#include <lateq.hh>
Public Member Functions | |
Lateq (const int &numInputs, const int &numOutputs) | |
~Lateq () | |
void | addInputSigFormula (const string &str) |
Add a line of a latex equation code corresponding to a signal. | |
void | addConstSigFormula (const string &str) |
void | addParamSigFormula (const string &str) |
void | addStoreSigFormula (const string &str) |
void | addRecurSigFormula (const string &str) |
void | addRDTblSigFormula (const string &str) |
void | addRWTblSigFormula (const string &str) |
void | addSelectSigFormula (const string &str) |
void | addPrefixSigFormula (const string &str) |
void | addOutputSigFormula (const string &str) |
void | addUISigFormula (const string &path, const string &str) |
void | println (ostream &docout) |
Top-level method to print a whole set of compiled LaTeX formulas. | |
int | inputs () const |
int | outputs () const |
Private Member Functions | |
void | printOneLine (const string §ion, list< string > &field, ostream &docout) |
Print a sorted list of input signals names ("x_i(t)"), on a single line, separated by commas. | |
void | printHierarchy (const string §ion, multimap< string, string > &field, ostream &docout) |
Print formulas for user interface signals. | |
void | printDGroup (const string §ion, list< string > &field, ostream &docout) |
Print a dgroup environment to auto-break long formulas. | |
void | printMath (const string §ion, list< string > &field, ostream &docout) |
Print formulas for select2, select3 and prefix signals. | |
bool | hasNotOnlyEmptyKeys (multimap< string, string > &mm) |
Find out whether all keys of the multimap are empty or not. | |
void | tab (int n, ostream &docout) const |
Simple handling of indentation. | |
Private Attributes | |
const int | fNumInputs |
const int | fNumOutputs |
list< string > | fInputSigsFormulas |
LaTeX formulas to print. | |
list< string > | fConstSigsFormulas |
list< string > | fParamSigsFormulas |
list< string > | fStoreSigsFormulas |
list< string > | fRecurSigsFormulas |
list< string > | fRDTblSigsFormulas |
list< string > | fRWTblSigsFormulas |
list< string > | fSelectSigsFormulas |
list< string > | fPrefixSigsFormulas |
list< string > | fOutputSigsFormulas |
multimap< string, string > | fUISigsFormulas |
Definition at line 55 of file lateq.hh.
Lateq::Lateq | ( | const int & | numInputs, | |
const int & | numOutputs | |||
) | [inline] |
Definition at line 59 of file lateq.hh.
00060 : fNumInputs(numInputs), fNumOutputs(numOutputs) 00061 {}
void Lateq::addConstSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 67 of file lateq.hh.
References fConstSigsFormulas.
Referenced by DocCompiler::generateVariableStore().
00067 { fConstSigsFormulas.push_back(str); }
void Lateq::addInputSigFormula | ( | const string & | str | ) | [inline] |
Add a line of a latex equation code corresponding to a signal.
Definition at line 66 of file lateq.hh.
References fInputSigsFormulas.
Referenced by DocCompiler::generateInput().
00066 { fInputSigsFormulas.push_back(str); }
void Lateq::addOutputSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 75 of file lateq.hh.
References fOutputSigsFormulas.
Referenced by DocCompiler::compileLateq(), and DocCompiler::generateOutput().
00075 { fOutputSigsFormulas.push_back(str); }
void Lateq::addParamSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 68 of file lateq.hh.
References fParamSigsFormulas.
Referenced by DocCompiler::generateVariableStore().
00068 { fParamSigsFormulas.push_back(str); }
void Lateq::addPrefixSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 74 of file lateq.hh.
References fPrefixSigsFormulas.
Referenced by DocCompiler::generatePrefix().
00074 { fPrefixSigsFormulas.push_back(str); }
void Lateq::addRDTblSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 71 of file lateq.hh.
References fRDTblSigsFormulas.
Referenced by DocCompiler::generateDocConstantTbl().
00071 { fRDTblSigsFormulas.push_back(str); }
void Lateq::addRecurSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 70 of file lateq.hh.
References fRecurSigsFormulas.
Referenced by DocCompiler::generateDelayLine(), and DocCompiler::generateDelayVecNoTemp().
00070 { fRecurSigsFormulas.push_back(str); }
void Lateq::addRWTblSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 72 of file lateq.hh.
References fRWTblSigsFormulas.
Referenced by DocCompiler::generateDocWriteTbl().
00072 { fRWTblSigsFormulas.push_back(str); }
void Lateq::addSelectSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 73 of file lateq.hh.
References fSelectSigsFormulas.
Referenced by DocCompiler::generateSelect2(), and DocCompiler::generateSelect3().
00073 { fSelectSigsFormulas.push_back(str); }
void Lateq::addStoreSigFormula | ( | const string & | str | ) | [inline] |
Definition at line 69 of file lateq.hh.
References fStoreSigsFormulas.
Referenced by DocCompiler::generateVariableStore().
00069 { fStoreSigsFormulas.push_back(str); }
void Lateq::addUISigFormula | ( | const string & | path, | |
const string & | str | |||
) | [inline] |
Definition at line 76 of file lateq.hh.
References fUISigsFormulas.
Referenced by DocCompiler::generateButton(), DocCompiler::generateCheckbox(), DocCompiler::generateHSlider(), DocCompiler::generateNumEntry(), and DocCompiler::generateVSlider().
00076 { fUISigsFormulas.insert(make_pair(path, str)); };
bool Lateq::hasNotOnlyEmptyKeys | ( | multimap< string, string > & | mm | ) | [private] |
Find out whether all keys of the multimap are empty or not.
In other words : Check that some UIs have a path (non empty).
In other other words : Check that all UIs are not at top-level.
< Look for pairs with empty keys.
Definition at line 293 of file lateq.cpp.
Referenced by printHierarchy().
00294 { 00295 typedef multimap<string,string>::iterator MMIT; 00296 pair<MMIT,MMIT> range; 00297 range = mm.equal_range(""); 00298 bool hasOnlyEmptyPaths = (range.first == mm.begin()) && (range.second == mm.end()); 00299 return !hasOnlyEmptyPaths; 00300 }
int Lateq::inputs | ( | ) | const [inline] |
Definition at line 81 of file lateq.hh.
References fNumInputs.
Referenced by DocCompiler::generateInput().
00081 { return fNumInputs; }
int Lateq::outputs | ( | ) | const [inline] |
Definition at line 82 of file lateq.hh.
References fNumOutputs.
Referenced by DocCompiler::compileLateq(), and DocCompiler::generateOutput().
00082 { return fNumOutputs; }
void Lateq::printDGroup | ( | const string & | section, | |
list< string > & | field, | |||
ostream & | docout | |||
) | [private] |
Print a dgroup environment to auto-break long formulas.
[in] | section | The title to print for these formulas. |
[in] | field | The list of LaTeX formulas. |
[out] | docout | The LaTeX output file to print into. |
Definition at line 158 of file lateq.cpp.
References tab().
Referenced by println().
00159 { 00160 if (field.size() > 0) { 00161 docout << section << endl; 00162 tab(1,docout); docout << "\\begin{dgroup*}" << endl; 00163 list<string>::const_iterator s; 00164 for (s = field.begin(); s != field.end(); ++s) { 00165 tab(2,docout); docout << "\\begin{" << "dmath*" << "}" << endl; 00166 tab(3,docout); docout << "\t" << *s << endl; 00167 tab(2,docout); docout << "\\end{" << "dmath*" << "}" << endl; 00168 } 00169 tab(1,docout); docout << "\\end{dgroup*}" << endl; 00170 docout << endl; 00171 } 00172 }
void Lateq::printHierarchy | ( | const string & | section, | |
multimap< string, string > & | field, | |||
ostream & | docout | |||
) | [private] |
Print formulas for user interface signals.
[in] | section | The title to print for these formulas. |
[in] | field | This multimap contains pairs : 1. the path_string is printed as a sub-title item, when new; 2. each latex_string is printed as a preformated row of the supertabular environment (needed to handle long tables). |
[out] | docout | The LaTeX output file to print into. |
< Manage itemize printing for pathnames.
< Manage latex indentation offset.
Definition at line 198 of file lateq.cpp.
References hasNotOnlyEmptyKeys(), and tab().
Referenced by println().
00199 { 00200 if (field.size() > 0) { 00201 docout << section << endl; 00202 00203 bool hasSomePaths = hasNotOnlyEmptyKeys(field); 00204 unsigned int n; 00205 00206 if (hasSomePaths) { 00207 tab(0,docout); docout << "\\begin{itemize}" << endl; 00208 n = 1; 00209 } else { 00210 n = 0; 00211 } 00212 00213 multimap<string,string>::iterator it; 00214 string uidir = "improbable_starting_dirname"; 00215 bool startFlag = true; 00216 00217 for (it = field.begin(); it != field.end(); ++it) { 00218 /* Manage supertabular environment bounds and pathname printing. */ 00219 if (it->first != uidir) { 00220 if (!startFlag) { 00221 tab(n+2,docout); docout << "\\end{supertabular}" << endl; 00222 tab(n+1,docout); docout << "\\end{center}" << endl; 00223 } else { 00224 startFlag = false; 00225 } 00226 if (hasSomePaths) { 00227 /* Print the current pathname if new and if pathnames requested. */ 00228 if (it->first != "") { 00229 tab(n+0,docout); docout << "\\item \\textsf{" << it->first << "}" << endl; 00230 } else { 00231 tab(n+0,docout); docout << "\\item \\textit{" << "(at root level)" << "}" << endl; 00232 } 00233 } 00234 tab(n+1,docout); docout << "\\begin{center}" << endl; 00235 tab(n+2,docout); docout << "\\begin{supertabular}{rllll}" << endl; 00236 } 00237 /* Print the current formula. */ 00238 tab(n+3,docout); docout << it->second << endl; 00239 uidir = it->first; 00240 } 00241 tab(n+2,docout); docout << "\\end{supertabular}" << endl; 00242 tab(n+1,docout); docout << "\\end{center}" << endl; 00243 if (hasSomePaths) { 00244 tab(n+0,docout); docout << "\\end{itemize}" << endl; 00245 } 00246 docout << endl; 00247 } 00248 }
void Lateq::println | ( | ostream & | docout | ) |
Top-level method to print a whole set of compiled LaTeX formulas.
Top-level method to print a whole set of compiled LaTeX formulas, corresponding to an <equation> faustdoc tag.
Definition at line 77 of file lateq.cpp.
References compLateqIndexes(), fConstSigsFormulas, fInputSigsFormulas, fOutputSigsFormulas, fParamSigsFormulas, fPrefixSigsFormulas, fRDTblSigsFormulas, fRecurSigsFormulas, fRWTblSigsFormulas, fSelectSigsFormulas, fStoreSigsFormulas, fUISigsFormulas, gDocMathStringMap, printDGroup(), printHierarchy(), printMath(), printOneLine(), and subst().
Referenced by printDocEqn().
00078 { 00079 docout << endl << gDocMathStringMap["lateqcomment"] << endl; 00080 docout << "\\begin{enumerate}" << endl << endl; 00081 00082 /* Plural handling for titles of sub-sets of formulas. */ 00083 string sInputs = fInputSigsFormulas.size() > 1 ? gDocMathStringMap["inputsigtitle2"] : gDocMathStringMap["inputsigtitle1"]; 00084 string sOutputs = fOutputSigsFormulas.size() > 1 ? gDocMathStringMap["outputsigtitle2"] : gDocMathStringMap["outputsigtitle1"]; 00085 string sConstants = fConstSigsFormulas.size() > 1 ? gDocMathStringMap["constsigtitle2"] : gDocMathStringMap["constsigtitle1"]; 00086 string sUIElements = fUISigsFormulas.size() > 1 ? gDocMathStringMap["uisigtitle2"] : gDocMathStringMap["uisigtitle1"]; 00087 string sParameters = fParamSigsFormulas.size() > 1 ? gDocMathStringMap["paramsigtitle2"] : gDocMathStringMap["paramsigtitle1"]; 00088 00089 unsigned int internalSigsCount = fStoreSigsFormulas.size() + fRecurSigsFormulas.size() + fRDTblSigsFormulas.size() + fRWTblSigsFormulas.size() + fSelectSigsFormulas.size() + fPrefixSigsFormulas.size(); 00090 string sInternals = internalSigsCount > 1 ? gDocMathStringMap["internalsigtitle2"] : gDocMathStringMap["internalsigtitle1"]; 00091 00092 /* Successively print each Lateq field containing LaTeX formulas, with a title. */ 00093 printOneLine (subst("\\item $0: ", sInputs), fInputSigsFormulas, docout); 00094 printDGroup (subst("\\item $0: ", sOutputs), fOutputSigsFormulas, docout); 00095 printDGroup (subst("\\item $0: ", sConstants), fConstSigsFormulas, docout); 00096 printHierarchy (subst("\\item $0: ", sUIElements), fUISigsFormulas, docout); 00097 printDGroup (subst("\\item $0: ", sParameters), fParamSigsFormulas, docout); 00098 00099 /* The "Internal signals" item gather several fields, like a "super-item"... */ 00100 if( internalSigsCount > 0 ) { 00101 docout << subst("\\item $0: ", sInternals); 00102 } 00103 fStoreSigsFormulas.sort(compLateqIndexes); 00104 printDGroup ("", fStoreSigsFormulas, docout); 00105 printDGroup ("", fRecurSigsFormulas, docout); 00106 printDGroup ("", fRDTblSigsFormulas, docout); 00107 printMath ("", fRWTblSigsFormulas, docout); 00108 printMath ("", fSelectSigsFormulas, docout); 00109 printMath ("", fPrefixSigsFormulas, docout); 00110 00111 docout << "\\end{enumerate}" << endl << endl; 00112 }
void Lateq::printMath | ( | const string & | section, | |
list< string > & | field, | |||
ostream & | docout | |||
) | [private] |
Print formulas for select2, select3 and prefix signals.
[in] | section | The title to print for these formulas. |
[in] | field | The list of LaTeX arrays (for braces with two lines). |
[out] | docout | The LaTeX output file to print into. |
Definition at line 262 of file lateq.cpp.
Referenced by println().
00263 { 00264 if (field.size() > 0) { 00265 docout << section; 00266 docout << "\\begin{displaymath}" << endl; 00267 list<string>::iterator s; 00268 for (s = field.begin(); s != field.end(); ++s) { 00269 docout << *s << endl; 00270 } 00271 docout << "\\end{displaymath}" << endl; 00272 docout << endl; 00273 } 00274 }
void Lateq::printOneLine | ( | const string & | section, | |
list< string > & | field, | |||
ostream & | docout | |||
) | [private] |
Print a sorted list of input signals names ("x_i(t)"), on a single line, separated by commas.
[in] | section | The title to print for these formulas. |
[in] | field | The list of LaTeX input signals names. |
[out] | docout | The LaTeX output file to print into. |
Definition at line 130 of file lateq.cpp.
References compLateqIndexes(), and gDocMathStringMap.
Referenced by println().
00131 { 00132 if (field.size() > 0) { 00133 field.sort(compLateqIndexes); 00134 docout << section << "\t "; 00135 list<string>::const_iterator s; 00136 string sep = ""; 00137 for (s = field.begin(); s != field.end(); ++s) { 00138 docout << sep << "$" << *s << "$" << endl; 00139 sep = ", "; 00140 } 00141 } else { 00142 docout << section << "\t" << gDocMathStringMap["emptyformulafield"] << endl << endl; 00143 } 00144 }
void Lateq::tab | ( | int | n, | |
ostream & | docout | |||
) | const [private] |
Simple handling of indentation.
Definition at line 278 of file lateq.cpp.
Referenced by printDGroup(), and printHierarchy().
list<string> Lateq::fConstSigsFormulas [private] |
Definition at line 92 of file lateq.hh.
Referenced by addConstSigFormula(), and println().
list<string> Lateq::fInputSigsFormulas [private] |
LaTeX formulas to print.
Definition at line 91 of file lateq.hh.
Referenced by addInputSigFormula(), and println().
const int Lateq::fNumInputs [private] |
const int Lateq::fNumOutputs [private] |
list<string> Lateq::fOutputSigsFormulas [private] |
Definition at line 100 of file lateq.hh.
Referenced by addOutputSigFormula(), and println().
list<string> Lateq::fParamSigsFormulas [private] |
Definition at line 93 of file lateq.hh.
Referenced by addParamSigFormula(), and println().
list<string> Lateq::fPrefixSigsFormulas [private] |
Definition at line 99 of file lateq.hh.
Referenced by addPrefixSigFormula(), and println().
list<string> Lateq::fRDTblSigsFormulas [private] |
Definition at line 96 of file lateq.hh.
Referenced by addRDTblSigFormula(), and println().
list<string> Lateq::fRecurSigsFormulas [private] |
Definition at line 95 of file lateq.hh.
Referenced by addRecurSigFormula(), and println().
list<string> Lateq::fRWTblSigsFormulas [private] |
Definition at line 97 of file lateq.hh.
Referenced by addRWTblSigFormula(), and println().
list<string> Lateq::fSelectSigsFormulas [private] |
Definition at line 98 of file lateq.hh.
Referenced by addSelectSigFormula(), and println().
list<string> Lateq::fStoreSigsFormulas [private] |
Definition at line 94 of file lateq.hh.
Referenced by addStoreSigFormula(), and println().
multimap<string,string> Lateq::fUISigsFormulas [private] |
Definition at line 101 of file lateq.hh.
Referenced by addUISigFormula(), and println().