Dispatch function for views with AnonymousViewContext (no sender)
| 553 | |
| 554 | // Dispatch function for views with AnonymousViewContext (no sender) |
| 555 | int16_t Module::__call_view_anon__( |
| 556 | uint32_t id, |
| 557 | BytesSource args_source, |
| 558 | BytesSink result_sink |
| 559 | ) { |
| 560 | // Check if view ID is valid |
| 561 | if (id >= g_view_anon_handlers.size()) { |
| 562 | fprintf(stderr, "ERROR: Invalid anonymous view ID %u (have %zu anonymous views)\n", |
| 563 | id, g_view_anon_handlers.size()); |
| 564 | return -1; // NO_SUCH_VIEW |
| 565 | } |
| 566 | |
| 567 | // Create anonymous view context |
| 568 | AnonymousViewContext ctx; |
| 569 | |
| 570 | // Get the handler |
| 571 | const auto& handler_info = g_view_anon_handlers[id]; |
| 572 | |
| 573 | // Call the view handler - returns fully serialized result data, including the header byte. |
| 574 | std::vector<uint8_t> result_data = handler_info.handler(ctx, args_source); |
| 575 | WriteBytes(result_sink, result_data); |
| 576 | |
| 577 | return 2; // Success with data |
| 578 | } |
| 579 | |
| 580 | // Dispatch function for procedures |
| 581 | int16_t Module::__call_procedure__( |
nothing calls this directly
no test coverage detected