bend: wire bend!-call into the Emscripten C tier — playground c ⚡
lumbda_wasm_entry.c — adds an EM_JS bridge js_lumbda_bend_call that
does sync XHR POST (legal inside Web Workers, the playground's tier
host) and writes the response bytes back into the wasm heap. C
wrapper bi_bend_call_wasm allocates a 256 KiB response buffer, calls
the EM_JS function, wraps the bytes as a lumbda string Value, and
gets registered as the `bend!-call` builtin in lumbda_wasm_init —
not in c/builtins.c, so the native CLI build doesn't acquire a
wasm-flavored binding it can't satisfy.
lumbda-c.loader.js — setBendUrl(url) mutates globalThis._lumbdaCBendUrl
which the EM_JS reads on every call. runner.js plumbing already
propagates a saved playground URL to every tier's setBendUrl on
each save.
C tier now matches asm + pyodide for HTTP-mode bend. End-to-end
verified in node + wasm directly: bend!-call returns the configured
URL response text; "no bend URL configured" when unset; clean
"bend error: ..." string when the XHR throws (e.g., CORS, network).
Tested against the live bend.unturf.com chain via the playground.
Three tiers in parallel now show the same (ok (HEX0 HEX1 HEX2))
result from (cuda-shake-fanout ("00" "01" "deadbeef") 32).
This commit is contained in:
parent
d672ab077e
commit
1458ebf77a
11 changed files with 106 additions and 5 deletions
File diff suppressed because one or more lines are too long
|
|
@ -27,7 +27,13 @@ async function _bootstrap() {
|
|||
|
||||
_init();
|
||||
|
||||
// bend!-call host bridge — js_lumbda_bend_call inside the wasm
|
||||
// (EM_JS in lumbda_wasm_entry.c) reads globalThis._lumbdaCBendUrl
|
||||
// for the destination, then does sync XHR POST and writes the
|
||||
// response bytes back into the wasm heap. setBendUrl mutates that
|
||||
// global so runner.js can propagate a saved playground URL.
|
||||
return {
|
||||
setBendUrl(url) { globalThis._lumbdaCBendUrl = url || null; },
|
||||
async evalLisp(src) {
|
||||
outBuf = [];
|
||||
errBuf = [];
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -27,7 +27,13 @@ async function _bootstrap() {
|
|||
|
||||
_init();
|
||||
|
||||
// bend!-call host bridge — js_lumbda_bend_call inside the wasm
|
||||
// (EM_JS in lumbda_wasm_entry.c) reads globalThis._lumbdaCBendUrl
|
||||
// for the destination, then does sync XHR POST and writes the
|
||||
// response bytes back into the wasm heap. setBendUrl mutates that
|
||||
// global so runner.js can propagate a saved playground URL.
|
||||
return {
|
||||
setBendUrl(url) { globalThis._lumbdaCBendUrl = url || null; },
|
||||
async evalLisp(src) {
|
||||
outBuf = [];
|
||||
errBuf = [];
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue