00001 #ifndef _H_MACRO_
00002 #define _H_MACRO_
00003 
00009 typedef  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  struct MacroContext_s {
00020  MacroEntry *macroTable;   
00021     int macrosAllocated;
00022     int firstFree;      
00023 } * MacroContext;
00024 
00025 
00026 
00027 extern MacroContext rpmGlobalMacroContext;
00028 
00029 
00030 extern MacroContext rpmCLIMacroContext;
00031 
00032 
00038 
00039  
00040 extern const char * macrofiles;
00041 
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       ( MacroContext mc,
00066                                          FILE * fp)
00067         
00068         ;
00069 
00077 int rpmGlob(const char * patterns,  int * argcPtr,
00078                  const char *** argvPtr)
00079         
00080         ;
00081 
00092 int     expandMacros    ( void * spec,  MacroContext mc,
00093                                   char * sbuf,
00094                                 size_t slen)
00095         
00096         ;
00097 
00107 void    addMacro        ( MacroContext mc, const char * n,
00108                                  const char * o,
00109                                  const char * b, int level)
00110         
00111         ;
00112 
00118 void    delMacro        ( MacroContext mc, const char * n)
00119         
00120         ;
00121 
00129 int     rpmDefineMacro  ( MacroContext mc, const char * macro,
00130                                 int level)
00131         
00132         ;
00133 
00139 void    rpmLoadMacros   ( MacroContext mc, int level)
00140         
00141         ;
00142 
00148 int     rpmLoadMacroFile( MacroContext mc, const char * fn)
00149         
00150 
00151         ;
00152 
00158 void    rpmInitMacros   ( MacroContext mc, const char * macrofiles)
00159         
00160 
00161         ;
00162 
00167 void    rpmFreeMacros   ( MacroContext mc)
00168         
00169         ;
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                                  rpmCompressedMagic * compressed)
00186         
00187         ;
00188 
00194 char * rpmExpand        ( const char * arg, ...)
00195         
00196         ;
00197 
00203 
00204 char * rpmCleanPath     (  char * path)
00205         ;
00206 
00212  
00213 const char * rpmGetPath ( const char * path, ...)
00214         
00215         ;
00216 
00217 
00228  
00229 const char * rpmGenPath ( const char * urlroot,
00230                          const char * urlmdir,
00231                          const char * urlfile)
00232         
00233         ;
00234 
00235 
00243 int     rpmExpandNumeric (const char * arg)
00244         
00245         ;
00246 
00247 #ifdef __cplusplus
00248 }
00249 #endif
00250 
00251 #endif