rpm  5.4.4
Defines | Functions | Variables
rpmio/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.

Defines

#define _RPMRUBY_INTERNAL   1
 Allows access to the gory details of rpmruby pool items.

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.

Define Documentation

#define _RPMRUBY_INTERNAL   1

Allows access to the gory details of rpmruby pool items.

Definition at line 25 of file rpmruby.c.


Function Documentation

static void rpmrubyFini ( void *  _ruby) [static]

Finalizes a Ruby interpreter instance/pool item.

Definition at line 41 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 72 of file rpmruby.c.

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

Referenced by rpmrubyNew().

static rpmruby rpmrubyI ( ) [static]

Definition at line 100 of file rpmruby.c.

References _rpmrubyI, and rpmrubyNew().

Referenced by 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 111 of file rpmruby.c.

References _rpmrubyI, rpmrubyGetPool(), 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 145 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 31 of file rpmruby.c.

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

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 34 of file rpmruby.c.

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

The pool of Ruby interpreter instances.

See also:
rpmioPool

Definition at line 59 of file rpmruby.c.

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