b4b51471b480f1d4767df2b13b29bc18097b5772
[satune.git] / src / AST / element.c
1 #include "element.h"
2 #include "structs.h"
3
4 Element *allocElementSet(Set * s) {
5         ElementSet * tmp=(ElementSet *)ourmalloc(sizeof(ElementSet));
6         GETELEMENTTYPE(tmp)= ELEMSET;
7         GETPARENTSVECTOR(tmp) = allocDefVectorVoid();
8         GETSTRUCTTYPE(tmp) = _ELEMENT;
9         tmp->set=s;
10         tmp->encoding=NULL;
11         return &tmp->base;
12 }
13
14 Element* allocElementFunction(Function * function, Element ** array, uint numArrays, Boolean * overflowstatus){
15         ElementFunction* tmp = (ElementFunction*) ourmalloc(sizeof(ElementFunction));
16         GETELEMENTTYPE(tmp)= ELEMFUNCRETURN;
17         GETPARENTSVECTOR(tmp) = allocDefVectorVoid();
18         GETSTRUCTTYPE(tmp) = _ELEMENT;
19         tmp->function=function;
20         tmp->overflowstatus = overflowstatus;
21         tmp->Elements = allocVectorArrayElement(numArrays, array);
22         return &tmp->base;
23 }
24
25 void deleteElement(Element *This) {
26         DELETEPARENTSVECTOR(This);
27         ourfree(This);
28 }