00001 #ifndef H_MIRE
00002 #define H_MIRE
00003
00009
00010 #include <fnmatch.h>
00011
00012 #if defined(__LCLINT__)
00013
00014 extern int fnmatch (const char *__pattern, const char *__name, int __flags)
00015 ;
00016
00017 #endif
00018
00021
00022
00023 extern int _mire_debug;
00024
00025
00026
00027 extern rpmioPool _mirePool;
00028
00031
00032 extern const unsigned char * _mirePCREtables;
00033
00035 typedef enum mireEL_e { EL_LF, EL_CR, EL_CRLF, EL_ANY, EL_ANYCRLF } mireEL_t;
00036
00037
00038 extern mireEL_t _mireEL;
00039
00041
00042 extern int _mireSTRINGoptions;
00043
00045
00046 extern int _mireGLOBoptions;
00047
00049
00050 extern int _mireREGEXoptions;
00051
00053
00054 extern int _mirePCREoptions;
00055
00058 typedef struct miRE_s * miRE;
00059
00063 typedef enum rpmMireMode_e {
00064 RPMMIRE_DEFAULT = 0,
00065 RPMMIRE_STRCMP = 1,
00066 RPMMIRE_REGEX = 2,
00067 RPMMIRE_GLOB = 3,
00068 RPMMIRE_PCRE = 4
00069 } rpmMireMode;
00070
00071 #if defined(_MIRE_INTERNAL)
00072
00073 #if defined(__LCLINT__)
00074
00075 extern void regfree ( regex_t *preg)
00076 ;
00077
00078 #endif
00079
00080 #if defined(WITH_PCRE)
00081 #include <pcre.h>
00082 #endif
00083 #if defined(WITH_PCRE) && defined(WITH_PCRE_POSIX)
00084 #include <pcreposix.h>
00085 #else
00086 #include <regex.h>
00087 #endif
00088
00091 struct miRE_s {
00092 struct rpmioItem_s _item;
00093 rpmMireMode mode;
00094
00095 const char *pattern;
00096
00097 regex_t *preg;
00098
00099 void *pcre;
00100
00101 void *hints;
00102
00103 const char * errmsg;
00104
00105 const unsigned char * table;
00106
00107 int * offsets;
00108 int noffsets;
00109 int erroff;
00110 int errcode;
00111 int fnflags;
00112 int cflags;
00113 int eflags;
00114 int coptions;
00115 int startoff;
00116 int eoptions;
00117 int notmatch;
00118 int tag;
00119 #if defined(__LCLINT__)
00120
00121 int nrefs;
00122 #endif
00123 };
00124 #endif
00125
00126 #ifdef __cplusplus
00127 extern "C" {
00128 #endif
00129
00135 int mireClean( miRE mire)
00136 ;
00137
00143 miRE mireGetPool( rpmioPool pool)
00144
00145 ;
00146
00152
00153 miRE mireUnlink ( miRE mire)
00154
00155 ;
00156 #define mireUnlink(_mire) \
00157 (miRE)rpmioUnlinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
00158
00164
00165 miRE mireLink ( miRE mire)
00166 ;
00167 #define mireLink(_mire) \
00168 (miRE)rpmioLinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
00169
00175
00176 miRE mireFree( miRE mire)
00177
00178 ;
00179 #define mireFree(_mire) \
00180 (miRE)rpmioFreePoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
00181
00188
00189 void * mireFreeAll( miRE mire, int nmire)
00190
00191 ;
00192
00199
00200 miRE mireNew(rpmMireMode mode, int tag)
00201
00202 ;
00203
00213 int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options,
00214 const unsigned char * table)
00215 ;
00216
00224 int mireSetEOptions(miRE mire, int * offsets, int noffsets)
00225 ;
00226
00235 int mireSetGOptions( const char * newline,
00236 int caseless, int multiline, int utf8)
00237
00238 ;
00239
00246 int mireSetLocale( miRE mire, const char * locale)
00247
00248 ;
00249
00257 int mireRegcomp(miRE mire, const char * pattern)
00258 ;
00259
00267 int mireRegexec(miRE mire, const char * val, size_t vallen)
00268 ;
00269
00279
00280 int mireAppend(rpmMireMode mode, int tag, const char * pattern,
00281 const unsigned char * table,
00282 miRE * mirep, int * nmirep)
00283
00284 ;
00285
00296 int mireLoadPatterns(rpmMireMode mode, int tag,
00297 const char ** patterns,
00298 const unsigned char * table,
00299 miRE * mirep, int * nmirep)
00300
00301 ;
00302
00312 int mireApply( miRE mire, int nmire,
00313 const char *s, size_t slen, int rc)
00314 ;
00315
00322 int mireStudy(miRE mire, int nmires)
00323 ;
00324
00325 #ifdef __cplusplus
00326 }
00327 #endif
00328
00329 #endif