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 / aienux / connector / gates / hostile / writer.om
| 1 | note hostile probe: create the file named on stdin and write to it; prints the open result |
| 2 | text m1 "open " |
| 3 | text m2 "wrote\n" |
| 4 | text nl "\n" |
| 5 | fn main to int |
| 6 | p = new uchar 512 0 |
| 7 | n = read 0 p 0 511 |
| 8 | if le n 1 |
| 9 | ret 2 |
| 10 | end |
| 11 | m = sub ulong n 1 |
| 12 | fd = fopen p 0 m 577 420 |
| 13 | k = write 1 m1 0 len m1 |
| 14 | if lt fd 0 |
| 15 | put p 0 45 |
| 16 | put p 1 49 |
| 17 | k = write 1 p 0 2 |
| 18 | k = write 1 nl 0 len nl |
| 19 | ret 0 |
| 20 | end |
| 21 | k = write int fd m2 0 len m2 |
| 22 | k = write 1 m2 0 len m2 |
| 23 | ret 0 |
| 24 | end |