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. More...
 
static bool isVerySimpleFormula (Tree sig)
 Test if exp is very simple that is it can't be considered a real component. More...
 
static bool isSeparator (char c)
 tests if a charactere is a word separator More...
 
static string replaceTimeBy (const string &src, char r)
 Replaces the occurences of 't' in a formula with another character. More...
 

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.

Referenced by DocCompiler::generateBinOp().

401  {
402  return (opcode == kAdd) || (opcode == kMul) || (opcode == kAND) || (opcode == kOR) || (opcode == kXOR);
403 }
Definition: binop.hh:59
Definition: binop.hh:56
Definition: binop.hh:59
Definition: binop.hh:56
Definition: binop.hh:59

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().

789 {
790  bool w = ( ((c >= 'a') && (c <='z'))
791  || ((c >= 'A') && (c <='Z'))
792  || ((c >= '0') && (c <='9'))
793  );
794 
795  return ! w;
796 }

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().

512 {
513  int i;
514  double r;
515  Tree type, name, file, label, c, x, y, z;
516 
517  return isSigInt(sig, &i)
518  || isSigReal(sig, &r)
519  || isSigInput(sig, &i)
520  || isSigFConst(sig, type, name, file)
521  || isSigButton(sig, label)
522  || isSigCheckbox(sig, label)
523  || isSigVSlider(sig, label,c,x,y,z)
524  || isSigHSlider(sig, label,c,x,y,z)
525  || isSigNumEntry(sig, label,c,x,y,z)
526  ;
527 }
bool isSigHSlider(Tree s)
Definition: signals.cpp:217
bool isSigFConst(Tree s)
Definition: signals.cpp:138
bool isSigCheckbox(Tree s)
Definition: signals.cpp:205
bool isSigNumEntry(Tree s)
Definition: signals.cpp:257
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
Definition: tree.hh:109
bool isSigInput(Tree t, int *i)
Definition: signals.cpp:48
bool isSigVSlider(Tree s)
Definition: signals.cpp:237
bool isSigReal(Tree t, double *r)
Definition: signals.cpp:44
const char * name(Symbol *sym)
Returns the name of a symbol.
Definition: symbol.hh:98
bool isSigInt(Tree t, int *i)
Definition: signals.cpp:41
bool isSigButton(Tree s)
Definition: signals.cpp:199

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().

803 {
804  string dst;
805  char pre = 0;
806  for (size_t i=0; i < src.size(); i++)
807  {
808  char x = src[i];
809  if ((x=='t') && isSeparator(pre) && ((i == src.size()-1) || isSeparator(src[i+1]))) {
810  dst.push_back(r);
811  } else {
812  dst.push_back(x);
813  }
814  pre = x;
815  }
816  return dst;
817 }
static bool isSeparator(char c)
tests if a charactere is a word separator

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.

Referenced by DocCompiler::prepareBinaryUI(), and DocCompiler::prepareIntervallicUI().

bool gLessTempSwitch

Definition at line 130 of file main.cpp.

int gMaxCopyDelay
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.