]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Support lower_case_csuffix
authorLuca Bruno <lucabru@src.gnome.org>
Mon, 1 Aug 2011 21:47:33 +0000 (23:47 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Mon, 1 Aug 2011 22:46:51 +0000 (00:46 +0200)
vala/valagirparser.vala
vapi/clutter-1.0.vapi

index 436ba9598bd7e83778c195106d319d09db1e51a6..9a71429855d5eab7c0d6bc2f7fe1be623f2f845d 100644 (file)
@@ -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)) {
index 9053c1d6959f329fe4e48d5f2e71d391329716ce..63bc66def954d0a60752c972c32e0762401d9ebf 100644 (file)
@@ -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 ();