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 / tests / pools / g2d.om
| 1 | note gate-pools 2: a read or write slice past the length traps 3 (uchar pool, write path). |
| 2 | global U uchar * |
| 3 | global ob uchar 24 |
| 4 | fn pnum v ulong to void |
| 5 | put ob 23 10 |
| 6 | i = ulong 23 |
| 7 | x = v |
| 8 | go = true |
| 9 | while go bound 21 |
| 10 | i = sub i 1 |
| 11 | put ob i uchar add rem x 10 48 |
| 12 | x = div x 10 |
| 13 | go = ne x 0 |
| 14 | end |
| 15 | k = write 1 ob i sub 24 i |
| 16 | end |
| 17 | fn plong v long to void |
| 18 | if lt v 0 |
| 19 | put ob 0 uchar 45 |
| 20 | k = write 1 ob 0 1 |
| 21 | pnum ulong neg v |
| 22 | else |
| 23 | pnum ulong v |
| 24 | end |
| 25 | end |
| 26 | fn main to int |
| 27 | r = enlarge U ulong 3 |
| 28 | put U 0 79 |
| 29 | put U 1 75 |
| 30 | put U 2 10 |
| 31 | k = write 1 U 0 3 |
| 32 | n = len U |
| 33 | k = write 1 U 1 n |
| 34 | pnum 9 |
| 35 | ret 0 |
| 36 | end |