f887b86296fdad268c5358bb7655b32e6596dd1d
[Faustine.git] / interpretor / faust-0.9.47mr3 / compiler / headers / ppsig.hh
1 /************************************************************************
2 ************************************************************************
3 FAUST compiler
4 Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale
5 ---------------------------------------------------------------------
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ************************************************************************
20 ************************************************************************/
21
22
23
24 #ifndef _PPSIG_H
25 #define _PPSIG_H
26
27 /**********************************************************************
28 - ppsig.h : pretty print signals expressions (projet FAUST) -
29
30
31 Historique :
32 -----------
33 05-07-2006 first implementation (yo)
34
35 ***********************************************************************/
36
37 #include <iostream>
38 #include <sstream>
39 #include "signals.hh"
40
41 using namespace std;
42
43 //void fppbox (FILE* fout, Tree box, int priority=0);
44
45 // box pretty printer.
46 // usage : out << boxpp(aBoxExp);
47
48 class ppsig
49 {
50 Tree sig;
51 Tree fEnv; ///< recursive environment stack
52 int fPriority; ///< priority context
53 bool fHideRecursion; ///<
54 public:
55 ppsig(Tree s) : sig(s), fEnv(nil), fPriority(0), fHideRecursion(false) {}
56 ostream& print (ostream& fout) const;
57
58 private:
59 ppsig(Tree s, Tree env, int priority=0) : sig(s), fEnv(env), fPriority(priority), fHideRecursion(false) {}
60 ostream& printinfix (ostream& fout, const string& opname, int priority, Tree x, Tree y) const;
61 ostream& printfun (ostream& fout, const string& funame, Tree x) const;
62 ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y) const;
63 ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y, Tree z) const;
64 ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y, Tree z, Tree zz) const;
65 ostream& printfun (ostream& fout, const string& funame, Tree x, Tree y, Tree z, Tree z2, Tree z3) const;
66 ostream& printout (ostream& fout, int i, Tree x) const;
67 ostream& printlist (ostream& fout, Tree largs) const;
68 ostream& printff (ostream& fout, Tree ff, Tree largs) const;
69 ostream& printrec (ostream& fout, Tree var, Tree lexp, bool hide) const;
70 ostream& printrec (ostream& fout, Tree lexp, bool hide) const;
71 ostream& printextended (ostream& fout, Tree sig) const;
72 ostream& printui (ostream& fout, const string& funame, Tree label) const;
73 ostream& printui (ostream& fout, const string& funame, Tree label, Tree lo, Tree hi, Tree step) const;
74 ostream& printui (ostream& fout, const string& funame, Tree label, Tree cur, Tree lo, Tree hi, Tree step) const;
75 ostream& printlabel (ostream& fout, Tree pathname) const;
76 ostream& printFixDelay (ostream& fout, Tree exp, Tree delay) const;
77
78 };
79
80 inline ostream& operator << (ostream& file, const ppsig& pp) { return pp.print(file); }
81
82 #endif