boxpp Class Reference

#include <ppbox.hh>

Collaboration diagram for boxpp:
[legend]

List of all members.

Public Member Functions

 boxpp (Tree b, int p=0)
ostream & print (ostream &fout) const

Private Attributes

Tree box
int priority

Detailed Description

Definition at line 58 of file ppbox.hh.


Constructor & Destructor Documentation

boxpp::boxpp ( Tree  b,
int  p = 0 
) [inline]

Definition at line 63 of file ppbox.hh.

Referenced by print().

00063 : box(b), priority(p) {}

Here is the caller graph for this function:


Member Function Documentation

ostream & boxpp::print ( ostream &  fout  )  const

Definition at line 113 of file ppbox.cpp.

References box, boxpp(), ffname(), getUserData(), hd(), isBoxAbstr(), isBoxAccess(), isBoxAppl(), isBoxButton(), isBoxCase(), isBoxCheckbox(), isBoxComponent(), isBoxCut(), isBoxEnvironment(), isBoxError(), isBoxFConst(), isBoxFFun(), isBoxFVar(), isBoxHBargraph(), isBoxHGroup(), isBoxHSlider(), isBoxIdent(), isBoxInt(), isBoxIPar(), isBoxIProd(), isBoxISeq(), isBoxISum(), isBoxMerge(), isBoxNumEntry(), isBoxPar(), isBoxPatternMatcher(), isBoxPatternVar(), isBoxPrim0(), isBoxPrim1(), isBoxPrim2(), isBoxPrim3(), isBoxPrim4(), isBoxPrim5(), isBoxReal(), isBoxRec(), isBoxSeq(), isBoxSlot(), isBoxSplit(), isBoxSymbolic(), isBoxTGroup(), isBoxVBargraph(), isBoxVGroup(), isBoxVSlider(), isBoxWire(), isBoxWithLocalDef(), isClosure(), isImportFile(), isList(), isNil(), max(), min(), xtended::name(), name(), prim0name(), prim1name(), prim2name(), prim3name(), prim4name(), prim5name(), printRule(), priority, streambinop(), tl(), and tree2str().

Referenced by operator<<().

00114 {
00115     int     i, id;
00116     double  r;
00117     prim0   p0;
00118     prim1   p1;
00119     prim2   p2;
00120     prim3   p3;
00121     prim4   p4;
00122     prim5   p5;
00123 
00124     Tree    t1, t2, t3, ff, label, cur, min, max, step, type, name, file, arg,
00125             body, fun, args, abstr, genv, vis, lenv, ldef, slot,
00126             ident, rules;
00127 
00128     const char* str;
00129 
00130     xtended* xt = (xtended*) getUserData(box);
00131 
00132 
00133     // primitive elements
00134          if (xt)                        fout << xt->name();
00135     else if (isBoxInt(box, &i))         fout << i;
00136     else if (isBoxReal(box, &r))        fout << r;
00137     else if (isBoxCut(box))             fout << '!';
00138     else if (isBoxWire(box))            fout << '_';
00139     else if (isBoxIdent(box, &str))     fout << str;
00140     else if (isBoxPrim0(box, &p0))      fout << prim0name(p0);
00141     else if (isBoxPrim1(box, &p1))      fout << prim1name(p1);
00142     else if (isBoxPrim2(box, &p2))      fout << prim2name(p2);
00143     else if (isBoxPrim3(box, &p3))      fout << prim3name(p3);
00144     else if (isBoxPrim4(box, &p4))      fout << prim4name(p4);
00145     else if (isBoxPrim5(box, &p5))      fout << prim5name(p5);
00146 
00147     else if (isBoxAbstr(box,arg,body))  fout << "\\" << boxpp(arg) << ".(" << boxpp(body) << ")";
00148     else if (isBoxAppl(box, fun, args)) fout << boxpp(fun) << boxpp(args) ;
00149 
00150     else if (isBoxWithLocalDef(box, body, ldef))    fout << boxpp(body) << " with { " << envpp(ldef) << " }";
00151 
00152     // foreign elements
00153     else if (isBoxFFun(box, ff))        fout << "ffunction(" << ffname(ff) << ')';
00154     else if (isBoxFConst(box, type, name, file))
00155                                         fout << "fconstant(" /*<< tree2str(type) */<< tree2str(name) << ')';
00156     else if (isBoxFVar(box, type, name, file))
00157                                         fout << "fvariable(" << tree2str(name) << ')';
00158 
00159     // block diagram binary operator
00160     else if (isBoxSeq(box, t1, t2))     streambinop(fout, t1, ":", t2, 1, priority);
00161     else if (isBoxSplit(box, t1, t2))   streambinop(fout, t1, "<:", t2, 1, priority);
00162     else if (isBoxMerge(box, t1, t2))   streambinop(fout, t1, ":>", t2, 1, priority);
00163     else if (isBoxPar(box, t1, t2))     streambinop(fout, t1,",",t2, 2, priority);
00164     else if (isBoxRec(box, t1, t2))     streambinop(fout, t1,"~",t2, 4, priority);
00165 
00166     // iterative block diagram construction
00167     else if (isBoxIPar(box, t1, t2, t3))    fout << "par(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}";
00168     else if (isBoxISeq(box, t1, t2, t3))    fout << "seq(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}";
00169     else if (isBoxISum(box, t1, t2, t3))    fout << "sum(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}";
00170     else if (isBoxIProd(box, t1, t2, t3))   fout << "prod(" << boxpp(t1) << ", " << boxpp(t2) << ") {" << boxpp(t3) << "}";
00171 
00172     // user interface
00173     else if (isBoxButton(box, label))   fout << "button(" << tree2str(label) << ')';
00174     else if (isBoxCheckbox(box, label)) fout << "checkbox(" << tree2str(label) << ')';
00175     else if (isBoxVSlider(box, label, cur, min, max, step))     {
00176         fout << "vslider("
00177              << tree2str(label) << ", "
00178              << boxpp(cur) << ", "
00179              << boxpp(min) << ", "
00180              << boxpp(max) << ", "
00181              << boxpp(step)<< ')';
00182     }
00183     else if (isBoxHSlider(box, label, cur, min, max, step))     {
00184         fout << "hslider("
00185              << tree2str(label) << ", "
00186              << boxpp(cur) << ", "
00187              << boxpp(min) << ", "
00188              << boxpp(max) << ", "
00189              << boxpp(step)<< ')';
00190     }
00191     else if (isBoxVGroup(box, label, t1)) {
00192         fout << "vgroup(" << tree2str(label) << ", " << boxpp(t1, 0) << ')';
00193     }
00194     else if (isBoxHGroup(box, label, t1)) {
00195         fout << "hgroup(" << tree2str(label) << ", " << boxpp(t1, 0) << ')';
00196     }
00197     else if (isBoxTGroup(box, label, t1)) {
00198         fout << "tgroup(" << tree2str(label) << ", " << boxpp(t1, 0) << ')';
00199     }
00200     else if (isBoxHBargraph(box, label, min, max))  {
00201         fout << "hbargraph("
00202              << tree2str(label) << ", "
00203              << boxpp(min) << ", "
00204              << boxpp(max) << ')';
00205     }
00206     else if (isBoxVBargraph(box, label, min, max))  {
00207         fout << "vbargraph("
00208              << tree2str(label) << ", "
00209              << boxpp(min) << ", "
00210              << boxpp(max) << ')';
00211     }
00212     else if (isBoxNumEntry(box, label, cur, min, max, step))    {
00213         fout << "nentry("
00214              << tree2str(label) << ", "
00215              << boxpp(cur) << ", "
00216              << boxpp(min) << ", "
00217              << boxpp(max) << ", "
00218              << boxpp(step)<< ')';
00219     }
00220     else if (isNil(box)) {
00221         fout << "()" ;
00222     }
00223     else if (isList(box)) {
00224 
00225         Tree l = box;
00226         char sep = '(';
00227 
00228         do {
00229             fout << sep << boxpp(hd(l));
00230             sep = ',';
00231             l = tl(l);
00232         } while (isList(l));
00233 
00234         fout << ')';
00235 
00236     }
00237     else if (isBoxEnvironment(box)) {
00238         fout << "environment";
00239     }
00240     else if (isClosure(box, abstr, genv, vis, lenv)) {
00241         fout << "closure[" << boxpp(abstr)
00242             << ", genv = " << envpp(genv)
00243             << ", lenv = " << envpp(lenv)
00244             << "]";
00245     }
00246     else if (isBoxComponent(box, label)) {
00247         fout << "component("
00248             << tree2str(label) << ')';
00249     }
00250     else if (isBoxAccess(box, t1, t2)) {
00251         fout << boxpp(t1) << '.' << boxpp(t2);
00252     }
00253     else if (isImportFile(box, label)) {
00254         fout << "import("
00255             << tree2str(label) << ')';
00256     }
00257     else if (isBoxSlot(box, &id)) {
00258         fout << "#" << id;
00259     }
00260     else if (isBoxSymbolic(box, slot, body)) {
00261         fout << "[" << boxpp(slot) << ">" << boxpp(body) << "]";
00262     }
00263     
00264     // Pattern Matching Extensions
00265     else if (isBoxCase(box, rules)) {
00266         fout << "case {";
00267         while (!isNil(rules)) { printRule(fout, hd(rules)); rules = tl(rules); }
00268         fout << "}";     
00269     }
00270 #if 0
00271     // more useful for debugging output
00272     else if (isBoxPatternVar(box, ident)) {
00273         fout << "<" << boxpp(ident) << ">"; 
00274     }
00275 #else
00276     // beautify messages involving lhs patterns
00277     else if (isBoxPatternVar(box, ident)) {
00278         fout << boxpp(ident);   
00279     }
00280 #endif
00281 
00282     else if (isBoxPatternMatcher(box)) {
00283         fout << "PM[" << box << "]";    
00284     }
00285 
00286     else if (isBoxError(box)) {
00287         fout << "ERROR";    
00288     }
00289 
00290     
00291     // None of the previous tests succeded, then it is not a valid box
00292     else {
00293         cerr << "Error in box::print() : " << *box << " is not the address of a valid box" << endl;
00294         exit(1);
00295     }
00296 
00297     return fout;
00298 }

Here is the caller graph for this function:


Member Data Documentation

Tree boxpp::box [private]

Definition at line 60 of file ppbox.hh.

Referenced by print().

int boxpp::priority [private]

Definition at line 61 of file ppbox.hh.

Referenced by print().


The documentation for this class was generated from the following files:
Generated on Thu Jul 15 16:15:54 2010 for FAUST compiler by  doxygen 1.6.3