Adding predicateOperator (equality operation ...)
[satune.git] / src / AST / function.c
index d4b693e3fa71980a20a0770d4de381ec4fc0052c..43adc256e699690af4c0088800ba89a86a741cc9 100644 (file)
@@ -1 +1,34 @@
 #include "function.h"
+#include "table.h"
+#include "set.h"
+
+
+Function* allocFunctionOperator( ArithOp op, Set ** domain, uint numDomain, Set * range,OverFlowBehavior overflowbehavior){
+       FunctionOperator* This = (FunctionOperator*) ourmalloc(sizeof(FunctionOperator));
+       GETFUNCTIONTYPE(This)=OPERATORFUNC;
+       allocInlineArrayInitSet(&This->domains, domain, numDomain);
+       This->op=op;
+       This->overflowbehavior = overflowbehavior;
+       This->range=range;
+       return &This->base;
+}
+
+Function* allocFunctionTable (Table* table){
+       FunctionTable* This = (FunctionTable*) ourmalloc(sizeof(FunctionTable));
+       GETFUNCTIONTYPE(This)=TABLEFUNC;
+       This->table = table;
+       return &This->base;
+}
+
+void deleteFunction(Function* This){
+       switch(GETFUNCTIONTYPE(This)){
+       case TABLEFUNC:
+               break;
+       case OPERATORFUNC:
+               deleteInlineArraySet(&((FunctionOperator*) This)->domains);
+               break;
+       default:
+               ASSERT(0);
+       }
+       ourfree(This);
+}