PnScript

Name

PnScript -- an object for byte-compiling and executing scripts in Paranormal

Synopsis


#include <pn/pn.h>


struct      PnScript;
PnScript*   pn_script_new                   (void);
gboolean    pn_script_parse_string          (PnScript *script,
                                             PnSymbolTable *symbol_table,
                                             const gchar *string);
void        pn_script_execute               (PnScript *script);

Object Hierarchy


  GObject
   +----PnObject
         +----PnScript

Description

PnScript objects parse and execute user scripts for Paranormal actuators. The script requires a PnSymbolTable object into which the in-script variables will be placed. The symbol table can then be used to retrieve or change the values of in-script variables, as well as share variables between multiple scripts.

Details

struct PnScript

struct PnScript;


pn_script_new ()

PnScript*   pn_script_new                   (void);

Creates a new PnScript object.

Returns : The newly created PnScript object


pn_script_parse_string ()

gboolean    pn_script_parse_string          (PnScript *script,
                                             PnSymbolTable *symbol_table,
                                             const gchar *string);

Parses a script, compiling it to a bytecode that is stored within the script object. All in-script variables within the script are added to the specified symbol table (if they are not already in it). If errors are encountered while parsing the script, they are output using pn_error().

script : A PnScript
symbol_table : the PnSymbolTable to associate with the script
string : a string containing the script
Returns : TRUE on success; FALSE otherwise


pn_script_execute ()

void        pn_script_execute               (PnScript *script);

Executes a script, updating all variabes in the associated symbol table as the script dictates.

script : a PnScript