summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-12-29 16:59:15 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-12-29 16:59:15 (GMT)
commit348916814c5f0e9bac693424abe20aefe1150869 (patch)
treead0cf3ea2e58d4bf1a264a348efdf6ae6e820c2c /generic
parent7ccc50d8b67a7e642928d04bfb66ec3ee4052fbb (diff)
downloadtcl-348916814c5f0e9bac693424abe20aefe1150869.zip
tcl-348916814c5f0e9bac693424abe20aefe1150869.tar.gz
tcl-348916814c5f0e9bac693424abe20aefe1150869.tar.bz2
use the new instruction
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmdsSZ.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 110476e..649a76a 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -765,12 +765,25 @@ TclCompileStringReplaceCmd(
} else {
/*
- * Too complicated to optimize, but we know the number of arguments is
- * correct so we can issue a call of the "standard" implementation.
+ * Need to process indices at runtime. This could be because the
+ * indices are not constants, or because we need to resolve them to
+ * absolute indices to work out if a replacement is going to happen.
+ * In any case, to runtime it is.
*/
genericReplace:
- return TclCompileBasicMin0ArgCmd(interp, parsePtr, cmdPtr, envPtr);
+ CompileWord(envPtr, valueTokenPtr, interp, 1);
+ tokenPtr = TokenAfter(valueTokenPtr);
+ CompileWord(envPtr, tokenPtr, interp, 2);
+ tokenPtr = TokenAfter(tokenPtr);
+ CompileWord(envPtr, tokenPtr, interp, 3);
+ if (replacementTokenPtr != NULL) {
+ CompileWord(envPtr, replacementTokenPtr, interp, 4);
+ } else {
+ PUSH( "");
+ }
+ OP( STR_REPLACE);
+ return TCL_OK;
}
}