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@*/ /*@unchecked@*/
    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 @*/
    00141         /*@modifies rpmGlobalMacroContext, fileSystem @*/;
    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@*/
    00167         /*@modifies *compressed, fileSystem @*/;
    00168
    00174 char * rpmExpand        (/*@null@*/ const char * arg, ...)
    00175         /*@globals rpmGlobalMacroContext @*/
    00176         /*@modifies rpmGlobalMacroContext @*/;
    00177
    00183 /*@null@*/ char * rpmCleanPath  (/*@null@*/ char * path)
    00184         /*@modifies *path @*/;
    00185
    00191 /*@-redecl@*/ /* LCL: shrug */
    00192 const char * rpmGetPath (/*@null@*/ const char * path, ...)
    00193         /*@globals rpmGlobalMacroContext @*/
    00194         /*@modifies rpmGlobalMacroContext @*/;
    00195 /*@=redecl@*/
    00196
    00207 /*@-redecl@*/ /* LCL: shrug */
    00208 const char * rpmGenPath (/*@null@*/ const char * urlroot,
    00209                         /*@null@*/ const char * urlmdir,
    00210                         /*@null@*/ const char * urlfile)
    00211         /*@globals rpmGlobalMacroContext @*/
    00212         /*@modifies rpmGlobalMacroContext @*/;
    00213 /*@=redecl@*/
    00214
    00222 int     rpmExpandNumeric (const char * arg)
    00223         /*@globals rpmGlobalMacroContext @*/
    00224         /*@modifies rpmGlobalMacroContext @*/;
    00225
    00226 #ifdef __cplusplus
    00227 }
    00228 #endif
    00229
    00230 #endif  /* _H_ MACRO_ */