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

Defines

#define _RPMJS_OPTIONS   0
#define _RPMJS_INTERNAL
#define F_ISSET(_flags, _FLAG)   ((_flags) & RPMJS_FLAGS_##_FLAG)

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.
rpmRC rpmjsRunFile (rpmjs js, const char *fn, char *const *Iargv, const char **resultp)
 Execute js from a file.
rpmRC rpmjsRun (rpmjs js, const char *str, const char **resultp)
 Execute js string.

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

Define Documentation

#define _RPMJS_INTERNAL

Definition at line 62 of file rpmjs.c.

#define _RPMJS_OPTIONS   0

Definition at line 59 of file rpmjs.c.

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

Definition at line 67 of file rpmjs.c.

Referenced by rpmjsNew(), and rpmjsRunFile().


Typedef Documentation

typedef void* JSI_t

Definition at line 58 of file rpmjs.c.


Function Documentation

static void rpmjsFini ( void *  _js) [static]

Definition at line 114 of file rpmjs.c.

References _rpmjs_debug.

Referenced by rpmjsGetPool().

static rpmjs rpmjsGetPool ( rpmioPool  pool) [static]

Definition at line 132 of file rpmjs.c.

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

Referenced by rpmjsNew().

static rpmjs rpmjsI ( void  ) [static]

Definition at line 146 of file rpmjs.c.

References _rpmjs_debug, _rpmjsI, and rpmjsNew().

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

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 162 of file rpmjs.c.

References _rpmjs_options, _rpmjs_zeal, F_ISSET, getenv(), rpmjsGetPool(), rpmjsI(), and rpmjsLink().

Referenced by expandMacro(), and rpmjsI().

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 383 of file rpmjs.c.

References _rpmjs_debug, rpmjsI(), RPMRC_FAIL, and RPMRC_OK.

Referenced by expandMacro().

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 300 of file rpmjs.c.

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


Variable Documentation

struct rpmjs_s _rpmjs

Definition at line 81 of file rpmjs.c.

int _rpmjs_debug = 0

Definition at line 70 of file rpmjs.c.

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

uint32_t _rpmjs_options = 0

Definition at line 76 of file rpmjs.c.

Referenced by rpmjsNew().

int _rpmjs_zeal = 2

Definition at line 79 of file rpmjs.c.

Referenced by rpmjsNew().

rpmjs _rpmjsI = NULL

Definition at line 73 of file rpmjs.c.

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

Definition at line 130 of file rpmjs.c.

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

char** environ
struct poptOption rpmjsIPoptTable[]
Initial value:
 {
  { "allow", 'a', POPT_BIT_SET,         &_rpmjs.flags, RPMJS_FLAGS_ALLOW,
         "Allow (read-only) access to caller's environmen" , NULL },
  { "nocache", 'C', POPT_BIT_SET,       &_rpmjs.flags, RPMJS_FLAGS_NOCACHE,
         "Disables compiler caching via JSScript XDR serialization" , NULL },
  { "loadrc", 'R', POPT_BIT_SET,        &_rpmjs.flags, RPMJS_FLAGS_LOADRC,
         "Load RC file for interpreter based on script filename." , NULL },
  { "nowarn", 'W', POPT_BIT_SET,        &_rpmjs.flags, RPMJS_FLAGS_NOWARN,
         "Do not report warnings" , NULL },

  { "norelimit", 'e', POPT_BIT_CLR,     &_rpmjs.flags, RPMJS_FLAGS_RELIMIT,
         "Do not limit regexps to n^3 levels of backtracking" , NULL },
  { "nojit", 'J', POPT_BIT_CLR,         &_rpmjs.flags, RPMJS_FLAGS_JIT,
         "Disable nanojit" , NULL },
  { "nostrict", 'S', POPT_BIT_CLR,      &_rpmjs.flags, RPMJS_FLAGS_STRICT,
         "Disable Strict mode" , NULL },
  { "noutf8", 'U', POPT_BIT_SET,        &_rpmjs.flags, RPMJS_FLAGS_NOUTF8,
         "Disable UTF-8 C string processing" , NULL },
  { "xml", 'x', POPT_BIT_SET,           &_rpmjs.flags, RPMJS_FLAGS_XML,
         "Parse <!-- comments --> as E4X tokens" , NULL },

  { "anonfunfix", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,   &_rpmjs.flags, RPMJS_FLAGS_ANONFUNFIX,
         "Parse //@line number [\"filename\"] for XUL" , NULL },
  { "atline", 'A', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,        &_rpmjs.flags, RPMJS_FLAGS_ATLINE,
         "Parse //@line number [\"filename\"] for XUL" , NULL },
  { "werror", 'w', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,        &_rpmjs.flags, RPMJS_FLAGS_WERROR,
         "Convert warnings to errors" , NULL },

  POPT_TABLEEND
}

Definition at line 83 of file rpmjs.c.