FAUST compiler  0.9.9.6b8
Functions
doc.hh File Reference
#include "tlib.hh"
#include "eval.hh"
Include dependency graph for doc.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Tree docTxt (const char *)
 
Tree docEqn (Tree x)
 
Tree docDgm (Tree x)
 
Tree docNtc ()
 
Tree docLst ()
 
Tree docMtd (Tree x)
 
bool isDocTxt (Tree t)
 
bool isDocTxt (Tree t, const char **)
 
bool isDocEqn (Tree t, Tree &x)
 
bool isDocDgm (Tree t, Tree &x)
 
bool isDocNtc (Tree t)
 
bool isDocLst (Tree t)
 
bool isDocMtd (Tree t)
 
void printDoc (const char *projname, const char *docdev, const char *faustversion)
 The entry point to generate faust doc files. More...
 

Function Documentation

Tree docDgm ( Tree  x)

Definition at line 189 of file doc.cpp.

References DOCDGM, and tree().

Referenced by declareAutoDoc(), and yyparse().

189 { return tree(DOCDGM, x); }
Tree tree(const Node &n)
Definition: tree.hh:186
Sym DOCDGM
Definition: doc.cpp:188

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docEqn ( Tree  x)

Definition at line 185 of file doc.cpp.

References DOCEQN, and tree().

Referenced by declareAutoDoc(), and yyparse().

185 { return tree(DOCEQN, x); }
Sym DOCEQN
Definition: doc.cpp:184
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docLst ( )

Definition at line 197 of file doc.cpp.

References DOCLST, and tree().

Referenced by declareAutoDoc(), and yyparse().

197 { return tree(DOCLST); }
Tree tree(const Node &n)
Definition: tree.hh:186
Sym DOCLST
Definition: doc.cpp:196

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docMtd ( Tree  x)

Definition at line 201 of file doc.cpp.

References DOCMTD, and tree().

Referenced by declareAutoDoc(), and yyparse().

201 { return tree(DOCMTD, x); }
Tree tree(const Node &n)
Definition: tree.hh:186
Sym DOCMTD
Definition: doc.cpp:200

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docNtc ( )

Definition at line 193 of file doc.cpp.

References DOCNTC, and tree().

Referenced by declareAutoDoc(), and yyparse().

193 { return tree(DOCNTC); }
Sym DOCNTC
Definition: doc.cpp:192
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docTxt ( const char *  )

Definition at line 171 of file doc.cpp.

References DOCTXT, symbol(), and tree().

Referenced by declareAutoDoc(), and yyparse().

171 { return tree( DOCTXT, tree(symbol(name)) ); }
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
Tree tree(const Node &n)
Definition: tree.hh:186
Symbol * symbol(const char *str)
Returns (and creates if new) the symbol of name str.
Definition: symbol.hh:95
Sym DOCTXT
Definition: doc.cpp:170

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocDgm ( Tree  t,
Tree x 
)

Definition at line 190 of file doc.cpp.

References DOCDGM, and isTree().

Referenced by printdoccontent().

190 { return isTree(t, DOCDGM, x); }
Sym DOCDGM
Definition: doc.cpp:188
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocEqn ( Tree  t,
Tree x 
)

Definition at line 186 of file doc.cpp.

References DOCEQN, and isTree().

Referenced by collectDocEqns(), and printdoccontent().

186 { return isTree(t, DOCEQN, x); }
Sym DOCEQN
Definition: doc.cpp:184
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocLst ( Tree  t)

Definition at line 198 of file doc.cpp.

References DOCLST, and isTree().

Referenced by printdoccontent().

198 { return isTree(t, DOCLST); }
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305
Sym DOCLST
Definition: doc.cpp:196

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocMtd ( Tree  t)
bool isDocNtc ( Tree  t)

Definition at line 194 of file doc.cpp.

References DOCNTC, and isTree().

Referenced by printdoccontent().

194 { return isTree(t, DOCNTC); }
Sym DOCNTC
Definition: doc.cpp:192
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocTxt ( Tree  t)

Definition at line 172 of file doc.cpp.

References DOCTXT, and CTree::node().

Referenced by printdoccontent().

172 { return t->node() == Node(DOCTXT); }
Class Node = (type x (int + double + Sym + void*))
Definition: node.hh:75
const Node & node() const
return the content of the tree
Definition: tree.hh:143
Sym DOCTXT
Definition: doc.cpp:170

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocTxt ( Tree  t,
const char **   
)

Definition at line 173 of file doc.cpp.

References DOCTXT, isSym(), isTree(), name(), and CTree::node().

174 {
175  Tree t1; Sym s;
176  if ( isTree(t0, DOCTXT, t1) && isSym(t1->node(), &s) ) {
177  *str = name(s);
178  return true;
179  } else {
180  return false;
181  }
182 }
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
const Node & node() const
return the content of the tree
Definition: tree.hh:143
bool isSym(const Node &n)
Definition: node.hh:199
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
Symbols are unique objects with a name stored in a hash table.
Definition: symbol.hh:53
bool isTree(const Tree &t, const Node &n)
Definition: tree.cpp:305
Sym DOCTXT
Definition: doc.cpp:170

Here is the call graph for this function:

void printDoc ( const char *  projname,
const char *  docdev,
const char *  faustversion 
)

The entry point to generate faust doc files.

The entry point to generate the output LaTeX file, stored in the directory "<projname>-math/". This file eventually references images for diagrams, generated in SVG subdirectories. The device system was adapted from drawSchema's device system.

Parameters
[in]projnameBasename of the new doc directory ("*-math").
[in]docdevThe doc device; only ".tex" is supported for the moment.
[in]faustversionThe current version of this Faust compiler.

File stuff : create doc directories and a tex file.

Create THE mathdoc tex file.

Init and load translation file.

Simulate a default doc if no <mdoc> tag detected.

Printing stuff : in the '.tex' ouptut file, eventually including SVG files.

< Faust version and compilation date (comment).

< Static LaTeX header (packages and setup).

< Generate math contents (main stuff!).

< Static LaTeX footer.

Definition at line 224 of file doc.cpp.

References cholddir(), copyFaustSources(), declareAutoDoc(), gDocDevSuffix, gDocLang, gDocName, gDocVector, gLatexheaderfilename, gReader, SourceReader::listSrcFiles(), loadTranslationFile(), makedir(), mkchdir(), openArchFile(), printdoccontent(), printfaustdocstamp(), printlatexfooter(), printlatexheader(), and subst().

Referenced by main().

225 {
226  gDocDevSuffix = docdev;
227 
229  //cerr << "Documentator : printDoc : gFaustDirectory = '" << gFaustDirectory << "'" << endl;
230  //cerr << "Documentator : printDoc : gFaustSuperDirectory = '" << gFaustSuperDirectory << "'" << endl;
231  //cerr << "Documentator : printDoc : gFaustSuperSuperDirectory = '" << gFaustSuperSuperDirectory << "'" << endl;
232  //cerr << "Documentator : printDoc : gCurrentDir = '" << gCurrentDir << "'" << endl;
233 
234  makedir(projname); // create a top directory to store files
235 
236  string svgTopDir = subst("$0/svg", projname);
237  makedir(svgTopDir.c_str()); // create a directory to store svg-* subdirectories.
238 
239  string cppdir = subst("$0/cpp", projname);
240  makedir(cppdir.c_str()); // create a cpp directory.
241 
242  string pdfdir = subst("$0/pdf", projname);
243  makedir(pdfdir.c_str()); // create a pdf directory.
244 
245  /* Copy all Faust source files into an 'src' sub-directory. */
246  vector<string> pathnames = gReader.listSrcFiles();
247  copyFaustSources(projname, pathnames);
248 
249  string texdir = subst("$0/tex", projname);
250  mkchdir(texdir.c_str()); // create a directory and move into.
251 
253  ofstream docout(subst("$0.$1", gDocName, docdev).c_str());
254  cholddir(); // return to current directory
255 
258 
260  if (gDocVector.empty()) { declareAutoDoc(); }
261 
263  printfaustdocstamp(faustversion, docout);
264  istream* latexheader = openArchFile(gLatexheaderfilename);
265  printlatexheader(*latexheader, faustversion, docout);
266  printdoccontent(svgTopDir.c_str(), gDocVector, faustversion, docout);
267  printlatexfooter(docout);
268 }
static void printlatexheader(istream &latexheader, const string &faustversion, ostream &docout)
Print a static LaTeX header.
Definition: doc.cpp:283
static int cholddir()
Switch back to the previously stored current directory.
Definition: doc_lang.cpp:242
int mkchdir(string dirname)
Create a new directory in the current one to store the diagrams.
Definition: files.cpp:55
static void printdoccontent(const char *svgTopDir, const vector< Tree > &docVector, const string &faustversion, ostream &docout)
Main documentator loop.
Definition: doc.cpp:436
static void copyFaustSources(const char *projname, const vector< string > &pathnames)
Copy all Faust source files into an 'src' subdirectory.
Definition: doc.cpp:1051
static istream * openArchFile(const string &filename)
Open architecture file.
Definition: doc.cpp:977
int makedir(string dirname)
Definition: files.cpp:72
string gDocName
Contains the filename for out documentation.
Definition: main.cpp:107
string gDocLang
Definition: doc.cpp:118
vector< string > listSrcFiles()
Return a vector of pathnames representing the list of all the source files that have been required to...
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47
vector< Tree > gDocVector
Contains parsed trees: DOCTXT, DOCEQN, DOCDGM.
Definition: doc.cpp:109
static void printlatexfooter(ostream &docout)
Print the static LaTeX footer.
Definition: doc.cpp:389
static const string gLatexheaderfilename
Definition: doc.cpp:107
void loadTranslationFile(const string &lang)
Definition: doc_lang.cpp:76
SourceReader gReader
Definition: main.cpp:89
static const char * gDocDevSuffix
".tex" (or .??? - used to choose output device).
Definition: doc.cpp:106
static void printfaustdocstamp(const string &faustversion, ostream &docout)
Print a "doc stamp" in the LaTeX document :
Definition: doc.cpp:404
void declareAutoDoc()
Declare an automatic documentation.
Definition: doc_autodoc.cpp:61

Here is the call graph for this function:

Here is the caller graph for this function: