summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-09-30 03:00:06 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-09-30 03:00:06 (GMT)
commit11fdcc3fedcd680e93a93d28bf862d388ada3f9d (patch)
tree3137d2b83c6acf8dbe087cfe4337fd40a986670a /generic/tclExecute.c
parent77befed765bd876b11882607e8bdf4eb976df127 (diff)
downloadtcl-11fdcc3fedcd680e93a93d28bf862d388ada3f9d.zip
tcl-11fdcc3fedcd680e93a93d28bf862d388ada3f9d.tar.gz
tcl-11fdcc3fedcd680e93a93d28bf862d388ada3f9d.tar.bz2
First attempt at [string trim] compilation.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 0ca393b..b4785bf 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -5252,6 +5252,39 @@ TEBCresume(
objResultPtr = TCONST(match);
NEXT_INST_F(0, 2, 1);
+ {
+ const char *string1, *string2;
+
+ case INST_STRTRIM_LEFT:
+ valuePtr = OBJ_UNDER_TOS; /* String */
+ value2Ptr = OBJ_AT_TOS; /* TrimSet */
+ string2 = TclGetStringFromObj(value2Ptr, &length2);
+ string1 = TclGetStringFromObj(valuePtr, &length);
+ match = TclTrimLeft(string1, length, string2, length2);
+ if (match == 0) {
+ TRACE_WITH_OBJ(("\"%.30s\" \"%.30s\" => ", valuePtr, value2Ptr),
+ valuePtr);
+ NEXT_INST_F(1, 1, 0);
+ } else {
+ objResultPtr = Tcl_NewStringObj(string1+match, length-match);
+ TRACE_WITH_OBJ(("\"%.30s\" \"%.30s\" => ", valuePtr, value2Ptr),
+ objResultPtr);
+ NEXT_INST_F(1, 2, 1);
+ }
+ case INST_STRTRIM_RIGHT:
+ valuePtr = OBJ_UNDER_TOS; /* String */
+ value2Ptr = OBJ_AT_TOS; /* TrimSet */
+ string2 = TclGetStringFromObj(value2Ptr, &length2);
+ string1 = TclGetStringFromObj(valuePtr, &length);
+ match = TclTrimRight(string1, length, string2, length2);
+ if (match == 0) {
+ NEXT_INST_F(1, 1, 0);
+ } else {
+ objResultPtr = Tcl_NewStringObj(string1, length-match);
+ NEXT_INST_F(1, 2, 1);
+ }
+ }
+
case INST_REGEXP:
cflags = TclGetInt1AtPtr(pc+1); /* RE compile flages like NOCASE */
valuePtr = OBJ_AT_TOS; /* String */