| java.lang.Object tcl.lang.CallFrame
CallFrame | public class CallFrame (Code) | | This class implements a frame in the call stack.
This class can be overridden to define new variable scoping rules for
the Tcl interpreter.
|
Field Summary | |
CallFrame | caller Value of interp.frame when this procedure was invoked
(i.e. | CallFrame | callerVar Value of interp.varFrame when this procedure was invoked
(i.e. | Var[] | compiledLocals Array of local variables in a compiled proc frame.
These include locals set in the proc, globals
or other variable brought into the proc scope,
and compiler generated aliases to globals.
This array is always null for an interpreted proc.
A compiled proc implementation known which variable
is associated with each slot at compile time,
so it is able to avoid a hashtable lookup each time
the variable is accessed. | String[] | compiledLocalsNames | Interp | interp The interpreter associated with this call frame. | boolean | isProcCallFrame If true, the frame was pushed to execute a Tcl procedure
and may have local vars. | int | level Level of recursion. | Namespace | ns The Namespace this CallFrame is executing in. | TclObject[] | objv Stores the arguments of the procedure associated with this CallFrame. | HashMap | varTable Stores the variables of this CallFrame. |
Method Summary | |
void | chain(Procedure proc, TclObject[] objv) Chain this frame into the call frame stack and binds the parameters
values to the formal parameters of the procedure. | protected void | dispose() This method is called when this CallFrame is no longer needed.
Removes the reference of this object from the interpreter so
that this object can be garbage collected.
For this procedure to work correctly, it must not be possible
for any of the variable in the table to be accessed from Tcl
commands (e.g. | static boolean | exists(Interp interp, String name) Parameters: name - the name of the variable. | static int | getFrame(Interp interp, String string, CallFrame[] frameArr) Tcl_GetFrame -> getFrame
Given a description of a procedure frame, such as the first
argument to an "uplevel" or "upvar" command, locate the
call frame for the appropriate level of procedure.
The return value is 1 if string was either a number or a number
preceded by "#" and it specified a valid frame. | ArrayList | getLocalVarNames() | ArrayList | getVarNames() |
caller | CallFrame caller(Code) | | Value of interp.frame when this procedure was invoked
(i.e. next in stack of all active procedures).
|
callerVar | CallFrame callerVar(Code) | | Value of interp.varFrame when this procedure was invoked
(i.e. determines variable scoping within caller; same as
caller unless an "uplevel" command or something equivalent
was active in the caller).
|
compiledLocals | Var[] compiledLocals(Code) | | Array of local variables in a compiled proc frame.
These include locals set in the proc, globals
or other variable brought into the proc scope,
and compiler generated aliases to globals.
This array is always null for an interpreted proc.
A compiled proc implementation known which variable
is associated with each slot at compile time,
so it is able to avoid a hashtable lookup each time
the variable is accessed. Both scalar variables and
array variables could appear in this array.
|
interp | Interp interp(Code) | | The interpreter associated with this call frame.
|
isProcCallFrame | boolean isProcCallFrame(Code) | | If true, the frame was pushed to execute a Tcl procedure
and may have local vars. If false, the frame was pushed to execute
a namespace command and var references are treated as references
to namespace vars; varTable is ignored.
|
level | int level(Code) | | Level of recursion. = 0 for the global level.
|
ns | Namespace ns(Code) | | The Namespace this CallFrame is executing in.
Used to resolve commands and global variables.
|
objv | TclObject[] objv(Code) | | Stores the arguments of the procedure associated with this CallFrame.
Is null for global level.
|
varTable | HashMap varTable(Code) | | Stores the variables of this CallFrame.
|
CallFrame | CallFrame(Interp i)(Code) | | Creates a CallFrame for the global variables.
Parameters: interp - current interpreter. |
CallFrame | CallFrame(Interp i, Procedure proc, TclObject[] objv) throws TclException(Code) | | Creates a CallFrame. It changes the following variables:
- this.caller
- this.callerVar
- interp.frame
- interp.varFrame
Parameters: i - current interpreter. Parameters: proc - the procedure to invoke in this call frame. Parameters: objv - the arguments to the procedure. exception: TclException - if error occurs in parameter bindings. |
chain | void chain(Procedure proc, TclObject[] objv) throws TclException(Code) | | Chain this frame into the call frame stack and binds the parameters
values to the formal parameters of the procedure.
Parameters: proc - the procedure. Parameters: proc - argv the parameter values. exception: TclException - if wrong number of arguments. |
dispose | protected void dispose()(Code) | | This method is called when this CallFrame is no longer needed.
Removes the reference of this object from the interpreter so
that this object can be garbage collected.
For this procedure to work correctly, it must not be possible
for any of the variable in the table to be accessed from Tcl
commands (e.g. from trace procedures).
|
exists | static boolean exists(Interp interp, String name)(Code) | | Parameters: name - the name of the variable. true if a variable exists and is defined inside thisCallFrame, false otherwise |
getFrame | static int getFrame(Interp interp, String string, CallFrame[] frameArr) throws TclException(Code) | | Tcl_GetFrame -> getFrame
Given a description of a procedure frame, such as the first
argument to an "uplevel" or "upvar" command, locate the
call frame for the appropriate level of procedure.
The return value is 1 if string was either a number or a number
preceded by "#" and it specified a valid frame. 0 is returned
if string isn't one of the two things above (in this case,
the lookup acts as if string were "1"). The frameArr[0] reference
will be filled by the reference of the desired frame (unless an
error occurs, in which case it isn't modified).
Parameters: string - a string that specifies the level. exception: TclException - if s is a valid level specifier butrefers to a bad level that doesn't exist. |
getLocalVarNames | ArrayList getLocalVarNames()(Code) | | a List of the names of the (defined) local variablesin this CallFrame (excluding upvar's) |
getVarNames | ArrayList getVarNames()(Code) | | a List of the names of the (defined) variablesin this CallFrame. |
|
|