rpm 4.19.0
The RPM Package Manager
Loading...
Searching...
No Matches
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
17extern "C" {
18#endif
19
20typedef struct rpmMacroEntry_s * rpmMacroEntry;
21
22typedef struct rpmMacroContext_s * rpmMacroContext;
23
24extern rpmMacroContext rpmGlobalMacroContext;
25
26extern rpmMacroContext rpmCLIMacroContext;
27
33extern const char * macrofiles;
34
38#define RMIL_BUILTIN -20
39#define RMIL_DEFAULT -15
40#define RMIL_MACROFILES -13
41#define RMIL_RPMRC -11
42
43#define RMIL_CMDLINE -7
44#define RMIL_TARBALL -5
45#define RMIL_SPEC -3
46#define RMIL_OLDSPEC -1
47#define RMIL_GLOBAL 0
48
49/* Deprecated compatibility wrappers */
50#define addMacro(_mc, _n, _o, _b, _l) rpmPushMacro(_mc, _n, _o, _b, _l)
51#define delMacro(_mc, _n) rpmPopMacro(_mc, _n)
52
53/* rpm expression parser flags */
54#define RPMEXPR_EXPAND (1 << 0)
56/* rpm macro expansion flags */
57#define RPMEXPAND_EXPAND_ARGS (1 << 0)
59typedef enum rpmMacroFlags_e {
60 RPMMACRO_DEFAULT = 0,
61 RPMMACRO_LITERAL = (1 << 0),
62} rpmMacroFlags;
63
69void rpmDumpMacroTable (rpmMacroContext mc,
70 FILE * fp);
71
80int rpmExpandMacros (rpmMacroContext mc, const char * sbuf,
81 char ** obuf, int flags);
82
92int rpmExpandThisMacro (rpmMacroContext mc, const char *n,
93 ARGV_const_t args,
94 char ** obuf, int flags);
95
105int rpmPushMacro (rpmMacroContext mc, const char * n,
106 const char * o,
107 const char * b, int level);
108
119int rpmPushMacroFlags (rpmMacroContext mc, const char * n,
120 const char * o,
121 const char * b, int level,
122 rpmMacroFlags flags);
123
130int rpmPopMacro (rpmMacroContext mc, const char * n);
131
139int rpmDefineMacro (rpmMacroContext mc, const char * macro,
140 int level);
141
142/*
143 * Test whether a macro is defined
144 * @param mc macro context (NULL uses global context).
145 * @param n macro name
146 * @return 1 if defined, 0 if not
147 */
148int rpmMacroIsDefined(rpmMacroContext mc, const char *n);
149
150/*
151 * Test whether a macro is parametric (ie takes arguments)
152 * @param mc macro context (NULL uses global context).
153 * @param n macro name
154 * @return 1 if parametric, 0 if not
155 */
156int rpmMacroIsParametric(rpmMacroContext mc, const char *n);
157
163void rpmLoadMacros (rpmMacroContext mc, int level);
164
170int rpmLoadMacroFile(rpmMacroContext mc, const char * fn);
171
177void rpmInitMacros (rpmMacroContext mc, const char * macrofiles);
178
183void rpmFreeMacros (rpmMacroContext mc);
184
190char * rpmExpand (const char * arg, ...) RPM_GNUC_NULL_TERMINATED;
191
199int rpmExpandNumeric (const char * arg);
200
210const char *rpmConfigDir(void);
211
218int rpmExprBoolFlags(const char * expr, int flags);
219
226char * rpmExprStrFlags(const char * expr, int flags);
227
233int rpmExprBool(const char * expr);
234
240char * rpmExprStr(const char * expr);
241
242#ifdef __cplusplus
243}
244#endif
245
246#endif /* _H_ MACRO_ */
int rpmPushMacroFlags(rpmMacroContext mc, const char *n, const char *o, const char *b, int level, rpmMacroFlags flags)
void rpmFreeMacros(rpmMacroContext mc)
char * rpmExprStrFlags(const char *expr, int flags)
const char * rpmConfigDir(void)
int rpmLoadMacroFile(rpmMacroContext mc, const char *fn)
void rpmLoadMacros(rpmMacroContext mc, int level)
int rpmExpandNumeric(const char *arg)
int rpmExprBoolFlags(const char *expr, int flags)
int rpmPopMacro(rpmMacroContext mc, const char *n)
char * rpmExprStr(const char *expr)
void rpmInitMacros(rpmMacroContext mc, const char *macrofiles)
int rpmExpandMacros(rpmMacroContext mc, const char *sbuf, char **obuf, int flags)
int rpmDefineMacro(rpmMacroContext mc, const char *macro, int level)
int rpmPushMacro(rpmMacroContext mc, const char *n, const char *o, const char *b, int level)
char * rpmExpand(const char *arg,...) RPM_GNUC_NULL_TERMINATED
int rpmExpandThisMacro(rpmMacroContext mc, const char *n, ARGV_const_t args, char **obuf, int flags)
void rpmDumpMacroTable(rpmMacroContext mc, FILE *fp)
int rpmExprBool(const char *expr)
const char * macrofiles
rpmMacroFlags_e
Definition: rpmmacro.h:59
@ RPMMACRO_LITERAL
Definition: rpmmacro.h:61