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/bridge/nvml/gate.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 / bridge / nvml / gate.om` 994 lines ยท 18090 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note bridge/nvml/gate.om: BRIDGE-NVML, the gate of the NVML library slice (one slice of CUDApp compat/: compat/nvml). 3 note CUDApp stores compat/nvml/libnvidia-ml.c, nvml.h and libnvidia-ml.map; all three are omega-bridge cabi-1 4 note output of gpu/nvidia/native/nvml/api.om. This tree stores none of them: bridge/nvml/derived.tsv names each as 5 note derived (source, source digest, generator digest, output digest), and this gate makes them again. 6 note Seeded Omega (Linux AArch64, OM-2 program mode; seed/ng/sha256.om supplies sh_init, sh_blk, sh_out). Build from 7 note the repository root: 8 note { printf 'om2\n'; cat seed/ng/sha256.om bridge/nvml/gate.om; } | seed/out/omc > gate 9 note Run from the repository root: 10 note gate SCRATCH OMC TABLE [toc=TOC]... [cudapp=CUDAPP]... 11 note SCRATCH a new directory (made 0700); an existing one is refused (exit 2). 12 note OMC the compiler (seed/out/omc): it compiles the source (the frontend step of omega-bridge's bridge-seeded) 13 note and the emitter. 14 note TABLE bridge/nvml/derived.tsv, or a mutated copy for a control. 15 note TOC an omega-bridge src/toc.om (the cabi-1 emitter). Its digest must be a generator column value of the 16 note table. OMC compiles it; for every row of that generator the gate writes the request bridge-seeded 17 note writes (the mode letter, the source, a newline, then the generator and source digests and a newline), 18 note runs the emitter on it with TOC on descriptor 3, and requires the output to have the row's output digest. 19 note CUDAPP a CUDApp checkout: each row that names a CUDApp file must find that file with the row's output digest. 20 note Descriptor 3: the emitter reads its own source on descriptor 3 and refuses (error 52) when that is not the 21 note generator it names. Omega's exec words close every descriptor above 2 (OMEGESE section 9, execprog), so the 22 note gate starts the emitter through /bin/sh -c 'exec "$0" 3<"$1"' EMITTER TOC; that one binding is all the shell 23 note does (bridge/nvml/README.md, section What is not in this tree, and why). 24 note Output: one line per check, then BRIDGE-NVML PASS|FAIL checks=N failed=F emitter=PASS|FAIL|NOT_RUN 25 note oracle=PASS|FAIL|NOT_RUN. Exit 0 PASS, 1 FAIL, 2 bad usage or setup. 26 note Sizes: files, the table, requests and outputs live in run-time pools sized from what is read (no size of their 27 note own). Paths are refused past 4095 bytes (Linux PATH_MAX, 4096 with its terminator); the argument packet of a 28 note child past 65536 bytes and its environment past 4096 bytes are refused with exit 2 (the exec words' packets). 29 const NOLIM ulong `9223372036854775807` 30 const PMAX ulong 4095 31 global g_n ulong 32 32 global g_pa uchar 4096 33 global g_tmp uchar 4096 34 global g_av uchar 65536 35 global g_ev uchar 4096 36 global g_stb uchar 4 37 global g_h uchar 256 38 global A uchar * 39 global AO ulong * 40 global T uchar * 41 global R ulong * 42 global F uchar * 43 global S uchar * 44 global Q uchar * 45 global O uchar * 46 text t_usage "usage: gate SCRATCH OMC TABLE [toc=TOC]... [cudapp=CUDAPP]... (run from the omega-mv root)\n" 47 text t_noscr "BRIDGE-NVML INVALID: SCRATCH exists or cannot be made\n" 48 text t_nomem "BRIDGE-NVML INVALID: the host refused memory for a pool\n" 49 text t_path "BRIDGE-NVML INVALID: a path is longer than 4095 bytes (Linux PATH_MAX)\n" 50 text t_pack "BRIDGE-NVML INVALID: a child's argument packet is over 65536 bytes\n" 51 text t_fork "BRIDGE-NVML INVALID: fork or wait failed\n" 52 text a_toc "toc=" 53 text a_cud "cudapp=" 54 text d_derived "derived" 55 text d_libc "lib-c" 56 text d_libh "lib-h" 57 text d_libmap "lib-map" 58 text d_none "-" 59 text f_sh "/bin/sh" 60 text f_c "-c" 61 text f_launch "exec \"$0\" 3<\"$1\"" 62 text f_front "/frontend" 63 text f_emit "/emitter" 64 text f_req "/request" 65 text f_out "/out" 66 text f_err ".err" 67 text e_path "PATH=/usr/bin:/bin" 68 text o_pass "PASS " 69 text o_fail "FAIL " 70 text o_table "table: " 71 text o_tablen " rows, each derived, a known mode, three 64-hex digests and eight tab-separated fields" 72 text o_tablef "table: a row is malformed (want derived, lib-c|lib-h|lib-map, eight tab-separated fields, 64-hex digests) or there is no row; rows " 73 text o_src "source " 74 text o_of " of " 75 text o_gen ", generator " 76 text o_srcm "): the file has the pinned digest " 77 text o_srcf "): unreadable or digest differs; got " 78 text o_front "frontend: " 79 text o_frontm " compiles with OMC (exit 0, a non-empty program)" 80 text o_rc " exit " 81 text o_emit "emitter " 82 text o_emitc ": compiled by OMC" 83 text o_emitn ": digest is not a generator in the table" 84 text o_emitu ": unreadable" 85 text o_der "derived " 86 text o_mode " (" 87 text o_from "): emitter " 88 text o_on " on " 89 text o_gives " gives the pinned digest " 90 text o_got " got " 91 text o_orc "oracle " 92 text o_orcm ": CUDApp's file has the derived digest of " 93 text o_orcn "oracle: no table row names a CUDApp file" 94 text o_sum "BRIDGE-NVML " 95 text o_spass "PASS" 96 text o_sfail "FAIL" 97 text o_checks " checks=" 98 text o_failed " failed=" 99 text o_emitter " emitter=" 100 text o_oracle " oracle=" 101 text o_notrun "NOT_RUN" 102 note g_n: 0 path length, 1 output line length, 2 checks, 3 failures, 4 arguments, 5 table length, 6 rows, 103 note 7 F length, 8 S length, 9 Q length, 10 argument packet length, 11 argument count, 12 environment length, 104 note 13 emitter state, 14 oracle state (0 NOT_RUN, 1 PASS, 2 FAIL), 15 bytes of A used. 105 note g_h: digest k as 64 lowercase hex at 64*k (0 computed, 1 source, 2 generator). 106 note AO: argument k at 2k (start in A) and 2k+1 (length); 0 SCRATCH, 1 OMC, 2 TABLE, 3.. toc= or cudapp=. 107 note R: row r field f at 16r+2f (start in T) and 16r+2f+1 (length); fields: 0 status, 1 file, 2 mode, 3 source, 108 note 4 source digest, 5 generator digest, 6 output digest, 7 the CUDApp file or -. 109 fn nomem to void 110 r = write 2 t_nomem 0 len t_nomem 111 exit 2 112 end 113 note ---- pool growth: to n elements at least, doubling 114 fn gsz have ulong n ulong to ulong 115 m = mul have 2 116 if lt m n 117 m = n 118 end 119 if lt m 4096 120 m = 4096 121 end 122 ret m 123 end 124 fn oen n ulong to void 125 if gt n len O 126 r = enlarge O gsz len O n 127 if ne r 0 128 nomem 129 end 130 end 131 end 132 fn fen n ulong to void 133 if gt n len F 134 r = enlarge F gsz len F n 135 if ne r 0 136 nomem 137 end 138 end 139 end 140 fn sen n ulong to void 141 if gt n len S 142 r = enlarge S gsz len S n 143 if ne r 0 144 nomem 145 end 146 end 147 end 148 fn qen n ulong to void 149 if gt n len Q 150 r = enlarge Q gsz len Q n 151 if ne r 0 152 nomem 153 end 154 end 155 end 156 fn aen n ulong to void 157 if gt n len A 158 r = enlarge A gsz len A n 159 if ne r 0 160 nomem 161 end 162 end 163 end 164 fn aoen n ulong to void 165 if gt n len AO 166 r = enlarge AO gsz len AO n 167 if ne r 0 168 nomem 169 end 170 end 171 end 172 fn ren n ulong to void 173 if gt n len R 174 r = enlarge R gsz len R n 175 if ne r 0 176 nomem 177 end 178 end 179 end 180 fn ten n ulong to void 181 if gt n len T 182 r = enlarge T gsz len T n 183 if ne r 0 184 nomem 185 end 186 end 187 end 188 note ---- output: one line in O, written to stdout by onl 189 fn oc c ulong to void 190 n = get g_n 1 191 oen add n 1 192 put O n uchar c 193 put g_n 1 add n 1 194 end 195 fn ot t view uchar * to void 196 for i ulong len t bound NOLIM 197 oc ulong get t i 198 end 199 end 200 fn onum v ulong to void 201 if ge v 10 202 onum div v 10 203 end 204 oc add 48 rem v 10 205 end 206 fn ohx k ulong to void 207 for j ulong 64 208 oc ulong get g_h add mul k 64 j 209 end 210 end 211 fn ofl r ulong f ulong to void 212 s = get R add mul r 16 mul f 2 213 n = get R add add mul r 16 mul f 2 1 214 for j ulong n bound NOLIM 215 oc ulong get T add s j 216 end 217 end 218 fn oarg k ulong skip ulong to void 219 s = get AO mul k 2 220 n = get AO add mul k 2 1 221 for j ulong sub n skip bound NOLIM 222 oc ulong get A add add s skip j 223 end 224 end 225 fn onl to void 226 oc 10 227 n = get g_n 1 228 r = write 1 O 0 n 229 put g_n 1 0 230 end 231 fn ook ok bool to void 232 put g_n 2 add get g_n 2 1 233 if ok 234 ot o_pass 235 else 236 ot o_fail 237 put g_n 3 add get g_n 3 1 238 end 239 end 240 note tier state slot k: PASS unless a check of the tier failed 241 fn tier k ulong ok bool to void 242 if not ok 243 put g_n k 2 244 else 245 if eq get g_n k 0 246 put g_n k 1 247 end 248 end 249 end 250 note ---- paths in g_pa 251 fn pclr to void 252 put g_n 0 0 253 end 254 fn pc c ulong to void 255 n = get g_n 0 256 if lt n PMAX 257 put g_pa n uchar c 258 end 259 put g_n 0 add n 1 260 end 261 fn pt t view uchar * to void 262 for i ulong len t bound NOLIM 263 pc ulong get t i 264 end 265 end 266 fn parg k ulong skip ulong to void 267 s = get AO mul k 2 268 n = get AO add mul k 2 1 269 for j ulong sub n skip bound NOLIM 270 pc ulong get A add add s skip j 271 end 272 end 273 fn pfl r ulong f ulong to void 274 s = get R add mul r 16 mul f 2 275 n = get R add add mul r 16 mul f 2 1 276 for j ulong n bound NOLIM 277 pc ulong get T add s j 278 end 279 end 280 note SCRATCH + t 281 fn psc t view uchar * to void 282 pclr 283 parg 0 0 284 pt t 285 end 286 fn plen to ulong 287 n = get g_n 0 288 if gt n PMAX 289 r = write 2 t_path 0 len t_path 290 exit 2 291 end 292 ret n 293 end 294 fn fopn fl ulong mode ulong to int 295 n = plen 296 r = fopen g_pa 0 n int fl int mode 297 if lt r 0 298 ret -1 299 end 300 ret int r 301 end 302 fn frd to int 303 ret fopn 524288 0 304 end 305 fn fwr mode ulong to int 306 ret fopn 524865 mode 307 end 308 fn fclo fd int to void 309 if ge fd 0 310 r = fclose fd 311 end 312 end 313 note ---- files: g_pa into F (length g_n 7); Q to g_pa 314 fn fload to bool 315 put g_n 7 0 316 fd = frd 317 if lt fd 0 318 ret false 319 end 320 n = ulong 0 321 ok = true 322 while true bound NOLIM 323 if lt sub len F n 65536 324 fen add n 65536 325 end 326 x = read fd F n sub len F n 327 if lt x 0 328 ok = false 329 break 330 end 331 if eq x 0 332 break 333 end 334 n = add n ulong x 335 end 336 fclo fd 337 put g_n 7 n 338 ret ok 339 end 340 fn qsave to bool 341 fd = fwr 420 342 if lt fd 0 343 ret false 344 end 345 n = get g_n 9 346 o = ulong 0 347 ok = true 348 while lt o n bound NOLIM 349 x = write fd Q o sub n o 350 if le x 0 351 ok = false 352 break 353 end 354 o = add o ulong x 355 end 356 fclo fd 357 ret ok 358 end 359 note ---- SHA-256 of F[0..g_n 7) into g_h slot k, block by block (seed/ng/sha256.om's sh_all, over a pool) 360 fn fblk to void 361 sh_init 362 for j ulong 8 363 put sh_h j get sh_k add j 64 364 end 365 nb = div get g_n 7 64 366 for b ulong nb bound NOLIM 367 for j ulong 64 368 put sh_pad j get F add mul b 64 j 369 end 370 sh_blk 1 0 371 end 372 end 373 fn ftail to void 374 n = get g_n 7 375 r = rem n 64 376 o = sub n r 377 for j ulong 128 378 put sh_pad j 0 379 end 380 for j ulong r bound 64 381 put sh_pad j get F add o j 382 end 383 put sh_pad r 128 384 e = ulong 64 385 if ge r 56 386 e = 128 387 end 388 bits = mul n 8 389 for j ulong 8 390 put sh_pad sub sub e 1 j uchar and shr bits mul j 8 255 391 end 392 sh_blk 1 0 393 if eq e 128 394 sh_blk 1 64 395 end 396 sh_out 397 end 398 fn fdig k ulong to void 399 fblk 400 ftail 401 for j ulong 32 402 c = get sh_dig j 403 put g_h add mul k 64 mul j 2 sh_hexd uint shr c 4 404 put g_h add add mul k 64 mul j 2 1 sh_hexd uint and c 15 405 end 406 end 407 note ---- table fields 408 fn flen r ulong f ulong to ulong 409 ret get R add add mul r 16 mul f 2 1 410 end 411 fn fat r ulong f ulong j ulong to uchar 412 ret get T add get R add mul r 16 mul f 2 j 413 end 414 fn feqt r ulong f ulong t view uchar * to bool 415 if ne flen r f len t 416 ret false 417 end 418 for j ulong len t bound NOLIM 419 if ne fat r f j get t j 420 ret false 421 end 422 end 423 ret true 424 end 425 fn feqh r ulong f ulong k ulong to bool 426 if ne flen r f 64 427 ret false 428 end 429 for j ulong 64 430 if ne fat r f j get g_h add mul k 64 j 431 ret false 432 end 433 end 434 ret true 435 end 436 fn fsame a ulong b ulong f ulong to bool 437 if ne flen a f flen b f 438 ret false 439 end 440 for j ulong flen a f bound NOLIM 441 if ne fat a f j fat b f j 442 ret false 443 end 444 end 445 ret true 446 end 447 fn fhex r ulong f ulong to bool 448 if ne flen r f 64 449 ret false 450 end 451 for j ulong 64 452 c = fat r f j 453 d = and ge c 48 le c 57 454 x = and ge c 97 le c 102 455 if not or d x 456 ret false 457 end 458 end 459 ret true 460 end 461 note the mode letter of bridge-seeded: lib-c L, lib-h M, lib-map V; 0 unknown 462 fn fmode r ulong to ulong 463 if feqt r 2 d_libc 464 ret 76 465 end 466 if feqt r 2 d_libh 467 ret 77 468 end 469 if feqt r 2 d_libmap 470 ret 86 471 end 472 ret 0 473 end 474 note fields of the line T[p..e) into row r of R; the field count 475 note g_n 16 the field count so far, g_n 17 where the field began 476 fn tcut r ulong i ulong to void 477 f = get g_n 16 478 s = get g_n 17 479 if lt f 8 480 x = add mul r 16 mul f 2 481 put R x s 482 put R add x 1 sub i s 483 end 484 put g_n 16 add f 1 485 put g_n 17 add i 1 486 end 487 fn tsplit p ulong e ulong r ulong to ulong 488 ren mul add r 1 16 489 put g_n 16 0 490 put g_n 17 p 491 i = p 492 while lt i e bound NOLIM 493 if eq get T i 9 494 tcut r i 495 end 496 i = add i 1 497 end 498 tcut r e 499 ret get g_n 16 500 end 501 fn tvalid r ulong f ulong to bool 502 if ne f 8 503 ret false 504 end 505 if not feqt r 0 d_derived 506 ret false 507 end 508 if eq fmode r 0 509 ret false 510 end 511 for k ulong 3 512 if not fhex r add 4 k 513 ret false 514 end 515 end 516 if or eq flen r 1 0 or eq flen r 3 0 eq flen r 7 0 517 ret false 518 end 519 ret true 520 end 521 note split T into rows; false when a row is malformed or there is none 522 fn tparse to bool 523 n = get g_n 5 524 p = ulong 0 525 rows = ulong 0 526 ok = true 527 while lt p n bound NOLIM 528 e = p 529 while lt e n bound NOLIM 530 if eq get T e 10 531 break 532 end 533 e = add e 1 534 end 535 if and gt e p ne get T p 35 536 f = tsplit p e rows 537 put g_n 6 add rows 1 538 if not tvalid rows f 539 ok = false 540 end 541 rows = add rows 1 542 end 543 p = add e 1 544 end 545 put g_n 6 rows 546 if eq rows 0 547 ok = false 548 end 549 ret ok 550 end 551 note ---- children: argument packet g_av, environment g_ev 552 fn aclr to void 553 put g_n 10 2 554 put g_n 11 0 555 end 556 fn apa to void 557 p = get g_n 10 558 n = plen 559 if gt add add p n 2 65536 560 r = write 2 t_pack 0 len t_pack 561 exit 2 562 end 563 for j ulong n bound 4096 564 put g_av add add p 2 j get g_pa j 565 end 566 put g_av p uchar and n 255 567 put g_av add p 1 uchar shr n 8 568 put g_n 10 add p add n 2 569 c = add get g_n 11 1 570 put g_n 11 c 571 put g_av 0 uchar and c 255 572 put g_av 1 uchar shr c 8 573 end 574 fn atx t view uchar * to void 575 pclr 576 pt t 577 apa 578 end 579 fn envset to void 580 put g_ev 0 1 581 put g_ev 1 0 582 put g_ev 2 uchar len e_path 583 put g_ev 3 0 584 for j ulong len e_path bound 64 585 put g_ev add 4 j get e_path j 586 end 587 put g_n 12 add 4 len e_path 588 end 589 fn redir s int d int to void 590 if ne dupfd s d 0 long d 591 exit 127 592 end 593 end 594 note run g_av with stdin fi, stdout fo, stderr fe (each closed here): the exit code, 256 + the signal, 512 when 595 note a descriptor could not be opened 596 fn spawn fi int fo int fe int to ulong 597 if or lt fi 0 or lt fo 0 lt fe 0 598 fclo fi 599 fclo fo 600 fclo fe 601 ret 512 602 end 603 pid = fork 604 if lt pid 0 605 r = write 2 t_fork 0 len t_fork 606 exit 2 607 end 608 if eq pid 0 609 redir fi 0 610 redir fo 1 611 redir fe 2 612 r = execenv g_av 0 get g_n 10 g_ev 0 get g_n 12 613 exit 127 614 end 615 fclo fi 616 fclo fo 617 fclo fe 618 while true bound NOLIM 619 r = waitpid int pid g_stb 0 len g_stb 0 620 if eq r pid 621 x = ulong get g_stb 0 622 if ne x 0 623 ret add 256 x 624 end 625 ret ulong get g_stb 1 626 end 627 if lt r 0 628 r = write 2 t_fork 0 len t_fork 629 exit 2 630 end 631 end 632 exit 2 633 end 634 note OMC with stdin g_pa (already set by the caller through fi), stdout SCRATCH + o (mode md), stderr SCRATCH + o.err 635 fn omcrun fi int o view uchar * md ulong to ulong 636 psc o 637 fo = fwr md 638 psc o 639 pt f_err 640 fe = fwr 420 641 aclr 642 pclr 643 parg 1 0 644 apa 645 ret spawn fi fo fe 646 end 647 note ---- checks 648 fn srccheck r ulong to void 649 pclr 650 pfl r 3 651 ok = fload 652 if ok 653 fdig 0 654 ok = feqh r 4 0 655 end 656 ook ok 657 ot o_src 658 ofl r 3 659 ot o_of 660 ofl r 1 661 ot o_mode 662 ofl r 2 663 ot o_gen 664 ofl r 5 665 if ok 666 ot o_srcm 667 else 668 ot o_srcf 669 end 670 ohx 0 671 onl 672 end 673 fn frontend r ulong to void 674 pclr 675 pfl r 3 676 fi = frd 677 rc = omcrun fi f_front 420 678 psc f_front 679 ok = fload 680 ok = and ok and eq rc 0 gt get g_n 7 0 681 ook ok 682 ot o_front 683 ofl r 3 684 ot o_frontm 685 if ne rc 0 686 ot o_rc 687 onum rc 688 end 689 onl 690 end 691 note one emitter row: the request, the run with TOC (argument k) on descriptor 3, the output digest 692 fn emitrow r ulong k ulong to bool 693 pclr 694 pfl r 3 695 ok = fload 696 n = get g_n 7 697 fdig 1 698 sen n 699 for j ulong n bound NOLIM 700 put S j get F j 701 end 702 qen add n 132 703 put Q 0 uchar fmode r 704 for j ulong n bound NOLIM 705 put Q add 1 j get S j 706 end 707 p = add n 1 708 put Q p 10 709 for j ulong 64 710 put Q add add p 1 j get g_h add 128 j 711 end 712 put Q add p 65 32 713 for j ulong 64 714 put Q add add p 66 j get g_h add 64 j 715 end 716 put Q add p 130 10 717 put g_n 9 add p 131 718 psc f_req 719 ok = and ok qsave 720 psc f_req 721 fi = frd 722 psc f_out 723 fo = fwr 420 724 psc f_out 725 pt f_err 726 fe = fwr 420 727 aclr 728 atx f_sh 729 atx f_c 730 atx f_launch 731 psc f_emit 732 apa 733 pclr 734 parg k 4 735 apa 736 rc = spawn fi fo fe 737 psc f_out 738 ok = and ok fload 739 fdig 0 740 ok = and ok and eq rc 0 feqh r 6 0 741 ook ok 742 ot o_der 743 ofl r 1 744 ot o_mode 745 ofl r 2 746 ot o_from 747 ohx 2 748 ot o_on 749 ofl r 3 750 ot o_gives 751 ofl r 6 752 if not ok 753 ot o_rc 754 onum rc 755 ot o_got 756 ohx 0 757 end 758 onl 759 ret ok 760 end 761 fn emitter k ulong to void 762 pclr 763 parg k 4 764 ok = fload 765 if not ok 766 ook false 767 ot o_emit 768 oarg k 4 769 ot o_emitu 770 onl 771 tier 13 false 772 ret 773 end 774 fdig 2 775 m = ulong 0 776 for r ulong get g_n 6 bound NOLIM 777 if feqh r 5 2 778 m = add m 1 779 end 780 end 781 if eq m 0 782 ook false 783 ot o_emit 784 ohx 2 785 ot o_emitn 786 onl 787 tier 13 false 788 ret 789 end 790 pclr 791 parg k 4 792 fi = frd 793 rc = omcrun fi f_emit 448 794 psc f_emit 795 ok = fload 796 ok = and ok and eq rc 0 gt get g_n 7 0 797 ook ok 798 ot o_emit 799 ohx 2 800 ot o_emitc 801 if ne rc 0 802 ot o_rc 803 onum rc 804 end 805 onl 806 tier 13 ok 807 if not ok 808 ret 809 end 810 for r ulong get g_n 6 bound NOLIM 811 if feqh r 5 2 812 tier 13 emitrow r k 813 end 814 end 815 end 816 fn oracle k ulong to void 817 m = ulong 0 818 for r ulong get g_n 6 bound NOLIM 819 if not feqt r 7 d_none 820 m = add m 1 821 pclr 822 parg k 7 823 pc 47 824 pfl r 7 825 ok = fload 826 if ok 827 fdig 0 828 ok = feqh r 6 0 829 end 830 ook ok 831 ot o_orc 832 ofl r 7 833 ot o_orcm 834 ofl r 1 835 ot o_mode 836 ofl r 2 837 ot o_from 838 ofl r 5 839 if not ok 840 ot o_got 841 ohx 0 842 end 843 onl 844 tier 14 ok 845 end 846 end 847 if eq m 0 848 ook false 849 ot o_orcn 850 onl 851 tier 14 false 852 end 853 end 854 fn usage to void 855 r = write 2 t_usage 0 len t_usage 856 exit 2 857 end 858 note does argument k start with t (and say more) 859 fn apre k ulong t view uchar * to bool 860 s = get AO mul k 2 861 n = get AO add mul k 2 1 862 if le n len t 863 ret false 864 end 865 for j ulong len t bound NOLIM 866 if ne get A add s j get t j 867 ret false 868 end 869 end 870 ret true 871 end 872 fn main to int 873 argc = ulong argcnt 874 if lt argc 4 875 usage 876 end 877 na = sub argc 1 878 put g_n 4 na 879 aoen mul na 2 880 for k ulong na bound NOLIM 881 n = argread add k 1 g_tmp 0 4096 882 if or lt n 1 gt n 4095 883 usage 884 end 885 u = get g_n 15 886 aen add u ulong n 887 for j ulong ulong n bound 4096 888 put A add u j get g_tmp j 889 end 890 put AO mul k 2 u 891 put AO add mul k 2 1 ulong n 892 put g_n 15 add u ulong n 893 end 894 for k ulong sub na 3 bound NOLIM 895 q = add k 3 896 if not or apre q a_toc apre q a_cud 897 usage 898 end 899 end 900 pclr 901 parg 0 0 902 n = plen 903 r = makedir g_pa 0 n 448 904 if ne r 0 905 r = write 2 t_noscr 0 len t_noscr 906 exit 2 907 end 908 envset 909 pclr 910 parg 2 0 911 ok = fload 912 n = get g_n 7 913 ten n 914 for j ulong n bound NOLIM 915 put T j get F j 916 end 917 put g_n 5 n 918 ok = and ok tparse 919 ook ok 920 ot o_table 921 if ok 922 onum get g_n 6 923 ot o_tablen 924 else 925 ot o_tablef 926 onum get g_n 6 927 end 928 onl 929 if ok 930 rows = get g_n 6 931 for ri ulong rows bound NOLIM 932 srccheck ri 933 seen = false 934 for qi ulong ri bound NOLIM 935 if fsame qi ri 3 936 seen = true 937 end 938 end 939 if not seen 940 frontend ri 941 end 942 end 943 for k ulong sub na 3 bound NOLIM 944 q = add k 3 945 if apre q a_toc 946 emitter q 947 end 948 end 949 for k ulong sub na 3 bound NOLIM 950 q = add k 3 951 if apre q a_cud 952 oracle q 953 end 954 end 955 end 956 ot o_sum 957 fl = get g_n 3 958 if eq fl 0 959 ot o_spass 960 else 961 ot o_sfail 962 end 963 ot o_checks 964 onum get g_n 2 965 ot o_failed 966 onum fl 967 ot o_emitter 968 st = get g_n 13 969 if eq st 0 970 ot o_notrun 971 end 972 if eq st 1 973 ot o_spass 974 end 975 if eq st 2 976 ot o_sfail 977 end 978 ot o_oracle 979 st = get g_n 14 980 if eq st 0 981 ot o_notrun 982 end 983 if eq st 1 984 ot o_spass 985 end 986 if eq st 2 987 ot o_sfail 988 end 989 onl 990 if eq fl 0 991 ret 0 992 end 993 ret 1 994 end