diff options
author | sebres <sebres@users.sourceforge.net> | 2012-03-07 15:40:59 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2012-03-07 15:40:59 (GMT) |
commit | 049be8908f899a68f88ba8e2d1bdea7c6d0d64dc (patch) | |
tree | 55f9c6ad7ded08a8b2c1bdac6d7e84b7cdf83a90 | |
parent | acf988e185b775de1775d3af1b10c1a7e7df7fd6 (diff) | |
download | tcl-049be8908f899a68f88ba8e2d1bdea7c6d0d64dc.zip tcl-049be8908f899a68f88ba8e2d1bdea7c6d0d64dc.tar.gz tcl-049be8908f899a68f88ba8e2d1bdea7c6d0d64dc.tar.bz2 |
experimental trying to use TclGetSrcInfoForCmd without special sentinel ENSEMBLE_PSEUDO_COMMAND
-rw-r--r-- | generic/tclBasic.c | 18 | ||||
-rw-r--r-- | generic/tclCompile.h | 7 | ||||
-rw-r--r-- | generic/tclExecute.c | 35 | ||||
-rw-r--r-- | generic/tclNamesp.c | 8 |
4 files changed, 14 insertions, 54 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 876daa7..a4d27d0 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3008,8 +3008,7 @@ CallCommandTraces( * * If 'command' has value (char*)-1, this function calls * TclGetSrcInfoForCmd() to obtain the source string. This is used - * to retrieve suitable source strings for bytecode exection and - * ensemble subcommand dispatch. + * to retrieve suitable source strings for bytecode exection. *---------------------------------------------------------------------- */ @@ -3021,16 +3020,13 @@ GetCommandSource( int objc, Tcl_Obj *const objv[]) { - if (!command) { - return Tcl_NewListObj(objc, objv); - } if (command == (char *) -1) { command = TclGetSrcInfoForCmd(iPtr, &numChars); - if (!command) { - return Tcl_NewListObj(objc, objv); - } } - return Tcl_NewStringObj(command, numChars); + if (command) { + return Tcl_NewStringObj(command, numChars); + } + return Tcl_NewListObj(objc, objv); } /* @@ -3540,9 +3536,7 @@ TclEvalObjvInternal( * for traces. NULL if the string * representation of the command is unknown is * to be generated from (objc,objv), -1 if it - * is to be generated from bytecode source, - * or, when length is ENSEMBLE_PSEUDO_COMMAND, - * determined from the ensemble context. + * is to be generated from bytecode source. * This is only needed the traces. */ int length, /* Number of bytes in command; if -1, all * characters up to the first null byte are diff --git a/generic/tclCompile.h b/generic/tclCompile.h index cc7ee3f..6f0e31d 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -844,13 +844,6 @@ typedef struct { } i; } TclOpCmdClientData; -/* - * Special sentinel value for TclEvalObjvInternal's 'length' parameter to - * cause it to retrieve command information for an ensemble from the - * containing command (parameter 'command' is (char *)-1). - */ - -#define ENSEMBLE_PSEUDO_COMMAND -2 /* *---------------------------------------------------------------- diff --git a/generic/tclExecute.c b/generic/tclExecute.c index cf83d77..0a98d95 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -7758,9 +7758,6 @@ IllegalExprOperandType( * no matching command is found, NULL is returned and *lengthPtr is * unchanged. * - * If input parameter '*lengthPtr' has value ENSEMBLE_PSEUDO_COMMAND, - * we're servicing a subcomand dispatch. - * * Side effects: * The CmdFrame at *cfPtr is updated. * @@ -7773,40 +7770,16 @@ TclGetSrcInfoForCmd( int *lenPtr) { CmdFrame *cfPtr = iPtr->cmdFramePtr; - const char *command; ByteCode *codePtr; - int len; - if (!cfPtr) { + if (!cfPtr) return NULL; - } codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; - if (!codePtr || !cfPtr->data.tebc.pc) { + if (!codePtr || !cfPtr->data.tebc.pc) return NULL; - } - - command = GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, - codePtr, &len); - - /* - * [sebres]: If ensemble call (sentinel length == ENSEMBLE_PSEUDO_COMMAND), - * shift string ptr to subcommand (string range -> range). - */ - - if (command && len && lenPtr && *lenPtr == ENSEMBLE_PSEUDO_COMMAND - && codePtr->objArrayPtr) { - Tcl_Obj *objPtr = codePtr->objArrayPtr[0]; - - if (len > objPtr->length) { - command += objPtr->length + 1; - len -= objPtr->length + 1; - } - } - if (lenPtr != NULL) { - *lenPtr = len; - } - return command; + return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, + codePtr, lenPtr); } void diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 84be640..888f70b 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -6230,13 +6230,13 @@ NsEnsembleImplementationCmd( /* * Hand off to the target command. - * [sebres] call from ensemble using ENSEMBLE_PSEUDO_COMMAND to - * retrive subcommand from main ensemble. + * [sebres] call from ensemble, use TEBC to retrive command trace + * from main ensemble. */ result = TclEvalObjvInternal(interp, objc-2+prefixObjc, tempObjv, - /* call from TEBC, TclGetSrcInfoForCmd sentinel */(char *) -1, - ENSEMBLE_PSEUDO_COMMAND, TCL_EVAL_INVOKE); + /* call from TEBC, TclGetSrcInfoForCmd */(char *) -1, + -1, TCL_EVAL_INVOKE); /* * Clean up. |