• src/syncterm/Wren.adoc src/syncterm/scripts/auto/connected/console.wre

    From Deucе@1:103/705 to Git commit to main/sbbs/master on Tue Apr 28 06:00:41 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/feab4f3a1cac2087b0260c95
    Modified Files:
    src/syncterm/Wren.adoc src/syncterm/scripts/auto/connected/console.wren src/syncterm/scripts/syncterm.wren wrentest.wren src/syncterm/term.c wren_bind.c wren_host.c wren_host.h wren_host_internal.h
    Log Message:
    SyncTERM: Wren result-queue framework + CTerm.suspended

    Generic completion queue: callable C-side request data + fiber
    handle + deliver/free callbacks travel through one mutex-protected
    FIFO, drained at the top of each doterm() iteration. The drainer
    walks each entry, skips fibers where Fiber.isDone (cached primitive
    handle), builds the Wren foreign right before wrenCall, and
    releases the handle + frees the data after. Workers can push from
    any thread; delivery is owner-thread only.

    Input.nextEvent now flows through the queue: dispatch_key/dispatch_mouse
    push an input_result carrying the raw key code or mouse_event and
    transfer the parked fiber handle. One-iteration latency on
    delivery, but the wrenCall is no longer fired mid-foreign-stack.

    Replaces the implicit "parking on Input.nextEvent claims the
    screen" behavior with an explicit CTerm.suspended Bool. Backed
    by a doterm() local; while true, the wire pump halts and bytes
    pile up in the conn buffer until the TCP window fills and the
    remote sees backpressure.

    When the suspend flag transitions back to false, doterm() credits
    the byte pump with all the bytes that would have drained at the
    emulated rate during the suspended window. Those bytes burst past
    the speed gate one per pump iteration until the credit runs out;
    the visible output catches up to where it would have been with no
    suspend. No-op when speed emulation is disabled.

    Adds T06 to wrentest.wren that exercises the queue end-to-end:
    parks a fiber on Input.nextEvent, ungets a sentinel key, sets +
    clears CTerm.suspended around the resume, and verifies the fiber
    captured the right KeyEvent. Also flips console.wren's launcher
    hook to the filtered Hook.onKey(Key.wrenConsole) form.

    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Tue Apr 28 09:22:53 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/cf86f51e84049319c38da7a8
    Modified Files:
    src/syncterm/Wren.adoc src/syncterm/scripts/auto/connected/console.wren src/syncterm/scripts/wrentest.wren
    Log Message:
    SyncTERM: WrenConsole.register for module-defined REPL commands

    Modules can plug in their own /<name> entries via
    WrenConsole.register(name, help, fn). The handler runs with the raw
    argument string (everything after the first separating space, or ""
    if none) inside a Fiber so a runtime abort surfaces as a logged
    error rather than tearing the console out from under itself.
    Re-registering a name overwrites; names can't contain spaces.

    /? now lists registered commands as continuation lines under the
    built-in "commands:" row, each annotated with the help text. WrenConsole.unregister(name) drops a registration (idempotent); WrenConsole.commands returns the sorted list of currently-registered
    names for tests + tooling.

    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)