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/apps/interplane-forge/patch/p5imp.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 / apps / interplane-forge / patch / p5imp.om` 1281 lines ยท 23363 bytes Raw Blame History 1 note patch/p5imp.om: imported proposals (SPEC prstore/r1 extension, written only by tools/ghimport): 2 note reading an imported item back, its list row and page, and the diff of a bundle-backed item. 3 note Every imported byte goes out through fescc (HTML) or fjtc (JSON); a GitHub login is text. Each 4 note reader checks a length against its buffer before it reads, so a malformed or oversized file 5 note ends in "not an item", a cut value or a sentence on the page, never in a trap. 6 note ---- loading 7 note pafrd t cap: the file of item gpid into fxo; its length cut to cap, 0 when it cannot be read 8 fn pafrd t view uchar * cap ulong to ulong 9 pafp t 10 n = frdall 11 if lt n 0 12 ret 0 13 end 14 ret hmin ulong n cap 15 end 16 note pasjat s t: gpsrc holds t at s (the caller keeps s + len t inside gpsrc) 17 fn pasjat s ulong t view uchar * to bool 18 for i ulong len t bound 64 19 if ne get gpsrc add s i get t i 20 ret false 21 end 22 end 23 ret true 24 end 25 note pasjf t: the offset in gpsrc of the first t, the length of gpsrc when it is not there 26 fn pasjf t view uchar * to ulong 27 n = get gpsrcl 0 28 k = len t 29 if gt k n 30 ret n 31 end 32 for s ulong add sub n k 1 bound 4097 33 if pasjat s t 34 ret s 35 end 36 end 37 ret n 38 end 39 note pasjv t: the string value after the key text t in gpsrc: its offset; its length in gpr 15, and gpr 40 note 14 is 1 when the key is there (0 and length 0 when it is not). The value ends at its closing 41 note quote; a backslash ends it too (the value is cut there, never decoded), and so does the end of 42 note the buffer 43 fn pasjv t view uchar * to ulong 44 n = get gpsrcl 0 45 s = pasjf t 46 put gpr 15 0 47 put gpr 14 0 48 if ge s n 49 ret 0 50 end 51 put gpr 14 1 52 p = add s len t 53 q = p 54 while lt q n bound 4097 55 c = get gpsrc q 56 if or eq c 34 eq c 92 57 break 58 end 59 q = add q 1 60 end 61 put gpr 15 sub q p 62 ret p 63 end 64 note pasjnum: the number of source.json ("number":N, 1..18 digits), 0 when it has none 65 fn pasjnum to ulong 66 n = get gpsrcl 0 67 s = pasjf tpsjnum 68 if ge s n 69 ret 0 70 end 71 p = add s len tpsjnum 72 v = ulong 0 73 k = ulong 0 74 while lt p n bound 19 75 c = get gpsrc p 76 if not fisdig c 77 break 78 end 79 if ge k 18 80 ret 0 81 end 82 v = add mul v 10 ulong sub c 48 83 k = add k 1 84 p = add p 1 85 end 86 ret v 87 end 88 note paghat s e t: the gh line gpgh[s, e) starts with t 89 fn paghat s ulong e ulong t view uchar * to bool 90 if lt sub e s len t 91 ret false 92 end 93 for i ulong len t bound 16 94 if ne get gpgh add s i get t i 95 ret false 96 end 97 end 98 ret true 99 end 100 note paghv t: the value of the gh line "\n" in gpgh: its offset; its length in gpr 15 (0 101 note when there is no such whole line) 102 fn paghv t view uchar * to ulong 103 n = get gpghl 0 104 s = ulong 0 105 for i ulong n bound 2048 106 if eq get gpgh i 10 107 if paghat s i t 108 put gpr 15 sub sub i s len t 109 ret add s len t 110 end 111 s = add i 1 112 end 113 end 114 put gpr 15 0 115 ret 0 116 end 117 note paghnum: the GitHub number of the gh file ("number N", 1..18 digits), 0 when it has none 118 fn paghnum to ulong 119 o = paghv tpghn 120 k = get gpr 15 121 if or eq k 0 gt k 18 122 ret 0 123 end 124 v = ulong 0 125 for i ulong k bound 18 126 c = get gpgh add o i 127 if not fisdig c 128 ret 0 129 end 130 v = add mul v 10 ulong sub c 48 131 end 132 ret v 133 end 134 note paiload2: the optional files of the imported item: title (cut to 1024 bytes), base (40 hex and 135 note a line feed, else the item has no base), gh (cut to 2048 bytes), and the code file: mbox, else 136 note head.bundle, else none (its size in gpmby) 137 fn paiload2 to bool 138 n = pafrd tpftt 1024 139 for i ulong n bound 1024 140 put gpttl i get fxo i 141 end 142 put gpttll 0 n 143 put gpihb 0 0 144 papid tpfbase 145 r = pards 146 if pal40 147 put gpihb 0 1 148 for i ulong 40 149 put gpbase i get gpln i 150 end 151 end 152 n = pafrd tpfgh 2048 153 for i ulong n bound 2048 154 put gpgh i get fxo i 155 end 156 put gpghl 0 n 157 put gpnum 0 paghnum 158 if eq get gpnum 0 0 159 put gpnum 0 pasjnum 160 end 161 put gpicode 0 0 162 put gpmby 0 0 163 papid tpfbn 164 e = paexist 165 if e 166 put gpicode 0 2 167 put gpmby 0 pastsz 168 end 169 papid tpfmb 170 e = paexist 171 if e 172 put gpicode 0 1 173 put gpmby 0 pastsz 174 end 175 put gpmcm 0 0 176 put gpmfl 0 0 177 put gpmdidl 0 0 178 put gpmts 0 0 179 ret true 180 end 181 note paiload: the imported item gpid into the globals (SPEC section 1): false unless source.json 182 note starts with the import prefix, status is one of the three words and head is 40 hex and a line 183 note feed. source.json is kept up to 4096 bytes. 184 fn paiload to bool 185 put gpimp 0 1 186 n = pafrd tpfsj 4096 187 if lt n len tpsjpre 188 ret false 189 end 190 for i ulong len tpsjpre bound 64 191 if ne get fxo i get tpsjpre i 192 ret false 193 end 194 end 195 for i ulong n bound 4096 196 put gpsrc i get fxo i 197 end 198 put gpsrcl 0 n 199 put gpider 0 0 200 if lt pasjf tpsjder n 201 put gpider 0 1 202 end 203 s = pastrd 204 if gt s 2 205 ret false 206 end 207 put gpist 0 s 208 papid tpfhd 209 r = pards 210 if not pal40 211 ret false 212 end 213 for i ulong 40 214 put gphead i get gpln i 215 end 216 ret paiload2 217 end 218 note ---- the thread: records "comment