[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: connection to tcl/tk

Bjoern Hoefling <hoefling@dfki.uni-kl.de> asks how to realize a connection
between a CommonLisp and tcl/tk.

> create a bidirectional stream between Lisp and the tcl/tk shell wish.

CLISP supports unidirectional streams to other programs through the
implemented bidirectional streams because that could lead to deadlocks.
See impnotes.txt for details.

> I discovered only the possibility to realize a communication via 2 files,
> one for the messages from lisp to tcl and one for the way back and Lisp 
> and wish must explicitly read from/write on that files.

You may simplify this by using FIFOs (named pipes) instead of ordinary files.
Try something like that:

  (shell "mkfifo /tmp/wish-in")
  (shell "mkfifo /tmp/wish-out")
  (setq *lisp-to-wish-stream*
    (make-two-way-stream (open "/tmp/wish-out" :direction :input)
                         (open "/tmp/wish-in" :direction :output)
  ) )
  (shell "wish < /tmp/wish-in > /tmp/wish-out")
  (delete-file "/tmp/wish-in")
  (delete-file "/tmp/wish-out")

> I am using both clisp under Linux on a PC (486) and under Unix on Sun.

mkfifo is contained in the GNU file utilities.

                    Bruno Haible