|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttcl.lang.Interp
public class Interp
Implements the core Tcl interpreter. Copyright (c) 1997 Cornell University. Copyright (c) 1997-1998 Sun Microsystems, Inc. See the file "license.terms" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Field Summary | |
---|---|
HashMap |
aliasTable
Table which maps from names of commands in slave interpreter to InterpAliasCmd objects. |
int |
cmdCount
Total number of times a command procedure has been called for this interpreter. |
protected tcl.lang.DebugInfo |
dbg
|
protected boolean |
deleted
True means the interpreter has been deleted: don't process any more commands for it, and destroy the structure as soon as all nested invocations of eval() are done. |
boolean |
errAlreadyLogged
True means information has already been logged in $errorInfo for the current eval() instance, so eval() needn't log it (used to implement the "error" command). |
protected boolean |
errCodeSet
True means that addErrorInfo has been called to record information for the current error. |
boolean |
errInProgress
True means an error unwind is already in progress. |
String |
errorCode
If returnCode is TCL.ERROR, stores the errorCode. |
String |
errorInfo
If returnCode is TCL.ERROR, stores the errorInfo. |
int |
errorLine
When TCL_ERROR is returned, this gives the line number within the command where the error occurred (1 means first line). |
int |
evalFlags
Flags used when evaluating a command. |
Expression |
expr
The expression parser for this interp. |
CallFrame |
frame
Points to top-most in stack of all nested procedure invocations. |
Namespace.GetNamespaceForQualNameResult |
getnfqnResult
Used only with Namespace.getNamespaceForQualName() |
HashMap |
hiddenCmdTable
Hash table used to keep track of hidden commands on a per-interp basis. |
HashMap[] |
importTable
Used ONLY by JavaImportCmd: classTable, packageTable, wildcardTable |
HashMap<String,Channel> |
interpChanTable
Table of channels currently registered in this interp. |
static int |
INVOKE_HIDDEN
|
static int |
INVOKE_NO_TRACEBACK
|
static int |
INVOKE_NO_UNKNOWN
|
boolean |
isSafe
Is this interpreted marked as safe? |
int |
nestLevel
Number of times the interp.eval() routine has been recursively invoked. |
HashMap |
packageTable
|
String |
packageUnknown
|
HashMap |
reflectConflictTable
Table used to store reflect hash index conflicts, see ReflectObject implementation for more details |
long |
reflectObjCount
Number of reflect objects created so far inside this Interp (including those that have be freed) |
HashMap |
reflectObjTable
Translates Object to ReflectObject. |
int |
returnCode
Completion code to return if current procedure exits with a TCL_RETURN code. |
String |
scriptFile
The script file currently under execution. |
InterpSlaveCmd |
slave
Information necessary for this interp to function as a slave. |
HashMap |
slaveTable
Information used by InterpCmd.java to keep track of master/slave interps on a per-interp basis. |
StrtodResult |
strtodResult
Used by callers of Util.strtod(). |
StrtoulResult |
strtoulResult
Used by callers of Util.strtoul(), also used in FormatCmd.strtoul(). |
boolean |
systemEncodingChangesStdoutStderr
Set to true if [encoding system] can set the encoding for stdout and stderr. |
static ManagedSystemInStream |
systemIn
Using System.in directly creates non-interruptible block during System.in.read(). |
HashMap |
targetTable
Hash table for Target Records. |
int |
termOffset
Offset of character just after last one compiled or executed by Parser.eval2(). |
CallFrame |
varFrame
Points to the call frame whose variables are currently in use (same as frame unless an "uplevel" command is being executed). |
Constructor Summary | |
---|---|
Interp()
Side effects: Various parts of the interpreter are initialized; built-in commands are created; global variables are initialized, etc. |
Method Summary | |
---|---|
void |
addErrorInfo(String message)
Add information to the "errorInfo" variable that describes the current error. |
void |
addInterpResolver(String name,
Resolver resolver)
---------------------------------------------------------------------- Tcl_AddInterpResolvers -> addInterpResolver Adds a set of command/variable resolution procedures to an interpreter. |
void |
allowExceptions()
Sets a flag in an interpreter so that exceptions can occur in the next call to Tcl_Eval without them being turned into errors. |
void |
appendElement(String string)
Convert a string to a valid Tcl list element and append it to the result (which is ostensibly a list). |
void |
backgroundError()
This procedure is invoked to handle errors that occur in Tcl commands that are invoked in "background" (e.g. |
static BackSlashResult |
backslash(String s,
int i,
int len)
Figure out how to handle a backslash sequence. |
TclObject |
checkCommonCharacter(int c)
It is very common to create a TclObject that contains a single character. |
TclObject |
checkCommonInteger(long value)
checkCommonInteger() If a given integer value is in the common value pool then return a shared object for that integer. |
TclObject |
checkCommonString(String value)
If a given String value is in the common value pool the return a shared object for that String. |
void |
checkInterrupted()
This method is invoked after an eval operation to check if a running interp has been marked as interrupted. |
static boolean |
commandComplete(String string)
|
void |
createCommand(String cmdName,
Command cmdImpl)
Define a new command in the interpreter. |
protected void |
createCommands()
Create the build-in commands. |
void |
deleteAssocData(String name)
Deletes a named association of user-specified data with the specified interpreter. |
int |
deleteCommand(String cmdName)
Remove the given command from the this interpreter. |
int |
deleteCommandFromToken(WrappedCommand cmd)
Remove the given command from the given interpreter. |
void |
dispose()
Invoked to indicate that the interp should be disposed of. |
void |
eval(String script)
Execute a Tcl command in a string. |
void |
eval(String string,
int flags)
Evaluate a TCL script in a string |
void |
eval(TclObject tobj,
int flags)
Execute a Tcl script in a TclObject. |
void |
evalFile(String s)
Loads a Tcl script from a file using the system encoding and evaluates it in the current interpreter. |
void |
evalFile(String s,
String encoding)
Loads a Tcl script from a file and evaluates it in the current interpreter. |
void |
evalResource(String resName)
Execute a Tcl script stored in the given Java resource location, encoded in the system encoding Results: The return value is void. |
void |
evalResource(String resName,
String javaEncoding)
Execute a Tcl script stored in the given Java resource location. |
void |
evalURL(URL context,
String s)
Loads a Tcl script (encoded in system encoding) from a URL and evaluate it in the current interpreter. |
void |
evalURL(URL context,
String s,
String javaEncoding)
Loads a Tcl script from a URL and evaluate it in the current interpreter. |
void |
eventuallyDispose()
This method cleans up the state of the interpreter so that it can be garbage collected safely. |
void |
exposeCommand(String hiddenCmdToken,
String cmdName)
Makes a previously hidden command callable from inside the interpreter instead of only by its ancestors. |
int |
getArgLineNumber(int index)
Returns the line number where the given command argument begins. |
AssocData |
getAssocData(String name)
Returns the AssocData instance associated with this name in the specified interpreter. |
ClassLoader |
getClassLoader()
Get the TclClassLoader used for the interp. |
Command |
getCommand(String cmdName)
Returns the command procedure of the given command. |
String |
getCommandFullName(WrappedCommand cmd)
Given a token returned by, e.g., Tcl_CreateCommand or Tcl_FindCommand, this procedure returns the command's full name, qualified by a sequence of parent namespace names. |
String |
getCommandName(WrappedCommand cmd)
Given a token returned by, e.g., Tcl_CreateCommand or Tcl_FindCommand, this procedure returns the command's name. |
Map<String,String> |
getenv()
Replacement for System.getenv(). |
int |
getErrorLine()
Query the interp.errorLine member. |
Resolver |
getInterpResolver(String name)
Looks for a set of command/variable resolution procedures with the given name in an interpreter. |
int |
getMaxNestingDepth()
setMaxNestingDepth -- |
String |
getNameOfExecutable()
Get the name of the executable file to invoke JTcl. |
Notifier |
getNotifier()
Retrieve the Notifier associated with this Interp. |
TclObject |
getResult()
Queries the value of this interpreter's result value |
String |
getScriptFile()
Returns the name of the script file currently under execution. |
String |
getShellClassName()
Get the name of the shell class name to invoke JTcl. |
TclObject |
getVar(String name,
int flags)
Get the value of a variable. |
TclObject |
getVar(String name1,
String name2,
int flags)
Get the value of a variable. |
TclObject |
getVar(TclObject nameObj,
int flags)
Get the value of a variable. |
File |
getWorkingDir()
Retrieve the current working directory for this interpreter. |
WrappedCommand |
getWrappedCommand(String cmdName)
|
void |
hideCommand(String cmdName,
String hiddenCmdToken)
Makes a command hidden so that it cannot be invoked from within an interpreter, only from within an ancestor. |
void |
hideUnsafeCommands()
---------------------------------------------------------------------- TclHideUnsafeCommands -> hideUnsafeCommands Hides base commands that are not marked as safe from this interpreter. |
protected tcl.lang.DebugInfo |
initDebugInfo()
Initialize the debugging information. |
int |
invoke(TclObject[] objv,
int flags)
Invokes a Tcl command, given an objv/objc, from either the exposed or the hidden sets of commands in the given interpreter. |
int |
invokeGlobal(TclObject[] objv,
int flags)
Invokes a Tcl command, given an objv/objc, from either the exposed or hidden set of commands in the given interpreter. |
CallFrame |
newCallFrame()
Creates a new callframe. |
protected CallFrame |
newCallFrame(Procedure proc,
TclObject[] objv)
Creates a new callframe. |
void |
pkgProvide(String name,
String version)
This procedure is invoked to declare that a particular version of a particular package is now present in an interpreter. |
String |
pkgRequire(String pkgname,
String version,
boolean exact)
This procedure is called by code that depends on a particular version of a particular package. |
void |
preserve()
---------------------------------------------------------------------- Tcl_Preserve -> preserve This method is used by another method to declare its interest in this particular object, so that the object will not be disposed until a matching call to release() has been made. |
void |
preventAliasLoop(Interp cmdInterp,
WrappedCommand cmd)
TclPreventAliasLoop -> preventAliasLoop When defining an alias or renaming a command, prevent an alias loop from being formed. |
void |
processUnexpectedResult(int returnCode)
Procedure called by Tcl_EvalObj to set the interpreter's result value to an appropriate error message when the code it evaluates returns an unexpected result code (not TCL_OK and not TCL_ERROR) to the topmost evaluation level. |
void |
ready()
Check if an interpreter is ready to eval commands or scripts, i.e., if it was not deleted and if the nesting level is not too high. |
void |
recordAndEval(TclObject script,
int flags)
This procedure adds its command argument to the current list of recorded events and then executes the command by calling eval. |
void |
release()
|
boolean |
removeInterpResolver(String name)
Removes a set of command/variable resolution procedures previously added by addInterpResolver. |
void |
renameCommand(String oldName,
String newName)
Called to give an existing Tcl command a different name. |
void |
resetResult()
This procedure resets this interpreter's result object. |
void |
setAssocData(String name,
AssocData data)
Creates a named association between user-specified data and this interpreter. |
void |
setErrorCode(TclObject code)
This procedure is called to record machine-readable information about an error that is about to be returned. |
void |
setInterrupted()
Invoke this method to indicate that an executing interp should be interrupted at the next safe moment. |
int |
setMaxNestingDepth(int depth)
Set new value for maxNestingDepth |
void |
setNameOfExecutable(String name)
Set the name of the executable file to invoke JTcl. |
void |
setResult(boolean r)
Set this interpreter's result object to a boolean value. |
void |
setResult(double r)
Set this interpreter's result object to a double value. |
void |
setResult(long r)
Set this interpreter's result object to a long value. |
void |
setResult(String r)
Set this interpreter's result object to a String value. |
void |
setResult(TclObject newResult)
Arrange for the given Tcl Object to be placed as the result object for the interpreter. |
void |
setShellClassName(String name)
Set the name of the shell class name to invoke JTcl. |
TclObject |
setVar(String name1,
String name2,
boolean bValue,
int flags)
Set a variable to the value of a boolean |
TclObject |
setVar(String name1,
String name2,
double dValue,
int flags)
Set a variable to the value of a double |
TclObject |
setVar(String name,
String strValue,
int flags)
Set the value of a variable |
TclObject |
setVar(String name1,
String name2,
long intValue,
int flags)
Set a variable to the value in a long argument. |
TclObject |
setVar(String name1,
String name2,
String strValue,
int flags)
Set a variable to the value of a String |
TclObject |
setVar(String name1,
String name2,
TclObject value,
int flags)
Set the value of a variable |
TclObject |
setVar(String name,
TclObject value,
int flags)
Set the value of a variable |
TclObject |
setVar(TclObject nameObj,
TclObject value,
int flags)
Set the value of a variable |
void |
setWorkingDir(String dirName)
Set the current working directory for this interpreter. |
String |
toString()
Debug print info about the interpreter. |
void |
traceCommand(String command,
CommandTrace trace)
Set a command trace on a command |
TclObject |
traceCommandInfo(String command)
Get a list of all command traces on a command |
void |
traceExecution(String command,
ExecutionTrace trace)
Set a execution trace on a command |
TclObject |
traceExecutionInfo(String command)
Get a list of all execution traces on a command |
void |
traceVar(String part1,
String part2,
VarTrace trace,
int flags)
Add a trace to a variable. |
void |
traceVar(String name,
VarTrace trace,
int flags)
Add a trace to a variable. |
void |
transferResult(Interp sourceInterp,
int result)
Copy the result (and error information) from one interp to another. |
void |
unsetVar(String name,
int flags)
Unset a variable. |
void |
unsetVar(String name1,
String name2,
int flags)
Unset a variable. |
void |
unsetVar(TclObject nameObj,
int flags)
Unset a variable. |
void |
untraceCommand(String command,
int type,
TclObject callbackCmd)
Remove a command trace on a command |
void |
untraceExecution(String command,
int type,
TclObject callbackCmd)
Remove an execution trace on a command |
void |
untraceVar(String part1,
String part2,
VarTrace trace,
int flags)
Remove a trace from a variable. |
void |
untraceVar(String name,
VarTrace trace,
int flags)
---------------------------------------------------------------------- untraceVar -- Remove a trace from a variable. |
int |
updateReturnInfo()
This method is used by various parts of the Jacl and external packages. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public HashMap reflectObjTable
public long reflectObjCount
public HashMap reflectConflictTable
public int cmdCount
public HashMap<String,Channel> interpChanTable
public boolean systemEncodingChangesStdoutStderr
public CallFrame frame
public CallFrame varFrame
public HashMap hiddenCmdTable
public HashMap slaveTable
public HashMap targetTable
public InterpSlaveCmd slave
public HashMap aliasTable
public String scriptFile
public int nestLevel
public int evalFlags
public boolean isSafe
public int termOffset
public Expression expr
public String errorInfo
public String errorCode
public int returnCode
protected boolean deleted
public boolean errInProgress
public boolean errAlreadyLogged
protected boolean errCodeSet
public int errorLine
public HashMap packageTable
public String packageUnknown
public HashMap[] importTable
public StrtoulResult strtoulResult
public StrtodResult strtodResult
strtoulResult
public Namespace.GetNamespaceForQualNameResult getnfqnResult
public static final int INVOKE_HIDDEN
public static final int INVOKE_NO_UNKNOWN
public static final int INVOKE_NO_TRACEBACK
public static ManagedSystemInStream systemIn
protected tcl.lang.DebugInfo dbg
Constructor Detail |
---|
public Interp()
Method Detail |
---|
public void dispose()
public void eventuallyDispose()
public void ready() throws TclException
TclException
protected void createCommands()
public void setAssocData(String name, AssocData data)
name
- name for the associationdata
- Object associated with the namepublic void deleteAssocData(String name)
name
- name of the associationpublic AssocData getAssocData(String name)
name
- name of the association
public void backgroundError()
public final TclObject setVar(TclObject nameObj, TclObject value, int flags) throws TclException
nameObj
- name of variable, array or array elementvalue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name, TclObject value, int flags) throws TclException
name
- name of variable, array or array elementvalue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name1, String name2, TclObject value, int flags) throws TclException
name1
- name of variable if name2 is null, or an arrayname2
- name of an array element, or nullvalue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name, String strValue, int flags) throws TclException
name
- name of variable, array or array elementstrValue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name1, String name2, String strValue, int flags) throws TclException
name1
- If name2 is null, this is the name of a scalar variable; otherwise it is the name of an arrayname2
- name of element within an array, or nullstrValue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name1, String name2, long intValue, int flags) throws TclException
name1
- name of scalar variable, or name of array if name2 is non-nullname2
- Name of element within an array, or null if setting a scalarintValue
- new value for avariableflags
- Various flags that tell how to set valu any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE,
or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name1, String name2, double dValue, int flags) throws TclException
name1
- If name2 is null, this is the name of a scalar variable; otherwise it is the name of an arrayname2
- name of element within an array, or nulldValue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject setVar(String name1, String name2, boolean bValue, int flags) throws TclException
name1
- If name2 is null, this is the name of a scalar variable; otherwise it is the name of an arrayname2
- name of element within an array, or nullbValue
- new value for variableflags
- any of TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, TCL.APPEND_VALUE, or TCL.LIST_ELEMENT.
TclException
public final TclObject getVar(TclObject nameObj, int flags) throws TclException
nameObj
- the name of a variable, array or array elementflags
- TCL.GLOBAL_ONLY or TCL.NAMESPACE_ONLY.
TclException
- If the variable is notpublic final TclObject getVar(String name, int flags) throws TclException
name
- the name of a variable, array or array elementflags
- TCL.GLOBAL_ONLY or TCL.NAMESPACE_ONLY.
TclException
- If the variable is notpublic final TclObject getVar(String name1, String name2, int flags) throws TclException
name1
- if name2 is null, this is the name of a scalar. Otherwise, it is the name of an arrayname2
- name of an element within an array, or nullflags
- TCL.GLOBAL_ONLY or TCL.NAMESPACE_ONLY.
TclException
- If the variable is notpublic Map<String,String> getenv()
public final void unsetVar(TclObject nameObj, int flags) throws TclException
nameObj
- name of a variable, array or array elementflags
- any of TCL.GLOBAL_ONLY or TCL.NAMESPACE_ONLY.
TclException
public final void unsetVar(String name, int flags) throws TclException
name
- name of a variable, array or array elementflags
- any of TCL.GLOBAL_ONLY or TCL.NAMESPACE_ONLY.
TclException
public final void unsetVar(String name1, String name2, int flags) throws TclException
name1
- if name2 is null, this is the name of a scalar. Otherwise it is the name of an arrayname2
- name of an element within an array, or nullflags
- any of TCL.GLOBAL_ONLY or TCL.NAMESPACE_ONLY.
TclException
public void traceVar(String name, VarTrace trace, int flags) throws TclException
name
- name of variable, may contain a parenthesized index valuetrace
- object to notify when specified ops are invoked upon the variableflags
- OR-ed collection of bits, including any of TCL.TRACE_READS, TCL.TRACE_WRITES, TCL.TRACE_UNSETS,
TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY.
TclException
public void traceVar(String part1, String part2, VarTrace trace, int flags) throws TclException
part1
- name of variablepart2
- name of element in within an array, null means part1 is a scalar or entire arraytrace
- object to notify when specified ops are invoked upon the variableflags
- OR-ed collection of bits, including any of TCL.TRACE_READS, TCL.TRACE_WRITES, TCL.TRACE_UNSETS,
TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY.
TclException
public void untraceVar(String name, VarTrace trace, int flags)
name
- Name of variable; may end with "(index)" to signify an array reference.trace
- Object associated with trace.flags
- OR-ed collection of bits describing current trace, including any of TCL.TRACE_READS, TCL.TRACE_WRITES,
TCL.TRACE_UNSETS, TCL.GLOBAL_ONLY and TCL.NAMESPACE_ONLY.public void untraceVar(String part1, String part2, VarTrace trace, int flags)
part1
- Name of scalar variable or array.part2
- Name of element within array; null means trace applies to scalar variable or array as-a-whole.trace
- Object associated with trace.flags
- OR-ed collection of bits describing current trace, including any of TCL.TRACE_READS, TCL.TRACE_WRITES,
TCL.TRACE_UNSETS, TCL.GLOBAL_ONLY and TCL.NAMESPACE_ONLY.public void createCommand(String cmdName, Command cmdImpl)
cmdName
- name of the commandcmdImpl
- Command instance that implements the commandpublic String getCommandFullName(WrappedCommand cmd)
cmd
- command of which to get the full name
public String getCommandName(WrappedCommand cmd)
cmd
- command of which to get the name of
public int deleteCommand(String cmdName)
cmdName
- name of command to remove in this interpreter
public int deleteCommandFromToken(WrappedCommand cmd)
cmd
- wrapper token for the command to delete; may be null
public void renameCommand(String oldName, String newName) throws TclException
oldName
- existing command namenewName
- new name
TclException
public void preventAliasLoop(Interp cmdInterp, WrappedCommand cmd) throws TclException
cmdInterp
- Interp in which the command is being defined.cmd
- Tcl command we are attempting to define.
TclException
public Command getCommand(String cmdName)
cmdName
- string name of the command
public WrappedCommand getWrappedCommand(String cmdName)
cmdName
- name of command to get
public static boolean commandComplete(String string)
public void traceCommand(String command, CommandTrace trace) throws TclException
command
- fully qualified command nametrace
- trace to add to command
TclException
public void untraceCommand(String command, int type, TclObject callbackCmd) throws TclException
command
- fully qualified command nametype
- CommandTrace.RENAME or CommandTrace.DELETEcallbackCmd
- callback command to remove
TclException
public TclObject traceCommandInfo(String command) throws TclException
command
- fully qualified name of command
TclException
public void traceExecution(String command, ExecutionTrace trace) throws TclException
command
- fully qualified command nametrace
- trace to add to command
TclException
public void untraceExecution(String command, int type, TclObject callbackCmd) throws TclException
command
- fully qualified command nametype
- ExecutionTrace.ENTER, ExecutionTrace.LEAVE, ExecutionTrace.ENTERSTEP, ExecutionTrace.LEAVESTEPcallbackCmd
- callback command to remove
TclException
public TclObject traceExecutionInfo(String command) throws TclException
command
- fully qualified name of command
TclException
public final TclObject getResult()
public final void setResult(TclObject newResult)
newResult
- A Tcl Object to be set as the result of this interpreterpublic final void setResult(String r)
r
- value to set result topublic final void setResult(long r)
r
- value to set result topublic final void setResult(double r)
r
- value to set result topublic final void setResult(boolean r)
r
- value to set result topublic final void resetResult()
public void appendElement(String string) throws TclException
string
- String to append to list result
TclException
public void eval(String script) throws TclException
script
- The script to be evaluated
TclException
- on any TCL errors generated by the scriptpublic void eval(String string, int flags) throws TclException
string
- containing the TCL scriptflags
- Either 0 or TCL.EVAL_GLOBAL
TclException
- on any TCL errorpublic void eval(TclObject tobj, int flags) throws TclException
tobj
- A Tcl object holding a script to evaluateflags
- either 0 or TCL.EVAL_GLOBAL
TclException
- on any TCL errorpublic void recordAndEval(TclObject script, int flags) throws TclException
script
- a script to evaluateflags
- TCL.NO_EVAL records only; TCL.EVAL_GLOBAL evalutes the script in a global context
TclException
public void evalFile(String s) throws TclException
s
- Name of the file to evaluate
TclException
- on any TCL error or on a file read errorpublic void evalFile(String s, String encoding) throws TclException
s
- Name of the file to evaluateencoding
- Java charset name of file's encoding
TclException
- on any TCL error or on a file read errorpublic void evalURL(URL context, String s) throws TclException
context
- URL context under which s is to be interpreteds
- the URL
TclException
- on any TCL or read errorpublic void evalURL(URL context, String s, String javaEncoding) throws TclException
context
- URL context under which s is to be interpreteds
- the URLjavaEncoding
- Java charset name in which script is encoded
TclException
- on any TCL or read errorpublic void evalResource(String resName) throws TclException
resName
- the location of the Java resource. See the Java documentation of Class.getResourceAsStream() for
details on resource naming.
TclException
public void evalResource(String resName, String javaEncoding) throws TclException
resName
- the location of the Java resource. See the Java documentation of Class.getResourceAsStream() for
details on resource naming.javaEncoding
- Java charset name for Unicode encoding of resource
TclException
public static BackSlashResult backslash(String s, int i, int len)
s
- i
- len
-
public void setErrorCode(TclObject code)
code
- the errorCode objectpublic void addErrorInfo(String message)
message
- message to record in errorInfopublic void processUnexpectedResult(int returnCode) throws TclException
returnCode
- the unexpected result code
TclException
public int updateReturnInfo()
protected CallFrame newCallFrame(Procedure proc, TclObject[] objv) throws TclException
proc
- the procedure which will later execute in the new CallFrameobjv
- the arguments that will be passed to the procedure
TclException
- incorrect arguments passed.public CallFrame newCallFrame()
public File getWorkingDir()
public void setWorkingDir(String dirName) throws TclException
dirName
- name of directory that will become working directory
TclException
public Notifier getNotifier()
public final void pkgProvide(String name, String version) throws TclException
name
- name of packageversion
- version of package
TclException
public final String pkgRequire(String pkgname, String version, boolean exact) throws TclException
pkgname
- name of the package to requireversion
- version to requireexact
- if true, require the exact versions specified
TclException
- If the caller's requirements cannot be met (e.g. the version requested conflicts with a currently
provided version, or the required version cannot be found, or the script to provide the required
version generates an error), a TclException is raised.protected tcl.lang.DebugInfo initDebugInfo()
public String getScriptFile()
public int getArgLineNumber(int index)
index
- specifies an argument.
public void transferResult(Interp sourceInterp, int result) throws TclException
sourceInterp
- interp whose result and error information should be moved to the target interp. AFter moving the
results, the interp's result is resetresult
- TCL.OK if just the result should be copied, TCL.ERROR if both teh result and the error information
should be copied
TclException
public void hideCommand(String cmdName, String hiddenCmdToken) throws TclException
cmdName
- Name of command to hide.hiddenCmdToken
- Token name of the to-be-hidden command.
TclException
public void exposeCommand(String hiddenCmdToken, String cmdName) throws TclException
hiddenCmdToken
- Token name of the to-be-hidden command.cmdName
- Name of command to hide.
TclException
public void hideUnsafeCommands() throws TclException
TclException
public int invokeGlobal(TclObject[] objv, int flags) throws TclException
objv
- Argument objects; objv[0] points to the name of the command to invoke.flags
- Combination of flags controlling the call: INVOKE_HIDDEN,_INVOKE_NO_UNKNOWN, or INVOKE_NO_TRACEBACK.
TclException
public int invoke(TclObject[] objv, int flags) throws TclException
objv
- argument objects, objv[0] is the name of the command to invokeflags
- Combination of flags controlling the call: INVOKE_HIDDEN,_INVOKE_NO_UNKNOWN, or INVOKE_NO_TRACEBACK.
TclException
public void allowExceptions()
public void addInterpResolver(String name, Resolver resolver)
name
- Name of this resolution schemeresolver
- Object to resolve commands/variables.public Resolver getInterpResolver(String name)
name
- Look for a scheme with scheme.
public boolean removeInterpResolver(String name)
name
- Name of the scheme to be removed.
public final TclObject checkCommonInteger(long value)
value
- integer to test
public final TclObject checkCommonString(String value)
public final TclObject checkCommonCharacter(int c)
public int getErrorLine()
public ClassLoader getClassLoader()
public void setInterrupted()
public final void checkInterrupted()
public int setMaxNestingDepth(int depth)
depth
- If > 0, set as new depth; otherwise don't set new value
public int getMaxNestingDepth()
public String toString()
toString
in class Object
public String getNameOfExecutable()
public void setNameOfExecutable(String name)
public String getShellClassName()
public void setShellClassName(String name)
public void preserve()
public void release()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |