114 |
|
|
115 |
typedef unsigned char uschar; |
typedef unsigned char uschar; |
116 |
|
|
117 |
|
/* PCRE is able to support 3 different kinds of newline (CR, LF, CRLF). The |
118 |
|
following macro is used to package up testing for newlines. NLBLOCK is defined |
119 |
|
in the various modules to indicate in which datablock the parameters exist. */ |
120 |
|
|
121 |
|
#define IS_NEWLINE(p) \ |
122 |
|
((p)[0] == NLBLOCK->nl[0] && \ |
123 |
|
(NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1])) |
124 |
|
|
125 |
/* When PCRE is compiled as a C++ library, the subject pointer can be replaced |
/* When PCRE is compiled as a C++ library, the subject pointer can be replaced |
126 |
with a custom type. This makes it possible, for example, to allow pcre_exec() |
with a custom type. This makes it possible, for example, to allow pcre_exec() |
127 |
to process subject strings that are discontinuous by using a smart pointer |
to process subject strings that are discontinuous by using a smart pointer |
168 |
#if HAVE_BCOPY |
#if HAVE_BCOPY |
169 |
#define memmove(a, b, c) bcopy(b, a, c) |
#define memmove(a, b, c) bcopy(b, a, c) |
170 |
#else /* HAVE_BCOPY */ |
#else /* HAVE_BCOPY */ |
171 |
void * |
static void * |
172 |
pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n) |
pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n) |
173 |
{ |
{ |
174 |
size_t i; |
size_t i; |
381 |
|
|
382 |
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) |
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL) |
383 |
|
|
384 |
/* Private options flags start at the most significant end of the four bytes, |
/* Private options flags start at the most significant end of the four bytes. |
385 |
but skip the top bit so we can use ints for convenience without getting tangled |
The public options defined in pcre.h start at the least significant end. Make |
386 |
with negative values. The public options defined in pcre.h start at the least |
sure they don't overlap! The bits are getting a bit scarce now -- when we run |
387 |
significant end. Make sure they don't overlap! */ |
out, there is a dummy word in the structure that could be used for the private |
388 |
|
bits. */ |
389 |
|
|
390 |
|
#define PCRE_NOPARTIAL 0x80000000 /* can't use partial with this regex */ |
391 |
#define PCRE_FIRSTSET 0x40000000 /* first_byte is set */ |
#define PCRE_FIRSTSET 0x40000000 /* first_byte is set */ |
392 |
#define PCRE_REQCHSET 0x20000000 /* req_byte is set */ |
#define PCRE_REQCHSET 0x20000000 /* req_byte is set */ |
393 |
#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */ |
#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */ |
394 |
#define PCRE_ICHANGED 0x08000000 /* i option changes within regex */ |
#define PCRE_JCHANGED 0x08000000 /* j option changes within regex */ |
|
#define PCRE_NOPARTIAL 0x04000000 /* can't use partial with this regex */ |
|
395 |
|
|
396 |
/* Options for the "extra" block produced by pcre_study(). */ |
/* Options for the "extra" block produced by pcre_study(). */ |
397 |
|
|
403 |
#define PUBLIC_OPTIONS \ |
#define PUBLIC_OPTIONS \ |
404 |
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ |
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \ |
405 |
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \ |
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \ |
406 |
PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE) |
PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \ |
407 |
|
PCRE_DUPNAMES|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF) |
408 |
|
|
409 |
#define PUBLIC_EXEC_OPTIONS \ |
#define PUBLIC_EXEC_OPTIONS \ |
410 |
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \ |
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \ |
411 |
PCRE_PARTIAL) |
PCRE_PARTIAL|PCRE_NEWLINE_CR|PCRE_NEWLINE_LF) |
412 |
|
|
413 |
#define PUBLIC_DFA_EXEC_OPTIONS \ |
#define PUBLIC_DFA_EXEC_OPTIONS \ |
414 |
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \ |
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \ |
415 |
PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART) |
PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART|PCRE_NEWLINE_CR| \ |
416 |
|
PCRE_NEWLINE_LF) |
417 |
|
|
418 |
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */ |
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */ |
419 |
|
|
541 |
OP_DOLL, /* 20 End of line - varies with multiline switch */ |
OP_DOLL, /* 20 End of line - varies with multiline switch */ |
542 |
OP_CHAR, /* 21 Match one character, casefully */ |
OP_CHAR, /* 21 Match one character, casefully */ |
543 |
OP_CHARNC, /* 22 Match one character, caselessly */ |
OP_CHARNC, /* 22 Match one character, caselessly */ |
544 |
OP_NOT, /* 23 Match anything but the following char */ |
OP_NOT, /* 23 Match one character, not the following one */ |
545 |
|
|
546 |
OP_STAR, /* 24 The maximizing and minimizing versions of */ |
OP_STAR, /* 24 The maximizing and minimizing versions of */ |
547 |
OP_MINSTAR, /* 25 all these opcodes must come in pairs, with */ |
OP_MINSTAR, /* 25 all these opcodes must come in pairs, with */ |
721 |
ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, |
ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, |
722 |
ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29, |
ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29, |
723 |
ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, |
ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, |
724 |
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47 }; |
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49, |
725 |
|
ERR50, ERR51 }; |
726 |
|
|
727 |
/* The real format of the start of the pcre block; the index of names and the |
/* The real format of the start of the pcre block; the index of names and the |
728 |
code vector run on as long as necessary after the end. We store an explicit |
code vector run on as long as necessary after the end. We store an explicit |
786 |
unsigned int backref_map; /* Bitmap of low back refs */ |
unsigned int backref_map; /* Bitmap of low back refs */ |
787 |
int req_varyopt; /* "After variable item" flag for reqbyte */ |
int req_varyopt; /* "After variable item" flag for reqbyte */ |
788 |
BOOL nopartial; /* Set TRUE if partial won't work */ |
BOOL nopartial; /* Set TRUE if partial won't work */ |
789 |
|
int nllen; /* 1 or 2 for newline string length */ |
790 |
|
uschar nl[4]; /* Newline string */ |
791 |
} compile_data; |
} compile_data; |
792 |
|
|
793 |
/* Structure for maintaining a chain of pointers to the currently incomplete |
/* Structure for maintaining a chain of pointers to the currently incomplete |
812 |
|
|
813 |
/* When compiling in a mode that doesn't use recursive calls to match(), |
/* When compiling in a mode that doesn't use recursive calls to match(), |
814 |
a structure is used to remember local variables on the heap. It is defined in |
a structure is used to remember local variables on the heap. It is defined in |
815 |
pcre.c, close to the match() function, so that it is easy to keep it in step |
pcre_exec.c, close to the match() function, so that it is easy to keep it in |
816 |
with any changes of local variable. However, the pointer to the current frame |
step with any changes of local variable. However, the pointer to the current |
817 |
must be saved in some "static" place over a longjmp(). We declare the |
frame must be saved in some "static" place over a longjmp(). We declare the |
818 |
structure here so that we can put a pointer in the match_data structure. |
structure here so that we can put a pointer in the match_data structure. NOTE: |
819 |
NOTE: This isn't used for a "normal" compilation of pcre. */ |
This isn't used for a "normal" compilation of pcre. */ |
820 |
|
|
821 |
struct heapframe; |
struct heapframe; |
822 |
|
|
830 |
int *offset_vector; /* Offset vector */ |
int *offset_vector; /* Offset vector */ |
831 |
int offset_end; /* One past the end */ |
int offset_end; /* One past the end */ |
832 |
int offset_max; /* The maximum usable for return data */ |
int offset_max; /* The maximum usable for return data */ |
833 |
|
int nllen; /* 1 or 2 for newline string length */ |
834 |
|
uschar nl[4]; /* Newline string */ |
835 |
const uschar *lcc; /* Points to lower casing table */ |
const uschar *lcc; /* Points to lower casing table */ |
836 |
const uschar *ctypes; /* Points to table of type maps */ |
const uschar *ctypes; /* Points to table of type maps */ |
837 |
BOOL offset_overflow; /* Set if too many extractions */ |
BOOL offset_overflow; /* Set if too many extractions */ |
865 |
const uschar *tables; /* Character tables */ |
const uschar *tables; /* Character tables */ |
866 |
int moptions; /* Match options */ |
int moptions; /* Match options */ |
867 |
int poptions; /* Pattern options */ |
int poptions; /* Pattern options */ |
868 |
|
int nllen; /* 1 or 2 for newline string length */ |
869 |
|
uschar nl[4]; /* Newline string */ |
870 |
void *callout_data; /* To pass back to callouts */ |
void *callout_data; /* To pass back to callouts */ |
871 |
} dfa_match_data; |
} dfa_match_data; |
872 |
|
|
940 |
extern int _pcre_ord2utf8(int, uschar *); |
extern int _pcre_ord2utf8(int, uschar *); |
941 |
extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *, |
extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *, |
942 |
const pcre_study_data *, pcre_study_data *); |
const pcre_study_data *, pcre_study_data *); |
943 |
extern int _pcre_ucp_findprop(const int, int *, int *); |
extern int _pcre_ucp_findprop(const unsigned int, int *, int *); |
944 |
extern int _pcre_ucp_othercase(const int); |
extern int _pcre_ucp_othercase(const int); |
945 |
extern int _pcre_valid_utf8(const uschar *, int); |
extern int _pcre_valid_utf8(const uschar *, int); |
946 |
extern BOOL _pcre_xclass(int, const uschar *); |
extern BOOL _pcre_xclass(int, const uschar *); |