diff options
Diffstat (limited to 'tests/programs/misc.zc')
| -rw-r--r-- | tests/programs/misc.zc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/programs/misc.zc b/tests/programs/misc.zc index 530322a..2b0f0c2 100644 --- a/tests/programs/misc.zc +++ b/tests/programs/misc.zc @@ -1,15 +1,18 @@ +namespace; +include rt, run; + // ct { ... } runs a block while compiling and leaves its result as a constant immediate fn ct() { let q, v; - next(); - q = grab(); - v = eval(q); - free(d*q); - lit(v); + run.next(); + q = run.grab(); + v = run.eval(q); + rt.free(d*q); + run.lit(v); return 0; } // teach the asm syntax that p means out, like the old repl demo -immediate fn teach() { next(); mnem[12] = 'p'; return 0; } +immediate fn teach() { run.next(); run.mnem[12] = 'p'; return 0; } teach fn countdown() { @@ -17,11 +20,11 @@ fn countdown() { return 0; } fn main() { - put_n(ct { let i = 0, s = 0; while (i < 10) { s += i; i++; } return s; }); put_c(10); + rt.put_n(ct { let i = 0, s = 0; while (i < 10) { s += i; i++; } return s; }); rt.put_c(10); countdown(); - put_s(lazy()); put_c(10); + rt.put_s(lazy()); rt.put_c(10); return 0; } // the analyzer is off from here on unchecked; -fn lazy() { let p = new(3); p[0] = 'o'; p[1] = 'k'; return p; } +fn lazy() { let p = rt.new(3); p[0] = 'o'; p[1] = 'k'; return p; } |
