mux/src/pcre.h

Go to the documentation of this file.
00001 /*************************************************
00002 *       Perl-Compatible Regular Expressions      *
00003 *************************************************/
00004 
00005 /* Copyright (c) 1997-2003 University of Cambridge */
00006 
00007 /* Modified a bit by Shawn Wagner for inclusion in MUX. See
00008    pcre.cpp for details. */
00009 
00010 #ifndef _PCRE_H
00011 #define _PCRE_H
00012 
00013 #define PCRE_MAJOR          4
00014 #define PCRE_MINOR          5
00015 #define PCRE_DATE           01-December-2003
00016 
00017 #ifndef PCRE_DATA_SCOPE
00018 #  define PCRE_DATA_SCOPE     extern
00019 #endif
00020 
00021 /* Have to include stdlib.h in order to ensure that size_t is defined;
00022 it is needed here for malloc. */
00023 
00024 #include <stdlib.h>
00025 
00026 /* Options */
00027 
00028 #define PCRE_CASELESS           0x0001
00029 #define PCRE_MULTILINE          0x0002
00030 #define PCRE_DOTALL             0x0004
00031 #define PCRE_EXTENDED           0x0008
00032 #define PCRE_ANCHORED           0x0010
00033 #define PCRE_DOLLAR_ENDONLY     0x0020
00034 #define PCRE_EXTRA              0x0040
00035 #define PCRE_NOTBOL             0x0080
00036 #define PCRE_NOTEOL             0x0100
00037 #define PCRE_UNGREEDY           0x0200
00038 #define PCRE_NOTEMPTY           0x0400
00039 #define PCRE_UTF8               0x0800
00040 #define PCRE_NO_AUTO_CAPTURE    0x1000
00041 #define PCRE_NO_UTF8_CHECK      0x2000
00042 
00043 /* Exec-time and get/set-time error codes */
00044 
00045 #define PCRE_ERROR_NOMATCH        (-1)
00046 #define PCRE_ERROR_NULL           (-2)
00047 #define PCRE_ERROR_BADOPTION      (-3)
00048 #define PCRE_ERROR_BADMAGIC       (-4)
00049 #define PCRE_ERROR_UNKNOWN_NODE   (-5)
00050 #define PCRE_ERROR_NOMEMORY       (-6)
00051 #define PCRE_ERROR_NOSUBSTRING    (-7)
00052 #define PCRE_ERROR_MATCHLIMIT     (-8)
00053 #define PCRE_ERROR_CALLOUT        (-9)  /* Never used by PCRE itself */
00054 #define PCRE_ERROR_BADUTF8       (-10)
00055 #define PCRE_ERROR_BADUTF8_OFFSET (-11)
00056 
00057 /* Request types for pcre_fullinfo() */
00058 
00059 #define PCRE_INFO_OPTIONS            0
00060 #define PCRE_INFO_SIZE               1
00061 #define PCRE_INFO_CAPTURECOUNT       2
00062 #define PCRE_INFO_BACKREFMAX         3
00063 #define PCRE_INFO_FIRSTBYTE          4
00064 #define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
00065 #define PCRE_INFO_FIRSTTABLE         5
00066 #define PCRE_INFO_LASTLITERAL        6
00067 #define PCRE_INFO_NAMEENTRYSIZE      7
00068 #define PCRE_INFO_NAMECOUNT          8
00069 #define PCRE_INFO_NAMETABLE          9
00070 #define PCRE_INFO_STUDYSIZE         10
00071 
00072 /* Request types for pcre_config() */
00073 
00074 #define PCRE_CONFIG_UTF8                    0
00075 #define PCRE_CONFIG_NEWLINE                 1
00076 #define PCRE_CONFIG_LINK_SIZE               2
00077 #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
00078 #define PCRE_CONFIG_MATCH_LIMIT             4
00079 #define PCRE_CONFIG_STACKRECURSE            5
00080 
00081 /* Bit flags for the pcre_extra structure */
00082 
00083 #define PCRE_EXTRA_STUDY_DATA          0x0001
00084 #define PCRE_EXTRA_MATCH_LIMIT         0x0002
00085 #define PCRE_EXTRA_CALLOUT_DATA        0x0004
00086 
00087 /* Types */
00088 
00089 struct real_pcre;                 /* declaration; the definition is private  */
00090 typedef struct real_pcre pcre;
00091 
00092 /* The structure for passing additional data to pcre_exec(). This is defined in
00093 such as way as to be extensible. */
00094 
00095 typedef struct pcre_extra {
00096   unsigned long int flags;        /* Bits for which fields are set */
00097   void *study_data;               /* Opaque data from pcre_study() */
00098   unsigned long int match_limit;  /* Maximum number of calls to match() */
00099   void *callout_data;             /* Data passed back in callouts */
00100 } pcre_extra;
00101 
00102 /* The structure for passing out data via the pcre_callout_function. We use a
00103 structure so that new fields can be added on the end in future versions,
00104 without changing the API of the function, thereby allowing old clients to work
00105 without modification. */
00106 
00107 typedef struct pcre_callout_block {
00108   int          version;           /* Identifies version of block */
00109   /* ------------------------ Version 0 ------------------------------- */
00110   int          callout_number;    /* Number compiled into pattern */
00111   int         *offset_vector;     /* The offset vector */
00112   const char  *subject;           /* The subject being matched */
00113   int          subject_length;    /* The length of the subject */
00114   int          start_match;       /* Offset to start of this match attempt */
00115   int          current_position;  /* Where we currently are */
00116   int          capture_top;       /* Max current capture */
00117   int          capture_last;      /* Most recently closed capture */
00118   void        *callout_data;      /* Data passed in with the call */
00119   /* ------------------------------------------------------------------ */
00120 } pcre_callout_block;
00121 
00122 
00123 /* Exported PCRE functions */
00124 
00125 extern pcre *pcre_compile(const char *, int, const char **,
00126               int *, const unsigned char *);
00127 extern int  pcre_copy_substring(const char *, int *, int, int,
00128               char *, int);
00129 extern int  pcre_exec(const pcre *, const pcre_extra *,
00130               const char *, int, int, int, int *, int);
00131 extern const unsigned char *pcre_maketables(void);
00132 extern pcre_extra *pcre_study(const pcre *, int, const char **);
00133 
00134 #endif /* End of pcre.h */

Generated on Mon May 28 04:40:11 2007 for MUX by  doxygen 1.4.7