#include <vm.h>
Public Member Functions | |
MAXON_METHOD Result< void > | Init (const String &identifier, const String &code, ERRORHANDLING errorHandling, const VmDebuggerConnectionRef *debug=nullptr) |
MAXON_METHOD Result< void > | Add (const String &name, const Data &data) |
MAXON_METHOD Result< Data > | Get (const String &name) |
MAXON_METHOD Result< void > | Execute () |
MAXON_METHOD Result< Data * > | PrivateInvoke (const String &name, BlockArray< Data > &helperStack, const DataType &expected=DataType::DefaultValue(), const Block< Data * > *arguments=nullptr) |
MAXON_METHOD Result< void > | ErrorHandling () |
MAXON_METHOD Result< void > | _PrivateInit (const LibraryRef &lib) |
Private Member Functions | |
MAXON_INTERFACE (VirtualMachineScopeInterface, MAXON_REFERENCE_NORMAL, "net.maxon.python.interface.virtualmachinescope") | |
|
private |
MAXON_METHOD Result<void> Init | ( | const String & | identifier, |
const String & | code, | ||
ERRORHANDLING | errorHandling, | ||
const VmDebuggerConnectionRef * | debug = nullptr |
||
) |
Initialized the virtual machine scope. Needs to be executed before any other function of the interface is used.
[in] | identifier | Human readable unique identifier. Depending on the engine, some exception handlers might print this into their exception to make it easier to understand where the exception comes from. |
[in] | code | Code to be executed. |
[in] | errorHandling | Adjust how the virtual machine should treat an exception. |
[in] | debug | Optional virtual machine debugger connection, to debug the code. |
MAXON_METHOD Result<void> Add | ( | const String & | name, |
const Data & | data | ||
) |
Add an object to the scope. The Data object will be converted through the underlying library implementation. So the Data object must be representable in the target virtual machine.
[in] | name | Variable name of the object in the scope. |
[in] | data | Object that will be added to the scope. |
MAXON_METHOD Result<Data> Get | ( | const String & | name | ) |
Returns an object from the scope.
[in] | name | Variable name of the object in the scope. |
MAXON_METHOD Result<void> Execute | ( | ) |
Execute the virtual machine scope. Before, and after executing the code, the optionally given debugger code from the VmDebuggerConnection will be executed.
MAXON_METHOD Result<Data*> PrivateInvoke | ( | const String & | name, |
BlockArray< Data > & | helperStack, | ||
const DataType & | expected = DataType::DefaultValue() , |
||
const Block< Data * > * | arguments = nullptr |
||
) |
Executes a callable object from the scope. Must only be called after VirtualMachineScopeInterface.Execute.
[in] | name | Name of the callable object, e.g a function name |
[in] | helperStack | A temporary helper stack for the return value. |
[in] | expected | (Optional) Datatype of the returned object, otherwise the type of the object will be chosen automatically. |
[in] | arguments | (Optional) Arguments which will be passed to the callable object. |
MAXON_METHOD Result<void> ErrorHandling | ( | ) |
Normally to reset the error state of the internal virtual machine. E.g. In Python PyErr_Print is executed. Normally used after VirtualMachineScopeInterface.Execute or VirtualMachineScopeInterface.PrivateInvoke failed, but only if scope is initialized with ERRORHANDLING.REDIRECT.
MAXON_METHOD Result<void> _PrivateInit | ( | const LibraryRef & | lib | ) |
Private.