Minor formatting issues
[satune.git] / src / AST / element.h
1 #ifndef ELEMENT_H
2 #define ELEMENT_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "structs.h"
6 #include "astnode.h"
7 #include "functionencoding.h"
8 #include "elementencoding.h"
9 #include "boolean.h"
10
11 #define GETELEMENTTYPE(o) GETASTNODETYPE(o)
12 #define GETELEMENTPARENTS(o) (&((Element*)o)->parents)          
13 struct Element {
14         ASTNode base;
15         VectorASTNode parents;
16 };
17
18 struct ElementSet {
19         Element base;
20         Set * set;
21         ElementEncoding encoding;
22 };
23
24 struct ElementFunction {
25         Element base;
26         Function * function;
27         ArrayElement inputs;
28         Boolean * overflowstatus;
29         FunctionEncoding functionencoding;
30         ElementEncoding domainencoding;
31 };
32
33 Element * allocElementSet(Set *s);
34 Element* allocElementFunction(Function * function, Element ** array, uint numArrays, Boolean * overflowstatus);
35 void deleteElement(Element *This);
36 Set* getElementSet(Element* This);
37
38 static inline ElementEncoding* getElementEncoding(Element* This){
39         switch(GETELEMENTTYPE(This)){
40                 case ELEMSET:
41                         return &((ElementSet*)This)->encoding;
42                 case ELEMFUNCRETURN:            
43                         return &((ElementFunction*)This)->domainencoding;
44                 default:
45                         ASSERT(0);
46         }
47         return NULL;
48 }
49
50 static inline FunctionEncoding* getElementFunctionEncoding(ElementFunction* func){
51         return &func->functionencoding;
52 }
53 #endif