[vala] girparser: Use c:symbol-prefixes as lower_case_cprefix when available
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] girparser: Use c:symbol-prefixes as lower_case_cprefix when available
- Date: Mon, 22 Aug 2011 22:42:14 +0000 (UTC)
commit 18850d394787add1fa47b4824bb4cb68490f3c63
Author: Luca Bruno <lucabru src gnome org>
Date: Mon Aug 22 12:23:12 2011 +0200
girparser: Use c:symbol-prefixes as lower_case_cprefix when available
vala/valagirparser.vala | 16 +++++++++++++++-
vapi/metadata/GtkSource-3.0.metadata | 2 +-
vapi/metadata/PangoCairo-1.0.metadata | 2 +-
3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index c440705..81cf6a8 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -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) {
diff --git a/vapi/metadata/GtkSource-3.0.metadata b/vapi/metadata/GtkSource-3.0.metadata
index d570b4e..69fa7fd 100644
--- a/vapi/metadata/GtkSource-3.0.metadata
+++ b/vapi/metadata/GtkSource-3.0.metadata
@@ -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
diff --git a/vapi/metadata/PangoCairo-1.0.metadata b/vapi/metadata/PangoCairo-1.0.metadata
index 1c486ea..04cf408 100644
--- a/vapi/metadata/PangoCairo-1.0.metadata
+++ b/vapi/metadata/PangoCairo-1.0.metadata
@@ -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"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]