108 if (p) { *inum = p->
arity(); *onum = 1; }
109 else if (
isBoxInt(t)) { *inum = 0; *onum = 1; }
110 else if (
isBoxReal(t)) { *inum = 0; *onum = 1; }
114 else if (
isBoxWire(t)) { *inum = 1; *onum = 1; }
115 else if (
isBoxCut(t)) { *inum = 1; *onum = 0; }
117 else if (
isBoxSlot(t)) { *inum = 0; *onum = 1; }
122 else if (
isBoxPrim0(t)) { *inum = 0; *onum = 1; }
123 else if (
isBoxPrim1(t)) { *inum = 1; *onum = 1; }
124 else if (
isBoxPrim2(t)) { *inum = 2; *onum = 1; }
125 else if (
isBoxPrim3(t)) { *inum = 3; *onum = 1; }
126 else if (
isBoxPrim4(t)) { *inum = 4; *onum = 1; }
127 else if (
isBoxPrim5(t)) { *inum = 5; *onum = 1; }
131 else if (
isBoxFVar(t)) { *inum = 0; *onum = 1; }
152 cerr <<
"Error in sequential composition (A:B)" << endl
153 <<
"The number of outputs (" << v <<
") of A = " <<
boxpp(a) << endl
154 <<
"must be equal to the number of inputs (" << x <<
") of B : " <<
boxpp(b) << endl;
157 *inum = u; *onum = y;
166 *inum = u+x; *onum = v+y;
175 cerr <<
"Connection error in : " <<
boxpp(t) << endl
176 <<
"The first expression : " <<
boxpp(a) <<
" has no outputs" << endl;
181 cerr <<
"Connection error in : " <<
boxpp(t) << endl
182 <<
"The second expression : " <<
boxpp(b) <<
" has no inputs" << endl;
187 cerr <<
"Connection error in : " <<
boxpp(t) << endl
188 <<
"The number of outputs " << v
189 <<
" of the first expression should be a divisor of the number of inputs " << x
190 <<
" of the second expression" << endl;
194 *inum = u; *onum = y;
203 cerr <<
"Connection error in : " <<
boxpp(t) << endl
204 <<
"The first expression : " <<
boxpp(a) <<
" has no outputs" << endl;
209 cerr <<
"Connection error in : " <<
boxpp(t) << endl
210 <<
"The second expression : " <<
boxpp(b) <<
" has no inputs" << endl;
215 cerr <<
"Connection error in : " <<
boxpp(t) << endl
216 <<
"The number of outputs " << v
217 <<
" of the first expression should be a multiple of the number of inputs " << x
218 <<
" of the second expression" << endl;
222 *inum = u; *onum = y;
229 if ( (x > v) | (y > u) ) {
230 cerr <<
"Connection error in : " <<
boxpp(t) << endl;
231 if (x > v) cerr <<
"The number of outputs " << v
232 <<
" of the first expression should be greater or equal \n to the number of inputs " << x
233 <<
" of the second expression" << endl;
234 if (y > u) cerr <<
"The number of inputs " << u
235 <<
" of the first expression should be greater or equal \n to the number of outputs " << y
236 <<
" of the second expression" << endl;
239 *inum =
max(0,u-y); *onum = v;
242 cerr <<
"Connection error : an environment is not a block-diagram : " <<
boxpp(t) << endl;
245 cerr <<
"boxType() internal error : unrecognized box expression " <<
boxpp(t) << endl;
static bool infereBoxType(Tree box, int *inum, int *onum)
Infere the type (number of inputs and outputs) of a box.
bool isBoxSeq(Tree t, Tree &x, Tree &y)
Tree cons(Tree a, Tree b)
bool isBoxSplit(Tree t, Tree &x, Tree &y)
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
const Node & node() const
return the content of the tree
bool isBoxHBargraph(Tree s)
bool isBoxRec(Tree t, Tree &x, Tree &y)
double max(double x, double y)
bool isBoxSymbolic(Tree t)
bool isBoxEnvironment(Tree s)
bool isBoxPar(Tree t, Tree &x, Tree &y)
bool isBoxHSlider(Tree s)
bool isBoxVBargraph(Tree s)
bool isBoxWaveform(Tree s)
bool isBoxCheckbox(Tree s)
virtual unsigned int arity()=0
bool isBoxVSlider(Tree s)
bool isBoxNumEntry(Tree s)
void setProperty(Tree t, Tree key, Tree val)
void * getUserData(Symbol *sym)
Returns user data.
bool isBoxPatternVar(Tree s, Tree &id)
Symbol * symbol(const char *str)
Returns (and creates if new) the symbol of name str.
bool isBoxMerge(Tree t, Tree &x, Tree &y)
bool getBoxType(Tree box, int *inum, int *onum)
Return the type (number of inputs and outputs) of a box or false if undefined.
bool getProperty(Tree t, Tree key, Tree &val)