interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / omc / om2 / fnhost / ok.om

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