#include "functionencoder.h"
-FunctionEncoder * allocFunctionEncoder(FunctionEncoderType type, Function *function) {
+FunctionEncoder * allocFunctionEncoder(FunctionEncoderType type, Element *function) {
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;
}
typedef enum FunctionEncoderType FunctionEncoderType;
+union ElementPredicate {
+ Element * function;
+ Boolean * predicate;
+};
+
+typedef union ElementPredicate ElementPredicate;
+
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