[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4013-g54483c6
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4013-g54483c6 |
Date: |
Tue, 7 Jul 2020 10:12:14 -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, gawk-5.1-stable has been updated
via 54483c688b659b96cc930000444d5b34ee11d11c (commit)
via d5590b1ba64e2135036f0c5de0844a9cddec75f0 (commit)
from 12701888ede0f58d20c7bd9bdb4334d1bf10bce1 (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=54483c688b659b96cc930000444d5b34ee11d11c
commit 54483c688b659b96cc930000444d5b34ee11d11c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Jul 7 17:11:53 2020 +0300
Change flags to enums (for showing in GDB).
diff --git a/ChangeLog b/ChangeLog
index dc2b365..9d6df8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-07-07 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h: Turn all the flag defines into enums. GDB can then show
+ the bit maps directly.
+
2020-07-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
* node.c (r_dupnode): Sanitize the code, particularly for MPFR.
diff --git a/awk.h b/awk.h
index dfc25b7..0dc3d3e 100644
--- a/awk.h
+++ b/awk.h
@@ -363,9 +363,10 @@ typedef struct exp_node {
size_t reserved;
struct exp_node *rn;
unsigned long cnt;
- unsigned long reflags;
-# define CONSTANT 1
-# define FS_DFLT 2
+ enum reflagvals {
+ CONSTANT = 1,
+ FS_DFLT = 2,
+ } reflags;
} nodep;
struct {
@@ -390,79 +391,79 @@ typedef struct exp_node {
} val;
} sub;
NODETYPE type;
- unsigned int flags;
-
-/* type = Node_val */
- /*
- * STRING and NUMBER are mutually exclusive, except for the special
- * case of an uninitialized value, represented internally by
- * Nnull_string. They represent the type of a value as assigned.
- * Nnull_string has both STRING and NUMBER attributes, but all other
- * scalar values should have precisely one of these bits set.
- *
- * STRCUR and NUMCUR are not mutually exclusive. They represent that
- * the particular type of value is up to date. For example,
- *
- * a = 5 # NUMBER | NUMCUR
- * b = a "" # Adds STRCUR to a, since a string value
- * # is now available. But the type hasn't changed!
- *
- * a = "42" # STRING | STRCUR
- * b = a + 0 # Adds NUMCUR to a, since numeric value
- * # is now available. But the type hasn't changed!
- *
- * USER_INPUT is the joker. When STRING|USER_INPUT is set, it means
- * "this is string data, but the user may have really wanted it to be a
- * number. If we have to guess, like in a comparison, turn it into a
- * number if the string is indeed numeric."
- * For example, gawk -v a=42 ....
- * Here, `a' gets STRING|STRCUR|USER_INPUT and then when used where
- * a number is needed, it gets turned into a NUMBER and STRING
- * is cleared. In that case, we leave the USER_INPUT in place, so
- * the combination NUMBER|USER_INPUT means it is a strnum a.k.a. a
- * "numeric string".
- *
- * WSTRCUR is for efficiency. If in a multibyte locale, and we
- * need to do something character based (substr, length, etc.)
- * we create the corresponding wide character string and store it,
- * and add WSTRCUR to the flags so that we don't have to do the
- * conversion more than once.
- *
- * The NUMINT flag may be used with a value of any type -- NUMBER,
- * STRING, or STRNUM. It indicates that the string representation
- * equals the result of sprintf("%ld", <numeric value>). So, for
- * example, NUMINT should NOT be set if it's a strnum or string value
- * where the string is " 1" or "01" or "+1" or "1.0" or "0.1E1". This
- * is a hint to indicate that an integer array optimization may be
- * used when this value appears as a subscript.
- *
- * We hope that the rest of the flags are self-explanatory. :-)
- */
-# define MALLOC 0x0001 /* stptr can be free'd, i.e. not a
field node pointing into a shared buffer */
-# define STRING 0x0002 /* assigned as string */
-# define STRCUR 0x0004 /* string value is current */
-# define NUMCUR 0x0008 /* numeric value is current */
-# define NUMBER 0x0010 /* assigned as number */
-# define USER_INPUT 0x0020 /* user input: if NUMERIC then
- * a NUMBER */
-# define INTLSTR 0x0040 /* use localized version */
-# define NUMINT 0x0080 /* numeric value is an integer */
-# define INTIND 0x0100 /* integral value is array index;
- * lazy conversion to string.
- */
-# define WSTRCUR 0x0200 /* wide str value is current */
-# define MPFN 0x0400 /* arbitrary-precision
floating-point number */
-# define MPZN 0x0800 /* arbitrary-precision integer */
-# define NO_EXT_SET 0x1000 /* extension cannot set a value
for this variable */
-# define NULL_FIELD 0x2000 /* this is the null field */
-
-/* type = Node_var_array */
-# define ARRAYMAXED 0x4000 /* array is at max size */
-# define HALFHAT 0x8000 /* half-capacity Hashed
Array Tree;
- * See cint_array.c */
-# define XARRAY 0x10000
-# define NUMCONSTSTR 0x20000 /* have string value for
numeric constant */
-# define REGEX 0x40000 /* this is a typed regex */
+ enum flagvals {
+ /* type = Node_val */
+ /*
+ * STRING and NUMBER are mutually exclusive, except for the
special
+ * case of an uninitialized value, represented internally by
+ * Nnull_string. They represent the type of a value as assigned.
+ * Nnull_string has both STRING and NUMBER attributes, but all
other
+ * scalar values should have precisely one of these bits set.
+ *
+ * STRCUR and NUMCUR are not mutually exclusive. They represent
that
+ * the particular type of value is up to date. For example,
+ *
+ * a = 5 # NUMBER | NUMCUR
+ * b = a "" # Adds STRCUR to a, since a string value
+ * # is now available. But the type hasn't
changed!
+ *
+ * a = "42" # STRING | STRCUR
+ * b = a + 0 # Adds NUMCUR to a, since numeric value
+ * # is now available. But the type hasn't
changed!
+ *
+ * USER_INPUT is the joker. When STRING|USER_INPUT is set, it
means
+ * "this is string data, but the user may have really wanted it
to be a
+ * number. If we have to guess, like in a comparison, turn it
into a
+ * number if the string is indeed numeric."
+ * For example, gawk -v a=42 ....
+ * Here, `a' gets STRING|STRCUR|USER_INPUT and then when used
where
+ * a number is needed, it gets turned into a NUMBER and STRING
+ * is cleared. In that case, we leave the USER_INPUT in place,
so
+ * the combination NUMBER|USER_INPUT means it is a strnum
a.k.a. a
+ * "numeric string".
+ *
+ * WSTRCUR is for efficiency. If in a multibyte locale, and we
+ * need to do something character based (substr, length, etc.)
+ * we create the corresponding wide character string and store
it,
+ * and add WSTRCUR to the flags so that we don't have to do the
+ * conversion more than once.
+ *
+ * The NUMINT flag may be used with a value of any type --
NUMBER,
+ * STRING, or STRNUM. It indicates that the string
representation
+ * equals the result of sprintf("%ld", <numeric value>). So, for
+ * example, NUMINT should NOT be set if it's a strnum or string
value
+ * where the string is " 1" or "01" or "+1" or "1.0" or
"0.1E1". This
+ * is a hint to indicate that an integer array optimization may
be
+ * used when this value appears as a subscript.
+ *
+ * We hope that the rest of the flags are self-explanatory. :-)
+ */
+ MALLOC = 0x0001, /* stptr can be free'd, i.e. not a
field node pointing into a shared buffer */
+ STRING = 0x0002, /* assigned as string */
+ STRCUR = 0x0004, /* string value is current */
+ NUMCUR = 0x0008, /* numeric value is current */
+ NUMBER = 0x0010, /* assigned as number */
+ USER_INPUT = 0x0020, /* user input: if NUMERIC then
+ * a NUMBER */
+ INTLSTR = 0x0040, /* use localized version */
+ NUMINT = 0x0080, /* numeric value is an integer */
+ INTIND = 0x0100, /* integral value is array index;
+ * lazy conversion to string.
+ */
+ WSTRCUR = 0x0200, /* wide str value is current */
+ MPFN = 0x0400, /* arbitrary-precision floating-point
number */
+ MPZN = 0x0800, /* arbitrary-precision integer */
+ NO_EXT_SET = 0x1000, /* extension cannot set a value for
this variable */
+ NULL_FIELD = 0x2000, /* this is the null field */
+
+ /* type = Node_var_array */
+ ARRAYMAXED = 0x4000, /* array is at max size */
+ HALFHAT = 0x8000, /* half-capacity Hashed Array
Tree;
+ * See cint_array.c */
+ XARRAY = 0x10000,
+ NUMCONSTSTR = 0x20000, /* have string value for
numeric constant */
+ REGEX = 0x40000, /* this is a typed regex */
+ } flags;
} NODE;
#define vname sub.nodep.name
@@ -944,30 +945,32 @@ typedef struct iobuf {
bool valid;
int errcode;
- int flag;
-# define IOP_IS_TTY 1
-# define IOP_AT_EOF 2
-# define IOP_CLOSED 4
-# define IOP_AT_START 8
+ enum iobuf_flags {
+ IOP_IS_TTY = 1,
+ IOP_AT_EOF = 2,
+ IOP_CLOSED = 4,
+ IOP_AT_START = 8,
+ } flag;
} IOBUF;
typedef void (*Func_ptr)(void);
/* structure used to dynamically maintain a linked-list of open files/pipes */
struct redirect {
- unsigned int flag;
-# define RED_FILE 1
-# define RED_PIPE 2
-# define RED_READ 4
-# define RED_WRITE 8
-# define RED_APPEND 16
-# define RED_NOBUF 32
-# define RED_USED 64 /* closed temporarily to reuse
fd */
-# define RED_EOF 128
-# define RED_TWOWAY 256
-# define RED_PTY 512
-# define RED_SOCKET 1024
-# define RED_TCP 2048
+ enum redirect_flags {
+ RED_FILE = 1,
+ RED_PIPE = 2,
+ RED_READ = 4,
+ RED_WRITE = 8,
+ RED_APPEND = 16,
+ RED_NOBUF = 32,
+ RED_USED = 64, /* closed temporarily to reuse fd */
+ RED_EOF = 128,
+ RED_TWOWAY = 256,
+ RED_PTY = 512,
+ RED_SOCKET = 1024,
+ RED_TCP = 2048,
+ } flag;
char *value;
FILE *ifp; /* input fp, needed for PIPES_SIMULATED */
IOBUF *iop;
@@ -982,10 +985,10 @@ struct redirect {
/* values for BINMODE, used as bit flags */
enum binmode_values {
- TEXT_TRANSLATE = 0, /* usual \r\n ---> \n translation */
- BINMODE_INPUT = 1, /* no translation for input files */
- BINMODE_OUTPUT = 2, /* no translation for output files */
- BINMODE_BOTH = 3 /* no translation for either */
+ TEXT_TRANSLATE = 0, /* usual \r\n ---> \n translation */
+ BINMODE_INPUT = 1, /* no translation for input files */
+ BINMODE_OUTPUT = 2, /* no translation for output files */
+ BINMODE_BOTH = 3 /* no translation for either */
};
/*
@@ -1139,12 +1142,11 @@ extern NODE *success_node;
extern struct block_header nextfree[];
extern bool field0_valid;
-extern int do_flags;
extern bool do_itrace; /* separate so can poke from a debugger */
extern SRCFILE *srcfiles; /* source files */
-enum do_flag_values {
+extern enum do_flag_values {
DO_LINT_INVALID = 0x00001, /* only warn about invalid */
DO_LINT_EXTENSIONS = 0x00002, /* warn about gawk extensions */
DO_LINT_ALL = 0x00004, /* warn about all things */
@@ -1161,7 +1163,7 @@ enum do_flag_values {
DO_PROFILE = 0x02000, /* profile the program */
DO_DEBUG = 0x04000, /* debug the program */
DO_MPFR = 0x08000, /* arbitrary-precision floating-point
math */
-};
+} do_flags;
#define do_traditional (do_flags & DO_TRADITIONAL)
#define do_posix (do_flags & DO_POSIX)
diff --git a/main.c b/main.c
index 25008c3..7c35139 100644
--- a/main.c
+++ b/main.c
@@ -145,7 +145,7 @@ static void parse_args(int argc, char **argv);
static void set_locale_stuff(void);
static bool stopped_early = false;
-int do_flags = false;
+enum do_flag_values do_flags = 0;
bool do_itrace = false; /* provide simple instruction
trace */
bool do_optimize = true; /* apply default optimizations */
static int do_nostalgia = false; /* provide a blast from the past */
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=d5590b1ba64e2135036f0c5de0844a9cddec75f0
commit d5590b1ba64e2135036f0c5de0844a9cddec75f0
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Jul 7 17:09:32 2020 +0300
Improve r_dupnode.
diff --git a/ChangeLog b/ChangeLog
index 8ff8f82..dc2b365 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-07-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * node.c (r_dupnode): Sanitize the code, particularly for MPFR.
+
2020-07-05 Arnold D. Robbins <arnold@skeeve.com>
Bug fixes in MPFR, reported by Hyunho Cho<mug896@naver.com>.
diff --git a/node.c b/node.c
index 04a90ad..2db6a1e 100644
--- a/node.c
+++ b/node.c
@@ -310,24 +310,17 @@ r_dupnode(NODE *n)
return n;
}
#endif
+ getnode(r);
+ *r = *n;
#ifdef HAVE_MPFR
if ((n->flags & MPZN) != 0) {
- r = mpg_integer();
+ mpz_init(r->mpg_i);
mpz_set(r->mpg_i, n->mpg_i);
- r->flags = n->flags;
- r->strndmode = MPFR_round_mode;
} else if ((n->flags & MPFN) != 0) {
- r = mpg_float();
+ mpfr_init(r->mpg_numbr);
int tval = mpfr_set(r->mpg_numbr, n->mpg_numbr, ROUND_MODE);
IEEE_FMT(r->mpg_numbr, tval);
- r->flags = n->flags;
- r->strndmode = MPFR_round_mode;
- } else {
-#endif
- getnode(r);
- *r = *n;
-#ifdef HAVE_MPFR
}
#endif
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 +++
awk.h | 204 +++++++++++++++++++++++++++++++-------------------------------
main.c | 2 +-
node.c | 15 ++---
4 files changed, 117 insertions(+), 113 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4013-g54483c6,
Arnold Robbins <=