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/trit/trit.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 / trit / trit.om` 1008 lines ยท 16555 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note trit: one native 3-valued signal per bot, read from DIR/inbox/.md and .emergency.md. 3 note Built after the core of seed/trace/sha256.om in OM-2; see tools/trit/build.sh and README.md. 4 note Usage: trit DIR BOT... one line " <1|2> " per bot to wake. 5 note Daily: trit DIR --inspect BOT... emits inspection1 only; --consume BOT TOKEN moves state silently. 6 note Daily mode grants no process authority and keeps legacy codebook meanings unchanged. 7 note trit DIR --ack BOT TOKEN prints the receipt " 0", then the next wake if any. 8 note Silence means nothing to do (TURNS.md 12:24): a bot with no wake line prints nothing. 0 is only the 9 note ack receipt. Exit: 0 completed (consume is silent), 1 no unread work, 2 usage, 3 consumption refused, 4/5 bad codebook/key, 70+ internal. 10 note 2 = an unread line that verifies with the codebook (tools/codebook/codebook.om, compiled into this 11 note binary) and carries a 3xx code: last '|' field ocb2::::, over 12 note ocb2|cbsha|counter|lane|ts|from|to|tag|text|ref|digits. Signed lines are the 6-field form 13 note ts|from|to|tag|text|ref; to must equal the BOT being read, and the lane (n or e) must match the 14 note file. An ocb1 line is at most 1. Key and codebook at DIR/codebook/{key,codebook.tsv}; the key 15 note must be mode 0600 (no group/other bits) and its path must not contain a boards/ segment. Counters 16 note DIR/inbox/..ctr hold " ". Anything that is not fyi gives at most 1, 17 note including STOP text, a stop tag, unsigned, tampered, stale, replayed and retargeted lines. 18 note Token: L:, L = n (inbox) or e (emergency lane). 19 note A cursor is DIR/inbox/[.emergency].md.cur holding " ". 20 const NMAX ulong 3 21 const WIN ulong 60 22 global dir uchar 4096 23 global dn ulong 1 24 global bot uchar 256 25 global bn ulong 1 26 global acc ulong * 27 global an ulong 1 28 global rej ulong 1 29 global lf ulong 3 30 global vk ulong 1 31 global inspecting ulong 1 32 global outb uchar 512 33 global tk uchar 160 34 global tl ulong 2 35 text tinbox "inbox/" 36 text tmd ".md" 37 text temd ".emergency.md" 38 text tcur ".cur" 39 text tack "--ack" 40 text tinspect "--inspect" 41 text tconsume "--consume" 42 text tstop "stop" 43 text tstopu "STOP" 44 text tfyi "fyi" 45 text tdrake "drake" 46 text tcbd "codebook/" 47 text tcbf "codebook.tsv" 48 text tkey "key" 49 text trej "rejected " 50 51 note Dominance 2 > 1 > 0 is the maximum of the two values. 52 fn tmax a trit b trit to trit 53 if gt open a open b 54 ret a 55 end 56 ret b 57 end 58 59 fn pdir to void 60 put pn 0 0 61 for i ulong get dn 0 bound BIG 62 pbyte get dir i 63 end 64 if gt get dn 0 0 65 pbyte 47 66 end 67 ptext tinbox 68 end 69 70 fn pbase lane ulong to void 71 if eq lane 1 72 put vln 0 101 73 else 74 put vln 0 110 75 end 76 pdir 77 for i ulong get bn 0 bound BIG 78 pbyte get bot i 79 end 80 if eq lane 1 81 ptext temd 82 else 83 ptext tmd 84 end 85 end 86 87 fn loadf to bool 88 put fbn 0 0 89 fd = fopen pb 0 get pn 0 0 0 90 if lt fd 0 91 ret false 92 end 93 n = ulong 0 94 while true bound BIG 95 if lt len fb add n 4096 96 e1 = enlarge fb add n 4096 97 if ne e1 0 98 exit 72 99 end 100 end 101 r = read int fd fb n 4096 102 if lt r 0 103 exit 73 104 end 105 if eq r 0 106 break 107 end 108 n = add n ulong r 109 end 110 e2 = fclose int fd 111 put fbn 0 n 112 ret true 113 end 114 115 fn lastnl to ulong 116 i = get fbn 0 117 while gt i 0 bound BIG 118 if eq get fb sub i 1 10 119 ret sub i 1 120 end 121 i = sub i 1 122 end 123 ret get fbn 0 124 end 125 126 note A content line starts with a timestamp YYYY-MM-DDT; anything else (a header) is not content. 127 fn ists p ulong e ulong to bool 128 if lt sub e p 11 129 ret false 130 end 131 for i ulong 11 132 c = get fb add p i 133 if or eq i 4 eq i 7 134 if ne c 45 135 ret false 136 end 137 else 138 if eq i 10 139 if ne c 84 140 ret false 141 end 142 else 143 if eq isdig c false 144 ret false 145 end 146 end 147 end 148 end 149 ret true 150 end 151 152 fn fpre t view uchar * to bool 153 s = get fs 0 154 if lt sub get fs 1 s len t 155 ret false 156 end 157 for i ulong len t bound BIG 158 if ne get fb add s i get t i 159 ret false 160 end 161 end 162 ret true 163 end 164 165 fn npipe p ulong e ulong to ulong 166 c = ulong 0 167 for i ulong sub e p bound BIG 168 if eq get fb add p i 124 169 c = add c 1 170 end 171 end 172 ret c 173 end 174 175 fn lastpipe p ulong e ulong to ulong 176 i = e 177 while gt i p bound BIG 178 if eq get fb sub i 1 124 179 ret sub i 1 180 end 181 i = sub i 1 182 end 183 ret e 184 end 185 186 fn startsw q ulong e ulong t view uchar * to bool 187 if lt sub e q len t 188 ret false 189 end 190 for i ulong len t bound BIG 191 if ne get fb add q i get t i 192 ret false 193 end 194 end 195 ret true 196 end 197 198 note Exact STOP: the text field is "STOP", or starts "STOP " or "STOP:". 199 fn stopx to bool 200 s = get fs 0 201 n = sub get fs 1 s 202 if lt n 4 203 ret false 204 end 205 for i ulong 4 206 if ne get fb add s i get tstopu i 207 ret false 208 end 209 end 210 if eq n 4 211 ret true 212 end 213 c = get fb add s 4 214 if or eq c 32 eq c 58 215 ret true 216 end 217 ret false 218 end 219 220 note Kind of one content line: 2 stop (tag "stop" or exact STOP text), 0 fyi (never wakes), else 1. 221 note A stop wins over fyi. 222 fn lnkind p ulong e ulong to ulong 223 lfmt p e 224 ee = get lf 0 225 tg = get lf 1 226 if splitf p ee tg 124 227 if feq tstop 228 ret 2 229 end 230 end 231 if splitf p ee add tg 1 124 232 if stopx 233 ret 2 234 end 235 end 236 if splitf p ee tg 124 237 if feq tfyi 238 ret 0 239 end 240 end 241 ret 1 242 end 243 244 note SHA-256 of fb[s..s+n) as 64 lowercase hex bytes in hx, on the seeded core above. 245 fn hfb s ulong n ulong to void 246 hinit 247 full = div n 64 248 for b ulong full bound BIG 249 o = add s mul b 64 250 for i ulong 64 251 put blk i get fb add o i 252 end 253 compress 254 end 255 hpadf add s mul full 64 rem n 64 n 256 hhex 257 end 258 259 fn hpadf o ulong left ulong n ulong to void 260 for i ulong 64 261 put blk i 0 262 end 263 for j ulong left bound BIG 264 put blk j get fb add o j 265 end 266 put blk left 128 267 if ge left 56 268 compress 269 for i ulong 64 270 put blk i 0 271 end 272 end 273 bits = mul n 8 274 for q ulong 8 275 v = and shr bits mul sub 7 q 8 255 276 put blk add 56 q uchar v 277 end 278 compress 279 end 280 281 note Unread starts at the cursor offset only when the cursor is well formed, inside the file, on a 282 note line end, and the sha256 of every byte before it matches. Otherwise the whole file is unread. 283 fn rdcur lane ulong to ulong 284 pbase lane 285 ptext tcur 286 fd = fopen pb 0 get pn 0 0 0 287 if lt fd 0 288 ret 0 289 end 290 r = read int fd cb 0 len cb 291 e2 = fclose int fd 292 if lt r 66 293 ret 0 294 end 295 n = ulong r 296 off = ulong 0 297 i = ulong 0 298 while lt i n bound BIG 299 c = get cb i 300 if eq c 32 301 break 302 end 303 if eq isdig c false 304 ret 0 305 end 306 if gt off `100000000000000` 307 ret 0 308 end 309 off = add mul off 10 ulong sub c 48 310 i = add i 1 311 end 312 if or eq off 0 gt off get fbn 0 313 ret 0 314 end 315 if gt add i 65 n 316 ret 0 317 end 318 if ne get fb sub off 1 10 319 ret 0 320 end 321 hfb 0 off 322 for j ulong 64 323 if ne get hx j get cb add add i 1 j 324 ret 0 325 end 326 end 327 ret off 328 end 329 330 fn scann st ulong to trit 331 t = tritmk 0 332 p = st 333 while lt p get fbn 0 bound BIG 334 e = lnend p 335 if eq e get fbn 0 336 break 337 end 338 if ists p e 339 t = tmax t lnlevel p e 340 end 341 p = add e 1 342 end 343 ret t 344 end 345 346 fn absd a ulong b ulong to ulong 347 if gt a b 348 ret sub a b 349 end 350 ret sub b a 351 end 352 353 fn sameid a ulong m ulong s ulong n ulong to bool 354 if ne m n 355 ret false 356 end 357 for i ulong n bound BIG 358 if ne get fb add a i get fb add s i 359 ret false 360 end 361 end 362 ret true 363 end 364 365 fn dig2 q ulong to ulong 366 a = get fb q 367 b = get fb add q 1 368 if or eq isdig a false eq isdig b false 369 ret 100000 370 end 371 ret add mul ulong sub a 48 10 ulong sub b 48 372 end 373 374 fn days y ulong m ulong d ulong to ulong 375 yy = y 376 if le m 2 377 yy = sub y 1 378 end 379 era = div yy 400 380 yoe = sub yy mul era 400 381 mp = add m 9 382 if gt m 2 383 mp = sub m 3 384 end 385 doy = add div add mul 153 mp 2 5 sub d 1 386 q4 = div yoe 4 387 c1 = div yoe 100 388 doe = add mul yoe 365 q4 389 doe = sub add doe doy c1 390 ret add mul era 146097 doe 391 end 392 393 note Minutes since a fixed civil origin, plus one; 0 means the timestamp does not parse. 394 fn minute p ulong e ulong to ulong 395 if lt sub e p 16 396 ret 0 397 end 398 if ne get fb add p 13 58 399 ret 0 400 end 401 y = add mul dig2 p 100 dig2 add p 2 402 mn = dig2 add p 5 403 d = dig2 add p 8 404 hh = dig2 add p 11 405 mi = dig2 add p 14 406 if or lt mn 1 gt mn 12 407 ret 0 408 end 409 if or lt d 1 gt d 31 410 ret 0 411 end 412 if or gt hh 23 gt mi 59 413 ret 0 414 end 415 if lt y 1 416 ret 0 417 end 418 dd = days y mn d 419 t1 = mul hh 60 420 t2 = add mul dd 1440 t1 421 ret add t2 add mi 1 422 end 423 424 note Sender check: a slug of a-z 0-9 '-', 1..64 bytes, that is drake or has DIR/inbox/.md. 425 fn okname s ulong n ulong to bool 426 if or eq n 0 gt n 64 427 ret false 428 end 429 for i ulong n bound BIG 430 if eq okch get fb add s i false 431 ret false 432 end 433 end 434 if eq n len tdrake 435 d = true 436 for j ulong n bound BIG 437 if ne get fb add s j get tdrake j 438 d = false 439 end 440 end 441 if d 442 ret true 443 end 444 end 445 pdir 446 for kk ulong n bound BIG 447 pbyte get fb add s kk 448 end 449 ptext tmd 450 a = faccess pb 0 get pn 0 0 451 if eq a 0 452 ret true 453 end 454 ret false 455 end 456 457 fn putdec v ulong to ulong 458 n = ulong 1 459 x = v 460 while ge x 10 bound BIG 461 x = div x 10 462 n = add n 1 463 end 464 x = v 465 for i ulong n bound BIG 466 put cb sub sub n 1 i add uchar rem x 10 48 467 x = div x 10 468 end 469 ret n 470 end 471 472 fn wr fd int n ulong to void 473 i = ulong 0 474 while lt i n bound BIG 475 r = write fd outb i sub n i 476 if le r 0 477 exit 75 478 end 479 i = add i ulong r 480 end 481 end 482 483 fn rejout to void 484 o = ulong 0 485 for i ulong len trej 486 put outb i get trej i 487 end 488 o = len trej 489 for j ulong get bn 0 bound BIG 490 put outb add o j get bot j 491 end 492 o = add o get bn 0 493 put outb o 32 494 o = add o 1 495 n = putdec get rej 0 496 for kk ulong n bound BIG 497 put outb add o kk get cb kk 498 end 499 o = add o n 500 put outb o 10 501 wr 2 add o 1 502 end 503 504 fn botout to ulong 505 n = get bn 0 506 for i ulong n bound BIG 507 put outb i get bot i 508 end 509 put outb n 32 510 ret add n 1 511 end 512 513 note Wake line " <1|2> "; a 0 (nothing to do) prints nothing. Returns 1 when printed. 514 fn emit t trit to ulong 515 if eq open t 0 516 ret 0 517 end 518 o = botout 519 if eq get inspecting 0 1 520 put outb o 49 521 else 522 put outb o add uchar open t 48 523 end 524 put outb add o 1 32 525 o = add o 2 526 put outb o 110 527 if eq get tl 0 2 528 put outb o 101 529 end 530 o = add o 1 531 m = putdec get tl 1 532 for j ulong m bound BIG 533 put outb add o j get cb j 534 end 535 o = add o m 536 put outb o 58 537 o = add o 1 538 for kk ulong 64 539 put outb add o kk get hx kk 540 end 541 o = add o 64 542 put outb o 10 543 wr 1 add o 1 544 ret 1 545 end 546 547 fn receipt to void 548 o = botout 549 put outb o 48 550 put outb add o 1 10 551 wr 1 add o 2 552 end 553 554 note Token for the lane in fb: the end of its last complete line and the sha256 of all bytes before it. 555 fn mktok lane ulong to void 556 q = lastnl 557 put tl 0 add lane 1 558 put tl 1 add q 1 559 hfb 0 add q 1 560 end 561 562 note Atomic cursor write: " " into .tmp, fsync, then renameat2 over the cursor. 563 fn wrcur lane ulong off ulong to void 564 n = putdec off 565 put cb n 32 566 for i ulong 64 567 put cb add add n 1 i get hx i 568 end 569 put cb add n 65 10 570 pbase lane 571 ptext tcur 572 ptext ttmp 573 fd = fopen pb 0 get pn 0 577 420 574 if lt fd 0 575 exit 76 576 end 577 w2 = ulong 0 578 m = add n 66 579 while lt w2 m bound BIG 580 r = write int fd cb w2 sub m w2 581 if le r 0 582 exit 77 583 end 584 w2 = add w2 ulong r 585 end 586 s1 = fsync int fd 587 e2 = fclose int fd 588 if ne s1 0 589 exit 77 590 end 591 put pk 0 2 592 put pk 1 0 593 put pkn 0 2 594 pkrec 595 pbase lane 596 ptext tcur 597 pkrec 598 rn = renames pk 0 get pkn 0 0 599 if ne rn 0 600 exit 77 601 end 602 pbase lane 603 ptext tcur 604 syncdir 605 end 606 607 note Parse TOKEN = L:<64 hex>; return the lane, the offset in tl 1, the hex at tk 2+digits. 608 fn parsetok tn ulong to ulong 609 lane = ulong 0 610 c0 = get tk 0 611 if eq c0 101 612 lane = 1 613 else 614 if ne c0 110 615 exit 3 616 end 617 end 618 off = ulong 0 619 i = ulong 1 620 while lt i tn bound BIG 621 c = get tk i 622 if eq c 58 623 break 624 end 625 if eq isdig c false 626 exit 3 627 end 628 if gt i 18 629 exit 3 630 end 631 off = add mul off 10 ulong sub c 48 632 i = add i 1 633 end 634 if or eq i 1 ne tn add i 65 635 exit 3 636 end 637 for j ulong 64 638 if eq ishex get tk add add i 1 j false 639 exit 3 640 end 641 end 642 put tl 0 add i 1 643 put tl 1 off 644 ret lane 645 end 646 647 fn getbot a ulong to void 648 p = argread a bot 0 len bot 649 if lt p 1 650 exit 2 651 end 652 if gt p 64 653 exit 2 654 end 655 put bn 0 ulong p 656 if eq get bot 0 45 657 exit 2 658 end 659 for i ulong get bn 0 bound BIG 660 if eq okch get bot i false 661 exit 2 662 end 663 end 664 end 665 666 fn botarg t view uchar * to bool 667 if ne get bn 0 len t 668 ret false 669 end 670 for i ulong len t 671 if ne get bot i get t i 672 ret false 673 end 674 end 675 ret true 676 end 677 678 note Line format: when the last '|' field is a codebook signature (ocb2: or a leftover ocb1:), it 679 note is not a content field; the tag is field 3 in the 6-field "to" format, else field 2. 680 fn lfmt p ulong e ulong to void 681 nf = add npipe p e 1 682 ee = e 683 if ge nf 2 684 lp = lastpipe p e 685 if or startsw add lp 1 e tocb startsw add lp 1 e tocbo 686 ee = lp 687 nf = sub nf 1 688 end 689 end 690 put lf 0 ee 691 put lf 1 2 692 if eq nf 6 693 put lf 1 3 694 end 695 end 696 697 note verified: the codebook's own verify (codebook.om verl, quiet, table mode) on fb[p..e). 698 note Without DIR/codebook/codebook.tsv and DIR/codebook/key nothing verifies. 699 fn verified p ulong e ulong to bool 700 put vm 0 0 701 put vf 0 0 702 put ve 0 0 703 put vc 0 0 704 if eq get vk 0 1 705 verx p e 706 end 707 ret eq get vf 0 1 708 end 709 710 note Level of a line whose verify already ran: 2 only for a verified line carrying a 3xx code; 711 note STOP text, a stop tag and every unsigned, tampered, stale or replayed line give at most 1. 712 fn lvl p ulong e ulong to trit 713 if and eq get vf 0 1 eq get ve 0 1 714 ret tritmk 2 715 end 716 if eq lnkind p e 0 717 ret tritmk 0 718 end 719 ret tritmk 1 720 end 721 722 fn lnlevel p ulong e ulong to trit 723 v = verified p e 724 ret lvl p e 725 end 726 727 note Quota entries are (sender off, len, minute, counter) and only MAC-verified lines are counted, 728 note once per (sender, counter): forged lines and replayed copies never use up a sender's quota. 729 fn cntwin s ulong n ulong m ulong to ulong 730 c = ulong 0 731 for i ulong get an 0 bound BIG 732 b = mul i 4 733 a0 = get acc b 734 a1 = get acc add b 1 735 if sameid a0 a1 s n 736 a2 = get acc add b 2 737 if lt absd a2 m WIN 738 c = add c 1 739 end 740 end 741 end 742 ret c 743 end 744 745 fn seenc s ulong n ulong v ulong to bool 746 for i ulong get an 0 bound BIG 747 b = mul i 4 748 if eq get acc add b 3 v 749 if sameid get acc b get acc add b 1 s n 750 ret true 751 end 752 end 753 end 754 ret false 755 end 756 757 note Admission for the emergency lane, after verified ran on the line. 758 fn admit p ulong e ulong to bool 759 if eq splitf p e 1 124 false 760 ret false 761 end 762 s = get fs 0 763 n = sub get fs 1 s 764 if eq okname s n false 765 ret false 766 end 767 m = minute p e 768 if eq m 0 769 ret false 770 end 771 if eq get vm 0 0 772 ret true 773 end 774 v = get vc 0 775 if seenc s n v 776 ret true 777 end 778 if ge cntwin s n m NMAX 779 ret false 780 end 781 b2 = mul get an 0 4 782 if lt len acc add b2 4 783 e1 = enlarge acc add mul b2 2 64 784 if ne e1 0 785 exit 74 786 end 787 end 788 put acc b2 s 789 put acc add b2 1 n 790 put acc add b2 2 m 791 put acc add b2 3 v 792 put an 0 add get an 0 1 793 ret true 794 end 795 796 fn scane st ulong to trit 797 put an 0 0 798 t = tritmk 0 799 p = ulong 0 800 while lt p get fbn 0 bound BIG 801 e = lnend p 802 if eq e get fbn 0 803 break 804 end 805 if ists p e 806 v = verified p e 807 ok = admit p e 808 if ge p st 809 if ok 810 t = tmax t lvl p e 811 else 812 put rej 0 add get rej 0 1 813 end 814 end 815 end 816 p = add e 1 817 end 818 ret t 819 end 820 821 note Counter state for this bot: DIR/inbox/..ctr, lock DIR/inbox/.ctr.lock. 822 fn setsd to void 823 pdir 824 for i ulong get bn 0 bound BIG 825 pbyte get bot i 826 put rbot i get bot i 827 end 828 put rbn 0 get bn 0 829 for j ulong get pn 0 bound BIG 830 put sd j get pb j 831 end 832 put sdn 0 get pn 0 833 put vtc 0 0 834 put vtn 0 0 835 end 836 837 note A verified 3xx (2) in the emergency lane is reported first; an emergency-lane 1 is reported 838 note only when the normal lane is quiet, so unsigned lines there cannot hide normal work. 839 fn state to trit 840 put rej 0 0 841 put tl 0 0 842 setsd 843 pbase 1 844 te = tritmk 0 845 if loadf 846 te = scane rdcur 1 847 end 848 if gt get rej 0 0 849 rejout 850 end 851 if eq open te 2 852 mktok 1 853 ret te 854 end 855 pbase 0 856 tn = tritmk 0 857 if loadf 858 tn = scann rdcur 0 859 end 860 if gt open tn 0 861 mktok 0 862 ret tn 863 end 864 if gt open te 0 865 pbase 1 866 if loadf 867 mktok 1 868 end 869 end 870 ret te 871 end 872 873 note --ack: under the state lock, verify-and-advance (vt = 0) every line the token covers, then 874 note move the cursor. A crash between the two leaves those lines unread but stale (at most 1). 875 fn doack tn ulong to void 876 lane = parsetok tn 877 hp = get tl 0 878 off = get tl 1 879 pbase lane 880 if eq loadf false 881 exit 3 882 end 883 cur = rdcur lane 884 if or eq off 0 gt off get fbn 0 885 exit 3 886 end 887 if lt off cur 888 exit 3 889 end 890 if ne get fb sub off 1 10 891 exit 3 892 end 893 hfb 0 off 894 for j ulong 64 895 if ne get hx j get tk add hp j 896 exit 3 897 end 898 end 899 if eq get vk 0 1 900 ackv cur off 901 hfb 0 off 902 end 903 wrcur lane off 904 end 905 906 fn ackv cur ulong off ulong to void 907 setsd 908 lk = lockst 909 put vt 0 0 910 p = cur 911 while lt p off bound BIG 912 e = lnend p 913 if ists p e 914 verx p e 915 end 916 p = add e 1 917 end 918 put vt 0 1 919 unlockst lk 920 end 921 922 note pb = DIR/codebook/. 923 fn pcb t view uchar * to void 924 put pn 0 0 925 for i ulong get dn 0 bound BIG 926 pbyte get dir i 927 end 928 if gt get dn 0 0 929 pbyte 47 930 end 931 ptext tcbd 932 ptext t 933 end 934 935 fn ldvk to void 936 pcb tcbf 937 a = faccess pb 0 get pn 0 0 938 pcb tkey 939 b = faccess pb 0 get pn 0 0 940 if or ne a 0 ne b 0 941 ret 942 end 943 pcb tcbf 944 ldcbq 945 pcb tkey 946 ldkeyq 947 put vk 0 1 948 end 949 950 fn main to int 951 put vq 0 1 952 put vt 0 1 953 put ssep 0 46 954 c = argcnt 955 if lt c 3 956 ret 2 957 end 958 p = argread 1 dir 0 len dir 959 if lt p 0 960 ret 2 961 end 962 put dn 0 ulong p 963 q = argread 2 bot 0 len bot 964 if lt q 0 965 ret 2 966 end 967 put bn 0 ulong q 968 ldvk 969 consume = botarg tconsume 970 if or botarg tack consume 971 if ne c 5 972 ret 2 973 end 974 getbot 3 975 tn = argread 4 tk 0 len tk 976 if lt tn 1 977 exit 3 978 end 979 doack ulong tn 980 if consume 981 zap 982 ret 0 983 end 984 receipt 985 z = emit state 986 zap 987 ret 0 988 end 989 any = ulong 0 990 first = ulong 2 991 if botarg tinspect 992 if lt c 4 993 zap 994 ret 2 995 end 996 put inspecting 0 1 997 first = ulong 3 998 end 999 for a ulong sub ulong c first bound BIG 1000 getbot add a first 1001 any = add any emit state 1002 end 1003 zap 1004 if eq any 0 1005 ret 1 1006 end 1007 ret 0 1008 end