Back to index

php5  5.3.10
Classes | Defines | Typedefs | Enumerations | Functions
pcreposix.h File Reference
#include <stdlib.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  regex_t
struct  regmatch_t

Defines

#define REG_ICASE   0x0001 /* Maps to PCRE_CASELESS */
#define REG_NEWLINE   0x0002 /* Maps to PCRE_MULTILINE */
#define REG_NOTBOL   0x0004 /* Maps to PCRE_NOTBOL */
#define REG_NOTEOL   0x0008 /* Maps to PCRE_NOTEOL */
#define REG_DOTALL   0x0010 /* NOT defined by POSIX; maps to PCRE_DOTALL */
#define REG_NOSUB   0x0020 /* Maps to PCRE_NO_AUTO_CAPTURE */
#define REG_UTF8   0x0040 /* NOT defined by POSIX; maps to PCRE_UTF8 */
#define REG_STARTEND   0x0080 /* BSD feature: pass subject string by so,eo */
#define REG_NOTEMPTY   0x0100 /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */
#define REG_UNGREEDY   0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */
#define REG_UCP   0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */
#define REG_EXTENDED   0
#define PCREPOSIX_EXP_DECL   extern
#define PCREPOSIX_EXP_DEFN   extern

Typedefs

typedef int regoff_t

Enumerations

enum  {
  REG_ASSERT = 1, REG_BADBR, REG_BADPAT, REG_BADRPT,
  REG_EBRACE, REG_EBRACK, REG_ECOLLATE, REG_ECTYPE,
  REG_EESCAPE, REG_EMPTY, REG_EPAREN, REG_ERANGE,
  REG_ESIZE, REG_ESPACE, REG_ESUBREG, REG_INVARG,
  REG_NOMATCH
}

Functions

PCREPOSIX_EXP_DECL int regcomp (regex_t *, const char *, int)
PCREPOSIX_EXP_DECL int regexec (const regex_t *, const char *, size_t, regmatch_t *, int)
PCREPOSIX_EXP_DECL size_t regerror (int, const regex_t *, char *, size_t)
PCREPOSIX_EXP_DECL void regfree (regex_t *)

Class Documentation

struct regex_t

Definition at line 20 of file regex.h.

Collaboration diagram for regex_t:
Class Members
int comp_options
void * onig
const char * re_endp
size_t re_erroffset
struct re_guts * re_g
int re_magic
size_t re_nsub
void * re_pcre
struct regmatch_t

Definition at line 26 of file regex.h.

Class Members
regoff_t rm_eo
regoff_t rm_so

Define Documentation

#define PCREPOSIX_EXP_DECL   extern

Definition at line 129 of file pcreposix.h.

#define PCREPOSIX_EXP_DEFN   extern

Definition at line 130 of file pcreposix.h.

#define REG_DOTALL   0x0010 /* NOT defined by POSIX; maps to PCRE_DOTALL */

Definition at line 59 of file pcreposix.h.

#define REG_EXTENDED   0

Definition at line 70 of file pcreposix.h.

#define REG_ICASE   0x0001 /* Maps to PCRE_CASELESS */

Definition at line 55 of file pcreposix.h.

#define REG_NEWLINE   0x0002 /* Maps to PCRE_MULTILINE */

Definition at line 56 of file pcreposix.h.

#define REG_NOSUB   0x0020 /* Maps to PCRE_NO_AUTO_CAPTURE */

Definition at line 60 of file pcreposix.h.

#define REG_NOTBOL   0x0004 /* Maps to PCRE_NOTBOL */

Definition at line 57 of file pcreposix.h.

#define REG_NOTEMPTY   0x0100 /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */

Definition at line 63 of file pcreposix.h.

#define REG_NOTEOL   0x0008 /* Maps to PCRE_NOTEOL */

Definition at line 58 of file pcreposix.h.

#define REG_STARTEND   0x0080 /* BSD feature: pass subject string by so,eo */

Definition at line 62 of file pcreposix.h.

#define REG_UCP   0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */

Definition at line 65 of file pcreposix.h.

#define REG_UNGREEDY   0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */

Definition at line 64 of file pcreposix.h.

#define REG_UTF8   0x0040 /* NOT defined by POSIX; maps to PCRE_UTF8 */

Definition at line 61 of file pcreposix.h.


Typedef Documentation

typedef int regoff_t

Definition at line 105 of file pcreposix.h.


Enumeration Type Documentation

anonymous enum
Enumerator:
REG_ASSERT 
REG_BADBR 
REG_BADPAT 
REG_BADRPT 
REG_EBRACE 
REG_EBRACK 
REG_ECOLLATE 
REG_ECTYPE 
REG_EESCAPE 
REG_EMPTY 
REG_EPAREN 
REG_ERANGE 
REG_ESIZE 
REG_ESPACE 
REG_ESUBREG 
REG_INVARG 
REG_NOMATCH 

Definition at line 74 of file pcreposix.h.

     {
  REG_ASSERT = 1,  /* internal error ? */
  REG_BADBR,       /* invalid repeat counts in {} */
  REG_BADPAT,      /* pattern error */
  REG_BADRPT,      /* ? * + invalid */
  REG_EBRACE,      /* unbalanced {} */
  REG_EBRACK,      /* unbalanced [] */
  REG_ECOLLATE,    /* collation error - not relevant */
  REG_ECTYPE,      /* bad class */
  REG_EESCAPE,     /* bad escape sequence */
  REG_EMPTY,       /* empty expression */
  REG_EPAREN,      /* unbalanced () */
  REG_ERANGE,      /* bad range inside [] */
  REG_ESIZE,       /* expression too big */
  REG_ESPACE,      /* failed to get memory */
  REG_ESUBREG,     /* bad back reference */
  REG_INVARG,      /* bad argument */
  REG_NOMATCH      /* match failed */
};

Function Documentation

PCREPOSIX_EXP_DECL int regcomp ( regex_t ,
const char *  ,
int   
)

Definition at line 134 of file regposix.c.

{
  int r, len;
  OnigSyntaxType* syntax = OnigDefaultSyntax;
  OnigOptionType options;

  if ((posix_options & REG_EXTENDED) == 0)
    syntax = ONIG_SYNTAX_POSIX_BASIC;

  options = syntax->options;
  if ((posix_options & REG_ICASE)   != 0)
    ONIG_OPTION_ON(options, ONIG_OPTION_IGNORECASE);
  if ((posix_options & REG_NEWLINE) != 0) {
    ONIG_OPTION_ON( options, ONIG_OPTION_NEGATE_SINGLELINE);
    ONIG_OPTION_OFF(options, ONIG_OPTION_SINGLELINE);
  }

  reg->comp_options = posix_options;

  ENC_STRING_LEN(OnigEncDefaultCharEncoding, pattern, len);
  r = onig_new(PONIG_C(reg), (UChar* )pattern, (UChar* )(pattern + len),
              options, OnigEncDefaultCharEncoding, syntax,
              (OnigErrorInfo* )NULL);
  if (r != ONIG_NORMAL) {
    return onig2posix_error_code(r);
  }

  reg->re_nsub = ONIG_C(reg)->num_mem;
  return 0;
}

Here is the call graph for this function:

PCREPOSIX_EXP_DECL size_t regerror ( int  ,
const regex_t ,
char *  ,
size_t   
)

Definition at line 65 of file regerror.c.

{
       register const struct rerr *r;
       register size_t len;
       register int target = errcode &~ REG_ITOA;
       register const char *s;
       char convbuf[50];

       if (errcode == REG_ATOI)
              s = regatoi(preg, convbuf, sizeof(convbuf));
       else {
              for (r = rerrs; r->code >= 0; r++)
                     if (r->code == target)
                            break;
       
              if (errcode&REG_ITOA) {
                     if (r->code >= 0) {
                            (void) strncpy(convbuf, r->name, sizeof(convbuf) - 1);
                            convbuf[sizeof(convbuf) - 1] = '\0';
                     } else {
                            snprintf(convbuf, sizeof(convbuf), "REG_0x%x", target);
                     }
                     assert(strlen(convbuf) < sizeof(convbuf));
                     s = convbuf;
              } else
                     s = r->explain;
       }

       len = strlen(s) + 1;
       if (errbuf_size > 0) {
              if (errbuf_size > len)
                     (void) strcpy(errbuf, s);
              else {
                     (void) strncpy(errbuf, s, errbuf_size-1);
                     errbuf[errbuf_size-1] = '\0';
              }
       }

       return(len);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PCREPOSIX_EXP_DECL int regexec ( const regex_t ,
const char *  ,
size_t  ,
regmatch_t ,
int   
)

Definition at line 14 of file regfree.c.

{
       register struct re_guts *g;

       if (preg->re_magic != MAGIC1)      /* oops */
              return;                     /* nice to complain, but hard */

       g = preg->re_g;
       if (g == NULL || g->magic != MAGIC2)      /* oops again */
              return;
       preg->re_magic = 0;         /* mark it invalid */
       g->magic = 0;               /* mark it invalid */

       if (g->strip != NULL)
              free((char *)g->strip);
       if (g->sets != NULL)
              free((char *)g->sets);
       if (g->setbits != NULL)
              free((char *)g->setbits);
       if (g->must != NULL)
              free(g->must);
       free((char *)g);
}

Here is the call graph for this function: