FAUST compiler  0.9.9.6b8
Public Member Functions | Private Member Functions | Private Attributes
ppsig Class Reference

#include <ppsig.hh>

Collaboration diagram for ppsig:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 48 of file ppsig.hh.


Constructor & Destructor Documentation

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().

: sig(s), fEnv(nil), fPriority(0), fHideRecursion(false)  {}

Here is the caller graph for this function:

ppsig::ppsig ( Tree  s,
Tree  env,
int  priority = 0 
) [inline, private]

Definition at line 59 of file ppsig.hh.

: sig(s), fEnv(env), fPriority(priority), fHideRecursion(false) {}

Member Function Documentation

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<<().

{
    int     i;
    double  r;
    Tree    c, sel, x, y, z, u, var, le, label, id, ff, largs, type, name, file;

          if ( isList(sig) )                        { printlist(fout, sig); }
    else if ( isProj(sig, &i, x) )                  { fout << "proj" << i << '(' << ppsig(x, fEnv) << ')';  }
    else if ( isRec(sig, var, le) )                 { printrec(fout, var, le, fHideRecursion /*&& (getRecursivness(sig)==0)*/ ); }

    // debruinj notation
    else if ( isRec(sig, le) )                      { printrec(fout, le, fHideRecursion ); }
    else if ( isRef(sig, i) )                       { fout << "REF[" << i << "]"; }
    
    else if ( getUserData(sig) )                    { printextended(fout, sig); }
    else if ( isSigInt(sig, &i) )                   { fout << i; }
    else if ( isSigReal(sig, &r) )                  { fout << r; }
    else if ( isSigInput(sig, &i) )                 { fout << "IN[" << i << "]"; }
    else if ( isSigOutput(sig, &i, x) )             { printout(fout, i, x) ; }
    
    else if ( isSigDelay1(sig, x) )                 { fout << ppsig(x, fEnv, 9) << "'"; }
    //else if ( isSigFixDelay(sig, x, y) )          { printinfix(fout, "@", 8, x, y);   }
    else if ( isSigFixDelay(sig, x, y) )            { printFixDelay(fout, x, y);    }
    else if ( isSigPrefix(sig, x, y) )              { printfun(fout, "prefix", x, y); }
    else if ( isSigIota(sig, x) )                   { printfun(fout, "iota", x); }
    else if ( isSigBinOp(sig, &i, x, y) )           { printinfix(fout, gBinOpTable[i]->fName, gBinOpTable[i]->fPriority, x, y);  }
    else if ( isSigFFun(sig, ff, largs) )           { printff(fout, ff, largs); }
    else if ( isSigFConst(sig, type, name, file) )  { fout << tree2str(name); }
    else if ( isSigFVar(sig, type, name, file) )    { fout << tree2str(name); }
    
    else if ( isSigTable(sig, id, x, y) )           { printfun(fout, "TABLE", x, y);        }
    else if ( isSigWRTbl(sig, id, x, y, z) )        { printfun(fout, "write", x, y, z); }
    else if ( isSigRDTbl(sig, x, y) )               { printfun(fout, "read", x, y); }
    else if ( isSigGen(sig, x) )                    { fout << ppsig(x, fEnv, fPriority); }

    else if ( isSigDocConstantTbl(sig, x, y) )      { printfun(fout, "docConstantTbl", x, y);   }
    else if ( isSigDocWriteTbl(sig, x, y, z, u) )   { printfun(fout, "docWriteTbl", x, y, z, u);    }
    else if ( isSigDocAccessTbl(sig, x, y) )        { printfun(fout, "docAccessTbl", x, y); }

    else if ( isSigSelect2(sig, sel, x, y) )        { printfun(fout, "select2", sel, x, y); }
    else if ( isSigSelect3(sig, sel, x, y, z) )     { printfun(fout, "select3", sel, x, y, z); }
    
    else if ( isSigIntCast(sig, x) )                { printfun(fout, "int", x); }
    else if ( isSigFloatCast(sig, x) )              { printfun(fout, "float", x);  }
    
    else if ( isSigButton(sig, label) )             { printui(fout, "button", label); }
    else if ( isSigCheckbox(sig, label) )           { printui(fout, "checkbox", label);  }
    else if ( isSigVSlider(sig, label,c,x,y,z) )    { printui(fout, "vslider", label, c, x, y, z); }
    else if ( isSigHSlider(sig, label,c,x,y,z) )    { printui(fout, "hslider", label, c, x, y, z); }
    else if ( isSigNumEntry(sig, label,c,x,y,z) )   { printui(fout, "nentry", label, c, x, y, z); }
    else if ( isSigVBargraph(sig, label,x,y,z) )    { printui(fout, "vbargraph", label, x, y, z); }
    else if ( isSigHBargraph(sig, label,x,y,z) )    { printui(fout, "hbargraph", label, x, y, z); }
    else if ( isSigAttach(sig, x, y) )              { printfun(fout, "attach", x, y); }
    
    else {
        cerr << "NOT A SIGNAL : " << *sig << endl;
        //exit(1);
    }
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{
    string      sep = "";
    xtended*    p = (xtended*) getUserData(sig);
    
    fout << p->name() << '(';
    for (int i = 0; i < sig->arity(); i++) {
        fout << sep << ppsig(sig->branch(i), fEnv);
        sep = ", ";
    }
    fout << ')';
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & ppsig::printff ( ostream &  fout,
Tree  ff,
Tree  largs 
) const [private]

Definition at line 125 of file ppsig.cpp.

References ffname(), and printlist().

Referenced by print().

{
    fout << ffname(ff); printlist(fout, largs);
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & ppsig::printFixDelay ( ostream &  fout,
Tree  exp,
Tree  delay 
) const [private]

Definition at line 131 of file ppsig.cpp.

References fEnv, isSigInt(), ppsig(), and printinfix().

Referenced by print().

{
    int     d;
    
    if (isSigInt(delay, &d) && (d==1)) {
        fout << ppsig(exp,fEnv,8) << "'";
    } else {
        printinfix(fout, "@", 8, exp, delay); 
    }
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & ppsig::printfun ( ostream &  fout,
const string &  funame,
Tree  x 
) const [private]

Definition at line 38 of file ppsig.cpp.

References fEnv, and ppsig().

Referenced by print().

{
    return fout << funame << '(' << ppsig(x,fEnv) << ')';
}

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & ppsig::printfun ( ostream &  fout,
const string &  funame,
Tree  x,
Tree  y 
) const [private]

Definition at line 43 of file ppsig.cpp.

References fEnv, and ppsig().

{
    return fout << funame << '(' << ppsig(x,fEnv) << ',' << ppsig(y,fEnv) << ')';
}

Here is the call graph for this function:

ostream & ppsig::printfun ( ostream &  fout,
const string &  funame,
Tree  x,
Tree  y,
Tree  z 
) const [private]

Definition at line 48 of file ppsig.cpp.

References fEnv, and ppsig().

{
    return fout << funame << '(' << ppsig(x,fEnv) << ',' << ppsig(y,fEnv) << ',' << ppsig(z,fEnv) << ')';
}

Here is the call graph for this function:

ostream & ppsig::printfun ( ostream &  fout,
const string &  funame,
Tree  x,
Tree  y,
Tree  z,
Tree  zz 
) const [private]

Definition at line 53 of file ppsig.cpp.

References fEnv, and ppsig().

{
    return fout << funame << '(' << ppsig(x,fEnv) << ',' << ppsig(y,fEnv) << ',' << ppsig(z,fEnv) << ',' << ppsig(zz,fEnv) << ')';
}

Here is the call graph for this function:

ostream & ppsig::printfun ( ostream &  fout,
const string &  funame,
Tree  x,
Tree  y,
Tree  z,
Tree  z2,
Tree  z3 
) const [private]

Definition at line 58 of file ppsig.cpp.

References fEnv, and ppsig().

{
    return fout << funame << '(' << ppsig(x,fEnv) << ',' << ppsig(y,fEnv) << ',' << ppsig(z,fEnv) << ',' << ppsig(z2,fEnv) << ',' << ppsig(z3,fEnv) << ')';
}

Here is the call graph for this function:

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().

{
    if (fPriority > priority) fout << "(";
    fout << ppsig(x,fEnv,priority) << opname << ppsig(y,fEnv,priority);
    if (fPriority > priority) fout << ")";
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{
    fout << *hd(pathname); 
    pathname = tl(pathname);
    while (!isNil(pathname)) { 
        fout << '/' << *tl(hd(pathname)); 
        pathname = tl(pathname);
    }
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{
    string sep = "";
    fout << '('; 
    while (!isNil(largs)) { 
        fout << sep << ppsig(hd(largs), fEnv); 
        sep = ", ";
        largs = tl(largs);
    }
    fout << ')';
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{
    if (fPriority > 0) fout << "(";
    fout << "OUT" << i << " = " << ppsig(x, fEnv, 0);   
    if (fPriority > 0) fout << ")";
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & ppsig::printrec ( ostream &  fout,
Tree  var,
Tree  lexp,
bool  hide 
) const [private]

Definition at line 145 of file ppsig.cpp.

References addElement(), fEnv, isElement(), and ppsig().

Referenced by print().

{
    if (isElement(var, fEnv) ) {
        fout << *var;
    } else if (hide) {
        fout << *var;
    } else {
        fout << "letrec(" << *var << " = " << ppsig(lexp, addElement(var, fEnv)) << ")";
    }
    return fout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ostream & ppsig::printrec ( ostream &  fout,
Tree  lexp,
bool  hide 
) const [private]

Definition at line 157 of file ppsig.cpp.

References fEnv, and ppsig().

{
    fout << "debruijn(" << ppsig(lexp,fEnv) << ")";
    return fout;
}

Here is the call graph for this function:

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().

{
    fout << funame << '(';
    printlabel(fout, label);
    return fout << ')';
}

Here is the call graph for this function:

Here is the caller graph for this function:

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().

{
    fout << funame << '(';
    printlabel(fout, label);
    return fout     
            << ',' << ppsig(lo,fEnv) 
            << ',' << ppsig(hi,fEnv) 
            << ',' << ppsig(step,fEnv) 
            << ')';
}

Here is the call graph for this function:

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().

{
    fout << funame << '(';
    printlabel(fout, label);
    return fout     
            << ',' << ppsig(cur,fEnv) 
            << ',' << ppsig(lo,fEnv) 
            << ',' << ppsig(hi,fEnv) 
            << ',' << ppsig(step,fEnv) 
            << ')';
}

Here is the call graph for this function:


Member Data Documentation

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]

Definition at line 53 of file ppsig.hh.

Referenced by print().

int ppsig::fPriority [private]

priority context

Definition at line 52 of file ppsig.hh.

Referenced by print(), printinfix(), and printout().

Tree ppsig::sig [private]

Definition at line 50 of file ppsig.hh.

Referenced by print().


The documentation for this class was generated from the following files: