The clTcl package embeds Tcl/Tk in Common Lisp. It parses Tcl scripts into lists of strings. These strings are properly escaped so they can be send to a Tcl/Tk interpreter. The package provides an interface to launch Tcl/Tk and setup a two-way stream for communication. Finally it provides synchronized communication between Lisp and Tcl/Tk.
Tcl scripts are parsed into list of strings. Just like Lisp, Tcl has a uniform syntax that is easily parsed. A Tcl script is a list of commands. The script is read and every command becoms a properly escaped string.
Reader macro #TCL[] reads the Tcl script between square brackets.
A running clTcl program is a Lisp process and a Tcl/Tk process that communicate via a two-way stream. Launching Tcl/Tk is implementation dependent. The stream is available via global *stream*.
The event-loop is synchronized with Tcl/Tk's event loop. There is a single flow of control that switches back and forth between Lisp and Tcl/Tk.
The event-loop starts a Tcl/Tk process, loads the given script and starts listening for events. When the user exits the application the event-loop terminates and so does the application.
The typical flow of control during a cycle in the event loop is