tools/pcre/pcre.h.generic
changeset 2762 d2d467bf1b5a
child 3831 babd0eee3c5e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/pcre/pcre.h.generic	Tue Jul 28 17:51:34 2009 -0400
     1.3 @@ -0,0 +1,307 @@
     1.4 +/*************************************************
     1.5 +*       Perl-Compatible Regular Expressions      *
     1.6 +*************************************************/
     1.7 +
     1.8 +/* This is the public header file for the PCRE library, to be #included by
     1.9 +applications that call the PCRE functions.
    1.10 +
    1.11 +           Copyright (c) 1997-2009 University of Cambridge
    1.12 +
    1.13 +-----------------------------------------------------------------------------
    1.14 +Redistribution and use in source and binary forms, with or without
    1.15 +modification, are permitted provided that the following conditions are met:
    1.16 +
    1.17 +    * Redistributions of source code must retain the above copyright notice,
    1.18 +      this list of conditions and the following disclaimer.
    1.19 +
    1.20 +    * Redistributions in binary form must reproduce the above copyright
    1.21 +      notice, this list of conditions and the following disclaimer in the
    1.22 +      documentation and/or other materials provided with the distribution.
    1.23 +
    1.24 +    * Neither the name of the University of Cambridge nor the names of its
    1.25 +      contributors may be used to endorse or promote products derived from
    1.26 +      this software without specific prior written permission.
    1.27 +
    1.28 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1.29 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.30 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.31 +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
    1.32 +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.33 +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.34 +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.35 +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.36 +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.37 +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.38 +POSSIBILITY OF SUCH DAMAGE.
    1.39 +-----------------------------------------------------------------------------
    1.40 +*/
    1.41 +
    1.42 +#ifndef _PCRE_H
    1.43 +#define _PCRE_H
    1.44 +
    1.45 +/* The current PCRE version information. */
    1.46 +
    1.47 +#define PCRE_MAJOR          7
    1.48 +#define PCRE_MINOR          9
    1.49 +#define PCRE_PRERELEASE     
    1.50 +#define PCRE_DATE           2009-04-11
    1.51 +
    1.52 +/* When an application links to a PCRE DLL in Windows, the symbols that are
    1.53 +imported have to be identified as such. When building PCRE, the appropriate
    1.54 +export setting is defined in pcre_internal.h, which includes this file. So we
    1.55 +don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */
    1.56 +
    1.57 +#if defined(_WIN32) && !defined(PCRE_STATIC)
    1.58 +#  ifndef PCRE_EXP_DECL
    1.59 +#    define PCRE_EXP_DECL  extern __declspec(dllimport)
    1.60 +#  endif
    1.61 +#  ifdef __cplusplus
    1.62 +#    ifndef PCRECPP_EXP_DECL
    1.63 +#      define PCRECPP_EXP_DECL  extern __declspec(dllimport)
    1.64 +#    endif
    1.65 +#    ifndef PCRECPP_EXP_DEFN
    1.66 +#      define PCRECPP_EXP_DEFN  __declspec(dllimport)
    1.67 +#    endif
    1.68 +#  endif
    1.69 +#endif
    1.70 +
    1.71 +/* By default, we use the standard "extern" declarations. */
    1.72 +
    1.73 +#ifndef PCRE_EXP_DECL
    1.74 +#  ifdef __cplusplus
    1.75 +#    define PCRE_EXP_DECL  extern "C"
    1.76 +#  else
    1.77 +#    define PCRE_EXP_DECL  extern
    1.78 +#  endif
    1.79 +#endif
    1.80 +
    1.81 +#ifdef __cplusplus
    1.82 +#  ifndef PCRECPP_EXP_DECL
    1.83 +#    define PCRECPP_EXP_DECL  extern
    1.84 +#  endif
    1.85 +#  ifndef PCRECPP_EXP_DEFN
    1.86 +#    define PCRECPP_EXP_DEFN
    1.87 +#  endif
    1.88 +#endif
    1.89 +
    1.90 +/* Have to include stdlib.h in order to ensure that size_t is defined;
    1.91 +it is needed here for malloc. */
    1.92 +
    1.93 +#include <stdlib.h>
    1.94 +
    1.95 +/* Allow for C++ users */
    1.96 +
    1.97 +#ifdef __cplusplus
    1.98 +extern "C" {
    1.99 +#endif
   1.100 +
   1.101 +/* Options. Some are compile-time only, some are run-time only, and some are
   1.102 +both, so we keep them all distinct. */
   1.103 +
   1.104 +#define PCRE_CASELESS           0x00000001
   1.105 +#define PCRE_MULTILINE          0x00000002
   1.106 +#define PCRE_DOTALL             0x00000004
   1.107 +#define PCRE_EXTENDED           0x00000008
   1.108 +#define PCRE_ANCHORED           0x00000010
   1.109 +#define PCRE_DOLLAR_ENDONLY     0x00000020
   1.110 +#define PCRE_EXTRA              0x00000040
   1.111 +#define PCRE_NOTBOL             0x00000080
   1.112 +#define PCRE_NOTEOL             0x00000100
   1.113 +#define PCRE_UNGREEDY           0x00000200
   1.114 +#define PCRE_NOTEMPTY           0x00000400
   1.115 +#define PCRE_UTF8               0x00000800
   1.116 +#define PCRE_NO_AUTO_CAPTURE    0x00001000
   1.117 +#define PCRE_NO_UTF8_CHECK      0x00002000
   1.118 +#define PCRE_AUTO_CALLOUT       0x00004000
   1.119 +#define PCRE_PARTIAL            0x00008000
   1.120 +#define PCRE_DFA_SHORTEST       0x00010000
   1.121 +#define PCRE_DFA_RESTART        0x00020000
   1.122 +#define PCRE_FIRSTLINE          0x00040000
   1.123 +#define PCRE_DUPNAMES           0x00080000
   1.124 +#define PCRE_NEWLINE_CR         0x00100000
   1.125 +#define PCRE_NEWLINE_LF         0x00200000
   1.126 +#define PCRE_NEWLINE_CRLF       0x00300000
   1.127 +#define PCRE_NEWLINE_ANY        0x00400000
   1.128 +#define PCRE_NEWLINE_ANYCRLF    0x00500000
   1.129 +#define PCRE_BSR_ANYCRLF        0x00800000
   1.130 +#define PCRE_BSR_UNICODE        0x01000000
   1.131 +#define PCRE_JAVASCRIPT_COMPAT  0x02000000
   1.132 +#define PCRE_NO_START_OPTIMIZE  0x04000000
   1.133 +#define PCRE_NO_START_OPTIMISE  0x04000000
   1.134 +
   1.135 +/* Exec-time and get/set-time error codes */
   1.136 +
   1.137 +#define PCRE_ERROR_NOMATCH         (-1)
   1.138 +#define PCRE_ERROR_NULL            (-2)
   1.139 +#define PCRE_ERROR_BADOPTION       (-3)
   1.140 +#define PCRE_ERROR_BADMAGIC        (-4)
   1.141 +#define PCRE_ERROR_UNKNOWN_OPCODE  (-5)
   1.142 +#define PCRE_ERROR_UNKNOWN_NODE    (-5)  /* For backward compatibility */
   1.143 +#define PCRE_ERROR_NOMEMORY        (-6)
   1.144 +#define PCRE_ERROR_NOSUBSTRING     (-7)
   1.145 +#define PCRE_ERROR_MATCHLIMIT      (-8)
   1.146 +#define PCRE_ERROR_CALLOUT         (-9)  /* Never used by PCRE itself */
   1.147 +#define PCRE_ERROR_BADUTF8        (-10)
   1.148 +#define PCRE_ERROR_BADUTF8_OFFSET (-11)
   1.149 +#define PCRE_ERROR_PARTIAL        (-12)
   1.150 +#define PCRE_ERROR_BADPARTIAL     (-13)
   1.151 +#define PCRE_ERROR_INTERNAL       (-14)
   1.152 +#define PCRE_ERROR_BADCOUNT       (-15)
   1.153 +#define PCRE_ERROR_DFA_UITEM      (-16)
   1.154 +#define PCRE_ERROR_DFA_UCOND      (-17)
   1.155 +#define PCRE_ERROR_DFA_UMLIMIT    (-18)
   1.156 +#define PCRE_ERROR_DFA_WSSIZE     (-19)
   1.157 +#define PCRE_ERROR_DFA_RECURSE    (-20)
   1.158 +#define PCRE_ERROR_RECURSIONLIMIT (-21)
   1.159 +#define PCRE_ERROR_NULLWSLIMIT    (-22)  /* No longer actually used */
   1.160 +#define PCRE_ERROR_BADNEWLINE     (-23)
   1.161 +
   1.162 +/* Request types for pcre_fullinfo() */
   1.163 +
   1.164 +#define PCRE_INFO_OPTIONS            0
   1.165 +#define PCRE_INFO_SIZE               1
   1.166 +#define PCRE_INFO_CAPTURECOUNT       2
   1.167 +#define PCRE_INFO_BACKREFMAX         3
   1.168 +#define PCRE_INFO_FIRSTBYTE          4
   1.169 +#define PCRE_INFO_FIRSTCHAR          4  /* For backwards compatibility */
   1.170 +#define PCRE_INFO_FIRSTTABLE         5
   1.171 +#define PCRE_INFO_LASTLITERAL        6
   1.172 +#define PCRE_INFO_NAMEENTRYSIZE      7
   1.173 +#define PCRE_INFO_NAMECOUNT          8
   1.174 +#define PCRE_INFO_NAMETABLE          9
   1.175 +#define PCRE_INFO_STUDYSIZE         10
   1.176 +#define PCRE_INFO_DEFAULT_TABLES    11
   1.177 +#define PCRE_INFO_OKPARTIAL         12
   1.178 +#define PCRE_INFO_JCHANGED          13
   1.179 +#define PCRE_INFO_HASCRORLF         14
   1.180 +
   1.181 +/* Request types for pcre_config(). Do not re-arrange, in order to remain
   1.182 +compatible. */
   1.183 +
   1.184 +#define PCRE_CONFIG_UTF8                    0
   1.185 +#define PCRE_CONFIG_NEWLINE                 1
   1.186 +#define PCRE_CONFIG_LINK_SIZE               2
   1.187 +#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD  3
   1.188 +#define PCRE_CONFIG_MATCH_LIMIT             4
   1.189 +#define PCRE_CONFIG_STACKRECURSE            5
   1.190 +#define PCRE_CONFIG_UNICODE_PROPERTIES      6
   1.191 +#define PCRE_CONFIG_MATCH_LIMIT_RECURSION   7
   1.192 +#define PCRE_CONFIG_BSR                     8
   1.193 +
   1.194 +/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine
   1.195 +these bits, just add new ones on the end, in order to remain compatible. */
   1.196 +
   1.197 +#define PCRE_EXTRA_STUDY_DATA             0x0001
   1.198 +#define PCRE_EXTRA_MATCH_LIMIT            0x0002
   1.199 +#define PCRE_EXTRA_CALLOUT_DATA           0x0004
   1.200 +#define PCRE_EXTRA_TABLES                 0x0008
   1.201 +#define PCRE_EXTRA_MATCH_LIMIT_RECURSION  0x0010
   1.202 +
   1.203 +/* Types */
   1.204 +
   1.205 +struct real_pcre;                 /* declaration; the definition is private  */
   1.206 +typedef struct real_pcre pcre;
   1.207 +
   1.208 +/* When PCRE is compiled as a C++ library, the subject pointer type can be
   1.209 +replaced with a custom type. For conventional use, the public interface is a
   1.210 +const char *. */
   1.211 +
   1.212 +#ifndef PCRE_SPTR
   1.213 +#define PCRE_SPTR const char *
   1.214 +#endif
   1.215 +
   1.216 +/* The structure for passing additional data to pcre_exec(). This is defined in
   1.217 +such as way as to be extensible. Always add new fields at the end, in order to
   1.218 +remain compatible. */
   1.219 +
   1.220 +typedef struct pcre_extra {
   1.221 +  unsigned long int flags;        /* Bits for which fields are set */
   1.222 +  void *study_data;               /* Opaque data from pcre_study() */
   1.223 +  unsigned long int match_limit;  /* Maximum number of calls to match() */
   1.224 +  void *callout_data;             /* Data passed back in callouts */
   1.225 +  const unsigned char *tables;    /* Pointer to character tables */
   1.226 +  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
   1.227 +} pcre_extra;
   1.228 +
   1.229 +/* The structure for passing out data via the pcre_callout_function. We use a
   1.230 +structure so that new fields can be added on the end in future versions,
   1.231 +without changing the API of the function, thereby allowing old clients to work
   1.232 +without modification. */
   1.233 +
   1.234 +typedef struct pcre_callout_block {
   1.235 +  int          version;           /* Identifies version of block */
   1.236 +  /* ------------------------ Version 0 ------------------------------- */
   1.237 +  int          callout_number;    /* Number compiled into pattern */
   1.238 +  int         *offset_vector;     /* The offset vector */
   1.239 +  PCRE_SPTR    subject;           /* The subject being matched */
   1.240 +  int          subject_length;    /* The length of the subject */
   1.241 +  int          start_match;       /* Offset to start of this match attempt */
   1.242 +  int          current_position;  /* Where we currently are in the subject */
   1.243 +  int          capture_top;       /* Max current capture */
   1.244 +  int          capture_last;      /* Most recently closed capture */
   1.245 +  void        *callout_data;      /* Data passed in with the call */
   1.246 +  /* ------------------- Added for Version 1 -------------------------- */
   1.247 +  int          pattern_position;  /* Offset to next item in the pattern */
   1.248 +  int          next_item_length;  /* Length of next item in the pattern */
   1.249 +  /* ------------------------------------------------------------------ */
   1.250 +} pcre_callout_block;
   1.251 +
   1.252 +/* Indirection for store get and free functions. These can be set to
   1.253 +alternative malloc/free functions if required. Special ones are used in the
   1.254 +non-recursive case for "frames". There is also an optional callout function
   1.255 +that is triggered by the (?) regex item. For Virtual Pascal, these definitions
   1.256 +have to take another form. */
   1.257 +
   1.258 +#ifndef VPCOMPAT
   1.259 +PCRE_EXP_DECL void *(*pcre_malloc)(size_t);
   1.260 +PCRE_EXP_DECL void  (*pcre_free)(void *);
   1.261 +PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
   1.262 +PCRE_EXP_DECL void  (*pcre_stack_free)(void *);
   1.263 +PCRE_EXP_DECL int   (*pcre_callout)(pcre_callout_block *);
   1.264 +#else   /* VPCOMPAT */
   1.265 +PCRE_EXP_DECL void *pcre_malloc(size_t);
   1.266 +PCRE_EXP_DECL void  pcre_free(void *);
   1.267 +PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
   1.268 +PCRE_EXP_DECL void  pcre_stack_free(void *);
   1.269 +PCRE_EXP_DECL int   pcre_callout(pcre_callout_block *);
   1.270 +#endif  /* VPCOMPAT */
   1.271 +
   1.272 +/* Exported PCRE functions */
   1.273 +
   1.274 +PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
   1.275 +                  const unsigned char *);
   1.276 +PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
   1.277 +                  int *, const unsigned char *);
   1.278 +PCRE_EXP_DECL int  pcre_config(int, void *);
   1.279 +PCRE_EXP_DECL int  pcre_copy_named_substring(const pcre *, const char *,
   1.280 +                  int *, int, const char *, char *, int);
   1.281 +PCRE_EXP_DECL int  pcre_copy_substring(const char *, int *, int, int, char *,
   1.282 +                  int);
   1.283 +PCRE_EXP_DECL int  pcre_dfa_exec(const pcre *, const pcre_extra *,
   1.284 +                  const char *, int, int, int, int *, int , int *, int);
   1.285 +PCRE_EXP_DECL int  pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
   1.286 +                   int, int, int, int *, int);
   1.287 +PCRE_EXP_DECL void pcre_free_substring(const char *);
   1.288 +PCRE_EXP_DECL void pcre_free_substring_list(const char **);
   1.289 +PCRE_EXP_DECL int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
   1.290 +                  void *);
   1.291 +PCRE_EXP_DECL int  pcre_get_named_substring(const pcre *, const char *,
   1.292 +                  int *, int, const char *, const char **);
   1.293 +PCRE_EXP_DECL int  pcre_get_stringnumber(const pcre *, const char *);
   1.294 +PCRE_EXP_DECL int  pcre_get_stringtable_entries(const pcre *, const char *,
   1.295 +                  char **, char **);
   1.296 +PCRE_EXP_DECL int  pcre_get_substring(const char *, int *, int, int,
   1.297 +                  const char **);
   1.298 +PCRE_EXP_DECL int  pcre_get_substring_list(const char *, int *, int,
   1.299 +                  const char ***);
   1.300 +PCRE_EXP_DECL int  pcre_info(const pcre *, int *, int *);
   1.301 +PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
   1.302 +PCRE_EXP_DECL int  pcre_refcount(pcre *, int);
   1.303 +PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
   1.304 +PCRE_EXP_DECL const char *pcre_version(void);
   1.305 +
   1.306 +#ifdef __cplusplus
   1.307 +}  /* extern "C" */
   1.308 +#endif
   1.309 +
   1.310 +#endif /* End of pcre.h */