#include "classlist.h"
#include "mymemory.h"
#include "ops.h"
-struct Boolean {
- VarType vtype;
- enum BooleanType btype;
- Order* order;
- uint64_t first;
- uint64_t second;
+#include "structs.h"
+#include "astnode.h"
+#include "functionencoding.h"
+#include "constraint.h"
+
+/**
+ This is a little sketchy, but apparently legit.
+ https://www.python.org/dev/peps/pep-3123/ */
+
+#define GETBOOLEANTYPE(o) GETASTNODETYPE(o)
+#define GETBOOLEANPARENTS(o) (&((Boolean *)(o))->parents)
+#define GETBOOLEANPOLARITY(b) (((Boolean *)b)->polarity)
+#define GETBOOLEANVALUE(b) (((Boolean *)b)->boolVal)
+
+struct Boolean {
+ ASTNode base;
+ Polarity polarity;
+ BooleanValue boolVal;
+ VectorBoolean parents;
+};
+
+struct BooleanOrder {
+ Boolean base;
+ Order *order;
+ uint64_t first;
+ uint64_t second;
+};
+
+struct BooleanVar {
+ Boolean base;
+ VarType vtype;
+ Edge var;
+};
+
+struct BooleanLogic {
+ Boolean base;
+ LogicOp op;
+ ArrayBoolean inputs;
+};
+
+struct BooleanPredicate {
+ Boolean base;
+ Predicate *predicate;
+ FunctionEncoding encoding;
+ ArrayElement inputs;
+ Boolean *undefStatus;
};
-Boolean* allocBoolean(VarType t);
-Boolean* allocBooleanOrder(Order* order,uint64_t first, uint64_t second);
-void deleteBoolean(Boolean * this);
+Boolean *allocBooleanVar(VarType t);
+Boolean *allocBooleanOrder(Order *order, uint64_t first, uint64_t second);
+Boolean *allocBooleanPredicate(Predicate *predicate, Element **inputs, uint numInputs, Boolean *undefinedStatus);
+Boolean *allocBooleanLogicArray(CSolver *solver, LogicOp op, Boolean **array, uint asize);
+void deleteBoolean(Boolean *This);
+static inline FunctionEncoding *getPredicateFunctionEncoding(BooleanPredicate *func) {
+ return &func->encoding;
+}
#endif