vala r2355 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2355 - in trunk: . gobject vala
- Date: Fri, 16 Jan 2009 16:16:32 +0000 (UTC)
Author: juergbi
Date: Fri Jan 16 16:16:32 2009
New Revision: 2355
URL: http://svn.gnome.org/viewvc/vala?rev=2355&view=rev
Log:
2009-01-16 JÃrg Billeter <j bitron ch>
* vala/valafield.vala:
* gobject/valaccodearraymodule.vala:
Add array_length_cexpr CCode attribute for fields with constant
array length, patch by Andreas Brauchli, fixes bug 567301
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 Fri Jan 16 16:16:32 2009
@@ -208,7 +208,9 @@
CCodeExpression length_expr = null;
- if (field.binding == MemberBinding.INSTANCE) {
+ if (field.has_array_length_cexpr) {
+ length_expr = new CCodeConstant (field.get_array_length_cexpr ());
+ } else if (field.binding == MemberBinding.INSTANCE) {
var cl = field.parent_symbol as Class;
bool is_gtypeinstance = (cl != null && !cl.is_compact);
Modified: trunk/vala/valafield.vala
==============================================================================
--- trunk/vala/valafield.vala (original)
+++ trunk/vala/valafield.vala Fri Jan 16 16:16:32 2009
@@ -81,8 +81,17 @@
get { return (array_length_cname != null); }
}
+ /**
+ * Specifies whether the array uses a custom C expression as length.
+ */
+ public bool has_array_length_cexpr {
+ get { return (array_length_cexpr != null); }
+ }
+
private string? array_length_cname;
+ private string? array_length_cexpr;
+
private string cname;
private bool lock_used = false;
@@ -173,6 +182,26 @@
this.array_length_cname = array_length_cname;
}
+ /**
+ * Returns the array length expression as it is used in C code
+ *
+ * @return the array length expression to be used in C code
+ */
+ public string? get_array_length_cexpr () {
+ return this.array_length_cexpr;
+ }
+
+
+ /**
+ * Sets the array length expression as it is used in C code
+ *
+ * @param array_length_cexpr the array length expression to be used in C
+ * code
+ */
+ public void set_array_length_cexpr (string? array_length_cexpr) {
+ this.array_length_cexpr = array_length_cexpr;
+ }
+
private void process_ccode_attribute (Attribute a) {
if (a.has_argument ("cname")) {
set_cname (a.get_string ("cname"));
@@ -192,6 +221,9 @@
if (a.has_argument ("array_length_cname")) {
set_array_length_cname (a.get_string ("array_length_cname"));
}
+ if (a.has_argument ("array_length_cexpr")) {
+ set_array_length_cexpr (a.get_string ("array_length_cexpr"));
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]