# pcre.h

    00001 #ifndef _PCRE_H
    00002 #define _PCRE_H
    00003
    00004 /* The file pcre.h is build by "configure". Do not edit it; instead
    00005 make changes to pcre.in. */
    00006
    00007 #define PCRE_MAJOR      5
    00008 #define PCRE_MINOR      0
    00009 #define PCRE_DATE       13-Sep-2004
    00010
    00011
    00012 /* Win32 uses DLL by default */
    00013 /*
    00014 #ifdef _WIN32
    00015 #  ifdef PCRE_DEFINITION
    00016 #    ifdef DLL_EXPORT
    00017 #      define PCRE_DATA_SCOPE __declspec(dllexport)
    00018 #    endif
    00019 #  else
    00020 #    ifndef PCRE_STATIC
    00021 #      define PCRE_DATA_SCOPE extern __declspec(dllimport)
    00022 #    endif
    00023 #  endif
    00024 #endif
    00025 */
    00026
    00027 #ifndef PCRE_DATA_SCOPE
    00028 #  define PCRE_DATA_SCOPE     extern
    00029 #endif
    00030
    00031 /* Have to include stdlib.h in order to ensure that size_t is defined;
    00032 it is needed here for malloc. */
    00033
    00034 #include <stdlib.h>
    00035
    00036 /* Allow for C++ users */
    00037
    00038 #ifdef __cplusplus
    00039 extern "C" {
    00040 #endif
    00041
    00042 /* Options */
    00043
    00044 #define PCRE_CASELESS           0x0001
    00045 #define PCRE_MULTILINE          0x0002
    00046 #define PCRE_DOTALL             0x0004
    00047 #define PCRE_EXTENDED           0x0008
    00048 #define PCRE_ANCHORED           0x0010
    00049 #define PCRE_DOLLAR_ENDONLY     0x0020
    00050 #define PCRE_EXTRA              0x0040
    00051 #define PCRE_NOTBOL             0x0080
    00052 #define PCRE_NOTEOL             0x0100
    00053 #define PCRE_UNGREEDY           0x0200
    00054 #define PCRE_NOTEMPTY           0x0400
    00055 #define PCRE_UTF8               0x0800
    00056 #define PCRE_NO_AUTO_CAPTURE    0x1000
    00057 #define PCRE_NO_UTF8_CHECK      0x2000
    00058 #define PCRE_AUTO_CALLOUT       0x4000
    00059 #define PCRE_PARTIAL            0x8000
    00060
    00061 /* Exec-time and get/set-time error codes */
    00062
    00063 #define PCRE_ERROR_NOMATCH         (-1)
    00064 #define PCRE_ERROR_NULL            (-2)
    00065 #define PCRE_ERROR_BADOPTION       (-3)
    00066 #define PCRE_ERROR_BADMAGIC        (-4)
    00067 #define PCRE_ERROR_UNKNOWN_NODE    (-5)
    00068 #define PCRE_ERROR_NOMEMORY        (-6)
    00069 #define PCRE_ERROR_NOSUBSTRING     (-7)
    00070 #define PCRE_ERROR_MATCHLIMIT      (-8)
    00071 #define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
    00072 #define PCRE_ERROR_BADUTF8        (-10)
    00073 #define PCRE_ERROR_BADUTF8_OFFSET (-11)
    00074 #define PCRE_ERROR_PARTIAL        (-12)
    00075 #define PCRE_ERROR_BADPARTIAL     (-13)
    00076 #define PCRE_ERROR_INTERNAL       (-14)
    00077 #define PCRE_ERROR_BADCOUNT       (-15)
    00078
    00079 /* Request types for pcre_fullinfo() */
    00080
    00081 #define PCRE_INFO_OPTIONS            0
    00082 #define PCRE_INFO_SIZE               1
    00083 #define PCRE_INFO_CAPTURECOUNT       2
    00084 #define PCRE_INFO_BACKREFMAX         3
    00085 #define PCRE_INFO_FIRSTBYTE          4
    00086 #define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
    00087 #define PCRE_INFO_FIRSTTABLE         5
    00088 #define PCRE_INFO_LASTLITERAL        6
    00089 #define PCRE_INFO_NAMEENTRYSIZE      7
    00090 #define PCRE_INFO_NAMECOUNT          8
    00091 #define PCRE_INFO_NAMETABLE          9
    00092 #define PCRE_INFO_STUDYSIZE         10
    00093 #define PCRE_INFO_DEFAULT_TABLES    11
    00094
    00095 /* Request types for pcre_config() */
    00096
    00097 #define PCRE_CONFIG_UTF8                    0
    00098 #define PCRE_CONFIG_NEWLINE                 1
    00099 #define PCRE_CONFIG_LINK_SIZE               2
    00100 #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
    00101 #define PCRE_CONFIG_MATCH_LIMIT             4
    00102 #define PCRE_CONFIG_STACKRECURSE            5
    00103 #define PCRE_CONFIG_UNICODE_PROPERTIES      6
    00104
    00105 /* Bit flags for the pcre_extra structure */
    00106
    00107 #define PCRE_EXTRA_STUDY_DATA          0x0001
    00108 #define PCRE_EXTRA_MATCH_LIMIT         0x0002
    00109 #define PCRE_EXTRA_CALLOUT_DATA        0x0004
    00110 #define PCRE_EXTRA_TABLES              0x0008
    00111
    00112 /* Types */
    00113
    00114 struct real_pcre;                 /* declaration; the definition is private  */
    00115 typedef struct real_pcre pcre;
    00116
    00117 /* The structure for passing additional data to pcre_exec(). This is defined in
    00118 such as way as to be extensible. Always add new fields at the end, in order to
    00119 remain compatible. */
    00120
    00121 typedef struct pcre_extra {
    00122   unsigned long int flags;        /* Bits for which fields are set */
    00123   void *study_data;               /* Opaque data from pcre_study() */
    00124   unsigned long int match_limit;  /* Maximum number of calls to match() */
    00125   void *callout_data;             /* Data passed back in callouts */
    00126   const unsigned char *tables;    /* Pointer to character tables */
    00127 } pcre_extra;
    00128
    00129 /* The structure for passing out data via the pcre_callout_function. We use a
    00130 structure so that new fields can be added on the end in future versions,
    00131 without changing the API of the function, thereby allowing old clients to work
    00132 without modification. */
    00133
    00134 typedef struct pcre_callout_block {
    00135   int          version;           /* Identifies version of block */
    00136   /* ------------------------ Version 0 ------------------------------- */
    00137   int          callout_number;    /* Number compiled into pattern */
    00138   int         *offset_vector;     /* The offset vector */
    00139   const char  *subject;           /* The subject being matched */
    00140   int          subject_length;    /* The length of the subject */
    00141   int          start_match;       /* Offset to start of this match attempt */
    00142   int          current_position;  /* Where we currently are in the subject */
    00143   int          capture_top;       /* Max current capture */
    00144   int          capture_last;      /* Most recently closed capture */
    00145   void        *callout_data;      /* Data passed in with the call */
    00146   /* ------------------- Added for Version 1 -------------------------- */
    00147   int          pattern_position;  /* Offset to next item in the pattern */
    00148   int          next_item_length;  /* Length of next item in the pattern */
    00149   /* ------------------------------------------------------------------ */
    00150 } pcre_callout_block;
    00151
    00152 /* Indirection for store get and free functions. These can be set to
    00153 alternative malloc/free functions if required. Special ones are used in the
    00154 non-recursive case for "frames". There is also an optional callout function
    00155 that is triggered by the (?) regex item. Some magic is required for Win32 DLL;
    00156 it is null on other OS. For Virtual Pascal, these have to be different again.
    00157 */
    00158
    00159 #ifndef VPCOMPAT
    00160 PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
    00161 PCRE_DATA_SCOPE void  (*pcre_free)(void *);
    00162 PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
    00163 PCRE_DATA_SCOPE void  (*pcre_stack_free)(void *);
    00164 PCRE_DATA_SCOPE int   (*pcre_callout)(pcre_callout_block *);
    00165 #else   /* VPCOMPAT */
    00166 extern void *pcre_malloc(size_t);
    00167 extern void  pcre_free(void *);
    00168 extern void *pcre_stack_malloc(size_t);
    00169 extern void  pcre_stack_free(void *);
    00170 extern int   pcre_callout(pcre_callout_block *);
    00171 #endif  /* VPCOMPAT */
    00172
    00173 /* Exported PCRE functions */
    00174
    00175 extern pcre *pcre_compile(const char *, int, const char **,
    00176               int *, const unsigned char *);
    00177 extern int  pcre_config(int, void *);
    00178 extern int  pcre_copy_named_substring(const pcre *, const char *,
    00179               int *, int, const char *, char *, int);
    00180 extern int  pcre_copy_substring(const char *, int *, int, int,
    00181               char *, int);
    00182 extern int  pcre_exec(const pcre *, const pcre_extra *,
    00183               const char *, int, int, int, int *, int);
    00184 extern void pcre_free_substring(const char *);
    00185 extern void pcre_free_substring_list(const char **);
    00186 extern int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
    00187               void *);
    00188 extern int  pcre_get_named_substring(const pcre *, const char *,
    00189               int *, int,  const char *, const char **);
    00190 extern int  pcre_get_stringnumber(const pcre *, const char *);
    00191 extern int  pcre_get_substring(const char *, int *, int, int,
    00192               const char **);
    00193 extern int  pcre_get_substring_list(const char *, int *, int,
    00194               const char ***);
    00195 extern int  pcre_info(const pcre *, int *, int *);
    00196 extern const unsigned char *pcre_maketables(void);
    00197 extern pcre_extra *pcre_study(const pcre *, int, const char **);
    00198 extern const char *pcre_version(void);
    00199
    00200 #ifdef __cplusplus
    00201 }  /* extern "C" */
    00202 #endif
    00203
    00204 #endif /* End of pcre.h */