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 / om2 / s4 / v-pwrite-text.om
| 1 | note S4: pwrite only reads its array, so a text and a view are allowed (error 20 is for pread). |
| 2 | note Writes ABC at file position 0 and a newline at 3 of stdout (exit 0). |
| 3 | om2 |
| 4 | text t "ABC" |
| 5 | fn g v view uchar * to long |
| 6 | ret pwrite 1 v 0 len v 0 |
| 7 | end |
| 8 | fn main to int |
| 9 | r = g t |
| 10 | if ne r 3 |
| 11 | ret 1 |
| 12 | end |
| 13 | nl = new uchar 1 10 |
| 14 | r = pwrite 1 nl 0 1 3 |
| 15 | if ne r 1 |
| 16 | ret 2 |
| 17 | end |
| 18 | ret 0 |
| 19 | end |