1
/*************************************************
2
* Perl-Compatible Regular Expressions *
3
*************************************************/
8
/* This is the header for the POSIX wrapper interface to the PCRE Perl-
9
Compatible Regular Expression library. It defines the things POSIX says should
12
Copyright (c) 1997-2012 University of Cambridge
14
-----------------------------------------------------------------------------
15
Redistribution and use in source and binary forms, with or without
16
modification, are permitted provided that the following conditions are met:
18
* Redistributions of source code must retain the above copyright notice,
19
this list of conditions and the following disclaimer.
21
* Redistributions in binary form must reproduce the above copyright
22
notice, this list of conditions and the following disclaimer in the
23
documentation and/or other materials provided with the distribution.
25
* Neither the name of the University of Cambridge nor the names of its
26
contributors may be used to endorse or promote products derived from
27
this software without specific prior written permission.
29
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
33
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
37
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39
POSSIBILITY OF SUCH DAMAGE.
40
-----------------------------------------------------------------------------
43
/* Have to include stdlib.h in order to ensure that size_t is defined. */
47
/* Allow for C++ users */
53
/* Options, mostly defined by POSIX, but with some extras. */
55
#define REG_ICASE 0x0001 /* Maps to PCRE_CASELESS */
56
#define REG_NEWLINE 0x0002 /* Maps to PCRE_MULTILINE */
57
#define REG_NOTBOL 0x0004 /* Maps to PCRE_NOTBOL */
58
#define REG_NOTEOL 0x0008 /* Maps to PCRE_NOTEOL */
59
#define REG_DOTALL 0x0010 /* NOT defined by POSIX; maps to PCRE_DOTALL */
60
#define REG_NOSUB 0x0020 /* Maps to PCRE_NO_AUTO_CAPTURE */
61
#define REG_UTF8 0x0040 /* NOT defined by POSIX; maps to PCRE_UTF8 */
62
#define REG_STARTEND 0x0080 /* BSD feature: pass subject string by so,eo */
63
#define REG_NOTEMPTY 0x0100 /* NOT defined by POSIX; maps to PCRE_NOTEMPTY */
64
#define REG_UNGREEDY 0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */
65
#define REG_UCP 0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */
67
/* This is not used by PCRE, but by defining it we make it easier
68
to slot PCRE into existing programs that make POSIX calls. */
70
#define REG_EXTENDED 0
72
/* Error values. Not all these are relevant or used by the wrapper. */
75
REG_ASSERT = 1, /* internal error ? */
76
REG_BADBR, /* invalid repeat counts in {} */
77
REG_BADPAT, /* pattern error */
78
REG_BADRPT, /* ? * + invalid */
79
REG_EBRACE, /* unbalanced {} */
80
REG_EBRACK, /* unbalanced [] */
81
REG_ECOLLATE, /* collation error - not relevant */
82
REG_ECTYPE, /* bad class */
83
REG_EESCAPE, /* bad escape sequence */
84
REG_EMPTY, /* empty expression */
85
REG_EPAREN, /* unbalanced () */
86
REG_ERANGE, /* bad range inside [] */
87
REG_ESIZE, /* expression too big */
88
REG_ESPACE, /* failed to get memory */
89
REG_ESUBREG, /* bad back reference */
90
REG_INVARG, /* bad argument */
91
REG_NOMATCH /* match failed */
95
/* The structure representing a compiled regular expression. */
103
/* The structure in which a captured offset is returned. */
105
typedef int regoff_t;
112
/* When an application links to a PCRE DLL in Windows, the symbols that are
113
imported have to be identified as such. When building PCRE, the appropriate
114
export settings are needed, and are set in pcreposix.c before including this
117
#if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL)
118
# define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
119
# define PCREPOSIX_EXP_DEFN __declspec(dllimport)
122
/* By default, we use the standard "extern" declarations. */
124
#ifndef PCREPOSIX_EXP_DECL
126
# define PCREPOSIX_EXP_DECL extern "C"
127
# define PCREPOSIX_EXP_DEFN extern "C"
129
# define PCREPOSIX_EXP_DECL extern
130
# define PCREPOSIX_EXP_DEFN extern
136
PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
137
PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
139
PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
140
PCREPOSIX_EXP_DECL void regfree(regex_t *);
146
#endif /* End of pcreposix.h */