rpm
5.4.14
|
Embedded Ruby interpreter. More...
Go to the source code of this file.
Macros | |
#define | rpmrubyUnlink(_ruby) |
#define | rpmrubyLink(_ruby) |
#define | rpmrubyFree(_ruby) |
Typedefs | |
typedef struct rpmruby_s * | rpmruby |
Functions | |
rpmruby | rpmrubyUnlink (rpmruby ruby) |
Dereferences a Ruby interpreter instance. More... | |
rpmruby | rpmrubyLink (rpmruby ruby) |
References a Ruby interpreter instance. More... | |
rpmruby | rpmrubyFree (rpmruby ruby) |
Destroys a Ruby interpreter instance. More... | |
rpmruby | rpmrubyNew (char **av, uint32_t flags) |
Creates and initializes a Ruby interpreter. More... | |
rpmRC | rpmrubyRun (rpmruby ruby, const char *str, const char **resultp) |
Evaluates Ruby code stored in a string. More... | |
Variables | |
int | _rpmruby_debug |
Triggers printing of debugging information. More... | |
rpmruby | _rpmrubyI |
Current (global) interpreter instance. More... | |
Embedded Ruby interpreter.
This allows the embedding of the Ruby interpreter into RPM5. It can be used, for example, for expanding in the fashion of %expand{ruby: ...}
.
Currently (as of ruby-1.9.2), the Ruby interpreter allows only one instance of itself per process. As such, rpmio's pooling mechanism will also always contain only one rpmruby instance. Calling rpmrubyNew() will initialize a new interpreter, while rpmrubyFree() beds this instance. Make sure you keep things in order, that is, call rpmrubyNew() exactly once, and don't forget to call rpmrubyFree() when you're done. Repeatedly calling rpmrubyNew will have no effect while an interpreter is allocated.
You can use rpmrubyRun() to evaluate Ruby code and get the result back.
Definition in file rpmruby.h.
#define rpmrubyFree | ( | _ruby | ) |
#define rpmrubyLink | ( | _ruby | ) |
#define rpmrubyUnlink | ( | _ruby | ) |
Destroys a Ruby interpreter instance.
ruby | The Ruby interpreter to be destroyed |
Referenced by rpmioClean(), and while().
References a Ruby interpreter instance.
ruby | Ruby interpreter |
Referenced by rpmrubyNew().
rpmruby rpmrubyNew | ( | char ** | av, |
uint32_t | flags | ||
) |
Creates and initializes a Ruby interpreter.
av | Arguments to the Ruby interpreter (may be NULL) |
flags | Ruby interpreter flags: ((1<<31): use global interpreter) |
Definition at line 99 of file rpmruby.c.
References _rpmrubyI, NULL, rpmrubyGetPool(), rpmrubyLink(), rpmrubyRun(), and void.
Referenced by rpmrubyI(), and while().
Evaluates Ruby code stored in a string.
ruby | The Ruby interpreter that is to be used (NULL uses global interpreter) |
str | Ruby code to evaluate (NULL forces return of RPMRC_FAIL) |
*resultp | Result of the evaluation |
Definition at line 126 of file rpmruby.c.
References _rpmruby_debug, fprintf(), NULL, rc, RPMRC_FAIL, RPMRC_OK, and rpmrubyI().
Referenced by rpmrbLoadClasses(), rpmrbLoadFile(), rpmrubyNew(), and while().
Dereferences a Ruby interpreter instance.
ruby | Ruby interpreter pool item |
int _rpmruby_debug |
Triggers printing of debugging information.
Definition at line 29 of file rpmruby.c.
Referenced by main(), rpmrubyGetPool(), and rpmrubyRun().
rpmruby _rpmrubyI |
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 553 of file poptALL.c.
Referenced by rpmioClean(), rpmrbLoadClasses(), rpmrubyI(), and rpmrubyNew().