BBS:      TELESC.NET.BR
Assunto:  src/syncterm/scripts/connected.wren console.wren src/syncterm/wren_hos
De:       Deuc¨
Data:     Mon, 27 Apr 2026 16:09:28 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/dbd8d7bd3c0dafd5849899d6
Modified Files:
	src/syncterm/scripts/connected.wren console.wren src/syncterm/wren_host.c
Log Message:
SyncTERM: load each Wren entry script into its own module

Was: every embedded script (console, connected, runtests) got
loaded into the shared `syncterm` module so it could see the
foreign-class declarations and Wren-side helpers without an
import.  That forced a chunk of "load syncterm first, route user
overrides of any embedded script back into the syncterm module"
gymnastics in wren_host_init and load_one_script.

Now: each entry script runs as its own filename-named module and
pulls bindings from `syncterm` via a top-of-file import.

* scripts/console.wren  imports Hook, Screen, Console, Input,
                        Clipboard, Key, REPL, LogSource, MouseEvent
* scripts/connected.wren imports Hook, Conn, BBS, CTerm, ConnType,
                        Emulation
* scripts/runtests.wren  was already importing what it needed.

`host_load_module` becomes the single source of truth for "find a
module's source"  search order is user scripts/.wren, then
user scripts/load/.wren, then EMBEDDED_SCRIPTS.  The
embedded fallback returns a static pointer with onComplete == NULL
so Wren skips the free.  Extracted read_script_file so the
loader and load_one_script share one reader.

is_embedded_script_name and the "route overrides into syncterm"
branch in load_one_script are gone.  wren_host_init replaces the
old user-override-vs-embedded-fallback ladder with one bootstrap
line  `wrenInterpret(vm, "_bootstrap", "import \"syncterm\" for
Cell, Cells, KeyEvent, MouseEvent\n")`  which triggers the
unified lookup and verifies the foreign classes exist before the
C side caches their handles.

Co-Authored-By: Claude Opus 4.7 (1M context) 
n
---
  mSynchronetn  hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net

-----------------------------------------------------------
[Voltar]