aboutsummaryrefslogtreecommitdiffstats
path: root/test/arrayind3.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-11-18 06:10:12 +0200
committerArnold D. Robbins <arnold@skeeve.com>2016-11-18 06:10:12 +0200
commitdc7bf0cfeb2ec3eb26f1767cfe8605199613c4d6 (patch)
treef2d6dcac2918d00cd31dd2dded7a776de7fa277e /test/arrayind3.awk
parentf0b405cceab16dadbb84b95a8d68f705bc20f70f (diff)
parentc2448a50be949f5df2da4f7a1baf58358b297970 (diff)
downloadegawk-dc7bf0cfeb2ec3eb26f1767cfe8605199613c4d6.tar.gz
egawk-dc7bf0cfeb2ec3eb26f1767cfe8605199613c4d6.tar.bz2
egawk-dc7bf0cfeb2ec3eb26f1767cfe8605199613c4d6.zip
Merge branch 'master' into feature/typed-regex-2
Diffstat (limited to 'test/arrayind3.awk')
-rw-r--r--test/arrayind3.awk19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/arrayind3.awk b/test/arrayind3.awk
new file mode 100644
index 00000000..ca4c58b5
--- /dev/null
+++ b/test/arrayind3.awk
@@ -0,0 +1,19 @@
+BEGIN {
+ # initialize cint arrays
+ pos[0] = 0
+ posout[0] = 0
+ split("00000779770060", f) # f[1] is a strnum
+ pos[f[1]] = 1 # subscripts must be strings!
+ for (x in pos) {
+ # if x is a strnum, then the
+ # x != 0 test may convert it to an integral NUMBER,
+ # and we might lose the unusual string representation
+ # if the cint code is not careful to recognize that this is
+ # actually a string
+ if (x != 0)
+ posout[x] = pos[x]
+ }
+ # which array element is populated?
+ print posout[779770060]
+ print posout["00000779770060"]
+}