summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.c
diff options
context:
space:
mode:
authorwelch <welch>1998-06-28 21:38:48 (GMT)
committerwelch <welch>1998-06-28 21:38:48 (GMT)
commit7d1f7120682cc4d944681bad0c1c5c38cf5bac4b (patch)
treed54b2e00fc2230746663084f08afdb06dd5b83ff /generic/tclVar.c
parent5660a1b99f47947543a5c227dd01243409577753 (diff)
downloadtcl-7d1f7120682cc4d944681bad0c1c5c38cf5bac4b.zip
tcl-7d1f7120682cc4d944681bad0c1c5c38cf5bac4b.tar.gz
tcl-7d1f7120682cc4d944681bad0c1c5c38cf5bac4b.tar.bz2
incr tcl updtaes
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r--generic/tclVar.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 6725568..d86ca06 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -141,7 +141,8 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2,
* parens around the index. Otherwise they
* are NULL. These are needed to restore
* the parens after parsing the name. */
- Namespace *varNsPtr, *dummy1Ptr, *dummy2Ptr;
+ Namespace *varNsPtr, *cxtNsPtr, *dummy1Ptr, *dummy2Ptr;
+ ResolverScheme *resPtr;
Tcl_HashEntry *hPtr;
register char *p;
int new, i, result;
@@ -183,6 +184,46 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2,
}
/*
+ * If this namespace has a variable resolver, then give it first
+ * crack at the variable resolution. It may return a Tcl_Var
+ * value, it may signal to continue onward, or it may signal
+ * an error.
+ */
+ if ((flags & TCL_GLOBAL_ONLY) != 0 || iPtr->varFramePtr == NULL) {
+ cxtNsPtr = iPtr->globalNsPtr;
+ }
+ else {
+ cxtNsPtr = iPtr->varFramePtr->nsPtr;
+ }
+
+ if (cxtNsPtr->varResProc != NULL || iPtr->resolverPtr != NULL) {
+ resPtr = iPtr->resolverPtr;
+
+ if (cxtNsPtr->varResProc) {
+ result = (*cxtNsPtr->varResProc)(interp, part1,
+ (Tcl_Namespace *) cxtNsPtr, flags, &var);
+ } else {
+ result = TCL_CONTINUE;
+ }
+
+ while (result == TCL_CONTINUE && resPtr) {
+ if (resPtr->varResProc) {
+ result = (*resPtr->varResProc)(interp, part1,
+ (Tcl_Namespace *) cxtNsPtr, flags, &var);
+ }
+ resPtr = resPtr->nextPtr;
+ }
+
+ if (result == TCL_OK) {
+ varPtr = (Var *) var;
+ goto lookupVarPart2;
+ }
+ else if (result != TCL_CONTINUE) {
+ return (Var *) NULL;
+ }
+ }
+
+ /*
* Look up part1. Look it up as either a namespace variable or as a
* local variable in a procedure call frame (varFramePtr).
* Interpret part1 as a namespace variable if:
@@ -310,6 +351,8 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2,
}
}
}
+
+lookupVarPart2:
if (openParen != NULL) {
*openParen = '(';
openParen = NULL;
@@ -4273,6 +4316,7 @@ TclDeleteVars(iPtr, tablePtr)
if (TclIsVarArray(varPtr)) {
DeleteArray(iPtr, Tcl_GetHashKey(tablePtr, hPtr), varPtr,
flags);
+ varPtr->value.tablePtr = NULL;
}
if (TclIsVarScalar(varPtr) && (varPtr->value.objPtr != NULL)) {
objPtr = varPtr->value.objPtr;