A simple type system for block diagram expressions. The type of a block diagram is defined by a number of inputs and outputs. More...
#include <stdio.h>#include <string.h>#include "boxes.hh"#include "ppbox.hh"#include "prim2.hh"#include "xtended.hh"
Go to the source code of this file.
Functions | |
| bool | getBoxType (Tree box, int *inum, int *onum) |
| Return the type (number of inputs and outputs) of a box or false if undefined. | |
A simple type system for block diagram expressions. The type of a block diagram is defined by a number of inputs and outputs.
Definition in file boxtype.cpp.
| bool getBoxType | ( | Tree | box, | |
| int * | inum, | |||
| int * | onum | |||
| ) |
Return the type (number of inputs and outputs) of a box or false if undefined.
| box | the box we want to know the type | |
| inum | the place to return the number of inputs | |
| onum | the place to return the number of outputs |
Definition at line 63 of file boxtype.cpp.
References CTree::node().
00064 { 00065 Tree t; 00066 if (getProperty(box, BOXTYPEPROP, t)) { 00067 00068 if (isNil(t)) { 00069 return false; 00070 } else { 00071 *inum = hd(t)->node().getInt(); 00072 *onum = tl(t)->node().getInt(); 00073 return true; 00074 } 00075 00076 } else { 00077 00078 if (infereBoxType(box, inum, onum)) { 00079 setProperty(box, BOXTYPEPROP, cons(tree(*inum), tree(*onum))); 00080 return true; 00081 } else { 00082 setProperty(box, BOXTYPEPROP, nil); 00083 return false; 00084 } 00085 } 00086 }

1.6.1