~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

1.1.1 by Aaron M. Ucko
Import upstream version 6.1.20040616
1
/*************************************************
2
*       Perl-Compatible Regular Expressions      *
3
*************************************************/
4
5
/* Copyright (c) 1997-2001 University of Cambridge */
6
7
#ifndef _PCREPOSIX_H
8
#define _PCREPOSIX_H
9
10
/* This is the header for the POSIX wrapper interface to the PCRE Perl-
11
Compatible Regular Expression library. It defines the things POSIX says should
12
be there. I hope. */
13
14
/* Have to include stdlib.h in order to ensure that size_t is defined. */
15
16
#include <stdlib.h>
17
18
/* Allow for C++ users */
19
20
#ifdef __cplusplus
21
extern "C" {
22
#endif
23
24
/* Options defined by POSIX. */
25
26
#define REG_ICASE     0x01
27
#define REG_NEWLINE   0x02
28
#define REG_NOTBOL    0x04
29
#define REG_NOTEOL    0x08
30
31
/* These are not used by PCRE, but by defining them we make it easier
32
to slot PCRE into existing programs that make POSIX calls. */
33
34
#define REG_EXTENDED  0
35
#define REG_NOSUB     0
36
37
/* Error values. Not all these are relevant or used by the wrapper. */
38
39
enum {
40
  REG_ASSERT = 1,  /* internal error ? */
41
  REG_BADBR,       /* invalid repeat counts in {} */
42
  REG_BADPAT,      /* pattern error */
43
  REG_BADRPT,      /* ? * + invalid */
44
  REG_EBRACE,      /* unbalanced {} */
45
  REG_EBRACK,      /* unbalanced [] */
46
  REG_ECOLLATE,    /* collation error - not relevant */
47
  REG_ECTYPE,      /* bad class */
48
  REG_EESCAPE,     /* bad escape sequence */
49
  REG_EMPTY,       /* empty expression */
50
  REG_EPAREN,      /* unbalanced () */
51
  REG_ERANGE,      /* bad range inside [] */
52
  REG_ESIZE,       /* expression too big */
53
  REG_ESPACE,      /* failed to get memory */
54
  REG_ESUBREG,     /* bad back reference */
55
  REG_INVARG,      /* bad argument */
56
  REG_NOMATCH      /* match failed */
57
};
58
59
60
/* The structure representing a compiled regular expression. */
61
62
typedef struct {
63
  void *re_pcre;
64
  size_t re_nsub;
65
  size_t re_erroffset;
66
} regex_t;
67
68
/* The structure in which a captured offset is returned. */
69
70
typedef int regoff_t;
71
72
typedef struct {
73
  regoff_t rm_so;
74
  regoff_t rm_eo;
75
} regmatch_t;
76
77
/* The functions */
78
79
extern int    regcomp(regex_t *, const char *, int);
80
extern int    regexec(regex_t *, const char *, size_t, regmatch_t *, int);
81
extern size_t regerror(int, const regex_t *, char *, size_t);
82
extern void   regfree(regex_t *);
83
84
#ifdef __cplusplus
85
}   /* extern "C" */
86
#endif
87
88
#endif /* End of pcreposix.h */