~ubuntu-branches/ubuntu/vivid/vala/vivid

« back to all changes in this revision

Viewing changes to codegen/valadovastructmodule.vala

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-07-28 07:58:01 UTC
  • mfrom: (1.5.5 upstream) (7.3.14 experimental)
  • Revision ID: james.westby@ubuntu.com-20100728075801-18u9cg5hv5oety6m
Tags: 0.9.4-1
New upstream development release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
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");
46
44
                        return;
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));
51
47
                        return;
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));
55
50
                        return;
56
51
                } else if (st.is_floating_type ()) {
57
52
                        // typedef for generic floating types
58
 
                        st.set_cname (st.width == 64 ? "double" : "float");
59
53
                        return;
60
54
                }
61
55
 
62
56
                var instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
63
57
 
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;
68
62
                        }
69
63
 
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);
72
66
 
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 ());
74
68
                        }
75
69
                }
76
70