|
|
An instance of script code and data, status machine run by a single thread at a time
enum Status { Invalid, Running, Incomplete, Succeeded, Failed, } | Status |
Runtime states
ScriptRun (ScriptCode* code, ScriptContext* context = 0)
| ScriptRun |
Constructor
Parameters:
code | Code fragment to execute |
context | Script context, an empty one will be allocated if NULL |
~ScriptRun ()
| ~ScriptRun |
[virtual]
Destructor, disposes the code and context
inline ScriptCode* code ()
| code |
[const]
Retrieve the parsed code being executed
Returns: Pointer to ScriptCode object
inline ScriptContext* context ()
| context |
[const]
Retrieve the execution context associated with the runtime
Returns: Pointer to ScriptContext object
inline Status state ()
| state |
[const]
Current state of the runtime
const char* textState (Status state)
| textState |
[static]
Get the text description of a runtime state
Parameters:
state | State to describe |
Returns: Description of the runtime state
inline const char* textState ()
| textState |
[const]
Get the text description of the current runtime state
Returns: Description of the runtime state
inline ObjList& stack ()
| stack |
Access the runtime execution stack
Returns: The internal execution stack
inline const ObjList& stack ()
| stack |
[const]
Const access the runtime execution stack
Returns: The internal execution stack
inline ScriptRun* clone ()
| clone |
[const]
Create a duplicate of the runtime with its own stack and state
Returns: New clone of the runtime
Status reset (bool init = false)
| reset |
[virtual]
Resets code execution to the beginning, does not clear context
Parameters:
init | Initialize context |
Returns: Status of the runtime after reset
Status execute ()
| execute |
[virtual]
Execute script from where it was left, may stop and return Incomplete state
Returns: Status of the runtime after code execution
Status run (bool init = true)
| run |
[virtual]
Execute script from the beginning until it returns a final state
Parameters:
init | Initialize context |
Returns: Final status of the runtime after code execution
bool pause ()
| pause |
[virtual]
Pause the script, make it return Incomplete state
Returns: True if pausing the script succeeded or was already paused
Status call (const String& name, ObjList& args,
ExpOperation* thisObj = 0, ExpOperation* scopeObj = 0)
| call |
[virtual]
Call a script function or method
Parameters:
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 |
Returns: Final status of the runtime after function call
bool callable (const String& name)
| callable |
[virtual]
Check if a script has a certain function or method
Parameters:
name | Name of the function to check |
Returns: True if function exists in code
bool insertAsync (ScriptAsync* oper)
| insertAsync |
[virtual]
Insert an asynchronous operation to be executed
Parameters:
oper | Operation to be inserted, will be owned by the runtime instance |
Returns: True if the operation was added
bool appendAsync (ScriptAsync* oper)
| appendAsync |
[virtual]
Append an asynchronous operation to be executed
Parameters:
oper | Operation to be appended, will be owned by the runtime instance |
Returns: True if the operation was added
bool runAssign (const ExpOperation& oper, GenObject* context = 0)
| runAssign |
Try to assign a value to a single field in the script context
Parameters:
oper | Field to assign to, contains the field name and new value |
context | Pointer to arbitrary object to be passed to called methods |
Returns: True if assignment succeeded
Status resume ()
| resume |
[protected virtual]
Resume script from where it was left, may stop and return Incomplete state
Returns: Status of the runtime after code execution
Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54. |