You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

4.4 KiB

Recovered 2024 Tcl source patches (G-096)

Origin: c:/buildtcl/2024zig/build_tcl90/patch/ (reference snapshot TEMP_REFERENCE/2024zig/build_tcl90/patch/), written against ~Tcl 9.0b4-era sources (Aug 2024; tclZipfs/tclCmdIL Nov 2024). Recovered into tracked form 2026-07-20 - these files previously existed only in those two VCS-ignored on-disk copies.

The tclZipfs/tclCmdIL patches are NOT applied by any build. The piperepl capability IS built by default since 2026-07-20 - as SEPARATE products (tclsh90spr, tclsh90sprzip) compiled from the rebased tclMain_piperepl_905.c; the stock tclsh90s/tclsh90szip products continue to compile upstream sources unpatched. NAMING NOTE: the spr names are suite-internal WORKING names - the published family naming (G-103) will carry 'punk' in patched runtime names (e.g tclsh905punk.exe, user 2026-07-21) so patched and unpatched are never confusable.

tclMain.c.piperepl.patch / tclMain_piperepl.c (the TCLSH_PIPEREPL capability)

tclMain_piperepl.c is the full patched file; the .patch is its diff against the era's stock tclMain.c.

Purpose (the G-096 goal capability): allow returning to a standard C-level tcl repl after launching from a kit with its own main.tcl - not possible with unmodified sources. Gated by the TCLSH_PIPEREPL env var (unset/0 = stock behaviour). When enabled:

  • Publishes ::tclsh(istty) (unlinked fact) plus linked ::tclsh(dorepl) and ::tclsh(evalinput) before the startup script runs; a script-arg launch defaults dorepl to 0 (stock semantics) but the script may set ::tclsh(dorepl) 1 to drop into the interactive repl after it completes.
  • Piped (non-tty) input the script did not consume is accumulated into ::tclsh(inputbuffer) rather than evaluated as commands, unless the script opts in with ::tclsh(evalinput) 1 - protects arbitrary piped data from accidental eval.
  • On stdin eof with dorepl set, stdin is reopened from the console (CONIN$ on windows, /dev/tty elsewhere) and installed as the std channel, yielding a live standard repl after a pipeline ends.

Status: REBASED 2026-07-20 as tclMain_piperepl_905.c (stock 9.0.5 tclMain.c + this patch, which applied cleanly at offset 4, + the gate-default flip). GATE SEMANTICS CHANGED from the 2024 original per the G-103 punk-kit policy: the patched binary is ENABLED unless TCLSH_PIPEREPL=0 (2024 was opt-in via set-and-not-"0"). Even enabled it is inert for scripts that never set ::tclsh(dorepl) - script-arg runs default dorepl to 0, and unconsumed piped input is buffered rather than eval'd. The stock-behaviour escape hatches are TCLSH_PIPEREPL=0 and the unpatched plain products. Era files (tclMain_piperepl.c, the .patch) are kept unmodified as the recovered 2024 artifacts. Known divergence when the gate is OPEN: tcl_interactive is linked to the internal tty flag BEFORE the startup script runs (stock links it only when entering the repl loop). Two visible effects: a script that WRITES ::tcl_interactive influences prompting behaviour in the patched shell where stock would ignore the write until repl entry (load-bearing - it is how a piped script that sets dorepl opts into prompts/echo in the reopened repl); and a script-arg launch from a CONSOLE READS 1 where stock reads 0 (stock sets it once to !path && istty; the early link overwrites that with the tty flag. Piped launches read 0 either way, so only console script runs diverge for readers - verified against punk9_beta 2026-07-23). Patch rev 2026-07-24 (G-118 items 1+7; in-source, effective at the next suite rebuild - the G-117 cycle): the "? reopen stdin from console" notice is emitted only when TCLSH_PIPEREPL_DEBUG is set truthy (stock prints nothing entering a repl), and the reopen-path messages (gated notice + genuine failure messages) moved from stdout to STDERR; ::tclsh(reopened) is published as an unlinked fact (0 at gate-open startup, republished 1 after a successful console reopen) - previously inferable only via info exists ::tclsh(inputbuffer). Note the punkshell-level analogue for the punk repl is G-038 (piped-to-interactive session continuity) - this patch is the plain-tclsh/kit-runtime counterpart.

tclZipfs.patch, tclCmdIL.patch

Companion experiment patches from the same era (zipfs behaviour and tclCmdIL tweak), recovered for durability; unexamined in detail. See the fossil-era notes in TEMP_REFERENCE/2024zig/build_tcl90/patch/ (doc/, prev/, test_zipfs_patch/) for their surrounding experiment context.