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 / si / mcp / src / rpc.om
| 1 | note omega-mcp: JSON-RPC 2.0 over newline-delimited stdio (MCP stdio transport). One request per |
| 2 | note line; a line without an id is a notification and gets no reply. Arrays live in fn main's frame: |
| 3 | note ib (input bytes), tape (request tokens), ob (reply writer), ds/dt (reference data and its tokens). |
| 4 | |
| 5 | const jrparse long -32700 |
| 6 | const jrinv long -32600 |
| 7 | const jrmeth long -32601 |
| 8 | const jrpar long -32602 |
| 9 | const jrint long -32603 |
| 10 | |
| 11 | text kjv "2.0" |
| 12 | text m_init "initialize" |
| 13 | text m_ping "ping" |
| 14 | text m_list "tools/list" |
| 15 | text m_call "tools/call" |
| 16 | text k_jrpc "jsonrpc" |
| 17 | text k_id "id" |
| 18 | text k_method "method" |
| 19 | text k_params "params" |
| 20 | text k_result "result" |
| 21 | text k_error "error" |
| 22 | text k_code "code" |
| 23 | text k_msg "message" |
| 24 | text k_pv "protocolVersion" |
| 25 | text k_caps "capabilities" |
| 26 | text k_tools "tools" |
| 27 | text k_lc "listChanged" |
| 28 | text k_si "serverInfo" |
| 29 | text k_name "name" |
| 30 | text k_ver "version" |
| 31 | text k_instr "instructions" |
| 32 | text k_args "arguments" |
| 33 | text k_cont "content" |
| 34 | text k_type "type" |
| 35 | text k_text "text" |
| 36 | text k_sc "structuredContent" |
| 37 | text k_iserr "isError" |
| 38 | text v_pv1 "2025-06-18" |
| 39 | text v_pv2 "2025-03-26" |
| 40 | text v_pv3 "2024-11-05" |
| 41 | note v_in1 kmv v_in2 kpin v_in3 kmv v_in4: the instructions string (winstr) |
| 42 | text v_in1 "Compile and run Omega (.om) programs with the pinned seeded compiler omc (omega-mv " |
| 43 | text v_in2 ", omc sha256 " |
| 44 | text v_in3 "). Tools: compile, run (each call gets a fresh sandbox: no network, no host files, cleared environment, cpu/memory/file-size/process limits and a wall clock), explain_error (compiler error 1..30, an `omc: line N: error K` line, or a trap exit 101..114) and lookup (every keyword of the compiler's keyword table, with citations into omega-mv@" |
| 45 | text v_in4 ")." |
| 46 | text e_parse "Parse error: the line is not one RFC 8259 JSON value" |
| 47 | text e_long "Parse error: the line is longer than 983040 bytes" |
| 48 | text e_batch "Invalid Request: batch arrays are not supported" |
| 49 | text e_notobj "Invalid Request: the request must be a JSON object" |
| 50 | text e_jv "Invalid Request: jsonrpc must be the string \"2.0\"" |
| 51 | text e_idt "Invalid Request: id must be a string or an integer" |
| 52 | text e_mt "Invalid Request: method must be a string" |
| 53 | text e_meth "Method not found" |
| 54 | text e_pobj "Invalid params: params must be an object" |
| 55 | text e_pvs "Invalid params: protocolVersion must be a string" |
| 56 | text e_tname "Invalid params: params.name must be a string" |
| 57 | text e_targ "Invalid params: params.arguments must be an object" |
| 58 | text e_tunk "Invalid params: unknown tool; tools/list names compile, run, explain_error and lookup" |
| 59 | text e_int "Internal error: the reply could not be encoded" |
| 60 | text l_ready "omega-mcp: ready; isolation bwrap+prlimit; compiler " |
| 61 | text l_noiso "omega-mcp: WARNING: --test-only-no-isolation is set; programs run on the host without sandbox, limits or environment clearing. Test use only; never use this flag with an agent." |
| 62 | text l_req "req " |
| 63 | text l_note "notification " |
| 64 | text l_id " id=" |
| 65 | text l_out " -> " |
| 66 | text l_tool " tool=" |
| 67 | text l_eof "omega-mcp: end of input; exiting" |
| 68 | text l_boot "omega-mcp: start-up failed with code " |
| 69 | text l_data "omega-mcp: data/reference.json is missing or invalid" |
| 70 | text f_ref "reference.json" |
| 71 | text o_ok "ok" |
| 72 | text o_err "error " |
| 73 | text o_tooler "tool error" |
| 74 | text o_silent "no reply" |
| 75 | |
| 76 | note ---- small writer helpers (ob is the reply writer) ---- |
| 77 | fn wt ob edit uchar * t view uchar * to void |
| 78 | js_wsbuf ob t 0 len t |
| 79 | end |
| 80 | |
| 81 | fn wkt ob edit uchar * k view uchar * t view uchar * to void |
| 82 | wt ob k |
| 83 | wt ob t |
| 84 | end |
| 85 | |
| 86 | fn wku ob edit uchar * k view uchar * v ulong to void |
| 87 | wt ob k |
| 88 | js_wulong ob v |
| 89 | end |
| 90 | |
| 91 | fn wkb ob edit uchar * k view uchar * v bool to void |
| 92 | wt ob k |
| 93 | js_wbool ob v |
| 94 | end |
| 95 | |
| 96 | note wsp: the bytes of t inside the string js_wsbeg opened |
| 97 | fn wsp ob edit uchar * t view uchar * to void |
| 98 | n = len t |
| 99 | for i ulong n |
| 100 | js_wsb ob get t i |
| 101 | end |
| 102 | end |
| 103 | |
| 104 | note winstr: the instructions string, with the pin from build/pin.om |
| 105 | fn winstr ob edit uchar * to void |
| 106 | js_wsbeg ob |
| 107 | wsp ob v_in1 |
| 108 | wsp ob kmv |
| 109 | wsp ob v_in2 |
| 110 | wsp ob kpin |
| 111 | wsp ob v_in3 |
| 112 | wsp ob kmv |
| 113 | wsp ob v_in4 |
| 114 | js_wsend ob |
| 115 | end |
| 116 | |
| 117 | note ---- member lookup ---- |
| 118 | note rmem: value token of member key in request object t (jsnone when absent or t is not an object) |
| 119 | fn rmem src view uchar 1572864 tape view uint 65536 t ulong key view uchar * to ulong |
| 120 | if ne js_type tape t jsobj |
| 121 | ret jsnone |
| 122 | end |
| 123 | k = js_first tape t |
| 124 | while ne k jsnone bound 999999 |
| 125 | if js_streq src js_off tape k key |
| 126 | ret add k 1 |
| 127 | end |
| 128 | k = js_mnext tape k |
| 129 | end |
| 130 | ret jsnone |
| 131 | end |
| 132 | |
| 133 | note dmem: the same over the reference data |
| 134 | fn dmem ds view uchar 393216 dt view uint 98304 t ulong key view uchar * to ulong |
| 135 | if ne js_type dt t jsobj |
| 136 | ret jsnone |
| 137 | end |
| 138 | k = js_first dt t |
| 139 | while ne k jsnone bound 999999 |
| 140 | if js_streq ds js_off dt k key |
| 141 | ret add k 1 |
| 142 | end |
| 143 | k = js_mnext dt k |
| 144 | end |
| 145 | ret jsnone |
| 146 | end |
| 147 | |
| 148 | note dcopy: copy the data value starting at token t into the writer |
| 149 | fn dcopy ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 t ulong to void |
| 150 | e = js_last dt t |
| 151 | for i ulong add sub e t 1 |
| 152 | u = add t i |
| 153 | js_wtok ob ds js_type dt u js_off dt u |
| 154 | end |
| 155 | end |
| 156 | |
| 157 | note rcopy: copy the request value starting at token t into the writer |
| 158 | fn rcopy ob edit uchar 787472 src view uchar 1572864 tape view uint 65536 t ulong to void |
| 159 | e = js_last tape t |
| 160 | for i ulong add sub e t 1 |
| 161 | u = add t i |
| 162 | js_wtok ob src js_type tape u js_off tape u |
| 163 | end |
| 164 | end |
| 165 | |
| 166 | note ---- replies ---- |
| 167 | note rbeg: {"jsonrpc":"2.0","id":<id or null>, |
| 168 | fn rbeg ob edit uchar 787472 src view uchar 1572864 tape view uint 65536 to void |
| 169 | z = js_winit ob |
| 170 | js_wobj ob |
| 171 | wkt ob k_jrpc kjv |
| 172 | wt ob k_id |
| 173 | t = get gv gidt |
| 174 | if eq t jsnone |
| 175 | js_wnull ob |
| 176 | end |
| 177 | if ne t jsnone |
| 178 | js_wtok ob src js_type tape t js_off tape t |
| 179 | end |
| 180 | end |
| 181 | |
| 182 | text knl "\n" |
| 183 | text kinter "{\"jsonrpc\":\"2.0\",\"id\":null,\"error\":{\"code\":-32603,\"message\":\"Internal error: the reply could not be encoded\"}}\n" |
| 184 | |
| 185 | note rsend: close the reply object and write it as one line to stdout |
| 186 | fn rsend ob edit uchar 787472 to void |
| 187 | js_wobje ob |
| 188 | n = js_wdone ob |
| 189 | if lt n 0 |
| 190 | lg_t e_int |
| 191 | lg_b 32 |
| 192 | lg_n ulong neg n |
| 193 | lg_end |
| 194 | ok = wfull 1 kinter len kinter |
| 195 | ret |
| 196 | end |
| 197 | ok = wfull 1 part ob 1040 ulong n ulong n |
| 198 | ok = wfull 1 knl 1 |
| 199 | end |
| 200 | |
| 201 | fn rerr ob edit uchar 787472 src view uchar 1572864 tape view uint 65536 code long msg view uchar * to void |
| 202 | rbeg ob src tape |
| 203 | wt ob k_error |
| 204 | js_wobj ob |
| 205 | wt ob k_code |
| 206 | js_wlong ob code |
| 207 | wkt ob k_msg msg |
| 208 | js_wobje ob |
| 209 | rsend ob |
| 210 | lg_t l_out |
| 211 | lg_t o_err |
| 212 | lg_b 45 |
| 213 | lg_n ulong neg code |
| 214 | end |
| 215 | |
| 216 | note ---- request line ---- |
| 217 | note idok: id must be a string or an integer number (MCP forbids null) |
| 218 | fn idok tape view uint 65536 src view uchar 1572864 t ulong to bool |
| 219 | y = js_type tape t |
| 220 | if eq y jsstr |
| 221 | ret true |
| 222 | end |
| 223 | if eq y jsnum |
| 224 | ret ne js_ilex src js_off tape t 0 |
| 225 | end |
| 226 | ret false |
| 227 | end |
| 228 | |
| 229 | fn lgid src view uchar 1572864 tape view uint 65536 to void |
| 230 | t = get gv gidt |
| 231 | if ne t jsnone |
| 232 | lg_t l_id |
| 233 | lg_raw src js_off tape t js_span tape t |
| 234 | end |
| 235 | end |
| 236 | |
| 237 | fn lgmeth src view uchar 1572864 tape view uint 65536 m ulong to void |
| 238 | if eq js_type tape m jsstr |
| 239 | lg_raw src add js_off tape m 1 sub js_span tape m 2 |
| 240 | end |
| 241 | end |
| 242 | |
| 243 | note handle: one request line ib[0..n) |
| 244 | fn handle ib view uchar 1572864 tape edit uint 65536 ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 n ulong to void |
| 245 | put gv gidt jsnone |
| 246 | lg_t l_req |
| 247 | r = js_parse ib tape n |
| 248 | if lt r 0 |
| 249 | rerr ob ib tape jrparse e_parse |
| 250 | lg_end |
| 251 | ret |
| 252 | end |
| 253 | if ne envelope ib tape ob 0 |
| 254 | lg_end |
| 255 | ret |
| 256 | end |
| 257 | m = rmem ib tape 0 k_method |
| 258 | lgmeth ib tape m |
| 259 | lgid ib tape |
| 260 | if eq get gv gidt jsnone |
| 261 | lg_b 32 |
| 262 | lg_t o_silent |
| 263 | lg_end |
| 264 | ret |
| 265 | end |
| 266 | dispatch ib tape ob ds dt m |
| 267 | lg_end |
| 268 | end |
| 269 | |
| 270 | note envelope: checks jsonrpc, id and method; replies -32600 itself and returns 1 on a refusal |
| 271 | fn envelope ib view uchar 1572864 tape view uint 65536 ob edit uchar 787472 to ulong |
| 272 | y = js_type tape 0 |
| 273 | if eq y jsarr |
| 274 | rerr ob ib tape jrinv e_batch |
| 275 | ret 1 |
| 276 | end |
| 277 | if ne y jsobj |
| 278 | rerr ob ib tape jrinv e_notobj |
| 279 | ret 1 |
| 280 | end |
| 281 | i = rmem ib tape 0 k_id |
| 282 | if ne i jsnone |
| 283 | if not idok tape ib i |
| 284 | rerr ob ib tape jrinv e_idt |
| 285 | ret 1 |
| 286 | end |
| 287 | put gv gidt i |
| 288 | end |
| 289 | v = rmem ib tape 0 k_jrpc |
| 290 | ok = false |
| 291 | if ne v jsnone |
| 292 | if eq js_type tape v jsstr |
| 293 | ok = js_streq ib js_off tape v kjv |
| 294 | end |
| 295 | end |
| 296 | if not ok |
| 297 | rerr ob ib tape jrinv e_jv |
| 298 | ret 1 |
| 299 | end |
| 300 | m = rmem ib tape 0 k_method |
| 301 | if or eq m jsnone ne js_type tape m jsstr |
| 302 | rerr ob ib tape jrinv e_mt |
| 303 | ret 1 |
| 304 | end |
| 305 | ret 0 |
| 306 | end |
| 307 | |
| 308 | fn ismeth ib view uchar 1572864 tape view uint 65536 m ulong t view uchar * to bool |
| 309 | ret js_streq ib js_off tape m t |
| 310 | end |
| 311 | |
| 312 | fn dispatch ib view uchar 1572864 tape view uint 65536 ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 m ulong to void |
| 313 | p = rmem ib tape 0 k_params |
| 314 | put gv gpar p |
| 315 | if ne p jsnone |
| 316 | if ne js_type tape p jsobj |
| 317 | rerr ob ib tape jrpar e_pobj |
| 318 | ret |
| 319 | end |
| 320 | end |
| 321 | if ismeth ib tape m m_init |
| 322 | doinit ib tape ob |
| 323 | ret |
| 324 | end |
| 325 | if ismeth ib tape m m_ping |
| 326 | rbeg ob ib tape |
| 327 | wt ob k_result |
| 328 | js_wobj ob |
| 329 | js_wobje ob |
| 330 | rsend ob |
| 331 | lg_t l_out |
| 332 | lg_t o_ok |
| 333 | ret |
| 334 | end |
| 335 | if ismeth ib tape m m_list |
| 336 | rbeg ob ib tape |
| 337 | wt ob k_result |
| 338 | js_wobj ob |
| 339 | wt ob k_tools |
| 340 | dcopy ob ds dt dmem ds dt 0 k_tools |
| 341 | js_wobje ob |
| 342 | rsend ob |
| 343 | lg_t l_out |
| 344 | lg_t o_ok |
| 345 | ret |
| 346 | end |
| 347 | if ismeth ib tape m m_call |
| 348 | docall ib tape ob ds dt |
| 349 | ret |
| 350 | end |
| 351 | rerr ob ib tape jrmeth e_meth |
| 352 | end |
| 353 | |
| 354 | note pvpick: 1..3 when the requested protocol version is supported, else 1 (the newest) |
| 355 | fn pvpick ib view uchar 1572864 tape view uint 65536 v ulong to ulong |
| 356 | o = js_off tape v |
| 357 | if js_streq ib o v_pv2 |
| 358 | ret 2 |
| 359 | end |
| 360 | if js_streq ib o v_pv3 |
| 361 | ret 3 |
| 362 | end |
| 363 | ret 1 |
| 364 | end |
| 365 | |
| 366 | fn doinit ib view uchar 1572864 tape view uint 65536 ob edit uchar 787472 to void |
| 367 | p = get gv gpar |
| 368 | v = rmem ib tape p k_pv |
| 369 | pv = ulong 1 |
| 370 | if ne v jsnone |
| 371 | if ne js_type tape v jsstr |
| 372 | rerr ob ib tape jrpar e_pvs |
| 373 | ret |
| 374 | end |
| 375 | pv = pvpick ib tape v |
| 376 | end |
| 377 | rbeg ob ib tape |
| 378 | wt ob k_result |
| 379 | js_wobj ob |
| 380 | wt ob k_pv |
| 381 | if eq pv 1 |
| 382 | wt ob v_pv1 |
| 383 | end |
| 384 | if eq pv 2 |
| 385 | wt ob v_pv2 |
| 386 | end |
| 387 | if eq pv 3 |
| 388 | wt ob v_pv3 |
| 389 | end |
| 390 | wt ob k_caps |
| 391 | js_wobj ob |
| 392 | wt ob k_tools |
| 393 | js_wobj ob |
| 394 | wkb ob k_lc false |
| 395 | js_wobje ob |
| 396 | js_wobje ob |
| 397 | wt ob k_si |
| 398 | js_wobj ob |
| 399 | wkt ob k_name kname |
| 400 | wkt ob k_ver kver |
| 401 | js_wobje ob |
| 402 | wt ob k_instr |
| 403 | winstr ob |
| 404 | js_wobje ob |
| 405 | rsend ob |
| 406 | lg_t l_out |
| 407 | lg_t o_ok |
| 408 | end |
| 409 | |
| 410 | note ---- tools/call ---- |
| 411 | text t_comp "compile" |
| 412 | text t_run "run" |
| 413 | text t_expl "explain_error" |
| 414 | text t_lookup "lookup" |
| 415 | |
| 416 | fn docall ib view uchar 1572864 tape view uint 65536 ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 to void |
| 417 | p = get gv gpar |
| 418 | nm = rmem ib tape p k_name |
| 419 | if or eq nm jsnone ne js_type tape nm jsstr |
| 420 | rerr ob ib tape jrpar e_tname |
| 421 | ret |
| 422 | end |
| 423 | a = rmem ib tape p k_args |
| 424 | if ne a jsnone |
| 425 | if ne js_type tape a jsobj |
| 426 | rerr ob ib tape jrpar e_targ |
| 427 | ret |
| 428 | end |
| 429 | end |
| 430 | put gv garg a |
| 431 | o = js_off tape nm |
| 432 | w = ulong 0 |
| 433 | if js_streq ib o t_comp |
| 434 | w = 1 |
| 435 | end |
| 436 | if js_streq ib o t_run |
| 437 | w = 2 |
| 438 | end |
| 439 | if js_streq ib o t_expl |
| 440 | w = 3 |
| 441 | end |
| 442 | if js_streq ib o t_lookup |
| 443 | w = 4 |
| 444 | end |
| 445 | if eq w 0 |
| 446 | rerr ob ib tape jrpar e_tunk |
| 447 | ret |
| 448 | end |
| 449 | put gv gtool w |
| 450 | lg_t l_tool |
| 451 | lg_raw ib add o 1 sub js_span tape nm 2 |
| 452 | e = argcheck ib tape ob w |
| 453 | if ne e 0 |
| 454 | argerr ob ib tape e |
| 455 | ret |
| 456 | end |
| 457 | prep ib tape ob ds dt |
| 458 | reply ib tape ob ds dt |
| 459 | end |
| 460 | |
| 461 | note reply: result {"structuredContent": R, "content": [{"type":"text","text": R as text}], "isError": b} |
| 462 | fn reply ib view uchar 1572864 tape view uint 65536 ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 to void |
| 463 | rbeg ob ib tape |
| 464 | wt ob k_result |
| 465 | js_wobj ob |
| 466 | wt ob k_sc |
| 467 | s = js_wlen ob |
| 468 | build ib tape ob ds dt |
| 469 | e = js_wlen ob |
| 470 | wt ob k_cont |
| 471 | js_warr ob |
| 472 | js_wobj ob |
| 473 | wkt ob k_type k_text |
| 474 | wt ob k_text |
| 475 | js_wsbeg ob |
| 476 | for i ulong sub e s |
| 477 | js_wsb ob get ob add add 1040 s i |
| 478 | end |
| 479 | js_wsend ob |
| 480 | js_wobje ob |
| 481 | js_warre ob |
| 482 | wkb ob k_iserr ne get gv gisok 1 |
| 483 | js_wobje ob |
| 484 | rsend ob |
| 485 | lg_t l_out |
| 486 | if eq get gv gisok 1 |
| 487 | lg_t o_ok |
| 488 | end |
| 489 | if ne get gv gisok 1 |
| 490 | lg_t o_tooler |
| 491 | end |
| 492 | end |
| 493 | |
| 494 | note ---- start-up and the read loop ---- |
| 495 | fn loadref ds edit uchar 393216 dt edit uint 98304 to bool |
| 496 | n = pa_d f_ref |
| 497 | f = fopen pa 0 n ofrd 0 |
| 498 | if lt f 0 |
| 499 | ret false |
| 500 | end |
| 501 | fd = int f |
| 502 | got = ulong 0 |
| 503 | while lt got 393216 bound 999999 |
| 504 | r = read fd ds got sub 393216 got |
| 505 | if le r 0 |
| 506 | break |
| 507 | end |
| 508 | got = add got ulong r |
| 509 | end |
| 510 | c = fclose fd |
| 511 | if ge got 393216 |
| 512 | ret false |
| 513 | end |
| 514 | z = js_init dt 393216 64 |
| 515 | if lt z 0 |
| 516 | ret false |
| 517 | end |
| 518 | p = js_parse ds dt got |
| 519 | if lt p 0 |
| 520 | ret false |
| 521 | end |
| 522 | ret eq js_type dt 0 jsobj |
| 523 | end |
| 524 | |
| 525 | note lineat: index of the first newline in ib[from..n), or n |
| 526 | fn lineat ib view uchar 1572864 from ulong n ulong to ulong |
| 527 | for i ulong sub n from |
| 528 | if eq get ib add from i 10 |
| 529 | ret add from i |
| 530 | end |
| 531 | end |
| 532 | ret n |
| 533 | end |
| 534 | |
| 535 | note step: one request line or one read; false at end of input |
| 536 | fn step ib edit uchar 1572864 tape edit uint 65536 ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 to bool |
| 537 | n = get gv gran |
| 538 | p = lineat ib get gv gsin n |
| 539 | if lt p n |
| 540 | oneline ib tape ob ds dt p |
| 541 | shiftin ib add p 1 |
| 542 | ret true |
| 543 | end |
| 544 | put gv gsin n |
| 545 | if gt n maxline |
| 546 | put gv geof 1 |
| 547 | put gv gran 0 |
| 548 | put gv gsin 0 |
| 549 | n = 0 |
| 550 | end |
| 551 | r = read 0 ib n sub 1572864 n |
| 552 | if eq r -4 |
| 553 | ret true |
| 554 | end |
| 555 | if le r 0 |
| 556 | if or gt n 0 ne get gv geof 0 |
| 557 | oneline ib tape ob ds dt n |
| 558 | end |
| 559 | ret false |
| 560 | end |
| 561 | put gv gran add n ulong r |
| 562 | ret true |
| 563 | end |
| 564 | |
| 565 | note shiftin: drop ib[0..k) and move the rest to the front |
| 566 | fn shiftin ib edit uchar 1572864 k ulong to void |
| 567 | n = get gv gran |
| 568 | for i ulong sub n k |
| 569 | put ib i get ib add k i |
| 570 | end |
| 571 | put gv gran sub n k |
| 572 | put gv gsin 0 |
| 573 | end |
| 574 | |
| 575 | note isblank: ib[0..q) holds only spaces, tabs and carriage returns |
| 576 | fn isblank ib view uchar 1572864 q ulong to bool |
| 577 | for i ulong q |
| 578 | c = get ib i |
| 579 | if not or or eq c 32 eq c 9 eq c 13 |
| 580 | ret false |
| 581 | end |
| 582 | end |
| 583 | ret true |
| 584 | end |
| 585 | |
| 586 | note oneline: ib[0..p) is a line (geof marks the tail of an overlong line, answered -32700) |
| 587 | fn oneline ib view uchar 1572864 tape edit uint 65536 ob edit uchar 787472 ds view uchar 393216 dt view uint 98304 p ulong to void |
| 588 | if ne get gv geof 0 |
| 589 | put gv geof 0 |
| 590 | put gv gidt jsnone |
| 591 | lg_t l_req |
| 592 | rerr ob ib tape jrparse e_long |
| 593 | lg_end |
| 594 | ret |
| 595 | end |
| 596 | q = p |
| 597 | if gt q 0 |
| 598 | if eq get ib sub q 1 13 |
| 599 | q = sub q 1 |
| 600 | end |
| 601 | end |
| 602 | if isblank ib q |
| 603 | ret |
| 604 | end |
| 605 | handle ib tape ob ds dt q |
| 606 | end |
| 607 | |
| 608 | fn main to int |
| 609 | ib = new uchar 1572864 0 |
| 610 | tape = new uint 65536 0 |
| 611 | ob = new uchar 787472 0 |
| 612 | ds = new uchar 393216 0 |
| 613 | dt = new uint 98304 0 |
| 614 | a = argcnt |
| 615 | if ge a 3 |
| 616 | if argeq 1 a_reap |
| 617 | ret reapmain |
| 618 | end |
| 619 | end |
| 620 | b = boot |
| 621 | if ne b 0 |
| 622 | lg_t l_boot |
| 623 | lg_n ulong b |
| 624 | lg_end |
| 625 | ret b |
| 626 | end |
| 627 | if not loadref ds dt |
| 628 | lg_line l_data |
| 629 | ret 4 |
| 630 | end |
| 631 | z = js_init tape maxline 64 |
| 632 | if ne get gv gnoiso 0 |
| 633 | lg_line l_noiso |
| 634 | end |
| 635 | if eq get gv gnoiso 0 |
| 636 | lg_t l_ready |
| 637 | lg_t kpin |
| 638 | lg_end |
| 639 | end |
| 640 | put gv gran 0 |
| 641 | put gv gsin 0 |
| 642 | put gv geof 0 |
| 643 | for o ulong 999999 |
| 644 | for i ulong 999999 |
| 645 | if not step ib tape ob ds dt |
| 646 | lg_line l_eof |
| 647 | ret 0 |
| 648 | end |
| 649 | end |
| 650 | end |
| 651 | ret 0 |
| 652 | end |