aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/struct_const.zc
blob: 59af8fd5f2ae5fc9fc35443fb98842b17afac0fe (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
namespace;
include rt;

struct Text {
	const MAX = 24, MIN = 1;
	const int WIDE = MAX * 2;
	int len, tag;
	static int top() { return MAX; }
	static int span() { return MAX - MIN; }
	int room() { return MAX - this.len; }
	int total() { int[MIN + 2] a; a[2] = WIDE; return a[2] + this.tag; }
}

const MAX = 99;

int main() {
	Text t;
	t.len = 5; t.tag = 7;
	rt.put_n(Text.MAX); rt.put_c(32);
	rt.put_n(Text.MIN + Text.WIDE); rt.put_c(32);
	rt.put_n(Text.top()); rt.put_c(32);
	rt.put_n(Text.span()); rt.put_c(32);
	rt.put_n(t.room()); rt.put_c(32);
	rt.put_n(t.total()); rt.put_c(32);
	rt.put_n(t.len + t.tag); rt.put_c(32);
	rt.put_n(MAX); rt.put_c(10);
	return 0;
}