summaryrefslogtreecommitdiff
path: root/src/struct.h
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-01-02 11:10:24 -0500
committerAdrian Thurston <thurston@complang.org>2015-01-02 11:10:24 -0500
commitc48b743c977895834e1e0479e276123bf28681d9 (patch)
treefce62f75652e1e47f1ad2a4836b3026fb4925bc7 /src/struct.h
parent05e00a28c191a7898532118983be23ce25bed2b9 (diff)
downloadcolm-c48b743c977895834e1e0479e276123bf28681d9.tar.gz
parser converted to struct type
Got a basic compile/run working with a struct-based parser object.
Diffstat (limited to 'src/struct.h')
-rw-r--r--src/struct.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/struct.h b/src/struct.h
index 392cd9f2..a5e49cb6 100644
--- a/src/struct.h
+++ b/src/struct.h
@@ -6,10 +6,17 @@ void colm_struct_delete( struct colm_program *prg, struct colm_tree **sp,
struct colm_struct *colm_struct_inbuilt( Program *prg, int size, void *destructor );
-#define colm_struct_get_field(obj, field) \
+#define colm_struct_get_field( obj, field ) \
((struct colm_tree**)(((struct colm_struct*)obj)+1))[field]
-#define colm_struct_set_field(obj, field, val) \
+#define colm_struct_set_field( obj, field, val ) \
((struct colm_tree**)(((struct colm_struct*)obj)+1))[field] = val
+#define colm_struct_get_field_type( obj, type, field ) \
+ ((type*)(((struct colm_struct*)obj)+1))[field]
+
+#define colm_struct_set_field_type( obj, type, field, val ) \
+ ((type*)(((struct colm_struct*)obj)+1))[field] = val
+
+
#endif