Fix functionencoder to have correct pointers...
authorbdemsky <bdemsky@uci.edu>
Fri, 16 Jun 2017 06:27:39 +0000 (23:27 -0700)
committerbdemsky <bdemsky@uci.edu>
Fri, 16 Jun 2017 06:27:58 +0000 (23:27 -0700)
src/Encoders/functionencoder.c
src/Encoders/functionencoder.h

index 119623aafeb002c7692fb501729a1af0a74b7efe..fa51fba8345957049ccb08d701fb6cbff1bd2a36 100644 (file)
@@ -1,8 +1,15 @@
 #include "functionencoder.h"
 
 #include "functionencoder.h"
 
-FunctionEncoder * allocFunctionEncoder(FunctionEncoderType type, Function *function) {
+FunctionEncoder * allocFunctionEncoder(FunctionEncoderType type, Element *function) {
        FunctionEncoder * this=(FunctionEncoder *)ourmalloc(sizeof(FunctionEncoder));
        FunctionEncoder * this=(FunctionEncoder *)ourmalloc(sizeof(FunctionEncoder));
-       this->function=function;
+       this->op.function=function;
+       this->type=type;
+       return this;
+}
+
+FunctionEncoder * allocPredicateEncoder(FunctionEncoderType type, Boolean *predicate) {
+       FunctionEncoder * this=(FunctionEncoder *)ourmalloc(sizeof(FunctionEncoder));
+       this->op.predicate=predicate;
        this->type=type;
        return this;
 }
        this->type=type;
        return this;
 }
index 6827535c90544503266886429d1dfa23422c7374..4a6ba80c31c53df54bc63f4e26d3608d9ea08417 100644 (file)
@@ -8,11 +8,20 @@ enum FunctionEncoderType {
 
 typedef enum FunctionEncoderType FunctionEncoderType;
 
 
 typedef enum FunctionEncoderType FunctionEncoderType;
 
+union ElementPredicate {
+       Element * function;
+       Boolean * predicate;
+};
+
+typedef union ElementPredicate ElementPredicate;
+
 struct FunctionEncoder {
        FunctionEncoderType type;
 struct FunctionEncoder {
        FunctionEncoderType type;
-       Function * function;
+       bool isFunction; //true for function, false for predicate
+       ElementPredicate op;
 };
 
 };
 
-FunctionEncoder * allocFunctionEncoder(FunctionEncoderType type, Function *function);
+FunctionEncoder * allocFunctionEncoder(FunctionEncoderType type, Element *function);
+FunctionEncoder * allocPredicateEncoder(FunctionEncoderType type, Boolean *predicate);
 void deleteFunctionEncoder(FunctionEncoder *this);
 #endif
 void deleteFunctionEncoder(FunctionEncoder *this);
 #endif