mire.h
Go to the documentation of this file.
#ifndef H_MIRE
#define H_MIRE
/*@-noparams@*/
#include <fnmatch.h>
/*@=noparams@*/
#if defined(__LCLINT__)
/*@-declundef -exportheader -redecl @*/ /* LCL: missing annotation */
extern int fnmatch (const char *__pattern, const char *__name, int __flags)
/*@*/;
/*@=declundef =exportheader =redecl @*/
#endif
/*@-exportlocal@*/
/*@unchecked@*/
extern int _mire_debug;
/*@=exportlocal@*/
/*@unchecked@*/ /*@only@*/ /*@null@*/
extern rpmioPool _mirePool;
/*@unchecked@*/ /*@null@*/ /*@shared@*/
extern const unsigned char * _mirePCREtables;
typedef enum mireEL_e { EL_LF, EL_CR, EL_CRLF, EL_ANY, EL_ANYCRLF } mireEL_t;
/*@unchecked@*/
extern mireEL_t _mireEL;
/*@unchecked@*/
extern int _mireSTRINGoptions;
/*@unchecked@*/
extern int _mireGLOBoptions;
/*@unchecked@*/
extern int _mireREGEXoptions;
/*@unchecked@*/
extern int _mirePCREoptions;
typedef /*@abstract@*/ /*@refcounted@*/ struct miRE_s * miRE;
typedef enum rpmMireMode_e {
RPMMIRE_DEFAULT = 0,
RPMMIRE_STRCMP = 1,
RPMMIRE_REGEX = 2,
RPMMIRE_GLOB = 3,
RPMMIRE_PCRE = 4
} rpmMireMode;
#if defined(_MIRE_INTERNAL)
#if defined(__LCLINT__)
/*@-declundef -exportheader @*/ /* LCL: missing modifies (only is bogus) */
extern void regfree (/*@only@*/ regex_t *preg)
/*@modifies *preg @*/;
/*@=declundef =exportheader @*/
#endif
#if defined(WITH_PCRE)
#include <pcre.h>
#endif
#if defined(WITH_PCRE) && defined(WITH_PCRE_POSIX)
#include <pcreposix.h>
#else
#include <regex.h>
#endif
struct miRE_s {
struct rpmioItem_s _item;
rpmMireMode mode;
/*@only@*/ /*@relnull@*/
const char *pattern;
/*@only@*/ /*@relnull@*/
regex_t *preg;
/*@only@*/ /*@relnull@*/
void *pcre;
/*@only@*/ /*@relnull@*/
void *hints;
/*@shared@*/ /*@relnull@*/
const char * errmsg;
/*@shared@*/ /*@relnull@*/
const unsigned char * table;
/*@kept@*/
int * offsets;
int noffsets;
int erroff;
int errcode;
int fnflags;
int cflags;
int eflags;
int coptions;
int startoff;
int eoptions;
int notmatch;
int tag;
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#endif /* defined(_MIRE_INTERNAL) */
#ifdef __cplusplus
extern "C" {
#endif
int mireClean(/*@null@*/ miRE mire)
/*@modifies mire @*/;
miRE mireGetPool(/*@null@*/ rpmioPool pool)
/*@globals _mirePool, fileSystem @*/
/*@modifies pool, _mirePool, fileSystem @*/;
/*@unused@*/ /*@null@*/
miRE mireUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire)
/*@globals fileSystem @*/
/*@modifies mire, fileSystem @*/;
#define mireUnlink(_mire) \
(miRE)rpmioUnlinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
/*@unused@*/ /*@newref@*/ /*@null@*/
miRE mireLink (/*@null@*/ miRE mire)
/*@modifies mire @*/;
#define mireLink(_mire) \
(miRE)rpmioLinkPoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
/*@null@*/
miRE mireFree(/*@killref@*/ /*@only@*/ /*@null@*/ miRE mire)
/*@globals fileSystem @*/
/*@modifies mire, fileSystem @*/;
#define mireFree(_mire) \
(miRE)rpmioFreePoolItem((rpmioItem)_mire, __FUNCTION__, __FILE__, __LINE__)
/*@null@*/
void * mireFreeAll(/*@only@*/ /*@null@*/ miRE mire, int nmire)
/*@globals fileSystem @*/
/*@modifies mire, fileSystem @*/;
/*@null@*/
miRE mireNew(rpmMireMode mode, int tag)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
int mireSetCOptions(miRE mire, rpmMireMode mode, int tag, int options,
/*@null@*/ const unsigned char * table)
/*@modifies mire @*/;
int mireSetEOptions(miRE mire, /*@out@*/ /*@kept@*/ int * offsets, int noffsets)
/*@modifies mire @*/;
int mireSetGOptions(/*@null@*/ const char * newline,
int caseless, int multiline, int utf8)
/*globals _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */
/*modifies _mireGLOBoptions, _mireREGEXoptions, _mirePCREoptions */;
int mireSetLocale(/*@null@*/ miRE mire, /*@null@*/ const char * locale)
/*@globals _mirePCREtables, internalState @*/
/*@modifies mire, _mirePCREtables, internalState @*/;
int mireRegcomp(miRE mire, const char * pattern)
/*@modifies mire @*/;
int mireRegexec(miRE mire, const char * val, size_t vallen)
/*@modifies mire @*/;
/*@null@*/
int mireAppend(rpmMireMode mode, int tag, const char * pattern,
/*@null@*/ const unsigned char * table,
miRE * mirep, int * nmirep)
/*@globals fileSystem @*/
/*@modifies *mirep, *nmirep, fileSystem @*/;
int mireLoadPatterns(rpmMireMode mode, int tag,
/*@null@*/ const char ** patterns,
/*@null@*/ const unsigned char * table,
miRE * mirep, int * nmirep)
/*@globals fileSystem @*/
/*@modifies *mirep, *nmirep, fileSystem @*/;
int mireApply(/*@null@*/ miRE mire, int nmire,
const char *s, size_t slen, int rc)
/*@modifies mire@*/;
int mireStudy(miRE mire, int nmires)
/*@modifies mire @*/;
#ifdef __cplusplus
}
#endif
#endif