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 #include <iostream> 00024 #include <fstream> 00025 #include <set> 00026 #include <time.h> 00027 #include <cstdlib> 00028 #include <errno.h> 00029 00030 #include "doc_notice.hh" 00031 #include "doc_lang.hh" 00032 #include "enrobage.hh" 00033 #include "compatibility.hh" 00034 00035 00036 map<string, bool> gDocNoticeFlagMap; 00037 00038 map<string, string> gDocNoticeStringMap; 00039 set<string> gDocNoticeKeySet; 00040 00041 extern map<string, string> gDocAutodocStringMap; 00042 00043 extern string gMasterName; 00044 00045 static void initDocNoticeKeySet(); 00046 static void initDocNoticeFlagMap(); 00047 00048 00049 00050 /***************************************************************************** 00051 Public functions 00052 *****************************************************************************/ 00053 00066 void printDocNotice(const string& faustversion, ostream& docout) { 00067 00068 if (! gDocNoticeStringMap.empty() ) { 00069 00070 //cerr << "Documentator : printDocNotice : printing..." << endl; 00071 00072 docout << endl << "\\begin{itemize}" << endl; 00073 00074 /* Presentations. */ 00075 docout << "\t\\item " << gDocAutodocStringMap["autontctext"] << endl; 00076 if(gDocNoticeFlagMap["faustapply"]) docout << "\t\\item " << gDocNoticeStringMap["faustapply"] << endl; 00077 if(gDocNoticeFlagMap["faustpresentation"]) docout << "\t\\item " << gDocNoticeStringMap["faustpresentation"] << endl; 00078 if(gDocNoticeFlagMap["causality"]) docout << "\t\\item " << gDocNoticeStringMap["causality"] << endl; 00079 if(gDocNoticeFlagMap["blockdiagrams"]) docout << "\t\\item " << gDocNoticeStringMap["blockdiagrams"] << endl; 00080 00081 /* Naming conventions of variables and functions. */ 00082 if(gDocNoticeFlagMap["foreignfun"]) docout << "\t\\item " << gDocNoticeStringMap["foreignfun"] << endl; 00083 if(gDocNoticeFlagMap["intcast"]) docout << "\t\\item " << gDocNoticeStringMap["intcast"] << endl; 00084 00085 /* Integer arithmetic into a tabular environment. */ 00086 if(gDocNoticeFlagMap["intplus"] || 00087 gDocNoticeFlagMap["intminus"] || 00088 gDocNoticeFlagMap["intmult"] || 00089 gDocNoticeFlagMap["intdiv"] || 00090 gDocNoticeFlagMap["intand"] || 00091 gDocNoticeFlagMap["intor"] || 00092 gDocNoticeFlagMap["intxor"]) 00093 { 00094 gDocNoticeFlagMap["operators"] = true; 00095 gDocNoticeFlagMap["optabtitle"] = true; 00096 gDocNoticeFlagMap["integerops"] = true; 00097 00098 docout << "\t\\item " << endl; 00099 docout << "\t\t" << gDocNoticeStringMap["operators"] << endl; 00100 docout << "\t\\begin{center}" << endl; 00101 docout << "\t\\begin{tabular}{|c|l|l|} " << endl; 00102 docout << "\t\t\\hline " << endl; 00103 docout << "\t\t" << gDocNoticeStringMap["optabtitle"] << endl; 00104 docout << "\t\t\\hline " << endl; 00105 if(gDocNoticeFlagMap["intplus"]) docout << "\t\t" << gDocNoticeStringMap["intplus"] << endl; 00106 if(gDocNoticeFlagMap["intminus"]) docout << "\t\t" << gDocNoticeStringMap["intminus"] << endl; 00107 if(gDocNoticeFlagMap["intmult"]) docout << "\t\t" << gDocNoticeStringMap["intmult"] << endl; 00108 if(gDocNoticeFlagMap["intdiv"]) docout << "\t\t" << gDocNoticeStringMap["intdiv"] << endl; 00109 if(gDocNoticeFlagMap["intand"]) docout << "\t\t" << gDocNoticeStringMap["intand"] << endl; 00110 if(gDocNoticeFlagMap["intor"]) docout << "\t\t" << gDocNoticeStringMap["intor"] << endl; 00111 if(gDocNoticeFlagMap["intxor"]) docout << "\t\t" << gDocNoticeStringMap["intxor"] << endl; 00112 docout << "\t\t\\hline " << endl; 00113 docout << "\t\\end{tabular} " << endl; 00114 docout << "\t\\end{center}" << endl; 00115 docout << "\t\t" << gDocNoticeStringMap["integerops"] << endl; 00116 } 00117 00118 if(gDocNoticeFlagMap["faustdocdir"]) docout << "\t\\item " << gDocNoticeStringMap["faustdocdir"] << endl; 00119 00120 docout << "\\end{itemize}" << endl << endl; 00121 } 00122 //cerr << " ... Documentator : printDocNotice : end of printing." << endl; 00123 } 00124 00125 00134 void initDocNotice() 00135 { 00136 initDocNoticeKeySet(); 00137 initDocNoticeFlagMap(); 00138 } 00139 00140 00141 00142 00143 /***************************************************************************** 00144 Static functions 00145 *****************************************************************************/ 00146 00147 00151 static void initDocNoticeKeySet() { 00152 00153 gDocNoticeKeySet.insert("faustpresentation"); 00154 gDocNoticeKeySet.insert("faustapply"); 00155 gDocNoticeKeySet.insert("faustdocdir"); 00156 gDocNoticeKeySet.insert("causality"); 00157 gDocNoticeKeySet.insert("blockdiagrams"); 00158 00159 gDocNoticeKeySet.insert("foreignfun"); 00160 gDocNoticeKeySet.insert("intcast"); 00161 00162 gDocNoticeKeySet.insert("operators"); 00163 gDocNoticeKeySet.insert("optabtitle"); 00164 gDocNoticeKeySet.insert("integerops"); 00165 gDocNoticeKeySet.insert("intplus"); 00166 gDocNoticeKeySet.insert("intminus"); 00167 gDocNoticeKeySet.insert("intmult"); 00168 gDocNoticeKeySet.insert("intdiv"); 00169 gDocNoticeKeySet.insert("intand"); 00170 gDocNoticeKeySet.insert("intor"); 00171 gDocNoticeKeySet.insert("intxor"); 00172 } 00173 00174 00178 static void initDocNoticeFlagMap() { 00179 00180 for (set<string>::iterator it=gDocNoticeKeySet.begin(); it != gDocNoticeKeySet.end() ; ++it ) { 00181 gDocNoticeFlagMap[*it] = false; 00182 } 00183 gDocNoticeFlagMap["faustpresentation"] = true; 00184 gDocNoticeFlagMap["faustapply"] = true; 00185 gDocNoticeFlagMap["faustdocdir"] = true; 00186 gDocNoticeFlagMap["causality"] = true; 00187 gDocNoticeFlagMap["blockdiagrams"] = true; 00188 } 00189