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 / native / prefetch / review-nested.om
| 1 | note Independent mutations of complete native-generated receipt. argv0..9. |
| 2 | text needles "\"tok_same\":0\n\"tok_same\":0\n\"tok_same\":0\n\"mutant1\":{\"rc\":0\n\"mutant1\":{\"rc\":0,\"token\":2,\"logit_max_abs\":0.2,\"caught\":1\n\"mutant2\":{\"rc\":0\n\"mutant2\":{\"rc\":0,\"token\":2,\"logit_max_abs\":0.2,\"caught\":1\n\"B\":{\"launches\":100,\"submits\":100,\"identical\":1\n\"B\":{\"launches\":100,\"submits\":100,\"identical\":1\n\"B\":{\"launches\":100,\"submits\":100,\"identical\":1\n" |
| 3 | text repl "\"tok_same\":1\n\"tok_wrong\":0\n\"tok_same\":0,\"tok_same\":0\n\"mutant1\":{\"rc\":1\n\"mutant1\":{\"rc\":0,\"token\":2,\"logit_max_abs\":0.2,\"caught\":0\n\"mutant2\":{\"rc\":1\n\"mutant2\":{\"rc\":0,\"token\":2,\"logit_max_abs\":0.2,\"caught\":0\n\"B\":{\"launches\":100,\"submits\":100,\"identical\":0\n\"B\":{\"launches\":100,\"submits\":100,\"identical\":1,\"identical\":1\n\"B\":{\"launches\":100,\"submits\":100,\"other\":1\n" |
| 4 | global data uchar 4096 |
| 5 | global mode uchar 1 |
| 6 | global loc ulong 4 |
| 7 | fn matches pos ulong to bool |
| 8 | for j ulong get loc 1 |
| 9 | if ne get data add pos j get needles add get loc 0 j |
| 10 | ret false |
| 11 | end |
| 12 | end |
| 13 | ret true |
| 14 | end |
| 15 | fn main to int |
| 16 | if ne argread 1 mode 0 1 1 |
| 17 | ret 64 |
| 18 | end |
| 19 | m = sub ulong get mode 0 48 |
| 20 | if gt m 9 |
| 21 | ret 64 |
| 22 | end |
| 23 | begin = ulong 0 |
| 24 | line = ulong 0 |
| 25 | for i ulong len needles |
| 26 | if eq get needles i 10 |
| 27 | if eq line m |
| 28 | put loc 0 begin |
| 29 | put loc 1 sub i begin |
| 30 | end |
| 31 | begin = add i 1 |
| 32 | line = add line 1 |
| 33 | end |
| 34 | end |
| 35 | begin = 0 |
| 36 | line = 0 |
| 37 | for i ulong len repl |
| 38 | if eq get repl i 10 |
| 39 | if eq line m |
| 40 | put loc 2 begin |
| 41 | put loc 3 sub i begin |
| 42 | end |
| 43 | begin = add i 1 |
| 44 | line = add line 1 |
| 45 | end |
| 46 | end |
| 47 | n = read 0 data 0 len data |
| 48 | if le n 0 |
| 49 | ret 65 |
| 50 | end |
| 51 | for pos ulong ulong n |
| 52 | if le add pos get loc 1 ulong n |
| 53 | if matches pos |
| 54 | r = write 1 data 0 pos |
| 55 | r = write 1 repl get loc 2 get loc 3 |
| 56 | after = add pos get loc 1 |
| 57 | r = write 1 data after sub ulong n after |
| 58 | ret 0 |
| 59 | end |
| 60 | end |
| 61 | end |
| 62 | ret 1 |
| 63 | end |