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

Go to the source code of this file.

Macros

#define _RPMJS_OPTIONS   0
 
#define _RPMJS_INTERNAL
 
#define F_ISSET(_flags, _FLAG)   ((_flags) & RPMJS_FLAGS_##_FLAG)
 
#define DBG(_t, _l)   if ((_t) || _rpmjs_debug) fprintf _l
 

Typedefs

typedef void * JSI_t
 

Functions

static void rpmjsFini (void *_js)
 
static rpmjs rpmjsGetPool (rpmioPool pool)
 
static rpmjs rpmjsI (void)
 
rpmjs rpmjsNew (char **av, uint32_t flags)
 Create and load a js interpreter. More...
 
rpmRC rpmjsRunFile (rpmjs js, const char *fn, char *const *Iargv, const char **resultp)
 Execute js from a file. More...
 
rpmRC rpmjsRun (rpmjs js, const char *str, const char **resultp)
 Execute js string. More...
 

Variables

char ** environ
 
int _rpmjs_debug = 0
 
rpmjs _rpmjsI = NULL
 
uint32_t _rpmjs_options = 0
 
int _rpmjs_zeal = 2
 
struct rpmjs_s _rpmjs
 
struct poptOption rpmjsIPoptTable []
 
rpmioPool _rpmjsPool
 

Macro Definition Documentation

§ _RPMJS_INTERNAL

#define _RPMJS_INTERNAL

Definition at line 66 of file rpmjs.c.

§ _RPMJS_OPTIONS

#define _RPMJS_OPTIONS   0

Definition at line 62 of file rpmjs.c.

§ DBG

#define DBG (   _t,
  _l 
)    if ((_t) || _rpmjs_debug) fprintf _l

Definition at line 76 of file rpmjs.c.

Referenced by rpmjsFini(), rpmjsI(), rpmjsNew(), rpmjsRun(), and rpmjsRunFile().

§ F_ISSET

#define F_ISSET (   _flags,
  _FLAG 
)    ((_flags) & RPMJS_FLAGS_##_FLAG)

Definition at line 71 of file rpmjs.c.

Referenced by rpmjsNew(), and rpmjsRunFile().

Typedef Documentation

§ JSI_t

typedef void* JSI_t

Definition at line 61 of file rpmjs.c.

Function Documentation

§ rpmjsFini()

static void rpmjsFini ( void *  _js)
static

Definition at line 121 of file rpmjs.c.

References DBG.

Referenced by rpmjsGetPool().

§ rpmjsGetPool()

static rpmjs rpmjsGetPool ( rpmioPool  pool)
static

Definition at line 142 of file rpmjs.c.

References _rpmjs_debug, _rpmjsPool, rpmioGetPool(), rpmioNewPool(), and rpmjsFini().

Referenced by rpmjsNew().

§ rpmjsI()

static rpmjs rpmjsI ( void  )
static

Definition at line 156 of file rpmjs.c.

References _rpmjsI, DBG, and rpmjsNew().

Referenced by rpmjsNew(), rpmjsRun(), and rpmjsRunFile().

§ rpmjsNew()

rpmjs rpmjsNew ( char **  av,
uint32_t  flags 
)

Create and load a js interpreter.

Parameters
avjs interpreter args (or NULL)
flagsjs interpreter flags ((1<<31): use global interpreter)
Returns
new js interpreter

Definition at line 171 of file rpmjs.c.

References _rpmjs_options, _rpmjs_zeal, DBG, errno, F_ISSET, getenv(), rpmjsGetPool(), rpmjsI(), rpmjsLink(), rpmlog(), RPMLOG_WARNING, SEEK_SET, and xstrdup().

Referenced by expandMacro(), psmWait(), and rpmjsI().

§ rpmjsRun()

rpmRC rpmjsRun ( rpmjs  js,
const char *  str,
const char **  resultp 
)

Execute js string.

Parameters
jsjs interpreter (NULL uses global interpreter)
strjs string to execute (NULL returns RPMRC_FAIL)
*resultpjs exec result
Returns
RPMRC_OK on success

Definition at line 410 of file rpmjs.c.

References DBG, rpmjsI(), RPMRC_FAIL, RPMRC_OK, and xmalloc.

Referenced by expandMacro(), and psmWait().

§ rpmjsRunFile()

rpmRC rpmjsRunFile ( rpmjs  js,
const char *  fn,
char *const *  Iargv,
const char **  resultp 
)

Execute js from a file.

Parameters
jsjs interpreter (NULL uses global interpreter)
fnjs file to run (NULL returns RPMRC_FAIL)
Iargvjs script argv
*resultpjs exec result
Returns
RPMRC_OK on success

Definition at line 317 of file rpmjs.c.

References DBG, environ, F_ISSET, rpmjsI(), RPMRC_FAIL, and RPMRC_OK.

Variable Documentation

§ _rpmjs

struct rpmjs_s _rpmjs

Definition at line 88 of file rpmjs.c.

§ _rpmjs_debug

int _rpmjs_debug = 0

Definition at line 74 of file rpmjs.c.

Referenced by rpmjsGetPool().

§ _rpmjs_options

uint32_t _rpmjs_options = 0

Definition at line 83 of file rpmjs.c.

Referenced by rpmjsNew().

§ _rpmjs_zeal

int _rpmjs_zeal = 2

Definition at line 86 of file rpmjs.c.

Referenced by rpmjsNew().

§ _rpmjsI

rpmjs _rpmjsI = NULL

Definition at line 80 of file rpmjs.c.

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

§ _rpmjsPool

rpmioPool _rpmjsPool

Definition at line 140 of file rpmjs.c.

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

§ environ

char** environ

§ rpmjsIPoptTable

struct poptOption rpmjsIPoptTable[]
Initial value:
= {
{ "allow", 'a', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_ALLOW,
N_("Allow (read-only) access to caller's environmen"), NULL },
{ "nocache", 'C', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_NOCACHE,
N_("Disables compiler caching via JSScript XDR serialization"), NULL },
{ "loadrc", 'R', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_LOADRC,
N_("Load RC file for interpreter based on script filename."), NULL },
{ "nowarn", 'W', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_NOWARN,
N_("Do not report warnings"), NULL },
{ "norelimit", 'e', POPT_BIT_CLR, &_rpmjs.flags, RPMJS_FLAGS_RELIMIT,
N_("Do not limit regexps to n^3 levels of backtracking"), NULL },
{ "nojit", 'J', POPT_BIT_CLR, &_rpmjs.flags, RPMJS_FLAGS_JIT,
N_("Disable nanojit"), NULL },
{ "nostrict", 'S', POPT_BIT_CLR, &_rpmjs.flags, RPMJS_FLAGS_STRICT,
N_("Disable Strict mode"), NULL },
{ "noutf8", 'U', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_NOUTF8,
N_("Disable UTF-8 C string processing"), NULL },
{ "xml", 'x', POPT_BIT_SET, &_rpmjs.flags, RPMJS_FLAGS_XML,
N_("Parse <!-- comments --> as E4X tokens"), NULL },
{ "anonfunfix", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmjs.flags, RPMJS_FLAGS_ANONFUNFIX,
N_("Parse //@line number [\"filename\"] for XUL"), NULL },
{ "atline", 'A', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmjs.flags, RPMJS_FLAGS_ATLINE,
N_("Parse //@line number [\"filename\"] for XUL"), NULL },
{ "werror", 'w', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &_rpmjs.flags, RPMJS_FLAGS_WERROR,
N_("Convert warnings to errors"), NULL },
POPT_TABLEEND
}
#define N_(Text)
Definition: system.h:490
struct rpmjs_s _rpmjs
Definition: rpmjs.c:88

Definition at line 90 of file rpmjs.c.