Fix the preprocessor compiling bug in interpretor/Makefile.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / compiler / extended / xtended.hh
1 #ifndef __XTENDED__
2 #define __XTENDED__
3
4 // xtended
5 #include "tlib.hh"
6 #include "sigtype.hh"
7 #include "klass.hh"
8 #include "sigvisitor.hh"
9 #include <vector>
10 #include "lateq.hh"
11
12 class xtended
13 {
14 Symbol* fSymbol; ///< the symbol the xtended is attached to
15 public:
16
17
18 xtended (const char* name) :
19 fSymbol(::symbol(name)) {
20 setUserData(fSymbol, (void*)this);
21 }
22 virtual ~xtended() { setUserData(fSymbol, 0); }
23
24 Sym symbol() { return fSymbol; }
25 const char * name () { return ::name(fSymbol); }
26
27 Tree box () {
28 Tree b = tree(fSymbol);
29 assert(getUserData(b) != 0);
30 return b;
31 }
32
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;
41
42 virtual bool isSpecialInfix() { return false; } ///< generaly false, but true for binary op # such that #(x) == _#x
43 };
44
45 // -- Trigonometric Functions
46
47 extern xtended* gAcosPrim;
48 extern xtended* gAsinPrim;
49 extern xtended* gAtanPrim;
50 extern xtended* gAtan2Prim;
51
52 extern xtended* gSinPrim;
53 extern xtended* gCosPrim;
54 extern xtended* gTanPrim;
55
56
57 // -- Exponential Functions
58
59 extern xtended* gExpPrim;
60 extern xtended* gLogPrim;
61 extern xtended* gLog10Prim;
62 extern xtended* gPowPrim;
63
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;
73
74
75 // -- Hyperbolic Functions
76
77 extern xtended* gAcoshPrim;
78 extern xtended* gAsinhPrim;
79 extern xtended* gAtanhPrim;
80
81 extern xtended* gSinhPrim;
82 extern xtended* gCoshPrim;
83 extern xtended* gTanhPrim;
84
85
86 // -- Remainder Functions
87
88 extern xtended* gFmodPrim;
89 extern xtended* gRemainderPrim;
90
91 // -- Nearest Integer Functions
92
93 extern xtended* gFloorPrim;
94 extern xtended* gCeilPrim;
95 extern xtended* gRintPrim;
96
97
98 // -- Miscellaneous Functions
99
100 extern xtended* gAbsPrim;
101 extern xtended* gMaxPrim;
102 extern xtended* gMinPrim;
103
104 #endif