Google

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ScriptInterp Class Reference

System script interpreter core engine class. Extensible Bayonne Scripting Engine. More...

#include <script.h>

Inheritance diagram for ScriptInterp:

ScriptSymbol SharedMemPager List of all members.

Public Methods

bool Attach (const char *scrname)
 Attempt to attach script engine to active session and specify a starting script. More...

void Detach (void)
 Detach the current script image. More...

bool Redirect (const char *scrname)
 Script redirection support. More...

bool Step (const char *trapname = NULL)
 Execute the next pending script statement. More...

bool isActive (void)
 Test if script interpreter is currently active. More...

char* getOption (const char *def = NULL)
 Fetch next logical option but do not evaluate. More...

char* getValue (const char *def = NULL)
 Fetch and evaluate next logical option. More...

char* getContent (char *sym)
 Evaluate the content of an option retrieved with getOption. More...

scriptline_tgetScript (void)
 Return the current script line object so it may be debugged. More...

scriptname_tgetObject (void)
 Return the master script object for resource context. More...

ScriptImagegetImage (void)
 Return the script image holding this application's context. More...

void autoloop (bool enable)
 Enable or disable autolooping of statements. More...


Protected Methods

 ScriptInterp (ScriptCommand *cmd, int symsize, int pgsize = 1024)
 Derive a new instance of the system script interpreter. More...

bool getOnce (void)
 Fetch unique "once" flag and set. More...

void Notify (unsigned long mask)
 Notify signal mask for "on" handlers. More...

void Notify (const char *str)
 Notify signal by symbolic name. More...

unsigned long getMask (void)
 Fetch the current interpreter mask bits directly. More...

ScriptCommandgetCommand (void)
 Fetch the active command interpreter subsystem. More...

bool Conditional (void)
 Used to process "conditional" arguments such as for IF/DO/LOOP statements. More...

bool scrExit (void)
 Some systems can derive alternative "exit" commands which can call this routine after performing other operations.

bool scrGoto (void)
 This is often called to process branching requests.

bool scrData (void)
 Method used to encode "data" lines.

virtual unsigned getId (void)
 Used to return channel identifiers in some systems. More...

scriptsymbol_tgetVariable (int size = 0)
 Fetch a variable (symbol) that will be used to store data. More...

virtual scriptsymbol_tgetIndirect (char *sym)
 May be used to override processing of indirect content requests. More...

void Advance (void)
 Advance program to the next script statement.

void Error (const char *error)
 Set error variable and advance to either the error handler or next script statement. More...

void Trap (unsigned id)
 Set the execution interpreter to a trap identifier. More...

void Trap (const char *trapname)
 Select trap by symbolic name and execute if found, else advance to next script step (unless exit trap). More...

bool Push (void)
 Attempt to push a value onto the stack. More...

bool Pull (void)
 Attempt to recall a previous stack level. More...

bool Signal (const char *trapname)
 Signals are used during "delayed" execution steps when a signal event has occured aynchronously with the execution of a script controlled state event handler. More...

bool Signal (unsigned trapid)
 Signals can be referenced by numeric id as well as by symbolic name. More...

virtual bool Execute (scriptmethod_t method)
 Runtime execution of script handler. More...

virtual void Stop (unsigned long mask)
 Stop request handler. More...

virtual void Exit (void) = 0
 Exit request handler. More...


Friends

class  ScriptCommand

Detailed Description

System script interpreter core engine class. Extensible Bayonne Scripting Engine.

This class is further derived to impliment application specific language dialects.

Author(s):
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

ScriptInterp::ScriptInterp ( ScriptCommand * cmd,
int symsize,
int pgsize = 1024 ) [protected]
 

Derive a new instance of the system script interpreter.

Parameters:
symsize   for default symbol sizing.
pgsize   for memory fragmentation.


Member Function Documentation

void ScriptInterp::Advance ( void ) [protected]
 

Advance program to the next script statement.

bool ScriptInterp::Attach ( const char * scrname )
 

Attempt to attach script engine to active session and specify a starting script.

Returns:
false if failed to attach.
Parameters:
name   of script entry.

bool ScriptInterp::Conditional ( void ) [protected]
 

Used to process "conditional" arguments such as for IF/DO/LOOP statements.

The index is kept at the next logical argument so a goto can be performed if needed.

Returns:
true if conditional test is true.

void ScriptInterp::Detach ( void )
 

Detach the current script image.

If it is the last ref count and the exit flag is set, then delete it.

void ScriptInterp::Error ( const char * error ) [protected]
 

Set error variable and advance to either the error handler or next script statement.

Parameters:
error   message.

bool ScriptInterp::Execute ( scriptmethod_t method ) [inline, protected, virtual]
 

Runtime execution of script handler.

This can be called in the current or derived class to invoke extensible methods.

Returns:
true if immediately ready for next step.
Parameters:
derived   method to call.

void ScriptInterp::Exit ( void ) [protected, pure virtual]
 

Exit request handler.

This is called when no script line exists. No default behavior is known.

void ScriptInterp::Notify ( const char * str ) [inline, protected]
 

Notify signal by symbolic name.

Parameters:
mask   name.

void ScriptInterp::Notify ( unsigned long mask ) [inline, protected]
 

Notify signal mask for "on" handlers.

Parameters:
mask   value.

bool ScriptInterp::Pull ( void ) [protected]
 

Attempt to recall a previous stack level.

Returns:
false if stack underflow.

bool ScriptInterp::Push ( void ) [protected]
 

Attempt to push a value onto the stack.

Returns:
false if stack overflow.

bool ScriptInterp::Redirect ( const char * scrname )
 

Script redirection support.

Returns:
false if redirect failed.
Parameters:
name   of script entry.

bool ScriptInterp::Signal ( unsigned trapid ) [protected]
 

Signals can be referenced by numeric id as well as by symbolic name.

Returns:
true if signal handler is not blocked.
Parameters:
trap   number of handler.

bool ScriptInterp::Signal ( const char * trapname ) [protected]
 

Signals are used during "delayed" execution steps when a signal event has occured aynchronously with the execution of a script controlled state event handler.

This mechanism can be used in place of calling implicit "Step" traps.

Returns:
true if signal handler is not blocked.
Parameters:
name   of signal identifier.

bool ScriptInterp::Step ( const char * trapname = NULL )
 

Execute the next pending script statement.

If no statement is selected, then we execute the exit handler instead. We can also force feed a trap identifier.

Returns:
true if advanced to next script statement already.
Parameters:
optional   trap branch point (also checks mask).

void ScriptInterp::Stop ( unsigned long mask ) [inline, protected, virtual]
 

Stop request handler.

Used for handling external trap requests during a "Signal". This is needed in some state engines when the current state is being abandoned because of a signaled trap.

Parameters:
signal   mask forcing stop.

void ScriptInterp::Trap ( const char * trapname ) [protected]
 

Select trap by symbolic name and execute if found, else advance to next script step (unless exit trap).

Parameters:
name   of trap to select.

void ScriptInterp::Trap ( unsigned id ) [protected]
 

Set the execution interpreter to a trap identifier.

If no trap id exists, then advance to next script statement (unless exit trap).

Parameters:
id   of trap to select numerically.

void ScriptInterp::autoloop ( bool enable ) [inline]
 

Enable or disable autolooping of statements.

Parameters:
true   to enable autoloop (default).

ScriptCommand * ScriptInterp::getCommand ( void ) [inline, protected]
 

Fetch the active command interpreter subsystem.

Returns:
script interpreter.

char * ScriptInterp::getContent ( char * sym )
 

Evaluate the content of an option retrieved with getOption.

Returns:
value of evaluation.
Parameters:
option   string.

unsigned ScriptInterp::getId ( void ) [inline, protected, virtual]
 

Used to return channel identifiers in some systems.

Returns:
channel id or 0 for none.

ScriptImage * ScriptInterp::getImage ( void ) [inline]
 

Return the script image holding this application's context.

Returns:
script image.

scriptsymbol_t * ScriptInterp::getIndirect ( char * sym ) [inline, protected, virtual]
 

May be used to override processing of indirect content requests.

This is used in the Bayonne IVR to fetch content constants based on language and country settings.

Returns:
symbol for indirect content.
Parameters:
indirect   fetch request.

unsigned long ScriptInterp::getMask ( void ) [inline, protected]
 

Fetch the current interpreter mask bits directly.

Returns:
interpreter mask.

scriptname_t * ScriptInterp::getObject ( void ) [inline]
 

Return the master script object for resource context.

Returns:
script object being executed.

bool ScriptInterp::getOnce ( void ) [protected]
 

Fetch unique "once" flag and set.

Returns:
true if once.

char * ScriptInterp::getOption ( const char * def = NULL )
 

Fetch next logical option but do not evaluate.

The index is advanced.

Returns:
option or NULL if end of list.
Parameters:
optional   default.

scriptline_t * ScriptInterp::getScript ( void ) [inline]
 

Return the current script line object so it may be debugged.

Returns:
script image record being executed.

char * ScriptInterp::getValue ( const char * def = NULL )
 

Fetch and evaluate next logical option.

If a symbol ref. then the symbol is also expressed. The index is advanced.

Returns:
option value or NULL if end of list.
Parameters:
optional   default value.

scriptsymbol_t * ScriptInterp::getVariable ( int size = 0 ) [protected]
 

Fetch a variable (symbol) that will be used to store data.

This advances the index.

Returns:
symbol found if any.
Parameters:
optional   size to allocate if new symbol.

bool ScriptInterp::isActive ( void ) [inline]
 

Test if script interpreter is currently active.

Returns:
true if active.

bool ScriptInterp::scrData ( void ) [protected]
 

Method used to encode "data" lines.

bool ScriptInterp::scrExit ( void ) [protected]
 

Some systems can derive alternative "exit" commands which can call this routine after performing other operations.

bool ScriptInterp::scrGoto ( void ) [protected]
 

This is often called to process branching requests.


Friends And Related Function Documentation

class ScriptCommand [friend]
 


The documentation for this class was generated from the following file:
Generated at Thu Apr 5 14:11:40 2001 for ccscript by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000