Represents a Sheep Virtual Machine which executes compiled Sheep scripts.
More...
#include <sheepcpp.h>
Represents a Sheep Virtual Machine which executes compiled Sheep scripts.
virtual int Sheep::IVirtualMachine::PrepareScriptForExecution |
( |
IScript * |
script, |
|
|
const char * |
function, |
|
|
IExecutionContext ** |
context |
|
) |
| |
|
pure virtual |
virtual void Sheep::IVirtualMachine::Release |
( |
| ) |
|
|
pure virtual |
Releases the Virtual Machine, decreasing its reference count by 1.
Once the reference count reaches 0, the Virtual Machine and any IExecutionContexts that belong to it are destroyed. Be very careful when accessing IExecutionContext after the parent IVirtualMachine has been released. If you don't know what you're doing you could easily cause a crash.
virtual int Sheep::IVirtualMachine::SetEndWaitCallback |
( |
EndWaitCallback |
callback | ) |
|
|
pure virtual |
Sets the callback that will be called whenever Sheep encounters the end of a wait section
Generally, what you should do is check to see if there are any import functions still executing that were called within this wait section. If so, suspend the context and wait until everything has finished, then call Execute() to resume.
- Parameters
-
callback | The callback to call when the end of a wait section is encountered (can be null, though this is not recommended) |
- Returns
- SHEEP_SUCCESS if successful
virtual int Sheep::IVirtualMachine::SetImportCallback |
( |
const char * |
importName, |
|
|
ImportCallback |
callback |
|
) |
| |
|
pure virtual |
Sets the callback for an import function.
Sheep will call the specified callback whenever it encounters the given import function.
- Parameters
-
importName | The name of the import |
callback | A pointer to a function handler that will be called when a script calls the import function (can be null, though this is not recommended) |
- Returns
- SHEEP_SUCCESS if successful, SHEEP_ERR_INVALID_ARGUMENT if importName is null
virtual void Sheep::IVirtualMachine::SetTag |
( |
void * |
tag | ) |
|
|
pure virtual |
Sets a "tag," which is just a pointer to whatever you want. The Virtual Machine doesn't use it. It's just for convenience.
The documentation for this class was generated from the following file: