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/device.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 / device.om` 102 lines ยท 1641 bytes Raw Blame History 1 note Host/device composition. No GPU opened. FIONREAD observes real native pipes. 2 global ends uchar 8 3 global count uchar 12 4 global status uchar 4 5 text msg "Omega device boundary" 6 text zero "/dev/zero" 7 fn word32 off ulong to int 8 v = uint 0 9 for i ulong 4 10 v = or v shl uint get ends add off i mul i 8 11 end 12 ret int v 13 end 14 fn fault kind int to int 15 if eq kind 0 16 r = devctl neg int 1 uint 21531 count 0 3 17 ret int r 18 end 19 if eq kind 1 20 r = devctl neg int 1 uint 21531 count 0 5 21 ret int r 22 end 23 if eq kind 2 24 r = devctl neg int 1 uint 21531 count 9 4 25 ret int r 26 end 27 if eq kind 3 28 r = devctl neg int 1 uint 21531 count `18446744073709551615` 4 29 ret int r 30 end 31 r = devctl neg int 1 uint 21531 count 0 `18446744073709551615` 32 ret int r 33 end 34 fn main to int 35 if ne pipefds ends 0 8 0 0 36 ret 1 37 end 38 rd = word32 0 39 wr = word32 4 40 if ne write wr msg 0 len msg long len msg 41 ret 2 42 end 43 for i ulong 12 44 put count i 171 45 end 46 if ne devctl rd uint 21531 count 4 4 0 47 ret 3 48 end 49 if ne get count 4 uchar len msg 50 ret 4 51 end 52 for i ulong 12 53 if or lt i 4 ge i 8 54 if ne get count i 171 55 ret 5 56 end 57 else 58 if and gt i 4 ne get count i 0 59 ret 6 60 end 61 end 62 end 63 if ne devctl neg int 1 uint 21531 count 4 4 neg long 9 64 ret 7 65 end 66 note Normal file operations and nested native calls retain live values. 67 fd = fopen zero 0 len zero 0 0 68 if lt fd 0 69 ret 8 70 end 71 if ne add devctl int fd uint 21531 count 4 4 25 0 72 ret 9 73 end 74 if ne fclose int fd 0 75 ret 10 76 end 77 if ne fclose rd 0 78 ret 11 79 end 80 if ne fclose wr 0 81 ret 12 82 end 83 for kind int 5 84 pid = fork 85 if lt pid 0 86 ret 13 87 end 88 if eq pid 0 89 exit fault kind 90 end 91 if ne waitpid int pid status 0 4 0 pid 92 ret 14 93 end 94 if ne get status 0 0 95 ret 15 96 end 97 if ne get status 1 103 98 ret 16 99 end 100 end 101 ret 0 102 end