Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

ucc::script::interp Class Reference

An instance of the runtime interpreter. More...

#include <script.h>

Inheritance diagram for ucc::script::interp:
Inheritance graph
[legend]
Collaboration diagram for ucc::script::interp:
Collaboration graph
[legend]

Public Types

typedef char num_t [16]

Public Member Functions

bool attach (script *image, const char *entry=NULL)
 Attach a compiled image to the interpreter and start.
void detach (void)
 Cleanup after interpreter run.
bool error (const char *text)
 Invoke runtime interpreter error handling.
unsigned getResource (void)
 Get current dsp resource mask.
void initialize (void)
 Used to initialize and purge the interpreter between runs.
bool step (void)
 Step through an instance of the interpreter.

Protected Member Functions

symbolcreateSymbol (const char *id)
symbolfind (const char *id)
virtual bool getCondition (const char *test, const char *value)
const char * getContent (void)
const char * getContent (const char *text)
virtual const char * getFormat (symbol *sym, const char *id, char *temp)
const char * getIndex (void)
const char * getKeyword (const char *id)
method_t getLooping (void)
void getParams (header *scope, line_t *line)
char * getTemp (void)
virtual const char * getTypeinit (const char *type_id)
virtual unsigned getTypesize (const char *type_id)
const char * getValue (void)
symbolgetVar (const char *id, const char *value=NULL)
bool isConditional (unsigned index)
virtual bool isInherited (const char *name)
 Used to determine if an event handler should be treated as inherited/callable from the base script when requested from a defined block of code but not found there.
virtual bool match (const char *pattern, const char *name)
 Define pattern match virtual.
bool pop (void)
void pullBase (void)
void pullLoop (void)
void pullScope (void)
void push (void)
bool scriptEvent (const char *name)
 Try to branch to a named event handler.
eventscriptMethod (const char *name)
 Search for an event object in the method table.
bool setConst (const char *id, const char *value)
void setRef (header *scope, const char *id, char *data, unsigned size)
void setStack (header *scr, event *ev=NULL)
void skip (void)
void startScript (header *scr)
bool tryexit (void)
bool trylabel (const char *id)

Protected Attributes

unsigned frame
pointer< scriptimage
stack_tstack
LinkedObject ** syms

Detailed Description

An instance of the runtime interpreter.

Some application servers, like GNU Bayonne, may create an interpreter instance for each telephone call session. All runtime execution happens through the interpreter class, which executes compiled script images. This is commonly used as a base class for runtime methods and application specific interpreters. All interpreter instance data and symbols are allocated off the interpreter instance private heap.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 256 of file script.h.


Member Function Documentation

bool ucc::script::interp::attach ( script image,
const char *  entry = NULL 
)

Attach a compiled image to the interpreter and start.

Even when different entry points are called, the initialization block is always called.

Parameters:
image to attach (ref count).
entry point, NULL for "@main"
Returns:
true ifi successful, false if failed to find entry.
void ucc::script::interp::detach ( void   ) 

Cleanup after interpreter run.

Releases reference to image.

bool ucc::script::interp::error ( const char *  text  ) 

Invoke runtime interpreter error handling.

Parameters:
text to post into error symbol.
unsigned ucc::script::interp::getResource ( void   ) 

Get current dsp resource mask.

Returns:
resource mask.
void ucc::script::interp::initialize ( void   ) 

Used to initialize and purge the interpreter between runs.

This is used especially if the same interpreter object is kept in memory and directly re-used for multiple executions.

virtual bool ucc::script::interp::isInherited ( const char *  name  )  [protected, virtual]

Used to determine if an event handler should be treated as inherited/callable from the base script when requested from a defined block of code but not found there.

Parameters:
name of event.
Returns:
true if is inherited.
virtual bool ucc::script::interp::match ( const char *  pattern,
const char *  name 
) [protected, virtual]

Define pattern match virtual.

This is used for the "$" conditional expression, for event dispatch, and for some searches.

Parameters:
pattern to match.
name we match with.
Returns:
true if pattern matches.
bool ucc::script::interp::scriptEvent ( const char *  name  )  [protected]

Try to branch to a named event handler.

If successful, the interpreter transfers control to the start of the handler for the next step.

Parameters:
name of event to request.
Returns:
true if found.
event* ucc::script::interp::scriptMethod ( const char *  name  )  [protected]

Search for an event object in the method table.

Parameters:
name to search for.
Returns:
method if found.
bool ucc::script::interp::step ( void   ) 

Step through an instance of the interpreter.

This can step through multiple lines at once, depending on script::stepping.

Returns:
true if still running, false if exited.

The documentation for this class was generated from the following file: