Previous Up

6.9  Differences From the Tcl Embedding Interface

The remote Tcl interface is designed to be largely compatible with the embedded Tcl interface, so that a user GUI can be written that allows either interfaces to be used, while sharing most of the code in both ECLiPSe and Tcl. An example of this is the Tkeclipse development tools.

Some remote specific code would need to be written. This includes code to handle the connection and disconnection of the Tcl and ECLiPSe sides: there is no equivalent to ec_cleanup in the embedded Tcl interface, as the termination of the ECLiPSe side should be handled in ECLiPSe. In addition, the user may need to provide code to restrict the interaction within the Tcl/Tk GUI when control is transferred to ECLiPSe. Aside from this, the rest of the code should be reusable, if the user exercises some care.

The supported compatible methods of communicating between Tcl and ECLiPSe in the two interfaces is via the ec_rpc calls and the use of the I/O queues. The ec_rpc mechanism should behave the same in both interfaces. For the queues, there are some differences because the queues are in-memory queues in the embedded interface, but are socket channels in the remote interface. This leads to the following differences:

In summary, to write code that will work for both the remote and embedded interfaces, the data should be sent using EXDR format, flush always performed, and a handler (command argument) provided. The Tcl channel identifier should not be constructed explicitly.

However, there may be cases where the two interfaces need to be distinguished. For example, if the Tcl side is to perform some operations on the file system for the ECLiPSe side (e.g. selecting a file via a GUI), then with the remote interface, the two sides might not have access to the same file systems, and being able to distinguish whether the interface is remote or embedded allows the user to provide code to handle this.

To obtain information on which interface is being used, use the command:


returns remote for the remote interface, and embedded for the embedding interface.

Previous Up