Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

pcreposix.h

Go to the documentation of this file.
00001 /*************************************************
00002 *       Perl-Compatible Regular Expressions      *
00003 *************************************************/
00004 
00005 #ifndef _PCREPOSIX_H
00006 #define _PCREPOSIX_H
00007 
00008 /* This is the header for the POSIX wrapper interface to the PCRE Perl-
00009 Compatible Regular Expression library. It defines the things POSIX says should
00010 be there. I hope.
00011 
00012             Copyright (c) 1997-2004 University of Cambridge
00013 
00014 -----------------------------------------------------------------------------
00015 Redistribution and use in source and binary forms, with or without
00016 modification, are permitted provided that the following conditions are met:
00017 
00018     * Redistributions of source code must retain the above copyright notice,
00019       this list of conditions and the following disclaimer.
00020 
00021     * Redistributions in binary form must reproduce the above copyright
00022       notice, this list of conditions and the following disclaimer in the
00023       documentation and/or other materials provided with the distribution.
00024 
00025     * Neither the name of the University of Cambridge nor the names of its
00026       contributors may be used to endorse or promote products derived from
00027       this software without specific prior written permission.
00028 
00029 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00030 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00031 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00032 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00033 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00034 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00035 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00036 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00037 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00038 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00039 POSSIBILITY OF SUCH DAMAGE.
00040 -----------------------------------------------------------------------------
00041 */
00042 
00043 /* Have to include stdlib.h in order to ensure that size_t is defined. */
00044 
00045 #include <stdlib.h>
00046 
00047 /* Allow for C++ users */
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00053 /* Options defined by POSIX. */
00054 
00055 #define REG_ICASE     0x01
00056 #define REG_NEWLINE   0x02
00057 #define REG_NOTBOL    0x04
00058 #define REG_NOTEOL    0x08
00059 
00060 /* These are not used by PCRE, but by defining them we make it easier
00061 to slot PCRE into existing programs that make POSIX calls. */
00062 
00063 #define REG_EXTENDED  0
00064 #define REG_NOSUB     0
00065 
00066 /* Error values. Not all these are relevant or used by the wrapper. */
00067 
00068 enum {
00069   REG_ASSERT = 1,  /* internal error ? */
00070   REG_BADBR,       /* invalid repeat counts in {} */
00071   REG_BADPAT,      /* pattern error */
00072   REG_BADRPT,      /* ? * + invalid */
00073   REG_EBRACE,      /* unbalanced {} */
00074   REG_EBRACK,      /* unbalanced [] */
00075   REG_ECOLLATE,    /* collation error - not relevant */
00076   REG_ECTYPE,      /* bad class */
00077   REG_EESCAPE,     /* bad escape sequence */
00078   REG_EMPTY,       /* empty expression */
00079   REG_EPAREN,      /* unbalanced () */
00080   REG_ERANGE,      /* bad range inside [] */
00081   REG_ESIZE,       /* expression too big */
00082   REG_ESPACE,      /* failed to get memory */
00083   REG_ESUBREG,     /* bad back reference */
00084   REG_INVARG,      /* bad argument */
00085   REG_NOMATCH      /* match failed */
00086 };
00087 
00088 
00089 /* The structure representing a compiled regular expression. */
00090 
00091 typedef struct {
00092   void *re_pcre;
00093   size_t re_nsub;
00094   size_t re_erroffset;
00095 } regex_t;
00096 
00097 /* The structure in which a captured offset is returned. */
00098 
00099 typedef int regoff_t;
00100 
00101 typedef struct {
00102   regoff_t rm_so;
00103   regoff_t rm_eo;
00104 } regmatch_t;
00105 
00106 /* The functions */
00107 
00108 extern int regcomp(regex_t *, const char *, int);
00109 extern int regexec(const regex_t *, const char *, size_t, regmatch_t *, int);
00110 extern size_t regerror(int, const regex_t *, char *, size_t);
00111 extern void regfree(regex_t *);
00112 
00113 #ifdef __cplusplus
00114 }   /* extern "C" */
00115 #endif
00116 
00117 #endif /* End of pcreposix.h */

Generated on Wed Feb 16 12:41:08 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1