a54135405c48cca13cd65cb8fcf004cc2230b099
1 #include "sigvisitor.hh"
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
17 void sigvisitor::visit(Tree sig
)
21 Tree sel
, s1
, s2
, s3
, s4
, ff
, id
, ls
, l
, var
, body
, type
, name
, file
, cur
, min
, max
, step
;
25 if (isSigInt(sig
, &i
)) visitInt (sig
, i
);
27 else if (isSigReal(sig
, &r
)) visitReal (sig
, r
);
30 else if (isSigInput(sig
, &i
)) visitInput (sig
, i
);
32 else if (isSigOutput(sig
, &i
, s1
)) visitOutput (sig
, i
, s1
);
35 else if (isSigDelay1(sig
, s1
)) visitDelay1 (sig
, s1
);
37 else if (isSigPrefix(sig
, s1
, s2
)) visitPrefix (sig
, s1
, s2
);
39 else if (isSigFixDelay(sig
, s1
, s2
)) visitFixDelay (sig
, s1
, s2
);
42 else if (isSigBinOp(sig
, &i
, s1
, s2
)) visitBinOp(sig
, i
, s1
, s2
);
44 else if (isSigIntCast(sig
, s1
)) visitIntCast(sig
, s1
);
46 else if (isSigFloatCast(sig
, s1
)) visitFloatCast(sig
, s1
);
48 else if (isSigFFun(sig
, ff
, ls
)) visitFFun(sig
,ff
,ls
);
50 else if (isSigFConst(sig
,type
,name
,file
)) visitFConst(sig
,type
,name
,file
);
52 else if (isSigFVar(sig
,type
,name
,file
)) visitFVar(sig
,type
,name
,file
);
57 else if (isSigButton(sig
, l
)) visitButton(sig
, l
);
59 else if (isSigCheckbox(sig
, l
)) visitCheckbox(sig
, l
);
61 else if (isSigVSlider(sig
, l
, cur
, min
, max
, step
)) visitVSlider(sig
, l
, cur
, min
, max
, step
);
63 else if (isSigHSlider(sig
, l
, cur
, min
, max
, step
)) visitHSlider(sig
, l
, cur
, min
, max
, step
);
65 else if (isSigNumEntry(sig
, l
, cur
, min
, max
, step
)) visitNumEntry(sig
, l
, cur
, min
, max
, step
);
67 else if (isSigHBargraph(sig
, l
, min
, max
, s1
)) visitHBargraph(sig
, l
, min
, max
, s1
);
69 else if (isSigVBargraph(sig
, l
, min
, max
, s1
)) visitVBargraph(sig
, l
, min
, max
, s1
);
71 else if (isSigAttach(sig
, s1
, s2
)) visitAttach(sig
, s1
, s2
);
74 //------------------------
76 else if (isRec(sig
, var
, body
)) visitRec(sig
, var
, body
);
78 else if (isRef(sig
, var
)) visitRef(sig
, var
);
80 else if (isProj(sig
, &i
, s1
)) visitProj(sig
, i
, s1
);
83 //----------------------------
85 else if (isSigTable(sig
, id
, s1
, s2
)) visitTable(sig
, id
, s1
, s2
);
87 else if (isSigWRTbl(sig
, id
, s1
, s2
, s3
)) visitWRTbl(sig
, id
, s1
, s2
, s3
);
89 else if (isSigRDTbl(sig
, s1
, s2
)) visitRDTbl(sig
, s1
, s2
);
91 else if (isSigGen(sig
, s1
)) visitGen(sig
, s1
);
94 else if (isSigDocConstantTbl(sig
, s1
, s2
)) visitDocConstantTbl(sig
, s1
, s2
);
96 else if (isSigDocWriteTbl(sig
,s1
,s2
,s3
,s4
)) visitDocWriteTbl(sig
,s1
,s2
,s3
,s4
);
98 else if (isSigDocAccessTbl(sig
,s1
,s2
)) visitDocAccessTbl(sig
,s1
,s2
);
101 //----------------------------
103 else if (isSigSelect2(sig
,sel
,s1
,s2
)) visitSelect2(sig
,sel
,s1
,s2
);
105 else if (isSigSelect3(sig
,sel
,s1
,s2
,s3
)) visitSelect3(sig
,sel
,s1
,s2
,s3
);
107 else if (isList(sig
)) visitList(sig
);
110 //----------------------------
112 else if (isSigTuple(sig
,&i
,ls
)) visitTuple(sig
,i
,ls
);
114 else if (isSigTupleAccess(sig
,s1
,s2
)) visitTupleAccess(sig
,s1
,s2
);
117 //----------------------------
119 else visitError(sig
);
122 void sigvisitor::visitError(Tree sig
)
124 cerr
<< "ERROR visiting signal" << endl
;