PageRenderTime 30ms CodeModel.GetById 11ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/pcre/pcreposix.h

http://github.com/feyeleanor/RubyGoLightly
C++ Header | 143 lines | 66 code | 26 blank | 51 comment | 2 complexity | 7fb42e9efc6ff9c389b5bfc9650e830e MD5 | raw file
  1/*************************************************
  2*       Perl-Compatible Regular Expressions      *
  3*************************************************/
  4
  5#ifndef _PCREPOSIX_H
  6#define _PCREPOSIX_H
  7
  8/* This is the header for the POSIX wrapper interface to the PCRE Perl-
  9Compatible Regular Expression library. It defines the things POSIX says should
 10be there. I hope.
 11
 12            Copyright (c) 1997-2008 University of Cambridge
 13
 14-----------------------------------------------------------------------------
 15Redistribution and use in source and binary forms, with or without
 16modification, are permitted provided that the following conditions are met:
 17
 18    * Redistributions of source code must retain the above copyright notice,
 19      this list of conditions and the following disclaimer.
 20
 21    * Redistributions in binary form must reproduce the above copyright
 22      notice, this list of conditions and the following disclaimer in the
 23      documentation and/or other materials provided with the distribution.
 24
 25    * Neither the name of the University of Cambridge nor the names of its
 26      contributors may be used to endorse or promote products derived from
 27      this software without specific prior written permission.
 28
 29THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 30AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 31IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 32ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 33LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 34CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 35SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 36INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 37CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 38ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 39POSSIBILITY OF SUCH DAMAGE.
 40-----------------------------------------------------------------------------
 41*/
 42
 43/* Have to include stdlib.h in order to ensure that size_t is defined. */
 44
 45#include <stdlib.h>
 46
 47/* Allow for C++ users */
 48
 49#ifdef __cplusplus
 50extern "C" {
 51#endif
 52
 53/* Options, mostly defined by POSIX, but with a couple of extras. */
 54
 55#define REG_ICASE     0x0001
 56#define REG_NEWLINE   0x0002
 57#define REG_NOTBOL    0x0004
 58#define REG_NOTEOL    0x0008
 59#define REG_DOTALL    0x0010   /* NOT defined by POSIX. */
 60#define REG_NOSUB     0x0020
 61#define REG_UTF8      0x0040   /* NOT defined by POSIX. */
 62#define REG_STARTEND  0x0080   /* BSD feature: pass subject string by so,eo */
 63
 64/* This is not used by PCRE, but by defining it we make it easier
 65to slot PCRE into existing programs that make POSIX calls. */
 66
 67#define REG_EXTENDED  0
 68
 69/* Error values. Not all these are relevant or used by the wrapper. */
 70
 71enum {
 72  REG_ASSERT = 1,  /* internal error ? */
 73  REG_BADBR,       /* invalid repeat counts in {} */
 74  REG_BADPAT,      /* pattern error */
 75  REG_BADRPT,      /* ? * + invalid */
 76  REG_EBRACE,      /* unbalanced {} */
 77  REG_EBRACK,      /* unbalanced [] */
 78  REG_ECOLLATE,    /* collation error - not relevant */
 79  REG_ECTYPE,      /* bad class */
 80  REG_EESCAPE,     /* bad escape sequence */
 81  REG_EMPTY,       /* empty expression */
 82  REG_EPAREN,      /* unbalanced () */
 83  REG_ERANGE,      /* bad range inside [] */
 84  REG_ESIZE,       /* expression too big */
 85  REG_ESPACE,      /* failed to get memory */
 86  REG_ESUBREG,     /* bad back reference */
 87  REG_INVARG,      /* bad argument */
 88  REG_NOMATCH      /* match failed */
 89};
 90
 91
 92/* The structure representing a compiled regular expression. */
 93
 94typedef struct {
 95  void *re_pcre;
 96  size_t re_nsub;
 97  size_t re_erroffset;
 98} regex_t;
 99
100/* The structure in which a captured offset is returned. */
101
102typedef int regoff_t;
103
104typedef struct {
105  regoff_t rm_so;
106  regoff_t rm_eo;
107} regmatch_t;
108
109/* When an application links to a PCRE DLL in Windows, the symbols that are
110imported have to be identified as such. When building PCRE, the appropriate
111export settings are needed, and are set in pcreposix.c before including this
112file. */
113
114#if defined(_WIN32) && !defined(PCRE_STATIC) && !defined(PCREPOSIX_EXP_DECL)
115#  define PCREPOSIX_EXP_DECL  extern __declspec(dllimport)
116#  define PCREPOSIX_EXP_DEFN  __declspec(dllimport)
117#endif
118
119/* By default, we use the standard "extern" declarations. */
120
121#ifndef PCREPOSIX_EXP_DECL
122#  ifdef __cplusplus
123#    define PCREPOSIX_EXP_DECL  extern "C"
124#    define PCREPOSIX_EXP_DEFN  extern "C"
125#  else
126#    define PCREPOSIX_EXP_DECL  extern
127#    define PCREPOSIX_EXP_DEFN  extern
128#  endif
129#endif
130
131/* The functions */
132
133PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
134PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
135                     regmatch_t *, int);
136PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
137PCREPOSIX_EXP_DECL void regfree(regex_t *);
138
139#ifdef __cplusplus
140}   /* extern "C" */
141#endif
142
143#endif /* End of pcreposix.h */