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 0be3deca..f4afd8e3 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -29143,8 +29143,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.
@@ -29161,6 +29161,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
@@ -29176,6 +29190,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"
@@ -29183,6 +29204,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
@@ -38013,6 +38038,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.
@@ -38726,6 +38753,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)
@@ -39260,92 +39289,92 @@ Ref: table-readdir-file-types1175462
Node: Extension Sample Revout1176530
Node: Extension Sample Rev2way1177119
Node: Extension Sample Read write array1177859
-Node: Extension Sample Readfile1179801
-Node: Extension Sample Time1180896
-Node: Extension Sample API Tests1182648
-Node: gawkextlib1183140
-Node: Extension summary1186058
-Node: Extension Exercises1189760
-Node: Language History1191002
-Node: V7/SVR3.11192658
-Node: SVR41194810
-Node: POSIX1196244
-Node: BTL1197625
-Node: POSIX/GNU1198354
-Node: Feature History1204132
-Node: Common Extensions1221307
-Node: Ranges and Locales1222590
-Ref: Ranges and Locales-Footnote-11227206
-Ref: Ranges and Locales-Footnote-21227233
-Ref: Ranges and Locales-Footnote-31227468
-Node: Contributors1227691
-Node: History summary1233688
-Node: Installation1235068
-Node: Gawk Distribution1236012
-Node: Getting1236496
-Node: Extracting1237459
-Node: Distribution contents1239097
-Node: Unix Installation1246158
-Node: Quick Installation1246962
-Node: Compiling with MPFR1249382
-Node: Shell Startup Files1250072
-Node: Additional Configuration Options1251161
-Node: Configuration Philosophy1253476
-Node: Compiling from Git1255872
-Node: Building the Documentation1256427
-Node: Non-Unix Installation1257811
-Node: PC Installation1258271
-Node: PC Binary Installation1259109
-Node: PC Compiling1259982
-Node: PC Using1261099
-Node: Cygwin1264652
-Node: MSYS1265876
-Node: VMS Installation1266478
-Node: VMS Compilation1267197
-Ref: VMS Compilation-Footnote-11268426
-Node: VMS Dynamic Extensions1268484
-Node: VMS Installation Details1270169
-Node: VMS Running1272431
-Node: VMS GNV1276710
-Node: Bugs1277424
-Node: Bug definition1278336
-Node: Bug address1281272
-Node: Usenet1284660
-Node: Performance bugs1285849
-Node: Asking for help1288770
-Node: Maintainers1290737
-Node: Other Versions1291931
-Node: Installation summary1300095
-Node: Notes1301459
-Node: Compatibility Mode1302253
-Node: Additions1303035
-Node: Accessing The Source1303960
-Node: Adding Code1305397
-Node: New Ports1311589
-Node: Derived Files1315964
-Ref: Derived Files-Footnote-11321624
-Ref: Derived Files-Footnote-21321659
-Ref: Derived Files-Footnote-31322257
-Node: Future Extensions1322371
-Node: Implementation Limitations1323029
-Node: Extension Design1324239
-Node: Old Extension Problems1325383
-Ref: Old Extension Problems-Footnote-11326901
-Node: Extension New Mechanism Goals1326958
-Ref: Extension New Mechanism Goals-Footnote-11330322
-Node: Extension Other Design Decisions1330511
-Node: Extension Future Growth1332624
-Node: Notes summary1333230
-Node: Basic Concepts1334388
-Node: Basic High Level1335069
-Ref: figure-general-flow1335351
-Ref: figure-process-flow1336037
-Ref: Basic High Level-Footnote-11339339
-Node: Basic Data Typing1339524
-Node: Glossary1342852
-Node: Copying1374739
-Node: GNU Free Documentation License1412282
-Node: Index1437402
+Node: Extension Sample Readfile1181025
+Node: Extension Sample Time1182120
+Node: Extension Sample API Tests1183872
+Node: gawkextlib1184364
+Node: Extension summary1187282
+Node: Extension Exercises1190984
+Node: Language History1192226
+Node: V7/SVR3.11193882
+Node: SVR41196034
+Node: POSIX1197468
+Node: BTL1198849
+Node: POSIX/GNU1199578
+Node: Feature History1205356
+Node: Common Extensions1222531
+Node: Ranges and Locales1223814
+Ref: Ranges and Locales-Footnote-11228430
+Ref: Ranges and Locales-Footnote-21228457
+Ref: Ranges and Locales-Footnote-31228692
+Node: Contributors1228915
+Node: History summary1234912
+Node: Installation1236292
+Node: Gawk Distribution1237236
+Node: Getting1237720
+Node: Extracting1238683
+Node: Distribution contents1240321
+Node: Unix Installation1247382
+Node: Quick Installation1248186
+Node: Compiling with MPFR1250606
+Node: Shell Startup Files1251296
+Node: Additional Configuration Options1252385
+Node: Configuration Philosophy1254700
+Node: Compiling from Git1257096
+Node: Building the Documentation1257651
+Node: Non-Unix Installation1259035
+Node: PC Installation1259495
+Node: PC Binary Installation1260333
+Node: PC Compiling1261206
+Node: PC Using1262323
+Node: Cygwin1265876
+Node: MSYS1267100
+Node: VMS Installation1267702
+Node: VMS Compilation1268421
+Ref: VMS Compilation-Footnote-11269650
+Node: VMS Dynamic Extensions1269708
+Node: VMS Installation Details1271393
+Node: VMS Running1273655
+Node: VMS GNV1277934
+Node: Bugs1278648
+Node: Bug definition1279560
+Node: Bug address1282496
+Node: Usenet1285884
+Node: Performance bugs1287073
+Node: Asking for help1289994
+Node: Maintainers1291961
+Node: Other Versions1293155
+Node: Installation summary1301319
+Node: Notes1302683
+Node: Compatibility Mode1303477
+Node: Additions1304259
+Node: Accessing The Source1305184
+Node: Adding Code1306621
+Node: New Ports1312813
+Node: Derived Files1317188
+Ref: Derived Files-Footnote-11322848
+Ref: Derived Files-Footnote-21322883
+Ref: Derived Files-Footnote-31323481
+Node: Future Extensions1323595
+Node: Implementation Limitations1324253
+Node: Extension Design1325463
+Node: Old Extension Problems1326607
+Ref: Old Extension Problems-Footnote-11328125
+Node: Extension New Mechanism Goals1328182
+Ref: Extension New Mechanism Goals-Footnote-11331546
+Node: Extension Other Design Decisions1331735
+Node: Extension Future Growth1333848
+Node: Notes summary1334454
+Node: Basic Concepts1335612
+Node: Basic High Level1336293
+Ref: figure-general-flow1336575
+Ref: figure-process-flow1337261
+Ref: Basic High Level-Footnote-11340563
+Node: Basic Data Typing1340748
+Node: Glossary1344076
+Node: Copying1375963
+Node: GNU Free Documentation License1413506
+Node: Index1438626

End Tag Table