After merging with master branch ...
[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         UndefinedBehavior undefBehavior;
26 };
27
28 Function *allocFunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
29 Function *allocFunctionTable (Table *table, UndefinedBehavior behavior);
30 uint64_t applyFunctionOperator(FunctionOperator *This, uint numVals, uint64_t *values);
31 bool isInRangeFunction(FunctionOperator *This, uint64_t val);
32 void deleteFunction(Function *This);
33
34 #endif