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#93 (2001/4/24, 19:2:53 CEST)

Version of last change: 1.5#16 (1999/12/14, 17:12:49 MET)

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 extensions packages, in particular the graphical interface toolkit Tk. The proposed interaction between both languages is realized as an interface between two process, a Tcl/Tk process and a Prolog process. This approach allows programmers to use both 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 receives requests from a Prolog program and sends them to the Tcl/Tk part. The Tcl/Tk part receives from the socket and performs the actions included in the requests.

Prolog side

The Prolog side receives the actions to do 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 done in the Tcl/Tk side, the result is retrieved to the user program, or the action fails if any problem sucess.

Tcl/Tk side

The Tcl/Tk side waits for requests from the Prolog side, executes the Tcl/Tk code sended from the Prolog side, handle the events and exceptions raised in the Tcl/Tk 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
Number
denote 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 pridicate.
format(Term)
denotes the string that is printed by the corresponding built-in pridicate.
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.