New Makefile for libsndfile-ocaml library integration; Makefiles chain modified.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / signals / sigvisitor.cpp
1 #include "sigvisitor.hh"
2 #include <iostream>
3 #include <assert.h>
4 #include "xtended.hh"
5
6
7 using namespace std;
8
9 /**
10 * Infere the type of a term according to its surrounding type environment
11 * @param sig the signal to aanlyze
12 * @param env the type environment
13 * @return the type of sig according to environment env
14 */
15
16
17 void sigvisitor::visit(Tree sig)
18 {
19 int i;
20 double r;
21 Tree sel, s1, s2, s3, s4, ff, id, ls, l, var, body, type, name, file, cur, min, max, step;
22
23 assert(sig);
24
25 if (isSigInt(sig, &i)) visitInt (sig, i);
26
27 else if (isSigReal(sig, &r)) visitReal (sig, r);
28
29
30 else if (isSigInput(sig, &i)) visitInput (sig, i);
31
32 else if (isSigOutput(sig, &i, s1)) visitOutput (sig, i, s1);
33
34
35 else if (isSigDelay1(sig, s1)) visitDelay1 (sig, s1);
36
37 else if (isSigPrefix(sig, s1, s2)) visitPrefix (sig, s1, s2);
38
39 else if (isSigFixDelay(sig, s1, s2)) visitFixDelay (sig, s1, s2);
40
41
42 else if (isSigBinOp(sig, &i, s1, s2)) visitBinOp(sig, i, s1, s2);
43
44 else if (isSigIntCast(sig, s1)) visitIntCast(sig, s1);
45
46 else if (isSigFloatCast(sig, s1)) visitFloatCast(sig, s1);
47
48 else if (isSigFFun(sig, ff, ls)) visitFFun(sig,ff,ls);
49
50 else if (isSigFConst(sig,type,name,file)) visitFConst(sig,type,name,file);
51
52 else if (isSigFVar(sig,type,name,file)) visitFVar(sig,type,name,file);
53
54
55 //---------------
56
57 else if (isSigButton(sig, l)) visitButton(sig, l);
58
59 else if (isSigCheckbox(sig, l)) visitCheckbox(sig, l);
60
61 else if (isSigVSlider(sig, l, cur, min, max, step)) visitVSlider(sig, l, cur, min, max, step);
62
63 else if (isSigHSlider(sig, l, cur, min, max, step)) visitHSlider(sig, l, cur, min, max, step);
64
65 else if (isSigNumEntry(sig, l, cur, min, max, step)) visitNumEntry(sig, l, cur, min, max, step);
66
67 else if (isSigHBargraph(sig, l, min, max, s1)) visitHBargraph(sig, l, min, max, s1);
68
69 else if (isSigVBargraph(sig, l, min, max, s1)) visitVBargraph(sig, l, min, max, s1);
70
71 else if (isSigAttach(sig, s1, s2)) visitAttach(sig, s1, s2);
72
73
74 //------------------------
75
76 else if (isRec(sig, var, body)) visitRec(sig, var, body);
77
78 else if (isRef(sig, var)) visitRef(sig, var);
79
80 else if (isProj(sig, &i, s1)) visitProj(sig, i, s1);
81
82
83 //----------------------------
84
85 else if (isSigTable(sig, id, s1, s2)) visitTable(sig, id, s1, s2);
86
87 else if (isSigWRTbl(sig, id, s1, s2, s3)) visitWRTbl(sig, id, s1, s2, s3);
88
89 else if (isSigRDTbl(sig, s1, s2)) visitRDTbl(sig, s1, s2);
90
91 else if (isSigGen(sig, s1)) visitGen(sig, s1);
92
93
94 else if (isSigDocConstantTbl(sig, s1, s2)) visitDocConstantTbl(sig, s1, s2);
95
96 else if (isSigDocWriteTbl(sig,s1,s2,s3,s4)) visitDocWriteTbl(sig,s1,s2,s3,s4);
97
98 else if (isSigDocAccessTbl(sig,s1,s2)) visitDocAccessTbl(sig,s1,s2);
99
100
101 //----------------------------
102
103 else if (isSigSelect2(sig,sel,s1,s2)) visitSelect2(sig,sel,s1,s2);
104
105 else if (isSigSelect3(sig,sel,s1,s2,s3)) visitSelect3(sig,sel,s1,s2,s3);
106
107 else if (isList(sig)) visitList(sig);
108
109
110 //----------------------------
111
112 else if (isSigTuple(sig,&i,ls)) visitTuple(sig,i,ls);
113
114 else if (isSigTupleAccess(sig,s1,s2)) visitTupleAccess(sig,s1,s2);
115
116
117 //----------------------------
118
119 else visitError(sig);
120 }
121
122 void sigvisitor::visitError(Tree sig)
123 {
124 cerr << "ERROR visiting signal" << endl;
125 }