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 / g4.om
| 1 | om2 |
| 2 | note gate-pools 4: the first global is a pool, sized globals follow. The pool takes no pinned register: the |
| 3 | note set of X18..X26 written by this unit equals that of g4base.om (the same unit without the pool). |
| 4 | global P ulong * |
| 5 | global g ulong 10 |
| 6 | global h ulong 5000 |
| 7 | global ob uchar 24 |
| 8 | fn pnum v ulong to void |
| 9 | put ob 23 10 |
| 10 | i = ulong 23 |
| 11 | x = v |
| 12 | go = true |
| 13 | while go bound 21 |
| 14 | i = sub i 1 |
| 15 | put ob i uchar add rem x 10 48 |
| 16 | x = div x 10 |
| 17 | go = ne x 0 |
| 18 | end |
| 19 | k = write 1 ob i sub 24 i |
| 20 | end |
| 21 | fn plong v long to void |
| 22 | if lt v 0 |
| 23 | put ob 0 uchar 45 |
| 24 | k = write 1 ob 0 1 |
| 25 | pnum ulong neg v |
| 26 | else |
| 27 | pnum ulong v |
| 28 | end |
| 29 | end |
| 30 | fn main to int |
| 31 | r = enlarge P ulong 1000 |
| 32 | put P 999 5 |
| 33 | put g 9 6 |
| 34 | put h 4999 7 |
| 35 | r = enlarge P ulong 1000000 |
| 36 | put P 999999 8 |
| 37 | pnum get P 999 |
| 38 | pnum get g 9 |
| 39 | pnum get h 4999 |
| 40 | pnum get P 999999 |
| 41 | pnum len P |
| 42 | ret 0 |
| 43 | end |