Low level interface library to Tcl/Tk

Author(s): Montse Iglesias Urraca.

The tcltk_low_level library defines the low level interface used by the tcltk library. Essentially it includes all the code related directly to the handling of sockets and processes. This library should normally not be used directly by user programs, which use tcltk instead. On the other hand in some cases it may be useful to undertand how this library works in order to understand possible problems in programs that use the tcltk library.

Usage and interface

Documentation on exports

PREDICATE

Usage:new_interp(TclInterpreter)

Creates two sockets to connect to the wish process, the term socket and the event socket, and opens a pipe to process wish in a new shell.

  • Call and exit should be compatible with:
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:var/1)TclInterpreter is a free variable.

PREDICATE

Usage:new_interp(TclInterpreter,Options)

Creates two sockets, the term socket and the event socket, and opens a pipe to process wish in a new shell invoked with the Options.

  • Call and exit should be compatible with:
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
    (term_typing:atom/1)Options is currently instantiated to an atom.
  • The following properties should hold at call time:
    (term_typing:var/1)TclInterpreter is a free variable.
    (term_typing:nonvar/1)Options is currently a term which is not a free variable.

PREDICATE

Usage:new_interp_file(FileName,TclInterpreter)

Creates two sockets, the term socket and the event socket, and opens a pipe to process wish in a new shell invoked with a FileName. FileName is treated as a name of a sript file

  • Call and exit should be compatible with:
    (basic_props:string/1)FileName is a string (a list of character codes).
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)FileName is currently a term which is not a free variable.
    (term_typing:var/1)TclInterpreter is a free variable.

PREDICATE

Usage:tcltk(Code,TclInterpreter)

Sends the Code converted to string to the TclInterpreter

  • Call and exit should be compatible with:
    (tcltk_low_level:tclCommand/1)Code is a Tcl command.
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Code is currently a term which is not a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:tcltk_raw_code(String,TclInterpreter)

Sends the tcltk code items of the Stream to the TclInterpreter

  • Call and exit should be compatible with:
    (basic_props:string/1)String is a string (a list of character codes).
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)String is currently a term which is not a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:receive_result(Result,TclInterpreter)

Receives the Result of the last TclCommand into the TclInterpreter. If the TclCommand is not correct the wish process is terminated and a message appears showing the error

  • Call and exit should be compatible with:
    (basic_props:string/1)Result is a string (a list of character codes).
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:var/1)Result is a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:send_term(String,TclInterpreter)

Sends the goal executed to the TclInterpreter. String has the predicate with unified variables

  • Call and exit should be compatible with:
    (basic_props:string/1)String is a string (a list of character codes).
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)String is currently a term which is not a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:receive_event(Event,TclInterpreter)

Receives the Event from the event socket of the TclInterpreter.

  • Call and exit should be compatible with:
    (basic_props:list/1)Event is a list.
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:var/1)Event is a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:receive_list(List,TclInterpreter)

Receives the List from the event socket of the TclInterpreter.The List has all the predicates that have been inserted from Tcl/Tk with the command prolog_event. It is a list of terms.

  • Call and exit should be compatible with:
    (basic_props:list/1)List is a list.
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:var/1)List is a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:receive_confirm(String,TclInterpreter)

Receives the String from the event socket of the TclInterpreter when a term inserted into the event queue is managed.

  • Call and exit should be compatible with:
    (basic_props:string/1)String is a string (a list of character codes).
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:var/1)String is a free variable.
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

PREDICATE

Usage:delete(TclInterpreter)

Terminates the wish process and closes the pipe, term socket and event socket. Deletes the interpreter TclInterpreter from the system

  • Call and exit should be compatible with:
    (tcltk_low_level:tclInterpreter/1)TclInterpreter is a reference to a Tcl interpreter.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)TclInterpreter is currently a term which is not a free variable.

Documentation on internals

PREDICATE

Usage:core(String)

core/1 is a set of facts which contain Strings to be sent to the Tcl/Tk interpreter on startup. They implement miscelaneous Tcl/Tk procedures which are used by the Tcl/Tk interface.

  • Call and exit should be compatible with:
    (basic_props:string/1)String is a string (a list of character codes).
  • The following properties should hold at call time:
    (term_typing:var/1)String is a free variable.