rpm 5.3.7

rpmio/rpmmacro.h

Go to the documentation of this file.
00001 #ifndef _H_MACRO_
00002 #define _H_MACRO_
00003 
00007 typedef /*@abstract@*/ struct MacroEntry_s * MacroEntry;
00008 typedef /*@abstract@*/ struct MacroContext_s * MacroContext;
00009 
00010 #if defined(_MACRO_INTERNAL)
00011 
00012 struct MacroEntry_s {
00013     struct MacroEntry_s *prev;  
00014     const char *name;           
00015     const char *opts;           
00016     const char *body;           
00017     int used;                   
00018     short level;                
00019     unsigned short flags;       
00020 };
00021 
00023 struct MacroContext_s {
00024 /*@owned@*//*@null@*/
00025     MacroEntry *macroTable;     
00026     int macrosAllocated;        
00027     int firstFree;              
00028 };
00029 #endif
00030 
00031 /*@-redecl@*/
00032 /*@checked@*/
00033 extern MacroContext rpmGlobalMacroContext;
00034 
00035 /*@checked@*/
00036 extern MacroContext rpmCLIMacroContext;
00037 
00043 /*@observer@*/ /*@checked@*/
00044 extern const char * rpmMacrofiles;
00045 /*@=redecl@*/
00046 
00050 #define RMIL_DEFAULT    -15
00051 #define RMIL_MACROFILES -13
00052 #define RMIL_RPMRC      -11
00053 
00054 #define RMIL_CMDLINE    -7
00055 #define RMIL_TARBALL    -5
00056 #define RMIL_SPEC       -3
00057 #define RMIL_OLDSPEC    -1
00058 #define RMIL_GLOBAL     0
00059 
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif
00063 
00069 void rpmDumpMacroTable(/*@null@*/ MacroContext mc, /*@null@*/ FILE * fp)
00070         /*@globals rpmGlobalMacroContext, fileSystem @*/
00071         /*@modifies *fp, fileSystem @*/;
00072 
00081 int
00082 rpmGetMacroEntries(/*@null@*/ MacroContext mc, /*@null@*/ void * _mire,
00083                 int used, /*@null@*/ const char *** avp)
00084         /*@globals rpmGlobalMacroContext @*/
00085         /*@modifies _mire, *avp @*/;
00086 
00092 int rpmSecuritySaneFile(const char *filename)
00093         /*@globals internalState @*/;
00094 
00102 int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
00103                 /*@out@*/ const char *** argvPtr)
00104         /*@globals fileSystem, internalState @*/
00105         /*@modifies *argcPtr, *argvPtr, fileSystem, internalState @*/;
00106 
00117 int expandMacros(/*@null@*/ void * spec, /*@null@*/ MacroContext mc,
00118                 /*@in@*/ /*@out@*/ char * sbuf, size_t slen)
00119         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00120         /*@modifies *sbuf, rpmGlobalMacroContext, fileSystem, internalState @*/;
00121 
00131 void addMacro(/*@null@*/ MacroContext mc, const char * n,
00132                 /*@null@*/ const char * o, /*@null@*/ const char * b, int level)
00133         /*@globals rpmGlobalMacroContext, internalState @*/
00134         /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
00135 
00141 void delMacro(/*@null@*/ MacroContext mc, const char * n)
00142         /*@globals rpmGlobalMacroContext @*/
00143         /*@modifies mc, rpmGlobalMacroContext @*/;
00144 
00152 int rpmDefineMacro(/*@null@*/ MacroContext mc, const char * macro, int level)
00153         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00154         /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
00155 
00162 int rpmUndefineMacro(/*@null@*/ MacroContext mc, const char * macro)
00163         /*@globals rpmGlobalMacroContext, internalState @*/
00164         /*@modifies mc, rpmGlobalMacroContext, internalState @*/;
00165 
00171 void rpmLoadMacros(/*@null@*/ MacroContext mc, int level)
00172         /*@globals rpmGlobalMacroContext, internalState @*/
00173         /*@modifies rpmGlobalMacroContext, internalState @*/;
00174 
00181 int rpmLoadMacroFile(/*@null@*/ MacroContext mc, const char * fn, int nesting)
00182         /*@globals rpmGlobalMacroContext,
00183                 h_errno, fileSystem, internalState @*/
00184         /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
00185 
00191 void rpmInitMacros(/*@null@*/ MacroContext mc, const char * macrofiles)
00192         /*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
00193                 h_errno, fileSystem, internalState @*/
00194         /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
00195 
00200 void rpmFreeMacros(/*@null@*/ MacroContext mc)
00201         /*@globals rpmGlobalMacroContext @*/
00202         /*@modifies mc, rpmGlobalMacroContext @*/;
00203 
00204 typedef enum rpmCompressedMagic_e {
00205     COMPRESSED_NOT              = 0,    
00206     COMPRESSED_OTHER            = 1,    
00207     COMPRESSED_BZIP2            = 2,    
00208     COMPRESSED_ZIP              = 3,    
00209     COMPRESSED_LZOP             = 4,    
00210     COMPRESSED_LZMA             = 5,    
00211     COMPRESSED_XZ               = 6     
00212 } rpmCompressedMagic;
00213 
00220 int isCompressed(const char * file, /*@out@*/ rpmCompressedMagic * compressed)
00221         /*@globals h_errno, fileSystem, internalState @*/
00222         /*@modifies *compressed, fileSystem, internalState @*/;
00223 
00229 char * rpmExpand(/*@null@*/ const char * arg, ...)
00230 #if defined(__GNUC__) && __GNUC__ >= 4
00231         /* issue a warning if the list is not  NULL-terminated */
00232         __attribute__((sentinel))
00233 #endif
00234         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00235         /*@modifies rpmGlobalMacroContext, internalState @*/;
00236 
00243 char * rpmMCExpand(/*@null@*/ MacroContext mc, /*@null@*/ const char * arg, ...)
00244 #if defined(__GNUC__) && __GNUC__ >= 4
00245         /* issue a warning if the list is not  NULL-terminated */
00246         __attribute__((sentinel))
00247 #endif
00248         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00249         /*@modifies rpmGlobalMacroContext, internalState @*/;
00250 
00257 /*@null@*/
00258 char * rpmCleanPath(/*@returned@*/ /*@null@*/ char * path)
00259         /*@modifies *path @*/;
00260 
00267 /*@-redecl@*/ /* LCL: shrug */
00268 char * rpmGetPath(/*@null@*/ const char * path, ...)
00269 #if defined(__GNUC__) && __GNUC__ >= 4
00270         /* issue a warning if the list is not  NULL-terminated */
00271          __attribute__((sentinel))
00272 #endif
00273         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00274         /*@modifies rpmGlobalMacroContext, internalState @*/;
00275 /*@=redecl@*/
00276 
00287 /*@-redecl@*/ /* LCL: shrug */
00288 const char * rpmGenPath(/*@null@*/ const char * urlroot,
00289                         /*@null@*/ const char * urlmdir,
00290                         /*@null@*/ const char * urlfile)
00291         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00292         /*@modifies rpmGlobalMacroContext, internalState @*/;
00293 /*@=redecl@*/
00294 
00302 int rpmExpandNumeric (const char * arg)
00303         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00304         /*@modifies rpmGlobalMacroContext, internalState @*/;
00305 
00306 #ifdef __cplusplus
00307 }
00308 #endif
00309 
00310 #endif  /* _H_ MACRO_ */