blob: 3a215d501cffa28e288cc1ee0bc2c852bf6fecd4 [file] [log] [blame]
Guido van Rossum51b3aa31997-10-06 14:43:11 +00001/*************************************************
2* Perl-Compatible Regular Expressions *
3*************************************************/
4
5/* Copyright (c) 1997 University of Cambridge */
6
Guido van Rossum50700601997-12-08 17:15:20 +00007#ifndef _PCRE_H
8#define _PCRE_H
Guido van Rossum51b3aa31997-10-06 14:43:11 +00009
Guido van Rossum51b3aa31997-10-06 14:43:11 +000010#ifdef FOR_PYTHON
11#include "Python.h"
12#endif
13
Guido van Rossum50700601997-12-08 17:15:20 +000014/* Have to include stdlib.h in order to ensure that size_t is defined;
15it is needed here for malloc. */
16
17#include <stdlib.h>
18
Guido van Rossum51b3aa31997-10-06 14:43:11 +000019/* Options */
20
Guido van Rossum50700601997-12-08 17:15:20 +000021#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 Rossum51b3aa31997-10-06 14:43:11 +000033
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 Rossum50700601997-12-08 17:15:20 +000042#define PCRE_ERROR_NOMEMORY (-7)
Guido van Rossum51b3aa31997-10-06 14:43:11 +000043
44/* Types */
45
46typedef void pcre;
47typedef void pcre_extra;
48
49/* Store get and free functions. These can be set to alternative malloc/free
50functions if required. */
51
52extern void *(*pcre_malloc)(size_t);
53extern void (*pcre_free)(void *);
54
55/* Functions */
56
57#ifdef FOR_PYTHON
Guido van Rossum50700601997-12-08 17:15:20 +000058extern pcre *pcre_compile(const char *, int, char **, int *, PyObject *);
Guido van Rossum51b3aa31997-10-06 14:43:11 +000059#else
Guido van Rossum50700601997-12-08 17:15:20 +000060extern pcre *pcre_compile(const char *, int, char **, int *);
Guido van Rossum51b3aa31997-10-06 14:43:11 +000061#endif
Guido van Rossum50700601997-12-08 17:15:20 +000062extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
63 int, int, int *, int);
64extern int pcre_info(const pcre *, int *, int *);
65extern pcre_extra *pcre_study(const pcre *, int, char **);
Guido van Rossum51b3aa31997-10-06 14:43:11 +000066extern char *pcre_version(void);
67
Guido van Rossum50700601997-12-08 17:15:20 +000068#endif /* End of pcre.h */