Tidy up "make" output along the lines of a 2.6 kernel make (just a short
[exim.git] / src / src / pcre / pcre.h
CommitLineData
c86f6258
PH
1/*************************************************
2* Perl-Compatible Regular Expressions *
3*************************************************/
4
5/* In its original form, this is the .in file that is transformed by
6"configure" into pcre.h.
7
8 Copyright (c) 1997-2004 University of Cambridge
9
10-----------------------------------------------------------------------------
11Redistribution and use in source and binary forms, with or without
12modification, 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
25THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35POSSIBILITY OF SUCH DAMAGE.
36-----------------------------------------------------------------------------
37*/
38
39#ifndef _PCRE_H
40#define _PCRE_H
41
42/* The file pcre.h is build by "configure". Do not edit it; instead
43make changes to pcre.in. */
44
45#define PCRE_MAJOR 5
46#define PCRE_MINOR 0
47#define PCRE_DATE 13-Sep-2004
48
49/* Win32 uses DLL by default */
50
51#ifdef _WIN32
52# ifdef PCRE_DEFINITION
53# ifdef DLL_EXPORT
54# define PCRE_DATA_SCOPE __declspec(dllexport)
55# endif
56# else
57# ifndef PCRE_STATIC
58# define PCRE_DATA_SCOPE extern __declspec(dllimport)
59# endif
60# endif
61#endif
62#ifndef PCRE_DATA_SCOPE
63# define PCRE_DATA_SCOPE extern
64#endif
65
66/* Have to include stdlib.h in order to ensure that size_t is defined;
67it is needed here for malloc. */
68
69#include <stdlib.h>
70
71/* Allow for C++ users */
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77/* Options */
78
79#define PCRE_CASELESS 0x0001
80#define PCRE_MULTILINE 0x0002
81#define PCRE_DOTALL 0x0004
82#define PCRE_EXTENDED 0x0008
83#define PCRE_ANCHORED 0x0010
84#define PCRE_DOLLAR_ENDONLY 0x0020
85#define PCRE_EXTRA 0x0040
86#define PCRE_NOTBOL 0x0080
87#define PCRE_NOTEOL 0x0100
88#define PCRE_UNGREEDY 0x0200
89#define PCRE_NOTEMPTY 0x0400
90#define PCRE_UTF8 0x0800
91#define PCRE_NO_AUTO_CAPTURE 0x1000
92#define PCRE_NO_UTF8_CHECK 0x2000
93#define PCRE_AUTO_CALLOUT 0x4000
94#define PCRE_PARTIAL 0x8000
95
96/* Exec-time and get/set-time error codes */
97
98#define PCRE_ERROR_NOMATCH (-1)
99#define PCRE_ERROR_NULL (-2)
100#define PCRE_ERROR_BADOPTION (-3)
101#define PCRE_ERROR_BADMAGIC (-4)
102#define PCRE_ERROR_UNKNOWN_NODE (-5)
103#define PCRE_ERROR_NOMEMORY (-6)
104#define PCRE_ERROR_NOSUBSTRING (-7)
105#define PCRE_ERROR_MATCHLIMIT (-8)
106#define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */
107#define PCRE_ERROR_BADUTF8 (-10)
108#define PCRE_ERROR_BADUTF8_OFFSET (-11)
109#define PCRE_ERROR_PARTIAL (-12)
110#define PCRE_ERROR_BADPARTIAL (-13)
111#define PCRE_ERROR_INTERNAL (-14)
112#define PCRE_ERROR_BADCOUNT (-15)
113
114/* Request types for pcre_fullinfo() */
115
116#define PCRE_INFO_OPTIONS 0
117#define PCRE_INFO_SIZE 1
118#define PCRE_INFO_CAPTURECOUNT 2
119#define PCRE_INFO_BACKREFMAX 3
120#define PCRE_INFO_FIRSTBYTE 4
121#define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */
122#define PCRE_INFO_FIRSTTABLE 5
123#define PCRE_INFO_LASTLITERAL 6
124#define PCRE_INFO_NAMEENTRYSIZE 7
125#define PCRE_INFO_NAMECOUNT 8
126#define PCRE_INFO_NAMETABLE 9
127#define PCRE_INFO_STUDYSIZE 10
128#define PCRE_INFO_DEFAULT_TABLES 11
129
130/* Request types for pcre_config() */
131
132#define PCRE_CONFIG_UTF8 0
133#define PCRE_CONFIG_NEWLINE 1
134#define PCRE_CONFIG_LINK_SIZE 2
135#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3
136#define PCRE_CONFIG_MATCH_LIMIT 4
137#define PCRE_CONFIG_STACKRECURSE 5
138#define PCRE_CONFIG_UNICODE_PROPERTIES 6
139
140/* Bit flags for the pcre_extra structure */
141
142#define PCRE_EXTRA_STUDY_DATA 0x0001
143#define PCRE_EXTRA_MATCH_LIMIT 0x0002
144#define PCRE_EXTRA_CALLOUT_DATA 0x0004
145#define PCRE_EXTRA_TABLES 0x0008
146
147/* Types */
148
149struct real_pcre; /* declaration; the definition is private */
150typedef struct real_pcre pcre;
151
152/* The structure for passing additional data to pcre_exec(). This is defined in
153such as way as to be extensible. Always add new fields at the end, in order to
154remain compatible. */
155
156typedef struct pcre_extra {
157 unsigned long int flags; /* Bits for which fields are set */
158 void *study_data; /* Opaque data from pcre_study() */
159 unsigned long int match_limit; /* Maximum number of calls to match() */
160 void *callout_data; /* Data passed back in callouts */
161 const unsigned char *tables; /* Pointer to character tables */
162} pcre_extra;
163
164/* The structure for passing out data via the pcre_callout_function. We use a
165structure so that new fields can be added on the end in future versions,
166without changing the API of the function, thereby allowing old clients to work
167without modification. */
168
169typedef struct pcre_callout_block {
170 int version; /* Identifies version of block */
171 /* ------------------------ Version 0 ------------------------------- */
172 int callout_number; /* Number compiled into pattern */
173 int *offset_vector; /* The offset vector */
174 const char *subject; /* The subject being matched */
175 int subject_length; /* The length of the subject */
176 int start_match; /* Offset to start of this match attempt */
177 int current_position; /* Where we currently are in the subject */
178 int capture_top; /* Max current capture */
179 int capture_last; /* Most recently closed capture */
180 void *callout_data; /* Data passed in with the call */
181 /* ------------------- Added for Version 1 -------------------------- */
182 int pattern_position; /* Offset to next item in the pattern */
183 int next_item_length; /* Length of next item in the pattern */
184 /* ------------------------------------------------------------------ */
185} pcre_callout_block;
186
187/* Indirection for store get and free functions. These can be set to
188alternative malloc/free functions if required. Special ones are used in the
189non-recursive case for "frames". There is also an optional callout function
190that is triggered by the (?) regex item. Some magic is required for Win32 DLL;
191it is null on other OS. For Virtual Pascal, these have to be different again.
192*/
193
194#ifndef VPCOMPAT
195PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
196PCRE_DATA_SCOPE void (*pcre_free)(void *);
197PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
198PCRE_DATA_SCOPE void (*pcre_stack_free)(void *);
199PCRE_DATA_SCOPE int (*pcre_callout)(pcre_callout_block *);
200#else /* VPCOMPAT */
201extern void *pcre_malloc(size_t);
202extern void pcre_free(void *);
203extern void *pcre_stack_malloc(size_t);
204extern void pcre_stack_free(void *);
205extern int pcre_callout(pcre_callout_block *);
206#endif /* VPCOMPAT */
207
208/* Exported PCRE functions */
209
210extern pcre *pcre_compile(const char *, int, const char **,
211 int *, const unsigned char *);
212extern int pcre_config(int, void *);
213extern int pcre_copy_named_substring(const pcre *, const char *,
214 int *, int, const char *, char *, int);
215extern int pcre_copy_substring(const char *, int *, int, int,
216 char *, int);
217extern int pcre_exec(const pcre *, const pcre_extra *,
218 const char *, int, int, int, int *, int);
219extern void pcre_free_substring(const char *);
220extern void pcre_free_substring_list(const char **);
221extern int pcre_fullinfo(const pcre *, const pcre_extra *, int,
222 void *);
223extern int pcre_get_named_substring(const pcre *, const char *,
224 int *, int, const char *, const char **);
225extern int pcre_get_stringnumber(const pcre *, const char *);
226extern int pcre_get_substring(const char *, int *, int, int,
227 const char **);
228extern int pcre_get_substring_list(const char *, int *, int,
229 const char ***);
230extern int pcre_info(const pcre *, int *, int *);
231extern const unsigned char *pcre_maketables(void);
232extern pcre_extra *pcre_study(const pcre *, int, const char **);
233extern const char *pcre_version(void);
234
235#ifdef __cplusplus
236} /* extern "C" */
237#endif
238
239#endif /* End of pcre.h */