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/interplane-forge/blob/main/galaxy/stars.om # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / galaxy / stars.om` 557 lines ยท 8798 bytes Raw Blame History 1 om2 2 note stars.om: the galaxy's stars and merges from the Radicle registry. Its own program. 3 note stars RIDS.md STORAGE/ [repos.tsv] 4 note Reads the FIRST table of RIDS.md (header "| repo | RID | default branch"), the table forged's 5 note allow-list uses, and writes stars.tsv in the working directory (tmp, sync, rename): 6 note R name tier one line per row whose name and RID are well formed, whose storage folder 7 note STORAGE/ exists and which is not on the deny list 8 note M repo head note the 8 rows with the latest UTC column, newest first 9 note tier is "core" when column 4 of repos.tsv says so for that name, else "rest". 10 note Exit 0 written, 1 usage, 2 RIDS.md unreadable or without the table, 3 write failed. 11 note At most 400 rows are listed (the page draws at most 400 stars) and the merges are chosen from the 12 note first 128 listed rows, so stars.tsv is at most 8*281 + 400*72 = 31,048 bytes, under the 32,768 13 note bytes galaxy-live reads. The crypto repositories are never listed, whatever the table says. 14 const SCAP ulong 400 15 global rb uchar 262144 16 global rbl ulong 1 17 global tb uchar 65536 18 global tbl ulong 1 19 global sp uchar 1024 20 global spl ulong 1 21 global pa uchar 1100 22 global wb uchar 65536 23 global wbl ulong 1 24 global rs ulong 128 25 global re ulong 128 26 global ru ulong 128 27 global rd ulong 128 28 global rn ulong 1 29 global pl uchar 64 30 global rk ulong 1 31 text thd "| repo | RID | default branch" 32 text dn1 "omega-pearl" 33 text dn2 "aien-crypto" 34 text dr1 "rad:`z2ft64NFLsKzWttCXw6NWNbRQLggQ`" 35 text tcor "core" 36 text tres "rest" 37 text fout "stars.tsv" 38 text ftmp "stars.tsv.tmp" 39 note ---- output buffer 40 fn wab c uchar to void 41 o = get wbl 0 42 if lt o 65535 43 put wb o c 44 put wbl 0 add o 1 45 end 46 end 47 fn wa t view uchar * to void 48 for i ulong len t bound 64 49 wab get t i 50 end 51 end 52 note was: at most cap bytes of rb a..b; a control byte or tab becomes a space 53 fn was a ulong b ulong cap ulong to void 54 e = b 55 if lt b a 56 ret 57 end 58 if gt sub b a cap 59 e = add a cap 60 end 61 i = a 62 while lt i e bound 262144 63 c = get rb i 64 if lt c 32 65 c = uchar 32 66 end 67 wab c 68 i = add i 1 69 end 70 end 71 note ---- scanning rb; every index stays inside 0..rbl 72 fn reol a ulong to ulong 73 lim = get rbl 0 74 i = a 75 while lt i lim bound 262144 76 if eq get rb i 10 77 ret i 78 end 79 i = add i 1 80 end 81 ret lim 82 end 83 fn rbar a ulong e ulong to ulong 84 i = a 85 while lt i e bound 262144 86 if eq get rb i 124 87 ret i 88 end 89 i = add i 1 90 end 91 ret e 92 end 93 note rbk: the k-th bar of the row s..e counting the leading one as 0; e when the row has fewer 94 fn rbk s ulong e ulong k ulong to ulong 95 p = s 96 j = ulong 0 97 while lt j k bound 16 98 p = rbar add p 1 e 99 j = add j 1 100 end 101 ret p 102 end 103 note rlb: the last bar before e in the row s..e, or s 104 fn rlb s ulong e ulong to ulong 105 i = e 106 while gt i s bound 262144 107 if eq get rb sub i 1 124 108 ret sub i 1 109 end 110 i = sub i 1 111 end 112 ret s 113 end 114 fn rtl a ulong e ulong to ulong 115 i = a 116 while lt i e bound 262144 117 if ne get rb i 32 118 ret i 119 end 120 i = add i 1 121 end 122 ret e 123 end 124 fn rtr a ulong e ulong to ulong 125 i = e 126 while gt i a bound 262144 127 if ne get rb sub i 1 32 128 ret i 129 end 130 i = sub i 1 131 end 132 ret a 133 end 134 fn ralnum c uchar to bool 135 if and ge c 97 le c 122 136 ret true 137 end 138 if and ge c 65 le c 90 139 ret true 140 end 141 ret and ge c 48 le c 57 142 end 143 fn rnameok a ulong b ulong to bool 144 if ge a b 145 ret false 146 end 147 if gt sub b a 64 148 ret false 149 end 150 i = a 151 while lt i b bound 64 152 c = get rb i 153 if not ralnum c 154 if not or or eq c 45 eq c 46 eq c 95 155 ret false 156 end 157 end 158 i = add i 1 159 end 160 ret true 161 end 162 note rridok: "rad:" then 20 to 56 letters and digits 163 fn rridok a ulong b ulong to bool 164 if lt b a 165 ret false 166 end 167 n = sub b a 168 if or lt n 24 gt n 60 169 ret false 170 end 171 if ne get rb a 114 172 ret false 173 end 174 if ne get rb add a 1 97 175 ret false 176 end 177 if ne get rb add a 2 100 178 ret false 179 end 180 if ne get rb add a 3 58 181 ret false 182 end 183 i = add a 4 184 while lt i b bound 64 185 if not ralnum get rb i 186 ret false 187 end 188 i = add i 1 189 end 190 ret true 191 end 192 fn rspeq a ulong b ulong t view uchar * to bool 193 n = len t 194 if lt b a 195 ret false 196 end 197 if ne sub b a n 198 ret false 199 end 200 i = ulong 0 201 while lt i n bound 64 202 if ne get rb add a i get t i 203 ret false 204 end 205 i = add i 1 206 end 207 ret true 208 end 209 fn rdeny na ulong nb ulong ra ulong rz ulong to bool 210 if rspeq na nb dn1 211 ret true 212 end 213 if rspeq na nb dn2 214 ret true 215 end 216 ret rspeq ra rz dr1 217 end 218 note rstore: STORAGE/ exists 219 fn rstore ra ulong rz ulong to bool 220 n = get spl 0 221 i = ulong 0 222 while lt i n bound 1024 223 put pa i get sp i 224 i = add i 1 225 end 226 j = add ra 4 227 while lt j rz bound 64 228 put pa n get rb j 229 n = add n 1 230 j = add j 1 231 end 232 ret eq faccess pa 0 n 0 0 233 end 234 note ---- tiers: repos.tsv lines "nameridheadtier..." 235 fn tfind a ulong e ulong c uchar to ulong 236 i = a 237 while lt i e bound 65536 238 if eq get tb i c 239 ret i 240 end 241 i = add i 1 242 end 243 ret e 244 end 245 fn tnameq a ulong b ulong s ulong f ulong to bool 246 if ne sub b a sub f s 247 ret false 248 end 249 n = sub b a 250 i = ulong 0 251 while lt i n bound 64 252 if ne get rb add a i get tb add s i 253 ret false 254 end 255 i = add i 1 256 end 257 ret true 258 end 259 note tcore: repos.tsv gives the name a..b (in rb) the tier "core" 260 fn tcore a ulong b ulong to bool 261 lim = get tbl 0 262 s = ulong 0 263 while lt s lim bound 65536 264 e = tfind s lim 10 265 f = tfind s e 9 266 if tnameq a b s f 267 t = tfind add f 1 e 9 268 t = tfind add t 1 e 9 269 t = add t 1 270 if le add t 4 e 271 if eq get tb t 99 272 if eq get tb add t 1 111 273 if eq get tb add t 2 114 274 if eq get tb add t 3 101 275 if eq add t 4 e 276 ret true 277 end 278 ret eq get tb add t 4 9 279 end 280 end 281 end 282 end 283 end 284 ret false 285 end 286 s = add e 1 287 end 288 ret false 289 end 290 note ---- rows 291 note rrow: one table row s..e. A listed row prints its R line and is remembered for the merges. 292 fn rrow s ulong e ulong to void 293 b1 = rbk s e 1 294 b2 = rbk s e 2 295 na = rtl add s 1 b1 296 nb = rtr na b1 297 ra = rtl add b1 1 b2 298 rz = rtr ra b2 299 if not rnameok na nb 300 ret 301 end 302 if not rridok ra rz 303 ret 304 end 305 if rdeny na nb ra rz 306 ret 307 end 308 if not rstore ra rz 309 ret 310 end 311 k = get rk 0 312 if ge k SCAP 313 ret 314 end 315 put rk 0 add k 1 316 wab 82 317 wab 9 318 was na nb 64 319 wab 9 320 if tcore na nb 321 wa tcor 322 else 323 wa tres 324 end 325 wab 10 326 n = get rn 0 327 if lt n 128 328 put rs n s 329 put re n e 330 f1 = rlb s e 331 f0 = rlb s f1 332 u = rtl add f0 1 f1 333 put ru n 0 334 if ge sub rtr u f1 u 20 335 if eq get rb u 50 336 put ru n u 337 end 338 end 339 put rd n 0 340 put rn 0 add n 1 341 end 342 end 343 note rlt: the 20-byte UTC stamp at a sorts before the one at b 344 fn rlt a ulong b ulong to bool 345 i = ulong 0 346 while lt i 20 bound 20 347 x = get rb add a i 348 y = get rb add b i 349 if lt x y 350 ret true 351 end 352 if gt x y 353 ret false 354 end 355 i = add i 1 356 end 357 ret false 358 end 359 fn rmerge i ulong to void 360 s = get rs i 361 e = get re i 362 b1 = rbk s e 1 363 b3 = rbk s e 3 364 b4 = rbk s e 4 365 f0 = rlb s rlb s e 366 na = rtl add s 1 b1 367 wab 77 368 wab 9 369 was na rtr na b1 64 370 wab 9 371 h = rtl add b3 1 b4 372 was h rtr h b4 12 373 wab 9 374 t = rtl add b4 1 f0 375 if gt f0 b4 376 was t rtr t f0 200 377 end 378 wab 10 379 end 380 note rtop: print up to 8 remembered rows, latest UTC first 381 fn rtop to void 382 n = get rn 0 383 k = ulong 0 384 while lt k 8 bound 8 385 best = ulong 128 386 i = ulong 0 387 while lt i n bound 128 388 if eq get rd i 0 389 u = get ru i 390 if gt u 0 391 if eq best 128 392 best = i 393 else 394 if rlt get ru best u 395 best = i 396 end 397 end 398 end 399 end 400 i = add i 1 401 end 402 if lt best 128 403 rmerge best 404 put rd best 1 405 end 406 k = add k 1 407 end 408 end 409 note rtable: the start of the first row after the header line, or rbl 410 fn rtable to ulong 411 lim = get rbl 0 412 s = ulong 0 413 while lt s lim bound 262144 414 e = reol s 415 if ge sub e s len thd 416 if rspeq s add s len thd thd 417 ret add e 1 418 end 419 end 420 s = add e 1 421 end 422 ret lim 423 end 424 fn rrows start ulong to void 425 lim = get rbl 0 426 s = start 427 while lt s lim bound 262144 428 e = reol s 429 if ge s e 430 ret 431 end 432 if ne get rb s 124 433 ret 434 end 435 if lt add s 1 e 436 if ne get rb add s 1 45 437 rrow s e 438 end 439 end 440 s = add e 1 441 end 442 end 443 note ---- files 444 fn ldr to bool 445 n = argread 1 pa 0 1023 446 if le n 0 447 ret false 448 end 449 fd = int fopen pa 0 ulong n 0 0 450 if lt fd 0 451 ret false 452 end 453 m = ulong 0 454 k = long 1 455 while gt k 0 bound 262145 456 k = read fd rb m sub 262144 m 457 if gt k 0 458 m = add m ulong k 459 end 460 end 461 r = fclose fd 462 put rbl 0 m 463 ret true 464 end 465 fn ldt to void 466 put tbl 0 0 467 n = argread 3 pa 0 1023 468 if le n 0 469 ret 470 end 471 fd = int fopen pa 0 ulong n 0 0 472 if lt fd 0 473 ret 474 end 475 m = ulong 0 476 k = long 1 477 while gt k 0 bound 65537 478 k = read fd tb m sub 65536 m 479 if gt k 0 480 m = add m ulong k 481 end 482 end 483 r = fclose fd 484 put tbl 0 m 485 end 486 fn wren to bool 487 la = len ftmp 488 lb = len fout 489 put pl 0 2 490 put pl 1 0 491 put pl 2 uchar la 492 put pl 3 0 493 i = ulong 0 494 while lt i la bound 28 495 put pl add 4 i get ftmp i 496 i = add i 1 497 end 498 o = add 4 la 499 put pl o uchar lb 500 put pl add o 1 0 501 k = ulong 0 502 while lt k lb bound 28 503 put pl add add o 2 k get fout k 504 k = add k 1 505 end 506 ret eq renames pl 0 add add o 2 lb 0 0 507 end 508 fn wout to bool 509 fd = int fopen ftmp 0 len ftmp 577 420 510 if lt fd 0 511 ret false 512 end 513 n = get wbl 0 514 o = ulong 0 515 ok = true 516 while lt o n bound 65536 517 k = write fd wb o sub n o 518 if le k 0 519 ok = false 520 o = n 521 else 522 o = add o ulong k 523 end 524 end 525 r = fsync fd 526 r = fclose fd 527 if not ok 528 ret false 529 end 530 ret wren 531 end 532 fn main to int 533 if lt argcnt 3 534 ret 1 535 end 536 if not ldr 537 ret 2 538 end 539 n = argread 2 sp 0 1023 540 if le n 0 541 ret 1 542 end 543 put spl 0 ulong n 544 if ge argcnt 4 545 ldt 546 end 547 t = rtable 548 if ge t get rbl 0 549 ret 2 550 end 551 rrows t 552 rtop 553 if wout 554 ret 0 555 end 556 ret 3 557 end