names.hh File Reference

Interface for names management. More...

#include "tlib.hh"
#include "propagate.hh"
#include <string>
Include dependency graph for names.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool getDefNameProperty (Tree t, Tree &id)
 Indicates the identifier (if any) the expression was a definition of.
void setSigListNickName (Tree lsig, const string &nickname)
 set the nickname property of a list of signals.
void setSigNickname (Tree t, const string &id)
 Set the nickname property of a signal.
bool getSigNickname (Tree t, Tree &id)
 Get the nickname property of a signal.
bool searchIdDef (Tree id, Tree &def, Tree lenv)
 Search the environment for the definition of a symbol ID and return it.
Tree pushValueDef (Tree id, Tree def, Tree lenv)
 Push a new layer and add a single definition.
Tree simplifyPattern (Tree pattern)
 Simplify a block-diagram pattern by computing its numerical sub-expressions.

Detailed Description

Interface for names management.

Definition in file names.hh.


Function Documentation

bool getDefNameProperty ( Tree  t,
Tree id 
)

Indicates the identifier (if any) the expression was a definition of.

Parameters:
t the expression
id reference to the identifier
Returns:
true if the expression t was a definition of id

Definition at line 85 of file names.cpp.

00086 {
00087     //cerr << "getDefNameProperty of : " << t << endl;
00088     return getProperty(t, DEFNAMEPROPERTY, id);
00089 }

Tree pushValueDef ( Tree  id,
Tree  def,
Tree  lenv 
)

Push a new layer and add a single definition.

Parameters:
id the symbol id to be defined
def the definition to be binded to the symbol id
lenv the environment where to push the layer and add the definition
Returns:
the new environment

Definition at line 1189 of file eval.cpp.

01190 {
01191     Tree lenv2 = pushNewLayer(lenv);
01192     addLayerDef(id, def, lenv2);
01193     return lenv2;
01194 }

bool searchIdDef ( Tree  id,
Tree def,
Tree  lenv 
)

Search the environment for the definition of a symbol ID and return it.

Parameters:
id the symbol ID to search
def where to store the definition if any
lenv the environment
Returns:
true if a definition was found

Definition at line 1229 of file eval.cpp.

References CTree::branch().

01230 {
01231     // search the environment until a definition is found
01232     // or nil (the empty environment) is reached
01233     while (!isNil(lenv) && !getProperty(lenv, id, def)) {
01234         lenv = lenv->branch(0);
01235     }
01236     return !isNil(lenv);
01237 }

Here is the call graph for this function:

void setSigListNickName ( Tree  lsig,
const string &  nickname 
)

set the nickname property of a list of signals.

If the list contains more than one signal, adds an index to the nickname

Definition at line 134 of file names.cpp.

00135 {
00136     assert(isList(lsig));
00137     
00138     if (isNil(tl(lsig))) {
00139         setSigNickname(hd(lsig), nickname);
00140     } else {
00141         int     i=0;
00142         while (!isNil(lsig)) {
00143             setSigNickname(hd(lsig), subst("$0_$1", nickname, T(++i)));
00144             lsig = tl(lsig);
00145         }
00146     }
00147 }

Tree simplifyPattern ( Tree  value  ) 

Simplify a block-diagram pattern by computing its numerical sub-expressions.

Parameters:
pattern an evaluated block-diagram
Returns:
a simplified pattern

Definition at line 605 of file eval.cpp.

00606 {
00607     Tree num;
00608     if (!getNumericProperty(value,num)) {
00609         if (!isBoxNumeric(value,num)) {
00610             num = value;
00611         }
00612         setNumericProperty(value,num);
00613     }
00614     return num;
00615 }


Generated on 31 Mar 2010 for FAUST compiler by  doxygen 1.6.1