interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / ng / front / cases / nom_layout_bounds.om

71 lines · 1077 bytes Raw Blame History
1note Layout boundaries: the last field ends exactly at the layout size, a big-endian field and a little-endian
2note field keep their own byte order, the last array element is writable without touching its neighbour, and
3note a run-time index one past the array traps 3 (exit 103).
4om2
5layout lo 12
6field lead uchar at 0 little
7field w ushort 2 at 1 big
8field d uint at 5 little
9field last uchar 3 at 9 little
10end
11fn five to ulong
12ret 3
13end
14fn fill c edit lo to void
15put c lead 255
16put c w 1 0x0102
17put c d 0x0a0b0c0d
18put c last 2 0x77
19end
20fn check c view lo to int
21if ne get c lead 255
22ret 1
23end
24if ne get c w 1 0x0102
25ret 2
26end
27if ne get c d 0x0a0b0c0d
28ret 3
29end
30if ne get c last 2 0x77
31ret 4
32end
33if ne get c last 0 0
34ret 5
35end
36if ne get c w 0 0
37ret 6
38end
39ret 0
40end
41fn over c edit lo to void
42put c last five 1
43end
44fn main to int
45c = new uchar 12 0
46fill c
47r = check c
48if ne r 0
49ret r
50end
51if ne get c 3 1
52ret 11
53end
54if ne get c 4 2
55ret 12
56end
57if ne get c 5 0x0d
58ret 13
59end
60if ne get c 8 0x0a
61ret 14
62end
63if ne get c 11 0x77
64ret 15
65end
66if ne get c 9 0
67ret 16
68end
69over c
70ret 0
71end