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/host/tests/mapio.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 / host / tests / mapio.om` 100 lines ยท 1771 bytes Raw Blame History 1 note Exact word access through managed mappings. No GPU or device opens. 2 global bytes uchar 16 3 global status uchar 4 4 text msg "PASS managed addresses and ordered mapped words\n" 5 fn ck yes bool to void 6 if not yes 7 exit int 80 8 end 9 end 10 fn bad k int to void 11 h = mapnew neg int 1 0 4096 3 34 12 ck gt h 0 13 if eq k 0 14 ck eq mapdrop h 0 15 r = mapaddr h 16 ret 17 end 18 if eq k 1 19 ck eq mapdrop h 0 20 r = mapget h 0 4 21 ret 22 end 23 if eq k 2 24 r = mapget h 4096 4 25 ret 26 end 27 if eq k 3 28 r = mapset h 4092 8 0 29 ret 30 end 31 if eq k 4 32 r = mapget h 1 4 33 ret 34 end 35 if eq k 5 36 r = mapset h 4 8 0 37 ret 38 end 39 if eq k 6 40 ro = mapnew neg int 1 0 4096 1 34 41 r = mapset ro 0 4 0 42 ret 43 end 44 if eq k 7 45 r = mapset h 0 4 `4294967296` 46 ret 47 end 48 r = mapget h `18446744073709551615` 8 49 end 50 fn held h long a ulong b ulong c ulong d ulong e ulong to void 51 ck gt mapaddr h 4096 52 ck eq mapset h 0 8 `18446744073709551615` 0 53 ck eq mapget h 0 8 `18446744073709551615` 54 ck eq a 101 55 ck eq b 202 56 ck eq c 303 57 ck eq d 404 58 ck eq e 505 59 end 60 fn main to int 61 h = mapnew neg int 1 0 4096 3 33 62 ck gt h 0 63 ck eq and mapaddr h 4095 0 64 held h 101 202 303 404 505 65 ck eq mapset h 8 4 `4294967295` 0 66 ck eq mapget h 8 4 `4294967295` 67 ck eq mapset h 12 4 `305419896` 0 68 ck eq mapread h 0 bytes 0 16 16 69 for i ulong 12 70 ck eq get bytes i 255 71 end 72 ck eq get bytes 12 120 73 ck eq get bytes 13 86 74 ck eq get bytes 14 52 75 ck eq get bytes 15 18 76 ck eq mapset h 4088 8 `81985529216486895` 0 77 ck eq mapget h 4088 8 `81985529216486895` 78 p = fork 79 ck ge p 0 80 if eq p 0 81 ck eq mapset h 0 8 42 0 82 exit int 0 83 end 84 ck eq waitpid int p status 0 4 0 p 85 ck and eq get status 0 0 eq get status 1 0 86 ck eq mapget h 0 8 42 87 ck eq mapdrop h 0 88 for k int 9 89 p = fork 90 ck ge p 0 91 if eq p 0 92 bad k 93 exit int 80 94 end 95 ck eq waitpid int p status 0 4 0 p 96 ck and eq get status 0 0 eq get status 1 103 97 end 98 ck eq write 1 msg 0 len msg long len msg 99 ret 0 100 end