gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, feature/api-parser, updated. gawk-4.1.0-


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, feature/api-parser, updated. gawk-4.1.0-2476-g61b4108
Date: Mon, 27 Mar 2017 14:28:24 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, feature/api-parser has been updated
       via  61b4108f82f30deaabf03eb6dbc0e64edeffdb6e (commit)
      from  70f73831de55d63263839d5fa6ac44dbc2c38491 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=61b4108f82f30deaabf03eb6dbc0e64edeffdb6e

commit 61b4108f82f30deaabf03eb6dbc0e64edeffdb6e
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Mar 27 21:27:50 2017 +0300

    Minor edits in feature/api-parser prepatory to merging.

diff --git a/ChangeLog b/ChangeLog
index a06a21f..d740b43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2017-03-27         Arnold D. Robbins     <address@hidden>
 
+       * field.c (parse_field_func_t): New typedef. Used as needed.
+       (fw_parse_field): Edit comment about resetting shift state.
+       (set_parser): Fix leading comment's style and type of argument.
+       (set_FIELDWIDTHS): Improve the fatal error message.
+       * gawkapi.h: Minor edits in some comments.
+
+2017-03-27         Arnold D. Robbins     <address@hidden>
+
        Cause EPIPE errors to stdout to generate a real SIGPIPE.
 
        * awk.h (die_via_sigpipe): New macro.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 2773847..a3a50cd 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-27         Arnold D. Robbins     <address@hidden>
+
+       * readdir.c: Minor edits.
+       * readdir_test.c: Same minor edits, update copyright year,
+       bump version of extension in case this ever becomes the real one.
+
 2017-03-23         Arnold D. Robbins     <address@hidden>
 
        * readdir.c (dir_get_record): Add additional parameter to make types
diff --git a/extension/readdir.c b/extension/readdir.c
index b871d13..2e34456 100644
--- a/extension/readdir.c
+++ b/extension/readdir.c
@@ -51,7 +51,7 @@
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
 #else
-#error Cannot compile the dirent extension on this system!
+#error Cannot compile the readdir extension on this system!
 #endif
 
 #ifdef __MINGW32__
@@ -137,6 +137,7 @@ ftype(struct dirent *entry, const char *dirname)
 }
 
 /* get_inode --- get the inode of a file */
+
 static long long
 get_inode(struct dirent *entry, const char *dirname)
 {
@@ -199,7 +200,7 @@ dir_get_record(char **out, awk_input_buf_t *iobuf, int 
*errcode,
                return EOF;
        }
 
-       ino = get_inode (dirent, iobuf->name);
+       ino = get_inode(dirent, iobuf->name);
 
 #if __MINGW32__
        len = sprintf(the_dir->buf, "%I64u/%s", ino, dirent->d_name);
diff --git a/extension/readdir_test.c b/extension/readdir_test.c
index d21b4e9..6d6ee13 100644
--- a/extension/readdir_test.c
+++ b/extension/readdir_test.c
@@ -10,7 +10,7 @@
  */
 
 /*
- * Copyright (C) 2012-2014 the Free Software Foundation, Inc.
+ * Copyright (C) 2012-2014, 2017 the Free Software Foundation, Inc.
  *
  * This file is part of GAWK, the GNU implementation of the
  * AWK Programming Language.
@@ -51,7 +51,7 @@
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
 #else
-#error Cannot compile the dirent extension on this system!
+#error Cannot compile the readdir extension on this system!
 #endif
 
 #ifdef __MINGW32__
@@ -73,7 +73,7 @@
 
 static const gawk_api_t *api;  /* for convenience macros to work */
 static awk_ext_id_t *ext_id;
-static const char *ext_version = "readdir extension: version 1.0";
+static const char *ext_version = "readdir extension: version 2.0";
 
 static awk_bool_t init_readdir(void);
 static awk_bool_t (*init_func)(void) = init_readdir;
@@ -142,6 +142,7 @@ ftype(struct dirent *entry, const char *dirname)
 }
 
 /* get_inode --- get the inode of a file */
+
 static long long
 get_inode(struct dirent *entry, const char *dirname)
 {
@@ -204,7 +205,7 @@ dir_get_record(char **out, awk_input_buf_t *iobuf, int 
*errcode,
                return EOF;
        }
 
-       ino = get_inode (dirent, iobuf->name);
+       ino = get_inode(dirent, iobuf->name);
 
 #if __MINGW32__
        len = sprintf(the_dir->buf, "%I64u", ino);
diff --git a/field.c b/field.c
index bd333c9..b5f28c1 100644
--- a/field.c
+++ b/field.c
@@ -40,15 +40,15 @@ typedef void (* Setfunc)(long, char *, long, NODE *);
 
 /* is the API currently overriding the default parsing mechanism? */
 static bool api_parser_override = false;
-static long (*parse_field)(long, char **, int, NODE *,
+typedef long (*parse_field_func_t)(long, char **, int, NODE *,
                             Regexp *, Setfunc, NODE *, NODE *, bool);
+static parse_field_func_t parse_field;
 /*
  * N.B. The normal_parse_field function pointer contains the parse_field value
  * that should be used except when API field parsing is overriding the default
  * field parsing mechanism.
  */
-static long (*normal_parse_field)(long, char **, int, NODE *,
-                            Regexp *, Setfunc, NODE *, NODE *, bool);
+static parse_field_func_t normal_parse_field;
 static long re_parse_field(long, char **, int, NODE *,
                             Regexp *, Setfunc, NODE *, NODE *, bool);
 static long def_parse_field(long, char **, int, NODE *,
@@ -771,9 +771,10 @@ fw_parse_field(long up_to, /* parse only up to this field 
number */
                return nf;
        if (gawk_mb_cur_max > 1 && fw->use_chars) {
                /*
-                * XXX This may be a bug. Most likely, shift state should
-                * persist across all fields in a record, if not across record
-                * boundaries as well.
+                * Reset the shift state for each field, since there might
+                * be who-knows-what kind of stuff in between fields,
+                * and we assume each field starts with a valid (possibly
+                * multibyte) character.
                 */
                memset(&mbs, 0, sizeof(mbstate_t));
                while (nf < up_to) {
@@ -1104,10 +1105,10 @@ do_patsplit(int nargs)
        return tmp;
 }
 
-/* set_parser: update the current (non-API) parser */
+/* set_parser --- update the current (non-API) parser */
 
 static void
-set_parser(long (*func)(long, char **, int, NODE *, Regexp *, Setfunc, NODE *, 
NODE *, bool))
+set_parser(parse_field_func_t func)
 {
        normal_parse_field = func;
        if (! api_parser_override && parse_field != func) {
@@ -1149,7 +1150,7 @@ set_FIELDWIDTHS()
 
        if (FIELDWIDTHS == NULL) {
                emalloc(FIELDWIDTHS, awk_fieldwidth_info_t *, 
awk_fieldwidth_info_size(fw_alloc), "set_FIELDWIDTHS");
-               FIELDWIDTHS->use_chars = awk_true;
+               FIELDWIDTHS->use_chars = true;
        }
        FIELDWIDTHS->nf = 0;
        for (i = 0; ; i++) {
@@ -1201,8 +1202,8 @@ set_FIELDWIDTHS()
        }
 
        if (fatal_error)
-               fatal(_("invalid FIELDWIDTHS value, near `%s'"),
-                             scan);
+               fatal(_("invalid FIELDWIDTHS value, for field %d, near `%s'"),
+                             i, scan);
 }
 
 /* set_FS --- handle things when FS is assigned to */
diff --git a/gawkapi.h b/gawkapi.h
index da53811..a8d6279 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -124,16 +124,18 @@ typedef enum awk_bool {
  * field lengths are specified in terms of bytes or potentially multi-byte
  * characters. Performance will be better if the values are supplied in
  * terms of bytes. The fields[0].skip value indicates how many bytes (or
- * characters to skip) before $1, and fields[0].len is the length of $1, etc.
+ * characters) to skip before $1, and fields[0].len is the length of $1, etc.
  */
+
 typedef struct {
        awk_bool_t      use_chars;      /* false ==> use bytes */
        size_t          nf;
        struct awk_field_info {
-               size_t  skip;   /* # to skip before field starts */
+               size_t  skip;   /* amount to skip before field starts */
                size_t len;     /* length of field */
-       } fields[1];    /* actual dimension should be nf */
+       } fields[1];            /* actual dimension should be nf */
 } awk_fieldwidth_info_t;
+
 /*
  * This macro calculates the total struct size needed. This is useful when
  * calling malloc or realloc.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |  8 ++++++++
 extension/ChangeLog      |  6 ++++++
 extension/readdir.c      |  5 +++--
 extension/readdir_test.c |  9 +++++----
 field.c                  | 23 ++++++++++++-----------
 gawkapi.h                |  8 +++++---
 6 files changed, 39 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]