Merge branch 'master' into brian
[satune.git] / src / AST / function.h
1 #ifndef FUNCTION_H
2 #define FUNCTION_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "ops.h"
6 #include "structs.h"
7
8 #define GETFUNCTIONTYPE(o) (((Function*)o)->type)
9
10 struct Function {
11         FunctionType type;
12 };
13
14 struct FunctionOperator {
15         Function base;
16         ArithOp op;
17         ArraySet domains;
18         Set * range;
19         OverFlowBehavior overflowbehavior;
20 };
21
22 struct FunctionTable {
23         Function base;
24         Table* table;
25 };
26
27 Function* allocFunctionOperator( ArithOp op, Set ** domain, uint numDomain, Set * range,OverFlowBehavior overflowbehavior);
28 Function* allocFunctionTable (Table* table);
29 uint64_t applyFunctionOperator(FunctionOperator* func, uint64_t var1, uint64_t var2, bool* isInrange);
30 void deleteFunction(Function* This);
31
32 #endif