boxtype.cpp File Reference

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"
Include dependency graph for boxtype.cpp:

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.

Detailed Description

A simple type system for block diagram expressions. The type of a block diagram is defined by a number of inputs and outputs.

Author:
Yann Orlarey
Version:
1.0
Date:
2003

Definition in file boxtype.cpp.


Function Documentation

bool getBoxType ( Tree  box,
int *  inum,
int *  onum 
)

Return the type (number of inputs and outputs) of a box or false if undefined.

Parameters:
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
Returns:
true if type is defined, false if undefined

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 }

Here is the call graph for this function:

Generated by  doxygen 1.6.2-20100208