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

Function make_array_declaration

src/gpre/languages/ftn.cpp:3586–3671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3584//
3585
3586static void make_array_declaration( const ref* reference)
3587{
3588 const gpre_fld* field = reference->ref_field;
3589 const SCHAR* const name = field->fld_symbol->sym_string;
3590
3591 // Check to see if the array already has been
3592 // declared in this routine or subroutine
3593 if (array_decl_list)
3594 {
3595 for (adl* loop_array = array_decl_list; loop_array; loop_array = loop_array->adl_next)
3596 {
3597 if (field->fld_array_info->ary_ident == loop_array->adl_gds_ident)
3598 {
3599 return;
3600 }
3601 }
3602 }
3603
3604 // If not, add it to the "declared" list and declare it
3605 adl* this_array = (adl*) MSC_alloc(ADL_LEN);
3606 this_array->adl_gds_ident = field->fld_array_info->ary_ident;
3607 if (array_decl_list)
3608 this_array->adl_next = array_decl_list;
3609 else
3610 this_array->adl_next = NULL;
3611 array_decl_list = this_array;
3612
3613 switch (field->fld_array_info->ary_dtype)
3614 {
3615 case dtype_short:
3616 fprintf(gpreGlob.out_file, "%sINTEGER*2%s", COLUMN, COLUMN);
3617 break;
3618
3619 case dtype_long:
3620 fprintf(gpreGlob.out_file, "%sINTEGER*4%s", COLUMN, COLUMN);
3621 break;
3622
3623 case dtype_date:
3624 case dtype_blob:
3625 case dtype_quad:
3626 fprintf(gpreGlob.out_file, "%sINTEGER*4%s", COLUMN, COLUMN);
3627 break;
3628
3629 case dtype_text:
3630 fprintf(gpreGlob.out_file, "%sCHARACTER*%d%s", COLUMN, field->fld_array->fld_length, COLUMN);
3631 break;
3632
3633 case dtype_real:
3634 fprintf(gpreGlob.out_file, "%sREAL%s", COLUMN, COLUMN);
3635 break;
3636
3637 case dtype_double:
3638 fprintf(gpreGlob.out_file, "%s%s%s", COLUMN, DOUBLE_DCL, COLUMN);
3639 break;
3640
3641 default:
3642 {
3643 TEXT s[64];

Callers 1

gen_database_declsFunction · 0.70

Calls 2

MSC_allocFunction · 0.85
CPR_errorFunction · 0.85

Tested by

no test coverage detected