WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
pcre.h
1 /*************************************************
2 * Perl-Compatible Regular Expressions *
3 *************************************************/
4 
5 /* This is the public header file for the PCRE library, to be #included by
6 applications that call the PCRE functions.
7 
8  Copyright (c) 1997-2008 University of Cambridge
9 
10 -----------------------------------------------------------------------------
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16 
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20 
21  * Neither the name of the University of Cambridge nor the names of its
22  contributors may be used to endorse or promote products derived from
23  this software without specific prior written permission.
24 
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 POSSIBILITY OF SUCH DAMAGE.
36 -----------------------------------------------------------------------------
37 */
38 
39 #ifndef _PCRE_H
40 #define _PCRE_H
41 
42 /* The current PCRE version information. */
43 
44 #define PCRE_MAJOR 7
45 #define PCRE_MINOR 8
46 #define PCRE_PRERELEASE
47 #define PCRE_DATE 2008-09-05
48 
49 /* When an application links to a PCRE DLL in Windows, the symbols that are
50 imported have to be identified as such. When building PCRE, the appropriate
51 export setting is defined in pcre_internal.h, which includes this file. So we
52 don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
53 
63 #define PCRE_STATIC
64 
65 #if defined(_WIN32) && !defined(PCRE_STATIC)
66 # ifndef PCRE_EXP_DECL
67 # define PCRE_EXP_DECL extern __declspec(dllimport)
68 # endif
69 # ifdef __cplusplus
70 # ifndef PCRECPP_EXP_DECL
71 # define PCRECPP_EXP_DECL extern __declspec(dllimport)
72 # endif
73 # ifndef PCRECPP_EXP_DEFN
74 # define PCRECPP_EXP_DEFN __declspec(dllimport)
75 # endif
76 # endif
77 #endif
78 
79 /* By default, we use the standard "extern" declarations. */
80 
81 #ifndef PCRE_EXP_DECL
82 # ifdef __cplusplus
83 # define PCRE_EXP_DECL extern "C"
84 # else
85 # define PCRE_EXP_DECL extern
86 # endif
87 #endif
88 
89 #ifdef __cplusplus
90 # ifndef PCRECPP_EXP_DECL
91 # define PCRECPP_EXP_DECL extern
92 # endif
93 # ifndef PCRECPP_EXP_DEFN
94 # define PCRECPP_EXP_DEFN
95 # endif
96 #endif
97 
111 #ifndef PCRE_CALL_CONVENTION
112 # if defined(_WIN32) /* 32-bit and 64-bit */
113 # define PCRE_CALL_CONVENTION __cdecl
114 # else
115 # define PCRE_CALL_CONVENTION
116 # endif
117 #else
118 # define PCRE_CALL_CONVENTION
119 #endif
120 
121 /* Have to include stdlib.h in order to ensure that size_t is defined;
122 it is needed here for malloc. */
123 
124 #include <stdlib.h>
125 
126 /* Allow for C++ users */
127 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
132 /* Options */
133 
134 #define PCRE_CASELESS 0x00000001
135 #define PCRE_MULTILINE 0x00000002
136 #define PCRE_DOTALL 0x00000004
137 #define PCRE_EXTENDED 0x00000008
138 #define PCRE_ANCHORED 0x00000010
139 #define PCRE_DOLLAR_ENDONLY 0x00000020
140 #define PCRE_EXTRA 0x00000040
141 #define PCRE_NOTBOL 0x00000080
142 #define PCRE_NOTEOL 0x00000100
143 #define PCRE_UNGREEDY 0x00000200
144 #define PCRE_NOTEMPTY 0x00000400
145 #define PCRE_UTF8 0x00000800
146 #define PCRE_NO_AUTO_CAPTURE 0x00001000
147 #define PCRE_NO_UTF8_CHECK 0x00002000
148 #define PCRE_AUTO_CALLOUT 0x00004000
149 #define PCRE_PARTIAL 0x00008000
150 #define PCRE_DFA_SHORTEST 0x00010000
151 #define PCRE_DFA_RESTART 0x00020000
152 #define PCRE_FIRSTLINE 0x00040000
153 #define PCRE_DUPNAMES 0x00080000
154 #define PCRE_NEWLINE_CR 0x00100000
155 #define PCRE_NEWLINE_LF 0x00200000
156 #define PCRE_NEWLINE_CRLF 0x00300000
157 #define PCRE_NEWLINE_ANY 0x00400000
158 #define PCRE_NEWLINE_ANYCRLF 0x00500000
159 #define PCRE_BSR_ANYCRLF 0x00800000
160 #define PCRE_BSR_UNICODE 0x01000000
161 #define PCRE_JAVASCRIPT_COMPAT 0x02000000
162 
163 /* Exec-time and get/set-time error codes */
164 
165 #define PCRE_ERROR_NOMATCH (-1)
166 #define PCRE_ERROR_NULL (-2)
167 #define PCRE_ERROR_BADOPTION (-3)
168 #define PCRE_ERROR_BADMAGIC (-4)
169 #define PCRE_ERROR_UNKNOWN_OPCODE (-5)
170 #define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */
171 #define PCRE_ERROR_NOMEMORY (-6)
172 #define PCRE_ERROR_NOSUBSTRING (-7)
173 #define PCRE_ERROR_MATCHLIMIT (-8)
174 #define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */
175 #define PCRE_ERROR_BADUTF8 (-10)
176 #define PCRE_ERROR_BADUTF8_OFFSET (-11)
177 #define PCRE_ERROR_PARTIAL (-12)
178 #define PCRE_ERROR_BADPARTIAL (-13)
179 #define PCRE_ERROR_INTERNAL (-14)
180 #define PCRE_ERROR_BADCOUNT (-15)
181 #define PCRE_ERROR_DFA_UITEM (-16)
182 #define PCRE_ERROR_DFA_UCOND (-17)
183 #define PCRE_ERROR_DFA_UMLIMIT (-18)
184 #define PCRE_ERROR_DFA_WSSIZE (-19)
185 #define PCRE_ERROR_DFA_RECURSE (-20)
186 #define PCRE_ERROR_RECURSIONLIMIT (-21)
187 #define PCRE_ERROR_NULLWSLIMIT (-22) /* No longer actually used */
188 #define PCRE_ERROR_BADNEWLINE (-23)
189 
190 /* Request types for pcre_fullinfo() */
191 
192 #define PCRE_INFO_OPTIONS 0
193 #define PCRE_INFO_SIZE 1
194 #define PCRE_INFO_CAPTURECOUNT 2
195 #define PCRE_INFO_BACKREFMAX 3
196 #define PCRE_INFO_FIRSTBYTE 4
197 #define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */
198 #define PCRE_INFO_FIRSTTABLE 5
199 #define PCRE_INFO_LASTLITERAL 6
200 #define PCRE_INFO_NAMEENTRYSIZE 7
201 #define PCRE_INFO_NAMECOUNT 8
202 #define PCRE_INFO_NAMETABLE 9
203 #define PCRE_INFO_STUDYSIZE 10
204 #define PCRE_INFO_DEFAULT_TABLES 11
205 #define PCRE_INFO_OKPARTIAL 12
206 #define PCRE_INFO_JCHANGED 13
207 #define PCRE_INFO_HASCRORLF 14
208 
209 /* Request types for pcre_config(). Do not re-arrange, in order to remain
210 compatible. */
211 
212 #define PCRE_CONFIG_UTF8 0
213 #define PCRE_CONFIG_NEWLINE 1
214 #define PCRE_CONFIG_LINK_SIZE 2
215 #define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3
216 #define PCRE_CONFIG_MATCH_LIMIT 4
217 #define PCRE_CONFIG_STACKRECURSE 5
218 #define PCRE_CONFIG_UNICODE_PROPERTIES 6
219 #define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7
220 #define PCRE_CONFIG_BSR 8
221 
222 /* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
223 these bits, just add new ones on the end, in order to remain compatible. */
224 
225 #define PCRE_EXTRA_STUDY_DATA 0x0001
226 #define PCRE_EXTRA_MATCH_LIMIT 0x0002
227 #define PCRE_EXTRA_CALLOUT_DATA 0x0004
228 #define PCRE_EXTRA_TABLES 0x0008
229 #define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0x0010
230 
231 /* Types */
232 
233 struct real_pcre; /* declaration; the definition is private */
234 typedef struct real_pcre pcre;
235 
236 /* When PCRE is compiled as a C++ library, the subject pointer type can be
237 replaced with a custom type. For conventional use, the public interface is a
238 const char *. */
239 
240 #ifndef PCRE_SPTR
241 #define PCRE_SPTR const char *
242 #endif
243 
244 /* The structure for passing additional data to pcre_exec(). This is defined in
245 such as way as to be extensible. Always add new fields at the end, in order to
246 remain compatible. */
247 
248 typedef struct pcre_extra {
249  unsigned long int flags; /* Bits for which fields are set */
250  void *study_data; /* Opaque data from pcre_study() */
251  unsigned long int match_limit; /* Maximum number of calls to match() */
252  void *callout_data; /* Data passed back in callouts */
253  const unsigned char *tables; /* Pointer to character tables */
254  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
255 } pcre_extra;
256 
257 /* The structure for passing out data via the pcre_callout_function. We use a
258 structure so that new fields can be added on the end in future versions,
259 without changing the API of the function, thereby allowing old clients to work
260 without modification. */
261 
262 typedef struct pcre_callout_block {
263  int version; /* Identifies version of block */
264  /* ------------------------ Version 0 ------------------------------- */
265  int callout_number; /* Number compiled into pattern */
266  int *offset_vector; /* The offset vector */
267  PCRE_SPTR subject; /* The subject being matched */
268  int subject_length; /* The length of the subject */
269  int start_match; /* Offset to start of this match attempt */
270  int current_position; /* Where we currently are in the subject */
271  int capture_top; /* Max current capture */
272  int capture_last; /* Most recently closed capture */
273  void *callout_data; /* Data passed in with the call */
274  /* ------------------- Added for Version 1 -------------------------- */
275  int pattern_position; /* Offset to next item in the pattern */
276  int next_item_length; /* Length of next item in the pattern */
277  /* ------------------------------------------------------------------ */
279 
280 /* Indirection for store get and free functions. These can be set to
281 alternative malloc/free functions if required. Special ones are used in the
282 non-recursive case for "frames". There is also an optional callout function
283 that is triggered by the (?) regex item. For Virtual Pascal, these definitions
284 have to take another form. */
285 
286 #ifndef VPCOMPAT
287 PCRE_EXP_DECL void* (PCRE_CALL_CONVENTION *pcre_malloc)(size_t);
288 PCRE_EXP_DECL void (PCRE_CALL_CONVENTION *pcre_free)(void *);
289 PCRE_EXP_DECL void* (PCRE_CALL_CONVENTION *pcre_stack_malloc)(size_t);
290 PCRE_EXP_DECL void (PCRE_CALL_CONVENTION *pcre_stack_free)(void *);
291 PCRE_EXP_DECL int (PCRE_CALL_CONVENTION *pcre_callout)(pcre_callout_block *);
292 #else /* VPCOMPAT */
293 PCRE_EXP_DECL void* PCRE_CALL_CONVENTION pcre_malloc(size_t);
294 PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free(void *);
295 PCRE_EXP_DECL void* PCRE_CALL_CONVENTION pcre_stack_malloc(size_t);
296 PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_stack_free(void *);
297 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_callout(pcre_callout_block *);
298 #endif /* VPCOMPAT */
299 
300 /* Exported PCRE functions */
301 
302 PCRE_EXP_DECL pcre* PCRE_CALL_CONVENTION pcre_compile(const char *, int, const char **, int *,
303  const unsigned char *);
304 PCRE_EXP_DECL pcre* PCRE_CALL_CONVENTION pcre_compile2(const char *, int, int *, const char **,
305  int *, const unsigned char *);
306 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_config(int, void *);
307 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_copy_named_substring(const pcre *, const char *,
308  int *, int, const char *, char *, int);
309 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_copy_substring(const char *, int *, int, int, char *,
310  int);
311 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_dfa_exec(const pcre *, const pcre_extra *,
312  const char *, int, int, int, int *, int , int *, int);
313 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
314  int, int, int, int *, int);
315 PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free_substring(const char *);
316 PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free_substring_list(const char **);
317 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_fullinfo(const pcre *, const pcre_extra *, int,
318  void *);
319 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_get_named_substring(const pcre *, const char *,
320  int *, int, const char *, const char **);
321 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_get_stringnumber(const pcre *, const char *);
322 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_get_stringtable_entries(const pcre *, const char *,
323  char **, char **);
324 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_get_substring(const char *, int *, int, int,
325  const char **);
326 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_get_substring_list(const char *, int *, int,
327  const char ***);
328 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_info(const pcre *, int *, int *);
329 PCRE_EXP_DECL const unsigned char* PCRE_CALL_CONVENTION pcre_maketables(void);
330 PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_refcount(pcre *, int);
331 PCRE_EXP_DECL pcre_extra* PCRE_CALL_CONVENTION pcre_study(const pcre *, int, const char **);
332 PCRE_EXP_DECL const char* PCRE_CALL_CONVENTION pcre_version(void);
333 
334 #ifdef __cplusplus
335 } /* extern "C" */
336 #endif
337 
338 #endif /* End of pcre.h */
Definition: pcre.h:262
Definition: pcre.h:248