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 / qualification / om2 / sec / s5s7 / pr.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note sec/s5s7/pr.om: output helpers, appended after a program-mode fixture (case SRC a+b). |
| 3 | note OM-1 words only, so the same file serves OM-2 fixtures and their OM-1 twins. |
| 4 | note putd v: v in decimal and a newline on stdout. puth v: 16 lowercase hex digits and a newline. |
| 5 | text prhex "0123456789abcdef" |
| 6 | fn putd v ulong to void |
| 7 | b = new uchar 21 10 |
| 8 | p = ulong 20 |
| 9 | x = v |
| 10 | go = true |
| 11 | while go |
| 12 | p = sub p 1 |
| 13 | put b p add uchar rem x 10 48 |
| 14 | x = div x 10 |
| 15 | if eq x 0 |
| 16 | go = false |
| 17 | end |
| 18 | end |
| 19 | w = write 1 b p sub 21 p |
| 20 | end |
| 21 | fn puth v ulong to void |
| 22 | b = new uchar 17 10 |
| 23 | for i ulong 16 |
| 24 | s = mul sub 15 i 4 |
| 25 | put b i get prhex and shr v s 15 |
| 26 | end |
| 27 | w = write 1 b 0 17 |
| 28 | end |