X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satune.git;a=blobdiff_plain;f=src%2FAST%2Fboolean.h;h=cdc05a6be55487fd5fcc5db483be2067fc920562;hp=f1d2127498d65fef3117f2c7d5e7a215c74e5b1e;hb=4221735881b9d1cd53ef410d9448efd2d12a51ad;hpb=b373ca39ded747fb61eda999a28dc178a6bb5eaa diff --git a/src/AST/boolean.h b/src/AST/boolean.h index f1d2127..cdc05a6 100644 --- a/src/AST/boolean.h +++ b/src/AST/boolean.h @@ -3,16 +3,61 @@ #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