ps::VM Class Reference

Central class for a PlusScript virtual machine. More...

#include <vm.hpp>

List of all members.

Public Member Functions

 VM ()
 ~VM ()
ModuleloadModule (const char *filename)
 Adds a module and generates bytecode from the source.
ModuleloadBytecode (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.


Detailed Description

Central class for a PlusScript virtual machine.

The machine manages modules and external functions and types.


Constructor & Destructor Documentation

ps::VM::VM (  ) 

ps::VM::~VM (  ) 


Member Function Documentation

Module* ps::VM::loadModule ( const char *  filename  ) 

Adds a module and generates bytecode from the source.

Parameters:
filename Name of the file to read the module from

Module* ps::VM::loadBytecode ( const char *  filename  ) 

Loads previously generated bytecode. UNIMPLEMENTED.

Parameters:
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.

Parameters:
filename File to write messages to

ps_vm_t* ps::VM::getVM ( void   ) 

Returns the vm struct.


The documentation for this class was generated from the following file:
Generated on Sun Feb 3 21:38:49 2008 for libplusscript++ by  doxygen 1.5.3