diff options
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index ac7fd5e..b50234b 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,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.357 2008/08/20 23:48:42 patthoyts Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.358 2008/08/21 21:01:23 msofer Exp $ */ #include "tclInt.h" @@ -8144,10 +8144,12 @@ static void DeleteCoroutine( ClientData clientData) { - register CoroutineData *corPtr = clientData; - + CoroutineData *corPtr = (CoroutineData *) clientData; + Tcl_Interp *interp = corPtr->eePtr->interp; + TEOV_callback *rootPtr = TOP_CB(interp); + if (COR_IS_SUSPENDED(corPtr)) { - RewindCoroutine(corPtr, TCL_OK); + (void) TclNRRunCallbacks(interp, RewindCoroutine(corPtr, TCL_OK), rootPtr, 0); } } @@ -8171,9 +8173,7 @@ PlugCoroutineChains( corPtr->base.framePtr->callerVarPtr = corPtr->caller.varFramePtr; corPtr->base.cmdFramePtr->nextPtr = corPtr->caller.cmdFramePtr; - corPtr->base.cmdFramePtr->level = (iPtr->cmdFramePtr == NULL? - 1 : iPtr->cmdFramePtr->level + 1); - corPtr->base.cmdFramePtr->numLevels = iPtr->numLevels; + corPtr->levelOffset = iPtr->cmdFramePtr->level; } static int @@ -8189,6 +8189,13 @@ NRCoroutineFirstCallback( while (tmpPtr->nextPtr != corPtr->caller.cmdFramePtr) { tmpPtr = tmpPtr->nextPtr; } + + /* + * Set the base cmdFrame level to zero, it will be computed using the + * offset. + */ + + tmpPtr->level = 0; corPtr->base.cmdFramePtr = tmpPtr; } @@ -8384,6 +8391,13 @@ TclNRCoroutineObjCmd( corPtr->eePtr->corPtr = corPtr; corPtr->stackLevel = NULL; + /* + * On first run just set a 0 level-offset, the natural numbering is + * correct. The offset will be fixed for later runs. + */ + + corPtr->levelOffset = 0; + Tcl_DStringInit(&ds); if (nsPtr != iPtr->globalNsPtr) { Tcl_DStringAppend(&ds, nsPtr->fullName, -1); |