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
data/Rakefile
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
$LOAD_PATH.unshift("./../glib2/lib")
|
20
|
+
require "gnome2/rake/package-task"
|
21
|
+
|
22
|
+
package = nil
|
23
|
+
package_task = GNOME2::Rake::PackageTask.new do |_package|
|
24
|
+
package = _package
|
25
|
+
package.summary = "Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection."
|
26
|
+
package.description = "Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection."
|
27
|
+
package.dependency.gem.runtime = ["glib2"]
|
28
|
+
package.dependency.gem.development = [["test-unit", ">= 2"]]
|
29
|
+
package.windows.packages = []
|
30
|
+
package.windows.dependencies = []
|
31
|
+
package.windows.build_dependencies = ["glib2"]
|
32
|
+
package.external_packages = [
|
33
|
+
{
|
34
|
+
:name => "glib",
|
35
|
+
:download_site => :gnome,
|
36
|
+
:label => "GLib",
|
37
|
+
:version => "2.36.0",
|
38
|
+
:compression_method => "xz",
|
39
|
+
:windows => {
|
40
|
+
:build => false,
|
41
|
+
},
|
42
|
+
:native => {
|
43
|
+
:build => true,
|
44
|
+
},
|
45
|
+
},
|
46
|
+
{
|
47
|
+
:name => "gobject-introspection",
|
48
|
+
:download_site => :gnome,
|
49
|
+
:label => "gobject-introspection",
|
50
|
+
:version => "1.36.0",
|
51
|
+
:compression_method => "xz",
|
52
|
+
:windows => {
|
53
|
+
:configure_args => [
|
54
|
+
"--with-g-ir-scanner=#{package.native.absolute_binary_dir}/bin/g-ir-scanner",
|
55
|
+
"--disable-tests",
|
56
|
+
],
|
57
|
+
:patches => [
|
58
|
+
"0001-Support-external-g-ir-scanner.patch",
|
59
|
+
],
|
60
|
+
:need_autoreconf => true,
|
61
|
+
},
|
62
|
+
:native => {
|
63
|
+
:build => true,
|
64
|
+
:patches => [
|
65
|
+
# "cross-compilable-g-ir-scanner.diff",
|
66
|
+
],
|
67
|
+
}
|
68
|
+
},
|
69
|
+
]
|
70
|
+
end
|
71
|
+
package_task.define
|
72
|
+
|
73
|
+
namespace :native do
|
74
|
+
namespace :"gobject-introspection" do
|
75
|
+
desc "Make g-ir-scanner workable for Windows on non Windows"
|
76
|
+
task :cross do
|
77
|
+
g_ir_scanner_dir = package.native.absolute_binary_dir
|
78
|
+
g_ir_scanner_dir += "lib/gobject-introspection/giscanner"
|
79
|
+
Dir.chdir(g_ir_scanner_dir.to_s) do
|
80
|
+
patch = "#{package.patches_dir}/cross-g-ir-scanner.diff"
|
81
|
+
sh("patch -p2 < #{patch}")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
namespace :builder do
|
87
|
+
task :after => "native:gobject-introspection:cross"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
namespace :win32 do
|
92
|
+
namespace :"gobject-introspection" do
|
93
|
+
desc "Use native tools"
|
94
|
+
task :cross do
|
95
|
+
pkg_config_dir = package.windows.absolute_binary_dir + "lib/pkgconfig"
|
96
|
+
pc_path = pkg_config_dir + "gobject-introspection-1.0.pc"
|
97
|
+
original_pc = pc_path.read
|
98
|
+
new_pc = ""
|
99
|
+
new_pc << "native_prefix=#{package.native.absolute_binary_dir}\n"
|
100
|
+
new_pc << "native_bindir=${native_prefix}/bin\n"
|
101
|
+
original_pc.each_line do |line|
|
102
|
+
case line
|
103
|
+
when /\Ag_ir_(scanner|compiler)=/
|
104
|
+
new_pc << line.gsub(/\${bindir}/, "${native_bindir}")
|
105
|
+
else
|
106
|
+
new_pc << line
|
107
|
+
end
|
108
|
+
end
|
109
|
+
pc_path.open("w") do |pc_file|
|
110
|
+
pc_file.write(new_pc)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
namespace :builder do
|
116
|
+
task :after => "win32:gobject-introspection:cross"
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
install-so: install-headers
|
2
|
+
install-headers:
|
3
|
+
$(INSTALL_DATA) $(srcdir)/rb-gobject-introspection.h $(RUBYARCHDIR)
|
4
|
+
|
5
|
+
install: install-pc
|
6
|
+
install-pc:
|
7
|
+
if test -n "$(pkgconfigdir)"; then \
|
8
|
+
$(MAKEDIRS) $(pkgconfigdir); \
|
9
|
+
$(INSTALL_DATA) ruby-gobject-introspection.pc $(pkgconfigdir);\
|
10
|
+
fi
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
require "pathname"
|
20
|
+
|
21
|
+
source_dir = Pathname(__FILE__).dirname
|
22
|
+
base_dir = source_dir.parent.parent.expand_path
|
23
|
+
top_dir = base_dir.parent.expand_path
|
24
|
+
top_build_dir = Pathname(".").parent.parent.parent.expand_path
|
25
|
+
|
26
|
+
mkmf_gnome2_dir = top_dir + "glib2" + "lib"
|
27
|
+
version_suffix = ""
|
28
|
+
unless mkmf_gnome2_dir.exist?
|
29
|
+
if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
|
30
|
+
version_suffix = $1
|
31
|
+
mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + "lib"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
|
36
|
+
|
37
|
+
module_name = "gobject_introspection"
|
38
|
+
package_id = "gobject-introspection-1.0"
|
39
|
+
|
40
|
+
begin
|
41
|
+
require "mkmf-gnome2"
|
42
|
+
rescue LoadError
|
43
|
+
require "rubygems"
|
44
|
+
gem "glib2"
|
45
|
+
require "mkmf-gnome2"
|
46
|
+
end
|
47
|
+
|
48
|
+
["glib2"].each do |package|
|
49
|
+
directory = "#{package}#{version_suffix}"
|
50
|
+
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
|
51
|
+
add_depend_package(package, "#{directory}/ext/#{package}",
|
52
|
+
top_dir.to_s,
|
53
|
+
:top_build_dir => top_build_dir.to_s,
|
54
|
+
:target_build_dir => build_dir)
|
55
|
+
end
|
56
|
+
|
57
|
+
setup_win32(module_name, base_dir)
|
58
|
+
|
59
|
+
unless required_pkg_config_package(package_id,
|
60
|
+
:debian => "libgirepository1.0-dev",
|
61
|
+
:fedora => "gobject-introspection-devel",
|
62
|
+
:homebrew => "gobject-introspection",
|
63
|
+
:macports => "gobject-introspection")
|
64
|
+
exit(false)
|
65
|
+
end
|
66
|
+
|
67
|
+
make_version_header("GI", package_id, ".")
|
68
|
+
|
69
|
+
ruby_headers = ["ruby.h"]
|
70
|
+
have_type("enum ruby_value_type", ruby_headers)
|
71
|
+
|
72
|
+
gi_headers = ["girepository.h"]
|
73
|
+
have_func("g_interface_info_find_signal", gi_headers)
|
74
|
+
|
75
|
+
enum_type_prefix = "gobject-introspection-enum-types"
|
76
|
+
include_paths = PKGConfig.cflags_only_I(package_id)
|
77
|
+
headers = include_paths.split.inject([]) do |result, path|
|
78
|
+
result + Dir.glob(File.join(path.sub(/^-I/, ""), "gi{repository,types}.h"))
|
79
|
+
end
|
80
|
+
glib_mkenums(enum_type_prefix, headers, "G_TYPE_", ["girepository.h"])
|
81
|
+
|
82
|
+
create_pkg_config_file("Ruby/GObjectIntrospection",
|
83
|
+
package_id, ruby_gnome2_version,
|
84
|
+
"ruby-gobject-introspection.pc")
|
85
|
+
|
86
|
+
ensure_objs
|
87
|
+
|
88
|
+
$defs << "-DRUBY_GOBJECT_INTROSPECTION_COMPILATION"
|
89
|
+
create_makefile(module_name)
|
90
|
+
|
91
|
+
pkg_config_dir = with_config("pkg-config-dir")
|
92
|
+
if pkg_config_dir.is_a?(String)
|
93
|
+
File.open("Makefile", "ab") do |makefile|
|
94
|
+
makefile.puts
|
95
|
+
makefile.puts("pkgconfigdir=#{pkg_config_dir}")
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gi-private.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE rb_cGIArgInfo
|
24
|
+
#define SELF(self) (RVAL2GI_ARG_INFO(self))
|
25
|
+
|
26
|
+
GType
|
27
|
+
gi_arg_info_get_type(void)
|
28
|
+
{
|
29
|
+
static GType type = 0;
|
30
|
+
if (type == 0) {
|
31
|
+
type = g_boxed_type_register_static("GIArgInfo",
|
32
|
+
(GBoxedCopyFunc)g_base_info_ref,
|
33
|
+
(GBoxedFreeFunc)g_base_info_unref);
|
34
|
+
}
|
35
|
+
return type;
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE
|
39
|
+
rg_direction(VALUE self)
|
40
|
+
{
|
41
|
+
GIArgInfo *info;
|
42
|
+
|
43
|
+
info = SELF(self);
|
44
|
+
return GI_DIRECTION2RVAL(g_arg_info_get_direction(info));
|
45
|
+
}
|
46
|
+
|
47
|
+
static VALUE
|
48
|
+
rg_caller_allocates_p(VALUE self)
|
49
|
+
{
|
50
|
+
GIArgInfo *info;
|
51
|
+
|
52
|
+
info = SELF(self);
|
53
|
+
return CBOOL2RVAL(g_arg_info_is_caller_allocates(info));
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
rg_return_value_p(VALUE self)
|
58
|
+
{
|
59
|
+
GIArgInfo *info;
|
60
|
+
|
61
|
+
info = SELF(self);
|
62
|
+
return CBOOL2RVAL(g_arg_info_is_return_value(info));
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE
|
66
|
+
rg_optional_p(VALUE self)
|
67
|
+
{
|
68
|
+
GIArgInfo *info;
|
69
|
+
|
70
|
+
info = SELF(self);
|
71
|
+
return CBOOL2RVAL(g_arg_info_is_optional(info));
|
72
|
+
}
|
73
|
+
|
74
|
+
static VALUE
|
75
|
+
rg_may_be_null_p(VALUE self)
|
76
|
+
{
|
77
|
+
GIArgInfo *info;
|
78
|
+
|
79
|
+
info = SELF(self);
|
80
|
+
return CBOOL2RVAL(g_arg_info_may_be_null(info));
|
81
|
+
}
|
82
|
+
|
83
|
+
static VALUE
|
84
|
+
rg_ownership_transfer(VALUE self)
|
85
|
+
{
|
86
|
+
GIArgInfo *info;
|
87
|
+
|
88
|
+
info = SELF(self);
|
89
|
+
return GI_TRANSFER2RVAL(g_arg_info_get_ownership_transfer(info));
|
90
|
+
}
|
91
|
+
|
92
|
+
static VALUE
|
93
|
+
rg_scope(VALUE self)
|
94
|
+
{
|
95
|
+
GIArgInfo *info;
|
96
|
+
|
97
|
+
info = SELF(self);
|
98
|
+
return GI_SCOPE_TYPE2RVAL(g_arg_info_get_scope(info));
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
rg_closure(VALUE self)
|
103
|
+
{
|
104
|
+
GIArgInfo *info;
|
105
|
+
|
106
|
+
info = SELF(self);
|
107
|
+
return INT2NUM(g_arg_info_get_closure(info));
|
108
|
+
}
|
109
|
+
|
110
|
+
static VALUE
|
111
|
+
rg_destroy(VALUE self)
|
112
|
+
{
|
113
|
+
GIArgInfo *info;
|
114
|
+
|
115
|
+
info = SELF(self);
|
116
|
+
return INT2NUM(g_arg_info_get_destroy(info));
|
117
|
+
}
|
118
|
+
|
119
|
+
static VALUE
|
120
|
+
rg_type(VALUE self)
|
121
|
+
{
|
122
|
+
GIArgInfo *info;
|
123
|
+
|
124
|
+
info = SELF(self);
|
125
|
+
return GI_BASE_INFO2RVAL_WITH_UNREF(g_arg_info_get_type(info));
|
126
|
+
}
|
127
|
+
|
128
|
+
void
|
129
|
+
rb_gi_arg_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
|
130
|
+
{
|
131
|
+
VALUE RG_TARGET_NAMESPACE;
|
132
|
+
|
133
|
+
RG_TARGET_NAMESPACE =
|
134
|
+
G_DEF_CLASS_WITH_PARENT(GI_TYPE_ARG_INFO, "ArgInfo", rb_mGI,
|
135
|
+
rb_cGIBaseInfo);
|
136
|
+
|
137
|
+
RG_DEF_METHOD(direction, 0);
|
138
|
+
RG_DEF_METHOD_P(caller_allocates, 0);
|
139
|
+
RG_DEF_METHOD_P(return_value, 0);
|
140
|
+
RG_DEF_METHOD_P(optional, 0);
|
141
|
+
RG_DEF_METHOD_P(may_be_null, 0);
|
142
|
+
RG_DEF_METHOD(ownership_transfer, 0);
|
143
|
+
RG_DEF_METHOD(scope, 0);
|
144
|
+
RG_DEF_METHOD(closure, 0);
|
145
|
+
RG_DEF_METHOD(destroy, 0);
|
146
|
+
RG_DEF_METHOD(type, 0);
|
147
|
+
|
148
|
+
G_DEF_CLASS(G_TYPE_I_DIRECTION, "Direction", rb_mGI);
|
149
|
+
G_DEF_CLASS(G_TYPE_I_SCOPE_TYPE, "ScopeType", rb_mGI);
|
150
|
+
G_DEF_CLASS(G_TYPE_I_TRANSFER, "Transfer", rb_mGI);
|
151
|
+
}
|
@@ -0,0 +1,1015 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gi-private.h"
|
22
|
+
|
23
|
+
static VALUE rb_cGLibValue = Qnil;
|
24
|
+
|
25
|
+
static void
|
26
|
+
array_c_to_ruby(const gchar **elements, GITypeInfo *type_info, VALUE rb_array)
|
27
|
+
{
|
28
|
+
gint n_elements;
|
29
|
+
gboolean fixed_size_p;
|
30
|
+
gboolean zero_terminated_p;
|
31
|
+
|
32
|
+
n_elements = g_type_info_get_array_length(type_info);
|
33
|
+
fixed_size_p = g_type_info_get_array_fixed_size(type_info);
|
34
|
+
zero_terminated_p = g_type_info_is_zero_terminated(type_info);
|
35
|
+
if (n_elements != -1) {
|
36
|
+
gint i;
|
37
|
+
for (i = 0; i < n_elements; i++) {
|
38
|
+
rb_ary_push(rb_array, CSTR2RVAL(elements[i]));
|
39
|
+
}
|
40
|
+
} else if (zero_terminated_p) {
|
41
|
+
for (; *elements; elements++) {
|
42
|
+
rb_ary_push(rb_array, CSTR2RVAL(*elements));
|
43
|
+
}
|
44
|
+
} else {
|
45
|
+
rb_raise(rb_eNotImpError,
|
46
|
+
"TODO: GIArgument(array)[c] -> Ruby: "
|
47
|
+
"zero-terminated: %s "
|
48
|
+
"fixed-size: %s "
|
49
|
+
"length: %d",
|
50
|
+
zero_terminated_p ? "true" : "false",
|
51
|
+
fixed_size_p ? "true" : "false",
|
52
|
+
n_elements);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
array_to_ruby(gpointer array, GITypeInfo *type_info)
|
58
|
+
{
|
59
|
+
VALUE rb_array;
|
60
|
+
GIArrayType array_type;
|
61
|
+
gint n_elements;
|
62
|
+
|
63
|
+
array_type = g_type_info_get_array_type(type_info);
|
64
|
+
n_elements = g_type_info_get_array_length(type_info);
|
65
|
+
if (n_elements == -1) {
|
66
|
+
rb_array = rb_ary_new();
|
67
|
+
} else {
|
68
|
+
rb_array = rb_ary_new2(n_elements);
|
69
|
+
}
|
70
|
+
switch (array_type) {
|
71
|
+
case GI_ARRAY_TYPE_C:
|
72
|
+
array_c_to_ruby(array, type_info, rb_array);
|
73
|
+
break;
|
74
|
+
case GI_ARRAY_TYPE_ARRAY:
|
75
|
+
rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[array] -> Ruby");
|
76
|
+
break;
|
77
|
+
case GI_ARRAY_TYPE_PTR_ARRAY:
|
78
|
+
rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[ptr-array] -> Ruby");
|
79
|
+
break;
|
80
|
+
case GI_ARRAY_TYPE_BYTE_ARRAY:
|
81
|
+
rb_raise(rb_eNotImpError, "TODO: GIArgument(array)[byte-array] -> Ruby");
|
82
|
+
break;
|
83
|
+
default:
|
84
|
+
g_assert_not_reached();
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
|
88
|
+
return rb_array;
|
89
|
+
}
|
90
|
+
|
91
|
+
static VALUE
|
92
|
+
interface_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
93
|
+
{
|
94
|
+
VALUE rb_interface;
|
95
|
+
GIBaseInfo *interface_info;
|
96
|
+
GIInfoType interface_type;
|
97
|
+
GType gtype;
|
98
|
+
|
99
|
+
interface_info = g_type_info_get_interface(type_info);
|
100
|
+
interface_type = g_base_info_get_type(interface_info);
|
101
|
+
|
102
|
+
gtype = g_registered_type_info_get_g_type(interface_info);
|
103
|
+
switch (interface_type) {
|
104
|
+
case GI_INFO_TYPE_INVALID:
|
105
|
+
rb_raise(rb_eNotImpError,
|
106
|
+
"TODO: GIArgument(interface)[invalid] -> Ruby");
|
107
|
+
break;
|
108
|
+
case GI_INFO_TYPE_FUNCTION:
|
109
|
+
rb_raise(rb_eNotImpError,
|
110
|
+
"TODO: GIArgument(interface)[function] -> Ruby");
|
111
|
+
break;
|
112
|
+
case GI_INFO_TYPE_CALLBACK:
|
113
|
+
rb_raise(rb_eNotImpError,
|
114
|
+
"TODO: GIArgument(interface)[callback] -> Ruby");
|
115
|
+
break;
|
116
|
+
case GI_INFO_TYPE_STRUCT:
|
117
|
+
rb_interface = BOXED2RVAL(argument->v_pointer, gtype);
|
118
|
+
break;
|
119
|
+
case GI_INFO_TYPE_BOXED:
|
120
|
+
rb_raise(rb_eNotImpError,
|
121
|
+
"TODO: GIArgument(interface)[boxed] -> Ruby");
|
122
|
+
break;
|
123
|
+
case GI_INFO_TYPE_ENUM:
|
124
|
+
if (gtype == G_TYPE_NONE) {
|
125
|
+
rb_interface = INT2NUM(argument->v_int32);
|
126
|
+
} else {
|
127
|
+
rb_interface = GENUM2RVAL(argument->v_int32, gtype);
|
128
|
+
}
|
129
|
+
break;
|
130
|
+
case GI_INFO_TYPE_FLAGS:
|
131
|
+
if (gtype == G_TYPE_NONE) {
|
132
|
+
rb_interface = INT2NUM(argument->v_int32);
|
133
|
+
} else {
|
134
|
+
rb_interface = GFLAGS2RVAL(argument->v_int32, gtype);
|
135
|
+
}
|
136
|
+
break;
|
137
|
+
case GI_INFO_TYPE_OBJECT:
|
138
|
+
rb_interface = GOBJ2RVAL(argument->v_pointer);
|
139
|
+
break;
|
140
|
+
case GI_INFO_TYPE_INTERFACE:
|
141
|
+
rb_interface = GOBJ2RVAL(argument->v_pointer);
|
142
|
+
break;
|
143
|
+
case GI_INFO_TYPE_CONSTANT:
|
144
|
+
rb_raise(rb_eNotImpError,
|
145
|
+
"TODO: GIArgument(interface)[constant] -> Ruby");
|
146
|
+
break;
|
147
|
+
case GI_INFO_TYPE_INVALID_0:
|
148
|
+
g_assert_not_reached();
|
149
|
+
break;
|
150
|
+
case GI_INFO_TYPE_UNION:
|
151
|
+
rb_interface = BOXED2RVAL(argument->v_pointer, gtype);
|
152
|
+
break;
|
153
|
+
case GI_INFO_TYPE_VALUE:
|
154
|
+
rb_raise(rb_eNotImpError,
|
155
|
+
"TODO: GIArgument(interface)[value] -> Ruby");
|
156
|
+
break;
|
157
|
+
case GI_INFO_TYPE_SIGNAL:
|
158
|
+
rb_raise(rb_eNotImpError,
|
159
|
+
"TODO: GIArgument(interface)[signal] -> Ruby");
|
160
|
+
break;
|
161
|
+
case GI_INFO_TYPE_VFUNC:
|
162
|
+
rb_raise(rb_eNotImpError,
|
163
|
+
"TODO: GIArgument(interface)[vfunc] -> Ruby");
|
164
|
+
break;
|
165
|
+
case GI_INFO_TYPE_PROPERTY:
|
166
|
+
rb_raise(rb_eNotImpError,
|
167
|
+
"TODO: GIArgument(interface)[property] -> Ruby");
|
168
|
+
break;
|
169
|
+
case GI_INFO_TYPE_FIELD:
|
170
|
+
rb_raise(rb_eNotImpError,
|
171
|
+
"TODO: GIArgument(interface)[field] -> Ruby");
|
172
|
+
break;
|
173
|
+
case GI_INFO_TYPE_ARG:
|
174
|
+
rb_raise(rb_eNotImpError,
|
175
|
+
"TODO: GIArgument(interface)[arg] -> Ruby");
|
176
|
+
break;
|
177
|
+
case GI_INFO_TYPE_TYPE:
|
178
|
+
rb_raise(rb_eNotImpError,
|
179
|
+
"TODO: GIArgument(interface)[type] -> Ruby");
|
180
|
+
break;
|
181
|
+
case GI_INFO_TYPE_UNRESOLVED:
|
182
|
+
rb_raise(rb_eNotImpError,
|
183
|
+
"TODO: GIArgument(interface)[unresolved] -> Ruby");
|
184
|
+
break;
|
185
|
+
default:
|
186
|
+
g_assert_not_reached();
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
|
190
|
+
g_base_info_unref(interface_info);
|
191
|
+
|
192
|
+
return rb_interface;
|
193
|
+
}
|
194
|
+
|
195
|
+
VALUE
|
196
|
+
rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
197
|
+
{
|
198
|
+
VALUE rb_argument = Qnil;
|
199
|
+
GITypeTag type_tag;
|
200
|
+
|
201
|
+
type_tag = g_type_info_get_tag(type_info);
|
202
|
+
switch (type_tag) {
|
203
|
+
case GI_TYPE_TAG_VOID:
|
204
|
+
rb_argument = Qnil;
|
205
|
+
break;
|
206
|
+
case GI_TYPE_TAG_BOOLEAN:
|
207
|
+
rb_argument = CBOOL2RVAL(argument->v_boolean);
|
208
|
+
break;
|
209
|
+
case GI_TYPE_TAG_INT8:
|
210
|
+
rb_argument = INT2NUM(argument->v_int8);
|
211
|
+
break;
|
212
|
+
case GI_TYPE_TAG_UINT8:
|
213
|
+
rb_argument = UINT2NUM(argument->v_uint8);
|
214
|
+
break;
|
215
|
+
case GI_TYPE_TAG_INT16:
|
216
|
+
rb_argument = INT2NUM(argument->v_int16);
|
217
|
+
break;
|
218
|
+
case GI_TYPE_TAG_UINT16:
|
219
|
+
rb_argument = UINT2NUM(argument->v_uint16);
|
220
|
+
break;
|
221
|
+
case GI_TYPE_TAG_INT32:
|
222
|
+
rb_argument = INT2NUM(argument->v_int32);
|
223
|
+
break;
|
224
|
+
case GI_TYPE_TAG_UINT32:
|
225
|
+
rb_argument = UINT2NUM(argument->v_uint32);
|
226
|
+
break;
|
227
|
+
case GI_TYPE_TAG_INT64:
|
228
|
+
rb_argument = LONG2NUM(argument->v_int64);
|
229
|
+
break;
|
230
|
+
case GI_TYPE_TAG_UINT64:
|
231
|
+
rb_argument = ULONG2NUM(argument->v_uint64);
|
232
|
+
break;
|
233
|
+
case GI_TYPE_TAG_FLOAT:
|
234
|
+
rb_argument = DBL2NUM(argument->v_float);
|
235
|
+
break;
|
236
|
+
case GI_TYPE_TAG_DOUBLE:
|
237
|
+
rb_argument = DBL2NUM(argument->v_double);
|
238
|
+
break;
|
239
|
+
case GI_TYPE_TAG_GTYPE:
|
240
|
+
rb_argument = rbgobj_gtype_new(argument->v_size);
|
241
|
+
break;
|
242
|
+
case GI_TYPE_TAG_UTF8:
|
243
|
+
rb_argument = CSTR2RVAL(argument->v_string);
|
244
|
+
break;
|
245
|
+
case GI_TYPE_TAG_FILENAME:
|
246
|
+
/* TODO: set encoding */
|
247
|
+
rb_argument = CSTR2RVAL(argument->v_string);
|
248
|
+
break;
|
249
|
+
case GI_TYPE_TAG_ARRAY:
|
250
|
+
rb_argument = array_to_ruby(argument->v_pointer, type_info);
|
251
|
+
break;
|
252
|
+
case GI_TYPE_TAG_INTERFACE:
|
253
|
+
rb_argument = interface_to_ruby(argument, type_info);
|
254
|
+
break;
|
255
|
+
case GI_TYPE_TAG_GLIST:
|
256
|
+
case GI_TYPE_TAG_GSLIST:
|
257
|
+
case GI_TYPE_TAG_GHASH:
|
258
|
+
rb_raise(rb_eNotImpError, "TODO: GIArgument(unichar) -> Ruby");
|
259
|
+
break;
|
260
|
+
case GI_TYPE_TAG_ERROR:
|
261
|
+
rb_argument = GERROR2RVAL(argument->v_pointer);
|
262
|
+
break;
|
263
|
+
case GI_TYPE_TAG_UNICHAR:
|
264
|
+
rb_raise(rb_eNotImpError,
|
265
|
+
"TODO: GIArgument(%s) -> Ruby",
|
266
|
+
g_type_tag_to_string(type_tag));
|
267
|
+
break;
|
268
|
+
default:
|
269
|
+
g_assert_not_reached();
|
270
|
+
break;
|
271
|
+
}
|
272
|
+
|
273
|
+
return rb_argument;
|
274
|
+
}
|
275
|
+
|
276
|
+
void
|
277
|
+
rb_gi_out_argument_init(GIArgument *argument, GIArgInfo *arg_info)
|
278
|
+
{
|
279
|
+
GITypeInfo type_info;
|
280
|
+
GITypeTag type_tag;
|
281
|
+
|
282
|
+
memset(argument, 0, sizeof(GIArgument));
|
283
|
+
|
284
|
+
g_arg_info_load_type(arg_info, &type_info);
|
285
|
+
type_tag = g_type_info_get_tag(&type_info);
|
286
|
+
switch (type_tag) {
|
287
|
+
case GI_TYPE_TAG_VOID:
|
288
|
+
break;
|
289
|
+
case GI_TYPE_TAG_BOOLEAN:
|
290
|
+
argument->v_pointer = ALLOC(gboolean);
|
291
|
+
break;
|
292
|
+
case GI_TYPE_TAG_INT8:
|
293
|
+
argument->v_pointer = ALLOC(gint8);
|
294
|
+
break;
|
295
|
+
case GI_TYPE_TAG_UINT8:
|
296
|
+
argument->v_pointer = ALLOC(guint8);
|
297
|
+
break;
|
298
|
+
case GI_TYPE_TAG_INT16:
|
299
|
+
argument->v_pointer = ALLOC(gint16);
|
300
|
+
break;
|
301
|
+
case GI_TYPE_TAG_UINT16:
|
302
|
+
argument->v_pointer = ALLOC(guint16);
|
303
|
+
break;
|
304
|
+
case GI_TYPE_TAG_INT32:
|
305
|
+
argument->v_pointer = ALLOC(gint32);
|
306
|
+
break;
|
307
|
+
case GI_TYPE_TAG_UINT32:
|
308
|
+
argument->v_pointer = ALLOC(guint32);
|
309
|
+
break;
|
310
|
+
case GI_TYPE_TAG_INT64:
|
311
|
+
argument->v_pointer = ALLOC(gint64);
|
312
|
+
break;
|
313
|
+
case GI_TYPE_TAG_UINT64:
|
314
|
+
argument->v_pointer = ALLOC(guint64);
|
315
|
+
break;
|
316
|
+
case GI_TYPE_TAG_FLOAT:
|
317
|
+
argument->v_pointer = ALLOC(gfloat);
|
318
|
+
break;
|
319
|
+
case GI_TYPE_TAG_DOUBLE:
|
320
|
+
argument->v_pointer = ALLOC(gdouble);
|
321
|
+
break;
|
322
|
+
case GI_TYPE_TAG_GTYPE:
|
323
|
+
argument->v_pointer = ALLOC(GType);
|
324
|
+
break;
|
325
|
+
case GI_TYPE_TAG_UTF8:
|
326
|
+
case GI_TYPE_TAG_FILENAME:
|
327
|
+
argument->v_pointer = ALLOC(gchar *);
|
328
|
+
break;
|
329
|
+
case GI_TYPE_TAG_ARRAY:
|
330
|
+
argument->v_pointer = ALLOC(gpointer);
|
331
|
+
break;
|
332
|
+
case GI_TYPE_TAG_INTERFACE:
|
333
|
+
argument->v_pointer = ALLOC(gpointer);
|
334
|
+
break;
|
335
|
+
case GI_TYPE_TAG_GLIST:
|
336
|
+
case GI_TYPE_TAG_GSLIST:
|
337
|
+
case GI_TYPE_TAG_GHASH:
|
338
|
+
argument->v_pointer = ALLOC(gpointer);
|
339
|
+
break;
|
340
|
+
case GI_TYPE_TAG_ERROR:
|
341
|
+
argument->v_pointer = ALLOC(GError *);
|
342
|
+
memset(argument->v_pointer, 0, sizeof(GError *));
|
343
|
+
break;
|
344
|
+
case GI_TYPE_TAG_UNICHAR:
|
345
|
+
argument->v_pointer = ALLOC(gunichar);
|
346
|
+
break;
|
347
|
+
default:
|
348
|
+
g_assert_not_reached();
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
VALUE
|
354
|
+
rb_gi_out_argument_to_ruby(GIArgument *argument, GIArgInfo *arg_info)
|
355
|
+
{
|
356
|
+
GIArgument normalized_argument;
|
357
|
+
GITypeInfo type_info;
|
358
|
+
GITypeTag type_tag;
|
359
|
+
|
360
|
+
memset(&normalized_argument, 0, sizeof(GIArgument));
|
361
|
+
g_arg_info_load_type(arg_info, &type_info);
|
362
|
+
type_tag = g_type_info_get_tag(&type_info);
|
363
|
+
switch (type_tag) {
|
364
|
+
case GI_TYPE_TAG_VOID:
|
365
|
+
break;
|
366
|
+
case GI_TYPE_TAG_BOOLEAN:
|
367
|
+
normalized_argument.v_boolean = *((gboolean *)(argument->v_pointer));
|
368
|
+
break;
|
369
|
+
case GI_TYPE_TAG_INT8:
|
370
|
+
normalized_argument.v_int8 = *((gint8 *)(argument->v_pointer));
|
371
|
+
break;
|
372
|
+
case GI_TYPE_TAG_UINT8:
|
373
|
+
normalized_argument.v_uint8 = *((guint8 *)(argument->v_pointer));
|
374
|
+
break;
|
375
|
+
case GI_TYPE_TAG_INT16:
|
376
|
+
normalized_argument.v_int16 = *((gint16 *)(argument->v_pointer));
|
377
|
+
break;
|
378
|
+
case GI_TYPE_TAG_UINT16:
|
379
|
+
normalized_argument.v_uint16 = *((guint16 *)(argument->v_pointer));
|
380
|
+
break;
|
381
|
+
case GI_TYPE_TAG_INT32:
|
382
|
+
normalized_argument.v_int32 = *((gint32 *)(argument->v_pointer));
|
383
|
+
break;
|
384
|
+
case GI_TYPE_TAG_UINT32:
|
385
|
+
normalized_argument.v_uint32 = *((guint32 *)(argument->v_pointer));
|
386
|
+
break;
|
387
|
+
case GI_TYPE_TAG_INT64:
|
388
|
+
normalized_argument.v_int64 = *((gint64 *)(argument->v_pointer));
|
389
|
+
break;
|
390
|
+
case GI_TYPE_TAG_UINT64:
|
391
|
+
normalized_argument.v_uint64 = *((guint64 *)(argument->v_pointer));
|
392
|
+
break;
|
393
|
+
case GI_TYPE_TAG_FLOAT:
|
394
|
+
normalized_argument.v_float = *((gfloat *)(argument->v_pointer));
|
395
|
+
break;
|
396
|
+
case GI_TYPE_TAG_DOUBLE:
|
397
|
+
normalized_argument.v_double = *((gdouble *)(argument->v_pointer));
|
398
|
+
break;
|
399
|
+
case GI_TYPE_TAG_GTYPE:
|
400
|
+
normalized_argument.v_size = *((GType *)(argument->v_pointer));
|
401
|
+
break;
|
402
|
+
case GI_TYPE_TAG_UTF8:
|
403
|
+
case GI_TYPE_TAG_FILENAME:
|
404
|
+
normalized_argument.v_string = *((gchar **)(argument->v_pointer));
|
405
|
+
break;
|
406
|
+
case GI_TYPE_TAG_ARRAY:
|
407
|
+
case GI_TYPE_TAG_INTERFACE:
|
408
|
+
case GI_TYPE_TAG_GLIST:
|
409
|
+
case GI_TYPE_TAG_GSLIST:
|
410
|
+
case GI_TYPE_TAG_GHASH:
|
411
|
+
normalized_argument.v_pointer = *((gpointer *)(argument->v_pointer));
|
412
|
+
break;
|
413
|
+
case GI_TYPE_TAG_ERROR:
|
414
|
+
normalized_argument.v_pointer = *((GError **)(argument->v_pointer));
|
415
|
+
break;
|
416
|
+
case GI_TYPE_TAG_UNICHAR:
|
417
|
+
normalized_argument.v_uint32 = *((guint32 *)(argument->v_pointer));
|
418
|
+
break;
|
419
|
+
default:
|
420
|
+
g_assert_not_reached();
|
421
|
+
break;
|
422
|
+
}
|
423
|
+
|
424
|
+
return rb_gi_argument_to_ruby(&normalized_argument, &type_info);
|
425
|
+
}
|
426
|
+
|
427
|
+
void
|
428
|
+
rb_gi_out_argument_fin(GIArgument *argument, GIArgInfo *arg_info)
|
429
|
+
{
|
430
|
+
GITypeInfo type_info;
|
431
|
+
|
432
|
+
if (g_arg_info_get_direction(arg_info) != GI_DIRECTION_OUT) {
|
433
|
+
return;
|
434
|
+
}
|
435
|
+
|
436
|
+
g_arg_info_load_type(arg_info, &type_info);
|
437
|
+
xfree(argument->v_pointer);
|
438
|
+
}
|
439
|
+
|
440
|
+
VALUE
|
441
|
+
rb_gi_return_argument_to_ruby(GIArgument *argument,
|
442
|
+
GICallableInfo *callable_info)
|
443
|
+
{
|
444
|
+
gboolean may_return_null;
|
445
|
+
GITypeInfo return_value_info;
|
446
|
+
|
447
|
+
may_return_null = g_callable_info_may_return_null(callable_info);
|
448
|
+
if (may_return_null && !argument->v_pointer) {
|
449
|
+
return Qnil;
|
450
|
+
}
|
451
|
+
|
452
|
+
g_callable_info_load_return_type(callable_info, &return_value_info);
|
453
|
+
return rb_gi_argument_to_ruby(argument, &return_value_info);
|
454
|
+
}
|
455
|
+
|
456
|
+
static void
|
457
|
+
rb_gi_argument_from_ruby_array_c(GIArgument *argument,
|
458
|
+
G_GNUC_UNUSED GITypeInfo *type_info,
|
459
|
+
GITypeInfo *element_type_info,
|
460
|
+
VALUE rb_argument)
|
461
|
+
{
|
462
|
+
GITypeTag element_type_tag;
|
463
|
+
|
464
|
+
element_type_tag = g_type_info_get_tag(element_type_info);
|
465
|
+
switch (element_type_tag) {
|
466
|
+
case GI_TYPE_TAG_VOID:
|
467
|
+
case GI_TYPE_TAG_BOOLEAN:
|
468
|
+
rb_raise(rb_eNotImpError,
|
469
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
470
|
+
g_type_tag_to_string(element_type_tag));
|
471
|
+
break;
|
472
|
+
case GI_TYPE_TAG_INT8:
|
473
|
+
argument->v_pointer = StringValueCStr(rb_argument);
|
474
|
+
break;
|
475
|
+
case GI_TYPE_TAG_UINT8:
|
476
|
+
argument->v_pointer = RSTRING_PTR(rb_argument);
|
477
|
+
break;
|
478
|
+
case GI_TYPE_TAG_INT16:
|
479
|
+
case GI_TYPE_TAG_UINT16:
|
480
|
+
case GI_TYPE_TAG_INT32:
|
481
|
+
case GI_TYPE_TAG_UINT32:
|
482
|
+
case GI_TYPE_TAG_INT64:
|
483
|
+
case GI_TYPE_TAG_UINT64:
|
484
|
+
case GI_TYPE_TAG_FLOAT:
|
485
|
+
case GI_TYPE_TAG_DOUBLE:
|
486
|
+
case GI_TYPE_TAG_GTYPE:
|
487
|
+
rb_raise(rb_eNotImpError,
|
488
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
489
|
+
g_type_tag_to_string(element_type_tag));
|
490
|
+
break;
|
491
|
+
case GI_TYPE_TAG_UTF8:
|
492
|
+
case GI_TYPE_TAG_FILENAME:
|
493
|
+
argument->v_pointer = RVAL2STRV(rb_argument);
|
494
|
+
break;
|
495
|
+
case GI_TYPE_TAG_ARRAY:
|
496
|
+
case GI_TYPE_TAG_INTERFACE:
|
497
|
+
case GI_TYPE_TAG_GLIST:
|
498
|
+
case GI_TYPE_TAG_GSLIST:
|
499
|
+
case GI_TYPE_TAG_GHASH:
|
500
|
+
case GI_TYPE_TAG_ERROR:
|
501
|
+
case GI_TYPE_TAG_UNICHAR:
|
502
|
+
rb_raise(rb_eNotImpError,
|
503
|
+
"TODO: Ruby -> GIArgument(array)[%s]",
|
504
|
+
g_type_tag_to_string(element_type_tag));
|
505
|
+
break;
|
506
|
+
default:
|
507
|
+
g_assert_not_reached();
|
508
|
+
break;
|
509
|
+
}
|
510
|
+
}
|
511
|
+
|
512
|
+
static void
|
513
|
+
rb_gi_argument_from_ruby_array(GIArgument *argument, GITypeInfo *type_info,
|
514
|
+
VALUE rb_argument)
|
515
|
+
{
|
516
|
+
GIArrayType array_type;
|
517
|
+
GITypeInfo *element_type_info;
|
518
|
+
|
519
|
+
array_type = g_type_info_get_array_type(type_info);
|
520
|
+
element_type_info = g_type_info_get_param_type(type_info, 0);
|
521
|
+
switch (array_type) {
|
522
|
+
case GI_ARRAY_TYPE_C:
|
523
|
+
rb_gi_argument_from_ruby_array_c(argument,
|
524
|
+
type_info, element_type_info,
|
525
|
+
rb_argument);
|
526
|
+
break;
|
527
|
+
case GI_ARRAY_TYPE_ARRAY:
|
528
|
+
case GI_ARRAY_TYPE_PTR_ARRAY:
|
529
|
+
case GI_ARRAY_TYPE_BYTE_ARRAY:
|
530
|
+
/* TODO */
|
531
|
+
break;
|
532
|
+
default:
|
533
|
+
g_assert_not_reached();
|
534
|
+
break;
|
535
|
+
}
|
536
|
+
g_base_info_unref(element_type_info);
|
537
|
+
}
|
538
|
+
|
539
|
+
static void
|
540
|
+
rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
|
541
|
+
VALUE rb_argument)
|
542
|
+
{
|
543
|
+
GIBaseInfo *interface_info;
|
544
|
+
GIInfoType interface_type;
|
545
|
+
GType gtype;
|
546
|
+
|
547
|
+
interface_info = g_type_info_get_interface(type_info);
|
548
|
+
interface_type = g_base_info_get_type(interface_info);
|
549
|
+
|
550
|
+
gtype = g_registered_type_info_get_g_type(interface_info);
|
551
|
+
switch (interface_type) {
|
552
|
+
case GI_INFO_TYPE_INVALID:
|
553
|
+
case GI_INFO_TYPE_FUNCTION:
|
554
|
+
case GI_INFO_TYPE_CALLBACK:
|
555
|
+
rb_raise(rb_eNotImpError,
|
556
|
+
"TODO: Ruby -> GIArgument(interface)[%s]: <%s>",
|
557
|
+
g_info_type_to_string(interface_type),
|
558
|
+
g_base_info_get_name(interface_info));
|
559
|
+
break;
|
560
|
+
case GI_INFO_TYPE_STRUCT:
|
561
|
+
if (gtype == G_TYPE_VALUE) {
|
562
|
+
GValue *gvalue;
|
563
|
+
gvalue = ALLOC(GValue);
|
564
|
+
memset(gvalue, 0, sizeof(GValue));
|
565
|
+
if (rb_obj_is_kind_of(rb_argument, rb_cGLibValue)) {
|
566
|
+
GValue *source_gvalue;
|
567
|
+
source_gvalue = RVAL2BOXED(rb_argument, G_TYPE_VALUE);
|
568
|
+
g_value_init(gvalue, source_gvalue->g_type);
|
569
|
+
g_value_copy(source_gvalue, gvalue);
|
570
|
+
} else {
|
571
|
+
rbgobj_initialize_gvalue(gvalue, rb_argument);
|
572
|
+
}
|
573
|
+
argument->v_pointer = gvalue;
|
574
|
+
} else {
|
575
|
+
argument->v_pointer = RVAL2BOXED(rb_argument, gtype);
|
576
|
+
}
|
577
|
+
break;
|
578
|
+
case GI_INFO_TYPE_BOXED:
|
579
|
+
rb_raise(rb_eNotImpError,
|
580
|
+
"TODO: Ruby -> GIArgument(interface)[%s]: <%s>",
|
581
|
+
g_info_type_to_string(interface_type),
|
582
|
+
g_base_info_get_name(interface_info));
|
583
|
+
break;
|
584
|
+
case GI_INFO_TYPE_ENUM:
|
585
|
+
if (gtype == G_TYPE_NONE) {
|
586
|
+
argument->v_int32 = NUM2INT(rb_argument);
|
587
|
+
} else {
|
588
|
+
argument->v_int32 = RVAL2GENUM(rb_argument, gtype);
|
589
|
+
}
|
590
|
+
break;
|
591
|
+
case GI_INFO_TYPE_FLAGS:
|
592
|
+
if (gtype == G_TYPE_NONE) {
|
593
|
+
argument->v_int32 = NUM2INT(rb_argument);
|
594
|
+
} else {
|
595
|
+
argument->v_int32 = RVAL2GFLAGS(rb_argument, gtype);
|
596
|
+
}
|
597
|
+
break;
|
598
|
+
case GI_INFO_TYPE_OBJECT:
|
599
|
+
case GI_INFO_TYPE_INTERFACE:
|
600
|
+
argument->v_pointer = RVAL2GOBJ(rb_argument);
|
601
|
+
break;
|
602
|
+
case GI_INFO_TYPE_CONSTANT:
|
603
|
+
rb_raise(rb_eNotImpError,
|
604
|
+
"TODO: Ruby -> GIArgument(interface)[%s]: <%s>",
|
605
|
+
g_info_type_to_string(interface_type),
|
606
|
+
g_base_info_get_name(interface_info));
|
607
|
+
break;
|
608
|
+
case GI_INFO_TYPE_INVALID_0:
|
609
|
+
g_assert_not_reached();
|
610
|
+
break;
|
611
|
+
case GI_INFO_TYPE_UNION:
|
612
|
+
case GI_INFO_TYPE_VALUE:
|
613
|
+
case GI_INFO_TYPE_SIGNAL:
|
614
|
+
case GI_INFO_TYPE_VFUNC:
|
615
|
+
case GI_INFO_TYPE_PROPERTY:
|
616
|
+
case GI_INFO_TYPE_FIELD:
|
617
|
+
case GI_INFO_TYPE_ARG:
|
618
|
+
case GI_INFO_TYPE_TYPE:
|
619
|
+
case GI_INFO_TYPE_UNRESOLVED:
|
620
|
+
default:
|
621
|
+
rb_raise(rb_eNotImpError,
|
622
|
+
"TODO: Ruby -> GIArgument(interface)[%s]: <%s>",
|
623
|
+
g_info_type_to_string(interface_type),
|
624
|
+
g_base_info_get_name(interface_info));
|
625
|
+
break;
|
626
|
+
}
|
627
|
+
|
628
|
+
g_base_info_unref(interface_info);
|
629
|
+
}
|
630
|
+
|
631
|
+
|
632
|
+
GIArgument *
|
633
|
+
rb_gi_in_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
634
|
+
VALUE rb_argument)
|
635
|
+
{
|
636
|
+
GITypeTag type_tag;
|
637
|
+
|
638
|
+
memset(argument, 0, sizeof(GIArgument));
|
639
|
+
|
640
|
+
type_tag = g_type_info_get_tag(type_info);
|
641
|
+
switch (type_tag) {
|
642
|
+
case GI_TYPE_TAG_VOID:
|
643
|
+
break;
|
644
|
+
case GI_TYPE_TAG_BOOLEAN:
|
645
|
+
argument->v_boolean = RVAL2CBOOL(rb_argument);
|
646
|
+
break;
|
647
|
+
case GI_TYPE_TAG_INT8:
|
648
|
+
argument->v_int8 = NUM2INT(rb_argument);
|
649
|
+
break;
|
650
|
+
case GI_TYPE_TAG_UINT8:
|
651
|
+
argument->v_uint8 = NUM2UINT(rb_argument);
|
652
|
+
break;
|
653
|
+
case GI_TYPE_TAG_INT16:
|
654
|
+
argument->v_int16 = NUM2INT(rb_argument);
|
655
|
+
break;
|
656
|
+
case GI_TYPE_TAG_UINT16:
|
657
|
+
argument->v_uint16 = NUM2UINT(rb_argument);
|
658
|
+
break;
|
659
|
+
case GI_TYPE_TAG_INT32:
|
660
|
+
argument->v_int32 = NUM2INT(rb_argument);
|
661
|
+
break;
|
662
|
+
case GI_TYPE_TAG_UINT32:
|
663
|
+
argument->v_uint32 = NUM2UINT(rb_argument);
|
664
|
+
break;
|
665
|
+
case GI_TYPE_TAG_INT64:
|
666
|
+
argument->v_int64 = NUM2LONG(rb_argument);
|
667
|
+
break;
|
668
|
+
case GI_TYPE_TAG_UINT64:
|
669
|
+
argument->v_uint64 = NUM2ULONG(rb_argument);
|
670
|
+
break;
|
671
|
+
case GI_TYPE_TAG_FLOAT:
|
672
|
+
argument->v_float = NUM2DBL(rb_argument);
|
673
|
+
break;
|
674
|
+
case GI_TYPE_TAG_DOUBLE:
|
675
|
+
argument->v_double = NUM2DBL(rb_argument);
|
676
|
+
break;
|
677
|
+
case GI_TYPE_TAG_GTYPE:
|
678
|
+
/* TODO: support GLib::Type and String as GType name. */
|
679
|
+
argument->v_size = NUM2ULONG(rb_argument);
|
680
|
+
break;
|
681
|
+
case GI_TYPE_TAG_UTF8:
|
682
|
+
/* TODO: support UTF-8 convert like rb_argument.encode("UTF-8"). */
|
683
|
+
argument->v_string = (gchar *)RVAL2CSTR(rb_argument);
|
684
|
+
break;
|
685
|
+
case GI_TYPE_TAG_FILENAME:
|
686
|
+
argument->v_string = (gchar *)RVAL2CSTR(rb_argument);
|
687
|
+
break;
|
688
|
+
case GI_TYPE_TAG_ARRAY:
|
689
|
+
rb_gi_argument_from_ruby_array(argument, type_info, rb_argument);
|
690
|
+
break;
|
691
|
+
case GI_TYPE_TAG_INTERFACE:
|
692
|
+
rb_gi_argument_from_ruby_interface(argument, type_info, rb_argument);
|
693
|
+
break;
|
694
|
+
case GI_TYPE_TAG_GLIST:
|
695
|
+
case GI_TYPE_TAG_GSLIST:
|
696
|
+
case GI_TYPE_TAG_GHASH:
|
697
|
+
case GI_TYPE_TAG_ERROR:
|
698
|
+
case GI_TYPE_TAG_UNICHAR:
|
699
|
+
rb_raise(rb_eNotImpError,
|
700
|
+
"TODO: Ruby -> GIArgument(%s)",
|
701
|
+
g_type_tag_to_string(type_tag));
|
702
|
+
break;
|
703
|
+
default:
|
704
|
+
g_assert_not_reached();
|
705
|
+
break;
|
706
|
+
}
|
707
|
+
|
708
|
+
return argument;
|
709
|
+
}
|
710
|
+
|
711
|
+
static void
|
712
|
+
rb_gi_inout_argument_from_ruby(GIArgument *argument,
|
713
|
+
G_GNUC_UNUSED GIArgInfo *arg_info,
|
714
|
+
GITypeInfo *type_info, VALUE rb_argument)
|
715
|
+
{
|
716
|
+
GIArgument in_argument;
|
717
|
+
GITypeTag type_tag;
|
718
|
+
|
719
|
+
rb_gi_in_argument_from_ruby(&in_argument, type_info, rb_argument);
|
720
|
+
|
721
|
+
type_tag = g_type_info_get_tag(type_info);
|
722
|
+
switch (type_tag) {
|
723
|
+
case GI_TYPE_TAG_VOID:
|
724
|
+
break;
|
725
|
+
case GI_TYPE_TAG_BOOLEAN:
|
726
|
+
argument->v_pointer = ALLOC(gboolean);
|
727
|
+
*((gboolean *)argument->v_pointer) = in_argument.v_boolean;
|
728
|
+
break;
|
729
|
+
case GI_TYPE_TAG_INT8:
|
730
|
+
argument->v_pointer = ALLOC(gint8);
|
731
|
+
*((gint8 *)argument->v_pointer) = in_argument.v_int8;
|
732
|
+
break;
|
733
|
+
case GI_TYPE_TAG_UINT8:
|
734
|
+
argument->v_pointer = ALLOC(guint8);
|
735
|
+
*((guint8 *)argument->v_pointer) = in_argument.v_uint8;
|
736
|
+
break;
|
737
|
+
case GI_TYPE_TAG_INT16:
|
738
|
+
argument->v_pointer = ALLOC(gint16);
|
739
|
+
*((gint16 *)argument->v_pointer) = in_argument.v_int16;
|
740
|
+
break;
|
741
|
+
case GI_TYPE_TAG_UINT16:
|
742
|
+
argument->v_pointer = ALLOC(guint16);
|
743
|
+
*((guint16 *)argument->v_pointer) = in_argument.v_uint16;
|
744
|
+
break;
|
745
|
+
case GI_TYPE_TAG_INT32:
|
746
|
+
argument->v_pointer = ALLOC(gint32);
|
747
|
+
*((gint32 *)argument->v_pointer) = in_argument.v_int32;
|
748
|
+
break;
|
749
|
+
case GI_TYPE_TAG_UINT32:
|
750
|
+
argument->v_pointer = ALLOC(guint32);
|
751
|
+
*((guint32 *)argument->v_pointer) = in_argument.v_uint32;
|
752
|
+
break;
|
753
|
+
case GI_TYPE_TAG_INT64:
|
754
|
+
argument->v_pointer = ALLOC(gint64);
|
755
|
+
*((gint64 *)argument->v_pointer) = in_argument.v_int64;
|
756
|
+
break;
|
757
|
+
case GI_TYPE_TAG_UINT64:
|
758
|
+
argument->v_pointer = ALLOC(guint64);
|
759
|
+
*((guint64 *)argument->v_pointer) = in_argument.v_uint64;
|
760
|
+
break;
|
761
|
+
case GI_TYPE_TAG_FLOAT:
|
762
|
+
argument->v_pointer = ALLOC(gfloat);
|
763
|
+
*((gfloat *)argument->v_pointer) = in_argument.v_float;
|
764
|
+
break;
|
765
|
+
case GI_TYPE_TAG_DOUBLE:
|
766
|
+
argument->v_pointer = ALLOC(gdouble);
|
767
|
+
*((gdouble *)argument->v_pointer) = in_argument.v_double;
|
768
|
+
break;
|
769
|
+
case GI_TYPE_TAG_GTYPE:
|
770
|
+
argument->v_pointer = ALLOC(gsize);
|
771
|
+
*((gsize *)argument->v_pointer) = in_argument.v_size;
|
772
|
+
break;
|
773
|
+
case GI_TYPE_TAG_UTF8:
|
774
|
+
case GI_TYPE_TAG_FILENAME:
|
775
|
+
argument->v_pointer = ALLOC(gchar *);
|
776
|
+
*((gchar **)argument->v_pointer) = in_argument.v_string;
|
777
|
+
break;
|
778
|
+
case GI_TYPE_TAG_ARRAY:
|
779
|
+
case GI_TYPE_TAG_INTERFACE:
|
780
|
+
case GI_TYPE_TAG_GLIST:
|
781
|
+
case GI_TYPE_TAG_GSLIST:
|
782
|
+
case GI_TYPE_TAG_GHASH:
|
783
|
+
argument->v_pointer = ALLOC(gpointer);
|
784
|
+
*((gpointer *)argument->v_pointer) = in_argument.v_pointer;
|
785
|
+
break;
|
786
|
+
case GI_TYPE_TAG_ERROR:
|
787
|
+
argument->v_pointer = ALLOC(GError *);
|
788
|
+
*((GError **)argument->v_pointer) = in_argument.v_pointer;
|
789
|
+
break;
|
790
|
+
case GI_TYPE_TAG_UNICHAR:
|
791
|
+
argument->v_pointer = ALLOC(gunichar);
|
792
|
+
*((gunichar *)argument->v_pointer) = in_argument.v_uint32;
|
793
|
+
break;
|
794
|
+
default:
|
795
|
+
g_assert_not_reached();
|
796
|
+
break;
|
797
|
+
}
|
798
|
+
}
|
799
|
+
|
800
|
+
GIArgument *
|
801
|
+
rb_gi_call_argument_from_ruby(GIArgument *argument, GIArgInfo *arg_info,
|
802
|
+
VALUE rb_argument)
|
803
|
+
{
|
804
|
+
GITypeInfo type_info;
|
805
|
+
|
806
|
+
if (g_arg_info_may_be_null(arg_info) && NIL_P(rb_argument)) {
|
807
|
+
memset(argument, 0, sizeof(GIArgument));
|
808
|
+
return argument;
|
809
|
+
}
|
810
|
+
|
811
|
+
g_arg_info_load_type(arg_info, &type_info);
|
812
|
+
if (g_arg_info_get_direction(arg_info) == GI_DIRECTION_INOUT) {
|
813
|
+
rb_gi_inout_argument_from_ruby(argument, arg_info, &type_info,
|
814
|
+
rb_argument);
|
815
|
+
} else {
|
816
|
+
rb_gi_in_argument_from_ruby(argument, &type_info, rb_argument);
|
817
|
+
}
|
818
|
+
|
819
|
+
return argument;
|
820
|
+
}
|
821
|
+
|
822
|
+
static void
|
823
|
+
rb_gi_in_argument_free_array(GIArgument *argument, GITypeInfo *type_info)
|
824
|
+
{
|
825
|
+
GIArrayType array_type;
|
826
|
+
|
827
|
+
array_type = g_type_info_get_array_type(type_info);
|
828
|
+
switch (array_type) {
|
829
|
+
case GI_ARRAY_TYPE_C:
|
830
|
+
g_free(argument->v_pointer);
|
831
|
+
break;
|
832
|
+
case GI_ARRAY_TYPE_ARRAY:
|
833
|
+
case GI_ARRAY_TYPE_PTR_ARRAY:
|
834
|
+
case GI_ARRAY_TYPE_BYTE_ARRAY:
|
835
|
+
break;
|
836
|
+
default:
|
837
|
+
g_assert_not_reached();
|
838
|
+
break;
|
839
|
+
}
|
840
|
+
}
|
841
|
+
|
842
|
+
static void
|
843
|
+
rb_gi_in_argument_free_interface(GIArgument *argument, GITypeInfo *type_info)
|
844
|
+
{
|
845
|
+
GIBaseInfo *interface_info;
|
846
|
+
GIInfoType interface_type;
|
847
|
+
|
848
|
+
interface_info = g_type_info_get_interface(type_info);
|
849
|
+
interface_type = g_base_info_get_type(interface_info);
|
850
|
+
|
851
|
+
if (interface_type == GI_INFO_TYPE_STRUCT) {
|
852
|
+
GType gtype;
|
853
|
+
gtype = g_registered_type_info_get_g_type(interface_info);
|
854
|
+
|
855
|
+
if (gtype == G_TYPE_VALUE) {
|
856
|
+
GValue *gvalue = argument->v_pointer;
|
857
|
+
g_value_unset(gvalue);
|
858
|
+
xfree(argument->v_pointer);
|
859
|
+
}
|
860
|
+
}
|
861
|
+
|
862
|
+
g_base_info_unref(interface_info);
|
863
|
+
}
|
864
|
+
|
865
|
+
void
|
866
|
+
rb_gi_in_argument_free(GIArgument *argument, GITypeInfo *type_info)
|
867
|
+
{
|
868
|
+
GITypeTag type_tag;
|
869
|
+
|
870
|
+
type_tag = g_type_info_get_tag(type_info);
|
871
|
+
switch (type_tag) {
|
872
|
+
case GI_TYPE_TAG_VOID:
|
873
|
+
case GI_TYPE_TAG_BOOLEAN:
|
874
|
+
case GI_TYPE_TAG_INT8:
|
875
|
+
case GI_TYPE_TAG_UINT8:
|
876
|
+
case GI_TYPE_TAG_INT16:
|
877
|
+
case GI_TYPE_TAG_UINT16:
|
878
|
+
case GI_TYPE_TAG_INT32:
|
879
|
+
case GI_TYPE_TAG_UINT32:
|
880
|
+
case GI_TYPE_TAG_INT64:
|
881
|
+
case GI_TYPE_TAG_UINT64:
|
882
|
+
case GI_TYPE_TAG_FLOAT:
|
883
|
+
case GI_TYPE_TAG_DOUBLE:
|
884
|
+
case GI_TYPE_TAG_GTYPE:
|
885
|
+
case GI_TYPE_TAG_UTF8:
|
886
|
+
case GI_TYPE_TAG_FILENAME:
|
887
|
+
break;
|
888
|
+
case GI_TYPE_TAG_ARRAY:
|
889
|
+
rb_gi_in_argument_free_array(argument, type_info);
|
890
|
+
break;
|
891
|
+
case GI_TYPE_TAG_INTERFACE:
|
892
|
+
rb_gi_in_argument_free_interface(argument, type_info);
|
893
|
+
break;
|
894
|
+
case GI_TYPE_TAG_GLIST:
|
895
|
+
case GI_TYPE_TAG_GSLIST:
|
896
|
+
case GI_TYPE_TAG_GHASH:
|
897
|
+
case GI_TYPE_TAG_ERROR:
|
898
|
+
case GI_TYPE_TAG_UNICHAR:
|
899
|
+
break;
|
900
|
+
default:
|
901
|
+
g_assert_not_reached();
|
902
|
+
break;
|
903
|
+
}
|
904
|
+
}
|
905
|
+
|
906
|
+
static void
|
907
|
+
rb_gi_inout_argument_free(GIArgument *argument, GITypeInfo *type_info)
|
908
|
+
{
|
909
|
+
GIArgument in_argument;
|
910
|
+
GITypeTag type_tag;
|
911
|
+
|
912
|
+
memset(&in_argument, 0, sizeof(GIArgument));
|
913
|
+
type_tag = g_type_info_get_tag(type_info);
|
914
|
+
switch (type_tag) {
|
915
|
+
case GI_TYPE_TAG_VOID:
|
916
|
+
break;
|
917
|
+
case GI_TYPE_TAG_BOOLEAN:
|
918
|
+
in_argument.v_boolean = *((gboolean *)(argument->v_pointer));
|
919
|
+
break;
|
920
|
+
case GI_TYPE_TAG_INT8:
|
921
|
+
in_argument.v_int8 = *((gint8 *)(argument->v_pointer));
|
922
|
+
break;
|
923
|
+
case GI_TYPE_TAG_UINT8:
|
924
|
+
/* TODO!!! */
|
925
|
+
in_argument.v_uint8 = *((guint8 *)(argument->v_pointer));
|
926
|
+
argument->v_pointer = ALLOC(guint8);
|
927
|
+
*((guint8 *)argument->v_pointer) = in_argument.v_uint8;
|
928
|
+
break;
|
929
|
+
case GI_TYPE_TAG_INT16:
|
930
|
+
in_argument.v_int16 = *((gint16 *)(argument->v_pointer));
|
931
|
+
argument->v_pointer = ALLOC(gint16);
|
932
|
+
*((gint16 *)argument->v_pointer) = in_argument.v_int16;
|
933
|
+
break;
|
934
|
+
case GI_TYPE_TAG_UINT16:
|
935
|
+
in_argument.v_uint16 = *((guint16 *)(argument->v_pointer));
|
936
|
+
argument->v_pointer = ALLOC(guint16);
|
937
|
+
*((guint16 *)argument->v_pointer) = in_argument.v_uint16;
|
938
|
+
break;
|
939
|
+
case GI_TYPE_TAG_INT32:
|
940
|
+
in_argument.v_int32 = *((gint32 *)(argument->v_pointer));
|
941
|
+
argument->v_pointer = ALLOC(gint32);
|
942
|
+
*((gint32 *)argument->v_pointer) = in_argument.v_int32;
|
943
|
+
break;
|
944
|
+
case GI_TYPE_TAG_UINT32:
|
945
|
+
in_argument.v_uint32 = *((guint32 *)(argument->v_pointer));
|
946
|
+
argument->v_pointer = ALLOC(guint32);
|
947
|
+
*((guint32 *)argument->v_pointer) = in_argument.v_uint32;
|
948
|
+
break;
|
949
|
+
case GI_TYPE_TAG_INT64:
|
950
|
+
in_argument.v_int64 = *((gint64 *)(argument->v_pointer));
|
951
|
+
argument->v_pointer = ALLOC(gint64);
|
952
|
+
*((gint64 *)argument->v_pointer) = in_argument.v_int64;
|
953
|
+
break;
|
954
|
+
case GI_TYPE_TAG_UINT64:
|
955
|
+
in_argument.v_uint64 = *((guint64 *)(argument->v_pointer));
|
956
|
+
argument->v_pointer = ALLOC(guint64);
|
957
|
+
*((guint64 *)argument->v_pointer) = in_argument.v_uint64;
|
958
|
+
break;
|
959
|
+
case GI_TYPE_TAG_FLOAT:
|
960
|
+
in_argument.v_float = *((gfloat *)(argument->v_pointer));
|
961
|
+
argument->v_pointer = ALLOC(gfloat);
|
962
|
+
*((gfloat *)argument->v_pointer) = in_argument.v_float;
|
963
|
+
break;
|
964
|
+
case GI_TYPE_TAG_DOUBLE:
|
965
|
+
in_argument.v_double = *((gdouble *)(argument->v_pointer));
|
966
|
+
argument->v_pointer = ALLOC(gdouble);
|
967
|
+
*((gdouble *)argument->v_pointer) = in_argument.v_double;
|
968
|
+
break;
|
969
|
+
case GI_TYPE_TAG_GTYPE:
|
970
|
+
in_argument.v_size = *((gsize *)(argument->v_pointer));
|
971
|
+
break;
|
972
|
+
case GI_TYPE_TAG_UTF8:
|
973
|
+
case GI_TYPE_TAG_FILENAME:
|
974
|
+
in_argument.v_string = *((gchar **)(argument->v_pointer));
|
975
|
+
break;
|
976
|
+
case GI_TYPE_TAG_ARRAY:
|
977
|
+
case GI_TYPE_TAG_INTERFACE:
|
978
|
+
case GI_TYPE_TAG_GLIST:
|
979
|
+
case GI_TYPE_TAG_GSLIST:
|
980
|
+
case GI_TYPE_TAG_GHASH:
|
981
|
+
in_argument.v_pointer = *((gpointer *)(argument->v_pointer));
|
982
|
+
break;
|
983
|
+
case GI_TYPE_TAG_ERROR:
|
984
|
+
in_argument.v_pointer = *((GError **)(argument->v_pointer));
|
985
|
+
break;
|
986
|
+
case GI_TYPE_TAG_UNICHAR:
|
987
|
+
in_argument.v_uint32 = *((gunichar *)(argument->v_pointer));
|
988
|
+
break;
|
989
|
+
default:
|
990
|
+
g_assert_not_reached();
|
991
|
+
break;
|
992
|
+
}
|
993
|
+
|
994
|
+
rb_gi_in_argument_free(&in_argument, type_info);
|
995
|
+
xfree(argument->v_pointer);
|
996
|
+
}
|
997
|
+
|
998
|
+
void
|
999
|
+
rb_gi_call_argument_free(GIArgument *argument, GIArgInfo *arg_info)
|
1000
|
+
{
|
1001
|
+
GITypeInfo type_info;
|
1002
|
+
|
1003
|
+
g_arg_info_load_type(arg_info, &type_info);
|
1004
|
+
if (g_arg_info_get_direction(arg_info) == GI_DIRECTION_INOUT) {
|
1005
|
+
rb_gi_inout_argument_free(argument, &type_info);
|
1006
|
+
} else {
|
1007
|
+
rb_gi_in_argument_free(argument, &type_info);
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
void
|
1012
|
+
rb_gi_argument_init(void)
|
1013
|
+
{
|
1014
|
+
rb_cGLibValue = rb_const_get(mGLib, rb_intern("Value"));
|
1015
|
+
}
|