Success-exclusive code was emitted outside the if-else, so it ran even
when the call failed. Now it's wrapped in else { ... } — shared code
(blocks reachable from both error and success paths) stays outside.
- _emitBranch now sets _genVisited on blocks before calling generateOwnCode
so that proc calls inside loop bodies can seed their error-handling
visited set from the main traversal, preventing loop-decision re-walk
- Add _noWalkNext flag on proc calls when error handling is active, so
_emitBranch skips redundant nextFlow walking (the success path was
already covered by the error-handling branch emission)
- Known issue: shared blocks that are direct roots of emitBranch (from
the shared set) may still be re-walked when they were already emitted
by a downstream proc call's error-handling success path
- _emitBranch walk no longer adds decisions to visited before calling
generateCode — let the decision's own generateCode manage its visited
tracking. Otherwise the decision's generateCode sees itself as already
visited and returns empty, dropping its entire subtree.
- Same fix in both codegen/index.js and blocks-algo.js
- Add CodeGen.findBackEdges(root) pre-pass — DFS-based back-edge
detection that finds all blocks targeted by at least one back-edge
- Only those blocks get C labels; only those back-edges emit goto
- emitBranch reverts to generateOwnCode + manual successor walking
(respects stop set properly for shared blocks)
- generateCode/generateNextCode accept loopTargets parameter;
visited-but-not-back-edge blocks are silently skipped
- No more -Wunused-label warnings in compiled output
- WCBlock.generateCode checks _isFlowBlock (set from #draw-area presence)
before emitting labels/gotos; variable blocks in #variable-area skip this
- Remove unconditional vertices array creation in main() — it was only
relevant for the SDL3 triangle template, which should create it itself
if needed
- wcprogram.js.generateCode now checks if the body already contains
a return or exit statement before appending the hardcoded return 0;
This eliminates the duplicate return 0 from the END block.
- Every block now emits a C label (its id) before its code
- generateNextCode emits goto label; for back-edges (visited targets)
- _emitBranch delegates to generateCode (not generateOwnCode), so labels
are emitted consistently in both main and branch traversals
- generateCallWithError threads a shared visited set across all three
emitBranch calls, preventing duplicate label emission for shared blocks
- emitBranch skips roots already visited by previous roots in the same
branch (prevents spurious gotos from shared-block traversal)
- Create codegen/index.js with pure branchDescendants, emitBranch,
generateCallWithError, and generateCFile — zero DOM dependencies
- blocks-proc.js adapters delegate to CodeGen with browser instanceof check
- run.js uses the same CodeGen module instead of duplicating block classes
with their own branchDescendants/emitBranch logic
- Load codegen/index.js in browser before blocks-proc.js
- Add gcc and mesa to shell.nix for C compilation
- Fix warning icon overlap with ::after message by adding padding-right
to proccall-header and end-header when warnings are active
- Add tests/compile/ with Makefile (pkg-config based) and run.js
which generates C source from block-like data structures, then
compiles with gcc -Wall -Wextra -fsyntax-only
- Tests cover: console template, simple error, error merge,
sequential errors, value-return error style
- Default colour now checks dataset.exitError instead of tagName === 'WC-END',
so success (exit 0) END blocks default to blue, error END blocks to red
- _selectByCode now also sets the HTML value attribute via setAttribute(),
ensuring cloneNode(true) preserves the formatted display value
- Add 4 regression tests for colour defaults, attribute sync, and clone value
- Replace if/else wrapping in WCProcCall.generateOwnCode with branch-aware
generation via _branchDescendants, _emitBranch, and _generateCallWithError
- Shared blocks (reachable from both error and success paths) now appear
only once after the if-block, avoiding deeply nested code
- Add 8 browser tests covering merge, decision passthrough, value style,
sequential calls, and shared-only error paths
- Increase template block spacing (16px -> 40px) for readability
- Add error WCEnd blocks to console and SDL3 templates with error-hook
connections to all failure-mode proc calls
- Hide editable WCProcCall input fields behind field-display spans,
matching existing algorithm-block convention
HTML defines template-based UI for flow chart nodes (start, end, output, decision, datum). CSS provides grid-based canvas and node styling. JS implements custom elements with drag-and-drop, linkable connections, and C code generation.