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

Function make_port

src/gpre/c_cxx.cpp:3702–3797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3700//
3701
3702static void make_port(const gpre_port* port, int column)
3703{
3704 printa(column, "struct isc_%d_struct {", port->por_ident);
3705
3706 for (const ref* reference = port->por_references; reference; reference = reference->ref_next)
3707 {
3708 align(column + INDENT);
3709 const gpre_fld* field = reference->ref_field;
3710 const TEXT* name;
3711 const gpre_sym* symbol = field->fld_symbol;
3712 if (symbol)
3713 name = symbol->sym_string;
3714 else
3715 name = "<expression>";
3716 if (reference->ref_value && (reference->ref_flags & REF_array_elem))
3717 field = field->fld_array;
3718 int fld_len = 0;
3719 const TEXT* dtype;
3720
3721 switch (field->fld_dtype)
3722 {
3723 case dtype_short:
3724 dtype = "short";
3725 break;
3726
3727 case dtype_long:
3728 dtype = DCL_LONG;
3729 break;
3730
3731 case dtype_varying:
3732 fprintf(gpreGlob.out_file, " struct { ISC_USHORT length; ISC_UCHAR data[%d]; } isc_%d;\t/* %s */", field->fld_length, reference->ref_ident, name);
3733 continue;
3734
3735 case dtype_cstring:
3736 case dtype_text:
3737 dtype = "char ";
3738 if (field->fld_sub_type != 1 || field->fld_length > 1)
3739 fld_len = field->fld_length;
3740 break;
3741
3742 case dtype_quad:
3743 dtype = DCL_QUAD;
3744 break;
3745
3746 // Begin date/time/timestamp
3747 case dtype_sql_date:
3748 dtype = "ISC_DATE";
3749 break;
3750
3751 case dtype_sql_time:
3752 dtype = "ISC_TIME";
3753 break;
3754
3755 case dtype_timestamp:
3756 dtype = "ISC_TIMESTAMP";
3757 break;
3758 // End date/time/timestamp
3759

Callers 2

gen_functionFunction · 0.70
gen_routineFunction · 0.70

Calls 4

CPR_errorFunction · 0.85
printaFunction · 0.70
alignFunction · 0.70
snprintfFunction · 0.50

Tested by

no test coverage detected