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
omega-mv / seed / build / release.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note seed/build/release.om: Pure seeded-Omega Build, Release, UXL & Automation Coordinator. |
| 3 | note Replaces Makefile/shell/Python delivery glue: |
| 4 | note om-release check-locks [ROOT] verify omc pin, *.lock 40-hex commits, and zero-disk-secrets |
| 5 | note om-release check-paths [ROOT] pure-Omega replacement for tools/uxl/windows_paths.py |
| 6 | note om-release layers [SCRATCH] compile and run all 8 SI pure-Omega layer units-gate.om suites |
| 7 | note om-release uxl [SCRATCH] pure-Omega UXL delivery verification (host, level1 65 files, SPIR-V, Xe) |
| 8 | note om-release package OUTDIR VERSION build & package pure-Omega toolchain + SHA256SUMS + manifests |
| 9 | note om-release verify OUTDIR fail-closed re-hash verification of RELEASE-MANIFEST.tsv & SHA256SUMS |
| 10 | note Zero shell, zero Python. |
| 11 | note Build: cat seed/build/common.om seed/build/release.om | seed/out/omc > build/om-release |
| 12 | |
| 13 | text rl_usage "usage: om-release check-locks [ROOT] | check-paths [ROOT] | layers [SCRATCH] | uxl [SCRATCH] | package OUTDIR VERSION | verify OUTDIR\n" |
| 14 | text rl_c_locks "check-locks" |
| 15 | text rl_c_paths "check-paths" |
| 16 | text rl_c_layers "layers" |
| 17 | text rl_c_uxl "uxl" |
| 18 | text rl_c_pkg "package" |
| 19 | text rl_c_ver "verify" |
| 20 | |
| 21 | text rl_omc "seed/out/omc" |
| 22 | text rl_omcsha "seed/out/omc.sha256" |
| 23 | text rl_s0hex "seed/rung0/seed0.hex" |
| 24 | text rl_l_phys "physics.lock" |
| 25 | text rl_l_aien "aienos.lock" |
| 26 | text rl_l_arg "argus.lock" |
| 27 | text rl_l_br "om/omega-bridge.lock" |
| 28 | text rl_defscr "build/om-release-work" |
| 29 | text rl_pass_lk1 "PASS check-locks: omc=" |
| 30 | text rl_pass_lk2 " locks=4 secrets=0\n" |
| 31 | text rl_fail_lk "FAIL check-locks: " |
| 32 | text rl_e_omc "omc digest mismatch or missing seed/out/omc.sha256\n" |
| 33 | text rl_e_lock "malformed lockfile: " |
| 34 | text rl_e_sec "plaintext .env secret file found: " |
| 35 | text rl_env_dot ".env" |
| 36 | text rl_env_ex ".env.example" |
| 37 | text rl_env_tp ".env.template" |
| 38 | text rl_d_git ".git" |
| 39 | text rl_d_bld "build" |
| 40 | text rl_d_ev "evidence" |
| 41 | |
| 42 | note Windows path check strings |
| 43 | text rl_wp_0 "windows-paths: 0 findings (" |
| 44 | text rl_wp_f "windows-paths: FINDING " |
| 45 | text rl_wp_end " paths)\n" |
| 46 | text rl_wp_cnt1 "windows-paths: " |
| 47 | text rl_wp_cnt2 " findings (" |
| 48 | text rl_r_trail "trailing-dot-or-space " |
| 49 | text rl_r_char "forbidden-character " |
| 50 | text rl_r_res "reserved-name " |
| 51 | text rl_r_case "case-collision " |
| 52 | text rl_res_con "con" |
| 53 | text rl_res_prn "prn" |
| 54 | text rl_res_aux "aux" |
| 55 | text rl_res_nul "nul" |
| 56 | |
| 57 | note Layer gate strings |
| 58 | text rl_ngsha "seed/ng/sha256.om" |
| 59 | text rl_om2l "om2\n" |
| 60 | text rl_ly_0 "gpu" |
| 61 | text rl_ly_1 "aienux" |
| 62 | text rl_ly_2 "apps" |
| 63 | text rl_ly_3 "bridge" |
| 64 | text rl_ly_4 "core" |
| 65 | text rl_ly_5 "protocol" |
| 66 | text rl_ly_6 "si" |
| 67 | text rl_ly_7 "train" |
| 68 | text rl_ly_suf "/units-gate.om" |
| 69 | text rl_ly_pass "PASS layer " |
| 70 | text rl_ly_fail "FAIL layer " |
| 71 | text rl_ly_sum1 "LAYERS pass=" |
| 72 | text rl_ly_sum2 " fail=" |
| 73 | |
| 74 | note UXL strings |
| 75 | text rl_l1_dir "tools/uxl/level1/" |
| 76 | text rl_l1_json "tools/uxl/level1/SHA256.json" |
| 77 | text rl_uxl_s1 "PASS uxl-stage1 host+pin+paths\n" |
| 78 | text rl_uxl_f1 "FAIL uxl-stage1 host+pin+paths\n" |
| 79 | text rl_uxl_s2 "PASS uxl-stage2 level1 files=" |
| 80 | text rl_uxl_f2 "FAIL uxl-stage2 level1 mismatch: " |
| 81 | text rl_uxl_s3 "PASS uxl-stage3 spirv-check\n" |
| 82 | text rl_uxl_f3 "FAIL uxl-stage3 spirv-check\n" |
| 83 | text rl_uxl_s4 "PASS uxl-stage4 rmsnorm cl+vk\n" |
| 84 | text rl_uxl_f4 "FAIL uxl-stage4 rmsnorm\n" |
| 85 | text rl_uxl_s5 "PASS uxl-stage5 opencl+vulkan kernels\n" |
| 86 | text rl_uxl_f5 "FAIL uxl-stage5 opencl+vulkan kernels\n" |
| 87 | text rl_uxl_s6 "PASS uxl-stage6 intel-xe\n" |
| 88 | text rl_uxl_f6 "FAIL uxl-stage6 intel-xe\n" |
| 89 | text rl_uxl_sum1 "UXL-OMEGA pass=" |
| 90 | text rl_uxl_sum2 " fail=" |
| 91 | text rl_gpuc_bin "/om-gpucoord" |
| 92 | text rl_gpuc_src "/om-gpucoord.om" |
| 93 | text rl_gpuc_out "/gpuc.out" |
| 94 | text rl_srun "spirv-run" |
| 95 | text rl_schk "spirv-check" |
| 96 | text rl_ixe "intel-gate" |
| 97 | text rl_k_rms "rmsnorm" |
| 98 | text rl_k_vadd "vadd" |
| 99 | text rl_k_fsum "fsum16" |
| 100 | text rl_k_gemm "gemm16" |
| 101 | text rl_e_cl "cl" |
| 102 | text rl_e_vk "vk" |
| 103 | text rl_sha_rms "144c89820d5d005af741dfcace8f9882bae481d72f1745aef36b5014cbaadb46" |
| 104 | text rl_sha_vadd "72d0c1b2928779e83518f0b4c7d101d933cf89f210cd4627e138c33c9ce9b6a6" |
| 105 | text rl_sha_fsum "6a6de93787e333d506d50996589af3e025c16b9bfc7c9493e1af34578e076290" |
| 106 | text rl_sha_gemm "d1e02b7d8dd06cd84ee45294b0525000cf7c61e6f6fa32bfa81d3719e47a6987" |
| 107 | |
| 108 | note Package & Verify strings |
| 109 | text rl_src_com "seed/build/common.om" |
| 110 | text rl_src_bir "seed/build/birth.om" |
| 111 | text rl_src_uni "seed/build/units.om" |
| 112 | text rl_src_tls "seed/build/tlsbuild.om" |
| 113 | text rl_src_efi "seed/build/sparkefi.om" |
| 114 | text rl_src_gpu "seed/build/gpucoord.om" |
| 115 | text rl_src_rel "seed/build/release.om" |
| 116 | text rl_d_bin "/bin" |
| 117 | text rl_d_seed "/seed" |
| 118 | text rl_r_omc "bin/omc" |
| 119 | text rl_r_bir "bin/om-birth" |
| 120 | text rl_r_uni "bin/om-units" |
| 121 | text rl_r_tls "bin/om-tlsbuild" |
| 122 | text rl_r_efi "bin/om-sparkefi" |
| 123 | text rl_r_gpu "bin/om-gpucoord" |
| 124 | text rl_r_rel "bin/om-release" |
| 125 | text rl_r_s0 "seed/seed0.hex" |
| 126 | text rl_r_sha "seed/omc.sha256" |
| 127 | text rl_f_sums "/SHA256SUMS" |
| 128 | text rl_f_man "/RELEASE-MANIFEST.tsv" |
| 129 | text rl_f_json "/release-manifest.json" |
| 130 | text rl_man_hdr "path\tbytes\tsha256\n" |
| 131 | text rl_sp2 " " |
| 132 | text rl_tab "\t" |
| 133 | text rl_j_1 "{\n \"schema\": \"omega-release-v1\",\n \"version\": \"" |
| 134 | text rl_j_2 "\",\n \"omc_sha256\": \"" |
| 135 | text rl_j_3 "\",\n \"artifacts\": [\n" |
| 136 | text rl_j_a1 " {\"path\": \"" |
| 137 | text rl_j_a2 "\", \"bytes\": " |
| 138 | text rl_j_a3 ", \"sha256\": \"" |
| 139 | text rl_j_a4 "\"}" |
| 140 | text rl_j_cm ",\n" |
| 141 | text rl_j_end "\n ]\n}\n" |
| 142 | text rl_pkg_ok1 "RELEASE PACKAGE PASS version=" |
| 143 | text rl_pkg_ok2 " artifacts=9 out=" |
| 144 | text rl_pkg_bad "RELEASE PACKAGE FAIL\n" |
| 145 | text rl_ver_ok "RELEASE VERIFY PASS artifacts=" |
| 146 | text rl_ver_bad "RELEASE VERIFY FAIL: " |
| 147 | text rl_ver_e1 "missing or unreadable RELEASE-MANIFEST.tsv\n" |
| 148 | text rl_ver_e2 "bad header or malformed row\n" |
| 149 | text rl_ver_e3 "unsafe or duplicate path\n" |
| 150 | text rl_ver_e4 "size or sha256 mismatch: " |
| 151 | text rl_ver_e5 "empty manifest\n" |
| 152 | text rl_ver_e6 "SHA256SUMS mismatch\n" |
| 153 | |
| 154 | global rl_root uchar 4096 |
| 155 | global rl_rootl ulong 1 |
| 156 | global rl_scr uchar 4096 |
| 157 | global rl_scrl ulong 1 |
| 158 | global rl_out uchar 4096 |
| 159 | global rl_outl ulong 1 |
| 160 | global rl_ver uchar 256 |
| 161 | global rl_verl ulong 1 |
| 162 | global rl_omchex uchar 64 |
| 163 | global rl_findings ulong 1 |
| 164 | global rl_paths ulong 1 |
| 165 | global rl_secrets ulong 1 |
| 166 | global rl_dstack uchar * |
| 167 | global rl_dso ulong 1 |
| 168 | global rl_sibs uchar * |
| 169 | global rl_sibn ulong 1 |
| 170 | global rl_sibc ulong 1 |
| 171 | global rl_siboff ulong 4096 |
| 172 | global rl_siblen ulong 4096 |
| 173 | global rl_l1buf uchar * |
| 174 | global rl_l1n ulong 1 |
| 175 | global rl_man uchar * |
| 176 | global rl_mann ulong 1 |
| 177 | global rl_sums uchar * |
| 178 | global rl_sumsn ulong 1 |
| 179 | global rl_json uchar * |
| 180 | global rl_jsonn ulong 1 |
| 181 | global rl_seen uchar * |
| 182 | global rl_seenn ulong 1 |
| 183 | global rl_pkg_idx ulong 1 |
| 184 | |
| 185 | fn rl_pa_root rel view uchar * to void |
| 186 | cb_pa_clr |
| 187 | rl = get rl_rootl 0 |
| 188 | if gt rl 0 |
| 189 | for i ulong rl bound 4096 |
| 190 | cb_pa_ch get rl_root i |
| 191 | end |
| 192 | cb_pa_ch 47 |
| 193 | end |
| 194 | cb_pa_tx rel |
| 195 | end |
| 196 | |
| 197 | fn rl_check_hex_line allow_comments bool to bool |
| 198 | n = get cb_n 0 |
| 199 | i = ulong 0 |
| 200 | found = ulong 0 |
| 201 | while lt i n bound 9223372036854775807 |
| 202 | e = i |
| 203 | while lt e n bound 9223372036854775807 |
| 204 | if eq get cb_rb e 10 |
| 205 | break |
| 206 | end |
| 207 | e = add e 1 |
| 208 | end |
| 209 | ll = sub e i |
| 210 | if allow_comments |
| 211 | if or eq ll 0 eq get cb_rb i 35 |
| 212 | i = add e 1 |
| 213 | continue |
| 214 | end |
| 215 | end |
| 216 | if ne ll 40 |
| 217 | ret false |
| 218 | end |
| 219 | for j ulong 40 |
| 220 | if not cb_is_hex get cb_rb add i j |
| 221 | ret false |
| 222 | end |
| 223 | end |
| 224 | found = add found 1 |
| 225 | if gt found 1 |
| 226 | ret false |
| 227 | end |
| 228 | i = add e 1 |
| 229 | end |
| 230 | ret eq found 1 |
| 231 | end |
| 232 | |
| 233 | fn rl_check_one_lock rel view uchar * allow_c bool to bool |
| 234 | rl_pa_root rel |
| 235 | if not cb_read_pa |
| 236 | cb_err rl_fail_lk |
| 237 | cb_err rl_e_lock |
| 238 | cb_err rel |
| 239 | cb_err cb_nl |
| 240 | ret false |
| 241 | end |
| 242 | if not rl_check_hex_line allow_c |
| 243 | cb_err rl_fail_lk |
| 244 | cb_err rl_e_lock |
| 245 | cb_err rel |
| 246 | cb_err cb_nl |
| 247 | ret false |
| 248 | end |
| 249 | ret true |
| 250 | end |
| 251 | |
| 252 | fn rl_is_lower_eq buf_off ulong blen ulong t view uchar * to bool |
| 253 | if ne blen len t |
| 254 | ret false |
| 255 | end |
| 256 | for j ulong blen bound 256 |
| 257 | c = get cb_dent add buf_off j |
| 258 | if and ge c 65 le c 90 |
| 259 | c = add c 32 |
| 260 | end |
| 261 | if ne c get t j |
| 262 | ret false |
| 263 | end |
| 264 | end |
| 265 | ret true |
| 266 | end |
| 267 | |
| 268 | fn rl_name_is_secret off ulong nlen ulong to bool |
| 269 | if lt nlen 4 |
| 270 | ret false |
| 271 | end |
| 272 | if ne get cb_dent off 46 |
| 273 | ret false |
| 274 | end |
| 275 | if ne get cb_dent add off 1 101 |
| 276 | ret false |
| 277 | end |
| 278 | if ne get cb_dent add off 2 110 |
| 279 | ret false |
| 280 | end |
| 281 | if ne get cb_dent add off 3 118 |
| 282 | ret false |
| 283 | end |
| 284 | if eq nlen 4 |
| 285 | ret true |
| 286 | end |
| 287 | if ne get cb_dent add off 4 46 |
| 288 | ret false |
| 289 | end |
| 290 | if rl_is_lower_eq off nlen rl_env_ex |
| 291 | ret false |
| 292 | end |
| 293 | if rl_is_lower_eq off nlen rl_env_tp |
| 294 | ret false |
| 295 | end |
| 296 | ret true |
| 297 | end |
| 298 | |
| 299 | fn rl_dent_nlen ns ulong lim ulong to ulong |
| 300 | nl = ulong 0 |
| 301 | while lt add ns nl lim bound 256 |
| 302 | if eq get cb_dent add ns nl 0 |
| 303 | break |
| 304 | end |
| 305 | nl = add nl 1 |
| 306 | end |
| 307 | ret nl |
| 308 | end |
| 309 | |
| 310 | fn rl_dstack_push ns ulong nl ulong to void |
| 311 | so = get rl_dso 0 |
| 312 | need = add add so nl 2 |
| 313 | if gt need len rl_dstack |
| 314 | cap = len rl_dstack |
| 315 | if eq cap 0 |
| 316 | cap = 65536 |
| 317 | end |
| 318 | while lt cap need bound 64 |
| 319 | cap = mul cap 2 |
| 320 | end |
| 321 | z0 = enlarge rl_dstack cap |
| 322 | end |
| 323 | put rl_dstack so uchar and nl 255 |
| 324 | put rl_dstack add so 1 uchar shr nl 8 |
| 325 | for j ulong nl bound 256 |
| 326 | put rl_dstack add add so 2 j get cb_dent add ns j |
| 327 | end |
| 328 | put rl_dso 0 need |
| 329 | end |
| 330 | |
| 331 | fn rl_pa_append_dstack cur ulong nl ulong base_len ulong to void |
| 332 | put cb_n 3 base_len |
| 333 | if gt base_len 0 |
| 334 | cb_pa_ch 47 |
| 335 | end |
| 336 | for j ulong nl bound 256 |
| 337 | cb_pa_ch get rl_dstack add add cur 2 j |
| 338 | end |
| 339 | end |
| 340 | |
| 341 | fn rl_sec_ent dt uchar ns ulong nl ulong depth ulong to void |
| 342 | if and eq nl 1 eq get cb_dent ns 46 |
| 343 | ret |
| 344 | end |
| 345 | if and eq nl 2 and eq get cb_dent ns 46 eq get cb_dent add ns 1 46 |
| 346 | ret |
| 347 | end |
| 348 | if and eq dt 4 rl_is_lower_eq ns nl rl_d_git |
| 349 | ret |
| 350 | end |
| 351 | if and eq dt 4 and eq depth 0 or rl_is_lower_eq ns nl rl_d_bld rl_is_lower_eq ns nl rl_d_ev |
| 352 | ret |
| 353 | end |
| 354 | if and ne dt 4 rl_name_is_secret ns nl |
| 355 | cb_err rl_fail_lk |
| 356 | cb_err rl_e_sec |
| 357 | cb_wbuf_pa 2 |
| 358 | cb_err cb_slash |
| 359 | r = write 2 cb_dent ns nl |
| 360 | cb_err cb_nl |
| 361 | put rl_secrets 0 add get rl_secrets 0 1 |
| 362 | end |
| 363 | if eq dt 4 |
| 364 | rl_dstack_push ns nl |
| 365 | end |
| 366 | end |
| 367 | |
| 368 | fn rl_scan_sec_buf nr ulong depth ulong to void |
| 369 | pos = ulong 0 |
| 370 | while lt pos nr bound 32768 |
| 371 | rlen = or ulong get cb_dent add pos 16 shl ulong get cb_dent add pos 17 8 |
| 372 | if eq rlen 0 |
| 373 | break |
| 374 | end |
| 375 | dt = get cb_dent add pos 18 |
| 376 | ns = add pos 19 |
| 377 | nl = rl_dent_nlen ns add pos rlen |
| 378 | rl_sec_ent dt ns nl depth |
| 379 | pos = add pos rlen |
| 380 | end |
| 381 | end |
| 382 | |
| 383 | fn rl_dstack_u16 cur ulong to ulong |
| 384 | b0 = ulong get rl_dstack cur |
| 385 | b1 = ulong get rl_dstack add cur 1 |
| 386 | ret or b0 shl b1 8 |
| 387 | end |
| 388 | |
| 389 | fn rl_read_sec_dir depth ulong to bool |
| 390 | dfd = fopen cb_pa 0 get cb_n 3 540672 0 |
| 391 | if lt dfd 0 |
| 392 | ret false |
| 393 | end |
| 394 | while true bound 65536 |
| 395 | nr = getdnts int dfd cb_dent 0 32768 |
| 396 | if le nr 0 |
| 397 | break |
| 398 | end |
| 399 | rl_scan_sec_buf ulong nr depth |
| 400 | end |
| 401 | z1 = fclose int dfd |
| 402 | ret true |
| 403 | end |
| 404 | |
| 405 | note Recursive scan for .env secrets (depth bounded by stack, skips .git / build / evidence) |
| 406 | fn rl_scan_secrets_dir depth ulong to void |
| 407 | if gt depth 32 |
| 408 | ret |
| 409 | end |
| 410 | base_len = get cb_n 3 |
| 411 | start_so = get rl_dso 0 |
| 412 | if not rl_read_sec_dir depth |
| 413 | ret |
| 414 | end |
| 415 | end_so = get rl_dso 0 |
| 416 | cur = start_so |
| 417 | while lt cur end_so bound 1048576 |
| 418 | nl = rl_dstack_u16 cur |
| 419 | rl_pa_append_dstack cur nl base_len |
| 420 | rl_scan_secrets_dir add depth 1 |
| 421 | cur = add add cur 2 nl |
| 422 | end |
| 423 | put cb_n 3 base_len |
| 424 | put rl_dso 0 start_so |
| 425 | end |
| 426 | |
| 427 | fn rl_check_omc_pin to bool |
| 428 | rl_pa_root rl_omcsha |
| 429 | if not cb_read_pa |
| 430 | ret false |
| 431 | end |
| 432 | if lt get cb_n 0 64 |
| 433 | ret false |
| 434 | end |
| 435 | for j ulong 64 |
| 436 | c = get cb_rb j |
| 437 | if not cb_is_hex c |
| 438 | ret false |
| 439 | end |
| 440 | put rl_omchex j c |
| 441 | end |
| 442 | rl_pa_root rl_omc |
| 443 | if not cb_sha_file_pa |
| 444 | ret false |
| 445 | end |
| 446 | for j ulong 64 |
| 447 | if ne get cb_shex j get rl_omchex j |
| 448 | ret false |
| 449 | end |
| 450 | end |
| 451 | ret true |
| 452 | end |
| 453 | |
| 454 | fn rl_cmd_check_locks to int |
| 455 | if not rl_check_omc_pin |
| 456 | cb_err rl_fail_lk |
| 457 | cb_err rl_e_omc |
| 458 | ret 1 |
| 459 | end |
| 460 | if not rl_check_one_lock rl_l_phys false |
| 461 | ret 1 |
| 462 | end |
| 463 | if not rl_check_one_lock rl_l_aien false |
| 464 | ret 1 |
| 465 | end |
| 466 | if not rl_check_one_lock rl_l_arg false |
| 467 | ret 1 |
| 468 | end |
| 469 | if not rl_check_one_lock rl_l_br true |
| 470 | ret 1 |
| 471 | end |
| 472 | put rl_secrets 0 0 |
| 473 | put rl_dso 0 0 |
| 474 | cb_pa_clr |
| 475 | if gt get rl_rootl 0 0 |
| 476 | for i ulong get rl_rootl 0 bound 4096 |
| 477 | cb_pa_ch get rl_root i |
| 478 | end |
| 479 | else |
| 480 | cb_pa_ch 46 |
| 481 | end |
| 482 | rl_scan_secrets_dir 0 |
| 483 | if ne get rl_secrets 0 0 |
| 484 | ret 1 |
| 485 | end |
| 486 | cb_out rl_pass_lk1 |
| 487 | r = write 1 rl_omchex 0 64 |
| 488 | cb_out rl_pass_lk2 |
| 489 | ret 0 |
| 490 | end |
| 491 | |
| 492 | note ---- Pure-Omega replacement for tools/uxl/windows_paths.py ---- |
| 493 | fn rl_is_win_reserved off ulong nlen ulong to bool |
| 494 | note stem = before first '.' |
| 495 | sl = nlen |
| 496 | for j ulong nlen bound 256 |
| 497 | if eq get cb_dent add off j 46 |
| 498 | sl = j |
| 499 | break |
| 500 | end |
| 501 | end |
| 502 | if eq sl 3 |
| 503 | if or rl_is_lower_eq off 3 rl_res_con or rl_is_lower_eq off 3 rl_res_prn or rl_is_lower_eq off 3 rl_res_aux rl_is_lower_eq off 3 rl_res_nul |
| 504 | ret true |
| 505 | end |
| 506 | end |
| 507 | if eq sl 4 |
| 508 | c0 = get cb_dent off |
| 509 | c1 = get cb_dent add off 1 |
| 510 | c2 = get cb_dent add off 2 |
| 511 | c3 = get cb_dent add off 3 |
| 512 | if and ge c0 65 le c0 90 |
| 513 | c0 = add c0 32 |
| 514 | end |
| 515 | if and ge c1 65 le c1 90 |
| 516 | c1 = add c1 32 |
| 517 | end |
| 518 | if and ge c2 65 le c2 90 |
| 519 | c2 = add c2 32 |
| 520 | end |
| 521 | if and ge c3 49 le c3 57 |
| 522 | if and eq c0 99 and eq c1 111 eq c2 109 |
| 523 | ret true |
| 524 | end |
| 525 | if and eq c0 108 and eq c1 112 eq c2 116 |
| 526 | ret true |
| 527 | end |
| 528 | end |
| 529 | end |
| 530 | ret false |
| 531 | end |
| 532 | |
| 533 | fn rl_is_win_badc c uchar to bool |
| 534 | if lt c 32 |
| 535 | ret true |
| 536 | end |
| 537 | if or eq c 60 eq c 62 |
| 538 | ret true |
| 539 | end |
| 540 | if or eq c 58 eq c 34 |
| 541 | ret true |
| 542 | end |
| 543 | if or eq c 124 eq c 63 |
| 544 | ret true |
| 545 | end |
| 546 | ret eq c 42 |
| 547 | end |
| 548 | |
| 549 | fn rl_has_win_badc off ulong nlen ulong to bool |
| 550 | for j ulong nlen bound 256 |
| 551 | if rl_is_win_badc get cb_dent add off j |
| 552 | ret true |
| 553 | end |
| 554 | end |
| 555 | ret false |
| 556 | end |
| 557 | |
| 558 | fn rl_check_win_name off ulong nlen ulong to void |
| 559 | note check trailing dot or space |
| 560 | last = get cb_dent add off sub nlen 1 |
| 561 | if or eq last 32 eq last 46 |
| 562 | cb_out rl_wp_f |
| 563 | cb_out rl_r_trail |
| 564 | cb_wbuf_pa 1 |
| 565 | cb_out cb_slash |
| 566 | r = write 1 cb_dent off nlen |
| 567 | cb_out cb_nl |
| 568 | put rl_findings 0 add get rl_findings 0 1 |
| 569 | end |
| 570 | if rl_has_win_badc off nlen |
| 571 | cb_out rl_wp_f |
| 572 | cb_out rl_r_char |
| 573 | cb_wbuf_pa 1 |
| 574 | cb_out cb_slash |
| 575 | r = write 1 cb_dent off nlen |
| 576 | cb_out cb_nl |
| 577 | put rl_findings 0 add get rl_findings 0 1 |
| 578 | end |
| 579 | if rl_is_win_reserved off nlen |
| 580 | cb_out rl_wp_f |
| 581 | cb_out rl_r_res |
| 582 | cb_wbuf_pa 1 |
| 583 | cb_out cb_slash |
| 584 | r = write 1 cb_dent off nlen |
| 585 | cb_out cb_nl |
| 586 | put rl_findings 0 add get rl_findings 0 1 |
| 587 | end |
| 588 | end |
| 589 | |
| 590 | fn rl_sib_eq_ci a ulong b ulong to bool |
| 591 | la = get rl_siblen a |
| 592 | lb = get rl_siblen b |
| 593 | if ne la lb |
| 594 | ret false |
| 595 | end |
| 596 | oa = get rl_siboff a |
| 597 | ob = get rl_siboff b |
| 598 | for j ulong la bound 256 |
| 599 | ca = get rl_sibs add oa j |
| 600 | cb = get rl_sibs add ob j |
| 601 | if and ge ca 65 le ca 90 |
| 602 | ca = add ca 32 |
| 603 | end |
| 604 | if and ge cb 65 le cb 90 |
| 605 | cb = add cb 32 |
| 606 | end |
| 607 | if ne ca cb |
| 608 | ret false |
| 609 | end |
| 610 | end |
| 611 | ret true |
| 612 | end |
| 613 | |
| 614 | fn rl_sib_push ns ulong nl ulong to void |
| 615 | sc = get rl_sibc 0 |
| 616 | if ge sc 4096 |
| 617 | ret |
| 618 | end |
| 619 | sn = get rl_sibn 0 |
| 620 | if gt add sn nl len rl_sibs |
| 621 | cap = len rl_sibs |
| 622 | if eq cap 0 |
| 623 | cap = 65536 |
| 624 | end |
| 625 | while lt cap add sn nl bound 64 |
| 626 | cap = mul cap 2 |
| 627 | end |
| 628 | z0 = enlarge rl_sibs cap |
| 629 | end |
| 630 | put rl_siboff sc sn |
| 631 | put rl_siblen sc nl |
| 632 | for j ulong nl bound 256 |
| 633 | put rl_sibs add sn j get cb_dent add ns j |
| 634 | end |
| 635 | put rl_sibn 0 add sn nl |
| 636 | put rl_sibc 0 add sc 1 |
| 637 | end |
| 638 | |
| 639 | fn rl_path_ent dt uchar ns ulong nl ulong depth ulong to void |
| 640 | if and eq nl 1 eq get cb_dent ns 46 |
| 641 | ret |
| 642 | end |
| 643 | if and eq nl 2 and eq get cb_dent ns 46 eq get cb_dent add ns 1 46 |
| 644 | ret |
| 645 | end |
| 646 | if and eq dt 4 rl_is_lower_eq ns nl rl_d_git |
| 647 | ret |
| 648 | end |
| 649 | if and eq dt 4 and eq depth 0 rl_is_lower_eq ns nl rl_d_bld |
| 650 | ret |
| 651 | end |
| 652 | put rl_paths 0 add get rl_paths 0 1 |
| 653 | rl_check_win_name ns nl |
| 654 | rl_sib_push ns nl |
| 655 | if eq dt 4 |
| 656 | rl_dstack_push ns nl |
| 657 | end |
| 658 | end |
| 659 | |
| 660 | fn rl_check_sibs to void |
| 661 | sc = get rl_sibc 0 |
| 662 | for a ulong sc bound 4096 |
| 663 | for b ulong a bound 4096 |
| 664 | if rl_sib_eq_ci a b |
| 665 | cb_out rl_wp_f |
| 666 | cb_out rl_r_case |
| 667 | cb_wbuf_pa 1 |
| 668 | cb_out cb_slash |
| 669 | r1 = write 1 rl_sibs get rl_siboff a get rl_siblen a |
| 670 | cb_out cb_nl |
| 671 | put rl_findings 0 add get rl_findings 0 1 |
| 672 | end |
| 673 | end |
| 674 | end |
| 675 | end |
| 676 | |
| 677 | fn rl_scan_path_buf nr ulong depth ulong to void |
| 678 | pos = ulong 0 |
| 679 | while lt pos nr bound 32768 |
| 680 | rlen = or ulong get cb_dent add pos 16 shl ulong get cb_dent add pos 17 8 |
| 681 | if eq rlen 0 |
| 682 | break |
| 683 | end |
| 684 | dt = get cb_dent add pos 18 |
| 685 | ns = add pos 19 |
| 686 | nl = rl_dent_nlen ns add pos rlen |
| 687 | rl_path_ent dt ns nl depth |
| 688 | pos = add pos rlen |
| 689 | end |
| 690 | end |
| 691 | |
| 692 | fn rl_read_path_dir depth ulong to bool |
| 693 | dfd = fopen cb_pa 0 get cb_n 3 540672 0 |
| 694 | if lt dfd 0 |
| 695 | ret false |
| 696 | end |
| 697 | put rl_sibn 0 0 |
| 698 | put rl_sibc 0 0 |
| 699 | while true bound 65536 |
| 700 | nr = getdnts int dfd cb_dent 0 32768 |
| 701 | if le nr 0 |
| 702 | break |
| 703 | end |
| 704 | rl_scan_path_buf ulong nr depth |
| 705 | end |
| 706 | z2 = fclose int dfd |
| 707 | rl_check_sibs |
| 708 | ret true |
| 709 | end |
| 710 | |
| 711 | fn rl_scan_paths_dir depth ulong to void |
| 712 | if gt depth 32 |
| 713 | ret |
| 714 | end |
| 715 | base_len = get cb_n 3 |
| 716 | start_so = get rl_dso 0 |
| 717 | if not rl_read_path_dir depth |
| 718 | ret |
| 719 | end |
| 720 | end_so = get rl_dso 0 |
| 721 | cur = start_so |
| 722 | while lt cur end_so bound 1048576 |
| 723 | nl = rl_dstack_u16 cur |
| 724 | rl_pa_append_dstack cur nl base_len |
| 725 | rl_scan_paths_dir add depth 1 |
| 726 | cur = add add cur 2 nl |
| 727 | end |
| 728 | put cb_n 3 base_len |
| 729 | put rl_dso 0 start_so |
| 730 | end |
| 731 | |
| 732 | fn rl_cmd_check_paths to int |
| 733 | put rl_findings 0 0 |
| 734 | put rl_paths 0 0 |
| 735 | put rl_dso 0 0 |
| 736 | cb_pa_clr |
| 737 | if gt get rl_rootl 0 0 |
| 738 | for i ulong get rl_rootl 0 bound 4096 |
| 739 | cb_pa_ch get rl_root i |
| 740 | end |
| 741 | else |
| 742 | cb_pa_ch 46 |
| 743 | end |
| 744 | rl_scan_paths_dir 0 |
| 745 | f = get rl_findings 0 |
| 746 | if eq f 0 |
| 747 | cb_out rl_wp_0 |
| 748 | cb_wnum 1 get rl_paths 0 |
| 749 | cb_out rl_wp_end |
| 750 | ret 0 |
| 751 | end |
| 752 | cb_out rl_wp_cnt1 |
| 753 | cb_wnum 1 f |
| 754 | cb_out rl_wp_cnt2 |
| 755 | cb_wnum 1 get rl_paths 0 |
| 756 | cb_out rl_wp_end |
| 757 | ret 1 |
| 758 | end |
| 759 | |
| 760 | note ---- Layers gate orchestrator ---- |
| 761 | fn rl_run_layer name view uchar * to bool |
| 762 | cb_wb_clr |
| 763 | cb_wb_tx rl_om2l |
| 764 | cb_pa_set rl_ngsha |
| 765 | if not cb_append_pa_to_wb |
| 766 | ret false |
| 767 | end |
| 768 | cb_pa_set name |
| 769 | cb_pa_tx rl_ly_suf |
| 770 | if not cb_append_pa_to_wb |
| 771 | ret false |
| 772 | end |
| 773 | note write gate source in SCRATCH/name.gate.om |
| 774 | cb_pa_clr |
| 775 | for i ulong get rl_scrl 0 bound 4096 |
| 776 | cb_pa_ch get rl_scr i |
| 777 | end |
| 778 | cb_pa_ch 47 |
| 779 | cb_pa_tx name |
| 780 | cb_pa_tx rl_src_com |
| 781 | note actually just use /<name>.om |
| 782 | cb_pa_clr |
| 783 | for i ulong get rl_scrl 0 bound 4096 |
| 784 | cb_pa_ch get rl_scr i |
| 785 | end |
| 786 | cb_pa_ch 47 |
| 787 | cb_pa_tx name |
| 788 | cb_pa_ch 46 |
| 789 | cb_pa_ch 111 |
| 790 | cb_pa_ch 109 |
| 791 | if not cb_write_wb_pa 420 |
| 792 | ret false |
| 793 | end |
| 794 | note compile gate -> SCRATCH/name.gate |
| 795 | for i ulong len rl_omc bound 4096 |
| 796 | put cb_pc i get rl_omc i |
| 797 | end |
| 798 | cb_pb_clr |
| 799 | for i ulong get rl_scrl 0 bound 4096 |
| 800 | cb_pb_ch get rl_scr i |
| 801 | end |
| 802 | cb_pb_ch 47 |
| 803 | cb_pb_tx name |
| 804 | cb_pb_ch 46 |
| 805 | cb_pb_ch 98 |
| 806 | if ne cb_run_omc len rl_omc 493 -1 0 |
| 807 | cb_out rl_ly_fail |
| 808 | cb_out name |
| 809 | cb_out cb_nl |
| 810 | ret false |
| 811 | end |
| 812 | note run gate: SCRATCH/name.b seed/out/omc SCRATCH/name-w |
| 813 | cb_av_clr |
| 814 | cb_av_push_pb |
| 815 | cb_av_push_tx rl_omc |
| 816 | cb_pa_clr |
| 817 | for i ulong get rl_scrl 0 bound 4096 |
| 818 | cb_pa_ch get rl_scr i |
| 819 | end |
| 820 | cb_pa_ch 47 |
| 821 | cb_pa_tx name |
| 822 | cb_pa_ch 45 |
| 823 | cb_pa_ch 119 |
| 824 | cb_av_push_pa |
| 825 | fo = fopen cb_devnull 0 len cb_devnull 524289 0 |
| 826 | rc = cb_spawn_fds -1 int fo -1 false |
| 827 | if ne rc 0 |
| 828 | cb_out rl_ly_fail |
| 829 | cb_out name |
| 830 | cb_out cb_nl |
| 831 | ret false |
| 832 | end |
| 833 | cb_out rl_ly_pass |
| 834 | cb_out name |
| 835 | cb_out cb_nl |
| 836 | ret true |
| 837 | end |
| 838 | |
| 839 | fn rl_cmd_layers to int |
| 840 | cb_pa_clr |
| 841 | for i ulong get rl_scrl 0 bound 4096 |
| 842 | cb_pa_ch get rl_scr i |
| 843 | end |
| 844 | if not cb_mkdir_p_pa |
| 845 | ret 1 |
| 846 | end |
| 847 | pass = ulong 0 |
| 848 | fail = ulong 0 |
| 849 | if rl_run_layer rl_ly_0 |
| 850 | pass = add pass 1 |
| 851 | else |
| 852 | fail = add fail 1 |
| 853 | end |
| 854 | if rl_run_layer rl_ly_1 |
| 855 | pass = add pass 1 |
| 856 | else |
| 857 | fail = add fail 1 |
| 858 | end |
| 859 | if rl_run_layer rl_ly_2 |
| 860 | pass = add pass 1 |
| 861 | else |
| 862 | fail = add fail 1 |
| 863 | end |
| 864 | if rl_run_layer rl_ly_3 |
| 865 | pass = add pass 1 |
| 866 | else |
| 867 | fail = add fail 1 |
| 868 | end |
| 869 | if rl_run_layer rl_ly_4 |
| 870 | pass = add pass 1 |
| 871 | else |
| 872 | fail = add fail 1 |
| 873 | end |
| 874 | if rl_run_layer rl_ly_5 |
| 875 | pass = add pass 1 |
| 876 | else |
| 877 | fail = add fail 1 |
| 878 | end |
| 879 | if rl_run_layer rl_ly_6 |
| 880 | pass = add pass 1 |
| 881 | else |
| 882 | fail = add fail 1 |
| 883 | end |
| 884 | if rl_run_layer rl_ly_7 |
| 885 | pass = add pass 1 |
| 886 | else |
| 887 | fail = add fail 1 |
| 888 | end |
| 889 | cb_out rl_ly_sum1 |
| 890 | cb_wnum 1 pass |
| 891 | cb_out rl_ly_sum2 |
| 892 | cb_wnum 1 fail |
| 893 | cb_out cb_nl |
| 894 | if ne fail 0 |
| 895 | ret 1 |
| 896 | end |
| 897 | ret 0 |
| 898 | end |
| 899 | |
| 900 | note ---- Pure-Omega UXL verifier ---- |
| 901 | fn rl_uxl_level1 to bool |
| 902 | cb_pa_set rl_l1_json |
| 903 | if not cb_read_pa |
| 904 | ret false |
| 905 | end |
| 906 | n = get cb_n 0 |
| 907 | ze1 = enlarge rl_l1buf n |
| 908 | if ne ze1 0 |
| 909 | ret false |
| 910 | end |
| 911 | for i ulong n bound 9223372036854775807 |
| 912 | put rl_l1buf i get cb_rb i |
| 913 | end |
| 914 | put rl_l1n 0 n |
| 915 | cnt = ulong 0 |
| 916 | i = ulong 0 |
| 917 | while lt i n bound 9223372036854775807 |
| 918 | note find opening quote of key |
| 919 | while lt i n bound 9223372036854775807 |
| 920 | if eq get rl_l1buf i 34 |
| 921 | break |
| 922 | end |
| 923 | i = add i 1 |
| 924 | end |
| 925 | if ge i n |
| 926 | break |
| 927 | end |
| 928 | ks = add i 1 |
| 929 | ke = ks |
| 930 | while lt ke n bound 4096 |
| 931 | if eq get rl_l1buf ke 34 |
| 932 | break |
| 933 | end |
| 934 | ke = add ke 1 |
| 935 | end |
| 936 | if ge ke n |
| 937 | ret false |
| 938 | end |
| 939 | note find opening quote of value |
| 940 | i = add ke 1 |
| 941 | while lt i n bound 4096 |
| 942 | if eq get rl_l1buf i 34 |
| 943 | break |
| 944 | end |
| 945 | i = add i 1 |
| 946 | end |
| 947 | if ge i n |
| 948 | ret false |
| 949 | end |
| 950 | vs = add i 1 |
| 951 | ve = vs |
| 952 | while lt ve n bound 256 |
| 953 | if eq get rl_l1buf ve 34 |
| 954 | break |
| 955 | end |
| 956 | ve = add ve 1 |
| 957 | end |
| 958 | if ne sub ve vs 64 |
| 959 | ret false |
| 960 | end |
| 961 | cb_pa_set rl_l1_dir |
| 962 | for j ulong sub ke ks bound 4096 |
| 963 | cb_pa_ch get rl_l1buf add ks j |
| 964 | end |
| 965 | if not cb_sha_file_pa |
| 966 | cb_out rl_uxl_f2 |
| 967 | cb_wbuf_pa 1 |
| 968 | cb_out cb_nl |
| 969 | ret false |
| 970 | end |
| 971 | for j ulong 64 |
| 972 | if ne get cb_shex j get rl_l1buf add vs j |
| 973 | cb_out rl_uxl_f2 |
| 974 | cb_wbuf_pa 1 |
| 975 | cb_out cb_nl |
| 976 | ret false |
| 977 | end |
| 978 | end |
| 979 | cnt = add cnt 1 |
| 980 | i = add ve 1 |
| 981 | end |
| 982 | if lt cnt 60 |
| 983 | ret false |
| 984 | end |
| 985 | cb_out rl_uxl_s2 |
| 986 | cb_wnum 1 cnt |
| 987 | cb_out cb_nl |
| 988 | ret true |
| 989 | end |
| 990 | |
| 991 | fn rl_uxl_spv_row k view uchar * e view uchar * want_sha view uchar * to bool |
| 992 | cb_av_clr |
| 993 | cb_pa_clr |
| 994 | for i ulong get rl_scrl 0 bound 4096 |
| 995 | cb_pa_ch get rl_scr i |
| 996 | end |
| 997 | cb_pa_tx rl_gpuc_bin |
| 998 | cb_av_push_pa |
| 999 | cb_av_push_tx rl_srun |
| 1000 | cb_av_push_tx k |
| 1001 | cb_av_push_tx e |
| 1002 | cb_pa_clr |
| 1003 | for i ulong get rl_scrl 0 bound 4096 |
| 1004 | cb_pa_ch get rl_scr i |
| 1005 | end |
| 1006 | cb_pa_tx rl_gpuc_out |
| 1007 | z0 = unlink cb_pa 0 get cb_n 3 |
| 1008 | fo = fopen cb_pa 0 get cb_n 3 524865 420 |
| 1009 | if lt fo 0 |
| 1010 | ret false |
| 1011 | end |
| 1012 | if ne cb_spawn_fds -1 int fo -1 false 0 |
| 1013 | ret false |
| 1014 | end |
| 1015 | if not cb_file_contains_pa want_sha |
| 1016 | ret false |
| 1017 | end |
| 1018 | ret true |
| 1019 | end |
| 1020 | |
| 1021 | fn rl_cmd_uxl to int |
| 1022 | cb_pa_clr |
| 1023 | for i ulong get rl_scrl 0 bound 4096 |
| 1024 | cb_pa_ch get rl_scr i |
| 1025 | end |
| 1026 | if not cb_mkdir_p_pa |
| 1027 | ret 1 |
| 1028 | end |
| 1029 | pass = ulong 0 |
| 1030 | fail = ulong 0 |
| 1031 | note Stage 1: omc pin + windows paths |
| 1032 | s1 = true |
| 1033 | if not rl_check_omc_pin |
| 1034 | s1 = false |
| 1035 | end |
| 1036 | if s1 |
| 1037 | put rl_rootl 0 0 |
| 1038 | if ne rl_cmd_check_paths 0 |
| 1039 | s1 = false |
| 1040 | end |
| 1041 | end |
| 1042 | if s1 |
| 1043 | cb_out rl_uxl_s1 |
| 1044 | pass = add pass 1 |
| 1045 | else |
| 1046 | cb_out rl_uxl_f1 |
| 1047 | fail = add fail 1 |
| 1048 | end |
| 1049 | |
| 1050 | note Stage 2: Level 1 65-file SHA256.json |
| 1051 | if rl_uxl_level1 |
| 1052 | pass = add pass 1 |
| 1053 | else |
| 1054 | fail = add fail 1 |
| 1055 | end |
| 1056 | |
| 1057 | note Compile gpucoord into SCRATCH/om-gpucoord |
| 1058 | cb_wb_clr |
| 1059 | cb_pa_set rl_src_com |
| 1060 | z0 = cb_append_pa_to_wb |
| 1061 | cb_pa_set rl_src_gpu |
| 1062 | z1 = cb_append_pa_to_wb |
| 1063 | cb_pa_clr |
| 1064 | for i ulong get rl_scrl 0 bound 4096 |
| 1065 | cb_pa_ch get rl_scr i |
| 1066 | end |
| 1067 | cb_pa_tx rl_gpuc_src |
| 1068 | z2 = cb_write_wb_pa 420 |
| 1069 | for i ulong len rl_omc bound 4096 |
| 1070 | put cb_pc i get rl_omc i |
| 1071 | end |
| 1072 | cb_pb_clr |
| 1073 | for i ulong get rl_scrl 0 bound 4096 |
| 1074 | cb_pb_ch get rl_scr i |
| 1075 | end |
| 1076 | cb_pb_tx rl_gpuc_bin |
| 1077 | if ne cb_run_omc len rl_omc 493 -1 0 |
| 1078 | cb_out rl_uxl_f3 |
| 1079 | ret 1 |
| 1080 | end |
| 1081 | |
| 1082 | note Stage 3: spirv-check |
| 1083 | cb_av_clr |
| 1084 | cb_av_push_pb |
| 1085 | cb_av_push_tx rl_schk |
| 1086 | fo3 = fopen cb_devnull 0 len cb_devnull 524289 0 |
| 1087 | if eq cb_spawn_fds -1 int fo3 -1 false 0 |
| 1088 | cb_out rl_uxl_s3 |
| 1089 | pass = add pass 1 |
| 1090 | else |
| 1091 | cb_out rl_uxl_f3 |
| 1092 | fail = add fail 1 |
| 1093 | end |
| 1094 | |
| 1095 | note Stage 4: rmsnorm cl + vk |
| 1096 | if and rl_uxl_spv_row rl_k_rms rl_e_cl rl_sha_rms rl_uxl_spv_row rl_k_rms rl_e_vk rl_sha_rms |
| 1097 | cb_out rl_uxl_s4 |
| 1098 | pass = add pass 1 |
| 1099 | else |
| 1100 | cb_out rl_uxl_f4 |
| 1101 | fail = add fail 1 |
| 1102 | end |
| 1103 | |
| 1104 | note Stage 5: vadd, fsum16, gemm16 cl + vk |
| 1105 | s5 = true |
| 1106 | if not rl_uxl_spv_row rl_k_vadd rl_e_cl rl_sha_vadd |
| 1107 | s5 = false |
| 1108 | end |
| 1109 | if not rl_uxl_spv_row rl_k_vadd rl_e_vk rl_sha_vadd |
| 1110 | s5 = false |
| 1111 | end |
| 1112 | if not rl_uxl_spv_row rl_k_fsum rl_e_cl rl_sha_fsum |
| 1113 | s5 = false |
| 1114 | end |
| 1115 | if not rl_uxl_spv_row rl_k_fsum rl_e_vk rl_sha_fsum |
| 1116 | s5 = false |
| 1117 | end |
| 1118 | if not rl_uxl_spv_row rl_k_gemm rl_e_cl rl_sha_gemm |
| 1119 | s5 = false |
| 1120 | end |
| 1121 | if not rl_uxl_spv_row rl_k_gemm rl_e_vk rl_sha_gemm |
| 1122 | s5 = false |
| 1123 | end |
| 1124 | if s5 |
| 1125 | cb_out rl_uxl_s5 |
| 1126 | pass = add pass 1 |
| 1127 | else |
| 1128 | cb_out rl_uxl_f5 |
| 1129 | fail = add fail 1 |
| 1130 | end |
| 1131 | |
| 1132 | note Stage 6: intel-gate |
| 1133 | cb_av_clr |
| 1134 | cb_pa_clr |
| 1135 | for i ulong get rl_scrl 0 bound 4096 |
| 1136 | cb_pa_ch get rl_scr i |
| 1137 | end |
| 1138 | cb_pa_tx rl_gpuc_bin |
| 1139 | cb_av_push_pa |
| 1140 | cb_av_push_tx rl_ixe |
| 1141 | fo6 = fopen cb_devnull 0 len cb_devnull 524289 0 |
| 1142 | if eq cb_spawn_fds -1 int fo6 -1 false 0 |
| 1143 | cb_out rl_uxl_s6 |
| 1144 | pass = add pass 1 |
| 1145 | else |
| 1146 | cb_out rl_uxl_f6 |
| 1147 | fail = add fail 1 |
| 1148 | end |
| 1149 | |
| 1150 | cb_out rl_uxl_sum1 |
| 1151 | cb_wnum 1 pass |
| 1152 | cb_out rl_uxl_sum2 |
| 1153 | cb_wnum 1 fail |
| 1154 | cb_out cb_nl |
| 1155 | if ne fail 0 |
| 1156 | ret 1 |
| 1157 | end |
| 1158 | ret 0 |
| 1159 | end |
| 1160 | |
| 1161 | note ---- Package & Verify ---- |
| 1162 | fn rl_man_ch c uchar to void |
| 1163 | n = get rl_mann 0 |
| 1164 | if ge n len rl_man |
| 1165 | cap = len rl_man |
| 1166 | if eq cap 0 |
| 1167 | cap = 16384 |
| 1168 | end |
| 1169 | z = enlarge rl_man mul cap 2 |
| 1170 | end |
| 1171 | put rl_man n c |
| 1172 | put rl_mann 0 add n 1 |
| 1173 | end |
| 1174 | |
| 1175 | fn rl_man_tx t view uchar * to void |
| 1176 | for i ulong len t bound 4096 |
| 1177 | rl_man_ch get t i |
| 1178 | end |
| 1179 | end |
| 1180 | |
| 1181 | fn rl_man_num v ulong to void |
| 1182 | x = v |
| 1183 | i = ulong 32 |
| 1184 | for j ulong 21 |
| 1185 | i = sub i 1 |
| 1186 | put cb_numbuf i uchar add 48 rem x 10 |
| 1187 | x = div x 10 |
| 1188 | if eq x 0 |
| 1189 | break |
| 1190 | end |
| 1191 | end |
| 1192 | for q ulong sub 32 i bound 32 |
| 1193 | rl_man_ch get cb_numbuf add i q |
| 1194 | end |
| 1195 | end |
| 1196 | |
| 1197 | fn rl_sums_ch c uchar to void |
| 1198 | n = get rl_sumsn 0 |
| 1199 | if ge n len rl_sums |
| 1200 | cap = len rl_sums |
| 1201 | if eq cap 0 |
| 1202 | cap = 16384 |
| 1203 | end |
| 1204 | z = enlarge rl_sums mul cap 2 |
| 1205 | end |
| 1206 | put rl_sums n c |
| 1207 | put rl_sumsn 0 add n 1 |
| 1208 | end |
| 1209 | |
| 1210 | fn rl_sums_tx t view uchar * to void |
| 1211 | for i ulong len t bound 4096 |
| 1212 | rl_sums_ch get t i |
| 1213 | end |
| 1214 | end |
| 1215 | |
| 1216 | fn rl_json_ch c uchar to void |
| 1217 | n = get rl_jsonn 0 |
| 1218 | if ge n len rl_json |
| 1219 | cap = len rl_json |
| 1220 | if eq cap 0 |
| 1221 | cap = 16384 |
| 1222 | end |
| 1223 | z = enlarge rl_json mul cap 2 |
| 1224 | end |
| 1225 | put rl_json n c |
| 1226 | put rl_jsonn 0 add n 1 |
| 1227 | end |
| 1228 | |
| 1229 | fn rl_json_tx t view uchar * to void |
| 1230 | for i ulong len t bound 4096 |
| 1231 | rl_json_ch get t i |
| 1232 | end |
| 1233 | end |
| 1234 | |
| 1235 | fn rl_json_num v ulong to void |
| 1236 | x = v |
| 1237 | i = ulong 32 |
| 1238 | for j ulong 21 |
| 1239 | i = sub i 1 |
| 1240 | put cb_numbuf i uchar add 48 rem x 10 |
| 1241 | x = div x 10 |
| 1242 | if eq x 0 |
| 1243 | break |
| 1244 | end |
| 1245 | end |
| 1246 | for q ulong sub 32 i bound 32 |
| 1247 | rl_json_ch get cb_numbuf add i q |
| 1248 | end |
| 1249 | end |
| 1250 | |
| 1251 | fn rl_record_art rel view uchar * to bool |
| 1252 | cb_pa_clr |
| 1253 | for i ulong get rl_outl 0 bound 4096 |
| 1254 | cb_pa_ch get rl_out i |
| 1255 | end |
| 1256 | cb_pa_ch 47 |
| 1257 | cb_pa_tx rel |
| 1258 | sz = cb_file_size_pa |
| 1259 | if lt sz 0 |
| 1260 | ret false |
| 1261 | end |
| 1262 | if not cb_sha_file_pa |
| 1263 | ret false |
| 1264 | end |
| 1265 | note TSV row |
| 1266 | rl_man_tx rel |
| 1267 | rl_man_tx rl_tab |
| 1268 | rl_man_num ulong sz |
| 1269 | rl_man_tx rl_tab |
| 1270 | for j ulong 64 |
| 1271 | rl_man_ch get cb_shex j |
| 1272 | end |
| 1273 | rl_man_ch 10 |
| 1274 | note SHA256SUMS row |
| 1275 | for j ulong 64 |
| 1276 | rl_sums_ch get cb_shex j |
| 1277 | end |
| 1278 | rl_sums_tx rl_sp2 |
| 1279 | rl_sums_tx rel |
| 1280 | rl_sums_ch 10 |
| 1281 | note JSON row |
| 1282 | if gt get rl_pkg_idx 0 0 |
| 1283 | rl_json_tx rl_j_cm |
| 1284 | end |
| 1285 | rl_json_tx rl_j_a1 |
| 1286 | rl_json_tx rel |
| 1287 | rl_json_tx rl_j_a2 |
| 1288 | rl_json_num ulong sz |
| 1289 | rl_json_tx rl_j_a3 |
| 1290 | for j ulong 64 |
| 1291 | rl_json_ch get cb_shex j |
| 1292 | end |
| 1293 | rl_json_tx rl_j_a4 |
| 1294 | put rl_pkg_idx 0 add get rl_pkg_idx 0 1 |
| 1295 | ret true |
| 1296 | end |
| 1297 | |
| 1298 | fn rl_build_coord src view uchar * rel_out view uchar * to bool |
| 1299 | cb_wb_clr |
| 1300 | cb_pa_set rl_src_com |
| 1301 | if not cb_append_pa_to_wb |
| 1302 | ret false |
| 1303 | end |
| 1304 | cb_pa_set src |
| 1305 | if not cb_append_pa_to_wb |
| 1306 | ret false |
| 1307 | end |
| 1308 | cb_pa_clr |
| 1309 | for i ulong get rl_outl 0 bound 4096 |
| 1310 | cb_pa_ch get rl_out i |
| 1311 | end |
| 1312 | cb_pa_tx rl_gpuc_src |
| 1313 | if not cb_write_wb_pa 420 |
| 1314 | ret false |
| 1315 | end |
| 1316 | for i ulong len rl_omc bound 4096 |
| 1317 | put cb_pc i get rl_omc i |
| 1318 | end |
| 1319 | cb_pb_clr |
| 1320 | for i ulong get rl_outl 0 bound 4096 |
| 1321 | cb_pb_ch get rl_out i |
| 1322 | end |
| 1323 | cb_pb_ch 47 |
| 1324 | cb_pb_tx rel_out |
| 1325 | rc = cb_run_omc len rl_omc 493 -1 |
| 1326 | z0 = unlink cb_pa 0 get cb_n 3 |
| 1327 | if ne rc 0 |
| 1328 | ret false |
| 1329 | end |
| 1330 | ret rl_record_art rel_out |
| 1331 | end |
| 1332 | |
| 1333 | fn rl_is_ver_ch c uchar to bool |
| 1334 | if and ge c 48 le c 57 |
| 1335 | ret true |
| 1336 | end |
| 1337 | if and ge c 65 le c 90 |
| 1338 | ret true |
| 1339 | end |
| 1340 | if and ge c 97 le c 122 |
| 1341 | ret true |
| 1342 | end |
| 1343 | if or eq c 46 eq c 45 |
| 1344 | ret true |
| 1345 | end |
| 1346 | ret or eq c 95 eq c 43 |
| 1347 | end |
| 1348 | |
| 1349 | fn rl_ver_safe to bool |
| 1350 | n = get rl_verl 0 |
| 1351 | if or eq n 0 gt n 64 |
| 1352 | ret false |
| 1353 | end |
| 1354 | for i ulong n bound 64 |
| 1355 | if not rl_is_ver_ch get rl_ver i |
| 1356 | ret false |
| 1357 | end |
| 1358 | end |
| 1359 | ret true |
| 1360 | end |
| 1361 | |
| 1362 | fn rl_cmd_package to int |
| 1363 | if not rl_ver_safe |
| 1364 | cb_err rl_pkg_bad |
| 1365 | ret 2 |
| 1366 | end |
| 1367 | put rl_rootl 0 0 |
| 1368 | if ne rl_cmd_check_locks 0 |
| 1369 | cb_err rl_pkg_bad |
| 1370 | ret 1 |
| 1371 | end |
| 1372 | cb_pa_clr |
| 1373 | for i ulong get rl_outl 0 bound 4096 |
| 1374 | cb_pa_ch get rl_out i |
| 1375 | end |
| 1376 | cb_pa_tx rl_d_bin |
| 1377 | if not cb_mkdir_p_pa |
| 1378 | cb_err rl_pkg_bad |
| 1379 | ret 1 |
| 1380 | end |
| 1381 | cb_pa_clr |
| 1382 | for i ulong get rl_outl 0 bound 4096 |
| 1383 | cb_pa_ch get rl_out i |
| 1384 | end |
| 1385 | cb_pa_tx rl_d_seed |
| 1386 | if not cb_mkdir_p_pa |
| 1387 | cb_err rl_pkg_bad |
| 1388 | ret 1 |
| 1389 | end |
| 1390 | |
| 1391 | put rl_mann 0 0 |
| 1392 | put rl_sumsn 0 0 |
| 1393 | put rl_jsonn 0 0 |
| 1394 | put rl_pkg_idx 0 0 |
| 1395 | rl_man_tx rl_man_hdr |
| 1396 | rl_json_tx rl_j_1 |
| 1397 | for i ulong get rl_verl 0 bound 64 |
| 1398 | rl_json_ch get rl_ver i |
| 1399 | end |
| 1400 | rl_json_tx rl_j_2 |
| 1401 | for j ulong 64 |
| 1402 | rl_json_ch get rl_omchex j |
| 1403 | end |
| 1404 | rl_json_tx rl_j_3 |
| 1405 | |
| 1406 | note Copy omc, seed0.hex, omc.sha256 |
| 1407 | cb_pa_set rl_omc |
| 1408 | cb_pb_clr |
| 1409 | for i ulong get rl_outl 0 bound 4096 |
| 1410 | cb_pb_ch get rl_out i |
| 1411 | end |
| 1412 | cb_pb_ch 47 |
| 1413 | cb_pb_tx rl_r_omc |
| 1414 | if not cb_copy_pa_to_pb 493 |
| 1415 | cb_err rl_pkg_bad |
| 1416 | ret 1 |
| 1417 | end |
| 1418 | if not rl_record_art rl_r_omc |
| 1419 | cb_err rl_pkg_bad |
| 1420 | ret 1 |
| 1421 | end |
| 1422 | |
| 1423 | if not rl_build_coord rl_src_bir rl_r_bir |
| 1424 | cb_err rl_pkg_bad |
| 1425 | ret 1 |
| 1426 | end |
| 1427 | if not rl_build_coord rl_src_uni rl_r_uni |
| 1428 | cb_err rl_pkg_bad |
| 1429 | ret 1 |
| 1430 | end |
| 1431 | if not rl_build_coord rl_src_tls rl_r_tls |
| 1432 | cb_err rl_pkg_bad |
| 1433 | ret 1 |
| 1434 | end |
| 1435 | if not rl_build_coord rl_src_efi rl_r_efi |
| 1436 | cb_err rl_pkg_bad |
| 1437 | ret 1 |
| 1438 | end |
| 1439 | if not rl_build_coord rl_src_gpu rl_r_gpu |
| 1440 | cb_err rl_pkg_bad |
| 1441 | ret 1 |
| 1442 | end |
| 1443 | if not rl_build_coord rl_src_rel rl_r_rel |
| 1444 | cb_err rl_pkg_bad |
| 1445 | ret 1 |
| 1446 | end |
| 1447 | |
| 1448 | cb_pa_set rl_s0hex |
| 1449 | cb_pb_clr |
| 1450 | for i ulong get rl_outl 0 bound 4096 |
| 1451 | cb_pb_ch get rl_out i |
| 1452 | end |
| 1453 | cb_pb_ch 47 |
| 1454 | cb_pb_tx rl_r_s0 |
| 1455 | if not cb_copy_pa_to_pb 420 |
| 1456 | cb_err rl_pkg_bad |
| 1457 | ret 1 |
| 1458 | end |
| 1459 | if not rl_record_art rl_r_s0 |
| 1460 | cb_err rl_pkg_bad |
| 1461 | ret 1 |
| 1462 | end |
| 1463 | |
| 1464 | cb_pa_set rl_omcsha |
| 1465 | cb_pb_clr |
| 1466 | for i ulong get rl_outl 0 bound 4096 |
| 1467 | cb_pb_ch get rl_out i |
| 1468 | end |
| 1469 | cb_pb_ch 47 |
| 1470 | cb_pb_tx rl_r_sha |
| 1471 | if not cb_copy_pa_to_pb 420 |
| 1472 | cb_err rl_pkg_bad |
| 1473 | ret 1 |
| 1474 | end |
| 1475 | if not rl_record_art rl_r_sha |
| 1476 | cb_err rl_pkg_bad |
| 1477 | ret 1 |
| 1478 | end |
| 1479 | |
| 1480 | rl_json_tx rl_j_end |
| 1481 | |
| 1482 | note Write RELEASE-MANIFEST.tsv, SHA256SUMS, release-manifest.json |
| 1483 | cb_wb_clr |
| 1484 | for i ulong get rl_mann 0 bound 9223372036854775807 |
| 1485 | cb_wb_ch get rl_man i |
| 1486 | end |
| 1487 | cb_pa_clr |
| 1488 | for i ulong get rl_outl 0 bound 4096 |
| 1489 | cb_pa_ch get rl_out i |
| 1490 | end |
| 1491 | cb_pa_tx rl_f_man |
| 1492 | if not cb_write_wb_pa 420 |
| 1493 | cb_err rl_pkg_bad |
| 1494 | ret 1 |
| 1495 | end |
| 1496 | |
| 1497 | cb_wb_clr |
| 1498 | for i ulong get rl_sumsn 0 bound 9223372036854775807 |
| 1499 | cb_wb_ch get rl_sums i |
| 1500 | end |
| 1501 | cb_pa_clr |
| 1502 | for i ulong get rl_outl 0 bound 4096 |
| 1503 | cb_pa_ch get rl_out i |
| 1504 | end |
| 1505 | cb_pa_tx rl_f_sums |
| 1506 | if not cb_write_wb_pa 420 |
| 1507 | cb_err rl_pkg_bad |
| 1508 | ret 1 |
| 1509 | end |
| 1510 | |
| 1511 | cb_wb_clr |
| 1512 | for i ulong get rl_jsonn 0 bound 9223372036854775807 |
| 1513 | cb_wb_ch get rl_json i |
| 1514 | end |
| 1515 | cb_pa_clr |
| 1516 | for i ulong get rl_outl 0 bound 4096 |
| 1517 | cb_pa_ch get rl_out i |
| 1518 | end |
| 1519 | cb_pa_tx rl_f_json |
| 1520 | if not cb_write_wb_pa 420 |
| 1521 | cb_err rl_pkg_bad |
| 1522 | ret 1 |
| 1523 | end |
| 1524 | |
| 1525 | cb_out rl_pkg_ok1 |
| 1526 | r1 = write 1 rl_ver 0 get rl_verl 0 |
| 1527 | cb_out rl_pkg_ok2 |
| 1528 | r2 = write 1 rl_out 0 get rl_outl 0 |
| 1529 | cb_out cb_nl |
| 1530 | ret 0 |
| 1531 | end |
| 1532 | |
| 1533 | fn rl_relpath_safe s ulong e ulong to bool |
| 1534 | if or eq s e gt sub e s 1024 |
| 1535 | ret false |
| 1536 | end |
| 1537 | if eq get rl_man s 47 |
| 1538 | ret false |
| 1539 | end |
| 1540 | i = s |
| 1541 | while lt i e bound 4096 |
| 1542 | c = get rl_man i |
| 1543 | if or lt c 32 gt c 126 |
| 1544 | ret false |
| 1545 | end |
| 1546 | if and eq c 46 lt add i 1 e |
| 1547 | if eq get rl_man add i 1 46 |
| 1548 | ret false |
| 1549 | end |
| 1550 | end |
| 1551 | i = add i 1 |
| 1552 | end |
| 1553 | ret true |
| 1554 | end |
| 1555 | |
| 1556 | fn rl_seen_eq p ulong s ulong pl ulong to bool |
| 1557 | for j ulong pl bound 1024 |
| 1558 | if ne get rl_seen add p j get rl_man add s j |
| 1559 | ret false |
| 1560 | end |
| 1561 | end |
| 1562 | ret true |
| 1563 | end |
| 1564 | |
| 1565 | fn rl_seen_next_nl p ulong sn ulong to ulong |
| 1566 | q = p |
| 1567 | while lt q sn bound 1048576 |
| 1568 | if eq get rl_seen q 10 |
| 1569 | break |
| 1570 | end |
| 1571 | q = add q 1 |
| 1572 | end |
| 1573 | ret q |
| 1574 | end |
| 1575 | |
| 1576 | fn rl_seen_add s ulong e ulong to bool |
| 1577 | pl = sub e s |
| 1578 | sn = get rl_seenn 0 |
| 1579 | p = ulong 0 |
| 1580 | while lt p sn bound 1048576 |
| 1581 | q = rl_seen_next_nl p sn |
| 1582 | if eq sub q p pl |
| 1583 | if rl_seen_eq p s pl |
| 1584 | ret false |
| 1585 | end |
| 1586 | end |
| 1587 | p = add q 1 |
| 1588 | end |
| 1589 | need = add add sn pl 1 |
| 1590 | if gt need len rl_seen |
| 1591 | cap = len rl_seen |
| 1592 | if eq cap 0 |
| 1593 | cap = 16384 |
| 1594 | end |
| 1595 | while lt cap need bound 64 |
| 1596 | cap = mul cap 2 |
| 1597 | end |
| 1598 | z = enlarge rl_seen cap |
| 1599 | end |
| 1600 | for j ulong pl bound 1024 |
| 1601 | put rl_seen add sn j get rl_man add s j |
| 1602 | end |
| 1603 | put rl_seen add sn pl 10 |
| 1604 | put rl_seenn 0 need |
| 1605 | ret true |
| 1606 | end |
| 1607 | |
| 1608 | fn rl_find_tab s ulong e ulong to ulong |
| 1609 | t = s |
| 1610 | while lt t e bound 4096 |
| 1611 | if eq get rl_man t 9 |
| 1612 | break |
| 1613 | end |
| 1614 | t = add t 1 |
| 1615 | end |
| 1616 | ret t |
| 1617 | end |
| 1618 | |
| 1619 | fn rl_parse_u64_man s ulong e ulong to long |
| 1620 | if eq s e |
| 1621 | ret -1 |
| 1622 | end |
| 1623 | v = ulong 0 |
| 1624 | for k ulong sub e s bound 32 |
| 1625 | c = get rl_man add s k |
| 1626 | if or lt c 48 gt c 57 |
| 1627 | ret -1 |
| 1628 | end |
| 1629 | v = add mul v 10 ulong sub c 48 |
| 1630 | end |
| 1631 | ret long v |
| 1632 | end |
| 1633 | |
| 1634 | fn rl_check_hex_man pos ulong to bool |
| 1635 | for j ulong 64 |
| 1636 | if ne get cb_shex j get rl_man add pos j |
| 1637 | ret false |
| 1638 | end |
| 1639 | end |
| 1640 | ret true |
| 1641 | end |
| 1642 | |
| 1643 | fn rl_verify_row i ulong e ulong to bool |
| 1644 | t1 = rl_find_tab i e |
| 1645 | if ge t1 e |
| 1646 | cb_err rl_ver_bad |
| 1647 | cb_err rl_ver_e2 |
| 1648 | ret false |
| 1649 | end |
| 1650 | t2 = rl_find_tab add t1 1 e |
| 1651 | if ge t2 e |
| 1652 | cb_err rl_ver_bad |
| 1653 | cb_err rl_ver_e2 |
| 1654 | ret false |
| 1655 | end |
| 1656 | if ne sub sub e t2 1 64 |
| 1657 | cb_err rl_ver_bad |
| 1658 | cb_err rl_ver_e2 |
| 1659 | ret false |
| 1660 | end |
| 1661 | if not rl_relpath_safe i t1 |
| 1662 | cb_err rl_ver_bad |
| 1663 | cb_err rl_ver_e3 |
| 1664 | ret false |
| 1665 | end |
| 1666 | if not rl_seen_add i t1 |
| 1667 | cb_err rl_ver_bad |
| 1668 | cb_err rl_ver_e3 |
| 1669 | ret false |
| 1670 | end |
| 1671 | bval = rl_parse_u64_man add t1 1 t2 |
| 1672 | if lt bval 0 |
| 1673 | cb_err rl_ver_bad |
| 1674 | cb_err rl_ver_e2 |
| 1675 | ret false |
| 1676 | end |
| 1677 | cb_pa_clr |
| 1678 | for k ulong get rl_outl 0 bound 4096 |
| 1679 | cb_pa_ch get rl_out k |
| 1680 | end |
| 1681 | cb_pa_ch 47 |
| 1682 | for k ulong sub t1 i bound 1024 |
| 1683 | cb_pa_ch get rl_man add i k |
| 1684 | end |
| 1685 | sz = cb_file_size_pa |
| 1686 | if ne sz bval |
| 1687 | cb_err rl_ver_bad |
| 1688 | cb_err rl_ver_e4 |
| 1689 | cb_wbuf_pa 2 |
| 1690 | cb_err cb_nl |
| 1691 | ret false |
| 1692 | end |
| 1693 | if not cb_sha_file_pa |
| 1694 | cb_err rl_ver_bad |
| 1695 | cb_err rl_ver_e4 |
| 1696 | cb_wbuf_pa 2 |
| 1697 | cb_err cb_nl |
| 1698 | ret false |
| 1699 | end |
| 1700 | if not rl_check_hex_man add t2 1 |
| 1701 | cb_err rl_ver_bad |
| 1702 | cb_err rl_ver_e4 |
| 1703 | cb_wbuf_pa 2 |
| 1704 | cb_err cb_nl |
| 1705 | ret false |
| 1706 | end |
| 1707 | ret true |
| 1708 | end |
| 1709 | |
| 1710 | fn rl_cmd_verify to int |
| 1711 | cb_pa_clr |
| 1712 | for i ulong get rl_outl 0 bound 4096 |
| 1713 | cb_pa_ch get rl_out i |
| 1714 | end |
| 1715 | cb_pa_tx rl_f_man |
| 1716 | if not cb_read_pa |
| 1717 | cb_err rl_ver_bad |
| 1718 | cb_err rl_ver_e1 |
| 1719 | ret 1 |
| 1720 | end |
| 1721 | n = get cb_n 0 |
| 1722 | if lt n len rl_man_hdr |
| 1723 | cb_err rl_ver_bad |
| 1724 | cb_err rl_ver_e2 |
| 1725 | ret 1 |
| 1726 | end |
| 1727 | ze2 = enlarge rl_man n |
| 1728 | if ne ze2 0 |
| 1729 | ret 1 |
| 1730 | end |
| 1731 | for i ulong n bound 9223372036854775807 |
| 1732 | put rl_man i get cb_rb i |
| 1733 | end |
| 1734 | put rl_mann 0 n |
| 1735 | for j ulong len rl_man_hdr bound 64 |
| 1736 | if ne get rl_man j get rl_man_hdr j |
| 1737 | cb_err rl_ver_bad |
| 1738 | cb_err rl_ver_e2 |
| 1739 | ret 1 |
| 1740 | end |
| 1741 | end |
| 1742 | put rl_seenn 0 0 |
| 1743 | cnt = ulong 0 |
| 1744 | i = len rl_man_hdr |
| 1745 | while lt i n bound 9223372036854775807 |
| 1746 | e = i |
| 1747 | while lt e n bound 9223372036854775807 |
| 1748 | if eq get rl_man e 10 |
| 1749 | break |
| 1750 | end |
| 1751 | e = add e 1 |
| 1752 | end |
| 1753 | if eq i e |
| 1754 | i = add e 1 |
| 1755 | continue |
| 1756 | end |
| 1757 | if not rl_verify_row i e |
| 1758 | ret 1 |
| 1759 | end |
| 1760 | cnt = add cnt 1 |
| 1761 | i = add e 1 |
| 1762 | end |
| 1763 | if eq cnt 0 |
| 1764 | cb_err rl_ver_bad |
| 1765 | cb_err rl_ver_e5 |
| 1766 | ret 1 |
| 1767 | end |
| 1768 | cb_out rl_ver_ok |
| 1769 | cb_wnum 1 cnt |
| 1770 | cb_out cb_nl |
| 1771 | ret 0 |
| 1772 | end |
| 1773 | |
| 1774 | fn main to int |
| 1775 | ac = argcnt |
| 1776 | if lt ac 2 |
| 1777 | cb_err rl_usage |
| 1778 | ret 2 |
| 1779 | end |
| 1780 | if not cb_pa_arg 1 |
| 1781 | cb_err rl_usage |
| 1782 | ret 2 |
| 1783 | end |
| 1784 | if cb_pa_eq rl_c_locks |
| 1785 | put rl_rootl 0 0 |
| 1786 | if ge ac 3 |
| 1787 | if cb_pa_arg 2 |
| 1788 | for i ulong get cb_n 3 bound 4096 |
| 1789 | put rl_root i get cb_pa i |
| 1790 | end |
| 1791 | put rl_rootl 0 get cb_n 3 |
| 1792 | end |
| 1793 | end |
| 1794 | ret rl_cmd_check_locks |
| 1795 | end |
| 1796 | if cb_pa_eq rl_c_paths |
| 1797 | put rl_rootl 0 0 |
| 1798 | if ge ac 3 |
| 1799 | if cb_pa_arg 2 |
| 1800 | for i ulong get cb_n 3 bound 4096 |
| 1801 | put rl_root i get cb_pa i |
| 1802 | end |
| 1803 | put rl_rootl 0 get cb_n 3 |
| 1804 | end |
| 1805 | end |
| 1806 | ret rl_cmd_check_paths |
| 1807 | end |
| 1808 | if cb_pa_eq rl_c_layers |
| 1809 | if ge ac 3 |
| 1810 | if cb_pa_arg 2 |
| 1811 | for i ulong get cb_n 3 bound 4096 |
| 1812 | put rl_scr i get cb_pa i |
| 1813 | end |
| 1814 | put rl_scrl 0 get cb_n 3 |
| 1815 | end |
| 1816 | else |
| 1817 | for i ulong len rl_defscr bound 4096 |
| 1818 | put rl_scr i get rl_defscr i |
| 1819 | end |
| 1820 | put rl_scrl 0 len rl_defscr |
| 1821 | end |
| 1822 | ret rl_cmd_layers |
| 1823 | end |
| 1824 | if cb_pa_eq rl_c_uxl |
| 1825 | if ge ac 3 |
| 1826 | if cb_pa_arg 2 |
| 1827 | for i ulong get cb_n 3 bound 4096 |
| 1828 | put rl_scr i get cb_pa i |
| 1829 | end |
| 1830 | put rl_scrl 0 get cb_n 3 |
| 1831 | end |
| 1832 | else |
| 1833 | for i ulong len rl_defscr bound 4096 |
| 1834 | put rl_scr i get rl_defscr i |
| 1835 | end |
| 1836 | put rl_scrl 0 len rl_defscr |
| 1837 | end |
| 1838 | ret rl_cmd_uxl |
| 1839 | end |
| 1840 | if cb_pa_eq rl_c_pkg |
| 1841 | if ne ac 4 |
| 1842 | cb_err rl_usage |
| 1843 | ret 2 |
| 1844 | end |
| 1845 | if not cb_pa_arg 2 |
| 1846 | ret 2 |
| 1847 | end |
| 1848 | for i ulong get cb_n 3 bound 4096 |
| 1849 | put rl_out i get cb_pa i |
| 1850 | end |
| 1851 | put rl_outl 0 get cb_n 3 |
| 1852 | if not cb_pa_arg 3 |
| 1853 | ret 2 |
| 1854 | end |
| 1855 | if gt get cb_n 3 255 |
| 1856 | ret 2 |
| 1857 | end |
| 1858 | for i ulong get cb_n 3 bound 256 |
| 1859 | put rl_ver i get cb_pa i |
| 1860 | end |
| 1861 | put rl_verl 0 get cb_n 3 |
| 1862 | ret rl_cmd_package |
| 1863 | end |
| 1864 | if cb_pa_eq rl_c_ver |
| 1865 | if ne ac 3 |
| 1866 | cb_err rl_usage |
| 1867 | ret 2 |
| 1868 | end |
| 1869 | if not cb_pa_arg 2 |
| 1870 | ret 2 |
| 1871 | end |
| 1872 | for i ulong get cb_n 3 bound 4096 |
| 1873 | put rl_out i get cb_pa i |
| 1874 | end |
| 1875 | put rl_outl 0 get cb_n 3 |
| 1876 | ret rl_cmd_verify |
| 1877 | end |
| 1878 | cb_err rl_usage |
| 1879 | ret 2 |
| 1880 | end |