[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-195
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-1958-gcabd048 |
Date: |
Wed, 3 Aug 2016 18:29:21 +0000 (UTC) |
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/fixtype has been updated
via cabd048bab5ebc2f217cf874fcd96a9025a4faa4 (commit)
via 9907a598dca8f129422c42f8c4fa3b4e2c988221 (commit)
from a490de044200243f8240a011abdffe172082db36 (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=cabd048bab5ebc2f217cf874fcd96a9025a4faa4
commit cabd048bab5ebc2f217cf874fcd96a9025a4faa4
Merge: a490de0 9907a59
Author: Arnold D. Robbins <address@hidden>
Date: Wed Aug 3 21:29:14 2016 +0300
Merge branch 'master' into feature/fixtype
diff --cc awk.h
index e566558,ba572d3..aca90ff
--- a/awk.h
+++ b/awk.h
@@@ -1793,33 -1799,18 +1792,30 @@@ dupnode(NODE *n
}
#endif
-/* force_string --- force a node to have a string value */
+/*
+ * force_string_fmt --- force a node to have a string value in a given format.
+ * The string representation of a number may change due to whether it was most
+ * recently rendered with CONVFMT or OFMT, or due to changes in the CONVFMT
+ * and OFMT values. But if the value entered gawk as a string or strnum, then
+ * stfmt should be set to STFMT_UNUSED, and the string representation should
+ * not change.
+ */
static inline NODE *
-force_string(NODE *s)
+force_string_fmt(NODE *s, const char *fmtstr, int fmtidx)
{
- if (s->type == Node_typedregex)
- return dupnode(s->re_exp);
-
if ((s->flags & STRCUR) != 0
- && (s->stfmt == STFMT_UNUSED || s->stfmt == CONVFMTidx)
+ && (s->stfmt == STFMT_UNUSED || s->stfmt == fmtidx)
)
return s;
- return format_val(CONVFMT, CONVFMTidx, s);
+ return format_val(fmtstr, fmtidx, s);
}
+/* conceptually should be force_string_convfmt, but this is the typical case
*/
+#define force_string(s) force_string_fmt((s), CONVFMT,
CONVFMTidx)
+
+#define force_string_ofmt(s) force_string_fmt((s), OFMT, OFMTidx)
+
#ifdef GAWKDEBUG
#define unref r_unref
#define force_number str2number
@@@ -1866,9 -1854,9 +1859,9 @@@ force_number(NODE *n
static inline NODE *
fixtype(NODE *n)
{
- assert(n->type == Node_val || n->type == Node_typedregex);
+ assert(n->type == Node_val);
if (n->type == Node_val) {
- if ((n->flags & MAYBE_NUM) != 0)
+ if ((n->flags & (NUMCUR|MAYBE_NUM)) == MAYBE_NUM)
return force_number(n);
if ((n->flags & INTIND) != 0)
return force_string(n);
diff --cc builtin.c
index 0e257f1,b295cd2..8ab1a38
--- a/builtin.c
+++ b/builtin.c
@@@ -3936,12 -3942,9 +3932,9 @@@ do_typeof(int nargs
res = "array";
deref = false;
break;
- case Node_typedregex:
- res = "regexp";
- break;
case Node_val:
case Node_var:
- switch (arg->flags & (STRING|NUMBER|MAYBE_NUM)) {
+ switch (fixtype(arg)->flags & (STRING|NUMBER|MAYBE_NUM)) {
case STRING:
res = "string";
break;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 22 +
NEWS | 17 +-
awk.h | 9 +-
awkgram.c | 2121 ++++++++++++++++++++++++++----------------------------
awkgram.y | 70 +-
builtin.c | 17 +-
debug.c | 8 -
doc/ChangeLog | 6 +
doc/gawk.1 | 1 -
doc/gawk.info | 1044 +++++++++++++--------------
doc/gawk.texi | 75 +-
doc/gawktexi.in | 75 +-
eval.c | 6 -
interpret.h | 4 +-
profile.c | 23 +-
re.c | 6 +-
test/ChangeLog | 11 +
test/Makefile.am | 8 +-
test/Makefile.in | 38 +-
test/Maketests | 30 +-
test/gsubind.awk | 9 +-
test/gsubind.ok | 2 -
test/typeof1.awk | 6 +-
test/typeof1.ok | 3 -
test/typeof3.awk | 12 +-
test/typeof3.ok | 3 -
26 files changed, 1621 insertions(+), 2005 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-1958-gcabd048,
Arnold Robbins <=