|
Yate
|
Script runtime execution. More...
#include <yatescript.h>
Public Types | |
| enum | Status { Invalid , Running , Incomplete , Succeeded , Failed } |
Public Member Functions | |
| ScriptRun (ScriptCode *code, ScriptContext *context=0) | |
| virtual | ~ScriptRun () |
| ScriptCode * | code () const |
| ScriptContext * | context () const |
| Status | state () const |
| const char * | textState () const |
| ObjList & | stack () |
| const ObjList & | stack () const |
| ScriptRun * | clone () const |
| virtual Status | reset (bool init=false) |
| virtual Status | execute () |
| virtual Status | run (bool init=true) |
| virtual bool | pause () |
| virtual Status | call (const String &name, ObjList &args, ExpOperation *thisObj=0, ExpOperation *scopeObj=0) |
| virtual bool | callable (const String &name) |
| virtual bool | insertAsync (ScriptAsync *oper) |
| virtual bool | appendAsync (ScriptAsync *oper) |
| virtual unsigned int | currentLineNo () const |
| virtual const String & | currentFileName (bool wholePath=false) const |
| virtual const String & | traceId () const |
| virtual void | setTraceId (const String &tid) |
| bool | runAssign (const ExpOperation &oper, GenObject *context=0) |
| void | objCreated (GenObject *obj) |
| void | objDeleted (GenObject *obj) |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual bool | alive () const |
| virtual void | destruct () |
| virtual const String & | toString () const |
| virtual void * | getObject (const String &name) const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Public Member Functions inherited from ScriptMutex | |
| ScriptMutex (bool recursive, const char *name) | |
| bool | objTrack () const |
Public Member Functions inherited from Mutex | |
| Mutex (bool recursive=false, const char *name=0) | |
| Mutex (const Mutex &original) | |
| ~Mutex () | |
| Mutex & | operator= (const Mutex &original) |
| virtual bool | lock (long maxwait=-1) |
| virtual bool | unlock () |
| virtual bool | locked () const |
| const char * | owner () const |
| bool | recursive () const |
Public Member Functions inherited from Lockable | |
| virtual | ~Lockable () |
| virtual bool | check (long maxwait=-1) |
| virtual bool | unlockAll () |
Static Public Member Functions | |
| static const char * | textState (Status state) |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Static Public Member Functions inherited from Mutex | |
| static int | count () |
| static int | locks () |
| static bool | efficientTimedLock () |
Static Public Member Functions inherited from Lockable | |
| static void | wait (unsigned long maxwait) |
| static unsigned long | wait () |
| static void | startUsingNow () |
| static void | enableSafety (bool safe=true) |
| static bool | safety () |
Protected Member Functions | |
| virtual Status | resume () |
Friends | |
| class | ScriptCode |
Additional Inherited Members | |
Protected Attributes inherited from ScriptMutex | |
| bool | m_objTrack |
Script runtime execution.
An instance of script code and data, status machine run by a single thread at a time
| enum Status |
Runtime states
| ScriptRun | ( | ScriptCode * | code, |
| ScriptContext * | context = 0 ) |
|
virtual |
Destructor, disposes the code and context
|
virtual |
Append an asynchronous operation to be executed
| oper | Operation to be appended, will be owned by the runtime instance |
|
virtual |
Call a script function or method
| name | Name of the function to call |
| args | Values to pass as actual function arguments |
| thisObj | Object to pass as "this" if applicable |
| scopeObj | Optional object to be used for scope resolution inside the call |
|
virtual |
Check if a script has a certain function or method
| name | Name of the function to check |
|
inline |
Create a duplicate of the runtime with its own stack and state
References code(), context(), and ScriptRun().
|
inline |
Retrieve the parsed code being executed
Referenced by clone(), and ScriptRun().
|
inline |
Retrieve the execution context associated with the runtime
Referenced by clone(), runAssign(), and ScriptRun().
|
inlinevirtual |
Retrieve the name of the source file from which code is being executed
| wholePath | Retrieve name including path |
References String::empty().
|
inlinevirtual |
Retrieve current file line being executed
|
virtual |
Execute script from where it was left, may stop and return Incomplete state
|
virtual |
Insert an asynchronous operation to be executed
| oper | Operation to be inserted, will be owned by the runtime instance |
|
inlinevirtual |
Notification that an object was created in context serialized by this mutex
| obj | Created object |
Implements ScriptMutex.
References GenObject::GenObject().
|
inlinevirtual |
Notification that an object was destroyed in context serialized by this mutex
| obj | Destroyed object |
Implements ScriptMutex.
References GenObject::GenObject().
|
virtual |
Pause the script, make it return Incomplete state
|
virtual |
Resets code execution to the beginning, does not clear context
| init | Initialize context |
|
protectedvirtual |
Resume script from where it was left, may stop and return Incomplete state
|
virtual |
Execute script from the beginning until it returns a final state
| init | Initialize context |
| bool runAssign | ( | const ExpOperation & | oper, |
| GenObject * | context = 0 ) |
Try to assign a value to a single field in the script context
| oper | Field to assign to, contains the field name and new value |
| context | Pointer to arbitrary object to be passed to called methods |
References context(), and GenObject::GenObject().
|
inlinevirtual |
Set an associated trace ID for this instance
| tid | Trace ID to associate |
|
inline |
Access the runtime execution stack
|
inline |
Const access the runtime execution stack
|
inline |
Current state of the runtime
Referenced by textState().
|
inline |
Get the text description of the current runtime state
References textState().
|
static |
Get the text description of a runtime state
| state | State to describe |
References state().
Referenced by textState().
|
inlinevirtual |