|
FAUST compiler
0.9.9.6b8
|


Public Member Functions | |
| MinPrim () | |
| virtual unsigned int | arity () |
| virtual bool | needCache () |
| virtual Type | infereSigType (const vector< Type > &types) |
| virtual void | sigVisit (Tree sig, sigvisitor *visitor) |
| virtual int | infereSigOrder (const vector< int > &args) |
| virtual Tree | computeSigOutput (const vector< Tree > &args) |
| virtual string | generateCode (Klass *klass, const vector< string > &args, const vector< Type > &types) |
| virtual string | generateLateq (Lateq *lateq, const vector< string > &args, const vector< Type > &types) |
Definition at line 8 of file minprim.cpp.
| MinPrim::MinPrim | ( | ) | [inline] |
Definition at line 13 of file minprim.cpp.
: xtended("min") {}
| virtual unsigned int MinPrim::arity | ( | ) | [inline, virtual] |
Implements xtended.
Definition at line 15 of file minprim.cpp.
Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().
{ return 2; }

| virtual Tree MinPrim::computeSigOutput | ( | const vector< Tree > & | args | ) | [inline, virtual] |
Implements xtended.
Definition at line 36 of file minprim.cpp.
References arity(), isDouble(), isInt(), min(), xtended::symbol(), and tree().
{
double f,g; int i,j;
assert (args.size() == arity());
if (isDouble(args[0]->node(),&f)) {
if (isDouble(args[1]->node(), &g)) {
return tree(min(f, g));
} else if (isInt(args[1]->node(),&j)) {
return tree(min(f, double(j)));
} else {
return tree(symbol(), args[0], args[1]);
}
} else if (isInt(args[0]->node(),&i)) {
if (isDouble(args[1]->node(), &g)) {
return tree(min(double(i), g));
} else if (isInt(args[1]->node(),&j)) {
return tree(min(i, j));
} else {
return tree(symbol(), args[0], args[1]);
}
} else {
return tree(symbol(), args[0], args[1]);
}
}

| virtual string MinPrim::generateCode | ( | Klass * | klass, |
| const vector< string > & | args, | ||
| const vector< Type > & | types | ||
| ) | [inline, virtual] |
Implements xtended.
Definition at line 68 of file minprim.cpp.
References arity(), infereSigType(), kReal, and subst().
{
assert (args.size() == arity());
assert (types.size() == arity());
Type t = infereSigType(types);
if (t->nature() == kReal) {
return subst("min($0, $1)", args[0], args[1]);
} else {
return subst("min($0, $1)", args[0], args[1]);
}
}

| virtual string MinPrim::generateLateq | ( | Lateq * | lateq, |
| const vector< string > & | args, | ||
| const vector< Type > & | types | ||
| ) | [inline, virtual] |
Implements xtended.
Definition at line 81 of file minprim.cpp.
References arity(), infereSigType(), and subst().
{
assert (args.size() == arity());
assert (types.size() == arity());
Type t = infereSigType(types);
return subst("\\min\\left( $0, $1 \\right)", args[0], args[1]);
}

| virtual int MinPrim::infereSigOrder | ( | const vector< int > & | args | ) | [inline, virtual] |
| virtual Type MinPrim::infereSigType | ( | const vector< Type > & | types | ) | [inline, virtual] |
Implements xtended.
Definition at line 19 of file minprim.cpp.
References arity(), castInterval(), and min().
Referenced by generateCode(), and generateLateq().
{
assert (types.size() == arity());
interval i = types[0]->getInterval();
interval j = types[1]->getInterval();
return castInterval(types[0]|types[1], min(i,j));
}


| virtual bool MinPrim::needCache | ( | ) | [inline, virtual] |
| virtual void MinPrim::sigVisit | ( | Tree | sig, |
| sigvisitor * | visitor | ||
| ) | [inline, virtual] |
Definition at line 27 of file minprim.cpp.
{}
1.8.0