Fix some things that C++ doesn't like so we don't lose the possibility to use the...
[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
7 /** 
8                 This is a little sketchy, but apparently legit.
9                 https://www.python.org/dev/peps/pep-3123/ */
10
11 #define GETBOOLEANTYPE(o) (((Boolean *)(o))->btype)
12
13 struct Boolean {
14         BooleanType btype;
15 };
16
17 struct BooleanOrder {
18         Boolean base;
19         Order* order;
20         uint64_t first;
21         uint64_t second;
22 };
23
24 struct BooleanVar {
25         Boolean base;
26         VarType vtype;
27 };
28
29 struct BooleanLogic {
30         Boolean base;
31         LogicOp op;
32         Boolean * left;
33         Boolean * right;
34 };
35
36 struct BooleanComp {
37         Boolean base;
38         CompOp op;
39         Boolean * left;
40         Boolean * right;
41 };
42
43
44
45 Boolean * allocBoolean(VarType t);
46 Boolean * allocBooleanOrder(Order * order, uint64_t first, uint64_t second);
47 void deleteBoolean(Boolean * This);
48
49 #endif