diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdIL.c | 8 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 58 |
2 files changed, 44 insertions, 22 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 6db0c53..b121c67 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.12 1999/04/16 00:46:43 stanton Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.13 1999/06/17 19:31:50 stanton Exp $ */ #include "tclInt.h" @@ -2372,9 +2372,9 @@ Tcl_LsearchObjCmd(clientData, interp, objc, objv) index = -1; for (i = 0; i < listc; i++) { match = 0; - bytes = Tcl_GetStringFromObj(listv[i], &elemLen); switch ((enum options) mode) { case LSEARCH_EXACT: { + bytes = Tcl_GetStringFromObj(listv[i], &elemLen); if (length == elemLen) { match = (memcmp(bytes, patternBytes, (size_t) length) == 0); @@ -2382,11 +2382,11 @@ Tcl_LsearchObjCmd(clientData, interp, objc, objv) break; } case LSEARCH_GLOB: { - match = Tcl_StringMatch(bytes, patternBytes); + match = Tcl_StringMatch(Tcl_GetString(listv[i]), patternBytes); break; } case LSEARCH_REGEXP: { - match = TclRegExpMatchObj(interp, bytes, patObj); + match = Tcl_RegExpMatchObj(interp, listv[i], patObj); if (match < 0) { return TCL_ERROR; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 3746cfc..36c75b2 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.15 1999/06/15 01:16:22 hershey Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.16 1999/06/17 19:31:50 stanton Exp $ */ #include "tclInt.h" @@ -144,7 +144,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) indices = 0; about = 0; - cflags = REG_ADVANCED; + cflags = TCL_REG_ADVANCED; eflags = 0; for (i = 1; i < objc; i++) { @@ -165,7 +165,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) break; } case REGEXP_NOCASE: { - cflags |= REG_ICASE; + cflags |= TCL_REG_NOCASE; break; } case REGEXP_ABOUT: { @@ -173,19 +173,19 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) break; } case REGEXP_EXPANDED: { - cflags |= REG_EXPANDED; + cflags |= TCL_REG_EXPANDED; break; } case REGEXP_LINE: { - cflags |= REG_NEWLINE; + cflags |= TCL_REG_NEWLINE; break; } case REGEXP_LINESTOP: { - cflags |= REG_NLSTOP; + cflags |= TCL_REG_NLSTOP; break; } case REGEXP_LINEANCHOR: { - cflags |= REG_NLANCH; + cflags |= TCL_REG_NLANCH; break; } case REGEXP_LAST: { @@ -217,7 +217,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) return TCL_OK; } - match = Tcl_RegExpMatchObj(interp, regExpr, objPtr, 0 /* offset */, + match = Tcl_RegExpExecObj(interp, regExpr, objPtr, 0 /* offset */, objc-2 /* nmatches */, eflags); if (match < 0) { @@ -330,13 +330,17 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) char *subspec; static char *options[] = { - "-all", "-nocase", "--", NULL + "-all", "-nocase", "-expanded", + "-line", "-linestop", "-lineanchor", + "--", NULL }; enum options { - REGSUB_ALL, REGSUB_NOCASE, REGSUB_LAST + REGSUB_ALL, REGSUB_NOCASE, REGSUB_EXPANDED, + REGSUB_LINE, REGSUB_LINESTOP, REGSUB_LINEANCHOR, + REGSUB_LAST }; - cflags = REG_ADVANCED; + cflags = TCL_REG_ADVANCED; all = 0; for (i = 1; i < objc; i++) { @@ -357,7 +361,23 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) break; } case REGSUB_NOCASE: { - cflags |= REG_ICASE; + cflags |= TCL_REG_NOCASE; + break; + } + case REGSUB_EXPANDED: { + cflags |= TCL_REG_EXPANDED; + break; + } + case REGSUB_LINE: { + cflags |= TCL_REG_NEWLINE; + break; + } + case REGSUB_LINESTOP: { + cflags |= TCL_REG_NLSTOP; + break; + } + case REGSUB_LINEANCHOR: { + cflags |= TCL_REG_NLANCH; break; } case REGSUB_LAST: { @@ -410,8 +430,8 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) * so that "^" won't match. */ - match = Tcl_RegExpMatchObj(interp, regExpr, objPtr, offset, - 10 /* matches */, ((offset > 0) ? REG_NOTBOL : 0)); + match = Tcl_RegExpExecObj(interp, regExpr, objPtr, offset, + 10 /* matches */, ((offset > 0) ? TCL_REG_NOTBOL : 0)); if (match < 0) { result = TCL_ERROR; @@ -2112,6 +2132,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) { int i, j, index, mode, matched, result; char *string, *pattern; + Tcl_Obj *stringObj; static char *options[] = { "-exact", "-glob", "-regexp", "--", NULL @@ -2143,7 +2164,7 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) return TCL_ERROR; } - string = Tcl_GetString(objv[i]); + stringObj = objv[i]; objc -= i + 1; objv += i + 1; @@ -2182,13 +2203,14 @@ Tcl_SwitchObjCmd(dummy, interp, objc, objv) } else { switch (mode) { case OPT_EXACT: - matched = (strcmp(string, pattern) == 0); + matched = (strcmp(Tcl_GetString(stringObj), pattern) == 0); break; case OPT_GLOB: - matched = Tcl_StringMatch(string, pattern); + matched = Tcl_StringMatch(Tcl_GetString(stringObj), + pattern); break; case OPT_REGEXP: - matched = TclRegExpMatchObj(interp, string, objv[i]); + matched = Tcl_RegExpMatchObj(interp, stringObj, objv[i]); if (matched < 0) { return TCL_ERROR; } |