Commit after resolving conflicts
[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
8 /** 
9                 This is a little sketchy, but apparently legit.
10                 https://www.python.org/dev/peps/pep-3123/ */
11
12 #define GETBOOLEANTYPE(o) (((Boolean *)(o))->btype)
13
14 struct Boolean {
15         BooleanType btype;
16 };
17
18 struct BooleanOrder {
19         Boolean base;
20         Order* order;
21         uint64_t first;
22         uint64_t second;
23 };
24
25 struct BooleanVar {
26         Boolean base;
27         VarType vtype;
28         Constraint * var;
29 };
30
31 struct BooleanLogic {
32         Boolean base;
33         LogicOp op;
34         Boolean * left;
35         Boolean * right;
36 };
37
38 struct BooleanComp {
39         Boolean base;
40         CompOp op;
41         Boolean * left;
42         Boolean * right;
43 };
44
45 struct BooleanPredicate{
46     Boolean base;
47     Predicate * predicate;
48     VectorElement* inputs;
49 };
50
51
52 Boolean * allocBoolean(VarType t);
53 Boolean * allocBooleanOrder(Order * order, uint64_t first, uint64_t second);
54 Boolean * allocBooleanPredicate(Predicate * predicate, Element ** inputs, uint numInputs);
55 Boolean * allocBooleanLogic(LogicOp op, Boolean * left, Boolean* right);
56 /**
57  * This function also save new boooleans to solver->allbooleans
58  * @param solver
59  * @param op
60  * @param array
61  * @param asize
62  * @return 
63  */
64 Boolean * allocBooleanLogicArray(CSolver *solver, LogicOp op, Boolean ** array, uint asize);
65 void deleteBoolean(Boolean * This);
66
67 #endif