gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4907-gb75abf5b


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4907-gb75abf5b
Date: Sat, 17 Sep 2022 14:54:18 -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, gawk-5.2-stable has been updated
       via  b75abf5b597630e562e91c9431c025d250045311 (commit)
      from  ae0de313fc51ab3862811a8152a92f68ece3bfb0 (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=b75abf5b597630e562e91c9431c025d250045311

commit b75abf5b597630e562e91c9431c025d250045311
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sat Sep 17 21:53:51 2022 +0300

    Bug fix for rwarray.c and doc and test updates.

diff --git a/doc/ChangeLog b/doc/ChangeLog
index ffe739de..0ccc653d 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-17         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawktexi.in (Extension Sample Read write array): Clarify how readall
+       works. Thanks to J Naman, <gawker@703n.com> for the prod.
+
 2022-09-04         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.2.0: Release tar ball made.
diff --git a/doc/gawk.info b/doc/gawk.info
index e292f253..110e724c 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -29431,9 +29431,9 @@ The 'rwarray' extension adds four functions, named 
'writea()',
      This function takes a string argument, which is the name of the
      file from which to read the contents of various global variables.
      For each variable in the file, the data is loaded unless the
-     variable already exists.  If the variable already exists, the data
-     for that variable in the file is ignored.  It returns one on
-     success, or zero upon failure.
+     variable has already been assigned a value or used as an array.  In
+     that case, the data for that variable in the file is ignored.  It
+     returns one on success, or zero upon failure.
 
    The array created by 'reada()' is identical to that written by
 'writea()' in the sense that the contents are the same.  However, due to
@@ -39767,93 +39767,93 @@ Ref: table-readdir-file-types1187438
 Node: Extension Sample Revout1188506
 Node: Extension Sample Rev2way1189095
 Node: Extension Sample Read write array1189835
-Node: Extension Sample Readfile1193000
-Node: Extension Sample Time1194095
-Node: Extension Sample API Tests1195847
-Node: gawkextlib1196339
-Node: Extension summary1199257
-Node: Extension Exercises1202959
-Node: Language History1204201
-Node: V7/SVR3.11205857
-Node: SVR41208009
-Node: POSIX1209443
-Node: BTL1210824
-Node: POSIX/GNU1211553
-Node: Feature History1217478
-Node: Common Extensions1235217
-Node: Ranges and Locales1236500
-Ref: Ranges and Locales-Footnote-11241116
-Ref: Ranges and Locales-Footnote-21241143
-Ref: Ranges and Locales-Footnote-31241378
-Node: Contributors1241601
-Node: History summary1247598
-Node: Installation1248978
-Node: Gawk Distribution1249922
-Node: Getting1250406
-Node: Extracting1251369
-Node: Distribution contents1253007
-Node: Unix Installation1260513
-Node: Quick Installation1261317
-Node: Compiling with MPFR1263737
-Node: Shell Startup Files1264427
-Node: Additional Configuration Options1265516
-Node: Configuration Philosophy1267831
-Node: Compiling from Git1270227
-Node: Building the Documentation1270782
-Node: Non-Unix Installation1272166
-Node: PC Installation1272626
-Node: PC Binary Installation1273467
-Node: PC Compiling1274340
-Node: PC Using1275446
-Node: Cygwin1278942
-Node: MSYS1280166
-Node: VMS Installation1280768
-Node: VMS Compilation1281487
-Ref: VMS Compilation-Footnote-11282894
-Node: VMS Dynamic Extensions1282952
-Ref: VMS Dynamic Extensions-Footnote-11284676
-Node: VMS Installation Details1284766
-Node: VMS Running1287028
-Node: VMS GNV1291307
-Node: Bugs1292021
-Node: Bug definition1292933
-Node: Bug address1296435
-Node: Usenet1299954
-Node: Performance bugs1301143
-Node: Asking for help1304064
-Node: Maintainers1306031
-Node: Other Versions1307038
-Node: Installation summary1315308
-Node: Notes1316665
-Node: Compatibility Mode1317459
-Node: Additions1318241
-Node: Accessing The Source1319166
-Node: Adding Code1320603
-Node: New Ports1327418
-Node: Derived Files1331793
-Ref: Derived Files-Footnote-11337453
-Ref: Derived Files-Footnote-21337488
-Ref: Derived Files-Footnote-31338086
-Node: Future Extensions1338200
-Node: Implementation Limitations1338858
-Node: Extension Design1340068
-Node: Old Extension Problems1341212
-Ref: Old Extension Problems-Footnote-11342730
-Node: Extension New Mechanism Goals1342787
-Ref: Extension New Mechanism Goals-Footnote-11346151
-Node: Extension Other Design Decisions1346340
-Node: Extension Future Growth1348453
-Node: Notes summary1349059
-Node: Basic Concepts1350217
-Node: Basic High Level1350898
-Ref: figure-general-flow1351180
-Ref: figure-process-flow1351866
-Ref: Basic High Level-Footnote-11355168
-Node: Basic Data Typing1355353
-Node: Glossary1358681
-Node: Copying1390568
-Node: GNU Free Documentation License1428111
-Node: Index1453231
+Node: Extension Sample Readfile1193021
+Node: Extension Sample Time1194116
+Node: Extension Sample API Tests1195868
+Node: gawkextlib1196360
+Node: Extension summary1199278
+Node: Extension Exercises1202980
+Node: Language History1204222
+Node: V7/SVR3.11205878
+Node: SVR41208030
+Node: POSIX1209464
+Node: BTL1210845
+Node: POSIX/GNU1211574
+Node: Feature History1217499
+Node: Common Extensions1235238
+Node: Ranges and Locales1236521
+Ref: Ranges and Locales-Footnote-11241137
+Ref: Ranges and Locales-Footnote-21241164
+Ref: Ranges and Locales-Footnote-31241399
+Node: Contributors1241622
+Node: History summary1247619
+Node: Installation1248999
+Node: Gawk Distribution1249943
+Node: Getting1250427
+Node: Extracting1251390
+Node: Distribution contents1253028
+Node: Unix Installation1260534
+Node: Quick Installation1261338
+Node: Compiling with MPFR1263758
+Node: Shell Startup Files1264448
+Node: Additional Configuration Options1265537
+Node: Configuration Philosophy1267852
+Node: Compiling from Git1270248
+Node: Building the Documentation1270803
+Node: Non-Unix Installation1272187
+Node: PC Installation1272647
+Node: PC Binary Installation1273488
+Node: PC Compiling1274361
+Node: PC Using1275467
+Node: Cygwin1278963
+Node: MSYS1280187
+Node: VMS Installation1280789
+Node: VMS Compilation1281508
+Ref: VMS Compilation-Footnote-11282915
+Node: VMS Dynamic Extensions1282973
+Ref: VMS Dynamic Extensions-Footnote-11284697
+Node: VMS Installation Details1284787
+Node: VMS Running1287049
+Node: VMS GNV1291328
+Node: Bugs1292042
+Node: Bug definition1292954
+Node: Bug address1296456
+Node: Usenet1299975
+Node: Performance bugs1301164
+Node: Asking for help1304085
+Node: Maintainers1306052
+Node: Other Versions1307059
+Node: Installation summary1315329
+Node: Notes1316686
+Node: Compatibility Mode1317480
+Node: Additions1318262
+Node: Accessing The Source1319187
+Node: Adding Code1320624
+Node: New Ports1327439
+Node: Derived Files1331814
+Ref: Derived Files-Footnote-11337474
+Ref: Derived Files-Footnote-21337509
+Ref: Derived Files-Footnote-31338107
+Node: Future Extensions1338221
+Node: Implementation Limitations1338879
+Node: Extension Design1340089
+Node: Old Extension Problems1341233
+Ref: Old Extension Problems-Footnote-11342751
+Node: Extension New Mechanism Goals1342808
+Ref: Extension New Mechanism Goals-Footnote-11346172
+Node: Extension Other Design Decisions1346361
+Node: Extension Future Growth1348474
+Node: Notes summary1349080
+Node: Basic Concepts1350238
+Node: Basic High Level1350919
+Ref: figure-general-flow1351201
+Ref: figure-process-flow1351887
+Ref: Basic High Level-Footnote-11355189
+Node: Basic Data Typing1355374
+Node: Glossary1358702
+Node: Copying1390589
+Node: GNU Free Documentation License1428132
+Node: Index1453252
 
 End Tag Table
 
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 61e740fc..809b8fd7 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -40177,7 +40177,8 @@ It returns one on success, or zero upon failure
 This function takes a string argument, which is the name of the
 file from which to read the contents of various global variables.
 For each variable in the file, the data is loaded unless the variable
-already exists. If the variable already exists, the data for that variable
+has already been assigned a value or used as an array.
+In that case, the data for that variable
 in the file is ignored.
 It returns one on success, or zero upon failure.
 @end table
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index a9274424..97445ace 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -39020,7 +39020,8 @@ It returns one on success, or zero upon failure
 This function takes a string argument, which is the name of the
 file from which to read the contents of various global variables.
 For each variable in the file, the data is loaded unless the variable
-already exists. If the variable already exists, the data for that variable
+has already been assigned a value or used as an array.
+In that case, the data for that variable
 in the file is ignored.
 It returns one on success, or zero upon failure.
 @end table
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 2fb0edff..db568436 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-17         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * rwarray.c (do_poke): Handle namespaced variables (foo::bar).
+       Thanks to J Naman, <gawker@703n.com> for the report.
+
 2022-09-04         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.2.0: Release tar ball made.
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 3e09102e..1a3a7d10 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -454,15 +454,34 @@ do_poke(awk_element_t *e)
 
        if (e->index.val_type != AWK_STRING)
                return awk_false;
-       /* So this is a bit tricky. If the program refers to the variable,
+       /*
+        * So this is a bit tricky. If the program refers to the variable,
         * then it will already exist in an undefined state after parsing.
         * If the program never refers to it, then the lookup fails.
         * We still need to create it in case the program accesses it via
-        * indirection through the SYMTAB table. */
-       if (sym_lookup(e->index.str_value.str, AWK_UNDEFINED, &t) && 
(t.val_type != AWK_UNDEFINED))
+        * indirection through the SYMTAB table.
+        */
+       // it's even trickier, we need to handle foo::bar as well
+       char *p = strstr(e->index.str_value.str, "::");
+       char *ns, *ident;
+       if (p != NULL) {
+               ns = e->index.str_value.str;
+               ident = p + 2;
+               *p = '\0';
+       } else {
+               ns = "";
+               ident = e->index.str_value.str;
+       }
+
+       if (sym_lookup_ns(ns, ident, AWK_UNDEFINED, & t)
+           && (t.val_type != AWK_UNDEFINED))
                return awk_false;
-       if (! sym_update(e->index.str_value.str, & e->value)) {
-               warning(ext_id, _("readall: unable to set %s"), 
e->index.str_value.str);
+
+       if (! sym_update_ns(ns, ident, & e->value)) {
+               if (ns[0])
+                       warning(ext_id, _("readall: unable to set %s::%s"), ns, 
ident);
+               else
+                       warning(ext_id, _("readall: unable to set %s"), ident);
                return awk_false;
        }
        return awk_true;
diff --git a/test/ChangeLog b/test/ChangeLog
index 6ec48cfd..b7e506a3 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2022-09-17         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * readall.ok, readall1.awk, readall2.awk: Update for code changes.
+
 2022-09-16         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.am (EXTRA_DIST): New test: dbugeval4.
diff --git a/test/readall.ok b/test/readall.ok
index b343af59..8aa6899f 100644
--- a/test/readall.ok
+++ b/test/readall.ok
@@ -1,6 +1,7 @@
 1
 1
 5.9 3 -2.327
+42
 zebra[archie] = banana
 zebra[0] = apple
 zebra[3][foo] = bar
diff --git a/test/readall1.awk b/test/readall1.awk
index 2888d157..4f90c73d 100644
--- a/test/readall1.awk
+++ b/test/readall1.awk
@@ -2,6 +2,7 @@ BEGIN {
        x = 5.9
        y = 3
        z = -2.327
+       guide::answer = 42
        zebra[0] = "apple"
        zebra["archie"] = "banana"
        zebra[3]["foo"] = "bar"
diff --git a/test/readall2.awk b/test/readall2.awk
index 8b79849a..af45751d 100644
--- a/test/readall2.awk
+++ b/test/readall2.awk
@@ -10,6 +10,7 @@ function printarray(n, x,   i) {
 BEGIN {
        print readall(ifile)
        print x, y, z
+       print guide::answer
        #print zebra[0], zebra[3]["foo"], zebra[3]["bar"]
        printarray("zebra", zebra)
 }

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

Summary of changes:
 doc/ChangeLog       |   5 ++
 doc/gawk.info       | 180 ++++++++++++++++++++++++++--------------------------
 doc/gawk.texi       |   3 +-
 doc/gawktexi.in     |   3 +-
 extension/ChangeLog |   5 ++
 extension/rwarray.c |  29 +++++++--
 test/ChangeLog      |   4 ++
 test/readall.ok     |   1 +
 test/readall1.awk   |   1 +
 test/readall2.awk   |   1 +
 10 files changed, 135 insertions(+), 97 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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