On Friday, October 8, 2021 at 9:40:05 PM UTC-7, Christian Werner wrote:
Maybe the pure Tcl readline from the wiki is a starting point, see
https://wiki.tcl.tk/20215 and https://wiki.tcl.tk/16139 and https://wiki.tcl-lang.org/page/Pure%2Dtcl+readline2
What I ended up doing - >
1- Registered 2 commands I needed anyway
Tcl_CreateCommand(interp, "show_gui", StartTclEventLoop,
NULL, NULL);
Tcl_CreateCommand(interp, "hide_gui", EndTclEventLoop,
NULL, NULL);
2. Such commands enter /exit event loop :
static Tcl_CmdProc StartTclEventLoop;
static Tcl_CmdProc EndTclEventLoop;
static void MainTclLoop(void);
static void MainTclLoop(void)
{
while (!exitMainLoop) {
Tcl_DoOneEvent(0);
}
fprintf(stdout, "Exit MainLoop\n");
fflush(stdout);
}
static int StartTclEventLoop(
ClientData dummy, /* Not used. */
Tcl_Interp* interp,/* Current interpreter. */
int argc, /* Number of arguments. */
const char** argv) /* Argument strings. */
{
exitMainLoop = 0;
Tcl_SetMainLoop(MainTclLoop);
return TCL_OK;
}
static int EndTclEventLoop(
ClientData dummy, /* Not used. */
Tcl_Interp* interp,/* Current interpreter. */
int argc, /* Number of arguments. */
const char** argv) /* Argument strings. */
{
exitMainLoop = 1;
return TCL_OK;
}
}
3. Everything works with original tcl_mainexcept command prompt is not printed for sometimes after command is executed through the sent message from other thread, trying investigate this right now
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)