24 #define CLEAR(v) ((v) = 0)
25 #define SET0(v, n) ((v) &= ~((states) 1 << (n)))
26 #define SET1(v, n) ((v) |= (states) 1 << (n))
27 #define ISSET(v, n) ((v) & ((states) 1 << (n)))
28 #define ASSIGN(d, s) ((d) = (s))
29 #define EQ(a, b) ((a) == (b))
30 #define STATEVARS int dummy
31 #define STATESETUP(m, n)
32 #define STATETEARDOWN(m)
33 #define SETUP(v) ((v) = 0)
35 #define INIT(o, n) ((o) = (unsigned states)1 << (n))
36 #define INC(o) ((o) <<= 1)
37 #define ISSTATEIN(v, o) ((v) & (o))
40 #define FWD(dst, src, n) ((dst) |= ((unsigned states)(src)&(here)) << (n))
41 #define BACK(dst, src, n) ((dst) |= ((unsigned states)(src)&(here)) >> (n))
42 #define ISSETBACK(v, n) ((v) & ((unsigned states)here >> (n)))
71 #define CLEAR(v) memset(v, 0, m->g->nstates)
72 #define SET0(v, n) ((v)[n] = 0)
73 #define SET1(v, n) ((v)[n] = 1)
74 #define ISSET(v, n) ((v)[n])
75 #define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
76 #define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
77 #define STATEVARS int vn; char *space
78 #define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
79 if ((m)->space == NULL) return(MY_REG_ESPACE); \
81 #define STATETEARDOWN(m) { free((m)->space); }
82 #define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
84 #define INIT(o, n) ((o) = (n))
85 #define INC(o) ((o)++)
86 #define ISSTATEIN(v, o) ((v)[o])
89 #define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
90 #define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
91 #define ISSETBACK(v, n) ((v)[here - (n)])
113 my_regexec(preg, str, nmatch, pmatch, eflags)
120 char *pstr = (
char *) str;
121 register struct re_guts *g = preg->re_g;
123 # define GOODFLAGS(f) (f)
125 # define GOODFLAGS(f) ((f)&(MY_REG_NOTBOL|MY_REG_NOTEOL|MY_REG_STARTEND))
128 if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
129 return(MY_REG_BADPAT);
130 assert(!(g->iflags&BAD));
132 return(MY_REG_BADPAT);
133 eflags = GOODFLAGS(eflags);
135 if ((
size_t) g->nstates <= CHAR_BIT*
sizeof(states1) &&
136 !(eflags&MY_REG_LARGE))
137 return(smatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
139 return(lmatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));