gobject-introspection 2.0.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,1100 @@
|
|
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
|
+
import copy
|
23
|
+
from itertools import chain
|
24
|
+
|
25
|
+
from . import message
|
26
|
+
|
27
|
+
from .message import Position
|
28
|
+
from .odict import odict
|
29
|
+
from .utils import to_underscores
|
30
|
+
|
31
|
+
class Type(object):
|
32
|
+
"""A Type can be either:
|
33
|
+
* A reference to a node (target_giname)
|
34
|
+
* A reference to a "fundamental" type like 'utf8'
|
35
|
+
* A "foreign" type - this can be any string."
|
36
|
+
If none are specified, then it's in an "unresolved" state. An
|
37
|
+
unresolved type can have two data sources; a "ctype" which comes
|
38
|
+
from a C type string, or a gtype_name (from g_type_name()).
|
39
|
+
""" # '''
|
40
|
+
|
41
|
+
def __init__(self,
|
42
|
+
ctype=None,
|
43
|
+
gtype_name=None,
|
44
|
+
target_fundamental=None,
|
45
|
+
target_giname=None,
|
46
|
+
target_foreign=None,
|
47
|
+
_target_unknown=False,
|
48
|
+
is_const=False,
|
49
|
+
origin_symbol=None,
|
50
|
+
complete_ctype=None):
|
51
|
+
self.ctype = ctype
|
52
|
+
self.gtype_name = gtype_name
|
53
|
+
self.origin_symbol = origin_symbol
|
54
|
+
if _target_unknown:
|
55
|
+
assert isinstance(self, TypeUnknown)
|
56
|
+
elif target_fundamental:
|
57
|
+
assert target_giname is None
|
58
|
+
assert target_foreign is None
|
59
|
+
elif target_giname:
|
60
|
+
assert '.' in target_giname
|
61
|
+
assert target_fundamental is None
|
62
|
+
assert target_foreign is None
|
63
|
+
elif target_foreign:
|
64
|
+
assert ctype is not None
|
65
|
+
assert target_giname is None
|
66
|
+
assert target_fundamental is None
|
67
|
+
else:
|
68
|
+
assert (ctype is not None) or (gtype_name is not None)
|
69
|
+
self.target_fundamental = target_fundamental
|
70
|
+
self.target_giname = target_giname
|
71
|
+
self.target_foreign = target_foreign
|
72
|
+
self.is_const = is_const
|
73
|
+
self.complete_ctype = complete_ctype
|
74
|
+
|
75
|
+
@property
|
76
|
+
def resolved(self):
|
77
|
+
return (self.target_fundamental or
|
78
|
+
self.target_giname or
|
79
|
+
self.target_foreign)
|
80
|
+
|
81
|
+
@property
|
82
|
+
def unresolved_string(self):
|
83
|
+
if self.ctype:
|
84
|
+
return self.ctype
|
85
|
+
elif self.gtype_name:
|
86
|
+
return self.gtype_name
|
87
|
+
elif self.target_giname:
|
88
|
+
return self.target_giname
|
89
|
+
else:
|
90
|
+
assert False
|
91
|
+
|
92
|
+
@classmethod
|
93
|
+
def create_from_gtype_name(cls, gtype_name):
|
94
|
+
"""Parse a GType name (as from g_type_name()), and return a
|
95
|
+
Type instance. Note that this function performs namespace lookup,
|
96
|
+
in contrast to the other create_type() functions."""
|
97
|
+
# First, is it a fundamental?
|
98
|
+
fundamental = type_names.get(gtype_name)
|
99
|
+
if fundamental is not None:
|
100
|
+
return cls(target_fundamental=fundamental.target_fundamental,
|
101
|
+
ctype=fundamental.ctype)
|
102
|
+
if gtype_name == 'GHashTable':
|
103
|
+
return Map(TYPE_ANY, TYPE_ANY, gtype_name=gtype_name)
|
104
|
+
elif gtype_name in ('GArray', 'GPtrArray', 'GByteArray'):
|
105
|
+
return Array('GLib.' + gtype_name[1:], TYPE_ANY,
|
106
|
+
gtype_name=gtype_name)
|
107
|
+
elif gtype_name == 'GStrv':
|
108
|
+
bare_utf8 = TYPE_STRING.clone()
|
109
|
+
bare_utf8.ctype = None
|
110
|
+
return Array(None, bare_utf8, ctype=None, gtype_name=gtype_name,
|
111
|
+
is_const=False)
|
112
|
+
|
113
|
+
# Workaround for Gdk.Rectangle being boxed alias for
|
114
|
+
# cairo.RectangleInt. G-I does not support boxing of aliases.
|
115
|
+
# See https://bugzilla.gnome.org/show_bug.cgi?id=655423
|
116
|
+
if gtype_name == 'GdkRectangle':
|
117
|
+
gtype_name = 'CairoRectangleInt'
|
118
|
+
|
119
|
+
return cls(gtype_name=gtype_name)
|
120
|
+
|
121
|
+
def get_giname(self):
|
122
|
+
assert self.target_giname is not None
|
123
|
+
return self.target_giname.split('.')[1]
|
124
|
+
|
125
|
+
def __cmp__(self, other):
|
126
|
+
if self.target_fundamental:
|
127
|
+
return cmp(self.target_fundamental, other.target_fundamental)
|
128
|
+
if self.target_giname:
|
129
|
+
return cmp(self.target_giname, other.target_giname)
|
130
|
+
if self.target_foreign:
|
131
|
+
return cmp(self.target_foreign, other.target_foreign)
|
132
|
+
return cmp(self.ctype, other.ctype)
|
133
|
+
|
134
|
+
def is_equiv(self, typeval):
|
135
|
+
"""Return True if the specified types are compatible at
|
136
|
+
an introspection level, disregarding their C types.
|
137
|
+
A sequence may be given for typeval, in which case
|
138
|
+
this function returns True if the type is compatible with
|
139
|
+
any."""
|
140
|
+
if isinstance(typeval, (list, tuple)):
|
141
|
+
for val in typeval:
|
142
|
+
if self.is_equiv(val):
|
143
|
+
return True
|
144
|
+
return False
|
145
|
+
return self == typeval
|
146
|
+
|
147
|
+
def clone(self):
|
148
|
+
return Type(target_fundamental=self.target_fundamental,
|
149
|
+
target_giname=self.target_giname,
|
150
|
+
target_foreign=self.target_foreign,
|
151
|
+
ctype=self.ctype,
|
152
|
+
is_const=self.is_const)
|
153
|
+
|
154
|
+
def __str__(self):
|
155
|
+
if self.target_fundamental:
|
156
|
+
return self.target_fundamental
|
157
|
+
elif self.target_giname:
|
158
|
+
return self.target_giname
|
159
|
+
elif self.target_foreign:
|
160
|
+
return self.target_foreign
|
161
|
+
|
162
|
+
def __repr__(self):
|
163
|
+
if self.target_fundamental:
|
164
|
+
data = 'target_fundamental=%s, ' % (self.target_fundamental, )
|
165
|
+
elif self.target_giname:
|
166
|
+
data = 'target_giname=%s, ' % (self.target_giname, )
|
167
|
+
elif self.target_foreign:
|
168
|
+
data = 'target_foreign=%s, ' % (self.target_foreign, )
|
169
|
+
else:
|
170
|
+
data = ''
|
171
|
+
return '%s(%sctype=%s)' % (self.__class__.__name__, data, self.ctype)
|
172
|
+
|
173
|
+
class TypeUnknown(Type):
|
174
|
+
def __init__(self):
|
175
|
+
Type.__init__(self, _target_unknown=True)
|
176
|
+
|
177
|
+
######
|
178
|
+
## Fundamental types
|
179
|
+
######
|
180
|
+
# Two special ones
|
181
|
+
TYPE_NONE = Type(target_fundamental='none', ctype='void')
|
182
|
+
TYPE_ANY = Type(target_fundamental='gpointer', ctype='gpointer')
|
183
|
+
# "Basic" types
|
184
|
+
TYPE_BOOLEAN = Type(target_fundamental='gboolean', ctype='gboolean')
|
185
|
+
TYPE_INT8 = Type(target_fundamental='gint8', ctype='gint8')
|
186
|
+
TYPE_UINT8 = Type(target_fundamental='guint8', ctype='guint8')
|
187
|
+
TYPE_INT16 = Type(target_fundamental='gint16', ctype='gint16')
|
188
|
+
TYPE_UINT16 = Type(target_fundamental='guint16', ctype='guint16')
|
189
|
+
TYPE_INT32 = Type(target_fundamental='gint32', ctype='gint32')
|
190
|
+
TYPE_UINT32 = Type(target_fundamental='guint32', ctype='guint32')
|
191
|
+
TYPE_INT64 = Type(target_fundamental='gint64', ctype='gint64')
|
192
|
+
TYPE_UINT64 = Type(target_fundamental='guint64', ctype='guint64')
|
193
|
+
TYPE_CHAR = Type(target_fundamental='gchar', ctype='gchar')
|
194
|
+
TYPE_SHORT = Type(target_fundamental='gshort', ctype='gshort')
|
195
|
+
TYPE_USHORT = Type(target_fundamental='gushort', ctype='gushort')
|
196
|
+
TYPE_INT = Type(target_fundamental='gint', ctype='gint')
|
197
|
+
TYPE_UINT = Type(target_fundamental='guint', ctype='guint')
|
198
|
+
TYPE_LONG = Type(target_fundamental='glong', ctype='glong')
|
199
|
+
TYPE_ULONG = Type(target_fundamental='gulong', ctype='gulong')
|
200
|
+
TYPE_SIZE = Type(target_fundamental='gsize', ctype='gsize')
|
201
|
+
TYPE_SSIZE = Type(target_fundamental='gssize', ctype='gssize')
|
202
|
+
TYPE_INTPTR = Type(target_fundamental='gintptr', ctype='gintptr')
|
203
|
+
TYPE_UINTPTR = Type(target_fundamental='guintptr', ctype='guintptr')
|
204
|
+
# C99 types
|
205
|
+
TYPE_LONG_LONG = Type(target_fundamental='long long', ctype='long long')
|
206
|
+
TYPE_LONG_ULONG = Type(target_fundamental='unsigned long long',
|
207
|
+
ctype='unsigned long long')
|
208
|
+
TYPE_FLOAT = Type(target_fundamental='gfloat', ctype='gfloat')
|
209
|
+
TYPE_DOUBLE = Type(target_fundamental='gdouble', ctype='gdouble')
|
210
|
+
# ?
|
211
|
+
TYPE_LONG_DOUBLE = Type(target_fundamental='long double',
|
212
|
+
ctype='long double')
|
213
|
+
TYPE_UNICHAR = Type(target_fundamental='gunichar', ctype='gunichar')
|
214
|
+
|
215
|
+
# C types with semantics overlaid
|
216
|
+
TYPE_GTYPE = Type(target_fundamental='GType', ctype='GType')
|
217
|
+
TYPE_STRING = Type(target_fundamental='utf8', ctype='gchar*')
|
218
|
+
TYPE_FILENAME = Type(target_fundamental='filename', ctype='gchar*')
|
219
|
+
|
220
|
+
TYPE_VALIST = Type(target_fundamental='va_list', ctype='va_list')
|
221
|
+
|
222
|
+
BASIC_GIR_TYPES = [TYPE_BOOLEAN, TYPE_INT8, TYPE_UINT8, TYPE_INT16,
|
223
|
+
TYPE_UINT16, TYPE_INT32, TYPE_UINT32, TYPE_INT64,
|
224
|
+
TYPE_UINT64, TYPE_CHAR, TYPE_SHORT, TYPE_USHORT, TYPE_INT,
|
225
|
+
TYPE_UINT, TYPE_LONG, TYPE_ULONG, TYPE_SIZE, TYPE_SSIZE,
|
226
|
+
TYPE_LONG_LONG, TYPE_LONG_ULONG, TYPE_INTPTR, TYPE_UINTPTR,
|
227
|
+
TYPE_FLOAT, TYPE_DOUBLE,
|
228
|
+
TYPE_LONG_DOUBLE, TYPE_UNICHAR, TYPE_GTYPE]
|
229
|
+
GIR_TYPES = [TYPE_NONE, TYPE_ANY]
|
230
|
+
GIR_TYPES.extend(BASIC_GIR_TYPES)
|
231
|
+
GIR_TYPES.extend([TYPE_STRING, TYPE_FILENAME, TYPE_VALIST])
|
232
|
+
|
233
|
+
# These are the only basic types that are guaranteed to
|
234
|
+
# be as big as a pointer (and thus are allowed in GPtrArray)
|
235
|
+
POINTER_TYPES = [TYPE_ANY, TYPE_INTPTR, TYPE_UINTPTR]
|
236
|
+
|
237
|
+
INTROSPECTABLE_BASIC = list(GIR_TYPES)
|
238
|
+
for v in [TYPE_NONE, TYPE_ANY,
|
239
|
+
TYPE_LONG_LONG, TYPE_LONG_ULONG,
|
240
|
+
TYPE_LONG_DOUBLE, TYPE_VALIST]:
|
241
|
+
INTROSPECTABLE_BASIC.remove(v)
|
242
|
+
|
243
|
+
type_names = {}
|
244
|
+
for typeval in GIR_TYPES:
|
245
|
+
type_names[typeval.target_fundamental] = typeval
|
246
|
+
basic_type_names = {}
|
247
|
+
for typeval in BASIC_GIR_TYPES:
|
248
|
+
basic_type_names[typeval.target_fundamental] = typeval
|
249
|
+
|
250
|
+
# C builtin
|
251
|
+
type_names['char'] = TYPE_CHAR
|
252
|
+
type_names['signed char'] = TYPE_INT8
|
253
|
+
type_names['unsigned char'] = TYPE_UINT8
|
254
|
+
type_names['short'] = TYPE_SHORT
|
255
|
+
type_names['signed short'] = TYPE_SHORT
|
256
|
+
type_names['unsigned short'] = TYPE_USHORT
|
257
|
+
type_names['int'] = TYPE_INT
|
258
|
+
type_names['signed int'] = TYPE_INT
|
259
|
+
type_names['unsigned short int'] = TYPE_USHORT
|
260
|
+
type_names['signed'] = TYPE_INT
|
261
|
+
type_names['unsigned int'] = TYPE_UINT
|
262
|
+
type_names['unsigned'] = TYPE_UINT
|
263
|
+
type_names['long'] = TYPE_LONG
|
264
|
+
type_names['signed long'] = TYPE_LONG
|
265
|
+
type_names['unsigned long'] = TYPE_ULONG
|
266
|
+
type_names['unsigned long int'] = TYPE_ULONG
|
267
|
+
type_names['float'] = TYPE_FLOAT
|
268
|
+
type_names['double'] = TYPE_DOUBLE
|
269
|
+
type_names['char*'] = TYPE_STRING
|
270
|
+
type_names['void*'] = TYPE_ANY
|
271
|
+
type_names['void'] = TYPE_NONE
|
272
|
+
# Also alias the signed one here
|
273
|
+
type_names['signed long long'] = TYPE_LONG_LONG
|
274
|
+
# C99 stdint exact width types
|
275
|
+
type_names['int8_t'] = TYPE_INT8
|
276
|
+
type_names['uint8_t'] = TYPE_UINT8
|
277
|
+
type_names['int16_t'] = TYPE_INT16
|
278
|
+
type_names['uint16_t'] = TYPE_UINT16
|
279
|
+
type_names['int32_t'] = TYPE_INT32
|
280
|
+
type_names['uint32_t'] = TYPE_UINT32
|
281
|
+
type_names['int64_t'] = TYPE_INT64
|
282
|
+
type_names['uint64_t'] = TYPE_UINT64
|
283
|
+
|
284
|
+
# A few additional GLib type aliases
|
285
|
+
type_names['guchar'] = TYPE_UINT8
|
286
|
+
type_names['gchararray'] = TYPE_STRING
|
287
|
+
type_names['gchar*'] = TYPE_STRING
|
288
|
+
type_names['goffset'] = TYPE_INT64
|
289
|
+
type_names['gunichar2'] = TYPE_UINT16
|
290
|
+
type_names['gsize'] = TYPE_SIZE
|
291
|
+
type_names['gssize'] = TYPE_SSIZE
|
292
|
+
type_names['gintptr'] = TYPE_INTPTR
|
293
|
+
type_names['guintptr'] = TYPE_UINTPTR
|
294
|
+
type_names['gconstpointer'] = TYPE_ANY
|
295
|
+
|
296
|
+
# We used to support these; continue to do so
|
297
|
+
type_names['any'] = TYPE_ANY
|
298
|
+
type_names['boolean'] = TYPE_BOOLEAN
|
299
|
+
type_names['uint'] = TYPE_UINT
|
300
|
+
type_names['ulong'] = TYPE_ULONG
|
301
|
+
|
302
|
+
# C stdio, used in GLib public headers; squash this for now here
|
303
|
+
# until we move scanning into GLib and can (skip)
|
304
|
+
type_names['FILE*'] = TYPE_ANY
|
305
|
+
|
306
|
+
# One off C unix type definitions; note some of these may be GNU Libc
|
307
|
+
# specific. If someone is actually bitten by this, feel free to do
|
308
|
+
# the required configure goop to determine their size and replace
|
309
|
+
# here.
|
310
|
+
#
|
311
|
+
# We don't want to encourage people to use these in their APIs because
|
312
|
+
# they compromise the platform-independence that GLib gives you.
|
313
|
+
# These are here mostly to avoid blowing when random platform-specific
|
314
|
+
# methods are added under #ifdefs inside GLib itself. We could just (skip)
|
315
|
+
# the relevant methods, but on the other hand, since these types are just
|
316
|
+
# integers it's easy enough to expand them.
|
317
|
+
type_names['size_t'] = type_names['gsize']
|
318
|
+
type_names['time_t'] = TYPE_LONG
|
319
|
+
type_names['off_t'] = type_names['gsize']
|
320
|
+
type_names['pid_t'] = TYPE_INT
|
321
|
+
type_names['uid_t'] = TYPE_UINT
|
322
|
+
type_names['gid_t'] = TYPE_UINT
|
323
|
+
type_names['dev_t'] = TYPE_INT
|
324
|
+
type_names['socklen_t'] = TYPE_INT32
|
325
|
+
type_names['size_t'] = TYPE_ULONG
|
326
|
+
type_names['ssize_t'] = TYPE_LONG
|
327
|
+
|
328
|
+
# Obj-C
|
329
|
+
type_names['id'] = TYPE_ANY
|
330
|
+
|
331
|
+
##
|
332
|
+
## Parameters
|
333
|
+
##
|
334
|
+
|
335
|
+
PARAM_DIRECTION_IN = 'in'
|
336
|
+
PARAM_DIRECTION_OUT = 'out'
|
337
|
+
PARAM_DIRECTION_INOUT = 'inout'
|
338
|
+
|
339
|
+
PARAM_SCOPE_CALL = 'call'
|
340
|
+
PARAM_SCOPE_ASYNC = 'async'
|
341
|
+
PARAM_SCOPE_NOTIFIED = 'notified'
|
342
|
+
|
343
|
+
PARAM_TRANSFER_NONE = 'none'
|
344
|
+
PARAM_TRANSFER_CONTAINER = 'container'
|
345
|
+
PARAM_TRANSFER_FULL = 'full'
|
346
|
+
|
347
|
+
SIGNAL_FIRST = 'first'
|
348
|
+
SIGNAL_LAST = 'last'
|
349
|
+
SIGNAL_CLEANUP = 'cleanup'
|
350
|
+
SIGNAL_MUST_COLLECT = 'must-collect'
|
351
|
+
|
352
|
+
|
353
|
+
class Namespace(object):
|
354
|
+
def __init__(self, name, version,
|
355
|
+
identifier_prefixes=None,
|
356
|
+
symbol_prefixes=None):
|
357
|
+
self.name = name
|
358
|
+
self.version = version
|
359
|
+
if identifier_prefixes is not None:
|
360
|
+
self.identifier_prefixes = identifier_prefixes
|
361
|
+
else:
|
362
|
+
self.identifier_prefixes = [name]
|
363
|
+
if symbol_prefixes is not None:
|
364
|
+
self.symbol_prefixes = symbol_prefixes
|
365
|
+
else:
|
366
|
+
ps = self.identifier_prefixes
|
367
|
+
self.symbol_prefixes = [to_underscores(p).lower() for p in ps]
|
368
|
+
# cache upper-cased versions
|
369
|
+
self._ucase_symbol_prefixes = [p.upper() for p in self.symbol_prefixes]
|
370
|
+
self.names = odict() # Maps from GIName -> node
|
371
|
+
self.aliases = {} # Maps from GIName -> GIName
|
372
|
+
self.type_names = {} # Maps from GTName -> node
|
373
|
+
self.ctypes = {} # Maps from CType -> node
|
374
|
+
self.symbols = {} # Maps from function symbols -> Function
|
375
|
+
self.includes = set() # Include
|
376
|
+
self.shared_libraries = [] # str
|
377
|
+
self.c_includes = [] # str
|
378
|
+
self.exported_packages = [] # str
|
379
|
+
|
380
|
+
def type_from_name(self, name, ctype=None):
|
381
|
+
"""Backwards compatibility method for older .gir files, which
|
382
|
+
only use the 'name' attribute. If name refers to a fundamental type,
|
383
|
+
create a Type object referncing it. If name is already a
|
384
|
+
fully-qualified GIName like 'Foo.Bar', returns a Type targeting it .
|
385
|
+
Otherwise a Type targeting name qualififed with the namespace name is
|
386
|
+
returned."""
|
387
|
+
if name in type_names:
|
388
|
+
return Type(target_fundamental=name, ctype=ctype)
|
389
|
+
if '.' in name:
|
390
|
+
target = name
|
391
|
+
else:
|
392
|
+
target = '%s.%s' % (self.name, name)
|
393
|
+
return Type(target_giname=target, ctype=ctype)
|
394
|
+
|
395
|
+
def track(self, node):
|
396
|
+
"""Doesn't directly append the function to our own namespace,
|
397
|
+
but adds it to things like ctypes, symbols, and type_names.
|
398
|
+
"""
|
399
|
+
assert isinstance(node, Node)
|
400
|
+
if node.namespace is self:
|
401
|
+
return
|
402
|
+
assert node.namespace is None
|
403
|
+
node.namespace = self
|
404
|
+
if isinstance(node, Alias):
|
405
|
+
self.aliases[node.name] = node
|
406
|
+
elif isinstance(node, Registered) and node.gtype_name is not None:
|
407
|
+
self.type_names[node.gtype_name] = node
|
408
|
+
elif isinstance(node, Function):
|
409
|
+
self.symbols[node.symbol] = node
|
410
|
+
if isinstance(node, (Compound, Class, Interface)):
|
411
|
+
for fn in chain(node.methods, node.static_methods, node.constructors):
|
412
|
+
if not isinstance(fn, Function):
|
413
|
+
continue
|
414
|
+
fn.namespace = self
|
415
|
+
self.symbols[fn.symbol] = fn
|
416
|
+
if isinstance(node, (Class, Interface)):
|
417
|
+
for m in chain(node.signals, node.properties):
|
418
|
+
m.namespace = self
|
419
|
+
if isinstance(node, Enum) or isinstance(node, Bitfield):
|
420
|
+
for fn in node.static_methods:
|
421
|
+
if not isinstance(fn, Function):
|
422
|
+
continue
|
423
|
+
fn.namespace = self
|
424
|
+
self.symbols[fn.symbol] = fn
|
425
|
+
for member in node.members:
|
426
|
+
member.namespace = self
|
427
|
+
self.symbols[member.symbol] = member
|
428
|
+
if hasattr(node, 'ctype'):
|
429
|
+
self.ctypes[node.ctype] = node
|
430
|
+
|
431
|
+
def append(self, node, replace=False):
|
432
|
+
previous = self.names.get(node.name)
|
433
|
+
if previous is not None:
|
434
|
+
if not replace:
|
435
|
+
raise ValueError("Namespace conflict: %r" % (node, ))
|
436
|
+
self.remove(previous)
|
437
|
+
|
438
|
+
self.track(node)
|
439
|
+
self.names[node.name] = node
|
440
|
+
|
441
|
+
def remove(self, node):
|
442
|
+
if isinstance(node, Alias):
|
443
|
+
del self.aliases[node.name]
|
444
|
+
elif isinstance(node, Registered) and node.gtype_name is not None:
|
445
|
+
del self.type_names[node.gtype_name]
|
446
|
+
if hasattr(node, 'ctype'):
|
447
|
+
del self.ctypes[node.ctype]
|
448
|
+
if isinstance(node, Function):
|
449
|
+
del self.symbols[node.symbol]
|
450
|
+
node.namespace = None
|
451
|
+
self.names.pop(node.name, None)
|
452
|
+
|
453
|
+
def float(self, node):
|
454
|
+
"""Like remove(), but doesn't unset the node's namespace
|
455
|
+
back-reference, and it's still possible to look up
|
456
|
+
functions via get_by_symbol()."""
|
457
|
+
if isinstance(node, Function):
|
458
|
+
symbol = node.symbol
|
459
|
+
self.remove(node)
|
460
|
+
self.symbols[symbol] = node
|
461
|
+
node.namespace = self
|
462
|
+
|
463
|
+
def __iter__(self):
|
464
|
+
return iter(self.names)
|
465
|
+
|
466
|
+
def iteritems(self):
|
467
|
+
return self.names.iteritems()
|
468
|
+
|
469
|
+
def itervalues(self):
|
470
|
+
return self.names.itervalues()
|
471
|
+
|
472
|
+
def get(self, name):
|
473
|
+
return self.names.get(name)
|
474
|
+
|
475
|
+
def get_by_ctype(self, ctype):
|
476
|
+
return self.ctypes.get(ctype)
|
477
|
+
|
478
|
+
def get_by_symbol(self, symbol):
|
479
|
+
return self.symbols.get(symbol)
|
480
|
+
|
481
|
+
def walk(self, callback):
|
482
|
+
for node in self.itervalues():
|
483
|
+
node.walk(callback, [])
|
484
|
+
|
485
|
+
class Include(object):
|
486
|
+
|
487
|
+
def __init__(self, name, version):
|
488
|
+
self.name = name
|
489
|
+
self.version = version
|
490
|
+
|
491
|
+
@classmethod
|
492
|
+
def from_string(cls, string):
|
493
|
+
return cls(*string.split('-', 1))
|
494
|
+
|
495
|
+
def __cmp__(self, other):
|
496
|
+
namecmp = cmp(self.name, other.name)
|
497
|
+
if namecmp != 0:
|
498
|
+
return namecmp
|
499
|
+
return cmp(self.version, other.version)
|
500
|
+
|
501
|
+
def __hash__(self):
|
502
|
+
return hash(str(self))
|
503
|
+
|
504
|
+
def __str__(self):
|
505
|
+
return '%s-%s' % (self.name, self.version)
|
506
|
+
|
507
|
+
class Annotated(object):
|
508
|
+
"""An object which has a few generic metadata
|
509
|
+
properties."""
|
510
|
+
def __init__(self):
|
511
|
+
self.version = None
|
512
|
+
self.skip = False
|
513
|
+
self.introspectable = True
|
514
|
+
self.attributes = [] # (key, value)*
|
515
|
+
self.stability = None
|
516
|
+
self.deprecated = None
|
517
|
+
self.deprecated_version = None
|
518
|
+
self.doc = None
|
519
|
+
|
520
|
+
class Node(Annotated):
|
521
|
+
"""A node is a type of object which is uniquely identified by its
|
522
|
+
(namespace, name) pair. When combined with a ., this is called a
|
523
|
+
GIName. It's possible for nodes to contain or point to other nodes."""
|
524
|
+
|
525
|
+
c_name = property(lambda self: self.namespace.name + self.name)
|
526
|
+
gi_name = property(lambda self: '%s.%s' % (self.namespace.name, self.name))
|
527
|
+
|
528
|
+
def __init__(self, name=None):
|
529
|
+
Annotated.__init__(self)
|
530
|
+
self.namespace = None # Should be set later by Namespace.append()
|
531
|
+
self.name = name
|
532
|
+
self.foreign = False
|
533
|
+
self.file_positions = set()
|
534
|
+
self._parent = None
|
535
|
+
|
536
|
+
def _get_parent(self):
|
537
|
+
if self._parent is not None:
|
538
|
+
return self._parent
|
539
|
+
else:
|
540
|
+
return self.namespace
|
541
|
+
|
542
|
+
def _set_parent(self, value):
|
543
|
+
self._parent = value
|
544
|
+
parent = property(_get_parent, _set_parent)
|
545
|
+
|
546
|
+
def create_type(self):
|
547
|
+
"""Create a Type object referencing this node."""
|
548
|
+
assert self.namespace is not None
|
549
|
+
return Type(target_giname=('%s.%s' % (self.namespace.name, self.name)))
|
550
|
+
|
551
|
+
def __cmp__(self, other):
|
552
|
+
nscmp = cmp(self.namespace, other.namespace)
|
553
|
+
if nscmp != 0:
|
554
|
+
return nscmp
|
555
|
+
return cmp(self.name, other.name)
|
556
|
+
|
557
|
+
def __repr__(self):
|
558
|
+
return '%s(%r)' % (self.__class__.__name__, self.name)
|
559
|
+
|
560
|
+
def inherit_file_positions(self, node):
|
561
|
+
self.file_positions.update(node.file_positions)
|
562
|
+
|
563
|
+
def add_file_position(self, position):
|
564
|
+
self.file_positions.add(position)
|
565
|
+
|
566
|
+
def add_symbol_reference(self, symbol):
|
567
|
+
if symbol.source_filename:
|
568
|
+
self.add_file_position(Position(symbol.source_filename, symbol.line))
|
569
|
+
|
570
|
+
def walk(self, callback, chain):
|
571
|
+
res = callback(self, chain)
|
572
|
+
assert res in (True, False), "Walk function must return boolean, not %r" % (res, )
|
573
|
+
if not res:
|
574
|
+
return False
|
575
|
+
chain.append(self)
|
576
|
+
self._walk(callback, chain)
|
577
|
+
chain.pop()
|
578
|
+
|
579
|
+
def _walk(self, callback, chain):
|
580
|
+
pass
|
581
|
+
|
582
|
+
|
583
|
+
class Registered:
|
584
|
+
"""A node that (possibly) has gtype_name and get_type."""
|
585
|
+
def __init__(self, gtype_name, get_type):
|
586
|
+
assert (gtype_name is None and get_type is None) or \
|
587
|
+
(gtype_name is not None and get_type is not None)
|
588
|
+
self.gtype_name = gtype_name
|
589
|
+
self.get_type = get_type
|
590
|
+
|
591
|
+
|
592
|
+
class Callable(Node):
|
593
|
+
|
594
|
+
def __init__(self, name, retval, parameters, throws):
|
595
|
+
Node.__init__(self, name)
|
596
|
+
self.retval = retval
|
597
|
+
self.parameters = parameters
|
598
|
+
self.throws = not not throws
|
599
|
+
self.instance_parameter = None # Parameter
|
600
|
+
self.parent = None # A Class or Interface
|
601
|
+
|
602
|
+
# Returns all parameters, including the instance parameter
|
603
|
+
@property
|
604
|
+
def all_parameters(self):
|
605
|
+
if self.instance_parameter is not None:
|
606
|
+
return [self.instance_parameter] + self.parameters
|
607
|
+
else:
|
608
|
+
return self.parameters
|
609
|
+
|
610
|
+
def get_parameter_index(self, name):
|
611
|
+
for i, parameter in enumerate(self.parameters):
|
612
|
+
if parameter.argname == name:
|
613
|
+
return i
|
614
|
+
raise ValueError("Unknown argument %s" % (name, ))
|
615
|
+
|
616
|
+
def get_parameter(self, name):
|
617
|
+
for parameter in self.all_parameters:
|
618
|
+
if parameter.argname == name:
|
619
|
+
return parameter
|
620
|
+
raise ValueError("Unknown argument %s" % (name, ))
|
621
|
+
|
622
|
+
|
623
|
+
class Function(Callable):
|
624
|
+
|
625
|
+
def __init__(self, name, retval, parameters, throws, symbol):
|
626
|
+
Callable.__init__(self, name, retval, parameters, throws)
|
627
|
+
self.symbol = symbol
|
628
|
+
self.is_method = False
|
629
|
+
self.is_constructor = False
|
630
|
+
self.shadowed_by = None # C symbol string
|
631
|
+
self.shadows = None # C symbol string
|
632
|
+
self.moved_to = None # namespaced function name string
|
633
|
+
self.internal_skipped = False # if True, this func will not be written to GIR
|
634
|
+
|
635
|
+
def clone(self):
|
636
|
+
clone = copy.copy(self)
|
637
|
+
# copy the parameters array so a change to self.parameters does not
|
638
|
+
# influence clone.parameters.
|
639
|
+
clone.parameters = self.parameters[:]
|
640
|
+
return clone
|
641
|
+
|
642
|
+
def is_type_meta_function(self):
|
643
|
+
# Named correctly
|
644
|
+
if not (self.name.endswith('_get_type') or
|
645
|
+
self.name.endswith('_get_gtype')):
|
646
|
+
return False
|
647
|
+
|
648
|
+
# Doesn't have any parameters
|
649
|
+
if self.parameters:
|
650
|
+
return False
|
651
|
+
|
652
|
+
# Returns GType
|
653
|
+
rettype = self.retval.type
|
654
|
+
if (not rettype.is_equiv(TYPE_GTYPE) and
|
655
|
+
rettype.target_giname != 'Gtk.Type'):
|
656
|
+
message.warn("function '%s' returns '%r', not a GType" %
|
657
|
+
(self.name, rettype))
|
658
|
+
return False
|
659
|
+
|
660
|
+
return True
|
661
|
+
|
662
|
+
class ErrorQuarkFunction(Function):
|
663
|
+
|
664
|
+
def __init__(self, name, retval, parameters, throws, symbol, error_domain):
|
665
|
+
Function.__init__(self, name, retval, parameters, throws, symbol)
|
666
|
+
self.error_domain = error_domain
|
667
|
+
|
668
|
+
|
669
|
+
class VFunction(Callable):
|
670
|
+
|
671
|
+
def __init__(self, name, retval, parameters, throws):
|
672
|
+
Callable.__init__(self, name, retval, parameters, throws)
|
673
|
+
self.invoker = None
|
674
|
+
|
675
|
+
@classmethod
|
676
|
+
def from_callback(cls, cb):
|
677
|
+
obj = cls(cb.name, cb.retval, cb.parameters[1:],
|
678
|
+
cb.throws)
|
679
|
+
return obj
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
class Varargs(Type):
|
684
|
+
|
685
|
+
def __init__(self):
|
686
|
+
Type.__init__(self, '<varargs>', target_fundamental='<varargs>')
|
687
|
+
|
688
|
+
|
689
|
+
class Array(Type):
|
690
|
+
C = '<c>'
|
691
|
+
GLIB_ARRAY = 'GLib.Array'
|
692
|
+
GLIB_BYTEARRAY = 'GLib.ByteArray'
|
693
|
+
GLIB_PTRARRAY = 'GLib.PtrArray'
|
694
|
+
|
695
|
+
def __init__(self, array_type, element_type, **kwargs):
|
696
|
+
Type.__init__(self, target_fundamental='<array>',
|
697
|
+
**kwargs)
|
698
|
+
if (array_type is None or array_type == self.C):
|
699
|
+
self.array_type = self.C
|
700
|
+
else:
|
701
|
+
assert array_type in (self.GLIB_ARRAY,
|
702
|
+
self.GLIB_BYTEARRAY,
|
703
|
+
self.GLIB_PTRARRAY), array_type
|
704
|
+
self.array_type = array_type
|
705
|
+
assert isinstance(element_type, Type)
|
706
|
+
self.element_type = element_type
|
707
|
+
self.zeroterminated = True
|
708
|
+
self.length_param_name = None
|
709
|
+
self.size = None
|
710
|
+
|
711
|
+
def clone(self):
|
712
|
+
arr = Array(self.array_type, self.element_type)
|
713
|
+
arr.zeroterminated = self.zeroterminated
|
714
|
+
arr.length_param_name = self.length_param_name
|
715
|
+
arr.size = self.size
|
716
|
+
return arr
|
717
|
+
|
718
|
+
class List(Type):
|
719
|
+
|
720
|
+
def __init__(self, name, element_type, **kwargs):
|
721
|
+
Type.__init__(self, target_fundamental='<list>',
|
722
|
+
**kwargs)
|
723
|
+
self.name = name
|
724
|
+
assert isinstance(element_type, Type)
|
725
|
+
self.element_type = element_type
|
726
|
+
|
727
|
+
def clone(self):
|
728
|
+
return List(self.name, self.element_type)
|
729
|
+
|
730
|
+
class Map(Type):
|
731
|
+
|
732
|
+
def __init__(self, key_type, value_type, **kwargs):
|
733
|
+
Type.__init__(self, target_fundamental='<map>', **kwargs)
|
734
|
+
assert isinstance(key_type, Type)
|
735
|
+
self.key_type = key_type
|
736
|
+
assert isinstance(value_type, Type)
|
737
|
+
self.value_type = value_type
|
738
|
+
|
739
|
+
def clone(self):
|
740
|
+
return Map(self.key_type, self.value_type)
|
741
|
+
|
742
|
+
class Alias(Node):
|
743
|
+
|
744
|
+
def __init__(self, name, target, ctype=None):
|
745
|
+
Node.__init__(self, name)
|
746
|
+
self.target = target
|
747
|
+
self.ctype = ctype
|
748
|
+
|
749
|
+
|
750
|
+
class TypeContainer(Annotated):
|
751
|
+
"""A fundamental base class for Return and Parameter."""
|
752
|
+
|
753
|
+
def __init__(self, typenode, transfer):
|
754
|
+
Annotated.__init__(self)
|
755
|
+
self.type = typenode
|
756
|
+
if transfer is not None:
|
757
|
+
self.transfer = transfer
|
758
|
+
elif typenode.is_const:
|
759
|
+
self.transfer = PARAM_TRANSFER_NONE
|
760
|
+
else:
|
761
|
+
self.transfer = None
|
762
|
+
|
763
|
+
|
764
|
+
class Parameter(TypeContainer):
|
765
|
+
"""An argument to a function."""
|
766
|
+
|
767
|
+
def __init__(self, argname, typenode, direction=None,
|
768
|
+
transfer=None, allow_none=False, scope=None,
|
769
|
+
caller_allocates=False):
|
770
|
+
TypeContainer.__init__(self, typenode, transfer)
|
771
|
+
self.argname = argname
|
772
|
+
self.direction = direction
|
773
|
+
self.allow_none = allow_none
|
774
|
+
self.scope = scope
|
775
|
+
self.caller_allocates = caller_allocates
|
776
|
+
self.closure_name = None
|
777
|
+
self.destroy_name = None
|
778
|
+
|
779
|
+
|
780
|
+
class Return(TypeContainer):
|
781
|
+
"""A return value from a function."""
|
782
|
+
|
783
|
+
def __init__(self, rtype, transfer=None):
|
784
|
+
TypeContainer.__init__(self, rtype, transfer)
|
785
|
+
self.direction = PARAM_DIRECTION_OUT
|
786
|
+
|
787
|
+
|
788
|
+
class Enum(Node, Registered):
|
789
|
+
|
790
|
+
def __init__(self, name, ctype,
|
791
|
+
gtype_name=None,
|
792
|
+
get_type=None,
|
793
|
+
c_symbol_prefix=None,
|
794
|
+
members=None):
|
795
|
+
Node.__init__(self, name)
|
796
|
+
Registered.__init__(self, gtype_name, get_type)
|
797
|
+
self.c_symbol_prefix = c_symbol_prefix
|
798
|
+
self.ctype = ctype
|
799
|
+
self.members = members
|
800
|
+
for member in members:
|
801
|
+
member.parent = self
|
802
|
+
# Associated error domain name
|
803
|
+
self.error_domain = None
|
804
|
+
self.static_methods = []
|
805
|
+
|
806
|
+
def _walk(self, callback, chain):
|
807
|
+
for meth in self.static_methods:
|
808
|
+
meth.walk(callback, chain)
|
809
|
+
|
810
|
+
|
811
|
+
class Bitfield(Node, Registered):
|
812
|
+
|
813
|
+
def __init__(self, name, ctype,
|
814
|
+
gtype_name=None,
|
815
|
+
c_symbol_prefix=None,
|
816
|
+
get_type=None,
|
817
|
+
members=None):
|
818
|
+
Node.__init__(self, name)
|
819
|
+
Registered.__init__(self, gtype_name, get_type)
|
820
|
+
self.ctype = ctype
|
821
|
+
self.c_symbol_prefix = c_symbol_prefix
|
822
|
+
self.members = members
|
823
|
+
for member in members:
|
824
|
+
member.parent = self
|
825
|
+
self.static_methods = []
|
826
|
+
|
827
|
+
def _walk(self, callback, chain):
|
828
|
+
for meth in self.static_methods:
|
829
|
+
meth.walk(callback, chain)
|
830
|
+
|
831
|
+
|
832
|
+
class Member(Annotated):
|
833
|
+
|
834
|
+
def __init__(self, name, value, symbol, nick):
|
835
|
+
Annotated.__init__(self)
|
836
|
+
self.name = name
|
837
|
+
self.value = value
|
838
|
+
self.symbol = symbol
|
839
|
+
self.nick = nick
|
840
|
+
self.parent = None
|
841
|
+
|
842
|
+
def __cmp__(self, other):
|
843
|
+
return cmp(self.name, other.name)
|
844
|
+
|
845
|
+
def __repr__(self):
|
846
|
+
return '%s(%r)' % (self.__class__.__name__, self.name)
|
847
|
+
|
848
|
+
|
849
|
+
class Compound(Node, Registered):
|
850
|
+
def __init__(self, name,
|
851
|
+
ctype=None,
|
852
|
+
gtype_name=None,
|
853
|
+
get_type=None,
|
854
|
+
c_symbol_prefix=None,
|
855
|
+
disguised=False):
|
856
|
+
Node.__init__(self, name)
|
857
|
+
Registered.__init__(self, gtype_name, get_type)
|
858
|
+
self.ctype = ctype
|
859
|
+
self.methods = []
|
860
|
+
self.static_methods = []
|
861
|
+
self.fields = []
|
862
|
+
self.constructors = []
|
863
|
+
self.disguised = disguised
|
864
|
+
self.gtype_name = gtype_name
|
865
|
+
self.get_type = get_type
|
866
|
+
self.c_symbol_prefix = c_symbol_prefix
|
867
|
+
|
868
|
+
def add_gtype(self, gtype_name, get_type):
|
869
|
+
self.gtype_name = gtype_name
|
870
|
+
self.get_type = get_type
|
871
|
+
self.namespace.type_names[gtype_name] = self
|
872
|
+
|
873
|
+
def _walk(self, callback, chain):
|
874
|
+
for ctor in self.constructors:
|
875
|
+
ctor.walk(callback, chain)
|
876
|
+
for func in self.methods:
|
877
|
+
func.walk(callback, chain)
|
878
|
+
for func in self.static_methods:
|
879
|
+
func.walk(callback, chain)
|
880
|
+
for field in self.fields:
|
881
|
+
if field.anonymous_node is not None:
|
882
|
+
field.anonymous_node.walk(callback, chain)
|
883
|
+
|
884
|
+
class Field(Annotated):
|
885
|
+
|
886
|
+
def __init__(self, name, typenode, readable, writable, bits=None,
|
887
|
+
anonymous_node=None):
|
888
|
+
Annotated.__init__(self)
|
889
|
+
assert (typenode or anonymous_node)
|
890
|
+
self.name = name
|
891
|
+
self.type = typenode
|
892
|
+
self.readable = readable
|
893
|
+
self.writable = writable
|
894
|
+
self.bits = bits
|
895
|
+
self.anonymous_node = anonymous_node
|
896
|
+
self.private = False
|
897
|
+
self.parent = None # a compound
|
898
|
+
|
899
|
+
def __cmp__(self, other):
|
900
|
+
return cmp(self.name, other.name)
|
901
|
+
|
902
|
+
def __repr__(self):
|
903
|
+
return '%s(%r)' % (self.__class__.__name__, self.name)
|
904
|
+
|
905
|
+
|
906
|
+
class Record(Compound):
|
907
|
+
|
908
|
+
def __init__(self, name,
|
909
|
+
ctype=None,
|
910
|
+
gtype_name=None,
|
911
|
+
get_type=None,
|
912
|
+
c_symbol_prefix=None,
|
913
|
+
disguised=False):
|
914
|
+
Compound.__init__(self, name,
|
915
|
+
ctype=ctype,
|
916
|
+
gtype_name=gtype_name,
|
917
|
+
get_type=get_type,
|
918
|
+
c_symbol_prefix=c_symbol_prefix,
|
919
|
+
disguised=disguised)
|
920
|
+
# If non-None, this record defines the FooClass C structure
|
921
|
+
# for some Foo GObject (or similar for GInterface)
|
922
|
+
self.is_gtype_struct_for = None
|
923
|
+
|
924
|
+
|
925
|
+
class Union(Compound):
|
926
|
+
|
927
|
+
def __init__(self, name,
|
928
|
+
ctype=None,
|
929
|
+
gtype_name=None,
|
930
|
+
get_type=None,
|
931
|
+
c_symbol_prefix=None,
|
932
|
+
disguised=False):
|
933
|
+
Compound.__init__(self, name,
|
934
|
+
ctype=ctype,
|
935
|
+
gtype_name=gtype_name,
|
936
|
+
get_type=get_type,
|
937
|
+
c_symbol_prefix=c_symbol_prefix,
|
938
|
+
disguised=disguised)
|
939
|
+
|
940
|
+
|
941
|
+
class Boxed(Node, Registered):
|
942
|
+
"""A boxed type with no known associated structure/union."""
|
943
|
+
def __init__(self, name,
|
944
|
+
gtype_name=None,
|
945
|
+
get_type=None,
|
946
|
+
c_symbol_prefix=None):
|
947
|
+
assert gtype_name is not None
|
948
|
+
assert get_type is not None
|
949
|
+
Node.__init__(self, name)
|
950
|
+
Registered.__init__(self, gtype_name, get_type)
|
951
|
+
if get_type is not None:
|
952
|
+
assert c_symbol_prefix is not None
|
953
|
+
self.c_symbol_prefix = c_symbol_prefix
|
954
|
+
self.constructors = []
|
955
|
+
self.methods = []
|
956
|
+
self.static_methods = []
|
957
|
+
|
958
|
+
def _walk(self, callback, chain):
|
959
|
+
for ctor in self.constructors:
|
960
|
+
ctor.walk(callback, chain)
|
961
|
+
for meth in self.methods:
|
962
|
+
meth.walk(callback, chain)
|
963
|
+
for meth in self.static_methods:
|
964
|
+
meth.walk(callback, chain)
|
965
|
+
|
966
|
+
|
967
|
+
class Signal(Callable):
|
968
|
+
|
969
|
+
def __init__(self, name, retval, parameters, when=None,
|
970
|
+
no_recurse=False, detailed=False, action=False,
|
971
|
+
no_hooks=False):
|
972
|
+
Callable.__init__(self, name, retval, parameters, False)
|
973
|
+
self.when = when
|
974
|
+
self.no_recurse = no_recurse
|
975
|
+
self.detailed = detailed
|
976
|
+
self.action = action
|
977
|
+
self.no_hooks = no_hooks
|
978
|
+
|
979
|
+
|
980
|
+
class Class(Node, Registered):
|
981
|
+
|
982
|
+
def __init__(self, name, parent_type,
|
983
|
+
ctype=None,
|
984
|
+
gtype_name=None,
|
985
|
+
get_type=None,
|
986
|
+
c_symbol_prefix=None,
|
987
|
+
is_abstract=False):
|
988
|
+
Node.__init__(self, name)
|
989
|
+
Registered.__init__(self, gtype_name, get_type)
|
990
|
+
self.ctype = ctype
|
991
|
+
self.c_symbol_prefix = c_symbol_prefix
|
992
|
+
self.parent_type = parent_type
|
993
|
+
self.fundamental = False
|
994
|
+
self.unref_func = None
|
995
|
+
self.ref_func = None
|
996
|
+
self.set_value_func = None
|
997
|
+
self.get_value_func = None
|
998
|
+
# When we're in the scanner, we keep around a list
|
999
|
+
# of parents so that we can transparently fall back
|
1000
|
+
# if there are 'hidden' parents
|
1001
|
+
self.parent_chain = []
|
1002
|
+
self.glib_type_struct = None
|
1003
|
+
self.is_abstract = is_abstract
|
1004
|
+
self.methods = []
|
1005
|
+
self.virtual_methods = []
|
1006
|
+
self.static_methods = []
|
1007
|
+
self.interfaces = []
|
1008
|
+
self.constructors = []
|
1009
|
+
self.properties = []
|
1010
|
+
self.fields = []
|
1011
|
+
self.signals = []
|
1012
|
+
|
1013
|
+
def _walk(self, callback, chain):
|
1014
|
+
for meth in self.methods:
|
1015
|
+
meth.walk(callback, chain)
|
1016
|
+
for meth in self.virtual_methods:
|
1017
|
+
meth.walk(callback, chain)
|
1018
|
+
for meth in self.static_methods:
|
1019
|
+
meth.walk(callback, chain)
|
1020
|
+
for ctor in self.constructors:
|
1021
|
+
ctor.walk(callback, chain)
|
1022
|
+
for field in self.fields:
|
1023
|
+
if field.anonymous_node:
|
1024
|
+
field.anonymous_node.walk(callback, chain)
|
1025
|
+
for sig in self.signals:
|
1026
|
+
sig.walk(callback, chain)
|
1027
|
+
for prop in self.properties:
|
1028
|
+
prop.walk(callback, chain)
|
1029
|
+
|
1030
|
+
|
1031
|
+
class Interface(Node, Registered):
|
1032
|
+
|
1033
|
+
def __init__(self, name, parent_type,
|
1034
|
+
ctype=None,
|
1035
|
+
gtype_name=None,
|
1036
|
+
get_type=None,
|
1037
|
+
c_symbol_prefix=None):
|
1038
|
+
Node.__init__(self, name)
|
1039
|
+
Registered.__init__(self, gtype_name, get_type)
|
1040
|
+
self.ctype = ctype
|
1041
|
+
self.c_symbol_prefix = c_symbol_prefix
|
1042
|
+
self.parent_type = parent_type
|
1043
|
+
self.parent_chain = []
|
1044
|
+
self.methods = []
|
1045
|
+
self.signals = []
|
1046
|
+
self.static_methods = []
|
1047
|
+
self.virtual_methods = []
|
1048
|
+
self.glib_type_struct = None
|
1049
|
+
self.properties = []
|
1050
|
+
self.fields = []
|
1051
|
+
self.prerequisites = []
|
1052
|
+
# Not used yet, exists just to avoid an exception in
|
1053
|
+
# Namespace.append()
|
1054
|
+
self.constructors = []
|
1055
|
+
|
1056
|
+
def _walk(self, callback, chain):
|
1057
|
+
for meth in self.methods:
|
1058
|
+
meth.walk(callback, chain)
|
1059
|
+
for meth in self.static_methods:
|
1060
|
+
meth.walk(callback, chain)
|
1061
|
+
for meth in self.virtual_methods:
|
1062
|
+
meth.walk(callback, chain)
|
1063
|
+
for field in self.fields:
|
1064
|
+
if field.anonymous_node:
|
1065
|
+
field.anonymous_node.walk(callback, chain)
|
1066
|
+
for sig in self.signals:
|
1067
|
+
sig.walk(callback, chain)
|
1068
|
+
|
1069
|
+
|
1070
|
+
class Constant(Node):
|
1071
|
+
|
1072
|
+
def __init__(self, name, value_type, value, ctype):
|
1073
|
+
Node.__init__(self, name)
|
1074
|
+
self.value_type = value_type
|
1075
|
+
self.value = value
|
1076
|
+
self.ctype = ctype
|
1077
|
+
|
1078
|
+
|
1079
|
+
class Property(Node):
|
1080
|
+
|
1081
|
+
def __init__(self, name, typeobj, readable, writable,
|
1082
|
+
construct, construct_only, transfer=None):
|
1083
|
+
Node.__init__(self, name)
|
1084
|
+
self.type = typeobj
|
1085
|
+
self.readable = readable
|
1086
|
+
self.writable = writable
|
1087
|
+
self.construct = construct
|
1088
|
+
self.construct_only = construct_only
|
1089
|
+
if transfer is None:
|
1090
|
+
self.transfer = PARAM_TRANSFER_NONE
|
1091
|
+
else:
|
1092
|
+
self.transfer = transfer
|
1093
|
+
self.parent = None # A Class or Interface
|
1094
|
+
|
1095
|
+
|
1096
|
+
class Callback(Callable):
|
1097
|
+
|
1098
|
+
def __init__(self, name, retval, parameters, throws, ctype=None):
|
1099
|
+
Callable.__init__(self, name, retval, parameters, throws)
|
1100
|
+
self.ctype = ctype
|