summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c340846..684d994 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.78 2005/10/08 14:42:45 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.79 2005/10/10 20:28:00 msofer Exp $
*/
#include "tclInt.h"
@@ -47,6 +47,18 @@
TclCompileCmdWord((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \
(envPtr))
+
+/*
+ * Convenience macro for use when compiling tokens to be pushed. The ANSI C
+ * "prototype" for this macro is:
+ *
+ * static void CompileTokens(CompileEnv *envPtr, Tcl_Token *tokenPtr,
+ * Tcl_Interp *interp);
+ */
+
+#define CompileTokens(envPtr, tokenPtr, interp) \
+ TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \
+ (envPtr));
/*
* Convenience macro for use when pushing literals. The ANSI C "prototype" for
* this macro is:
@@ -367,8 +379,7 @@ TclCompileCatchCmd(interp, parsePtr, envPtr)
CompileBody(envPtr, cmdTokenPtr, interp);
ExceptionRangeEnds(envPtr, range);
} else {
- TclCompileTokens(interp, cmdTokenPtr+1,
- cmdTokenPtr->numComponents, envPtr);
+ CompileTokens(envPtr, cmdTokenPtr, interp);
ExceptionRangeStarts(envPtr, range);
TclEmitOpcode(INST_EVAL_STK, envPtr);
ExceptionRangeEnds(envPtr, range);
@@ -1405,9 +1416,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr)
i < numWords-1;
i++, tokenPtr = TokenAfter(tokenPtr)) {
if ((i%2 == 0) && (i > 0)) {
- TclCompileTokens(interp, tokenPtr+1,
- tokenPtr->numComponents, envPtr);
-
+ CompileTokens(envPtr, tokenPtr, interp);
tempVar = (firstValueTemp + loopIndex);
if (tempVar <= 255) {
TclEmitInstInt1(INST_STORE_SCALAR1, tempVar, envPtr);
@@ -1986,8 +1995,7 @@ TclCompileIncrCmd(interp, parsePtr, envPtr)
PushLiteral(envPtr, word, numBytes);
}
} else {
- TclCompileTokens(interp, incrTokenPtr+1,
- incrTokenPtr->numComponents, envPtr);
+ CompileTokens(envPtr, incrTokenPtr, interp);
}
} else { /* no incr amount given so use 1 */
haveImmValue = 1;
@@ -3197,8 +3205,7 @@ TclCompileStringCmd(interp, parsePtr, envPtr)
}
PushLiteral(envPtr, str, length);
} else {
- TclCompileTokens(interp, varTokenPtr+1,
- varTokenPtr->numComponents, envPtr);
+ CompileTokens(envPtr, varTokenPtr, interp);
}
varTokenPtr = TokenAfter(varTokenPtr);
}
@@ -3228,8 +3235,7 @@ TclCompileStringCmd(interp, parsePtr, envPtr)
PushLiteral(envPtr, buf, len);
return TCL_OK;
} else {
- TclCompileTokens(interp, varTokenPtr+1,
- varTokenPtr->numComponents, envPtr);
+ CompileTokens(envPtr, varTokenPtr, interp);
}
TclEmitOpcode(INST_STR_LEN, envPtr);
return TCL_OK;
@@ -3553,8 +3559,7 @@ TclCompileSwitchCmd(interp, parsePtr, envPtr)
* First, we push the value we're matching against on the stack.
*/
- TclCompileTokens(interp, valueTokenPtr+1, valueTokenPtr->numComponents,
- envPtr);
+ CompileTokens(envPtr, valueTokenPtr, interp);
/*
* Generate a test for each arm.
@@ -4167,8 +4172,7 @@ PushVarName(interp, varTokenPtr, envPtr, flags, localIndexPtr,
* The var name isn't simple: compile and push it.
*/
- TclCompileTokens(interp, varTokenPtr+1, varTokenPtr->numComponents,
- envPtr);
+ CompileTokens(envPtr, varTokenPtr, interp);
}
if (removedParen) {