diff --git a/wasm/c/lumbda-c.loader.js b/wasm/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/wasm/c/lumbda-c.loader.js +++ b/wasm/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, diff --git a/wasm/dist-repl/c/lumbda-c.loader.js b/wasm/dist-repl/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/wasm/dist-repl/c/lumbda-c.loader.js +++ b/wasm/dist-repl/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, diff --git a/www/playground/c/lumbda-c.loader.js b/www/playground/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/www/playground/c/lumbda-c.loader.js +++ b/www/playground/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, diff --git a/www/repl/c/lumbda-c.loader.js b/www/repl/c/lumbda-c.loader.js index 1e2e8e2..bfde8d3 100644 --- a/www/repl/c/lumbda-c.loader.js +++ b/www/repl/c/lumbda-c.loader.js @@ -30,13 +30,19 @@ async function _bootstrap() { let outBuf = []; let errBuf = []; let currentOnChunk = null; + // Temporary debug — log every Module.print invocation so we can + // see exactly what Emscripten passes us (with/without trailing + // newline). Remove once the streaming-newline bug is resolved. + const DEBUG_STREAM = true; const module = await createLumbdaC({ locateFile: (p) => wasmDir + p, print: (line) => { + if (DEBUG_STREAM) console.log("[c-tier print]", JSON.stringify(line)); outBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); }, printErr: (line) => { + if (DEBUG_STREAM) console.log("[c-tier printErr]", JSON.stringify(line)); errBuf.push(line); if (currentOnChunk) currentOnChunk(line + "\n"); },