projects
/
satune.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
66ab53e
)
Implement CPython strategy
author
bdemsky
<bdemsky@uci.edu>
Sat, 17 Jun 2017 06:34:50 +0000
(23:34 -0700)
committer
bdemsky
<bdemsky@uci.edu>
Sat, 17 Jun 2017 06:34:50 +0000
(23:34 -0700)
src/AST/boolean.c
patch
|
blob
|
history
src/AST/boolean.h
patch
|
blob
|
history
diff --git
a/src/AST/boolean.c
b/src/AST/boolean.c
index aaebba7312315e02f07b4068852de98499058459..d452b1a27e981a6c19627a15a8dd6b9bab237c83 100644
(file)
--- a/
src/AST/boolean.c
+++ b/
src/AST/boolean.c
@@
-1,19
+1,19
@@
#include "boolean.h"
Boolean* allocBoolean(VarType t) {
#include "boolean.h"
Boolean* allocBoolean(VarType t) {
- Boolean
* tmp=(Boolean*) ourmalloc(sizeof (Boolean
));
- tmp->btype=BOOLEANVAR;
- tmp->v
ar.v
type=t;
- return
tmp
;
+ Boolean
Var* tmp=(BooleanVar *) ourmalloc(sizeof (BooleanVar
));
+ tmp->b
ase.b
type=BOOLEANVAR;
+ tmp->vtype=t;
+ return
& tmp->base
;
}
Boolean* allocBooleanOrder(Order* order, uint64_t first, uint64_t second) {
}
Boolean* allocBooleanOrder(Order* order, uint64_t first, uint64_t second) {
- Boolean
* tmp=(Boolean*) ourmalloc(sizeof (Boolean
));
- tmp->btype=ORDERCONST;
- tmp->order
.order
=order;
- tmp->
order.
first=first;
- tmp->
order.
second=second;
- return
tmp
;
+ Boolean
Order* tmp=(BooleanOrder *) ourmalloc(sizeof (BooleanOrder
));
+ tmp->b
ase.b
type=ORDERCONST;
+ tmp->order=order;
+ tmp->first=first;
+ tmp->second=second;
+ return
& tmp -> base
;
}
void deleteBoolean(Boolean * this) {
}
void deleteBoolean(Boolean * this) {
diff --git
a/src/AST/boolean.h
b/src/AST/boolean.h
index 87d7a49da28aec59607f52f9d2332d344811bf01..065ba4ac2590696b7a107e1214019aff795c5c91 100644
(file)
--- a/
src/AST/boolean.h
+++ b/
src/AST/boolean.h
@@
-4,37
+4,41
@@
#include "mymemory.h"
#include "ops.h"
#include "mymemory.h"
#include "ops.h"
+/**
+ This is a little sketchy, but apparently legit.
+ https://www.python.org/dev/peps/pep-3123/ */
+
+struct Boolean {
+ BooleanType btype;
+};
+
struct BooleanOrder {
struct BooleanOrder {
+ Boolean base;
Order* order;
uint64_t first;
uint64_t second;
};
struct BooleanVar {
Order* order;
uint64_t first;
uint64_t second;
};
struct BooleanVar {
+ Boolean base;
VarType vtype;
};
struct BooleanLogic {
VarType vtype;
};
struct BooleanLogic {
+ Boolean base;
LogicOp op;
Boolean * left;
Boolean * right;
};
struct BooleanComp {
LogicOp op;
Boolean * left;
Boolean * right;
};
struct BooleanComp {
+ Boolean base;
CompOp op;
Boolean * left;
Boolean * right;
};
CompOp op;
Boolean * left;
Boolean * right;
};
-struct Boolean {
- BooleanType btype;
- union {
- BooleanOrder order;
- BooleanVar var;
- BooleanLogic logic;
- BooleanComp comp;
- };
-};
+
Boolean * allocBoolean(VarType t);
Boolean * allocBooleanOrder(Order * order, uint64_t first, uint64_t second);
Boolean * allocBoolean(VarType t);
Boolean * allocBooleanOrder(Order * order, uint64_t first, uint64_t second);