gobject-introspection 2.0.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +118 -0
- data/ext/gobject-introspection/depend +10 -0
- data/ext/gobject-introspection/extconf.rb +97 -0
- data/ext/gobject-introspection/gobject_introspection.def +5 -0
- data/ext/gobject-introspection/rb-gi-arg-info.c +151 -0
- data/ext/gobject-introspection/rb-gi-argument.c +1015 -0
- data/ext/gobject-introspection/rb-gi-base-info.c +218 -0
- data/ext/gobject-introspection/rb-gi-boxed-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-callable-info.c +104 -0
- data/ext/gobject-introspection/rb-gi-callback-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-constant-info.c +77 -0
- data/ext/gobject-introspection/rb-gi-constructor-info.c +120 -0
- data/ext/gobject-introspection/rb-gi-conversions.h +116 -0
- data/ext/gobject-introspection/rb-gi-enum-info.c +145 -0
- data/ext/gobject-introspection/rb-gi-field-info.c +153 -0
- data/ext/gobject-introspection/rb-gi-flags-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-function-info.c +658 -0
- data/ext/gobject-introspection/rb-gi-interface-info.c +222 -0
- data/ext/gobject-introspection/rb-gi-loader.c +162 -0
- data/ext/gobject-introspection/rb-gi-method-info.c +109 -0
- data/ext/gobject-introspection/rb-gi-object-info.c +345 -0
- data/ext/gobject-introspection/rb-gi-private.h +110 -0
- data/ext/gobject-introspection/rb-gi-property-info.c +77 -0
- data/ext/gobject-introspection/rb-gi-registered-type-info.c +86 -0
- data/ext/gobject-introspection/rb-gi-repository.c +164 -0
- data/ext/gobject-introspection/rb-gi-signal-info.c +77 -0
- data/ext/gobject-introspection/rb-gi-struct-info.c +190 -0
- data/ext/gobject-introspection/rb-gi-type-info.c +143 -0
- data/ext/gobject-introspection/rb-gi-type-tag.c +43 -0
- data/ext/gobject-introspection/rb-gi-types.h +71 -0
- data/ext/gobject-introspection/rb-gi-union-info.c +206 -0
- data/ext/gobject-introspection/rb-gi-unresolved-info.c +48 -0
- data/ext/gobject-introspection/rb-gi-value-info.c +57 -0
- data/ext/gobject-introspection/rb-gi-vfunc-info.c +91 -0
- data/ext/gobject-introspection/rb-gobject-introspection.c +44 -0
- data/ext/gobject-introspection/rb-gobject-introspection.h +57 -0
- data/extconf.rb +71 -0
- data/lib/1.9/gobject_introspection.so +0 -0
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/gobject-introspection.rb +52 -0
- data/lib/gobject-introspection/callable-info.rb +91 -0
- data/lib/gobject-introspection/collection-reader.rb +34 -0
- data/lib/gobject-introspection/interface-info.rb +32 -0
- data/lib/gobject-introspection/loader.rb +328 -0
- data/lib/gobject-introspection/object-info.rb +33 -0
- data/lib/gobject-introspection/repository.rb +32 -0
- data/lib/gobject-introspection/struct-info.rb +28 -0
- data/lib/gobject-introspection/union-info.rb +28 -0
- data/test/gobject-introspection-test-utils.rb +26 -0
- data/test/run-test.rb +45 -0
- data/test/test-arg-info.rb +68 -0
- data/test/test-base-info.rb +31 -0
- data/test/test-boxed-info.rb +21 -0
- data/test/test-callable-info.rb +49 -0
- data/test/test-callback-info.rb +29 -0
- data/test/test-constant-info.rb +24 -0
- data/test/test-enum-info.rb +56 -0
- data/test/test-field-type.rb +42 -0
- data/test/test-flags-info.rb +27 -0
- data/test/test-function-info.rb +37 -0
- data/test/test-interface-info.rb +97 -0
- data/test/test-loader.rb +30 -0
- data/test/test-object-info.rb +131 -0
- data/test/test-property-info.rb +38 -0
- data/test/test-registered-type-info.rb +35 -0
- data/test/test-repository.rb +59 -0
- data/test/test-signal-info.rb +37 -0
- data/test/test-struct-info.rb +57 -0
- data/test/test-type-info.rb +62 -0
- data/test/test-type-tag.rb +29 -0
- data/test/test-union-info.rb +21 -0
- data/test/test-value-info.rb +28 -0
- data/test/test-vfunc-info.rb +42 -0
- data/vendor/local/bin/g-ir-compiler.exe +0 -0
- data/vendor/local/bin/g-ir-generate.exe +0 -0
- data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
- data/vendor/local/include/gobject-introspection-1.0/giarginfo.h +52 -0
- data/vendor/local/include/gobject-introspection-1.0/gibaseinfo.h +89 -0
- data/vendor/local/include/gobject-introspection-1.0/gicallableinfo.h +74 -0
- data/vendor/local/include/gobject-introspection-1.0/giconstantinfo.h +46 -0
- data/vendor/local/include/gobject-introspection-1.0/gienuminfo.h +56 -0
- data/vendor/local/include/gobject-introspection-1.0/gifieldinfo.h +52 -0
- data/vendor/local/include/gobject-introspection-1.0/gifunctioninfo.h +77 -0
- data/vendor/local/include/gobject-introspection-1.0/giinterfaceinfo.h +68 -0
- data/vendor/local/include/gobject-introspection-1.0/giobjectinfo.h +137 -0
- data/vendor/local/include/gobject-introspection-1.0/gipropertyinfo.h +44 -0
- data/vendor/local/include/gobject-introspection-1.0/giregisteredtypeinfo.h +53 -0
- data/vendor/local/include/gobject-introspection-1.0/girepository.h +179 -0
- data/vendor/local/include/gobject-introspection-1.0/girffi.h +80 -0
- data/vendor/local/include/gobject-introspection-1.0/gisignalinfo.h +45 -0
- data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +53 -0
- data/vendor/local/include/gobject-introspection-1.0/gitypeinfo.h +56 -0
- data/vendor/local/include/gobject-introspection-1.0/gitypelib.h +55 -0
- data/vendor/local/include/gobject-introspection-1.0/gitypes.h +453 -0
- data/vendor/local/include/gobject-introspection-1.0/giunioninfo.h +57 -0
- data/vendor/local/include/gobject-introspection-1.0/givfuncinfo.h +56 -0
- data/vendor/local/lib/girepository-1.0/DBus-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/DBusGLib-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GL-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/cairo-1.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/fontconfig-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/freetype2-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/libxml2-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/xfixes-4.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/xft-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/xlib-2.0.typelib +0 -0
- data/vendor/local/lib/girepository-1.0/xrandr-1.3.typelib +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.py +24 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +74 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +1204 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.py +1100 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +196 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +140 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +60 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/class.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/constructor.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/default.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/enum.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/function.tmpl +61 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/method.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/namespace.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/property.tmpl +5 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/record.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/signal.tmpl +5 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/vfunc.tmpl +4 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/class.tmpl +18 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/constructor.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/default.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/enum.tmpl +13 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/function.tmpl +48 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/method.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/namespace.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/property.tmpl +10 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/record.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/signal.tmpl +37 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/vfunc.tmpl +27 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/class.tmpl +17 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/constructor.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/default.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/enum.tmpl +13 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/function.tmpl +53 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/method.tmpl +1 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/namespace.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/property.tmpl +10 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/record.tmpl +2 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/signal.tmpl +42 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/vfunc.tmpl +33 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/base.tmpl +29 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/class.tmpl +40 -0
- data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/namespace.tmpl +19 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +635 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +363 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +551 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +581 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +584 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.py +236 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.py +76 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +1337 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.py +185 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/odict.py +50 -0
- data/vendor/local/lib/gobject-introspection/giscanner/odict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/odict.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +497 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.py +78 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +132 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +324 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +119 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +999 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.py +141 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +197 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
- data/vendor/local/lib/libgirepository-1.0.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
- data/vendor/local/lib/libgirepository-1.0.la +41 -0
- data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +26 -0
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +23 -0
- data/vendor/local/share/aclocal/introspection.m4 +96 -0
- data/vendor/local/share/gir-1.0/DBus-1.0.gir +32 -0
- data/vendor/local/share/gir-1.0/DBusGLib-1.0.gir +18 -0
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +3833 -0
- data/vendor/local/share/gir-1.0/GL-1.0.gir +31 -0
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +44304 -0
- data/vendor/local/share/gir-1.0/GModule-2.0.gir +184 -0
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +13947 -0
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +73619 -0
- data/vendor/local/share/gir-1.0/cairo-1.0.gir +70 -0
- data/vendor/local/share/gir-1.0/fontconfig-2.0.gir +18 -0
- data/vendor/local/share/gir-1.0/freetype2-2.0.gir +22 -0
- data/vendor/local/share/gir-1.0/libxml2-2.0.gir +25 -0
- data/vendor/local/share/gir-1.0/xfixes-4.0.gir +10 -0
- data/vendor/local/share/gir-1.0/xft-2.0.gir +23 -0
- data/vendor/local/share/gir-1.0/xlib-2.0.gir +67 -0
- data/vendor/local/share/gir-1.0/xrandr-1.3.gir +16 -0
- data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +166 -0
- data/vendor/local/share/gobject-introspection-1.0/gdump.c +564 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +835 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +198 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/drawable.c +55 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/drawable.h +33 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +1473 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +428 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/foo.c +790 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/foo.h +437 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +5256 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +1158 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +4009 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +944 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/utility.c +45 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/utility.h +95 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.c +33 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.h +36 -0
- data/vendor/local/share/license/gobject-introspection/AUTHORS +9 -0
- data/vendor/local/share/license/gobject-introspection/COPYING +12 -0
- data/vendor/local/share/man/man1/g-ir-compiler.1 +51 -0
- data/vendor/local/share/man/man1/g-ir-generate.1 +29 -0
- metadata +343 -0
Binary file
|
Binary file
|
@@ -0,0 +1,584 @@
|
|
1
|
+
# -*- Mode: Python -*-
|
2
|
+
# GObject-Introspection - a framework for introspecting GObject libraries
|
3
|
+
# Copyright (C) 2008 Johan Dahlin
|
4
|
+
# Copyright (C) 2008, 2009 Red Hat, Inc.
|
5
|
+
#
|
6
|
+
# This library is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
8
|
+
# License as published by the Free Software Foundation; either
|
9
|
+
# version 2 of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
# Lesser General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
17
|
+
# License along with this library; if not, write to the
|
18
|
+
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
19
|
+
# Boston, MA 02111-1307, USA.
|
20
|
+
#
|
21
|
+
|
22
|
+
from __future__ import with_statement
|
23
|
+
|
24
|
+
from . import ast
|
25
|
+
from .xmlwriter import XMLWriter
|
26
|
+
|
27
|
+
# Bump this for *incompatible* changes to the .gir.
|
28
|
+
# Compatible changes we just make inline
|
29
|
+
COMPATIBLE_GIR_VERSION = '1.2'
|
30
|
+
|
31
|
+
class GIRWriter(XMLWriter):
|
32
|
+
|
33
|
+
def __init__(self, namespace):
|
34
|
+
super(GIRWriter, self).__init__()
|
35
|
+
self.write_comment(
|
36
|
+
'''This file was automatically generated from C sources - DO NOT EDIT!
|
37
|
+
To affect the contents of this file, edit the original C definitions,
|
38
|
+
and/or use gtk-doc annotations. ''')
|
39
|
+
self._write_repository(namespace)
|
40
|
+
|
41
|
+
def _write_repository(self, namespace):
|
42
|
+
attrs = [
|
43
|
+
('version', COMPATIBLE_GIR_VERSION),
|
44
|
+
('xmlns', 'http://www.gtk.org/introspection/core/1.0'),
|
45
|
+
('xmlns:c', 'http://www.gtk.org/introspection/c/1.0'),
|
46
|
+
('xmlns:glib', 'http://www.gtk.org/introspection/glib/1.0'),
|
47
|
+
]
|
48
|
+
with self.tagcontext('repository', attrs):
|
49
|
+
for include in sorted(namespace.includes):
|
50
|
+
self._write_include(include)
|
51
|
+
for pkg in sorted(set(namespace.exported_packages)):
|
52
|
+
self._write_pkgconfig_pkg(pkg)
|
53
|
+
for c_include in sorted(set(namespace.c_includes)):
|
54
|
+
self._write_c_include(c_include)
|
55
|
+
self._namespace = namespace
|
56
|
+
self._write_namespace(namespace)
|
57
|
+
self._namespace = None
|
58
|
+
|
59
|
+
def _write_include(self, include):
|
60
|
+
attrs = [('name', include.name), ('version', include.version)]
|
61
|
+
self.write_tag('include', attrs)
|
62
|
+
|
63
|
+
def _write_pkgconfig_pkg(self, package):
|
64
|
+
attrs = [('name', package)]
|
65
|
+
self.write_tag('package', attrs)
|
66
|
+
|
67
|
+
def _write_c_include(self, c_include):
|
68
|
+
attrs = [('name', c_include)]
|
69
|
+
self.write_tag('c:include', attrs)
|
70
|
+
|
71
|
+
def _write_namespace(self, namespace):
|
72
|
+
attrs = [('name', namespace.name),
|
73
|
+
('version', namespace.version),
|
74
|
+
('shared-library', ','.join(namespace.shared_libraries)),
|
75
|
+
('c:identifier-prefixes', ','.join(namespace.identifier_prefixes)),
|
76
|
+
('c:symbol-prefixes', ','.join(namespace.symbol_prefixes))]
|
77
|
+
with self.tagcontext('namespace', attrs):
|
78
|
+
# We define a custom sorting function here because
|
79
|
+
# we want aliases to be first. They're a bit
|
80
|
+
# special because the typelib compiler expands them.
|
81
|
+
def nscmp(a, b):
|
82
|
+
if isinstance(a, ast.Alias):
|
83
|
+
if isinstance(b, ast.Alias):
|
84
|
+
return cmp(a.name, b.name)
|
85
|
+
else:
|
86
|
+
return -1
|
87
|
+
elif isinstance(b, ast.Alias):
|
88
|
+
return 1
|
89
|
+
else:
|
90
|
+
return cmp(a, b)
|
91
|
+
for node in sorted(namespace.itervalues(), cmp=nscmp):
|
92
|
+
self._write_node(node)
|
93
|
+
|
94
|
+
def _write_node(self, node):
|
95
|
+
if isinstance(node, ast.Function):
|
96
|
+
self._write_function(node)
|
97
|
+
elif isinstance(node, ast.Enum):
|
98
|
+
self._write_enum(node)
|
99
|
+
elif isinstance(node, ast.Bitfield):
|
100
|
+
self._write_bitfield(node)
|
101
|
+
elif isinstance(node, (ast.Class, ast.Interface)):
|
102
|
+
self._write_class(node)
|
103
|
+
elif isinstance(node, ast.Callback):
|
104
|
+
self._write_callback(node)
|
105
|
+
elif isinstance(node, ast.Record):
|
106
|
+
self._write_record(node)
|
107
|
+
elif isinstance(node, ast.Union):
|
108
|
+
self._write_union(node)
|
109
|
+
elif isinstance(node, ast.Boxed):
|
110
|
+
self._write_boxed(node)
|
111
|
+
elif isinstance(node, ast.Member):
|
112
|
+
# FIXME: atk_misc_instance singleton
|
113
|
+
pass
|
114
|
+
elif isinstance(node, ast.Alias):
|
115
|
+
self._write_alias(node)
|
116
|
+
elif isinstance(node, ast.Constant):
|
117
|
+
self._write_constant(node)
|
118
|
+
else:
|
119
|
+
print 'WRITER: Unhandled node', node
|
120
|
+
|
121
|
+
def _append_version(self, node, attrs):
|
122
|
+
if node.version:
|
123
|
+
attrs.append(('version', node.version))
|
124
|
+
|
125
|
+
def _write_generic(self, node):
|
126
|
+
for key, value in node.attributes:
|
127
|
+
self.write_tag('attribute', [('name', key), ('value', value)])
|
128
|
+
if hasattr(node, 'doc') and node.doc:
|
129
|
+
self.write_tag('doc', [('xml:whitespace', 'preserve')],
|
130
|
+
node.doc)
|
131
|
+
|
132
|
+
def _append_node_generic(self, node, attrs):
|
133
|
+
if node.skip or not node.introspectable:
|
134
|
+
attrs.append(('introspectable', '0'))
|
135
|
+
if node.deprecated:
|
136
|
+
attrs.append(('deprecated', node.deprecated))
|
137
|
+
if node.deprecated_version:
|
138
|
+
attrs.append(('deprecated-version',
|
139
|
+
node.deprecated_version))
|
140
|
+
if node.stability:
|
141
|
+
attrs.append(('stability', node.stability))
|
142
|
+
|
143
|
+
def _append_throws(self, func, attrs):
|
144
|
+
if func.throws:
|
145
|
+
attrs.append(('throws', '1'))
|
146
|
+
|
147
|
+
def _write_alias(self, alias):
|
148
|
+
attrs = [('name', alias.name)]
|
149
|
+
if alias.ctype is not None:
|
150
|
+
attrs.append(('c:type', alias.ctype))
|
151
|
+
self._append_node_generic(alias, attrs)
|
152
|
+
with self.tagcontext('alias', attrs):
|
153
|
+
self._write_generic(alias)
|
154
|
+
self._write_type_ref(alias.target)
|
155
|
+
|
156
|
+
def _write_callable(self, callable, tag_name, extra_attrs):
|
157
|
+
attrs = [('name', callable.name)]
|
158
|
+
attrs.extend(extra_attrs)
|
159
|
+
self._append_version(callable, attrs)
|
160
|
+
self._append_node_generic(callable, attrs)
|
161
|
+
self._append_throws(callable, attrs)
|
162
|
+
with self.tagcontext(tag_name, attrs):
|
163
|
+
self._write_generic(callable)
|
164
|
+
self._write_return_type(callable.retval, parent=callable)
|
165
|
+
self._write_parameters(callable)
|
166
|
+
|
167
|
+
def _write_function(self, func, tag_name='function'):
|
168
|
+
if func.internal_skipped:
|
169
|
+
return
|
170
|
+
attrs = []
|
171
|
+
if hasattr(func, 'symbol'):
|
172
|
+
attrs.append(('c:identifier', func.symbol))
|
173
|
+
if func.shadowed_by:
|
174
|
+
attrs.append(('shadowed-by', func.shadowed_by))
|
175
|
+
elif func.shadows:
|
176
|
+
attrs.append(('shadows', func.shadows))
|
177
|
+
if func.moved_to is not None:
|
178
|
+
attrs.append(('moved-to', func.moved_to))
|
179
|
+
self._write_callable(func, tag_name, attrs)
|
180
|
+
|
181
|
+
def _write_method(self, method):
|
182
|
+
self._write_function(method, tag_name='method')
|
183
|
+
|
184
|
+
def _write_static_method(self, method):
|
185
|
+
self._write_function(method, tag_name='function')
|
186
|
+
|
187
|
+
def _write_constructor(self, method):
|
188
|
+
self._write_function(method, tag_name='constructor')
|
189
|
+
|
190
|
+
def _write_return_type(self, return_, parent=None):
|
191
|
+
if not return_:
|
192
|
+
return
|
193
|
+
|
194
|
+
attrs = []
|
195
|
+
if return_.transfer:
|
196
|
+
attrs.append(('transfer-ownership', return_.transfer))
|
197
|
+
if return_.skip:
|
198
|
+
attrs.append(('skip', '1'))
|
199
|
+
with self.tagcontext('return-value', attrs):
|
200
|
+
self._write_generic(return_)
|
201
|
+
self._write_type(return_.type, function=parent)
|
202
|
+
|
203
|
+
def _write_parameters(self, callable):
|
204
|
+
if not callable.parameters and callable.instance_parameter is None:
|
205
|
+
return
|
206
|
+
with self.tagcontext('parameters'):
|
207
|
+
if callable.instance_parameter:
|
208
|
+
self._write_parameter(callable, callable.instance_parameter, 'instance-parameter')
|
209
|
+
for parameter in callable.parameters:
|
210
|
+
self._write_parameter(callable, parameter)
|
211
|
+
|
212
|
+
def _write_parameter(self, parent, parameter, nodename='parameter'):
|
213
|
+
attrs = []
|
214
|
+
if parameter.argname is not None:
|
215
|
+
attrs.append(('name', parameter.argname))
|
216
|
+
if (parameter.direction is not None) and (parameter.direction != 'in'):
|
217
|
+
attrs.append(('direction', parameter.direction))
|
218
|
+
attrs.append(('caller-allocates',
|
219
|
+
'1' if parameter.caller_allocates else '0'))
|
220
|
+
if parameter.transfer:
|
221
|
+
attrs.append(('transfer-ownership',
|
222
|
+
parameter.transfer))
|
223
|
+
if parameter.allow_none:
|
224
|
+
attrs.append(('allow-none', '1'))
|
225
|
+
if parameter.scope:
|
226
|
+
attrs.append(('scope', parameter.scope))
|
227
|
+
if parameter.closure_name is not None:
|
228
|
+
idx = parent.get_parameter_index(parameter.closure_name)
|
229
|
+
attrs.append(('closure', '%d' % (idx, )))
|
230
|
+
if parameter.destroy_name is not None:
|
231
|
+
idx = parent.get_parameter_index(parameter.destroy_name)
|
232
|
+
attrs.append(('destroy', '%d' % (idx, )))
|
233
|
+
if parameter.skip:
|
234
|
+
attrs.append(('skip', '1'))
|
235
|
+
with self.tagcontext(nodename, attrs):
|
236
|
+
self._write_generic(parameter)
|
237
|
+
self._write_type(parameter.type, function=parent)
|
238
|
+
|
239
|
+
def _type_to_name(self, typeval):
|
240
|
+
if not typeval.resolved:
|
241
|
+
raise AssertionError("Caught unresolved type %r (ctype=%r)" % (typeval, typeval.ctype))
|
242
|
+
assert typeval.target_giname is not None
|
243
|
+
prefix = self._namespace.name + '.'
|
244
|
+
if typeval.target_giname.startswith(prefix):
|
245
|
+
return typeval.target_giname[len(prefix):]
|
246
|
+
return typeval.target_giname
|
247
|
+
|
248
|
+
def _write_type_ref(self, ntype):
|
249
|
+
""" Like _write_type, but only writes the type name rather than the full details """
|
250
|
+
assert isinstance(ntype, ast.Type), ntype
|
251
|
+
attrs = []
|
252
|
+
if ntype.ctype:
|
253
|
+
attrs.append(('c:type', ntype.ctype))
|
254
|
+
if isinstance(ntype, ast.Array):
|
255
|
+
if ntype.array_type != ast.Array.C:
|
256
|
+
attrs.insert(0, ('name', ntype.array_type))
|
257
|
+
elif isinstance(ntype, ast.List):
|
258
|
+
if ntype.name:
|
259
|
+
attrs.insert(0, ('name', ntype.name))
|
260
|
+
elif isinstance(ntype, ast.Map):
|
261
|
+
attrs.insert(0, ('name', 'GLib.HashTable'))
|
262
|
+
else:
|
263
|
+
if ntype.target_giname:
|
264
|
+
attrs.insert(0, ('name', self._type_to_name(ntype)))
|
265
|
+
elif ntype.target_fundamental:
|
266
|
+
attrs.insert(0, ('name', ntype.target_fundamental))
|
267
|
+
|
268
|
+
self.write_tag('type', attrs)
|
269
|
+
|
270
|
+
def _write_type(self, ntype, relation=None, function=None):
|
271
|
+
assert isinstance(ntype, ast.Type), ntype
|
272
|
+
attrs = []
|
273
|
+
if ntype.complete_ctype:
|
274
|
+
attrs.append(('c:type', ntype.complete_ctype))
|
275
|
+
elif ntype.ctype:
|
276
|
+
attrs.append(('c:type', ntype.ctype))
|
277
|
+
if isinstance(ntype, ast.Varargs):
|
278
|
+
with self.tagcontext('varargs', []):
|
279
|
+
pass
|
280
|
+
elif isinstance(ntype, ast.Array):
|
281
|
+
if ntype.array_type != ast.Array.C:
|
282
|
+
attrs.insert(0, ('name', ntype.array_type))
|
283
|
+
# we insert an explicit 'zero-terminated' attribute
|
284
|
+
# when it is false, or when it would not be implied
|
285
|
+
# by the absence of length and fixed-size
|
286
|
+
if not ntype.zeroterminated:
|
287
|
+
attrs.insert(0, ('zero-terminated', '0'))
|
288
|
+
elif (ntype.zeroterminated
|
289
|
+
and (ntype.size is not None or ntype.length_param_name is not None)):
|
290
|
+
attrs.insert(0, ('zero-terminated', '1'))
|
291
|
+
if ntype.size is not None:
|
292
|
+
attrs.append(('fixed-size', '%d' % (ntype.size, )))
|
293
|
+
if ntype.length_param_name is not None:
|
294
|
+
assert function
|
295
|
+
attrs.insert(0, ('length', '%d'
|
296
|
+
% (function.get_parameter_index(ntype.length_param_name, ))))
|
297
|
+
|
298
|
+
with self.tagcontext('array', attrs):
|
299
|
+
self._write_type(ntype.element_type)
|
300
|
+
elif isinstance(ntype, ast.List):
|
301
|
+
if ntype.name:
|
302
|
+
attrs.insert(0, ('name', ntype.name))
|
303
|
+
with self.tagcontext('type', attrs):
|
304
|
+
self._write_type(ntype.element_type)
|
305
|
+
elif isinstance(ntype, ast.Map):
|
306
|
+
attrs.insert(0, ('name', 'GLib.HashTable'))
|
307
|
+
with self.tagcontext('type', attrs):
|
308
|
+
self._write_type(ntype.key_type)
|
309
|
+
self._write_type(ntype.value_type)
|
310
|
+
else:
|
311
|
+
# REWRITEFIXME - enable this for 1.2
|
312
|
+
if ntype.target_giname:
|
313
|
+
attrs.insert(0, ('name', self._type_to_name(ntype)))
|
314
|
+
elif ntype.target_fundamental:
|
315
|
+
# attrs = [('fundamental', ntype.target_fundamental)]
|
316
|
+
attrs.insert(0, ('name', ntype.target_fundamental))
|
317
|
+
elif ntype.target_foreign:
|
318
|
+
attrs.insert(0, ('foreign', '1'))
|
319
|
+
self.write_tag('type', attrs)
|
320
|
+
|
321
|
+
def _append_registered(self, node, attrs):
|
322
|
+
assert isinstance(node, ast.Registered)
|
323
|
+
if node.get_type:
|
324
|
+
attrs.extend([('glib:type-name', node.gtype_name),
|
325
|
+
('glib:get-type', node.get_type)])
|
326
|
+
|
327
|
+
def _write_enum(self, enum):
|
328
|
+
attrs = [('name', enum.name)]
|
329
|
+
self._append_version(enum, attrs)
|
330
|
+
self._append_node_generic(enum, attrs)
|
331
|
+
self._append_registered(enum, attrs)
|
332
|
+
attrs.append(('c:type', enum.ctype))
|
333
|
+
if enum.error_domain:
|
334
|
+
attrs.append(('glib:error-domain', enum.error_domain))
|
335
|
+
|
336
|
+
with self.tagcontext('enumeration', attrs):
|
337
|
+
self._write_generic(enum)
|
338
|
+
for member in enum.members:
|
339
|
+
self._write_member(member)
|
340
|
+
for method in sorted(enum.static_methods):
|
341
|
+
self._write_static_method(method)
|
342
|
+
|
343
|
+
def _write_bitfield(self, bitfield):
|
344
|
+
attrs = [('name', bitfield.name)]
|
345
|
+
self._append_version(bitfield, attrs)
|
346
|
+
self._append_node_generic(bitfield, attrs)
|
347
|
+
self._append_registered(bitfield, attrs)
|
348
|
+
attrs.append(('c:type', bitfield.ctype))
|
349
|
+
with self.tagcontext('bitfield', attrs):
|
350
|
+
self._write_generic(bitfield)
|
351
|
+
for member in bitfield.members:
|
352
|
+
self._write_member(member)
|
353
|
+
for method in sorted(bitfield.static_methods):
|
354
|
+
self._write_static_method(method)
|
355
|
+
|
356
|
+
def _write_member(self, member):
|
357
|
+
attrs = [('name', member.name),
|
358
|
+
('value', str(member.value)),
|
359
|
+
('c:identifier', member.symbol)]
|
360
|
+
if member.nick is not None:
|
361
|
+
attrs.append(('glib:nick', member.nick))
|
362
|
+
with self.tagcontext('member', attrs):
|
363
|
+
self._write_generic(member)
|
364
|
+
|
365
|
+
def _write_constant(self, constant):
|
366
|
+
attrs = [('name', constant.name),
|
367
|
+
('value', constant.value),
|
368
|
+
('c:type', constant.ctype)]
|
369
|
+
self._append_version(constant, attrs)
|
370
|
+
self._append_node_generic(constant, attrs)
|
371
|
+
with self.tagcontext('constant', attrs):
|
372
|
+
self._write_generic(constant)
|
373
|
+
self._write_type(constant.value_type)
|
374
|
+
|
375
|
+
def _write_class(self, node):
|
376
|
+
attrs = [('name', node.name),
|
377
|
+
('c:symbol-prefix', node.c_symbol_prefix),
|
378
|
+
('c:type', node.ctype)]
|
379
|
+
self._append_version(node, attrs)
|
380
|
+
self._append_node_generic(node, attrs)
|
381
|
+
if isinstance(node, ast.Class):
|
382
|
+
tag_name = 'class'
|
383
|
+
if node.parent_type is not None:
|
384
|
+
attrs.append(('parent',
|
385
|
+
self._type_to_name(node.parent_type)))
|
386
|
+
if node.is_abstract:
|
387
|
+
attrs.append(('abstract', '1'))
|
388
|
+
else:
|
389
|
+
assert isinstance(node, ast.Interface)
|
390
|
+
tag_name = 'interface'
|
391
|
+
attrs.append(('glib:type-name', node.gtype_name))
|
392
|
+
if node.get_type is not None:
|
393
|
+
attrs.append(('glib:get-type', node.get_type))
|
394
|
+
if node.glib_type_struct is not None:
|
395
|
+
attrs.append(('glib:type-struct',
|
396
|
+
self._type_to_name(node.glib_type_struct)))
|
397
|
+
if isinstance(node, ast.Class):
|
398
|
+
if node.fundamental:
|
399
|
+
attrs.append(('glib:fundamental', '1'))
|
400
|
+
if node.ref_func:
|
401
|
+
attrs.append(('glib:ref-func', node.ref_func))
|
402
|
+
if node.unref_func:
|
403
|
+
attrs.append(('glib:unref-func', node.unref_func))
|
404
|
+
if node.set_value_func:
|
405
|
+
attrs.append(('glib:set-value-func', node.set_value_func))
|
406
|
+
if node.get_value_func:
|
407
|
+
attrs.append(('glib:get-value-func', node.get_value_func))
|
408
|
+
with self.tagcontext(tag_name, attrs):
|
409
|
+
self._write_generic(node)
|
410
|
+
if isinstance(node, ast.Class):
|
411
|
+
for iface in sorted(node.interfaces):
|
412
|
+
self.write_tag('implements',
|
413
|
+
[('name', self._type_to_name(iface))])
|
414
|
+
if isinstance(node, ast.Interface):
|
415
|
+
for iface in sorted(node.prerequisites):
|
416
|
+
self.write_tag('prerequisite',
|
417
|
+
[('name', self._type_to_name(iface))])
|
418
|
+
if isinstance(node, ast.Class):
|
419
|
+
for method in sorted(node.constructors):
|
420
|
+
self._write_constructor(method)
|
421
|
+
if isinstance(node, (ast.Class, ast.Interface)):
|
422
|
+
for method in sorted(node.static_methods):
|
423
|
+
self._write_static_method(method)
|
424
|
+
for vfunc in sorted(node.virtual_methods):
|
425
|
+
self._write_vfunc(vfunc)
|
426
|
+
for method in sorted(node.methods):
|
427
|
+
self._write_method(method)
|
428
|
+
for prop in sorted(node.properties):
|
429
|
+
self._write_property(prop)
|
430
|
+
for field in node.fields:
|
431
|
+
self._write_field(field)
|
432
|
+
for signal in sorted(node.signals):
|
433
|
+
self._write_signal(signal)
|
434
|
+
|
435
|
+
def _write_boxed(self, boxed):
|
436
|
+
attrs = [('glib:name', boxed.name)]
|
437
|
+
if boxed.c_symbol_prefix is not None:
|
438
|
+
attrs.append(('c:symbol-prefix', boxed.c_symbol_prefix))
|
439
|
+
self._append_registered(boxed, attrs)
|
440
|
+
with self.tagcontext('glib:boxed', attrs):
|
441
|
+
self._write_generic(boxed)
|
442
|
+
for method in sorted(boxed.constructors):
|
443
|
+
self._write_constructor(method)
|
444
|
+
for method in sorted(boxed.methods):
|
445
|
+
self._write_method(method)
|
446
|
+
for method in sorted(boxed.static_methods):
|
447
|
+
self._write_static_method(method)
|
448
|
+
|
449
|
+
def _write_property(self, prop):
|
450
|
+
attrs = [('name', prop.name)]
|
451
|
+
self._append_version(prop, attrs)
|
452
|
+
self._append_node_generic(prop, attrs)
|
453
|
+
# Properties are assumed to be readable (see also generate.c)
|
454
|
+
if not prop.readable:
|
455
|
+
attrs.append(('readable', '0'))
|
456
|
+
if prop.writable:
|
457
|
+
attrs.append(('writable', '1'))
|
458
|
+
if prop.construct:
|
459
|
+
attrs.append(('construct', '1'))
|
460
|
+
if prop.construct_only:
|
461
|
+
attrs.append(('construct-only', '1'))
|
462
|
+
if prop.transfer:
|
463
|
+
attrs.append(('transfer-ownership', prop.transfer))
|
464
|
+
with self.tagcontext('property', attrs):
|
465
|
+
self._write_generic(prop)
|
466
|
+
self._write_type(prop.type)
|
467
|
+
|
468
|
+
def _write_vfunc(self, vf):
|
469
|
+
attrs = []
|
470
|
+
if vf.invoker:
|
471
|
+
attrs.append(('invoker', vf.invoker))
|
472
|
+
self._write_callable(vf, 'virtual-method', attrs)
|
473
|
+
|
474
|
+
def _write_callback(self, callback):
|
475
|
+
attrs = []
|
476
|
+
if callback.ctype != callback.name:
|
477
|
+
attrs.append(('c:type', callback.ctype))
|
478
|
+
self._write_callable(callback, 'callback', attrs)
|
479
|
+
|
480
|
+
def _write_record(self, record, extra_attrs=[]):
|
481
|
+
is_gtype_struct = False
|
482
|
+
attrs = list(extra_attrs)
|
483
|
+
if record.name is not None:
|
484
|
+
attrs.append(('name', record.name))
|
485
|
+
if record.ctype is not None: # the record might be anonymous
|
486
|
+
attrs.append(('c:type', record.ctype))
|
487
|
+
if record.disguised:
|
488
|
+
attrs.append(('disguised', '1'))
|
489
|
+
if record.foreign:
|
490
|
+
attrs.append(('foreign', '1'))
|
491
|
+
if record.is_gtype_struct_for is not None:
|
492
|
+
is_gtype_struct = True
|
493
|
+
attrs.append(('glib:is-gtype-struct-for',
|
494
|
+
self._type_to_name(record.is_gtype_struct_for)))
|
495
|
+
self._append_version(record, attrs)
|
496
|
+
self._append_node_generic(record, attrs)
|
497
|
+
self._append_registered(record, attrs)
|
498
|
+
if record.c_symbol_prefix:
|
499
|
+
attrs.append(('c:symbol-prefix', record.c_symbol_prefix))
|
500
|
+
with self.tagcontext('record', attrs):
|
501
|
+
self._write_generic(record)
|
502
|
+
if record.fields:
|
503
|
+
for field in record.fields:
|
504
|
+
self._write_field(field, is_gtype_struct)
|
505
|
+
for method in sorted(record.constructors):
|
506
|
+
self._write_constructor(method)
|
507
|
+
for method in sorted(record.methods):
|
508
|
+
self._write_method(method)
|
509
|
+
for method in sorted(record.static_methods):
|
510
|
+
self._write_static_method(method)
|
511
|
+
|
512
|
+
def _write_union(self, union):
|
513
|
+
attrs = []
|
514
|
+
if union.name is not None:
|
515
|
+
attrs.append(('name', union.name))
|
516
|
+
if union.ctype is not None: # the union might be anonymous
|
517
|
+
attrs.append(('c:type', union.ctype))
|
518
|
+
self._append_version(union, attrs)
|
519
|
+
self._append_node_generic(union, attrs)
|
520
|
+
self._append_registered(union, attrs)
|
521
|
+
if union.c_symbol_prefix:
|
522
|
+
attrs.append(('c:symbol-prefix', union.c_symbol_prefix))
|
523
|
+
with self.tagcontext('union', attrs):
|
524
|
+
self._write_generic(union)
|
525
|
+
if union.fields:
|
526
|
+
for field in union.fields:
|
527
|
+
self._write_field(field)
|
528
|
+
for method in sorted(union.constructors):
|
529
|
+
self._write_constructor(method)
|
530
|
+
for method in sorted(union.methods):
|
531
|
+
self._write_method(method)
|
532
|
+
for method in sorted(union.static_methods):
|
533
|
+
self._write_static_method(method)
|
534
|
+
|
535
|
+
def _write_field(self, field, is_gtype_struct=False):
|
536
|
+
if field.anonymous_node:
|
537
|
+
if isinstance(field.anonymous_node, ast.Callback):
|
538
|
+
attrs = [('name', field.name)]
|
539
|
+
self._append_node_generic(field, attrs)
|
540
|
+
with self.tagcontext('field', attrs):
|
541
|
+
self._write_callback(field.anonymous_node)
|
542
|
+
elif isinstance(field.anonymous_node, ast.Record):
|
543
|
+
self._write_record(field.anonymous_node)
|
544
|
+
elif isinstance(field.anonymous_node, ast.Union):
|
545
|
+
self._write_union(field.anonymous_node)
|
546
|
+
else:
|
547
|
+
raise AssertionError("Unknown field anonymous: %r" \
|
548
|
+
% (field.anonymous_node, ))
|
549
|
+
else:
|
550
|
+
attrs = [('name', field.name)]
|
551
|
+
self._append_node_generic(field, attrs)
|
552
|
+
# Fields are assumed to be read-only
|
553
|
+
# (see also girparser.c and generate.c)
|
554
|
+
if not field.readable:
|
555
|
+
attrs.append(('readable', '0'))
|
556
|
+
if field.writable:
|
557
|
+
attrs.append(('writable', '1'))
|
558
|
+
if field.bits:
|
559
|
+
attrs.append(('bits', str(field.bits)))
|
560
|
+
if field.private:
|
561
|
+
attrs.append(('private', '1'))
|
562
|
+
with self.tagcontext('field', attrs):
|
563
|
+
self._write_generic(field)
|
564
|
+
self._write_type(field.type)
|
565
|
+
|
566
|
+
def _write_signal(self, signal):
|
567
|
+
attrs = [('name', signal.name)]
|
568
|
+
if signal.when:
|
569
|
+
attrs.append(('when', signal.when))
|
570
|
+
if signal.no_recurse:
|
571
|
+
attrs.append(('no-recurse', '1'))
|
572
|
+
if signal.detailed:
|
573
|
+
attrs.append(('detailed', '1'))
|
574
|
+
if signal.action:
|
575
|
+
attrs.append(('action', '1'))
|
576
|
+
if signal.no_hooks:
|
577
|
+
attrs.append(('no-hooks', '1'))
|
578
|
+
|
579
|
+
self._append_version(signal, attrs)
|
580
|
+
self._append_node_generic(signal, attrs)
|
581
|
+
with self.tagcontext('glib:signal', attrs):
|
582
|
+
self._write_generic(signal)
|
583
|
+
self._write_return_type(signal.retval)
|
584
|
+
self._write_parameters(signal)
|