BBS: TELESC.NET.BR Assunto: src/syncterm/scripts/syncterm.wren src/syncterm/wren_bind.c wren_host. De: Deuc¨ Data: Mon, 27 Apr 2026 16:09:28 -0700 ----------------------------------------------------------- https://gitlab.synchro.net/main/sbbs/-/commit/378af3b080bb6209bc6a3649 Modified Files: src/syncterm/scripts/syncterm.wren src/syncterm/wren_bind.c wren_host.c wren_host_internal.h Log Message: SyncTERM: lazy-cache foreign class handles, move Cache into Wren Cleanup after rev to per-module entry scripts: * The four foreign-class handles (Cell, Cells, KeyEvent, MouseEvent) were captured eagerly in wren_host_init, which forced an `import "syncterm"` bootstrap to run first so the wrenGetVariable lookups had a loaded module to read from. None of that was necessary the handles are pure caches around symbol-table lookups, and by the time any allocation site runs, the calling script has already imported syncterm. New load_class_into_slot helper does the fetch-and-cache lazily; six allocation sites (push/resume key & mouse, fn_Screen_readRect, cells_make_view) call it at the slot they were already filling. The `if (... || st->X_class == NULL)` bailouts on those sites were guarding a case the lazy fill makes impossible. * `Cache` (the singleton Directory pointing at the script-cache directory) was injected into the syncterm module from C via wren_bind_define_cache, reaching into vm->modules and calling wrenDefineVariable. Replaced with a Wren-side `var Cache = ...` in syncterm.wren backed by a new foreign static Host.cacheDirectory. Cache is now an ordinary module variable instead of a C-injected ghost. A user override of syncterm.wren has to include the same boilerplate (one line) to keep Cache available that's the trade-off, and matches the rest of the module's "the override is responsible for the contract" model. * The entry-script iteration's special-case skip for "syncterm" is gone; both loops now use wrenHasModule to skip any module another entry script's import already loaded. Same effect for syncterm, plus handles any future library-also-embedded module generically. wren_host_init shrinks to: make VM wire callbacks cache call/call(_) handles set ownership glob run embeds run user scripts. No bootstrap, no eager class capture, no Cache injection, no name-specific skip. Co-Authored-By: Claude Opus 4.7 (1M context)n --- mSynchronetn hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net ----------------------------------------------------------- [Voltar]