sigtype.cpp File Reference

#include "sigtype.hh"
Include dependency graph for sigtype.cpp:

Go to the source code of this file.

Functions

ostream & operator<< (ostream &dst, const Type &t)
ostream & operator<< (ostream &dst, const SimpleType &t)
ostream & operator<< (ostream &dst, const TableType &t)
ostream & operator<< (ostream &dst, const TupletType &t)
Type operator| (const Type &t1, const Type &t2)
bool operator== (const Type &t1, const Type &t2)
bool operator<= (const Type &t1, const Type &t2)
Type operator* (const Type &t1, const Type &t2)
SimpleTypeisSimpleType (AudioType *t)
TableTypeisTableType (AudioType *t)
TupletTypeisTupletType (AudioType *t)
Type checkInt (Type t)
 verifie que t est entier
Type checkKonst (Type t)
 verifie que t est constant
Type checkInit (Type t)
 verifie que t est connu a l'initialisation
Type checkIntParam (Type t)
 verifie que t est connu a l'initialisation, constant et entier
Type checkWRTbl (Type tbl, Type wr)
 verifie que wr est compatible avec le contenu de tbl
int checkDelayInterval (Type t)
 Check is a type is appropriate for a delay.
string cType (Type t)

Variables

Type TINT = new SimpleType(kInt, kKonst, kComp, kVect, kNum, interval())
Type TREAL = new SimpleType(kReal, kKonst, kComp, kVect, kNum, interval())
Type TKONST = new SimpleType(kInt, kKonst, kComp, kVect, kNum, interval())
Type TBLOCK = new SimpleType(kInt, kBlock, kComp, kVect, kNum, interval())
Type TSAMP = new SimpleType(kInt, kSamp, kComp, kVect, kNum, interval())
Type TCOMP = new SimpleType(kInt, kKonst, kComp, kVect, kNum, interval())
Type TINIT = new SimpleType(kInt, kKonst, kInit, kVect, kNum, interval())
Type TEXEC = new SimpleType(kInt, kKonst, kExec, kVect, kNum, interval())
Type TINPUT = new SimpleType(kReal, kSamp, kExec, kVect, kNum, interval())
Type TGUI = new SimpleType(kReal, kBlock,kExec, kVect, kNum, interval())
Type INT_TGUI = new SimpleType(kInt, kBlock,kExec, kVect, kNum, interval())
Type TREC = TINT

Function Documentation

int checkDelayInterval ( Type  t  ) 

Check is a type is appropriate for a delay.

Check if the interval of t is appropriate for a delay.

Returns:
-1 if not appropriate, mxd (max delay) if appropriate

Definition at line 279 of file sigtype.cpp.

References interval::hi, interval::lo, and interval::valid.

Referenced by OccMarkup::incOcc().

00280 {
00281     interval i = t->getInterval();
00282     if (i.valid && i.lo >= 0) {
00283         return int(i.hi+0.5);
00284     } else {
00285         //cerr << "checkDelayInterval failed for : " << i << endl;
00286         return -1;
00287     }
00288 }       

Here is the caller graph for this function:

Type checkInit ( Type  t  ) 

verifie que t est connu a l'initialisation

Definition at line 249 of file sigtype.cpp.

References kInit.

Referenced by checkIntParam(), infereDocConstantTblType(), infereDocWriteTblType(), and infereSigType().

00250 {
00251     // verifie que t est connu a l'initialisation
00252     if (t->computability() > kInit) {
00253         cerr << "Error : checkInit failed for type " << t << endl;
00254         exit(1);
00255     }
00256     return t;
00257 }   

Here is the caller graph for this function:

Type checkInt ( Type  t  ) 

verifie que t est entier

Definition at line 228 of file sigtype.cpp.

References isSimpleType(), kInt, and AudioType::nature().

Referenced by checkIntParam(), infereDocConstantTblType(), infereDocWriteTblType(), and infereSigType().

00229 {
00230     // verifie que t est entier
00231     SimpleType* st = isSimpleType(t);
00232     if (st == 0 || st->nature() > kInt) {
00233         cerr << "Error : checkInt failed for type " << t << endl;
00234         exit(1);
00235     }
00236     return t;
00237 }

Here is the call graph for this function:

Here is the caller graph for this function:

Type checkIntParam ( Type  t  ) 

verifie que t est connu a l'initialisation, constant et entier

Definition at line 259 of file sigtype.cpp.

References checkInit(), checkInt(), and checkKonst().

00260 {
00261     return checkInit(checkKonst(checkInt(t)));
00262 }

Here is the call graph for this function:

Type checkKonst ( Type  t  ) 

verifie que t est constant

Definition at line 239 of file sigtype.cpp.

References kKonst.

Referenced by checkIntParam(), infereDocConstantTblType(), and infereDocWriteTblType().

00240 {
00241     // verifie que t est constant
00242     if (t->variability() > kKonst) {
00243         cerr << "Error : checkKonst failed for type " << t << endl;
00244         exit(1);
00245     }
00246     return t;
00247 }   

Here is the caller graph for this function:

Type checkWRTbl ( Type  tbl,
Type  wr 
)

verifie que wr est compatible avec le contenu de tbl

Definition at line 264 of file sigtype.cpp.

00265 {
00266     // verifie que wr est compatible avec le contenu de tbl
00267     if (wr->nature() > tbl->nature()) {
00268         cerr << "Error : checkWRTbl failed, the content of  " << tbl << " is incompatible with " << wr << endl;
00269         exit(1);
00270     }
00271     return tbl;
00272 }       

string cType ( Type  t  ) 

Definition at line 292 of file sigtype.cpp.

References kInt.

Referenced by ScalarCompiler::generatePrefix().

00293 {
00294     return (t->nature() == kInt) ? "int" : "float";
00295 }

Here is the caller graph for this function:

SimpleType* isSimpleType ( AudioType t  ) 

Definition at line 219 of file sigtype.cpp.

Referenced by checkInt(), infereReadTableType(), infereSigType(), infereWriteTableType(), operator==(), and operator|().

00219 { return dynamic_cast<SimpleType*>(t); }

Here is the caller graph for this function:

TableType* isTableType ( AudioType t  ) 

Definition at line 220 of file sigtype.cpp.

Referenced by infereReadTableType(), infereWriteTableType(), operator==(), and operator|().

00220 { return dynamic_cast<TableType*>(t);  }

Here is the caller graph for this function:

TupletType* isTupletType ( AudioType t  ) 

Definition at line 221 of file sigtype.cpp.

Referenced by infereProjType(), operator==(), and operator|().

00221 { return dynamic_cast<TupletType*>(t); }

Here is the caller graph for this function:

Type operator* ( const Type t1,
const Type t2 
)

Definition at line 193 of file sigtype.cpp.

References TupletType::arity().

00194 {
00195     vector<Type>    v;
00196     
00197     TupletType* nt1 = dynamic_cast<TupletType*>((AudioType*)t1);
00198     TupletType* nt2 = dynamic_cast<TupletType*>((AudioType*)t2);
00199     
00200     if (nt1) {
00201         for (int i=0; i<nt1->arity(); i++) {
00202             v.push_back((*nt1)[i]);
00203         }
00204     } else {
00205         v.push_back(t1);
00206     }
00207     
00208     if (nt2) {
00209         for (int i=0; i<nt2->arity(); i++) {
00210             v.push_back((*nt2)[i]);
00211         }
00212     } else {
00213         v.push_back(t2);
00214     }
00215     return new TupletType(v);   
00216 }

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const TupletType t 
)

Definition at line 40 of file sigtype.cpp.

References TupletType::print().

00040 { return  t.print(dst); }

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const TableType t 
)

Definition at line 38 of file sigtype.cpp.

References TableType::print().

00038 { return  t.print(dst); }

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const SimpleType t 
)

Definition at line 36 of file sigtype.cpp.

References SimpleType::print().

00036 { return  t.print(dst); }

Here is the call graph for this function:

ostream& operator<< ( ostream &  dst,
const Type t 
)

Definition at line 34 of file sigtype.cpp.

00034 { return  t->print(dst);}

bool operator<= ( const Type t1,
const Type t2 
)

Definition at line 186 of file sigtype.cpp.

00187 {
00188     return (t1|t2) == t2;
00189 }

bool operator== ( const Type t1,
const Type t2 
)

Definition at line 162 of file sigtype.cpp.

References TupletType::arity(), AudioType::boolean(), TableType::content(), isSimpleType(), isTableType(), isTupletType(), AudioType::nature(), and AudioType::vectorability().

00163 {
00164     SimpleType  *st1, *st2;
00165     TableType   *tt1, *tt2;
00166     TupletType  *nt1, *nt2;
00167 
00168     if (t1->variability() != t2->variability())     return false;
00169     if (t1->computability() != t2->computability()) return false;
00170     
00171     if ( (st1 = isSimpleType(t1)) && (st2 = isSimpleType(t2)) ) return (st1->nature() == st2->nature())&&(st1->vectorability() == st2->vectorability())&&(st1->boolean() == st2->boolean());
00172     if ( (tt1 = isTableType(t1)) && (tt2 = isTableType(t2)) )   return tt1->content()== tt2->content(); 
00173     if ( (nt1 = isTupletType(t1)) && (nt2 = isTupletType(t2)) ) {
00174         int a1 = nt1->arity();
00175         int a2 = nt2->arity();
00176         if (a1 == a2) {
00177             for (int i=0; i<a1; i++)  { if ((*nt1)[i] != (*nt2)[i]) return false; }
00178             return true;
00179         } else {
00180             return false;
00181         }
00182     }
00183     return false;
00184 }

Here is the call graph for this function:

Type operator| ( const Type t1,
const Type t2 
)

achanger

Definition at line 127 of file sigtype.cpp.

References TupletType::arity(), AudioType::boolean(), AudioType::computability(), TableType::content(), isSimpleType(), isTableType(), isTupletType(), min(), AudioType::nature(), AudioType::variability(), and AudioType::vectorability().

00128 {
00129     SimpleType  *st1, *st2;
00130     TableType   *tt1, *tt2;
00131     TupletType  *nt1, *nt2;
00132     
00133     if ( (st1 = isSimpleType(t1)) && (st2 = isSimpleType(t2)) ) {
00134         
00135         return new SimpleType(  st1->nature()|st2->nature(),
00136                     st1->variability()|st2->variability(),
00137                     st1->computability()|st2->computability(),
00138                     st1->vectorability()|st2->vectorability(),
00139                     st1->boolean()|st2->boolean(),
00140                     interval() 
00141                     );
00142         
00143     } else if ( (tt1 = isTableType(t1)) && (tt2 = isTableType(t2)) ) {
00144         
00145         return new TableType( tt1->content() | tt2->content() );
00146         
00147     } else if ( (nt1 = isTupletType(t1)) && (nt2 = isTupletType(t2)) ) {
00148         
00149         vector<Type> v;
00150         int n = min(nt1->arity(), nt2->arity());
00151         for (int i=0; i<n; i++) { v.push_back( (*nt1)[i] | (*nt2)[i]); }
00152         return new TupletType( v );
00153         
00154     } else {
00155         
00156         cerr << "Error : trying to combine incompatible types, " << t1 << " and " << t2 << endl;
00157         exit(1);
00158         return 0;
00159     }
00160 }

Here is the call graph for this function:


Variable Documentation

Type INT_TGUI = new SimpleType(kInt, kBlock,kExec, kVect, kNum, interval())

Definition at line 122 of file sigtype.cpp.

Type TBLOCK = new SimpleType(kInt, kBlock, kComp, kVect, kNum, interval())

Definition at line 111 of file sigtype.cpp.

Type TCOMP = new SimpleType(kInt, kKonst, kComp, kVect, kNum, interval())

Definition at line 114 of file sigtype.cpp.

Type TEXEC = new SimpleType(kInt, kKonst, kExec, kVect, kNum, interval())

Definition at line 116 of file sigtype.cpp.

Type TGUI = new SimpleType(kReal, kBlock,kExec, kVect, kNum, interval())

Definition at line 121 of file sigtype.cpp.

Referenced by infereSigType().

Type TINIT = new SimpleType(kInt, kKonst, kInit, kVect, kNum, interval())

Definition at line 115 of file sigtype.cpp.

Type TINPUT = new SimpleType(kReal, kSamp, kExec, kVect, kNum, interval())

Definition at line 120 of file sigtype.cpp.

Type TINT = new SimpleType(kInt, kKonst, kComp, kVect, kNum, interval())

Definition at line 107 of file sigtype.cpp.

Type TKONST = new SimpleType(kInt, kKonst, kComp, kVect, kNum, interval())

Definition at line 110 of file sigtype.cpp.

Type TREAL = new SimpleType(kReal, kKonst, kComp, kVect, kNum, interval())

Definition at line 108 of file sigtype.cpp.

Definition at line 124 of file sigtype.cpp.

Referenced by initialRecType().

Type TSAMP = new SimpleType(kInt, kSamp, kComp, kVect, kNum, interval())

Definition at line 112 of file sigtype.cpp.

Generated on Thu Jul 15 15:47:26 2010 for FAUST compiler by  doxygen 1.6.3