summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 9b33b41..6ec2265 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.156 2009/09/04 23:14:32 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.157 2009/09/11 20:13:27 dgp Exp $
*/
#include "tclInt.h"
@@ -3874,14 +3874,9 @@ TclCompileSubstCmd(
int numOpts = numArgs - 1;
int objc, flags = TCL_SUBST_ALL;
Tcl_Obj **objv/*, *toSubst = NULL*/;
- Tcl_Parse parse;
- Tcl_InterpState state = NULL;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
- int breakOffset = 0, count = 0, code = TCL_ERROR;
- Tcl_Token *endTokenPtr, *tokenPtr;
+ int code = TCL_ERROR;
DefineLineInformation; /* TIP #280 */
- int bline = mapPtr->loc[eclIndex].line[numArgs];
- SetLineInformation(numArgs);
if (numArgs == 0) {
return TCL_ERROR;
@@ -3925,8 +3920,29 @@ TclCompileSubstCmd(
return TCL_ERROR;
}
- TclSubstParse(interp, /*toSubst,*/ wordTokenPtr[1].start,
- wordTokenPtr[1].size, flags, &parse, &state);
+ SetLineInformation(numArgs);
+ TclSubstCompile(interp, wordTokenPtr[1].start, wordTokenPtr[1].size, flags,
+ mapPtr->loc[eclIndex].line[numArgs], envPtr);
+
+/* TclDecrRefCount(toSubst);*/
+ return TCL_OK;
+}
+
+void
+TclSubstCompile(
+ Tcl_Interp *interp,
+ const char *bytes,
+ int numBytes,
+ int flags,
+ int line,
+ CompileEnv *envPtr)
+{
+ Tcl_Token *endTokenPtr, *tokenPtr;
+ int breakOffset = 0, count = 0, bline = line;
+ Tcl_Parse parse;
+ Tcl_InterpState state = NULL;
+
+ TclSubstParse(interp, bytes, numBytes, flags, &parse, &state);
for (tokenPtr = parse.tokenPtr, endTokenPtr = tokenPtr + parse.numTokens;
tokenPtr < endTokenPtr; tokenPtr = TokenAfter(tokenPtr)) {
@@ -4101,7 +4117,6 @@ TclCompileSubstCmd(
}
Tcl_FreeParse(&parse);
-/* TclDecrRefCount(toSubst);*/
if (state != NULL) {
Tcl_RestoreInterpState(interp, state);
@@ -4113,8 +4128,6 @@ TclCompileSubstCmd(
TclUpdateInstInt4AtPc(INST_JUMP4, CurrentOffset(envPtr) - breakOffset,
envPtr->codeStart + breakOffset);
}
-
- return TCL_OK;
}
/*