Back to index

php5  5.3.10
Defines | Functions
regexec.c File Reference
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include "regex.h"
#include "utils.h"
#include "regex2.h"
#include "engine.c"

Go to the source code of this file.

Defines

#define PHP_REGEX_NOPE   0; /* for use in asserts; shuts lint up */
#define states   unsigned
#define states1   unsigned /* for later use in regexec() decision */
#define CLEAR(v)   ((v) = 0)
#define SET0(v, n)   ((v) &= ~((unsigned)1 << (n)))
#define SET1(v, n)   ((v) |= (unsigned)1 << (n))
#define ISSET(v, n)   ((v) & ((unsigned)1 << (n)))
#define ASSIGN(d, s)   ((d) = (s))
#define EQ(a, b)   ((a) == (b))
#define STATEVARS   int dummy /* dummy version */
#define STATESETUP(m, n)   /* nothing */
#define STATETEARDOWN(m)   /* nothing */
#define SETUP(v)   ((v) = 0)
#define onestate   unsigned
#define INIT(o, n)   ((o) = (unsigned)1 << (n))
#define INC(o)   ((o) <<= 1)
#define ISSTATEIN(v, o)   ((v) & (o))
#define FWD(dst, src, n)   ((dst) |= ((unsigned)(src)&(here)) << (n))
#define BACK(dst, src, n)   ((dst) |= ((unsigned)(src)&(here)) >> (n))
#define ISSETBACK(v, n)   ((v) & ((unsigned)here >> (n)))
#define SNAMES   /* engine.c looks after details */
#define states   unsigned char *
#define CLEAR(v)   memset(v, 0, m->g->nstates)
#define SET0(v, n)   ((v)[n] = 0)
#define SET1(v, n)   ((v)[n] = 1)
#define ISSET(v, n)   ((v)[n])
#define ASSIGN(d, s)   memcpy(d, s, m->g->nstates)
#define EQ(a, b)   (memcmp(a, b, m->g->nstates) == 0)
#define STATEVARS   int vn; unsigned char *space
#define STATESETUP(m, nv)
#define STATETEARDOWN(m)   { free((m)->space); }
#define SETUP(v)   ((v) = &m->space[m->vn++ * m->g->nstates])
#define onestate   int
#define INIT(o, n)   ((o) = (n))
#define INC(o)   ((o)++)
#define ISSTATEIN(v, o)   ((v)[o])
#define FWD(dst, src, n)   ((dst)[here+(n)] |= (src)[here])
#define BACK(dst, src, n)   ((dst)[here-(n)] |= (src)[here])
#define ISSETBACK(v, n)   ((v)[here - (n)])
#define LNAMES   /* flag */
#define GOODFLAGS(f)   ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))

Functions

 API_EXPORT (int)

Define Documentation

#define ASSIGN (   d,
 
)    ((d) = (s))

Definition at line 75 of file regexec.c.

#define ASSIGN (   d,
 
)    memcpy(d, s, m->g->nstates)

Definition at line 75 of file regexec.c.

#define BACK (   dst,
  src,
  n 
)    ((dst) |= ((unsigned)(src)&(here)) >> (n))

Definition at line 90 of file regexec.c.

#define BACK (   dst,
  src,
  n 
)    ((dst)[here-(n)] |= (src)[here])

Definition at line 90 of file regexec.c.

#define CLEAR (   v)    ((v) = 0)

Definition at line 71 of file regexec.c.

#define CLEAR (   v)    memset(v, 0, m->g->nstates)

Definition at line 71 of file regexec.c.

#define EQ (   a,
 
)    ((a) == (b))

Definition at line 76 of file regexec.c.

#define EQ (   a,
 
)    (memcmp(a, b, m->g->nstates) == 0)

Definition at line 76 of file regexec.c.

#define FWD (   dst,
  src,
  n 
)    ((dst) |= ((unsigned)(src)&(here)) << (n))

Definition at line 89 of file regexec.c.

#define FWD (   dst,
  src,
  n 
)    ((dst)[here+(n)] |= (src)[here])

Definition at line 89 of file regexec.c.

#define GOODFLAGS (   f)    ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
#define INC (   o)    ((o) <<= 1)

Definition at line 85 of file regexec.c.

#define INC (   o)    ((o)++)

Definition at line 85 of file regexec.c.

#define INIT (   o,
  n 
)    ((o) = (unsigned)1 << (n))

Definition at line 84 of file regexec.c.

#define INIT (   o,
  n 
)    ((o) = (n))

Definition at line 84 of file regexec.c.

#define ISSET (   v,
  n 
)    ((v) & ((unsigned)1 << (n)))

Definition at line 74 of file regexec.c.

#define ISSET (   v,
  n 
)    ((v)[n])

Definition at line 74 of file regexec.c.

#define ISSETBACK (   v,
  n 
)    ((v) & ((unsigned)here >> (n)))

Definition at line 91 of file regexec.c.

#define ISSETBACK (   v,
  n 
)    ((v)[here - (n)])

Definition at line 91 of file regexec.c.

#define ISSTATEIN (   v,
 
)    ((v) & (o))

Definition at line 86 of file regexec.c.

#define ISSTATEIN (   v,
 
)    ((v)[o])

Definition at line 86 of file regexec.c.

#define LNAMES   /* flag */

Definition at line 93 of file regexec.c.

#define onestate   unsigned

Definition at line 83 of file regexec.c.

#define onestate   int

Definition at line 83 of file regexec.c.

#define PHP_REGEX_NOPE   0; /* for use in asserts; shuts lint up */

Definition at line 19 of file regexec.c.

#define SET0 (   v,
  n 
)    ((v) &= ~((unsigned)1 << (n)))

Definition at line 72 of file regexec.c.

#define SET0 (   v,
  n 
)    ((v)[n] = 0)

Definition at line 72 of file regexec.c.

#define SET1 (   v,
  n 
)    ((v) |= (unsigned)1 << (n))

Definition at line 73 of file regexec.c.

#define SET1 (   v,
  n 
)    ((v)[n] = 1)

Definition at line 73 of file regexec.c.

#define SETUP (   v)    ((v) = 0)

Definition at line 82 of file regexec.c.

#define SETUP (   v)    ((v) = &m->space[m->vn++ * m->g->nstates])

Definition at line 82 of file regexec.c.

#define SNAMES   /* engine.c looks after details */

Definition at line 44 of file regexec.c.

#define states   unsigned

Definition at line 70 of file regexec.c.

#define states   unsigned char *

Definition at line 70 of file regexec.c.

#define states1   unsigned /* for later use in regexec() decision */

Definition at line 23 of file regexec.c.

#define STATESETUP (   m,
  n 
)    /* nothing */

Definition at line 78 of file regexec.c.

#define STATESETUP (   m,
  nv 
)
Value:
{ (m)->space = malloc((nv)*(m)->g->nstates); \
                            if ((m)->space == NULL) return(REG_ESPACE); \
                            (m)->vn = 0; }

Definition at line 78 of file regexec.c.

#define STATETEARDOWN (   m)    /* nothing */

Definition at line 81 of file regexec.c.

#define STATETEARDOWN (   m)    { free((m)->space); }

Definition at line 81 of file regexec.c.

#define STATEVARS   int dummy /* dummy version */

Definition at line 77 of file regexec.c.

#define STATEVARS   int vn; unsigned char *space

Definition at line 77 of file regexec.c.


Function Documentation

API_EXPORT ( int  )

Definition at line 112 of file regexec.c.

{
       register struct re_guts *g = preg->re_g;
#ifdef REDEBUG
#      define GOODFLAGS(f)  (f)
#else
#      define GOODFLAGS(f)  ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
#endif

       if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
              return(REG_BADPAT);
       assert(!(g->iflags&BAD));
       if (g->iflags&BAD)          /* backstop for no-debug case */
              return(REG_BADPAT);
       eflags = GOODFLAGS(eflags);

       if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
              return(smatcher(g, (unsigned char *)string, nmatch, pmatch, eflags));
       else
              return(lmatcher(g, (unsigned char *)string, nmatch, pmatch, eflags));
}

Here is the call graph for this function: