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
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module GObjectIntrospection
|
18
|
+
module CollectionReader
|
19
|
+
def collection_reader(name)
|
20
|
+
n_getter = "n_#{name}"
|
21
|
+
if name.end_with?("ies")
|
22
|
+
singular = name.sub(/ies\z/, "y")
|
23
|
+
else
|
24
|
+
singular = name.sub(/s\z/, "")
|
25
|
+
end
|
26
|
+
getter = "get_#{singular}"
|
27
|
+
define_method(name) do
|
28
|
+
send(n_getter).times.collect do |i|
|
29
|
+
send(getter, i)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "gobject-introspection/collection-reader"
|
18
|
+
|
19
|
+
module GObjectIntrospection
|
20
|
+
class InterfaceInfo
|
21
|
+
extend CollectionReader
|
22
|
+
|
23
|
+
alias_method :__methods__, :methods
|
24
|
+
|
25
|
+
collection_reader("prerequisites")
|
26
|
+
collection_reader("properties")
|
27
|
+
collection_reader("methods")
|
28
|
+
collection_reader("signals")
|
29
|
+
collection_reader("vfuncs")
|
30
|
+
collection_reader("constants")
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,328 @@
|
|
1
|
+
# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module GObjectIntrospection
|
18
|
+
class Loader
|
19
|
+
class << self
|
20
|
+
def load(namespace, base_module, options={})
|
21
|
+
loader = new(base_module)
|
22
|
+
loader.version = options[:version]
|
23
|
+
loader.load(namespace)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
attr_accessor :version
|
28
|
+
def initialize(base_module)
|
29
|
+
@base_module = base_module
|
30
|
+
@version = nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def load(namespace)
|
34
|
+
repository = Repository.default
|
35
|
+
repository.require(namespace, @version)
|
36
|
+
pre_load(repository, namespace)
|
37
|
+
repository.each(namespace) do |info|
|
38
|
+
load_info(info)
|
39
|
+
end
|
40
|
+
post_load(repository, namespace)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def pre_load(repository, namespace)
|
45
|
+
end
|
46
|
+
|
47
|
+
def post_load(repository, namespace)
|
48
|
+
end
|
49
|
+
|
50
|
+
def load_info(info)
|
51
|
+
case info
|
52
|
+
when FunctionInfo
|
53
|
+
load_function_info(info)
|
54
|
+
when StructInfo
|
55
|
+
load_struct_info(info)
|
56
|
+
when FlagsInfo
|
57
|
+
load_flags_info(info)
|
58
|
+
when EnumInfo
|
59
|
+
load_enum_info(info)
|
60
|
+
when ObjectInfo
|
61
|
+
load_object_info(info)
|
62
|
+
when InterfaceInfo
|
63
|
+
load_interface_info(info)
|
64
|
+
when ConstantInfo
|
65
|
+
load_constant_info(info)
|
66
|
+
when UnionInfo
|
67
|
+
load_union_info(info)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def load_function_info(info)
|
72
|
+
name = rubyish_method_name(info)
|
73
|
+
define_module_function(@base_module, name, info)
|
74
|
+
end
|
75
|
+
|
76
|
+
def define_module_function(target_module, name, function_info)
|
77
|
+
validate = lambda do |arguments|
|
78
|
+
method_name = "#{target_module}\#.#{name}"
|
79
|
+
validate_arguments(function_info, method_name, arguments)
|
80
|
+
end
|
81
|
+
target_module.module_eval do
|
82
|
+
define_method(name) do |*arguments, &block|
|
83
|
+
validate.call(arguments, &block)
|
84
|
+
function_info.invoke(*arguments, &block)
|
85
|
+
end
|
86
|
+
module_function(name)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def define_struct(info, options={})
|
91
|
+
if info.gtype == GLib::Type::NONE
|
92
|
+
klass = self.class.define_struct(info.size, info.name, @base_module,
|
93
|
+
:parent => options[:parent])
|
94
|
+
else
|
95
|
+
klass = self.class.define_class(info.gtype, info.name, @base_module,
|
96
|
+
:parent => options[:parent])
|
97
|
+
end
|
98
|
+
load_fields(info, klass)
|
99
|
+
load_methods(info, klass)
|
100
|
+
end
|
101
|
+
|
102
|
+
def load_struct_info(info)
|
103
|
+
return if info.gtype_struct?
|
104
|
+
|
105
|
+
define_struct(info)
|
106
|
+
end
|
107
|
+
|
108
|
+
def load_enum_value(value_info, enum_module)
|
109
|
+
enum_module.const_set(value_info.name.upcase, value_info.value)
|
110
|
+
end
|
111
|
+
|
112
|
+
def load_enum_info(info)
|
113
|
+
if info.gtype == GLib::Type::NONE
|
114
|
+
enum_module = Module.new
|
115
|
+
info.values.each do |value_info|
|
116
|
+
load_enum_value(value_info, enum_module)
|
117
|
+
end
|
118
|
+
@base_module.const_set(info.name, enum_module)
|
119
|
+
else
|
120
|
+
self.class.define_class(info.gtype, info.name, @base_module)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def load_flag_value(value_info, flags_module)
|
125
|
+
flags_module.const_set(value_info.name.upcase, value_info.value)
|
126
|
+
end
|
127
|
+
|
128
|
+
def load_flags_info(info)
|
129
|
+
if info.gtype == GLib::Type::NONE
|
130
|
+
flags_module = Module.new
|
131
|
+
info.values.each do |value_info|
|
132
|
+
load_flag_value(value_info, flags_module)
|
133
|
+
end
|
134
|
+
@base_module.const_set(info.name, flags_module)
|
135
|
+
else
|
136
|
+
self.class.define_class(info.gtype, info.name, @base_module)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def load_object_info(info)
|
141
|
+
klass = self.class.define_class(info.gtype, info.name, @base_module)
|
142
|
+
load_fields(info, klass)
|
143
|
+
load_methods(info, klass)
|
144
|
+
end
|
145
|
+
|
146
|
+
def load_fields(info, klass)
|
147
|
+
info.n_fields.times do |i|
|
148
|
+
field_info = info.get_field(i)
|
149
|
+
name = field_info.name
|
150
|
+
flags = field_info.flags
|
151
|
+
|
152
|
+
if flags.readable?
|
153
|
+
klass.__send__(:define_method, name) do ||
|
154
|
+
info.get_field_value(self, i)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if flags.writable?
|
159
|
+
klass.__send__(:define_method, "#{name}=") do |value|
|
160
|
+
info.set_field_value(self, i, value)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def load_methods(info, klass)
|
167
|
+
grouped_methods = info.methods.group_by do |method_info|
|
168
|
+
method_info.class
|
169
|
+
end
|
170
|
+
grouped_methods.each do |method_info_class, method_infos|
|
171
|
+
next if method_infos.empty?
|
172
|
+
case method_infos.first
|
173
|
+
when ConstructorInfo
|
174
|
+
load_constructor_infos(method_infos, klass)
|
175
|
+
when MethodInfo
|
176
|
+
load_method_infos(method_infos, klass)
|
177
|
+
when FunctionInfo
|
178
|
+
load_function_infos(method_infos, klass)
|
179
|
+
else
|
180
|
+
raise "TODO: #{method_info_class}"
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def load_constructor_infos(infos, klass)
|
186
|
+
return if infos.empty?
|
187
|
+
|
188
|
+
validate = lambda do |info, method_name, arguments|
|
189
|
+
validate_arguments(info, "#{klass}\##{method_name}", arguments)
|
190
|
+
end
|
191
|
+
infos.each do |info|
|
192
|
+
name = "initialize_#{info.name}"
|
193
|
+
klass.__send__(:define_method, name) do |*arguments, &block|
|
194
|
+
validate.call(info, name, arguments, &block)
|
195
|
+
info.invoke(self, *arguments, &block)
|
196
|
+
end
|
197
|
+
klass.__send__(:private, name)
|
198
|
+
end
|
199
|
+
|
200
|
+
find_info = lambda do |arguments|
|
201
|
+
find_suitable_callable_info(infos, arguments)
|
202
|
+
end
|
203
|
+
klass.__send__(:define_method, "initialize") do |*arguments, &block|
|
204
|
+
info = find_info.call(arguments, &block)
|
205
|
+
__send__("initialize_#{info.name}", *arguments, &block)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
def validate_arguments(info, method_name, arguments)
|
210
|
+
n_in_args = info.n_in_args
|
211
|
+
n_required_in_args = info.n_required_in_args
|
212
|
+
return if (n_required_in_args..n_in_args).cover?(arguments.size)
|
213
|
+
|
214
|
+
detail = "#{arguments.size} for "
|
215
|
+
if n_in_args == n_required_in_args
|
216
|
+
detail << "#{info.n_in_args}"
|
217
|
+
else
|
218
|
+
detail << "#{info.n_required_in_args}..#{info.n_in_args}"
|
219
|
+
end
|
220
|
+
message = "#{method_name}: wrong number of arguments (#{detail})"
|
221
|
+
raise ArgumentError, message
|
222
|
+
end
|
223
|
+
|
224
|
+
def find_suitable_callable_info(infos, arguments)
|
225
|
+
min_n_args = nil
|
226
|
+
max_n_args = nil
|
227
|
+
infos.each do |info|
|
228
|
+
if arguments.size == info.n_in_args
|
229
|
+
return info
|
230
|
+
end
|
231
|
+
n_in_args = info.n_in_args
|
232
|
+
min_n_args = [min_n_args || n_in_args, n_in_args].min
|
233
|
+
max_n_args = [max_n_args || n_in_args, n_in_args].max
|
234
|
+
end
|
235
|
+
detail = "#{arguments.size} for #{min_n_args}"
|
236
|
+
if min_n_args < max_n_args
|
237
|
+
detail << "..#{max_n_args}"
|
238
|
+
end
|
239
|
+
raise ArgumentError, "wrong number of arguments (#{detail})"
|
240
|
+
end
|
241
|
+
|
242
|
+
def rubyish_method_name(function_info)
|
243
|
+
name = function_info.name
|
244
|
+
return_type = function_info.return_type
|
245
|
+
if return_type.tag == GObjectIntrospection::TypeTag::BOOLEAN
|
246
|
+
case name
|
247
|
+
when /\A(?:is|get_is|get)_/
|
248
|
+
"#{$POSTMATCH}?"
|
249
|
+
when /\A(?:has|use)_/
|
250
|
+
"#{name}?"
|
251
|
+
else
|
252
|
+
name
|
253
|
+
end
|
254
|
+
elsif /\Aget_/ =~ name and function_info.n_in_args.zero?
|
255
|
+
$POSTMATCH
|
256
|
+
else
|
257
|
+
case name
|
258
|
+
when "to_string"
|
259
|
+
"to_s"
|
260
|
+
when "foreach"
|
261
|
+
"each"
|
262
|
+
else
|
263
|
+
name
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
def load_method_infos(infos, klass)
|
269
|
+
infos.each do |info|
|
270
|
+
method_name = rubyish_method_name(info)
|
271
|
+
load_method_info(info, klass, method_name)
|
272
|
+
if /\Aset_/ =~ method_name and info.n_args == 1
|
273
|
+
klass.__send__(:alias_method, "#{$POSTMATCH}=", method_name)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
def load_method_info(info, klass, method_name)
|
279
|
+
validate = lambda do |arguments|
|
280
|
+
validate_arguments(info, "#{klass}\##{method_name}", arguments)
|
281
|
+
end
|
282
|
+
klass.__send__(:define_method, method_name) do |*arguments, &block|
|
283
|
+
validate.call(arguments, &block)
|
284
|
+
if block.nil? and info.require_callback?
|
285
|
+
Enumerator.new(self, method_name, *arguments)
|
286
|
+
else
|
287
|
+
info.invoke(self, *arguments, &block)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
def load_function_infos(infos, klass)
|
293
|
+
infos.each do |info|
|
294
|
+
name = rubyish_method_name(info)
|
295
|
+
next if name == "new"
|
296
|
+
next if name == "alloc"
|
297
|
+
validate = lambda do |arguments|
|
298
|
+
validate_arguments(info, "#{klass}.#{name}", arguments)
|
299
|
+
end
|
300
|
+
singleton_class = (class << klass; self; end)
|
301
|
+
singleton_class.__send__(:define_method, name) do |*arguments, &block|
|
302
|
+
validate.call(arguments, &block)
|
303
|
+
if block.nil? and info.require_callback?
|
304
|
+
Enumerator.new(self, name, *arguments)
|
305
|
+
else
|
306
|
+
info.invoke(*arguments, &block)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
def load_interface_info(info)
|
313
|
+
interface_module =
|
314
|
+
self.class.define_interface(info.gtype, info.name, @base_module)
|
315
|
+
load_methods(info, interface_module)
|
316
|
+
end
|
317
|
+
|
318
|
+
def load_constant_info(info)
|
319
|
+
@base_module.const_set(info.name, info.value)
|
320
|
+
end
|
321
|
+
|
322
|
+
def load_union_info(info)
|
323
|
+
klass = self.class.define_class(info.gtype, info.name, @base_module)
|
324
|
+
load_fields(info, klass)
|
325
|
+
load_methods(info, klass)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "gobject-introspection/collection-reader"
|
18
|
+
|
19
|
+
module GObjectIntrospection
|
20
|
+
class ObjectInfo
|
21
|
+
extend CollectionReader
|
22
|
+
|
23
|
+
alias_method :__methods__, :methods
|
24
|
+
|
25
|
+
collection_reader("interfaces")
|
26
|
+
collection_reader("fields")
|
27
|
+
collection_reader("properties")
|
28
|
+
collection_reader("methods")
|
29
|
+
collection_reader("signals")
|
30
|
+
collection_reader("vfuncs")
|
31
|
+
collection_reader("constants")
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
module GObjectIntrospection
|
18
|
+
class Repository
|
19
|
+
include Enumerable
|
20
|
+
|
21
|
+
def each(*namespaces)
|
22
|
+
if namespaces.empty?
|
23
|
+
namespaces = loaded_namespaces
|
24
|
+
end
|
25
|
+
namespaces.each do |namespace|
|
26
|
+
get_n_infos(namespace).times do |i|
|
27
|
+
yield(get_info(namespace, i))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|