tcl.lang
Class Var

java.lang.Object
  extended by tcl.lang.Var

public class Var
extends java.lang.Object


Method Summary
protected static java.lang.String callTraces(Interp interp, Var array, Var var, java.lang.String part1, java.lang.String part2, int flags)
          CallTraces -> callTraces This procedure is invoked to find and invoke relevant trace procedures associated with a particular operation on a variable.
protected static void cleanupVar(Var var, Var array)
          CleanupVar -> cleanupVar This procedure is called when it looks like it may be OK to free up the variable's record and hash table entry, and those of its containing parent.
protected static void deleteArray(Interp interp, java.lang.String arrayName, Var var, int flags)
          DeleteArray -> deleteArray This procedure is called to free up everything in an array variable.
protected static void deleteSearches(Var arrayVar)
          DeleteSearches -> deleteSearches This procedure is called to free up all of the searches associated with an array variable.
protected static void deleteVar(Interp interp, Var var, int flags)
          deleteVar This procedure is called to recycle all the storage space associated with a single Var instance.
protected static void deleteVars(Interp interp, java.util.HashMap table)
          TclDeleteVars -> deleteVars This procedure is called to recycle all the storage space associated with a table of variables.
protected static void deleteVars(Interp interp, Var[] compiledLocals)
          // FIXME: Make more like TclDeleteCompiledLocalVars() TclDeleteVars -> deleteVars This procedure is called to recycle all the storage space associated with an array of variables.
protected  int getNextIndex()
          Used by ArrayCmd to create a unique searchId string.
protected  java.util.Iterator getSearch(java.lang.String s)
          Find the SearchId that in the sidVec List that is equal the unique String s and returns the iterator associated with that SearchId.
protected static java.util.ArrayList getTraces(Interp interp, java.lang.String part1, java.lang.String part2, int flags)
          Tcl_VarTraceInfo2 -> getTraces
static java.lang.String getVariableFullName(Interp interp, Var var)
           
static boolean isArrayVarname(java.lang.String varName)
           
protected static void makeUpvar(Interp interp, CallFrame frame, java.lang.String otherP1, java.lang.String otherP2, int otherFlags, java.lang.String myName, int myFlags, int localIndex)
          MakeUpvar -> makeUpvar Create a reference of a variable in otherFrame in the current CallFrame, given a two-part name consisting of array name and element within array.
protected  boolean removeSearch(java.lang.String sid)
          Find the SearchId object in the sidVec list and remove it.
 java.lang.String toString()
          Used to create a String that describes this variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Used to create a String that describes this variable.

Overrides:
toString in class java.lang.Object

getNextIndex

protected int getNextIndex()
Used by ArrayCmd to create a unique searchId string. If the sidVec List is empty then simply return 1. Else return 1 plus the SearchId.index value of the last Object in the vector.

Parameters:
None -
Returns:
The int value for unique SearchId string.

getSearch

protected java.util.Iterator getSearch(java.lang.String s)
Find the SearchId that in the sidVec List that is equal the unique String s and returns the iterator associated with that SearchId.

Parameters:
s - String that ia a unique identifier for a SearchId object
Returns:
Iterator if a match is found else null.

removeSearch

protected boolean removeSearch(java.lang.String sid)
Find the SearchId object in the sidVec list and remove it.

Parameters:
sid - String that ia a unique identifier for a SearchId object.

isArrayVarname

public static final boolean isArrayVarname(java.lang.String varName)

getTraces

protected static java.util.ArrayList getTraces(Interp interp,
                                               java.lang.String part1,
                                               java.lang.String part2,
                                               int flags)
                                        throws TclException
Tcl_VarTraceInfo2 -> getTraces

Parameters:
interp - Interpreter containing variable.
part1 - 1st part of the variable name.
part2 - 2nd part of the variable name (can be null).
flags - misc flags that control the actions of this method.
Returns:
the list of traces of a variable.
Throws:
TclException

makeUpvar

protected static void makeUpvar(Interp interp,
                                CallFrame frame,
                                java.lang.String otherP1,
                                java.lang.String otherP2,
                                int otherFlags,
                                java.lang.String myName,
                                int myFlags,
                                int localIndex)
                         throws TclException
MakeUpvar -> makeUpvar Create a reference of a variable in otherFrame in the current CallFrame, given a two-part name consisting of array name and element within array.

Parameters:
interp - Interp containing the variables
frame - CallFrame containing "other" variable. null means use global context.
otherP1 - the 1st part name of the variable in the "other" frame.
otherP2 - the 2nd part name of the variable in the "other" frame.
otherFlags - the flags for scaope of "other" variable
myName - Name of scalar variable which will refer to otherP1/otherP2.
myFlags - only the TCL.GLOBAL_ONLY bit matters, indicating the scope of myName.
Throws:
TclException - if the upvar cannot be created.

getVariableFullName

public static java.lang.String getVariableFullName(Interp interp,
                                                   Var var)

callTraces

protected static java.lang.String callTraces(Interp interp,
                                             Var array,
                                             Var var,
                                             java.lang.String part1,
                                             java.lang.String part2,
                                             int flags)
CallTraces -> callTraces This procedure is invoked to find and invoke relevant trace procedures associated with a particular operation on a variable. This procedure invokes traces both on the variable and on its containing array (where relevant).

Parameters:
interp - Interpreter containing variable.
array - array variable that contains the variable, or null if the variable isn't an element of an array.
var - Variable whose traces are to be invoked.
part1 - the first part of a variable name.
part2 - the second part of a variable name.
flags - Flags to pass to trace procedures: indicates what's happening to variable, plus other stuff like TCL.GLOBAL_ONLY, TCL.NAMESPACE_ONLY, and TCL.INTERP_DESTROYED.
Returns:
null if no trace procedures were invoked, or if all the invoked trace procedures returned successfully. The return value is non-null if a trace procedure returned an error (in this case no more trace procedures were invoked after the error was returned). In this case the return value is a pointer to a string describing the error.

deleteSearches

protected static void deleteSearches(Var arrayVar)
DeleteSearches -> deleteSearches This procedure is called to free up all of the searches associated with an array variable.

Parameters:
interp - Interpreter containing array.
arrayVar - the array variable to delete searches from.

deleteVars

protected static void deleteVars(Interp interp,
                                 java.util.HashMap table)
TclDeleteVars -> deleteVars This procedure is called to recycle all the storage space associated with a table of variables. For this procedure to work correctly, it must not be possible for any of the variables in the table to be accessed from Tcl commands (e.g. from trace procedures).

Parameters:
interp - Interpreter containing array.
table - HashMap that holds the Vars to delete

deleteVars

protected static void deleteVars(Interp interp,
                                 Var[] compiledLocals)
// FIXME: Make more like TclDeleteCompiledLocalVars() TclDeleteVars -> deleteVars This procedure is called to recycle all the storage space associated with an array of variables. For this procedure to work correctly, it must not be possible for any of the variables in the array to be accessed from Tcl commands (e.g. from trace procedures).

Parameters:
interp - Interpreter containing array.
compiledLocals - array of compiled local variables

deleteVar

protected static void deleteVar(Interp interp,
                                Var var,
                                int flags)
deleteVar This procedure is called to recycle all the storage space associated with a single Var instance.

Parameters:
interp - Interpreter containing array.
var - A Var refrence to be deleted
flags - flags to pass to trace callbacks.

deleteArray

protected static void deleteArray(Interp interp,
                                  java.lang.String arrayName,
                                  Var var,
                                  int flags)
DeleteArray -> deleteArray This procedure is called to free up everything in an array variable. It's the caller's responsibility to make sure that the array is no longer accessible before this procedure is called.

Parameters:
interp - Interpreter containing array.
arrayName - name of array (used for trace callbacks).
var - the array variable to delete.
flags - Flags to pass to CallTraces.

cleanupVar

protected static void cleanupVar(Var var,
                                 Var array)
CleanupVar -> cleanupVar This procedure is called when it looks like it may be OK to free up the variable's record and hash table entry, and those of its containing parent. It's called, for example, when a trace on a variable deletes the variable.

Parameters:
var - variable that may be a candidate for being expunged.
array - Array that contains the variable, or NULL if this variable isn't an array element.