~ubuntu-branches/ubuntu/vivid/ssed/vivid

« back to all changes in this revision

Viewing changes to pcre/regexp.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2004-03-23 16:45:36 UTC
  • Revision ID: james.westby@ubuntu.com-20040323164536-r0jrs8udv1ftwoac
Tags: upstream-3.60
ImportĀ upstreamĀ versionĀ 3.60

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************
 
2
*       Perl-Compatible Regular Expressions      *
 
3
*************************************************/
 
4
 
 
5
/* Copyright (c) 1997-2000 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
{
 
23
#endif
 
24
 
 
25
#ifdef __STDC__
 
26
#define __PCRE_PROTO(a) a
 
27
#else
 
28
#define __PCRE_PROTO(a) ()
 
29
#endif
 
30
 
 
31
/* Options defined by POSIX. */
 
32
 
 
33
#define REG_ICASE     0x01
 
34
#define REG_NEWLINE   0x02
 
35
#define REG_NOTBOL    0x04
 
36
#define REG_NOTEOL    0x08
 
37
#define REG_EXTENDED  0x10
 
38
 
 
39
#define REG_PERL      0x20
 
40
#define REG_DOTALL    0x40
 
41
 
 
42
/* These are not used by PCRE, but by defining them we make it easier
 
43
   to slot PCRE into existing programs that make POSIX calls. */
 
44
 
 
45
#define REG_NOSUB     0
 
46
 
 
47
/* Error values. Not all these are relevant or used by the wrapper. */
 
48
 
 
49
  enum
 
50
    {
 
51
      REG_ASSERT = 1,           /* internal error ? */
 
52
      REG_BADBR,                /* invalid repeat counts in {} */
 
53
      REG_BADPAT,               /* pattern error */
 
54
      REG_BADRPT,               /* ? * + invalid */
 
55
      REG_EBRACE,               /* unbalanced {} */
 
56
      REG_EBRACK,               /* unbalanced [] */
 
57
      REG_ECOLLATE,             /* collation error - not relevant */
 
58
      REG_ECTYPE,               /* bad class */
 
59
      REG_EESCAPE,              /* bad escape sequence */
 
60
      REG_EMPTY,                /* empty expression */
 
61
      REG_EPAREN,               /* unbalanced () */
 
62
      REG_ERANGE,               /* bad range inside [] */
 
63
      REG_ESIZE,                /* expression too big */
 
64
      REG_ESPACE,               /* failed to get memory */
 
65
      REG_ESUBREG,              /* bad back reference */
 
66
      REG_INVARG,               /* bad argument */
 
67
      REG_NOMATCH               /* match failed */
 
68
    };
 
69
 
 
70
 
 
71
/* The structure representing a compiled regular expression. */
 
72
 
 
73
  typedef struct
 
74
    {
 
75
      void *re_pcre;
 
76
      void *re_study;
 
77
      size_t re_nsub;
 
78
      size_t re_erroffset;
 
79
    }
 
80
  regex_t;
 
81
 
 
82
/* The structure in which a captured offset is returned. */
 
83
 
 
84
  typedef int regoff_t;
 
85
 
 
86
  typedef struct
 
87
    {
 
88
      regoff_t rm_so;
 
89
      regoff_t rm_eo;
 
90
    }
 
91
  regmatch_t;
 
92
 
 
93
/* The functions */
 
94
 
 
95
  extern int regcomp __PCRE_PROTO ((regex_t *, const char *, int));
 
96
  extern int regncomp __PCRE_PROTO ((regex_t *, const char *, int, int));
 
97
  extern int regexec __PCRE_PROTO ((regex_t *, const char *, size_t,
 
98
                                    regmatch_t *, int));
 
99
  extern int regnexec __PCRE_PROTO ((regex_t *, const char *, int, size_t,
 
100
                                     regmatch_t *, int));
 
101
  extern int regexec2 __PCRE_PROTO ((regex_t *, const char *, int, int, size_t,
 
102
                                     regmatch_t *, int));
 
103
  extern size_t regerror __PCRE_PROTO ((int, const regex_t *, char *, size_t));
 
104
  extern void regfree __PCRE_PROTO ((regex_t *));
 
105
 
 
106
#ifdef __cplusplus
 
107
}                               /* extern "C" */
 
108
#endif
 
109
#undef __PCRE_PROTO
 
110
 
 
111
#endif