[vala] girparser: Support lower_case_csuffix
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Support lower_case_csuffix
- Date: Mon, 1 Aug 2011 22:48:01 +0000 (UTC)
commit 7abd9b1b835fd573265c0238470a474aa39562d5
Author: Luca Bruno <lucabru src gnome org>
Date: Mon Aug 1 23:47:33 2011 +0200
girparser: Support lower_case_csuffix
vala/valagirparser.vala | 28 ++++++++++++++++++++++------
vapi/clutter-1.0.vapi | 2 +-
2 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 436ba95..9a71429 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -581,11 +581,6 @@ public class Vala.GirParser : CodeVisitor {
}
}
- /* gir doesn't use the full C prefix in c:symbol-prefix
- * so we can't rely on it if parent changed prefix */
- if (prefix == null && girdata != null && girdata["c:symbol-prefix"] != null && !parent.metadata.has_argument (ArgumentType.CPREFIX)) {
- prefix = "%s%s_".printf (parent.get_lower_case_cprefix (), girdata["c:symbol-prefix"]);
- }
if (prefix == null) {
prefix = get_default_lower_case_cprefix ();
}
@@ -593,7 +588,24 @@ public class Vala.GirParser : CodeVisitor {
}
public string get_default_lower_case_cprefix () {
- return "%s%s_".printf (parent.get_lower_case_cprefix (), Symbol.camel_case_to_lower_case (name));
+ return "%s%s_".printf (parent.get_lower_case_cprefix (), get_lower_case_csuffix ());
+ }
+
+ public string get_lower_case_csuffix () {
+ var suffix = symbol.get_attribute_string ("CCode", "lower_case_csuffix");
+
+ // we can't rely on gir suffix if metadata changed the name
+ if (suffix == null && girdata != null && girdata["c:symbol-prefix"] != null && !metadata.has_argument (ArgumentType.NAME)) {
+ suffix = girdata["c:symbol-prefix"];
+ }
+ if (suffix == null) {
+ suffix = get_default_lower_case_csuffix ();
+ }
+ return suffix;
+ }
+
+ public string get_default_lower_case_csuffix () {
+ return Symbol.camel_case_to_lower_case (name);
}
public string get_cprefix () {
@@ -947,6 +959,10 @@ public class Vala.GirParser : CodeVisitor {
symbol.set_attribute_string ("CCode", "lower_case_cprefix", get_lower_case_cprefix ());
}
}
+ // lower_case_csuffix
+ if (get_lower_case_csuffix () != get_default_lower_case_csuffix ()) {
+ symbol.set_attribute_string ("CCode", "lower_case_csuffix", get_lower_case_csuffix ());
+ }
}
if (!(new_symbol && merged) && is_container (symbol)) {
diff --git a/vapi/clutter-1.0.vapi b/vapi/clutter-1.0.vapi
index 9053c1d..63bc66d 100644
--- a/vapi/clutter-1.0.vapi
+++ b/vapi/clutter-1.0.vapi
@@ -1153,7 +1153,7 @@ namespace Clutter {
public void set_width (float width);
public void union (Clutter.PaintVolume another_pv);
}
- [CCode (cheader_filename = "clutter/clutter.h", cprefix = "clutter_param_units_", type_id = "clutter_param_units_get_type ()")]
+ [CCode (cheader_filename = "clutter/clutter.h", lower_case_csuffix = "param_units", type_id = "clutter_param_units_get_type ()")]
public class ParamSpecUnit {
[CCode (has_construct_function = false)]
protected ParamSpecUnit ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]