WPILib 2012
WPILibRoboticsLibraryforFRC
pcre.h
00001 /*************************************************
00002 *       Perl-Compatible Regular Expressions      *
00003 *************************************************/
00004 
00005 /* This is the public header file for the PCRE library, to be #included by
00006 applications that call the PCRE functions.
00007 
00008            Copyright (c) 1997-2008 University of Cambridge
00009 
00010 -----------------------------------------------------------------------------
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014     * Redistributions of source code must retain the above copyright notice,
00015       this list of conditions and the following disclaimer.
00016 
00017     * Redistributions in binary form must reproduce the above copyright
00018       notice, this list of conditions and the following disclaimer in the
00019       documentation and/or other materials provided with the distribution.
00020 
00021     * Neither the name of the University of Cambridge nor the names of its
00022       contributors may be used to endorse or promote products derived from
00023       this software without specific prior written permission.
00024 
00025 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00028 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00029 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00030 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00031 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00032 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00033 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035 POSSIBILITY OF SUCH DAMAGE.
00036 -----------------------------------------------------------------------------
00037 */
00038 
00039 #ifndef _PCRE_H
00040 #define _PCRE_H
00041 
00042 /* The current PCRE version information. */
00043 
00044 #define PCRE_MAJOR          7
00045 #define PCRE_MINOR          8
00046 #define PCRE_PRERELEASE     
00047 #define PCRE_DATE           2008-09-05
00048 
00049 /* When an application links to a PCRE DLL in Windows, the symbols that are
00050 imported have to be identified as such. When building PCRE, the appropriate
00051 export setting is defined in pcre_internal.h, which includes this file. So we
00052 don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
00053 
00063 #define PCRE_STATIC
00064 
00065 #if defined(_WIN32) && !defined(PCRE_STATIC)
00066 #  ifndef PCRE_EXP_DECL
00067 #    define PCRE_EXP_DECL  extern __declspec(dllimport)
00068 #  endif
00069 #  ifdef __cplusplus
00070 #    ifndef PCRECPP_EXP_DECL
00071 #      define PCRECPP_EXP_DECL  extern __declspec(dllimport)
00072 #    endif
00073 #    ifndef PCRECPP_EXP_DEFN
00074 #      define PCRECPP_EXP_DEFN  __declspec(dllimport)
00075 #    endif
00076 #  endif
00077 #endif
00078 
00079 /* By default, we use the standard "extern" declarations. */
00080 
00081 #ifndef PCRE_EXP_DECL
00082 #  ifdef __cplusplus
00083 #    define PCRE_EXP_DECL  extern "C"
00084 #  else
00085 #    define PCRE_EXP_DECL  extern
00086 #  endif
00087 #endif
00088 
00089 #ifdef __cplusplus
00090 #  ifndef PCRECPP_EXP_DECL
00091 #    define PCRECPP_EXP_DECL  extern
00092 #  endif
00093 #  ifndef PCRECPP_EXP_DEFN
00094 #    define PCRECPP_EXP_DEFN
00095 #  endif
00096 #endif
00097 
00111 #ifndef PCRE_CALL_CONVENTION
00112 #  if defined(_WIN32) /* 32-bit and 64-bit */
00113 #    define PCRE_CALL_CONVENTION __cdecl
00114 #  else
00115 #    define PCRE_CALL_CONVENTION
00116 #  endif
00117 #else
00118 #  define PCRE_CALL_CONVENTION
00119 #endif
00120 
00121 /* Have to include stdlib.h in order to ensure that size_t is defined;
00122 it is needed here for malloc. */
00123 
00124 #include <stdlib.h>
00125 
00126 /* Allow for C++ users */
00127 
00128 #ifdef __cplusplus
00129 extern "C" {
00130 #endif
00131 
00132 /* Options */
00133 
00134 #define PCRE_CASELESS           0x00000001
00135 #define PCRE_MULTILINE          0x00000002
00136 #define PCRE_DOTALL             0x00000004
00137 #define PCRE_EXTENDED           0x00000008
00138 #define PCRE_ANCHORED           0x00000010
00139 #define PCRE_DOLLAR_ENDONLY     0x00000020
00140 #define PCRE_EXTRA              0x00000040
00141 #define PCRE_NOTBOL             0x00000080
00142 #define PCRE_NOTEOL             0x00000100
00143 #define PCRE_UNGREEDY           0x00000200
00144 #define PCRE_NOTEMPTY           0x00000400
00145 #define PCRE_UTF8               0x00000800
00146 #define PCRE_NO_AUTO_CAPTURE    0x00001000
00147 #define PCRE_NO_UTF8_CHECK      0x00002000
00148 #define PCRE_AUTO_CALLOUT       0x00004000
00149 #define PCRE_PARTIAL            0x00008000
00150 #define PCRE_DFA_SHORTEST       0x00010000
00151 #define PCRE_DFA_RESTART        0x00020000
00152 #define PCRE_FIRSTLINE          0x00040000
00153 #define PCRE_DUPNAMES           0x00080000
00154 #define PCRE_NEWLINE_CR         0x00100000
00155 #define PCRE_NEWLINE_LF         0x00200000
00156 #define PCRE_NEWLINE_CRLF       0x00300000
00157 #define PCRE_NEWLINE_ANY        0x00400000
00158 #define PCRE_NEWLINE_ANYCRLF    0x00500000
00159 #define PCRE_BSR_ANYCRLF        0x00800000
00160 #define PCRE_BSR_UNICODE        0x01000000
00161 #define PCRE_JAVASCRIPT_COMPAT  0x02000000
00162 
00163 /* Exec-time and get/set-time error codes */
00164 
00165 #define PCRE_ERROR_NOMATCH         (-1)
00166 #define PCRE_ERROR_NULL            (-2)
00167 #define PCRE_ERROR_BADOPTION       (-3)
00168 #define PCRE_ERROR_BADMAGIC        (-4)
00169 #define PCRE_ERROR_UNKNOWN_OPCODE  (-5)
00170 #define PCRE_ERROR_UNKNOWN_NODE    (-5)  /* For backward compatibility */
00171 #define PCRE_ERROR_NOMEMORY        (-6)
00172 #define PCRE_ERROR_NOSUBSTRING     (-7)
00173 #define PCRE_ERROR_MATCHLIMIT      (-8)
00174 #define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
00175 #define PCRE_ERROR_BADUTF8        (-10)
00176 #define PCRE_ERROR_BADUTF8_OFFSET (-11)
00177 #define PCRE_ERROR_PARTIAL        (-12)
00178 #define PCRE_ERROR_BADPARTIAL     (-13)
00179 #define PCRE_ERROR_INTERNAL       (-14)
00180 #define PCRE_ERROR_BADCOUNT       (-15)
00181 #define PCRE_ERROR_DFA_UITEM      (-16)
00182 #define PCRE_ERROR_DFA_UCOND      (-17)
00183 #define PCRE_ERROR_DFA_UMLIMIT    (-18)
00184 #define PCRE_ERROR_DFA_WSSIZE     (-19)
00185 #define PCRE_ERROR_DFA_RECURSE    (-20)
00186 #define PCRE_ERROR_RECURSIONLIMIT (-21)
00187 #define PCRE_ERROR_NULLWSLIMIT    (-22)  /* No longer actually used */
00188 #define PCRE_ERROR_BADNEWLINE     (-23)
00189 
00190 /* Request types for pcre_fullinfo() */
00191 
00192 #define PCRE_INFO_OPTIONS            0
00193 #define PCRE_INFO_SIZE               1
00194 #define PCRE_INFO_CAPTURECOUNT       2
00195 #define PCRE_INFO_BACKREFMAX         3
00196 #define PCRE_INFO_FIRSTBYTE          4
00197 #define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
00198 #define PCRE_INFO_FIRSTTABLE         5
00199 #define PCRE_INFO_LASTLITERAL        6
00200 #define PCRE_INFO_NAMEENTRYSIZE      7
00201 #define PCRE_INFO_NAMECOUNT          8
00202 #define PCRE_INFO_NAMETABLE          9
00203 #define PCRE_INFO_STUDYSIZE         10
00204 #define PCRE_INFO_DEFAULT_TABLES    11
00205 #define PCRE_INFO_OKPARTIAL         12
00206 #define PCRE_INFO_JCHANGED          13
00207 #define PCRE_INFO_HASCRORLF         14
00208 
00209 /* Request types for pcre_config(). Do not re-arrange, in order to remain
00210 compatible. */
00211 
00212 #define PCRE_CONFIG_UTF8                    0
00213 #define PCRE_CONFIG_NEWLINE                 1
00214 #define PCRE_CONFIG_LINK_SIZE               2
00215 #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
00216 #define PCRE_CONFIG_MATCH_LIMIT             4
00217 #define PCRE_CONFIG_STACKRECURSE            5
00218 #define PCRE_CONFIG_UNICODE_PROPERTIES      6
00219 #define PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
00220 #define PCRE_CONFIG_BSR                     8
00221 
00222 /* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
00223 these bits, just add new ones on the end, in order to remain compatible. */
00224 
00225 #define PCRE_EXTRA_STUDY_DATA             0x0001
00226 #define PCRE_EXTRA_MATCH_LIMIT            0x0002
00227 #define PCRE_EXTRA_CALLOUT_DATA           0x0004
00228 #define PCRE_EXTRA_TABLES                 0x0008
00229 #define PCRE_EXTRA_MATCH_LIMIT_RECURSION  0x0010
00230 
00231 /* Types */
00232 
00233 struct real_pcre;                 /* declaration; the definition is private  */
00234 typedef struct real_pcre pcre;
00235 
00236 /* When PCRE is compiled as a C++ library, the subject pointer type can be
00237 replaced with a custom type. For conventional use, the public interface is a
00238 const char *. */
00239 
00240 #ifndef PCRE_SPTR
00241 #define PCRE_SPTR const char *
00242 #endif
00243 
00244 /* The structure for passing additional data to pcre_exec(). This is defined in
00245 such as way as to be extensible. Always add new fields at the end, in order to
00246 remain compatible. */
00247 
00248 typedef struct pcre_extra {
00249   unsigned long int flags;        /* Bits for which fields are set */
00250   void *study_data;               /* Opaque data from pcre_study() */
00251   unsigned long int match_limit;  /* Maximum number of calls to match() */
00252   void *callout_data;             /* Data passed back in callouts */
00253   const unsigned char *tables;    /* Pointer to character tables */
00254   unsigned long int match_limit_recursion; /* Max recursive calls to match() */
00255 } pcre_extra;
00256 
00257 /* The structure for passing out data via the pcre_callout_function. We use a
00258 structure so that new fields can be added on the end in future versions,
00259 without changing the API of the function, thereby allowing old clients to work
00260 without modification. */
00261 
00262 typedef struct pcre_callout_block {
00263   int          version;           /* Identifies version of block */
00264   /* ------------------------ Version 0 ------------------------------- */
00265   int          callout_number;    /* Number compiled into pattern */
00266   int         *offset_vector;     /* The offset vector */
00267   PCRE_SPTR    subject;           /* The subject being matched */
00268   int          subject_length;    /* The length of the subject */
00269   int          start_match;       /* Offset to start of this match attempt */
00270   int          current_position;  /* Where we currently are in the subject */
00271   int          capture_top;       /* Max current capture */
00272   int          capture_last;      /* Most recently closed capture */
00273   void        *callout_data;      /* Data passed in with the call */
00274   /* ------------------- Added for Version 1 -------------------------- */
00275   int          pattern_position;  /* Offset to next item in the pattern */
00276   int          next_item_length;  /* Length of next item in the pattern */
00277   /* ------------------------------------------------------------------ */
00278 } pcre_callout_block;
00279 
00280 /* Indirection for store get and free functions. These can be set to
00281 alternative malloc/free functions if required. Special ones are used in the
00282 non-recursive case for "frames". There is also an optional callout function
00283 that is triggered by the (?) regex item. For Virtual Pascal, these definitions
00284 have to take another form. */
00285 
00286 #ifndef VPCOMPAT
00287 PCRE_EXP_DECL void* (PCRE_CALL_CONVENTION *pcre_malloc)(size_t);
00288 PCRE_EXP_DECL void  (PCRE_CALL_CONVENTION *pcre_free)(void *);
00289 PCRE_EXP_DECL void* (PCRE_CALL_CONVENTION *pcre_stack_malloc)(size_t);
00290 PCRE_EXP_DECL void  (PCRE_CALL_CONVENTION *pcre_stack_free)(void *);
00291 PCRE_EXP_DECL int   (PCRE_CALL_CONVENTION *pcre_callout)(pcre_callout_block *);
00292 #else   /* VPCOMPAT */
00293 PCRE_EXP_DECL void* PCRE_CALL_CONVENTION pcre_malloc(size_t);
00294 PCRE_EXP_DECL void  PCRE_CALL_CONVENTION pcre_free(void *);
00295 PCRE_EXP_DECL void* PCRE_CALL_CONVENTION pcre_stack_malloc(size_t);
00296 PCRE_EXP_DECL void  PCRE_CALL_CONVENTION pcre_stack_free(void *);
00297 PCRE_EXP_DECL int   PCRE_CALL_CONVENTION pcre_callout(pcre_callout_block *);
00298 #endif  /* VPCOMPAT */
00299 
00300 /* Exported PCRE functions */
00301 
00302 PCRE_EXP_DECL pcre* PCRE_CALL_CONVENTION pcre_compile(const char *, int, const char **, int *,
00303                   const unsigned char *);
00304 PCRE_EXP_DECL pcre* PCRE_CALL_CONVENTION pcre_compile2(const char *, int, int *, const char **,
00305                   int *, const unsigned char *);
00306 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_config(int, void *);
00307 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_copy_named_substring(const pcre *, const char *,
00308                   int *, int, const char *, char *, int);
00309 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_copy_substring(const char *, int *, int, int, char *,
00310                   int);
00311 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_dfa_exec(const pcre *, const pcre_extra *,
00312                   const char *, int, int, int, int *, int , int *, int);
00313 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
00314                    int, int, int, int *, int);
00315 PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free_substring(const char *);
00316 PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free_substring_list(const char **);
00317 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_fullinfo(const pcre *, const pcre_extra *, int,
00318                   void *);
00319 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_get_named_substring(const pcre *, const char *,
00320                   int *, int, const char *, const char **);
00321 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_get_stringnumber(const pcre *, const char *);
00322 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_get_stringtable_entries(const pcre *, const char *,
00323                   char **, char **);
00324 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_get_substring(const char *, int *, int, int,
00325                   const char **);
00326 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_get_substring_list(const char *, int *, int,
00327                   const char ***);
00328 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_info(const pcre *, int *, int *);
00329 PCRE_EXP_DECL const unsigned char* PCRE_CALL_CONVENTION pcre_maketables(void);
00330 PCRE_EXP_DECL int  PCRE_CALL_CONVENTION pcre_refcount(pcre *, int);
00331 PCRE_EXP_DECL pcre_extra* PCRE_CALL_CONVENTION pcre_study(const pcre *, int, const char **);
00332 PCRE_EXP_DECL const char* PCRE_CALL_CONVENTION pcre_version(void);
00333 
00334 #ifdef __cplusplus
00335 }  /* extern "C" */
00336 #endif
00337 
00338 #endif /* End of pcre.h */
 All Classes Functions Variables