rpm  4.17.0
Macros | Typedefs | Enumerations | Functions | Variables
rpmmacro.h File Reference

Macro API. More...

#include <stdio.h>
#include <stddef.h>
#include <rpm/rpmutil.h>
#include <rpm/rpmfileutil.h>
Include dependency graph for rpmmacro.h:

Go to the source code of this file.

Macros

#define RMIL_BUILTIN   -20
 Markers for sources of macros added throughout rpm. More...
 
#define RMIL_DEFAULT   -15
 
#define RMIL_MACROFILES   -13
 
#define RMIL_RPMRC   -11
 
#define RMIL_CMDLINE   -7
 
#define RMIL_TARBALL   -5
 
#define RMIL_SPEC   -3
 
#define RMIL_OLDSPEC   -1
 
#define RMIL_GLOBAL   0
 
#define addMacro(_mc, _n, _o, _b, _l)   rpmPushMacro(_mc, _n, _o, _b, _l)
 
#define delMacro(_mc, _n)   rpmPopMacro(_mc, _n)
 
#define RPMEXPR_EXPAND   (1 << 0)
 
#define RPMEXPAND_EXPAND_ARGS   (1 << 0)
 

Typedefs

typedef struct rpmMacroEntry_s * rpmMacroEntry
 
typedef struct rpmMacroContext_s * rpmMacroContext
 
typedef enum rpmMacroFlags_e rpmMacroFlags
 

Enumerations

enum  rpmMacroFlags_e { RPMMACRO_DEFAULT = 0 , RPMMACRO_LITERAL = (1 << 0) }
 

Functions

void rpmDumpMacroTable (rpmMacroContext mc, FILE *fp)
 Print macros to file stream. More...
 
int rpmExpandMacros (rpmMacroContext mc, const char *sbuf, char **obuf, int flags)
 Expand macro into buffer. More...
 
int rpmExpandThisMacro (rpmMacroContext mc, const char *n, ARGV_const_t args, char **obuf, int flags)
 Expand a specific macro into buffer. More...
 
int rpmPushMacro (rpmMacroContext mc, const char *n, const char *o, const char *b, int level)
 Push macro to context. More...
 
int rpmPushMacroFlags (rpmMacroContext mc, const char *n, const char *o, const char *b, int level, rpmMacroFlags flags)
 Push macro to context. More...
 
int rpmPopMacro (rpmMacroContext mc, const char *n)
 Pop macro from context. More...
 
int rpmDefineMacro (rpmMacroContext mc, const char *macro, int level)
 Define macro in context. More...
 
int rpmMacroIsDefined (rpmMacroContext mc, const char *n)
 
int rpmMacroIsParametric (rpmMacroContext mc, const char *n)
 
void rpmLoadMacros (rpmMacroContext mc, int level)
 Load macros from specific context into global context. More...
 
int rpmLoadMacroFile (rpmMacroContext mc, const char *fn)
 Load macro context from a macro file. More...
 
void rpmInitMacros (rpmMacroContext mc, const char *macrofiles)
 Initialize macro context from set of macrofile(s). More...
 
void rpmFreeMacros (rpmMacroContext mc)
 Destroy macro context. More...
 
char * rpmExpand (const char *arg,...) RPM_GNUC_NULL_TERMINATED
 Return (malloc'ed) concatenated macro expansion(s). More...
 
int rpmExpandNumeric (const char *arg)
 Return macro expansion as a numeric value. More...
 
const char * rpmConfigDir (void)
 Return rpm configuration base directory. More...
 
int rpmExprBoolFlags (const char *expr, int flags)
 Evaluate boolean expression. More...
 
char * rpmExprStrFlags (const char *expr, int flags)
 Evaluate string expression. More...
 
int rpmExprBool (const char *expr)
 Evaluate boolean expression. More...
 
char * rpmExprStr (const char *expr)
 Evaluate string expression. More...
 

Variables

rpmMacroContext rpmGlobalMacroContext
 
rpmMacroContext rpmCLIMacroContext
 
const char * macrofiles
 List of macro files to read when configuring rpm. More...
 

Detailed Description

Macro API.

Definition in file rpmmacro.h.

Macro Definition Documentation

◆ addMacro

#define addMacro (   _mc,
  _n,
  _o,
  _b,
  _l 
)    rpmPushMacro(_mc, _n, _o, _b, _l)

Definition at line 50 of file rpmmacro.h.

◆ delMacro

#define delMacro (   _mc,
  _n 
)    rpmPopMacro(_mc, _n)

Definition at line 51 of file rpmmacro.h.

◆ RMIL_BUILTIN

#define RMIL_BUILTIN   -20

Markers for sources of macros added throughout rpm.

Definition at line 38 of file rpmmacro.h.

◆ RMIL_CMDLINE

#define RMIL_CMDLINE   -7

Definition at line 43 of file rpmmacro.h.

◆ RMIL_DEFAULT

#define RMIL_DEFAULT   -15

Definition at line 39 of file rpmmacro.h.

◆ RMIL_GLOBAL

#define RMIL_GLOBAL   0

Definition at line 47 of file rpmmacro.h.

◆ RMIL_MACROFILES

#define RMIL_MACROFILES   -13

Definition at line 40 of file rpmmacro.h.

◆ RMIL_OLDSPEC

#define RMIL_OLDSPEC   -1

Definition at line 46 of file rpmmacro.h.

◆ RMIL_RPMRC

#define RMIL_RPMRC   -11

Definition at line 41 of file rpmmacro.h.

◆ RMIL_SPEC

#define RMIL_SPEC   -3

Definition at line 45 of file rpmmacro.h.

◆ RMIL_TARBALL

#define RMIL_TARBALL   -5

Definition at line 44 of file rpmmacro.h.

◆ RPMEXPAND_EXPAND_ARGS

#define RPMEXPAND_EXPAND_ARGS   (1 << 0)

expand arguments of parametric macros

Definition at line 57 of file rpmmacro.h.

◆ RPMEXPR_EXPAND

#define RPMEXPR_EXPAND   (1 << 0)

expand primary terms

Definition at line 54 of file rpmmacro.h.

Typedef Documentation

◆ rpmMacroContext

typedef struct rpmMacroContext_s* rpmMacroContext

Definition at line 22 of file rpmmacro.h.

◆ rpmMacroEntry

typedef struct rpmMacroEntry_s* rpmMacroEntry

Definition at line 20 of file rpmmacro.h.

◆ rpmMacroFlags

Enumeration Type Documentation

◆ rpmMacroFlags_e

Enumerator
RPMMACRO_DEFAULT 
RPMMACRO_LITERAL 

do not expand body of macro

Definition at line 59 of file rpmmacro.h.

Function Documentation

◆ rpmMacroIsDefined()

int rpmMacroIsDefined ( rpmMacroContext  mc,
const char *  n 
)

◆ rpmMacroIsParametric()

int rpmMacroIsParametric ( rpmMacroContext  mc,
const char *  n 
)

Variable Documentation

◆ rpmCLIMacroContext

rpmMacroContext rpmCLIMacroContext
extern

◆ rpmGlobalMacroContext

rpmMacroContext rpmGlobalMacroContext
extern