gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, feature/printf-fixes, created. gawk-4.1.0-5485-gf3c36


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/printf-fixes, created. gawk-4.1.0-5485-gf3c36862
Date: Tue, 11 Jun 2024 12:02:39 -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/printf-fixes has been created
        at  f3c36862834aefdf1a5fa0b7264815d19b61aaad (commit)

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

commit f3c36862834aefdf1a5fa0b7264815d19b61aaad
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 11 18:46:53 2024 +0300

    Final fix for non -M mode.

diff --git a/builtin.c b/builtin.c
index ce7f54eb..eb2b6bee 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1509,11 +1509,13 @@ mpf1:
                        prec = cend - cp;
        pr_tail:
                        if (! lj) {
-                               if (fw == 0 && have_prec && prec == 0 && 
signchar == ' ')
-                                       fw = 1; // make the loop run once
-                               while (fw > prec) {
-                                       bchunk_one(fill);
-                                       fw--;
+                               if (fw == 0 && have_prec && prec == 0 && 
signchar) {
+                                       bchunk_one(& signchar);
+                               } else {
+                                       while (fw > prec) {
+                                               bchunk_one(fill);
+                                               fw--;
+                                       }
                                }
                        }
                        copy_count = prec;

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=55fd23fceb1d439840916985c17cf6513bc3c8c1

commit 55fd23fceb1d439840916985c17cf6513bc3c8c1
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 11 18:42:14 2024 +0300

    Next fix.

diff --git a/builtin.c b/builtin.c
index 7eb6733c..ce7f54eb 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1509,6 +1509,8 @@ mpf1:
                        prec = cend - cp;
        pr_tail:
                        if (! lj) {
+                               if (fw == 0 && have_prec && prec == 0 && 
signchar == ' ')
+                                       fw = 1; // make the loop run once
                                while (fw > prec) {
                                        bchunk_one(fill);
                                        fw--;

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=289831b7ae8457add0414a9994a949e739c9b48c

commit 289831b7ae8457add0414a9994a949e739c9b48c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 11 18:22:24 2024 +0300

    Next fix.

diff --git a/builtin.c b/builtin.c
index f901a4fa..7eb6733c 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1429,7 +1429,7 @@ mpf1:
                         *      printf("%#.0o\n", 0);
                         * prints a single 0.
                         */
-                       if (! alt && have_prec && prec == 0 && tmpval == 0)
+                       if ((! alt || base != 8) && have_prec && prec == 0 && 
tmpval == 0)
                                goto pr_tail;
 
                        if (tmpval < 0) {

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=621e69138141f9ebd6f01007860b8d95b7f29874

commit 621e69138141f9ebd6f01007860b8d95b7f29874
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Tue Jun 11 17:24:09 2024 +0300

    First round of printf fixes.

diff --git a/builtin.c b/builtin.c
index 275456b3..f901a4fa 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1058,7 +1058,7 @@ check_pos:
                case ' ':               /* print ' ' or '-' */
                                        /* 'space' flag is ignored */
                                        /* if '+' already present  */
-                       if (signchar != false)
+                       if (signchar != '\0')
                                goto check_pos;
                        /* FALL THROUGH */
                case '+':               /* print '+' or '-' */
@@ -1500,7 +1500,7 @@ mpf1:
                                                cp += 2;
                                                fw -= 2;
                                        }
-                               } else if (base == 8)
+                               } else if (base == 8 && ! have_prec)
                                        PREPEND('0');
                        }
                        base = 0;
@@ -1552,6 +1552,13 @@ mpf1:
                                if (do_lint)
                                        lintwarn(_("[s]printf: value %s is out 
of range for `%%%c' format"),
                                                                nan_inf_val, 
cs1);
+                               if (! lj) {
+                                       fw -= strlen(nan_inf_val);
+                                       while (fw > prec) {
+                                               bchunk_one(fill);
+                                               fw--;
+                                       }
+                               }
                                bchunk(nan_inf_val, strlen(nan_inf_val));
                                s0 = s1;
                                break;
@@ -1612,7 +1619,7 @@ mpf1:
                                *cp++ = '-';
                        if (signchar)
                                *cp++ = signchar;
-                       if (alt)
+                       if (alt && ! is_zero(arg))
                                *cp++ = '#';
                        if (zero_flag)
                                *cp++ = '0';

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


hooks/post-receive
-- 
gawk



reply via email to

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