Commit 9d268488 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Add array_length_cname attribute for fields, patch by Andreas Brauchli,

2009-01-03  Jürg Billeter  <j@bitron.ch>

	* vala/valafield.vala:
	* gobject/valaccodearraymodule.vala:

	Add array_length_cname attribute for fields,
	patch by Andreas Brauchli, fixes bug 565793

svn path=/trunk/; revision=2260
parent dd6fed15
2009-01-03 Jürg Billeter <j@bitron.ch>
* vala/valafield.vala:
* gobject/valaccodearraymodule.vala:
Add array_length_cname attribute for fields,
patch by Andreas Brauchli, fixes bug 565793
2009-01-03 Jürg Billeter <j@bitron.ch>
* vapi/packages/gstreamer-0.10/:
......
......@@ -175,7 +175,12 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
var cl = field.parent_symbol as Class;
bool is_gtypeinstance = (cl != null && !cl.is_compact);
var length_cname = get_array_length_cname (field.name, dim);
string length_cname;
if (field.has_array_length_cname) {
length_cname = field.get_array_length_cname ();
} else {
length_cname = get_array_length_cname (field.name, dim);
}
CCodeExpression typed_inst = (CCodeExpression) get_ccodenode (ma.inner);
CCodeExpression inst;
......
......@@ -69,6 +69,15 @@ public class Vala.Field : Member, Lockable {
*/
public bool no_array_length { get; set; }
/**
* Specifies whether the array length field uses a custom name in C.
*/
public bool has_array_length_cname {
get { return (array_length_cname != null); }
}
private string? array_length_cname;
private string cname;
private bool lock_used = false;
......@@ -140,6 +149,25 @@ public class Vala.Field : Member, Lockable {
}
}
/**
* Returns the name of the array length field as it is used in C code
*
* @return the name of the array length field to be used in C code
*/
public string? get_array_length_cname () {
return this.array_length_cname;
}
/**
* Sets the name of the array length field as it is used in C code
*
* @param array_length_cname the name of the array length field to be
* used in C code
*/
public void set_array_length_cname (string? array_length_cname) {
this.array_length_cname = array_length_cname;
}
private void process_ccode_attribute (Attribute a) {
if (a.has_argument ("cname")) {
set_cname (a.get_string ("cname"));
......@@ -150,6 +178,9 @@ public class Vala.Field : Member, Lockable {
add_cheader_filename (filename);
}
}
if (a.has_argument ("array_length_cname")) {
set_array_length_cname (a.get_string ("array_length_cname"));
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment