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/aien-architecture-mv/blob/main/tools/doctrine/doctrine.om # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. 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 `aien-architecture-mv / tools / doctrine / doctrine.om` 1827 lines · 28177 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note doctrine: doctrine consistency check (aien-architecture#7) in seeded Omega (#316, #300). 3 note Port of scripts/check_doctrine.sh (bash + GNU grep + gawk, LC_ALL=C): same inputs 4 note (doctrine/*.md, docs/milestone-*-spec.md under ROOT), same checks 0-4, same output lines 5 note and the same exit codes (0 pass, 1 fail, 2 ROOT unusable). 6 note usage: doctrine [ROOT] (ROOT defaults to the current directory) 7 note Every ERE of the script is hand-written as a matcher below; the ERE is kept in a note 8 note above its matcher. Byte semantics everywhere (the script runs under LC_ALL=C): word 9 note characters are [A-Za-z0-9_], [[:space:]] is 9-13 and 32, and gawk's bracket [-–] is 10 note the four bytes 45, 226, 128, 147 (an en dash never matches it as one character). 11 note Built only by seed/out/omc from aien-dev/omega-mv (tools/zero-legacy/omega.pin). 12 13 text tbl "\n\nALPHA\nAlpha\nalpha.\nbin\nmanifest\nsha256\ndecode\nmemory-map\ncontrol-flow\naudit\nHandoff (EL1)\nEL1 Handoff\nEL1 handoff\nstrictly at **EL1\nEL1 Jump\nat EL1 privilege level\nMilestone\nMILESTONE\nSOVEREIGN_CLOSURE\nSOVEREIGN_MACHINE_CLOSURE\nAIEN_HUMAN_INTERFACE\n27\n28-\n31-\nilestone\nwenty-eight \nprecise \nmilestones\nhirty-one milestones\nMILESTONE \n— \n–\nM27\nBOOTSTRAP_SEED_ATLAS\nATLAS_BAREMETAL_BOOT\nATLAS_MEASUREMENT_CHAIN\nATLAS_STAGE2_ELIMINATION\nPHYSICS_CORE_MEMBRANE\nSENTINEL_GATE_\nAIEN_SEED_TRAINING\nAIEN_SEED_TOPOLOGY\n[COMPLETE]\n[IN PROGRESS]\n[REOPENED\n[COMPLETE / QEMU QUALIFIED]\n[QEMU QUALIFIED]\nPHYSICS_BOOT\nCOMPLETE\n| **M\n** |\nhysics \nero\nCOMPLETE / QEMU QUALIFIED\nCOMPLETE / HARDWARE BOUNDARY QUALIFIED\nCOMPLETE / CORRECTIVELY REQUALIFIED\nCOMPLETE / SILICON QUALIFIED\nREOPENED / IN PROGRESS\nIN PROGRESS\nPLANNED\nPhysics Zero Discovery\nGeneral AIEN\nFAIL [\n] \n: \nunbalanced-historical-marker\nalpha-naming\nfixed-el1-handoff\nobsolete-m27-closure\nobsolete-roadmap-generation\nretired-milestone-identifier\nstatus-outside-roadmap\nduplicate-roadmap-table\nphysics-zero-range\nroadmap-missing\nroadmap-structure\nmilestone-number-mismatch\nHISTORICAL-PROVENANCE marker without partner\ncanonical roadmap file not found\n expected row M\n, found M\n has unknown status \"\n\"\n is outside Physics Zero M27-M35\n must be in the Physics Zero Discovery era\n is outside General AIEN M36-M40\n expected 41 roadmap rows (M0-M40), found \n cited as M\n, is M\n in ROADMAP.md: \n----------------------------------------------------------------------\ncheck_doctrine: scanned \n files; \n failure(s); 0 deferred finding(s).\ncheck_doctrine: FAIL\ncheck_doctrine: PASS\ncheck_doctrine: cannot cd to \ndoctrine/ROADMAP.md\ndoctrine/\ndocs/\n.md\nmilestone-\n-spec.md\ndoctrine\ndocs\n:\n M\n.\n" 14 15 note table entries by index: 16 note 0 BEGIN marker, 1 END marker, 2-11 alpha-naming parts, 12-17 fixed-el1-handoff literals, 17 note 18 Milestone, 19 MILESTONE, 20-22 m27 codes, 23 "27", 24-34 roadmap-generation parts 18 note (32 is em dash + space, 33 is the en dash), 35-42 retired identifiers, 43-49 status parts, 19 note 50 "| **M", 51 "** |", 52 "hysics ", 53 "ero", 54-60 roadmap statuses (49 is COMPLETE), 20 note 61-62 eras, 63-65 report pieces, 66-77 check names (66 + check id), 78-90 messages, 21 note 91-97 summary lines, 98 ROADMAP path, 99-105 directory and glob parts, 106 ":", 107 " M", 22 note 108 "." (the default ROOT). 23 24 global toff ulong 128 25 global tlen ulong 128 26 global fbuf uchar `8388608` 27 global flen ulong 1 28 global fpath uchar 4096 29 global fplen ulong 1 30 global lb ulong 1 31 global lx ulong 1 32 global nl ulong 1 33 global fs ulong 1 34 global fe ulong 1 35 global names uchar 65536 36 global noff ulong 1024 37 global nlen ulong 1024 38 global ord ulong 1024 39 global nf ulong 1 40 global nused ulong 1 41 global dbuf uchar 65536 42 global sb uchar 128 43 global nb uchar 24 44 global fails ulong 1 45 global mcode uchar 32768 46 global moff ulong 512 47 global mlen ulong 512 48 global mnoff ulong 512 49 global mnlen ulong 512 50 global mcnt ulong 1 51 global mused ulong 1 52 global mi ulong 1 53 54 note ---- the text table ---- 55 56 fn tinit to void 57 k = ulong 0 58 s = ulong 0 59 for i ulong len tbl 60 if eq get tbl i 10 61 put toff k s 62 put tlen k sub i s 63 k = add k 1 64 s = add i 1 65 end 66 end 67 end 68 69 note write table entry k to stdout 70 fn wt k ulong to void 71 r = write 1 tbl get toff k get tlen k 72 end 73 74 fn wnl to void 75 put nb 0 10 76 r = write 1 nb 0 1 77 end 78 79 fn wnum v ulong to void 80 n = ulong 0 81 if eq v 0 82 put nb 23 48 83 n = 1 84 end 85 x = v 86 while gt x 0 bound 20 87 put nb sub 23 n uchar add 48 rem x 10 88 x = div x 10 89 n = add n 1 90 end 91 r = write 1 nb sub 24 n n 92 end 93 94 note ---- bytes of the current line [lb, lx) of fbuf ---- 95 96 note byte at i inside the line, 0 at or past its end 97 fn cb i ulong to ulong 98 if lt i get lx 0 99 ret ulong get fbuf i 100 end 101 ret 0 102 end 103 104 note table entry k is the text at i (inside the line) 105 fn lit i ulong k ulong to bool 106 m = get tlen k 107 if gt add i m get lx 0 108 ret false 109 end 110 o = get toff k 111 for j ulong m 112 if ne get fbuf add i j get tbl add o j 113 ret false 114 end 115 end 116 ret true 117 end 118 119 note table entry k occurs somewhere in the line 120 fn has k ulong to bool 121 m = get tlen k 122 e = get lx 0 123 if lt sub e get lb 0 m 124 ret false 125 end 126 i = get lb 0 127 e = sub e m 128 while le i e bound 999999 129 if lit i k 130 ret true 131 end 132 i = add i 1 133 end 134 ret false 135 end 136 137 note ---- byte classes (C locale) ---- 138 139 fn isdg c ulong to bool 140 if lt c 48 141 ret false 142 end 143 ret le c 57 144 end 145 146 fn isup c ulong to bool 147 if lt c 65 148 ret false 149 end 150 ret le c 90 151 end 152 153 fn islo c ulong to bool 154 if lt c 97 155 ret false 156 end 157 ret le c 122 158 end 159 160 note [A-Za-z0-9] 161 fn isan c ulong to bool 162 if isdg c 163 ret true 164 end 165 if isup c 166 ret true 167 end 168 ret islo c 169 end 170 171 note word character of \b and \<: [A-Za-z0-9_] 172 fn isw c ulong to bool 173 if isan c 174 ret true 175 end 176 ret eq c 95 177 end 178 179 note [A-Z0-9_] 180 fn isid c ulong to bool 181 if isup c 182 ret true 183 end 184 if isdg c 185 ret true 186 end 187 ret eq c 95 188 end 189 190 note [[:space:]] 191 fn issp c ulong to bool 192 if eq c 32 193 ret true 194 end 195 if lt c 9 196 ret false 197 end 198 ret le c 13 199 end 200 201 note \b before position i: line start or a non-word byte before i 202 fn wbb i ulong to bool 203 if le i get lb 0 204 ret true 205 end 206 ret not isw ulong get fbuf sub i 1 207 end 208 209 note \b after a word byte ending just before i: line end or a non-word byte at i 210 fn wba i ulong to bool 211 ret not isw cb i 212 end 213 214 note ---- check 1: alpha-naming ---- 215 note ERE: \bALPHA\b|\bAlpha\b|\balpha\.(bin|manifest|sha256|decode|memory-map|control-flow|audit)\b 216 217 fn alsuf j ulong to bool 218 k = ulong 5 219 while le k 11 bound 8 220 if lit j k 221 if wba add j get tlen k 222 ret true 223 end 224 end 225 k = add k 1 226 end 227 ret false 228 end 229 230 fn m1 to bool 231 i = get lb 0 232 while lt i get lx 0 bound 999999 233 if wbb i 234 if lit i 2 235 if wba add i 5 236 ret true 237 end 238 end 239 if lit i 3 240 if wba add i 5 241 ret true 242 end 243 end 244 if lit i 4 245 if alsuf add i 6 246 ret true 247 end 248 end 249 end 250 i = add i 1 251 end 252 ret false 253 end 254 255 note ---- check 1: fixed-el1-handoff ---- 256 note ERE: Monotonic Handoff \(EL1\)|Handoff \(EL1\)|EL1 [Hh]andoff|strictly at \*\*EL1|EL1 Jump|at EL1 privilege level 257 note (the first alternative contains the second, so five literals decide) 258 259 fn m2 to bool 260 i = get lb 0 261 while lt i get lx 0 bound 999999 262 k = ulong 12 263 while le k 17 bound 7 264 if lit i k 265 ret true 266 end 267 k = add k 1 268 end 269 i = add i 1 270 end 271 ret false 272 end 273 274 note ---- check 1: obsolete-m27-closure ---- 275 note ERE: (Milestone|MILESTONE|\bM) ?27\b[^|]*SOVEREIGN(_MACHINE)?_CLOSURE 276 note | SOVEREIGN(_MACHINE)?_CLOSURE[^|]*(Milestone|MILESTONE|\bM) ?27\b 277 note | (Milestone|MILESTONE|M) ?27\b[^|]*AIEN_HUMAN_INTERFACE 278 note | AIEN_HUMAN_INTERFACE[^|]*(Milestone|MILESTONE|\bM) ?27\b 279 280 note end of "(Milestone|MILESTONE|M) ?27\b" starting at i, 0 when none; bd 1 demands \b before a bare M 281 fn tok27 i ulong bd ulong to ulong 282 p = ulong 0 283 if lit i 18 284 p = add i 9 285 end 286 if lit i 19 287 p = add i 9 288 end 289 if eq p 0 290 if ne cb i 77 291 ret 0 292 end 293 if eq bd 1 294 if not wbb i 295 ret 0 296 end 297 end 298 p = add i 1 299 end 300 if eq cb p 32 301 p = add p 1 302 end 303 if not lit p 23 304 ret 0 305 end 306 if not wba add p 2 307 ret 0 308 end 309 ret add p 2 310 end 311 312 note a token ends at or before s with no | between it and s 313 fn m3a s ulong bd ulong to bool 314 i = s 315 while gt i get lb 0 bound 999999 316 i = sub i 1 317 if eq cb i 124 318 ret false 319 end 320 e = tok27 i bd 321 if ne e 0 322 if le e s 323 ret true 324 end 325 end 326 end 327 ret false 328 end 329 330 note a \b-token starts at or after e with no | between e and it 331 fn m3b e ulong to bool 332 i = e 333 while lt i get lx 0 bound 999999 334 if eq cb i 124 335 ret false 336 end 337 if ne tok27 i 1 0 338 ret true 339 end 340 i = add i 1 341 end 342 ret false 343 end 344 345 fn m3 to bool 346 i = get lb 0 347 while lt i get lx 0 bound 999999 348 if or lit i 20 lit i 21 349 if m3a i 1 350 ret true 351 end 352 end 353 if lit i 20 354 if m3b add i 17 355 ret true 356 end 357 end 358 if lit i 21 359 if m3b add i 25 360 ret true 361 end 362 end 363 if lit i 22 364 if m3a i 0 365 ret true 366 end 367 if m3b add i 20 368 ret true 369 end 370 end 371 i = add i 1 372 end 373 ret false 374 end 375 376 note ---- check 1: obsolete-roadmap-generation ---- 377 note ERE: \b(28|31)-[Mm]ilestone|[Tt]wenty-eight (precise )?milestones|[Tt]hirty-one milestones 378 note | ^MILESTONE [0-9]+ +— |\bM[0-9]+ ?(-|–) ?M27\b 379 380 fn m4a i ulong to bool 381 if not wbb i 382 ret false 383 end 384 if not or lit i 24 lit i 25 385 ret false 386 end 387 c = cb add i 3 388 if not or eq c 77 eq c 109 389 ret false 390 end 391 ret lit add i 4 26 392 end 393 394 fn m4b i ulong to bool 395 c = cb i 396 if not or eq c 84 eq c 116 397 ret false 398 end 399 if lit add i 1 30 400 ret true 401 end 402 if not lit add i 1 27 403 ret false 404 end 405 p = add i 13 406 if lit p 28 407 p = add p 8 408 end 409 ret lit p 29 410 end 411 412 fn m4c to bool 413 p = get lb 0 414 if not lit p 31 415 ret false 416 end 417 p = add p 10 418 if not isdg cb p 419 ret false 420 end 421 while isdg cb p bound 999999 422 p = add p 1 423 end 424 if ne cb p 32 425 ret false 426 end 427 while eq cb p 32 bound 999999 428 p = add p 1 429 end 430 ret lit p 32 431 end 432 433 note position after "-" or the en dash at p, 0 when neither 434 fn dash p ulong to ulong 435 if eq cb p 45 436 ret add p 1 437 end 438 if lit p 33 439 ret add p 3 440 end 441 ret 0 442 end 443 444 fn m4d i ulong to bool 445 if not wbb i 446 ret false 447 end 448 if ne cb i 77 449 ret false 450 end 451 p = add i 1 452 if not isdg cb p 453 ret false 454 end 455 while isdg cb p bound 999999 456 p = add p 1 457 end 458 if eq cb p 32 459 p = add p 1 460 end 461 p = dash p 462 if eq p 0 463 ret false 464 end 465 if eq cb p 32 466 p = add p 1 467 end 468 if not lit p 34 469 ret false 470 end 471 ret wba add p 3 472 end 473 474 fn m4 to bool 475 if m4c 476 ret true 477 end 478 i = get lb 0 479 while lt i get lx 0 bound 999999 480 if m4a i 481 ret true 482 end 483 if m4b i 484 ret true 485 end 486 if m4d i 487 ret true 488 end 489 i = add i 1 490 end 491 ret false 492 end 493 494 note ---- check 1: retired-milestone-identifier ---- 495 note ERE: \b(BOOTSTRAP_SEED_ATLAS|ATLAS_BAREMETAL_BOOT|ATLAS_MEASUREMENT_CHAIN|ATLAS_STAGE2_ELIMINATION 496 note |PHYSICS_CORE_MEMBRANE|SENTINEL_GATE_[0-9]|AIEN_SEED_TRAINING|AIEN_SEED_TOPOLOGY)\b 497 498 fn m5a i ulong to bool 499 k = ulong 35 500 while le k 42 bound 9 501 if lit i k 502 if eq k 40 503 if isdg cb add i 14 504 if wba add i 15 505 ret true 506 end 507 end 508 else 509 if wba add i get tlen k 510 ret true 511 end 512 end 513 end 514 k = add k 1 515 end 516 ret false 517 end 518 519 fn m5 to bool 520 i = get lb 0 521 while lt i get lx 0 bound 999999 522 if wbb i 523 if m5a i 524 ret true 525 end 526 end 527 i = add i 1 528 end 529 ret false 530 end 531 532 note ---- check 1: status-outside-roadmap ---- 533 note ERE: \[(COMPLETE|IN PROGRESS|REOPENED[^]]*|COMPLETE / QEMU QUALIFIED|QEMU QUALIFIED)\]|PHYSICS_BOOT[^|]*\bCOMPLETE\b 534 535 fn m6a i ulong to bool 536 j = add i 12 537 while lt j get lx 0 bound 999999 538 if eq cb j 124 539 ret false 540 end 541 if lit j 49 542 if wbb j 543 if wba add j 8 544 ret true 545 end 546 end 547 end 548 j = add j 1 549 end 550 ret false 551 end 552 553 fn m6b i ulong to bool 554 j = add i 9 555 while lt j get lx 0 bound 999999 556 if eq cb j 93 557 ret true 558 end 559 j = add j 1 560 end 561 ret false 562 end 563 564 fn m6 to bool 565 i = get lb 0 566 while lt i get lx 0 bound 999999 567 if or lit i 43 lit i 44 568 ret true 569 end 570 if or lit i 46 lit i 47 571 ret true 572 end 573 if lit i 45 574 if m6b i 575 ret true 576 end 577 end 578 if lit i 48 579 if m6a i 580 ret true 581 end 582 end 583 i = add i 1 584 end 585 ret false 586 end 587 588 note ---- check 1: duplicate-roadmap-table ---- 589 note ERE: ^[[:space:]]*M[0-9]{1,2}:[[:space:]]+[A-Z][A-Z0-9_]{3,}|^\| \*\*M[0-9]{1,2}\*\* \| 590 591 fn m7b to bool 592 p = get lb 0 593 if not lit p 50 594 ret false 595 end 596 p = add p 5 597 if not isdg cb p 598 ret false 599 end 600 p = add p 1 601 if isdg cb p 602 p = add p 1 603 end 604 ret lit p 51 605 end 606 607 fn m7 to bool 608 if m7b 609 ret true 610 end 611 p = get lb 0 612 while issp cb p bound 999999 613 p = add p 1 614 end 615 if ne cb p 77 616 ret false 617 end 618 p = add p 1 619 if not isdg cb p 620 ret false 621 end 622 p = add p 1 623 if isdg cb p 624 p = add p 1 625 end 626 if ne cb p 58 627 ret false 628 end 629 p = add p 1 630 if not issp cb p 631 ret false 632 end 633 while issp cb p bound 999999 634 p = add p 1 635 end 636 if not isup cb p 637 ret false 638 end 639 p = add p 1 640 n = ulong 0 641 while isid cb p bound 999999 642 p = add p 1 643 n = add n 1 644 end 645 ret ge n 3 646 end 647 648 note ---- check 2: physics-zero-range ---- 649 note awk, leftmost-longest, one report per line: 650 note while (match(s, /[Pp]hysics [Zz]ero[^.]{0,30}M[0-9]+ ?[-–] ?M[0-9]+|M[0-9]+ ?[-–] ?M[0-9]+ ?\([Pp]hysics [Zz]ero/)) 651 note t = matched; s = rest; match(t, /M[0-9]+ ?[-–] ?M[0-9]+/); r = that with spaces removed and – turned into - 652 note if (r != "M27-M35") report the line and stop 653 654 note one byte of gawk's C-locale bracket [-–] 655 fn isdash c ulong to bool 656 if eq c 45 657 ret true 658 end 659 if eq c 226 660 ret true 661 end 662 if eq c 128 663 ret true 664 end 665 ret eq c 147 666 end 667 668 note end of M[0-9]+ ?[-–] ?M[0-9]+ at j, 0 when none 669 fn rng j ulong to ulong 670 if ne cb j 77 671 ret 0 672 end 673 p = add j 1 674 if not isdg cb p 675 ret 0 676 end 677 while isdg cb p bound 999999 678 p = add p 1 679 end 680 if eq cb p 32 681 p = add p 1 682 end 683 if not isdash cb p 684 ret 0 685 end 686 p = add p 1 687 if eq cb p 32 688 p = add p 1 689 end 690 if ne cb p 77 691 ret 0 692 end 693 p = add p 1 694 if not isdg cb p 695 ret 0 696 end 697 while isdg cb p bound 999999 698 p = add p 1 699 end 700 ret p 701 end 702 703 note [Pp]hysics [Zz]ero at i 704 fn pz i ulong to bool 705 c = cb i 706 if not or eq c 80 eq c 112 707 ret false 708 end 709 if not lit add i 1 52 710 ret false 711 end 712 c = cb add i 8 713 if not or eq c 90 eq c 122 714 ret false 715 end 716 ret lit add i 9 53 717 end 718 719 note longest end of the first alternative at i, 0 when none 720 fn alt1 i ulong to ulong 721 if not pz i 722 ret 0 723 end 724 b = add i 12 725 best = ulong 0 726 k = ulong 0 727 while le k 30 bound 31 728 if gt k 0 729 if eq cb sub add b k 1 46 730 break 731 end 732 end 733 e = rng add b k 734 if gt e best 735 best = e 736 end 737 k = add k 1 738 end 739 ret best 740 end 741 742 note end of the second alternative at i, 0 when none 743 fn alt2 i ulong to ulong 744 p = rng i 745 if eq p 0 746 ret 0 747 end 748 if eq cb p 32 749 p = add p 1 750 end 751 if ne cb p 40 752 ret 0 753 end 754 if pz add p 1 755 ret add p 13 756 end 757 ret 0 758 end 759 760 note the range at j (already known to match rng) normalizes to M27-M35 761 fn rok j ulong to bool 762 p = add j 1 763 if not lit p 23 764 ret false 765 end 766 p = add p 2 767 if isdg cb p 768 ret false 769 end 770 if eq cb p 32 771 p = add p 1 772 end 773 if ne cb p 45 774 ret false 775 end 776 p = add p 1 777 if eq cb p 32 778 p = add p 1 779 end 780 if ne cb p 77 781 ret false 782 end 783 p = add p 1 784 if ne cb p 51 785 ret false 786 end 787 if ne cb add p 1 53 788 ret false 789 end 790 ret not isdg cb add p 2 791 end 792 793 note inside t = [i, e): is the leftmost range not M27-M35 794 fn m8t i ulong e ulong to bool 795 sv = get lx 0 796 put lx 0 e 797 r = false 798 j = i 799 while lt j e bound 999999 800 if ne rng j 0 801 r = not rok j 802 break 803 end 804 j = add j 1 805 end 806 put lx 0 sv 807 ret r 808 end 809 810 fn m8 to bool 811 pos = get lb 0 812 while lt pos get lx 0 bound 999999 813 i = pos 814 e = ulong 0 815 while lt i get lx 0 bound 999999 816 a = alt1 i 817 b = alt2 i 818 if gt b a 819 a = b 820 end 821 if gt a 0 822 e = a 823 break 824 end 825 i = add i 1 826 end 827 if eq e 0 828 ret false 829 end 830 if m8t i e 831 ret true 832 end 833 pos = e 834 end 835 ret false 836 end 837 838 note ---- roadmap rows (checks 3 and 4): fields split by | like awk -F'|' ---- 839 840 note field k of the line into [fs, fe); empty at the line end when the row has fewer fields 841 fn fld k ulong to void 842 p = get lb 0 843 c = ulong 1 844 while lt c k bound 999999 845 if ge p get lx 0 846 break 847 end 848 if eq cb p 124 849 c = add c 1 850 end 851 p = add p 1 852 end 853 if lt c k 854 put fs 0 get lx 0 855 put fe 0 get lx 0 856 ret 857 end 858 e = p 859 while lt e get lx 0 bound 999999 860 if eq cb e 124 861 break 862 end 863 e = add e 1 864 end 865 put fs 0 p 866 put fe 0 e 867 end 868 869 note gsub(/^ +| +$/, "") on the field 870 fn trim to void 871 s = get fs 0 872 e = get fe 0 873 while lt s e bound 999999 874 if ne get fbuf s 32 875 break 876 end 877 s = add s 1 878 end 879 while gt e s bound 999999 880 if ne get fbuf sub e 1 32 881 break 882 end 883 e = sub e 1 884 end 885 put fs 0 s 886 put fe 0 e 887 end 888 889 note the field equals table entry k 890 fn feq k ulong to bool 891 if ne sub get fe 0 get fs 0 get tlen k 892 ret false 893 end 894 ret lit get fs 0 k 895 end 896 897 note row regex ^\| \*\*M[0-9]+\*\* \| 898 fn isrow to bool 899 p = get lb 0 900 if not lit p 50 901 ret false 902 end 903 p = add p 5 904 if not isdg cb p 905 ret false 906 end 907 while isdg cb p bound 999999 908 p = add p 1 909 end 910 ret lit p 51 911 end 912 913 note the row's number as awk computes it (m + 0) 914 fn rowm to ulong 915 p = add get lb 0 5 916 m = ulong 0 917 while isdg cb p bound 999999 918 m = add mul m 10 sub cb p 48 919 p = add p 1 920 end 921 ret m 922 end 923 924 note status in the roadmap's closed list 925 fn stok to bool 926 if feq 49 927 ret true 928 end 929 k = ulong 54 930 while le k 60 bound 8 931 if feq k 932 ret true 933 end 934 k = add k 1 935 end 936 ret false 937 end 938 939 note ---- reports ---- 940 941 note FAIL [check] path:line:␣ and count the failure 942 fn hdr ci ulong to void 943 wt 63 944 wt add 66 ci 945 wt 64 946 r = write 1 fpath 0 get fplen 0 947 wt 106 948 wnum get nl 0 949 wt 65 950 put fails 0 add get fails 0 1 951 end 952 953 fn wline to void 954 r = write 1 fbuf get lb 0 sub get lx 0 get lb 0 955 end 956 957 note sed 's/^[[:space:]]*//' | cut -c1-160 958 fn wstrip to void 959 s = get lb 0 960 while issp cb s bound 999999 961 s = add s 1 962 end 963 n = sub get lx 0 s 964 if gt n 160 965 n = 160 966 end 967 r = write 1 fbuf s n 968 end 969 970 fn rep ci ulong to void 971 hdr ci 972 if eq ci 8 973 wline 974 else 975 wstrip 976 end 977 wnl 978 end 979 980 note roadmap-structure message " M" 981 fn rep3 m ulong k ulong to void 982 hdr 10 983 wt 107 984 wnum m 985 wt k 986 wnl 987 end 988 989 fn c3era m ulong to void 990 pzd = feq 61 991 if pzd 992 if or lt m 27 gt m 35 993 rep3 m 84 994 end 995 end 996 if and ge m 27 le m 35 997 if not pzd 998 rep3 m 85 999 end 1000 end 1001 if feq 62 1002 if or lt m 36 gt m 40 1003 rep3 m 86 1004 end 1005 end 1006 end 1007 1008 note awk's row counter n is unset until the first row passes: printed before that, it is the 1009 note empty string, not 0 (" expected row M, found M1"; "found " with no rows). Reproduced. 1010 fn wcnt n ulong to void 1011 if ne n 0 1012 wnum n 1013 end 1014 end 1015 1016 note one roadmap row; n = the row index expected 1017 fn c3row n ulong to void 1018 m = rowm 1019 if ne m n 1020 hdr 10 1021 wt 80 1022 wcnt n 1023 wt 81 1024 wnum m 1025 wnl 1026 end 1027 fld 6 1028 trim 1029 if not stok 1030 hdr 10 1031 wt 107 1032 wnum m 1033 wt 82 1034 r = write 1 fbuf get fs 0 sub get fe 0 get fs 0 1035 wt 83 1036 wnl 1037 end 1038 fld 3 1039 trim 1040 c3era m 1041 end 1042 1043 note ---- check 4: milestone-number-mismatch ---- 1044 note MAP: for each roadmap row, code = $4 without spaces and backticks -> number = $2 without " *M" 1045 note (a digit string; awk compares it to the cited digits as strings; the last row for a code wins) 1046 1047 note copy field bytes that are not ' ' and not x and not y into mcode at mused; return the length 1048 fn mcopy x ulong y ulong to ulong 1049 u = get mused 0 1050 n = ulong 0 1051 s = get fs 0 1052 while lt s get fe 0 bound 999999 1053 c = ulong get fbuf s 1054 if ne c 32 1055 if ne c x 1056 if ne c y 1057 put mcode add u n uchar c 1058 n = add n 1 1059 end 1060 end 1061 end 1062 s = add s 1 1063 end 1064 put mused 0 add u n 1065 ret n 1066 end 1067 1068 fn maprow to void 1069 k = get mcnt 0 1070 put moff k get mused 0 1071 fld 4 1072 put mlen k mcopy 96 96 1073 if eq get mlen k 0 1074 put mused 0 get moff k 1075 ret 1076 end 1077 put mnoff k get mused 0 1078 fld 2 1079 put mnlen k mcopy 42 77 1080 put mcnt 0 add k 1 1081 end 1082 1083 note the code [s, e) is in the map: mi = its last row 1084 fn look s ulong e ulong to bool 1085 k = get mcnt 0 1086 while gt k 0 bound 512 1087 k = sub k 1 1088 if eq get mlen k sub e s 1089 if same s get moff k get mlen k 1090 put mi 0 k 1091 ret true 1092 end 1093 end 1094 end 1095 ret false 1096 end 1097 1098 fn same s ulong o ulong n ulong to bool 1099 for j ulong n 1100 if ne get fbuf add s j get mcode add o j 1101 ret false 1102 end 1103 end 1104 ret true 1105 end 1106 1107 note the cited digits [d, e) equal the map number of row mi as strings 1108 fn numeq d ulong e ulong to bool 1109 k = get mi 0 1110 if ne get mnlen k sub e d 1111 ret false 1112 end 1113 ret same d get mnoff k get mnlen k 1114 end 1115 1116 fn rep4 cs ulong ce ulong ds ulong de ulong to void 1117 hdr 11 1118 r = write 1 fbuf cs sub ce cs 1119 wt 88 1120 r = write 1 fbuf ds sub de ds 1121 wt 89 1122 r = write 1 mcode get mnoff get mi 0 get mnlen get mi 0 1123 wt 90 1124 wline 1125 wnl 1126 end 1127 1128 note first loop: (Milestones?|MILESTONE|\