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/collab/coJjson.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 / collab / coJjson.om` 755 lines ยท 10526 bytes Raw Blame History 1 note collab/coJjson.om (ForgePatches): the JSON form of the patch and issue pages (docs/API.md): 2 note forge/patches/1 and forge/issues/1 for the lists, forge/patch/1 and forge/issue/1 for one COB. Same 3 note loading, validation and statuses as the HTML handlers; every link is the href the HTML page builds. 4 note Pool text (titles, descriptions, bodies) is the raw markdown source, written by cojp without the 5 note 64 KiB cap of fjt; ill-formed UTF-8 becomes U+FFFD as in fjstr. 6 text tcjrep "\\ufffd" 7 text tcjsps "forge/patches/1" 8 text tcjsis "forge/issues/1" 9 text tcjsp "forge/patch/1" 10 text tcjsi "forge/issue/1" 11 text tcjsts "states" 12 text tcjcnt "count" 13 text tcjpath "path" 14 text tcjtr "truncated" 15 text tcjpats "patches" 16 text tcjisss "issues" 17 text tcjtitl "title" 18 text tcjauth "author" 19 text tcjupd "updated" 20 text tcjrevs "revisions" 21 text tcjcoms "comments" 22 text tcjverd "verdict" 23 text tcjname "name" 24 text tcjdid "did" 25 text tcjopen "opened" 26 text tcjdesc "description" 27 text tcjlabs "labels" 28 text tcjasg "assignees" 29 text tcjbld "forged_commit" 30 text tcjmrgs "merges" 31 text tcjact "activity" 32 text tcjdiff "diff" 33 text tcjnum "number" 34 text tcjred "redacted" 35 text tcjbase "base" 36 text tcjhead "head" 37 text tcjtime "time" 38 text tcjrev "revision" 39 text tcjcmt "commit" 40 text tcjtype "type" 41 text tcjbody "body" 42 text tcjraw "raw" 43 text tcjreas "reason" 44 text tcjtrvw "review" 45 text tcjtcom "comment" 46 text tcjtmrg "merge" 47 global gcjn ulong 1 48 note ---- JSON strings from gcpool (UTF-8 checked like fjulen, but on gcpool[i, e)) 49 fn cojc i ulong e ulong to bool 50 if ge i e 51 ret false 52 end 53 c = get gcpool i 54 ret and ge c 128 le c 191 55 end 56 fn coju3 i ulong e ulong c uchar to ulong 57 if not cojc add i 1 e 58 ret 0 59 end 60 if not cojc add i 2 e 61 ret 0 62 end 63 d = get gcpool add i 1 64 if and eq c 224 lt d 160 65 ret 0 66 end 67 if and eq c 237 gt d 159 68 ret 0 69 end 70 ret 3 71 end 72 fn coju4 i ulong e ulong c uchar to ulong 73 if not cojc add i 1 e 74 ret 0 75 end 76 if not cojc add i 2 e 77 ret 0 78 end 79 if not cojc add i 3 e 80 ret 0 81 end 82 d = get gcpool add i 1 83 if and eq c 240 lt d 144 84 ret 0 85 end 86 if and eq c 244 gt d 143 87 ret 0 88 end 89 ret 4 90 end 91 fn cojul i ulong e ulong to ulong 92 c = get gcpool i 93 if lt c 128 94 ret 1 95 end 96 if and ge c 194 le c 223 97 if cojc add i 1 e 98 ret 2 99 end 100 ret 0 101 end 102 if and ge c 224 le c 239 103 ret coju3 i e c 104 end 105 if and ge c 240 le c 244 106 ret coju4 i e c 107 end 108 ret 0 109 end 110 note cojp o n: gcpool[o, o+n) as one JSON string 111 fn cojp o ulong n ulong to void 112 fputc 34 113 e = add o n 114 i = o 115 while lt i e bound `4194304` 116 l = cojul i e 117 if eq l 0 118 fput tcjrep 119 i = add i 1 120 continue 121 end 122 if eq l 1 123 fjasc get gcpool i 124 i = add i 1 125 continue 126 end 127 for k ulong l bound 4 128 fputc get gcpool add i k 129 end 130 i = add i l 131 end 132 fputc 34 133 end 134 note cojlst k: the ", "-joined list in gcpool at gcm k/k+1 (labels 3, assignees 5) as an array of strings 135 fn cojlst k ulong to void 136 fputc 91 137 o = get gcm k 138 e = add o get gcm add k 1 139 s = o 140 i = o 141 while lt i e bound `4194304` 142 if eq get gcpool i 44 143 if lt add i 1 e 144 if eq get gcpool add i 1 32 145 cojp s sub i s 146 fputc 44 147 i = add i 2 148 s = i 149 continue 150 end 151 end 152 end 153 i = add i 1 154 end 155 if gt e o 156 cojp s sub e s 157 end 158 fputc 93 159 end 160 note ---- small pieces 161 fn cojq to void 162 fputc 34 163 end 164 fn cojnum r ulong to void 165 if lt r 64 166 fnum add r 1 167 ret 168 end 169 fynull 170 end 171 fn cojkn t view uchar * to void 172 fyk t 173 fynull 174 end 175 note cojsn kd s: the state as a JSON string of its ?state= value; cojsv the bare value 176 fn cojsn kd ulong s ulong to void 177 cojq 178 cojsv kd s 179 cojq 180 end 181 fn cojsv kd ulong s ulong to void 182 if eq s 9 183 fput tcall 184 end 185 if eq s 0 186 fput tcopen 187 end 188 if eq s 1 189 fput tcdraft 190 end 191 if eq s 3 192 fput tcmerged 193 end 194 if eq s 2 195 if eq kd 1 196 fput tcarch 197 else 198 fput tcclosed 199 end 200 end 201 ret 202 end 203 note cojaun ow / cojaup ow: open an author object with its name, and close it with its link 204 fn cojaun ow bool to void 205 fputc 123 206 fyk0 tcjname 207 if ow 208 cojq 209 fput tfowner 210 cojq 211 else 212 fynull 213 end 214 fyk tcjdid 215 end 216 fn cojaup ow bool to void 217 fyk tcjpath 218 if ow 219 cojq 220 fputb 221 fput tfowner 222 cojq 223 else 224 fynull 225 end 226 fputc 125 227 end 228 note cojcau ci: the author of change ci (coauth): {"name","did","path"} 229 fn cojcau ci ulong to void 230 ow = coisown ci 231 cojaun ow 232 fjtb 233 for k ulong len tcdidk 234 fjtc get tcdidk k 235 end 236 for k ulong get gccal ci bound 64 237 fjtc get gccau add mul ci 64 k 238 end 239 fjstr 240 cojaup ow 241 end 242 note ---- list pages 243 fn cojlist kd ulong to long 244 if eq coldata kd false 245 ret 500 246 end 247 put gcm 9 kd 248 f = coqstate kd 249 if and eq kd 2 or eq f 1 eq f 3 250 f = ulong 0 251 end 252 if eq kd 1 253 fyrhead tcjsps 254 else 255 fyrhead tcjsis 256 end 257 fyk tcstn 258 cojsn kd f 259 fyk tcjsts 260 cojtabs kd 261 fyk tcjtr 262 fybool gt get gcun 0 200 263 if eq kd 1 264 fyk tcjpats 265 else 266 fyk tcjisss 267 end 268 cojrows kd f 269 fyk tcnwr 270 cojq 271 fputrl 272 if eq kd 1 273 fput tcpatp 274 else 275 fput tcissp 276 end 277 fput tcnwr 278 cojq 279 fputc 10 280 fyend 281 ret 200 282 end 283 note cojtabs kd: the filter links in HTML order (cotabs) 284 fn cojtabs kd ulong to void 285 fputc 91 286 cojtab kd 0 false 287 if eq kd 1 288 cojtab kd 1 true 289 cojtab kd 3 true 290 cojtab kd 2 true 291 else 292 cojtab kd 2 true 293 end 294 cojtab kd 9 true 295 fputc 93 296 end 297 fn cojtab kd ulong s ulong c bool to void 298 if c 299 fputc 44 300 end 301 fputc 123 302 fyk0 tcstn 303 cojsn kd s 304 fyk tcjcnt 305 cotabn kd s 306 fyk tcjpath 307 cojq 308 fputrl 309 if eq kd 1 310 fput tcpats 311 else 312 fput tcisss 313 end 314 fput tcstq 315 cojsv kd s 316 cojq 317 fputc 125 318 end 319 fn cojrows kd ulong f ulong to void 320 fputc 91 321 m = ulong 0 322 for i ulong get gcsn 0 323 if or eq f 9 eq f get gcss i 324 if gt m 0 325 fputc 44 326 end 327 fputc 10 328 cojrow kd i 329 m = add m 1 330 end 331 end 332 fputc 93 333 end 334 fn cojrow kd ulong i ulong to void 335 coidref get gcsr i 336 fputc 123 337 fyk0 tcid 338 cojq 339 coidh 40 340 cojq 341 fyk tcjtitl 342 fjtb 343 o = get gcst mul i 2 344 for k ulong get gcst add mul i 2 1 bound 300 345 fjtc get gclp add o k 346 end 347 fjstr 348 fyk tcstn 349 cojsn kd get gcss i 350 fyk tcjauth 351 cojlau i 352 cojrow2 kd i 353 end 354 fn cojrow2 kd ulong i ulong to void 355 fyk tcjupd 356 fjiso get gcsu i 357 if eq kd 1 358 fyk tcjrevs 359 fnum get gcsc i 360 end 361 fyk tcjcoms 362 fnum get gcsk i 363 fyk tcjverd 364 n = get gcsvl i 365 if eq n 0 366 fynull 367 else 368 fjtb 369 for k ulong n bound 128 370 fjtc get gcsv add mul i 128 k 371 end 372 fjstr 373 end 374 fyk tcjpath 375 cojq 376 coplink kd 377 cojq 378 fputc 125 379 end 380 fn cojlau i ulong to void 381 n = get gcsal i 382 ow = false 383 if eq n len tfnid 384 ow = cosaown i 385 end 386 cojaun ow 387 fjtb 388 for k ulong len tcdidk 389 fjtc get tcdidk k 390 end 391 for k ulong n bound 64 392 fjtc get gcsau add mul i 64 k 393 end 394 fjstr 395 cojaup ow 396 end 397 note ---- one patch (copatpg) 398 fn cojpat to long 399 if eq corefs 1 false 400 ret 500 401 end 402 if eq coresolve false 403 ret 404 404 end 405 if eq coload 1 false 406 ret 404 407 end 408 if ne get gcov 0 0 409 fincut 410 ret 500 411 end 412 fyrhead tcjsp 413 cojhead 1 costate 414 fyk tcjdesc 415 if eq get gcrn 0 0 416 cojq 417 cojq 418 else 419 cojp get gcrd 0 get gcrd 1 420 end 421 cojmeta 422 fyk tcjbld 423 if cobldok tcbldc 424 cojq 425 fput tcbldc 426 cojq 427 else 428 fynull 429 end 430 fyk tcjrevs 431 cojrevs 432 fyk tcjmrgs 433 cojmrgs 434 fyk tcjact 435 cojact 436 fyk tcjdiff 437 cojdiff coqrev 438 fputc 10 439 fyend 440 ret 200 441 end 442 note cojhead kd s: id, title, state, author, opened, path of the loaded COB 443 fn cojhead kd ulong s ulong to void 444 fyk tcid 445 cojq 446 coidh 40 447 cojq 448 fyk tcjtitl 449 cojp get gcm 0 get gcm 1 450 fyk tcstn 451 cojsn kd s 452 fyk tcjauth 453 cojcau 0 454 fyk tcjopen 455 fjiso get gccts 0 456 fyk tcjpath 457 cojq 458 coplink kd 459 cojq 460 end 461 fn cojmeta to void 462 fyk tcjlabs 463 cojlst 3 464 fyk tcjasg 465 cojlst 5 466 end 467 fn cojrevs to void 468 fputc 91 469 for r ulong get gcrn 0 470 if gt r 0 471 fputc 44 472 end 473 fputc 10 474 cojrev r 475 end 476 fputc 93 477 end 478 fn cojrev r ulong to void 479 fputc 123 480 fyk0 tcjnum 481 fnum add r 1 482 fyk tcid 483 cojq 484 corhex r 40 485 cojq 486 fyk tcjpath 487 cojq 488 copatl 489 coidh 40 490 fput tcrq 491 corhex r 40 492 fput tcrfrag 493 cojq 494 fyk tcjred 495 fybool eq get gcrx r 1 496 cojrev2 r 497 end 498 fn cojrev2 r ulong to void 499 fyk tcjbase 500 cojq 501 cobhex r 40 502 cojq 503 fyk tcjhead 504 cojq 505 cohhex r 40 506 cojq 507 ci = get gcrt r 508 fyk tcjauth 509 cojcau ci 510 fyk tcjtime 511 fjiso get gccts ci 512 fyk tcjverd 513 cojrv r 514 fputc 125 515 end 516 fn cojrv r ulong to void 517 n = get gcrvl r 518 if eq n 0 519 fynull 520 ret 521 end 522 fjtb 523 for k ulong n bound 256 524 fjtc get gcrvd add mul r 256 k 525 end 526 fjstr 527 end 528 fn cojmrgs to void 529 fputc 91 530 for m ulong get gcmn 0 531 if gt m 0 532 fputc 44 533 end 534 fputc 123 535 fyk0 tcjrev 536 fnum add get gcmr m 1 537 fyk tcjcmt 538 cojq 539 comhex m 40 540 cojq 541 ci = get gcmt m 542 fyk tcjauth 543 cojcau ci 544 fyk tcjtime 545 fjiso get gccts ci 546 fputc 125 547 end 548 fputc 93 549 end 550 note ---- activity (copact): every change in order; each item has the same keys 551 fn cojact to void 552 put gcjn 0 0 553 fputc 91 554 for ci ulong get gccn 0 555 cojactc ci 556 end 557 fputc 93 558 end 559 fn cojactc ci ulong to void 560 for r ulong get gcrn 0 561 if eq get gcrt r ci 562 cojarev ci r 563 end 564 end 565 for w ulong get gcwn 0 566 if eq get gcwt w ci 567 cojarvw ci w 568 end 569 end 570 for q ulong get gcqn 0 571 if eq get gcqt q ci 572 cojacom ci q 573 end 574 end 575 for m ulong get gcmn 0 576 if eq get gcmt m ci 577 cojamrg ci m 578 end 579 end 580 end 581 note cojah ty ci: open an activity item: type, author, time, and the "revision" key 582 fn cojah ty view uchar * ci ulong to void 583 n = get gcjn 0 584 if gt n 0 585 fputc 44 586 end 587 put gcjn 0 add n 1 588 fputc 10 589 fputc 123 590 fyk0 tcjtype 591 cojq 592 fput ty 593 cojq 594 fyk tcjauth 595 cojcau ci 596 fyk tcjtime 597 fjiso get gccts ci 598 fyk tcjrev 599 end 600 fn cojarev ci ulong r ulong to void 601 if eq r 0 602 cojah tcopen ci 603 else 604 cojah tcjrev ci 605 end 606 fnum add r 1 607 fyk tcjhead 608 cojq 609 cohhex r 40 610 cojq 611 cojkn tcjcmt 612 cojkn tcjverd 613 cojkn tcjbody 614 fyk tcjred 615 fybool eq get gcrx r 1 616 fputc 125 617 end 618 fn cojarvw ci ulong w ulong to void 619 cojah tcjtrvw ci 620 cojnum get gcwr w 621 cojkn tcjhead 622 cojkn tcjcmt 623 fyk tcjverd 624 v = get gcwv w 625 if eq v 0 626 fynull 627 else 628 cojq 629 if eq v 1 630 fput tcaccept 631 else 632 fput tcreject 633 end 634 cojq 635 end 636 fyk tcjbody 637 cojp get gcws mul w 2 get gcws add mul w 2 1 638 fyk tcjred 639 fybool false 640 fputc 125 641 end 642 fn cojacom ci ulong q ulong to void 643 cojah tcjtcom ci 644 cojnum get gcqr q 645 cojkn tcjhead 646 cojkn tcjcmt 647 cojkn tcjverd 648 cojbody q 649 fputc 125 650 end 651 note cojbody q: "body" (null when redacted) and "redacted" of comment q 652 fn cojbody q ulong to void 653 fyk tcjbody 654 x = eq get gcqx q 1 655 if x 656 fynull 657 else 658 cojp get gcqs mul q 2 get gcqs add mul q 2 1 659 end 660 fyk tcjred 661 fybool x 662 end 663 fn cojamrg ci ulong m ulong to void 664 cojah tcjtmrg ci 665 cojnum get gcmr m 666 cojkn tcjhead 667 fyk tcjcmt 668 cojq 669 comhex m 40 670 cojq 671 cojkn tcjverd 672 cojkn tcjbody 673 fyk tcjred 674 fybool false 675 fputc 125 676 end 677 note cojdiff r: the revision whose changes the page shows (coqrev), with the raw diff link; null when none 678 fn cojdiff r ulong to void 679 if gt r 63 680 fynull 681 ret 682 end 683 fputc 123 684 fyk0 tcjrev 685 fnum add r 1 686 fyk tcid 687 cojq 688 corhex r 40 689 cojq 690 fyk tcjbase 691 cojq 692 cobhex r 40 693 cojq 694 fyk tcjhead 695 cojq 696 cohhex r 40 697 cojq 698 fyk tcjraw 699 cojq 700 copatl 701 coidh 40 702 fput tcdsuf 703 fput tcrq 704 corhex r 40 705 cojq 706 fputc 125 707 end 708 note ---- one issue (coisspg) 709 fn cojiss to long 710 if eq corefs 2 false 711 ret 500 712 end 713 if eq coresolve false 714 ret 404 715 end 716 if eq coload 2 false 717 ret 404 718 end 719 if ne get gcov 0 0 720 fincut 721 ret 500 722 end 723 fyrhead tcjsi 724 cojhead 2 get gcm 2 725 fyk tcjreas 726 if gt get gcm 8 0 727 cojp get gcm 7 get gcm 8 728 else 729 fynull 730 end 731 cojmeta 732 fyk tcjcoms 733 fputc 91 734 for q ulong get gcqn 0 735 if gt q 0 736 fputc 44 737 end 738 fputc 10 739 cojicom q 740 end 741 fputc 93 742 fputc 10 743 fyend 744 ret 200 745 end 746 fn cojicom q ulong to void 747 ci = get gcqt q 748 fputc 123 749 fyk0 tcjauth 750 cojcau ci 751 fyk tcjtime 752 fjiso get gccts ci 753 cojbody q 754 fputc 125 755 end