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 / s4 / v-text-empty.om
| 1 | note S4 empty text (`text e ""`, length 0) as a `view uchar *` argument (spec 6, erratum E2): its count is |
| 2 | note the number 0, never a count register. x = 7 is live in the register the old lowering read as the |
| 3 | note count. Checks: len through a parameter, through an inline parameter, len e itself, part e 0 0 and a |
| 4 | note 0-byte write. Exit 0 when every check holds, else the failing check's number. |
| 5 | om2 |
| 6 | text e "" |
| 7 | fn plen v view uchar * to ulong |
| 8 | ret len v |
| 9 | end |
| 10 | fn ilen v view uchar * to ulong inline |
| 11 | ret len v |
| 12 | end |
| 13 | fn main to int |
| 14 | x = ulong 7 |
| 15 | if ne plen e 0 |
| 16 | ret 1 |
| 17 | end |
| 18 | if ne ilen e 0 |
| 19 | ret 2 |
| 20 | end |
| 21 | if ne len e 0 |
| 22 | ret 3 |
| 23 | end |
| 24 | if ne plen part e 0 0 0 |
| 25 | ret 4 |
| 26 | end |
| 27 | n = write int 1 e ulong 0 ulong 0 |
| 28 | if ne n 0 |
| 29 | ret 5 |
| 30 | end |
| 31 | ret int sub x 7 |
| 32 | end |