From aa1f9091eb3bb99bc9e42cff663cb010f63e7d8c Mon Sep 17 00:00:00 2001 From: das Date: Thu, 13 Sep 2007 15:25:50 +0000 Subject: * generic/tclCmdIL.c: factor our core of InfoFrameCmd() into internal TclInfoFrame() for use by DTrace probes. --- generic/tclCmdIL.c | 55 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index d3decd7..d3aee97 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.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: tclCmdIL.c,v 1.122 2007/07/31 17:03:36 msofer Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.123 2007/09/13 15:25:50 das Exp $ */ #include "tclInt.h" @@ -1060,18 +1060,8 @@ InfoFrameCmd( Tcl_Obj *CONST objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; - Tcl_Obj *lv[20]; /* Keep uptodate when more keys are added to - * the dict. */ - int level, lc = 0; + int level; CmdFrame *framePtr; - /* - * This array is indexed by the TCL_LOCATION_... values, except - * for _LAST. - */ - static CONST char *typeString[TCL_LOCATION_LAST] = { - "eval", "eval", "eval", "precompiled", "source", "proc" - }; - Tcl_Obj *tmpObj; if (objc == 1) { /* @@ -1125,7 +1115,45 @@ InfoFrameCmd( goto levelError; } + Tcl_SetObjResult(interp, TclInfoFrame(interp, framePtr)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclInfoFrame -- + * + * Core of InfoFrameCmd, returns TIP280 dict for a given frame. + * + * Results: + * Returns TIP280 dict. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclInfoFrame( + Tcl_Interp *interp, /* Current interpreter. */ + CmdFrame *framePtr) /* Frame to get info for. */ +{ + Interp *iPtr = (Interp *) interp; + Tcl_Obj *lv[20]; /* Keep uptodate when more keys are added to + * the dict. */ + int lc = 0; /* + * This array is indexed by the TCL_LOCATION_... values, except + * for _LAST. + */ + static CONST char *typeString[TCL_LOCATION_LAST] = { + "eval", "eval", "eval", "precompiled", "source", "proc" + }; + Tcl_Obj *tmpObj; + + /* * Pull the information and construct the dictionary to return, as list. * Regarding use of the CmdFrame fields see tclInt.h, and its definition. */ @@ -1301,8 +1329,7 @@ InfoFrameCmd( } } - Tcl_SetObjResult(interp, Tcl_NewListObj(lc, lv)); - return TCL_OK; + return Tcl_NewListObj(lc, lv); } /* -- cgit v0.12