For the average user, the kit is an intermediary between the C++ code and the embedded Tcl interpreter. Do not, if not strictly needed, bypass the kit. It may cause problems, now and in the future. More abstractly, the kit provides access to an underlying system with state. Typically, the state is defined by the binding of elements of a script language and the values of (state) variables.
interface kit { <hush/kit.h>
<hush/kit.idl>
sources/java/hush.dv.api.kit
enum { tcl = 0, python, dlp , nop }; kit modalities
kit(int mode=kit::tcl); the default tickle kit
kit(void*); system level constructor
int eval(char* cmd); to evaluate script command
char* result(); to fetch the result of eval
void result(char* s); to set the result of eval
char* evaluate(char* cmd); combines eval and result
int source(char* s); to load a script
binding* bind(char* cmd, handler* h); to bind command to handler
binding* bind(int fd, handler* h, int mask = readable); // for filedesc.
void unbind(char* cmd); to unbind a command
void unbind(int fd); to unbind a filedescriptor
char* selection(char* options); X environment
void after(int msecs, char* cmd = "");
void after(int msecs, handler* h);
void update(char* options* = ""); to update display
char* send(char* it, char* cmd);
widget* root(); returns toplevel (root) widget
widget* pack(widget* w, char* options = "");
widget* pack(char* wp, char* options = "");
void trace(int level = 1);
void notrace();
void quit();
// Advanced -- dependent (safe) kits
kit* slave(char* options=""); options: -safe -tk
int safe(); to determine safety
// System-level -- for installing widget bindings
binding* bind(handler*, char* args = ""); anonymous handlers
binding* bind(char* name, void* h, void* c = 0); very low level!
void command(char* name, void*, void* = 0);
void command(ing fd, int mask, void*, void* = 0);
// Experimental -- do not use it
kit* become(char* s, kit* k = 0); role-switch, see issues(4)
void restore(kit* k = 0); 0 -> default kit
};
For the ordinary user, a kit object provides an interface to the Tcl interpreter and other global properties of the system. The first group of functions (eval, result, evaluate and source) may be used to execute commands in Tcl scripting language directly. A Tcl command is simply a string conforming to certain syntactic requirements. The function eval evaluates a Tcl command. The function result() may be used to fetch the result of the last Tcl command. In contrast, the function result(char*) may be used to set the result of a Tcl command, when this command is defined in C++ (as may be done with kit::bind). The function evaluate provides a shorthand for combining eval and result(). The function source may be used to read in a file containing a Tcl script. The function bind may be used to associate a Tcl command to a command function or handler written in C++. The function selection gives access to the X selection. The function after may be used to have a Tcl command evaluated after n milliseconds. (It makes use of X timer callbacks). The function send may be used to evaluate a command in a different application. An application may be given a name when creating the session object. These functions are only for experienced users. The function root gives access to the toplevel widget associated with that particular instance of the kit. The function pack may be used to append widgets to the root widget, in order to map them to the screen. Widgets may be identified either by a pointer to a widget object or by their pathname, which is a string. See widget(4). The functions trace() and notrace() may be used to turn on, respectively off, tracing. The level indicates in what detail information will be given. Trace level zero is equivalent to notrace(). Finally, the function quit may be used to terminate the execution.
tcl_kit -- implements Tcl language binding
python_kit -- experimental
These kits are not exported.
However, they are initialized by choosing the corresponding mode.
Only advanced users and system-level programmers will have te create kits explicitly. The tk instance variable of handler objects and the session object gives immediate access to the kit.
hush -- file <hush/kit.h>
|
Hush Online Technology
hush@cs.vu.nl
09/24/99 |
|
|