| 3187 | // |
| 3188 | |
| 3189 | static void make_array_declaration( ref* reference, int column) |
| 3190 | { |
| 3191 | gpre_fld* field = reference->ref_field; |
| 3192 | const TEXT* name = field->fld_symbol->sym_string; |
| 3193 | |
| 3194 | // Don't generate multiple declarations for the array. V3 Bug 569. |
| 3195 | |
| 3196 | if (field->fld_array_info->ary_declared) |
| 3197 | return; |
| 3198 | |
| 3199 | field->fld_array_info->ary_declared = true; |
| 3200 | |
| 3201 | if ((field->fld_array->fld_dtype <= dtype_varying) && (field->fld_array->fld_length != 1)) |
| 3202 | { |
| 3203 | if (field->fld_array->fld_sub_type == 1) |
| 3204 | fprintf(gpreGlob.out_file, "subtype isc_%d_byte is %s(1..%d);\n", |
| 3205 | field->fld_array_info->ary_ident, BYTE_VECTOR_DCL, |
| 3206 | field->fld_array->fld_length); |
| 3207 | else |
| 3208 | fprintf(gpreGlob.out_file, "subtype isc_%d_string is string(1..%d);\n", |
| 3209 | field->fld_array_info->ary_ident, field->fld_array->fld_length); |
| 3210 | } |
| 3211 | |
| 3212 | fprintf(gpreGlob.out_file, "type isc_%dt is array (", field->fld_array_info->ary_ident); |
| 3213 | |
| 3214 | // Print out the dimension part of the declaration |
| 3215 | const dim* dimension = field->fld_array_info->ary_dimension; |
| 3216 | for (int i = 1; |
| 3217 | i < field->fld_array_info->ary_dimension_count; |
| 3218 | dimension = dimension->dim_next, ++i) |
| 3219 | { |
| 3220 | fprintf(gpreGlob.out_file, "%s range %" SLONGFORMAT"..%" SLONGFORMAT",\n ", |
| 3221 | LONG_DCL, dimension->dim_lower, dimension->dim_upper); |
| 3222 | } |
| 3223 | |
| 3224 | fprintf(gpreGlob.out_file, "%s range %" SLONGFORMAT"..%" SLONGFORMAT") of ", |
| 3225 | LONG_DCL, dimension->dim_lower, dimension->dim_upper); |
| 3226 | |
| 3227 | switch (field->fld_array_info->ary_dtype) |
| 3228 | { |
| 3229 | case dtype_short: |
| 3230 | fprintf(gpreGlob.out_file, "%s", SHORT_DCL); |
| 3231 | break; |
| 3232 | |
| 3233 | case dtype_long: |
| 3234 | fprintf(gpreGlob.out_file, "%s", LONG_DCL); |
| 3235 | break; |
| 3236 | |
| 3237 | case dtype_cstring: |
| 3238 | case dtype_text: |
| 3239 | case dtype_varying: |
| 3240 | if (field->fld_array->fld_length == 1) |
| 3241 | { |
| 3242 | if (field->fld_array->fld_sub_type == 1) |
| 3243 | fprintf(gpreGlob.out_file, BYTE_DCL); |
| 3244 | else |
| 3245 | fprintf(gpreGlob.out_file, "firebird.isc_character"); |
| 3246 | } |
no test coverage detected