#include "regex/regguts.h"#include "regex/regexport.h"
Go to the source code of this file.
Functions | |
| static void | scancolormap (struct colormap *cm, int co, union tree *t, int level, chr partial, pg_wchar **chars, int *chars_len) |
| int | pg_reg_getnumstates (const regex_t *regex) |
| int | pg_reg_getinitialstate (const regex_t *regex) |
| int | pg_reg_getfinalstate (const regex_t *regex) |
| int | pg_reg_getnumoutarcs (const regex_t *regex, int st) |
| void | pg_reg_getoutarcs (const regex_t *regex, int st, regex_arc_t *arcs, int arcs_len) |
| int | pg_reg_getnumcolors (const regex_t *regex) |
| int | pg_reg_colorisbegin (const regex_t *regex, int co) |
| int | pg_reg_colorisend (const regex_t *regex, int co) |
| int | pg_reg_getnumcharacters (const regex_t *regex, int co) |
| void | pg_reg_getcharacters (const regex_t *regex, int co, pg_wchar *chars, int chars_len) |
| int pg_reg_colorisbegin | ( | const regex_t * | regex, | |
| int | co | |||
| ) |
Definition at line 155 of file regexport.c.
References assert, cnfa::bos, NULL, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
Referenced by addKey().
| int pg_reg_colorisend | ( | const regex_t * | regex, | |
| int | co | |||
| ) |
Definition at line 172 of file regexport.c.
References assert, cnfa::eos, NULL, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
Referenced by addKey().
Definition at line 221 of file regexport.c.
References assert, colormap::cd, colordesc::flags, colormap::max, NULL, PSEUDO, regex_t::re_guts, regex_t::re_magic, REMAGIC, scancolormap(), and colormap::tree.
Referenced by getColorInfo().
{
struct colormap *cm;
assert(regex != NULL && regex->re_magic == REMAGIC);
cm = &((struct guts *) regex->re_guts)->cmap;
if (co <= 0 || co > cm->max || chars_len <= 0)
return;
if (cm->cd[co].flags & PSEUDO)
return;
/* Recursively search the colormap tree */
scancolormap(cm, co, cm->tree, 0, 0, &chars, &chars_len);
}
| int pg_reg_getfinalstate | ( | const regex_t * | regex | ) |
Definition at line 68 of file regexport.c.
References assert, NULL, cnfa::post, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
Referenced by addKey().
| int pg_reg_getinitialstate | ( | const regex_t * | regex | ) |
Definition at line 54 of file regexport.c.
References assert, NULL, cnfa::pre, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
Referenced by transformGraph().
| int pg_reg_getnumcharacters | ( | const regex_t * | regex, | |
| int | co | |||
| ) |
Definition at line 196 of file regexport.c.
References assert, colormap::cd, colordesc::flags, colormap::max, colordesc::nchrs, NULL, PSEUDO, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
Referenced by getColorInfo().
| int pg_reg_getnumcolors | ( | const regex_t * | regex | ) |
Definition at line 138 of file regexport.c.
References assert, colormap::max, NULL, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
Referenced by getColorInfo().
| int pg_reg_getnumoutarcs | ( | const regex_t * | regex, | |
| int | st | |||
| ) |
Definition at line 84 of file regexport.c.
References assert, carc::co, COLORLESS, cnfa::ncolors, cnfa::nstates, NULL, regex_t::re_guts, regex_t::re_magic, REMAGIC, and cnfa::states.
Referenced by addArcs(), and addKey().
{
struct cnfa *cnfa;
struct carc *ca;
int count;
assert(regex != NULL && regex->re_magic == REMAGIC);
cnfa = &((struct guts *) regex->re_guts)->search;
if (st < 0 || st >= cnfa->nstates)
return 0;
count = 0;
for (ca = cnfa->states[st]; ca->co != COLORLESS; ca++)
{
if (ca->co < cnfa->ncolors)
count++;
}
return count;
}
| int pg_reg_getnumstates | ( | const regex_t * | regex | ) |
Definition at line 40 of file regexport.c.
References assert, cnfa::nstates, NULL, regex_t::re_guts, regex_t::re_magic, and REMAGIC.
| void pg_reg_getoutarcs | ( | const regex_t * | regex, | |
| int | st, | |||
| regex_arc_t * | arcs, | |||
| int | arcs_len | |||
| ) |
Definition at line 110 of file regexport.c.
References assert, regex_arc_t::co, carc::co, COLORLESS, cnfa::ncolors, cnfa::nstates, NULL, regex_t::re_guts, regex_t::re_magic, REMAGIC, cnfa::states, carc::to, and regex_arc_t::to.
Referenced by addArcs(), and addKey().
{
struct cnfa *cnfa;
struct carc *ca;
assert(regex != NULL && regex->re_magic == REMAGIC);
cnfa = &((struct guts *) regex->re_guts)->search;
if (st < 0 || st >= cnfa->nstates || arcs_len <= 0)
return;
for (ca = cnfa->states[st]; ca->co != COLORLESS; ca++)
{
if (ca->co < cnfa->ncolors)
{
arcs->co = ca->co;
arcs->to = ca->to;
arcs++;
if (--arcs_len == 0)
break;
}
}
}
| static void scancolormap | ( | struct colormap * | cm, | |
| int | co, | |||
| union tree * | t, | |||
| int | level, | |||
| chr | partial, | |||
| pg_wchar ** | chars, | |||
| int * | chars_len | |||
| ) | [static] |
Definition at line 248 of file regexport.c.
References BYTBITS, i, NBYTS, and colormap::tree.
Referenced by pg_reg_getcharacters().
{
int i;
if (level < NBYTS - 1)
{
/* non-leaf node */
for (i = 0; i < BYTTAB; i++)
{
/*
* We do not support search for chrs of color 0 (WHITE), so
* all-white subtrees need not be searched. These can be
* recognized because they are represented by the fill blocks in
* the colormap struct. This typically allows us to avoid
* scanning large regions of higher-numbered chrs.
*/
if (t->tptr[i] == &cm->tree[level + 1])
continue;
/* Recursively scan next level down */
scancolormap(cm, co,
t->tptr[i], level + 1,
(partial | (chr) i) << BYTBITS,
chars, chars_len);
}
}
else
{
/* leaf node */
for (i = 0; i < BYTTAB; i++)
{
if (t->tcolor[i] == co)
{
if (*chars_len > 0)
{
**chars = partial | (chr) i;
(*chars)++;
(*chars_len)--;
}
}
}
}
}
1.7.1