Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/omc/om2/s4/v-ok.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / omc / om2 / s4 / v-ok.om` 72 lines ยท 1434 bytes Raw Blame History 1 note S4 unsized views (spec 6, erratum E2): sized arrays, an unsized name and a text passed to `view T *` 2 note and `edit T *` parameters of internal functions, inline ones included; `len` is the run-time count 3 note (ulong); constant and run-time indexes in range; a write slice inside the view; six parameter slots 4 note mixing scalars and unsized arrays (pointer then count). Exit 0 when every check holds, else the 5 note failing check's number. 6 om2 7 text msg "abcdef" 8 fn vsum v view ulong * to ulong 9 x = ulong 0 10 for i ulong len v 11 x = add x get v i 12 end 13 ret x 14 end 15 fn pass v view ulong * to ulong 16 ret vsum v 17 end 18 fn isum v view ulong * to ulong inline 19 ret add get v 0 get v sub len v 1 20 end 21 fn fill e edit uchar * c uchar to ulong 22 for i ulong len e 23 put e i add c uchar i 24 end 25 ret len e 26 end 27 fn six a ulong v view ulong * b ulong w edit uchar * to ulong 28 put w 0 uchar b 29 ret add add mul a 1000 len v add mul b 100 len w 30 end 31 fn bytes t view uchar * to ulong 32 ret add mul ulong get t 0 256 len t 33 end 34 fn sl a ulong v view uchar * b ulong to ulong 35 ret add add mul a 100 mul len v 10 b 36 end 37 fn main to int 38 u = new uchar 7 0 39 if ne sl 3 u 4 374 40 ret 10 41 end 42 a = new ulong 5 3 43 put a 4 10 44 if ne vsum a 22 45 ret 1 46 end 47 if ne pass a 22 48 ret 2 49 end 50 if ne isum a 13 51 ret 3 52 end 53 if ne fill u 40 7 54 ret 4 55 end 56 if ne get u 6 46 57 ret 5 58 end 59 if ne six 2 a 9 u 2912 60 ret 6 61 end 62 if ne get u 0 9 63 ret 7 64 end 65 if ne bytes msg 24838 66 ret 8 67 end 68 if ne bytes view u 2311 69 ret 9 70 end 71 ret 0 72 end