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