Falcon::Symbol Class Reference

Representation of a VM symbol For now, it is only an accessible strucutre. More...

#include <symbol.h>

Inheritance diagram for Falcon::Symbol:

Inheritance graph
[legend]

List of all members.

Public Types


Public Member Functions

SymboladdParam (const String &param)
 Candy grammar to add a parameter to a function (internal or external).
int32 declaredAt () const
void declaredAt (int32 line)
bool exported () const
Symbolexported (bool exp)
 Sets the symbol export class.
bool fromClass (const String &find_name) const
 If the symbol is a class, check if this class is the named one or derived from the named one.
ClassDefgetClassDef () const
ExtFuncDefgetExtFuncDef () const
FuncDefgetFuncDef () const
ImportAliasgetImportAlias () const
SymbolgetInstance () const
uint16 getItemId () const
VarDefgetVarDef () const
uint32 id () const
void id (uint32 i)
 Changes the symbol id.
bool imported () const
Symbolimported (bool exp)
 Sets the symbol import class.
bool isCallable () const
bool isClass () const
bool isConst () const
bool isEnum () const
bool isEta () const
bool isExtFunc () const
bool isFunction () const
bool isGlobal () const
bool isImportAlias () const
bool isInstance () const
bool isLocal () const
bool isLocalUndef () const
bool isParam () const
bool isProp () const
bool isUndefined () const
bool isVar () const
bool isWKS () const
void itemId (uint16 ip)
uint16 itemId () const
bool load (Stream *in)
void module (Module *mod)
const Modulemodule () const
 Returns the module associated with a symbol.
const Stringname () const
void name (const String *name)
 Changes the symbol name.
bool save (Stream *out) const
void setClass (ClassDef *f)
void setConst (VarDef *p)
SymbolsetEnum (bool exp)
 Declares the symbol as an "enum class".
SymbolsetEta (bool exp)
 Declares the symbol as an "eta function".
void setExtFunc (ExtFuncDef *f)
void setFunction (FuncDef *func)
void setGlobal ()
void setImportAlias (const String *name, const String *origModule, bool bIsFileName=false)
void setImportAlias (ImportAlias *alias)
void setInstance (Symbol *base_class)
void setLocal ()
void setLocalUndef ()
void setParam ()
void setProp (VarDef *p)
void setUndefined ()
void setVar (VarDef *p)
SymbolsetWKS (bool exp)
 Declares the symbol as an "well known symbol".
 Symbol (Module *owner)
 Basic empty constructor.
 Symbol (Module *mod, const String *name)
 Builds a symbol without ID and export class.
 Symbol (Module *mod, uint32 id, const String *name, bool exp)
 Convenience constructor.
type_t type () const
 ~Symbol ()


Detailed Description

Representation of a VM symbol For now, it is only an accessible strucutre.

As symbol names are allocated in the symbol table part of the module, they are currently not deleted at item destruction. Symbol names must be allocated in the module symbol table.


Member Enumeration Documentation

Enumerator:
tundef 
tglobal 
tlocal 
tparam 
tlocalundef 
tfunc 
textfunc 
tclass 
tprop 
tvar 
tinst 
tconst 
timportalias 


Constructor & Destructor Documentation

Falcon::Symbol::Symbol ( Module mod,
uint32  id,
const String name,
bool  exp 
) [inline]

Convenience constructor.

This creates the symbol with minimal setup

Parameters:
mod the owner module
id the id of the symbol in the module
name the name of the symbol
exp true if this symbol is exported.

Falcon::Symbol::Symbol ( Module mod,
const String name 
) [inline]

Builds a symbol without ID and export class.

The symbol is by default not exported, and it's id is left to a non-meaningful value. This constructor is meant to be used only on symbols that are going to be added somehow to a module soon after.

The type of the symbol is Symbol::tundef.

Parameters:
mod the owner module
name a String that has been created and stored somewhere safe (i.e. module string table).

Falcon::Symbol::Symbol ( Module owner  )  [inline]

Basic empty constructor.

This is mainly used for de-serialization to prepare the symbols before it can be de-serialized.

Parameters:
owner the module that is owning this symbol
Note:
by default, the symbol is not exported.

Falcon::Symbol::~Symbol (  )  [inline]


Member Function Documentation

Symbol* Falcon::Symbol::addParam ( const String param  ) 

Candy grammar to add a parameter to a function (internal or external).

int32 Falcon::Symbol::declaredAt (  )  const [inline]

void Falcon::Symbol::declaredAt ( int32  line  )  [inline]

bool Falcon::Symbol::exported (  )  const [inline]

Symbol* Falcon::Symbol::exported ( bool  exp  )  [inline]

Sets the symbol export class.

Parameters:
exp true if the symbol must be exported, false otherwise.
Returns:
itself

bool Falcon::Symbol::fromClass ( const String find_name  )  const

If the symbol is a class, check if this class is the named one or derived from the named one.

If the name passed as parameters is the name of this class or one of its ancestor names, the function returns true.

Parameters:
find_name The class name.

ClassDef* Falcon::Symbol::getClassDef (  )  const [inline]

ExtFuncDef* Falcon::Symbol::getExtFuncDef (  )  const [inline]

FuncDef* Falcon::Symbol::getFuncDef (  )  const [inline]

ImportAlias* Falcon::Symbol::getImportAlias (  )  const [inline]

Symbol* Falcon::Symbol::getInstance (  )  const [inline]

References v_symbol.

uint16 Falcon::Symbol::getItemId (  )  const [inline]

VarDef* Falcon::Symbol::getVarDef (  )  const [inline]

uint32 Falcon::Symbol::id (  )  const [inline]

void Falcon::Symbol::id ( uint32  i  )  [inline]

Changes the symbol id.

Parameters:
i the new id.

bool Falcon::Symbol::imported (  )  const [inline]

Symbol* Falcon::Symbol::imported ( bool  exp  )  [inline]

Sets the symbol import class.

Import class is prioritary to export class; that is, if a symbol is imported, exported() will always return false. Also, imported symbols report their type as unknonw, no matter what local setting is provided.

Parameters:
exp true if the symbol must be imported, false otherwise.
Returns:
itself

bool Falcon::Symbol::isCallable (  )  const [inline]

bool Falcon::Symbol::isClass (  )  const [inline]

bool Falcon::Symbol::isConst (  )  const [inline]

bool Falcon::Symbol::isEnum (  )  const [inline]

bool Falcon::Symbol::isEta (  )  const [inline]

bool Falcon::Symbol::isExtFunc (  )  const [inline]

bool Falcon::Symbol::isFunction (  )  const [inline]

bool Falcon::Symbol::isGlobal (  )  const [inline]

bool Falcon::Symbol::isImportAlias (  )  const [inline]

bool Falcon::Symbol::isInstance (  )  const [inline]

bool Falcon::Symbol::isLocal (  )  const [inline]

bool Falcon::Symbol::isLocalUndef (  )  const [inline]

bool Falcon::Symbol::isParam (  )  const [inline]

bool Falcon::Symbol::isProp (  )  const [inline]

bool Falcon::Symbol::isUndefined (  )  const [inline]

bool Falcon::Symbol::isVar (  )  const [inline]

bool Falcon::Symbol::isWKS (  )  const [inline]

void Falcon::Symbol::itemId ( uint16  ip  )  [inline]

uint16 Falcon::Symbol::itemId (  )  const [inline]

bool Falcon::Symbol::load ( Stream in  ) 

void Falcon::Symbol::module ( Module mod  )  [inline]

const Module* Falcon::Symbol::module (  )  const [inline]

Returns the module associated with a symbol.

Returns:
the owner module or zero if the information is not available.

const String& Falcon::Symbol::name (  )  const [inline]

void Falcon::Symbol::name ( const String name  )  [inline]

Changes the symbol name.

Symbol names are never destroyed, so the old name is not de-allocated. If necessary, the application must keep track of that.

Parameters:
name The new name.

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

void Falcon::Symbol::setClass ( ClassDef f  )  [inline]

void Falcon::Symbol::setConst ( VarDef p  )  [inline]

Symbol* Falcon::Symbol::setEnum ( bool  exp  )  [inline]

Declares the symbol as an "enum class".

Enum classes are classes that only store constant values, or serve otherwise as namespaces. They cannot be instantiated.

Parameters:
exp true if the symbol is an enumeration.
Returns:
itself

Symbol* Falcon::Symbol::setEta ( bool  exp  )  [inline]

Declares the symbol as an "eta function".

Eta functions are self-managed functions in Sigma-evaluation (functional evaluation).

Parameters:
exp true if the symbol is an ETA function, false otherwise.
Returns:
itself

void Falcon::Symbol::setExtFunc ( ExtFuncDef f  )  [inline]

void Falcon::Symbol::setFunction ( FuncDef func  )  [inline]

void Falcon::Symbol::setGlobal (  )  [inline]

void Falcon::Symbol::setImportAlias ( const String name,
const String origModule,
bool  bIsFileName = false 
) [inline]

void Falcon::Symbol::setImportAlias ( ImportAlias alias  )  [inline]

void Falcon::Symbol::setInstance ( Symbol base_class  )  [inline]

void Falcon::Symbol::setLocal (  )  [inline]

void Falcon::Symbol::setLocalUndef (  )  [inline]

void Falcon::Symbol::setParam (  )  [inline]

void Falcon::Symbol::setProp ( VarDef p  )  [inline]

void Falcon::Symbol::setUndefined (  )  [inline]

void Falcon::Symbol::setVar ( VarDef p  )  [inline]

Symbol* Falcon::Symbol::setWKS ( bool  exp  )  [inline]

Declares the symbol as an "well known symbol".

Normal symbols are generated in a module, and eventually exported to the global namespace of the VM. Well known symbols live in a special space in the VM; they are always referenced and the module declaring them receives a copy of the original item, but not the original one.

Modules can i.e. change objects and can alter functions, but a copy of the original well knonw items is kept by the VM and is available to C++ extensions.

Well known items are meant to provide language-oriented special features, or to provide special hooks for modules. Error, TimeStamp and other language relevant classes are WKS (well known symbol). Modules can declare new well known symbol to i.e. declare new classes and provide C++ factory functions.

Parameters:
exp true if the symbol is a Well Known Symbol.
Returns:
itself

type_t Falcon::Symbol::type (  )  const [inline]


Member Data Documentation

Referenced by getInstance().


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

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