blob: c5847723af2fd8f94ee4aee73c34028ca50f7bfa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
include rt;
include run;
include icon;
int total = 1;
fn main() {
// step a fragment that writes an isolated global and a bound one, reading both after each step
let q = run.tokens("int n = 5; scale = scale * n; total = total + scale; return total;");
let frame = icon.begin(q);
icon.set_global(frame, "scale", 2);
icon.bind_global(frame, "total");
icon.step(frame); rt.put_n(icon.local(frame, "n")); rt.put_c(' ');
icon.step(frame); rt.put_n(icon.global(frame, "scale")); rt.put_c(' ');
icon.step(frame); rt.put_n(icon.global(frame, "total")); rt.put_c(' '); rt.put_n(total); rt.put_c(' ');
icon.step(frame); rt.put_n(icon.result(frame)); rt.put_c(' ');
// a name the frame never bound reads as 0 with error status 2
rt.put_n(icon.global(frame, "missing")); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
icon.close(d*frame);
return 0;
}
|