From 63d4144a37db8c69be1a8090936516467f684480 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Tue, 22 Jul 2008 21:02:25 +0000 Subject: * generic/tclBasic.c: Added numLevels field to CommandFrame, * generic/tclExecute.c: let GetCommandSource use it. This solves * generic/tclInt.h: [Bug 2017146]. Thx dgp for the analysis. --- ChangeLog | 8 +++++++- generic/tclBasic.c | 6 ++++-- generic/tclExecute.c | 3 ++- generic/tclInt.h | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d388303..6d06add 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -2008-07-21 Andreas Kupries +2008-07-22 Miguel Sofer + + * generic/tclBasic.c: Added numLevels field to CommandFrame, + * generic/tclExecute.c: let GetCommandSource use it. This solves + * generic/tclInt.h: [Bug 2017146]. Thx dgp for the analysis. + +2008-07-22 Andreas Kupries * generic/tclBasic.c: Extended the existing TIP #280 system (info * generic/tclCmdAH.c: frame), added the ability to track the diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 8c4f69a..f7c667a 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.323 2008/07/21 23:46:51 das Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.324 2008/07/22 21:02:27 msofer Exp $ */ #include "tclInt.h" @@ -3161,7 +3161,7 @@ GetCommandSource( int numChars; objPtr = Tcl_NewListObj(objc, objv); - if (lookup && cfPtr) { + if (lookup && cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) { switch (cfPtr->type) { case TCL_LOCATION_EVAL: case TCL_LOCATION_SOURCE: @@ -4910,6 +4910,7 @@ TclEvalEx( } eeFramePtr->level = iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level + 1 : 1; + eeFramePtr->numLevels = iPtr->numLevels; eeFramePtr->framePtr = iPtr->framePtr; eeFramePtr->nextPtr = iPtr->cmdFramePtr; eeFramePtr->nline = 0; @@ -5640,6 +5641,7 @@ TclNREvalObjEx( eoFramePtr->type = TCL_LOCATION_EVAL_LIST; eoFramePtr->level = (iPtr->cmdFramePtr == NULL? 1 : iPtr->cmdFramePtr->level + 1); + eoFramePtr->numLevels = iPtr->numLevels; eoFramePtr->framePtr = iPtr->framePtr; eoFramePtr->nextPtr = iPtr->cmdFramePtr; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 148b3e9..b26d77e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -14,7 +14,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.385 2008/07/21 19:41:42 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.386 2008/07/22 21:02:28 msofer Exp $ */ #include "tclInt.h" @@ -1867,6 +1867,7 @@ TclExecuteByteCode( bcFramePtr->type = ((codePtr->flags & TCL_BYTECODE_PRECOMPILED) ? TCL_LOCATION_PREBC : TCL_LOCATION_BC); bcFramePtr->level = (iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level+1 : 1); + bcFramePtr->numLevels = iPtr->numLevels; bcFramePtr->framePtr = iPtr->framePtr; bcFramePtr->nextPtr = iPtr->cmdFramePtr; bcFramePtr->nline = 0; diff --git a/generic/tclInt.h b/generic/tclInt.h index 7614f32..dad62a8 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.376 2008/07/21 22:50:34 andreas_kupries Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.377 2008/07/22 21:02:30 msofer Exp $ */ #ifndef _TCLINT @@ -1094,6 +1094,8 @@ typedef struct CmdFrame { int type; /* Values see below. */ int level; /* #Frames in stack, prevent O(n) scan of * list. */ + int numLevels; /* value of interp's numLevels when the frame + * was pushed */ int *line; /* Lines the words of the command start on. */ int nline; -- cgit v0.12