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 / omc / om2 / s3 / l-rw.om

76 lines · 1376 bytes Raw Blame History
1note S3 layout: every integer field type, both byte orders, scalar and array fields, run-time and constant
2note indexes, an inline function with a layout parameter, the raw uchar fallback and len. Writes the 40-byte
3note image to stdout, then exits 0 when every read-back matches (else the failing check's number).
4om2
5layout mix 40
6field sb byte at 0 little
7field ss short at 1 big
8field si int at 3 little
9field sl long at 7 big
10field us ushort 2 at 15 big
11field ui uint 2 at 19 little
12field ul ulong at 27 little
13field tail uchar 5 at 35 big
14end
15fn setul c edit mix v ulong to void inline
16put c ul v
17end
18fn fill c edit mix k ulong to void
19put c sb -2
20put c ss -300
21put c si -70000
22put c sl -4294967296
23put c us 0 0xbeef
24put c us k 0x1234
25put c ui 0 0xdeadbeef
26put c ui k 7
27setul c 0x0102030405060708
28for i ulong 5
29put c tail i uchar add i 0xa0
30end
31end
32fn check c view mix k ulong to int
33if ne get c sb -2
34ret 1
35end
36if ne get c ss -300
37ret 2
38end
39if ne get c si -70000
40ret 3
41end
42if ne get c sl -4294967296
43ret 4
44end
45if ne get c us 0 0xbeef
46ret 5
47end
48if ne get c us k 0x1234
49ret 6
50end
51if ne get c ui 0 0xdeadbeef
52ret 7
53end
54if ne get c ui k 7
55ret 8
56end
57if ne get c ul 0x0102030405060708
58ret 9
59end
60if ne get c tail 4 0xa4
61ret 10
62end
63if ne get c 1 254
64ret 11
65end
66if ne len c 40
67ret 12
68end
69ret 0
70end
71fn main to int
72c = new uchar 40 0
73fill c 1
74w = write 1 c 0 40
75ret check c 1
76end