Updated for 2.1b2 distribution.
[python/dscho.git] / Modules / pcre.h
blob36068239c0b2b65d04353f312fd1336adc746381
1 /*************************************************
2 * Perl-Compatible Regular Expressions *
3 *************************************************/
5 /* Copyright (c) 1998 University of Cambridge */
7 #ifndef _PCRE_H
8 #define _PCRE_H
10 #ifdef FOR_PYTHON
11 #include "Python.h"
12 #endif
14 /* Have to include stdlib.h in order to ensure that size_t is defined;
15 it is needed here for malloc. */
17 #ifndef DONT_HAVE_SYS_TYPES_H
18 #include <sys/types.h>
19 #endif
20 #include <stdlib.h>
22 /* Allow for C++ users */
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /* Options */
30 #define PCRE_CASELESS 0x0001
31 #define PCRE_EXTENDED 0x0002
32 #define PCRE_ANCHORED 0x0004
33 #define PCRE_MULTILINE 0x0008
34 #define PCRE_DOTALL 0x0010
35 #define PCRE_DOLLAR_ENDONLY 0x0020
36 #define PCRE_EXTRA 0x0040
37 #define PCRE_NOTBOL 0x0080
38 #define PCRE_NOTEOL 0x0100
39 #define PCRE_UNGREEDY 0x0400
40 #ifdef FOR_PYTHON
41 #define PCRE_LOCALE 0x0200
42 #endif
44 /* Exec-time error codes */
46 #define PCRE_ERROR_NOMATCH (-1)
47 #define PCRE_ERROR_BADREF (-2)
48 #define PCRE_ERROR_NULL (-3)
49 #define PCRE_ERROR_BADOPTION (-4)
50 #define PCRE_ERROR_BADMAGIC (-5)
51 #define PCRE_ERROR_UNKNOWN_NODE (-6)
52 #define PCRE_ERROR_NOMEMORY (-7)
54 /* Types */
56 typedef void pcre;
57 typedef void pcre_extra;
59 /* Store get and free functions. These can be set to alternative malloc/free
60 functions if required. */
62 extern void *(*pcre_malloc)(size_t);
63 extern void (*pcre_free)(void *);
65 /* Functions */
67 #ifdef FOR_PYTHON
68 extern pcre *pcre_compile(const char *, int, const char **, int *, PyObject *);
69 extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
70 int, int, int, int *, int);
71 #else
72 extern pcre *pcre_compile(const char *, int, const char **, int *);
73 extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
74 int, int, int *, int);
75 #endif
76 extern int pcre_info(const pcre *, int *, int *);
77 extern pcre_extra *pcre_study(const pcre *, int, const char **);
78 extern const char *pcre_version(void);
80 #ifdef __cplusplus
81 } /* extern "C" */
82 #endif
84 #endif /* End of pcre.h */