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/babel/blob/main/src/70-complete.om # babel aien-dev/babel 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 `babel / src / 70-complete.om` 715 lines ยท 11746 bytes Raw Blame History 1 note babel 70-complete: the completion record (policy complete-v1). Its denominator is every walked file, 2 note every split item, every entry the walk skipped and every required check (three differential legs per 3 note unit that reached the differential, the generated target test where the target has one, and each 4 note toolchain the target needs). --complete turns its state into the exit status. 5 note State codes in Csv: 1 COMPLETE, 2 PARTIAL, 3 BLOCKED, 4 FAILED (the highest open severity wins). 6 global Cpl ulong 1 7 global Cmd ulong 1 8 global Cden ulong 1 9 global Ccov ulong 1 10 global Csv ulong 1 11 global Cno ulong 1 12 global Ccap ulong 1 13 note staged strings of one open item: 0 kind, 1 item, 2 name, 3 verdict, 4 reason (pool offset, length) 14 global Xo ulong 5 15 global Xn ulong 5 16 global Cexc ulong 1 17 global Xe ulong 1 18 text CvExc "EXCLUDED" 19 text CpPol "complete-v1" 20 text CpS1 "COMPLETE" 21 text CpS2 "PARTIAL" 22 text CpS3 "BLOCKED" 23 text CpS4 "FAILED" 24 text CkFile "file" 25 text CkSkip "skipped" 26 text CkUnit "unit" 27 text CkCheck "check" 28 text CkTool "toolchain" 29 text CvSkip "SKIPPED" 30 text CiDot "." 31 text CiTst "diff/test.log" 32 text CiCap "babel capacity" 33 text CrOth "not a source language babel recognises (.c .h .rs .py .go .zig .cpp .cc .cxx .hpp): copied to input/ only, nothing translated" 34 text CrEmp "no files were walked: there is nothing to translate" 35 text CrSk1 "hidden (dot) entry: not walked, not copied, not translated" 36 text CrSk2 "symbolic link: not followed, not copied, not translated" 37 text CrSk3 "not a regular file or directory: not copied, not translated" 38 text CrSk4 "*.babel output folder: not walked" 39 text CrSk5 "directory could not be read: its entries were not walked" 40 text CrSk6 "could not be inspected (lstat failed): not walked" 41 text CrL0 "differential leg: original C (cc oracle)" 42 text CrL1 "differential leg: Omega unit (pinned omc)" 43 text CrL2 "differential leg: target " 44 text CrLf " failed" 45 text CrLn " did not run" 46 text CrSep ": " 47 text CrTf "generated target test failed (see diff/test.log), exit " 48 text CrTn "generated target test did not run (its toolchain is missing)" 49 text CrTl " was not found (on PATH, or at the ZIG or GO path given): every check that needs it is NOT_RUN" 50 text CrCap "an internal capacity was exceeded (2048 files or skipped entries, 1024 units, 8 MiB pool): items may be missing from this record" 51 52 note ---------- the walk over every item ---------- 53 note mode md: 0 count (Cden, Ccov, Cexc, Csv), 1 report.json open list, 2 REPORT.md open rows, 54 note 3 report.json excluded list, 4 REPORT.md excluded rows 55 fn cwalk md ulong to void 56 put Cmd 0 md 57 put Cno 0 0 58 if eq md 0 59 put Cden 0 0 60 put Ccov 0 0 61 put Cexc 0 0 62 put Csv 0 1 63 put Ccap 0 get Cap 0 64 end 65 if eq get Nf 0 0 66 cempty 67 end 68 for f ulong get Nf 0 69 cfile f 70 end 71 for i ulong get Nsk 0 72 cskip i 73 end 74 for u ulong get Nu 0 75 cunit u 76 end 77 for u ulong get Nu 0 78 for k ulong 3 79 cleg u k 80 end 81 end 82 ctest 83 ctool 0 84 s = tslot 85 if ne s 0 86 ctool s 87 end 88 if eq get Ccap 0 1 89 ccap 90 end 91 end 92 93 note one item with severity sv (0 covered, 1 EXCLUDED, 2 PARTIAL, 3 BLOCKED, 4 FAILED); true when it is to be printed 94 fn cbump sv ulong to bool 95 md = get Cmd 0 96 if eq md 0 97 put Cden 0 add get Cden 0 1 98 if eq sv 0 99 put Ccov 0 add get Ccov 0 1 100 end 101 if eq sv 1 102 put Cexc 0 add get Cexc 0 1 103 end 104 if gt sv get Csv 0 105 put Csv 0 sv 106 end 107 ret false 108 end 109 if gt md 2 110 ret eq sv 1 111 end 112 ret gt sv 1 113 end 114 115 note an EXCLUDED item: kind, item Pl[o, o+n) ("." when empty), manifest entry e1 - 1 116 fn cexcl kd view uchar * o ulong n ulong e1 ulong to void 117 m = mark 118 bs kd 119 xput 0 m 120 if eq n 0 121 bs CiDot 122 else 123 bpl o n 124 end 125 xput 1 m 126 put Xe 0 sub e1 1 127 cemit 128 end 129 130 note Ob[m, mark) into staged string k (empty: null in JSON, "-" in Markdown) 131 fn xput k ulong m ulong to void 132 put Xn k sub mark m 133 put Xo k psave m sub mark m 134 reset m 135 end 136 137 fn cempty to void 138 if not cbump 2 139 ret 140 end 141 m = mark 142 bs CkFile 143 xput 0 m 144 bs CiDot 145 xput 1 m 146 xput 2 m 147 bs VMi 148 xput 3 m 149 bs CrEmp 150 xput 4 m 151 cemit 152 end 153 154 note a walked file is covered when its language is one babel recognises (its content is counted by its 155 note units) or when it is the --exclude manifest; EXCLUDED when a manifest entry matched it 156 fn cfile f ulong to void 157 sv = ulong 0 158 if eq get Flg f 0 159 sv = ulong 2 160 if eq get Mfi 0 add f 1 161 sv = ulong 0 162 end 163 if ne get Fex f 0 164 sv = ulong 1 165 end 166 end 167 if not cbump sv 168 ret 169 end 170 if eq sv 1 171 cexcl CkFile get F0 f get Fl f get Fex f 172 ret 173 end 174 m = mark 175 bs CkFile 176 xput 0 m 177 bpl get F0 f get Fl f 178 xput 1 m 179 xput 2 m 180 bs VMi 181 xput 3 m 182 bs CrOth 183 xput 4 m 184 cemit 185 end 186 187 fn cskip i ulong to void 188 sv = ulong 2 189 if eq get Msk 0 add i 1 190 sv = ulong 0 191 end 192 if ne get Skx i 0 193 sv = ulong 1 194 end 195 if not cbump sv 196 ret 197 end 198 if eq sv 1 199 cexcl CkSkip get Sk0 i get Skl i get Skx i 200 ret 201 end 202 m = mark 203 bs CkSkip 204 xput 0 m 205 if eq get Skl i 0 206 bs CiDot 207 else 208 bpl get Sk0 i get Skl i 209 end 210 xput 1 m 211 xput 2 m 212 bs CvSkip 213 xput 3 m 214 bskip get Skr i 215 xput 4 m 216 cemit 217 end 218 219 fn bskip r ulong to void 220 if eq r 1 221 bs CrSk1 222 ret 223 end 224 if eq r 2 225 bs CrSk2 226 ret 227 end 228 if eq r 3 229 bs CrSk3 230 ret 231 end 232 if eq r 4 233 bs CrSk4 234 ret 235 end 236 if eq r 5 237 bs CrSk5 238 ret 239 end 240 bs CrSk6 241 end 242 243 note a split item is covered when TRANSLATED or ABSORBED 244 fn cunit u ulong to void 245 s = get Ust u 246 sv = ulong 3 247 if eq s 1 248 sv = ulong 0 249 end 250 if eq s 6 251 sv = ulong 0 252 end 253 if eq s 2 254 sv = ulong 2 255 end 256 if eq s 3 257 sv = ulong 2 258 end 259 if eq s 4 260 sv = ulong 4 261 end 262 if not cbump sv 263 ret 264 end 265 m = mark 266 bs CkUnit 267 xput 0 m 268 bloc u 269 xput 1 m 270 bname u 271 xput 2 m 272 bverdict u 273 xput 3 m 274 bpl get Ur0 u get Urn u 275 xput 4 m 276 cemit 277 end 278 279 note differential leg k of unit u, required once the unit reached the differential 280 fn cleg u ulong k ulong to void 281 v = get Ulg add mul u 3 k 282 if eq v 0 283 ret 284 end 285 sv = ulong 0 286 if eq v 2 287 sv = ulong 4 288 end 289 if eq v 3 290 sv = ulong 3 291 end 292 if not cbump sv 293 ret 294 end 295 m = mark 296 bs CkCheck 297 xput 0 m 298 bloc u 299 xput 1 m 300 bname u 301 xput 2 m 302 if eq v 2 303 bs VFa 304 else 305 bs VNr 306 end 307 xput 3 m 308 if eq k 0 309 bs CrL0 310 end 311 if eq k 1 312 bs CrL1 313 end 314 if eq k 2 315 bs CrL2 316 blang get Lg 0 317 end 318 if eq v 2 319 bs CrLf 320 else 321 bs CrLn 322 end 323 if gt get Urn u 0 324 bs CrSep 325 bpl get Ur0 u get Urn u 326 end 327 xput 4 m 328 cemit 329 end 330 331 note the generated target test: required for rust and python once any oracle output exists 332 fn ctest to void 333 g = get Lg 0 334 if lt g 2 335 ret 336 end 337 if gt g 3 338 ret 339 end 340 if not anycase 341 ret 342 end 343 t = get Tsr 0 344 sv = ulong 0 345 if ne t 0 346 sv = ulong 4 347 if eq t 999 348 sv = ulong 3 349 end 350 end 351 if not cbump sv 352 ret 353 end 354 m = mark 355 bs CkCheck 356 xput 0 m 357 bs CiTst 358 xput 1 m 359 xput 2 m 360 if eq sv 4 361 bs VFa 362 xput 3 m 363 bs CrTf 364 bu t 365 else 366 bs VNr 367 xput 3 m 368 bs CrTn 369 end 370 xput 4 m 371 cemit 372 end 373 374 note toolchain slot s: required (cc for the oracle, plus the target's own tool) 375 fn ctool s ulong to void 376 sv = ulong 0 377 if eq get Tok s 0 378 sv = ulong 3 379 end 380 if not cbump sv 381 ret 382 end 383 m = mark 384 bs CkTool 385 xput 0 m 386 btool s 387 xput 1 m 388 xput 2 m 389 bs VNr 390 xput 3 m 391 btool s 392 bs CrTl 393 xput 4 m 394 cemit 395 end 396 397 fn btool s ulong to void 398 if eq s 0 399 bs TlNm0 400 ret 401 end 402 if eq s 1 403 bs TlNm1 404 ret 405 end 406 if eq s 2 407 bs TlNm2 408 ret 409 end 410 if eq s 3 411 bs TlNm3 412 ret 413 end 414 if eq s 4 415 bs TlNm4 416 ret 417 end 418 bs TlNm5 419 end 420 421 fn ccap to void 422 if not cbump 3 423 ret 424 end 425 m = mark 426 bs CkCheck 427 xput 0 m 428 bs CiCap 429 xput 1 m 430 xput 2 m 431 bs VNr 432 xput 3 m 433 bs CrCap 434 xput 4 m 435 cemit 436 end 437 438 note ---------- output of one open item ---------- 439 text CjA "\n {\"kind\": \"" 440 text CjB "\", \"item\": " 441 text CjC ", \"name\": " 442 text CjD ", \"verdict\": \"" 443 text CjE "\", \"reason\": " 444 text CjF "}" 445 446 fn cemit to void 447 md = get Cmd 0 448 if eq md 1 449 cemitj 450 ret 451 end 452 if eq md 3 453 cemitx 454 ret 455 end 456 if eq md 4 457 cemitxm 458 ret 459 end 460 cemitm 461 end 462 463 text CxV ", \"verdict\": \"EXCLUDED\", \"reason\": " 464 text CxM ", \"matched_by\": " 465 text CxL ", \"line\": " 466 467 note report.json excluded item: kind, item, verdict, the manifest's reason, entry and line 468 fn cemitx to void 469 if gt get Cno 0 0 470 bc 44 471 end 472 put Cno 0 add get Cno 0 1 473 e = get Xe 0 474 bs CjA 475 bpl get Xo 0 get Xn 0 476 bs CjB 477 bjq get Xo 1 get Xn 1 478 bs CxV 479 bjq get Mr0 e get Mrn e 480 bs CxM 481 bjq get Me0 e get Men e 482 bs CxL 483 bu get Mln e 484 bs CjF 485 end 486 487 text CxLn " (line " 488 489 note REPORT.md excluded row: | kind | item | EXCLUDED | entry (line N) | reason | 490 fn cemitxm to void 491 e = get Xe 0 492 bs MTl 493 bpl get Xo 0 get Xn 0 494 bs MTm 495 bc 96 496 bmd get Xo 1 get Xn 1 497 bc 96 498 bs MTm 499 bs CvExc 500 bs MTm 501 bc 96 502 bmd get Me0 e get Men e 503 bc 96 504 bs CxLn 505 bu get Mln e 506 bc 41 507 bs MTm 508 bmd get Mr0 e get Mrn e 509 bs MTn 510 end 511 512 fn cemitj to void 513 if gt get Cno 0 0 514 bc 44 515 end 516 put Cno 0 add get Cno 0 1 517 bs CjA 518 bpl get Xo 0 get Xn 0 519 bs CjB 520 bjq get Xo 1 get Xn 1 521 bs CjC 522 bqnull get Xo 2 get Xn 2 523 bs CjD 524 bpl get Xo 3 get Xn 3 525 bs CjE 526 bqnull get Xo 4 get Xn 4 527 bs CjF 528 end 529 530 fn cemitm to void 531 bs MTl 532 bpl get Xo 0 get Xn 0 533 bs MTm 534 bc 96 535 bmd get Xo 1 get Xn 1 536 bc 96 537 bs MTm 538 if eq get Xn 2 0 539 bc 45 540 else 541 bmd get Xo 2 get Xn 2 542 end 543 bs MTm 544 bpl get Xo 3 get Xn 3 545 bs MTm 546 bmd get Xo 4 get Xn 4 547 bs MTn 548 end 549 550 note ---------- state, exit status and the three renderings ---------- 551 fn bstate to void 552 s = get Csv 0 553 if eq s 1 554 bs CpS1 555 ret 556 end 557 if eq s 2 558 bs CpS2 559 ret 560 end 561 if eq s 3 562 bs CpS3 563 ret 564 end 565 bs CpS4 566 end 567 568 note --complete: 0 COMPLETE, 1 FAILED, 3 PARTIAL, 4 BLOCKED 569 fn cexit to ulong 570 s = get Csv 0 571 if eq s 1 572 ret 0 573 end 574 if eq s 2 575 ret 3 576 end 577 if eq s 3 578 ret 4 579 end 580 ret 1 581 end 582 583 text CjH "{\"policy\": \"" 584 text CjI "\", \"enforced\": " 585 text CjT "true" 586 text CjFl "false" 587 text CjJ ", \"state\": \"" 588 text CjK "\", \"denominator\": " 589 text CjL ", \"covered\": " 590 text CjM ", \"open\": [" 591 text CjN "\n ]" 592 text CjO "]" 593 text CjP ", \"excluded_count\": " 594 text CjQ ", \"excluded\": [" 595 text CjR ", \"manifest\": " 596 597 fn cjson to void 598 bs CjH 599 bs CpPol 600 bs CjI 601 if eq get Cpl 0 1 602 bs CjT 603 else 604 bs CjFl 605 end 606 bs CjJ 607 bstate 608 bs CjK 609 bu get Cden 0 610 bs CjL 611 bu get Ccov 0 612 bs CjM 613 cwalk 1 614 if gt get Cno 0 0 615 bs CjN 616 else 617 bs CjO 618 end 619 bs CjP 620 bu get Cexc 0 621 bs CjQ 622 cwalk 3 623 if gt get Cno 0 0 624 bs CjN 625 else 626 bs CjO 627 end 628 bs CjR 629 exjson 630 bc 125 631 end 632 633 text CmA "\n## Completion\n\nPolicy `complete-v1`" 634 text CmB " (enforced: --complete was given, so the exit status follows this state)" 635 text CmC " (not enforced: with --complete the exit status follows this state)" 636 text CmD ". State: **" 637 text CmE "**, " 638 text CmF " of " 639 text CmG " items covered" 640 text CmE2 ", " 641 text CmGx " excluded by manifest `" 642 text CmGs "` (sha256 " 643 text CmGe ")" 644 text CmG2 ".\n\nThe denominator counts every walked file, every split item, every entry the walk skipped (hidden entries, symbolic links, other non-regular files, `*.babel` folders, unreadable directories) and every required check: the three differential legs of each unit that reached the differential, the generated target test where the target has one (rust, python), and each toolchain the target needs. An entry matched by the --exclude manifest stays in the denominator as EXCLUDED with the manifest's reason; source files and their split items cannot be excluded. COMPLETE: every item TRANSLATED, ABSORBED or EXCLUDED, nothing else skipped, every check ran and passed. FAILED: any FAIL. BLOCKED: no FAIL, but a required check did not run or a toolchain is missing. PARTIAL: no FAIL and no NOT_RUN, but UNSUPPORTED, MISSING_IMPLEMENTATION or skipped items remain.\n" 645 text CmX "\nExcluded by the manifest:\n\n| kind | item | verdict | manifest entry | reason |\n|---|---|---|---|---|\n" 646 text CmH "\n| kind | item | name | verdict | reason |\n|---|---|---|---|---|\n" 647 text CmI "\nNo open items.\n" 648 649 fn cmdsec to void 650 bs CmA 651 if eq get Cpl 0 1 652 bs CmB 653 else 654 bs CmC 655 end 656 bs CmD 657 bstate 658 bs CmE 659 bu get Ccov 0 660 bs CmF 661 bu get Cden 0 662 bs CmG 663 if gt get Exn 0 0 664 bs CmE2 665 bu get Cexc 0 666 bs CmGx 667 bmd get Ex0 0 get Exn 0 668 bs CmGs 669 exhex 32 670 bs CmGe 671 end 672 bs CmG2 673 if eq add get Ccov 0 get Cexc 0 get Cden 0 674 bs CmI 675 else 676 bs CmH 677 cwalk 2 678 end 679 if gt get Cexc 0 0 680 bs CmX 681 cwalk 4 682 end 683 end 684 685 text CsA " completion " 686 text CsB " items covered (policy complete-v1" 687 text CsC ", enforced by --complete)\n" 688 text CsD "; --complete makes it the exit status)\n" 689 text CsE " items covered, " 690 text CsF " excluded by manifest " 691 text CsG " (policy complete-v1" 692 693 fn csline to void 694 bs CsA 695 bstate 696 bc 32 697 bc 32 698 bu get Ccov 0 699 bs CmF 700 bu get Cden 0 701 if gt get Exn 0 0 702 bs CsE 703 bu get Cexc 0 704 bs CsF 705 exhex 4 706 bs CsG 707 else 708 bs CsB 709 end 710 if eq get Cpl 0 1 711 bs CsC 712 else 713 bs CsD 714 end 715 end