MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / make_array_declaration

Function make_array_declaration

src/gpre/languages/pas.cpp:3161–3235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3159//
3160
3161static void make_array_declaration( const ref* reference)
3162{
3163 const gpre_fld* field = reference->ref_field;
3164 const TEXT* name = field->fld_symbol->sym_string;
3165
3166 // Don't generate multiple declarations for the array. V3 Bug 569.
3167
3168 if (field->fld_array_info->ary_declared)
3169 return;
3170
3171 field->fld_array_info->ary_declared = true;
3172
3173 if (field->fld_array_info->ary_dtype <= dtype_varying)
3174 fprintf(gpreGlob.out_file, "gds__%d : %s [", field->fld_array_info->ary_ident, PACKED_ARRAY);
3175 else
3176 fprintf(gpreGlob.out_file, "gds__%d : array [", field->fld_array_info->ary_ident);
3177
3178 // Print out the dimension part of the declaration
3179 for (const dim* dimension = field->fld_array_info->ary_dimension; dimension;
3180 dimension = dimension->dim_next)
3181 {
3182 fprintf(gpreGlob.out_file, "%" SLONGFORMAT"..%" SLONGFORMAT, dimension->dim_lower,
3183 dimension->dim_upper);
3184 if (dimension->dim_next)
3185 fprintf(gpreGlob.out_file, ", ");
3186 }
3187
3188 if (field->fld_array_info->ary_dtype <= dtype_varying)
3189 fprintf(gpreGlob.out_file, ", 1..%d", field->fld_array->fld_length);
3190
3191 fprintf(gpreGlob.out_file, "] of ");
3192
3193 switch (field->fld_array_info->ary_dtype)
3194 {
3195 case dtype_short:
3196 fprintf(gpreGlob.out_file, SHORT_DCL);
3197 break;
3198
3199 case dtype_long:
3200 fprintf(gpreGlob.out_file, LONG_DCL);
3201 break;
3202
3203 case dtype_cstring:
3204 case dtype_text:
3205 case dtype_varying:
3206 fprintf(gpreGlob.out_file, "char");
3207 break;
3208
3209 case dtype_date:
3210 case dtype_quad:
3211 fprintf(gpreGlob.out_file, "ISC_QUAD");
3212 break;
3213
3214 case dtype_real:
3215 fprintf(gpreGlob.out_file, "real");
3216 break;
3217
3218 case dtype_double:

Callers 1

gen_databaseFunction · 0.70

Calls 2

CPR_errorFunction · 0.85
snprintfFunction · 0.50

Tested by

no test coverage detected