]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Use c:symbol-prefixes as lower_case_cprefix when available
authorLuca Bruno <lucabru@src.gnome.org>
Mon, 22 Aug 2011 10:23:12 +0000 (12:23 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Mon, 22 Aug 2011 19:49:02 +0000 (21:49 +0200)
vala/valagirparser.vala
vapi/metadata/GtkSource-3.0.metadata
vapi/metadata/PangoCairo-1.0.metadata

index c44070574e04a2db30aef982b056a463a72bd67e..81cf6a8dcd15c02664b3fe83ff6c5c7342ecb90e 100644 (file)
@@ -68,6 +68,7 @@ public class Vala.GirParser : CodeVisitor {
                SENTINEL,
                CLOSURE,
                CPREFIX,
+               LOWER_CASE_CPREFIX,
                ERRORDOMAIN;
 
                public static ArgumentType? from_string (string name) {
@@ -1741,6 +1742,7 @@ public class Vala.GirParser : CodeVisitor {
                start_element ("namespace");
 
                string? cprefix = reader.get_attribute ("c:identifier-prefixes");
+               string? lower_case_cprefix = reader.get_attribute ("c:symbol-prefixes");
                string vala_namespace = cprefix;
                string gir_namespace = reader.get_attribute ("name");
                string gir_version = reader.get_attribute ("version");
@@ -1778,12 +1780,24 @@ public class Vala.GirParser : CodeVisitor {
                        cprefix = ns_metadata.get_string (ArgumentType.CPREFIX);
                }
 
+               if (ns_metadata.has_argument (ArgumentType.LOWER_CASE_CPREFIX)) {
+                       lower_case_cprefix = ns_metadata.get_string (ArgumentType.LOWER_CASE_CPREFIX);
+               } else if (lower_case_cprefix != null) {
+                       lower_case_cprefix += "_";
+               }
+
                ns.set_attribute_string ("CCode", "gir_namespace", gir_namespace);
                ns.set_attribute_string ("CCode", "gir_version", gir_version);
 
                if (cprefix != null) {
                        ns.set_attribute_string ("CCode", "cprefix", cprefix);
-                       ns.set_attribute_string ("CCode", "lower_case_cprefix", Symbol.camel_case_to_lower_case (cprefix) + "_");
+                       if (lower_case_cprefix == null) {
+                               ns.set_attribute_string ("CCode", "lower_case_cprefix", Symbol.camel_case_to_lower_case (cprefix) + "_");
+                       }
+               }
+
+               if (lower_case_cprefix != null) {
+                       ns.set_attribute_string ("CCode", "lower_case_cprefix", lower_case_cprefix);
                }
 
                if (cheader_filenames != null) {
index d570b4ec11299ad296b23ad93cd1f97151b4aabf..69fa7fd4bcc7316648215826e2d4b1a15d968376 100644 (file)
@@ -1,5 +1,5 @@
 * name="(.+)/Source\\1"
-GtkSource name="Gtk" cprefix="Gtk"
+GtkSource name="Gtk" cprefix="Gtk" lower_case_cprefix="gtk_"
 CompletionProvider
         .*#virtual_method virtual
         .get_icon nullable
index 1c486eae19f3c94df3b0205b29028ee6006c6fbe..04cf408fe818a22a7e06b5db63827b16d6de27b4 100644 (file)
@@ -1,6 +1,6 @@
 * name="(.+)/Cairo\\1"
 *#function name="(.+)/cairo_\\1" skip=false
-PangoCairo name="Pango" cprefix="Pango"
+PangoCairo name="Pango" cprefix="Pango" lower_case_cprefix="pango_"
 
 // Report upstream
 PangoCairo cheader_filename="pango/pangocairo.h"