Go to the first, previous, next, last section, table of contents.


The Tcl/Tk interface

Author(s): Montse Iglesias Urraca, http://www.clip.dia.fi.upm.es/, The CLIP Group, Facultad de Informática, Universidad Politécnica de Madrid.

Version: 1.7#125 (2001/10/17, 13:42:47 CEST)

Version of last change: 1.7#123 (2001/9/2, 14:13:25 CEST)

The tcltk library package is a bidirectional interface to the Tcl (pronounced Tickle) language and Tk toolkit. Tcl is an interpreter scripting language with many extension packages, in particular the graphical interface toolkit Tk. The interaction between both languages is implemented as an interface between two processes, a Tcl/Tk process and a Prolog process. The approach allows programmers to program both in Tcl/Tk and Prolog.

Prolog - Tcl/Tk interface structure

The interface is made up of two parts: a Prolog part and a Tcl/Tk part. The Prolog part encodes the requests from a Prolog program and sends them to the Tcl/Tk part via a socket. The Tcl/Tk part receives from this socket and performs the actions included implied by the requests.

Prolog side of the Prolog - Tcl/Tk interface

The Prolog side receives the actions to perform in the Tcl/Tk side from the user program and sends them to the Tcl/Tk side through the socket connection. When the action is finished in the Tcl/Tk side, the result is returned to the user program, or the action fails if any problem occurs.

Tcl/Tk side of the Prolog - Tcl/Tk interface

The Tcl/Tk side waits for requests from the Prolog side, executes the Tcl/Tk code sent from the Prolog side. At the same time, the Tcl/Tk side handles the events and exceptions raised in the Tcl/Tk side, possibly passing on control to the Prolog side.

Usage and interface (tcltk)

Documentation on exports (tcltk)

REGTYPE: tclInterpreter/1:

To use Tcl, you must create a Tcl interpreter object and send commands to it.

Usage: tclInterpreter(I)

REGTYPE: tclCommand/1:

A Tcl command is specified as follows:

      Command         --> Atom  { other than [] }
                        | Number
                        | chars(PrologString)
                        | write(Term)
                        | format(Fmt,Args)
                        | dq(Command)
                        | br(Command)
                        | sqb(Command)
                        | min(Command)
                        | ListOfCommands
      ListOfCommands  --> []
                        |[Command|ListOfCommands]

where:

Atom
denotes the printed representation of the atom.
Number
denotes their printed representations.
chars(PrologString)
denotes the string represented by PrologString (a list of character codes).
write(Term)
denotes the string that is printed by the corresponding built-in predicate.
format(Term)
denotes the string that is printed by the corresponding built-in predicate.
dq(Command)
denotes the string specified by Command, enclosed in double quotes.
br(Command)
denotes the string specified by Command, enclosed in braces.
sqb(Command)
denotes the string specified by Command, enclosed in square brackets.
min(Command)
denotes the string specified by Command, immediately preceded by a hyphen.
ListOfCommands
denotes the strings denoted by each element, separated by spaces.

Usage: tclCommand(C)

PREDICATE: tcl_new/1:

Usage: tcl_new(-TclInterpreter)

PREDICATE: tcl_eval/3:

Usage: tcl_eval(+TclInterpreter,+Command,-Result)

PREDICATE: tcl_delete/1:

Usage: tcl_delete(+TclInterpreter)

PREDICATE: tcl_event/3:

Usage: tcl_event(+TclInterpreter,+Command,-Events)

PREDICATE: tk_event_loop/1:

Usage: tk_event_loop(+TclInterpreter)

PREDICATE: tk_loop/1:

Usage: tk_loop(+TclInterpreter)

PREDICATE: tk_new/2:

Usage: tk_new(+Options,-TclInterpreter)

PREDICATE: tk_next_event/2:

Usage: tk_next_event(+TclInterpreter,-Event)


Go to the first, previous, next, last section, table of contents.