8 #include "sigvisitor.hh"
14 Symbol* fSymbol; ///< the symbol the xtended is attached to
18 xtended (const char* name) :
19 fSymbol(::symbol(name)) {
20 setUserData(fSymbol, (void*)this);
22 virtual ~xtended() { setUserData(fSymbol, 0); }
24 Sym symbol() { return fSymbol; }
25 const char * name () { return ::name(fSymbol); }
28 Tree b = tree(fSymbol);
29 assert(getUserData(b) != 0);
33 // virtual method to be implemented by subclasses
34 virtual unsigned int arity () = 0;
35 virtual string generateCode (Klass* klass, const vector<string>& args, const vector<Type>& types) = 0;
36 virtual string generateLateq (Lateq* lateq, const vector<string>& args, const vector<Type>& types) = 0;
37 virtual int infereSigOrder (const vector<int>& args) = 0;
38 virtual Type infereSigType (const vector<Type>& args) = 0;
39 virtual Tree computeSigOutput (const vector<Tree>& args) = 0;
40 virtual bool needCache () = 0;
42 virtual bool isSpecialInfix() { return false; } ///< generaly false, but true for binary op # such that #(x) == _#x
45 // -- Trigonometric Functions
47 extern xtended* gAcosPrim;
48 extern xtended* gAsinPrim;
49 extern xtended* gAtanPrim;
50 extern xtended* gAtan2Prim;
52 extern xtended* gSinPrim;
53 extern xtended* gCosPrim;
54 extern xtended* gTanPrim;
57 // -- Exponential Functions
59 extern xtended* gExpPrim;
60 extern xtended* gLogPrim;
61 extern xtended* gLog10Prim;
62 extern xtended* gPowPrim;
64 extern xtended* gSqrtPrim;
65 extern xtended* gCbrtPrim;
66 extern xtended* gHypotPrim;
67 extern xtended* gLdexpPrim;
68 extern xtended* gScalbPrim;
69 extern xtended* gLog1pPrim;
70 extern xtended* gLogbPrim;
71 extern xtended* gIlogbPrim;
72 extern xtended* gExpm1Prim;
75 // -- Hyperbolic Functions
77 extern xtended* gAcoshPrim;
78 extern xtended* gAsinhPrim;
79 extern xtended* gAtanhPrim;
81 extern xtended* gSinhPrim;
82 extern xtended* gCoshPrim;
83 extern xtended* gTanhPrim;
86 // -- Remainder Functions
88 extern xtended* gFmodPrim;
89 extern xtended* gRemainderPrim;
91 // -- Nearest Integer Functions
93 extern xtended* gFloorPrim;
94 extern xtended* gCeilPrim;
95 extern xtended* gRintPrim;
98 // -- Miscellaneous Functions
100 extern xtended* gAbsPrim;
101 extern xtended* gMaxPrim;
102 extern xtended* gMinPrim;