for (c = a; c <= b; c++)
{
- cc = pg_wc_tolower(c);
+ cc = regc_wc_tolower(c);
if (cc != c &&
(before(cc, a) || before(b, cc)))
{
}
addchr(cv, cc);
}
- cc = pg_wc_toupper(c);
+ cc = regc_wc_toupper(c);
if (cc != c &&
(before(cc, a) || before(b, cc)))
{
* Must include case counterparts if "cases" is true.
*
* The returned cvec might be either a transient cvec gotten from getcvec(),
- * or a permanently cached one from pg_ctype_get_cache(). This is okay
+ * or a permanently cached one from regc_ctype_get_cache(). This is okay
* because callers are not supposed to explicitly free the result either way.
*/
static struct cvec *
/*
* Now compute the character class contents. For classes that are based
* on the behavior of a <wctype.h> or <ctype.h> function, we use
- * pg_ctype_get_cache so that we can cache the results. Other classes
+ * regc_ctype_get_cache so that we can cache the results. Other classes
* have definitions that are hard-wired here, and for those we just
* construct a transient cvec on the fly.
*
switch (cclasscode)
{
case CC_PRINT:
- cv = pg_ctype_get_cache(pg_wc_isprint, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isprint, cclasscode);
break;
case CC_ALNUM:
- cv = pg_ctype_get_cache(pg_wc_isalnum, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isalnum, cclasscode);
break;
case CC_ALPHA:
- cv = pg_ctype_get_cache(pg_wc_isalpha, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isalpha, cclasscode);
break;
case CC_WORD:
- cv = pg_ctype_get_cache(pg_wc_isword, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isword, cclasscode);
break;
case CC_ASCII:
/* hard-wired meaning */
addrange(cv, 0x7f, 0x9f);
break;
case CC_DIGIT:
- cv = pg_ctype_get_cache(pg_wc_isdigit, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isdigit, cclasscode);
break;
case CC_PUNCT:
- cv = pg_ctype_get_cache(pg_wc_ispunct, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_ispunct, cclasscode);
break;
case CC_XDIGIT:
}
break;
case CC_SPACE:
- cv = pg_ctype_get_cache(pg_wc_isspace, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isspace, cclasscode);
break;
case CC_LOWER:
- cv = pg_ctype_get_cache(pg_wc_islower, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_islower, cclasscode);
break;
case CC_UPPER:
- cv = pg_ctype_get_cache(pg_wc_isupper, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isupper, cclasscode);
break;
case CC_GRAPH:
- cv = pg_ctype_get_cache(pg_wc_isgraph, cclasscode);
+ cv = regc_ctype_get_cache(regc_wc_isgraph, cclasscode);
break;
}
* Note: we should not see requests to consider cclasses that are not
* treated as locale-specific by cclasscvec(), above.
*/
- if (cm->classbits[CC_PRINT] && pg_wc_isprint(c))
+ if (cm->classbits[CC_PRINT] && regc_wc_isprint(c))
colnum |= cm->classbits[CC_PRINT];
- if (cm->classbits[CC_ALNUM] && pg_wc_isalnum(c))
+ if (cm->classbits[CC_ALNUM] && regc_wc_isalnum(c))
colnum |= cm->classbits[CC_ALNUM];
- if (cm->classbits[CC_ALPHA] && pg_wc_isalpha(c))
+ if (cm->classbits[CC_ALPHA] && regc_wc_isalpha(c))
colnum |= cm->classbits[CC_ALPHA];
- if (cm->classbits[CC_WORD] && pg_wc_isword(c))
+ if (cm->classbits[CC_WORD] && regc_wc_isword(c))
colnum |= cm->classbits[CC_WORD];
assert(cm->classbits[CC_ASCII] == 0);
assert(cm->classbits[CC_BLANK] == 0);
assert(cm->classbits[CC_CNTRL] == 0);
- if (cm->classbits[CC_DIGIT] && pg_wc_isdigit(c))
+ if (cm->classbits[CC_DIGIT] && regc_wc_isdigit(c))
colnum |= cm->classbits[CC_DIGIT];
- if (cm->classbits[CC_PUNCT] && pg_wc_ispunct(c))
+ if (cm->classbits[CC_PUNCT] && regc_wc_ispunct(c))
colnum |= cm->classbits[CC_PUNCT];
assert(cm->classbits[CC_XDIGIT] == 0);
- if (cm->classbits[CC_SPACE] && pg_wc_isspace(c))
+ if (cm->classbits[CC_SPACE] && regc_wc_isspace(c))
colnum |= cm->classbits[CC_SPACE];
- if (cm->classbits[CC_LOWER] && pg_wc_islower(c))
+ if (cm->classbits[CC_LOWER] && regc_wc_islower(c))
colnum |= cm->classbits[CC_LOWER];
- if (cm->classbits[CC_UPPER] && pg_wc_isupper(c))
+ if (cm->classbits[CC_UPPER] && regc_wc_isupper(c))
colnum |= cm->classbits[CC_UPPER];
- if (cm->classbits[CC_GRAPH] && pg_wc_isgraph(c))
+ if (cm->classbits[CC_GRAPH] && regc_wc_isgraph(c))
colnum |= cm->classbits[CC_GRAPH];
return colnum;
chr lc,
uc;
- lc = pg_wc_tolower(c);
- uc = pg_wc_toupper(c);
+ lc = regc_wc_tolower(c);
+ uc = regc_wc_toupper(c);
cv = getcvec(v, 2, 0);
addchr(cv, lc);
{
for (; len > 0; len--, x++, y++)
{
- if ((*x != *y) && (pg_wc_tolower(*x) != pg_wc_tolower(*y)))
+ if ((*x != *y) && (regc_wc_tolower(*x) != regc_wc_tolower(*y)))
return 1;
}
return 0;
}
static int
-pg_wc_isdigit(pg_wchar c)
+regc_wc_isdigit(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_isalpha(pg_wchar c)
+regc_wc_isalpha(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_isalnum(pg_wchar c)
+regc_wc_isalnum(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_isword(pg_wchar c)
+regc_wc_isword(pg_wchar c)
{
/* We define word characters as alnum class plus underscore */
if (c == CHR('_'))
return 1;
- return pg_wc_isalnum(c);
+ return regc_wc_isalnum(c);
}
static int
-pg_wc_isupper(pg_wchar c)
+regc_wc_isupper(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_islower(pg_wchar c)
+regc_wc_islower(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_isgraph(pg_wchar c)
+regc_wc_isgraph(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_isprint(pg_wchar c)
+regc_wc_isprint(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_ispunct(pg_wchar c)
+regc_wc_ispunct(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static int
-pg_wc_isspace(pg_wchar c)
+regc_wc_isspace(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
return (c <= (pg_wchar) 127 &&
}
static pg_wchar
-pg_wc_toupper(pg_wchar c)
+regc_wc_toupper(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
{
}
static pg_wchar
-pg_wc_tolower(pg_wchar c)
+regc_wc_tolower(pg_wchar c)
{
if (pg_regex_locale->ctype_is_c)
{
* the main regex code expects us to return a failure indication instead.
*/
-typedef int (*pg_wc_probefunc) (pg_wchar c);
+typedef int (*regc_wc_probefunc) (pg_wchar c);
typedef struct pg_ctype_cache
{
- pg_wc_probefunc probefunc; /* pg_wc_isalpha or a sibling */
+ regc_wc_probefunc probefunc; /* regc_wc_isalpha or a sibling */
pg_locale_t locale; /* locale this entry is for */
struct cvec cv; /* cache entry contents */
struct pg_ctype_cache *next; /* chain link */
}
/*
- * Given a probe function (e.g., pg_wc_isalpha) get a struct cvec for all
+ * Given a probe function (e.g., regc_wc_isalpha) get a struct cvec for all
* chrs satisfying the probe function. The active collation is the one
* previously set by pg_set_regex_collation. Return NULL if out of memory.
*
* Note that the result must not be freed or modified by caller.
*/
static struct cvec *
-pg_ctype_get_cache(pg_wc_probefunc probefunc, int cclasscode)
+regc_ctype_get_cache(regc_wc_probefunc probefunc, int cclasscode)
{
pg_ctype_cache *pcc;
pg_wchar max_chr;
static void freecvec(struct cvec *cv);
/* === regc_pg_locale.c === */
-static int pg_wc_isdigit(pg_wchar c);
-static int pg_wc_isalpha(pg_wchar c);
-static int pg_wc_isalnum(pg_wchar c);
-static int pg_wc_isword(pg_wchar c);
-static int pg_wc_isupper(pg_wchar c);
-static int pg_wc_islower(pg_wchar c);
-static int pg_wc_isgraph(pg_wchar c);
-static int pg_wc_isprint(pg_wchar c);
-static int pg_wc_ispunct(pg_wchar c);
-static int pg_wc_isspace(pg_wchar c);
-static pg_wchar pg_wc_toupper(pg_wchar c);
-static pg_wchar pg_wc_tolower(pg_wchar c);
+static int regc_wc_isdigit(pg_wchar c);
+static int regc_wc_isalpha(pg_wchar c);
+static int regc_wc_isalnum(pg_wchar c);
+static int regc_wc_isword(pg_wchar c);
+static int regc_wc_isupper(pg_wchar c);
+static int regc_wc_islower(pg_wchar c);
+static int regc_wc_isgraph(pg_wchar c);
+static int regc_wc_isprint(pg_wchar c);
+static int regc_wc_ispunct(pg_wchar c);
+static int regc_wc_isspace(pg_wchar c);
+static pg_wchar regc_wc_toupper(pg_wchar c);
+static pg_wchar regc_wc_tolower(pg_wchar c);
/* === regc_locale.c === */
static chr element(struct vars *v, const chr *startp, const chr *endp);
#define MAX_SIMPLE_CHR 0x7FF /* suitable value for Unicode */
/* functions operating on chr */
-#define iscalnum(x) pg_wc_isalnum(x)
-#define iscalpha(x) pg_wc_isalpha(x)
-#define iscdigit(x) pg_wc_isdigit(x)
-#define iscspace(x) pg_wc_isspace(x)
+#define iscalnum(x) regc_wc_isalnum(x)
+#define iscalpha(x) regc_wc_isalpha(x)
+#define iscdigit(x) regc_wc_isdigit(x)
+#define iscspace(x) regc_wc_isspace(x)
/* and pick up the standard header */
#include "regex.h"