- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# rpmio/rpmmacro.h

Go to the documentation of this file.

    00001 #ifndef _H_MACRO_
    00002 #define _H_MACRO_
    00003
    00004 #include <mire.h>
    00005
    00009 typedef /*@abstract@*/ struct MacroEntry_s * MacroEntry;
    00010 typedef /*@abstract@*/ struct MacroContext_s * MacroContext;
    00011
    00012 #if defined(_MACRO_INTERNAL)
    00013
    00014 struct MacroEntry_s {
    00015     struct MacroEntry_s *prev;
    00016     const char *name;
    00017     const char *opts;
    00018     const char *body;
    00019     int used;
    00020     short level;
    00021     unsigned short flags;
    00022 };
    00023
    00025 struct MacroContext_s {
    00026 /*@owned@*//*@null@*/
    00027     MacroEntry *macroTable;
    00028     int macrosAllocated;
    00029     int firstFree;
    00030 };
    00031 #endif
    00032
    00033 /*@-redecl@*/
    00034 /*@checked@*/
    00035 extern MacroContext rpmGlobalMacroContext;
    00036
    00037 /*@checked@*/
    00038 extern MacroContext rpmCLIMacroContext;
    00039
    00045 /*@observer@*/ /*@checked@*/
    00046 extern const char * rpmMacrofiles;
    00047 /*@=redecl@*/
    00048
    00052 #define RMIL_DEFAULT    -15
    00053 #define RMIL_MACROFILES -13
    00054 #define RMIL_RPMRC      -11
    00055
    00056 #define RMIL_CMDLINE    -7
    00057 #define RMIL_TARBALL    -5
    00058 #define RMIL_SPEC       -3
    00059 #define RMIL_OLDSPEC    -1
    00060 #define RMIL_GLOBAL     0
    00061
    00062 #ifdef __cplusplus
    00063 extern "C" {
    00064 #endif
    00065
    00071 void rpmDumpMacroTable(/*@null@*/ MacroContext mc, /*@null@*/ FILE * fp)
    00072         /*@globals rpmGlobalMacroContext, fileSystem @*/
    00073         /*@modifies *fp, fileSystem @*/;
    00074
    00083 int
    00084 rpmGetMacroEntries(/*@null@*/ MacroContext mc, /*@null@*/ miRE mire,
    00085                 int used, /*@null@*/ const char *** avp)
    00086         /*@globals rpmGlobalMacroContext @*/
    00087         /*@modifies mire, *avp @*/;
    00088
    00094 int rpmSecuritySaneFile(const char *filename)
    00095         /*@globals fileSystem, internalState @*/;
    00096
    00104 int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
    00105                 /*@out@*/ const char *** argvPtr)
    00106         /*@globals fileSystem, internalState @*/
    00107         /*@modifies *argcPtr, *argvPtr, fileSystem, internalState @*/;
    00108
    00119 int expandMacros(/*@null@*/ void * spec, /*@null@*/ MacroContext mc,
    00120                 /*@in@*/ /*@out@*/ char * sbuf, size_t slen)
    00121         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00122         /*@modifies *sbuf, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00123
    00133 void addMacro(/*@null@*/ MacroContext mc, const char * n,
    00134                 /*@null@*/ const char * o, /*@null@*/ const char * b, int level)
    00135         /*@globals rpmGlobalMacroContext, internalState @*/
    00136         /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
    00137
    00143 void delMacro(/*@null@*/ MacroContext mc, const char * n)
    00144         /*@globals rpmGlobalMacroContext @*/
    00145         /*@modifies mc, rpmGlobalMacroContext @*/;
    00146
    00154 int rpmDefineMacro(/*@null@*/ MacroContext mc, const char * macro, int level)
    00155         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00156         /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
    00157
    00164 int rpmUndefineMacro(/*@null@*/ MacroContext mc, const char * macro)
    00165         /*@globals rpmGlobalMacroContext, internalState @*/
    00166         /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
    00167
    00173 void rpmLoadMacros(/*@null@*/ MacroContext mc, int level)
    00174         /*@globals rpmGlobalMacroContext, internalState @*/
    00175         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00176
    00182 int rpmLoadMacroFile(/*@null@*/ MacroContext mc, const char * fn)
    00183         /*@globals rpmGlobalMacroContext,
    00184                 h_errno, fileSystem, internalState @*/
    00185         /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00186
    00192 void rpmInitMacros(/*@null@*/ MacroContext mc, const char * macrofiles)
    00193         /*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
    00194                 h_errno, fileSystem, internalState @*/
    00195         /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00196
    00201 void rpmFreeMacros(/*@null@*/ MacroContext mc)
    00202         /*@globals rpmGlobalMacroContext @*/
    00203         /*@modifies mc, rpmGlobalMacroContext @*/;
    00204
    00205 typedef enum rpmCompressedMagic_e {
    00206     COMPRESSED_NOT              = 0,
    00207     COMPRESSED_OTHER            = 1,
    00208     COMPRESSED_BZIP2            = 2,
    00209     COMPRESSED_ZIP              = 3,
    00210     COMPRESSED_LZOP             = 4,
    00211     COMPRESSED_LZMA             = 5,
    00212     COMPRESSED_XZ               = 6
    00213 } rpmCompressedMagic;
    00214
    00221 int isCompressed(const char * file, /*@out@*/ rpmCompressedMagic * compressed)
    00222         /*@globals h_errno, fileSystem, internalState @*/
    00223         /*@modifies *compressed, fileSystem, internalState @*/;
    00224
    00230 char * rpmExpand(/*@null@*/ const char * arg, ...)
    00231         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00232         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00233
    00239 /*@null@*/
    00240 char * rpmCleanPath(/*@returned@*/ /*@null@*/ char * path)
    00241         /*@modifies *path @*/;
    00242
    00248 /*@-redecl@*/ /* LCL: shrug */
    00249 const char * rpmGetPath(/*@null@*/ const char * path, ...)
    00250         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00251         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00252 /*@=redecl@*/
    00253
    00264 /*@-redecl@*/ /* LCL: shrug */
    00265 const char * rpmGenPath(/*@null@*/ const char * urlroot,
    00266                         /*@null@*/ const char * urlmdir,
    00267                         /*@null@*/ const char * urlfile)
    00268         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00269         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00270 /*@=redecl@*/
    00271
    00279 int rpmExpandNumeric (const char * arg)
    00280         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00281         /*@modifies rpmGlobalMacroContext, internalState @*/;
    00282
    00283 #ifdef __cplusplus
    00284 }
    00285 #endif
    00286
    00287 #endif  /* _H_ MACRO_ */