From 8aaba25d689b1f93a30ae5e26d64217149b05239 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 20 Jun 2017 13:33:11 -0700 Subject: [PATCH] ake --- src/AST/function.c | 8 +++++--- src/AST/function.h | 15 ++++++++------- src/AST/ops.h | 2 +- src/AST/predicate.h | 6 ++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/AST/function.c b/src/AST/function.c index c816363..daa3dc3 100644 --- a/src/AST/function.c +++ b/src/AST/function.c @@ -6,7 +6,9 @@ Function* allocFunctionOperator( ArithOp op, Set ** domain, uint numDomain, Set * range,OverFlowBehavior overflowbehavior){ FunctionOperator* This = (FunctionOperator*) ourmalloc(sizeof(FunctionOperator)); GETFUNCTIONTYPE(This)=OPERATORFUNC; - This->domains = allocVectorArraySet(numDomain, domain); + This->numDomains=numDomain; + This->domains = ourmalloc(numDomain * sizeof(Set *)); + memcpy(This->domains, domain, numDomain * sizeof(Set *)); This->op=op; This->overflowbehavior = overflowbehavior; This->range=range; @@ -23,12 +25,12 @@ Function* allocFunctionTable (Table* table){ void deleteFunction(Function* This){ switch(GETFUNCTIONTYPE(This)){ case TABLEFUNC: - ourfree((FunctionTable*)This); break; case OPERATORFUNC: - ourfree((FunctionOperator*) This); + ourfree(((FunctionOperator*) This)->domains); break; default: ASSERT(0); } + ourfree(This); } diff --git a/src/AST/function.h b/src/AST/function.h index 3f2a1a9..c04d6f2 100644 --- a/src/AST/function.h +++ b/src/AST/function.h @@ -12,16 +12,17 @@ struct Function{ }; struct FunctionOperator { - Function base; - ArithOp op; - VectorSet* domains; - Set * range; - OverFlowBehavior overflowbehavior; + Function base; + ArithOp op; + uint numDomains; + Set ** domains; + Set * range; + OverFlowBehavior overflowbehavior; }; struct FunctionTable{ - Function base; - Table* table; + Function base; + Table* table; }; Function* allocFunctionOperator( ArithOp op, Set ** domain, uint numDomain, Set * range,OverFlowBehavior overflowbehavior); diff --git a/src/AST/ops.h b/src/AST/ops.h index 62083f7..123617b 100644 --- a/src/AST/ops.h +++ b/src/AST/ops.h @@ -26,7 +26,7 @@ typedef enum OverFlowBehavior OverFlowBehavior; enum UndefinedBehavior {IGNOREBEHAVIOR, FLAGFORCEUNDEFINED, UNDEFINEDSETSFLAG, FLAGIFFUNDEFINED}; typedef enum UndefinedBehavior UndefinedBehavior; -enum BooleanType {ORDERCONST, BOOLEANVAR, LOGICOP, COMPARE, PREDICATEOP, TABLEPREDICATEOP}; +enum BooleanType {ORDERCONST, BOOLEANVAR, LOGICOP, PREDICATEOP, TABLEPREDICATEOP}; typedef enum BooleanType BooleanType; enum FunctionType {TABLEFUNC, OPERATORFUNC}; diff --git a/src/AST/predicate.h b/src/AST/predicate.h index f9edc09..f9af5af 100644 --- a/src/AST/predicate.h +++ b/src/AST/predicate.h @@ -14,14 +14,12 @@ struct Predicate { struct PredicateOperator { Predicate base; CompOp op; - Set** domains; - int numDomains; + Set ** domains; + uint numDomains; }; struct PredicateTable { Predicate base; - Set** domains; - int numDomains; Table* table; UndefinedBehavior undefinedbehavior; }; -- 2.34.1