Examples' Makefiles are completed and tested.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / documentator / lateq.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 _LATEQ_H
25 #define _LATEQ_H
26
27 /**********************************************************************
28 - lateq.hh : the Lateq class definition (FAUST project) -
29 - for automatic generation of documentation -
30 - "lateq" stands for "LaTeX equations" -
31 - Several containers store LaTeX formulas by type of signals -
32 - Formulas usually are signal definitions,
33 except for input signals (only names). -
34
35
36 Historique :
37 -----------
38 17-10-2001 : (klass.hh) implementation initiale (yo)
39 18-10-2001 : (klass.hh) Ajout de getFreshID (yo)
40 02-11-2001 : (klass.hh) Ajout de sous classes (yo)
41 16-08-2009 : (lateq.hh) Création de lateq depuis klass.hh (kb)
42 08-09-2009 : (lateq.hh) Grand nettoyage par le vide (yo & kb)
43 23-09-2009 : (lateq.hh) Poursuite du nettoyage (kb)
44 2009-11-23 : (lateq.hh) End of cleaning (kb)
45
46 ***********************************************************************/
47
48 using namespace std;
49
50 #include <string>
51 #include <list>
52 #include <vector>
53 #include <map>
54
55
56 class Lateq {
57
58 public:
59
60 Lateq (const int& numInputs, const int& numOutputs)
61 : fNumInputs(numInputs), fNumOutputs(numOutputs)
62 {}
63
64 ~Lateq() {}
65
66 /** Add a line of a latex equation code corresponding to a signal. */
67 void addInputSigFormula (const string& str) { fInputSigsFormulas.push_back(str); }
68 void addConstSigFormula (const string& str) { fConstSigsFormulas.push_back(str); }
69 void addParamSigFormula (const string& str) { fParamSigsFormulas.push_back(str); }
70 void addStoreSigFormula (const string& str) { fStoreSigsFormulas.push_back(str); }
71 void addRecurSigFormula (const string& str) { fRecurSigsFormulas.push_back(str); }
72 void addRDTblSigFormula (const string& str) { fRDTblSigsFormulas.push_back(str); }
73 void addRWTblSigFormula (const string& str) { fRWTblSigsFormulas.push_back(str); }
74 void addSelectSigFormula (const string& str) { fSelectSigsFormulas.push_back(str); }
75 void addPrefixSigFormula (const string& str) { fPrefixSigsFormulas.push_back(str); }
76 void addOutputSigFormula (const string& str) { fOutputSigsFormulas.push_back(str); }
77 void addUISigFormula (const string& path, const string& str) { fUISigsFormulas.insert(make_pair(path, str)); };
78
79 /** Top-level method to print a whole set of compiled LaTeX formulas. */
80 void println(ostream& docout);
81
82 int inputs() const { return fNumInputs; }
83 int outputs() const { return fNumOutputs; }
84
85
86 private:
87
88 const int fNumInputs;
89 const int fNumOutputs;
90
91 /** LaTeX formulas to print. */
92 list<string> fInputSigsFormulas;
93 list<string> fConstSigsFormulas;
94 list<string> fParamSigsFormulas;
95 list<string> fStoreSigsFormulas;
96 list<string> fRecurSigsFormulas;
97 list<string> fRDTblSigsFormulas;
98 list<string> fRWTblSigsFormulas;
99 list<string> fSelectSigsFormulas;
100 list<string> fPrefixSigsFormulas;
101 list<string> fOutputSigsFormulas;
102 multimap<string,string> fUISigsFormulas;
103
104 string makeItemTitle(const unsigned int formulasListSize, const string& titleName);
105 string makeSignamesList(const list<string>& formulasList, const string& ending);
106 string makeSignamesList(const vector<list<string> >& formulasListsVector, const string& ending); ///< For all "internal" signals.
107 string getSigName(const string& s);
108 string makeSigDomain(const list<string>& formulasList);
109 string getUISigName(const string& s);
110 char getUISigType(const string& s);
111 vector<list<string> > makeUISignamesVector(const multimap<string,string>& field);
112
113 void printOneLine (const string& section, ostream& docout);
114 void printHierarchy (const string& section, multimap<string,string>& field, ostream& docout);
115 void printDGroup (const string& section, list<string>& field, ostream& docout);
116 void printMath (const string& section, list<string>& field, ostream& docout);
117
118 bool hasNotOnlyEmptyKeys(multimap<string,string>& mm);
119 void tab(int n, ostream& docout) const;
120 };
121
122 void initDocMath();
123
124
125 #endif