1 /************************************************************************
2 ************************************************************************
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.
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.
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 ************************************************************************/
30 #include "doc_notice.hh"
31 #include "doc_lang.hh"
32 #include "enrobage.hh"
33 #include "compatibility.hh"
36 map
<string
, bool> gDocNoticeFlagMap
;
38 map
<string
, string
> gDocNoticeStringMap
;
39 set
<string
> gDocNoticeKeySet
;
41 extern map
<string
, string
> gDocAutodocStringMap
;
43 extern string gMasterName
;
45 static void initDocNoticeKeySet();
46 static void initDocNoticeFlagMap();
50 /*****************************************************************************
52 *****************************************************************************/
55 * Print the content of the notice (a string map),
56 * as LaTeX items inside an itemize environment.
59 * This function is meant to make it easier to reorder
60 * the notice printing by gathering all the items.
62 * @param[in] notice The set containing the strings to print as items.
63 * @param[in] faustversion The current version of this Faust compiler.
64 * @param[out] docout The LaTeX output file to print into.
66 void printDocNotice(const string
& faustversion
, ostream
& docout
) {
68 if (! gDocNoticeStringMap
.empty() ) {
70 //cerr << "Documentator : printDocNotice : printing..." << endl;
72 docout
<< endl
<< "\\begin{itemize}" << endl
;
75 docout
<< "\t\\item " << gDocAutodocStringMap
["autontctext"] << endl
;
76 if(gDocNoticeFlagMap
["faustapply"]) docout
<< "\t\\item " << gDocNoticeStringMap
["faustapply"] << endl
;
77 if(gDocNoticeFlagMap
["faustpresentation"]) docout
<< "\t\\item " << gDocNoticeStringMap
["faustpresentation"] << endl
;
78 if(gDocNoticeFlagMap
["causality"]) docout
<< "\t\\item " << gDocNoticeStringMap
["causality"] << endl
;
79 if(gDocNoticeFlagMap
["blockdiagrams"]) docout
<< "\t\\item " << gDocNoticeStringMap
["blockdiagrams"] << endl
;
81 /* Naming conventions of variables and functions. */
82 if(gDocNoticeFlagMap
["foreignfun"]) docout
<< "\t\\item " << gDocNoticeStringMap
["foreignfun"] << endl
;
83 if(gDocNoticeFlagMap
["intcast"]) docout
<< "\t\\item " << gDocNoticeStringMap
["intcast"] << endl
;
85 /* Integer arithmetic into a tabular environment. */
86 if(gDocNoticeFlagMap
["intplus"] ||
87 gDocNoticeFlagMap
["intminus"] ||
88 gDocNoticeFlagMap
["intmult"] ||
89 gDocNoticeFlagMap
["intdiv"] ||
90 gDocNoticeFlagMap
["intand"] ||
91 gDocNoticeFlagMap
["intor"] ||
92 gDocNoticeFlagMap
["intxor"])
94 gDocNoticeFlagMap
["operators"] = true;
95 gDocNoticeFlagMap
["optabtitle"] = true;
96 gDocNoticeFlagMap
["integerops"] = true;
98 docout
<< "\t\\item " << endl
;
99 docout
<< "\t\t" << gDocNoticeStringMap
["operators"] << endl
;
100 docout
<< "\t\\begin{center}" << endl
;
101 docout
<< "\t\\begin{tabular}{|c|l|l|} " << endl
;
102 docout
<< "\t\t\\hline " << endl
;
103 docout
<< "\t\t" << gDocNoticeStringMap
["optabtitle"] << endl
;
104 docout
<< "\t\t\\hline " << endl
;
105 if(gDocNoticeFlagMap
["intplus"]) docout
<< "\t\t" << gDocNoticeStringMap
["intplus"] << endl
;
106 if(gDocNoticeFlagMap
["intminus"]) docout
<< "\t\t" << gDocNoticeStringMap
["intminus"] << endl
;
107 if(gDocNoticeFlagMap
["intmult"]) docout
<< "\t\t" << gDocNoticeStringMap
["intmult"] << endl
;
108 if(gDocNoticeFlagMap
["intdiv"]) docout
<< "\t\t" << gDocNoticeStringMap
["intdiv"] << endl
;
109 if(gDocNoticeFlagMap
["intand"]) docout
<< "\t\t" << gDocNoticeStringMap
["intand"] << endl
;
110 if(gDocNoticeFlagMap
["intor"]) docout
<< "\t\t" << gDocNoticeStringMap
["intor"] << endl
;
111 if(gDocNoticeFlagMap
["intxor"]) docout
<< "\t\t" << gDocNoticeStringMap
["intxor"] << endl
;
112 docout
<< "\t\t\\hline " << endl
;
113 docout
<< "\t\\end{tabular} " << endl
;
114 docout
<< "\t\\end{center}" << endl
;
115 docout
<< "\t\t" << gDocNoticeStringMap
["integerops"] << endl
;
118 if(gDocNoticeFlagMap
["faustdocdir"]) docout
<< "\t\\item " << gDocNoticeStringMap
["faustdocdir"] << endl
;
120 docout
<< "\\end{itemize}" << endl
<< endl
;
122 //cerr << " ... Documentator : printDocNotice : end of printing." << endl;
127 * Dispatch initialization of notice containers,
128 * after default notice file loading.
131 * The default (english) notice is already loaded at this stage
132 * to ensure that all keywords will receive a definition.
136 initDocNoticeKeySet();
137 initDocNoticeFlagMap();
143 /*****************************************************************************
145 *****************************************************************************/
149 * Initialize gDocNoticeKeySet, a set containing all the keywords.
151 static void initDocNoticeKeySet() {
153 gDocNoticeKeySet
.insert("faustpresentation");
154 gDocNoticeKeySet
.insert("faustapply");
155 gDocNoticeKeySet
.insert("faustdocdir");
156 gDocNoticeKeySet
.insert("causality");
157 gDocNoticeKeySet
.insert("blockdiagrams");
159 gDocNoticeKeySet
.insert("foreignfun");
160 gDocNoticeKeySet
.insert("intcast");
162 gDocNoticeKeySet
.insert("operators");
163 gDocNoticeKeySet
.insert("optabtitle");
164 gDocNoticeKeySet
.insert("integerops");
165 gDocNoticeKeySet
.insert("intplus");
166 gDocNoticeKeySet
.insert("intminus");
167 gDocNoticeKeySet
.insert("intmult");
168 gDocNoticeKeySet
.insert("intdiv");
169 gDocNoticeKeySet
.insert("intand");
170 gDocNoticeKeySet
.insert("intor");
171 gDocNoticeKeySet
.insert("intxor");
176 * Initialize gDocNoticeFlagMap, a map containing all the flags.
178 static void initDocNoticeFlagMap() {
180 for (set
<string
>::iterator it
=gDocNoticeKeySet
.begin(); it
!= gDocNoticeKeySet
.end() ; ++it
) {
181 gDocNoticeFlagMap
[*it
] = false;
183 gDocNoticeFlagMap
["faustpresentation"] = true;
184 gDocNoticeFlagMap
["faustapply"] = true;
185 gDocNoticeFlagMap
["faustdocdir"] = true;
186 gDocNoticeFlagMap
["causality"] = true;
187 gDocNoticeFlagMap
["blockdiagrams"] = true;