rpm  5.4.10
Macros | Functions | Variables
rpmruby.c File Reference
#include "system.h"
#include <argv.h>
#include "rpmruby.h"
#include "debug.h"
Include dependency graph for rpmruby.c:

Go to the source code of this file.

Macros

#define _RPMRUBY_INTERNAL   1

Functions

static void rpmrubyFini (void *_ruby)
 Finalizes a Ruby interpreter instance/pool item.
static rpmruby rpmrubyGetPool (rpmioPool pool)
 Returns the current rpmio pool responsible for Ruby interpreter instances.
static rpmruby rpmrubyI ()
rpmruby rpmrubyNew (char **av, uint32_t flags)
 Creates and initializes a Ruby interpreter.
rpmRC rpmrubyRun (rpmruby ruby, const char *str, const char **resultp)
 Evaluates Ruby code stored in a string.

Variables

int _rpmruby_debug = 0
 Triggers printing of debugging information.
rpmruby _rpmrubyI = NULL
 Current (global) interpreter instance.
rpmioPool _rpmrubyPool
 The pool of Ruby interpreter instances.

Macro Definition Documentation

#define _RPMRUBY_INTERNAL   1

Definition at line 24 of file rpmruby.c.

Function Documentation

static void rpmrubyFini ( void *  _ruby)
static

Finalizes a Ruby interpreter instance/pool item.

Definition at line 38 of file rpmruby.c.

Referenced by rpmrubyGetPool().

static rpmruby rpmrubyGetPool ( rpmioPool  pool)
static

Returns the current rpmio pool responsible for Ruby interpreter instances.

This is a wrapper function that returns the current rpmio pool responsible for embedded Ruby interpreters. It creates and initializes a new pool when there is no current pool.

Returns
The current pool
See Also
rpmioNewPool

Definition at line 67 of file rpmruby.c.

References _rpmruby_debug, _rpmrubyPool, rpmioGetPool(), rpmioNewPool(), and rpmrubyFini().

Referenced by rpmrubyNew().

static rpmruby rpmrubyI ( )
static

Definition at line 91 of file rpmruby.c.

References _rpmrubyI, and rpmrubyNew().

Referenced by rpmrubyNew(), and rpmrubyRun().

rpmruby rpmrubyNew ( char **  av,
uint32_t  flags 
)

Creates and initializes a Ruby interpreter.

Parameters
avArguments to the Ruby interpreter (may be NULL)
flagsRuby interpreter flags: ((1<<31): use global interpreter)
Returns
A new Ruby interpreter

Definition at line 125 of file rpmruby.c.

References _rpmrubyI, rpmrubyGetPool(), rpmrubyI(), rpmrubyLink(), and rpmrubyRun().

Referenced by expandMacro(), and rpmrubyI().

rpmRC rpmrubyRun ( rpmruby  ruby,
const char *  str,
const char **  resultp 
)

Evaluates Ruby code stored in a string.

Parameters
rubyThe Ruby interpreter that is to be used (NULL uses global interpreter)
strRuby code to evaluate (NULL forces return of RPMRC_FAIL)
*resultpResult of the evaluation
Returns
RPMRC_OK on success

Definition at line 163 of file rpmruby.c.

References _rpmruby_debug, RPMRC_FAIL, RPMRC_OK, and rpmrubyI().

Referenced by expandMacro(), rpmrbLoadClasses(), rpmrbLoadFile(), and rpmrubyNew().

Variable Documentation

int _rpmruby_debug = 0

Triggers printing of debugging information.

Definition at line 30 of file rpmruby.c.

Referenced by main(), rpmrubyGetPool(), and rpmrubyRun().

rpmruby _rpmrubyI = NULL

Current (global) interpreter instance.

At the moment, this variable is merely a safeguard against initializing the Ruby interpreter over and over again. In the future, when there is Ruby support for multiple interpreter instances, a flag given to rpmrubyNew() will use this variable and return the global interpreter instance.

Definition at line 33 of file rpmruby.c.

Referenced by rpmcliFini(), rpmioClean(), rpmrbLoadClasses(), rpmrubyI(), and rpmrubyNew().

rpmioPool _rpmrubyPool

The pool of Ruby interpreter instances.

See Also
rpmioPool

Definition at line 55 of file rpmruby.c.

Referenced by rpmcliFini(), rpmioClean(), and rpmrubyGetPool().