diff options
Diffstat (limited to 'doc/gawk.info')
-rw-r--r-- | doc/gawk.info | 205 |
1 files changed, 117 insertions, 88 deletions
diff --git a/doc/gawk.info b/doc/gawk.info index f424ef99..cc695b19 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -29140,8 +29140,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. @@ -29158,6 +29158,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 @@ -29173,6 +29187,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" @@ -29180,6 +29201,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 @@ -38012,6 +38037,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. @@ -38725,6 +38752,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) @@ -39259,92 +39288,92 @@ Ref: table-readdir-file-types1175318 Node: Extension Sample Revout1176386 Node: Extension Sample Rev2way1176975 Node: Extension Sample Read write array1177715 -Node: Extension Sample Readfile1179657 -Node: Extension Sample Time1180752 -Node: Extension Sample API Tests1182504 -Node: gawkextlib1182996 -Node: Extension summary1185914 -Node: Extension Exercises1189616 -Node: Language History1190858 -Node: V7/SVR3.11192514 -Node: SVR41194666 -Node: POSIX1196100 -Node: BTL1197481 -Node: POSIX/GNU1198210 -Node: Feature History1203988 -Node: Common Extensions1221163 -Node: Ranges and Locales1222446 -Ref: Ranges and Locales-Footnote-11227062 -Ref: Ranges and Locales-Footnote-21227089 -Ref: Ranges and Locales-Footnote-31227324 -Node: Contributors1227547 -Node: History summary1233544 -Node: Installation1234924 -Node: Gawk Distribution1235868 -Node: Getting1236352 -Node: Extracting1237315 -Node: Distribution contents1238953 -Node: Unix Installation1246014 -Node: Quick Installation1246818 -Node: Compiling with MPFR1249238 -Node: Shell Startup Files1249928 -Node: Additional Configuration Options1251017 -Node: Configuration Philosophy1253332 -Node: Compiling from Git1255728 -Node: Building the Documentation1256283 -Node: Non-Unix Installation1257667 -Node: PC Installation1258127 -Node: PC Binary Installation1258965 -Node: PC Compiling1259838 -Node: PC Using1260955 -Node: Cygwin1264508 -Node: MSYS1265732 -Node: VMS Installation1266334 -Node: VMS Compilation1267053 -Ref: VMS Compilation-Footnote-11268282 -Node: VMS Dynamic Extensions1268340 -Node: VMS Installation Details1270025 -Node: VMS Running1272287 -Node: VMS GNV1276566 -Node: Bugs1277280 -Node: Bug definition1278192 -Node: Bug address1281128 -Node: Usenet1284516 -Node: Performance bugs1285705 -Node: Asking for help1288626 -Node: Maintainers1290593 -Node: Other Versions1291787 -Node: Installation summary1299951 -Node: Notes1301315 -Node: Compatibility Mode1302109 -Node: Additions1302891 -Node: Accessing The Source1303816 -Node: Adding Code1305253 -Node: New Ports1311445 -Node: Derived Files1315820 -Ref: Derived Files-Footnote-11321480 -Ref: Derived Files-Footnote-21321515 -Ref: Derived Files-Footnote-31322113 -Node: Future Extensions1322227 -Node: Implementation Limitations1322885 -Node: Extension Design1324095 -Node: Old Extension Problems1325239 -Ref: Old Extension Problems-Footnote-11326757 -Node: Extension New Mechanism Goals1326814 -Ref: Extension New Mechanism Goals-Footnote-11330178 -Node: Extension Other Design Decisions1330367 -Node: Extension Future Growth1332480 -Node: Notes summary1333086 -Node: Basic Concepts1334244 -Node: Basic High Level1334925 -Ref: figure-general-flow1335207 -Ref: figure-process-flow1335893 -Ref: Basic High Level-Footnote-11339195 -Node: Basic Data Typing1339380 -Node: Glossary1342708 -Node: Copying1374595 -Node: GNU Free Documentation License1412138 -Node: Index1437258 +Node: Extension Sample Readfile1180881 +Node: Extension Sample Time1181976 +Node: Extension Sample API Tests1183728 +Node: gawkextlib1184220 +Node: Extension summary1187138 +Node: Extension Exercises1190840 +Node: Language History1192082 +Node: V7/SVR3.11193738 +Node: SVR41195890 +Node: POSIX1197324 +Node: BTL1198705 +Node: POSIX/GNU1199434 +Node: Feature History1205212 +Node: Common Extensions1222387 +Node: Ranges and Locales1223670 +Ref: Ranges and Locales-Footnote-11228286 +Ref: Ranges and Locales-Footnote-21228313 +Ref: Ranges and Locales-Footnote-31228548 +Node: Contributors1228771 +Node: History summary1234768 +Node: Installation1236148 +Node: Gawk Distribution1237092 +Node: Getting1237576 +Node: Extracting1238539 +Node: Distribution contents1240177 +Node: Unix Installation1247238 +Node: Quick Installation1248042 +Node: Compiling with MPFR1250462 +Node: Shell Startup Files1251152 +Node: Additional Configuration Options1252241 +Node: Configuration Philosophy1254556 +Node: Compiling from Git1256952 +Node: Building the Documentation1257507 +Node: Non-Unix Installation1258891 +Node: PC Installation1259351 +Node: PC Binary Installation1260189 +Node: PC Compiling1261062 +Node: PC Using1262179 +Node: Cygwin1265732 +Node: MSYS1266956 +Node: VMS Installation1267558 +Node: VMS Compilation1268277 +Ref: VMS Compilation-Footnote-11269506 +Node: VMS Dynamic Extensions1269564 +Node: VMS Installation Details1271249 +Node: VMS Running1273511 +Node: VMS GNV1277790 +Node: Bugs1278504 +Node: Bug definition1279416 +Node: Bug address1282352 +Node: Usenet1285740 +Node: Performance bugs1286929 +Node: Asking for help1289850 +Node: Maintainers1291817 +Node: Other Versions1293011 +Node: Installation summary1301175 +Node: Notes1302539 +Node: Compatibility Mode1303333 +Node: Additions1304115 +Node: Accessing The Source1305040 +Node: Adding Code1306477 +Node: New Ports1312669 +Node: Derived Files1317044 +Ref: Derived Files-Footnote-11322704 +Ref: Derived Files-Footnote-21322739 +Ref: Derived Files-Footnote-31323337 +Node: Future Extensions1323451 +Node: Implementation Limitations1324109 +Node: Extension Design1325319 +Node: Old Extension Problems1326463 +Ref: Old Extension Problems-Footnote-11327981 +Node: Extension New Mechanism Goals1328038 +Ref: Extension New Mechanism Goals-Footnote-11331402 +Node: Extension Other Design Decisions1331591 +Node: Extension Future Growth1333704 +Node: Notes summary1334310 +Node: Basic Concepts1335468 +Node: Basic High Level1336149 +Ref: figure-general-flow1336431 +Ref: figure-process-flow1337117 +Ref: Basic High Level-Footnote-11340419 +Node: Basic Data Typing1340604 +Node: Glossary1343932 +Node: Copying1375819 +Node: GNU Free Documentation License1413362 +Node: Index1438482 End Tag Table |