|
FAUST compiler
0.9.9.6b8
|


Go to the source code of this file.
Classes | |
| struct | point |
| struct | trait |
| struct | collector |
| class | schema |
| An abstract block diagram schema. More... | |
Enumerations | |
| enum | { kLeftRight = 1, kRightLeft = -1 } |
Functions | |
| schema * | makeBlockSchema (unsigned int inputs, unsigned int outputs, const string &name, const string &color, const string &link) |
| Build a simple colored blockSchema with a certain number of inputs and outputs, a text to be displayed, and an optional link. | |
| schema * | makeCableSchema (unsigned int n=1) |
| Build n cables in parallel. | |
| schema * | makeInverterSchema (const string &color) |
| Build n cables in parallel. | |
| schema * | makeCutSchema () |
| Creates a new Cut schema. | |
| schema * | makeEnlargedSchema (schema *s, double width) |
| Returns an enlarged schema, but only if really needed that is if the requiered width is greater that the schema width. | |
| schema * | makeParSchema (schema *s1, schema *s2) |
| schema * | makeSeqSchema (schema *s1, schema *s2) |
| Make a sequential schema. | |
| schema * | makeMergeSchema (schema *s1, schema *s2) |
| Creates a new merge schema. | |
| schema * | makeSplitSchema (schema *s1, schema *s2) |
| Creates a new split schema. | |
| schema * | makeRecSchema (schema *s1, schema *s2) |
| Creates a new recursive schema (s1 ~ s2). | |
| schema * | makeTopSchema (schema *s1, double margin, const string &text, const string &link) |
| Creates a new top schema. | |
| schema * | makeDecorateSchema (schema *s1, double margin, const string &text) |
| Creates a new decorated schema. | |
Variables | |
| const double | dWire = 8 |
| distance between two wires | |
| const double | dLetter = 4.3 |
| width of a letter | |
| const double | dHorz = 4 |
| marge horizontale | |
| const double | dVert = 4 |
| marge verticale | |
| anonymous enum |
Definition at line 90 of file schema.h.
{ kLeftRight=1, kRightLeft=-1 };
| schema* makeBlockSchema | ( | unsigned int | inputs, |
| unsigned int | outputs, | ||
| const string & | text, | ||
| const string & | color, | ||
| const string & | link | ||
| ) |
Build a simple colored blockSchema with a certain number of inputs and outputs, a text to be displayed, and an optional link.
Computes the size of the box according to the length of the text and the maximum number of ports.
Definition at line 40 of file blockSchema.cpp.
References dHorz, dVert, dWire, max(), and quantize().
Referenced by generateBargraphSchema(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), generateOutputSlotSchema(), and generateUserInterfaceSchema().
{
// determine the optimal size of the box
double minimal = 3*dWire;
double w = 2*dHorz + max( minimal, quantize(text.size()) );
double h = 2*dVert + max( minimal, max(inputs, outputs) * dWire );
return new blockSchema(inputs, outputs, w, h, text, color, link);
}


| schema* makeCableSchema | ( | unsigned int | n = 1 | ) |
Build n cables in parallel.
Definition at line 32 of file cableSchema.cpp.
Referenced by generateInsideSchema(), and makeSeqSchema().
{
assert(n>0);
return new cableSchema(n);
}

| schema* makeCutSchema | ( | ) |
Creates a new Cut schema.
Definition at line 33 of file cutSchema.cpp.
Referenced by generateInsideSchema().
{
return new cutSchema();
}

| schema* makeDecorateSchema | ( | schema * | s1, |
| double | margin, | ||
| const string & | text | ||
| ) |
Creates a new decorated schema.
Definition at line 31 of file decorateSchema.cpp.
Referenced by generateDiagramSchema(), generateInsideSchema(), and makeTopSchema().
{
return new decorateSchema (s, margin, text);
}

| schema* makeEnlargedSchema | ( | schema * | s, |
| double | width | ||
| ) |
Returns an enlarged schema, but only if really needed that is if the requiered width is greater that the schema width.
Definition at line 32 of file enlargedSchema.cpp.
References schema::width().
Referenced by makeMergeSchema(), makeParSchema(), makeRecSchema(), and makeSplitSchema().
{
if (width > s->width()) {
return new enlargedSchema(s, width);
} else {
return s;
}
}


| schema* makeInverterSchema | ( | const string & | color | ) |
Build n cables in parallel.
Definition at line 35 of file inverterSchema.cpp.
Referenced by generateInsideSchema().
{
return new inverterSchema(color);
}

| schema* makeMergeSchema | ( | schema * | s1, |
| schema * | s2 | ||
| ) |
Creates a new merge schema.
Cables are enlarged to dWire. The horizontal gap between the two subschema is such that the connections are not too slopy.
Definition at line 35 of file mergeSchema.cpp.
References dWire, schema::height(), and makeEnlargedSchema().
Referenced by generateInsideSchema().
{
// avoid ugly diagram by ensuring at least dWire width
schema * a = makeEnlargedSchema(s1, dWire);
schema * b = makeEnlargedSchema(s2, dWire);
double hgap = (a->height()+b->height())/4;
return new mergeSchema(a,b,hgap);
}


| schema* makeParSchema | ( | schema * | s1, |
| schema * | s2 | ||
| ) |
Definition at line 28 of file parSchema.cpp.
References makeEnlargedSchema(), and schema::width().
Referenced by generateAbstractionSchema(), generateInsideSchema(), and makeSeqSchema().
{
// make sure s1 and s2 have same width
return new parSchema( makeEnlargedSchema(s1, s2->width()),
makeEnlargedSchema(s2, s1->width()) );
}


| schema* makeRecSchema | ( | schema * | s1, |
| schema * | s2 | ||
| ) |
Creates a new recursive schema (s1 ~ s2).
The smallest component is enlarged to the width of the other. The left and right horizontal margins are computed according to the number of internal connections.
Definition at line 34 of file recSchema.cpp.
References dWire, makeEnlargedSchema(), max(), and schema::width().
Referenced by generateInsideSchema().
{
schema* a = makeEnlargedSchema(s1, s2->width());
schema* b = makeEnlargedSchema(s2, s1->width());
double m = dWire * max(b->inputs(), b->outputs());
double w = a->width() + 2*m;
return new recSchema(a,b,w);
}


| schema* makeSeqSchema | ( | schema * | s1, |
| schema * | s2 | ||
| ) |
Make a sequential schema.
May add cables to ensure the internal connections are between the same number of outputs and inputs. Compute an horizontal gap based on the number of upward and downward connections.
Definition at line 43 of file seqSchema.cpp.
References computeHorzGap(), schema::inputs(), makeCableSchema(), makeParSchema(), and schema::outputs().
Referenced by generateAbstractionSchema(), and generateInsideSchema().
{
unsigned int o = s1->outputs();
unsigned int i = s2->inputs();
schema* a = (o < i) ? makeParSchema(s1, makeCableSchema(i-o)) : s1;
schema* b = (o > i) ? makeParSchema(s2, makeCableSchema(o-i)) : s2;
return new seqSchema(a, b, computeHorzGap(a,b));
}


| schema* makeSplitSchema | ( | schema * | s1, |
| schema * | s2 | ||
| ) |
Creates a new split schema.
Cables are enlarged to dWire. The horizontal gap between the two subschema is such that the connections are not too slopy.
Definition at line 34 of file splitSchema.cpp.
References dWire, schema::height(), and makeEnlargedSchema().
Referenced by generateInsideSchema().
{
// make sure a and b are at least dWire large
schema * a = makeEnlargedSchema(s1, dWire);
schema * b = makeEnlargedSchema(s2, dWire);
// horizontal gap to avaoid too slopy connections
double hgap = (a->height()+b->height())/4;
return new splitSchema(a,b,hgap);
}


| schema* makeTopSchema | ( | schema * | s1, |
| double | margin, | ||
| const string & | text, | ||
| const string & | link | ||
| ) |
Creates a new top schema.
Definition at line 33 of file topSchema.cpp.
References makeDecorateSchema().
Referenced by writeSchemaFile().
{
return new topSchema (makeDecorateSchema(s, margin/2, text), margin/2, "", link);
}


| const double dHorz = 4 |
marge horizontale
Definition at line 36 of file schema.h.
Referenced by blockSchema::collectInputWires(), blockSchema::collectOutputWires(), inverterSchema::draw(), blockSchema::drawInputWires(), blockSchema::drawOrientationMark(), blockSchema::drawRectangle(), and makeBlockSchema().
| const double dLetter = 4.3 |
width of a letter
Definition at line 35 of file schema.h.
Referenced by decorateSchema::draw(), and quantize().
| const double dVert = 4 |
marge verticale
Definition at line 37 of file schema.h.
Referenced by blockSchema::drawOrientationMark(), blockSchema::drawRectangle(), and makeBlockSchema().
| const double dWire = 8 |
distance between two wires
Definition at line 33 of file schema.h.
Referenced by recSchema::collectFeedback(), seqSchema::collectInternalWires(), recSchema::collectTraits(), computeHorzGap(), recSchema::draw(), recSchema::drawFeedback(), seqSchema::drawInternalWires(), makeBlockSchema(), makeMergeSchema(), makeRecSchema(), makeSplitSchema(), cableSchema::place(), blockSchema::placeInputPoints(), and blockSchema::placeOutputPoints().
1.8.0