Main Page Modules Data Structures File List Data Fields Globals Related Pages

# rpmio/rpmmacro.h

Go to the documentation of this file.

    00001 #ifndef _H_MACRO_
    00002 #define _H_MACRO_
    00003
    00009 typedef /*@abstract@*/ struct MacroEntry_s {
    00010     struct MacroEntry_s *prev;
    00011     const char *name;
    00012     const char *opts;
    00013     const char *body;
    00014     int used;
    00015     int level;
    00016 } * MacroEntry;
    00017
    00019 typedef /*@abstract@*/ struct MacroContext_s {
    00020 /*@owned@*//*@null@*/ MacroEntry *macroTable;
    00021     int macrosAllocated;
    00022     int firstFree;
    00023 } * MacroContext;
    00024
    00025 /*@-redecl@*/
    00026 /*@checked@*/
    00027 extern MacroContext rpmGlobalMacroContext;
    00028
    00029 /*@checked@*/
    00030 extern MacroContext rpmCLIMacroContext;
    00031 /*@=redecl@*/
    00032
    00038 /*@-redecl@*/
    00039 /*@observer@*/ /*@checked@*/
    00040 extern const char * macrofiles;
    00041 /*@=redecl@*/
    00042
    00046 #define RMIL_DEFAULT    -15
    00047 #define RMIL_MACROFILES -13
    00048 #define RMIL_RPMRC      -11
    00049
    00050 #define RMIL_CMDLINE    -7
    00051 #define RMIL_TARBALL    -5
    00052 #define RMIL_SPEC       -3
    00053 #define RMIL_OLDSPEC    -1
    00054 #define RMIL_GLOBAL     0
    00055
    00056 #ifdef __cplusplus
    00057 extern "C" {
    00058 #endif
    00059
    00065 void    rpmDumpMacroTable       (/*@null@*/ MacroContext mc,
    00066                                         /*@null@*/ FILE * fp)
    00067         /*@globals rpmGlobalMacroContext,
    00068                 fileSystem@*/
    00069         /*@modifies *fp, fileSystem @*/;
    00070
    00081 int     expandMacros    (/*@null@*/ void * spec, /*@null@*/ MacroContext mc,
    00082                                 /*@in@*/ /*@out@*/ char * sbuf,
    00083                                 size_t slen)
    00084         /*@globals rpmGlobalMacroContext,
    00085                 fileSystem @*/
    00086         /*@modifies *sbuf, rpmGlobalMacroContext, fileSystem @*/;
    00087
    00097 void    addMacro        (/*@null@*/ MacroContext mc, const char * n,
    00098                                 /*@null@*/ const char * o,
    00099                                 /*@null@*/ const char * b, int level)
    00100         /*@globals rpmGlobalMacroContext@*/
    00101         /*@modifies mc, rpmGlobalMacroContext @*/;
    00102
    00108 void    delMacro        (/*@null@*/ MacroContext mc, const char * n)
    00109         /*@globals rpmGlobalMacroContext@*/
    00110         /*@modifies mc, rpmGlobalMacroContext @*/;
    00111
    00119 int     rpmDefineMacro  (/*@null@*/ MacroContext mc, const char * macro,
    00120                                 int level)
    00121         /*@globals rpmGlobalMacroContext@*/
    00122         /*@modifies mc, rpmGlobalMacroContext @*/;
    00123
    00129 void    rpmLoadMacros   (/*@null@*/ MacroContext mc, int level)
    00130         /*@globals rpmGlobalMacroContext@*/
    00131         /*@modifies rpmGlobalMacroContext @*/;
    00132
    00138 void    rpmInitMacros   (/*@null@*/ MacroContext mc, const char * macrofiles)
    00139         /*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
    00140                 fileSystem, internalState @*/
    00141         /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
    00142
    00147 void    rpmFreeMacros   (/*@null@*/ MacroContext mc)
    00148         /*@globals rpmGlobalMacroContext@*/
    00149         /*@modifies mc, rpmGlobalMacroContext @*/;
    00150
    00151 typedef enum rpmCompressedMagic_e {
    00152     COMPRESSED_NOT              = 0,
    00153     COMPRESSED_OTHER            = 1,
    00154     COMPRESSED_BZIP2            = 2,
    00155     COMPRESSED_ZIP              = 3
    00156 } rpmCompressedMagic;
    00157
    00164 int     isCompressed    (const char * file,
    00165                                 /*@out@*/ rpmCompressedMagic * compressed)
    00166         /*@globals fileSystem, internalState @*/
    00167         /*@modifies *compressed, fileSystem, internalState @*/;
    00168
    00174 char * rpmExpand        (/*@null@*/ const char * arg, ...)
    00175         /*@globals rpmGlobalMacroContext @*/
    00176         /*@modifies rpmGlobalMacroContext @*/;
    00177
    00183 /*@null@*/
    00184 char * rpmCleanPath     (/*@returned@*/ /*@null@*/ char * path)
    00185         /*@modifies *path @*/;
    00186
    00192 /*@-redecl@*/ /* LCL: shrug */
    00193 const char * rpmGetPath (/*@null@*/ const char * path, ...)
    00194         /*@globals rpmGlobalMacroContext @*/
    00195         /*@modifies rpmGlobalMacroContext @*/;
    00196 /*@=redecl@*/
    00197
    00208 /*@-redecl@*/ /* LCL: shrug */
    00209 const char * rpmGenPath (/*@null@*/ const char * urlroot,
    00210                         /*@null@*/ const char * urlmdir,
    00211                         /*@null@*/ const char * urlfile)
    00212         /*@globals rpmGlobalMacroContext @*/
    00213         /*@modifies rpmGlobalMacroContext @*/;
    00214 /*@=redecl@*/
    00215
    00223 int     rpmExpandNumeric (const char * arg)
    00224         /*@globals rpmGlobalMacroContext @*/
    00225         /*@modifies rpmGlobalMacroContext @*/;
    00226
    00227 #ifdef __cplusplus
    00228 }
    00229 #endif
    00230
    00231 #endif  /* _H_ MACRO_ */