next up previous index
Next: Differences From the Tcl Up: Remote Tcl Interface Previous: Additional Control and Support   Index

Example

Figure: Example use of interface: ECLiPSe code
\begin{figure}
\begin{verbatim}% Tcl side will create the from-ECLiPSe queue gui...
...Control explicitly
tclyield :-
remote_yield(control).\end{verbatim}\end{figure}

Figure 6.2: Example use of interface: Tcl code
\begin{figure}
{\small\begin{verbatim} ...

Figures 6.1 and 6.2 shows a simple example of the use of the interface. To try this program, the user should start an ECLiPSe, compile the ECLiPSe program. This will suspend on the remote_connect/3, waiting for the Tcl program to attach. The Tcl program should then be started on the same machine, and the attachment will be connected using the fixed host and port address. During the initialisation when attaching, a from-ECLiPSe queue is created, which is set to flush at every newline. This is done by an ec_rpc goal after the queue is created. As no Tcl data consumer handler is specified, the default Tcl data consumer handler ec_stream_output_popup handles and display the data on the Tcl side on a pop-up window. The Tcl side GUI has just one button which allows the application to terminate. This button is disabled when ECLiPSe side has control, and this is done by setting up the appropriate call-backs to disable and enable the button in ec_running_set_commands on the Tcl side.

On disconnection, which can be initiated either by pressing the button on the Tcl side, or by quitting from ECLiPSe, the handlers for disconnection ensures that both the ECLiPSe and Tcl program terminates.


next up previous index
Next: Differences From the Tcl Up: Remote Tcl Interface Previous: Additional Control and Support   Index
Warwick Harvey
2004-08-07