gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-186


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, feature/fixtype, updated. gawk-4.1.0-1860-g41785b1
Date: Mon, 27 Jun 2016 00:26:44 +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  41785b1a222d34f4e0e0a3ab4fd15f94f988ca39 (commit)
      from  e18ebe10166e2c63f3385666978b678fe6ce67a2 (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=41785b1a222d34f4e0e0a3ab4fd15f94f988ca39

commit 41785b1a222d34f4e0e0a3ab4fd15f94f988ca39
Author: Andrew J. Schorr <address@hidden>
Date:   Sun Jun 26 20:26:05 2016 -0400

    Do not use OFMT or CONVFMT for strnum values.

diff --git a/ChangeLog b/ChangeLog
index 3ce9292..82a688f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-26         Andrew J. Schorr     <address@hidden>
+
+       * builtin.c (do_print): Do not use OFMT to print strnum values. We
+       accomplish this by calling format_val for a NUMBER only
+       if there is no string currently available, or if stfmt equals
+       neither -1 nor OFMTidx.
+
 2016-06-26         Arnold D. Robbins     <address@hidden>
 
        * awk.h: Edit some comments. Add others. Minor coding style changes.
diff --git a/builtin.c b/builtin.c
index 08ce327..a0b6e79 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2202,13 +2202,11 @@ do_print(int nargs, int redirtype)
                }
 
                if (tmp->type == Node_typedregex)
-                               args_array[i] = force_string(tmp);
-               else if ((fixtype(tmp)->flags & (NUMBER|STRING)) == NUMBER) {
-                       if (OFMTidx == CONVFMTidx)
-                               args_array[i] = force_string(tmp);
-                       else
-                               args_array[i] = format_val(OFMT, OFMTidx, tmp);
-               }
+                       args_array[i] = force_string(tmp);
+               else if ((fixtype(tmp)->flags & (NUMBER|STRING)) == NUMBER &&
+                        !((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 f5dbd57..cca91c5 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-26         Andrew J. Schorr     <address@hidden>
+
+       * strnum2.ok: Fix results, since print for a strnum should not be
+       affected by OFMT or CONVFMT.
+
 2016-06-22         Andrew J. Schorr     <address@hidden>
 
        * strnum2.awk, strnum2.ok: Improve test case to show both OFMT and
diff --git a/test/strnum2.ok b/test/strnum2.ok
index 65cfbde..63898bd 100644
--- a/test/strnum2.ok
+++ b/test/strnum2.ok
@@ -1,4 +1,4 @@
-1.2
-1.23
-1.2
-1.23
+ 1.234 
+ 1.234 
+ 1.234 
+ 1.234 

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

Summary of changes:
 ChangeLog       |    7 +++++++
 builtin.c       |   12 +++++-------
 test/ChangeLog  |    5 +++++
 test/strnum2.ok |    8 ++++----
 4 files changed, 21 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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