rpm  5.4.10
mire.h
Go to the documentation of this file.
1 #ifndef H_MIRE
2 #define H_MIRE
3 
9 #include <rpmiotypes.h>
10 
11 /*@-noparams@*/
12 #include <fnmatch.h>
13 /*@=noparams@*/
14 #if defined(__LCLINT__)
15 /*@-declundef -exportheader -redecl @*/ /* LCL: missing annotation */
16 extern int fnmatch (const char *__pattern, const char *__name, int __flags)
17  /*@*/;
18 /*@=declundef =exportheader =redecl @*/
19 #endif
20 
23 /*@-exportlocal@*/
24 /*@unchecked@*/
25 extern int _mire_debug;
26 /*@=exportlocal@*/
27 
28 /*@unchecked@*/ /*@only@*/ /*@null@*/
29 extern rpmioPool _mirePool;
30 
33 /*@unchecked@*/ /*@null@*/ /*@shared@*/
34 extern const unsigned char * _mirePCREtables;
35 
38 
39 /*@unchecked@*/
40 extern mireEL_t _mireEL;
41 
43 /*@unchecked@*/
44 extern int _mireSTRINGoptions;
45 
47 /*@unchecked@*/
48 extern int _mireGLOBoptions;
49 
51 /*@unchecked@*/
52 extern int _mireREGEXoptions;
53 
55 /*@unchecked@*/
56 extern int _mirePCREoptions;
57 
60 typedef /*@abstract@*/ /*@refcounted@*/ struct miRE_s * miRE;
61 
65 typedef enum rpmMireMode_e {
71 } rpmMireMode;
72 
73 #if defined(_MIRE_INTERNAL)
74 
75 #if defined(__LCLINT__)
76 /*@-declundef -exportheader @*/ /* LCL: missing modifies (only is bogus) */
77 extern void regfree (/*@only@*/ regex_t *preg)
78  /*@modifies *preg @*/;
79 /*@=declundef =exportheader @*/
80 #endif
81 
82 #if defined(WITH_PCRE)
83 #include <pcre.h>
84 #endif
85 #if defined(WITH_PCRE) && defined(WITH_PCRE_POSIX)
86 #include <pcreposix.h>
87 #else
88 #include <regex.h>
89 #endif
90 
93 struct miRE_s {
94  struct rpmioItem_s _item;
95  rpmMireMode mode;
96 /*@only@*/ /*@relnull@*/
97  const char *pattern;
98 /*@only@*/ /*@relnull@*/
99  regex_t *preg;
100 /*@only@*/ /*@relnull@*/
101  void *pcre;
102 /*@only@*/ /*@relnull@*/
103  void *hints;
104 /*@shared@*/ /*@relnull@*/
105  const char * errmsg;
106 /*@shared@*/ /*@relnull@*/
107  const unsigned char * table;
108 /*@kept@*/
109  int * offsets;
110  int noffsets;
111  int erroff;
112  int errcode;
113  int fnflags;
114  int cflags;
115  int eflags;
116  int coptions;
117  int startoff;
118  int eoptions;
119  int notmatch;
120  int tag;
121 #if defined(__LCLINT__)
122 /*@refs@*/
123  int nrefs;
124 #endif
125 };
126 #endif /* defined(_MIRE_INTERNAL) */
127 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
137 int mireClean(/*@null@*/ miRE mire)
138  /*@modifies mire @*/;
139 
145 miRE mireGetPool(/*@null@*/ rpmioPool pool)
146  /*@globals _mirePool, fileSystem @*/
147  /*@modifies pool, _mirePool, fileSystem @*/;
148 
154 /*@unused@*/ /*@null@*/
155 miRE mireUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire)
156  /*@globals fileSystem @*/
157  /*@modifies mire, fileSystem @*/;
158 #define mireUnlink(_mire) \
159  (miRE)rpmioUnlinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
160 
166 /*@unused@*/ /*@newref@*/ /*@null@*/
167 miRE mireLink (/*@null@*/ miRE mire)
168  /*@modifies mire @*/;
169 #define mireLink(_mire) \
170  (miRE)rpmioLinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
171 
177 /*@null@*/
178 miRE mireFree(/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire)
179  /*@globals fileSystem @*/
180  /*@modifies mire, fileSystem @*/;
181 #define mireFree(_mire) \
182  (miRE)rpmioFreePoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
183 
190 /*@null@*/
191 void * mireFreeAll(/*@only@*/ /*@null@*/ miRE mire, int nmire)
192  /*@globals fileSystem @*/
193  /*@modifies mire, fileSystem @*/;
194 
201 /*@null@*/
202 miRE mireNew(rpmMireMode mode, int tag)
203  /*@globals fileSystem @*/
204  /*@modifies fileSystem @*/;
205 
215 int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options,
216  /*@null@*/ const unsigned char * table)
217  /*@modifies mire @*/;
218 
226 int mireSetEOptions(miRE mire, /*@out@*/ /*@kept@*/ int * offsets, int noffsets)
227  /*@modifies mire @*/;
228 
237 int mireSetGOptions(/*@null@*/ const char * newline,
238  int caseless, int multiline, int utf8)
239  /*globals _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */
240  /*modifies _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */;
241 
248 int mireSetLocale(/*@null@*/ miRE mire, /*@null@*/ const char * locale)
249  /*@globals _mirePCREtables, internalState @*/
250  /*@modifies mire, _mirePCREtables, internalState @*/;
251 
259 int mireRegcomp(miRE mire, const char * pattern)
260  /*@modifies mire @*/;
261 
269 int mireRegexec(miRE mire, const char * val, size_t vallen)
270  /*@modifies mire @*/;
271 
281 /*@null@*/
282 int mireAppend(rpmMireMode mode, int tag, const char * pattern,
283  /*@null@*/ const unsigned char * table,
284  miRE * mirep, int * nmirep)
285  /*@globals fileSystem @*/
286  /*@modifies *mirep, *nmirep, fileSystem @*/;
287 
298 int mireLoadPatterns(rpmMireMode mode, int tag,
299  /*@null@*/ const char ** patterns,
300  /*@null@*/ const unsigned char * table,
301  miRE * mirep, int * nmirep)
302  /*@globals fileSystem @*/
303  /*@modifies *mirep, *nmirep, fileSystem @*/;
304 
314 int mireApply(/*@null@*/ miRE mire, int nmire,
315  const char *s, size_t slen, int rc)
316  /*@modifies mire@*/;
317 
324 int mireStudy(miRE mire, int nmires)
325  /*@modifies mire @*/;
326 
327 #ifdef __cplusplus
328 }
329 #endif
330 
331 #endif