|
FAUST compiler
0.9.9.6b8
|


Public Member Functions | |
| PowPrim () | |
| virtual unsigned int | arity () |
| virtual bool | needCache () |
| virtual Type | infereSigType (const vector< Type > &args) |
| 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) |
| virtual bool | isSpecialInfix () |
| generaly false, but true for binary op # such that #(x) == _::x | |
Definition at line 7 of file powprim.cpp.
| PowPrim::PowPrim | ( | ) | [inline] |
Definition at line 12 of file powprim.cpp.
: xtended("powf") {}
| virtual unsigned int PowPrim::arity | ( | ) | [inline, virtual] |
Implements xtended.
Definition at line 14 of file powprim.cpp.
Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().
{ return 2; }

| virtual Tree PowPrim::computeSigOutput | ( | const vector< Tree > & | args | ) | [inline, virtual] |
Implements xtended.
Definition at line 33 of file powprim.cpp.
References arity(), isNum(), xtended::symbol(), and tree().
{
num n,m;
assert (args.size() == arity());
if (isNum(args[0],n) & isNum(args[1],m)) {
return tree(pow(double(n), double(m)));
} else {
return tree(symbol(), args[0], args[1]);
}
}

| virtual string PowPrim::generateCode | ( | Klass * | klass, |
| const vector< string > & | args, | ||
| const vector< Type > & | types | ||
| ) | [inline, virtual] |
Implements xtended.
Definition at line 43 of file powprim.cpp.
References arity(), isuffix(), kInt, Klass::rememberNeedPowerDef(), and subst().
{
assert (args.size() == arity());
assert (types.size() == arity());
if (types[1]->nature() == kInt) {
klass->rememberNeedPowerDef();
return subst("faustpower<$1>($0)", args[0], args[1]);
} else {
return subst("pow$2($0,$1)", args[0], args[1], isuffix());
}
}

| virtual string PowPrim::generateLateq | ( | Lateq * | lateq, |
| const vector< string > & | args, | ||
| const vector< Type > & | types | ||
| ) | [inline, virtual] |
| virtual int PowPrim::infereSigOrder | ( | const vector< int > & | args | ) | [inline, virtual] |
| virtual Type PowPrim::infereSigType | ( | const vector< Type > & | args | ) | [inline, virtual] |
Implements xtended.
Definition at line 18 of file powprim.cpp.
References arity(), and castInterval().
{
assert (args.size() == arity());
//return castInterval(floatCast(args[0]|args[1]), interval()); // temporary !!!
return castInterval(args[0]|args[1], interval()); // temporary !!!
}

| virtual bool PowPrim::isSpecialInfix | ( | ) | [inline, virtual] |
generaly false, but true for binary op # such that #(x) == _::x
Reimplemented from xtended.
Definition at line 66 of file powprim.cpp.
{ return true; }
| virtual bool PowPrim::needCache | ( | ) | [inline, virtual] |
| virtual void PowPrim::sigVisit | ( | Tree | sig, |
| sigvisitor * | visitor | ||
| ) | [inline, virtual] |
Definition at line 25 of file powprim.cpp.
{}
1.8.0