Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 1 | /************************************************* |
| 2 | * Perl-Compatible Regular Expressions * |
| 3 | *************************************************/ |
| 4 | |
Guido van Rossum | 042ff9e | 1998-04-03 21:13:31 +0000 | [diff] [blame] | 5 | /* Copyright (c) 1998 University of Cambridge */ |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 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 | 40ced50 | 2000-06-28 20:56:30 +0000 | [diff] [blame] | 17 | #ifndef DONT_HAVE_SYS_TYPES_H |
Guido van Rossum | 557dea1 | 1997-12-22 22:46:52 +0000 | [diff] [blame] | 18 | #include <sys/types.h> |
Guido van Rossum | 40ced50 | 2000-06-28 20:56:30 +0000 | [diff] [blame] | 19 | #endif |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 20 | #include <stdlib.h> |
| 21 | |
Guido van Rossum | 042ff9e | 1998-04-03 21:13:31 +0000 | [diff] [blame] | 22 | /* Allow for C++ users */ |
| 23 | |
| 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #endif |
| 27 | |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 28 | /* Options */ |
| 29 | |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 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 |
Guido van Rossum | dda6696 | 1998-05-07 15:32:44 +0000 | [diff] [blame] | 39 | #define PCRE_UNGREEDY 0x0400 |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 40 | #ifdef FOR_PYTHON |
| 41 | #define PCRE_LOCALE 0x0200 |
| 42 | #endif |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 43 | |
| 44 | /* Exec-time error codes */ |
| 45 | |
| 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) |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 52 | #define PCRE_ERROR_NOMEMORY (-7) |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 53 | |
| 54 | /* Types */ |
| 55 | |
| 56 | typedef void pcre; |
| 57 | typedef void pcre_extra; |
| 58 | |
| 59 | /* Store get and free functions. These can be set to alternative malloc/free |
| 60 | functions if required. */ |
| 61 | |
| 62 | extern void *(*pcre_malloc)(size_t); |
| 63 | extern void (*pcre_free)(void *); |
| 64 | |
| 65 | /* Functions */ |
| 66 | |
| 67 | #ifdef FOR_PYTHON |
Guido van Rossum | 58132c6 | 1997-12-17 00:24:13 +0000 | [diff] [blame] | 68 | extern pcre *pcre_compile(const char *, int, const char **, int *, PyObject *); |
Guido van Rossum | 816671c | 1998-03-10 04:55:29 +0000 | [diff] [blame] | 69 | extern int pcre_exec(const pcre *, const pcre_extra *, const char *, |
| 70 | int, int, int, int *, int); |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 71 | #else |
Guido van Rossum | 58132c6 | 1997-12-17 00:24:13 +0000 | [diff] [blame] | 72 | extern pcre *pcre_compile(const char *, int, const char **, int *); |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 73 | extern int pcre_exec(const pcre *, const pcre_extra *, const char *, |
| 74 | int, int, int *, int); |
Guido van Rossum | 816671c | 1998-03-10 04:55:29 +0000 | [diff] [blame] | 75 | #endif |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 76 | extern int pcre_info(const pcre *, int *, int *); |
Guido van Rossum | 58132c6 | 1997-12-17 00:24:13 +0000 | [diff] [blame] | 77 | extern pcre_extra *pcre_study(const pcre *, int, const char **); |
| 78 | extern const char *pcre_version(void); |
Guido van Rossum | 51b3aa3 | 1997-10-06 14:43:11 +0000 | [diff] [blame] | 79 | |
Guido van Rossum | 042ff9e | 1998-04-03 21:13:31 +0000 | [diff] [blame] | 80 | #ifdef __cplusplus |
| 81 | } /* extern "C" */ |
| 82 | #endif |
| 83 | |
Guido van Rossum | 5070060 | 1997-12-08 17:15:20 +0000 | [diff] [blame] | 84 | #endif /* End of pcre.h */ |