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 / src / visor / visor_console.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note Pure seeded OM-2 Visor lane 2: console / REPL dispatcher |
| 3 | note (replaces src/visor/visor_console.c). |
| 4 | note Depends on visor.om, omega_lower.om, visor_semantic.om, visor_machine.om, |
| 5 | note visor_realization.om, visor_verify.om, visor_evidence.om, visor_world.om, |
| 6 | note visor_effect_request.om, visor_parse_command.om. |
| 7 | |
| 8 | text vcon_cls_insp "inspection" |
| 9 | text vcon_cls_pure "pure-execution" |
| 10 | text vcon_cls_sim "simulation" |
| 11 | text vcon_cls_eff "effect-request" |
| 12 | text vcon_help_hdr "Omega Visor commands (classes: inspection, pure-execution, simulation, effect-request):\n help [cmd] inspection show commands\n quit inspection exit console\n inspect <x> inspection inspect object\n type <x> inspection show type of x\n id <x> inspection show the semantic id of a name, _ or hex id\n graph <x> inspection show dependency graph\n verify <x> pure-execution run verification report\n machine inspection show current machine model\n realize <x> [for current.machine] pure-execution realize x to AArch64\n cost <x> simulation show four-slot cost view\n run <x> [args...] pure-execution run x if pure; effects become an effect request\n evidence [x] inspection inspect evidence receipts\n bindings inspection list session bindings\n clear inspection clear session\n world inspection show read-only world view\n effects [x] effect-request show unauthorized effect request\n alternatives <x> simulation compare realizations\n compare <a> <b> simulation compare two realizations\n why <x> inspection explain realization\n let x: u64 = 7 pure-execution evaluate Omega language V0\n" |
| 13 | text vcon_t_bye "bye\n" |
| 14 | text vcon_t_clr "session cleared\n" |
| 15 | text vcon_t_nobind "(no bindings)\n" |
| 16 | text vcon_t_errpfx "error: " |
| 17 | text vcon_t_colsp ": " |
| 18 | text vcon_t_unk_id "unknown name or id" |
| 19 | text vcon_t_no_eff "[effect-request]\nno effect objects in session\n" |
| 20 | text vcon_t_not_eff "is not an EFFECT object" |
| 21 | text vcon_t_eff_req "EFFECT REQUEST: requires authority; routed via EffectIntent -> AEGIS/PHYSICS (not executed)\n" |
| 22 | text vcon_t_true "true\n" |
| 23 | text vcon_t_false "false\n" |
| 24 | text vcon_t_obj " object " |
| 25 | text vcon_t_prog " program " |
| 26 | text vcon_t_real " realization " |
| 27 | text vcon_j_c1 "{\"command\":\"" |
| 28 | text vcon_j_c2 "\",\"status\":\"" |
| 29 | text vcon_j_ok "ok" |
| 30 | text vcon_j_er "error" |
| 31 | text vcon_j_c3 "\",\"class\":\"" |
| 32 | text vcon_j_c4 "\",\"result\":" |
| 33 | text vcon_j_c5 ",\"error\":" |
| 34 | text vcon_j_null "null" |
| 35 | text vcon_j_end "}\n" |
| 36 | |
| 37 | global vcon_json ulong 1 |
| 38 | global vcon_quit ulong 1 |
| 39 | global vcon_err_cnt ulong 1 |
| 40 | global vcon_last_st ulong 1 |
| 41 | global vcon_evroot uchar 256 |
| 42 | global vcon_evlen ulong 1 |
| 43 | global vcon_out_copy uchar 65536 |
| 44 | global vcon_out_clen ulong 1 |
| 45 | |
| 46 | fn vcon_init is_json ulong to void |
| 47 | vs_init |
| 48 | vmch_detect_current |
| 49 | put vcon_json 0 is_json |
| 50 | put vcon_quit 0 0 |
| 51 | put vcon_err_cnt 0 0 |
| 52 | put vcon_last_st 0 0 |
| 53 | put vcon_evlen 0 0 |
| 54 | end |
| 55 | |
| 56 | fn vcon_cmd_class cmd ulong to ulong |
| 57 | if or eq cmd 6 or eq cmd 8 or eq cmd 10 eq cmd 19 |
| 58 | ret 1 |
| 59 | end |
| 60 | if or eq cmd 9 or eq cmd 16 eq cmd 17 |
| 61 | ret 2 |
| 62 | end |
| 63 | if eq cmd 15 |
| 64 | ret 3 |
| 65 | end |
| 66 | ret 0 |
| 67 | end |
| 68 | |
| 69 | fn vcon_put_class cls ulong to void |
| 70 | if eq cls 1 |
| 71 | ob_puts vcon_cls_pure |
| 72 | ret |
| 73 | end |
| 74 | if eq cls 2 |
| 75 | ob_puts vcon_cls_sim |
| 76 | ret |
| 77 | end |
| 78 | if eq cls 3 |
| 79 | ob_puts vcon_cls_eff |
| 80 | ret |
| 81 | end |
| 82 | ob_puts vcon_cls_insp |
| 83 | end |
| 84 | |
| 85 | fn vcon_emit_err_sbuf cmd ulong mlen ulong to long |
| 86 | put vcon_err_cnt 0 add get vcon_err_cnt 0 1 |
| 87 | put vcon_last_st 0 1 |
| 88 | if ne get vcon_json 0 0 |
| 89 | ob_reset 65535 |
| 90 | ob_puts vcon_j_c1 |
| 91 | vpc_put_cmd_name cmd |
| 92 | ob_puts vcon_j_c2 |
| 93 | ob_puts vcon_j_er |
| 94 | ob_puts vcon_j_c3 |
| 95 | vcon_put_class vcon_cmd_class cmd |
| 96 | ob_puts vcon_j_c4 |
| 97 | ob_puts vcon_j_null |
| 98 | ob_puts vcon_j_c5 |
| 99 | ob_put_json_sbuf mlen |
| 100 | ob_puts vcon_j_end |
| 101 | ob_write_fd 1 |
| 102 | else |
| 103 | ob_reset 65535 |
| 104 | ob_puts vcon_t_errpfx |
| 105 | vpc_put_cmd_name cmd |
| 106 | ob_puts vcon_t_colsp |
| 107 | ob_put_sbuf mlen |
| 108 | ob_putc uchar 10 |
| 109 | ob_write_fd 1 |
| 110 | end |
| 111 | ret 1 |
| 112 | end |
| 113 | |
| 114 | fn vcon_emit_err_txt cmd ulong s view uchar * to long |
| 115 | n = v_copy_txt_sbuf s |
| 116 | ret vcon_emit_err_sbuf cmd n |
| 117 | end |
| 118 | |
| 119 | fn vcon_emit_ok_json cmd ulong cls ulong to long |
| 120 | put vcon_last_st 0 0 |
| 121 | n = get v_ob_len 0 |
| 122 | for i ulong n bound 65536 |
| 123 | put vcon_out_copy i get v_ob i |
| 124 | end |
| 125 | put vcon_out_clen 0 n |
| 126 | ob_reset 65535 |
| 127 | ob_puts vcon_j_c1 |
| 128 | vpc_put_cmd_name cmd |
| 129 | ob_puts vcon_j_c2 |
| 130 | ob_puts vcon_j_ok |
| 131 | ob_puts vcon_j_c3 |
| 132 | vcon_put_class cls |
| 133 | ob_puts vcon_j_c4 |
| 134 | for i ulong n bound 65536 |
| 135 | ob_putc get vcon_out_copy i |
| 136 | end |
| 137 | ob_puts vcon_j_c5 |
| 138 | ob_puts vcon_j_null |
| 139 | ob_puts vcon_j_end |
| 140 | ob_write_fd 1 |
| 141 | ret 0 |
| 142 | end |
| 143 | |
| 144 | fn vcon_parse_u64_arg idx ulong to long |
| 145 | al = get vpc_alen idx |
| 146 | if eq al 0 |
| 147 | ret -1 |
| 148 | end |
| 149 | base = mul idx 256 |
| 150 | v = ulong 0 |
| 151 | for i ulong al bound 32 |
| 152 | c = ulong get vpc_args add base i |
| 153 | if or lt c 48 gt c 57 |
| 154 | ret -1 |
| 155 | end |
| 156 | v = add mul v 10 sub c 48 |
| 157 | end |
| 158 | ret long v |
| 159 | end |
| 160 | |
| 161 | fn vcon_cmd_bindings isj ulong to long |
| 162 | bc = get v_bind_cnt 0 |
| 163 | ob_reset 65535 |
| 164 | if ne isj 0 |
| 165 | ob_putc uchar 91 |
| 166 | for i ulong bc bound 64 |
| 167 | if gt i 0 |
| 168 | ob_putc uchar 44 |
| 169 | end |
| 170 | nl = get v_bind_nlen i |
| 171 | nb = mul i 64 |
| 172 | for j ulong nl bound 64 |
| 173 | put v_sbuf j get v_bind_name add nb j |
| 174 | end |
| 175 | ob_put_json_sbuf nl |
| 176 | end |
| 177 | ob_putc uchar 93 |
| 178 | ret vcon_emit_ok_json 12 0 |
| 179 | end |
| 180 | if eq bc 0 |
| 181 | v_write_all 1 vcon_t_nobind |
| 182 | else |
| 183 | for i ulong bc bound 64 |
| 184 | nl = get v_bind_nlen i |
| 185 | nb = mul i 64 |
| 186 | for j ulong nl bound 64 |
| 187 | ob_putc get v_bind_name add nb j |
| 188 | end |
| 189 | bk = get v_bind_kind i |
| 190 | if eq bk V_BIND_OBJECT |
| 191 | ob_puts vcon_t_obj |
| 192 | else |
| 193 | if eq bk V_BIND_PROGRAM |
| 194 | ob_puts vcon_t_prog |
| 195 | else |
| 196 | ob_puts vcon_t_real |
| 197 | end |
| 198 | end |
| 199 | ob_puts vt_sha256_pfx |
| 200 | ib = mul i 32 |
| 201 | for b ulong 32 |
| 202 | ob_put_hex_byte ulong get v_bind_id add ib b |
| 203 | end |
| 204 | ob_putc uchar 10 |
| 205 | end |
| 206 | ob_write_fd 1 |
| 207 | end |
| 208 | put vcon_last_st 0 0 |
| 209 | ret 0 |
| 210 | end |
| 211 | |
| 212 | fn vcon_cmd_run oi long rk ulong isj ulong to long |
| 213 | if ge oi 0 |
| 214 | cr = verq_classify ulong oi |
| 215 | if or lt cr 0 ne get verq_needs 0 0 |
| 216 | v_write_all 1 vcon_t_eff_req |
| 217 | put vcon_last_st 0 0 |
| 218 | ret 0 |
| 219 | end |
| 220 | end |
| 221 | ridx = long -1 |
| 222 | if eq rk V_BIND_REALIZATION |
| 223 | ridx = get v_res_idx 0 |
| 224 | else |
| 225 | if eq rk V_BIND_PROGRAM |
| 226 | ridx = vrl_realize_program ulong get v_res_idx 0 |
| 227 | else |
| 228 | if ge oi 0 |
| 229 | ridx = vrl_realize_apply ulong oi |
| 230 | end |
| 231 | end |
| 232 | end |
| 233 | if lt ridx 0 |
| 234 | wl = get vrl_wlen 0 |
| 235 | for i ulong wl bound 256 |
| 236 | put v_sbuf i get vrl_why i |
| 237 | end |
| 238 | ret vcon_emit_err_sbuf 10 wl |
| 239 | end |
| 240 | a0 = ulong 0 |
| 241 | a1 = ulong 0 |
| 242 | a2 = ulong 0 |
| 243 | ac = sub get vpc_argc 0 1 |
| 244 | if ge ac 1 |
| 245 | v0 = vcon_parse_u64_arg 1 |
| 246 | if lt v0 0 |
| 247 | ret vcon_emit_err_txt 10 vcon_t_unk_id |
| 248 | end |
| 249 | a0 = ulong v0 |
| 250 | end |
| 251 | if ge ac 2 |
| 252 | v1 = vcon_parse_u64_arg 2 |
| 253 | if lt v1 0 |
| 254 | ret vcon_emit_err_txt 10 vcon_t_unk_id |
| 255 | end |
| 256 | a1 = ulong v1 |
| 257 | end |
| 258 | if ge ac 3 |
| 259 | v2 = vcon_parse_u64_arg 3 |
| 260 | if lt v2 0 |
| 261 | ret vcon_emit_err_txt 10 vcon_t_unk_id |
| 262 | end |
| 263 | a2 = ulong v2 |
| 264 | end |
| 265 | if lt vrl_run_pure ulong ridx a0 a1 a2 ac 0 |
| 266 | ret vcon_emit_err_txt 10 vrl_w_incompat |
| 267 | end |
| 268 | ob_reset 65535 |
| 269 | ob_put_u64 get vrl_run_out 0 |
| 270 | if ne isj 0 |
| 271 | ret vcon_emit_ok_json 10 1 |
| 272 | end |
| 273 | ob_putc uchar 10 |
| 274 | ob_write_fd 1 |
| 275 | put vcon_last_st 0 0 |
| 276 | ret 0 |
| 277 | end |
| 278 | |
| 279 | fn vcon_cmd_type oi long rk ulong isj ulong to long |
| 280 | ob_reset 65535 |
| 281 | if eq rk V_BIND_PROGRAM |
| 282 | ob_puts vsem_t_u |
| 283 | ob_put_u64 64 |
| 284 | else |
| 285 | if lt oi 0 |
| 286 | ret vcon_emit_err_txt 3 vcon_t_unk_id |
| 287 | end |
| 288 | k = get v_og_kind ulong oi |
| 289 | if eq k V_KIND_TYPE |
| 290 | vsem_put_type_str ulong oi |
| 291 | else |
| 292 | info = olw_obj_type_info ulong oi |
| 293 | tag = shr info 16 |
| 294 | wid = and info 0xffff |
| 295 | if eq tag V_TY_BOOL |
| 296 | ob_puts vsem_t_bool |
| 297 | else |
| 298 | if eq tag V_TY_UINT |
| 299 | ob_puts vsem_t_u |
| 300 | ob_put_u64 wid |
| 301 | else |
| 302 | ob_puts vsem_op_unk |
| 303 | end |
| 304 | end |
| 305 | end |
| 306 | end |
| 307 | if ne isj 0 |
| 308 | ret vcon_emit_ok_json 3 0 |
| 309 | end |
| 310 | ob_putc uchar 10 |
| 311 | ob_write_fd 1 |
| 312 | put vcon_last_st 0 0 |
| 313 | ret 0 |
| 314 | end |
| 315 | |
| 316 | fn vcon_cmd_subject cmd ulong isj ulong to long |
| 317 | a0l = get vpc_alen 0 |
| 318 | for i ulong a0l bound 256 |
| 319 | put v_sbuf i get vpc_args i |
| 320 | end |
| 321 | if lt vs_resolve_sbuf a0l 0 |
| 322 | ret vcon_emit_err_txt cmd vcon_t_unk_id |
| 323 | end |
| 324 | rk = get v_res_kind 0 |
| 325 | if eq cmd 4 |
| 326 | ob_reset 65535 |
| 327 | if ne isj 0 |
| 328 | ob_putc uchar 123 |
| 329 | ob_putc uchar 34 |
| 330 | ob_puts vpc_c_id |
| 331 | ob_putc uchar 34 |
| 332 | ob_putc uchar 58 |
| 333 | ob_putc uchar 34 |
| 334 | ob_puts vt_sha256_pfx |
| 335 | for i ulong 32 |
| 336 | ob_put_hex_byte ulong get v_res_id i |
| 337 | end |
| 338 | ob_putc uchar 34 |
| 339 | ob_putc uchar 125 |
| 340 | ret vcon_emit_ok_json cmd 0 |
| 341 | end |
| 342 | ob_puts vt_sha256_pfx |
| 343 | for i ulong 32 |
| 344 | ob_put_hex_byte ulong get v_res_id i |
| 345 | end |
| 346 | ob_putc uchar 10 |
| 347 | ob_write_fd 1 |
| 348 | put vcon_last_st 0 0 |
| 349 | ret 0 |
| 350 | end |
| 351 | for i ulong 32 |
| 352 | put v_tmp_id i get v_res_id i |
| 353 | end |
| 354 | oi = og_find_by_tmp |
| 355 | if eq cmd 2 |
| 356 | if lt oi 0 |
| 357 | ret vcon_emit_err_txt cmd vcon_t_unk_id |
| 358 | end |
| 359 | ir = vsem_inspect ulong oi |
| 360 | if ne isj 0 |
| 361 | u = vsem_format_json 65535 |
| 362 | ret vcon_emit_ok_json cmd 0 |
| 363 | end |
| 364 | u = vsem_format_text 65535 |
| 365 | ob_write_fd 1 |
| 366 | put vcon_last_st 0 0 |
| 367 | ret 0 |
| 368 | end |
| 369 | if eq cmd 3 |
| 370 | ret vcon_cmd_type oi rk isj |
| 371 | end |
| 372 | if eq cmd 5 |
| 373 | if lt oi 0 |
| 374 | ret vcon_emit_err_txt cmd vcon_t_unk_id |
| 375 | end |
| 376 | u = vsem_graph_text ulong oi 65535 |
| 377 | ob_write_fd 1 |
| 378 | put vcon_last_st 0 0 |
| 379 | ret 0 |
| 380 | end |
| 381 | if eq cmd 6 |
| 382 | if eq rk V_BIND_PROGRAM |
| 383 | u = vver_verify_program ulong get v_res_idx 0 |
| 384 | else |
| 385 | u = vver_verify_object oi -1 0 |
| 386 | end |
| 387 | if ne isj 0 |
| 388 | u2 = vver_format_json 65535 |
| 389 | ret vcon_emit_ok_json cmd 1 |
| 390 | end |
| 391 | u2 = vver_format_text 65535 |
| 392 | ob_write_fd 1 |
| 393 | put vcon_last_st 0 0 |
| 394 | ret 0 |
| 395 | end |
| 396 | if eq cmd 8 |
| 397 | ridx = long -1 |
| 398 | if eq rk V_BIND_PROGRAM |
| 399 | ridx = vrl_realize_program ulong get v_res_idx 0 |
| 400 | else |
| 401 | if ge oi 0 |
| 402 | ridx = vrl_realize_apply ulong oi |
| 403 | end |
| 404 | end |
| 405 | if lt ridx 0 |
| 406 | wl = get vrl_wlen 0 |
| 407 | for i ulong wl bound 256 |
| 408 | put v_sbuf i get vrl_why i |
| 409 | end |
| 410 | ret vcon_emit_err_sbuf cmd wl |
| 411 | end |
| 412 | rb = mul ulong ridx 32 |
| 413 | for i ulong 32 |
| 414 | put v_tmp_id i get v_real_id add rb i |
| 415 | end |
| 416 | vs_set_last V_BIND_REALIZATION ridx |
| 417 | if ne isj 0 |
| 418 | u = vrl_format_json ulong ridx 65535 |
| 419 | ret vcon_emit_ok_json cmd 1 |
| 420 | end |
| 421 | u = vrl_format_text ulong ridx 65535 |
| 422 | ob_write_fd 1 |
| 423 | put vcon_last_st 0 0 |
| 424 | ret 0 |
| 425 | end |
| 426 | if eq cmd 9 |
| 427 | if ne rk V_BIND_REALIZATION |
| 428 | ret vcon_emit_err_txt cmd vcon_t_unk_id |
| 429 | end |
| 430 | if ne isj 0 |
| 431 | u = vrl_format_cost_json ulong get v_res_idx 0 65535 |
| 432 | ret vcon_emit_ok_json cmd 2 |
| 433 | end |
| 434 | u = vrl_format_cost_text ulong get v_res_idx 0 65535 |
| 435 | ob_write_fd 1 |
| 436 | put vcon_last_st 0 0 |
| 437 | ret 0 |
| 438 | end |
| 439 | if eq cmd 10 |
| 440 | ret vcon_cmd_run oi rk isj |
| 441 | end |
| 442 | if eq cmd 15 |
| 443 | if lt oi 0 |
| 444 | ret vcon_emit_err_txt cmd vcon_t_not_eff |
| 445 | end |
| 446 | if ne get v_og_kind ulong oi V_KIND_EFFECT |
| 447 | ret vcon_emit_err_txt cmd vcon_t_not_eff |
| 448 | end |
| 449 | if lt verq_build ulong oi 0 |
| 450 | ret vcon_emit_err_txt cmd vcon_t_not_eff |
| 451 | end |
| 452 | if ne isj 0 |
| 453 | u = verq_format_json 65535 |
| 454 | ret vcon_emit_ok_json cmd 3 |
| 455 | end |
| 456 | u = verq_format_text 65535 |
| 457 | ob_write_fd 1 |
| 458 | put vcon_last_st 0 0 |
| 459 | ret 0 |
| 460 | end |
| 461 | ret vcon_emit_err_txt cmd vcon_t_unk_id |
| 462 | end |
| 463 | |
| 464 | fn vcon_exec_sbuf rlen ulong to long |
| 465 | prc = vpc_parse_sbuf rlen |
| 466 | cmd = get vpc_cmd 0 |
| 467 | if lt prc 0 |
| 468 | el = get vpc_elen 0 |
| 469 | for i ulong el bound 256 |
| 470 | put v_sbuf i get vpc_err i |
| 471 | end |
| 472 | ret vcon_emit_err_sbuf cmd el |
| 473 | end |
| 474 | if eq cmd 20 |
| 475 | ret 0 |
| 476 | end |
| 477 | isj = get vcon_json 0 |
| 478 | if eq cmd 1 |
| 479 | put vcon_quit 0 1 |
| 480 | if ne isj 0 |
| 481 | ob_reset 65535 |
| 482 | ob_put_json_str vcon_t_bye 0 3 |
| 483 | ret vcon_emit_ok_json cmd 0 |
| 484 | end |
| 485 | v_write_all 1 vcon_t_bye |
| 486 | put vcon_last_st 0 0 |
| 487 | ret 0 |
| 488 | end |
| 489 | if eq cmd 0 |
| 490 | if ne isj 0 |
| 491 | ob_reset 65535 |
| 492 | ob_put_json_str vcon_help_hdr 0 20 |
| 493 | ret vcon_emit_ok_json cmd 0 |
| 494 | end |
| 495 | v_write_all 1 vcon_help_hdr |
| 496 | put vcon_last_st 0 0 |
| 497 | ret 0 |
| 498 | end |
| 499 | if eq cmd 13 |
| 500 | vs_clear |
| 501 | if ne isj 0 |
| 502 | ob_reset 65535 |
| 503 | ob_put_json_str vcon_t_clr 0 15 |
| 504 | ret vcon_emit_ok_json cmd 0 |
| 505 | end |
| 506 | v_write_all 1 vcon_t_clr |
| 507 | put vcon_last_st 0 0 |
| 508 | ret 0 |
| 509 | end |
| 510 | if eq cmd 12 |
| 511 | ret vcon_cmd_bindings isj |
| 512 | end |
| 513 | if eq cmd 7 |
| 514 | if ne isj 0 |
| 515 | u = vmch_format_json 65535 |
| 516 | ret vcon_emit_ok_json cmd 0 |
| 517 | end |
| 518 | u = vmch_format_text 65535 |
| 519 | ob_write_fd 1 |
| 520 | put vcon_last_st 0 0 |
| 521 | ret 0 |
| 522 | end |
| 523 | if eq cmd 14 |
| 524 | vwld_unattached |
| 525 | if ne isj 0 |
| 526 | u = vwld_format_json 65535 |
| 527 | ret vcon_emit_ok_json cmd 0 |
| 528 | end |
| 529 | u = vwld_format_text 65535 |
| 530 | ob_write_fd 1 |
| 531 | put vcon_last_st 0 0 |
| 532 | ret 0 |
| 533 | end |
| 534 | if eq cmd 19 |
| 535 | ll = get vpc_llen 0 |
| 536 | for i ulong ll bound 4096 |
| 537 | put v_sbuf i get vpc_line i |
| 538 | end |
| 539 | er = olw_eval_sbuf ll |
| 540 | if lt er 0 |
| 541 | el = get olx_elen 0 |
| 542 | for i ulong el bound 256 |
| 543 | put v_sbuf i get olx_err i |
| 544 | end |
| 545 | ret vcon_emit_err_sbuf cmd el |
| 546 | end |
| 547 | if ne isj 0 |
| 548 | ob_reset 65535 |
| 549 | ob_putc uchar 123 |
| 550 | ob_putc uchar 34 |
| 551 | ob_puts vpc_c_id |
| 552 | ob_putc uchar 34 |
| 553 | ob_putc uchar 58 |
| 554 | ob_putc uchar 34 |
| 555 | ob_puts vt_sha256_pfx |
| 556 | for i ulong 32 |
| 557 | ob_put_hex_byte ulong get v_last_id i |
| 558 | end |
| 559 | ob_putc uchar 34 |
| 560 | ob_putc uchar 125 |
| 561 | ret vcon_emit_ok_json cmd 1 |
| 562 | end |
| 563 | if ne get olw_has_val 0 0 |
| 564 | if ne get olw_val_is_bool 0 0 |
| 565 | if ne get olw_val_out 0 0 |
| 566 | v_write_all 1 vcon_t_true |
| 567 | else |
| 568 | v_write_all 1 vcon_t_false |
| 569 | end |
| 570 | else |
| 571 | ob_reset 65535 |
| 572 | ob_put_u64 get olw_val_out 0 |
| 573 | ob_putc uchar 10 |
| 574 | ob_write_fd 1 |
| 575 | end |
| 576 | end |
| 577 | put vcon_last_st 0 0 |
| 578 | ret 0 |
| 579 | end |
| 580 | if eq cmd 15 |
| 581 | if eq get vpc_argc 0 0 |
| 582 | if ne isj 0 |
| 583 | ob_reset 65535 |
| 584 | ob_putc uchar 91 |
| 585 | ob_putc uchar 93 |
| 586 | ret vcon_emit_ok_json cmd 3 |
| 587 | end |
| 588 | v_write_all 1 vcon_t_no_eff |
| 589 | put vcon_last_st 0 0 |
| 590 | ret 0 |
| 591 | end |
| 592 | end |
| 593 | if eq cmd 11 |
| 594 | put vev_filter_on 0 0 |
| 595 | evl = get vcon_evlen 0 |
| 596 | if eq evl 0 |
| 597 | if ne isj 0 |
| 598 | ob_reset 65535 |
| 599 | ob_puts vev_t_j1 |
| 600 | ob_put_u64 0 |
| 601 | ob_puts vev_t_jend |
| 602 | ret vcon_emit_ok_json cmd 0 |
| 603 | end |
| 604 | v_write_all 1 vev_t_noev |
| 605 | put vcon_last_st 0 0 |
| 606 | ret 0 |
| 607 | end |
| 608 | for i ulong evl bound 256 |
| 609 | put v_sbuf i get vcon_evroot i |
| 610 | end |
| 611 | sr = vev_scan_sbuf evl |
| 612 | if lt sr 0 |
| 613 | ret vcon_emit_err_txt cmd vcon_t_unk_id |
| 614 | end |
| 615 | if ne isj 0 |
| 616 | u = vev_format_json 65535 |
| 617 | ret vcon_emit_ok_json cmd 0 |
| 618 | end |
| 619 | u = vev_format_text 65535 |
| 620 | ob_write_fd 1 |
| 621 | put vcon_last_st 0 0 |
| 622 | ret 0 |
| 623 | end |
| 624 | ret vcon_cmd_subject cmd isj |
| 625 | end |