FAUST compiler  0.9.9.6b8
ppsig.hh
Go to the documentation of this file.
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 {
52  int fPriority;
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
ostream & operator<<(ostream &file, const ppsig &pp)
Definition: ppsig.hh:80
static bool printlist(Tree l, FILE *out)
Definition: list.cpp:123
int fPriority
priority context
Definition: ppsig.hh:52
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
ppsig(Tree s, Tree env, int priority=0)
Definition: ppsig.hh:59
Definition: ppsig.hh:48
Tree sig
Definition: ppsig.hh:50
Tree fEnv
recursive environment stack
Definition: ppsig.hh:51
ppsig(Tree s)
Definition: ppsig.hh:55
Tree nil
Definition: list.cpp:116
bool fHideRecursion
Definition: ppsig.hh:53
ostream & print(ostream &fout) const
Definition: ppsig.cpp:179
void print(Tree t, FILE *out)
Definition: list.cpp:154