|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttcl.lang.Var
public class Var
Field Summary | |
---|---|
static int |
EXPLICIT_LOCAL_NAME
|
String |
hashKey
The key under which this variable is stored in the hash table. |
Namespace |
ns
Reference to the namespace that contains this variable. |
int |
refCount
Counts number of active uses of this variable, not including its entry in the call frame or the hash table: 1 for each additional variable whose link points here, 1 for each nested trace active on variable, and 1 if the variable is a namespace variable. |
ArrayList |
sidVec
|
Map |
table
If variable is in a hashtable, either the hash table entry that refers to this variable or null if the variable has been detached from its hash table (e.g. |
ArrayList |
traces
List that holds the traces that were placed in this Var |
Constructor Summary | |
---|---|
Var()
NewVar -> Var Construct a variable and initialize its fields. |
Method Summary | |
---|---|
static void |
AppendLocals(Interp interp,
TclObject list,
String pattern,
boolean includeLinks)
|
static String |
callTraces(Interp interp,
Var array,
Var var,
String part1,
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. |
void |
clearVarInHashtable()
|
void |
createArrayMap()
Create a new array map in this Var |
protected static void |
deleteArray(Interp interp,
String arrayName,
Var var,
int flags)
DeleteArray -> deleteArray This procedure is called to free up everything in an array variable. |
void |
deleteArrayMap()
Remove the existing array map in this var |
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. |
static void |
deleteVars(Interp interp,
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. |
Map<String,Var> |
getArrayMap()
|
int |
getNextIndex()
Used by ArrayCmd to create a unique searchId string. |
Iterator |
getSearch(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. |
static ArrayList |
getTraces(Interp interp,
String part1,
String part2,
int flags)
Tcl_VarTraceInfo2 -> getTraces |
TclObject |
getValue()
|
static TclObject |
getVar(Interp interp,
String part1,
String part2,
int flags)
Tcl_GetVar2Ex -> getVar Query the value of a variable, given a two-part name consisting of array name and element within array. |
static TclObject |
getVarCompiledLocalArray(Interp interp,
String varname,
String key,
Var resolved,
boolean leaveErrMsg)
|
static TclObject |
getVarCompiledLocalArrayInvalid(Interp interp,
String varname,
String key)
|
static TclObject |
getVarCompiledLocalScalarInvalid(Interp interp,
String varname)
|
static String |
getVariableFullName(Interp interp,
Var var)
|
static TclObject |
incrVar(Interp interp,
String part1,
String part2,
long incrAmount,
int flags)
TclIncrVar2 -> incrVar Given a two-part variable name, which may refer either to a scalar variable or an element of an array, increment the Tcl object value of the variable by a specified amount. |
static TclObject |
initVarCompiledLocalArray(Interp interp,
String varname,
String key,
TclObject newValue,
Var[] compiledLocals,
int localIndex)
|
static TclObject |
initVarCompiledLocalScalar(Interp interp,
String varname,
TclObject newValue,
Var[] compiledLocals,
int localIndex)
|
static boolean |
isArrayVarname(String varName)
|
boolean |
isVarArray()
|
boolean |
isVarArrayElement()
|
boolean |
isVarInHashtable()
|
boolean |
isVarLink()
|
boolean |
isVarNamespace()
|
boolean |
isVarNoCache()
|
boolean |
isVarScalar()
|
boolean |
isVarTraceExists()
|
boolean |
isVarUndefined()
|
static Var[] |
lookupVar(Interp interp,
String part1,
String part2,
int flags,
String msg,
boolean createPart1,
boolean createPart2)
TclLookupVar -> lookupVar This procedure is used by virtually all of the variable code to locate a variable given its name(s). |
static void |
makeUpvar(Interp interp,
CallFrame frame,
String otherP1,
String otherP2,
int otherFlags,
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. |
boolean |
removeSearch(String sid)
Find the SearchId object in the sidVec list and remove it. |
static Var |
resolveArray(Var v)
|
static Var |
resolveScalar(Var v)
|
void |
setValue(TclObject tobj)
Set the value of this Var (either as a scalar or as an array element) |
static TclObject |
setVar(Interp interp,
String part1,
String part2,
TclObject newValue,
int flags)
Tcl_SetVar2Ex -> setVar Given a two-part variable name, which may refer either to a scalar variable or an element of an array, change the value of the variable to a new Tcl object value. |
static TclObject |
setVarCompiledLocalArray(Interp interp,
String varname,
String key,
TclObject newValue,
Var resolved)
|
static TclObject |
setVarCompiledLocalArrayInvalid(Interp interp,
String varname,
String key,
TclObject newValue)
|
static TclObject |
setVarCompiledLocalScalarInvalid(Interp interp,
String varname,
TclObject newValue)
|
void |
setVarNamespace()
|
String |
toString()
Used to create a String that describes this variable. |
static void |
traceVar(Interp interp,
String part1,
String part2,
int flags,
VarTrace proc)
Tcl_TraceVar2 -> traceVar Trace a variable, given a two-part name consisting of array name and element within array. |
static void |
untraceVar(Interp interp,
String part1,
String part2,
int flags,
VarTrace proc)
Tcl_UntraceVar2 -> untraceVar Untrace a variable, given a two-part name consisting of array name and element within array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int EXPLICIT_LOCAL_NAME
public ArrayList traces
public ArrayList sidVec
public Map table
public String hashKey
public int refCount
public Namespace ns
Constructor Detail |
---|
public Var()
Method Detail |
---|
public final boolean isVarScalar()
public final boolean isVarLink()
public final boolean isVarArray()
public final boolean isVarUndefined()
public final boolean isVarArrayElement()
public final boolean isVarNamespace()
public final boolean isVarInHashtable()
public final boolean isVarTraceExists()
public final boolean isVarNoCache()
public final void setVarNamespace()
public final void clearVarInHashtable()
public void setValue(TclObject tobj)
tobj
- public TclObject getValue()
public Map<String,Var> getArrayMap()
public void createArrayMap()
public void deleteArrayMap()
public String toString()
toString
in class Object
public int getNextIndex()
public Iterator getSearch(String s)
s
- String that ia a unique identifier for a SearchId object
public boolean removeSearch(String sid)
sid
- String that ia a unique identifier for a SearchId object.public static final boolean isArrayVarname(String varName)
public static Var[] lookupVar(Interp interp, String part1, String part2, int flags, String msg, boolean createPart1, boolean createPart2) throws TclException
part1
- if part2 isn't NULL, this is the name of an array. Otherwise,
this is a full variable name that could include a
parenthesized array element or a scalar.part2
- Name of an element within array, or null.flags
- Only the TCL.GLOBAL_ONLY bit matters.msg
- Verb to use in error messages, e.g. "read" or "set".createPart2
- OR'ed combination of CRT_PART1 and CRT_PART2. Tells which
entries to create if they don't already exist.
If the variable is found, a[1] is the array that contains the variable (or null if the variable is a scalar). If the variable can't be found and either createPart1 or createPart2 are true, a new as-yet-undefined (VAR_UNDEFINED) variable instance is created, entered into a hash table, and returned. Note: it's possible that var.value of the returned variable may be null (variable undefined), even if createPart1 or createPart2 are true (these only cause the hash table entry or array to be created). For example, the variable might be a global that has been unset but is still referenced by a procedure, or a variable that has been unset but it only being kept in existence by a trace.
TclException
- if the variable cannot be found and throwException is
true.public static TclObject getVar(Interp interp, String part1, String part2, int flags) throws TclException
interp
- the interp that holds the variablepart1
- 1st part of the variable name.part2
- 2nd part of the variable name.flags
- misc flags that control the actions of this method.
TclException
public static TclObject setVar(Interp interp, String part1, String part2, TclObject newValue, int flags) throws TclException
TclException
public static TclObject initVarCompiledLocalScalar(Interp interp, String varname, TclObject newValue, Var[] compiledLocals, int localIndex) throws TclException
TclException
public static TclObject setVarCompiledLocalScalarInvalid(Interp interp, String varname, TclObject newValue) throws TclException
TclException
public static TclObject getVarCompiledLocalScalarInvalid(Interp interp, String varname) throws TclException
TclException
public static TclObject initVarCompiledLocalArray(Interp interp, String varname, String key, TclObject newValue, Var[] compiledLocals, int localIndex) throws TclException
TclException
public static TclObject setVarCompiledLocalArrayInvalid(Interp interp, String varname, String key, TclObject newValue) throws TclException
TclException
public static TclObject getVarCompiledLocalArrayInvalid(Interp interp, String varname, String key) throws TclException
TclException
public static TclObject getVarCompiledLocalArray(Interp interp, String varname, String key, Var resolved, boolean leaveErrMsg) throws TclException
TclException
public static TclObject setVarCompiledLocalArray(Interp interp, String varname, String key, TclObject newValue, Var resolved) throws TclException
TclException
public static TclObject incrVar(Interp interp, String part1, String part2, long incrAmount, int flags) throws TclException
part1
- 1st part of the variable name.part2
- 2nd part of the variable name.incrAmount
- Amount to be added to variable.flags
- misc flags that control the actions of this method
Results: Returns a reference to the TclObject holding the new
value of the variable. If the specified variable doesn't
exist, or there is a clash in array usage, or an error occurs
while executing variable traces, then a TclException will be
raised.
Side effects: The value of the given variable is incremented
by the specified amount. If either the array or the entry
didn't exist then a new variable is created. The ref count for
the returned object is _not_ incremented to reflect the
returned reference; if you want to keep a reference to the
object you must increment its ref count yourself.
----------------------------------------------------------------
------
TclException
public static void traceVar(Interp interp, String part1, String part2, int flags, VarTrace proc) throws TclException
part1
- 1st part of the variable name.part2
- 2nd part of the variable name. null means part1 is a scalar or
whole array.flags
- misc flags that control the actions of this method. OR-ed
collection of bits, including any of TCL.TRACE_READS,
TCL.TRACE_WRITES, TCL.TRACE_UNSETS, TCL.GLOBAL_ONLY, // and
TCL.NAMESPACE_ONLY.proc
- the trace to comand to add.
TclException
public static void untraceVar(Interp interp, String part1, String part2, int flags, VarTrace proc)
interp
- Interpreter containing variable.part1
- 1st part of the variable name.part2
- 2nd part of the variable name.flags
- misc flags that control the actions of this method.proc
- the trace to delete.public static ArrayList getTraces(Interp interp, String part1, String part2, int flags) throws TclException
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.
TclException
public static void makeUpvar(Interp interp, CallFrame frame, String otherP1, String otherP2, int otherFlags, String myName, int myFlags, int localIndex) throws TclException
interp
- Interp containing the variablesframe
- 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" variablemyName
- Name of scalar variable which will refer to otherP1/otherP2.myFlags
- only the TCL.GLOBAL_ONLY bit matters, indicating the scope of
myName.
TclException
- if the upvar cannot be created.public static String getVariableFullName(Interp interp, Var var)
public static String callTraces(Interp interp, Var array, Var var, String part1, String part2, int flags)
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.
protected static void deleteSearches(Var arrayVar)
arrayVar
- the array variable to delete searches from.public static void deleteVars(Interp interp, HashMap table)
interp
- Interpreter containing array.table
- HashMap that holds the Vars to deleteprotected static void deleteVars(Interp interp, Var[] compiledLocals)
interp
- Interpreter containing array.compiledLocals
- array of compiled local variablesprotected static void deleteVar(Interp interp, Var var, int flags)
interp
- Interpreter containing array.var
- A Var refrence to be deletedflags
- flags to pass to trace callbacks.protected static void deleteArray(Interp interp, String arrayName, Var var, int flags)
interp
- Interpreter containing array.arrayName
- name of array (used for trace callbacks).var
- the array variable to delete.flags
- Flags to pass to CallTraces.protected static void cleanupVar(Var var, Var array)
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.public static Var resolveScalar(Var v)
public static Var resolveArray(Var v)
public static void AppendLocals(Interp interp, TclObject list, String pattern, boolean includeLinks) throws TclException
TclException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |