rpm 5.3.7
|
00001 #ifndef H_MIRE 00002 #define H_MIRE 00003 00009 #include <rpmiotypes.h> 00010 00011 /*@-noparams@*/ 00012 #include <fnmatch.h> 00013 /*@=noparams@*/ 00014 #if defined(__LCLINT__) 00015 /*@-declundef -exportheader -redecl @*/ /* LCL: missing annotation */ 00016 extern int fnmatch (const char *__pattern, const char *__name, int __flags) 00017 /*@*/; 00018 /*@=declundef =exportheader =redecl @*/ 00019 #endif 00020 00023 /*@-exportlocal@*/ 00024 /*@unchecked@*/ 00025 extern int _mire_debug; 00026 /*@=exportlocal@*/ 00027 00028 /*@unchecked@*/ /*@only@*/ /*@null@*/ 00029 extern rpmioPool _mirePool; 00030 00033 /*@unchecked@*/ /*@null@*/ /*@shared@*/ 00034 extern const unsigned char * _mirePCREtables; 00035 00037 typedef enum mireEL_e { EL_LF, EL_CR, EL_CRLF, EL_ANY, EL_ANYCRLF } mireEL_t; 00038 00039 /*@unchecked@*/ 00040 extern mireEL_t _mireEL; 00041 00043 /*@unchecked@*/ 00044 extern int _mireSTRINGoptions; 00045 00047 /*@unchecked@*/ 00048 extern int _mireGLOBoptions; 00049 00051 /*@unchecked@*/ 00052 extern int _mireREGEXoptions; 00053 00055 /*@unchecked@*/ 00056 extern int _mirePCREoptions; 00057 00060 typedef /*@abstract@*/ /*@refcounted@*/ struct miRE_s * miRE; 00061 00065 typedef enum rpmMireMode_e { 00066 RPMMIRE_DEFAULT = 0, 00067 RPMMIRE_STRCMP = 1, 00068 RPMMIRE_REGEX = 2, 00069 RPMMIRE_GLOB = 3, 00070 RPMMIRE_PCRE = 4 00071 } rpmMireMode; 00072 00073 #if defined(_MIRE_INTERNAL) 00074 00075 #if defined(__LCLINT__) 00076 /*@-declundef -exportheader @*/ /* LCL: missing modifies (only is bogus) */ 00077 extern void regfree (/*@only@*/ regex_t *preg) 00078 /*@modifies *preg @*/; 00079 /*@=declundef =exportheader @*/ 00080 #endif 00081 00082 #if defined(WITH_PCRE) 00083 #include <pcre.h> 00084 #endif 00085 #if defined(WITH_PCRE) && defined(WITH_PCRE_POSIX) 00086 #include <pcreposix.h> 00087 #else 00088 #include <regex.h> 00089 #endif 00090 00093 struct miRE_s { 00094 struct rpmioItem_s _item; 00095 rpmMireMode mode; 00096 /*@only@*/ /*@relnull@*/ 00097 const char *pattern; 00098 /*@only@*/ /*@relnull@*/ 00099 regex_t *preg; 00100 /*@only@*/ /*@relnull@*/ 00101 void *pcre; 00102 /*@only@*/ /*@relnull@*/ 00103 void *hints; 00104 /*@shared@*/ /*@relnull@*/ 00105 const char * errmsg; 00106 /*@shared@*/ /*@relnull@*/ 00107 const unsigned char * table; 00108 /*@kept@*/ 00109 int * offsets; 00110 int noffsets; 00111 int erroff; 00112 int errcode; 00113 int fnflags; 00114 int cflags; 00115 int eflags; 00116 int coptions; 00117 int startoff; 00118 int eoptions; 00119 int notmatch; 00120 int tag; 00121 #if defined(__LCLINT__) 00122 /*@refs@*/ 00123 int nrefs; 00124 #endif 00125 }; 00126 #endif /* defined(_MIRE_INTERNAL) */ 00127 00128 #ifdef __cplusplus 00129 extern "C" { 00130 #endif 00131 00137 int mireClean(/*@null@*/ miRE mire) 00138 /*@modifies mire @*/; 00139 00145 miRE mireGetPool(/*@null@*/ rpmioPool pool) 00146 /*@globals _mirePool, fileSystem @*/ 00147 /*@modifies pool, _mirePool, fileSystem @*/; 00148 00154 /*@unused@*/ /*@null@*/ 00155 miRE mireUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire) 00156 /*@globals fileSystem @*/ 00157 /*@modifies mire, fileSystem @*/; 00158 #define mireUnlink(_mire) \ 00159 (miRE)rpmioUnlinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__) 00160 00166 /*@unused@*/ /*@newref@*/ /*@null@*/ 00167 miRE mireLink (/*@null@*/ miRE mire) 00168 /*@modifies mire @*/; 00169 #define mireLink(_mire) \ 00170 (miRE)rpmioLinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__) 00171 00177 /*@null@*/ 00178 miRE mireFree(/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire) 00179 /*@globals fileSystem @*/ 00180 /*@modifies mire, fileSystem @*/; 00181 #define mireFree(_mire) \ 00182 (miRE)rpmioFreePoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__) 00183 00190 /*@null@*/ 00191 void * mireFreeAll(/*@only@*/ /*@null@*/ miRE mire, int nmire) 00192 /*@globals fileSystem @*/ 00193 /*@modifies mire, fileSystem @*/; 00194 00201 /*@null@*/ 00202 miRE mireNew(rpmMireMode mode, int tag) 00203 /*@globals fileSystem @*/ 00204 /*@modifies fileSystem @*/; 00205 00215 int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options, 00216 /*@null@*/ const unsigned char * table) 00217 /*@modifies mire @*/; 00218 00226 int mireSetEOptions(miRE mire, /*@out@*/ /*@kept@*/ int * offsets, int noffsets) 00227 /*@modifies mire @*/; 00228 00237 int mireSetGOptions(/*@null@*/ const char * newline, 00238 int caseless, int multiline, int utf8) 00239 /*globals _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */ 00240 /*modifies _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */; 00241 00248 int mireSetLocale(/*@null@*/ miRE mire, /*@null@*/ const char * locale) 00249 /*@globals _mirePCREtables, internalState @*/ 00250 /*@modifies mire, _mirePCREtables, internalState @*/; 00251 00259 int mireRegcomp(miRE mire, const char * pattern) 00260 /*@modifies mire @*/; 00261 00269 int mireRegexec(miRE mire, const char * val, size_t vallen) 00270 /*@modifies mire @*/; 00271 00281 /*@null@*/ 00282 int mireAppend(rpmMireMode mode, int tag, const char * pattern, 00283 /*@null@*/ const unsigned char * table, 00284 miRE * mirep, int * nmirep) 00285 /*@globals fileSystem @*/ 00286 /*@modifies *mirep, *nmirep, fileSystem @*/; 00287 00298 int mireLoadPatterns(rpmMireMode mode, int tag, 00299 /*@null@*/ const char ** patterns, 00300 /*@null@*/ const unsigned char * table, 00301 miRE * mirep, int * nmirep) 00302 /*@globals fileSystem @*/ 00303 /*@modifies *mirep, *nmirep, fileSystem @*/; 00304 00314 int mireApply(/*@null@*/ miRE mire, int nmire, 00315 const char *s, size_t slen, int rc) 00316 /*@modifies mire@*/; 00317 00324 int mireStudy(miRE mire, int nmires) 00325 /*@modifies mire @*/; 00326 00327 #ifdef __cplusplus 00328 } 00329 #endif 00330 00331 #endif