[gobject-introspection/wip/transformer] Fix structure field parsing
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/transformer] Fix structure field parsing
- Date: Thu, 22 Jul 2010 02:32:06 +0000 (UTC)
commit d004c0a72225f1266376a7e169ea6a2b0773dfce
Author: Colin Walters <walters verbum org>
Date: Wed Jul 21 22:21:29 2010 -0400
Fix structure field parsing
giscanner/glibtransformer.py | 12 +++++++++---
giscanner/scannermain.py | 3 +--
giscanner/transformer.py | 15 ++++++++-------
3 files changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/giscanner/glibtransformer.py b/giscanner/glibtransformer.py
index 92c35d8..0523cb1 100644
--- a/giscanner/glibtransformer.py
+++ b/giscanner/glibtransformer.py
@@ -178,7 +178,10 @@ class GLibTransformer(object):
self._transformer.resolve_type(node.value_type)
if isinstance(node, (Class, Interface, Record, Union)):
for field in node.fields:
- self._transformer.resolve_type(field.type)
+ if field.anonymous_node:
+ field.anonymous_node.walk(self._pass_type_resolution, chain)
+ else:
+ self._transformer.resolve_type(field.type)
if isinstance(node, (Class, Interface)):
resolved_parent = None
for parent in node.parent_chain:
@@ -485,8 +488,9 @@ method or constructor of some type."""
class_struct = maybe_class
pair_class = self._namespace.get(name)
- if (not pair_class or
- not isinstance(pair_class, (GLibObject, GLibInterface))):
+ if not pair_class:
+ return
+ if not isinstance(pair_class, (GLibObject, GLibInterface)):
return
# Object class fields are assumed to be read-only
@@ -499,6 +503,7 @@ method or constructor of some type."""
# functions and which are signal slots by
# assuming everything that doesn't share a name
# with a known signal is a virtual slot.
+ print "fields: %r" % (maybe_class.fields, )
for field in maybe_class.fields:
if not isinstance(field, Callback):
continue
@@ -692,6 +697,7 @@ method or constructor of some type."""
record = self._namespace.get(node.name)
if record is None:
return
+ print "record %r fields: %r" % (node, node.fields)
node.fields = record.fields
for field in node.fields:
if isinstance(field, Field):
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 4eaed05..3b33753 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -143,8 +143,7 @@ def passthrough_gir(path):
parser.get_shared_libraries(),
parser.get_includes(),
parser.get_pkgconfig_packages(),
- parser.get_c_includes(),
- parser.get_c_prefix())
+ parser.get_c_includes())
sys.stdout.write(writer.get_xml())
sys.exit(0)
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 6129b1a..dc918da 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -82,8 +82,6 @@ class Transformer(object):
def parse(self):
nodes = []
for symbol in self.generator.get_symbols():
- if symbol.ident.startswith('_'):
- continue
node = self._traverse_one(symbol)
if node:
try:
@@ -403,8 +401,7 @@ pair of (namespace, stripped_identifier) or raise ValueError."""
derefed_name = canonical_ctype[:-1]
else:
derefed_name = canonical_ctype
- derefed_name = self.resolve_param_type(derefed_name)
- ftype = Array(ctype, self.parse_ctype(derefed_name))
+ ftype = Array(None, self.create_type(ctype), ctype=derefed_name)
child_list = list(symbol.base_type.child_list)
ftype.zeroterminated = False
if child_list:
@@ -593,9 +590,13 @@ pair of (namespace, stripped_identifier) or raise ValueError."""
compound = klass(name, symbol.ident)
for child in symbol.base_type.child_list:
- field = self._traverse_one(child)
- if field:
- compound.fields.append(field)
+ child_node = self._traverse_one(child)
+ if isinstance(child_node, Field):
+ field = child_node
+ else:
+ field = Field(child.ident, None, True, False,
+ anonymous_node=child_node)
+ compound.fields.append(field)
compound.add_symbol_reference(symbol)
return compound
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]