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 / core / cortex / tests / parity / gen.om
| 1 | note gen.om: parity corpus generator (read phase). usage: gen DATA OUT |
| 2 | note DATA is written by tests/parity/gen.sh from a copy of the cortex-rs database (sqlite3 is used |
| 3 | note only to extract real values, as hex): "T<TAB><hex query term>" and |
| 4 | note "E<TAB><hex id><TAB><hex canonical name><TAB><hex space slug>". OUT gets one corpus line per |
| 5 | note request, CLASS TAB METHOD TAB PATH TAB FLAGS TAB BODY (spec/PARITY.md): |
| 6 | note - every term, alone, against search GET, search POST and recall, over five spaces (none, |
| 7 | note aien-lessons, aien-sources, atlas-memory, an unknown one) with the limit cycling over |
| 8 | note absent/0/1/5/12/50/999 and occasional query=, include_retracted, tokenBudget, origin and |
| 9 | note spaced-token variants; |
| 10 | note - eleven FTS operator forms over term pairs (AND, OR, NOT, prefix, phrase, NEAR, column |
| 11 | note filter, dangling AND, open and close parenthesis, leading minus); |
| 12 | note - eighteen empty and malformed queries that use no term; |
| 13 | note - get by id, by name, with the right, default and wrong space, id+name, HEAD; traverse. |
| 14 | global pa uchar 4096 |
| 15 | global db uchar 4194304 |
| 16 | global ob uchar 2097152 |
| 17 | global qb uchar 16384 |
| 18 | note tt: term i hex at db offset tt[2i], length tt[2i+1] |
| 19 | global tt ulong 2048 |
| 20 | note et: entity e: id, name, space hex (offset, length) at et[6e .. 6e+5] |
| 21 | global et ulong 3072 |
| 22 | note gv: 0 data len, 1 out fd, 2 ob pos, 3 terms, 4 entities, 5 request counter, 6 qb len, 7 write failed |
| 23 | global gv ulong 8 |
| 24 | text u_use "usage: gen DATA OUT\n" |
| 25 | text u_open "gen: cannot open a file\n" |
| 26 | text u_big "gen: data too large or malformed\n" |
| 27 | text u_wr "gen: write failed\n" |
| 28 | text s_sp1 "aien-lessons" |
| 29 | text s_sp2 "aien-sources" |
| 30 | text s_sp3 "atlas-memory" |
| 31 | text s_sp4 "no-such-space" |
| 32 | text p_sg "/api/cortex/search?" |
| 33 | text p_sp "/api/cortex/search" |
| 34 | text p_rc "/api/cortex/recall" |
| 35 | text p_get "/api/cortex/get?" |
| 36 | text p_tr "/api/cortex/traverse" |
| 37 | text m_get "GET" |
| 38 | text m_post "POST" |
| 39 | text m_head "HEAD" |
| 40 | text a_q "q=" |
| 41 | text a_qy "query=" |
| 42 | text a_sp "&space=" |
| 43 | text a_lim "&limit=" |
| 44 | text a_ir "&include_retracted=true" |
| 45 | text a_id "id=" |
| 46 | text a_nm "name=" |
| 47 | text a_spn "&space=no-such-space" |
| 48 | text a_nz "&name=zzz-no-such-name" |
| 49 | text j_q "{\"q\":\"" |
| 50 | text j_qy "{\"query\":\"" |
| 51 | text j_sj "{\"subjectId\":\"" |
| 52 | text j_sp ",\"space\":\"" |
| 53 | text j_lim ",\"limit\":" |
| 54 | text j_ir ",\"include_retracted\":true" |
| 55 | text j_tb ",\"tokenBudget\":200" |
| 56 | text c_sgt "search.get.term" |
| 57 | text c_spt "search.post.term" |
| 58 | text c_rt "recall.term" |
| 59 | text c_sgo "search.get.ops" |
| 60 | text c_spo "search.post.ops" |
| 61 | text c_ro "recall.ops" |
| 62 | text c_sge "search.get.malformed" |
| 63 | text c_spe "search.post.malformed" |
| 64 | text c_re "recall.malformed" |
| 65 | text c_get "get.read" |
| 66 | text c_tr "traverse.read" |
| 67 | text f_and " AND " |
| 68 | text f_or " OR " |
| 69 | text f_not " NOT " |
| 70 | text f_near "NEAR(" |
| 71 | text f_col "canonical_name:" |
| 72 | text f_dand " AND" |
| 73 | text x_00 " " |
| 74 | text x_01 "\"" |
| 75 | text x_02 "*" |
| 76 | text x_03 "AND" |
| 77 | text x_04 "OR" |
| 78 | text x_05 "NOT" |
| 79 | text x_06 "(" |
| 80 | text x_07 ")" |
| 81 | text x_08 "\"unclosed phrase" |
| 82 | text x_09 "%" |
| 83 | text x_10 "_" |
| 84 | text x_11 "%_%" |
| 85 | text x_12 "'" |
| 86 | text x_13 "NEAR(" |
| 87 | text x_14 "a:b" |
| 88 | text x_15 "^" |
| 89 | text x_16 "\\" |
| 90 | text x_17 "\t tab and newline \n" |
| 91 | |
| 92 | fn say t view uchar * to void |
| 93 | w = write 2 t 0 len t |
| 94 | if lt w 0 |
| 95 | ret |
| 96 | end |
| 97 | end |
| 98 | fn argp i ulong to ulong |
| 99 | n = argread i pa 0 len pa |
| 100 | if lt n 0 |
| 101 | ret 0 |
| 102 | end |
| 103 | ret ulong n |
| 104 | end |
| 105 | fn rdall fd int to bool |
| 106 | n = ulong 0 |
| 107 | while true bound 999999 |
| 108 | if ge n len db |
| 109 | say u_big |
| 110 | ret false |
| 111 | end |
| 112 | r = pread fd db n sub len db n long n |
| 113 | if lt r 0 |
| 114 | ret false |
| 115 | end |
| 116 | if eq r 0 |
| 117 | put gv 0 n |
| 118 | ret true |
| 119 | end |
| 120 | n = add n ulong r |
| 121 | end |
| 122 | ret false |
| 123 | end |
| 124 | note ---- output ---- |
| 125 | fn flush to void |
| 126 | k = ulong 0 |
| 127 | e = get gv 2 |
| 128 | while lt k e bound 999999 |
| 129 | w = write int get gv 1 ob k sub e k |
| 130 | if le w 0 |
| 131 | put gv 7 1 |
| 132 | put gv 2 0 |
| 133 | ret |
| 134 | end |
| 135 | k = add k ulong w |
| 136 | end |
| 137 | put gv 2 0 |
| 138 | end |
| 139 | fn oc c uchar to void |
| 140 | p = get gv 2 |
| 141 | put ob p c |
| 142 | put gv 2 add p 1 |
| 143 | end |
| 144 | fn ot t view uchar * to void |
| 145 | for i ulong len t |
| 146 | oc get t i |
| 147 | end |
| 148 | end |
| 149 | fn odec v ulong to void |
| 150 | if ge v 10 |
| 151 | odec div v 10 |
| 152 | end |
| 153 | oc uchar add rem v 10 48 |
| 154 | end |
| 155 | fn hexv c ulong to ulong |
| 156 | if le c 57 |
| 157 | ret sub c 48 |
| 158 | end |
| 159 | if le c 70 |
| 160 | ret sub c 55 |
| 161 | end |
| 162 | ret sub c 87 |
| 163 | end |
| 164 | fn hexd v ulong to uchar |
| 165 | if lt v 10 |
| 166 | ret uchar add v 48 |
| 167 | end |
| 168 | ret uchar add v 55 |
| 169 | end |
| 170 | note end of a corpus line; flushes when the buffer is mostly full |
| 171 | fn eol to void |
| 172 | oc 10 |
| 173 | put gv 5 add get gv 5 1 |
| 174 | if gt get gv 2 1900000 |
| 175 | flush |
| 176 | end |
| 177 | end |
| 178 | fn tab to void |
| 179 | oc 9 |
| 180 | end |
| 181 | note ---- the query buffer qb ---- |
| 182 | fn qclr to void |
| 183 | put gv 6 0 |
| 184 | end |
| 185 | fn qc c uchar to void |
| 186 | p = get gv 6 |
| 187 | if lt p len qb |
| 188 | put qb p c |
| 189 | put gv 6 add p 1 |
| 190 | end |
| 191 | end |
| 192 | fn qt t view uchar * to void |
| 193 | for i ulong len t |
| 194 | qc get t i |
| 195 | end |
| 196 | end |
| 197 | note append the bytes of term i (decoded from hex) |
| 198 | fn qterm i ulong to void |
| 199 | o = get tt mul i 2 |
| 200 | n = div get tt add mul i 2 1 2 |
| 201 | for j ulong n |
| 202 | a = hexv ulong get db add o mul j 2 |
| 203 | b = hexv ulong get db add add o mul j 2 1 |
| 204 | qc uchar add mul a 16 b |
| 205 | end |
| 206 | end |
| 207 | note qb as "~" plus hex pairs (pdrive sends them as %HH) |
| 208 | fn ourl to void |
| 209 | oc 126 |
| 210 | for i ulong get gv 6 |
| 211 | c = ulong get qb i |
| 212 | oc hexd shr c 4 |
| 213 | oc hexd and c 15 |
| 214 | end |
| 215 | end |
| 216 | fn ou4 c ulong to void |
| 217 | oc 92 |
| 218 | oc 117 |
| 219 | oc 48 |
| 220 | oc 48 |
| 221 | oc hexd shr c 4 |
| 222 | oc hexd and c 15 |
| 223 | end |
| 224 | note qb as the inside of a JSON string |
| 225 | fn ojson to void |
| 226 | for i ulong get gv 6 |
| 227 | c = get qb i |
| 228 | if or eq c 34 eq c 92 |
| 229 | oc 92 |
| 230 | oc c |
| 231 | continue |
| 232 | end |
| 233 | if lt c 32 |
| 234 | ou4 ulong c |
| 235 | continue |
| 236 | end |
| 237 | oc c |
| 238 | end |
| 239 | end |
| 240 | note hex region of db copied as "~" plus hex (url) or decoded and escaped (json) |
| 241 | fn ohex o ulong n ulong to void |
| 242 | oc 126 |
| 243 | for j ulong n |
| 244 | oc get db add o j |
| 245 | end |
| 246 | end |
| 247 | fn ojhex o ulong n ulong to void |
| 248 | qclr |
| 249 | for j ulong div n 2 |
| 250 | a = hexv ulong get db add o mul j 2 |
| 251 | b = hexv ulong get db add add o mul j 2 1 |
| 252 | qc uchar add mul a 16 b |
| 253 | end |
| 254 | ojson |
| 255 | end |
| 256 | note ---- spaces and limits ---- |
| 257 | fn ospace s ulong to void |
| 258 | if eq s 1 |
| 259 | ot s_sp1 |
| 260 | end |
| 261 | if eq s 2 |
| 262 | ot s_sp2 |
| 263 | end |
| 264 | if eq s 3 |
| 265 | ot s_sp3 |
| 266 | end |
| 267 | if eq s 4 |
| 268 | ot s_sp4 |
| 269 | end |
| 270 | end |
| 271 | fn limv l ulong to ulong |
| 272 | if eq l 1 |
| 273 | ret 0 |
| 274 | end |
| 275 | if eq l 2 |
| 276 | ret 1 |
| 277 | end |
| 278 | if eq l 3 |
| 279 | ret 5 |
| 280 | end |
| 281 | if eq l 4 |
| 282 | ret 12 |
| 283 | end |
| 284 | if eq l 5 |
| 285 | ret 50 |
| 286 | end |
| 287 | ret 999 |
| 288 | end |
| 289 | note flags for request number n: a token, plus an allowed origin or a spaced token now and then |
| 290 | fn oflags json bool to void |
| 291 | n = get gv 5 |
| 292 | if eq rem n 13 6 |
| 293 | oc 115 |
| 294 | else |
| 295 | oc 97 |
| 296 | end |
| 297 | if json |
| 298 | oc 106 |
| 299 | end |
| 300 | if eq rem n 11 4 |
| 301 | oc 111 |
| 302 | end |
| 303 | end |
| 304 | note ---- one request built from qb: ep 0 search GET, 1 search POST, 2 recall ---- |
| 305 | fn rqget c view uchar * s ulong l ulong to void |
| 306 | n = get gv 5 |
| 307 | ot c |
| 308 | tab |
| 309 | ot m_get |
| 310 | tab |
| 311 | ot p_sg |
| 312 | if eq rem n 5 3 |
| 313 | ot a_qy |
| 314 | else |
| 315 | ot a_q |
| 316 | end |
| 317 | ourl |
| 318 | if ne s 0 |
| 319 | ot a_sp |
| 320 | ospace s |
| 321 | end |
| 322 | if ne l 0 |
| 323 | ot a_lim |
| 324 | odec limv l |
| 325 | end |
| 326 | if eq rem n 7 2 |
| 327 | ot a_ir |
| 328 | end |
| 329 | tab |
| 330 | oflags false |
| 331 | tab |
| 332 | eol |
| 333 | end |
| 334 | fn jtail s ulong l ulong to void |
| 335 | oc 34 |
| 336 | if ne s 0 |
| 337 | ot j_sp |
| 338 | ospace s |
| 339 | oc 34 |
| 340 | end |
| 341 | if ne l 0 |
| 342 | ot j_lim |
| 343 | odec limv l |
| 344 | end |
| 345 | end |
| 346 | fn rqpost c view uchar * s ulong l ulong to void |
| 347 | n = get gv 5 |
| 348 | ot c |
| 349 | tab |
| 350 | ot m_post |
| 351 | tab |
| 352 | ot p_sp |
| 353 | tab |
| 354 | oflags true |
| 355 | tab |
| 356 | ot j_q |
| 357 | ojson |
| 358 | jtail s l |
| 359 | if eq rem n 7 2 |
| 360 | ot j_ir |
| 361 | end |
| 362 | oc 125 |
| 363 | eol |
| 364 | end |
| 365 | fn rqrec c view uchar * s ulong l ulong to void |
| 366 | n = get gv 5 |
| 367 | ot c |
| 368 | tab |
| 369 | ot m_post |
| 370 | tab |
| 371 | ot p_rc |
| 372 | tab |
| 373 | oflags true |
| 374 | tab |
| 375 | ot j_qy |
| 376 | ojson |
| 377 | jtail s l |
| 378 | if eq rem n 5 1 |
| 379 | ot j_tb |
| 380 | end |
| 381 | oc 125 |
| 382 | eol |
| 383 | end |
| 384 | note kind 0 term, 1 ops, 2 malformed: picks the class names |
| 385 | fn rq3 kind ulong ep ulong s ulong l ulong to void |
| 386 | if eq ep 0 |
| 387 | if eq kind 0 |
| 388 | rqget c_sgt s l |
| 389 | end |
| 390 | if eq kind 1 |
| 391 | rqget c_sgo s l |
| 392 | end |
| 393 | if eq kind 2 |
| 394 | rqget c_sge s l |
| 395 | end |
| 396 | ret |
| 397 | end |
| 398 | if eq ep 1 |
| 399 | if eq kind 0 |
| 400 | rqpost c_spt s l |
| 401 | end |
| 402 | if eq kind 1 |
| 403 | rqpost c_spo s l |
| 404 | end |
| 405 | if eq kind 2 |
| 406 | rqpost c_spe s l |
| 407 | end |
| 408 | ret |
| 409 | end |
| 410 | if eq kind 0 |
| 411 | rqrec c_rt s l |
| 412 | end |
| 413 | if eq kind 1 |
| 414 | rqrec c_ro s l |
| 415 | end |
| 416 | if eq kind 2 |
| 417 | rqrec c_re s l |
| 418 | end |
| 419 | end |
| 420 | note ---- phases ---- |
| 421 | fn gterm to void |
| 422 | nt = get gv 3 |
| 423 | for i ulong nt |
| 424 | qclr |
| 425 | qterm i |
| 426 | for s ulong 5 |
| 427 | for ep ulong 3 |
| 428 | rq3 0 ep s rem add add mul i 5 mul s 3 ep 7 |
| 429 | end |
| 430 | end |
| 431 | end |
| 432 | end |
| 433 | note operator form f (1..11) over terms t and u into qb |
| 434 | fn qform f ulong t ulong u ulong to void |
| 435 | qclr |
| 436 | if eq f 5 |
| 437 | qc 34 |
| 438 | end |
| 439 | if eq f 6 |
| 440 | qt f_near |
| 441 | end |
| 442 | if eq f 7 |
| 443 | qt f_col |
| 444 | end |
| 445 | if eq f 9 |
| 446 | qc 40 |
| 447 | end |
| 448 | if eq f 11 |
| 449 | qc 45 |
| 450 | end |
| 451 | qterm t |
| 452 | if eq f 1 |
| 453 | qt f_and |
| 454 | qterm u |
| 455 | end |
| 456 | if eq f 2 |
| 457 | qt f_or |
| 458 | qterm u |
| 459 | end |
| 460 | if eq f 3 |
| 461 | qt f_not |
| 462 | qterm u |
| 463 | end |
| 464 | if eq f 4 |
| 465 | qc 42 |
| 466 | end |
| 467 | if or eq f 5 eq f 6 |
| 468 | qc 32 |
| 469 | qterm u |
| 470 | end |
| 471 | if eq f 5 |
| 472 | qc 34 |
| 473 | end |
| 474 | if eq f 6 |
| 475 | qc 41 |
| 476 | end |
| 477 | if eq f 8 |
| 478 | qt f_dand |
| 479 | end |
| 480 | if eq f 10 |
| 481 | qc 41 |
| 482 | end |
| 483 | end |
| 484 | fn opsone i ulong f ulong ep ulong to void |
| 485 | s = rem add add i f ep 5 |
| 486 | l = rem add mul i 3 add f ep 7 |
| 487 | rq3 1 ep s l |
| 488 | end |
| 489 | fn gops to void |
| 490 | nt = get gv 3 |
| 491 | np = nt |
| 492 | if gt np 50 |
| 493 | np = 50 |
| 494 | end |
| 495 | for i ulong np |
| 496 | for f ulong 11 |
| 497 | qform add f 1 i rem add i 7 nt |
| 498 | for ep ulong 3 |
| 499 | opsone i f ep |
| 500 | end |
| 501 | end |
| 502 | end |
| 503 | end |
| 504 | fn qmal x ulong to void |
| 505 | qclr |
| 506 | if eq x 1 |
| 507 | qt x_00 |
| 508 | end |
| 509 | if eq x 2 |
| 510 | qt x_01 |
| 511 | end |
| 512 | if eq x 3 |
| 513 | qt x_02 |
| 514 | end |
| 515 | if eq x 4 |
| 516 | qt x_03 |
| 517 | end |
| 518 | if eq x 5 |
| 519 | qt x_04 |
| 520 | end |
| 521 | if eq x 6 |
| 522 | qt x_05 |
| 523 | end |
| 524 | if eq x 7 |
| 525 | qt x_06 |
| 526 | end |
| 527 | if eq x 8 |
| 528 | qt x_07 |
| 529 | end |
| 530 | if eq x 9 |
| 531 | qt x_08 |
| 532 | end |
| 533 | if eq x 10 |
| 534 | qt x_09 |
| 535 | end |
| 536 | if eq x 11 |
| 537 | qt x_10 |
| 538 | end |
| 539 | if eq x 12 |
| 540 | qt x_11 |
| 541 | end |
| 542 | if eq x 13 |
| 543 | qt x_12 |
| 544 | end |
| 545 | if eq x 14 |
| 546 | qt x_13 |
| 547 | end |
| 548 | if eq x 15 |
| 549 | qt x_14 |
| 550 | end |
| 551 | if eq x 16 |
| 552 | qt x_15 |
| 553 | end |
| 554 | if eq x 17 |
| 555 | qt x_16 |
| 556 | end |
| 557 | if eq x 18 |
| 558 | qt x_17 |
| 559 | end |
| 560 | end |
| 561 | note x 0 is the empty query |
| 562 | fn gmal to void |
| 563 | for x ulong 19 |
| 564 | qmal x |
| 565 | for s ulong 5 |
| 566 | for ep ulong 3 |
| 567 | rq3 2 ep s rem add add x s mul ep 3 7 |
| 568 | end |
| 569 | end |
| 570 | end |
| 571 | end |
| 572 | note get lines for entity e: v 0 id+space, 1 id (default space), 2 name+space, 3 name+wrong |
| 573 | note space, 4 id+name+space, 5 HEAD id+space |
| 574 | fn ghead e ulong m view uchar * to void |
| 575 | ot c_get |
| 576 | tab |
| 577 | ot m |
| 578 | tab |
| 579 | ot p_get |
| 580 | end |
| 581 | fn gone e ulong v ulong to void |
| 582 | b = mul e 6 |
| 583 | if eq v 5 |
| 584 | ghead e m_head |
| 585 | else |
| 586 | ghead e m_get |
| 587 | end |
| 588 | if or eq v 2 eq v 3 |
| 589 | ot a_nm |
| 590 | ohex get et add b 2 get et add b 3 |
| 591 | else |
| 592 | ot a_id |
| 593 | ohex get et b get et add b 1 |
| 594 | end |
| 595 | if eq v 4 |
| 596 | ot a_nz |
| 597 | end |
| 598 | if eq v 3 |
| 599 | ot a_spn |
| 600 | end |
| 601 | if and ne v 1 ne v 3 |
| 602 | ot a_sp |
| 603 | ohex get et add b 4 get et add b 5 |
| 604 | end |
| 605 | tab |
| 606 | oflags false |
| 607 | tab |
| 608 | eol |
| 609 | end |
| 610 | fn trone e ulong to void |
| 611 | b = mul e 6 |
| 612 | ot c_tr |
| 613 | tab |
| 614 | ot m_post |
| 615 | tab |
| 616 | ot p_tr |
| 617 | tab |
| 618 | oflags true |
| 619 | tab |
| 620 | ot j_sj |
| 621 | ojhex get et b get et add b 1 |
| 622 | oc 34 |
| 623 | if eq rem e 2 0 |
| 624 | ot j_sp |
| 625 | ojhex get et add b 4 get et add b 5 |
| 626 | oc 34 |
| 627 | end |
| 628 | oc 125 |
| 629 | eol |
| 630 | end |
| 631 | fn gget to void |
| 632 | for e ulong get gv 4 |
| 633 | for v ulong 5 |
| 634 | gone e v |
| 635 | end |
| 636 | if eq rem e 3 0 |
| 637 | gone e 5 |
| 638 | end |
| 639 | if eq rem e 5 0 |
| 640 | trone e |
| 641 | end |
| 642 | end |
| 643 | end |
| 644 | note ---- data file ---- |
| 645 | fn eolat i ulong to ulong |
| 646 | n = get gv 0 |
| 647 | for j ulong sub n i |
| 648 | if eq get db add i j 10 |
| 649 | ret add i j |
| 650 | end |
| 651 | end |
| 652 | ret n |
| 653 | end |
| 654 | fn tabat i ulong e ulong to ulong |
| 655 | for j ulong sub e i |
| 656 | if eq get db add i j 9 |
| 657 | ret add i j |
| 658 | end |
| 659 | end |
| 660 | ret e |
| 661 | end |
| 662 | fn addt s ulong e ulong to bool |
| 663 | k = get gv 3 |
| 664 | if ge mul add k 1 2 len tt |
| 665 | ret false |
| 666 | end |
| 667 | put tt mul k 2 add s 2 |
| 668 | put tt add mul k 2 1 sub e add s 2 |
| 669 | put gv 3 add k 1 |
| 670 | ret true |
| 671 | end |
| 672 | fn adde s ulong e ulong to bool |
| 673 | k = get gv 4 |
| 674 | b = mul k 6 |
| 675 | if ge add b 6 len et |
| 676 | ret false |
| 677 | end |
| 678 | t1 = tabat add s 2 e |
| 679 | t2 = tabat add t1 1 e |
| 680 | if ge t2 e |
| 681 | ret false |
| 682 | end |
| 683 | put et b add s 2 |
| 684 | put et add b 1 sub t1 add s 2 |
| 685 | put et add b 2 add t1 1 |
| 686 | put et add b 3 sub t2 add t1 1 |
| 687 | put et add b 4 add t2 1 |
| 688 | put et add b 5 sub e add t2 1 |
| 689 | put gv 4 add k 1 |
| 690 | ret true |
| 691 | end |
| 692 | fn parse to bool |
| 693 | i = ulong 0 |
| 694 | n = get gv 0 |
| 695 | while lt i n bound 999999 |
| 696 | e = eolat i |
| 697 | if gt e add i 2 |
| 698 | c = get db i |
| 699 | ok = false |
| 700 | if eq c 84 |
| 701 | ok = addt i e |
| 702 | end |
| 703 | if eq c 69 |
| 704 | ok = adde i e |
| 705 | end |
| 706 | if not ok |
| 707 | ret false |
| 708 | end |
| 709 | end |
| 710 | i = add e 1 |
| 711 | end |
| 712 | ret and gt get gv 3 8 gt get gv 4 0 |
| 713 | end |
| 714 | fn main to int |
| 715 | if ne ulong argcnt 3 |
| 716 | say u_use |
| 717 | ret 2 |
| 718 | end |
| 719 | fd = int fopen pa 0 argp 1 524288 0 |
| 720 | if lt fd 0 |
| 721 | say u_open |
| 722 | ret 3 |
| 723 | end |
| 724 | if not rdall fd |
| 725 | ret 3 |
| 726 | end |
| 727 | x = fclose fd |
| 728 | if not parse |
| 729 | say u_big |
| 730 | ret 3 |
| 731 | end |
| 732 | of = int fopen pa 0 argp 2 524865 420 |
| 733 | if lt of 0 |
| 734 | say u_open |
| 735 | ret 3 |
| 736 | end |
| 737 | put gv 1 ulong of |
| 738 | gterm |
| 739 | gops |
| 740 | gmal |
| 741 | gget |
| 742 | flush |
| 743 | y = fclose of |
| 744 | if ne get gv 7 0 |
| 745 | say u_wr |
| 746 | ret 4 |
| 747 | end |
| 748 | ret 0 |
| 749 | end |