pcre.h

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

Generated on Wed May 31 18:19:59 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6