|
|
System script interpreter core engine class. This class is further derived to impliment application specific language dialects.
ScriptInterp (ScriptCommand *cmd, int symsize, int pgsize = 1024) |
Derive a new instance of the system script interpreter.
Parameters:
symsize | for default symbol sizing. |
pgsize | for memory fragmentation. |
inline ScriptCommand * getCommand (void) |
Fetch the active command interpreter subsystem.
Returns: script interpreter.
bool Conditional (void) |
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.
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 Attach (const char *scrname) |
Attempt to attach script engine to active session and specify a starting script.
Parameters:
name | of script entry. |
Returns: false if failed to attach.
void Detach (void) |
Detach the current script image. If it is the last ref count and the exit flag is set, then delete it.
unsigned getId (void) |
Used to return channel identifiers in some systems.
Returns: channel id or 0 for none.
char * getOption (const char *def = NULL) |
Fetch next logical option but do not evaluate. The index is advanced.
Parameters:
optional | default. |
Returns: option or NULL if end of list.
char * 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.
Parameters:
optional | default value. |
Returns: option value or NULL if end of list.
scriptsymbol_t * getVariable (int size = 0) |
Fetch a variable (symbol) that will be used to store data. This advances the index.
Parameters:
optional | size to allocate if new symbol. |
Returns: symbol found if any.
char * getContent (char *sym) |
Evaluate the content of an option retrieved with getOption.
Parameters:
option | string. |
Returns: value of evaluation.
scriptsymbol_t * getIndirect (char *sym) |
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.
Parameters:
indirect | fetch request. |
Returns: symbol for indirect content.
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.
Parameters:
error | message. |
void Trap (unsigned id) |
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 Trap (const char *trapname) |
Select trap by symbolic name and execute if found, else advance to next script step (unless exit trap).
Parameters:
name | of trap to select. |
bool Push (void) |
Attempt to push a value onto the stack.
Returns: false if stack overflow.
bool Pull (void) |
Attempt to recall a previous stack level.
Returns: false if stack underflow.
bool 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.
Parameters:
optional | trap branch point (also checks mask). |
Returns: true if advanced to next script statement already.
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. This mechanism can be used in place of calling implicit "Step" traps.
Parameters:
name | of signal identifier. |
Returns: true if signal handler is not blocked.
bool Signal (unsigned trapid) |
Signals can be referenced by numeric id as well as by symbolic name.
Parameters:
trap | number of handler. |
Returns: true if signal handler is not blocked.
bool Execute (scriptmethod_t method) |
Runtime execution of script handler. This can be called in the current or derived class to invoke extensible methods.
Parameters:
derived | method to call. |
Returns: true if immediately ready for next step.
void Stop (unsigned long mask) |
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 Exit (void) |
Exit request handler. This is called when no script line exists. No default behavior is known.