FAUST compiler  0.9.9.6b8
ppsig.hh
Go to the documentation of this file.
00001 /************************************************************************
00002  ************************************************************************
00003     FAUST compiler
00004     Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
00005     ---------------------------------------------------------------------
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  ************************************************************************
00020  ************************************************************************/
00021 
00022 
00023 
00024 #ifndef _PPSIG_H
00025 #define _PPSIG_H
00026 
00027 /**********************************************************************
00028             - ppsig.h : pretty print signals expressions (projet FAUST) -
00029 
00030 
00031         Historique :
00032         -----------
00033         05-07-2006  first implementation  (yo)
00034 
00035 ***********************************************************************/
00036 
00037 #include <iostream>
00038 #include <sstream>
00039 #include "signals.hh"
00040 
00041 using namespace std;
00042 
00043 //void      fppbox (FILE* fout, Tree box, int priority=0);
00044 
00045 // box pretty printer.
00046 // usage : out << boxpp(aBoxExp);
00047 
00048 class ppsig
00049 {
00050     Tree    sig;
00051     Tree    fEnv;       
00052     int     fPriority;  
00053     bool    fHideRecursion;     
00054 public:
00055     ppsig(Tree s) : sig(s), fEnv(nil), fPriority(0), fHideRecursion(false)  {}
00056     ostream& print (ostream& fout) const;
00057 
00058 private:
00059     ppsig(Tree s, Tree env, int priority=0) : sig(s), fEnv(env), fPriority(priority), fHideRecursion(false) {}
00060     ostream& printinfix (ostream& fout, const string& opname, int priority, Tree x, Tree y) const;
00061     ostream& printfun (ostream& fout, const string& funame, Tree x) const;
00062     ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y) const;
00063     ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y, Tree z) const;
00064     ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y, Tree z, Tree zz) const;
00065     ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y, Tree z, Tree z2, Tree z3) const;
00066     ostream& printout (ostream& fout, int i, Tree x) const;
00067     ostream& printlist (ostream& fout, Tree largs) const;
00068     ostream& printff (ostream& fout, Tree ff, Tree largs) const;
00069     ostream& printrec (ostream& fout, Tree var, Tree lexp, bool hide) const;
00070     ostream& printrec (ostream& fout, Tree lexp, bool hide) const;
00071     ostream& printextended (ostream& fout, Tree sig) const;
00072     ostream& printui (ostream& fout, const string& funame, Tree label) const;
00073     ostream& printui (ostream& fout, const string& funame, Tree label, Tree lo, Tree hi, Tree step) const;
00074     ostream& printui (ostream& fout, const string& funame, Tree label, Tree cur, Tree lo, Tree hi, Tree step) const;
00075     ostream& printlabel (ostream& fout, Tree pathname) const;
00076     ostream& printFixDelay (ostream& fout, Tree exp, Tree delay) const;
00077 
00078 };
00079 
00080 inline ostream& operator << (ostream& file, const ppsig& pp) { return pp.print(file); }
00081 
00082 #endif