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/p5page.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 / p5page.om` 614 lines ยท 10498 bytes Raw Blame History 1 note patch/p5page.om: reading the store back, the HTML pages (list, one patch, how to open one) and 2 note the raw routes (.patch: the stored mbox bytes; .diff: the diff the forge made when it applied them). 3 note ---- reading a stored patch 4 note pafp t: fpth = the file of patch gpid, for frdall 5 fn pafp t view uchar * to void 6 papid t 7 fpb 8 for i ulong get gppl 0 bound 4096 9 fpc get gpp i 10 end 11 end 12 note pamnum: the decimal number at fxo[gpcur] up to its line feed; gpcur moves past the line feed; 13 note gpbad is set when it is not 1..18 digits followed by a line feed 14 fn pamnum to ulong 15 p = get gpcur 0 16 n = get fxol 0 17 v = ulong 0 18 k = ulong 0 19 while lt p n bound 32 20 c = get fxo p 21 if eq c 10 22 break 23 end 24 if or not fisdig c ge k 18 25 put gpbad 0 1 26 ret 0 27 end 28 v = add mul v 10 ulong sub c 48 29 k = add k 1 30 p = add p 1 31 end 32 if or eq k 0 ge p n 33 put gpbad 0 1 34 end 35 put gpcur 0 add p 1 36 ret v 37 end 38 note pameld: the meta file into gpmdid, gpmts, gpmcm, gpmfl, gpmby, gpmsha 39 fn pameld to bool 40 pafp tpfme 41 n = frdall 42 if or lt n 80 gt n 250 43 ret false 44 end 45 e = ulong 0 46 while lt e ulong n bound 256 47 if eq get fxo e 10 48 break 49 end 50 e = add e 1 51 end 52 if or lt e 9 gt e 120 53 ret false 54 end 55 for i ulong e bound 128 56 put gpmdid i get fxo i 57 end 58 put gpmdidl 0 e 59 put gpbad 0 0 60 put gpcur 0 add e 1 61 put gpmts 0 pamnum 62 put gpmcm 0 pamnum 63 put gpmfl 0 pamnum 64 put gpmby 0 pamnum 65 p = get gpcur 0 66 if or ne get gpbad 0 0 ne add p 65 ulong n 67 ret false 68 end 69 for i ulong 64 70 put gpmsha i get fxo add p i 71 end 72 ret true 73 end 74 note pastld: the statement into gpst and its base line into gpbase (the statement ends with base, 75 note line feed, two lines of 64 hex and a line feed each: the base is 171 bytes before the end) 76 fn pastld to bool 77 pafp tpfst 78 n = frdall 79 if or lt n 180 gt n 511 80 ret false 81 end 82 for i ulong ulong n bound 512 83 put gpst i get fxo i 84 end 85 put gpstl 0 ulong n 86 o = sub ulong n 171 87 for i ulong 40 88 c = get fxo add o i 89 if lt sohexv c 0 90 ret false 91 end 92 put gpbase i c 93 end 94 ret true 95 end 96 note paload: patch gpid of this repository into the globals; false when it is not a whole stored patch 97 fn paload to bool 98 if not pameld 99 ret false 100 end 101 pafp tpftt 102 n = frdall 103 if or lt n 1 gt n 256 104 ret false 105 end 106 for i ulong ulong n bound 256 107 put gpttl i get fxo i 108 end 109 put gpttll 0 ulong n 110 if not pastld 111 ret false 112 end 113 pafp tpfhd 114 n = frdall 115 if lt n 0 116 ret false 117 end 118 ret pahex40 119 end 120 note paany: item gpid of this repository into the globals, signed (its meta file exists: paload) or 121 note imported (patch/p5imp.om paiload); false when it is neither a whole signed patch nor a loadable 122 note imported item 123 fn paany to bool 124 put gpimp 0 0 125 put gpist 0 0 126 put gpider 0 0 127 put gpicode 0 1 128 put gpihb 0 1 129 put gpnum 0 0 130 papid tpfme 131 e = paexist 132 if e 133 ret paload 134 end 135 ret paiload 136 end 137 note paqst: the state of item gpid for the list head: 0 open, 1 closed, 2 merged when its page loader 138 note loads it (paany: paload for a signed patch, which is open; paiload for an imported item), 9 when 139 note it does not. The loaders read through fxo, so the caller keeps the index in gpix 140 fn paqst to ulong 141 if not paany 142 ret 9 143 end 144 ret get gpist 0 145 end 146 note pastcnt tot: the items of the index in gpix (tot lines) that load, by state, into gpsc: exactly 147 note the items a list page shows. A line that is not an id, or whose folder does not load as an item, 148 note is in no count (palist: damaged = tot less the three counts) 149 fn pastcnt tot ulong to void 150 for s ulong 3 151 put gpsc s 0 152 end 153 for r ulong tot bound `1048576` 154 if paidrow mul r 17 155 s = paqst 156 if lt s 3 157 put gpsc s add get gpsc s 1 158 end 159 end 160 end 161 end 162 note paidrow o: gpid = gpix[o, o+16) when it is 16 lowercase hex 163 fn paidrow o ulong to bool 164 for i ulong 16 165 c = get gpix add o i 166 if lt sohexv c 0 167 ret false 168 end 169 put gpid i c 170 end 171 ret true 172 end 173 note pardf t: the file of patch gpid into fxo; its length, 0 when it cannot be read 174 fn pardf t view uchar * to ulong 175 pafp t 176 n = frdall 177 if lt n 0 178 ret 0 179 end 180 ret ulong n 181 end 182 note ---- pieces 183 note padid: the social store's id of the author DID in gpmdid, 0 when it holds no such account 184 fn padid to ulong 185 sokclr 186 for i ulong get gpmdidl 0 bound 128 187 sokc get gpmdid i 188 end 189 ret sofind 190 end 191 note paauth: the author as the pages show an account (its name linked, else the shortened DID 192 note linked; social/50route.om souser); the full DID in code when the store has no such account 193 fn paauth to void 194 d = padid 195 if ne d 0 196 souser d 197 ret 198 end 199 fput tphcode 200 for i ulong get gpmdidl 0 bound 128 201 fescc get gpmdid i 202 end 203 fput tphcodz 204 end 205 fn paputid to void 206 for i ulong 16 207 fputc get gpid i 208 end 209 end 210 note papath: the page path of patch gpid: //patches/ 211 fn papath to void 212 fputrl 213 fput tppats 214 fputc 47 215 paputid 216 end 217 fn paput40 w ulong to void 218 for i ulong 40 219 if eq w 0 220 fputc get gpbase i 221 else 222 fputc get gphead i 223 end 224 end 225 end 226 note pacnts: "N commits · M files" 227 fn pacnts to void 228 c = get gpmcm 0 229 fnum c 230 if eq c 1 231 fput tphc1 232 else 233 fput tphc2 234 end 235 fput tphm3 236 f = get gpmfl 0 237 fnum f 238 if eq f 1 239 fput tphf1 240 else 241 fput tphf2 242 end 243 end 244 fn paesct to void 245 for i ulong get gpttll 0 bound 1024 246 fescc get gpttl i 247 end 248 end 249 note ---- the list: the index file holds one line "<16 hex>\n" per patch, oldest first; a page shows 250 note 30, newest first 251 note paidxn: the index into fxo; the number of patches 252 fn paidxn to ulong 253 paprepo 254 papt tpindex 255 fpb 256 for i ulong get gppl 0 bound 4096 257 fpc get gpp i 258 end 259 n = frdall 260 if lt n 0 261 ret 0 262 end 263 if ne get fxotr 0 0 264 fincut 265 end 266 ret div ulong n 17 267 end 268 note pacount: the patches the store holds for the repository fridx (growth/g1prep.om grpatch) 269 fn pacount to ulong 270 ret paidxn 271 end 272 note papage: the ?page= number, 1 when absent or not a number of 1 to 9 digits above zero 273 fn papage to ulong 274 n = fqget tpqpage 275 if or lt n 1 gt n 9 276 ret 1 277 end 278 v = ulong 0 279 for i ulong ulong n bound 9 280 c = get fval i 281 if not fisdig c 282 ret 1 283 end 284 v = add mul v 10 ulong sub c 48 285 end 286 if eq v 0 287 ret 1 288 end 289 ret v 290 end 291 note paixld: the index into gpix (read through fxo, paidxn); the number of its lines 292 fn paixld to ulong 293 tot = paidxn 294 for i ulong mul tot 17 bound `16777216` 295 put gpix i get fxo i 296 end 297 ret tot 298 end 299 note papick: the ids of page pg (of tot lines in gpix) into gpids, newest first; how many 300 fn papick tot ulong pg ulong to ulong 301 a = mul sub pg 1 30 302 c = ulong 0 303 for j ulong 30 304 k = add a j 305 if ge k tot 306 break 307 end 308 o = mul sub sub tot 1 k 17 309 for i ulong 16 310 put gpids add mul c 16 i get gpix add o i 311 end 312 c = add c 1 313 end 314 ret c 315 end 316 note paidset: gpid = row j of gpids; false when it is not 16 lowercase hex 317 fn paidset j ulong to bool 318 for i ulong 16 319 c = get gpids add mul j 16 i 320 if lt sohexv c 0 321 ret false 322 end 323 put gpid i c 324 end 325 ret true 326 end 327 fn parow to void 328 fput tphli 329 papath 330 fput tphq 331 paesct 332 fput tphae 333 fput tphm1 334 paputid 335 fput tphm2 336 fjday get gpmts 0 337 fput tphby 338 paauth 339 fput tphm3 340 pacnts 341 fput tphm4 342 end 343 fn papgln pg ulong t view uchar * to void 344 fput tph2 345 fputrl 346 fput tphqp 347 fnum pg 348 fput t 349 end 350 note padmg n: the list head's words for n index lines whose folder does not load as an item 351 fn padmg n ulong to void 352 fput tpdmg1 353 fnum n 354 if eq n 1 355 fput tpdmg2 356 ret 357 end 358 fput tpdmg3 359 end 360 note palist: the list. tot: the lines of the index (the pages go by index position, 30 lines each); 361 note lst: the items that load (count; gpsc by state); dmg: the lines that do not (damaged) 362 fn palist to long 363 tot = paixld 364 if ne get fobtr 0 0 365 ret 500 366 end 367 pg = papage 368 pages = div add tot 29 30 369 if eq pages 0 370 pages = 1 371 end 372 if gt pg pages 373 ret 404 374 end 375 cnt = papick tot pg 376 pastcnt tot 377 lst = add add get gpsc 0 get gpsc 1 get gpsc 2 378 dmg = sub tot lst 379 if fjwant 380 ret pajlist lst dmg pg pages cnt 381 end 382 fyalt 383 fsetti tptlist 384 frepohd 5 385 fput tph1 386 fnum lst 387 if eq lst 1 388 fput tph1a 389 else 390 fput tph1b 391 end 392 fput tpsth 393 fnum get gpsc 0 394 fput tpsto 395 fnum get gpsc 1 396 fput tpstc 397 fnum get gpsc 2 398 fput tpstm 399 if gt dmg 0 400 padmg dmg 401 end 402 fput tph2 403 fputrl 404 fput tph2n 405 if eq tot 0 406 fput tphnone 407 ret 200 408 end 409 fput tphul 410 for j ulong cnt bound 30 411 if paidset j 412 if paany 413 if eq get gpimp 0 0 414 parow 415 else 416 pairow 417 end 418 end 419 end 420 end 421 fput tphule 422 fput tphpg1 423 if gt pg 1 424 papgln sub pg 1 tphpgn 425 end 426 if lt pg pages 427 papgln add pg 1 tphpgo 428 end 429 fput tphpg2 430 ret 200 431 end 432 note ---- one patch 433 fn paorig to void 434 if eq get fbasel 0 1 435 fput tppor1 436 ret 437 end 438 fput tppor2 439 end 440 note patitl: the page title: the patch title when it is at most 200 bytes, else "Patches" 441 fn patitl to void 442 n = get gpttll 0 443 if gt n 200 444 fsetti tptlist 445 ret 446 end 447 put ftil 0 0 448 for i ulong n bound 200 449 ftic get gpttl i 450 end 451 end 452 note pashdf: the stored diff of the loaded patch, as pashdn shows it 453 fn pashdf to void 454 n = pardf tpfdf 455 if eq n 0 456 ret 457 end 458 pashdn n 459 end 460 note pashdn n: the diff fxo[0, n), at most 400000 bytes of it cut at a line's end, with a note when it 461 note is cut 462 fn pashdn n ulong to void 463 m = n 464 if gt n 400000 465 m = ulong 400000 466 for it ulong 400000 467 if eq m 0 468 break 469 end 470 if eq get fxo sub m 1 10 471 break 472 end 473 m = sub m 1 474 end 475 end 476 fput tphdf1 477 fxesc 0 m 478 fput tphpre 479 if lt m n 480 fput tphdfc 481 end 482 end 483 fn pashow2 to void 484 fput tphap1 485 paputid 486 fputc 32 487 paput40 0 488 fput tphap2 489 paorig 490 papath 491 fput tpsfxp 492 fput tphap3 493 papath 494 fput tpsfxp 495 fput tphap4 496 papath 497 fput tpsfxd 498 fput tphap5 499 fput tphsg1 500 for i ulong get gpmdidl 0 bound 128 501 fescc get gpmdid i 502 end 503 fput tphsg2 504 for i ulong get gpstl 0 bound 512 505 fescc get gpst i 506 end 507 fput tphpre 508 n = pardf tpfsg 509 fput tphsg3 510 fxesc 0 n 511 fput tphpre 512 fput tphdv 513 pashdf 514 end 515 fn pashow to long 516 if not paany 517 ret 404 518 end 519 if fjwant 520 ret pajone 521 end 522 if ne get gpimp 0 0 523 ret paishow 524 end 525 fyalt 526 patitl 527 frepohd 5 528 fput tphp1 529 paesct 530 fput tphp2 531 paputid 532 fput tphm2 533 fjday get gpmts 0 534 fput tphby 535 paauth 536 fput tphp3 537 pacnts 538 fput tphm3 539 fnum get gpmby 0 540 fput tphp4 541 fputrl 542 fput tphcm 543 paput40 0 544 fput tphq 545 fput tphcode 546 paput40 0 547 fput tphp5 548 paput40 1 549 fput tphp6 550 n = pardf tpfds 551 if gt n 0 552 fput tphds1 553 fxesc 0 n 554 fput tphpre 555 end 556 pashow2 557 ret 200 558 end 559 note panewpg: GET .../patches/new: how to open a patch (the upload itself is the POST) 560 fn panewpg to long 561 fsetti tptnew 562 frepohd 5 563 fput tphn1 564 fput tfowner 565 fputc 47 566 fputrnm 567 fput tphn2 568 ret 200 569 end 570 note ---- raw: w 0 .patch (the stored mbox), 1 .diff (the stored diff; else the bundle diff of 571 note an imported item, patch/p5imp.om pabraw), 2 .bundle (head.bundle). Streamed from the store or 572 note the diff cache (kind 3) under the sandbox policy; no JSON form. An item without a meta file must 573 note load as an imported item first. 574 fn paraws w ulong to long 575 papid tpfme 576 e = paexist 577 if not e 578 if not paiload 579 ret 404 580 end 581 end 582 if eq w 0 583 papid tpfmb 584 end 585 if eq w 1 586 papid tpfdf 587 end 588 if eq w 2 589 papid tpfbn 590 end 591 e = paexist 592 if not e 593 if ne w 1 594 ret 404 595 end 596 r = pabraw 597 if ne r 0 598 ret r 599 end 600 end 601 put ffilel 0 0 602 for i ulong get gppl 0 bound 4096 603 ffilc get gpp i 604 end 605 put fobl 0 0 606 put fkind 0 3 607 if eq w 2 608 fsetct tpctbin 609 else 610 fsetct tpctxt 611 end 612 fsetsbx 613 ret 200 614 end