X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/c7f552fd8888da2f0d8cfb228fe0f28d3df3a12c..b4b6f2ea75b9f0f3ca918f5b84016610bf7a4d4f:/interpretor/faust-0.9.47mr3/compiler/extended/powprim.cpp diff --git a/interpretor/faust-0.9.47mr3/compiler/extended/powprim.cpp b/interpretor/faust-0.9.47mr3/compiler/extended/powprim.cpp deleted file mode 100644 index bf81b71..0000000 --- a/interpretor/faust-0.9.47mr3/compiler/extended/powprim.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "xtended.hh" -#include "Text.hh" -#include - -#include "floats.hh" - -class PowPrim : public xtended -{ - - public: - - PowPrim() : xtended("powf") {} - - virtual unsigned int arity () { return 2; } - - virtual bool needCache () { return true; } - - virtual Type infereSigType (const vector& args) - { - assert (args.size() == arity()); - //return castInterval(floatCast(args[0]|args[1]), interval()); // temporary !!! - return castInterval(args[0]|args[1], interval()); // temporary !!! - } - - virtual void sigVisit (Tree sig, sigvisitor* visitor) {} - - virtual int infereSigOrder (const vector& args) { - assert (args.size() == arity()); - return max(args[0], args[1]); - } - - - virtual Tree computeSigOutput (const vector& args) { - 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 generateCode (Klass* klass, const vector& args, const vector& types) - { - 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 generateLateq (Lateq* lateq, const vector& args, const vector& types) - { - assert (args.size() == arity()); - assert (types.size() == arity()); - - return subst("{$0}^{$1}", args[0], args[1]); - } - - // power is now used as an infix binary operator, we return true to - // indicate that we want ^(n) to be equivalent to _^n - virtual bool isSpecialInfix() { return true; } - - -}; - - -xtended* gPowPrim = new PowPrim(); - -