Tcl interpreter embedded in wxWidgets?

I'd like to embed a TCL (not Tk) interpreter into my wxWidgets application.=
I saw a thread from long ago (2004? 2006?) that discusses this, but I didn=
't see any successes mentioned. I looked at cpptcl at SourceForge, but woul=
d like to do a more "formal" embed into my C++/wxWidgets application.=20
Tcl provides a mechanism for embedding itself into other applications via T=
cl_SetNotifier and Tcl_SetMainLoop calls. Tcl_SetNotifier allows the defini=
tion of callback functions that Tcl can use to service certain events, and =
Tcl_SetMainLoop defines the main event loop that Tcl should call (normally =
the application's main event loop). This allows Tcl to use the application'=
s event loop (and therefore the application is in control). Others have use=
d this feature to embed Tcl into Qt...=20
If one builds Tcl (or the Tcl/Tk combination) as a standalone application, =
it includes its own event loop. Of course other applications (or applicatio=
n frameworks), like wxWidgets (or Qt, etc.) have their own event loops. Whe=
n embedding a scripting interpreter like Tcl into an application framework,=
both can't control the processing of events, so one has to "give up" contr=
ol to the other.
Tcl appears to provide a mechanism to yield event processing to the applica=
tion it is being embedded into, as long as the events needed by Tcl can be =
processed/passed to it. It looks like Tcl does this via:
1. Defining callbacks for the events. Tcl defines:
typedef struct Tcl_NotifierProcs {
Tcl_SetTimerProc *setTimerProc;
Tcl_WaitForEventProc *waitForEventProc;
Tcl_CreateFileHandlerProc *createFileHandlerProc;
Tcl_DeleteFileHandlerProc *deleteFileHandlerProc;
Tcl_InitNotifierProc *initNotifierProc;
Tcl_FinalizeNotifierProc *finalizeNotifierProc;
Tcl_AlertNotifierProc *alertNotifierProc;
Tcl_ServiceModeHookProc *serviceModeHookProc;
} Tcl_NotifierProcs;
This defines a data structure that names functions for various events. I th=
ink I have the "timer" related functions covered. wxWidgets has functions t=
hat pretty closely parallel the requested Tcl timer needs. Most of the othe=
rs don't seem too important for a simple script interpreter. The ones relat=
ed to file handling are mentioned below.=20
2. This data structure is passed to Tcl using Tcl_SetNotifier() call
3. The application's event loop call is given to Tcl via the Tcl_SetMainLoo=
p() call.
4. Then Tcl_Main() is called. Since step 3 gives Tcl the application's loop=
, Tcl will initialize itself, then give up control to the application event=
loop.
The wxWidgets event loop is then in control.
Since some of the information needed by the data structure mentioned above =
is dependent upon some of the inner-workings of wxWidgets, I could use sugg=
estions on how best to meet the needs of this structure. In particular, the=
Create/Delete File Handlers seem to be functions that monitor the state of=
the file descriptor (ie. is data available for reading, can data be writte=
n, etc.) Is there a convenient way get this from wxWIdgets?
Is there a wxWidgets event loop function that can be passed to Tcl_SetMainL=
oop? Tcl wants a function with the prototype:=20
typedef void Tcl_MainLoopProc(void);
Has anyone been successful in using this to embed Tcl into wxWidgets? (I =
know many prefer Python, but TCL has been used in CAD tools for many years =
and I'd like to use it as well!)
Any assistance is appreciated!
Many thanks!