Falcon::FuncDef Class Reference

Implements a callable symbol. More...

#include <symbol.h>

Inheritance diagram for Falcon::FuncDef:

Inheritance graph

List of all members.

Public Types

enum  { NO_STATE = 0xFFFFFFFF }

Public Member Functions

void addAttrib (const String &name, VarDef *value)
 Adds an attribute.
SymboladdLocal (Symbol *sym)
SymboladdParameter (Symbol *sym)
SymboladdUndefined (Symbol *sym)
AttribMapattributes () const
 Returns a map of String& -> VarDef* containing metadata about this symbol.
uint32 basePC () const
 BasePC at which this symbol was declared.
void basePC (uint32 pc)
void code (byte *b)
bytecode () const
void codeSize (uint32 p)
uint32 codeSize () const
 FuncDef (byte *code, uint32 codeSize)
 Constructor for external generators.
bool load (Module *mod, Stream *in)
void locals (uint16 l)
uint16 locals () const
uint32 onceItemId () const
void onceItemId (uint32 id)
void params (uint16 p)
uint16 params () const
void recount ()
 Counts the parameters and the local variables that this funcdef has in its symtab.
bool save (Stream *out) const
SymbolTablesymtab ()
const SymbolTablesymtab () const
void undefined (uint16 u)
uint16 undefined () const
 ~FuncDef ()

Public Attributes

enum Falcon::FuncDef:: { ... }  enum_NO_STATE

Detailed Description

Implements a callable symbol.

A callable symbol has many more fields to keep track of. It has a back-pointer to the owning module, because the module contains the bytecode where data is held. It has also a symbol table pointer holding variable only symbols in it.

Member Enumeration Documentation

anonymous enum


Constructor & Destructor Documentation

Falcon::FuncDef::FuncDef ( byte code,
uint32  codeSize 

Constructor for external generators.

Requires that the funcdef is provided with a previously allocated code. The code is owned by the FuncDef and destroyed with this instance.

Falcon::FuncDef::~FuncDef (  ) 

Member Function Documentation

void Falcon::FuncDef::addAttrib ( const String name,
VarDef value 

Adds an attribute.

The first attribute added will cause the map to be created.

Symbol* Falcon::FuncDef::addLocal ( Symbol sym  ) 

Symbol* Falcon::FuncDef::addParameter ( Symbol sym  ) 

Symbol* Falcon::FuncDef::addUndefined ( Symbol sym  ) 

AttribMap* Falcon::FuncDef::attributes (  )  const [inline]

Returns a map of String& -> VarDef* containing metadata about this symbol.

May return if the item has no attributes.

uint32 Falcon::FuncDef::basePC (  )  const [inline]

BasePC at which this symbol was declared.

This is useful only to find lines in the code of this function in the global line table.

The line that generated a certain function is found through basepc + VM->pc.

void Falcon::FuncDef::basePC ( uint32  pc  )  [inline]

void Falcon::FuncDef::code ( byte b  )  [inline]

byte* Falcon::FuncDef::code (  )  const [inline]

void Falcon::FuncDef::codeSize ( uint32  p  )  [inline]

uint32 Falcon::FuncDef::codeSize (  )  const [inline]

bool Falcon::FuncDef::load ( Module mod,
Stream in 

Reimplemented in Falcon::ClassDef.

void Falcon::FuncDef::locals ( uint16  l  )  [inline]

uint16 Falcon::FuncDef::locals (  )  const [inline]

uint32 Falcon::FuncDef::onceItemId (  )  const [inline]

void Falcon::FuncDef::onceItemId ( uint32  id  )  [inline]

void Falcon::FuncDef::params ( uint16  p  )  [inline]

uint16 Falcon::FuncDef::params (  )  const [inline]

void Falcon::FuncDef::recount (  ) 

Counts the parameters and the local variables that this funcdef has in its symtab.

Useful when the function object is created by the compiler, that won't use addParameter() and addLocal(). Those two metods are for API implementors and extensions, while the compiler has to add symbols to the function symbol table; for this reason, at the end of the function the compiler calls this method to cache the count of locals and parameters that the linker must create.

bool Falcon::FuncDef::save ( Stream out  )  const

Reimplemented in Falcon::ClassDef.

SymbolTable& Falcon::FuncDef::symtab (  )  [inline]

const SymbolTable& Falcon::FuncDef::symtab (  )  const [inline]

void Falcon::FuncDef::undefined ( uint16  u  )  [inline]

uint16 Falcon::FuncDef::undefined (  )  const [inline]

Member Data Documentation

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

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