From c5d0acf0fab462e650f0739ff1223ed1966ad770 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 6 Jan 2011 20:21:20 +0900 Subject: [PATCH] Allow arrays to have ranges (not fully implmented) --- tools/qfcc/include/type.h | 2 ++ tools/qfcc/source/type.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tools/qfcc/include/type.h b/tools/qfcc/include/type.h index d0f356ae2..c62b62521 100644 --- a/tools/qfcc/include/type.h +++ b/tools/qfcc/include/type.h @@ -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); diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index a0b157ecf..5c8114e2e 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -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) {