#include <vm.hpp>
Public Member Functions | |
| VM () | |
| ~VM () | |
| Module * | loadModule (const char *filename) |
| Adds a module and generates bytecode from the source. | |
| Module * | loadBytecode (const char *filename) |
| Loads previously generated bytecode. UNIMPLEMENTED. | |
| FuncPtr | getFunction (const char *name) |
| Returns a pointer to a script function. | |
| void | registerFunction (std::string name, void *addr, TypeInfo rettype=TypeInfo(ETC_None), std::vector< TypeInfo > arguments=std::vector< TypeInfo >()) |
| Registers an external function. | |
| void | registerStruct (std::string name, StructInfo info) |
| Registers an external struct. | |
| void | registerBaseFunctions (void) |
| ps_vm_t * | getVM (void) |
| Returns the vm struct. | |
Static Public Member Functions | |
| static void | setLoggingOutput (const char *filename) |
| Sets output for debug messages. | |
The machine manages modules and external functions and types.
| ps::VM::VM | ( | ) |
| ps::VM::~VM | ( | ) |
| Module* ps::VM::loadModule | ( | const char * | filename | ) |
Adds a module and generates bytecode from the source.
| filename | Name of the file to read the module from |
| Module* ps::VM::loadBytecode | ( | const char * | filename | ) |
Loads previously generated bytecode. UNIMPLEMENTED.
| filename | Name of the file to read the module from |
| FuncPtr ps::VM::getFunction | ( | const char * | name | ) |
Returns a pointer to a script function.
The pointer does not point to the function itself but to a stub function which if needed compiles the function.
| void ps::VM::registerFunction | ( | std::string | name, | |
| void * | addr, | |||
| TypeInfo | rettype = TypeInfo(ETC_None), |
|||
| std::vector< TypeInfo > | arguments = std::vector< TypeInfo >() | |||
| ) |
Registers an external function.
The function can be used by scripts afterwards. Functions must be registered before compiling scripts which might need them.
| void ps::VM::registerStruct | ( | std::string | name, | |
| StructInfo | info | |||
| ) |
Registers an external struct.
The struct can be used by scripts afterwards. Structs must be registered before compiling scripts which might need them.
| void ps::VM::registerBaseFunctions | ( | void | ) |
| static void ps::VM::setLoggingOutput | ( | const char * | filename | ) | [static] |
Sets output for debug messages.
If filename is 0 then stdout is used instead.
| filename | File to write messages to |
| ps_vm_t* ps::VM::getVM | ( | void | ) |
Returns the vm struct.
1.5.3