aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / om / site / site.om
| 1 | note Whole-site orchestrator. Compose after runtime/json/chrome/content/copy/markdown/seo. |
| 2 | note Metadata is copied once before any renderer can replace the JSON arena. |
| 3 | |
| 4 | fn st_fail message view uchar * to void |
| 5 | sr_fail message |
| 6 | end |
| 7 | |
| 8 | fn st_append dst edit uchar * src view uchar * pos ulong to ulong |
| 9 | if gt len src sub len dst pos |
| 10 | trap 3 |
| 11 | end |
| 12 | for i ulong len src |
| 13 | put dst add pos i get src i |
| 14 | end |
| 15 | ret add pos len src |
| 16 | end |
| 17 | |
| 18 | fn st_store node ulong key view uchar * slot ulong to void |
| 19 | buf = new uchar 4096 0 |
| 20 | fnode = sj_find node key |
| 21 | if eq fnode 0 |
| 22 | trap 10 |
| 23 | end |
| 24 | n = sj_string fnode buf |
| 25 | p = get stused 0 |
| 26 | if gt n sub len stpool p |
| 27 | trap 3 |
| 28 | end |
| 29 | put stoff slot p |
| 30 | put stlens slot n |
| 31 | for i ulong n |
| 32 | put stpool add p i get buf i |
| 33 | end |
| 34 | put stused 0 add p n |
| 35 | end |
| 36 | |
| 37 | fn st_row node ulong to void |
| 38 | row = get stcount 0 |
| 39 | if ge row STCAP |
| 40 | trap 3 |
| 41 | end |
| 42 | base = mul row STFIELDS |
| 43 | st_store node stk0 base |
| 44 | st_store node stk1 add base 1 |
| 45 | st_store node stk2 add base 2 |
| 46 | st_store node stk3 add base 3 |
| 47 | st_store node stk4 add base 4 |
| 48 | st_store node stk5 add base 5 |
| 49 | st_store node stk6 add base 6 |
| 50 | st_store node stk7 add base 7 |
| 51 | st_store node stk8 add base 8 |
| 52 | st_store node stk9 add base 9 |
| 53 | st_store node stk10 add base 10 |
| 54 | put stcount 0 add row 1 |
| 55 | end |
| 56 | |
| 57 | fn st_registry path view uchar * to void |
| 58 | root = sj_load path |
| 59 | if ne sj_kind root 2 |
| 60 | trap 10 |
| 61 | end |
| 62 | if eq sj_len root 0 |
| 63 | trap 10 |
| 64 | end |
| 65 | node = sj_first root |
| 66 | while ne node 0 bound 128 |
| 67 | st_row node |
| 68 | node = sj_next node |
| 69 | end |
| 70 | end |
| 71 | |
| 72 | fn st_field row ulong col ulong dst edit uchar * to ulong |
| 73 | slot = add mul row STFIELDS col |
| 74 | n = get stlens slot |
| 75 | if gt n len dst |
| 76 | trap 3 |
| 77 | end |
| 78 | p = get stoff slot |
| 79 | for i ulong n |
| 80 | put dst i get stpool add p i |
| 81 | end |
| 82 | ret n |
| 83 | end |
| 84 | |
| 85 | fn st_match row ulong col ulong value view uchar * to bool |
| 86 | slot = add mul row STFIELDS col |
| 87 | if ne get stlens slot len value |
| 88 | ret false |
| 89 | end |
| 90 | p = get stoff slot |
| 91 | for i ulong len value |
| 92 | if ne get stpool add p i get value i |
| 93 | ret false |
| 94 | end |
| 95 | end |
| 96 | ret true |
| 97 | end |
| 98 | |
| 99 | fn st_emit row ulong col ulong escaped bool to void |
| 100 | buf = new uchar 4096 0 |
| 101 | n = st_field row col buf |
| 102 | if escaped |
| 103 | sr_esc part buf 0 n |
| 104 | else |
| 105 | sr_raw part buf 0 n |
| 106 | end |
| 107 | end |
| 108 | |
| 109 | fn st_path suffix view uchar * dst edit uchar * to ulong |
| 110 | n = get stoutn 0 |
| 111 | if ge n len dst |
| 112 | trap 3 |
| 113 | end |
| 114 | for i ulong n |
| 115 | put dst i get stout i |
| 116 | end |
| 117 | if eq len suffix 0 |
| 118 | ret n |
| 119 | end |
| 120 | if ne get suffix 0 47 |
| 121 | put dst n 47 |
| 122 | n = add n 1 |
| 123 | end |
| 124 | ret st_append dst suffix n |
| 125 | end |
| 126 | |
| 127 | fn st_open suffix view uchar * to void |
| 128 | buf = new uchar 8192 0 |
| 129 | n = st_path suffix buf |
| 130 | sr_open part buf 0 n |
| 131 | end |
| 132 | |
| 133 | fn st_copy src view uchar * dest view uchar * to void |
| 134 | buf = new uchar 8192 0 |
| 135 | n = st_path dest buf |
| 136 | sr_copy src part buf 0 n |
| 137 | end |
| 138 | |
| 139 | fn st_stamp to void |
| 140 | buf = new uchar 64 0 |
| 141 | n = get stdaten 0 |
| 142 | for i ulong n |
| 143 | put buf i get stdate i |
| 144 | end |
| 145 | sr_raw part buf 0 n |
| 146 | end |
| 147 | |
| 148 | fn st_route_ok row ulong to void |
| 149 | buf = new uchar 512 0 |
| 150 | for fieldno ulong 4 |
| 151 | if eq get stlens add mul row STFIELDS fieldno 0 |
| 152 | trap 10 |
| 153 | end |
| 154 | end |
| 155 | if ne get stlens add mul row STFIELDS 7 10 |
| 156 | trap 10 |
| 157 | end |
| 158 | n = st_field row 0 buf |
| 159 | if eq n 0 |
| 160 | trap 10 |
| 161 | end |
| 162 | if ne get buf 0 47 |
| 163 | trap 10 |
| 164 | end |
| 165 | if ne get buf sub n 1 47 |
| 166 | trap 10 |
| 167 | end |
| 168 | for i ulong n |
| 169 | c = get buf i |
| 170 | if eq c 47 |
| 171 | if gt i 0 |
| 172 | if eq get buf sub i 1 47 |
| 173 | trap 10 |
| 174 | end |
| 175 | end |
| 176 | else |
| 177 | if not or or and ge c 97 le c 122 and ge c 48 le c 57 eq c 45 |
| 178 | trap 10 |
| 179 | end |
| 180 | end |
| 181 | end |
| 182 | for j ulong row |
| 183 | if st_match j 0 part buf 0 n |
| 184 | trap 10 |
| 185 | end |
| 186 | end |
| 187 | end |
| 188 | |
| 189 | fn st_html_path row ulong dst edit uchar * to ulong |
| 190 | n = st_field row 0 dst |
| 191 | ret st_append dst stindex n |
| 192 | end |
| 193 | |
| 194 | note /aienet/: the hello form stays paused until its browser gates pass (as main's agora.rs). |
| 195 | note Each target must occur exactly once, in order; a miss stops the build instead of publishing a live form. |
| 196 | text snroute "/aienet/" |
| 197 | text snform "<form id=\"aienet-form\" class=\"hub-card\">" |
| 198 | text snformp "<p id=\"aienet-paused\" role=\"status\">The hello form is paused until browser testing is done, so profiles can't be registered from this page yet.</p><form id=\"aienet-form\" class=\"hub-card\" inert>" |
| 199 | text snsub "<button id=\"aienet-submit\" type=\"submit\">" |
| 200 | text snsubp "<button id=\"aienet-submit\" type=\"submit\" disabled>" |
| 201 | text snrec "<button id=\"aienet-recheck\" type=\"button\">" |
| 202 | text snrecp "<button id=\"aienet-recheck\" type=\"button\" disabled>" |
| 203 | text snapi "/agora/api/" |
| 204 | text SN0001 "aienet pause missed its target in om/agora-page/aienet.html" |
| 205 | text SN0002 "paused /aienet/ page names /agora/api/" |
| 206 | text SN0003 "aienet.html is larger than one copy block" |
| 207 | |
| 208 | fn sn_copy from ulong upto ulong to void |
| 209 | if gt sub upto from 999000 |
| 210 | st_fail SN0003 |
| 211 | end |
| 212 | for i ulong sub upto from |
| 213 | sr_byte get shbuf add from i |
| 214 | end |
| 215 | end |
| 216 | |
| 217 | fn sn_one from ulong pat view uchar * rep view uchar * to ulong |
| 218 | p = sh_find pat 0 |
| 219 | if or eq p get shlen 0 lt p from |
| 220 | st_fail SN0001 |
| 221 | end |
| 222 | if ne sh_find pat add p 1 get shlen 0 |
| 223 | st_fail SN0001 |
| 224 | end |
| 225 | sn_copy from p |
| 226 | sr_raw rep |
| 227 | ret add p len pat |
| 228 | end |
| 229 | |
| 230 | fn sn_aienet src view uchar * to void |
| 231 | sh_load src |
| 232 | if ne sh_find snapi 0 get shlen 0 |
| 233 | st_fail SN0002 |
| 234 | end |
| 235 | p = sn_one 0 snform snformp |
| 236 | p = sn_one p snsub snsubp |
| 237 | p = sn_one p snrec snrecp |
| 238 | sn_copy p get shlen 0 |
| 239 | end |
| 240 | |
| 241 | fn st_page_body row ulong route view uchar * to void |
| 242 | src = new uchar 4096 0 |
| 243 | n = st_field row 5 src |
| 244 | if st_match row 4 stfront |
| 245 | door_home |
| 246 | sh_allen_home part src 0 n |
| 247 | sr_raw stnoscr |
| 248 | ret |
| 249 | end |
| 250 | if st_match row 4 sthtml |
| 251 | if st_match row 0 rdroute |
| 252 | rd_body part src 0 n |
| 253 | ret |
| 254 | end |
| 255 | sh_body part src 0 n |
| 256 | ret |
| 257 | end |
| 258 | if st_match row 4 startif |
| 259 | if st_match row 0 snroute |
| 260 | sn_aienet part src 0 n |
| 261 | ret |
| 262 | end |
| 263 | sr_file part src 0 n |
| 264 | ret |
| 265 | end |
| 266 | if st_match row 4 stprof |
| 267 | ss_profiles |
| 268 | ret |
| 269 | end |
| 270 | if st_match row 4 stemode |
| 271 | if not se_page route |
| 272 | st_fail ST0001 |
| 273 | end |
| 274 | ret |
| 275 | end |
| 276 | if not st_match row 4 strender |
| 277 | trap 10 |
| 278 | end |
| 279 | if sm_page route |
| 280 | ret |
| 281 | end |
| 282 | if sp_page route |
| 283 | ret |
| 284 | end |
| 285 | if sd_page route |
| 286 | ret |
| 287 | end |
| 288 | if ag_page route |
| 289 | ret |
| 290 | end |
| 291 | st_fail ST0001 |
| 292 | end |
| 293 | |
| 294 | fn st_page row ulong to void |
| 295 | route = new uchar 512 0 |
| 296 | titlebuf = new uchar 4096 0 |
| 297 | descbuf = new uchar 4096 0 |
| 298 | areabuf = new uchar 32 0 |
| 299 | rn = st_field row 0 route |
| 300 | tn = st_field row 1 titlebuf |
| 301 | dn = st_field row 2 descbuf |
| 302 | an = st_field row 3 areabuf |
| 303 | st_popen row |
| 304 | sc_begin part titlebuf 0 tn part descbuf 0 dn |
| 305 | sc_route part route 0 rn part areabuf 0 an |
| 306 | st_page_body row part route 0 rn |
| 307 | sc_end |
| 308 | sr_close |
| 309 | end |
| 310 | |
| 311 | note st_popen: the page's output file (split out of st_page for registers). |
| 312 | fn st_popen row ulong to void |
| 313 | filebuf = new uchar 1024 0 |
| 314 | fnn = st_html_path row filebuf |
| 315 | st_open part filebuf 0 fnn |
| 316 | end |
| 317 | |
| 318 | fn st_export to void |
| 319 | st_copy ST0002 stfacts |
| 320 | st_copy ST0003 ST0004 |
| 321 | st_copy ST0005 ST0006 |
| 322 | st_copy ST0007 ST0008 |
| 323 | st_copy ST0009 ST0010 |
| 324 | st_copy ST0011 ST0012 |
| 325 | st_copy ST0013 stagents |
| 326 | st_open ST0014 |
| 327 | ss_page_registry |
| 328 | sr_close |
| 329 | end |
| 330 | |
| 331 | fn st_assets to void |
| 332 | css_repairs |
| 333 | st_open stdoor |
| 334 | door_css |
| 335 | sr_close |
| 336 | st_open ST0017 |
| 337 | css_tokens |
| 338 | sr_close |
| 339 | st_open ST0015 |
| 340 | css_emit |
| 341 | sr_close |
| 342 | st_open ST0016 |
| 343 | client_emit |
| 344 | sr_close |
| 345 | end |
| 346 | |
| 347 | fn st_args to void |
| 348 | src = new uchar 4096 0 |
| 349 | outbuf = new uchar 4096 0 |
| 350 | datebuf = new uchar 64 0 |
| 351 | if ne argcnt 4 |
| 352 | st_fail ST0018 |
| 353 | end |
| 354 | sn = argread 1 src 0 len src |
| 355 | on = argread 2 outbuf 0 len outbuf |
| 356 | dn = argread 3 datebuf 0 len datebuf |
| 357 | if or or le sn 0 le on 1 le dn 0 |
| 358 | trap 10 |
| 359 | end |
| 360 | if ne get outbuf 0 47 |
| 361 | st_fail ST0019 |
| 362 | end |
| 363 | existing = faccess outbuf 0 ulong on 0 |
| 364 | if eq existing 0 |
| 365 | st_fail ST0020 |
| 366 | end |
| 367 | if ne existing -2 |
| 368 | trap 10 |
| 369 | end |
| 370 | n = ulong on |
| 371 | if eq get outbuf sub n 1 47 |
| 372 | n = sub n 1 |
| 373 | end |
| 374 | for i ulong n |
| 375 | put stout i get outbuf i |
| 376 | end |
| 377 | put stoutn 0 n |
| 378 | sf_safe part datebuf 0 ulong dn |
| 379 | for j ulong ulong dn |
| 380 | put stdate j get datebuf j |
| 381 | end |
| 382 | put stdaten 0 ulong dn |
| 383 | r = chdir src 0 ulong sn |
| 384 | if ne r 0 |
| 385 | st_fail ST0021 |
| 386 | end |
| 387 | end |
| 388 | |
| 389 | note Navigation projection runs after rendering, before CSP finalization. Source artifacts and examples remain unchanged. |
| 390 | fn st_project_links row ulong to void |
| 391 | suffix = new uchar 1024 0 |
| 392 | full = new uchar 8192 0 |
| 393 | sn = st_html_path row suffix |
| 394 | pn = st_path part suffix 0 sn full |
| 395 | sh_load part full 0 pn |
| 396 | st_open part suffix 0 sn |
| 397 | p = ulong 0 |
| 398 | start = ulong 0 |
| 399 | while lt p get shlen 0 bound 4194304 |
| 400 | if sh_at ghaopen p |
| 401 | sh_range start p |
| 402 | next = gxanchor p |
| 403 | if gt next p |
| 404 | p = next |
| 405 | start = p |
| 406 | continue |
| 407 | end |
| 408 | start = p |
| 409 | end |
| 410 | if gh_probe p |
| 411 | sh_range start p |
| 412 | p = gh_emit p |
| 413 | start = p |
| 414 | else |
| 415 | p = add p 1 |
| 416 | end |
| 417 | end |
| 418 | sh_range start get shlen 0 |
| 419 | sr_close |
| 420 | end |
| 421 | |
| 422 | fn main to int |
| 423 | st_args |
| 424 | st_registry streg |
| 425 | st_engineer_registry |
| 426 | sf_load |
| 427 | for i ulong get stcount 0 |
| 428 | st_route_ok i |
| 429 | end |
| 430 | sp_ledger_check |
| 431 | sx_tree stpub 0 |
| 432 | st_export |
| 433 | sa_emit |
| 434 | st_assets |
| 435 | for j ulong get stcount 0 |
| 436 | st_page j |
| 437 | end |
| 438 | sk_runner |
| 439 | ss_surfaces |
| 440 | for j ulong get stcount 0 |
| 441 | st_project_links j |
| 442 | end |
| 443 | sk_all |
| 444 | ret 0 |
| 445 | end |