aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.info
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gawk.info')
-rw-r--r--doc/gawk.info205
1 files changed, 117 insertions, 88 deletions
diff --git a/doc/gawk.info b/doc/gawk.info
index e11d3b06..97cb96ca 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -29128,8 +29128,8 @@ File: gawk.info, Node: Extension Sample Read write array, Next: Extension Samp
17.7.9 Dumping and Restoring an Array
-------------------------------------
-The 'rwarray' extension adds two functions, named 'writea()' and
-'reada()', as follows:
+The 'rwarray' extension adds four functions, named 'writea()',
+'reada()', 'writeall()' and 'readall()', as follows:
'@load "rwarray"'
This is how you load the extension.
@@ -29146,6 +29146,20 @@ The 'rwarray' extension adds two functions, named 'writea()' and
argument. It clears the array first. Here too, the return value
is one on success, or zero upon failure.
+'ret = writeall(file)'
+ This function takes a string argument, which is the name of the
+ file to which to dump the state of all variables. Calling this
+ function is completely equivalent to calling 'writea(file,
+ SYMTAB)'. It returns one on success, or zero upon failure
+
+'ret = writeall(file)'
+ 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.
+
The array created by 'reada()' is identical to that written by
'writea()' in the sense that the contents are the same. However, due to
implementation issues, the array traversal order of the re-created array
@@ -29161,6 +29175,13 @@ written as native binary data. Thus, arrays containing only string data
can theoretically be dumped on systems with one byte order and restored
on systems with a different one, but this has not been tried.
+ Note that the 'writeall()' and 'readall()' functions provide a
+mechanism for maintaining persistent state across repeated invocations
+of a program. If, for example, a program calculates some statistics
+based on the data in a series of files, it could save state using
+'writeall()' after processing N files, and then reload the state using
+'readall()' when the N+1st file arrives to update the results.
+
Here is an example:
@load "rwarray"
@@ -29168,6 +29189,10 @@ on systems with a different one, but this has not been tried.
ret = writea("arraydump.bin", array)
...
ret = reada("arraydump.bin", array)
+ ...
+ ret = writeall("globalstate.bin")
+ ...
+ ret = readall("globalstate.bin")

File: gawk.info, Node: Extension Sample Readfile, Next: Extension Sample Time, Prev: Extension Sample Read write array, Up: Extension Samples
@@ -37998,6 +38023,8 @@ Index
(line 18)
* readable data files, checking: File Checking. (line 6)
* readable.awk program: File Checking. (line 11)
+* readall() extension function: Extension Sample Read write array.
+ (line 30)
* readdir extension: Extension Sample Readdir.
(line 9)
* readfile() extension function: Extension Sample Readfile.
@@ -38711,6 +38738,8 @@ Index
* words, usage counts, generating: Word Sorting. (line 6)
* writea() extension function: Extension Sample Read write array.
(line 12)
+* writeall() extension function: Extension Sample Read write array.
+ (line 24)
* xgettext utility: String Extraction. (line 13)
* xor: Bitwise Functions. (line 58)
* XOR bitwise operation: Bitwise Functions. (line 6)
@@ -39246,92 +39275,92 @@ Ref: table-readdir-file-types1174562
Node: Extension Sample Revout1175630
Node: Extension Sample Rev2way1176219
Node: Extension Sample Read write array1176959
-Node: Extension Sample Readfile1178901
-Node: Extension Sample Time1179996
-Node: Extension Sample API Tests1181748
-Node: gawkextlib1182240
-Node: Extension summary1185158
-Node: Extension Exercises1188860
-Node: Language History1190102
-Node: V7/SVR3.11191758
-Node: SVR41193910
-Node: POSIX1195344
-Node: BTL1196725
-Node: POSIX/GNU1197454
-Node: Feature History1203232
-Node: Common Extensions1220407
-Node: Ranges and Locales1221690
-Ref: Ranges and Locales-Footnote-11226306
-Ref: Ranges and Locales-Footnote-21226333
-Ref: Ranges and Locales-Footnote-31226568
-Node: Contributors1226791
-Node: History summary1232788
-Node: Installation1234168
-Node: Gawk Distribution1235112
-Node: Getting1235596
-Node: Extracting1236559
-Node: Distribution contents1238197
-Node: Unix Installation1245258
-Node: Quick Installation1246062
-Node: Compiling with MPFR1248482
-Node: Shell Startup Files1249172
-Node: Additional Configuration Options1250261
-Node: Configuration Philosophy1252576
-Node: Compiling from Git1254972
-Node: Building the Documentation1255527
-Node: Non-Unix Installation1256911
-Node: PC Installation1257371
-Node: PC Binary Installation1258209
-Node: PC Compiling1259082
-Node: PC Using1260199
-Node: Cygwin1263752
-Node: MSYS1264976
-Node: VMS Installation1265578
-Node: VMS Compilation1266297
-Ref: VMS Compilation-Footnote-11267526
-Node: VMS Dynamic Extensions1267584
-Node: VMS Installation Details1269269
-Node: VMS Running1271531
-Node: VMS GNV1275810
-Node: Bugs1276524
-Node: Bug definition1277436
-Node: Bug address1280372
-Node: Usenet1283760
-Node: Performance bugs1284949
-Node: Asking for help1287870
-Node: Maintainers1289837
-Node: Other Versions1291031
-Node: Installation summary1299195
-Node: Notes1300559
-Node: Compatibility Mode1301353
-Node: Additions1302135
-Node: Accessing The Source1303060
-Node: Adding Code1304497
-Node: New Ports1310689
-Node: Derived Files1315064
-Ref: Derived Files-Footnote-11320724
-Ref: Derived Files-Footnote-21320759
-Ref: Derived Files-Footnote-31321357
-Node: Future Extensions1321471
-Node: Implementation Limitations1322129
-Node: Extension Design1323339
-Node: Old Extension Problems1324483
-Ref: Old Extension Problems-Footnote-11326001
-Node: Extension New Mechanism Goals1326058
-Ref: Extension New Mechanism Goals-Footnote-11329422
-Node: Extension Other Design Decisions1329611
-Node: Extension Future Growth1331724
-Node: Notes summary1332330
-Node: Basic Concepts1333488
-Node: Basic High Level1334169
-Ref: figure-general-flow1334451
-Ref: figure-process-flow1335137
-Ref: Basic High Level-Footnote-11338439
-Node: Basic Data Typing1338624
-Node: Glossary1341952
-Node: Copying1373839
-Node: GNU Free Documentation License1411382
-Node: Index1436502
+Node: Extension Sample Readfile1180125
+Node: Extension Sample Time1181220
+Node: Extension Sample API Tests1182972
+Node: gawkextlib1183464
+Node: Extension summary1186382
+Node: Extension Exercises1190084
+Node: Language History1191326
+Node: V7/SVR3.11192982
+Node: SVR41195134
+Node: POSIX1196568
+Node: BTL1197949
+Node: POSIX/GNU1198678
+Node: Feature History1204456
+Node: Common Extensions1221631
+Node: Ranges and Locales1222914
+Ref: Ranges and Locales-Footnote-11227530
+Ref: Ranges and Locales-Footnote-21227557
+Ref: Ranges and Locales-Footnote-31227792
+Node: Contributors1228015
+Node: History summary1234012
+Node: Installation1235392
+Node: Gawk Distribution1236336
+Node: Getting1236820
+Node: Extracting1237783
+Node: Distribution contents1239421
+Node: Unix Installation1246482
+Node: Quick Installation1247286
+Node: Compiling with MPFR1249706
+Node: Shell Startup Files1250396
+Node: Additional Configuration Options1251485
+Node: Configuration Philosophy1253800
+Node: Compiling from Git1256196
+Node: Building the Documentation1256751
+Node: Non-Unix Installation1258135
+Node: PC Installation1258595
+Node: PC Binary Installation1259433
+Node: PC Compiling1260306
+Node: PC Using1261423
+Node: Cygwin1264976
+Node: MSYS1266200
+Node: VMS Installation1266802
+Node: VMS Compilation1267521
+Ref: VMS Compilation-Footnote-11268750
+Node: VMS Dynamic Extensions1268808
+Node: VMS Installation Details1270493
+Node: VMS Running1272755
+Node: VMS GNV1277034
+Node: Bugs1277748
+Node: Bug definition1278660
+Node: Bug address1281596
+Node: Usenet1284984
+Node: Performance bugs1286173
+Node: Asking for help1289094
+Node: Maintainers1291061
+Node: Other Versions1292255
+Node: Installation summary1300419
+Node: Notes1301783
+Node: Compatibility Mode1302577
+Node: Additions1303359
+Node: Accessing The Source1304284
+Node: Adding Code1305721
+Node: New Ports1311913
+Node: Derived Files1316288
+Ref: Derived Files-Footnote-11321948
+Ref: Derived Files-Footnote-21321983
+Ref: Derived Files-Footnote-31322581
+Node: Future Extensions1322695
+Node: Implementation Limitations1323353
+Node: Extension Design1324563
+Node: Old Extension Problems1325707
+Ref: Old Extension Problems-Footnote-11327225
+Node: Extension New Mechanism Goals1327282
+Ref: Extension New Mechanism Goals-Footnote-11330646
+Node: Extension Other Design Decisions1330835
+Node: Extension Future Growth1332948
+Node: Notes summary1333554
+Node: Basic Concepts1334712
+Node: Basic High Level1335393
+Ref: figure-general-flow1335675
+Ref: figure-process-flow1336361
+Ref: Basic High Level-Footnote-11339663
+Node: Basic Data Typing1339848
+Node: Glossary1343176
+Node: Copying1375063
+Node: GNU Free Documentation License1412606
+Node: Index1437726

End Tag Table