summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmdsSZ.c
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2014-08-02 13:04:16 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2014-08-02 13:04:16 (GMT)
commit199f805233d9af1ccfd843748bffd339b275bbab (patch)
tree49eec2c0a52f05ac8d8fe1930266724473d74651 /generic/tclCompCmdsSZ.c
parent6f329a1932ac170449caed077ca7f5596709433c (diff)
downloadtcl-199f805233d9af1ccfd843748bffd339b275bbab.zip
tcl-199f805233d9af1ccfd843748bffd339b275bbab.tar.gz
tcl-199f805233d9af1ccfd843748bffd339b275bbab.tar.bz2
TIP 429 Implementation: [string cat]
Diffstat (limited to 'generic/tclCompCmdsSZ.c')
-rw-r--r--generic/tclCompCmdsSZ.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index e6ec0a6..8ade6a5 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -269,6 +269,39 @@ TclCompileSetCmd(
*/
int
+TclCompileStringCatCmd(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tcl_Parse *parsePtr, /* Points to a parse structure for the command
+ * created by Tcl_ParseCommand. */
+ Command *cmdPtr, /* Points to defintion of command being
+ * compiled. */
+ CompileEnv *envPtr) /* Holds resulting instructions. */
+{
+ int numWords = parsePtr->numWords;
+ Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
+ DefineLineInformation; /* TIP #280 */
+
+ if (numWords>=2) {
+ int i;
+
+ for (i = 1; i < numWords; i++) {
+ CompileWord(envPtr, wordTokenPtr, interp, i);
+ wordTokenPtr = TokenAfter(wordTokenPtr);
+ }
+ while (numWords > 256) {
+ TclEmitInstInt1(INST_STR_CONCAT1, 255, envPtr);
+ numWords -= 254; /* concat pushes 1 obj, the result */
+ }
+ if (numWords > 2) {
+ TclEmitInstInt1(INST_STR_CONCAT1, numWords - 1, envPtr);
+ }
+ } else {
+ PushStringLiteral(envPtr, "");
+ }
+ return TCL_OK;
+}
+
+int
TclCompileStringCmpCmd(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command