• src/syncterm/Wren.adoc src/syncterm/scripts/wrentest.wren src/syncterm

    From Deucе@VERT to Git commit to main/sbbs/master on Tuesday, April 28, 2026 06:25:04
    https://gitlab.synchro.net/main/sbbs/-/commit/572a7ff6bf903c063edc99a6
    Modified Files:
    src/syncterm/Wren.adoc src/syncterm/scripts/wrentest.wren src/syncterm/term.c wren_host.c wren_host.h
    Log Message:
    SyncTERM: Hook.onInput String returns + filter spillover

    Extend Hook.onInput so a handler can return a String to replace
    the input byte with the string's bytes (up to 256; bigger
    replacements log a runtime error and the byte passes through).
    Bool true still drops, anything else still passes through.

    Decouple the wire-side buffer from recv_byte_buffer: a separate
    wire_buffer holds raw conn_recv_upto bytes, and the filter runs
    them into recv_byte_buffer until either input exhausts or output
    fills. When a replacement won't fit, the filter pauses on that
    input byte; the unprocessed wire-side tail stays parked in
    wire_buffer until the next recv_bytes() call drains something out
    and frees room for it. Spillover means recv_byte_buffer never has
    to grow past BUFFER_SIZE even with aggressive expansion.

    wren_host_dispatch_input now returns int — KEEP/DROP/N — and writes replacement bytes into a caller-provided buffer. The caller (wren_filter_input) commits N bytes only if they fit, otherwise
    backs out without consuming the input byte.

    Adds an LF→CRLF hook to wrentest.wren that ticks a counter when it
    fires; report_() asserts the counter is positive, exercising the
    new WREN_TYPE_STRING dispatch branch end-to-end.

    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net