diff options
author | Adrian Thurston <thurston@complang.org> | 2015-01-05 11:28:17 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-01-05 11:28:17 -0500 |
commit | 2b1372cc483637f6bedc511c145ce1682ffad987 (patch) | |
tree | fa6d6da76b2c41ce46f7e34302651bc0091fb804 /src/struct.h | |
parent | 8569491e54188467a5730960c2413164815e83f8 (diff) | |
download | colm-2b1372cc483637f6bedc511c145ce1682ffad987.tar.gz |
work on object-based lists
Diffstat (limited to 'src/struct.h')
-rw-r--r-- | src/struct.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/struct.h b/src/struct.h index 47c7b0ce..7aea468b 100644 --- a/src/struct.h +++ b/src/struct.h @@ -110,15 +110,18 @@ struct colm_struct *colm_struct_inbuilt( struct colm_program *prg, int size, #define colm_struct_get_field( obj, field ) \ ((struct colm_tree**)(((struct colm_struct*)obj)+1))[field] +#define colm_struct_get_field_type( obj, type, field ) \ + ((type*)(((struct colm_struct*)obj)+1))[field] + #define colm_struct_get_addr( obj, field ) \ - &(((struct colm_tree**)(((struct colm_struct*)obj)+1))[field]) + &(((void **)(((struct colm_struct*)obj)+1))[field]) + +#define colm_struct_get_addr_type( obj, type, field ) \ + (type*)(&(((void **)(((struct colm_struct*)obj)+1))[field])) #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 @@ -130,7 +133,8 @@ Stream *colm_stream_new2( struct colm_program *prg ); List *colm_list_new( struct colm_program *prg ); Tree *colm_list_get( List *list, Word field ); Tree *colm_list_el_get( ListEl *listEl, Word field ); -ListEl *colm_list_el_new( struct colm_program *prg ); +ListEl *colm_list_detach_head( List *list ); +long colm_list_length( List *list ); Map *colm_map_new( struct colm_program *prg ); |