42
42
if (st.is_boolean_type ()) {
43
43
// typedef for boolean types
44
decl_space.add_include ("stdbool.h");
45
st.set_cname ("bool");
47
45
} else if (st.is_integer_type ()) {
48
46
// typedef for integral types
49
decl_space.add_include ("stdint.h");
50
st.set_cname ("%sint%d_t".printf (st.signed ? "" : "u", st.width));
52
48
} else if (st.is_decimal_floating_type ()) {
53
49
// typedef for decimal floating types
54
st.set_cname ("_Decimal%d".printf (st.width));
56
51
} else if (st.is_floating_type ()) {
57
52
// typedef for generic floating types
58
st.set_cname (st.width == 64 ? "double" : "float");
62
56
var instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
64
58
foreach (Field f in st.get_fields ()) {
65
string field_ctype = f.field_type.get_cname ();
59
string field_ctype = f.variable_type.get_cname ();
66
60
if (f.is_volatile) {
67
61
field_ctype = "volatile " + field_ctype;
70
64
if (f.binding == MemberBinding.INSTANCE) {
71
generate_type_declaration (f.field_type, decl_space);
65
generate_type_declaration (f.variable_type, decl_space);
73
instance_struct.add_field (field_ctype, f.get_cname () + f.field_type.get_cdeclarator_suffix ());
67
instance_struct.add_field (field_ctype, f.get_cname () + f.variable_type.get_cdeclarator_suffix ());