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 / apps / interplane-forge / collab / native / issue.om
| 1 | note collab/co5iss.om: issues from the native issue store (GitHub import contract r1 G3; docs/API.md |
| 2 | note forge/issues/1, forge/issue/1). The store is <data>issues/<owner>/<repo>/: an index file of lines |
| 3 | note "<id>\n" (16 lowercase hex) and one folder per issue with title, description, status ("open\n" or |
| 4 | note "closed\n"), labels (one per line), gh (number, login, opened, closed, reason lines), thread and |
| 5 | note source.json for imports, or native metadata for web writes. Nothing here reads Radicle storage. |
| 6 | note A native-comment record holds the author DID and form token before the length. |
| 7 | note A thread is a run of records "<kind> <time> <login> [<state> | <line> <pathlen>] <len>\n" then |
| 8 | note [<path>\n] <body>\n with kind comment, review or review-comment. |
| 9 | note An imported issue names its GitHub author as plain text, "Imported from GitHub <owner>/<repo>#<n>, |
| 10 | note by <login>": never a link, an account of this forge or a DID (G1). |
| 11 | note Prefixes: functions ni*, globals gn*, texts tn*. |
| 12 | text tniwnat "native" |
| 13 | text tniwdid "did " |
| 14 | text tniwncom "native-comment" |
| 15 | text tniss "issues/" |
| 16 | text tnindex "index" |
| 17 | text tnfttl "title" |
| 18 | text tnfdsc "description" |
| 19 | text tnfsts "status" |
| 20 | text tnfgh "gh" |
| 21 | text tnfthr "thread" |
| 22 | text tnflab "labels" |
| 23 | text tnfsrc "source.json" |
| 24 | text tnghn "number " |
| 25 | text tnghl "login " |
| 26 | text tnghop "opened " |
| 27 | text tnghcl "closed " |
| 28 | text tnghre "reason " |
| 29 | text tnjow "\"owner\":\"" |
| 30 | text tnjrp "\"repo\":\"" |
| 31 | text tnrcom "comment" |
| 32 | text tnrrev "review" |
| 33 | text tnrrc "review-comment" |
| 34 | text tnimp1 "Imported from GitHub " |
| 35 | text tnimp2 ", by " |
| 36 | text tnmeta "<p class=\"meta\">" |
| 37 | text tnmetae "</p>\n" |
| 38 | text tnli3 "<p class=\"meta\"><code>#" |
| 39 | text tnli4 "</code> · opened " |
| 40 | text tnli5 " comment" |
| 41 | text tnph1 "<section class=\"rhead\"><h1>" |
| 42 | text tnph2 "</h1>\n" |
| 43 | text tnclo " · closed " |
| 44 | text tnreas " (reason " |
| 45 | text tnlab "Labels: " |
| 46 | text tnbox "<section class=\"box\"><p class=\"meta\">" |
| 47 | text tnwrote " wrote on " |
| 48 | text tnrevd " reviewed (" |
| 49 | text tnrevd2 ") on " |
| 50 | text tnrcon " commented on <code>" |
| 51 | text tnline "</code> line " |
| 52 | text tnon " on " |
| 53 | text tnsece "</section>\n" |
| 54 | text tnnocm "<p class=\"muted\">No comments.</p>\n" |
| 55 | text tnutc " UTC" |
| 56 | text tntiss " - issue - " |
| 57 | text tnmd1 "<article class=\"md\">\n" |
| 58 | text tnmd2 "</article>\n" |
| 59 | text tnpkey "page" |
| 60 | text tnpp "per_page" |
| 61 | text tnnext "next" |
| 62 | text tnprev "prev" |
| 63 | text tnpage "&page=" |
| 64 | text tnpjson "&page=" |
| 65 | text tnnava "<nav aria-label=\"Issue pages\">" |
| 66 | text tnnavz "</nav>\n" |
| 67 | text tnpnext "Next" |
| 68 | text tnpprev "Previous" |
| 69 | const NIPAGE ulong 30 |
| 70 | const NIROWS ulong 262144 |
| 71 | const NILEG ulong 200 |
| 72 | global gnpage ulong 1 |
| 73 | global gnmatch ulong 1 |
| 74 | global gnpaged ulong 1 |
| 75 | note the index of the repository's store (17 bytes per id line) and its count |
| 76 | global gnix uchar 4456448 |
| 77 | global gnn ulong 1 |
| 78 | note one issue's thread file, a small file (title, gh, status, source.json) and its length |
| 79 | global gnth uchar 16777216 |
| 80 | global gnthl ulong 1 |
| 81 | global gnf uchar 65536 |
| 82 | global gnfl ulong 1 |
| 83 | global gngh uchar 65536 |
| 84 | global gnghl ulong 1 |
| 85 | global gnative ulong 1 |
| 86 | note a parsed thread record: kind (1 comment 2 review 3 review comment), time, login, state, line, |
| 87 | note path and body as offsets and lengths into gnth |
| 88 | global gnr ulong 16 |
| 89 | |
| 90 | note ---- paths and reads |
| 91 | fn nipath to void |
| 92 | fpb |
| 93 | fpt tfdata |
| 94 | fpt tniss |
| 95 | fpt tfowner |
| 96 | fpc 47 |
| 97 | r = get fridx 0 |
| 98 | for i ulong get fanl r bound 128 |
| 99 | fpc frnbyte r i |
| 100 | end |
| 101 | fpc 47 |
| 102 | end |
| 103 | fn nipf k ulong t view uchar * to void |
| 104 | nipath |
| 105 | for i ulong 16 |
| 106 | fpc get gnix add mul k 17 i |
| 107 | end |
| 108 | fpc 47 |
| 109 | fpt t |
| 110 | end |
| 111 | note niidx: the ids of the index into gnix (lines that are not 16 lowercase hex and a line feed are |
| 112 | note left out); a missing index is an empty store. false when the index does not fit the table. |
| 113 | fn niidx to bool |
| 114 | put gnn 0 0 |
| 115 | nipath |
| 116 | fpt tnindex |
| 117 | r = frdall |
| 118 | if lt r 0 |
| 119 | ret true |
| 120 | end |
| 121 | if ne get fxotr 0 0 |
| 122 | fincut |
| 123 | ret false |
| 124 | end |
| 125 | n = div ulong r 17 |
| 126 | if gt n 262144 |
| 127 | fincut |
| 128 | ret false |
| 129 | end |
| 130 | m = ulong 0 |
| 131 | for j ulong n bound 262144 |
| 132 | if niidok mul j 17 |
| 133 | nicp mul j 17 mul m 17 |
| 134 | m = add m 1 |
| 135 | end |
| 136 | end |
| 137 | put gnn 0 m |
| 138 | ret true |
| 139 | end |
| 140 | fn nicp a ulong b ulong to void |
| 141 | for i ulong 17 |
| 142 | put gnix add b i get fxo add a i |
| 143 | end |
| 144 | end |
| 145 | fn niidok o ulong to bool |
| 146 | for i ulong 16 |
| 147 | c = get fxo add o i |
| 148 | if not or and ge c 48 le c 57 and ge c 97 le c 102 |
| 149 | ret false |
| 150 | end |
| 151 | end |
| 152 | ret eq get fxo add o 16 10 |
| 153 | end |
| 154 | note nismall k t: the file t of issue k into gnf (at most 65536 bytes are kept); its length |
| 155 | fn nismall k ulong t view uchar * to ulong |
| 156 | put gnfl 0 0 |
| 157 | nipf k t |
| 158 | r = frdall |
| 159 | if lt r 0 |
| 160 | ret 0 |
| 161 | end |
| 162 | n = ulong r |
| 163 | if gt n 65536 |
| 164 | n = ulong 65536 |
| 165 | end |
| 166 | for i ulong n bound 65536 |
| 167 | put gnf i get fxo i |
| 168 | end |
| 169 | put gnfl 0 n |
| 170 | ret n |
| 171 | end |
| 172 | note nistate k: 0 open, 2 closed (the states of costbadge 2) |
| 173 | fn nistate k ulong to ulong |
| 174 | n = nismall k tnfsts |
| 175 | if and eq n 5 eq get gnf 0 111 |
| 176 | ret 0 |
| 177 | end |
| 178 | ret 2 |
| 179 | end |
| 180 | note nigh k: the gh file of issue k into gngh |
| 181 | fn nigh k ulong to void |
| 182 | n = nismall k tniwnat |
| 183 | put gnative 0 0 |
| 184 | if eq n 0 |
| 185 | n = nismall k tnfgh |
| 186 | else |
| 187 | put gnative 0 1 |
| 188 | end |
| 189 | for i ulong n bound 65536 |
| 190 | put gngh i get gnf i |
| 191 | end |
| 192 | put gnghl 0 n |
| 193 | end |
| 194 | note nighv t: the value of the gh line "<t><value>\n": its offset in gngh; its length in gnr 15 |
| 195 | fn nighv t view uchar * to ulong |
| 196 | n = get gnghl 0 |
| 197 | s = ulong 0 |
| 198 | for i ulong n bound 65536 |
| 199 | if eq get gngh i 10 |
| 200 | if nighat s i t |
| 201 | put gnr 15 sub sub i s len t |
| 202 | ret add s len t |
| 203 | end |
| 204 | s = add i 1 |
| 205 | end |
| 206 | end |
| 207 | put gnr 15 0 |
| 208 | ret 0 |
| 209 | end |
| 210 | fn nighat s ulong e ulong t view uchar * to bool |
| 211 | if lt sub e s len t |
| 212 | ret false |
| 213 | end |
| 214 | for i ulong len t bound 16 |
| 215 | if ne get gngh add s i get t i |
| 216 | ret false |
| 217 | end |
| 218 | end |
| 219 | ret true |
| 220 | end |
| 221 | note nighp t: the gh value t, HTML-escaped |
| 222 | fn nighp t view uchar * to void |
| 223 | o = nighv t |
| 224 | for i ulong get gnr 15 bound 65536 |
| 225 | fescc get gngh add o i |
| 226 | end |
| 227 | end |
| 228 | note nijv t: in gnf (a source.json), the string value after t (plain names), HTML-escaped |
| 229 | fn nijv t view uchar * to void |
| 230 | n = get gnfl 0 |
| 231 | for s ulong n bound 65536 |
| 232 | if nijat s t |
| 233 | p = add s len t |
| 234 | while lt p n bound 65536 |
| 235 | c = get gnf p |
| 236 | if eq c 34 |
| 237 | ret |
| 238 | end |
| 239 | fescc c |
| 240 | p = add p 1 |
| 241 | end |
| 242 | ret |
| 243 | end |
| 244 | end |
| 245 | end |
| 246 | fn nijat s ulong t view uchar * to bool |
| 247 | if gt add s len t get gnfl 0 |
| 248 | ret false |
| 249 | end |
| 250 | for i ulong len t bound 16 |
| 251 | if ne get gnf add s i get t i |
| 252 | ret false |
| 253 | end |
| 254 | end |
| 255 | ret true |
| 256 | end |
| 257 | note nithr k: the thread of issue k into gnth; false when it does not fit |
| 258 | fn nithr k ulong to bool |
| 259 | put gnthl 0 0 |
| 260 | nipf k tnfthr |
| 261 | r = frdall |
| 262 | if lt r 0 |
| 263 | ret true |
| 264 | end |
| 265 | if ne get fxotr 0 0 |
| 266 | ret false |
| 267 | end |
| 268 | for i ulong ulong r bound 16777216 |
| 269 | put gnth i get fxo i |
| 270 | end |
| 271 | put gnthl 0 ulong r |
| 272 | ret true |
| 273 | end |
| 274 | |
| 275 | note ---- thread records |
| 276 | global gnbad ulong 1 |
| 277 | global gncur ulong 1 |
| 278 | fn niword a ulong to void |
| 279 | put gnr add a 1 0 |
| 280 | if ne get gnbad 0 0 |
| 281 | ret |
| 282 | end |
| 283 | p = get gncur 0 |
| 284 | n = get gnthl 0 |
| 285 | q = p |
| 286 | while lt q n bound 257 |
| 287 | if le get gnth q 32 |
| 288 | break |
| 289 | end |
| 290 | if ge sub q p 256 |
| 291 | put gnbad 0 1 |
| 292 | ret |
| 293 | end |
| 294 | q = add q 1 |
| 295 | end |
| 296 | if or ge q n eq q p |
| 297 | put gnbad 0 1 |
| 298 | ret |
| 299 | end |
| 300 | if ne get gnth q 32 |
| 301 | put gnbad 0 1 |
| 302 | ret |
| 303 | end |
| 304 | put gnr a p |
| 305 | put gnr add a 1 sub q p |
| 306 | put gncur 0 add q 1 |
| 307 | end |
| 308 | note nidec t: the decimal at gncur (1..18 digits) ended by the byte t; gncur moves past t. gnbad is |
| 309 | note set when it is not one. At most 19 passes: the pass that sees an 19th digit returns. |
| 310 | fn nidec t uchar to ulong |
| 311 | if ne get gnbad 0 0 |
| 312 | ret 0 |
| 313 | end |
| 314 | p = get gncur 0 |
| 315 | n = get gnthl 0 |
| 316 | v = ulong 0 |
| 317 | k = ulong 0 |
| 318 | while lt p n bound 19 |
| 319 | c = get gnth p |
| 320 | if not fisdig c |
| 321 | break |
| 322 | end |
| 323 | if ge k 18 |
| 324 | put gnbad 0 1 |
| 325 | ret 0 |
| 326 | end |
| 327 | v = add mul v 10 ulong sub c 48 |
| 328 | k = add k 1 |
| 329 | p = add p 1 |
| 330 | end |
| 331 | if or eq k 0 ge p n |
| 332 | put gnbad 0 1 |
| 333 | ret 0 |
| 334 | end |
| 335 | if ne get gnth p t |
| 336 | put gnbad 0 1 |
| 337 | ret 0 |
| 338 | end |
| 339 | put gncur 0 add p 1 |
| 340 | ret v |
| 341 | end |
| 342 | note niwordis a t: the word of gnr a, a+1 is t |
| 343 | fn niwordis a ulong t view uchar * to bool |
| 344 | if ne get gnr add a 1 len t |
| 345 | ret false |
| 346 | end |
| 347 | o = get gnr a |
| 348 | for i ulong len t bound 16 |
| 349 | if ne get gnth add o i get t i |
| 350 | ret false |
| 351 | end |
| 352 | end |
| 353 | ret true |
| 354 | end |
| 355 | note nikind: the record kind of the word in gnr 12, 13: 1 comment, 2 review, 3 review-comment, else 0 |
| 356 | fn nikind to ulong |
| 357 | if niwordis 12 tnrcom |
| 358 | ret 1 |
| 359 | end |
| 360 | if niwordis 12 tniwncom |
| 361 | ret 4 |
| 362 | end |
| 363 | if niwordis 12 tnrrev |
| 364 | ret 2 |
| 365 | end |
| 366 | if niwordis 12 tnrrc |
| 367 | ret 3 |
| 368 | end |
| 369 | ret 0 |
| 370 | end |
| 371 | note nitok: the time word (gnr 1, 2) is 20 bytes or "-" |
| 372 | fn nitok to bool |
| 373 | k = get gnr 2 |
| 374 | if eq k 20 |
| 375 | ret true |
| 376 | end |
| 377 | if ne k 1 |
| 378 | ret false |
| 379 | end |
| 380 | ret eq get gnth get gnr 1 45 |
| 381 | end |
| 382 | note nirec p: parse the record at p into gnr (0 kind, 1-2 time, 3-4 login, 5-6 state, 7 line, 8-9 |
| 383 | note path, 10-11 body); the index after it. A malformed record leaves kind 0 and returns the thread's |
| 384 | note length, which stops the caller: every length is checked against the thread before the bytes it |
| 385 | note names are read (a path is at most 4096 bytes). |
| 386 | fn nirec p ulong to ulong |
| 387 | n = get gnthl 0 |
| 388 | put gnr 0 0 |
| 389 | put gnr 6 0 |
| 390 | put gnr 7 0 |
| 391 | put gnr 9 0 |
| 392 | put gnbad 0 0 |
| 393 | put gncur 0 p |
| 394 | niword 12 |
| 395 | k = nikind |
| 396 | if eq k 0 |
| 397 | ret n |
| 398 | end |
| 399 | niword 1 |
| 400 | niword 3 |
| 401 | if or eq k 2 eq k 4 |
| 402 | niword 5 |
| 403 | end |
| 404 | if eq k 3 |
| 405 | put gnr 7 nidec 32 |
| 406 | put gnr 9 nidec 32 |
| 407 | end |
| 408 | b = nidec 10 |
| 409 | if ne get gnbad 0 0 |
| 410 | ret n |
| 411 | end |
| 412 | if not nitok |
| 413 | ret n |
| 414 | end |
| 415 | q = get gncur 0 |
| 416 | if eq k 3 |
| 417 | m = get gnr 9 |
| 418 | if or gt m 4096 ge add q m n |
| 419 | ret n |
| 420 | end |
| 421 | if ne get gnth add q m 10 |
| 422 | ret n |
| 423 | end |
| 424 | put gnr 8 q |
| 425 | q = add add q m 1 |
| 426 | end |
| 427 | if ge add q b n |
| 428 | ret n |
| 429 | end |
| 430 | if ne get gnth add q b 10 |
| 431 | ret n |
| 432 | end |
| 433 | put gnr 10 q |
| 434 | put gnr 11 b |
| 435 | put gnr 0 k |
| 436 | ret add add q b 1 |
| 437 | end |
| 438 | note nicount: the records of the loaded thread |
| 439 | fn nicount to ulong |
| 440 | p = ulong 0 |
| 441 | c = ulong 0 |
| 442 | n = get gnthl 0 |
| 443 | while lt p n bound 16777216 |
| 444 | p = nirec p |
| 445 | if ne get gnr 0 0 |
| 446 | c = add c 1 |
| 447 | end |
| 448 | end |
| 449 | ret c |
| 450 | end |
| 451 | note nitime o: the ISO time gnth[o, o+20) as YYYY-MM-DD HH:MM UTC |
| 452 | fn nitime o ulong to void |
| 453 | for i ulong 10 |
| 454 | fescc get gnth add o i |
| 455 | end |
| 456 | fputc 32 |
| 457 | for i ulong 5 |
| 458 | fescc get gnth add add o 11 i |
| 459 | end |
| 460 | fput tnutc |
| 461 | end |
| 462 | note nighte t: the gh time value t as YYYY-MM-DD HH:MM UTC ("-" stays "-") |
| 463 | fn nighte t view uchar * to void |
| 464 | o = nighv t |
| 465 | if ne get gnr 15 20 |
| 466 | fputc 45 |
| 467 | ret |
| 468 | end |
| 469 | for i ulong 10 |
| 470 | fescc get gngh add o i |
| 471 | end |
| 472 | fputc 32 |
| 473 | for i ulong 5 |
| 474 | fescc get gngh add add o 11 i |
| 475 | end |
| 476 | fput tnutc |
| 477 | end |
| 478 | |
| 479 | note ---- the provenance line: Imported from GitHub <owner>/<repo>#<n>, by <login> (plain text) |
| 480 | fn niprov k ulong to void |
| 481 | x = nismall k tnfsrc |
| 482 | fput tnimp1 |
| 483 | nijv tnjow |
| 484 | fputc 47 |
| 485 | nijv tnjrp |
| 486 | fputc 35 |
| 487 | nighp tnghn |
| 488 | fput tnimp2 |
| 489 | nighp tnghl |
| 490 | end |
| 491 | fn niwho to void |
| 492 | if eq get gnative 0 1 |
| 493 | nighp tniwdid |
| 494 | else |
| 495 | nighp tnghl |
| 496 | end |
| 497 | end |
| 498 | fn niorigin k ulong to void |
| 499 | if eq get gnative 0 1 |
| 500 | niwho |
| 501 | else |
| 502 | niprov k |
| 503 | end |
| 504 | end |
| 505 | note niref: the request's id prefix (gcrq, 4..16 hex) names exactly one issue: its index, else gnn |
| 506 | fn niref to ulong |
| 507 | n = get gnn 0 |
| 508 | q = get gcrql 0 |
| 509 | if gt q 16 |
| 510 | ret n |
| 511 | end |
| 512 | w = n |
| 513 | c = ulong 0 |
| 514 | for k ulong n bound 262144 |
| 515 | if nipre k q |
| 516 | w = k |
| 517 | c = add c 1 |
| 518 | end |
| 519 | end |
| 520 | if ne c 1 |
| 521 | ret n |
| 522 | end |
| 523 | ret w |
| 524 | end |
| 525 | fn nipre k ulong q ulong to bool |
| 526 | for i ulong q bound 16 |
| 527 | if ne get gnix add mul k 17 i get gcrq i |
| 528 | ret false |
| 529 | end |
| 530 | end |
| 531 | ret true |
| 532 | end |
| 533 | fn nilink k ulong to void |
| 534 | fputrl |
| 535 | fput tcissp |
| 536 | for i ulong 16 |
| 537 | fputc get gnix add mul k 17 i |
| 538 | end |
| 539 | end |
| 540 | |
| 541 | note ---- the list page |
| 542 | note nifilt: the ?state= filter (0 open, 2 closed, 9 all; anything else open) and the tab counts in |
| 543 | note gccnt and gcsn (cotabs reads them) |
| 544 | fn nifilt to ulong |
| 545 | f = coqstate 2 |
| 546 | if and ne f 2 ne f 9 |
| 547 | f = ulong 0 |
| 548 | end |
| 549 | for s ulong 8 |
| 550 | put gccnt s 0 |
| 551 | end |
| 552 | for k ulong get gnn 0 bound 262144 |
| 553 | s = nistate k |
| 554 | put gccnt s add get gccnt s 1 |
| 555 | end |
| 556 | put gcsn 0 get gnn 0 |
| 557 | put gcm 9 2 |
| 558 | ret f |
| 559 | end |
| 560 | note Keep list thread reads to one page. The status scan also supplies the filter counts. |
| 561 | fn nipagen f ulong to void |
| 562 | n = fqget tnpkey |
| 563 | put gnpaged 0 0 |
| 564 | if ge n 0 |
| 565 | put gnpaged 0 1 |
| 566 | end |
| 567 | v = ulong 0 |
| 568 | if and gt n 0 le n 6 |
| 569 | for i ulong ulong n bound 6 |
| 570 | c = get fval i |
| 571 | if not fisdig c |
| 572 | v = ulong 0 |
| 573 | break |
| 574 | end |
| 575 | v = add mul v 10 ulong sub c 48 |
| 576 | end |
| 577 | end |
| 578 | if eq v 0 |
| 579 | v = ulong 1 |
| 580 | end |
| 581 | put gnpage 0 v |
| 582 | put gnmatch 0 cotabnval f |
| 583 | end |
| 584 | fn cotabnval s ulong to ulong |
| 585 | if eq s 9 |
| 586 | ret get gcsn 0 |
| 587 | end |
| 588 | ret get gccnt s |
| 589 | end |
| 590 | fn nipageurl f ulong p ulong html bool to void |
| 591 | fputrl |
| 592 | fput tcisss |
| 593 | fput tcstq |
| 594 | cojsv 2 f |
| 595 | if html |
| 596 | fput tnpage |
| 597 | else |
| 598 | fput tnpjson |
| 599 | end |
| 600 | fnum p |
| 601 | end |
| 602 | fn nilnav f ulong to void |
| 603 | p = get gnpage 0 |
| 604 | if and eq p 1 le get gnmatch 0 NIPAGE |
| 605 | ret |
| 606 | end |
| 607 | fput tnnava |
| 608 | if gt p 1 |
| 609 | fput tcah |
| 610 | nipageurl f sub p 1 true |
| 611 | fput tcqg |
| 612 | fput tnpprev |
| 613 | fput tcae |
| 614 | cosp |
| 615 | end |
| 616 | if gt get gnmatch 0 mul p NIPAGE |
| 617 | fput tcah |
| 618 | nipageurl f add p 1 true |
| 619 | fput tcqg |
| 620 | fput tnpnext |
| 621 | fput tcae |
| 622 | end |
| 623 | fput tnnavz |
| 624 | end |
| 625 | fn nilist to long |
| 626 | if not niidx |
| 627 | ret 500 |
| 628 | end |
| 629 | f = nifilt |
| 630 | nipagen f |
| 631 | fsetti tciss |
| 632 | frepohd 6 |
| 633 | ftic 32 |
| 634 | ftirepo |
| 635 | fput tclh1 |
| 636 | costname 2 f |
| 637 | fput tclh2 |
| 638 | cotabs 2 f |
| 639 | fput tclh3 |
| 640 | niwlink |
| 641 | m = ulong 0 |
| 642 | fput tclul |
| 643 | skip = mul sub get gnpage 0 1 NIPAGE |
| 644 | for j ulong get gnn 0 bound 262144 |
| 645 | k = sub sub get gnn 0 1 j |
| 646 | s = nistate k |
| 647 | if or eq f 9 eq f s |
| 648 | if ge m skip |
| 649 | if not nirow k s |
| 650 | ret 500 |
| 651 | end |
| 652 | end |
| 653 | m = add m 1 |
| 654 | if eq m add skip NIPAGE |
| 655 | break |
| 656 | end |
| 657 | end |
| 658 | end |
| 659 | fput tcluln |
| 660 | if le m skip |
| 661 | fput tclnone |
| 662 | end |
| 663 | nilnav f |
| 664 | ret 200 |
| 665 | end |
| 666 | fn nirow k ulong s ulong to bool |
| 667 | fput tcli1 |
| 668 | nilink k |
| 669 | fput tcqg |
| 670 | n = nismall k tnfttl |
| 671 | if eq n 0 |
| 672 | fput tcnot |
| 673 | end |
| 674 | for i ulong n bound 65536 |
| 675 | fescc get gnf i |
| 676 | end |
| 677 | fput tcli2 |
| 678 | costbadge 2 s |
| 679 | nigh k |
| 680 | if eq get gnative 0 0 |
| 681 | fput tnli3 |
| 682 | nighp tnghn |
| 683 | fput tnli4 |
| 684 | nighte tnghop |
| 685 | else |
| 686 | fput tnmeta |
| 687 | fput tcopen |
| 688 | cosp |
| 689 | nighte tnghop |
| 690 | end |
| 691 | fput tcmidd |
| 692 | if not nithr k |
| 693 | ret false |
| 694 | end |
| 695 | c = nicount |
| 696 | fnum c |
| 697 | fput tnli5 |
| 698 | if ne c 1 |
| 699 | fputc 115 |
| 700 | end |
| 701 | fput tcli7 |
| 702 | fput tnmeta |
| 703 | niorigin k |
| 704 | fput tnmetae |
| 705 | fput tcli10 |
| 706 | ret true |
| 707 | end |
| 708 | |
| 709 | note ---- one issue page |
| 710 | fn nipage to long |
| 711 | if not niidx |
| 712 | ret 500 |
| 713 | end |
| 714 | k = niref |
| 715 | if ge k get gnn 0 |
| 716 | ret 404 |
| 717 | end |
| 718 | s = nistate k |
| 719 | n = nismall k tnfttl |
| 720 | put ftil 0 0 |
| 721 | for i ulong hmin n 256 bound 256 |
| 722 | ftic get gnf i |
| 723 | end |
| 724 | for i ulong len tntiss |
| 725 | ftic get tntiss i |
| 726 | end |
| 727 | ftirepo |
| 728 | frepohd 6 |
| 729 | fput tnph1 |
| 730 | if eq n 0 |
| 731 | fput tcnot |
| 732 | end |
| 733 | for i ulong n bound 65536 |
| 734 | fescc get gnf i |
| 735 | end |
| 736 | fput tnph2 |
| 737 | nigh k |
| 738 | fput tnmeta |
| 739 | costbadge 2 s |
| 740 | fput tcmidd |
| 741 | if eq get gnative 0 0 |
| 742 | fputc 35 |
| 743 | nighp tnghn |
| 744 | fput tcmidd |
| 745 | end |
| 746 | fput tcopen |
| 747 | cosp |
| 748 | nighte tnghop |
| 749 | if eq s 2 |
| 750 | fput tnclo |
| 751 | nighte tnghcl |
| 752 | x = nighv tnghre |
| 753 | if gt get gnr 15 1 |
| 754 | fput tnreas |
| 755 | nighp tnghre |
| 756 | fputc 41 |
| 757 | end |
| 758 | end |
| 759 | fput tnmetae |
| 760 | fput tnmeta |
| 761 | niorigin k |
| 762 | fput tnmetae |
| 763 | nilabs k |
| 764 | fput tnsece |
| 765 | if not nibody k |
| 766 | ret 500 |
| 767 | end |
| 768 | if not nithr k |
| 769 | ret 500 |
| 770 | end |
| 771 | nicoms |
| 772 | niwform k false |
| 773 | ret 200 |
| 774 | end |
| 775 | fn nilabs k ulong to void |
| 776 | n = nismall k tnflab |
| 777 | if eq n 0 |
| 778 | ret |
| 779 | end |
| 780 | fput tnmeta |
| 781 | fput tnlab |
| 782 | for i ulong n bound 65536 |
| 783 | c = get gnf i |
| 784 | if eq c 10 |
| 785 | if lt add i 1 n |
| 786 | fputc 44 |
| 787 | fputc 32 |
| 788 | end |
| 789 | else |
| 790 | fescc c |
| 791 | end |
| 792 | end |
| 793 | fput tnmetae |
| 794 | end |
| 795 | note nibody k: the description as Markdown (the default branch for relative links) |
| 796 | fn nibody k ulong to bool |
| 797 | nipf k tnfdsc |
| 798 | r = frdall |
| 799 | if le r 0 |
| 800 | ret true |
| 801 | end |
| 802 | if ne get fxotr 0 0 |
| 803 | ret false |
| 804 | end |
| 805 | codrefb |
| 806 | fput tnbox |
| 807 | niwho |
| 808 | fput tnwrote |
| 809 | nighte tnghop |
| 810 | fput tnmetae |
| 811 | put gbmdl 0 0 |
| 812 | fput tnmd1 |
| 813 | brmd 0 ulong r |
| 814 | fput tnmd2 |
| 815 | fput tnsece |
| 816 | ret true |
| 817 | end |
| 818 | fn nicoms to void |
| 819 | p = ulong 0 |
| 820 | c = ulong 0 |
| 821 | n = get gnthl 0 |
| 822 | while lt p n bound 16777216 |
| 823 | p = nirec p |
| 824 | if ne get gnr 0 0 |
| 825 | nicom |
| 826 | c = add c 1 |
| 827 | end |
| 828 | end |
| 829 | if eq c 0 |
| 830 | fput tnnocm |
| 831 | end |
| 832 | end |
| 833 | note nicom: the parsed record (gnr) as a comment box; the login is text, the body Markdown |
| 834 | fn nicom to void |
| 835 | k = get gnr 0 |
| 836 | fput tnbox |
| 837 | niraw 3 |
| 838 | if or eq k 1 eq k 4 |
| 839 | fput tnwrote |
| 840 | end |
| 841 | if eq k 2 |
| 842 | fput tnrevd |
| 843 | niraw 5 |
| 844 | fput tnrevd2 |
| 845 | end |
| 846 | if eq k 3 |
| 847 | fput tnrcon |
| 848 | niraw 8 |
| 849 | fput tnline |
| 850 | fnum get gnr 7 |
| 851 | fput tnon |
| 852 | end |
| 853 | if eq get gnr 2 20 |
| 854 | nitime get gnr 1 |
| 855 | else |
| 856 | fputc 45 |
| 857 | end |
| 858 | fput tnmetae |
| 859 | o = get gnr 10 |
| 860 | b = get gnr 11 |
| 861 | if gt b 0 |
| 862 | for i ulong b bound 16777216 |
| 863 | put fxo i get gnth add o i |
| 864 | end |
| 865 | put gbmdl 0 0 |
| 866 | fput tnmd1 |
| 867 | brmd 0 b |
| 868 | fput tnmd2 |
| 869 | end |
| 870 | fput tnsece |
| 871 | end |
| 872 | note niraw a: the bytes gnth[gnr a, + gnr a+1), HTML-escaped |
| 873 | fn niraw a ulong to void |
| 874 | o = get gnr a |
| 875 | for i ulong get gnr add a 1 bound 16777216 |
| 876 | fescc get gnth add o i |
| 877 | end |
| 878 | end |