summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-08-14 12:15:59 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-08-14 12:15:59 (GMT)
commitb2d7315f923bd7c0eae390595466fcf0ff1388ac (patch)
tree0b40f16863b25ebb13b0372d9395cf90c76225e9 /generic/tclExecute.c
parent9c15217967a7614ac17d324144b8e39d788b6eef (diff)
downloadtcl-b2d7315f923bd7c0eae390595466fcf0ff1388ac.zip
tcl-b2d7315f923bd7c0eae390595466fcf0ff1388ac.tar.gz
tcl-b2d7315f923bd7c0eae390595466fcf0ff1388ac.tar.bz2
Consolidate some helper routines.dgp_bye_ctx_eval_flag
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c27
1 files changed, 19 insertions, 8 deletions
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