FAUST compiler  0.9.9.6b8
ppbox.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 _PPBOX_H
00025 #define _PPBOX_H
00026 
00027 /**********************************************************************
00028             - ppbox.h : pretty print box expressions (projet FAUST) -
00029                     
00030 
00031         Historique :
00032         -----------
00033         12-07-2002  first implementation  (yo)
00034         
00035 ***********************************************************************/
00036 
00037 #include <iostream>
00038 #include <sstream>
00039 #include "boxes.hh"
00040 
00041 using namespace std;
00042 
00043 //void      fppbox (FILE* fout, Tree box, int priority=0);
00044 //inline void   ppbox  (Tree box, int priority=0)                   { fppbox(stdout, box, priority); }
00045 
00046 
00047 const char * prim0name(CTree *(*ptr) ());
00048 const char * prim1name(CTree *(*ptr) (CTree *));
00049 const char * prim2name(CTree *(*ptr) (CTree *, CTree *));
00050 const char * prim3name(CTree *(*ptr) (CTree *, CTree *, CTree *));
00051 const char * prim4name(CTree *(*ptr) (CTree *, CTree *, CTree *, CTree *));
00052 const char * prim5name(CTree *(*ptr) (CTree *, CTree *, CTree *, CTree *, CTree *));
00053 
00054 
00055 // box pretty printer.
00056 // usage : out << boxpp(aBoxExp);
00057 
00058 class boxpp
00059 {
00060     Tree    box;
00061     int     priority;
00062 public:
00063     boxpp(Tree b, int p=0) : box(b), priority(p) {}
00064     ostream& print (ostream& fout) const;
00065 };
00066 
00067 inline ostream& operator << (ostream& file, const boxpp& bpp) { return bpp.print(file); }
00068 
00069 
00070 // box pretty printer.
00071 // usage : out << boxpp(aBoxExp);
00072 
00073 class envpp
00074 {
00075     Tree    fEnv;
00076 public:
00077     envpp(Tree e) : fEnv(e) {}
00078     ostream& print (ostream& fout) const;
00079 };
00080 
00081 inline ostream& operator << (ostream& file, const envpp& epp) { return epp.print(file); }
00082 
00083 
00084 #endif