FAUST compiler  0.9.9.6b8
Defines | Enumerations | Functions | Variables
doc.cpp File Reference

Implementation of documentation trees support and printing. More...

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <time.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <string>
#include <vector>
#include "ppbox.hh"
#include "prim2.hh"
#include "doc.hh"
#include "eval.hh"
#include "errormsg.hh"
#include "doc_Text.hh"
#include "sigprint.hh"
#include "propagate.hh"
#include "enrobage.hh"
#include "drawschema.hh"
#include "names.hh"
#include "simplify.hh"
#include "privatise.hh"
#include "recursivness.hh"
#include "sourcereader.hh"
#include "lateq.hh"
#include "doc_compile.hh"
#include "doc_lang.hh"
#include "doc_notice.hh"
#include "doc_autodoc.hh"
#include "compatibility.hh"
Include dependency graph for doc.cpp:

Go to the source code of this file.

Defines

#define MAXIDCHARS   5
 max numbers (characters) to represent ids (e.g. for directories).

Enumerations

enum  { langEN, langFR, langIT }

Functions

static void printlatexheader (istream &latexheader, const string &faustversion, ostream &docout)
 Print a static LaTeX header.
static void printfaustlistings (ostream &docout)
 Print listings of each Faust code ".dsp" files, calling the 'printfaustlisting' function.
static void printfaustlisting (string &faustfile, ostream &docout)
 Print a listing of the Faust code, in a LaTeX "listing" environment.
static void printlatexfooter (ostream &docout)
 Print the static LaTeX footer.
static void printdoccontent (const char *svgTopDir, const vector< Tree > &docVector, const string &faustversion, ostream &docout)
 Main documentator loop.
static void printfaustdocstamp (const string &faustversion, ostream &docout)
 Print a "doc stamp" in the LaTeX document :
static void printDocEqn (Lateq *ltq, ostream &docout)
 Print doc equations, following the Lateq::println method.
static void printDocDgm (const Tree expr, const char *svgTopDir, ostream &docout, int i)
 Doc diagrams handling.
static void printDocMetadata (const Tree expr, ostream &docout)
 Print a metadata set.
static void prepareDocEqns (const vector< Tree > &docBoxes, vector< Lateq * > &docCompiledEqnsVector)
 Caller function.
static void collectDocEqns (const vector< Tree > &docBoxes, vector< Tree > &eqBoxes)
 step 0. Feed a vector.
static void mapEvalDocEqn (const vector< Tree > &eqBoxes, const Tree &env, vector< Tree > &evalEqBoxes)
 step 1. Evaluate boxes.
static void mapGetEqName (const vector< Tree > &evalEqBoxes, vector< string > &eqNames)
 step 2. Get boxes name.
static void calcEqnsNicknames (const vector< string > &eqNames, vector< string > &eqNicknames)
 step 3. Calculate nicknames.
static void mapPrepareEqSig (const vector< Tree > &evalEqBoxes, vector< int > &eqInputs, vector< int > &eqOutputs, vector< Tree > &eqSigs)
 step 4&5. Propagate and prepare signals.
static void mapSetSigNickname (const vector< string > &eqNicknames, const vector< int > &eqInputs, const vector< Tree > &eqSigs)
 step 6. Set signals nicknames.
static void collectEqSigs (const vector< Tree > &eqSigs, Tree &superEqList)
 step 7. Collect all signals in a superlist.
static void annotateSuperList (DocCompiler *DC, Tree superEqList)
 step 8. Annotate superlist.
static void mapCompileDocEqnSigs (const vector< Tree > &eqSigs, const vector< int > &eqInputs, const vector< int > &eqOutputs, DocCompiler *DC, vector< Lateq * > &docCompiledEqnsVector)
 step 10. Compile equations.
static string calcNumberedName (const char *base, int i)
 Simply concat a string with a number in a "%03d" format.
static void getBoxInputsAndOutputs (const Tree t, int &numInputs, int &numOutputs)
 Just get the number of inputs and the number of outputs of a box.
static string calcDocEqnInitial (const string s)
 Calculate an appropriate nickname for equations, from previous names.
static void initCompilationDate ()
static struct tm * getCompilationDate ()
static int cholddir ()
 Switch back to the previously stored current directory.
static int mkchdir (const char *dirname)
 Create a new directory in the current one, then 'cd' into this new directory.
static int makedir (const char *dirname)
 Create a new directory in the current one.
static void getCurrentDir ()
 Get current directory and store it in gCurrentDir.
static istream * openArchFile (const string &filename)
 Open architecture file.
static char * legalFileName (const Tree t, int n, char *dst)
 Transform the definition name property of tree <t> into a legal file name.
static string rmExternalDoubleQuotes (const string &s)
 Remove the leading and trailing double quotes of a string (but not those in the middle of the string)
static void copyFaustSources (const char *projname, const vector< string > &pathnames)
 Copy all Faust source files into an 'src' subdirectory.
vector< string > & docCodeSlicer (const string &faustfile, vector< string > &codeSlices)
 Slice faust code between "mdoc" sections.
static void printdocCodeSlices (const string &code, ostream &docout)
 Print faust code inside a listing environment.
static bool doesFileBeginWithCode (const string &faustfile)
 Test whether a file does begin with some faust code or not.
Tree docTxt (const char *name)
bool isDocTxt (Tree t)
bool isDocTxt (Tree t0, const char **str)
Tree docEqn (Tree x)
bool isDocEqn (Tree t, Tree &x)
Tree docDgm (Tree x)
bool isDocDgm (Tree t, Tree &x)
Tree docNtc ()
bool isDocNtc (Tree t)
Tree docLst ()
bool isDocLst (Tree t)
Tree docMtd (Tree x)
bool isDocMtd (Tree t, Tree &x)
void printDoc (const char *projname, const char *docdev, const char *faustversion)
 The entry point to generate faust doc files.

Variables

Tree gExpandedDefList
map< Tree, set< Tree > > gMetaDataSet
map< string, string > gDocMetadatasStringMap
map< string, string > gDocMathStringMap
bool gDetailsSwitch
bool gStripDocSwitch
string gFaustDirectory
string gFaustSuperDirectory
string gFaustSuperSuperDirectory
string gMasterDocument
string gMasterName
SourceReader gReader
string gDocName
 Contains the filename for out documentation.
static const char * gDocDevSuffix
 ".tex" (or .??? - used to choose output device).
static string gCurrentDir
 Room to save current directory name.
static const string gLatexheaderfilename = "latexheader.tex"
vector< TreegDocVector
 Contains <mdoc> parsed trees: DOCTXT, DOCEQN, DOCDGM.
static struct tm gCompilationDate
bool gLstDependenciesSwitch = true
 mdoc listing management.
bool gLstMdocTagsSwitch = true
 mdoc listing management.
bool gLstDistributedSwitch = true
 mdoc listing management.
string gDocLang
Sym DOCTXT = symbol ("DocTxt")
Sym DOCEQN = symbol ("DocEqn")
Sym DOCDGM = symbol ("DocDgm")
Sym DOCNTC = symbol ("DocNtc")
Sym DOCLST = symbol ("DocLst")
Sym DOCMTD = symbol ("DocMtd")

Detailed Description

Implementation of documentation trees support and printing.

Author:
Karim Barkati and Yann Orlarey
Version:
1.0
Date:
2009

Definition in file doc.cpp.


Define Documentation

#define MAXIDCHARS   5

max numbers (characters) to represent ids (e.g. for directories).

Definition at line 83 of file doc.cpp.

Referenced by calcNumberedName(), and printDocDgm().


Enumeration Type Documentation

anonymous enum
Enumerator:
langEN 
langFR 
langIT 

Definition at line 118 of file doc.cpp.


Function Documentation

static void annotateSuperList ( DocCompiler DC,
Tree  superEqList 
) [static]

step 8. Annotate superlist.

8.

Annotate superEqList (to find candidate signals to be named later).

Parameters:
[in]DCThe signals compiler.
[out]superEqListThe super equations signal tree to annotate.

Definition at line 737 of file doc.cpp.

References DocCompiler::annotate().

Referenced by prepareDocEqns().

{
    DC->annotate(superEqList);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string calcDocEqnInitial ( const string  s) [static]

Calculate an appropriate nickname for equations, from previous names.

Parameters:
Thestring to parse.
Returns:
Essentially returns the initial character, except "Y" for "process", and "Z" for unnamed equations.

Definition at line 788 of file doc.cpp.

Referenced by calcEqnsNicknames().

{
    string nn;
    if(s == "process")
        nn = "Y";
    else if (s.substr(0,6) == "doceqn")
        nn = "Z";
    else
        nn += toupper(s[0]);
    return nn;
}

Here is the caller graph for this function:

static void calcEqnsNicknames ( const vector< string > &  eqNames,
vector< string > &  eqNicknames 
) [static]

step 3. Calculate nicknames.

3.

Calculate a nickname for each equation and store it.

Parameters:
[in]eqNamesEquations names to parse.
[out]eqNicknamesThe place to store calculated nicknames.
Todo:
Should check unicity : check whether several names share the same initial, or else capture consonants for example.

Check duplicates

Definition at line 623 of file doc.cpp.

References calcDocEqnInitial().

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : calcEqnsNicknames" << endl;
    
    vector<string> v;
    
    for( vector<string>::const_iterator eq = eqNames.begin(); eq < eqNames.end(); eq++ ) {
        string init = calcDocEqnInitial(*eq);
        v.push_back(init);
//      for( vector<string>::iterator it = v.begin(); it < v.end()-1; ++it ) {
//          if (init == *it) {
//              //cerr << "!! Warning Documentator : calcEqnsNicknames : duplicates \"" << init << "\"" << endl;
//          }
//      }
        eqNicknames.push_back(init);
    }
    
//  for( vector<string>::const_iterator eq = eqNames.begin(); eq < eqNames.end(); eq++ ) {
//      int c = 0;
//      c = count_if(eqNames.begin(), eqNames.end(), bind2nd(equal_to<string>(), *eq));
//      if (c > 0) { 
//          cerr << "- Duplicate nickname !! " << *eq << endl; 
//      } else {
//          cerr << "(no duplicate) " << *eq << endl;
//      }
//  }
    
    //cerr << "Documentator : end of calcEqnsNicknames\n---" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string calcNumberedName ( const char *  base,
int  i 
) [static]

Simply concat a string with a number in a "%03d" format.

The number has MAXIDCHARS characters.

Definition at line 1094 of file doc.cpp.

References MAXIDCHARS, and subst().

Referenced by mapGetEqName().

{
    char nb[MAXIDCHARS+1];
    sprintf(nb, "%03d", i);
    return subst("$0$1", base, nb);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int cholddir ( ) [static]

Switch back to the previously stored current directory.

Definition at line 1026 of file doc.cpp.

References gCurrentDir.

Referenced by openArchFile(), and printDoc().

{
    if (chdir(gCurrentDir.c_str()) == 0) {
        return 0;
    } else {
        perror("cholddir");
        exit(errno);
    }
}

Here is the caller graph for this function:

static void collectDocEqns ( const vector< Tree > &  docBoxes,
vector< Tree > &  eqBoxes 
) [static]

step 0. Feed a vector.

0.

Collect every <equation> found in all <mdoc> faust comments.

Parameters:
[in]docBoxesThe <mdoc> boxes to filter.
[out]eqBoxesThe place to store only <equation> boxes.

Definition at line 549 of file doc.cpp.

References doc, hd(), isDocEqn(), isList(), reverse(), and tl().

Referenced by prepareDocEqns().

{
    int nbdoceqn = 0;
    
    for (vector<Tree>::const_iterator doc=docBoxes.begin(); doc<docBoxes.end(); doc++) {
        Tree L = reverse(*doc);
        Tree expr;
        while (isList(L)) {
            if ( isDocEqn(hd(L), expr) ) {
                eqBoxes.push_back(expr);
                nbdoceqn++;
            }
            L = tl(L);
        }
    }
    //cerr << "Documentator : collectDocEqns : " << nbdoceqn << " <equation> tags found." << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void collectEqSigs ( const vector< Tree > &  eqSigs,
Tree superEqList 
) [static]

step 7. Collect all signals in a superlist.

7.

Collect each prepared list of signals to construct a super list.

Parameters:
[in]eqSigsContains well-prepared and nicknamed signals.
[out]superEqListThe root where to 'cons' signals all together.

Definition at line 716 of file doc.cpp.

References cons(), and nil.

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : collectEqSigs" << endl;
    
    superEqList = nil;
    
    for( vector<Tree>::const_iterator it = eqSigs.begin(); it < eqSigs.end(); ++it ) {
        superEqList = cons( *it, superEqList );
    }
    //printSignal(superEqList, stdout, 0);
    
    //cerr << endl << "Documentator : end of collectEqSigs\n---" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void copyFaustSources ( const char *  projname,
const vector< string > &  pathnames 
) [static]

Copy all Faust source files into an 'src' subdirectory.

Parameters:
[in]projnameBasename of the new doc directory ("*-math").
[in]pathnamesThe paths list of the source files to copy.

Definition at line 1124 of file doc.cpp.

References filebasename(), makedir(), and subst().

Referenced by printDoc().

{
    string srcdir = subst("$0/src", projname);
    //cerr << "Documentator : copyFaustSources : Creating directory '" << srcdir << "'" << endl;
    makedir(srcdir.c_str());    // create a directory.
        
    for (unsigned int i=0; i< pathnames.size(); i++) {
        ifstream src;
        ofstream dst;
        string faustfile = pathnames[i];
        string copy = subst("$0/$1", srcdir, filebasename(faustfile.c_str()));
        //cerr << "Documentator : copyFaustSources : Opening input file  '" << faustfile << "'" << endl;
        //cerr << "Documentator : copyFaustSources : Opening output file '" << copy << "'" << endl;
        src.open(faustfile.c_str(), ifstream::in);
        dst.open(copy.c_str(), ofstream::out);
        string  s;
        while ( getline(src,s) ) dst << s << endl;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

vector< string > & docCodeSlicer ( const string &  faustfile,
vector< string > &  codeSlices 
)

Slice faust code between "mdoc" sections.

Parameters:
[in]faustfileName of the input faust file to parse.
[in]codeSlicesThe place to store code "slices".

Caution: we suppose there's only one <mdoc> tag per line!

A change has come. ;)

Definition at line 896 of file doc.cpp.

Referenced by printdoccontent().

{
    string  s;
    ifstream src;
    src.open(faustfile.c_str(), ifstream::in);
    string tmp = "";
    
    bool isInsideDoc = false;
    
    if (faustfile != "" && src.good()) {
        while(getline(src, s)) { 
            size_t foundopendoc  = s.find("<mdoc>");
            
            if (foundopendoc != string::npos) { 
                if (isInsideDoc == false) { 
                    if (! tmp.empty() ) {
                        codeSlices.push_back(tmp); }
                    tmp = "";
                }
                isInsideDoc = true;  
            }
            
            if (isInsideDoc == false) {
                tmp += s + '\n';
            }
            
            size_t foundclosedoc = s.find("</mdoc>");
            if (foundclosedoc != string::npos) isInsideDoc = false;
        }
    } else {
        cerr << "ERROR : can't open faust source file " << faustfile << endl;
        exit(1);
    }
    return codeSlices;
}

Here is the caller graph for this function:

Tree docDgm ( Tree  x)

Definition at line 194 of file doc.cpp.

References DOCDGM, and tree().

Referenced by declareAutoDoc(), and yyparse().

{ return tree(DOCDGM, x);       }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docEqn ( Tree  x)

Definition at line 190 of file doc.cpp.

References DOCEQN, and tree().

Referenced by declareAutoDoc(), and yyparse().

{ return tree(DOCEQN, x);       }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docLst ( )

Definition at line 202 of file doc.cpp.

References DOCLST, and tree().

Referenced by declareAutoDoc(), and yyparse().

{ return tree(DOCLST);          }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docMtd ( Tree  x)

Definition at line 206 of file doc.cpp.

References DOCMTD, and tree().

Referenced by declareAutoDoc(), and yyparse().

{ return tree(DOCMTD, x);       }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docNtc ( )

Definition at line 198 of file doc.cpp.

References DOCNTC, and tree().

Referenced by declareAutoDoc(), and yyparse().

{ return tree(DOCNTC);          }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree docTxt ( const char *  name)

Definition at line 176 of file doc.cpp.

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

Referenced by declareAutoDoc(), and yyparse().

{ return tree( DOCTXT, tree(symbol(name)) ); }

Here is the call graph for this function:

Here is the caller graph for this function:

static bool doesFileBeginWithCode ( const string &  faustfile) [static]

Test whether a file does begin with some faust code or not.

Parameters:
[in]faustfileName of the input faust file to parse.

Definition at line 954 of file doc.cpp.

Referenced by printdoccontent().

{
    string  s;
    ifstream src;
    src.open(faustfile.c_str(), ifstream::in);
    
    if (faustfile != "" && src.good()) {
        getline(src, s);
        size_t foundopendoc = s.find("<mdoc>");
        if(int(foundopendoc)==0) {
            return false;
        } else {
            return true;
        }
    } else {
        cerr << "ERROR : can't open faust source file " << faustfile << endl;
        exit(1);
    }
}   

Here is the caller graph for this function:

static void getBoxInputsAndOutputs ( const Tree  t,
int &  numInputs,
int &  numOutputs 
) [static]

Just get the number of inputs and the number of outputs of a box.

Parameters:
[in]tThe box tree to get inputs and outputs from.
[out]numInputsThe place to store the number of inputs.
[out]numOutputsThe place to store the number of outputs.

Definition at line 808 of file doc.cpp.

References getBoxType().

Referenced by mapPrepareEqSig().

{
    if (!getBoxType(t, &numInputs, &numOutputs)) {
        cerr << "ERROR during the evaluation of t : " << boxpp(t) << endl;
        exit(1);
    }
    //cerr << "Documentator : " << numInputs <<" inputs and " << numOutputs <<" outputs for box : " << boxpp(t) << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static struct tm * getCompilationDate ( ) [static, read]

Definition at line 1156 of file doc.cpp.

References gCompilationDate, and initCompilationDate().

Referenced by printfaustdocstamp(), and printlatexheader().

Here is the call graph for this function:

Here is the caller graph for this function:

static void getCurrentDir ( ) [static]

Get current directory and store it in gCurrentDir.

Definition at line 1040 of file doc.cpp.

References FAUST_PATH_MAX, and gCurrentDir.

Referenced by openArchFile().

{
    char    buffer[FAUST_PATH_MAX];
    gCurrentDir = getcwd (buffer, FAUST_PATH_MAX);
}

Here is the caller graph for this function:

static void initCompilationDate ( ) [static]

Definition at line 1148 of file doc.cpp.

References gCompilationDate.

Referenced by getCompilationDate().

{
    time_t now;
    
    time(&now);
    gCompilationDate = *localtime(&now);
}

Here is the caller graph for this function:

bool isDocDgm ( Tree  t,
Tree x 
)

Definition at line 195 of file doc.cpp.

References DOCDGM, and isTree().

Referenced by printdoccontent().

{ return isTree(t, DOCDGM, x);  }

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 191 of file doc.cpp.

References DOCEQN, and isTree().

Referenced by collectDocEqns(), and printdoccontent().

{ return isTree(t, DOCEQN, x);  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocLst ( Tree  t)

Definition at line 203 of file doc.cpp.

References DOCLST, and isTree().

Referenced by printdoccontent().

{ return isTree(t, DOCLST);     }

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocMtd ( Tree  t,
Tree x 
)

Definition at line 207 of file doc.cpp.

References DOCMTD, and isTree().

Referenced by printdoccontent().

{ return isTree(t, DOCMTD, x);  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocNtc ( Tree  t)

Definition at line 199 of file doc.cpp.

References DOCNTC, and isTree().

Referenced by printdoccontent().

{ return isTree(t, DOCNTC);     }

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocTxt ( Tree  t)

Definition at line 177 of file doc.cpp.

References DOCTXT, and CTree::node().

Referenced by printdoccontent().

{ return t->node() == Node(DOCTXT); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool isDocTxt ( Tree  t0,
const char **  str 
)

Definition at line 178 of file doc.cpp.

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

{
    Tree t1; Sym s;
    if ( isTree(t0, DOCTXT, t1) && isSym(t1->node(), &s) ) {
        *str = name(s);
        return true;
    } else {
        return false;
    }
}

Here is the call graph for this function:

static char * legalFileName ( const Tree  t,
int  n,
char *  dst 
) [static]

Transform the definition name property of tree <t> into a legal file name.

The resulting file name is stored in <dst> a table of at least <n> chars. Returns the <dst> pointer for convenience.

Definition at line 1072 of file doc.cpp.

References getDefNameProperty(), and tree2str().

Referenced by printDocDgm().

{
    Tree    id;
    int     i=0;
    if (getDefNameProperty(t, id)) {
        const char*     src = tree2str(id);
        for (i=0; isalnum(src[i]) && i<16; i++) {
            dst[i] = src[i];
        }
    }
    dst[i] = 0;
    if (strcmp(dst, "process") != 0) { 
        // if it is not process add the hex address to make the name unique
        snprintf(&dst[i], n-i, "-%p", t);
    }
    return dst;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int makedir ( const char *  dirname) [static]

Create a new directory in the current one.

Definition at line 982 of file doc.cpp.

References FAUST_PATH_MAX, and gCurrentDir.

Referenced by copyFaustSources(), and printDoc().

{
    char    buffer[FAUST_PATH_MAX];
    gCurrentDir = getcwd (buffer, FAUST_PATH_MAX);
    
    if ( gCurrentDir.c_str() != 0) {
        int status = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
        if (status == 0 || errno == EEXIST) {
            return 0;
        }
    }
    perror("makedir");
    exit(errno);
}

Here is the caller graph for this function:

static void mapCompileDocEqnSigs ( const vector< Tree > &  eqSigs,
const vector< int > &  eqInputs,
const vector< int > &  eqOutputs,
DocCompiler DC,
vector< Lateq * > &  docCompiledEqnsVector 
) [static]

step 10. Compile equations.

9.

Calculated and set lateq (LaTeX equation) names. Note : Transfered into mapCompileDocEqnSigs (DocCompiler::compileMultiSignal).

10. Name and compile prepared doc signals.

Parameters:
[in]eqSigsContains well-prepared and nicknamed signals.
[in]DCThe signals compiler.
[out]docCompiledEqnsVectorThe place to store each compiled Lateq* object.

Definition at line 760 of file doc.cpp.

References DocCompiler::compileLateq().

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : mapCompileDocEqnSigs" << endl;
    
    for( unsigned int i=0; i < eqSigs.size(); i++ ) {
        
        //      docCompiledEqnsVector.push_back( DC->compileMultiSignal(*it, 0) );
        docCompiledEqnsVector.push_back( DC->compileLateq(eqSigs[i], new Lateq(eqInputs[i], eqOutputs[i])) );
    }
    
    //cerr << "Documentator : end of mapCompileDocEqnSigs\n---" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void mapEvalDocEqn ( const vector< Tree > &  eqBoxes,
const Tree env,
vector< Tree > &  evalEqBoxes 
) [static]

step 1. Evaluate boxes.

1.

Evaluate every doc <equation> (evaluation replaces abstractions by symbolic boxes).

Parameters:
[in]eqBoxesThe boxes to evaluate.
[in]envThe environment for the evaluation.
[out]evalEqBoxesThe place to store evaluated equations boxes.

Definition at line 575 of file doc.cpp.

References evaldocexpr().

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : mapEvalDocEqn" << endl;
    
    for ( vector<Tree>::const_iterator eq=eqBoxes.begin(); eq < eqBoxes.end(); eq++)
    {
        evalEqBoxes.push_back(evaldocexpr( *eq, env ));
    }
    //cerr << "Documentator : end of mapEvalDocEqn\n---" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void mapGetEqName ( const vector< Tree > &  evalEqBoxes,
vector< string > &  eqNames 
) [static]

step 2. Get boxes name.

2.

Get name if exists, else create one, and store it.

Parameters:
[in]evalEqBoxesEvaluated box trees, eventually containing an equation name.
[out]eqNamesThe place to store equations names.

Definition at line 593 of file doc.cpp.

References calcNumberedName(), getBoxType(), getDefNameProperty(), and tree2str().

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : mapGetEqName" << endl;
    
    int i = 1;
    for( vector<Tree>::const_iterator eq = evalEqBoxes.begin(); eq < evalEqBoxes.end(); eq++, i++ ) {
        Tree id;
        string s;
        int n,m; getBoxType(*eq, &n, &m); // eq name only for bd without inputs
        if ( n==0 && getDefNameProperty(*eq, id) ) {
            s = tree2str(id);
        }
        else {
            s = calcNumberedName("doceqn-", i);
        }       
        eqNames.push_back( s ) ;
    }
    //cerr << "Documentator : end of mapGetEqName\n---" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void mapPrepareEqSig ( const vector< Tree > &  evalEqBoxes,
vector< int > &  eqInputs,
vector< int > &  eqOutputs,
vector< Tree > &  eqSigs 
) [static]

step 4&5. Propagate and prepare signals.

4&5.

Propagate and prepare every doc <equation>.

Call boxPropagateSig, deBruijn2Sym, simplify, and privatise.

Parameters:
[in]evalEqBoxesEquations boxes to propagate as signals.
[out]eqSigsThe place to store prepared signals.

< Convert debruijn recursion into symbolic recursion

< Simplify by executing every computable operation

< convert regular tables into special doctables (regular tables are difficult to translate to equations)

Definition at line 663 of file doc.cpp.

References boxPropagateSig(), deBruijn2Sym(), docTableConvertion(), getBoxInputsAndOutputs(), makeSigInputList(), nil, and simplify().

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : mapPrepareEqSig" << endl;
    
    for( vector<Tree>::const_iterator eq = evalEqBoxes.begin(); eq < evalEqBoxes.end(); eq++ ) {
        
        int numInputs, numOutputs;
        getBoxInputsAndOutputs(*eq, numInputs, numOutputs);
        //cerr << numInputs <<" ins and " << numOutputs <<" outs" << endl;
        eqInputs.push_back(numInputs);
        eqOutputs.push_back(numOutputs);
        
        Tree lsig1 = boxPropagateSig( nil, *eq , makeSigInputList(numInputs) );
        //cerr << "output signals are : " << endl;  printSignal(lsig1, stderr);
        
        Tree lsig2 = deBruijn2Sym(lsig1);   
        Tree lsig3 = simplify(lsig2);       
        //Tree lsig4 = privatise(lsig3);        ///< Un-share tables with multiple writers
        Tree lsig4 = docTableConvertion(lsig3);     


        eqSigs.push_back(lsig4);
    }
    //cerr << "Documentator : end of mapPrepareEqSig\n---" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void mapSetSigNickname ( const vector< string > &  eqNicknames,
const vector< int > &  eqInputs,
const vector< Tree > &  eqSigs 
) [static]

step 6. Set signals nicknames.

6.

Set signals nicknames.

Do nothing for the moment !

Parameters:
[in]eqNicknamesContains previously calculated nicknames.
[out]eqSigsThe signals to tag with a NICKNAMEPROPERTY.

Definition at line 697 of file doc.cpp.

Referenced by prepareDocEqns().

{
    //cerr << "###\n# Documentator : mapSetSigNickname" << endl;

//  Do nothing for the moment...
//  for( unsigned int i=0; i < eqSigs.size(); i++ ) {
//      if (eqInputs[i] == 0) // Only "generators" should be finally named with user equation (nick)name.
//          setSigListNickName(eqSigs[i], eqNicknames[i]);
//  }
    //cerr << "Documentator : end of mapSetSigNickname\n---" << endl;
}

Here is the caller graph for this function:

static int mkchdir ( const char *  dirname) [static]

Create a new directory in the current one, then 'cd' into this new directory.

Remarks:
The current directory is saved to be later restaured.

Definition at line 1005 of file doc.cpp.

References FAUST_PATH_MAX, and gCurrentDir.

Referenced by printDoc().

{
    char    buffer[FAUST_PATH_MAX];
    gCurrentDir = getcwd (buffer, FAUST_PATH_MAX);

    if ( gCurrentDir.c_str() != 0) {
        int status = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
        if (status == 0 || errno == EEXIST) {
            if (chdir(dirname) == 0) {
                return 0;
            }
        }
    }
    perror("mkchdir");
    exit(errno);
}

Here is the caller graph for this function:

static istream * openArchFile ( const string &  filename) [static]

Open architecture file.

Definition at line 1050 of file doc.cpp.

References cholddir(), getCurrentDir(), and open_arch_stream().

Referenced by printDoc().

{
    istream* file;
    getCurrentDir();    // Save the current directory.
    //cerr << "Documentator : openArchFile : Opening input file  '" << filename << "'" << endl;
    if ( (file = open_arch_stream(filename.c_str())) ) {
        //cerr << "Documentator : openArchFile : Opening '" << filename << "'" << endl;
    } else {
        cerr << "ERROR : can't open architecture file " << filename << endl;
        exit(1);
    }
    cholddir();         // Return to current directory.
    return file;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void prepareDocEqns ( const vector< Tree > &  docBoxes,
vector< Lateq * > &  docCompiledEqnsVector 
) [static]

Caller function.

Caller function for all steps of doc equations preparation.

Note : many of the functions called put their result into their last argument in a "source / destination" manner, the "destination" being declared before the function call.

Parameters:
[in]docBoxesThe <mdoc> boxes to collect and prepare.
[out]docCompiledEqnsVectorThe place to store compiled equations.

< step 0. Feed a vector.

< step 1. Evaluate boxes.

< step 2. Get boxes name.

< step 3. Calculate nicknames.

< step 4&5. Propagate and prepare signals.

< step 6. Set signals nicknames.

< step 7. Collect all signals in a superlist.

< step 8. Annotate superEqList.

< step 10. Compile every signal.

Definition at line 520 of file doc.cpp.

References annotateSuperList(), calcEqnsNicknames(), collectDocEqns(), collectEqSigs(), gExpandedDefList, mapCompileDocEqnSigs(), mapEvalDocEqn(), mapGetEqName(), mapPrepareEqSig(), and mapSetSigNickname().

Referenced by printdoccontent().

{   
    vector<Tree>    eqBoxes;        collectDocEqns( docBoxes, eqBoxes );        
    
    if(! eqBoxes.empty() ) {
        vector<Tree>    evalEqBoxes;    mapEvalDocEqn( eqBoxes, gExpandedDefList, evalEqBoxes );    
        vector<string>  eqNames;        mapGetEqName( evalEqBoxes, eqNames );       
        vector<string>  eqNicknames;    calcEqnsNicknames( eqNames, eqNicknames );  
        
        vector<int>     eqInputs;
        vector<int>     eqOutputs;
        vector<Tree>    eqSigs;         mapPrepareEqSig( evalEqBoxes, eqInputs, eqOutputs, eqSigs );    
        mapSetSigNickname( eqNicknames, eqInputs, eqSigs );                                 
        Tree            superEqList;    collectEqSigs( eqSigs, superEqList );       
        
        DocCompiler* DC = new DocCompiler(0, 0);
        annotateSuperList( DC, superEqList );                                       
        //calcAndSetLtqNames( superEqList );                                        ///< step 9. (directly in 10.)
        mapCompileDocEqnSigs( eqSigs, eqInputs, eqOutputs, DC, docCompiledEqnsVector );     
    }
}

Here is the call graph for this function:

Here is the caller 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 229 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().

{
    gDocDevSuffix = docdev;
    
    //cerr << "Documentator : printDoc : gFaustDirectory = '" << gFaustDirectory << "'" << endl;
    //cerr << "Documentator : printDoc : gFaustSuperDirectory = '" << gFaustSuperDirectory << "'" << endl;
    //cerr << "Documentator : printDoc : gFaustSuperSuperDirectory = '" << gFaustSuperSuperDirectory << "'" << endl;
    //cerr << "Documentator : printDoc : gCurrentDir = '" << gCurrentDir << "'" << endl;
    
    makedir(projname);          // create a top directory to store files
    
    string svgTopDir = subst("$0/svg", projname);
    makedir(svgTopDir.c_str()); // create a directory to store svg-* subdirectories.
    
    string cppdir = subst("$0/cpp", projname);
    makedir(cppdir.c_str());    // create a cpp directory.
    
    string pdfdir = subst("$0/pdf", projname);
    makedir(pdfdir.c_str());    // create a pdf directory.
    
    /* Copy all Faust source files into an 'src' sub-directory. */
    vector<string> pathnames = gReader.listSrcFiles();
    copyFaustSources(projname, pathnames);
    
    string texdir = subst("$0/tex", projname);
    mkchdir(texdir.c_str());    // create a directory and move into.

    ofstream docout(subst("$0.$1", gDocName, docdev).c_str());
    cholddir();                 // return to current directory
    
    loadTranslationFile(gDocLang);
    
    if (gDocVector.empty()) { declareAutoDoc(); }   
    
    printfaustdocstamp(faustversion, docout);                       
    istream* latexheader = openArchFile(gLatexheaderfilename);
    printlatexheader(*latexheader, faustversion, docout);                       
    printdoccontent(svgTopDir.c_str(), gDocVector, faustversion, docout);       
    printlatexfooter(docout);                                       
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printdocCodeSlices ( const string &  code,
ostream &  docout 
) [static]

Print faust code inside a listing environment.

Parameters:
[in]codeFaust code as a string (may contain '
' characters).
[out]docoutThe output file to print into.

Definition at line 939 of file doc.cpp.

Referenced by printdoccontent().

{
    if ( ! code.empty() ) {
        docout << endl << "\\begin{lstlisting}[numbers=none, frame=none, basicstyle=\\small\\ttfamily, backgroundcolor=\\color{yobg}]" << endl;
        docout << code << endl;
        docout << "\\end{lstlisting}" << endl << endl;
    }
}

Here is the caller graph for this function:

static void printdoccontent ( const char *  svgTopDir,
const vector< Tree > &  docVector,
const string &  faustversion,
ostream &  docout 
) [static]

Main documentator loop.

First loop on gDocVector, which contains the faust <mdoc> trees. Second loop for each of these <mdoc> trees, which contain parsed input expressions of 3 types : DOCEQN for <equation> tags, DOCDGM for <diagram> tags, and DOCTXT for direct LaTeX text (no tag).

  • DOCTXT expressions printing is trivial.
  • DOCDGM expressions printing calls 'printDocDgm' to generate SVG files and print LaTeX "figure" code.
  • DOCEQN expressions printing calls 'printDocEqn' after an important preparing work has been done by 'prepareDocEqns'.
Parameters:
[in]projnameBasename of the new doc directory ("*-math").
[in]docVectorContains all <mdoc> parsed content (as boxes).
[in]faustversionThe current version of this Faust compiler.
[out]docoutThe output file to print into.

Equations need to be prepared (named and compiled) before printing.

< Quite a lot of stuff there.

< For diagram directories numbering.

First level printing loop, on docVector.

Second level printing loop, on each <mdoc>.

< After equations are well prepared and named.

Definition at line 441 of file doc.cpp.

References CTree::branch(), doc, docCodeSlicer(), doesFileBeginWithCode(), gLstDistributedSwitch, gMasterDocument, hd(), isDocDgm(), isDocEqn(), isDocLst(), isDocMtd(), isDocNtc(), isDocTxt(), isList(), prepareDocEqns(), printdocCodeSlices(), printDocDgm(), printDocEqn(), printDocMetadata(), printDocNotice(), printfaustlistings(), reverse(), and tl().

Referenced by printDoc().

{
    //cerr << endl << "Documentator : printdoccontent : " << docVector.size() << " <mdoc> tags read." << endl;
    
    vector<Lateq*>  docCompiledEqnsVector;
    prepareDocEqns( docVector, docCompiledEqnsVector ); 
    vector<Lateq*>::iterator eqn_it = docCompiledEqnsVector.begin();
    
    int dgmIndex = 1;           

    vector<string> docMasterCodeMap;
    docMasterCodeMap = docCodeSlicer(gMasterDocument, docMasterCodeMap);
    
    vector<Tree>::const_iterator doc;
    vector<string>::const_iterator code;
    code = docMasterCodeMap.begin();
    
    if(doesFileBeginWithCode(gMasterDocument) && (! docMasterCodeMap.empty()) && gLstDistributedSwitch ) {
        printdocCodeSlices(*code, docout);
        code++;
    }
    
    for (doc=docVector.begin(); doc<docVector.end(); doc++, code++) {
        
        Tree L = reverse(*doc);
        //cerr << "Entering into <mdoc> parsing..." << endl; 
        
        while (isList(L)) {
            Tree expr;
            if ( isDocEqn(hd(L), expr) ) { 
                printDocEqn(*eqn_it++, docout);
            }
            else if ( isDocDgm(hd(L), expr) ) { 
                printDocDgm(expr, svgTopDir, docout, dgmIndex++);
            }
            else if ( isDocMtd(hd(L), expr) ) { 
                printDocMetadata(expr, docout);
            }
            else if ( isDocTxt(hd(L)) ) { 
                docout << *hd(L)->branch(0); // Directly print registered doc text.
            }
            else if ( isDocNtc(hd(L)) ) { 
                printDocNotice(faustversion, docout);
            }
            else if ( isDocLst(hd(L)) ) { 
                printfaustlistings(docout);
            }
            else { 
                cerr << "ERROR : " << *hd(L) << " is not a valid documentation type." << endl; 
            }
            L = tl(L);
        }
        //cerr << " ...end of <mdoc> parsing." << endl; 
        
        if ( code != docMasterCodeMap.end() && gLstDistributedSwitch ) {
            printdocCodeSlices(*code, docout);
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printDocDgm ( const Tree  expr,
const char *  svgTopDir,
ostream &  docout,
int  i 
) [static]

Doc diagrams handling.

Three steps :

  1. evaluate expression
  2. call svg drawing in the appropriate directory
  3. print latex figure code with the appropriate directory reference
Parameters:
[in]exprParsed input expression, as boxes tree.
[in]svgTopDirBasename of the new doc directory ("*-math/svg").
[out]docoutThe output file to print into.
  1. Evaluate expression.
  1. Draw the diagram after its evaluation, in SVG. Warning : pdflatex can't directly include SVG files !
  1. Print LaTeX figure code.
  1. Warn about naming interferences (in the notice).

Definition at line 847 of file doc.cpp.

References drawSchema(), evaldocexpr(), gDocMathStringMap, gDocNoticeFlagMap, gErrorCount, gExpandedDefList, legalFileName(), MAXIDCHARS, and subst().

Referenced by printdoccontent().

{
    Tree docdgm = evaldocexpr(expr, gExpandedDefList);
    if (gErrorCount > 0) {
        cerr << "Total of " << gErrorCount << " errors during evaluation of : diagram docdgm = " << boxpp(docdgm) << ";\n";
        exit(1);
    }
    
    char dgmid[MAXIDCHARS+1];
    sprintf(dgmid, "%02d", i);
    string thisdgmdir = subst("$0/svg-$1", svgTopDir, dgmid);
    //cerr << "Documentator : printDocDgm : drawSchema in '" << gCurrentDir << "/" << thisdgmdir << "'" << endl;
    
    drawSchema( docdgm, thisdgmdir.c_str(), "svg" );
    
    char temp[1024];
    const string dgmfilename = legalFileName(docdgm, 1024, temp);
    //docout << "figure \\ref{figure" << i << "}";
    docout << "\\begin{figure}[ht!]" << endl;
    docout << "\t\\centering" << endl;
    docout << "\t\\includegraphics[width=\\textwidth]{" << subst("../svg/svg-$0/", dgmid) << dgmfilename << "}" << endl;
    docout << "\t\\caption{" << gDocMathStringMap["dgmcaption"] << " \\texttt{" << dgmfilename << "}}" << endl;
    docout << "\t\\label{figure" << i << "}" << endl;
    docout << "\\end{figure}" << endl << endl;
    
    gDocNoticeFlagMap["nameconflicts"] = true;
    gDocNoticeFlagMap["svgdir"] = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printDocEqn ( Lateq ltq,
ostream &  docout 
) [static]

Print doc equations, following the Lateq::println method.

Parameters:
[in]ltqThe object containing compiled LaTeX code of equations.
[out]docoutThe output file to print into.

Definition at line 824 of file doc.cpp.

References Lateq::println().

Referenced by printdoccontent().

{
    ltq->println(docout);
    //cerr << "Documentator : printDocEqn : "; ltq->println(cerr); cerr << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printDocMetadata ( const Tree  expr,
ostream &  docout 
) [static]

Print a metadata set.

Each metadata is a set, in order to handle multiple items, like multiple authors, even if most of metadatas have unique items.

Parameters:
[in]exprParsed metadata keyname, as boxes tree.
[out]docoutThe output file to print into.

Definition at line 316 of file doc.cpp.

References gMetaDataSet, rmExternalDoubleQuotes(), and tree2str().

Referenced by printdoccontent().

{
    if (gMetaDataSet.count(expr)) {
        string sep = "";
        set<Tree> mset = gMetaDataSet[expr];
        
        for (set<Tree>::iterator j = mset.begin(); j != mset.end(); j++) {
            docout << sep << rmExternalDoubleQuotes(tree2str(*j));
            sep = ", ";
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printfaustdocstamp ( const string &  faustversion,
ostream &  docout 
) [static]

Print a "doc stamp" in the LaTeX document :

  • the Faust version,
  • the date of doc compilation,
  • faust's web site URL.
Parameters:
[in]faustversionThe current version of this Faust compiler.
[out]docoutThe LaTeX output file to print into.

Definition at line 409 of file doc.cpp.

References getCompilationDate().

Referenced by printDoc().

{
    char datebuf [150];
    strftime (datebuf, 150, "%c", getCompilationDate());
    
    docout << "%% This documentation was generated with Faust version " << faustversion << endl;
    docout << "%% " << datebuf << endl;
    docout << "%% http://faust.grame.fr" << endl << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printfaustlisting ( string &  faustfile,
ostream &  docout 
) [static]

Print a listing of the Faust code, in a LaTeX "listing" environment.

Strip content of <mdoc> tags.

Parameters:
[in]faustfileThe source file containing the Faust code.
[out]docoutThe LaTeX output file to print into.

We suppose there's only one <mdoc> tag per line.

Definition at line 356 of file doc.cpp.

References filebasename(), and gStripDocSwitch.

Referenced by printfaustlistings().

{   
    string  s;
    ifstream src;
    
    //cerr << "Documentator : printfaustlisting : Opening file '" << faustfile << "'" << endl;
    src.open(faustfile.c_str(), ifstream::in);
    
    docout << endl << "\\bigskip\\bigskip" << endl;
    docout << "\\begin{lstlisting}[caption=\\texttt{" << filebasename(faustfile.c_str()) << "}]" << endl;

    bool isInsideDoc = false;
    
    if (faustfile != "" && src.good()) {
        while(getline(src, s)) { 
            size_t foundopendoc  = s.find("<mdoc>");
            if (foundopendoc != string::npos && gStripDocSwitch) isInsideDoc = true;
            
            if (isInsideDoc == false)
                docout << s << endl;
            
            size_t foundclosedoc = s.find("</mdoc>");
            if (foundclosedoc != string::npos && gStripDocSwitch) isInsideDoc = false;
        }
    } else {
        cerr << "ERROR : can't open faust source file " << faustfile << endl;
        exit(1);
    }
    
    docout << "\\end{lstlisting}" << endl << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printfaustlistings ( ostream &  docout) [static]

Print listings of each Faust code ".dsp" files, calling the 'printfaustlisting' function.

Parameters:
[out]docoutThe LaTeX output file to print into.

Definition at line 336 of file doc.cpp.

References gLstDependenciesSwitch, gMasterDocument, gReader, SourceReader::listSrcFiles(), and printfaustlisting().

Referenced by printdoccontent().

{   
    if (gLstDependenciesSwitch) {
        vector<string> pathnames = gReader.listSrcFiles();
        for (unsigned int i=0; i< pathnames.size(); i++) {
            printfaustlisting(pathnames[i], docout);
        }
    } else {
        printfaustlisting(gMasterDocument, docout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void printlatexfooter ( ostream &  docout) [static]

Print the static LaTeX footer.

Parameters:
[out]docoutThe LaTeX output file to print into.

Definition at line 394 of file doc.cpp.

Referenced by printDoc().

{
    docout << endl << "\\end{document}" << endl << endl;
}

Here is the caller graph for this function:

static void printlatexheader ( istream &  latexheader,
const string &  faustversion,
ostream &  docout 
) [static]

Print a static LaTeX header.

Parameters:
[in]latexheaderThe file containing the static part of the LaTeX header.
[in]faustversionThe current version of this Faust compiler.
[out]docoutThe LaTeX output file to print into.

Specific LaTeX macros for Faust

Definition at line 288 of file doc.cpp.

References getCompilationDate(), gMasterDocument, and gMasterName.

Referenced by printDoc().

{   
    string  s;
    while(getline(latexheader, s)) docout << s << endl;
    
    docout << "\\newcommand{\\faustfilename}{" << gMasterDocument << "}" << endl;
    docout << "\\newcommand{\\faustdocdir}{" << gMasterName << "-mdoc}" << endl;
    docout << "\\newcommand{\\faustprogname}{" << gMasterName << "}" << endl;
    docout << "\\newcommand{\\faustversion}{" << faustversion << "}" << endl;
    char datebuf [150];
    strftime (datebuf, 150, "%B %d, %Y", getCompilationDate());
    docout << "\\newcommand{\\faustdocdate}{" << datebuf << "}" << endl;
    
    docout << endl << "\\begin{document}" << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string rmExternalDoubleQuotes ( const string &  s) [static]

Remove the leading and trailing double quotes of a string (but not those in the middle of the string)

Definition at line 1105 of file doc.cpp.

Referenced by printDocMetadata().

{
    size_t i = s.find_first_not_of("\"");
    size_t j = s.find_last_not_of("\"");
    
    if ( (i != string::npos) & (j != string::npos) ) {
        return s.substr(i, 1+j-i);
    } else {
        return "";
    }
}

Here is the caller graph for this function:


Variable Documentation

Sym DOCDGM = symbol ("DocDgm")

Definition at line 193 of file doc.cpp.

Referenced by docDgm(), and isDocDgm().

Sym DOCEQN = symbol ("DocEqn")

Definition at line 189 of file doc.cpp.

Referenced by docEqn(), and isDocEqn().

Sym DOCLST = symbol ("DocLst")

Definition at line 201 of file doc.cpp.

Referenced by docLst(), and isDocLst().

Sym DOCMTD = symbol ("DocMtd")

Definition at line 205 of file doc.cpp.

Referenced by docMtd(), and isDocMtd().

Sym DOCNTC = symbol ("DocNtc")

Definition at line 197 of file doc.cpp.

Referenced by docNtc(), and isDocNtc().

Sym DOCTXT = symbol ("DocTxt")

Definition at line 175 of file doc.cpp.

Referenced by docTxt(), and isDocTxt().

struct tm gCompilationDate [static]

Definition at line 112 of file doc.cpp.

Referenced by getCompilationDate(), and initCompilationDate().

string gCurrentDir [static]

Room to save current directory name.

Definition at line 107 of file doc.cpp.

Referenced by cholddir(), getCurrentDir(), makedir(), and mkchdir().

Definition at line 114 of file main.cpp.

Referenced by main(), and process_cmdline().

const char* gDocDevSuffix [static]

".tex" (or .??? - used to choose output device).

Definition at line 106 of file doc.cpp.

Referenced by printDoc().

string gDocLang

Definition at line 119 of file doc.cpp.

Referenced by printDoc(), and process_cmdline().

map<string, string> gDocMathStringMap
map<string, string> gDocMetadatasStringMap

Definition at line 35 of file doc_metadatas.cpp.

Referenced by declareAutoDoc(), importDocStrings(), and storePair().

string gDocName

Contains the filename for out documentation.

Definition at line 107 of file main.cpp.

Referenced by declareAutoDoc(), initFaustDirectories(), and printDoc().

vector<Tree> gDocVector

Contains <mdoc> parsed trees: DOCTXT, DOCEQN, DOCDGM.

Definition at line 110 of file doc.cpp.

Referenced by declareDoc(), and printDoc().

Definition at line 108 of file main.cpp.

Referenced by main(), prepareDocEqns(), and printDocDgm().

Definition at line 103 of file main.cpp.

Referenced by fopensearch(), initFaustDirectories(), and open_arch_stream().

Definition at line 102 of file main.cpp.

Referenced by fopensearch(), initFaustDirectories(), and open_arch_stream().

Definition at line 101 of file main.cpp.

Referenced by fopensearch(), initFaustDirectories(), and open_arch_stream().

const string gLatexheaderfilename = "latexheader.tex" [static]

Definition at line 108 of file doc.cpp.

Referenced by printDoc().

mdoc listing management.

Definition at line 114 of file doc.cpp.

Referenced by printfaustlistings(), and yyparse().

bool gLstDistributedSwitch = true

mdoc listing management.

Definition at line 116 of file doc.cpp.

Referenced by printdoccontent(), and yyparse().

bool gLstMdocTagsSwitch = true

mdoc listing management.

Definition at line 115 of file doc.cpp.

string gMasterName

Definition at line 106 of file main.cpp.

Referenced by initFaustDirectories(), and printlatexheader().

map<Tree, set<Tree> > gMetaDataSet

Definition at line 89 of file main.cpp.

Referenced by main(), printDoc(), and printfaustlistings().

Definition at line 123 of file main.cpp.

Referenced by printfaustlisting(), process_cmdline(), and yyparse().