Big Tabbing Change
[satune.git] / src / AST / boolean.h
index 5e8c5a5e6f9a225af80543f9d1fc4b2f1411cd14..cdc05a6be55487fd5fcc5db483be2067fc920562 100644 (file)
@@ -2,7 +2,62 @@
 #define BOOLEAN_H
 #include "classlist.h"
 #include "mymemory.h"
+#include "ops.h"
+#include "structs.h"
+#include "astnode.h"
+#include "functionencoding.h"
+#include "constraint.h"
 
-struct  Boolean {
+/**
+    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 *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