FAUST compiler  0.9.9.6b8
Functions
subsignals.cpp File Reference
#include <signals.hh>
#include <property.hh>
Include dependency graph for subsignals.cpp:

Go to the source code of this file.

Functions

int getSubSignals (Tree sig, vector< Tree > &vsigs, bool visitgen)
 Extract the sub signals of a signal expression, that is not necesseraly all the subtrees. More...
 

Function Documentation

int getSubSignals ( Tree  sig,
vector< Tree > &  vsigs,
bool  visitgen 
)

Extract the sub signals of a signal expression, that is not necesseraly all the subtrees.

Parameters
sigthe signals
vsigsa reference to the vector where the subsignals will be placed
Returns
the number of subsignals

Definition at line 12 of file subsignals.cpp.

References CTree::arity(), CTree::branch(), CTree::branches(), getUserData(), hd(), isList(), isNil(), isProj(), isRec(), isSigAttach(), isSigBinOp(), isSigButton(), isSigCheckbox(), isSigDelay1(), isSigDocAccessTbl(), isSigDocConstantTbl(), isSigDocWriteTbl(), isSigFConst(), isSigFFun(), isSigFixDelay(), isSigFloatCast(), isSigFVar(), isSigGen(), isSigHBargraph(), isSigHSlider(), isSigInput(), isSigInt(), isSigIntCast(), isSigIota(), isSigNumEntry(), isSigOutput(), isSigPrefix(), isSigRDTbl(), isSigReal(), isSigSelect2(), isSigSelect3(), isSigTable(), isSigVBargraph(), isSigVSlider(), isSigWaveform(), isSigWRTbl(), name(), and tl().

Referenced by annotate(), colorize(), VectorCompiler::generateCodeRecursions(), OccMarkup::incOcc(), listMultiColoredExp(), recdraw(), ScalarCompiler::sharingAnnotation(), DocCompiler::sharingAnnotation(), symlistVisit(), and uncolorize().

13 {
14  vsigs.clear();
15 
16  int i;
17  double r;
18  Tree c, sel, x, y, z, u, v, var, le, label, id, ff, largs, type, name, file;
19 
20  if ( getUserData(sig) ) { for (int i=0; i<sig->arity(); i++) { vsigs.push_back(sig->branch(i)); }
21  return sig->arity(); }
22  else if ( isSigInt(sig, &i) ) { return 0; }
23  else if ( isSigReal(sig, &r) ) { return 0; }
24  else if ( isSigWaveform(sig)) { vsigs = sig->branches(); return vsigs.size(); }
25 
26  //else if ( isSigWaveform(sig) ) { return 0; }
27 
28  else if ( isSigInput(sig, &i) ) { return 0; }
29  else if ( isSigOutput(sig, &i, x) ) { vsigs.push_back(x); return 1; }
30 
31  else if ( isSigDelay1(sig, x) ) { vsigs.push_back(x); return 1; }
32 
33  else if ( isSigFixDelay(sig, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
34  else if ( isSigPrefix(sig, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
35  else if ( isSigIota(sig, x) ) { vsigs.push_back(x); return 1; }
36 
37  else if ( isSigBinOp(sig, &i, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
38  else if ( isSigFFun(sig, ff, largs) ) { int n = 0; while (!isNil(largs)) { vsigs.push_back(hd(largs)); largs = tl(largs); n++; } return n; }
39  else if ( isSigFConst(sig, type, name, file) ) { return 0; }
40  else if ( isSigFVar(sig, type, name, file) ) { return 0; }
41 
42  else if ( isSigTable(sig, id, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
43  else if ( isSigWRTbl(sig, id, x, y, z) ) { vsigs.push_back(x); vsigs.push_back(y); vsigs.push_back(z); return 3; }
44  else if ( isSigRDTbl(sig, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
45 
46  else if ( isSigDocConstantTbl(sig, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
47  else if ( isSigDocWriteTbl(sig, x, y, u, v) ) { vsigs.push_back(x); vsigs.push_back(y); vsigs.push_back(u); vsigs.push_back(v); return 4; }
48  else if ( isSigDocAccessTbl(sig, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
49 
50 
51  else if ( isSigSelect2(sig, sel, x, y) ) { vsigs.push_back(sel); vsigs.push_back(x); vsigs.push_back(y); return 3; }
52  else if ( isSigSelect3(sig, sel, x, y, z) ) { vsigs.push_back(sel); vsigs.push_back(x); vsigs.push_back(y); vsigs.push_back(z); return 4; }
53 
54  else if ( isSigGen(sig, x) ) { if (visitgen) { vsigs.push_back(x); return 1;} else { return 0; } }
55 
56  else if ( isProj(sig, &i, x) ) { vsigs.push_back(x); return 1; }
57  else if ( isRec(sig, var, le) ) { vsigs.push_back(le); return 1; }
58 
59  else if ( isSigIntCast(sig, x) ) { vsigs.push_back(x); return 1; }
60  else if ( isSigFloatCast(sig, x) ) { vsigs.push_back(x); return 1; }
61 
62  else if ( isSigButton(sig, label) ) { return 0; }
63  else if ( isSigCheckbox(sig, label) ) { return 0; }
64  else if ( isSigVSlider(sig, label,c,x,y,z) ) { return 0; }
65  else if ( isSigHSlider(sig, label,c,x,y,z) ) { return 0; }
66  else if ( isSigNumEntry(sig, label,c,x,y,z) ) { return 0; }
67 
68  else if ( isSigVBargraph(sig, label,x,y,z) ) { vsigs.push_back(z); return 1; }
69  else if ( isSigHBargraph(sig, label,x,y,z) ) { vsigs.push_back(z); return 1; }
70  else if ( isSigAttach(sig, x, y) ) { vsigs.push_back(x); vsigs.push_back(y); return 2; }
71  else if ( isList(sig) ) { vsigs.push_back(hd(sig)); vsigs.push_back(tl(sig)); return 2; }
72  else if ( isNil(sig) ) { return 0; }
73 
74  else {
75  cerr << "ERROR, getSubSignals unrecognized signal : " << *sig << endl;
76  exit(1);
77  }
78  return 0;
79 }
bool isSigHSlider(Tree s)
Definition: signals.cpp:217
bool isSigRDTbl(Tree s, Tree &t, Tree &i)
Definition: signals.cpp:77
bool isSigFConst(Tree s)
Definition: signals.cpp:138
bool isSigPrefix(Tree t, Tree &t0, Tree &t1)
Definition: signals.cpp:66
bool isSigCheckbox(Tree s)
Definition: signals.cpp:205
bool isSigFFun(Tree s, Tree &ff, Tree &largs)
Definition: signals.cpp:133
bool isSigNumEntry(Tree s)
Definition: signals.cpp:257
bool isSigSelect2(Tree t, Tree &selector, Tree &s1, Tree &s2)
Definition: signals.cpp:116
bool isSigIota(Tree t, Tree &t0)
Definition: signals.cpp:70
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
bool isSigInput(Tree t, int *i)
Definition: signals.cpp:48
bool isSigFixDelay(Tree t, Tree &t0, Tree &t1)
Definition: signals.cpp:62
Tree hd(Tree l)
Definition: list.hh:133
bool isSigVBargraph(Tree s)
Definition: signals.cpp:285
bool isSigSelect3(Tree t, Tree &selector, Tree &s1, Tree &s2, Tree &s3)
Definition: signals.cpp:119
bool isSigVSlider(Tree s)
Definition: signals.cpp:237
bool isSigGen(Tree t, Tree &x)
Definition: signals.cpp:91
bool isNil(Tree l)
Definition: list.hh:137
bool isSigReal(Tree t, double *r)
Definition: signals.cpp:44
bool isSigHBargraph(Tree s)
Definition: signals.cpp:279
bool isSigDocConstantTbl(Tree t, Tree &n, Tree &sig)
Definition: signals.cpp:99
bool isList(Tree l)
Definition: list.hh:138
bool isSigTable(Tree t, Tree &id, Tree &n, Tree &sig)
Definition: signals.cpp:85
bool isSigBinOp(Tree s, int *op, Tree &x, Tree &y)
Definition: signals.cpp:126
bool isSigAttach(Tree t, Tree &t0, Tree &t1)
Definition: signals.cpp:291
bool isSigDocAccessTbl(Tree t, Tree &tbl, Tree &ridx)
Definition: signals.cpp:107
bool isSigWRTbl(Tree u, Tree &id, Tree &t, Tree &i, Tree &s)
Definition: signals.cpp:81
int arity() const
return the number of branches (subtrees) of a tree
Definition: tree.hh:144
const tvec & branches() const
return all branches (subtrees) of a tree
Definition: tree.hh:146
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
bool isSigWaveform(Tree s)
Definition: signals.cpp:211
bool isRec(Tree t, Tree &body)
is t a de Bruijn recursive tree
bool isSigInt(Tree t, int *i)
Definition: signals.cpp:41
bool isSigDocWriteTbl(Tree t, Tree &n, Tree &sig, Tree &widx, Tree &wsig)
Definition: signals.cpp:103
bool isSigDelay1(Tree t, Tree &t0)
Definition: signals.cpp:58
bool isSigFloatCast(Tree t)
Definition: signals.cpp:187
bool isSigFVar(Tree s)
Definition: signals.cpp:144
void * getUserData(Symbol *sym)
Returns user data.
Definition: symbol.hh:100
bool isSigIntCast(Tree t)
Definition: signals.cpp:184
bool isProj(Tree t, int *i, Tree &rgroup)
Definition: signals.cpp:151
Tree tl(Tree l)
Definition: list.hh:134
Tree branch(int i) const
return the ith branch (subtree) of a tree
Definition: tree.hh:145
bool isSigOutput(Tree t, int *i, Tree &t0)
Definition: signals.cpp:52
bool isSigButton(Tree s)
Definition: signals.cpp:199

Here is the call graph for this function:

Here is the caller graph for this function: