Minor formatting issues
[satune.git] / src / AST / boolean.h
1 #ifndef BOOLEAN_H
2 #define BOOLEAN_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "ops.h"
6 #include "structs.h"
7 #include "astnode.h"
8 #include "functionencoding.h"
9 #include "constraint.h"
10
11 /**
12     This is a little sketchy, but apparently legit.
13     https://www.python.org/dev/peps/pep-3123/ */
14
15 #define GETBOOLEANTYPE(o) GETASTNODETYPE(o)
16 #define GETBOOLEANPARENTS(o) (&((Boolean *)(o))->parents)
17
18 struct Boolean {
19         ASTNode base;
20         VectorBoolean parents;
21 };
22
23 struct BooleanOrder {
24         Boolean base;
25         Order* order;
26         uint64_t first;
27         uint64_t second;
28 };
29
30 struct BooleanVar {
31         Boolean base;
32         VarType vtype;
33         Edge var;
34 };
35
36 struct BooleanLogic {
37         Boolean base;
38         LogicOp op;
39         ArrayBoolean inputs;
40 };
41
42 struct BooleanPredicate {
43         Boolean base;
44         Predicate * predicate;
45         FunctionEncoding encoding;
46         ArrayElement inputs;
47 };
48
49 Boolean * allocBooleanVar(VarType t);
50 Boolean * allocBooleanOrder(Order * order, uint64_t first, uint64_t second);
51 Boolean * allocBooleanPredicate(Predicate * predicate, Element ** inputs, uint numInputs);
52 Boolean * allocBooleanLogicArray(CSolver *solver, LogicOp op, Boolean ** array, uint asize);
53 void deleteBoolean(Boolean * This);
54
55 static inline FunctionEncoding* getPredicateFunctionEncoding(BooleanPredicate* func){
56         return &func->encoding;
57 }
58
59 #endif