|
FAUST compiler
0.9.9.6b8
|
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <limits.h>#include "tree.hh"#include <fstream>#include <cstdlib>
Go to the source code of this file.
Defines | |
| #define | ERROR(s, t) { error(s,t); exit(1); } |
Functions | |
| static void | error (const char *s, Tree t) |
| int | tree2int (Tree t) |
| if t has a node of type int, return it otherwise error | |
| double | tree2float (Tree t) |
| if t has a node of type float, return it otherwise error | |
| double | tree2double (Tree t) |
| if t has a node of type float, return it otherwise error | |
| const char * | tree2str (Tree t) |
| if t has a node of type symbol, return its name otherwise error | |
| void * | tree2ptr (Tree t) |
| if t has a node of type ptr, return it otherwise error | |
| bool | isTree (const Tree &t, const Node &n) |
| bool | isTree (const Tree &t, const Node &n, Tree &a) |
| bool | isTree (const Tree &t, const Node &n, Tree &a, Tree &b) |
| bool | isTree (const Tree &t, const Node &n, Tree &a, Tree &b, Tree &c) |
| bool | isTree (const Tree &t, const Node &n, Tree &a, Tree &b, Tree &c, Tree &d) |
| bool | isTree (const Tree &t, const Node &n, Tree &a, Tree &b, Tree &c, Tree &d, Tree &e) |
| void * | getUserData (Tree t) |
| if t has a node of type symbol, return the associated user data | |
Variables | |
| Tabber | TABBER (1) |
| Sym | PROCESS = symbol("process") |
Definition at line 96 of file tree.cpp.
Referenced by tree2double(), tree2float(), tree2int(), tree2ptr(), and tree2str().
| void* getUserData | ( | Tree | t | ) |
if t has a node of type symbol, return the associated user data
Definition at line 372 of file tree.cpp.
References getUserData(), isSym(), and CTree::node().
{
Sym s;
if (isSym(t->node(), &s)) {
return getUserData(s);
} else {
return 0;
}
}

Definition at line 305 of file tree.cpp.
References CTree::node().
Referenced by isBoxAbstr(), isBoxAccess(), isBoxAppl(), isBoxButton(), isBoxCase(), isBoxCheckbox(), isBoxComponent(), isBoxCut(), isBoxEnvironment(), isBoxError(), isBoxFConst(), isBoxFFun(), isBoxFVar(), isBoxHBargraph(), isBoxHGroup(), isBoxHSlider(), isBoxIdent(), isBoxIPar(), isBoxIProd(), isBoxISeq(), isBoxISum(), isBoxLibrary(), isBoxMerge(), isBoxModifLocalDef(), isBoxNumEntry(), isBoxPar(), isBoxPatternMatcher(), isBoxPatternVar(), isBoxPrim0(), isBoxPrim1(), isBoxPrim2(), isBoxPrim3(), isBoxPrim4(), isBoxPrim5(), isBoxRec(), isBoxSeq(), isBoxSlot(), isBoxSplit(), isBoxSymbolic(), isBoxTGroup(), isBoxVBargraph(), isBoxVGroup(), isBoxVSlider(), isBoxWire(), isBoxWithLocalDef(), isClosure(), isDocDgm(), isDocEqn(), isDocLst(), isDocMtd(), isDocNtc(), isDocTxt(), isImportFile(), isPathCurrent(), isPathParent(), isPathRoot(), isProj(), isRec(), isRef(), isSigAttach(), isSigBinOp(), isSigButton(), isSigCheckbox(), isSigDelay1(), isSigDocAccessTbl(), isSigDocConstantTbl(), isSigDocWriteTbl(), isSigFConst(), isSigFFun(), isSigFixDelay(), isSigFloatCast(), isSigFVar(), isSigGen(), isSigHBargraph(), isSigHSlider(), isSigInput(), isSigIntCast(), isSigIota(), isSigNumEntry(), isSigOutput(), isSigPrefix(), isSigRDTbl(), isSigSelect2(), isSigSelect3(), isSigTable(), isSigTuple(), isSigTupleAccess(), isSigVBargraph(), isSigVSlider(), isSigWRTbl(), isUiFolder(), and isUiWidget().
{
return (t->node() == n);
}

Definition at line 310 of file tree.cpp.
References CTree::arity(), CTree::branch(), and CTree::node().
{
if ((t->node() == n) && (t->arity() == 1)) {
a=t->branch(0);
return true;
} else {
return false;
}
}

Definition at line 320 of file tree.cpp.
References CTree::arity(), CTree::branch(), and CTree::node().
{
if ((t->node() == n) && (t->arity() == 2)) {
a=t->branch(0);
b=t->branch(1);
return true;
} else {
return false;
}
}

Definition at line 331 of file tree.cpp.
References CTree::arity(), CTree::branch(), and CTree::node().
{
if ((t->node() == n) && (t->arity() == 3)) {
a=t->branch(0);
b=t->branch(1);
c=t->branch(2);
return true;
} else {
return false;
}
}

Definition at line 343 of file tree.cpp.
References CTree::arity(), CTree::branch(), and CTree::node().
{
if ((t->node() == n) && (t->arity() == 4)) {
a=t->branch(0);
b=t->branch(1);
c=t->branch(2);
d=t->branch(3);
return true;
} else {
return false;
}
}

Definition at line 356 of file tree.cpp.
References CTree::arity(), CTree::branch(), and CTree::node().
{
if ((t->node() == n) && (t->arity() == 5)) {
a=t->branch(0);
b=t->branch(1);
c=t->branch(2);
d=t->branch(3);
e=t->branch(4);
return true;
} else {
return false;
}
}

| double tree2double | ( | Tree | t | ) |
if t has a node of type float, return it otherwise error
Definition at line 262 of file tree.cpp.
References ERROR, isDouble(), isInt(), and CTree::node().
Referenced by Description::addWidget().
{
double x;
int i;
if (isInt(t->node(), &i)) {
x = double(i);
} else if (isDouble(t->node(), &x)) {
//nothing to do
} else {
ERROR("the node of the tree is not a float nor an int", t);
}
return double(x);
}


| double tree2float | ( | Tree | t | ) |
if t has a node of type float, return it otherwise error
Definition at line 246 of file tree.cpp.
References ERROR, isDouble(), isInt(), and CTree::node().
Referenced by eval2double(), ScalarCompiler::generateHSlider(), ScalarCompiler::generateNumEntry(), ScalarCompiler::generateVSlider(), Compiler::generateWidgetCode(), Compiler::generateWidgetMacro(), infereSigType(), and DocCompiler::prepareIntervallicUI().
{
double x;
int i;
if (isInt(t->node(), &i)) {
x = double(i);
} else if (isDouble(t->node(), &x)) {
//nothing to do
} else {
ERROR("the node of the tree is not a float nor an int", t);
}
return x;
}


if t has a node of type int, return it otherwise error
Definition at line 230 of file tree.cpp.
References ERROR, isDouble(), isInt(), and CTree::node().
Referenced by Description::addGroup(), annotate(), boxComplexity(), eval2int(), ffargtype(), ffrestype(), Compiler::generateUserInterfaceTree(), getRecursivness(), getSigOrder(), infereFConstType(), infereFVarType(), and isBoxPatternMatcher().
{
double x;
int i;
if (isInt(t->node(), &i)) {
// nothing to do
} else if (isDouble(t->node(), &x)) {
i = int(x);
} else {
ERROR("the node of the tree is not an int nor a float", t);
}
return i;
}


if t has a node of type ptr, return it otherwise error
Definition at line 288 of file tree.cpp.
References ERROR, isPointer(), and CTree::node().
Referenced by getColorProperty(), OccMarkup::getOcc(), and isBoxPatternMatcher().
{
void* x;
if (! isPointer(t->node(), &x)) {
ERROR("the node of the tree is not a pointer", t);
}
return x;
}


if t has a node of type symbol, return its name otherwise error
Definition at line 278 of file tree.cpp.
References ERROR, isSym(), name(), and CTree::node().
Referenced by Description::addGroup(), Description::addWidget(), applyList(), DocCompiler::compileLateq(), declareAutoDoc(), declareMetadata(), SourceReader::expandrec(), extractName(), ffincfile(), fflibfile(), ffname(), ScalarCompiler::generateCode(), DocCompiler::generateCode(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), Compiler::generateMacroInterfaceTree(), generateOutputSlotSchema(), Compiler::generateUserInterfaceTree(), Compiler::generateWidgetCode(), Compiler::generateWidgetMacro(), DocCompiler::getUIDir(), DocCompiler::getUIDocInfos(), legalFileName(), main(), mapGetEqName(), ppsig::print(), boxpp::print(), printDocMetadata(), realeval(), and writeSchemaFile().
{
Sym s;
if (!isSym(t->node(), &s)) {
ERROR("the node of the tree is not a symbol", t);
}
return name(s);
}


Definition at line 87 of file tree.cpp.
Referenced by annotationStatistics(), getSigType(), setSigType(), T(), and traced_simplification().
1.8.0