aboutsummaryrefslogtreecommitdiffstats
path: root/z3.awk
diff options
context:
space:
mode:
Diffstat (limited to 'z3.awk')
-rw-r--r--z3.awk19
1 files changed, 19 insertions, 0 deletions
diff --git a/z3.awk b/z3.awk
new file mode 100644
index 00000000..408f5259
--- /dev/null
+++ b/z3.awk
@@ -0,0 +1,19 @@
+function testit(count, re, repl, fun, bi, n1, n2)
+{
+ $0 = "foo"
+ n1 = gsub(re, repl)
+ bi = $0
+
+ $0 = "foo"
+ fun = "gsub"
+ n2 = @fun(re, repl)
+ printf("%d: n1 = %d, bi -> %s, n2 = %d, indirect -> %s\n",
+ count, n1, bi, n2, $0)
+}
+
+BEGIN {
+ testit(1, @/o/, "q")
+ p = @/o/
+stopme()
+ testit(2, p, "q")
+}