Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

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

Generated on Sun May 14 14:51:20 2006 by  doxygen 1.4.2