gobject-introspection r594 - trunk/giscanner



Author: walters
Date: Sat Sep 13 00:12:34 2008
New Revision: 594
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=594&view=rev

Log:
Parse c:type for boxed records/unions; try resolving types using the GType names.

	* giscanner/girparser.py: Parse c:type for boxed records/unions.
	* giscanner/glibast.py: Avoid overwriting ctype.
	* giscsanner/transformer.py: Try resolving types using the GType names.


Modified:
   trunk/giscanner/girparser.py
   trunk/giscanner/glibast.py
   trunk/giscanner/transformer.py

Modified: trunk/giscanner/girparser.py
==============================================================================
--- trunk/giscanner/girparser.py	(original)
+++ trunk/giscanner/girparser.py	Sat Sep 13 00:12:34 2008
@@ -144,7 +144,8 @@
         if _glibns('type-name') in node.attrib:
             struct = GLibBoxedStruct(node.attrib['name'],
                                      node.attrib[_glibns('type-name')],
-                                     node.attrib[_glibns('get-type')])
+                                     node.attrib[_glibns('get-type')],
+                                     node.attrib.get(_cns('type')))
         else:
             struct = Struct(node.attrib['name'],
                             node.attrib[_cns('type')])
@@ -154,7 +155,8 @@
         if _glibns('type-name') in node.attrib:
             struct = GLibBoxedUnion(node.attrib['name'],
                                     node.attrib[_glibns('type-name')],
-                                    node.attrib[_glibns('get-type')])
+                                    node.attrib[_glibns('get-type')],
+                                    node.attrib.get(_cns('type')))
         else:
             struct = Union(node.attrib['name'],
                            node.attrib[_cns('type')])

Modified: trunk/giscanner/glibast.py
==============================================================================
--- trunk/giscanner/glibast.py	(original)
+++ trunk/giscanner/glibast.py	Sat Sep 13 00:12:34 2008
@@ -97,22 +97,20 @@
         self.constructors = []
         self.methods = []
         self.type_name = type_name
-        self.symbol = type_name
-        self.ctype = type_name
         self.get_type = get_type
 
 
 class GLibBoxedStruct(Struct, GLibBoxed):
 
-    def __init__(self, name, type_name, get_type):
-        Struct.__init__(self, name, name)
+    def __init__(self, name, type_name, get_type, ctype=None):
+        Struct.__init__(self, name, ctype or type_name)
         GLibBoxed.__init__(self, type_name, get_type)
 
 
 class GLibBoxedUnion(Union, GLibBoxed):
 
-    def __init__(self, name, type_name, get_type):
-        Union.__init__(self, name, name)
+    def __init__(self, name, type_name, get_type, ctype=None):
+        Union.__init__(self, name, ctype or type_name)
         GLibBoxed.__init__(self, type_name, get_type)
 
 
@@ -121,6 +119,7 @@
     def __init__(self, name, type_name, get_type):
         Node.__init__(self, name)
         GLibBoxed.__init__(self, type_name, get_type)
+        self.ctype = type_name
 
 
 class GLibInterface(Interface):

Modified: trunk/giscanner/transformer.py
==============================================================================
--- trunk/giscanner/transformer.py	(original)
+++ trunk/giscanner/transformer.py	Sat Sep 13 00:12:34 2008
@@ -444,6 +444,9 @@
             resolved = names.ctypes.get(ctype)
             if resolved:
                 return self._typepair_to_str(resolved)
+        resolved = names.type_names.get(type_name)
+        if resolved:
+            return self._typepair_to_str(resolved)
         raise KeyError("failed to find %r" % (type_name, ))
 
     def resolve_type_name_full(self, type_name, ctype,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]