diff options
author | Lucas Rocha <lucasr@gnome.org> | 2008-10-11 18:33:43 +0000 |
---|---|---|
committer | Lucas Almeida Rocha <lucasr@src.gnome.org> | 2008-10-11 18:33:43 +0000 |
commit | 0be08ed820506a63b5a9342d52d695f977934145 (patch) | |
tree | 2955cbd94fba25494a18deedbf176a88e41a84a4 /giscanner/girwriter.py | |
parent | f1be097d3be66639374c160225f01cfd42275953 (diff) | |
download | gobject-introspection-0be08ed820506a63b5a9342d52d695f977934145.tar.gz |
Bug 554854: The --typelib-xml and --inject options should reuse giscanner
2008-10-11 Lucas Rocha <lucasr@gnome.org>
Bug 554854: The --typelib-xml and --inject options should reuse
giscanner parser/writer.
* giscanner/ast.py: add constructor list to Struct and Union.
Add new param in Return's contructor to define transfer.
* giscanner/girparser.py: several additions to the parser in order
to have parsing all nodes of the gir xml files.
* tools/g-ir-scanner (typelib_xml_strip, inject): use gir parser
and writer in --inject and --typelib-xml options.
* giscanner/xmlwriter.py: ignore empty attributes instead of
raising an error as this basically exposes a bug in GIRParser.
This should be reverted as soon as the parser is fixed.
svn path=/trunk/; revision=665
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r-- | giscanner/girwriter.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index ed4e596a..43678581 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -189,16 +189,18 @@ class GIRWriter(XMLWriter): self.write_tag('type', attrs) def _write_enum(self, enum): - attrs = [('name', enum.name), - ('c:type', enum.symbol)] + attrs = [('name', enum.name)] self._append_deprecated(enum, attrs) - tag_name = 'enumeration' - if isinstance(enum, GLibEnum): + if isinstance(enum, GLibFlags): + tag_name = 'bitfield' + else: + tag_name = 'enumeration' + if isinstance(enum, GLibEnum) or isinstance(enum, GLibFlags): attrs.extend([('glib:type-name', enum.type_name), - ('glib:get-type', enum.get_type)]) - if isinstance(enum, GLibFlags): - tag_name = 'bitfield' - + ('glib:get-type', enum.get_type), + ('c:type', enum.ctype)]) + else: + attrs.append(('c:type', enum.symbol)) with self.tagcontext(tag_name, attrs): for member in enum.members: self._write_member(member) @@ -305,8 +307,11 @@ class GIRWriter(XMLWriter): self._write_boxed_ctors_methods(union) def _write_field(self, field): - # FIXME: Just function - if isinstance(field, (Callback, Function)): + if isinstance(field, Function): + self._write_method(field) + return + + if isinstance(field, Callback): self._write_callback(field) return |