X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/c7f552fd8888da2f0d8cfb228fe0f28d3df3a12c..b4b6f2ea75b9f0f3ca918f5b84016610bf7a4d4f:/interpretor/faust-0.9.47mr3/compiler/extended/minprim.cpp diff --git a/interpretor/faust-0.9.47mr3/compiler/extended/minprim.cpp b/interpretor/faust-0.9.47mr3/compiler/extended/minprim.cpp deleted file mode 100644 index dd56392..0000000 --- a/interpretor/faust-0.9.47mr3/compiler/extended/minprim.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "xtended.hh" -#include "Text.hh" -#include -#include "sigtyperules.hh" - -#include "floats.hh" - -class MinPrim : public xtended -{ - - public: - - MinPrim() : xtended("min") {} - - virtual unsigned int arity () { return 2; } - - virtual bool needCache () { return true; } - - virtual Type infereSigType (const vector& types) - { - assert (types.size() == arity()); - interval i = types[0]->getInterval(); - interval j = types[1]->getInterval(); - return castInterval(types[0]|types[1], min(i,j)); - } - - 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) - { - 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 generateCode (Klass* klass, const vector& args, const vector& types) - { - 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 generateLateq (Lateq* lateq, const vector& args, const vector& types) - { - assert (args.size() == arity()); - assert (types.size() == arity()); - - Type t = infereSigType(types); - return subst("\\min\\left( $0, $1 \\right)", args[0], args[1]); - } - -}; - - -xtended* gMinPrim = new MinPrim(); - -