rpm  4.14.0
rpmmacro.h
Go to the documentation of this file.
1 #ifndef _H_MACRO_
2 #define _H_MACRO_
3 
10 #include <stdio.h>
11 #include <stddef.h>
12 
13 #include <rpm/rpmutil.h>
14 #include <rpm/rpmfileutil.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 typedef struct rpmMacroEntry_s * rpmMacroEntry;
21 
22 typedef struct rpmMacroContext_s * rpmMacroContext;
23 
24 extern rpmMacroContext rpmGlobalMacroContext;
25 
26 extern rpmMacroContext rpmCLIMacroContext;
27 
33 extern const char * macrofiles;
34 
38 #define RMIL_DEFAULT -15
39 #define RMIL_MACROFILES -13
40 #define RMIL_RPMRC -11
41 
42 #define RMIL_CMDLINE -7
43 #define RMIL_TARBALL -5
44 #define RMIL_SPEC -3
45 #define RMIL_OLDSPEC -1
46 #define RMIL_GLOBAL 0
47 
48 /* Deprecated compatibility wrappers */
49 #define addMacro(_mc, _n, _o, _b, _l) rpmPushMacro(_mc, _n, _o, _b, _l)
50 #define delMacro(_mc, _n) rpmPopMacro(_mc, _n)
51 
57 void rpmDumpMacroTable (rpmMacroContext mc,
58  FILE * fp);
59 
68 int rpmExpandMacros (rpmMacroContext mc, const char * sbuf,
69  char ** obuf, int flags);
70 
80 int rpmPushMacro (rpmMacroContext mc, const char * n,
81  const char * o,
82  const char * b, int level);
83 
90 int rpmPopMacro (rpmMacroContext mc, const char * n);
91 
99 int rpmDefineMacro (rpmMacroContext mc, const char * macro,
100  int level);
101 
107 void rpmLoadMacros (rpmMacroContext mc, int level);
108 
114 int rpmLoadMacroFile(rpmMacroContext mc, const char * fn);
115 
121 void rpmInitMacros (rpmMacroContext mc, const char * macrofiles);
122 
127 void rpmFreeMacros (rpmMacroContext mc);
128 
134 char * rpmExpand (const char * arg, ...) RPM_GNUC_NULL_TERMINATED;
135 
143 int rpmExpandNumeric (const char * arg);
144 
154 const char *rpmConfigDir(void);
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* _H_ MACRO_ */
void rpmLoadMacros(rpmMacroContext mc, int level)
Load macros from specific context into global context.
struct rpmMacroContext_s * rpmMacroContext
Definition: rpmmacro.h:22
#define RPM_GNUC_NULL_TERMINATED
Definition: rpmutil.h:49
int rpmPushMacro(rpmMacroContext mc, const char *n, const char *o, const char *b, int level)
Push macro to context.
int rpmDefineMacro(rpmMacroContext mc, const char *macro, int level)
Define macro in context.
void rpmInitMacros(rpmMacroContext mc, const char *macrofiles)
Initialize macro context from set of macrofile(s).
char * rpmExpand(const char *arg,...) RPM_GNUC_NULL_TERMINATED
Return (malloc&#39;ed) concatenated macro expansion(s).
rpmMacroContext rpmGlobalMacroContext
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
rpmMacroContext rpmCLIMacroContext
int rpmPopMacro(rpmMacroContext mc, const char *n)
Pop macro from context.
void rpmDumpMacroTable(rpmMacroContext mc, FILE *fp)
Print macros to file stream.
int rpmLoadMacroFile(rpmMacroContext mc, const char *fn)
Load macro context from a macro file.
const char * macrofiles
List of macro files to read when configuring rpm.
void rpmFreeMacros(rpmMacroContext mc)
Destroy macro context.
int rpmExpandMacros(rpmMacroContext mc, const char *sbuf, char **obuf, int flags)
Expand macro into buffer.
const char * rpmConfigDir(void)
Return rpm configuration base directory.
struct rpmMacroEntry_s * rpmMacroEntry
Definition: rpmmacro.h:20