Allow arrays to have ranges (not fully implmented)

This commit is contained in:
Bill Currie 2011-01-06 20:21:20 +09:00
parent 25c36a51a8
commit c5d0acf0fa
2 changed files with 15 additions and 0 deletions

View file

@ -45,6 +45,7 @@ typedef struct type_s {
union {
struct class_s *class; // for ev_class
struct struct_s *strct; // for ev_struct
int base; // for arrays
} s;
} type_t;
@ -97,6 +98,7 @@ typedef_t *get_typedef (const char *name);
type_t *field_type (type_t *aux);
type_t *pointer_type (type_t *aux);
type_t *array_type (type_t *aux, int size);
type_t *based_array_type (type_t *aux, int base, int top);
void print_type (type_t *type);
const char *encode_params (type_t *type);
void encode_type (struct dstring_s *encoding, type_t *type);

View file

@ -229,6 +229,19 @@ array_type (type_t *aux, int size)
return find_type (&new);
}
type_t *
based_array_type (type_t *aux, int base, int top)
{
type_t new;
memset (&new, 0, sizeof (new));
new.type = ev_array;
new.aux_type = aux;
new.num_parms = top - base + 1;
new.s.base = base;
return find_type (&new);
}
void
print_type (type_t *type)
{