vala r2260 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2260 - in trunk: . gobject vala
- Date: Sat, 3 Jan 2009 17:45:49 +0000 (UTC)
Author: juergbi
Date: Sat Jan 3 17:45:49 2009
New Revision: 2260
URL: http://svn.gnome.org/viewvc/vala?rev=2260&view=rev
Log:
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
Modified:
trunk/ChangeLog
trunk/gobject/valaccodearraymodule.vala
trunk/vala/valafield.vala
Modified: trunk/gobject/valaccodearraymodule.vala
==============================================================================
--- trunk/gobject/valaccodearraymodule.vala (original)
+++ trunk/gobject/valaccodearraymodule.vala Sat Jan 3 17:45:49 2009
@@ -175,7 +175,12 @@
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;
Modified: trunk/vala/valafield.vala
==============================================================================
--- trunk/vala/valafield.vala (original)
+++ trunk/vala/valafield.vala Sat Jan 3 17:45:49 2009
@@ -69,6 +69,15 @@
*/
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 @@
}
}
+ /**
+ * 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 @@
add_cheader_filename (filename);
}
}
+ if (a.has_argument ("array_length_cname")) {
+ set_array_length_cname (a.get_string ("array_length_cname"));
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]