root/1.8.3/tags/p6/hdrs/mypcre.h

Revision 1167, 8.4 KB (checked in by shawnw, 13 months ago)

Merge devel into trunk for p6 release

Line 
1#ifndef _MYPCRE_H
2#define _MYPCRE_H
3
4/*************************************************
5*       Perl-Compatible Regular Expressions      *
6*************************************************/
7
8/* In its original form, this is the .in file that is transformed by
9"configure" into pcre.h.
10
11           Copyright (c) 1997-2005 University of Cambridge
12
13-----------------------------------------------------------------------------
14Redistribution and use in source and binary forms, with or without
15modification, are permitted provided that the following conditions are met:
16
17    * Redistributions of source code must retain the above copyright notice,
18      this list of conditions and the following disclaimer.
19
20    * Redistributions in binary form must reproduce the above copyright
21      notice, this list of conditions and the following disclaimer in the
22      documentation and/or other materials provided with the distribution.
23
24    * Neither the name of the University of Cambridge nor the names of its
25      contributors may be used to endorse or promote products derived from
26      this software without specific prior written permission.
27
28THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38POSSIBILITY OF SUCH DAMAGE.
39-----------------------------------------------------------------------------
40*/
41
42/* Modified a bit by Shawn Wagner for inclusion in PennMUSH. See
43   pcre.c for details. */
44
45
46#define PENN_MATCH_LIMIT 100000
47struct pcre_extra;
48void set_match_limit(struct pcre_extra *);
49struct pcre_extra *default_match_limit(void);
50
51#ifdef HAVE_PCRE
52#include <pcre.h>
53#else
54
55
56#define PCRE_MAJOR          6
57#define PCRE_MINOR          4
58#define PCRE_DATE           05-Sep-2005
59
60#ifndef PCRE_DATA_SCOPE
61#  define PCRE_DATA_SCOPE     extern
62#endif
63
64/* Have to include stdlib.h in order to ensure that size_t is defined;
65it is needed here for malloc. */
66
67#include <stdlib.h>
68
69/* Allow for C++ users */
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75/* Options */
76
77#define PCRE_CASELESS           0x00000001
78#define PCRE_MULTILINE          0x00000002
79#define PCRE_DOTALL             0x00000004
80#define PCRE_EXTENDED           0x00000008
81#define PCRE_ANCHORED           0x00000010
82#define PCRE_DOLLAR_ENDONLY     0x00000020
83#define PCRE_EXTRA              0x00000040
84#define PCRE_NOTBOL             0x00000080
85#define PCRE_NOTEOL             0x00000100
86#define PCRE_UNGREEDY           0x00000200
87#define PCRE_NOTEMPTY           0x00000400
88#define PCRE_UTF8               0x00000800
89#define PCRE_NO_AUTO_CAPTURE    0x00001000
90#define PCRE_NO_UTF8_CHECK      0x00002000
91#define PCRE_AUTO_CALLOUT       0x00004000
92#define PCRE_PARTIAL            0x00008000
93#define PCRE_DFA_SHORTEST       0x00010000
94#define PCRE_DFA_RESTART        0x00020000
95#define PCRE_FIRSTLINE          0x00040000
96
97
98/* Exec-time and get/set-time error codes */
99
100#define PCRE_ERROR_NOMATCH         (-1)
101#define PCRE_ERROR_NULL            (-2)
102#define PCRE_ERROR_BADOPTION       (-3)
103#define PCRE_ERROR_BADMAGIC        (-4)
104#define PCRE_ERROR_UNKNOWN_NODE    (-5)
105#define PCRE_ERROR_NOMEMORY        (-6)
106#define PCRE_ERROR_NOSUBSTRING     (-7)
107#define PCRE_ERROR_MATCHLIMIT      (-8)
108#define PCRE_ERROR_CALLOUT         (-9) /* Never used by PCRE itself */
109#define PCRE_ERROR_BADUTF8        (-10)
110#define PCRE_ERROR_BADUTF8_OFFSET (-11)
111#define PCRE_ERROR_PARTIAL        (-12)
112#define PCRE_ERROR_BADPARTIAL     (-13)
113#define PCRE_ERROR_INTERNAL       (-14)
114#define PCRE_ERROR_BADCOUNT       (-15)
115#define PCRE_ERROR_DFA_UITEM      (-16)
116#define PCRE_ERROR_DFA_UCOND      (-17)
117#define PCRE_ERROR_DFA_UMLIMIT    (-18)
118#define PCRE_ERROR_DFA_WSSIZE     (-19)
119#define PCRE_ERROR_DFA_RECURSE    (-20)
120
121/* Request types for pcre_fullinfo() */
122
123#define PCRE_INFO_OPTIONS            0
124#define PCRE_INFO_SIZE               1
125#define PCRE_INFO_CAPTURECOUNT       2
126#define PCRE_INFO_BACKREFMAX         3
127#define PCRE_INFO_FIRSTBYTE          4
128#define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
129#define PCRE_INFO_FIRSTTABLE         5
130#define PCRE_INFO_LASTLITERAL        6
131#define PCRE_INFO_NAMEENTRYSIZE      7
132#define PCRE_INFO_NAMECOUNT          8
133#define PCRE_INFO_NAMETABLE          9
134#define PCRE_INFO_STUDYSIZE         10
135#define PCRE_INFO_DEFAULT_TABLES    11
136
137/* Request types for pcre_config() */
138
139#define PCRE_CONFIG_UTF8                    0
140#define PCRE_CONFIG_NEWLINE                 1
141#define PCRE_CONFIG_LINK_SIZE               2
142#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
143#define PCRE_CONFIG_MATCH_LIMIT             4
144
145/* Bit flags for the pcre_extra structure */
146
147#define PCRE_EXTRA_STUDY_DATA          0x0001
148#define PCRE_EXTRA_MATCH_LIMIT         0x0002
149#define PCRE_EXTRA_CALLOUT_DATA        0x0004
150#define PCRE_EXTRA_TABLES              0x0008
151
152/* Types */
153
154  struct real_pcre;             /* declaration; the definition is private  */
155  typedef struct real_pcre pcre;
156
157/* The structure for passing additional data to pcre_exec(). This is defined in
158such as way as to be extensible. */
159
160  typedef struct pcre_extra {
161    unsigned long int flags;    /* Bits for which fields are set */
162    void *study_data;           /* Opaque data from pcre_study() */
163    unsigned long int match_limit;      /* Maximum number of calls to match() */
164    void *callout_data;         /* Data passed back in callouts */
165    const unsigned char *tables;        /* Pointer to character tables */
166  } pcre_extra;
167
168/* The structure for passing out data via the pcre_callout_function. We use a
169structure so that new fields can be added on the end in future versions,
170without changing the API of the function, thereby allowing old clients to work
171without modification. */
172
173  typedef struct pcre_callout_block {
174    int version;                /* Identifies version of block */
175    /* ------------------------ Version 0 ------------------------------- */
176    int callout_number;         /* Number compiled into pattern */
177    int *offset_vector;         /* The offset vector */
178    const char *subject;        /* The subject being matched */
179    int subject_length;         /* The length of the subject */
180    int start_match;            /* Offset to start of this match attempt */
181    int current_position;       /* Where we currently are in the subject */
182    int capture_top;            /* Max current capture */
183    int capture_last;           /* Most recently closed capture */
184    void *callout_data;         /* Data passed in with the call */
185    /* ------------------- Added for Version 1 -------------------------- */
186    int pattern_position;       /* Offset to next item in the pattern */
187    int next_item_length;       /* Length of next item in the pattern */
188    /* ------------------------------------------------------------------ */
189  } pcre_callout_block;
190
191
192/* Exported PCRE functions */
193
194  extern pcre *pcre_compile(const char *, int, const char **,
195                            int *, const unsigned char *);
196  extern int pcre_copy_substring(const char *, int *, int, int, char *, int);
197  int pcre_get_substring(const char *, int *, int, int, const char **);
198  extern int pcre_exec(const pcre *, const pcre_extra *,
199                       const char *, int, int, int, int *, int);
200  extern const unsigned char *pcre_maketables(void);
201  extern pcre_extra *pcre_study(const pcre *, int, const char **);
202  extern int pcre_fullinfo(const pcre * argument_re,
203                           const pcre_extra * extra_data, int what,
204                           void *where);
205  extern int pcre_get_stringnumber(const pcre * code, const char *stringname);
206  extern int
207   pcre_copy_named_substring(const pcre * code, const char *subject,
208                             int *ovector, int stringcount,
209                             const char *stringname, char *buffer, int size);
210
211#ifdef __cplusplus
212}                               /* extern "C" */
213#endif
214#endif                          /* !HAVE_PCRE */
215#endif                          /* End of pcre.h */
Note: See TracBrowser for help on using the browser.