#include <vm.h>
Public Member Functions | |
VM () | |
InterpretResult | Interpret (const char *source) |
InterpretResult | Interpret (Chunk *chunk) |
void | SetChunk (const Chunk *_chunk) |
InterpretResult | Run (Value *ret=NULL) |
template<typename TObj > | |
void | AddGlobal (const char *name, const TObj *object) |
void | AddGlobal (const char *name) |
template<> | |
void | AddGlobal (const char *name, const int *obj) |
template<> | |
void | AddGlobal (const char *name, const unsigned *obj) |
template<> | |
void | AddGlobal (const char *name, const float *obj) |
template<> | |
void | AddGlobal (const char *name, const double *obj) |
template<> | |
void | AddGlobal (const char *name, const bool *obj) |
Private Member Functions | |
uint8_t | ReadInstruction () |
Value | ReadConstant () |
Value | Peek (unsigned distance=0) |
Value | Pop () |
void | Push (Value v) |
void | Reset () |
void | RuntimeError (const char *format,...) |
bool | CallValue (Value callee, int argCount) |
bool | IndexValue (Value callee, int index) |
bool | AccessValue (Value instance, const char *name, Value *result) |
bool | GetTField (ObjTInstance instance, const char *name, Value *ret) |
Value | GetTValue (uint8_t *loc, TData data) |
void | DoAddGlobal (const char *classname, const char *name, uint8_t *data) |
Private Attributes | |
const Chunk * | chunk |
unsigned | ip |
std::vector< Value > | stack |
std::map< const char *, Value > | globals |
uscript::VM::VM | ( | ) |
Definition at line 362 of file vm.cc.
|
inline |
void uscript::VM::AddGlobal | ( | const char * | name | ) |
Definition at line 449 of file vm.cc.
void uscript::VM::AddGlobal | ( | const char * | name, |
const int * | obj | ||
) |
Definition at line 420 of file vm.cc.
void uscript::VM::AddGlobal | ( | const char * | name, |
const unsigned * | obj | ||
) |
Definition at line 426 of file vm.cc.
void uscript::VM::AddGlobal | ( | const char * | name, |
const float * | obj | ||
) |
Definition at line 432 of file vm.cc.
void uscript::VM::AddGlobal | ( | const char * | name, |
const double * | obj | ||
) |
Definition at line 438 of file vm.cc.
void uscript::VM::AddGlobal | ( | const char * | name, |
const bool * | obj | ||
) |
Definition at line 444 of file vm.cc.
|
private |
|
private |
Definition at line 396 of file vm.cc.
|
private |
Definition at line 378 of file vm.cc.
|
private |
Definition at line 309 of file vm.cc.
|
private |
Definition at line 285 of file vm.cc.
uscript::InterpretResult uscript::VM::Interpret | ( | const char * | source | ) |
Definition at line 14 of file vm.cc.
uscript::InterpretResult uscript::VM::Interpret | ( | Chunk * | chunk | ) |
|
inlineprivate |
Definition at line 28 of file vm.h.
|
inlineprivate |
|
private |
|
private |
uscript::InterpretResult uscript::VM::Run | ( | Value * | ret = NULL | ) |
Definition at line 65 of file vm.cc.
|
private |
Definition at line 409 of file vm.cc.