33eaa143ad295d457a359447bc47e31ed4146cf8
[Faustine.git] / interpretor / faust-0.9.47mr3 / compiler / headers / ppbox.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 _PPBOX_H
25 #define _PPBOX_H
26
27 /**********************************************************************
28 - ppbox.h : pretty print box expressions (projet FAUST) -
29
30
31 Historique :
32 -----------
33 12-07-2002 first implementation (yo)
34
35 ***********************************************************************/
36
37 #include <iostream>
38 #include <sstream>
39 #include "boxes.hh"
40
41 using namespace std;
42
43 //void fppbox (FILE* fout, Tree box, int priority=0);
44 //inline void ppbox (Tree box, int priority=0) { fppbox(stdout, box, priority); }
45
46
47 const char * prim0name(CTree *(*ptr) ());
48 const char * prim1name(CTree *(*ptr) (CTree *));
49 const char * prim2name(CTree *(*ptr) (CTree *, CTree *));
50 const char * prim3name(CTree *(*ptr) (CTree *, CTree *, CTree *));
51 const char * prim4name(CTree *(*ptr) (CTree *, CTree *, CTree *, CTree *));
52 const char * prim5name(CTree *(*ptr) (CTree *, CTree *, CTree *, CTree *, CTree *));
53
54
55 // box pretty printer.
56 // usage : out << boxpp(aBoxExp);
57
58 class boxpp
59 {
60 Tree box;
61 int priority;
62 public:
63 boxpp(Tree b, int p=0) : box(b), priority(p) {}
64 ostream& print (ostream& fout) const;
65 };
66
67 inline ostream& operator << (ostream& file, const boxpp& bpp) { return bpp.print(file); }
68
69
70 // box pretty printer.
71 // usage : out << boxpp(aBoxExp);
72
73 class envpp
74 {
75 Tree fEnv;
76 public:
77 envpp(Tree e) : fEnv(e) {}
78 ostream& print (ostream& fout) const;
79 };
80
81 inline ostream& operator << (ostream& file, const envpp& epp) { return epp.print(file); }
82
83
84 #endif