diff options
author | dgp <dgp@noemail.net> | 2005-05-03 18:07:33 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2005-05-03 18:07:33 (GMT) |
commit | 75342426b3d9fbf5be1a5a0ce82d15e8241cea7b (patch) | |
tree | b6fcb467e2e876bcc285aba2c7258bb0988cbe54 /generic/tclRegexp.c | |
parent | aa0ad456e7885aad90c04bd167e5a4c13ff84902 (diff) | |
download | tcl-75342426b3d9fbf5be1a5a0ce82d15e8241cea7b.zip tcl-75342426b3d9fbf5be1a5a0ce82d15e8241cea7b.tar.gz tcl-75342426b3d9fbf5be1a5a0ce82d15e8241cea7b.tar.bz2 |
* doc/DString.3: Eliminated use of identifier "string" in Tcl's
* doc/Environment.3: public C API to avoid conflict/confusion with
* doc/Eval.3: the std::string of C++.
* doc/ExprLong.3, doc/ExprLongObj.3, doc/GetInt.3, doc/GetOpnFl.3:
* doc/ParseCmd.3, doc/RegExp.3, doc/SetResult.3, doc/StrMatch.3:
* doc/Utf.3, generic/tcl.decls, generic/tclBasic.c, generic/tclEnv.c:
* generic/tclGet.c, generic/tclParse.c, generic/tclParseExpr.c:
* generic/tclRegexp.c, generic/tclResult.c, generic/tclUtf.c:
* generic/tclUtil.c, unix/tclUnixChan.c:
* generic/tclDecls.h: `make genstubs`
FossilOrigin-Name: 83aa957ebe8d942b417ec080d6731e06e930ba73
Diffstat (limited to 'generic/tclRegexp.c')
-rw-r--r-- | generic/tclRegexp.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 1909ed6..25c30dc 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclRegexp.c,v 1.17 2004/09/29 22:23:25 dkf Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.18 2005/05/03 18:08:19 dgp Exp $ */ #include "tclInt.h" @@ -137,13 +137,13 @@ Tcl_ObjType tclRegexpType = { */ Tcl_RegExp -Tcl_RegExpCompile(interp, string) +Tcl_RegExpCompile(interp, pattern) Tcl_Interp *interp; /* For use in error reporting and * to access the interp regexp cache. */ - CONST char *string; /* String for which to produce + CONST char *pattern; /* String for which to produce * compiled regular expression. */ { - return (Tcl_RegExp) CompileRegexp(interp, string, (int) strlen(string), + return (Tcl_RegExp) CompileRegexp(interp, pattern, (int) strlen(pattern), REG_ADVANCED); } @@ -169,13 +169,13 @@ Tcl_RegExpCompile(interp, string) */ int -Tcl_RegExpExec(interp, re, string, start) +Tcl_RegExpExec(interp, re, text, start) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ Tcl_RegExp re; /* Compiled regular expression; must have * been returned by previous call to * Tcl_GetRegExpFromObj. */ - CONST char *string; /* String against which to match re. */ - CONST char *start; /* If string is part of a larger string, + CONST char *text; /* Text against which to match re. */ + CONST char *start; /* If text is part of a larger string, * this identifies beginning of larger * string, so that "^" won't match. */ { @@ -189,7 +189,7 @@ Tcl_RegExpExec(interp, re, string, start) * then we need to tell the regexp engine not to match "^". */ - if (string > start) { + if (text > start) { flags = REG_NOTBOL; } else { flags = 0; @@ -199,7 +199,7 @@ Tcl_RegExpExec(interp, re, string, start) * Remember the string for use by Tcl_RegExpRange(). */ - regexp->string = string; + regexp->string = text; regexp->objPtr = NULL; /* @@ -207,7 +207,7 @@ Tcl_RegExpExec(interp, re, string, start) */ Tcl_DStringInit(&ds); - ustr = Tcl_UtfToUniCharDString(string, -1, &ds); + ustr = Tcl_UtfToUniCharDString(text, -1, &ds); numChars = Tcl_DStringLength(&ds) / sizeof(Tcl_UniChar); result = RegExpExecUniChar(interp, re, ustr, numChars, -1 /* nmatches */, flags); @@ -385,7 +385,7 @@ TclRegExpRangeUniChar(re, index, startPtr, endPtr) * Results: * If an error occurs during the matching operation then -1 * is returned and the interp's result contains an error message. - * Otherwise the return value is 1 if "string" matches "pattern" + * Otherwise the return value is 1 if "text" matches "pattern" * and 0 otherwise. * * Side effects: @@ -395,11 +395,10 @@ TclRegExpRangeUniChar(re, index, startPtr, endPtr) */ int -Tcl_RegExpMatch(interp, string, pattern) +Tcl_RegExpMatch(interp, text, pattern) Tcl_Interp *interp; /* Used for error reporting. May be NULL. */ - CONST char *string; /* String. */ - CONST char *pattern; /* Regular expression to match against - * string. */ + CONST char *text; /* Text to search for pattern matches. */ + CONST char *pattern; /* Regular expression to match against text. */ { Tcl_RegExp re; @@ -407,7 +406,7 @@ Tcl_RegExpMatch(interp, string, pattern) if (re == NULL) { return -1; } - return Tcl_RegExpExec(interp, re, string, string); + return Tcl_RegExpExec(interp, re, text, text); } /* @@ -430,12 +429,12 @@ Tcl_RegExpMatch(interp, string, pattern) */ int -Tcl_RegExpExecObj(interp, re, objPtr, offset, nmatches, flags) +Tcl_RegExpExecObj(interp, re, textObj, offset, nmatches, flags) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ Tcl_RegExp re; /* Compiled regular expression; must have * been returned by previous call to * Tcl_GetRegExpFromObj. */ - Tcl_Obj *objPtr; /* String against which to match re. */ + Tcl_Obj *textObj; /* Text against which to match re. */ int offset; /* Character index that marks where matching * should begin. */ int nmatches; /* How many subexpression matches (counting @@ -452,9 +451,9 @@ Tcl_RegExpExecObj(interp, re, objPtr, offset, nmatches, flags) */ regexpPtr->string = NULL; - regexpPtr->objPtr = objPtr; + regexpPtr->objPtr = textObj; - udata = Tcl_GetUnicodeFromObj(objPtr, &length); + udata = Tcl_GetUnicodeFromObj(textObj, &length); if (offset > length) { offset = length; @@ -475,7 +474,7 @@ Tcl_RegExpExecObj(interp, re, objPtr, offset, nmatches, flags) * Results: * If an error occurs during the matching operation then -1 * is returned and the interp's result contains an error message. - * Otherwise the return value is 1 if "string" matches "pattern" + * Otherwise the return value is 1 if "text" matches "pattern" * and 0 otherwise. * * Side effects: @@ -485,9 +484,9 @@ Tcl_RegExpExecObj(interp, re, objPtr, offset, nmatches, flags) */ int -Tcl_RegExpMatchObj(interp, stringObj, patternObj) +Tcl_RegExpMatchObj(interp, textObj, patternObj) Tcl_Interp *interp; /* Used for error reporting. May be NULL. */ - Tcl_Obj *stringObj; /* Object containing the String to search. */ + Tcl_Obj *textObj; /* Object containing the String to search. */ Tcl_Obj *patternObj; /* Regular expression to match against * string. */ { @@ -498,7 +497,7 @@ Tcl_RegExpMatchObj(interp, stringObj, patternObj) if (re == NULL) { return -1; } - return Tcl_RegExpExecObj(interp, re, stringObj, 0 /* offset */, + return Tcl_RegExpExecObj(interp, re, textObj, 0 /* offset */, 0 /* nmatches */, 0 /* flags */); } |