1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Regex library is switched to use new ctype tools

to allow usage of many character sets at a time.


include/m_ctype.h:
  Added condition to simplify migrating from old ctype
  Added new style toupper, tolower which accepts charset in first argument
regex/debug.c:
  Added charset argument
regex/debug.ih:
  added charset argument
regex/engine.c:
  added charset argument
regex/engine.ih:
  added charset arguent
regex/main.c:
  added charset argument
regex/regcomp.c:
  added CHARSET_INFO field
regex/regcomp.ih:
  Added charset argument
regex/regex.h:
  Added #include <m_ctype.h> for CHARSET_INFO
  Added charset argument for regcomp()
regex/regex2.h:
  New charset argument for ISWORD()
regex/regexec.c:
  New charset argument
regex/reginit.c:
  Move to new style ctype. 
  However still needs fixes:
    instead of single static cclass variable,
    each charset must have it's own variable.
sql/item_cmpfunc.cc:
  Pass charset field into regcomp()
  This will be fixed tommorow to use String->charset
    instead of default_charset_info
This commit is contained in:
unknown
2002-03-06 20:04:13 +04:00
parent 325c22a784
commit 654db69b82
13 changed files with 126 additions and 100 deletions

View File

@ -45,7 +45,7 @@ FILE *d;
if (g->nplus > 0)
fprintf(d, ", nplus %ld", (long)g->nplus);
fprintf(d, "\n");
s_print(g, d);
s_print(r->charset, g, d);
for (i = 0; i < g->ncategories; i++) {
nincat[i] = 0;
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
@ -58,7 +58,7 @@ FILE *d;
for (c = CHAR_MIN; c <= CHAR_MAX; c++)
if (g->categories[c] == i)
break;
fprintf(d, ", %d=%s", i, regchar(c,buf));
fprintf(d, ", %d=%s", i, regchar(r->charset,c,buf));
}
fprintf(d, "\n");
for (i = 1; i < g->ncategories; i++)
@ -68,14 +68,14 @@ FILE *d;
for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
if (c <= CHAR_MAX && g->categories[c] == i) {
if (last < 0) {
fprintf(d, "%s", regchar(c,buf));
fprintf(d, "%s", regchar(r->charset,c,buf));
last = c;
}
} else {
if (last >= 0) {
if (last != c-1)
fprintf(d, "-%s",
regchar(c-1,buf));
regchar(r->charset,c-1,buf));
last = -1;
}
}
@ -88,7 +88,8 @@ FILE *d;
== static void s_print(register struct re_guts *g, FILE *d);
*/
static void
s_print(g, d)
s_print(charset, g, d)
CHARSET_INFO *charset;
register struct re_guts *g;
FILE *d;
{
@ -127,7 +128,7 @@ FILE *d;
if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
fprintf(d, "\\%c", (char)opnd);
else
fprintf(d, "%s", regchar((char)opnd,buf));
fprintf(d, "%s", regchar(charset,(char)opnd,buf));
break;
case OBOL:
fprintf(d, "^");
@ -151,14 +152,14 @@ FILE *d;
for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
if (CHIN(cs, i) && i < g->csetsize) {
if (last < 0) {
fprintf(d, "%s", regchar(i,buf));
fprintf(d, "%s", regchar(charset,i,buf));
last = i;
}
} else {
if (last >= 0) {
if (last != i-1)
fprintf(d, "-%s",
regchar(i-1,buf));
regchar(charset,i-1,buf));
last = -1;
}
}
@ -230,12 +231,13 @@ FILE *d;
== static char *regchar(int ch);
*/
static char * /* -> representation */
regchar(ch,buf)
regchar(charset,ch,buf)
CHARSET_INFO *charset;
int ch;
char *buf;
{
if (isprint(ch) || ch == ' ')
if (my_isprint(charset,ch) || ch == ' ')
sprintf(buf, "%c", ch);
else
sprintf(buf, "\\%o", ch);