aboutsummaryrefslogtreecommitdiffstats
path: root/test/readall2.awk
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2021-12-08 17:05:52 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2021-12-08 17:05:52 -0500
commit508e9368d2d461b2290af6787cad6dfbed357176 (patch)
treece0ce2b65098253601901534a40e83ae2ab98202 /test/readall2.awk
parentc4b80d4a006d3cbcce3aaca1c598a094de936f8b (diff)
downloadegawk-508e9368d2d461b2290af6787cad6dfbed357176.tar.gz
egawk-508e9368d2d461b2290af6787cad6dfbed357176.tar.bz2
egawk-508e9368d2d461b2290af6787cad6dfbed357176.zip
Enhance rwarray extension to add writeall and readall functions for dumping and reloading global state.
Diffstat (limited to 'test/readall2.awk')
-rw-r--r--test/readall2.awk15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/readall2.awk b/test/readall2.awk
new file mode 100644
index 00000000..8b79849a
--- /dev/null
+++ b/test/readall2.awk
@@ -0,0 +1,15 @@
+function printarray(n, x, i) {
+ for (i in x) {
+ if (isarray(x[i]))
+ printarray((n "[" i "]"), x[i])
+ else
+ printf "%s[%s] = %s\n", n, i, x[i]
+ }
+}
+
+BEGIN {
+ print readall(ifile)
+ print x, y, z
+ #print zebra[0], zebra[3]["foo"], zebra[3]["bar"]
+ printarray("zebra", zebra)
+}