gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-943


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-943-g140a4a8
Date: Sat, 23 Jul 2016 18:59:58 +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, gawk-4.1-stable has been updated
       via  140a4a886edc231f1c5f02c6cd4c82effe58139e (commit)
      from  2a92e9d3cb8ba907376837dadd03abc6ad09b741 (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=140a4a886edc231f1c5f02c6cd4c82effe58139e

commit 140a4a886edc231f1c5f02c6cd4c82effe58139e
Author: Arnold D. Robbins <address@hidden>
Date:   Sat Jul 23 21:59:40 2016 +0300

    Fix do_print for use with strnums.

diff --git a/ChangeLog b/ChangeLog
index 27711b8..54bd868 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-23         Andrew J. Schorr     <address@hidden>
+
+       * builtin.c (do_print): Improve logic for formatting
+       numeric values.
+
 2016-07-19         Andrew J. Schorr     <address@hidden>
 
        * eval.c (set_LINT): Simplify the code considerably.
diff --git a/builtin.c b/builtin.c
index 6742466..0163b81 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2179,12 +2179,8 @@ do_print(int nargs, int redirtype)
                        fatal(_("attempt to use array `%s' in a scalar 
context"), array_vname(tmp));
                }
 
-               if ((tmp->flags & (NUMBER|STRING)) == NUMBER) {
-                       if (OFMTidx == CONVFMTidx)
-                               args_array[i] = force_string(tmp);
-                       else
-                               args_array[i] = format_val(OFMT, OFMTidx, tmp);
-               }
+               if ((tmp->flags & STRCUR) == 0 || (tmp->stfmt != -1 && 
tmp->stfmt != OFMTidx))
+                       args_array[i] = format_val(OFMT, OFMTidx, tmp);
        }
 
        if (redir_exp != NULL) {
diff --git a/test/ChangeLog b/test/ChangeLog
index f7c2892..8939b6f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-17         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (ofmtstrnum): New test.
+       * ofmtstrnu.awk, ofmtstrnum.ok: New files.
+
 2016-07-01         Arnold D. Robbins     <address@hidden>
 
        * arrayind1.awk, arrayind1.ok: Comment out prints to stderr to
diff --git a/test/Makefile.am b/test/Makefile.am
index 34cc954..0bda377 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -674,6 +674,8 @@ EXTRA_DIST = \
        ofmts.awk \
        ofmts.in \
        ofmts.ok \
+       ofmtstrnum.awk \
+       ofmtstrnum.ok \
        ofs1.awk \
        ofs1.in \
        ofs1.ok \
@@ -1080,7 +1082,8 @@ BASIC_TESTS = \
        nasty nasty2 negexp negrange nested nfldstr nfloop nfneg nfset nlfldsep 
\
        nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
        noparms nors nulinsrc nulrsend numindex numsubstr \
-       octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
+       octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofmtstrnum ofs1 onlynl \
+       opasnidx opasnslf \
        paramasfunc1 paramasfunc2 \
        paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
        pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
diff --git a/test/Makefile.in b/test/Makefile.in
index 5baefb4..ff1d8e0 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -931,6 +931,8 @@ EXTRA_DIST = \
        ofmts.awk \
        ofmts.in \
        ofmts.ok \
+       ofmtstrnum.awk \
+       ofmtstrnum.ok \
        ofs1.awk \
        ofs1.in \
        ofs1.ok \
@@ -1336,7 +1338,8 @@ BASIC_TESTS = \
        nasty nasty2 negexp negrange nested nfldstr nfloop nfneg nfset nlfldsep 
\
        nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
        noparms nors nulinsrc nulrsend numindex numsubstr \
-       octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
+       octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofmtstrnum ofs1 onlynl \
+       opasnidx opasnslf \
        paramasfunc1 paramasfunc2 \
        paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
        pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
@@ -3233,6 +3236,11 @@ ofmts:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+ofmtstrnum:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 ofs1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 57b5c5a..7d50a4b 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -620,6 +620,11 @@ ofmts:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+ofmtstrnum:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 ofs1:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/ofmtstrnum.awk b/test/ofmtstrnum.awk
new file mode 100644
index 0000000..805dad7
--- /dev/null
+++ b/test/ofmtstrnum.awk
@@ -0,0 +1,7 @@
+BEGIN {
+       split(" 1", f, "|")
+       OFMT = "%.1f"
+       print f[1]
+       x = f[1] + 0
+       print f[1]
+}
diff --git a/test/ofmtstrnum.ok b/test/ofmtstrnum.ok
new file mode 100644
index 0000000..ae95586
--- /dev/null
+++ b/test/ofmtstrnum.ok
@@ -0,0 +1,2 @@
+ 1
+ 1

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

Summary of changes:
 ChangeLog           |    5 +++++
 builtin.c           |    8 ++------
 test/ChangeLog      |    5 +++++
 test/Makefile.am    |    5 ++++-
 test/Makefile.in    |   10 +++++++++-
 test/Maketests      |    5 +++++
 test/ofmtstrnum.awk |    7 +++++++
 test/ofmtstrnum.ok  |    2 ++
 8 files changed, 39 insertions(+), 8 deletions(-)
 create mode 100644 test/ofmtstrnum.awk
 create mode 100644 test/ofmtstrnum.ok


hooks/post-receive
-- 
gawk



reply via email to

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