PostgreSQL Source Code git master
|
Go to the source code of this file.
Macros | |
#define | NISERR() VISERR(nfa->v) |
#define | NERR(e) VERR(nfa->v, (e)) |
#define | BULK_ARC_OP_USE_SORT(nsrcarcs, ndestarcs) ((nsrcarcs) < 4 ? 0 : ((nsrcarcs) > 32 || (ndestarcs) > 32)) |
#define | CA(ct, at) (((ct)<<CHAR_BIT) | (at)) |
Functions | |
static struct nfa * | newnfa (struct vars *v, struct colormap *cm, struct nfa *parent) |
static void | freenfa (struct nfa *nfa) |
static struct state * | newstate (struct nfa *nfa) |
static struct state * | newfstate (struct nfa *nfa, int flag) |
static void | dropstate (struct nfa *nfa, struct state *s) |
static void | freestate (struct nfa *nfa, struct state *s) |
static void | newarc (struct nfa *nfa, int t, color co, struct state *from, struct state *to) |
static void | createarc (struct nfa *nfa, int t, color co, struct state *from, struct state *to) |
static struct arc * | allocarc (struct nfa *nfa) |
static void | freearc (struct nfa *nfa, struct arc *victim) |
static void | changearcsource (struct arc *a, struct state *newfrom) |
static void | changearctarget (struct arc *a, struct state *newto) |
static int | hasnonemptyout (struct state *s) |
static struct arc * | findarc (struct state *s, int type, color co) |
static void | cparc (struct nfa *nfa, struct arc *oa, struct state *from, struct state *to) |
static void | sortins (struct nfa *nfa, struct state *s) |
static int | sortins_cmp (const void *a, const void *b) |
static void | sortouts (struct nfa *nfa, struct state *s) |
static int | sortouts_cmp (const void *a, const void *b) |
static void | moveins (struct nfa *nfa, struct state *oldState, struct state *newState) |
static void | copyins (struct nfa *nfa, struct state *oldState, struct state *newState) |
static void | mergeins (struct nfa *nfa, struct state *s, struct arc **arcarray, int arccount) |
static void | moveouts (struct nfa *nfa, struct state *oldState, struct state *newState) |
static void | copyouts (struct nfa *nfa, struct state *oldState, struct state *newState) |
static void | cloneouts (struct nfa *nfa, struct state *old, struct state *from, struct state *to, int type) |
static void | delsub (struct nfa *nfa, struct state *lp, struct state *rp) |
static void | deltraverse (struct nfa *nfa, struct state *leftend, struct state *s) |
static void | dupnfa (struct nfa *nfa, struct state *start, struct state *stop, struct state *from, struct state *to) |
static void | duptraverse (struct nfa *nfa, struct state *s, struct state *stmp) |
static void | removeconstraints (struct nfa *nfa, struct state *start, struct state *stop) |
static void | removetraverse (struct nfa *nfa, struct state *s) |
static void | cleartraverse (struct nfa *nfa, struct state *s) |
static struct state * | single_color_transition (struct state *s1, struct state *s2) |
static void | specialcolors (struct nfa *nfa) |
static long | optimize (struct nfa *nfa, FILE *f) |
static void | pullback (struct nfa *nfa, FILE *f) |
static int | pull (struct nfa *nfa, struct arc *con, struct state **intermediates) |
static void | pushfwd (struct nfa *nfa, FILE *f) |
static int | push (struct nfa *nfa, struct arc *con, struct state **intermediates) |
static int | combine (struct nfa *nfa, struct arc *con, struct arc *a) |
static void | fixempties (struct nfa *nfa, FILE *f) |
static struct state * | emptyreachable (struct nfa *nfa, struct state *s, struct state *lastfound, struct arc **inarcsorig) |
static int | isconstraintarc (struct arc *a) |
static int | hasconstraintout (struct state *s) |
static void | fixconstraintloops (struct nfa *nfa, FILE *f) |
static int | findconstraintloop (struct nfa *nfa, struct state *s) |
static void | breakconstraintloop (struct nfa *nfa, struct state *sinitial) |
static void | clonesuccessorstates (struct nfa *nfa, struct state *ssource, struct state *sclone, struct state *spredecessor, struct arc *refarc, char *curdonemap, char *outerdonemap, int nstates) |
static void | removecantmatch (struct nfa *nfa) |
static void | cleanup (struct nfa *nfa) |
static void | markreachable (struct nfa *nfa, struct state *s, struct state *okay, struct state *mark) |
static void | markcanreach (struct nfa *nfa, struct state *s, struct state *okay, struct state *mark) |
static long | analyze (struct nfa *nfa) |
static void | checkmatchall (struct nfa *nfa) |
static bool | checkmatchall_recurse (struct nfa *nfa, struct state *s, bool **haspaths) |
static bool | check_out_colors_match (struct state *s, color co1, color co2) |
static bool | check_in_colors_match (struct state *s, color co1, color co2) |
static void | compact (struct nfa *nfa, struct cnfa *cnfa) |
static void | carcsort (struct carc *first, size_t n) |
static int | carc_cmp (const void *a, const void *b) |
static void | freecnfa (struct cnfa *cnfa) |
static void | dumpnfa (struct nfa *nfa, FILE *f) |
#define BULK_ARC_OP_USE_SORT | ( | nsrcarcs, | |
ndestarcs | |||
) | ((nsrcarcs) < 4 ? 0 : ((nsrcarcs) > 32 || (ndestarcs) > 32)) |
Definition at line 758 of file regc_nfa.c.
#define CA | ( | ct, | |
at | |||
) | (((ct)<<CHAR_BIT) | (at)) |
Definition at line 39 of file regc_nfa.c.
Definition at line 368 of file regc_nfa.c.
References a, arcbatch::a, ARCBATCHSIZE, FIRSTABSIZE, nfa::freearcs, if(), nfa::lastab, nfa::lastabused, MALLOC, MAXABSIZE, arcbatch::narcs, NERR, arcbatch::next, REG_ESPACE, REG_ETOOBIG, REG_MAX_COMPILE_SPACE, vars::spaceused, and nfa::v.
Referenced by createarc().
|
static |
Definition at line 3051 of file regc_nfa.c.
References a, checkmatchall(), NISERR, arc::outchain, state::outs, nfa::post, nfa::pre, REG_UEMPTYMATCH, REG_UIMPOSSIBLE, and arc::to.
Referenced by ExecVacuum(), GetCommandLogLevel(), and optimize().
Definition at line 2558 of file regc_nfa.c.
References a, assert, clonesuccessorstates(), cparc(), freearc(), freestate(), arc::from, isconstraintarc(), newstate(), state::next, NISERR, state::nouts, nfa::nstates, state::outs, nfa::states, state::tmp, and arc::to.
Referenced by findconstraintloop().
|
static |
Definition at line 3612 of file regc_nfa.c.
References a, b, carc::co, and carc::to.
Referenced by carcsort().
|
static |
Definition at line 3605 of file regc_nfa.c.
References carc_cmp(), and qsort.
Referenced by compact().
Definition at line 489 of file regc_nfa.c.
References a, assert, state::nouts, arc::outchain, arc::outchainRev, and state::outs.
Referenced by moveouts().
Definition at line 533 of file regc_nfa.c.
References a, assert, arc::inchain, arc::inchainRev, state::ins, and state::nins.
Referenced by moveins().
Definition at line 3469 of file regc_nfa.c.
References a, assert, and state::ins.
Referenced by checkmatchall().
Definition at line 3415 of file regc_nfa.c.
References a, assert, and state::outs.
Referenced by checkmatchall().
|
static |
Definition at line 3097 of file regc_nfa.c.
References a, assert, nfa::bos, colormap::cd, check_in_colors_match(), check_out_colors_match(), checkmatchall_recurse(), nfa::cm, DUPINF, nfa::eos, colordesc::flags, nfa::flags, FREE, i, MALLOC, MATCHALL, nfa::maxmatchall, nfa::minmatchall, state::next, state::no, nfa::nstates, state::outs, PLAIN, nfa::post, nfa::pre, PSEUDO, RAINBOW, nfa::states, and state::tmp.
Referenced by analyze().
Definition at line 3277 of file regc_nfa.c.
References a, assert, checkmatchall_recurse(), DUPINF, i, INTERRUPT, MALLOC, state::no, nfa::nstates, state::outs, nfa::post, RAINBOW, vars::re, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by checkmatchall(), and checkmatchall_recurse().
|
static |
Definition at line 2964 of file regc_nfa.c.
References assert, cleartraverse(), dropstate(), state::flag, markcanreach(), markreachable(), state::next, state::nins, NISERR, state::no, nfa::nstates, nfa::post, nfa::pre, nfa::states, and state::tmp.
Referenced by optimize().
Definition at line 1488 of file regc_nfa.c.
References a, cleartraverse(), NERR, state::outs, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by cleanup(), cleartraverse(), dupnfa(), and removeconstraints().
|
static |
Definition at line 1256 of file regc_nfa.c.
References a, AHEAD, assert, BEHIND, arc::from, newarc(), state::outs, PLAIN, arc::to, and type.
|
static |
Definition at line 2704 of file regc_nfa.c.
References a, a2, assert, clonesuccessorstates(), arc::co, cparc(), dropstate(), FREE, arc::from, hasconstraintout(), state::ins, isconstraintarc(), MALLOC, NERR, newstate(), state::nins, NISERR, state::no, state::outs, vars::re, REG_ESPACE, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, arc::type, and nfa::v.
Referenced by breakconstraintloop(), and clonesuccessorstates().
Definition at line 1987 of file regc_nfa.c.
References a, AHEAD, assert, BEHIND, CA, colormap::cd, nfa::cm, arc::co, COMPATIBLE, colordesc::flags, INCOMPATIBLE, LACON, NOTREACHED, PLAIN, PSEUDO, RAINBOW, REPLACEARC, SATISFIED, and arc::type.
Definition at line 3514 of file regc_nfa.c.
References a, cnfa::arcs, assert, nfa::bos, cnfa::bos, carcsort(), nfa::cm, CNFA_NOPROGRESS, carc::co, COLORLESS, nfa::eos, cnfa::eos, nfa::flags, cnfa::flags, FREE, HASLACONS, LACON, MALLOC, maxcolor(), nfa::maxmatchall, cnfa::maxmatchall, nfa::minmatchall, cnfa::minmatchall, cnfa::ncolors, NERR, state::next, NISERR, state::no, state::nouts, cnfa::nstates, state::outs, PLAIN, nfa::post, cnfa::post, nfa::pre, cnfa::pre, REG_ASSERT, REG_ESPACE, nfa::states, cnfa::states, cnfa::stflags, and carc::to.
Definition at line 882 of file regc_nfa.c.
References a, assert, BULK_ARC_OP_USE_SORT, cparc(), createarc(), arc::inchain, state::ins, INTERRUPT, state::nins, NISERR, NOTREACHED, vars::re, sortins(), sortins_cmp(), and nfa::v.
Referenced by pull().
Definition at line 1167 of file regc_nfa.c.
References a, assert, BULK_ARC_OP_USE_SORT, cparc(), createarc(), INTERRUPT, NISERR, NOTREACHED, state::nouts, arc::outchain, state::outs, vars::re, sortouts(), sortouts_cmp(), and nfa::v.
Referenced by push().
|
static |
Definition at line 608 of file regc_nfa.c.
References arc::co, arc::from, newarc(), arc::to, and arc::type.
Referenced by breakconstraintloop(), clonesuccessorstates(), copyins(), copyouts(), duptraverse(), moveins(), moveouts(), pull(), and push().
|
static |
Definition at line 323 of file regc_nfa.c.
References a, allocarc(), assert, nfa::cm, arc::co, colorchain(), COLORED, arc::from, arc::inchainRev, state::ins, state::nins, NISERR, state::nouts, arc::outchainRev, state::outs, nfa::parent, and arc::to.
Referenced by copyins(), copyouts(), mergeins(), moveins(), moveouts(), and newarc().
Definition at line 1281 of file regc_nfa.c.
References assert, deltraverse(), FREESTATE, state::nins, NISERR, state::no, state::nouts, and state::tmp.
Definition at line 1304 of file regc_nfa.c.
References a, assert, deltraverse(), freearc(), FREESTATE, freestate(), NERR, state::nins, NISERR, state::no, state::nouts, state::outs, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by delsub(), and deltraverse().
Definition at line 226 of file regc_nfa.c.
References a, freearc(), freestate(), state::ins, and state::outs.
Referenced by cleanup(), clonesuccessorstates(), fixconstraintloops(), fixempties(), pullback(), and pushfwd().
|
static |
Definition at line 3646 of file regc_nfa.c.
References nfa::bos, nfa::cm, COLORLESS, DUPINF, nfa::eos, fflush(), nfa::flags, fprintf, HASCANTMATCH, HASLACONS, MATCHALL, nfa::maxmatchall, nfa::minmatchall, state::next, state::no, state::nouts, nfa::parent, nfa::post, nfa::pre, and nfa::states.
Referenced by fixconstraintloops(), fixempties(), optimize(), pullback(), and pushfwd().
|
static |
Definition at line 1355 of file regc_nfa.c.
References cleartraverse(), duptraverse(), EMPTY, newarc(), start, and state::tmp.
Definition at line 1379 of file regc_nfa.c.
References a, assert, cparc(), duptraverse(), NERR, newstate(), NISERR, state::outs, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by dupnfa(), and duptraverse().
|
static |
Definition at line 2303 of file regc_nfa.c.
References a, EMPTY, emptyreachable(), NERR, state::no, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by emptyreachable(), and fixempties().
Definition at line 2469 of file regc_nfa.c.
References a, assert, breakconstraintloop(), findconstraintloop(), isconstraintarc(), NERR, state::outs, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by findconstraintloop(), and fixconstraintloops().
|
static |
Definition at line 2370 of file regc_nfa.c.
References a, assert, dropstate(), dumpnfa(), findconstraintloop(), state::flag, freearc(), isconstraintarc(), state::next, state::nins, NISERR, state::nouts, state::outs, nfa::states, and state::tmp.
Referenced by optimize().
|
static |
Definition at line 2076 of file regc_nfa.c.
References a, assert, dropstate(), dumpnfa(), EMPTY, emptyreachable(), state::flag, FREE, freearc(), hasnonemptyout(), state::ins, MALLOC, mergeins(), moveins(), moveouts(), NERR, state::next, state::nins, NISERR, state::no, state::nouts, nfa::nstates, state::outs, REG_ESPACE, s2, nfa::states, and state::tmp.
Referenced by optimize().
Definition at line 418 of file regc_nfa.c.
References assert, nfa::cm, COLORED, nfa::freearcs, arc::from, arc::inchain, arc::inchainRev, state::ins, state::nins, state::nouts, arc::outchain, arc::outchainRev, state::outs, nfa::parent, arc::to, arc::type, and uncolorchain().
Referenced by breakconstraintloop(), deltraverse(), dropstate(), fixconstraintloops(), fixempties(), moveins(), moveouts(), pull(), pullback(), push(), pushfwd(), removecantmatch(), and removetraverse().
|
static |
Definition at line 3633 of file regc_nfa.c.
References cnfa::arcs, assert, FREE, NULLCNFA, cnfa::states, cnfa::stflags, and ZAPCNFA.
|
static |
Definition at line 107 of file regc_nfa.c.
References ARCBATCHSIZE, FREE, nfa::lastab, nfa::lastsb, arcbatch::narcs, arcbatch::next, statebatch::next, statebatch::nstates, nfa::nstates, vars::spaceused, STATEBATCHSIZE, and nfa::v.
Referenced by newnfa().
Definition at line 242 of file regc_nfa.c.
References assert, state::flag, FREESTATE, nfa::freestates, state::next, state::nins, state::no, state::nouts, state::prev, nfa::slast, and nfa::states.
Referenced by breakconstraintloop(), deltraverse(), and dropstate().
|
static |
Definition at line 2349 of file regc_nfa.c.
References a, isconstraintarc(), and state::outs.
Referenced by clonesuccessorstates().
|
static |
Definition at line 575 of file regc_nfa.c.
References a, EMPTY, and state::outs.
Referenced by fixempties().
|
inlinestatic |
Definition at line 2331 of file regc_nfa.c.
References a, AHEAD, BEHIND, and LACON.
Referenced by breakconstraintloop(), clonesuccessorstates(), findconstraintloop(), fixconstraintloops(), and hasconstraintout().
|
static |
Definition at line 3025 of file regc_nfa.c.
References a, state::ins, markcanreach(), NERR, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by cleanup(), and markcanreach().
|
static |
Definition at line 2999 of file regc_nfa.c.
References a, markreachable(), NERR, state::outs, vars::re, REG_ETOOBIG, STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by cleanup(), and markreachable().
|
static |
Definition at line 971 of file regc_nfa.c.
References a, assert, createarc(), i, arc::inchain, state::ins, INTERRUPT, j, NISERR, NOTREACHED, qsort, vars::re, sortins(), sortins_cmp(), and nfa::v.
Referenced by fixempties().
Definition at line 778 of file regc_nfa.c.
References a, assert, BULK_ARC_OP_USE_SORT, changearctarget(), cparc(), createarc(), freearc(), arc::inchain, state::ins, INTERRUPT, state::nins, NISERR, NOTREACHED, vars::re, sortins(), sortins_cmp(), and nfa::v.
Referenced by fixempties(), and pull().
Definition at line 1066 of file regc_nfa.c.
References a, assert, BULK_ARC_OP_USE_SORT, changearcsource(), cparc(), createarc(), freearc(), INTERRUPT, NISERR, NOTREACHED, state::nouts, arc::outchain, state::outs, vars::re, sortouts(), sortouts_cmp(), and nfa::v.
Referenced by fixempties(), and push().
|
static |
Definition at line 281 of file regc_nfa.c.
References a, assert, arc::co, createarc(), arc::from, state::ins, INTERRUPT, state::nins, state::nouts, state::outs, vars::re, arc::to, and nfa::v.
Referenced by cloneouts(), colorcomplement(), cparc(), dupnfa(), newnfa(), okcolors(), pull(), pullback(), push(), pushfwd(), rainbow(), removetraverse(), subcolorcvec(), subcoloronechr(), and subcoloronerow().
Definition at line 212 of file regc_nfa.c.
References state::flag, flag(), and newstate().
Referenced by newnfa().
Definition at line 47 of file regc_nfa.c.
References nfa::bos, nfa::cm, COLORLESS, nfa::eos, ERR, nfa::final, nfa::flags, nfa::freearcs, freenfa(), nfa::freestates, nfa::init, ISERR, nfa::lastab, nfa::lastabused, nfa::lastsb, nfa::lastsbused, MALLOC, nfa::maxmatchall, nfa::minmatchall, newarc(), newfstate(), newstate(), nfa::nstates, nfa::parent, PLAIN, nfa::post, nfa::pre, rainbow(), REG_ESPACE, nfa::slast, nfa::states, and nfa::v.
Definition at line 137 of file regc_nfa.c.
References assert, FIRSTSBSIZE, state::flag, nfa::freestates, if(), state::ins, INTERRUPT, nfa::lastsb, nfa::lastsbused, MALLOC, MAXSBSIZE, NERR, state::next, statebatch::next, state::nins, state::no, state::nouts, statebatch::nstates, nfa::nstates, state::outs, state::prev, vars::re, REG_ESPACE, REG_ETOOBIG, REG_MAX_COMPILE_SPACE, statebatch::s, nfa::slast, vars::spaceused, STATEBATCHSIZE, nfa::states, state::tmp, and nfa::v.
Referenced by breakconstraintloop(), clonesuccessorstates(), duptraverse(), newfstate(), newnfa(), pull(), push(), and SetMatViewPopulatedState().
|
static |
Definition at line 1594 of file regc_nfa.c.
References analyze(), cleanup(), dumpnfa(), fixconstraintloops(), fixempties(), nfa::flags, fprintf, HASCANTMATCH, pullback(), pushfwd(), removecantmatch(), and verbose.
Definition at line 1720 of file regc_nfa.c.
References a, assert, arc::co, combine(), COMPATIBLE, copyins(), cparc(), state::flag, freearc(), arc::from, INCOMPATIBLE, state::ins, moveins(), newarc(), newstate(), state::nins, NISERR, NOTREACHED, state::nouts, state::outs, REPLACEARC, SATISFIED, state::tmp, and arc::to.
Referenced by pullback().
|
static |
Definition at line 1640 of file regc_nfa.c.
References a, assert, BEHIND, nfa::bos, dropstate(), dumpnfa(), state::flag, freearc(), newarc(), state::next, state::nins, NISERR, state::nouts, state::outs, PLAIN, nfa::pre, progress, pull(), nfa::states, and state::tmp.
Referenced by optimize().
Definition at line 1891 of file regc_nfa.c.
References a, assert, arc::co, combine(), COMPATIBLE, copyouts(), cparc(), state::flag, freearc(), arc::from, INCOMPATIBLE, state::ins, moveouts(), newarc(), newstate(), state::nins, NISERR, NOTREACHED, state::nouts, state::outs, REPLACEARC, SATISFIED, state::tmp, and arc::to.
Referenced by pushfwd().
|
static |
Definition at line 1811 of file regc_nfa.c.
References a, AHEAD, assert, dropstate(), dumpnfa(), nfa::eos, state::flag, freearc(), state::ins, newarc(), state::next, state::nins, NISERR, state::nouts, PLAIN, nfa::post, progress, push(), nfa::states, and state::tmp.
Referenced by optimize().
|
static |
Definition at line 2938 of file regc_nfa.c.
References a, CANTMATCH, freearc(), state::next, NISERR, state::outs, and nfa::states.
Referenced by optimize().
|
static |
Definition at line 1419 of file regc_nfa.c.
References cleartraverse(), removetraverse(), start, and state::tmp.
Definition at line 1438 of file regc_nfa.c.
References a, AHEAD, BEHIND, CANTMATCH, EMPTY, freearc(), LACON, NERR, newarc(), NISERR, state::outs, PLAIN, vars::re, REG_ASSERT, REG_ETOOBIG, removetraverse(), STACK_TOO_DEEP, state::tmp, and nfa::v.
Referenced by removeconstraints(), and removetraverse().
Definition at line 1525 of file regc_nfa.c.
Definition at line 620 of file regc_nfa.c.
References a, assert, FREE, i, state::ins, MALLOC, NERR, state::nins, qsort, REG_ESPACE, and sortins_cmp().
Referenced by copyins(), mergeins(), and moveins().
|
static |
Definition at line 662 of file regc_nfa.c.
References a, b, arc::co, arc::from, state::no, and arc::type.
Referenced by copyins(), mergeins(), moveins(), and sortins().
Definition at line 687 of file regc_nfa.c.
References a, assert, FREE, i, MALLOC, NERR, state::nouts, state::outs, qsort, REG_ESPACE, and sortouts_cmp().
Referenced by copyouts(), and moveouts().
|
static |
Definition at line 729 of file regc_nfa.c.
References a, b, arc::co, state::no, arc::to, and arc::type.
Referenced by copyouts(), moveouts(), and sortouts().
|
static |
Definition at line 1555 of file regc_nfa.c.
References assert, nfa::bos, nfa::cm, COLORLESS, nfa::eos, nfa::parent, and pseudocolor().