#include <ppsig.hh>
Public Member Functions | |
ppsig (Tree s) | |
ostream & | print (ostream &fout) const |
Private Member Functions | |
ppsig (Tree s, Tree env, int priority=0) | |
ostream & | printinfix (ostream &fout, const string &opname, int priority, Tree x, Tree y) const |
ostream & | printfun (ostream &fout, const string &funame, Tree x) const |
ostream & | printfun (ostream &fout, const string &funame, Tree x, Tree y) const |
ostream & | printfun (ostream &fout, const string &funame, Tree x, Tree y, Tree z) const |
ostream & | printfun (ostream &fout, const string &funame, Tree x, Tree y, Tree z, Tree zz) const |
ostream & | printfun (ostream &fout, const string &funame, Tree x, Tree y, Tree z, Tree z2, Tree z3) const |
ostream & | printout (ostream &fout, int i, Tree x) const |
ostream & | printlist (ostream &fout, Tree largs) const |
ostream & | printff (ostream &fout, Tree ff, Tree largs) const |
ostream & | printrec (ostream &fout, Tree var, Tree lexp, bool hide) const |
ostream & | printrec (ostream &fout, Tree lexp, bool hide) const |
ostream & | printextended (ostream &fout, Tree sig) const |
ostream & | printui (ostream &fout, const string &funame, Tree label) const |
ostream & | printui (ostream &fout, const string &funame, Tree label, Tree lo, Tree hi, Tree step) const |
ostream & | printui (ostream &fout, const string &funame, Tree label, Tree cur, Tree lo, Tree hi, Tree step) const |
ostream & | printlabel (ostream &fout, Tree pathname) const |
ostream & | printFixDelay (ostream &fout, Tree exp, Tree delay) const |
Private Attributes | |
Tree | sig |
Tree | fEnv |
recursive environment stack | |
int | fPriority |
priority context | |
bool | fHideRecursion |
Definition at line 48 of file ppsig.hh.
ppsig::ppsig | ( | Tree | s | ) | [inline] |
Definition at line 55 of file ppsig.hh.
Referenced by print(), printextended(), printFixDelay(), printfun(), printinfix(), printlist(), printout(), printrec(), and printui().
00055 : sig(s), fEnv(nil), fPriority(0), fHideRecursion(false) {}
ostream & ppsig::print | ( | ostream & | fout | ) | const |
Definition at line 178 of file ppsig.cpp.
References fEnv, fHideRecursion, fPriority, gBinOpTable, getUserData(), isList(), isProj(), isRec(), isRef(), 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(), isSigWRTbl(), name(), ppsig(), printextended(), printff(), printFixDelay(), printfun(), printinfix(), printlist(), printout(), printrec(), printui(), sig, and tree2str().
Referenced by operator<<().
00179 { 00180 int i; 00181 double r; 00182 Tree c, sel, x, y, z, u, var, le, label, id, ff, largs, type, name, file; 00183 00184 if ( isList(sig) ) { printlist(fout, sig); } 00185 else if ( isProj(sig, &i, x) ) { fout << "proj" << i << '(' << ppsig(x, fEnv) << ')'; } 00186 else if ( isRec(sig, var, le) ) { printrec(fout, var, le, fHideRecursion /*&& (getRecursivness(sig)==0)*/ ); } 00187 00188 // debruinj notation 00189 else if ( isRec(sig, le) ) { printrec(fout, le, fHideRecursion ); } 00190 else if ( isRef(sig, i) ) { fout << "REF[" << i << "]"; } 00191 00192 else if ( getUserData(sig) ) { printextended(fout, sig); } 00193 else if ( isSigInt(sig, &i) ) { fout << i; } 00194 else if ( isSigReal(sig, &r) ) { fout << r; } 00195 else if ( isSigInput(sig, &i) ) { fout << "IN[" << i << "]"; } 00196 else if ( isSigOutput(sig, &i, x) ) { printout(fout, i, x) ; } 00197 00198 else if ( isSigDelay1(sig, x) ) { fout << ppsig(x, fEnv, 9) << "'"; } 00199 //else if ( isSigFixDelay(sig, x, y) ) { printinfix(fout, "@", 8, x, y); } 00200 else if ( isSigFixDelay(sig, x, y) ) { printFixDelay(fout, x, y); } 00201 else if ( isSigPrefix(sig, x, y) ) { printfun(fout, "prefix", x, y); } 00202 else if ( isSigIota(sig, x) ) { printfun(fout, "iota", x); } 00203 else if ( isSigBinOp(sig, &i, x, y) ) { printinfix(fout, gBinOpTable[i]->fName, gBinOpTable[i]->fPriority, x, y); } 00204 else if ( isSigFFun(sig, ff, largs) ) { printff(fout, ff, largs); } 00205 else if ( isSigFConst(sig, type, name, file) ) { fout << tree2str(name); } 00206 else if ( isSigFVar(sig, type, name, file) ) { fout << tree2str(name); } 00207 00208 else if ( isSigTable(sig, id, x, y) ) { printfun(fout, "TABLE", x, y); } 00209 else if ( isSigWRTbl(sig, id, x, y, z) ) { printfun(fout, "write", x, y, z); } 00210 else if ( isSigRDTbl(sig, x, y) ) { printfun(fout, "read", x, y); } 00211 else if ( isSigGen(sig, x) ) { fout << ppsig(x, fEnv, fPriority); } 00212 00213 else if ( isSigDocConstantTbl(sig, x, y) ) { printfun(fout, "docConstantTbl", x, y); } 00214 else if ( isSigDocWriteTbl(sig, x, y, z, u) ) { printfun(fout, "docWriteTbl", x, y, z, u); } 00215 else if ( isSigDocAccessTbl(sig, x, y) ) { printfun(fout, "docAccessTbl", x, y); } 00216 00217 else if ( isSigSelect2(sig, sel, x, y) ) { printfun(fout, "select2", sel, x, y); } 00218 else if ( isSigSelect3(sig, sel, x, y, z) ) { printfun(fout, "select3", sel, x, y, z); } 00219 00220 else if ( isSigIntCast(sig, x) ) { printfun(fout, "int", x); } 00221 else if ( isSigFloatCast(sig, x) ) { printfun(fout, "float", x); } 00222 00223 else if ( isSigButton(sig, label) ) { printui(fout, "button", label); } 00224 else if ( isSigCheckbox(sig, label) ) { printui(fout, "checkbox", label); } 00225 else if ( isSigVSlider(sig, label,c,x,y,z) ) { printui(fout, "vslider", label, c, x, y, z); } 00226 else if ( isSigHSlider(sig, label,c,x,y,z) ) { printui(fout, "hslider", label, c, x, y, z); } 00227 else if ( isSigNumEntry(sig, label,c,x,y,z) ) { printui(fout, "nentry", label, c, x, y, z); } 00228 else if ( isSigVBargraph(sig, label,x,y,z) ) { printui(fout, "vbargraph", label, x, y, z); } 00229 else if ( isSigHBargraph(sig, label,x,y,z) ) { printui(fout, "hbargraph", label, x, y, z); } 00230 else if ( isSigAttach(sig, x, y) ) { printfun(fout, "attach", x, y); } 00231 00232 else { 00233 cerr << "ERROR, ppsig doesn't recognize signal : " << *sig << endl; 00234 exit(1); 00235 } 00236 return fout; 00237 }
ostream & ppsig::printextended | ( | ostream & | fout, | |
Tree | sig | |||
) | const [private] |
Definition at line 163 of file ppsig.cpp.
References CTree::arity(), CTree::branch(), fEnv, getUserData(), xtended::name(), and ppsig().
Referenced by print().
00164 { 00165 string sep = ""; 00166 xtended* p = (xtended*) getUserData(sig); 00167 00168 fout << p->name() << '('; 00169 for (int i = 0; i < sig->arity(); i++) { 00170 fout << sep << ppsig(sig->branch(i), fEnv); 00171 sep = ", "; 00172 } 00173 fout << ')'; 00174 return fout; 00175 }
Definition at line 131 of file ppsig.cpp.
References fEnv, isSigInt(), ppsig(), and printinfix().
Referenced by print().
00132 { 00133 int d; 00134 00135 if (isSigInt(delay, &d) && (d==1)) { 00136 fout << ppsig(exp,fEnv,8) << "'"; 00137 } else { 00138 printinfix(fout, "@", 8, exp, delay); 00139 } 00140 return fout; 00141 }
ostream & ppsig::printfun | ( | ostream & | fout, | |
const string & | funame, | |||
Tree | x | |||
) | const [private] |
ostream & ppsig::printinfix | ( | ostream & | fout, | |
const string & | opname, | |||
int | priority, | |||
Tree | x, | |||
Tree | y | |||
) | const [private] |
Definition at line 30 of file ppsig.cpp.
References fEnv, fPriority, and ppsig().
Referenced by print(), and printFixDelay().
00031 { 00032 if (fPriority > priority) fout << "("; 00033 fout << ppsig(x,fEnv,priority) << opname << ppsig(y,fEnv,priority); 00034 if (fPriority > priority) fout << ")"; 00035 return fout; 00036 }
ostream & ppsig::printlabel | ( | ostream & | fout, | |
Tree | pathname | |||
) | const [private] |
Definition at line 101 of file ppsig.cpp.
References hd(), isNil(), and tl().
Referenced by printui().
00102 { 00103 fout << *hd(pathname); 00104 pathname = tl(pathname); 00105 while (!isNil(pathname)) { 00106 fout << '/' << *tl(hd(pathname)); 00107 pathname = tl(pathname); 00108 } 00109 return fout; 00110 }
ostream & ppsig::printlist | ( | ostream & | fout, | |
Tree | largs | |||
) | const [private] |
Definition at line 112 of file ppsig.cpp.
References fEnv, hd(), isNil(), ppsig(), and tl().
Referenced by print(), and printff().
00113 { 00114 string sep = ""; 00115 fout << '('; 00116 while (!isNil(largs)) { 00117 fout << sep << ppsig(hd(largs), fEnv); 00118 sep = ", "; 00119 largs = tl(largs); 00120 } 00121 fout << ')'; 00122 return fout; 00123 }
ostream & ppsig::printout | ( | ostream & | fout, | |
int | i, | |||
Tree | x | |||
) | const [private] |
Definition at line 93 of file ppsig.cpp.
References fEnv, fPriority, and ppsig().
Referenced by print().
00094 { 00095 if (fPriority > 0) fout << "("; 00096 fout << "OUT" << i << " = " << ppsig(x, fEnv, 0); 00097 if (fPriority > 0) fout << ")"; 00098 return fout; 00099 }
ostream & ppsig::printrec | ( | ostream & | fout, | |
Tree | lexp, | |||
bool | hide | |||
) | const [private] |
Definition at line 145 of file ppsig.cpp.
References addElement(), fEnv, isElement(), and ppsig().
Referenced by print().
00146 { 00147 if (isElement(var, fEnv) ) { 00148 fout << *var; 00149 } else if (hide) { 00150 fout << *var; 00151 } else { 00152 fout << "letrec(" << *var << " = " << ppsig(lexp, addElement(var, fEnv)) << ")"; 00153 } 00154 return fout; 00155 }
ostream & ppsig::printui | ( | ostream & | fout, | |
const string & | funame, | |||
Tree | label, | |||
Tree | cur, | |||
Tree | lo, | |||
Tree | hi, | |||
Tree | step | |||
) | const [private] |
Definition at line 81 of file ppsig.cpp.
References fEnv, ppsig(), and printlabel().
00082 { 00083 fout << funame << '('; 00084 printlabel(fout, label); 00085 return fout 00086 << ',' << ppsig(cur,fEnv) 00087 << ',' << ppsig(lo,fEnv) 00088 << ',' << ppsig(hi,fEnv) 00089 << ',' << ppsig(step,fEnv) 00090 << ')'; 00091 }
ostream & ppsig::printui | ( | ostream & | fout, | |
const string & | funame, | |||
Tree | label, | |||
Tree | lo, | |||
Tree | hi, | |||
Tree | step | |||
) | const [private] |
Definition at line 70 of file ppsig.cpp.
References fEnv, ppsig(), and printlabel().
00071 { 00072 fout << funame << '('; 00073 printlabel(fout, label); 00074 return fout 00075 << ',' << ppsig(lo,fEnv) 00076 << ',' << ppsig(hi,fEnv) 00077 << ',' << ppsig(step,fEnv) 00078 << ')'; 00079 }
ostream & ppsig::printui | ( | ostream & | fout, | |
const string & | funame, | |||
Tree | label | |||
) | const [private] |
Definition at line 63 of file ppsig.cpp.
References printlabel().
Referenced by print().
00064 { 00065 fout << funame << '('; 00066 printlabel(fout, label); 00067 return fout << ')'; 00068 }
Tree ppsig::fEnv [private] |
recursive environment stack
Definition at line 51 of file ppsig.hh.
Referenced by print(), printextended(), printFixDelay(), printfun(), printinfix(), printlist(), printout(), printrec(), and printui().
bool ppsig::fHideRecursion [private] |
int ppsig::fPriority [private] |
priority context
Definition at line 52 of file ppsig.hh.
Referenced by print(), printinfix(), and printout().
Tree ppsig::sig [private] |