|
FAUST compiler
0.9.9.6b8
|
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 _LOOP_H 00025 #define _LOOP_H 00026 00027 /********************************************************************** 00028 - loop.hh : loop C++ à remplir (projet FAUST) - 00029 00030 00031 Historique : 00032 ----------- 00033 21-01-2008 : implementation initiale (yo) 00034 00035 ***********************************************************************/ 00036 namespace std{} 00037 using namespace std; 00038 00039 #include <string> 00040 #include <list> 00041 #include <stack> 00042 #include <set> 00043 #include <map> 00044 #include "tlib.hh" 00045 00046 #define kMaxCategory 32 00047 00048 /* 00049 * Loops are lines of code that correspond to a recursive expression or a vector expression. 00050 */ 00051 00052 struct Loop 00053 { 00054 const bool fIsRecursive; 00055 Tree fRecSymbolSet; 00056 Loop* const fEnclosingLoop; 00057 const string fSize; 00058 // fields concerned by absorbsion 00059 set<Loop*> fBackwardLoopDependencies; 00060 set<Loop*> fForwardLoopDependencies; 00061 list<string> fPreCode; 00062 list<string> fExecCode; 00063 list<string> fPostCode; 00064 // for topological sort 00065 int fOrder; 00066 int fIndex; 00067 // new fields 00068 int fUseCount; 00069 list<Loop*> fExtraLoops; 00070 00071 int fPrinted; 00072 00073 public: 00074 Loop(Tree recsymbol, Loop* encl, const string& size); 00075 Loop(Loop* encl, const string& size); 00076 00077 bool isEmpty(); 00078 bool hasRecDependencyIn(Tree S); 00079 00080 void addPreCode (const string& str); 00081 void addExecCode (const string& str); 00082 void addPostCode (const string& str); 00083 void println (int n, ostream& fout); 00084 void printParLoopln(int n, ostream& fout); 00085 00086 void printoneln (int n, ostream& fout); 00087 00088 void absorb(Loop* l); 00089 // new method 00090 void concat(Loop* l); 00091 }; 00092 00093 #endif
1.8.0