diff options
| author | Zac Pierson <zacpiersonhehe@gmail.com> | 2017-02-15 10:21:38 -0600 |
|---|---|---|
| committer | Zac Pierson <zacpiersonhehe@gmail.com> | 2017-02-15 10:21:38 -0600 |
| commit | aaa4dd5c363f2cb4643cd6489108d5be7c9d17de (patch) | |
| tree | cb6b93596135d2a7f868acc73fcea1536e3d7ab9 /src/types.c | |
| parent | 9d19ee7e4c285d5d881570be3328d81bdff40368 (diff) | |
| parent | 71100ed427ee2eec8d8a9d4d9616102738097e80 (diff) | |
Merge https://github.com/gingerBill/odin
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/types.c b/src/types.c index 6c0524955..06a407576 100644 --- a/src/types.c +++ b/src/types.c @@ -178,8 +178,9 @@ typedef struct Type { bool failure; } Type; -typedef Array(i32) Array_i32; +// TODO(bill): Should I add extra information here specifying the kind of selection? +// e.g. field, constant, vector field, type field, etc. typedef struct Selection { Entity * entity; Array_i32 index; @@ -195,6 +196,7 @@ Selection make_selection(Entity *entity, Array_i32 index, bool indirect) { void selection_add_index(Selection *s, isize index) { // IMPORTANT NOTE(bill): this requires a stretchy buffer/dynamic array so it requires some form // of heap allocation + // TODO(bill): Find a way to use a backing buffer for initial use as the general case is probably .count<3 if (s->index.e == NULL) { array_init(&s->index, heap_allocator()); } @@ -277,6 +279,7 @@ gb_global Type *t_byte_slice = NULL; gb_global Type *t_string_slice = NULL; +// Type generated for the "preload" file gb_global Type *t_type_info = NULL; gb_global Type *t_type_info_record = NULL; gb_global Type *t_type_info_enum_value = NULL; @@ -303,7 +306,6 @@ gb_global Type *t_type_info_raw_union = NULL; gb_global Type *t_type_info_enum = NULL; gb_global Type *t_type_info_map = NULL; - gb_global Type *t_type_info_named_ptr = NULL; gb_global Type *t_type_info_integer_ptr = NULL; gb_global Type *t_type_info_float_ptr = NULL; @@ -323,8 +325,6 @@ gb_global Type *t_type_info_raw_union_ptr = NULL; gb_global Type *t_type_info_enum_ptr = NULL; gb_global Type *t_type_info_map_ptr = NULL; - - gb_global Type *t_allocator = NULL; gb_global Type *t_allocator_ptr = NULL; gb_global Type *t_context = NULL; @@ -337,14 +337,15 @@ gb_global Type *t_map_header = NULL; -i64 type_size_of (gbAllocator allocator, Type *t); -i64 type_align_of (gbAllocator allocator, Type *t); -i64 type_offset_of(gbAllocator allocator, Type *t, i32 index); - +i64 type_size_of (gbAllocator allocator, Type *t); +i64 type_align_of (gbAllocator allocator, Type *t); +i64 type_offset_of (gbAllocator allocator, Type *t, i32 index); gbString type_to_string(Type *type); + + Type *base_type(Type *t) { for (;;) { if (t == NULL) { |