/[pcre]/code/trunk/pcreposix.h
ViewVC logotype

Contents of /code/trunk/pcreposix.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 63 - (hide annotations) (download)
Sat Feb 24 21:40:03 2007 UTC (7 years, 1 month ago) by nigel
File MIME type: text/plain
File size: 2341 byte(s)
Load pcre-4.0 into code/trunk.

1 nigel 3 /*************************************************
2     * Perl-Compatible Regular Expressions *
3     *************************************************/
4    
5 nigel 63 /* Copyright (c) 1997-2003 University of Cambridge */
6 nigel 3
7     #ifndef _PCREPOSIX_H
8     #define _PCREPOSIX_H
9    
10     /* This is the header for the POSIX wrapper interface to the PCRE Perl-
11     Compatible Regular Expression library. It defines the things POSIX says should
12     be there. I hope. */
13    
14     /* Have to include stdlib.h in order to ensure that size_t is defined. */
15    
16     #include <stdlib.h>
17    
18 nigel 15 /* Allow for C++ users */
19    
20     #ifdef __cplusplus
21     extern "C" {
22     #endif
23    
24 nigel 3 /* Options defined by POSIX. */
25    
26     #define REG_ICASE 0x01
27     #define REG_NEWLINE 0x02
28     #define REG_NOTBOL 0x04
29     #define REG_NOTEOL 0x08
30    
31 nigel 43 /* These are not used by PCRE, but by defining them we make it easier
32     to slot PCRE into existing programs that make POSIX calls. */
33    
34     #define REG_EXTENDED 0
35     #define REG_NOSUB 0
36    
37 nigel 3 /* Error values. Not all these are relevant or used by the wrapper. */
38    
39     enum {
40     REG_ASSERT = 1, /* internal error ? */
41     REG_BADBR, /* invalid repeat counts in {} */
42     REG_BADPAT, /* pattern error */
43     REG_BADRPT, /* ? * + invalid */
44     REG_EBRACE, /* unbalanced {} */
45     REG_EBRACK, /* unbalanced [] */
46     REG_ECOLLATE, /* collation error - not relevant */
47     REG_ECTYPE, /* bad class */
48     REG_EESCAPE, /* bad escape sequence */
49     REG_EMPTY, /* empty expression */
50     REG_EPAREN, /* unbalanced () */
51     REG_ERANGE, /* bad range inside [] */
52     REG_ESIZE, /* expression too big */
53     REG_ESPACE, /* failed to get memory */
54     REG_ESUBREG, /* bad back reference */
55     REG_INVARG, /* bad argument */
56     REG_NOMATCH /* match failed */
57     };
58    
59    
60     /* The structure representing a compiled regular expression. */
61    
62     typedef struct {
63     void *re_pcre;
64     size_t re_nsub;
65     size_t re_erroffset;
66     } regex_t;
67    
68     /* The structure in which a captured offset is returned. */
69    
70     typedef int regoff_t;
71    
72     typedef struct {
73     regoff_t rm_so;
74     regoff_t rm_eo;
75     } regmatch_t;
76    
77     /* The functions */
78    
79     extern int regcomp(regex_t *, const char *, int);
80     extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
81     extern size_t regerror(int, const regex_t *, char *, size_t);
82     extern void regfree(regex_t *);
83    
84 nigel 15 #ifdef __cplusplus
85     } /* extern "C" */
86     #endif
87    
88 nigel 3 #endif /* End of pcreposix.h */

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12