FAUST compiler  0.9.9.6b8
Classes | Typedefs | Functions | Variables
tree.hh File Reference

A tree library with hashconsing and maximal sharing capabilities. More...

#include "symbol.hh"
#include "node.hh"
#include <vector>
#include <map>
#include <assert.h>
Include dependency graph for tree.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CTree
 A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches. More...
 
class  Tabber
 

Typedefs

typedef CTreeTree
 
typedef map< Tree, Treeplist
 
typedef vector< Treetvec
 

Functions

Tree tree (const Node &n)
 
Tree tree (const Node &n, const Tree &a)
 
Tree tree (const Node &n, const Tree &a, const Tree &b)
 
Tree tree (const Node &n, const Tree &a, const Tree &b, const Tree &c)
 
Tree tree (const Node &n, const Tree &a, const Tree &b, const Tree &c, const Tree &d)
 
Tree tree (const Node &n, const Tree &a, const Tree &b, const Tree &c, const Tree &d, const Tree &e)
 
Tree tree (const Node &n, const tvec &br)
 
int tree2int (Tree t)
 if t has a node of type int, return it otherwise error More...
 
double tree2float (Tree t)
 if t has a node of type float, return it otherwise error More...
 
double tree2double (Tree t)
 if t has a node of type float, return it otherwise error More...
 
const char * tree2str (Tree t)
 if t has a node of type symbol, return its name otherwise error More...
 
void * tree2ptr (Tree t)
 if t has a node of type ptr, return it otherwise error More...
 
void * getUserData (Tree t)
 if t has a node of type symbol, return the associated user data More...
 
bool isTree (const Tree &t, const Node &n)
 
bool isTree (const Tree &t, const Node &n, Tree &a)
 
bool isTree (const Tree &t, const Node &n, Tree &a, Tree &b)
 
bool isTree (const Tree &t, const Node &n, Tree &a, Tree &b, Tree &c)
 
bool isTree (const Tree &t, const Node &n, Tree &a, Tree &b, Tree &c, Tree &d)
 
bool isTree (const Tree &t, const Node &n, Tree &a, Tree &b, Tree &c, Tree &d, Tree &e)
 
ostream & operator<< (ostream &s, const CTree &t)
 
Tree rec (Tree body)
 create a de Bruijn recursive tree More...
 
Tree rec (Tree id, Tree body)
 create a symbolic recursive tree More...
 
bool isRec (Tree t, Tree &body)
 is t a de Bruijn recursive tree More...
 
bool isRec (Tree t, Tree &id, Tree &body)
 is t a symbolic recursive tree More...
 
Tree ref (int level)
 create a de Bruijn recursive reference More...
 
Tree ref (Tree id)
 create a symbolic recursive reference More...
 
bool isRef (Tree t, int &level)
 is t a de Bruijn recursive reference More...
 
bool isRef (Tree t, Tree &id)
 is t a symbolic recursive reference More...
 
bool isOpen (Tree t)
 t contains free de Bruijn references More...
 
bool isClosed (Tree t)
 t dont contain free de Bruijn ref More...
 
Tree lift (Tree t)
 
Tree deBruijn2Sym (Tree t)
 
void updateAperture (Tree t)
 
ostream & operator<< (ostream &s, Tabber &t)
 

Variables

Tabber TABBER
 

Detailed Description

A tree library with hashconsing and maximal sharing capabilities.

A tree library with hashconsing and maximal sharing capabilities.

API:

Useful conversions :

Pattern matching :

Accessors :

Attributs :

Properties:

If p and q are two CTree pointers : p != q <=> *p != *q

Definition in file tree.hh.

Typedef Documentation

typedef map<Tree, Tree> plist

Definition at line 89 of file tree.hh.

typedef CTree* Tree

Definition at line 86 of file tree.hh.

typedef vector<Tree> tvec

Definition at line 90 of file tree.hh.

Function Documentation

Tree deBruijn2Sym ( Tree  t)

Definition at line 223 of file recursive-tree.cpp.

References calcDeBruijn2Sym(), CTree::getProperty(), isClosed(), and CTree::setProperty().

Referenced by calcDeBruijn2Sym(), mapPrepareEqSig(), and ScalarCompiler::prepare().

224 {
225  assert(isClosed(t));
226  Tree t2 = t->getProperty(DEBRUIJN2SYM);
227 
228  if (!t2) {
229  t2 = calcDeBruijn2Sym(t);
230  t->setProperty(DEBRUIJN2SYM, t2);
231  }
232  return t2;
233 }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
bool isClosed(Tree t)
t dont contain free de Bruijn ref
Definition: tree.hh:239
void setProperty(Tree key, Tree value)
Definition: tree.hh:167
static Tree calcDeBruijn2Sym(Tree t)
Tree DEBRUIJN2SYM
Tree getProperty(Tree key)
Definition: tree.hh:173

Here is the call graph for this function:

Here is the caller graph for this function:

void* getUserData ( Tree  t)

if t has a node of type symbol, return the associated user data

Definition at line 372 of file tree.cpp.

References getUserData(), isSym(), and CTree::node().

Referenced by getUserData().

373 {
374  Sym s;
375  if (isSym(t->node(), &s)) {
376  return getUserData(s);
377  } else {
378  return 0;
379  }
380 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143
void * getUserData(Tree t)
if t has a node of type symbol, return the associated user data
Definition: tree.cpp:372
bool isSym(const Node &n)
Definition: node.hh:199
Symbols are unique objects with a name stored in a hash table.
Definition: symbol.hh:53

Here is the call graph for this function:

Here is the caller graph for this function:

bool isClosed ( Tree  t)
inline

t dont contain free de Bruijn ref

Definition at line 239 of file tree.hh.

References CTree::aperture().

Referenced by calcliftn(), and deBruijn2Sym().

Here is the call graph for this function:

Here is the caller graph for this function:

bool isOpen ( Tree  t)
inline

t contains free de Bruijn references

Definition at line 238 of file tree.hh.

References CTree::aperture().

Here is the call graph for this function:

bool isRec ( Tree  t,
Tree body 
)

is t a de Bruijn recursive tree

Definition at line 59 of file recursive-tree.cpp.

References isTree().

Referenced by annotate(), calcDeBruijn2Sym(), calcliftn(), calcsubstitute(), computePrivatisation(), VectorCompiler::generateCodeRecursions(), ScalarCompiler::generateRecProj(), DocCompiler::generateRecProj(), getSubSignals(), infereSigOrder(), infereSigType(), ppsig::print(), printSignal(), recdraw(), recomputeAperture(), sigLabel(), sigMap(), sigMapRename(), symlistVisit(), typeAnnotation(), and sigvisitor::visit().

60 {
61  return isTree(t, DEBRUIJN, body);
62 }
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305
Sym DEBRUIJN

Here is the call graph for this function:

Here is the caller graph for this function:

bool isRec ( Tree  t,
Tree id,
Tree body 
)

is t a symbolic recursive tree

Definition at line 95 of file recursive-tree.cpp.

References CTree::getProperty(), and isTree().

96 {
97  if (isTree(t, SYMREC, var)) {
98  body = t->getProperty(RECDEF);
99  return true;
100  } else {
101  return false;
102  }
103 }
Sym SYMREC
Tree RECDEF
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305
Tree getProperty(Tree key)
Definition: tree.hh:173

Here is the call graph for this function:

bool isRef ( Tree  t,
int &  level 
)

is t a de Bruijn recursive reference

Definition at line 70 of file recursive-tree.cpp.

References isInt(), isTree(), and CTree::node().

Referenced by calcDeBruijn2Sym(), calcliftn(), calcsubstitute(), infereSigOrder(), ppsig::print(), printSignal(), recomputeAperture(), sigMapRename(), and sigvisitor::visit().

71 {
72  Tree u;
73 
74  if (isTree(t, DEBRUIJNREF, u)) {
75  return isInt(u->node(), &level);
76  } else {
77  return false;
78  }
79 }
Sym DEBRUIJNREF
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305
bool isInt(const Node &n)
Definition: node.hh:126

Here is the call graph for this function:

Here is the caller graph for this function:

bool isRef ( Tree  t,
Tree id 
)

is t a symbolic recursive reference

Definition at line 111 of file recursive-tree.cpp.

References isTree().

112 {
113  return isTree(t, SYMREC, v);
114 }
Sym SYMREC
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305

Here is the call graph for this function:

bool isTree ( const Tree t,
const Node n 
)

Definition at line 305 of file tree.cpp.

References CTree::node().

Referenced by isBoxAbstr(), isBoxAccess(), isBoxAppl(), isBoxButton(), isBoxCase(), isBoxCheckbox(), isBoxComponent(), isBoxCut(), isBoxEnvironment(), isBoxError(), isBoxFConst(), isBoxFFun(), isBoxFVar(), isBoxHBargraph(), isBoxHGroup(), isBoxHSlider(), isBoxIdent(), isBoxInputs(), isBoxIPar(), isBoxIProd(), isBoxISeq(), isBoxISum(), isBoxLibrary(), isBoxMerge(), isBoxModifLocalDef(), isBoxNumEntry(), isBoxOutputs(), isBoxPar(), isBoxPatternMatcher(), isBoxPatternVar(), isBoxPrim0(), isBoxPrim1(), isBoxPrim2(), isBoxPrim3(), isBoxPrim4(), isBoxPrim5(), isBoxRec(), isBoxSeq(), isBoxSlot(), isBoxSplit(), isBoxSymbolic(), isBoxTGroup(), isBoxVBargraph(), isBoxVGroup(), isBoxVSlider(), isBoxWaveform(), isBoxWire(), isBoxWithLocalDef(), isClosure(), isDocDgm(), isDocEqn(), isDocLst(), isDocMtd(), isDocNtc(), isDocTxt(), isImportFile(), isPathCurrent(), isPathParent(), isPathRoot(), isProj(), isRec(), isRef(), isSigAttach(), isSigBinOp(), isSigButton(), isSigCheckbox(), isSigDelay1(), isSigDocAccessTbl(), isSigDocConstantTbl(), isSigDocWriteTbl(), isSigFConst(), isSigFFun(), isSigFixDelay(), isSigFloatCast(), isSigFVar(), isSigGen(), isSigHBargraph(), isSigHSlider(), isSigInput(), isSigIntCast(), isSigIota(), isSigNumEntry(), isSigOutput(), isSigPrefix(), isSigRDTbl(), isSigSelect2(), isSigSelect3(), isSigTable(), isSigTuple(), isSigTupleAccess(), isSigVBargraph(), isSigVSlider(), isSigWaveform(), isSigWRTbl(), isUiFolder(), and isUiWidget().

306 {
307  return (t->node() == n);
308 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143

Here is the call graph for this function:

bool isTree ( const Tree t,
const Node n,
Tree a 
)

Definition at line 310 of file tree.cpp.

References CTree::arity(), CTree::branch(), and CTree::node().

311 {
312  if ((t->node() == n) && (t->arity() == 1)) {
313  a=t->branch(0);
314  return true;
315  } else {
316  return false;
317  }
318 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143
int arity() const
return the number of branches (subtrees) of a tree
Definition: tree.hh:144
Tree branch(int i) const
return the ith branch (subtree) of a tree
Definition: tree.hh:145

Here is the call graph for this function:

bool isTree ( const Tree t,
const Node n,
Tree a,
Tree b 
)

Definition at line 320 of file tree.cpp.

References CTree::arity(), CTree::branch(), and CTree::node().

321 {
322  if ((t->node() == n) && (t->arity() == 2)) {
323  a=t->branch(0);
324  b=t->branch(1);
325  return true;
326  } else {
327  return false;
328  }
329 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143
int arity() const
return the number of branches (subtrees) of a tree
Definition: tree.hh:144
Tree branch(int i) const
return the ith branch (subtree) of a tree
Definition: tree.hh:145

Here is the call graph for this function:

bool isTree ( const Tree t,
const Node n,
Tree a,
Tree b,
Tree c 
)

Definition at line 331 of file tree.cpp.

References CTree::arity(), CTree::branch(), and CTree::node().

332 {
333  if ((t->node() == n) && (t->arity() == 3)) {
334  a=t->branch(0);
335  b=t->branch(1);
336  c=t->branch(2);
337  return true;
338  } else {
339  return false;
340  }
341 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143
int arity() const
return the number of branches (subtrees) of a tree
Definition: tree.hh:144
Tree branch(int i) const
return the ith branch (subtree) of a tree
Definition: tree.hh:145

Here is the call graph for this function:

bool isTree ( const Tree t,
const Node n,
Tree a,
Tree b,
Tree c,
Tree d 
)

Definition at line 343 of file tree.cpp.

References CTree::arity(), CTree::branch(), and CTree::node().

344 {
345  if ((t->node() == n) && (t->arity() == 4)) {
346  a=t->branch(0);
347  b=t->branch(1);
348  c=t->branch(2);
349  d=t->branch(3);
350  return true;
351  } else {
352  return false;
353  }
354 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143
int arity() const
return the number of branches (subtrees) of a tree
Definition: tree.hh:144
Tree branch(int i) const
return the ith branch (subtree) of a tree
Definition: tree.hh:145

Here is the call graph for this function:

bool isTree ( const Tree t,
const Node n,
Tree a,
Tree b,
Tree c,
Tree d,
Tree e 
)

Definition at line 356 of file tree.cpp.

References CTree::arity(), CTree::branch(), and CTree::node().

357 {
358  if ((t->node() == n) && (t->arity() == 5)) {
359  a=t->branch(0);
360  b=t->branch(1);
361  c=t->branch(2);
362  d=t->branch(3);
363  e=t->branch(4);
364  return true;
365  } else {
366  return false;
367  }
368 }
const Node & node() const
return the content of the tree
Definition: tree.hh:143
int arity() const
return the number of branches (subtrees) of a tree
Definition: tree.hh:144
Tree branch(int i) const
return the ith branch (subtree) of a tree
Definition: tree.hh:145

Here is the call graph for this function:

Tree lift ( Tree  t)

Definition at line 149 of file recursive-tree.cpp.

References liftn().

Referenced by listLift(), and realPropagate().

149 { return liftn(t, 1); }
static Tree liftn(Tree t, int threshold)

Here is the call graph for this function:

Here is the caller graph for this function:

ostream& operator<< ( ostream &  s,
const CTree t 
)
inline

Definition at line 212 of file tree.hh.

References CTree::print().

212 { return t.print(s); }
ostream & print(ostream &fout) const
print recursively the content of a tree on a stream
Definition: tree.cpp:190

Here is the call graph for this function:

ostream& operator<< ( ostream &  s,
Tabber t 
)
inline

Definition at line 264 of file tree.hh.

References Tabber::print().

264 { return t.print(s); }
ostream & print(ostream &fout)
Definition: tree.hh:259

Here is the call graph for this function:

Tree rec ( Tree  body)

create a de Bruijn recursive tree

Definition at line 54 of file recursive-tree.cpp.

References tree().

Referenced by calcDeBruijn2Sym(), calcliftn(), calcsubstitute(), computePrivatisation(), realPropagate(), sigMap(), and sigMapRename().

55 {
56  return tree(DEBRUIJN, body);
57 }
Tree tree(const Node &n)
Definition: tree.hh:186
Sym DEBRUIJN

Here is the call graph for this function:

Here is the caller graph for this function:

Tree rec ( Tree  id,
Tree  body 
)

create a symbolic recursive tree

Definition at line 88 of file recursive-tree.cpp.

References CTree::setProperty(), and tree().

89 {
90  Tree t = tree(SYMREC, var);
91  t->setProperty(RECDEF, body);
92  return t;
93 }
Sym SYMREC
Tree RECDEF
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
void setProperty(Tree key, Tree value)
Definition: tree.hh:167
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

Tree ref ( int  level)

create a de Bruijn recursive reference

Definition at line 64 of file recursive-tree.cpp.

References tree().

Referenced by calcDeBruijn2Sym(), calcliftn(), realPropagate(), and sigMapRename().

65 {
66  assert(level > 0);
67  return tree(DEBRUIJNREF, tree(level)); // reference to enclosing recursive tree starting from 1
68 }
Sym DEBRUIJNREF
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

Here is the caller graph for this function:

Tree ref ( Tree  id)

create a symbolic recursive reference

Definition at line 106 of file recursive-tree.cpp.

References tree().

107 {
108  return tree(SYMREC, id); // reference to a symbolic id
109 }
Sym SYMREC
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

Tree tree ( const Node n)
inline

Definition at line 186 of file tree.hh.

References CTree::make().

Referenced by addNums(), annotate(), autoName(), xtended::box(), boxAbstr(), boxAccess(), boxAppl(), boxButton(), boxCaseInternal(), boxCheckbox(), boxComplexity(), boxComponent(), boxCut(), boxEnvironment(), boxError(), boxFConst(), boxFFun(), boxFVar(), boxHBargraph(), boxHGroup(), boxHSlider(), boxIdent(), boxInputs(), boxInt(), boxIPar(), boxIProd(), boxISeq(), boxISum(), boxLibrary(), boxMerge(), boxModifLocalDef(), boxNumEntry(), boxOutputs(), boxPar(), boxPatternMatcher(), boxPatternVar(), boxPrim0(), boxPrim1(), boxPrim2(), boxPrim3(), boxPrim4(), boxPrim5(), boxReal(), boxRec(), boxSeq(), boxSlot(), boxSplit(), boxSymbolic(), boxTGroup(), boxVBargraph(), boxVGroup(), boxVSlider(), boxWaveform(), boxWire(), boxWithLocalDef(), calcDeBruijn2Sym(), closure(), codeSimpleType(), codeTableType(), combineDivLeft(), computePrivatisation(), CosPrim::computeSigOutput(), Atan2Prim::computeSigOutput(), AtanPrim::computeSigOutput(), SinPrim::computeSigOutput(), TanPrim::computeSigOutput(), AcosPrim::computeSigOutput(), AsinPrim::computeSigOutput(), ExpPrim::computeSigOutput(), FloorPrim::computeSigOutput(), FmodPrim::computeSigOutput(), CeilPrim::computeSigOutput(), RemainderPrim::computeSigOutput(), AbsPrim::computeSigOutput(), MaxPrim::computeSigOutput(), MinPrim::computeSigOutput(), LogPrim::computeSigOutput(), RintPrim::computeSigOutput(), Log10Prim::computeSigOutput(), SqrtPrim::computeSigOutput(), PowPrim::computeSigOutput(), cons(), declareAutoDoc(), declareMetadata(), divExtendedNums(), docDgm(), docEqn(), docLst(), docMtd(), docNtc(), docTxt(), encodeName(), ffunction(), gcd(), ScalarCompiler::generateButton(), ScalarCompiler::generateCheckbox(), ScalarCompiler::generateHBargraph(), ScalarCompiler::generateHSlider(), ScalarCompiler::generateNumEntry(), ScalarCompiler::generateVBargraph(), ScalarCompiler::generateVSlider(), getBoxType(), getEvalProperty(), getPMProperty(), getPropagateProperty(), getSigOrder(), importFile(), inverseNum(), iteratePar(), iterateProd(), iterateSeq(), iterateSum(), label2path(), liftn(), main(), makePrivatisationKey(), makePrivatisationLabel(), OccMarkup::mark(), minusNum(), mulNums(), normalizeDelay1Term(), aterm::normalizedTree(), mterm::normalizedTree(), pathCurrent(), pathParent(), pathRoot(), patternSimplification(), printheader(), Klass::printMetadata(), propagate(), pushEnvBarrier(), pushNewLayer(), realeval(), realPropagate(), rec(), ref(), property< Loop * >::set(), property< int >::set(), property< double >::set(), setColorProperty(), Occurrences::setCount(), setDefNameProperty(), setDefProp(), setEvalProperty(), OccMarkup::setOcc(), setPMProperty(), setPropagateProperty(), ScalarCompiler::setSharingCount(), DocCompiler::setSharingCount(), setSigNickname(), shprkey(), sigAttach(), sigBinOp(), sigButton(), sigCheckbox(), sigDelay1(), sigDocAccessTbl(), sigDocConstantTbl(), sigDocWriteTbl(), sigFConst(), sigFFun(), sigFixDelay(), sigFloatCast(), sigFVar(), sigGen(), sigHBargraph(), sigHSlider(), sigInput(), sigInt(), sigIntCast(), sigIota(), sigMap(), sigMapRename(), sigNumEntry(), sigOutput(), sigPow(), sigPrefix(), sigProj(), sigRDTbl(), sigReal(), sigSelect2(), sigSelect3(), sigTable(), sigTuple(), sigTupleAccess(), sigVBargraph(), sigVSlider(), sigWaveform(), sigWRTbl(), simplification(), Occurrences::specificKey(), subNums(), subst(), substitute(), substkey(), tmap(), uiFolder(), uiWidget(), unquote(), writeSchemaFile(), and yyparse().

186 { Tree br[1]; return CTree::make(n, 0, br); }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

Tree tree ( const Node n,
const Tree a 
)
inline

Definition at line 187 of file tree.hh.

References CTree::make().

187 { Tree br[]= {a}; return CTree::make(n, 1, br); }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

Tree tree ( const Node n,
const Tree a,
const Tree b 
)
inline

Definition at line 188 of file tree.hh.

References CTree::make().

188 { Tree br[]= {a,b}; return CTree::make(n, 2, br); }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

Tree tree ( const Node n,
const Tree a,
const Tree b,
const Tree c 
)
inline

Definition at line 189 of file tree.hh.

References CTree::make().

189 { Tree br[]= {a,b,c}; return CTree::make(n, 3, br); }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

Tree tree ( const Node n,
const Tree a,
const Tree b,
const Tree c,
const Tree d 
)
inline

Definition at line 190 of file tree.hh.

References CTree::make().

190 { Tree br[]= {a,b,c,d}; return CTree::make(n, 4, br); }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

Tree tree ( const Node n,
const Tree a,
const Tree b,
const Tree c,
const Tree d,
const Tree e 
)
inline

Definition at line 192 of file tree.hh.

References CTree::make().

192 { Tree br[]= {a,b,c,d,e}; return CTree::make(n, 5, br); }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

Tree tree ( const Node n,
const tvec br 
)
inline

Definition at line 193 of file tree.hh.

References CTree::make().

193 { return CTree::make(n, br); }
static Tree make(const Node &n, int ar, Tree br[])
return a new tree or an existing equivalent one

Here is the call graph for this function:

double tree2double ( Tree  t)

if t has a node of type float, return it otherwise error

Definition at line 262 of file tree.cpp.

References ERROR, isDouble(), isInt(), and CTree::node().

Referenced by Description::addWidget().

263 {
264  double x;
265  int i;
266 
267  if (isInt(t->node(), &i)) {
268  x = double(i);
269  } else if (isDouble(t->node(), &x)) {
270  //nothing to do
271  } else {
272  ERROR("the node of the tree is not a float nor an int", t);
273  }
274  return double(x);
275 }
#define ERROR(s, t)
Definition: tree.cpp:96
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isDouble(const Node &n)
Definition: node.hh:143
bool isInt(const Node &n)
Definition: node.hh:126

Here is the call graph for this function:

Here is the caller graph for this function:

double tree2float ( Tree  t)

if t has a node of type float, return it otherwise error

Definition at line 246 of file tree.cpp.

References ERROR, isDouble(), isInt(), and CTree::node().

Referenced by eval2double(), ScalarCompiler::generateHSlider(), ScalarCompiler::generateNumEntry(), ScalarCompiler::generateVSlider(), Compiler::generateWidgetCode(), Compiler::generateWidgetMacro(), infereSigType(), infereWaveformType(), and DocCompiler::prepareIntervallicUI().

247 {
248  double x;
249  int i;
250 
251  if (isInt(t->node(), &i)) {
252  x = double(i);
253  } else if (isDouble(t->node(), &x)) {
254  //nothing to do
255  } else {
256  ERROR("the node of the tree is not a float nor an int", t);
257  }
258  return x;
259 }
#define ERROR(s, t)
Definition: tree.cpp:96
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isDouble(const Node &n)
Definition: node.hh:143
bool isInt(const Node &n)
Definition: node.hh:126

Here is the call graph for this function:

Here is the caller graph for this function:

int tree2int ( Tree  t)

if t has a node of type int, return it otherwise error

Definition at line 230 of file tree.cpp.

References ERROR, isDouble(), isInt(), and CTree::node().

Referenced by Description::addGroup(), annotate(), boxComplexity(), eval2int(), ffargtype(), ffrestype(), Compiler::generateUserInterfaceTree(), getRecursivness(), getSigOrder(), infereFConstType(), infereFVarType(), isBoxPatternMatcher(), and boxpp::print().

231 {
232  double x;
233  int i;
234 
235  if (isInt(t->node(), &i)) {
236  // nothing to do
237  } else if (isDouble(t->node(), &x)) {
238  i = int(x);
239  } else {
240  ERROR("the node of the tree is not an int nor a float", t);
241  }
242  return i;
243 }
#define ERROR(s, t)
Definition: tree.cpp:96
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isDouble(const Node &n)
Definition: node.hh:143
bool isInt(const Node &n)
Definition: node.hh:126

Here is the call graph for this function:

Here is the caller graph for this function:

void* tree2ptr ( Tree  t)

if t has a node of type ptr, return it otherwise error

Definition at line 288 of file tree.cpp.

References ERROR, isPointer(), and CTree::node().

Referenced by getColorProperty(), OccMarkup::getOcc(), and isBoxPatternMatcher().

289 {
290  void* x;
291  if (! isPointer(t->node(), &x)) {
292  ERROR("the node of the tree is not a pointer", t);
293  }
294  return x;
295 }
#define ERROR(s, t)
Definition: tree.cpp:96
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isPointer(const Node &n)
Definition: node.hh:216

Here is the call graph for this function:

Here is the caller graph for this function:

const char* tree2str ( Tree  t)

if t has a node of type symbol, return its name otherwise error

Definition at line 278 of file tree.cpp.

References ERROR, isSym(), name(), and CTree::node().

Referenced by Description::addGroup(), Description::addWidget(), applyList(), DocCompiler::compileLateq(), declareAutoDoc(), declareMetadata(), SourceReader::expandrec(), extractName(), ffincfile(), fflibfile(), ffname(), ScalarCompiler::generateCode(), DocCompiler::generateCode(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), Compiler::generateMacroInterfaceTree(), generateOutputSlotSchema(), Compiler::generateUserInterfaceTree(), Compiler::generateWidgetCode(), Compiler::generateWidgetMacro(), DocCompiler::getUIDir(), DocCompiler::getUIDocInfos(), legalFileName(), main(), mapGetEqName(), ppsig::print(), boxpp::print(), printDocMetadata(), realeval(), tree2quotedstr(), and writeSchemaFile().

279 {
280  Sym s;
281  if (!isSym(t->node(), &s)) {
282  ERROR("the node of the tree is not a symbol", t);
283  }
284  return name(s);
285 }
#define ERROR(s, t)
Definition: tree.cpp:96
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isSym(const Node &n)
Definition: node.hh:199
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
Symbols are unique objects with a name stored in a hash table.
Definition: symbol.hh:53

Here is the call graph for this function:

Here is the caller graph for this function:

void updateAperture ( Tree  t)

Definition at line 320 of file recursive-tree.cpp.

References markOpen(), and recomputeAperture().

321 {
322  markOpen(t);
323  recomputeAperture(t, NULL);
324 }
static void markOpen(Tree t)
static int recomputeAperture(Tree t, Env *p)

Here is the call graph for this function:

Variable Documentation

Tabber TABBER

Definition at line 87 of file tree.cpp.

Referenced by annotationStatistics(), getSigType(), setSigType(), T(), and traced_simplification().