summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2005-10-10 20:27:59 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2005-10-10 20:27:59 (GMT)
commit23cc8da10b48873d4ffa43732da81094aa5637b8 (patch)
tree9d47b824e1e73520f9fc52d4f933a69ba4de397d
parent0dce4fa5b68010813737f31033012ad6d4cb5bc3 (diff)
downloadtcl-23cc8da10b48873d4ffa43732da81094aa5637b8.zip
tcl-23cc8da10b48873d4ffa43732da81094aa5637b8.tar.gz
tcl-23cc8da10b48873d4ffa43732da81094aa5637b8.tar.bz2
* generic/tclCompCmds.c: New convenience macro CompileTokens().
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclCompCmds.c36
2 files changed, 26 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 4577bd6..04298cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-10-10 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclCompCmds.c: New convenience macro CompileTokens().
+
2005-10-10 Don Porter <dgp@users.sourceforge.net>
* generic/tclExecute.c: Corrections to the NO_WIDE_TYPE build. Also
@@ -14,7 +18,7 @@
2005-10-10 Miguel Sofer <msofer@users.sf.net>
- * generic/tclExecute.c: fixing errors in last commit. (Two
+ * generic/tclExecute.c: Fixing errors in last commit. (Two
commits, the second removes wrong comment).
2005-10-09 Miguel Sofer <msofer@users.sf.net>
@@ -22,7 +26,7 @@
* generic/tclBasic.c:
* generic/tclExecute.c:
* generic/tclStrToD.c:
- * generic/tclStringObj.c: initialise variables to avoid compiler
+ * generic/tclStringObj.c: Initialise variables to avoid compiler
warnings ([Bug 1320818] among others).
2005-10-08 Don Porter <dgp@users.sourceforge.net>
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) {