Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Oct 26, 2023
1 parent 6e859e6 commit 1d14a94
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 43 deletions.
8 changes: 3 additions & 5 deletions compiler/boxes/boxcomplexity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ int boxComplexity(Tree box)
*/
static int computeBoxComplexity(Tree box)
{
int i;
double r;
prim0 p0;
prim1 p1;
prim2 p2;
Expand All @@ -92,9 +90,9 @@ static int computeBoxComplexity(Tree box)
// simple elements
if (xt)
return 1;
else if (isBoxInt(box, &i))
else if (isBoxInt(box))
return 1;
else if (isBoxReal(box, &r))
else if (isBoxReal(box))
return 1;

else if (isBoxWaveform(box))
Expand Down Expand Up @@ -126,7 +124,7 @@ static int computeBoxComplexity(Tree box)
else if (isBoxFVar(box, type, name, file))
return 1;
// slots and symbolic boxes
else if (isBoxSlot(box, &i))
else if (isBoxSlot(box))
return 1;
else if (isBoxSymbolic(box, t1, t2))
return 1 + BC(t2);
Expand Down
1 change: 0 additions & 1 deletion compiler/boxes/boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <string.h>
#include "exception.hh"
#include "global.hh"
#include "ppbox.hh"
#include "prim2.hh"
#include "xtended.hh"

Expand Down
20 changes: 20 additions & 0 deletions compiler/boxes/boxes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,24 @@ LIBFAUST_API bool isBoxMetadata(Tree s, Tree& exp, Tree& mdlist);
// Return the number of inputs and outputs
LIBFAUST_API bool getBoxType(Tree box, int* inum, int* onum);

/**
* Produces "1 input" or "n inputs" according to n
* \param n the number of inputs
* \return the corresponding string
*/
inline std::string inputs(int n)
{
return std::to_string(n) + ((n == 1) ? " input" : " inputs");
}

/**
* Produces "1 output" or "n outputs" according to n
* \param n the number of outputs
* \return the corresponding string
*/
inline std::string outputs(int n)
{
return std::to_string(n) + ((n == 1) ? " output" : " outputs");
}

#endif
22 changes: 0 additions & 22 deletions compiler/boxes/boxtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,6 @@ LIBFAUST_API bool getBoxType(Tree box, int* inum, int* onum)
}
}

/**
* Produces "1 output" or "n outputs" according to n
* \param n the number of outputs
* \return the corresponding string
*/

static string outputs(int n)
{
return std::to_string(n) + ((n == 1) ? " output" : " outputs");
}

/**
* Produces "1 input" or "n inputs" according to n
* \param n the number of inputs
* \return the corresponding string
*/

static string inputs(int n)
{
return std::to_string(n) + ((n == 1) ? " input" : " inputs");
}

/**
* Compute a parametric type error message
* \param a the LHS expression
Expand Down
2 changes: 1 addition & 1 deletion compiler/generator/c/c_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ CodeContainer* CCodeContainer::createScalarContainer(const string& name, int sub

CodeContainer* CCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
gGlobal->gDSPStruct = true; // for -vec -fun mode
CodeContainer* container;

if (gGlobal->gOpenCLSwitch) {
Expand Down
1 change: 0 additions & 1 deletion compiler/generator/codebox/codebox_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ CodeContainer* CodeboxCodeContainer::createScalarContainer(const string& name, i

CodeContainer* CodeboxCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gOpenCLSwitch) {
Expand Down
1 change: 0 additions & 1 deletion compiler/generator/jax/jax_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ CodeContainer* JAXCodeContainer::createScalarContainer(const string& name, int s

CodeContainer* JAXCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gOpenCLSwitch) {
Expand Down
1 change: 0 additions & 1 deletion compiler/generator/jsfx/jsfx_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ CodeContainer* JSFXCodeContainer::createScalarContainer(const string& name, int

CodeContainer* JSFXCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gOpenCLSwitch) {
Expand Down
1 change: 0 additions & 1 deletion compiler/generator/julia/julia_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ CodeContainer* JuliaCodeContainer::createScalarContainer(const string& name, int

CodeContainer* JuliaCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gOpenCLSwitch) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/generator/llvm/llvm_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ LLVMCodeContainer::~LLVMCodeContainer()

CodeContainer* LLVMCodeContainer::createContainer(const string& name, int numInputs, int numOutputs)
{
gGlobal->gDSPStruct = true;
gGlobal->gDSPStruct = true; // for -vec -fun mode
CodeContainer* container;

if (gGlobal->gFloatSize == 3) {
Expand Down
1 change: 0 additions & 1 deletion compiler/generator/rust/rust_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ CodeContainer* RustCodeContainer::createVectorContainer(const string& name, int

CodeContainer* RustCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gFloatSize == 3) {
Expand Down
1 change: 0 additions & 1 deletion compiler/generator/template/template_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ CodeContainer* TemplateCodeContainer::createScalarContainer(const string& name,
*/
CodeContainer* TemplateCodeContainer::createContainer(const string& name, int numInputs, int numOutputs, ostream* dst)
{
gGlobal->gDSPStruct = true;
CodeContainer* container;

if (gGlobal->gOpenCLSwitch) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/libcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static Tree evaluateBlockDiagram(Tree expandedDefList, int& numInputs, int& numO
}

if (gGlobal->gDetailsSwitch) {
cout << "process has " << numInputs << " inputs, and " << numOutputs << " outputs" << endl;
cout << "process has " << inputs(numInputs) << ", and " << outputs(numOutputs) << endl;
}

endTiming("evaluation");
Expand Down
9 changes: 3 additions & 6 deletions compiler/propagate/propagate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ static siglist realPropagate(Tree slotenv, Tree path, Tree box, const siglist& l
Tree sig;
faustassert(lsig.size() == 0);
if (!searchEnv(box, sig, slotenv)) {
// test YO : diagrams simplification
// cerr << "propagate : internal error (slot undefined)\n");
sig = sigInput(++gGlobal->gDummyInput);
}
return makeList(sig);
Expand Down Expand Up @@ -359,7 +357,6 @@ static siglist realPropagate(Tree slotenv, Tree path, Tree box, const siglist& l
}

else if (isBoxFFun(box, ff)) {
// cerr << "propagate en boxFFun of arity " << ffarity(ff) << endl;
faustassert(int(lsig.size()) == ffarity(ff));
return makeList(sigFFun(ff, listConvert(lsig)));
}
Expand Down Expand Up @@ -575,9 +572,9 @@ siglist propagate(Tree slotenv, Tree path, Tree box, const siglist& lsig)
result = realPropagate(slotenv, path, box, lsig);
setPropagateProperty(args, result);
}
// cerr << "propagate in " << boxpp(box) << endl;
// for (int i = 0; i < lsig.size(); i++) { cerr << " -> signal " << i << " : " << *(lsig[i]) << endl; }
// cerr << endl;
// cerr << "propagate in " << boxpp(box) << endl;
// for (int i = 0; i < lsig.size(); i++) { cerr << " -> signal " << i << " : " << *(lsig[i]) << endl; }
// cerr << endl;
return result;
}

Expand Down

0 comments on commit 1d14a94

Please sign in to comment.