#include <symbol.h>
Public Member Functions | |
ExtFuncDef & | addParam (Symbol *param, int32 id=-1) |
Adds a function parameter with the specified ID. | |
void | call (VMachine *vm) const |
Call this function. | |
ExtFuncDef (ext_func_t func, void *extra) | |
Crates this definition setting extra data. | |
ExtFuncDef (ext_func_t func) | |
void | extra (void *e) |
Sets extra data for this function call. | |
void * | extra () const |
Gets extra data. | |
ext_func_t | func () const |
int32 | getParam (const String &name) |
Returns the ID of the given function parameter, or -1 if the parameter doesn't exist. | |
void | operator() (VMachine *vm) const |
Call this function. | |
uint32 | paramCount () const |
SymbolTable * | parameters () const |
External Function symbol table. | |
~ExtFuncDef () |
Falcon::ExtFuncDef::ExtFuncDef | ( | ext_func_t | func | ) | [inline] |
Falcon::ExtFuncDef::ExtFuncDef | ( | ext_func_t | func, | |
void * | extra | |||
) | [inline] |
Falcon::ExtFuncDef::~ExtFuncDef | ( | ) |
ExtFuncDef& Falcon::ExtFuncDef::addParam | ( | Symbol * | param, | |
int32 | id = -1 | |||
) |
Adds a function parameter with the specified ID.
Consider using Symbol::addParam() instead (candy grammar).
void Falcon::ExtFuncDef::call | ( | VMachine * | vm | ) | const [inline] |
Call this function.
Will crash if function is not an external function.
void Falcon::ExtFuncDef::extra | ( | void * | e | ) | [inline] |
Sets extra data for this function call.
This extra data is useful to create flexible reflected calls. The ext_func_t gets called with the VM data; it can then decode the VM data and prepare it accordingly to m_extra, and finally call some different function as retreived data instructs to do. This allows to reuse a single ext_func_t in m_func to call different binding function.
This item doesn't own m_extra; the data must be held in the same module in which this function exists (or in the application where this module is run), and must stay valid for all the time this function stays valid.
Extra data will be available to m_func through VMachine::symbol(), which will return the symbol containing this funcdef.
void* Falcon::ExtFuncDef::extra | ( | ) | const [inline] |
ext_func_t Falcon::ExtFuncDef::func | ( | ) | const [inline] |
Returns the ID of the given function parameter, or -1 if the parameter doesn't exist.
void Falcon::ExtFuncDef::operator() | ( | VMachine * | vm | ) | const [inline] |
Call this function.
uint32 Falcon::ExtFuncDef::paramCount | ( | ) | const [inline] |
SymbolTable* Falcon::ExtFuncDef::parameters | ( | ) | const [inline] |
External Function symbol table.
Not all the external functions need to be provided with a symbol table (actually storing only formal parameters). For this reason, the symbol table of external functions gets allocated only when actually adding parameters.