rpm  4.12.0.1
rpmmacro.h
Go to the documentation of this file.
1 #ifndef _H_MACRO_
2 #define _H_MACRO_
3 
8 #include <stdio.h>
9 #include <stddef.h>
10 
11 #include <rpm/rpmutil.h>
12 #include <rpm/rpmfileutil.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 typedef struct rpmMacroEntry_s * rpmMacroEntry;
19 
20 typedef struct rpmMacroContext_s * rpmMacroContext;
21 
22 extern rpmMacroContext rpmGlobalMacroContext;
23 
24 extern rpmMacroContext rpmCLIMacroContext;
25 
31 extern const char * macrofiles;
32 
36 #define RMIL_DEFAULT -15
37 #define RMIL_MACROFILES -13
38 #define RMIL_RPMRC -11
39 
40 #define RMIL_CMDLINE -7
41 #define RMIL_TARBALL -5
42 #define RMIL_SPEC -3
43 #define RMIL_OLDSPEC -1
44 #define RMIL_GLOBAL 0
45 
51 void rpmDumpMacroTable (rpmMacroContext mc,
52  FILE * fp);
53 
64 int expandMacros (void * spec, rpmMacroContext mc,
65  char * sbuf,
66  size_t slen);
67 
77 void addMacro (rpmMacroContext mc, const char * n,
78  const char * o,
79  const char * b, int level);
80 
86 void delMacro (rpmMacroContext mc, const char * n);
87 
95 int rpmDefineMacro (rpmMacroContext mc, const char * macro,
96  int level);
97 
103 void rpmLoadMacros (rpmMacroContext mc, int level);
104 
110 int rpmLoadMacroFile(rpmMacroContext mc, const char * fn);
111 
117 void rpmInitMacros (rpmMacroContext mc, const char * macrofiles);
118 
123 void rpmFreeMacros (rpmMacroContext mc);
124 
130 char * rpmExpand (const char * arg, ...) RPM_GNUC_NULL_TERMINATED;
131 
139 int rpmExpandNumeric (const char * arg);
140 
150 const char *rpmConfigDir(void);
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif /* _H_ MACRO_ */
void rpmLoadMacros(rpmMacroContext mc, int level)
Load macros from specific context into global context.
struct rpmMacroContext_s * rpmMacroContext
Definition: rpmmacro.h:20
#define RPM_GNUC_NULL_TERMINATED
Definition: rpmutil.h:48
void addMacro(rpmMacroContext mc, const char *n, const char *o, const char *b, int level)
Add 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'ed) concatenated macro expansion(s).
rpmMacroContext rpmGlobalMacroContext
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
rpmMacroContext rpmCLIMacroContext
int expandMacros(void *spec, rpmMacroContext mc, char *sbuf, size_t slen)
Expand macro into buffer.
void delMacro(rpmMacroContext mc, const char *n)
Delete 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.
const char * rpmConfigDir(void)
Return rpm configuration base directory.
struct rpmMacroEntry_s * rpmMacroEntry
Definition: rpmmacro.h:18