summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c20
-rw-r--r--generic/tclExecute.c15
2 files changed, 13 insertions, 22 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index fc5e49e..18acb81 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.38 2001/11/19 17:30:27 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.39 2001/11/20 19:45:19 msofer Exp $
*/
#include "tclInt.h"
@@ -2796,11 +2796,10 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
* it's probably because of an infinite loop somewhere.
*/
- if (iPtr->numLevels >= iPtr->maxNestingDepth) {
+ if (iPtr->numLevels > iPtr->maxNestingDepth) {
iPtr->result = "too many nested calls to Tcl_Eval (infinite loop?)";
return TCL_ERROR;
}
- iPtr->numLevels++;
/*
* On the Mac, we will never reach the default recursion limit before
@@ -2809,7 +2808,6 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
if (TclpCheckStackSpace() == 0) {
/*NOTREACHED*/
- iPtr->numLevels--;
iPtr->result = "too many nested calls to Tcl_Eval (infinite loop?)";
return TCL_ERROR;
}
@@ -2838,7 +2836,9 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
(char *) NULL);
code = TCL_ERROR;
} else {
+ iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objc+1, newObjv, command, length, 0);
+ iPtr->numLevels--;
}
Tcl_DecrRefCount(newObjv[0]);
ckfree((char *) newObjv);
@@ -2918,7 +2918,6 @@ TclEvalObjvInternal(interp, objc, objv, command, length, flags)
}
done:
- iPtr->numLevels--;
return code;
}
@@ -2962,10 +2961,7 @@ Tcl_EvalObjv(interp, objc, objv, flags)
int code = TCL_OK;
for (tracePtr = iPtr->tracePtr; tracePtr; tracePtr = tracePtr->nextPtr) {
- /*
- * EvalObjv will increment numLevels so use "<" rather than "<="
- */
- if (iPtr->numLevels < tracePtr->level) {
+ if (iPtr->numLevels <= tracePtr->level) {
int i;
/*
* The command will be needed for an execution trace or stack trace
@@ -2987,7 +2983,9 @@ Tcl_EvalObjv(interp, objc, objv, flags)
*/
switch (code) {
case TCL_OK:
+ iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objc, objv, cmdString, cmdLen, flags);
+ iPtr->numLevels--;
if (code == TCL_ERROR && cmdLen == 0)
goto cmdtraced;
break;
@@ -3417,8 +3415,10 @@ Tcl_EvalEx(interp, script, numBytes, flags)
/*
* Execute the command and free the objects for its words.
*/
-
+
+ iPtr->numLevels++;
code = TclEvalObjvInternal(interp, objectsUsed, objv, p, bytesLeft, 0);
+ iPtr->numLevels--;
if (code != TCL_OK) {
goto error;
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 7bb78fa..cb3b5cc 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.39 2001/11/20 16:52:46 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.40 2001/11/20 19:45:19 msofer Exp $
*/
#include "tclInt.h"
@@ -765,13 +765,7 @@ TclExecuteByteCode(interp, codePtr)
for (tracePtr = iPtr->tracePtr; tracePtr != NULL;
tracePtr = nextTracePtr) {
nextTracePtr = tracePtr->nextPtr;
-
- /*
- * TclEvalObjvInternal will increment numLevels
- * so use "<" rather than "<="
- */
-
- if (iPtr->numLevels < tracePtr->level) {
+ if (iPtr->numLevels <= tracePtr->level) {
/*
* Traces will be called: get command string
*/
@@ -795,15 +789,12 @@ TclExecuteByteCode(interp, codePtr)
preservedStack = stackPtr;
/*
- * Finally, let TclEvalObjvInternal handle the command. As it
- * will increase the numLevels, decrease them here to compensate.
+ * Finally, let TclEvalObjvInternal handle the command.
*/
- iPtr->numLevels--;
DECACHE_STACK_INFO();
result = TclEvalObjvInternal(interp, objc, objv, bytes, length, 0);
CACHE_STACK_INFO();
- iPtr->numLevels++;
/*
* If the old stack is going to be released, it is