rpmmacro.h
Go to the documentation of this file.
#ifndef _H_MACRO_
#define _H_MACRO_
typedef /*@abstract@*/ struct MacroEntry_s * MacroEntry;
typedef /*@abstract@*/ struct MacroContext_s * MacroContext;
#if defined(_MACRO_INTERNAL)
struct MacroEntry_s {
struct MacroEntry_s *prev;
const char *name;
const char *opts;
const char *body;
int used;
short level;
unsigned short flags;
};
struct MacroContext_s {
/*@owned@*//*@null@*/
MacroEntry *macroTable;
int macrosAllocated;
int firstFree;
};
#endif
/*@-redecl@*/
/*@checked@*/
extern MacroContext rpmGlobalMacroContext;
/*@checked@*/
extern MacroContext rpmCLIMacroContext;
/*@observer@*/ /*@checked@*/
extern const char * rpmMacrofiles;
/*@=redecl@*/
#define RMIL_DEFAULT -15
#define RMIL_MACROFILES -13
#define RMIL_RPMRC -11
#define RMIL_CMDLINE -7
#define RMIL_TARBALL -5
#define RMIL_SPEC -3
#define RMIL_OLDSPEC -1
#define RMIL_GLOBAL 0
#ifdef __cplusplus
extern "C" {
#endif
void rpmDumpMacroTable(/*@null@*/ MacroContext mc, /*@null@*/ FILE * fp)
/*@globals rpmGlobalMacroContext, fileSystem @*/
/*@modifies *fp, fileSystem @*/;
int
rpmGetMacroEntries(/*@null@*/ MacroContext mc, /*@null@*/ void * _mire,
int used, /*@null@*/ const char *** avp)
/*@globals rpmGlobalMacroContext @*/
/*@modifies _mire, *avp @*/;
int rpmSecuritySaneFile(const char *filename)
/*@globals internalState @*/;
int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
/*@out@*/ const char *** argvPtr)
/*@globals fileSystem, internalState @*/
/*@modifies *argcPtr, *argvPtr, fileSystem, internalState @*/;
int expandMacros(/*@null@*/ void * spec, /*@null@*/ MacroContext mc,
/*@in@*/ /*@out@*/ char * sbuf, size_t slen)
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
/*@modifies *sbuf, rpmGlobalMacroContext, fileSystem, internalState @*/;
void addMacro(/*@null@*/ MacroContext mc, const char * n,
/*@null@*/ const char * o, /*@null@*/ const char * b, int level)
/*@globals rpmGlobalMacroContext, internalState @*/
/*@modifies mc, rpmGlobalMacroContext, internalState @*/;
void delMacro(/*@null@*/ MacroContext mc, const char * n)
/*@globals rpmGlobalMacroContext @*/
/*@modifies mc, rpmGlobalMacroContext @*/;
int rpmDefineMacro(/*@null@*/ MacroContext mc, const char * macro, int level)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies mc, rpmGlobalMacroContext, internalState @*/;
int rpmUndefineMacro(/*@null@*/ MacroContext mc, const char * macro)
/*@globals rpmGlobalMacroContext, internalState @*/
/*@modifies mc, rpmGlobalMacroContext, internalState @*/;
void rpmLoadMacros(/*@null@*/ MacroContext mc, int level)
/*@globals rpmGlobalMacroContext, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
int rpmLoadMacroFile(/*@null@*/ MacroContext mc, const char * fn)
/*@globals rpmGlobalMacroContext,
h_errno, fileSystem, internalState @*/
/*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
void rpmInitMacros(/*@null@*/ MacroContext mc, const char * macrofiles)
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
h_errno, fileSystem, internalState @*/
/*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
void rpmFreeMacros(/*@null@*/ MacroContext mc)
/*@globals rpmGlobalMacroContext @*/
/*@modifies mc, rpmGlobalMacroContext @*/;
typedef enum rpmCompressedMagic_e {
COMPRESSED_NOT = 0,
COMPRESSED_OTHER = 1,
COMPRESSED_BZIP2 = 2,
COMPRESSED_ZIP = 3,
COMPRESSED_LZOP = 4,
COMPRESSED_LZMA = 5,
COMPRESSED_XZ = 6
} rpmCompressedMagic;
int isCompressed(const char * file, /*@out@*/ rpmCompressedMagic * compressed)
/*@globals h_errno, fileSystem, internalState @*/
/*@modifies *compressed, fileSystem, internalState @*/;
char * rpmExpand(/*@null@*/ const char * arg, ...)
#if defined(__GNUC__) && __GNUC__ >= 4
/* issue a warning if the list is not NULL-terminated */
__attribute__((sentinel))
#endif
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
char * rpmMCExpand(/*@null@*/ MacroContext mc, /*@null@*/ const char * arg, ...)
#if defined(__GNUC__) && __GNUC__ >= 4
/* issue a warning if the list is not NULL-terminated */
__attribute__((sentinel))
#endif
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
/*@null@*/
char * rpmCleanPath(/*@returned@*/ /*@null@*/ char * path)
/*@modifies *path @*/;
/*@-redecl@*/ /* LCL: shrug */
const char * rpmGetPath(/*@null@*/ const char * path, ...)
#if defined(__GNUC__) && __GNUC__ >= 4
/* issue a warning if the list is not NULL-terminated */
__attribute__((sentinel))
#endif
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
/*@=redecl@*/
/*@-redecl@*/ /* LCL: shrug */
const char * rpmGenPath(/*@null@*/ const char * urlroot,
/*@null@*/ const char * urlmdir,
/*@null@*/ const char * urlfile)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
/*@=redecl@*/
int rpmExpandNumeric (const char * arg)
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/
/*@modifies rpmGlobalMacroContext, internalState @*/;
#ifdef __cplusplus
}
#endif
#endif /* _H_ MACRO_ */