rpm  5.2.1
mire.h
Go to the documentation of this file.
1 #ifndef H_MIRE
2 #define H_MIRE
3 
9 /*@-noparams@*/
10 #include <fnmatch.h>
11 /*@=noparams@*/
12 #if defined(__LCLINT__)
13 /*@-declundef -exportheader -redecl @*/ /* LCL: missing annotation */
14 extern int fnmatch (const char *__pattern, const char *__name, int __flags)
15  /*@*/;
16 /*@=declundef =exportheader =redecl @*/
17 #endif
18 
21 /*@-exportlocal@*/
22 /*@unchecked@*/
23 extern int _mire_debug;
24 /*@=exportlocal@*/
25 
26 /*@unchecked@*/ /*@only@*/ /*@null@*/
27 extern rpmioPool _mirePool;
28 
31 /*@unchecked@*/ /*@null@*/ /*@shared@*/
32 extern const unsigned char * _mirePCREtables;
33 
36 
37 /*@unchecked@*/
38 extern mireEL_t _mireEL;
39 
41 /*@unchecked@*/
42 extern int _mireSTRINGoptions;
43 
45 /*@unchecked@*/
46 extern int _mireGLOBoptions;
47 
49 /*@unchecked@*/
50 extern int _mireREGEXoptions;
51 
53 /*@unchecked@*/
54 extern int _mirePCREoptions;
55 
58 typedef /*@abstract@*/ /*@refcounted@*/ struct miRE_s * miRE;
59 
63 typedef enum rpmMireMode_e {
69 } rpmMireMode;
70 
71 #if defined(_MIRE_INTERNAL)
72 
73 #if defined(__LCLINT__)
74 /*@-declundef -exportheader @*/ /* LCL: missing modifies (only is bogus) */
75 extern void regfree (/*@only@*/ regex_t *preg)
76  /*@modifies *preg @*/;
77 /*@=declundef =exportheader @*/
78 #endif
79 
80 #if defined(WITH_PCRE)
81 #include <pcre.h>
82 #endif
83 #if defined(WITH_PCRE) && defined(WITH_PCRE_POSIX)
84 #include <pcreposix.h>
85 #else
86 #include <regex.h>
87 #endif
88 
91 struct miRE_s {
92  struct rpmioItem_s _item;
93  rpmMireMode mode;
94 /*@only@*/ /*@relnull@*/
95  const char *pattern;
96 /*@only@*/ /*@relnull@*/
97  regex_t *preg;
98 /*@only@*/ /*@relnull@*/
99  void *pcre;
100 /*@only@*/ /*@relnull@*/
101  void *hints;
102 /*@shared@*/ /*@relnull@*/
103  const char * errmsg;
104 /*@shared@*/ /*@relnull@*/
105  const unsigned char * table;
106 /*@kept@*/
107  int * offsets;
108  int noffsets;
109  int erroff;
110  int errcode;
111  int fnflags;
112  int cflags;
113  int eflags;
114  int coptions;
115  int startoff;
116  int eoptions;
117  int notmatch;
118  int tag;
119 #if defined(__LCLINT__)
120 /*@refs@*/
121  int nrefs;
122 #endif
123 };
124 #endif /* defined(_MIRE_INTERNAL) */
125 
126 #ifdef __cplusplus
127 extern "C" {
128 #endif
129 
135 int mireClean(/*@null@*/ miRE mire)
136  /*@modifies mire @*/;
137 
143 miRE mireGetPool(/*@null@*/ rpmioPool pool)
144  /*@globals _mirePool, fileSystem @*/
145  /*@modifies pool, _mirePool, fileSystem @*/;
146 
152 /*@unused@*/ /*@null@*/
153 miRE mireUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire)
154  /*@globals fileSystem @*/
155  /*@modifies mire, fileSystem @*/;
156 #define mireUnlink(_mire) \
157  (miRE)rpmioUnlinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
158 
164 /*@unused@*/ /*@newref@*/ /*@null@*/
165 miRE mireLink (/*@null@*/ miRE mire)
166  /*@modifies mire @*/;
167 #define mireLink(_mire) \
168  (miRE)rpmioLinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
169 
175 /*@null@*/
176 miRE mireFree(/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire)
177  /*@globals fileSystem @*/
178  /*@modifies mire, fileSystem @*/;
179 #define mireFree(_mire) \
180  (miRE)rpmioFreePoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
181 
188 /*@null@*/
189 void * mireFreeAll(/*@only@*/ /*@null@*/ miRE mire, int nmire)
190  /*@globals fileSystem @*/
191  /*@modifies mire, fileSystem @*/;
192 
199 /*@null@*/
200 miRE mireNew(rpmMireMode mode, int tag)
201  /*@globals fileSystem @*/
202  /*@modifies fileSystem @*/;
203 
213 int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options,
214  /*@null@*/ const unsigned char * table)
215  /*@modifies mire @*/;
216 
224 int mireSetEOptions(miRE mire, /*@out@*/ /*@kept@*/ int * offsets, int noffsets)
225  /*@modifies mire @*/;
226 
235 int mireSetGOptions(/*@null@*/ const char * newline,
236  int caseless, int multiline, int utf8)
237  /*globals _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */
238  /*modifies _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */;
239 
246 int mireSetLocale(/*@null@*/ miRE mire, /*@null@*/ const char * locale)
247  /*@globals _mirePCREtables, internalState @*/
248  /*@modifies mire, _mirePCREtables, internalState @*/;
249 
257 int mireRegcomp(miRE mire, const char * pattern)
258  /*@modifies mire @*/;
259 
267 int mireRegexec(miRE mire, const char * val, size_t vallen)
268  /*@modifies mire @*/;
269 
279 /*@null@*/
280 int mireAppend(rpmMireMode mode, int tag, const char * pattern,
281  /*@null@*/ const unsigned char * table,
282  miRE * mirep, int * nmirep)
283  /*@globals fileSystem @*/
284  /*@modifies *mirep, *nmirep, fileSystem @*/;
285 
296 int mireLoadPatterns(rpmMireMode mode, int tag,
297  /*@null@*/ const char ** patterns,
298  /*@null@*/ const unsigned char * table,
299  miRE * mirep, int * nmirep)
300  /*@globals fileSystem @*/
301  /*@modifies *mirep, *nmirep, fileSystem @*/;
302 
312 int mireApply(/*@null@*/ miRE mire, int nmire,
313  const char *s, size_t slen, int rc)
314  /*@modifies mire@*/;
315 
322 int mireStudy(miRE mire, int nmires)
323  /*@modifies mire @*/;
324 
325 #ifdef __cplusplus
326 }
327 #endif
328 
329 #endif