+2008-05-03 Jürg Billeter <j@bitron.ch>
+
+ * vala/valainterfacewriter.vala:
+ * vala/valastruct.vala:
+
+ Support custom cname for structs in InterfaceWriter
+
2008-05-02 Jürg Billeter <j@bitron.ch>
* vala/valastruct.vala: inherit integer_type and floating_type,
write_indent ();
+ write_string ("[CCode (");
+
+ if (st.get_cname () != st.get_default_cname ()) {
+ write_string ("cname = \"%s\", ".printf (st.get_cname ()));
+ }
+
var first = true;
string cheaders;
foreach (string cheader in st.get_cheader_filenames ()) {
cheaders = "%s,%s".printf (cheaders, cheader);
}
}
- write_string ("[CCode (cheader_filename = \"%s\")]".printf (cheaders));
+ write_string ("cheader_filename = \"%s\")]".printf (cheaders));
write_newline ();
if (st.is_simple_type ()) {
}
if (cname == null) {
- cname = "%s%s".printf (parent_symbol.get_cprefix (), name);
+ cname = get_default_cname ();
}
return cname;
}
-
+
+ /**
+ * Returns the default name of this struct as it is used in C code.
+ *
+ * @return the name to be used in C code by default
+ */
+ public string get_default_cname () {
+ return "%s%s".printf (parent_symbol.get_cprefix (), name);
+ }
+
private void set_cname (string cname) {
this.cname = cname;
}