Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 1 | /************************************************* |
| 2 | * Perl-Compatible Regular Expressions * |
| 3 | *************************************************/ |
| 4 | |
| 5 | /* Copyright (c) 1997 University of Cambridge */ |
| 6 | |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 7 | #ifndef _PCRE_H |
| 8 | #define _PCRE_H |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 9 | |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 10 | #ifdef FOR_PYTHON |
| 11 | #include "Python.h" |
| 12 | #endif |
| 13 | |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 14 | /* Have to include stdlib.h in order to ensure that size_t is defined; |
| 15 | it is needed here for malloc. */ |
| 16 | |
| 17 | #include <stdlib.h> |
| 18 | |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 19 | /* Options */ |
| 20 | |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 21 | #define PCRE_CASELESS 0x0001 |
| 22 | #define PCRE_EXTENDED 0x0002 |
| 23 | #define PCRE_ANCHORED 0x0004 |
| 24 | #define PCRE_MULTILINE 0x0008 |
| 25 | #define PCRE_DOTALL 0x0010 |
| 26 | #define PCRE_DOLLAR_ENDONLY 0x0020 |
| 27 | #define PCRE_EXTRA 0x0040 |
| 28 | #define PCRE_NOTBOL 0x0080 |
| 29 | #define PCRE_NOTEOL 0x0100 |
| 30 | #ifdef FOR_PYTHON |
| 31 | #define PCRE_LOCALE 0x0200 |
| 32 | #endif |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 33 | |
| 34 | /* Exec-time error codes */ |
| 35 | |
| 36 | #define PCRE_ERROR_NOMATCH (-1) |
| 37 | #define PCRE_ERROR_BADREF (-2) |
| 38 | #define PCRE_ERROR_NULL (-3) |
| 39 | #define PCRE_ERROR_BADOPTION (-4) |
| 40 | #define PCRE_ERROR_BADMAGIC (-5) |
| 41 | #define PCRE_ERROR_UNKNOWN_NODE (-6) |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 42 | #define PCRE_ERROR_NOMEMORY (-7) |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 43 | |
| 44 | /* Types */ |
| 45 | |
| 46 | typedef void pcre; |
| 47 | typedef void pcre_extra; |
| 48 | |
| 49 | /* Store get and free functions. These can be set to alternative malloc/free |
| 50 | functions if required. */ |
| 51 | |
| 52 | extern void *(*pcre_malloc)(size_t); |
| 53 | extern void (*pcre_free)(void *); |
| 54 | |
| 55 | /* Functions */ |
| 56 | |
| 57 | #ifdef FOR_PYTHON |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 58 | extern pcre *pcre_compile(const char *, int, char **, int *, PyObject *); |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 59 | #else |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 60 | extern pcre *pcre_compile(const char *, int, char **, int *); |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 61 | #endif |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 62 | extern int pcre_exec(const pcre *, const pcre_extra *, const char *, |
| 63 | int, int, int *, int); |
| 64 | extern int pcre_info(const pcre *, int *, int *); |
| 65 | extern pcre_extra *pcre_study(const pcre *, int, char **); |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 66 | extern char *pcre_version(void); |
| 67 | |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 68 | #endif /* End of pcre.h */ |