rpm 4.19.92
The RPM Package Manager
Loading...
Searching...
No Matches
Functions
Macro API.

Macro API. More...

Functions

void rpmDumpMacroTable (rpmMacroContext mc, FILE *fp)
 
int rpmExpandMacros (rpmMacroContext mc, const char *sbuf, char **obuf, int flags)
 
int rpmExpandThisMacro (rpmMacroContext mc, const char *n, ARGV_const_t args, char **obuf, int flags)
 
int rpmPushMacro (rpmMacroContext mc, const char *n, const char *o, const char *b, int level)
 
int rpmPushMacroFlags (rpmMacroContext mc, const char *n, const char *o, const char *b, int level, rpmMacroFlags flags)
 
int rpmPushMacroAux (rpmMacroContext mc, const char *n, const char *o, macroFunc f, void *priv, int nargs, int level, rpmMacroFlags flags)
 
void * rpmMacroEntryPriv (rpmMacroEntry me)
 
void rpmMacroBufAppend (rpmMacroBuf mb, char c)
 
void rpmMacroBufAppendStr (rpmMacroBuf mb, const char *str)
 
void rpmMacroBufErr (rpmMacroBuf mb, int error, const char *fmt,...)
 
int rpmPopMacro (rpmMacroContext mc, const char *n)
 
int rpmDefineMacro (rpmMacroContext mc, const char *macro, int level)
 
void rpmLoadMacros (rpmMacroContext mc, int level)
 
int rpmLoadMacroFile (rpmMacroContext mc, const char *fn)
 
void rpmInitMacros (rpmMacroContext mc, const char *macrofiles)
 
void rpmFreeMacros (rpmMacroContext mc)
 
char * rpmExpand (const char *arg,...) RPM_GNUC_NULL_TERMINATED
 
int rpmExpandNumeric (const char *arg)
 
const char * rpmConfigDir (void)
 
int rpmExprBoolFlags (const char *expr, int flags)
 
char * rpmExprStrFlags (const char *expr, int flags)
 
int rpmExprBool (const char *expr)
 
char * rpmExprStr (const char *expr)
 

Detailed Description

Macro API.

Function Documentation

◆ rpmConfigDir()

const char * rpmConfigDir ( void  )

Return rpm configuration base directory. If RPM_CONFIGDIR environment variable is set, it's value will be used. Otherwise the configuration directory is the one set at build time, typically /usr/lib/rpm. The value of rpmConfigDir() is determined on first call to this function and is guaranteed to remain the same on subsequent calls.

Returns
rpm configuration directory name

◆ rpmDefineMacro()

int rpmDefineMacro ( rpmMacroContext  mc,
const char *  macro,
int  level 
)

Define macro in context.

Parameters
mcmacro context (NULL uses global context).
macromacro name, options, body
levelmacro recursion level (0 is entry API)
Returns
0 on success (always)

◆ rpmDumpMacroTable()

void rpmDumpMacroTable ( rpmMacroContext  mc,
FILE *  fp 
)

Print macros to file stream.

Parameters
mcmacro context (NULL uses global context).
fpfile stream (NULL uses stderr).

◆ rpmExpand()

char * rpmExpand ( const char *  arg,
  ... 
)

Return (malloc'ed) concatenated macro expansion(s).

Parameters
argmacro(s) to expand (NULL terminates list)
Returns
macro expansion (malloc'ed)

◆ rpmExpandMacros()

int rpmExpandMacros ( rpmMacroContext  mc,
const char *  sbuf,
char **  obuf,
int  flags 
)

Expand macro into buffer.

Parameters
mcmacro context (NULL uses global context).
sbufinput macro to expand
obufmacro expansion (malloc'ed)
flagsflags (currently unused)
Returns
negative on failure

◆ rpmExpandNumeric()

int rpmExpandNumeric ( const char *  arg)

Return macro expansion as a numeric value. Boolean values ('Y' or 'y' returns 1, 'N' or 'n' returns 0) are permitted as well. An undefined macro returns 0.

Parameters
argmacro to expand
Returns
numeric value

◆ rpmExpandThisMacro()

int rpmExpandThisMacro ( rpmMacroContext  mc,
const char *  n,
ARGV_const_t  args,
char **  obuf,
int  flags 
)

Expand a specific macro into buffer.

Parameters
mcmacro context (NULL uses global context).
nmacro name
argsarguments for parametric macros
obufmacro expansion (malloc'ed)
flagsflags (currently unused)
Returns
negative on failure

◆ rpmExprBool()

int rpmExprBool ( const char *  expr)

Evaluate boolean expression.

Parameters
exprexpression to parse
Returns

◆ rpmExprBoolFlags()

int rpmExprBoolFlags ( const char *  expr,
int  flags 
)

Evaluate boolean expression.

Parameters
exprexpression to parse
flagsparser flags
Returns

◆ rpmExprStr()

char * rpmExprStr ( const char *  expr)

Evaluate string expression.

Parameters
exprexpression to parse
Returns

◆ rpmExprStrFlags()

char * rpmExprStrFlags ( const char *  expr,
int  flags 
)

Evaluate string expression.

Parameters
exprexpression to parse
flagsparser flags
Returns

◆ rpmFreeMacros()

void rpmFreeMacros ( rpmMacroContext  mc)

Destroy macro context.

Parameters
mcmacro context (NULL uses global context).

◆ rpmInitMacros()

void rpmInitMacros ( rpmMacroContext  mc,
const char *  macrofiles 
)

Initialize macro context from set of macrofile(s).

Parameters
mcmacro context
macrofilescolon separated list of macro files (NULL does nothing)

◆ rpmLoadMacroFile()

int rpmLoadMacroFile ( rpmMacroContext  mc,
const char *  fn 
)

Load macro context from a macro file.

Parameters
mc(unused)
fnmacro file name

◆ rpmLoadMacros()

void rpmLoadMacros ( rpmMacroContext  mc,
int  level 
)

Load macros from specific context into global context.

Parameters
mcmacro context (NULL does nothing).
levelmacro recursion level (0 is entry API)

◆ rpmMacroBufAppend()

void rpmMacroBufAppend ( rpmMacroBuf  mb,
char  c 
)

Append a character to macro buffer (in aux macro)

Parameters
mbmacro buffer
ccharacter to append

◆ rpmMacroBufAppendStr()

void rpmMacroBufAppendStr ( rpmMacroBuf  mb,
const char *  str 
)

Append a string to macro buffer (in aux macro)

Parameters
mbmacro buffer
strstring to append

◆ rpmMacroBufErr()

void rpmMacroBufErr ( rpmMacroBuf  mb,
int  error,
const char *  fmt,
  ... 
)

Raise an error or warning in macro buffer (in aux macro)

Parameters
mbmacro buffer
error1 if error, 0 if warning
fmtj

◆ rpmMacroEntryPriv()

void * rpmMacroEntryPriv ( rpmMacroEntry  me)

Return macro entry user data (in aux macro)

Parameters
memacro entry
Returns
pointer to private data passed on define or NULL

◆ rpmPopMacro()

int rpmPopMacro ( rpmMacroContext  mc,
const char *  n 
)

Pop macro from context.

Parameters
mcmacro context (NULL uses global context).
nmacro name
Returns
0 on success

◆ rpmPushMacro()

int rpmPushMacro ( rpmMacroContext  mc,
const char *  n,
const char *  o,
const char *  b,
int  level 
)

Push macro to context.

Parameters
mcmacro context (NULL uses global context).
nmacro name
omacro parameters
bmacro body
levelmacro recursion level (0 is entry API)
Returns
0 on success

◆ rpmPushMacroAux()

int rpmPushMacroAux ( rpmMacroContext  mc,
const char *  n,
const char *  o,
macroFunc  f,
void *  priv,
int  nargs,
int  level,
rpmMacroFlags  flags 
)

Push an auxiliary macro to context.

Parameters
mcmacro context (NULL uses global context).
nmacro name
omacro parameters (or NULL)
fmacro function
privprivate user data (or NULL)
nargsnumber of arguments (0-N for enforced check, -1 for optional)
levelmacro recursion level (0 is entry API)
flagsmacro flags
Returns
0 on success

◆ rpmPushMacroFlags()

int rpmPushMacroFlags ( rpmMacroContext  mc,
const char *  n,
const char *  o,
const char *  b,
int  level,
rpmMacroFlags  flags 
)

Push macro to context.

Parameters
mcmacro context (NULL uses global context).
nmacro name
omacro parameters
bmacro body
levelmacro recursion level (0 is entry API)
flagsmacro flags
Returns
0 on success