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 / fnhost / x86-ok.om
| 1 | target x86linux |
| 2 | note ok.om: an OM-2 function unit (no fn main) using every function-mode host word: getuid geteuid |
| 3 | note getgid getegid, stat lstat fopen fstat fclose, and read. Compiles (exit 0) since the om2 function-mode |
| 4 | note host-word subset; the same unit without the om2 line is error 9 (om1.om). |
| 5 | om2 |
| 6 | fn ids to ulong |
| 7 | a = ulong getuid |
| 8 | b = ulong geteuid |
| 9 | c = ulong getgid |
| 10 | e = ulong getegid |
| 11 | ret add add a b add c e |
| 12 | end |
| 13 | fn peek p view uchar * to long |
| 14 | s = new uchar 128 0 |
| 15 | r = lstat p 0 len p s 0 128 |
| 16 | if ne r 0 |
| 17 | ret r |
| 18 | end |
| 19 | r = stat p 0 len p s 0 128 |
| 20 | if ne r 0 |
| 21 | ret r |
| 22 | end |
| 23 | fd = fopen p 0 len p 559104 0 |
| 24 | if lt fd 0 |
| 25 | ret fd |
| 26 | end |
| 27 | b = new uchar 16 0 |
| 28 | k = fstat int fd s 0 128 |
| 29 | n = read int fd b 0 16 |
| 30 | z = fclose int fd |
| 31 | if ne k 0 |
| 32 | ret k |
| 33 | end |
| 34 | ret n |
| 35 | end |