Falcon::ExtFuncDef Class Reference

Implements an external function definition. More...

#include <symbol.h>

Inheritance diagram for Falcon::ExtFuncDef:

Inheritance graph
[legend]

List of all members.

Public Member Functions

ExtFuncDefaddParam (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
SymbolTableparameters () const
 External Function symbol table.
 ~ExtFuncDef ()


Detailed Description

Implements an external function definition.

Constructor & Destructor Documentation

Falcon::ExtFuncDef::ExtFuncDef ( ext_func_t  func  )  [inline]

Falcon::ExtFuncDef::ExtFuncDef ( ext_func_t  func,
void *  extra 
) [inline]

Crates this definition setting extra data.

See also:
extra()

Falcon::ExtFuncDef::~ExtFuncDef (  ) 


Member Function Documentation

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]

Gets extra data.

See also:
void extra( void *)

ext_func_t Falcon::ExtFuncDef::func (  )  const [inline]

int32 Falcon::ExtFuncDef::getParam ( const String name  ) 

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.


The documentation for this class was generated from the following file:

Generated on Mon Oct 19 10:11:34 2009 for Falcon_Core by  doxygen 1.5.8