blob: 36068239c0b2b65d04353f312fd1336adc746381 [file] [log] [blame]
Guido van Rossum51b3aa31997-10-06 14:43:11 +00001/*************************************************
2* Perl-Compatible Regular Expressions *
3*************************************************/
4
Guido van Rossum042ff9e1998-04-03 21:13:31 +00005/* Copyright (c) 1998 University of Cambridge */
Guido van Rossum51b3aa31997-10-06 14:43:11 +00006
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
Guido van Rossum40ced502000-06-28 20:56:30 +000017#ifndef DONT_HAVE_SYS_TYPES_H
Guido van Rossum557dea11997-12-22 22:46:52 +000018#include <sys/types.h>
Guido van Rossum40ced502000-06-28 20:56:30 +000019#endif
Guido van Rossum50700601997-12-08 17:15:20 +000020#include <stdlib.h>
21
Guido van Rossum042ff9e1998-04-03 21:13:31 +000022/* Allow for C++ users */
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
Guido van Rossum51b3aa31997-10-06 14:43:11 +000028/* Options */
29
Guido van Rossum50700601997-12-08 17:15:20 +000030#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 Rossumdda66961998-05-07 15:32:44 +000039#define PCRE_UNGREEDY 0x0400
Guido van Rossum50700601997-12-08 17:15:20 +000040#ifdef FOR_PYTHON
41#define PCRE_LOCALE 0x0200
42#endif
Guido van Rossum51b3aa31997-10-06 14:43:11 +000043
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 Rossum50700601997-12-08 17:15:20 +000052#define PCRE_ERROR_NOMEMORY (-7)
Guido van Rossum51b3aa31997-10-06 14:43:11 +000053
54/* Types */
55
56typedef void pcre;
57typedef void pcre_extra;
58
59/* Store get and free functions. These can be set to alternative malloc/free
60functions if required. */
61
62extern void *(*pcre_malloc)(size_t);
63extern void (*pcre_free)(void *);
64
65/* Functions */
66
67#ifdef FOR_PYTHON
Guido van Rossum58132c61997-12-17 00:24:13 +000068extern pcre *pcre_compile(const char *, int, const char **, int *, PyObject *);
Guido van Rossum816671c1998-03-10 04:55:29 +000069extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
70 int, int, int, int *, int);
Guido van Rossum51b3aa31997-10-06 14:43:11 +000071#else
Guido van Rossum58132c61997-12-17 00:24:13 +000072extern pcre *pcre_compile(const char *, int, const char **, int *);
Guido van Rossum50700601997-12-08 17:15:20 +000073extern int pcre_exec(const pcre *, const pcre_extra *, const char *,
74 int, int, int *, int);
Guido van Rossum816671c1998-03-10 04:55:29 +000075#endif
Guido van Rossum50700601997-12-08 17:15:20 +000076extern int pcre_info(const pcre *, int *, int *);
Guido van Rossum58132c61997-12-17 00:24:13 +000077extern pcre_extra *pcre_study(const pcre *, int, const char **);
78extern const char *pcre_version(void);
Guido van Rossum51b3aa31997-10-06 14:43:11 +000079
Guido van Rossum042ff9e1998-04-03 21:13:31 +000080#ifdef __cplusplus
81} /* extern "C" */
82#endif
83
Guido van Rossum50700601997-12-08 17:15:20 +000084#endif /* End of pcre.h */