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/reserve.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 / reserve.om` 105 lines ยท 1869 bytes Raw Blame History 1 note Owned low-address reservations and complete-span file binding. Host only. 2 text path "reserve.bin" 3 text mark "Z" 4 text msg "PASS owned reservations, collision refusal and failed-bind retirement\n" 5 global buf uchar 4 6 global status uchar 4 7 global fds int 2 8 fn ck yes bool to void 9 if not yes 10 exit int 80 11 end 12 end 13 fn bad k int to void 14 if eq k 0 15 r = maphold 4096 4096 16 ret 17 end 18 if eq k 1 19 r = maphold `1099511627776` 4096 20 ret 21 end 22 if eq k 2 23 r = maphold `68719476737` 4096 24 ret 25 end 26 if eq k 3 27 r = maphold `68719476736` 4097 28 ret 29 end 30 if eq k 4 31 r = maphold `18446744073709551615` 4096 32 ret 33 end 34 h = maphold `68719542272` 4096 35 ck gt h 0 36 if eq k 5 37 r = mapread h 0 buf 0 1 38 ret 39 end 40 if eq k 6 41 r = mapwrite h 0 mark 0 1 42 ret 43 end 44 if eq k 7 45 r = mapget h 0 4 46 ret 47 end 48 if eq k 8 49 r = mapset h 0 4 0 50 ret 51 end 52 if eq k 9 53 ck eq mapbind h neg int 1 0 3 neg long 9 54 r = mapaddr h 55 ret 56 end 57 ck eq mapbind h get fds 0 0 3 0 58 r = mapbind h get fds 0 0 3 59 end 60 fn main to int 61 fd = fopen path 0 len path 524482 384 62 ck ge fd 0 63 put fds 0 int fd 64 ck eq fseek int fd 4095 0 4095 65 ck eq write int fd mark 0 1 1 66 ro = fopen path 0 len path 524288 0 67 ck ge ro 0 68 put fds 1 int ro 69 for i ulong 16 70 h = maphold `68719476736` 4096 71 ck gt h 0 72 ck eq mapaddr h `68719476736` 73 ck eq maphold `68719476736` 4096 neg long 17 74 ck eq mapbind h int fd 0 3 0 75 ck eq mapread h 4095 buf 0 1 1 76 ck eq get buf 0 90 77 ck eq mapset h 0 4 add 123 i 0 78 ck eq mapget h 0 4 add 123 i 79 ck eq mapdrop h 0 80 end 81 h = maphold `68719476736` 4096 82 ck gt h 0 83 ck eq mapbind h int ro 0 3 neg long 13 84 j = maphold `68719476736` 4096 85 ck gt j 0 86 ck ne j h 87 ck eq mapbind j int ro 0 1 0 88 ck eq mapget j 0 4 138 89 ck eq mapdrop j 0 90 for k int 11 91 p = fork 92 ck ge p 0 93 if eq p 0 94 bad k 95 exit int 80 96 end 97 ck eq waitpid int p status 0 4 0 p 98 ck and eq get status 0 0 eq get status 1 103 99 end 100 ck eq fclose int fd 0 101 ck eq fclose int ro 0 102 ck eq unlink path 0 len path 0 103 ck eq write 1 msg 0 len msg long len msg 104 ret 0 105 end