if (param.parameter_type.data_type is Struct) {
var st = (Struct) param.parameter_type.data_type;
if (!st.is_simple_type () && param.direction == ParameterDirection.IN) {
- if (st.use_const && !param.parameter_type.value_owned) {
+ if (st.is_immutable && !param.parameter_type.value_owned) {
ctypename = "const " + ctypename;
}
public bool free_function_address_of { get; private set; }
private string cname;
- private string const_cname;
+ public string const_cname { get; set; }
private string lower_case_cprefix;
private string lower_case_csuffix;
private string type_id;
public void set_cname (string cname) {
this.cname = cname;
}
-
+
private string get_lower_case_csuffix () {
if (lower_case_csuffix == null) {
lower_case_csuffix = camel_case_to_lower_case (name);
if (cl.get_cname () != cl.get_default_cname ()) {
write_string ("cname = \"%s\", ".printf (cl.get_cname ()));
}
+ if (cl.const_cname != null) {
+ write_string ("const_cname = \"%s\", ".printf (cl.const_cname));
+ }
if (cl.type_check_function != null) {
write_string ("type_check_function = \"%s\", ".printf (cl.type_check_function ));
return;
}
+ if (st.is_immutable) {
+ write_indent ();
+ write_string ("[Immutable]");
+ write_newline ();
+ }
+
write_indent ();
write_string ("[CCode (");
write_string ("type_id = \"%s\", ".printf (st.get_type_id ()));
}
- if (!st.use_const) {
- write_string ("use_const = false, ");
- }
-
if (!st.has_copy_function) {
write_string ("has_copy_function = false, ");
}
* Specifies if 'const' should be emitted for input parameters
* of this type.
*/
- public bool use_const { get; set; default = true; }
+ public bool is_immutable { get; set; }
/**
* Specifies whether this struct has a registered GType.
if (a.has_argument ("has_destroy_function")) {
has_destroy_function = a.get_bool ("has_destroy_function");
}
- if (a.has_argument ("use_const")) {
- use_const = a.get_bool ("use_const");
- }
}
private void process_boolean_type_attribute (Attribute a) {
process_integer_type_attribute (a);
} else if (a.name == "FloatingType") {
process_floating_type_attribute (a);
+ } else if (a.name == "Immutable") {
+ is_immutable = true;
}
}
}
if (eval (nv[1]) == "1") {
st.set_simple_type (true);
}
- } else if (nv[0] == "use_const") {
- if (eval (nv[1]) == "0") {
- st.use_const = false;
+ } else if (nv[0] == "immutable") {
+ if (eval (nv[1]) == "1") {
+ st.is_immutable = true;
}
} else if (nv[0] == "has_type_id") {
if (eval (nv[1]) == "0") {
if (eval (nv[1]) == "1") {
cl.is_immutable = true;
}
+ } else if (nv[0] == "const_cname") {
+ cl.const_cname = eval (nv[1]);
} else if (nv[0] == "is_fundamental") {
if (eval (nv[1]) == "1") {
cl.is_compact = false;
var nv = attr.split ("=", 2);
if (nv[0] == "cheader_filename") {
st.add_cheader_filename (eval (nv[1]));
- } else if (nv[0] == "use_const") {
- if (eval (nv[1]) == "0") {
- st.use_const = false;
+ } else if (nv[0] == "immutable") {
+ if (eval (nv[1]) == "1") {
+ st.is_immutable = true;
}
} else if (nv[0] == "has_copy_function") {
if (eval (nv[1]) == "0") {
if (eval (nv[1]) == "1") {
cl.is_immutable = true;
}
+ } else if (nv[0] == "const_cname") {
+ cl.const_cname = eval (nv[1]);
}
}
}