LISP2WISH --------------- Changes: 7/20/94 JMK (test.tcl) Removed dependence on awk. Changed 'eval [expr $i]' to just 'eval $i' (lisp2wish.lisp) Added (finish-lisp-broadcast) to close-wish-stream function. --------------- This is a very simple demonstration of how to use a Tcl script as an interface to a Lisp process (running Lucid Common Lisp). Essentially, Lisp (in function "init-interface") starts a process that executes the Wish script "test.tcl". The interaction is completely SYNCHRONOUS-- Lisp and Wish take turns waiting for the other. The wish script waits for user input, meanwhile Lisp is waiting to hear from Wish. When the user does something Lisp should know about, the wish script tells Lisp what happened. Wish then waits for Lisp to tell it to go on. The Wish script displays a small window with a number of buttons. When you click on a button, the wish script sends a code to the awaiting Lisp function. It looks up the code sent in a hash table and calls a function that has been registered with that code. The demonstration includes - calling a Tcl procedure from Lisp (with and without arguments) - reconfiguring a widget from within Lisp - defining and executing a Tcl procedure dynamically from Wish ------------------ Requirements: o Tcl ("wish") version 6.0 or higher. o Lucid Common Lisp, version 4.0 or so. Again, nothing inherently fancy (run-program), but I know it works here. or Allegro Common Lisp (I'm told). I haven't tested this, though. ------------------- This tar file contains the following five files: README (this file) test.tcl lisp2wish.lisp test.lisp FILE LOADING: In Lisp, because of the hash table initialization, you must load "lisp2wish.lisp" before "test.lisp". SITE CONFIGURATION: You must change the top line in test.tcl to indicate where your copy of "wish" (the interpreter) resides. ------------------ To use: Make sure your environment can run the wish interpreter. get into lisp > (load "lisp2wish.lisp") > (load "test.lisp") > (main) and away you go! ------------------ Good Luck! Please write with comments, suggestions or questions. My system is more extensive than this with respect to exchanging info between Wish and Lisp, but this gives the basic idea. If you send me your email address, I will update you if I see that someone has made an improvements. I don't see any reason you couldn't substitute your own interpreter for "wish" if you've built new Tcl commands through Tk, then Lisp could use them as well. Jonathan kaye@linc.cis.upenn.edu February 27, 1992 *EOF*