struct def *en_enums; /* Definitions of enumeration literals */
arith en_ncst; /* Number of constants */
label en_rck; /* Label of range check descriptor */
-#define enm_enums tp_value.tp_enum.en_enums
-#define enm_ncst tp_value.tp_enum.en_ncst
-#define enm_rck tp_value.tp_enum.en_rck
+#define enm_enums tp_value.tp_enum->en_enums
+#define enm_ncst tp_value.tp_enum->en_ncst
+#define enm_rck tp_value.tp_enum->en_rck
};
struct subrange {
arith su_lb, su_ub; /* lower bound and upper bound */
label su_rck; /* label of range check descriptor */
-#define sub_lb tp_value.tp_subrange.su_lb
-#define sub_ub tp_value.tp_subrange.su_ub
-#define sub_rck tp_value.tp_subrange.su_rck
+#define sub_lb tp_value.tp_subrange->su_lb
+#define sub_ub tp_value.tp_subrange->su_ub
+#define sub_rck tp_value.tp_subrange->su_rck
};
struct array {
struct type *ar_elem; /* type of elements */
label ar_descr; /* label of array descriptor */
arith ar_elsize; /* size of elements */
-#define arr_elem tp_value.tp_arr.ar_elem
-#define arr_descr tp_value.tp_arr.ar_descr
-#define arr_elsize tp_value.tp_arr.ar_elsize
+#define arr_elem tp_value.tp_arr->ar_elem
+#define arr_descr tp_value.tp_arr->ar_descr
+#define arr_elsize tp_value.tp_arr->ar_elsize
};
struct record {
int tp_align; /* alignment requirement of this type */
arith tp_size; /* size of this type */
union {
- struct enume tp_enum;
- struct subrange tp_subrange;
- struct array tp_arr;
+ struct enume *tp_enum;
+ struct subrange *tp_subrange;
+ struct array *tp_arr;
struct record tp_record;
struct proc tp_proc;
} tp_value;
extern long full_mask[];
-#define fit(n, i) (((n) + (0x80<<(((i)-1)*8)) & ~full_mask[(i)]) == 0)
+#define fit(n, i) (((n) + ((arith)0x80<<(((i)-1)*8)) & ~full_mask[(i)]) == 0)
#define ufit(n, i) (((n) & ~full_mask[(i)]) == 0)
break;
case T_ARRAY:
+ dtp->tp_value.tp_arr =
+ (struct array *) Malloc(sizeof(struct array));
if (tp) dtp->tp_align = tp->tp_align;
break;
case T_SUBRANGE:
assert(tp != 0);
+ dtp->tp_value.tp_subrange =
+ (struct subrange *) Malloc(sizeof(struct subrange));
dtp->tp_align = tp->tp_align;
dtp->tp_size = tp->tp_size;
break;
tp->tp_fund = fund;
tp->tp_align = align;
tp->tp_size = size;
+ if (fund == T_ENUMERATION || fund == T_CHAR) {
+ tp->tp_value.tp_enum =
+ (struct enume *) Malloc(sizeof(struct enume));
+ }
return tp;
}
/* a unique type indicating an error
*/
- error_type = standard_type(T_CHAR, 1, (arith) 1);
+ error_type = new_type();
+ *error_type = *char_type;
}
STATIC
qualified_type(nd)
register struct node *nd;
{
- struct type *tp = error_type;
register struct def *df;
if (ChkDesignator(nd)) {