gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, master, updated. gawk-4.1.0-4243-g9c81550


From: Arnold Robbins
Subject: [SCM] gawk branch, master, updated. gawk-4.1.0-4243-g9c81550
Date: Mon, 1 Feb 2021 01:14:23 -0500 (EST)

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, master has been updated
       via  9c81550ac0f386929462a200e57a1dbe0953fe10 (commit)
      from  7c12765b99d41b8842d29a0bba37794744bb6834 (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=9c81550ac0f386929462a200e57a1dbe0953fe10

commit 9c81550ac0f386929462a200e57a1dbe0953fe10
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Feb 1 08:13:49 2021 +0200

    Updates to inf/nan test programs.

diff --git a/awklib/eg/test-programs/gen-float-table.awk 
b/awklib/eg/test-programs/gen-float-table.awk
index c35f2df..ea6269c 100644
--- a/awklib/eg/test-programs/gen-float-table.awk
+++ b/awklib/eg/test-programs/gen-float-table.awk
@@ -50,8 +50,8 @@ BEGIN {
                                                 values[i],
                                                names[k],
                                                compare[j],
-                                               the_func(values[i], compare[j]) 
?
-                                                        "true" : "false");
+                                               @the_func(values[i], 
compare[j]) ?
+                                                        "True" : "False");
                        }
                        printf("\n");
                }
diff --git a/awklib/eg/test-programs/gen-float-table.c 
b/awklib/eg/test-programs/gen-float-table.c
index ae1d5dd..ba3a0d0 100644
--- a/awklib/eg/test-programs/gen-float-table.c
+++ b/awklib/eg/test-programs/gen-float-table.c
@@ -50,7 +50,7 @@ int main()
                 printf("%g %s %g -> %s\n", values[i],
                                 functions[k].name,
                                 compare[j],
-                    functions[k].func(values[i], compare[j]) ? "true" : 
"false");
+                    functions[k].func(values[i], compare[j]) ? "True" : 
"False");
             }
             printf("\n");
         }
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 4c086ff..02a87af 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,10 @@
+2021-02-01         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawktexi.in (Strange values): Fix a typo in the awk test
+       program. Make the C and Awk versions print "True" and
+       "False" to match Python, making comparisons easier. Thanks to
+       Antonio Columbo for the suggestions.
+
 2021-01-25         Arnold D. Robbins     <arnold@skeeve.com>
 
        * gawktexi.in: Fix some spelling errors.
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 956bb54..82c06b5 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -34041,36 +34041,36 @@ they handle NaN and infinity values.
 @ignore
 @c file eg/test-programs/gen-float-table.awk
 function eq(left, right)
-{
+@{
         return left == right
-}
+@}
 
 function ne(left, right)
-{
+@{
         return left != right
-}
+@}
 
 function lt(left, right)
-{
+@{
         return left <  right
-}
+@}
 
 function le(left, right)
-{
+@{
         return left <= right
-}
+@}
 
 function gt(left, right)
-{
+@{
         return left >  right
-}
+@}
 
 function ge(left, right)
-{
+@{
         return left >= right
-}
+@}
 
-BEGIN {
+BEGIN @{
        nan = sqrt(-1)
        inf = -log(0)
         split("== != < <= > >=", names)
@@ -34084,21 +34084,21 @@ BEGIN {
         compare[4] = values[3] = -log(0.0)     # inf
         compare[5] = values[4] =  log(0.0)     # -inf
 
-       for (i = 1; i in values; i++) {
-               for (j = 1; j in compare; j++) {
-                       for (k = 1; k in names; k++) {
+       for (i = 1; i in values; i++) @{
+               for (j = 1; j in compare; j++) @{
+                       for (k = 1; k in names; k++) @{
                                the_func = funcs[k]
                                printf("%g %s %g -> %s\n",
                                                 values[i],
                                                names[k],
                                                compare[j],
-                                               @the_func(values[i], 
compare[j]) ?
-                                                        "true" : "false");
-                       }
+                                               @@the_func(values[i], 
compare[j]) ?
+                                                        "True" : "False");
+                       @}
                        printf("\n");
-               }
-       }
-}
+               @}
+       @}
+@}
 @c endfile
 @end ignore
 
@@ -34109,9 +34109,9 @@ BEGIN {
 #include <stdbool.h>
 
 #define def_func(name, op) \
-    bool name(double left, double right) { \
+    bool name(double left, double right) @{ \
         return left op right; \
-    }
+    @}
 
 def_func(eq, ==)
 def_func(ne, !=)
@@ -34120,50 +34120,50 @@ def_func(le, <=)
 def_func(gt, >)
 def_func(ge, >=)
 
-struct {
+struct @{
     const char *name;
     bool (*func)(double left, double right);
-} functions[] = {
-    { "==", eq },
-    { "!=", ne },
-    { "< ", lt },
-    { "<=", le },
-    { "> ", gt },
-    { ">=", ge },
-    { 0, 0 }
-};
+@} functions[] = @{
+    @{ "==", eq @},
+    @{ "!=", ne @},
+    @{ "< ", lt @},
+    @{ "<=", le @},
+    @{ "> ", gt @},
+    @{ ">=", ge @},
+    @{ 0, 0 @}
+@};
 
 int main()
-{
-    double values[] = {
+@{
+    double values[] = @{
         -sqrt(-1),     // nan
         sqrt(-1),      // -nan
         -log(0.0),     // inf
         log(0.0)       // -inf
-    };
-    double compare[] = { 2.0,
+    @};
+    double compare[] = @{ 2.0,
         -sqrt(-1),     // nan
         sqrt(-1),      // -nan
         -log(0.0),     // inf
         log(0.0)       // -inf
-    };
+    @};
 
     int i, j, k;
 
-    for (i = 0; i < 4; i++) {
-        for (j = 0; j < 5; j++) {
-            for (k = 0; functions[k].name != NULL; k++) {
+    for (i = 0; i < 4; i++) @{
+        for (j = 0; j < 5; j++) @{
+            for (k = 0; functions[k].name != NULL; k++) @{
                 printf("%g %s %g -> %s\n", values[i],
                                 functions[k].name,
                                 compare[j],
-                    functions[k].func(values[i], compare[j]) ? "true" : 
"false");
-            }
+                    functions[k].func(values[i], compare[j]) ? "True" : 
"False");
+            @}
             printf("\n");
-        }
-    }
+        @}
+    @}
 
     return 0;
-}
+@}
 @c endfile
 @end ignore
 
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index b463e6b..fb23735 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -32977,36 +32977,36 @@ they handle NaN and infinity values.
 @ignore
 @c file eg/test-programs/gen-float-table.awk
 function eq(left, right)
-{
+@{
         return left == right
-}
+@}
 
 function ne(left, right)
-{
+@{
         return left != right
-}
+@}
 
 function lt(left, right)
-{
+@{
         return left <  right
-}
+@}
 
 function le(left, right)
-{
+@{
         return left <= right
-}
+@}
 
 function gt(left, right)
-{
+@{
         return left >  right
-}
+@}
 
 function ge(left, right)
-{
+@{
         return left >= right
-}
+@}
 
-BEGIN {
+BEGIN @{
        nan = sqrt(-1)
        inf = -log(0)
         split("== != < <= > >=", names)
@@ -33020,21 +33020,21 @@ BEGIN {
         compare[4] = values[3] = -log(0.0)     # inf
         compare[5] = values[4] =  log(0.0)     # -inf
 
-       for (i = 1; i in values; i++) {
-               for (j = 1; j in compare; j++) {
-                       for (k = 1; k in names; k++) {
+       for (i = 1; i in values; i++) @{
+               for (j = 1; j in compare; j++) @{
+                       for (k = 1; k in names; k++) @{
                                the_func = funcs[k]
                                printf("%g %s %g -> %s\n",
                                                 values[i],
                                                names[k],
                                                compare[j],
-                                               @the_func(values[i], 
compare[j]) ?
-                                                        "true" : "false");
-                       }
+                                               @@the_func(values[i], 
compare[j]) ?
+                                                        "True" : "False");
+                       @}
                        printf("\n");
-               }
-       }
-}
+               @}
+       @}
+@}
 @c endfile
 @end ignore
 
@@ -33045,9 +33045,9 @@ BEGIN {
 #include <stdbool.h>
 
 #define def_func(name, op) \
-    bool name(double left, double right) { \
+    bool name(double left, double right) @{ \
         return left op right; \
-    }
+    @}
 
 def_func(eq, ==)
 def_func(ne, !=)
@@ -33056,50 +33056,50 @@ def_func(le, <=)
 def_func(gt, >)
 def_func(ge, >=)
 
-struct {
+struct @{
     const char *name;
     bool (*func)(double left, double right);
-} functions[] = {
-    { "==", eq },
-    { "!=", ne },
-    { "< ", lt },
-    { "<=", le },
-    { "> ", gt },
-    { ">=", ge },
-    { 0, 0 }
-};
+@} functions[] = @{
+    @{ "==", eq @},
+    @{ "!=", ne @},
+    @{ "< ", lt @},
+    @{ "<=", le @},
+    @{ "> ", gt @},
+    @{ ">=", ge @},
+    @{ 0, 0 @}
+@};
 
 int main()
-{
-    double values[] = {
+@{
+    double values[] = @{
         -sqrt(-1),     // nan
         sqrt(-1),      // -nan
         -log(0.0),     // inf
         log(0.0)       // -inf
-    };
-    double compare[] = { 2.0,
+    @};
+    double compare[] = @{ 2.0,
         -sqrt(-1),     // nan
         sqrt(-1),      // -nan
         -log(0.0),     // inf
         log(0.0)       // -inf
-    };
+    @};
 
     int i, j, k;
 
-    for (i = 0; i < 4; i++) {
-        for (j = 0; j < 5; j++) {
-            for (k = 0; functions[k].name != NULL; k++) {
+    for (i = 0; i < 4; i++) @{
+        for (j = 0; j < 5; j++) @{
+            for (k = 0; functions[k].name != NULL; k++) @{
                 printf("%g %s %g -> %s\n", values[i],
                                 functions[k].name,
                                 compare[j],
-                    functions[k].func(values[i], compare[j]) ? "true" : 
"false");
-            }
+                    functions[k].func(values[i], compare[j]) ? "True" : 
"False");
+            @}
             printf("\n");
-        }
-    }
+        @}
+    @}
 
     return 0;
-}
+@}
 @c endfile
 @end ignore
 

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

Summary of changes:
 awklib/eg/test-programs/gen-float-table.awk |  4 +-
 awklib/eg/test-programs/gen-float-table.c   |  2 +-
 doc/ChangeLog                               |  7 +++
 doc/gawk.texi                               | 94 ++++++++++++++---------------
 doc/gawktexi.in                             | 94 ++++++++++++++---------------
 5 files changed, 104 insertions(+), 97 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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