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 / aienux / allen / tests / fixture.om
| 1 | note Native acceptance of frozen existing courier --split fixtures, reversed. |
| 2 | global Stream uchar 65536 |
| 3 | global Starts ulong 257 |
| 4 | global Sizes ulong 257 |
| 5 | global Count ulong 1 |
| 6 | fn partload slot ulong to void |
| 7 | n = get Sizes slot |
| 8 | put Inlen 0 n |
| 9 | for i ulong n |
| 10 | put In i get Stream add get Starts slot i |
| 11 | end |
| 12 | end |
| 13 | fn main to int |
| 14 | n = read 0 Stream 0 len Stream |
| 15 | if le n 0 |
| 16 | ret 90 |
| 17 | end |
| 18 | used = ulong n |
| 19 | while gt n 0 |
| 20 | if eq used len Stream |
| 21 | ret 91 |
| 22 | end |
| 23 | n = read 0 Stream used sub len Stream used |
| 24 | if lt n 0 |
| 25 | ret 92 |
| 26 | end |
| 27 | used = add used ulong n |
| 28 | end |
| 29 | startpos = ulong 0 |
| 30 | for i ulong used |
| 31 | if eq get Stream i 10 |
| 32 | if eq get Stream startpos 67 |
| 33 | slot = get Count 0 |
| 34 | if ge slot 256 |
| 35 | ret 93 |
| 36 | end |
| 37 | put Starts slot startpos |
| 38 | put Sizes slot sub i startpos |
| 39 | put Count 0 add slot 1 |
| 40 | end |
| 41 | startpos = add i 1 |
| 42 | end |
| 43 | end |
| 44 | codebeg 1 |
| 45 | parts = get Count 0 |
| 46 | check gt parts 1 401 |
| 47 | for i ulong sub parts 1 |
| 48 | partload sub sub parts 1 i |
| 49 | check codetake add 410 i |
| 50 | end |
| 51 | check eq codestat 1 402 |
| 52 | check eq missing 1 403 |
| 53 | partload 0 |
| 54 | check codetake 404 |
| 55 | check eq codestat 2 405 |
| 56 | check eq get C 4 parts 406 |
| 57 | for i ulong parts |
| 58 | partload i |
| 59 | check codetake add 700 i |
| 60 | end |
| 61 | check eq get C 4 parts 407 |
| 62 | check eq codestat 2 408 |
| 63 | partload 0 |
| 64 | put In 5 uchar 50 |
| 65 | check not codetake 409 |
| 66 | ret int get Fails 0 |
| 67 | end |