raz / conform / run / Sizes.raz

28 lines · 866 B · raw · history · last change 264716cb

1(* Sizes the report fixes on every target, and those it ties to the
2 size of an address. *)
3module Sizes;
4import Out;
5
6type Empty = record end;
7
8proc line(name: []const U8; b: BOOL);
9begin
10 Out.str(name);
11 if b then Out.str(" yes"); else Out.str(" NO"); end;
12 Out.ln;
13end;
14
15proc main*;
16begin
17 Out.int(SIZE(I8)); Out.char(' '); Out.int(SIZE(I16)); Out.char(' ');
18 Out.int(SIZE(I32)); Out.char(' '); Out.int(SIZE(I64)); Out.char(' ');
19 Out.int(SIZE(U8)); Out.char(' '); Out.int(SIZE(BOOL)); Out.ln;
20 line("INT is an address", SIZE(INT) = SIZE(^U8));
21 line("UINT is an address", SIZE(UINT) = SIZE(^U8));
22 line("procedure is an address", SIZE(proc) = SIZE(^U8));
23 line("ERROR is an address", SIZE(ERROR) = SIZE(^U8));
24 line("slice is two", SIZE([]const U8) = 2 * SIZE(^U8));
25 line("empty record", SIZE(Empty) = 0);
26end;
27
28end Sizes.