VirtualMachineScopeInterface Class Reference

#include <vm.h>

Inheritance diagram for VirtualMachineScopeInterface:

公共成员函数

MAXON_METHOD Result < void >  Init (const String &identifier, const String &code, ERRORHANDLING errorHandling, const VmDebuggerConnectionRef *debug=nullptr)
MAXON_METHOD Result < void >  添加 (const String &name, const 数据 &data)
MAXON_METHOD Result < 数据 Get (const String &name)
MAXON_METHOD Result < void >  Execute ()
MAXON_METHOD Result < 数据 * >  PrivateInvoke (const String &name, BlockArray < 数据 > &helperStack, const DataType &expected= DataType::NullValue (), const Block < 数据 * > *arguments=nullptr)
MAXON_METHOD Result < void >  ErrorHandling ()
MAXON_METHOD Result < void >  _PrivateInit (const LibraryRef &lib)

私有成员函数

  MAXON_INTERFACE ( VirtualMachineScopeInterface , MAXON_REFERENCE_NORMAL , "net.maxon.python.interface.virtualmachinescope")

成员函数文档编制

◆  MAXON_INTERFACE()

MAXON_INTERFACE ( VirtualMachineScopeInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.python.interface.virtualmachinescope"   
)
private

◆  Init()

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.

◆  Add()

MAXON_METHOD Result <void> Add ( const String name ,
const 数据 data  
)

Add an object to the scope. The 数据 object will be converted through the underlying library implementation. So the 数据 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.
返回
Return state, depending on VirtualMachineScopeInterface::Init(errorHandling).

◆  Get()

MAXON_METHOD Result < 数据 > Get ( const String name )

Returns an object from the scope.

参数
[in] name Variable name of the object in the scope.
返回
Requested object or error.

◆  Execute()

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.

返回
Return state, depending on VirtualMachineScopeInterface::Init(errorHandling).

◆  PrivateInvoke()

MAXON_METHOD Result < 数据 *> PrivateInvoke ( const String name ,
BlockArray < 数据 > &  helperStack ,
const DataType expected = DataType::NullValue() ,
const Block < 数据 * > *  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.

◆  ErrorHandling()

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 .

返回
OK if the error was handled, otherwise an exception is returned.

◆  _PrivateInit()

MAXON_METHOD Result <void> _PrivateInit ( const LibraryRef &  lib )

Private.