Embedding into Tcl/Tk

# Chapter 5 Embedding into Tcl/Tk

This chapter describes how to embed ECLiPSe into a Tcl host program. Tcl/Tk is a cross-platform toolkit for the development of graphical user interfaces. The facilities described here make it possible to implement ECLiPSe applications with platform-independent graphical user interfaces. The interface is similar in spirit to the ECLiPSe embedding interfaces for other languages.

An alternative method of using ECLiPSe with Tcl is to use the Tcl remote interface, described in chapter 6. In this case, the ECLiPSe is ran as a separate program. The facilities provided by the remote and embedding interfaces are largely compatible, so that it is possible to reuse the same Tcl and ECLiPSe code in both interface. The advantage of the embedding interface is that ECLiPSe is much more tightly coupled with the Tcl program, and communication between the two is more efficient. The advantage of the remote interface is that the Tcl and ECLiPSe programs are not tightly coupled, and in fact can be run on separate machines.

The tkeclipse development environment is entirely implemented using the facilities described in this chapter. The toplevel of tkeclipse is currently implemented using only the embedding interface, but the development tools can be used with both the embedding and remote interfaces.

- Loading the interface
- Initialising the ECLiPSe Subsystem
- Shutting down the ECLiPSe Subsystem
- Passing Goals and Control to ECLiPSe
- Communication via Queues
  - From-ECLiPSe to Tcl
  - To-ECLiPSe from Tcl
- Attaching Handlers to Queues
  - Tcl handlers
  - ECLiPSe handlers
- Obtaining the Interface Type
- Type conversion between Tcl and ECLiPSe
- Incompatible and obsolete commands