FAUST compiler  0.9.9.6b8
compile.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 _COMPILE_
00025 #define _COMPILE_
00026 
00027 
00028 #include "signals.hh"
00029 #include "klass.hh"
00030 #include "Text.hh"
00031 #include "uitree.hh"
00032 #include <string>
00033 #include <list>
00034 #include <stack>
00035 #include <map>
00036 
00037 #include "description.hh"
00038 
00040 
00045 
00046 
00047 #define kMaxHeight 1024
00048 
00049 
00050 class Compiler
00051 {
00052 protected:
00053     Klass*          fClass;
00054     bool            fNeedToDeleteClass;
00055     Tree            fUIRoot;
00056     Description*    fDescription;
00057 
00058 public:
00059     Compiler (const string& name, const string& super, int numInputs, int numOutputs, bool vec);
00060     Compiler (Klass* k);
00061 
00062     virtual ~Compiler();
00063 
00064     virtual void        compileMultiSignal  (Tree lsig) = 0;
00065     virtual void        compileSingleSignal (Tree lsig) = 0;
00066 
00067     Klass*              getClass() { return (Klass*)fClass; }
00068 
00069     void                setDescription(Description* descr)  { fDescription= descr; }
00070     Description*        getDescription()                    { return fDescription; }
00071 
00072 protected:
00073   virtual Tree      prepare (Tree L0) = 0;
00074   virtual Tree      prepare2 (Tree L0) = 0;
00075 
00076 // gestion des includes et librairies
00077     void        addIncludeFile (const string& str)  { fClass->addIncludeFile(str);  }
00078     void        addLibrary (const string& str)      { fClass->addLibrary(str);      }
00079 
00080 // gestion de la description arborescente de l'IU
00081     void        addUIWidget(Tree path, Tree widget);
00082     void        generateWidgetCode(Tree fulllabel, Tree varname, Tree sig);
00083     void        generateUserInterfaceTree(Tree t);
00084     void        generateUserInterfaceElements(Tree elements);
00085     Tree        prepareUserInterfaceTree(Tree t);
00086 
00087     void        generateMacroInterfaceTree(const string& pathname, Tree t);
00088     void        generateMacroInterfaceElements(const string& pathname, Tree elements);
00089     void        generateWidgetMacro(const string& pathname, Tree fulllabel, Tree varname, Tree sig);
00090 
00091 
00092 };
00093 #define generateEquivRecGroup generateRecGroup
00094 
00095 
00096 void compileSignals (const string& name, const string& super, int numInputs, int numOutputs, Tree lsig);
00097 
00098 #endif