FAUST compiler  0.9.9.6b8
Functions | Variables
doc_compile.cpp File Reference
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <math.h>
#include "doc_compile.hh"
#include "sigtype.hh"
#include "floats.hh"
#include "sigprint.hh"
#include "sigtyperules.hh"
#include "recursivness.hh"
#include "simplify.hh"
#include "privatise.hh"
#include "prim2.hh"
#include "xtended.hh"
#include "compatibility.hh"
#include "ppsig.hh"
#include "names.hh"
#include "doc.hh"
#include "tlib.hh"
#include "doc_notice.hh"
Include dependency graph for doc_compile.cpp:

Go to the source code of this file.

Functions

bool getSigListNickName (Tree t, Tree &id)
static bool associative (int opcode)
 Generate binary operations, managing priority parenthesis.
static bool isVerySimpleFormula (Tree sig)
 Test if exp is very simple that is it can't be considered a real component.
static bool isSeparator (char c)
 tests if a charactere is a word separator
static string replaceTimeBy (const string &src, char r)
 Replaces the occurences of 't' in a formula with another character.

Variables

bool gLessTempSwitch
int gMaxCopyDelay
map< string, string > gDocMathStringMap
static const unsigned int MAX_RIGHT_MEMBER = 20
static const unsigned int MAX_SUB_EXPR = 10

Function Documentation

static bool associative ( int  opcode) [static]

Generate binary operations, managing priority parenthesis.

((a*b)+c) can be written (a*b+c) if priority(*) > priority(+) ((a*b)*c) can be writteb (a*b*c) if * is associative Associative operation should have a distinc priority from other operations. Non associative operations can share the same priority.

Parameters:
sigThe signal expression to treat.
opcodeThe operation code, as described in gBinOpLateqTable.
arg1The first operand.
arg2The second operand.
priorityThe priority of the environment of the expression.
Returns:
<string> The LaTeX code translation of the signal, cached.
Remarks:
The case of LaTeX frac{}{} is special.
Todo:
Handle integer arithmetics, by testing arguments type, and printing dedicated operators (, , , ).

associative operations are + * | & xor

Definition at line 401 of file doc_compile.cpp.

References kAdd, kAND, kMul, kOR, and kXOR.

Referenced by DocCompiler::generateBinOp().

                                     {
    return (opcode == kAdd) || (opcode == kMul) || (opcode == kAND) || (opcode == kOR) || (opcode == kXOR);
}

Here is the caller graph for this function:

bool getSigListNickName ( Tree  t,
Tree id 
)
static bool isSeparator ( char  c) [static]

tests if a charactere is a word separator

Definition at line 788 of file doc_compile.cpp.

Referenced by replaceTimeBy().

{
    bool w = (  ((c >= 'a') && (c <='z'))
            ||  ((c >= 'A') && (c <='Z'))
            ||  ((c >= '0') && (c <='9'))
            );

    return ! w;
}

Here is the caller graph for this function:

static bool isVerySimpleFormula ( Tree  sig) [static]

Test if exp is very simple that is it can't be considered a real component.

Parameters:
expthe signal we want to test
Returns:
true if it a very simple signal

Definition at line 511 of file doc_compile.cpp.

References isSigButton(), isSigCheckbox(), isSigFConst(), isSigHSlider(), isSigInput(), isSigInt(), isSigNumEntry(), isSigReal(), isSigVSlider(), and name().

Referenced by DocCompiler::generateCacheCode().

{
    int     i;
    double  r;
    Tree    type, name, file, label, c, x, y, z;
    
    return  isSigInt(sig, &i) 
    ||  isSigReal(sig, &r)
    ||  isSigInput(sig, &i)
    ||  isSigFConst(sig, type, name, file)
    ||  isSigButton(sig, label)
    ||  isSigCheckbox(sig, label)
    ||  isSigVSlider(sig, label,c,x,y,z)
    ||  isSigHSlider(sig, label,c,x,y,z)
    ||  isSigNumEntry(sig, label,c,x,y,z)
    ;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static string replaceTimeBy ( const string &  src,
char  r 
) [static]

Replaces the occurences of 't' in a formula with another character.

Definition at line 802 of file doc_compile.cpp.

References isSeparator().

Referenced by DocCompiler::generateDocWriteTbl().

{
    string  dst;
    char    pre = 0;
    for (size_t i=0; i < src.size(); i++)
    {
        char x = src[i];
        if ((x=='t') && isSeparator(pre) && ((i == src.size()-1) || isSeparator(src[i+1]))) {
            dst.push_back(r);
        } else {
            dst.push_back(x);
        }
        pre = x;
    }
    return dst;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

map<string, string> gDocMathStringMap

Definition at line 51 of file lateq.cpp.

Definition at line 129 of file main.cpp.

Referenced by process_cmdline().

const unsigned int MAX_RIGHT_MEMBER = 20 [static]

Definition at line 62 of file doc_compile.cpp.

const unsigned int MAX_SUB_EXPR = 10 [static]

Definition at line 63 of file doc_compile.cpp.