]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Recognize c:type attributes in .gir
authorJürg Billeter <j@bitron.ch>
Wed, 11 Feb 2009 00:43:44 +0000 (00:43 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 11 Feb 2009 00:43:44 +0000 (00:43 +0000)
2009-02-11  Jürg Billeter  <j@bitron.ch>

* vala/valaenum.vala:
* vala/valainterface.vala:
* vala/valastruct.vala:
* vapigen/valagirparser.vala:

Recognize c:type attributes in .gir

svn path=/trunk/; revision=2426

ChangeLog
vala/valaenum.vala
vala/valainterface.vala
vala/valastruct.vala
vapigen/valagirparser.vala

index 9e87172c6c3d2e92f9aedb46f58804d8f45f563a..cd0f91d5a01b20f2a07b16af2e72e1b5d0705d77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-02-11  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaenum.vala:
+       * vala/valainterface.vala:
+       * vala/valastruct.vala:
+       * vapigen/valagirparser.vala:
+
+       Recognize c:type attributes in .gir
+
 2009-02-10  Ryan Lortie  <desrt@desrt.ca>
 
        Bug 571169 – make floating references generic
index 4f2a73ee5c1eb31f6d8405f7eb8854fcaf13d3b0..e709f866034118f025ac199a216aba8c51e7a445 100644 (file)
@@ -132,6 +132,10 @@ public class Vala.Enum : TypeSymbol {
                return cname;
        }
 
+       public void set_cname (string cname) {
+               this.cname = cname;
+       }
+
        public override string get_lower_case_cprefix () {
                if (lower_case_cprefix == null) {
                        lower_case_cprefix = "%s_".printf (get_lower_case_cname (null));
index a998229db9bc7720c564ded5c5feecbd2d998819..66e3068e7127bf086292dcc698e87ddcc654ee30 100644 (file)
@@ -1,6 +1,6 @@
 /* valainterface.vala
  *
- * Copyright (C) 2006-2008  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -263,6 +263,10 @@ public class Vala.Interface : ObjectTypeSymbol {
                }
                return cname;
        }
+
+       public void set_cname (string cname) {
+               this.cname = cname;
+       }
        
        /**
         * Returns the string to be prepended to the name of members of this
index b5ef8fb68ff35903c5a72bfc5662665753a517e2..1546af10b2440f0ef49974dc3927ae34a60e30b3 100644 (file)
@@ -229,6 +229,10 @@ public class Vala.Struct : TypeSymbol {
                return cname;
        }
 
+       public void set_cname (string cname) {
+               this.cname = cname;
+       }
+
        /**
         * Returns the default name of this struct as it is used in C code.
         *
index 686e1a8388270a1d2bbd7581d5be379eded00916..e23e14c0667a431f58d155f7029bf66623c0ed2f 100644 (file)
@@ -242,6 +242,12 @@ public class Vala.GirParser : CodeVisitor {
                start_element ("enumeration");
                var en = new Enum (reader.get_attribute ("name"), get_current_src ());
                en.access = SymbolAccessibility.PUBLIC;
+
+               string enum_cname = reader.get_attribute ("c:type");
+               if (enum_cname != null) {
+                       en.set_cname (enum_cname);
+               }
+
                next ();
 
                string common_prefix = null;
@@ -476,6 +482,11 @@ public class Vala.GirParser : CodeVisitor {
                var cl = new Class (reader.get_attribute ("name"), get_current_src ());
                cl.access = SymbolAccessibility.PUBLIC;
 
+               string cname = reader.get_attribute ("c:type");
+               if (cname != null) {
+                       cl.set_cname (cname);
+               }
+
                string parent = reader.get_attribute ("parent");
                if (parent != null) {
                        cl.add_base_type (parse_type_from_name (parent));
@@ -573,6 +584,12 @@ public class Vala.GirParser : CodeVisitor {
                start_element ("interface");
                var iface = new Interface (reader.get_attribute ("name"), get_current_src ());
                iface.access = SymbolAccessibility.PUBLIC;
+
+               string cname = reader.get_attribute ("c:type");
+               if (cname != null) {
+                       iface.set_cname (cname);
+               }
+
                next ();
                var methods = new ArrayList<Method> ();
                var vmethods = new ArrayList<Method> ();
@@ -811,6 +828,12 @@ public class Vala.GirParser : CodeVisitor {
                start_element ("glib:boxed");
                var st = new Struct (reader.get_attribute ("glib:name"));
                st.access = SymbolAccessibility.PUBLIC;
+
+               string cname = reader.get_attribute ("c:type");
+               if (cname != null) {
+                       st.set_cname (cname);
+               }
+
                next ();
 
                while (current_token == MarkupTokenType.START_ELEMENT) {