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 / host / tests / stat.om

42 lines · 621 bytes Raw Blame History
1note stat: path-based metadata without opening the file. st_size is at byte 48 of the ARM64 stat structure.
2text p "stat.tmp"
3text body "abcdefgh"
4text miss "no.such.file"
5fn main to int
6fd = int fopen p 0 len p 577 420
7if lt fd 0
8ret 1
9end
10w = write fd body 0 len body
11if ne w long len body
12ret 2
13end
14r = fclose fd
15if ne r 0
16ret 3
17end
18buf = new uchar 128 0
19r = stat p 0 len p buf 0 128
20if ne r 0
21ret 4
22end
23if ne get buf 48 8
24ret 5
25end
26k = ulong 49
27while lt k 56 bound 8
28if ne get buf k 0
29ret 6
30end
31k = add k 1
32end
33r = stat miss 0 len miss buf 0 128
34if ge r 0
35ret 7
36end
37r = unlink p 0 len p
38if ne r 0
39ret 8
40end
41ret 0
42end