+/**
+ * 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;
+ unsigned type_num = get_type_number(h, tp);
+ int i, n = get_array_n_dimensions(tp);
+ ir_type *etp = get_array_element_type(tp);
+ int *perm;
+
+ SET_TYPE_READY(tp);
+ if (! IS_TYPE_READY(etp))
+ waitq_put(env->wq, etp);
+
+ NEW_ARR_A(int, perm, n);
+ for (i = 0; i < n; ++i) {
+ perm[i] = get_array_order(tp, i);
+ }
+ fprintf(h->f, "\t.stabs\t\"%s:t%u=a", get_type_name(tp), type_num);
+
+ for (i = 0; i < n; ++i) {
+ int dim = perm[i];
+ 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\",%d,0,0,0\n", type_num, N_LSYM);
+} /* gen_array_type */
+
+/**
+ * Generates a method type
+ *
+ * @param env the walker environment
+ * @param tp the type
+ */
+static void gen_method_type(wenv_t *env, ir_type *tp) {
+ stabs_handle *h = env->h;
+ unsigned type_num = get_type_number(h, tp);
+ ir_type *rtp = NULL;
+ unsigned res_type_num;
+ int i, n = get_method_n_ress(tp);
+
+ SET_TYPE_READY(tp);
+ if (n > 0) {
+ rtp = get_method_res_type(tp, 0);
+ if (! IS_TYPE_READY(rtp))
+ waitq_put(env->wq, rtp);
+ }
+ res_type_num = get_type_number(h, rtp);
+
+ fprintf(h->f, "\t.stabs\t\"%s:t%u=f%u", get_type_name(tp), type_num, res_type_num);
+
+ /* handle more than one return type */
+ for (i = 1; i < n; ++i) {
+ rtp = get_method_res_type(tp, i);
+ if (! IS_TYPE_READY(rtp))
+ waitq_put(env->wq, rtp);
+ res_type_num = get_type_number(h, rtp);
+ fprintf(h->f, ",%u", res_type_num);
+ }
+ fprintf(h->f, "\",%d,0,0,0\n", N_LSYM);
+} /* gen_method_type */
+