6.1 Basic Concepts of the Interface
The interface is used by starting separate ECLiPSe and Tcl processes, and
then attaching the Tcl process to the ECLiPSe process. Once
attached, the Tcl and ECLiPSe processes can communicate much as in the
embedded interface: ECLiPSe goals can be sent from the Tcl side to the
ECLiPSe side via the remote predicate call (ec_rpc) mechanism,
and further I/O queues can be established between the ECLiPSe and Tcl
processes to allow streams of bytes to sent from one side to the other.
The attached Tcl
process can also be detached from the ECLiPSe process. This
disconnection will terminate and clean-up the links between the two
processes. Thus, typically, if the programmer wants to allow a particular
application to be usable through both the Tcl remote and embedding
interfaces, the only code that needs to be specific to one or the other
interface is the code associated with starting and termination of the
application (the attach and detach operations in the case of the remote
interface).
The interaction between the Tcl and ECLiPSe is mediated by a version of
thread-like control flow of the embedded interface. The
interface distinguishes two `sides': the Tcl side, which is the Tcl
process, and the ECLiPSe side, which is generally the ECLiPSe
process1. At any given time,
either the ECLiPSe side or the Tcl side has `control'. When the Tcl side
has control, execution of the ECLiPSe process is suspended. When the
ECLiPSe side has control, the Tcl side cannot initiate the execution of
ec_rpc goals. The interface can implicitly transfer control from one side
to the other (e.g. when processing synchronous I/O), or it can be
explicitly transferred.
An ECLiPSe process can have several attached remote processes. Each
remote process is identified by a control name, which is the
ECLiPSe name for a special control connection between the two sides.