aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/ftype.zc
blob: 6db7f5a788aded259140ac3de843528ee0ff6234 (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
fn put_f(x) { asm { x @ #1220 } return 0; }
fn sp() { 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();
	put_n(&(1.field)); sp();
	w = (&c) as word;
	put_n(w.tag); sp();
	put_f(w.field); sp();
	w.field = 8.5;
	put_f(c.field); sp();
	put_n(g > 3); sp();
	if (z) n = 1;
	do { if (z) n = n + 2; } while (z);
	if (!z && g) n = n + 4;
	put_n(n);
	put_c(10);
	return 0;
}