CLASS
tcl.lang.Interp -- This manual entry contains Interp methods that execute or check Tcl scripts.
METHODS
void eval(String str) throws TclException
void eval(String str, int flags) throws TclException
void eval(TclObject tobj, int flags) throws TclException
void recordAndEval(TclObject tobj, int flags) throws TclException
void evalFile(String fileName) throws TclException
static boolean commandComplete(String cmdName) throws TclException
OTHER METHODS
ARGUMENTS
DESCRIPTION
eval
recordAndEval
evalFile
commandComplete
EQUIVALENT C FUNCTIONS
SEE ALSO
KEYWORDS

CLASS

tcl.lang.Interp -- This manual entry contains Interp methods that execute or check Tcl scripts.

METHODS

void eval(String str) throws TclException

void eval(String str, int flags) throws TclException

void eval(TclObject tobj, int flags) throws TclException

void recordAndEval(TclObject tobj, int flags) throws TclException

void evalFile(String fileName) throws TclException

static boolean commandComplete(String cmdName) throws TclException

OTHER METHODS

setVar, traceVar, createCommand, setResult, backgroundError,
getNotifier, setAssocData, dispose, pkgRequire

ARGUMENTS

String str
String value of script to evaluate.

TclObject tobj
TclObject value of script to evaluate.

int flags
An OR'ed combination of flag bits. Currently supported flags include TCL.EVAL_GLOBAL, TCL.EVAL_DIRECT, and TCL.NO_EVAL.

String fileName
File containing script to evaluate.

String cmdName
Command string to test for completeness.

DESCRIPTION

The methods described here are invoked to execute Tcl scripts in various forms.

eval
The eval method executes the commands in the script stored in str or tobj until either an error occurs or the end of the script is reached. If the flag argument is specified, it controls the stack level of the evaluation via an OR-ed combination of flag bits. Currently, only the TCL.EVAL_GLOBAL flag is supported. If this flag is set, the script is processed at global level. This means that it is evaluated in the global namespace and its variable context consists of global variables only (it ignores any Tcl procedures that are active). Otherwise, the script is evaluated in the current stack level. A TclException is thrown if an error occurs in evaluating the str or tobj (e.g. the script contains bad Tcl syntax or accesses an undefined variable).

recordAndEval
The recordAndEval method adds the script stored in tobj to the current list of recorded events and then executes the command by calling eval. Passing TCL.NO_EVAL in the flags argument means record the command but don't evaluate.

evalFile
The evalFile method reads the file given by fileName and evaluates its contents as a Tcl script. It behaves the same as eval.

commandComplete
The commandComplete method takes a Tcl command str as argument and determines whether it contains one or more complete commands (i.e. there are no unclosed quotes, braces, brackets, or variable references). If the command string is complete then it returns true; otherwise it returns false.

EQUIVALENT C FUNCTIONS

Tcl_Eval, Tcl_GlobalEval, Tcl_EvalObj, Tcl_EvalFile, Tcl_RecordAndEvalObj, Tcl_CommandComplete

SEE ALSO

Interp, setVar, setResult, addErrorInfo, dispose, TclException, TclRuntimeError, TclEvent

KEYWORDS

complete command, execute, file, global, interpreter, object, partial command, result, script
Copyright © 1994-1998 Sun Microsystems, Inc.
Copyright © 1995-1997 Roger E. Critchlow Jr.