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, fileSystem @*/
00068         /*@modifies *fp, fileSystem @*/;
00069 
00077 int rpmGlob(const char * patterns, /*@out@*/ int * argcPtr,
00078                 /*@out@*/ const char *** argvPtr)
00079         /*@globals fileSystem, internalState @*/
00080         /*@modifies *argcPtr, *argvPtr, fileSystem, internalState @*/;
00081 
00092 int     expandMacros    (/*@null@*/ void * spec, /*@null@*/ MacroContext mc,
00093                                 /*@in@*/ /*@out@*/ char * sbuf,
00094                                 size_t slen)
00095         /*@globals rpmGlobalMacroContext, h_errno, fileSystem @*/
00096         /*@modifies *sbuf, rpmGlobalMacroContext, fileSystem @*/;
00097 
00107 void    addMacro        (/*@null@*/ MacroContext mc, const char * n,
00108                                 /*@null@*/ const char * o,
00109                                 /*@null@*/ const char * b, int level)
00110         /*@globals rpmGlobalMacroContext @*/
00111         /*@modifies mc, rpmGlobalMacroContext @*/;
00112 
00118 void    delMacro        (/*@null@*/ MacroContext mc, const char * n)
00119         /*@globals rpmGlobalMacroContext @*/
00120         /*@modifies mc, rpmGlobalMacroContext @*/;
00121 
00129 int     rpmDefineMacro  (/*@null@*/ MacroContext mc, const char * macro,
00130                                 int level)
00131         /*@globals rpmGlobalMacroContext, h_errno @*/
00132         /*@modifies mc, rpmGlobalMacroContext @*/;
00133 
00139 void    rpmLoadMacros   (/*@null@*/ MacroContext mc, int level)
00140         /*@globals rpmGlobalMacroContext @*/
00141         /*@modifies rpmGlobalMacroContext @*/;
00142 
00148 int     rpmLoadMacroFile(/*@null@*/ MacroContext mc, const char * fn)
00149         /*@globals rpmGlobalMacroContext,
00150                 h_errno, fileSystem, internalState @*/
00151         /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
00152 
00158 void    rpmInitMacros   (/*@null@*/ MacroContext mc, const char * macrofiles)
00159         /*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
00160                 h_errno, fileSystem, internalState @*/
00161         /*@modifies mc, rpmGlobalMacroContext, fileSystem, internalState @*/;
00162 
00167 void    rpmFreeMacros   (/*@null@*/ MacroContext mc)
00168         /*@globals rpmGlobalMacroContext @*/
00169         /*@modifies mc, rpmGlobalMacroContext @*/;
00170 
00171 typedef enum rpmCompressedMagic_e {
00172     COMPRESSED_NOT              = 0,    
00173     COMPRESSED_OTHER            = 1,    
00174     COMPRESSED_BZIP2            = 2,    
00175     COMPRESSED_ZIP              = 3     
00176 } rpmCompressedMagic;
00177 
00184 int     isCompressed    (const char * file,
00185                                 /*@out@*/ rpmCompressedMagic * compressed)
00186         /*@globals h_errno, fileSystem, internalState @*/
00187         /*@modifies *compressed, fileSystem, internalState @*/;
00188 
00194 char * rpmExpand        (/*@null@*/ const char * arg, ...)
00195         /*@globals rpmGlobalMacroContext, h_errno @*/
00196         /*@modifies rpmGlobalMacroContext @*/;
00197 
00203 /*@null@*/
00204 char * rpmCleanPath     (/*@returned@*/ /*@null@*/ char * path)
00205         /*@modifies *path @*/;
00206 
00212 /*@-redecl@*/ /* LCL: shrug */
00213 const char * rpmGetPath (/*@null@*/ const char * path, ...)
00214         /*@globals rpmGlobalMacroContext, h_errno @*/
00215         /*@modifies rpmGlobalMacroContext @*/;
00216 /*@=redecl@*/
00217 
00228 /*@-redecl@*/ /* LCL: shrug */
00229 const char * rpmGenPath (/*@null@*/ const char * urlroot,
00230                         /*@null@*/ const char * urlmdir,
00231                         /*@null@*/ const char * urlfile)
00232         /*@globals rpmGlobalMacroContext, h_errno @*/
00233         /*@modifies rpmGlobalMacroContext @*/;
00234 /*@=redecl@*/
00235 
00243 int     rpmExpandNumeric (const char * arg)
00244         /*@globals rpmGlobalMacroContext, h_errno @*/
00245         /*@modifies rpmGlobalMacroContext @*/;
00246 
00247 #ifdef __cplusplus
00248 }
00249 #endif
00250 
00251 #endif  /* _H_ MACRO_ */

Generated on Fri Oct 12 08:44:54 2007 for rpm by  doxygen 1.5.2