diff options
author | dgp <dgp@users.sourceforge.net> | 2013-08-14 12:15:59 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-08-14 12:15:59 (GMT) |
commit | 6dee5b3e07d501459386b52bc18efc2c2cbc5fcb (patch) | |
tree | 0b40f16863b25ebb13b0372d9395cf90c76225e9 /generic | |
parent | 9d1f38c3e3690b0f7b473375d4fe633656c630a4 (diff) | |
download | tcl-6dee5b3e07d501459386b52bc18efc2c2cbc5fcb.zip tcl-6dee5b3e07d501459386b52bc18efc2c2cbc5fcb.tar.gz tcl-6dee5b3e07d501459386b52bc18efc2c2cbc5fcb.tar.bz2 |
Consolidate some helper routines.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdIL.c | 19 | ||||
-rw-r--r-- | generic/tclExecute.c | 27 | ||||
-rw-r--r-- | generic/tclInt.h | 2 |
3 files changed, 19 insertions, 29 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index da9edd6..fa4ead4 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1266,25 +1266,6 @@ InfoFrameCmd( */ Tcl_Obj * -TclGetSourceFromFrame( - CmdFrame *cfPtr, - int objc, - Tcl_Obj *const objv[]) -{ - if (cfPtr == NULL) { - return Tcl_NewListObj(objc, objv); - } - if (cfPtr->cmdObj == NULL) { - if (cfPtr->cmd == NULL) { - cfPtr->cmd = TclGetSrcInfoForCmdFrame(cfPtr, &cfPtr->len); - } - cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); - Tcl_IncrRefCount(cfPtr->cmdObj); - } - return cfPtr->cmdObj; -} - -Tcl_Obj * TclInfoFrame( Tcl_Interp *interp, /* Current interpreter. */ CmdFrame *framePtr) /* Frame to get info for. */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 58e4d3d..d066476 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8740,7 +8740,7 @@ IllegalExprOperandType( /* *---------------------------------------------------------------------- * - * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSrcInfoForCmdFrame -- + * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSourceFromFrame -- * * Given a program counter value, finds the closest command in the * bytecode code unit's CmdLocation array and returns information about @@ -8761,15 +8761,26 @@ IllegalExprOperandType( *---------------------------------------------------------------------- */ -const char * -TclGetSrcInfoForCmdFrame( +Tcl_Obj * +TclGetSourceFromFrame( CmdFrame *cfPtr, - int *lenPtr) + int objc, + Tcl_Obj *const objv[]) { - ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; - - return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, - codePtr, lenPtr, NULL, NULL); + if (cfPtr == NULL) { + return Tcl_NewListObj(objc, objv); + } + if (cfPtr->cmdObj == NULL) { + if (cfPtr->cmd == NULL) { + ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; + + cfPtr->cmd = GetSrcInfoForPc((unsigned char *) + cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL); + } + cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + Tcl_IncrRefCount(cfPtr->cmdObj); + } + return cfPtr->cmdObj; } void diff --git a/generic/tclInt.h b/generic/tclInt.h index 19cd883..6056119 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2909,8 +2909,6 @@ MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr); MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE const char *TclGetSrcInfoForCmdFrame(CmdFrame *cfPtr, - int *lenPtr); MODULE_SCOPE int TclGlob(Tcl_Interp *interp, char *pattern, Tcl_Obj *unquotedPrefix, int globFlags, Tcl_GlobTypeData *types); |