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