+/**
+ * print an array type
+ */
+static void print_array_type(stabs_handle *h, ir_type *tp, int local) {
+ ir_type *etp = get_array_element_type(tp);
+ int i, n = get_array_n_dimensions(tp);
+ unsigned type_num = local ? h->next_type_nr++ : get_type_number(h, tp);
+ int *perm;
+
+ fprintf(h->f, "%u=a", type_num);
+ NEW_ARR_A(int, perm, n);
+ for (i = 0; i < n; ++i) {
+ perm[i] = get_array_order(tp, i);
+ }
+
+ for (i = 0; i < n; ++i) {
+ int dim = perm[i];
+
+ if (is_Const(get_array_lower_bound(tp, dim)) && is_Const(get_array_upper_bound(tp, dim))) {
+ long min = get_array_lower_bound_int(tp, dim);
+ long max = get_array_upper_bound_int(tp, dim);
+
+ /* FIXME r1 must be integer type, but seems to work for now */
+ fprintf(h->f, "r1;%ld;%ld;", min, max-1);
+ }
+ }
+
+ type_num = get_type_number(h, etp);
+ fprintf(h->f, "%d", type_num);
+}
+
+/**
+ * Generates an array type
+ *
+ * @param env the walker environment
+ * @param tp the type
+ */
+static void gen_array_type(wenv_t *env, ir_type *tp) {
+ stabs_handle *h = env->h;
+ ir_type *etp = get_array_element_type(tp);
+
+ SET_TYPE_READY(tp);
+ if (! IS_TYPE_READY(etp))
+ waitq_put(env->wq, etp);
+
+ fprintf(h->f, "\t.stabs\t\"%s:t", get_type_name(tp));
+
+ print_array_type(h, tp, 0);
+
+ fprintf(h->f, "\",%d,0,0,0\n", N_LSYM);
+} /* gen_array_type */
+