aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/ftype.zc
blob: cbc2444f3f3e05508306643009cf446a61e6a69b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace;
include rt;

fn put_f(x) { asm { x @ #1220 } return 0; }
fn sp() { rt.put_c(32); return 0; }

struct cell { int tag; float field; }

float g;

float add(float a, float b) { return a + b; }
float pick(cell* p) { return p.field; }

fn main() {
	float x;
	float y;
	cell c;
	cell* q;
	float buf[1];
	let w = 0;
	let z = 0.0 * -1.0;
	let n = 0;
	x = 1.5;
	y = 2;
	g = 10;
	put_f(add(x, y)); sp();
	put_f(add(g, 0.5)); sp();
	put_f(add(1, 2) + 0.5); sp();
	c.tag = 4;
	c.field = 4.25;
	q = &c;
	put_f(pick(q)); sp();
	put_f(q.field + 1); sp();
	put_f(c.field); sp();
	buf[0] = 6.5;
	put_f(buf[0]); sp();
	rt.put_n(&(1.field)); sp();
	w = (&c) as word;
	rt.put_n(w.tag); sp();
	put_f(w.field); sp();
	w.field = 8.5;
	put_f(c.field); sp();
	rt.put_n(g > 3); sp();
	if (z) n = 1;
	do { if (z) n = n + 2; } while (z);
	if (!z && g) n = n + 4;
	rt.put_n(n);
	rt.put_c(10);
	return 0;
}