3 |
*************************************************/ |
*************************************************/ |
4 |
|
|
5 |
|
|
|
#define PCRE_VERSION "2.01 21-Oct-1998" |
|
|
|
|
|
|
|
6 |
/* This is a library of functions to support regular expressions whose syntax |
/* This is a library of functions to support regular expressions whose syntax |
7 |
and semantics are as close as possible to those of the Perl 5 language. See |
and semantics are as close as possible to those of the Perl 5 language. See |
8 |
the file Tech.Notes for some information on the internals. |
the file Tech.Notes for some information on the internals. |
9 |
|
|
10 |
Written by: Philip Hazel <ph10@cam.ac.uk> |
Written by: Philip Hazel <ph10@cam.ac.uk> |
11 |
|
|
12 |
Copyright (c) 1998 University of Cambridge |
Copyright (c) 1997-1999 University of Cambridge |
13 |
|
|
14 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
15 |
Permission is granted to anyone to use this software for any purpose on any |
Permission is granted to anyone to use this software for any purpose on any |
25 |
|
|
26 |
3. Altered versions must be plainly marked as such, and must not be |
3. Altered versions must be plainly marked as such, and must not be |
27 |
misrepresented as being the original software. |
misrepresented as being the original software. |
28 |
|
|
29 |
|
4. If PCRE is embedded in any software that is released under the GNU |
30 |
|
General Purpose Licence (GPL), then the terms of that licence shall |
31 |
|
supersede any condition above with which it is incompatible. |
32 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
33 |
*/ |
*/ |
34 |
|
|
35 |
/* This header contains definitions that are shared between the different |
/* This header contains definitions that are shared between the different |
36 |
modules, but which are not relevant to the outside. */ |
modules, but which are not relevant to the outside. */ |
37 |
|
|
38 |
|
/* Get the definitions provided by running "configure" */ |
39 |
|
|
40 |
|
#include "config.h" |
41 |
|
|
42 |
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), |
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), |
43 |
define a macro for memmove() if USE_BCOPY is defined. */ |
define a macro for memmove() if HAVE_MEMMOVE is not defined. */ |
44 |
|
|
45 |
#ifdef USE_BCOPY |
#ifndef HAVE_MEMMOVE |
46 |
#undef memmove /* some systems may have a macro */ |
#undef memmove /* some systems may have a macro */ |
47 |
#define memmove(a, b, c) bcopy(b, a, c) |
#define memmove(a, b, c) bcopy(b, a, c) |
48 |
#endif |
#endif |
68 |
|
|
69 |
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) |
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) |
70 |
|
|
71 |
/* Private options flags start at the most significant end of the two bytes. |
/* Private options flags start at the most significant end of the four bytes, |
72 |
The public options defined in pcre.h start at the least significant end. Make |
but skip the top bit so we can use ints for convenience without getting tangled |
73 |
sure they don't overlap! */ |
with negative values. The public options defined in pcre.h start at the least |
74 |
|
significant end. Make sure they don't overlap, though now that we have expanded |
75 |
#define PCRE_FIRSTSET 0x8000 /* first_char is set */ |
to four bytes there is plenty of space. */ |
76 |
#define PCRE_STARTLINE 0x4000 /* start after \n for multiline */ |
|
77 |
#define PCRE_INGROUP 0x2000 /* compiling inside a group */ |
#define PCRE_FIRSTSET 0x40000000 /* first_char is set */ |
78 |
|
#define PCRE_REQCHSET 0x20000000 /* req_char is set */ |
79 |
|
#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */ |
80 |
|
#define PCRE_INGROUP 0x08000000 /* compiling inside a group */ |
81 |
|
#define PCRE_ICHANGED 0x04000000 /* i option changes within regex */ |
82 |
|
|
83 |
/* Options for the "extra" block produced by pcre_study(). */ |
/* Options for the "extra" block produced by pcre_study(). */ |
84 |
|
|
91 |
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ |
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ |
92 |
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY) |
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY) |
93 |
|
|
94 |
#define PUBLIC_EXEC_OPTIONS (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL) |
#define PUBLIC_EXEC_OPTIONS \ |
95 |
|
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY) |
96 |
|
|
97 |
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */ |
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */ |
98 |
|
|
99 |
/* Magic number to provide a small check against being handed junk. */ |
/* Magic number to provide a small check against being handed junk. */ |
100 |
|
|
101 |
#define MAGIC_NUMBER 0x50435245 /* 'PCRE' */ |
#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */ |
102 |
|
|
103 |
/* Miscellaneous definitions */ |
/* Miscellaneous definitions */ |
104 |
|
|
268 |
runs on as long as necessary after the end. */ |
runs on as long as necessary after the end. */ |
269 |
|
|
270 |
typedef struct real_pcre { |
typedef struct real_pcre { |
271 |
unsigned int magic_number; |
unsigned long int magic_number; |
272 |
const unsigned char *tables; |
const unsigned char *tables; |
273 |
unsigned short int options; |
unsigned long int options; |
274 |
unsigned char top_bracket; |
uschar top_bracket; |
275 |
unsigned char top_backref; |
uschar top_backref; |
276 |
unsigned char first_char; |
uschar first_char; |
277 |
unsigned char code[1]; |
uschar req_char; |
278 |
|
uschar code[1]; |
279 |
} real_pcre; |
} real_pcre; |
280 |
|
|
281 |
/* The real format of the extra block returned by pcre_study(). */ |
/* The real format of the extra block returned by pcre_study(). */ |
282 |
|
|
283 |
typedef struct real_pcre_extra { |
typedef struct real_pcre_extra { |
284 |
unsigned char options; |
uschar options; |
285 |
unsigned char start_bits[32]; |
uschar start_bits[32]; |
286 |
} real_pcre_extra; |
} real_pcre_extra; |
287 |
|
|
288 |
|
|
291 |
|
|
292 |
typedef struct compile_data { |
typedef struct compile_data { |
293 |
const uschar *lcc; /* Points to lower casing table */ |
const uschar *lcc; /* Points to lower casing table */ |
294 |
const uschar *fcc; /* Points to case-flippint table */ |
const uschar *fcc; /* Points to case-flipping table */ |
295 |
const uschar *cbits; /* Points to character type table */ |
const uschar *cbits; /* Points to character type table */ |
296 |
const uschar *ctypes; /* Points to table of type maps */ |
const uschar *ctypes; /* Points to table of type maps */ |
297 |
} compile_data; |
} compile_data; |
310 |
BOOL notbol; /* NOTBOL flag */ |
BOOL notbol; /* NOTBOL flag */ |
311 |
BOOL noteol; /* NOTEOL flag */ |
BOOL noteol; /* NOTEOL flag */ |
312 |
BOOL endonly; /* Dollar not before final \n */ |
BOOL endonly; /* Dollar not before final \n */ |
313 |
|
BOOL notempty; /* Empty string match not wanted */ |
314 |
const uschar *start_subject; /* Start of the subject string */ |
const uschar *start_subject; /* Start of the subject string */ |
315 |
const uschar *end_subject; /* End of the subject string */ |
const uschar *end_subject; /* End of the subject string */ |
316 |
|
const uschar *start_match; /* Start of this match attempt */ |
317 |
const uschar *end_match_ptr; /* Subject position at end match */ |
const uschar *end_match_ptr; /* Subject position at end match */ |
318 |
int end_offset_top; /* Highwater mark at end of match */ |
int end_offset_top; /* Highwater mark at end of match */ |
319 |
} match_data; |
} match_data; |