summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2010-05-04 16:57:51 +0200
committerTomeu Vizoso <tomeu@sugarlabs.org>2010-05-04 16:58:15 +0200
commitf84400b39b966289d6a98548f606b247b05fb6c1 (patch)
tree4d56b0cdee22ca172da53614ce68db1faa33cd25 /giscanner/girparser.py
parent39f2997b9f32598fa2288cdac36f513fcab590b5 (diff)
downloadgobject-introspection-f84400b39b966289d6a98548f606b247b05fb6c1.tar.gz
Add support for GArrays: add g_type_info_get_array_type() and properly scan GArray args
Based on a previous patch by C. Scott Ananian <cscott@litl.com> https://bugzilla.gnome.org/show_bug.cgi?id=581687
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r--giscanner/girparser.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 1db5c6e4..852874d9 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -280,17 +280,29 @@ class GIRParser(object):
if typenode is not None:
return Type(typenode.attrib['name'],
typenode.attrib.get(_cns('type')))
+
typenode = node.find(_corens('array'))
if typenode is not None:
- ret = Array(typenode.attrib.get(_cns('type')),
- self._parse_type(typenode))
+
+ array_type = typenode.attrib.get(_cns('type'))
+ if array_type.startswith('GArray*') or \
+ array_type.startswith('GPtrArray*') or \
+ array_type.startswith('GByteArray*'):
+ element_type = None
+ else:
+ element_type = self._parse_type(typenode)
+
+ ret = Array(None, array_type, element_type)
+
lenidx = typenode.attrib.get('length')
if lenidx:
ret.length_param_index = int(lenidx)
return ret
+
typenode = node.find(_corens('varargs'))
if typenode is not None:
return Varargs()
+
raise ValueError("Couldn't parse type of node %r; children=%r",
node, list(node))