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

Function gen_based

src/gpre/languages/pas.cpp:681–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679//
680
681static void gen_based( const act* action, int column)
682{
683 SSHORT datatype;
684
685 align(column);
686 bas* based_on = (bas*) action->act_object;
687 gpre_fld* field = based_on->bas_field;
688
689 if (based_on->bas_flags & BAS_segment)
690 {
691 datatype = dtype_text;
692 SLONG length = field->fld_seg_length;
693 if (!length)
694 length = 256;
695 fprintf(gpreGlob.out_file, "%s [1..%" SLONGFORMAT"] of ", PACKED_ARRAY, length);
696 }
697 else if (field->fld_array_info)
698 {
699 datatype = field->fld_array_info->ary_dtype;
700 if (datatype <= dtype_varying)
701 fprintf(gpreGlob.out_file, "%s [", PACKED_ARRAY);
702 else
703 fprintf(gpreGlob.out_file, "array [");
704
705 for (dim* dimension = field->fld_array_info->ary_dimension; dimension;
706 dimension = dimension->dim_next)
707 {
708 fprintf(gpreGlob.out_file, "%" SLONGFORMAT"..%" SLONGFORMAT, dimension->dim_lower,
709 dimension->dim_upper);
710 if (dimension->dim_next)
711 fprintf(gpreGlob.out_file, ", ");
712 }
713 if (datatype <= dtype_varying)
714 fprintf(gpreGlob.out_file, ", 1..%d", field->fld_array->fld_length);
715
716 fprintf(gpreGlob.out_file, "] of ");
717 }
718 else
719 {
720 datatype = field->fld_dtype;
721 if (datatype <= dtype_varying)
722 fprintf(gpreGlob.out_file, "%s [1..%d] of ", PACKED_ARRAY, field->fld_length);
723 }
724
725 TEXT s[64];
726
727 switch (datatype)
728 {
729 case dtype_short:
730 fprintf(gpreGlob.out_file, "%s;", SHORT_DCL);
731 break;
732
733 case dtype_long:
734 fprintf(gpreGlob.out_file, "%s;", LONG_DCL);
735 break;
736
737 case dtype_date:
738 case dtype_blob:

Callers 1

PAS_actionFunction · 0.70

Calls 2

CPR_errorFunction · 0.85
alignFunction · 0.70

Tested by

no test coverage detected