Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

pcreposix.h

Go to the documentation of this file.
00001 /*************************************************
00002 *       Perl-Compatible Regular Expressions      *
00003 *************************************************/
00004 
00005 /* Copyright (c) 1997-2003 University of Cambridge */
00006 
00007 #ifndef _PCREPOSIX_H
00008 #define _PCREPOSIX_H
00009 
00010 /* This is the header for the POSIX wrapper interface to the PCRE Perl-
00011 Compatible Regular Expression library. It defines the things POSIX says should
00012 be there. I hope. */
00013 
00014 /* Have to include stdlib.h in order to ensure that size_t is defined. */
00015 
00016 #include <stdlib.h>
00017 
00018 /* Allow for C++ users */
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00024 /* Options defined by POSIX. */
00025 
00026 #define REG_ICASE     0x01
00027 #define REG_NEWLINE   0x02
00028 #define REG_NOTBOL    0x04
00029 #define REG_NOTEOL    0x08
00030 
00031 /* These are not used by PCRE, but by defining them we make it easier
00032 to slot PCRE into existing programs that make POSIX calls. */
00033 
00034 #define REG_EXTENDED  0
00035 #define REG_NOSUB     0
00036 
00037 /* Error values. Not all these are relevant or used by the wrapper. */
00038 
00039 enum {
00040   REG_ASSERT = 1,  /* internal error ? */
00041   REG_BADBR,       /* invalid repeat counts in {} */
00042   REG_BADPAT,      /* pattern error */
00043   REG_BADRPT,      /* ? * + invalid */
00044   REG_EBRACE,      /* unbalanced {} */
00045   REG_EBRACK,      /* unbalanced [] */
00046   REG_ECOLLATE,    /* collation error - not relevant */
00047   REG_ECTYPE,      /* bad class */
00048   REG_EESCAPE,     /* bad escape sequence */
00049   REG_EMPTY,       /* empty expression */
00050   REG_EPAREN,      /* unbalanced () */
00051   REG_ERANGE,      /* bad range inside [] */
00052   REG_ESIZE,       /* expression too big */
00053   REG_ESPACE,      /* failed to get memory */
00054   REG_ESUBREG,     /* bad back reference */
00055   REG_INVARG,      /* bad argument */
00056   REG_NOMATCH      /* match failed */
00057 };
00058 
00059 
00060 /* The structure representing a compiled regular expression. */
00061 
00062 typedef struct {
00063   void *re_pcre;
00064   size_t re_nsub;
00065   size_t re_erroffset;
00066 } regex_t;
00067 
00068 /* The structure in which a captured offset is returned. */
00069 
00070 typedef int regoff_t;
00071 
00072 typedef struct {
00073   regoff_t rm_so;
00074   regoff_t rm_eo;
00075 } regmatch_t;
00076 
00077 /* The functions */
00078 
00079 extern int regcomp(regex_t *, const char *, int);
00080 extern int regexec(const regex_t *, const char *, size_t, regmatch_t *, int);
00081 extern size_t regerror(int, const regex_t *, char *, size_t);
00082 extern void regfree(regex_t *);
00083 
00084 #ifdef __cplusplus
00085 }   /* extern "C" */
00086 #endif
00087 
00088 #endif /* End of pcreposix.h */

Generated on Sun May 14 14:51:20 2006 by  doxygen 1.4.2