|
FAUST compiler
0.9.9.6b8
|


Public Member Functions | |
| AbsPrim () | |
| 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 absprim.cpp.
| AbsPrim::AbsPrim | ( | ) | [inline] |
Definition at line 13 of file absprim.cpp.
: xtended("abs") {}
| virtual unsigned int AbsPrim::arity | ( | ) | [inline, virtual] |
Implements xtended.
Definition at line 15 of file absprim.cpp.
Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().
{ return 1; }

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

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

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

| virtual int AbsPrim::infereSigOrder | ( | const vector< int > & | args | ) | [inline, virtual] |
Implements xtended.
Definition at line 29 of file absprim.cpp.
References arity().
{
assert (args.size() == arity());
return args[0];
}

| virtual Type AbsPrim::infereSigType | ( | const vector< Type > & | types | ) | [inline, virtual] |
Implements xtended.
Definition at line 19 of file absprim.cpp.
References abs(), arity(), and castInterval().
Referenced by generateCode(), and generateLateq().
{
assert (types.size() == arity());
Type t = types[0];
return castInterval(t, abs(t->getInterval()));
return t;
}


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