summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2012-03-01 09:29:27 (GMT)
committersebres <sebres@users.sourceforge.net>2012-03-01 09:29:27 (GMT)
commitc2a45672bbf7864d9b68c70a8429a31006009f5e (patch)
tree67ed371c02061643f6c4677516bc1f6411244c09
parent3842ca9ea3933c6f90d77974bd154cd6f719bef1 (diff)
downloadtcl-c2a45672bbf7864d9b68c70a8429a31006009f5e.zip
tcl-c2a45672bbf7864d9b68c70a8429a31006009f5e.tar.gz
tcl-c2a45672bbf7864d9b68c70a8429a31006009f5e.tar.bz2
clarify and review code
-rw-r--r--generic/tclBasic.c11
-rw-r--r--generic/tclCompile.h6
-rw-r--r--generic/tclExecute.c8
-rw-r--r--generic/tclNamesp.c4
4 files changed, 17 insertions, 12 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index deeebbb..3f55b0a 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -3005,6 +3005,9 @@ CallCommandTraces(
* This function returns a Tcl_Obj with the full source string for the
* command. This insures that traces get a correct NUL-terminated command
* string.
+ * If parameter 'command' is (char*)-1 it returns a pointer to the command's
+ * source using TclGetSrcInfoForCmd. As parameter 'numChars' could be used
+ * an ENSEMBLE_PSEUDO_COMMAND to advise call of the ensemble command.
*
*----------------------------------------------------------------------
*/
@@ -3020,7 +3023,7 @@ GetCommandSource(
if (!command) {
return Tcl_NewListObj(objc, objv);
}
- if (command == (char *) -1 || command == ENSEMBLE_PSEUDO_COMMAND) {
+ if (command == (char *) -1) {
command = TclGetSrcInfoForCmd(iPtr, &numChars);
if (!command) {
return Tcl_NewListObj(objc, objv);
@@ -3537,9 +3540,9 @@ TclEvalObjvInternal(
* representation of the command is unknown is
* to be generated from (objc,objv), -1 if it
* is to be generated from bytecode source,
- * ENSEMBLE_PSEUDO_COMMAND if it is to be
- * determined from the ensemble context. This
- * is only needed the traces. */
+ * with length ENSEMBLE_PSEUDO_COMMAND it is
+ * to be determined from the ensemble context.
+ * This is only needed the traces. */
int length, /* Number of bytes in command; if -1, all
* characters up to the first null byte are
* used. */
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 0fd7589..cc7ee3f 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -845,12 +845,12 @@ typedef struct {
} TclOpCmdClientData;
/*
- * Special sentinel value for TclEvalObjvInternal's 'command' parameter to
+ * Special sentinel value for TclEvalObjvInternal's 'length' parameter to
* cause it to retrieve command information for an ensemble from the
- * containing command.
+ * containing command (parameter 'command' is (char *)-1).
*/
-#define ENSEMBLE_PSEUDO_COMMAND ((char *)(-2))
+#define ENSEMBLE_PSEUDO_COMMAND -2
/*
*----------------------------------------------------------------
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index eb092a2..cf335db 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -7757,6 +7757,8 @@ IllegalExprOperandType(
* at pc, information about the closest enclosing command is returned. If
* no matching command is found, NULL is returned and *lengthPtr is
* unchanged.
+ * As input parameter '*lengthPtr' could be used an ENSEMBLE_PSEUDO_COMMAND
+ * to advise call of the ensemble command.
*
* Side effects:
* The CmdFrame at *cfPtr is updated.
@@ -7786,11 +7788,11 @@ TclGetSrcInfoForCmd(
codePtr, &len);
/*
- * [sebres]: If ensemble call (sentinel length == -2), shift string ptr to
- * subcommand (string range -> range).
+ * [sebres]: If ensemble call (sentinel length == ENSEMBLE_PSEUDO_COMMAND),
+ * shift string ptr to subcommand (string range -> range).
*/
- if (command && len && (lenPtr && *lenPtr == -2) && codePtr->objArrayPtr) {
+ if (command && len && (lenPtr && *lenPtr == ENSEMBLE_PSEUDO_COMMAND) && codePtr->objArrayPtr) {
Tcl_Obj *objPtr = codePtr->objArrayPtr[0];
if (len > objPtr->length) {
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index f4550d9..84be640 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -6235,8 +6235,8 @@ NsEnsembleImplementationCmd(
*/
result = TclEvalObjvInternal(interp, objc-2+prefixObjc, tempObjv,
- ENSEMBLE_PSEUDO_COMMAND, -2 /*TclGetSrcInfoForCmd sentinel*/,
- TCL_EVAL_INVOKE);
+ /* call from TEBC, TclGetSrcInfoForCmd sentinel */(char *) -1,
+ ENSEMBLE_PSEUDO_COMMAND, TCL_EVAL_INVOKE);
/*
* Clean up.