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/tools/codebook/main.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 / tools / codebook / main.om` 134 lines ยท 1535 bytes Raw Blame History 1 note tools/codebook/main.om -- the codebook command line. The functions it calls live in 2 note codebook.om, which tools/trit/build.sh also compiles into trit (OM-2 has no imports; both 3 note builds concatenate the same codebook.om bytes). 4 text tcext "ext" 5 text eeext "ERR notprefix" 6 7 fn argav to void 8 p = argread 1 av 0 len av 9 if lt p 1 10 exit 2 11 end 12 put avn 0 ulong p 13 end 14 15 fn aveq t view uchar * to bool 16 if ne get avn 0 len t 17 ret false 18 end 19 for i ulong len t bound BIG 20 if ne get av i get t i 21 ret false 22 end 23 end 24 ret true 25 end 26 27 fn main to int 28 c = argcnt 29 if lt c 2 30 ret 2 31 end 32 argav 33 if aveq tenc 34 rdin 35 doenc 36 wrall 1 37 ret 0 38 end 39 if aveq tdec 40 rdin 41 dodec 42 wrall 1 43 ret 0 44 end 45 if aveq tsha 46 if ne c 3 47 ret 2 48 end 49 ldcb 2 50 for i ulong 64 51 obyte get cs i 52 end 53 obyte 10 54 wrall 1 55 ret 0 56 end 57 if aveq tsign 58 if ne c 4 59 ret 2 60 end 61 ldcb 2 62 ldkey 3 63 rdin 64 dosign 65 zap 66 wrall 1 67 ret 0 68 end 69 if aveq tver 70 if and ne c 5 ne c 6 71 ret 2 72 end 73 ldcb 2 74 ldkey 3 75 q = argread 4 sd 0 len sd 76 if lt q 1 77 ret 2 78 end 79 put sdn 0 ulong q 80 put vln 0 110 81 if eq c 6 82 q2 = argread 5 av 0 len av 83 if ne q2 1 84 ret 2 85 end 86 if and ne get av 0 110 ne get av 0 101 87 ret 2 88 end 89 put vln 0 ulong get av 0 90 end 91 rdin 92 lk = lockst 93 dover 94 unlockst lk 95 zap 96 wrall 1 97 ret 0 98 end 99 if aveq tcext 100 if ne c 4 101 ret 2 102 end 103 ldcb 2 104 put msn 0 0 105 for i ulong get cbn 0 bound BIG 106 msbyte get cbk i 107 end 108 ldcb 3 109 m = get msn 0 110 if lt get cbn 0 m 111 otext eeext 112 obyte 10 113 wrall 1 114 ret 6 115 end 116 for j ulong m bound BIG 117 if ne get cbk j get ms j 118 otext eeext 119 obyte 10 120 wrall 1 121 ret 6 122 end 123 end 124 otext vok 125 obyte 32 126 for q ulong 64 127 obyte get cs q 128 end 129 obyte 10 130 wrall 1 131 ret 0 132 end 133 ret 2 134 end