FAUST compiler  0.9.9.6b8
compile.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 _COMPILE_
25 #define _COMPILE_
26 
27 
28 #include "signals.hh"
29 #include "klass.hh"
30 #include "Text.hh"
31 #include "uitree.hh"
32 #include <string>
33 #include <list>
34 #include <stack>
35 #include <map>
36 
37 #include "description.hh"
38 
40 
45 
47 #define kMaxHeight 1024
48 
49 
50 class Compiler
51 {
52 protected:
57 
58 public:
59  Compiler (const string& name, const string& super, int numInputs, int numOutputs, bool vec);
60  Compiler (Klass* k);
61 
62  virtual ~Compiler();
63 
64  virtual void compileMultiSignal (Tree lsig) = 0;
65  virtual void compileSingleSignal (Tree lsig) = 0;
66 
67  Klass* getClass() { return (Klass*)fClass; }
68 
69  void setDescription(Description* descr) { fDescription= descr; }
71 
72 protected:
73  virtual Tree prepare (Tree L0) = 0;
74  virtual Tree prepare2 (Tree L0) = 0;
75 
76 // gestion des includes et librairies
77  void addIncludeFile (const string& str) { fClass->addIncludeFile(str); }
78  void addLibrary (const string& str) { fClass->addLibrary(str); }
79 
80 // gestion de la description arborescente de l'IU
81  void addUIWidget(Tree path, Tree widget);
82  void generateWidgetCode(Tree fulllabel, Tree varname, Tree sig);
84  void generateUserInterfaceElements(Tree elements);
86 
87  void generateMacroInterfaceTree(const string& pathname, Tree t);
88  void generateMacroInterfaceElements(const string& pathname, Tree elements);
89  void generateWidgetMacro(const string& pathname, Tree fulllabel, Tree varname, Tree sig);
90 
91 
92 };
93 #define generateEquivRecGroup generateRecGroup
94 
95 
96 void compileSignals (const string& name, const string& super, int numInputs, int numOutputs, Tree lsig);
97 
98 #endif
virtual void compileMultiSignal(Tree lsig)=0
void addLibrary(const string &str)
Definition: klass.hh:139
void addIncludeFile(const string &str)
Definition: klass.hh:137
void addIncludeFile(const string &str)
Definition: compile.hh:77
void generateWidgetCode(Tree fulllabel, Tree varname, Tree sig)
Generate buildUserInterface C++ lines of code corresponding to user interface widget t...
Definition: compile.cpp:229
Description * fDescription
Definition: compile.hh:56
Klass * fClass
Definition: compile.hh:53
void addUIWidget(Tree path, Tree widget)
Add a widget with a certain path to the user interface tree.
Definition: compile.cpp:123
void compileSignals(const string &name, const string &super, int numInputs, int numOutputs, Tree lsig)
Tree prepareUserInterfaceTree(Tree t)
Remove fake root folder if not needed (that is if the UI is completely enclosed in one folder...
Definition: compile.cpp:133
void generateUserInterfaceTree(Tree t)
Generate buildUserInterface C++ lines of code corresponding to user interface element t...
Definition: compile.cpp:164
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
bool fNeedToDeleteClass
Definition: compile.hh:54
Tree fUIRoot
Definition: compile.hh:55
Compiler(const string &name, const string &super, int numInputs, int numOutputs, bool vec)
Definition: compile.cpp:94
void generateMacroInterfaceTree(const string &pathname, Tree t)
Generate user interface macros corresponding to user interface element t.
Definition: compile.cpp:312
void addLibrary(const string &str)
Definition: compile.hh:78
virtual Tree prepare(Tree L0)=0
void setDescription(Description *descr)
Definition: compile.hh:69
virtual void compileSingleSignal(Tree lsig)=0
Definition: klass.hh:55
virtual ~Compiler()
Definition: compile.cpp:109
virtual Tree prepare2(Tree L0)=0
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
void generateUserInterfaceElements(Tree elements)
Iterate generateUserInterfaceTree on a list of user interface elements.
Definition: compile.cpp:217
Description * getDescription()
Definition: compile.hh:70
void generateMacroInterfaceElements(const string &pathname, Tree elements)
Iterate generateMacroInterfaceTree on a list of user interface elements.
Definition: compile.cpp:339
void generateWidgetMacro(const string &pathname, Tree fulllabel, Tree varname, Tree sig)
Generate user interface macros corresponding to a user interface widget.
Definition: compile.cpp:352
Klass * getClass()
Definition: compile.hh:67