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 / train / aien-train / native / collective / admit / a1emit-main.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note DRA-15 / aien-train#26 P0 admission observation tail. Appended after every |
| 3 | note line of native/collective/admit_p0.om before its fn main, byte-identical, |
| 4 | note by native/collective/admit/run.sh. It replaces only the self-test main: |
| 5 | note the same setcase/run sequence runs in one process and every observable is |
| 6 | note printed, so an oracle the program does not contain (Wolfram, |
| 7 | note expected-a1.out) can judge it. It adds no arithmetic and checks nothing. |
| 8 | note Line format: A1 case status y0 y1 base_count adapter_count, then END. |
| 9 | |
| 10 | global Buf uchar 128 |
| 11 | global Pos ulong 1 |
| 12 | |
| 13 | text ta "A1" |
| 14 | text te "END\n" |
| 15 | |
| 16 | fn pc c ulong to void |
| 17 | p = get Pos 0 |
| 18 | put Buf p uchar c |
| 19 | put Pos 0 add p 1 |
| 20 | end |
| 21 | |
| 22 | note Appends one space and the signed decimal of v to Buf. |
| 23 | fn pnum v long to void |
| 24 | d = new uchar 20 0 |
| 25 | pc 32 |
| 26 | u = ulong 0 |
| 27 | if lt v 0 |
| 28 | pc 45 |
| 29 | u = ulong neg v |
| 30 | else |
| 31 | u = ulong v |
| 32 | end |
| 33 | n = ulong 0 |
| 34 | c = true |
| 35 | while c bound 20 |
| 36 | put d n uchar add rem u 10 48 |
| 37 | n = add n 1 |
| 38 | u = div u 10 |
| 39 | if eq u 0 |
| 40 | c = false |
| 41 | end |
| 42 | end |
| 43 | for i ulong 20 |
| 44 | if lt i n |
| 45 | pc ulong get d sub sub n 1 i |
| 46 | end |
| 47 | end |
| 48 | end |
| 49 | |
| 50 | fn flush to void |
| 51 | p = get Pos 0 |
| 52 | put Buf p uchar 10 |
| 53 | k = write 1 Buf 0 add p 1 |
| 54 | put Pos 0 0 |
| 55 | end |
| 56 | |
| 57 | fn main to int |
| 58 | for n ulong NCASE |
| 59 | setcase n |
| 60 | s = run |
| 61 | k = write 1 ta 0 len ta |
| 62 | pnum long n |
| 63 | pnum s |
| 64 | pnum get Yv 0 |
| 65 | pnum get Yv 1 |
| 66 | pnum long get Counts 0 |
| 67 | pnum long get Counts 1 |
| 68 | flush |
| 69 | end |
| 70 | k = write 1 te 0 len te |
| 71 | ret 0 |
| 72 | end |