| 1 | (* Sizes the report fixes on every target, and those it ties to the |
| 2 | size of an address. *) |
| 3 | module Sizes; |
| 4 | import Out; |
| 5 | |
| 6 | type Empty = record end; |
| 7 | |
| 8 | proc line(name: []const U8; b: BOOL); |
| 9 | begin |
| 10 | Out.str(name); |
| 11 | if b then Out.str(" yes"); else Out.str(" NO"); end; |
| 12 | Out.ln; |
| 13 | end; |
| 14 | |
| 15 | proc main*; |
| 16 | begin |
| 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); |
| 26 | end; |
| 27 | |
| 28 | end Sizes. |