Bayonne2 / Common C++ 2 Framework
|
#include <script3.h>
Data Structures | |
class | Frame |
Public Types | |
enum | scrAccess { scrPUBLIC, scrPROTECTED, scrPRIVATE, scrFUNCTION, scrLOCAL } |
typedef enum scrAccess | scrAccess |
enum | symType { symNORMAL = 0, symCONST, symDYNAMIC, symFIFO, symSEQUENCE, symSTACK, symCOUNTER, symPOINTER, symREF, symARRAY, symASSOC, symINITIAL, symNUMBER, symLOCK, symPROPERTY, symORIGINAL, symMODIFIED, symTIMER, symBOOL } |
typedef enum symType | symType |
typedef bool(ScriptInterp::* | Method )(void) |
typedef const char *(ScriptCommand::* | Check )(Line *line, ScriptImage *img) |
typedef bool(* | Cond )(ScriptInterp *interp, const char *v) |
typedef long(* | Function )(long *args, unsigned prec) |
typedef const char *(* | Meta )(ScriptInterp *interp, const char *token) |
typedef const char *(* | Parse )(ScriptCompiler *img, const char *token) |
typedef void(* | Init )(void) |
typedef struct ost::Script::_symbol | Symbol |
typedef struct ost::Script::_array | Array |
Public Member Functions | |
long | getIntValue (const char *text, unsigned prec, ScriptProperty *property=NULL) |
int | numericExpression (long *list, int max, unsigned prec, ScriptProperty *property=NULL) |
bool | conditionalExpression (void) |
bool | conditional (void) |
virtual unsigned | getId (void) |
unsigned long | getSequence (void) |
virtual const char * | getLogname (void) |
virtual ScriptInterp * | getInterp (const char *id) |
virtual const char * | getExternal (const char *opt) |
ScriptImage * | getImage (void) |
const char * | getMember (void) |
const char * | getKeyword (const char *kw) |
const char * | getKeyoption (const char *kw) |
const char * | getValue (const char *def=NULL) |
const char * | getOption (const char *def=NULL) |
const char * | hasOption (void) |
const char * | getContent (const char *opt) |
const char * | getSymContent (const char *opt) |
Symbol * | getKeysymbol (const char *kw, unsigned size=0) |
Symbol * | getSymbol (unsigned short size=0) |
char | getPackToken (void) |
Frame * | getFrame (void) |
Line * | getLine (void) |
void | setFrame (void) |
Name * | getName (void) |
bool | getTrace (void) |
bool | execute (Method method) |
Runtime execution of script handler. More... | |
virtual void | logmissing (const char *id, const char *level="undefined", const char *group="symbol") |
virtual void | logerror (const char *msg, const char *name=NULL) |
Symbol * | mapSymbol (const char *id, unsigned short=0) |
Symbol * | mapDirect (const char *id, unsigned short=0) |
bool | setNumber (const char *id, const char *value=NULL, unsigned dec=0) |
bool | setSymbol (const char *id, const char *value=NULL, unsigned short size=0) |
bool | setConst (const char *id, const char *value) |
bool | putSymbol (const char *id, const char *value, unsigned short size=0) |
bool | getSymbol (const char *id, char *buffer, unsigned short max) |
bool | catSymbol (const char *id, const char *value, unsigned short size=0) |
const char * | getSymbol (const char *id) |
Name * | getScript (const char *name) |
ScriptInterp () | |
bool | step (void) |
bool | attach (ScriptCommand *cmd, const char *scrname) |
void | detach (void) |
void | attach (ScriptCommand *cmd, ScriptImage *img, Name *scr) |
void | release (void) |
Release any acquired lock... More... | |
bool | signal (const char *name) |
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 id) |
Signals can be referenced by numeric id as well as by symbolic name. More... | |
bool | done (void) |
timeout_t | getTimeout (void) |
virtual void | branching (void) |
A virtual holding a branch conditional member. More... | |
bool | isRunning (void) |
bool | isExiting (void) |
char * | getTemp (void) |
unsigned | getTempSize (void) |
void | nameMutex (const char *name) |
Enable setting of mutex name for deadlock debug. More... | |
void | enterMutex (void) |
Entering a Mutex locks the mutex for the current thread. More... | |
void | enter (void) |
Future abi will use enter/leave/test members. More... | |
void | leave (void) |
Future abi will use enter/leave/test members. More... | |
bool | test (void) |
Future abi will use enter/leave/test members. More... | |
bool | tryEnterMutex (void) |
Tries to lock the mutex for the current thread. More... | |
void | leaveMutex (void) |
Leaving a mutex frees that mutex for use by another thread. More... | |
const char * | cstring (const char *str) |
unsigned | gathertype (Symbol **idx, unsigned max, const char *prefix, symType group) |
unsigned | gather (Symbol **idx, unsigned max, const char *prefix, const char *suffix) |
Symbol * | find (const char *id, unsigned short size=0) |
Symbol * | make (const char *id, unsigned short size) |
Symbol * | setReference (const char *id, Symbol *target) |
int | getPages (void) |
Return the total number of pages that have been allocated for this memory pool. More... | |
Static Public Member Functions | |
static long | getRealValue (double val, unsigned prec) |
static double | getDouble (long value, unsigned prec) |
static long | getInteger (long value, unsigned prec) |
static long | getTens (unsigned prec) |
static void | setDebug (bool mode) |
Enable or disable deadlock debugging. More... | |
static bool | isScript (Name *scr) |
static bool | isSymbol (const char *id) |
static bool | use (const char *name) |
static unsigned | getIndex (const char *id) |
static Symbol * | deref (Symbol *sym) |
static bool | commit (Symbol *sym, const char *value) |
static bool | append (Symbol *sym, const char *value) |
static bool | symindex (Symbol *sym, short offset) |
static const char * | extract (Symbol *sym) |
static unsigned | count (Symbol *sym) |
static unsigned | storage (Symbol *sym) |
static void | clear (Symbol *sym) |
static void | addFunction (const char *name, unsigned count, Function i) |
static void | addConditional (const char *name, Cond test) |
static bool | isPrivate (Name *scr) |
static bool | isFunction (Name *scr) |
Data Fields | |
class __EXPORT | Line |
class __EXPORT | Name |
Static Public Attributes | |
static size_t | pagesize |
static bool | fastStart |
static bool | useBigmem |
static unsigned | fastStepping |
static unsigned | autoStepping |
static unsigned | symsize |
static unsigned | symlimit |
static char | decimal |
static bool | use_definitions |
static bool | use_macros |
static bool | use_prefix |
static bool | use_merge |
static bool | use_funcs |
static const char * | plugins |
static const char * | altplugins |
static const char * | access_user |
static const char * | access_pass |
static const char * | access_host |
static bool | exec_funcs |
static const char * | exec_extensions |
static const char * | exec_token |
static const char * | exec_prefix |
static const char * | exit_token |
static const char * | apps_extensions |
static const char * | apps_prefix |
static const char * | etc_prefix |
static const char * | var_prefix |
static const char * | log_prefix |
Protected Member Functions | |
virtual ScriptSymbols * | getSymbols (const char *id) |
ScriptSymbols * | getLocal (void) |
void | initRuntime (Name *name) |
Initialize execution environment for a script. More... | |
virtual void | initialize (void) |
New virtual to initialize script environment syms before running init sections. More... | |
bool | push (void) |
Attempt to push a value onto the stack. More... | |
bool | pull (void) |
Attempt to recall a previous stack level. More... | |
void | clearStack (void) |
Clear the stack of local loops or recursion for branching. More... | |
void | advance (void) |
Advance program to the next script statement. More... | |
void | skip (void) |
Skip line without checking or setting updates. More... | |
void | error (const char *error) |
Set error variable and advance to either the error handler or next script statement. More... | |
bool | scriptEvent (const char *name, bool inhereted=true) |
Events reference to named @event handlers which have been attached to a script. More... | |
void | gotoEvent (NamedEvent *event) |
Branch to a selected event record immediately. More... | |
void | trap (unsigned id) |
Set the execution interpreter to a trap identifier. More... | |
bool | tryCatch (const char *id) |
Tries a catch handler... More... | |
void | trap (const char *name) |
Select trap by symbolic name and execute if found, else advance to next script step (unless exit trap). More... | |
virtual bool | isLocked (const char *id) |
virtual const char * | remapLocal (void) |
virtual bool | exit (void) |
virtual void | enterThread (ScriptThread *thread) |
virtual void | exitThread (const char *msg) |
virtual void | waitThread (void) |
virtual void | startThread (void) |
bool | eventThread (const char *evt, bool flag=true) |
bool | redirect (const char *scr) |
void | ripple (void) |
bool | redirect (bool evflag) |
unsigned long | getMask (void) |
void | purge (void) |
virtual void * | first (size_t size) |
Allocate first workspace from paged memory. More... | |
char * | first (char *str) |
Allocate a string from the memory pager pool and copy the string into it's new memory area. More... | |
virtual void * | alloc (size_t size) |
Allocate memory from either the currently active page, or allocate a new page for the object. More... | |
char * | alloc (const char *str) |
Allocate a string from the memory pager pool and copy the string inti it's new memory area. More... | |
void | clean (void) |
Clean for memory cleanup before exiting. More... | |
Protected Attributes | |
Mutex * | lock |
ScriptCommand * | cmd |
ScriptImage * | image |
ScriptInterp * | session |
ScriptThread * | thread |
Frame | frame [32] |
char * | temps [16] |
unsigned | tempidx |
unsigned | stack |
bool | initialized |
bool | trace |
bool | exiting |
bool | updated |
unsigned long | sequence |
char | logname [32] |
Symbol * | index [KEYDATA_INDEX_SIZE+1] |
Static Protected Attributes | |
static Test * | test |
static Fun * | ifun |
Friends | |
class __EXPORT | ScriptThread |
class __EXPORT | ScriptCommand |
class __EXPORT | ScriptBinder |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
ost::ScriptInterp::ScriptInterp | ( | ) |
|
staticinherited |
|
staticinherited |
|
protected |
Advance program to the next script statement.
|
protectedvirtualinherited |
Allocate memory from either the currently active page, or allocate a new page for the object.
size | size of memory to allocate. |
Reimplemented in SharedMemPager.
|
protectedinherited |
Allocate a string from the memory pager pool and copy the string inti it's new memory area.
This checks only the last active page for available space before allocating a new page.
str | string to allocate and copy into paged memory pool. |
|
staticinherited |
bool ost::ScriptInterp::attach | ( | ScriptCommand * | cmd, |
const char * | scrname | ||
) |
void ost::ScriptInterp::attach | ( | ScriptCommand * | cmd, |
ScriptImage * | img, | ||
Name * | scr | ||
) |
|
virtual |
A virtual holding a branch conditional member.
This may be invoked typically from goto or restart. Can be used to check contextual changes.
Reimplemented in ost::BayonneSession.
bool ost::ScriptInterp::catSymbol | ( | const char * | id, |
const char * | value, | ||
unsigned short | size = 0 |
||
) |
|
protectedinherited |
Clean for memory cleanup before exiting.
|
staticinherited |
|
protected |
Clear the stack of local loops or recursion for branching.
|
staticinherited |
bool ost::ScriptInterp::conditional | ( | void | ) |
bool ost::ScriptInterp::conditionalExpression | ( | void | ) |
|
staticinherited |
|
inlineinherited |
void ost::ScriptInterp::detach | ( | void | ) |
bool ost::ScriptInterp::done | ( | void | ) |
|
inlineinherited |
|
inherited |
Entering a Mutex locks the mutex for the current thread.
This also can be done using the ENTER_CRITICAL macro or by using the ++ operator on a mutex.
|
protectedvirtual |
Reimplemented in ost::BayonneSession.
|
protected |
Set error variable and advance to either the error handler or next script statement.
error | message. |
|
protected |
bool ost::ScriptInterp::execute | ( | Method | method | ) |
Runtime execution of script handler.
This can be called in the current or derived class to invoke extensible methods.
method | derived method member to call. |
|
protectedvirtual |
Reimplemented in ost::BayonneSession.
|
protectedvirtual |
Reimplemented in ost::BayonneSession.
|
staticinherited |
|
inherited |
|
protectedvirtualinherited |
Allocate first workspace from paged memory.
This method scans all currently allocated blocks for available space before adding new pages and hence is both slower and more efficient.
size | size of memory to allocate. |
Reimplemented in SharedMemPager.
|
protectedinherited |
Allocate a string from the memory pager pool and copy the string into it's new memory area.
This method allocates memory by first searching for an available page, and then allocating a new page if no space is found.
str | string to allocate and copy into paged memory pool. |
|
inherited |
|
inherited |
const char* ost::ScriptInterp::getContent | ( | const char * | opt | ) |
|
static |
|
virtual |
Reimplemented in ost::BayonneSession.
|
virtual |
Reimplemented in ost::BayonneSession.
|
inline |
|
staticinherited |
|
static |
|
virtual |
Reimplemented in ost::BayonneSession.
long ost::ScriptInterp::getIntValue | ( | const char * | text, |
unsigned | prec, | ||
ScriptProperty * | property = NULL |
||
) |
const char* ost::ScriptInterp::getKeyoption | ( | const char * | kw | ) |
Symbol* ost::ScriptInterp::getKeysymbol | ( | const char * | kw, |
unsigned | size = 0 |
||
) |
const char* ost::ScriptInterp::getKeyword | ( | const char * | kw | ) |
|
protected |
|
inlinevirtual |
|
protected |
const char* ost::ScriptInterp::getMember | ( | void | ) |
const char* ost::ScriptInterp::getOption | ( | const char * | def = NULL | ) |
char ost::ScriptInterp::getPackToken | ( | void | ) |
|
inlineinherited |
|
static |
Name* ost::ScriptInterp::getScript | ( | const char * | name | ) |
|
inline |
Symbol* ost::ScriptInterp::getSymbol | ( | unsigned short | size = 0 | ) |
bool ost::ScriptInterp::getSymbol | ( | const char * | id, |
char * | buffer, | ||
unsigned short | max | ||
) |
const char* ost::ScriptInterp::getSymbol | ( | const char * | id | ) |
|
protectedvirtual |
Reimplemented in ost::BayonneSession.
const char* ost::ScriptInterp::getSymContent | ( | const char * | opt | ) |
char* ost::ScriptInterp::getTemp | ( | void | ) |
unsigned ost::ScriptInterp::getTempSize | ( | void | ) |
|
static |
timeout_t ost::ScriptInterp::getTimeout | ( | void | ) |
const char* ost::ScriptInterp::getValue | ( | const char * | def = NULL | ) |
|
protected |
Branch to a selected event record immediately.
event | record pointer to access. |
const char* ost::ScriptInterp::hasOption | ( | void | ) |
|
protectedvirtual |
New virtual to initialize script environment syms before running init sections.
Reimplemented in ost::BayonneSession.
|
protected |
Initialize execution environment for a script.
|
staticinherited |
|
protectedvirtual |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
inlineinherited |
|
inherited |
Leaving a mutex frees that mutex for use by another thread.
If the mutex has been entered (invoked) multiple times (recursivily) by the same thread, then it will need to be exited the same number of instances before it is free for re-use. This operation can also be done using the LEAVE_CRITICAL macro or by the – operator on a mutex.
|
virtual |
|
virtual |
|
inherited |
Symbol* ost::ScriptInterp::mapDirect | ( | const char * | id, |
unsigned | short = 0 |
||
) |
Symbol* ost::ScriptInterp::mapSymbol | ( | const char * | id, |
unsigned | short = 0 |
||
) |
|
inlineinherited |
int ost::ScriptInterp::numericExpression | ( | long * | list, |
int | max, | ||
unsigned | prec, | ||
ScriptProperty * | property = NULL |
||
) |
|
protected |
Attempt to recall a previous stack level.
|
protectedinherited |
|
protected |
Attempt to push a value onto the stack.
bool ost::ScriptInterp::putSymbol | ( | const char * | id, |
const char * | value, | ||
unsigned short | size = 0 |
||
) |
|
protected |
|
protected |
void ost::ScriptInterp::release | ( | void | ) |
Release any acquired lock...
|
protectedvirtual |
|
protected |
|
protected |
Events reference to named @event handlers which have been attached to a script.
This allows low level applications to invoke an event handler much the way a signal handler occurs.
name | of event handler. |
inhereted | search flag. |
bool ost::ScriptInterp::setConst | ( | const char * | id, |
const char * | value | ||
) |
|
inlinestaticinherited |
void ost::ScriptInterp::setFrame | ( | void | ) |
bool ost::ScriptInterp::setNumber | ( | const char * | id, |
const char * | value = NULL , |
||
unsigned | dec = 0 |
||
) |
bool ost::ScriptInterp::setSymbol | ( | const char * | id, |
const char * | value = NULL , |
||
unsigned short | size = 0 |
||
) |
bool ost::ScriptInterp::signal | ( | const char * | name | ) |
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.
name | of signal identifier. |
bool ost::ScriptInterp::signal | ( | unsigned | id | ) |
Signals can be referenced by numeric id as well as by symbolic name.
id | number of handler. |
|
protected |
Skip line without checking or setting updates.
|
protectedvirtual |
Reimplemented in ost::BayonneSession.
bool ost::ScriptInterp::step | ( | void | ) |
|
staticinherited |
|
staticinherited |
|
inlineinherited |
|
protected |
Set the execution interpreter to a trap identifier.
If no trap id exists, then advance to next script statement (unless exit trap).
id | of trap to select numerically. |
|
protected |
Select trap by symbolic name and execute if found, else advance to next script step (unless exit trap).
name | of trap to select. |
|
protected |
Tries a catch handler...
id | of catch handler to try. |
|
inherited |
Tries to lock the mutex for the current thread.
Behaves like enterMutex , except that it doesn't block the calling thread if the mutex is already locked by another thread.
|
staticinherited |
|
protectedvirtual |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
protectedinherited |
|
inherited |
|
inherited |
|
protected |
|
protected |