|
FAUST compiler
0.9.9.6b8
|
#include <iostream>#include <string>#include <set>#include <map>#include <cstdlib>#include "doc_autodoc.hh"#include "tlib.hh"#include "boxes.hh"#include "doc.hh"
Go to the source code of this file.
Functions | |
| static void | initDocAutodocKeySet () |
| Initialize gDocAutodocKeySet, a set containing all the keywords. | |
| void | declareAutoDoc () |
| Declare an automatic documentation. | |
| void | initDocAutodoc () |
| Dispatch initialization of autodoc container. | |
| static void | printDocAutodocStringMapContent () |
| Simple trace function. | |
Variables | |
| SourceReader | gReader |
| string | gDocName |
| Contains the filename for out documentation. | |
| map< Tree, set< Tree > > | gMetaDataSet |
| map< string, string > | gDocMetadatasStringMap |
| map< string, string > | gDocAutodocStringMap |
| set< string > | gDocAutodocKeySet |
| void declareAutoDoc | ( | ) |
Declare an automatic documentation.
This function simulates a default documentation : if no <mdoc> tag was found in the input faust file, and yet the '-mdoc' option was called, then print a complete 'process' doc.
Autodoc's "head", with title, author, date, and metadatas.
The latex title macro is bound to the metadata "name" if it exists, (corresponding to "declare name") or else just to the file name.
The latex author macro is bound to the metadata "author" if it exists, (corresponding to "declare author") or else no author item is printed.
The latex date macro is bound to the metadata "date" if it exists, (corresponding to "declare date") or else to the today latex macro.
The latex maketitle macro.
Insert all declared metadatas in a latex tabular environment.
Autodoc's "body", with equation and diagram of process, and notice and listing.
Definition at line 61 of file doc_autodoc.cpp.
References boxIdent(), cons(), declareDoc(), docDgm(), docEqn(), docLst(), docMtd(), docNtc(), docTxt(), gDocAutodocStringMap, gDocMetadatasStringMap, gDocName, gMetaDataSet, SourceReader::listSrcFiles(), nil, tree(), and tree2str().
Referenced by printDoc().
{
Tree autodoc = nil;
Tree process = boxIdent("process");
autodoc = cons(docTxt("\\title{"), autodoc);
if (gMetaDataSet.count(tree("name"))) {
autodoc = cons(docMtd(tree("name")), autodoc);
} else {
autodoc = cons(docTxt(gDocName.c_str()), autodoc);
}
autodoc = cons(docTxt("}\n"), autodoc);
if (gMetaDataSet.count(tree("author"))) {
autodoc = cons(docTxt("\\author{"), autodoc);
autodoc = cons(docMtd(tree("author")), autodoc);
autodoc = cons(docTxt("}\n"), autodoc);
}
autodoc = cons(docTxt("\\date{"), autodoc);
if (gMetaDataSet.count(tree("date"))) {
autodoc = cons(docMtd(tree("date")), autodoc);
} else {
autodoc = cons(docTxt("\\today"), autodoc);
}
autodoc = cons(docTxt("}\n"), autodoc);
autodoc = cons(docTxt("\\maketitle\n"), autodoc);
if (! gMetaDataSet.empty()) {
autodoc = cons(docTxt("\\begin{tabular}{ll}\n"), autodoc);
autodoc = cons(docTxt("\t\\hline\n"), autodoc);
for (map<Tree, set<Tree> >::iterator i = gMetaDataSet.begin(); i != gMetaDataSet.end(); i++) {
string mtdkey = tree2str(i->first);
string mtdTranslatedKey = gDocMetadatasStringMap[mtdkey];
if (mtdTranslatedKey.empty()) {
mtdTranslatedKey = mtdkey;
}
autodoc = cons(docTxt("\t\\textbf{"), autodoc);
autodoc = cons(docTxt(mtdTranslatedKey.c_str()), autodoc);
autodoc = cons(docTxt("} & "), autodoc);
autodoc = cons(docMtd(tree(mtdkey.c_str())), autodoc);
autodoc = cons(docTxt(" \\\\\n"), autodoc);
}
autodoc = cons(docTxt("\t\\hline\n"), autodoc);
autodoc = cons(docTxt("\\end{tabular}\n"), autodoc);
autodoc = cons(docTxt("\\bigskip\n"), autodoc);
}
string autoPresentationTxt = "\n\\bigskip\n" + gDocAutodocStringMap["thisdoc"] + "\n\n";
autodoc = cons(docTxt(autoPresentationTxt.c_str()), autodoc);
string autoEquationTxt = "\n" + gDocAutodocStringMap["autoeqntitle"] + "\n\n";
autoEquationTxt += gDocAutodocStringMap["autoeqntext"] + "\n";
autodoc = cons(docTxt(autoEquationTxt.c_str()), autodoc);
autodoc = cons(docEqn(process), autodoc);
string autoDiagramTxt = "\n" + gDocAutodocStringMap["autodgmtitle"] + "\n\n";
autoDiagramTxt += gDocAutodocStringMap["autodgmtext"] + "\n";
autodoc = cons(docTxt(autoDiagramTxt.c_str()), autodoc);
autodoc = cons(docDgm(process), autodoc);
string autoNoticeTxt = "\n" + gDocAutodocStringMap["autontctitle"] + "\n\n";
// autoNoticeTxt += gDocAutodocStringMap["autontctext"] + "\n";
autodoc = cons(docTxt(autoNoticeTxt.c_str()), autodoc);
autodoc = cons(docNtc(), autodoc);
string autoListingTxt;
vector<string> pathnames = gReader.listSrcFiles();
if(pathnames.size() > 1) {
autoListingTxt = "\n" + gDocAutodocStringMap["autolsttitle2"] + "\n\n";
autoListingTxt += gDocAutodocStringMap["autolsttext2"] + "\n";
} else {
autoListingTxt = "\n" + gDocAutodocStringMap["autolsttitle1"] + "\n\n";
autoListingTxt += gDocAutodocStringMap["autolsttext1"] + "\n";
}
autodoc = cons(docTxt(autoListingTxt.c_str()), autodoc);
autodoc = cons(docLst(), autodoc);
declareDoc(autodoc);
}


| void initDocAutodoc | ( | ) |
Dispatch initialization of autodoc container.
Definition at line 161 of file doc_autodoc.cpp.
References initDocAutodocKeySet().
Referenced by loadTranslationFile().
{
initDocAutodocKeySet();
}


| static void initDocAutodocKeySet | ( | ) | [static] |
Initialize gDocAutodocKeySet, a set containing all the keywords.
Definition at line 176 of file doc_autodoc.cpp.
References gDocAutodocKeySet.
Referenced by initDocAutodoc().
{
gDocAutodocKeySet.insert("thisdoc");
gDocAutodocKeySet.insert("autoeqntitle");
gDocAutodocKeySet.insert("autoeqntext");
gDocAutodocKeySet.insert("autodgmtitle");
gDocAutodocKeySet.insert("autodgmtext");
gDocAutodocKeySet.insert("autontctitle");
gDocAutodocKeySet.insert("autontctext");
gDocAutodocKeySet.insert("autolsttitle1");
gDocAutodocKeySet.insert("autolsttext1");
gDocAutodocKeySet.insert("autolsttitle2");
gDocAutodocKeySet.insert("autolsttext2");
}

| static void printDocAutodocStringMapContent | ( | ) | [static] |
Simple trace function.
Definition at line 200 of file doc_autodoc.cpp.
References gDocAutodocStringMap.
{
bool trace = false;
if(trace) {
cout << "gDocAutodocStringMap.size() = " << gDocAutodocStringMap.size() << endl;
map<string,string>::iterator it;
int i = 1;
for(it = gDocAutodocStringMap.begin(); it!=gDocAutodocStringMap.end(); ++it)
cout << i++ << ".\tgDocNoticeStringMap[" << it->first << "] \t= '" << it->second << "'" << endl;
}
}
| set<string> gDocAutodocKeySet |
Definition at line 41 of file doc_autodoc.cpp.
Referenced by initDocAutodocKeySet(), and storePair().
| map<string, string> gDocAutodocStringMap |
Definition at line 40 of file doc_autodoc.cpp.
Referenced by declareAutoDoc(), importDocStrings(), printDocAutodocStringMapContent(), printDocNotice(), and storePair().
| map<string, string> gDocMetadatasStringMap |
Definition at line 35 of file doc_metadatas.cpp.
| string gDocName |
| map<Tree, set<Tree> > gMetaDataSet |
1.8.0