gobject-introspection 3.0.7-x86-mingw32 → 3.0.8-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/ext/gobject-introspection/extconf.rb +1 -0
- data/ext/gobject-introspection/rb-gi-argument.c +123 -26
- data/ext/gobject-introspection/rb-gi-function-info.c +558 -19
- data/ext/gobject-introspection/rb-gi-repository.c +9 -0
- data/ext/gobject-introspection/rb-gobject-introspection.h +3 -0
- data/lib/2.2/gobject_introspection.so +0 -0
- data/lib/2.3/gobject_introspection.so +0 -0
- data/lib/gobject-introspection/loader.rb +1 -1
- 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/gistructinfo.h +4 -0
- data/vendor/local/lib/girepository-1.0/GIRepository-2.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/gobject-introspection/giscanner/__init__.py +1 -1
- 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 +39 -11
- 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 +187 -164
- 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 +191 -58
- 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 +42 -54
- 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/ccompiler.py +272 -82
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +18 -11
- 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/collections/__init__.py +4 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.py +25 -13
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +21 -19
- 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/docwriter.py +19 -16
- 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 +148 -158
- 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 +31 -21
- 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 +13 -5
- 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 +12 -13
- 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 +5 -1
- 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 +11 -9
- 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 +150 -45
- 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 +56 -19
- 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/msvccompiler.py +101 -0
- data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +41 -22
- 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 +6 -1
- 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 +8 -2
- 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 +42 -56
- 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 +19 -5
- 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 +73 -37
- 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 +92 -14
- 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 +30 -11
- 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 +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
- data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
- data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +57 -13
- data/vendor/local/share/gir-1.0/GLib-2.0.gir +2018 -894
- data/vendor/local/share/gir-1.0/GModule-2.0.gir +2 -1
- data/vendor/local/share/gir-1.0/GObject-2.0.gir +1107 -674
- data/vendor/local/share/gir-1.0/Gio-2.0.gir +5589 -1287
- data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +4 -2
- data/vendor/local/share/gobject-introspection-1.0/gdump.c +8 -0
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +273 -323
- data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +58 -38
- data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +1 -1
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +177 -23
- data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +40 -0
- data/vendor/local/share/man/man1/g-ir-compiler.1 +7 -7
- metadata +9 -7
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/2.1/gobject_introspection.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a2a6696bfb8359349560011842d8ceeb5fb2dc
|
4
|
+
data.tar.gz: 4bae718ad6d24f29c53c8cb29f0ea331529b459a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f67f6f0e6524acce4db762190a6a74a31ac9c42951dd025aab059626b4bff4f8affc60eab4b23daf92d8c483cad59e95ad440a02a1de8bf6be0273d81ddd1250
|
7
|
+
data.tar.gz: f0786e74f7906a734da66310f0710e0a0e675c5245848676026c7b55f54b2f90a61644565024c08ea66a8a87eb2b8cf839292508d4f31fdf54f807553cb05abe
|
data/Rakefile
CHANGED
@@ -32,7 +32,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
32
32
|
:name => "glib",
|
33
33
|
:download_site => :gnome,
|
34
34
|
:label => "GLib",
|
35
|
-
:version => "2.
|
35
|
+
:version => "2.48.0",
|
36
36
|
:compression_method => "xz",
|
37
37
|
:windows => {
|
38
38
|
:build => false,
|
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
47
47
|
:name => "gobject-introspection",
|
48
48
|
:download_site => :gnome,
|
49
49
|
:label => "gobject-introspection",
|
50
|
-
:version => "1.
|
50
|
+
:version => "1.48.0",
|
51
51
|
:compression_method => "xz",
|
52
52
|
:windows => {
|
53
53
|
:configure_args => [
|
@@ -57,6 +57,7 @@ end
|
|
57
57
|
setup_windows(module_name, base_dir)
|
58
58
|
|
59
59
|
unless required_pkg_config_package(package_id,
|
60
|
+
:altlinux => "gobject-introspection-devel",
|
60
61
|
:debian => "libgirepository1.0-dev",
|
61
62
|
:redhat => "gobject-introspection-devel",
|
62
63
|
:homebrew => "gobject-introspection",
|
@@ -559,9 +559,9 @@ interface_variant_to_ruby(GVariant *variant)
|
|
559
559
|
}
|
560
560
|
|
561
561
|
static VALUE
|
562
|
-
|
563
|
-
|
564
|
-
|
562
|
+
rb_gi_argument_to_ruby_interface(GIArgument *argument,
|
563
|
+
gboolean duplicate,
|
564
|
+
GITypeInfo *type_info)
|
565
565
|
{
|
566
566
|
VALUE rb_interface;
|
567
567
|
GIBaseInfo *interface_info;
|
@@ -1098,7 +1098,9 @@ rb_gi_argument_to_ruby(GIArgument *argument,
|
|
1098
1098
|
args_metadata);
|
1099
1099
|
break;
|
1100
1100
|
case GI_TYPE_TAG_INTERFACE:
|
1101
|
-
rb_argument =
|
1101
|
+
rb_argument = rb_gi_argument_to_ruby_interface(argument,
|
1102
|
+
duplicate,
|
1103
|
+
type_info);
|
1102
1104
|
break;
|
1103
1105
|
case GI_TYPE_TAG_GLIST:
|
1104
1106
|
rb_argument = rb_gi_argument_to_ruby_glist(argument, type_info);
|
@@ -1298,16 +1300,20 @@ rb_gi_out_argument_init_array(GIArgument *argument, GIArgInfo *arg_info,
|
|
1298
1300
|
}
|
1299
1301
|
|
1300
1302
|
static void
|
1301
|
-
rb_gi_out_argument_init_interface(GIArgument *argument,
|
1303
|
+
rb_gi_out_argument_init_interface(GIArgument *argument,
|
1304
|
+
G_GNUC_UNUSED GIArgInfo *arg_info,
|
1302
1305
|
GITypeInfo *type_info)
|
1303
1306
|
{
|
1304
1307
|
GIBaseInfo *interface_info;
|
1305
1308
|
GIInfoType interface_type;
|
1306
1309
|
|
1310
|
+
/* TODO: Can we use the following code? */
|
1311
|
+
/*
|
1307
1312
|
if (!g_arg_info_is_caller_allocates(arg_info)) {
|
1308
1313
|
argument->v_pointer = ALLOC(gpointer);
|
1309
1314
|
return;
|
1310
1315
|
}
|
1316
|
+
*/
|
1311
1317
|
|
1312
1318
|
interface_info = g_type_info_get_interface(type_info);
|
1313
1319
|
interface_type = g_base_info_get_type(interface_info);
|
@@ -1330,10 +1336,32 @@ rb_gi_out_argument_init_interface(GIArgument *argument, GIArgInfo *arg_info,
|
|
1330
1336
|
}
|
1331
1337
|
break;
|
1332
1338
|
case GI_INFO_TYPE_BOXED:
|
1339
|
+
rb_raise(rb_eNotImpError,
|
1340
|
+
"TODO: allocates GIArgument(interface)[%s] for output",
|
1341
|
+
g_info_type_to_string(interface_type));
|
1342
|
+
break;
|
1333
1343
|
case GI_INFO_TYPE_ENUM:
|
1344
|
+
{
|
1345
|
+
gint *pointer = ALLOC(gint);
|
1346
|
+
*pointer = 0;
|
1347
|
+
argument->v_pointer = pointer;
|
1348
|
+
}
|
1349
|
+
break;
|
1334
1350
|
case GI_INFO_TYPE_FLAGS:
|
1351
|
+
{
|
1352
|
+
guint *pointer = ALLOC(guint);
|
1353
|
+
*pointer = 0;
|
1354
|
+
argument->v_pointer = pointer;
|
1355
|
+
}
|
1356
|
+
break;
|
1335
1357
|
case GI_INFO_TYPE_OBJECT:
|
1336
1358
|
case GI_INFO_TYPE_INTERFACE:
|
1359
|
+
{
|
1360
|
+
gpointer *pointer = ALLOC(gpointer);
|
1361
|
+
*pointer = NULL;
|
1362
|
+
argument->v_pointer = pointer;
|
1363
|
+
}
|
1364
|
+
break;
|
1337
1365
|
case GI_INFO_TYPE_CONSTANT:
|
1338
1366
|
case GI_INFO_TYPE_INVALID_0:
|
1339
1367
|
case GI_INFO_TYPE_UNION:
|
@@ -1370,48 +1398,102 @@ rb_gi_out_argument_init(GIArgument *argument, GIArgInfo *arg_info)
|
|
1370
1398
|
switch (type_tag) {
|
1371
1399
|
case GI_TYPE_TAG_VOID:
|
1372
1400
|
if (g_type_info_is_pointer(&type_info)) {
|
1373
|
-
|
1401
|
+
gpointer *pointer = ALLOC(gpointer);
|
1402
|
+
*pointer = NULL;
|
1403
|
+
argument->v_pointer = pointer;
|
1374
1404
|
}
|
1375
1405
|
break;
|
1376
1406
|
case GI_TYPE_TAG_BOOLEAN:
|
1377
|
-
|
1407
|
+
{
|
1408
|
+
gboolean *pointer = ALLOC(gboolean);
|
1409
|
+
*pointer = FALSE;
|
1410
|
+
argument->v_pointer = pointer;
|
1411
|
+
}
|
1378
1412
|
break;
|
1379
1413
|
case GI_TYPE_TAG_INT8:
|
1380
|
-
|
1414
|
+
{
|
1415
|
+
gint8 *pointer = ALLOC(gint8);
|
1416
|
+
*pointer = 0;
|
1417
|
+
argument->v_pointer = pointer;
|
1418
|
+
}
|
1381
1419
|
break;
|
1382
1420
|
case GI_TYPE_TAG_UINT8:
|
1383
|
-
|
1421
|
+
{
|
1422
|
+
guint8 *pointer = ALLOC(guint8);
|
1423
|
+
*pointer = 0;
|
1424
|
+
argument->v_pointer = pointer;
|
1425
|
+
}
|
1384
1426
|
break;
|
1385
1427
|
case GI_TYPE_TAG_INT16:
|
1386
|
-
|
1428
|
+
{
|
1429
|
+
gint16 *pointer = ALLOC(gint16);
|
1430
|
+
*pointer = 0;
|
1431
|
+
argument->v_pointer = pointer;
|
1432
|
+
}
|
1387
1433
|
break;
|
1388
1434
|
case GI_TYPE_TAG_UINT16:
|
1389
|
-
|
1435
|
+
{
|
1436
|
+
guint16 *pointer = ALLOC(guint16);
|
1437
|
+
*pointer = 0;
|
1438
|
+
argument->v_pointer = pointer;
|
1439
|
+
}
|
1390
1440
|
break;
|
1391
1441
|
case GI_TYPE_TAG_INT32:
|
1392
|
-
|
1442
|
+
{
|
1443
|
+
gint32 *pointer = ALLOC(gint32);
|
1444
|
+
*pointer = 0;
|
1445
|
+
argument->v_pointer = pointer;
|
1446
|
+
}
|
1393
1447
|
break;
|
1394
1448
|
case GI_TYPE_TAG_UINT32:
|
1395
|
-
|
1449
|
+
{
|
1450
|
+
guint32 *pointer = ALLOC(guint32);
|
1451
|
+
*pointer = 0;
|
1452
|
+
argument->v_pointer = pointer;
|
1453
|
+
}
|
1396
1454
|
break;
|
1397
1455
|
case GI_TYPE_TAG_INT64:
|
1398
|
-
|
1456
|
+
{
|
1457
|
+
gint64 *pointer = ALLOC(gint64);
|
1458
|
+
*pointer = 0;
|
1459
|
+
argument->v_pointer = pointer;
|
1460
|
+
}
|
1399
1461
|
break;
|
1400
1462
|
case GI_TYPE_TAG_UINT64:
|
1401
|
-
|
1463
|
+
{
|
1464
|
+
guint64 *pointer = ALLOC(guint64);
|
1465
|
+
*pointer = 0;
|
1466
|
+
argument->v_pointer = pointer;
|
1467
|
+
}
|
1402
1468
|
break;
|
1403
1469
|
case GI_TYPE_TAG_FLOAT:
|
1404
|
-
|
1470
|
+
{
|
1471
|
+
gfloat *pointer = ALLOC(gfloat);
|
1472
|
+
*pointer = 0.0;
|
1473
|
+
argument->v_pointer = pointer;
|
1474
|
+
}
|
1405
1475
|
break;
|
1406
1476
|
case GI_TYPE_TAG_DOUBLE:
|
1407
|
-
|
1477
|
+
{
|
1478
|
+
gdouble *pointer = ALLOC(gdouble);
|
1479
|
+
*pointer = 0.0;
|
1480
|
+
argument->v_pointer = pointer;
|
1481
|
+
}
|
1408
1482
|
break;
|
1409
1483
|
case GI_TYPE_TAG_GTYPE:
|
1410
|
-
|
1484
|
+
{
|
1485
|
+
GType *pointer = ALLOC(GType);
|
1486
|
+
*pointer = G_TYPE_INVALID;
|
1487
|
+
argument->v_pointer = pointer;
|
1488
|
+
}
|
1411
1489
|
break;
|
1412
1490
|
case GI_TYPE_TAG_UTF8:
|
1413
1491
|
case GI_TYPE_TAG_FILENAME:
|
1414
|
-
|
1492
|
+
{
|
1493
|
+
gchar **pointer = ALLOC(gchar *);
|
1494
|
+
*pointer = NULL;
|
1495
|
+
argument->v_pointer = pointer;
|
1496
|
+
}
|
1415
1497
|
break;
|
1416
1498
|
case GI_TYPE_TAG_ARRAY:
|
1417
1499
|
rb_gi_out_argument_init_array(argument, arg_info, &type_info);
|
@@ -1422,14 +1504,25 @@ rb_gi_out_argument_init(GIArgument *argument, GIArgInfo *arg_info)
|
|
1422
1504
|
case GI_TYPE_TAG_GLIST:
|
1423
1505
|
case GI_TYPE_TAG_GSLIST:
|
1424
1506
|
case GI_TYPE_TAG_GHASH:
|
1425
|
-
|
1507
|
+
{
|
1508
|
+
gpointer *pointer = ALLOC(gpointer);
|
1509
|
+
*pointer = NULL;
|
1510
|
+
argument->v_pointer = pointer;
|
1511
|
+
}
|
1426
1512
|
break;
|
1427
1513
|
case GI_TYPE_TAG_ERROR:
|
1428
|
-
|
1429
|
-
|
1514
|
+
{
|
1515
|
+
GError **pointer = ALLOC(GError *);
|
1516
|
+
*pointer = NULL;
|
1517
|
+
argument->v_pointer = pointer;
|
1518
|
+
}
|
1430
1519
|
break;
|
1431
1520
|
case GI_TYPE_TAG_UNICHAR:
|
1432
|
-
|
1521
|
+
{
|
1522
|
+
gunichar *pointer = ALLOC(gunichar);
|
1523
|
+
*pointer = 0;
|
1524
|
+
argument->v_pointer = pointer;
|
1525
|
+
}
|
1433
1526
|
break;
|
1434
1527
|
default:
|
1435
1528
|
g_assert_not_reached();
|
@@ -1824,9 +1917,13 @@ rb_gi_return_argument_free_everything_interface(GIArgument *argument,
|
|
1824
1917
|
g_assert_not_reached();
|
1825
1918
|
break;
|
1826
1919
|
case GI_INFO_TYPE_UNION:
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1920
|
+
if (gtype == G_TYPE_NONE) {
|
1921
|
+
rb_raise(rb_eNotImpError,
|
1922
|
+
"TODO: free GIArgument(interface)[union] everything");
|
1923
|
+
} else {
|
1924
|
+
g_boxed_free(gtype, argument->v_pointer);
|
1925
|
+
}
|
1926
|
+
break;
|
1830
1927
|
case GI_INFO_TYPE_VALUE:
|
1831
1928
|
rb_raise(rb_eNotImpError,
|
1832
1929
|
"TODO: free GIArgument(interface)[value] everything");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2012-
|
3
|
+
* Copyright (C) 2012-2016 Ruby-GNOME2 Project Team
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -34,6 +34,14 @@
|
|
34
34
|
#define RG_TARGET_NAMESPACE rb_cGIFunctionInfo
|
35
35
|
#define SELF(self) RVAL2GI_FUNCTION_INFO(self)
|
36
36
|
|
37
|
+
typedef struct _RBGICallback {
|
38
|
+
GIArgInfo *arg_info;
|
39
|
+
GITypeInfo *type_info;
|
40
|
+
GICallbackInfo *callback_info;
|
41
|
+
ffi_cif cif;
|
42
|
+
ffi_closure *closure;
|
43
|
+
} RBGICallback;
|
44
|
+
|
37
45
|
static VALUE RG_TARGET_NAMESPACE;
|
38
46
|
static VALUE rb_cGLibError;
|
39
47
|
static const char *callbacks_key = "gi_callbacks";
|
@@ -148,9 +156,6 @@ fill_metadata_callback(GPtrArray *args_metadata)
|
|
148
156
|
gint destroy_index;
|
149
157
|
|
150
158
|
metadata = g_ptr_array_index(args_metadata, i);
|
151
|
-
if (!metadata->callback_p) {
|
152
|
-
continue;
|
153
|
-
}
|
154
159
|
|
155
160
|
arg_info = &(metadata->arg_info);
|
156
161
|
closure_index = g_arg_info_get_closure(arg_info);
|
@@ -274,9 +279,22 @@ callback_data_unguard_from_gc(RBGICallbackData *callback_data)
|
|
274
279
|
rb_hash_delete(rb_callbacks, callback_data->rb_gc_guard_key);
|
275
280
|
}
|
276
281
|
|
282
|
+
static void
|
283
|
+
rb_gi_callback_free(RBGICallback *callback)
|
284
|
+
{
|
285
|
+
g_callable_info_free_closure(callback->callback_info,
|
286
|
+
callback->closure);
|
287
|
+
g_base_info_unref(callback->callback_info);
|
288
|
+
g_base_info_unref(callback->type_info);
|
289
|
+
xfree(callback);
|
290
|
+
}
|
291
|
+
|
277
292
|
void
|
278
293
|
rb_gi_callback_data_free(RBGICallbackData *callback_data)
|
279
294
|
{
|
295
|
+
if (callback_data->callback) {
|
296
|
+
rb_gi_callback_free(callback_data->callback);
|
297
|
+
}
|
280
298
|
callback_data_unguard_from_gc(callback_data);
|
281
299
|
xfree(callback_data->metadata);
|
282
300
|
xfree(callback_data);
|
@@ -380,14 +398,535 @@ source_func_callback_finder(GIArgInfo *arg_info)
|
|
380
398
|
return source_func_callback;
|
381
399
|
}
|
382
400
|
|
401
|
+
static void arguments_init(GArray **in_args,
|
402
|
+
GArray **out_args,
|
403
|
+
GPtrArray **args_metadata);
|
404
|
+
static void arguments_free(VALUE rb_arguments,
|
405
|
+
GArray *in_args,
|
406
|
+
GArray *out_args,
|
407
|
+
GPtrArray *args_metadata);
|
408
|
+
|
409
|
+
static void
|
410
|
+
argument_from_raw_data_interface(GICallableInfo *callable_info,
|
411
|
+
void *raw_arg,
|
412
|
+
GIArgument *argument,
|
413
|
+
GITypeInfo *type_info)
|
414
|
+
{
|
415
|
+
GIBaseInfo *interface_info;
|
416
|
+
GIInfoType interface_type;
|
417
|
+
|
418
|
+
interface_info = g_type_info_get_interface(type_info);
|
419
|
+
interface_type = g_base_info_get_type(interface_info);
|
420
|
+
|
421
|
+
switch (interface_type) {
|
422
|
+
case GI_INFO_TYPE_INVALID:
|
423
|
+
case GI_INFO_TYPE_FUNCTION:
|
424
|
+
case GI_INFO_TYPE_CALLBACK:
|
425
|
+
rb_raise(rb_eNotImpError,
|
426
|
+
"TODO: %s::%s: raw data -> GIArgument(interface)[%s]: <%s>",
|
427
|
+
g_base_info_get_namespace(callable_info),
|
428
|
+
g_base_info_get_name(callable_info),
|
429
|
+
g_info_type_to_string(interface_type),
|
430
|
+
g_base_info_get_name(interface_info));
|
431
|
+
break;
|
432
|
+
case GI_INFO_TYPE_STRUCT:
|
433
|
+
argument->v_pointer = *((gpointer *)(raw_arg));
|
434
|
+
break;
|
435
|
+
case GI_INFO_TYPE_BOXED:
|
436
|
+
case GI_INFO_TYPE_ENUM:
|
437
|
+
rb_raise(rb_eNotImpError,
|
438
|
+
"TODO: %s::%s: raw data -> GIArgument(interface)[%s]: <%s>",
|
439
|
+
g_base_info_get_namespace(callable_info),
|
440
|
+
g_base_info_get_name(callable_info),
|
441
|
+
g_info_type_to_string(interface_type),
|
442
|
+
g_base_info_get_name(interface_info));
|
443
|
+
break;
|
444
|
+
case GI_INFO_TYPE_FLAGS:
|
445
|
+
argument->v_int32= *((gint32 *)(raw_arg));
|
446
|
+
break;
|
447
|
+
case GI_INFO_TYPE_OBJECT:
|
448
|
+
case GI_INFO_TYPE_INTERFACE:
|
449
|
+
argument->v_pointer = *((gpointer *)(raw_arg));
|
450
|
+
break;
|
451
|
+
case GI_INFO_TYPE_CONSTANT:
|
452
|
+
rb_raise(rb_eNotImpError,
|
453
|
+
"TODO: %s::%s: raw data -> GIArgument(interface)[%s]: <%s>",
|
454
|
+
g_base_info_get_namespace(callable_info),
|
455
|
+
g_base_info_get_name(callable_info),
|
456
|
+
g_info_type_to_string(interface_type),
|
457
|
+
g_base_info_get_name(interface_info));
|
458
|
+
break;
|
459
|
+
case GI_INFO_TYPE_INVALID_0:
|
460
|
+
g_assert_not_reached();
|
461
|
+
break;
|
462
|
+
case GI_INFO_TYPE_UNION:
|
463
|
+
case GI_INFO_TYPE_VALUE:
|
464
|
+
case GI_INFO_TYPE_SIGNAL:
|
465
|
+
case GI_INFO_TYPE_VFUNC:
|
466
|
+
case GI_INFO_TYPE_PROPERTY:
|
467
|
+
case GI_INFO_TYPE_FIELD:
|
468
|
+
case GI_INFO_TYPE_ARG:
|
469
|
+
case GI_INFO_TYPE_TYPE:
|
470
|
+
case GI_INFO_TYPE_UNRESOLVED:
|
471
|
+
default:
|
472
|
+
rb_raise(rb_eNotImpError,
|
473
|
+
"TODO: %s::%s: raw data -> GIArgument(interface)[%s]: <%s>",
|
474
|
+
g_base_info_get_namespace(callable_info),
|
475
|
+
g_base_info_get_name(callable_info),
|
476
|
+
g_info_type_to_string(interface_type),
|
477
|
+
g_base_info_get_name(interface_info));
|
478
|
+
break;
|
479
|
+
}
|
480
|
+
|
481
|
+
g_base_info_unref(interface_info);
|
482
|
+
}
|
483
|
+
|
484
|
+
static void
|
485
|
+
argument_from_raw_data(GICallableInfo *callable_info,
|
486
|
+
void **raw_args,
|
487
|
+
GArray *in_args,
|
488
|
+
GArray *out_args,
|
489
|
+
GPtrArray *args_metadata,
|
490
|
+
guint i)
|
491
|
+
{
|
492
|
+
RBGIArgMetadata *metadata;
|
493
|
+
GIArgument *argument;
|
494
|
+
GITypeInfo *type_info;
|
495
|
+
GITypeTag type_tag;
|
496
|
+
|
497
|
+
metadata = g_ptr_array_index(args_metadata, i);
|
498
|
+
|
499
|
+
if (metadata->direction == GI_DIRECTION_INOUT) {
|
500
|
+
argument = &g_array_index(in_args, GIArgument, metadata->in_arg_index);
|
501
|
+
argument->v_pointer = *((gpointer *)(raw_args[i]));
|
502
|
+
return;
|
503
|
+
} else if (metadata->direction == GI_DIRECTION_OUT) {
|
504
|
+
argument = &g_array_index(out_args, GIArgument, metadata->out_arg_index);
|
505
|
+
argument->v_pointer = *((gpointer *)(raw_args[i]));
|
506
|
+
return;
|
507
|
+
}
|
508
|
+
|
509
|
+
argument = &g_array_index(in_args, GIArgument, metadata->in_arg_index);
|
510
|
+
type_info = g_arg_info_get_type(&(metadata->arg_info));
|
511
|
+
type_tag = g_type_info_get_tag(type_info);
|
512
|
+
|
513
|
+
switch (type_tag) {
|
514
|
+
case GI_TYPE_TAG_VOID:
|
515
|
+
argument->v_pointer = *((gpointer *)(raw_args[i]));
|
516
|
+
break;
|
517
|
+
case GI_TYPE_TAG_BOOLEAN:
|
518
|
+
argument->v_boolean = *((gboolean *)(raw_args[i]));
|
519
|
+
break;
|
520
|
+
case GI_TYPE_TAG_INT8:
|
521
|
+
argument->v_int8 = *((gint8 *)(raw_args[i]));
|
522
|
+
break;
|
523
|
+
case GI_TYPE_TAG_UINT8:
|
524
|
+
argument->v_uint8 = *((guint8 *)(raw_args[i]));
|
525
|
+
break;
|
526
|
+
case GI_TYPE_TAG_INT16:
|
527
|
+
argument->v_int16 = *((gint16 *)(raw_args[i]));
|
528
|
+
break;
|
529
|
+
case GI_TYPE_TAG_UINT16:
|
530
|
+
argument->v_uint16 = *((guint16 *)(raw_args[i]));
|
531
|
+
break;
|
532
|
+
case GI_TYPE_TAG_INT32:
|
533
|
+
argument->v_int32 = *((gint32 *)(raw_args[i]));
|
534
|
+
break;
|
535
|
+
case GI_TYPE_TAG_UINT32:
|
536
|
+
argument->v_uint32 = *((guint32 *)(raw_args[i]));
|
537
|
+
break;
|
538
|
+
case GI_TYPE_TAG_INT64:
|
539
|
+
argument->v_int64 = *((gint64 *)(raw_args[i]));
|
540
|
+
break;
|
541
|
+
case GI_TYPE_TAG_UINT64:
|
542
|
+
argument->v_uint64 = *((guint64 *)(raw_args[i]));
|
543
|
+
break;
|
544
|
+
case GI_TYPE_TAG_FLOAT:
|
545
|
+
argument->v_float = *((gfloat *)(raw_args[i]));
|
546
|
+
break;
|
547
|
+
case GI_TYPE_TAG_DOUBLE:
|
548
|
+
argument->v_double = *((gdouble *)(raw_args[i]));
|
549
|
+
break;
|
550
|
+
case GI_TYPE_TAG_GTYPE:
|
551
|
+
argument->v_size = *((gsize *)(raw_args[i]));
|
552
|
+
break;
|
553
|
+
case GI_TYPE_TAG_UTF8:
|
554
|
+
case GI_TYPE_TAG_FILENAME:
|
555
|
+
argument->v_string = *((gchar **)(raw_args[i]));
|
556
|
+
break;
|
557
|
+
case GI_TYPE_TAG_ARRAY:
|
558
|
+
argument->v_pointer = *((gpointer *)(raw_args[i]));
|
559
|
+
break;
|
560
|
+
case GI_TYPE_TAG_INTERFACE:
|
561
|
+
argument_from_raw_data_interface(callable_info,
|
562
|
+
raw_args[i],
|
563
|
+
argument,
|
564
|
+
type_info);
|
565
|
+
break;
|
566
|
+
case GI_TYPE_TAG_GLIST:
|
567
|
+
case GI_TYPE_TAG_GSLIST:
|
568
|
+
case GI_TYPE_TAG_GHASH:
|
569
|
+
argument->v_pointer = *((gpointer *)(raw_args[i]));
|
570
|
+
break;
|
571
|
+
case GI_TYPE_TAG_ERROR:
|
572
|
+
argument->v_pointer = *((GError **)(raw_args[i]));
|
573
|
+
break;
|
574
|
+
case GI_TYPE_TAG_UNICHAR:
|
575
|
+
argument->v_uint32 = *((gunichar *)(raw_args[i]));
|
576
|
+
break;
|
577
|
+
default:
|
578
|
+
g_assert_not_reached();
|
579
|
+
break;
|
580
|
+
}
|
581
|
+
|
582
|
+
g_base_info_unref(type_info);
|
583
|
+
}
|
584
|
+
|
585
|
+
static void
|
586
|
+
arguments_from_raw_data(GICallableInfo *callable_info,
|
587
|
+
void **args,
|
588
|
+
GArray *in_args,
|
589
|
+
GArray *out_args,
|
590
|
+
GPtrArray *args_metadata)
|
591
|
+
{
|
592
|
+
guint i;
|
593
|
+
|
594
|
+
for (i = 0; i < args_metadata->len; i++) {
|
595
|
+
argument_from_raw_data(callable_info,
|
596
|
+
args,
|
597
|
+
in_args,
|
598
|
+
out_args,
|
599
|
+
args_metadata,
|
600
|
+
i);
|
601
|
+
}
|
602
|
+
}
|
603
|
+
|
604
|
+
static void
|
605
|
+
in_arguments_to_ruby(GArray *in_args,
|
606
|
+
GArray *out_args,
|
607
|
+
GPtrArray *args_metadata,
|
608
|
+
GArray *rb_args)
|
609
|
+
{
|
610
|
+
guint i;
|
611
|
+
|
612
|
+
for (i = 0; i < args_metadata->len; i++) {
|
613
|
+
RBGIArgMetadata *metadata;
|
614
|
+
GIArgument *argument;
|
615
|
+
GITypeInfo *type_info;
|
616
|
+
VALUE rb_arg;
|
617
|
+
|
618
|
+
metadata = g_ptr_array_index(args_metadata, i);
|
619
|
+
|
620
|
+
if (metadata->direction == GI_DIRECTION_OUT) {
|
621
|
+
continue;
|
622
|
+
}
|
623
|
+
if (metadata->closure_p) {
|
624
|
+
continue;
|
625
|
+
}
|
626
|
+
|
627
|
+
argument = &g_array_index(in_args, GIArgument, metadata->in_arg_index);
|
628
|
+
type_info = g_arg_info_get_type(&(metadata->arg_info));
|
629
|
+
rb_arg = GI_ARGUMENT2RVAL(argument,
|
630
|
+
FALSE,
|
631
|
+
type_info,
|
632
|
+
in_args,
|
633
|
+
out_args,
|
634
|
+
args_metadata);
|
635
|
+
g_array_append_val(rb_args, rb_arg);
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
static void
|
640
|
+
out_argument_to_raw_data_interface(GICallableInfo *callable_info,
|
641
|
+
GIArgument *argument,
|
642
|
+
gpointer result,
|
643
|
+
GITypeInfo *type_info,
|
644
|
+
G_GNUC_UNUSED GITransfer transfer /* TODO */)
|
645
|
+
{
|
646
|
+
GIBaseInfo *interface_info;
|
647
|
+
GIInfoType interface_type;
|
648
|
+
|
649
|
+
interface_info = g_type_info_get_interface(type_info);
|
650
|
+
interface_type = g_base_info_get_type(interface_info);
|
651
|
+
|
652
|
+
switch (interface_type) {
|
653
|
+
case GI_INFO_TYPE_INVALID:
|
654
|
+
case GI_INFO_TYPE_FUNCTION:
|
655
|
+
case GI_INFO_TYPE_CALLBACK:
|
656
|
+
case GI_INFO_TYPE_STRUCT:
|
657
|
+
case GI_INFO_TYPE_BOXED:
|
658
|
+
rb_raise(rb_eNotImpError,
|
659
|
+
"TODO: %s::%s: out raw data(interface)[%s]: <%s>",
|
660
|
+
g_base_info_get_namespace(callable_info),
|
661
|
+
g_base_info_get_name(callable_info),
|
662
|
+
g_info_type_to_string(interface_type),
|
663
|
+
g_base_info_get_name(interface_info));
|
664
|
+
break;
|
665
|
+
case GI_INFO_TYPE_ENUM:
|
666
|
+
*((gint *)result) = argument->v_int;
|
667
|
+
break;
|
668
|
+
case GI_INFO_TYPE_FLAGS:
|
669
|
+
case GI_INFO_TYPE_OBJECT:
|
670
|
+
case GI_INFO_TYPE_INTERFACE:
|
671
|
+
case GI_INFO_TYPE_CONSTANT:
|
672
|
+
rb_raise(rb_eNotImpError,
|
673
|
+
"TODO: %s::%s: out raw data(interface)[%s]: <%s>",
|
674
|
+
g_base_info_get_namespace(callable_info),
|
675
|
+
g_base_info_get_name(callable_info),
|
676
|
+
g_info_type_to_string(interface_type),
|
677
|
+
g_base_info_get_name(interface_info));
|
678
|
+
break;
|
679
|
+
case GI_INFO_TYPE_INVALID_0:
|
680
|
+
g_assert_not_reached();
|
681
|
+
break;
|
682
|
+
case GI_INFO_TYPE_UNION:
|
683
|
+
case GI_INFO_TYPE_VALUE:
|
684
|
+
case GI_INFO_TYPE_SIGNAL:
|
685
|
+
case GI_INFO_TYPE_VFUNC:
|
686
|
+
case GI_INFO_TYPE_PROPERTY:
|
687
|
+
case GI_INFO_TYPE_FIELD:
|
688
|
+
case GI_INFO_TYPE_ARG:
|
689
|
+
case GI_INFO_TYPE_TYPE:
|
690
|
+
case GI_INFO_TYPE_UNRESOLVED:
|
691
|
+
default:
|
692
|
+
rb_raise(rb_eNotImpError,
|
693
|
+
"TODO: %s::%s: out raw data(interface)[%s]: <%s>",
|
694
|
+
g_base_info_get_namespace(callable_info),
|
695
|
+
g_base_info_get_name(callable_info),
|
696
|
+
g_info_type_to_string(interface_type),
|
697
|
+
g_base_info_get_name(interface_info));
|
698
|
+
break;
|
699
|
+
}
|
700
|
+
|
701
|
+
g_base_info_unref(interface_info);
|
702
|
+
}
|
703
|
+
|
704
|
+
static void
|
705
|
+
out_argument_to_raw_data(GICallableInfo *callable_info,
|
706
|
+
VALUE rb_result,
|
707
|
+
gpointer result,
|
708
|
+
GITypeInfo *type_info,
|
709
|
+
GITransfer transfer)
|
710
|
+
{
|
711
|
+
GIArgument argument;
|
712
|
+
GITypeTag type_tag;
|
713
|
+
|
714
|
+
rb_gi_value_argument_from_ruby(&argument,
|
715
|
+
type_info,
|
716
|
+
rb_result,
|
717
|
+
rb_result);
|
718
|
+
type_tag = g_type_info_get_tag(type_info);
|
719
|
+
switch (type_tag) {
|
720
|
+
case GI_TYPE_TAG_VOID:
|
721
|
+
g_assert_not_reached();
|
722
|
+
break;
|
723
|
+
case GI_TYPE_TAG_BOOLEAN:
|
724
|
+
*((gboolean *)result) = argument.v_boolean;
|
725
|
+
break;
|
726
|
+
case GI_TYPE_TAG_INT8:
|
727
|
+
*((gint8 *)result) = argument.v_int8;
|
728
|
+
break;
|
729
|
+
case GI_TYPE_TAG_UINT8:
|
730
|
+
*((guint8 *)result) = argument.v_uint8;
|
731
|
+
break;
|
732
|
+
case GI_TYPE_TAG_INT16:
|
733
|
+
*((gint16 *)result) = argument.v_int16;
|
734
|
+
break;
|
735
|
+
case GI_TYPE_TAG_UINT16:
|
736
|
+
*((guint16 *)result) = argument.v_uint16;
|
737
|
+
break;
|
738
|
+
case GI_TYPE_TAG_INT32:
|
739
|
+
*((gint32 *)result) = argument.v_int32;
|
740
|
+
break;
|
741
|
+
case GI_TYPE_TAG_UINT32:
|
742
|
+
*((guint32 *)result) = argument.v_uint32;
|
743
|
+
break;
|
744
|
+
case GI_TYPE_TAG_INT64:
|
745
|
+
*((gint64 *)result) = argument.v_int64;
|
746
|
+
break;
|
747
|
+
case GI_TYPE_TAG_UINT64:
|
748
|
+
*((guint64 *)result) = argument.v_uint64;
|
749
|
+
break;
|
750
|
+
case GI_TYPE_TAG_FLOAT:
|
751
|
+
*((gfloat *)result) = argument.v_float;
|
752
|
+
break;
|
753
|
+
case GI_TYPE_TAG_DOUBLE:
|
754
|
+
*((gdouble *)result) = argument.v_double;
|
755
|
+
break;
|
756
|
+
case GI_TYPE_TAG_GTYPE:
|
757
|
+
*((gsize *)result) = argument.v_size;
|
758
|
+
break;
|
759
|
+
case GI_TYPE_TAG_UTF8:
|
760
|
+
case GI_TYPE_TAG_FILENAME:
|
761
|
+
*((gchar **)result) = argument.v_string;
|
762
|
+
break;
|
763
|
+
case GI_TYPE_TAG_ARRAY:
|
764
|
+
*((gpointer *)result) = argument.v_pointer;
|
765
|
+
break;
|
766
|
+
case GI_TYPE_TAG_INTERFACE:
|
767
|
+
out_argument_to_raw_data_interface(callable_info,
|
768
|
+
&argument,
|
769
|
+
result,
|
770
|
+
type_info,
|
771
|
+
transfer);
|
772
|
+
break;
|
773
|
+
case GI_TYPE_TAG_GLIST:
|
774
|
+
case GI_TYPE_TAG_GSLIST:
|
775
|
+
case GI_TYPE_TAG_GHASH:
|
776
|
+
*((gpointer *)result) = argument.v_pointer;
|
777
|
+
break;
|
778
|
+
case GI_TYPE_TAG_ERROR:
|
779
|
+
*((GError **)result) = argument.v_pointer;
|
780
|
+
break;
|
781
|
+
case GI_TYPE_TAG_UNICHAR:
|
782
|
+
*((gunichar *)result) = argument.v_uint32;
|
783
|
+
break;
|
784
|
+
default:
|
785
|
+
g_assert_not_reached();
|
786
|
+
break;
|
787
|
+
}
|
788
|
+
}
|
789
|
+
|
790
|
+
static void
|
791
|
+
out_arguments_to_raw_data(GICallableInfo *callable_info,
|
792
|
+
VALUE rb_results,
|
793
|
+
void *result,
|
794
|
+
GArray *out_args,
|
795
|
+
GPtrArray *args_metadata)
|
796
|
+
{
|
797
|
+
int i_rb_result = 0;
|
798
|
+
guint i;
|
799
|
+
GITypeInfo *return_type_info;
|
800
|
+
GITypeTag return_type_tag;
|
801
|
+
|
802
|
+
return_type_info = g_callable_info_get_return_type(callable_info);
|
803
|
+
return_type_tag = g_type_info_get_tag(return_type_info);
|
804
|
+
if (return_type_tag != GI_TYPE_TAG_VOID) {
|
805
|
+
GITransfer transfer;
|
806
|
+
transfer = g_callable_info_get_caller_owns(callable_info);
|
807
|
+
if (out_args->len == 0) {
|
808
|
+
VALUE rb_return_value = rb_results;
|
809
|
+
out_argument_to_raw_data(callable_info,
|
810
|
+
rb_return_value,
|
811
|
+
result,
|
812
|
+
return_type_info,
|
813
|
+
transfer);
|
814
|
+
} else {
|
815
|
+
out_argument_to_raw_data(callable_info,
|
816
|
+
RARRAY_AREF(rb_results, i_rb_result),
|
817
|
+
result,
|
818
|
+
return_type_info,
|
819
|
+
transfer);
|
820
|
+
i_rb_result++;
|
821
|
+
}
|
822
|
+
}
|
823
|
+
g_base_info_unref(return_type_info);
|
824
|
+
|
825
|
+
for (i = 0; i < args_metadata->len; i++) {
|
826
|
+
RBGIArgMetadata *metadata;
|
827
|
+
GIArgument *argument;
|
828
|
+
GITypeInfo *type_info;
|
829
|
+
GITransfer transfer;
|
830
|
+
|
831
|
+
metadata = g_ptr_array_index(args_metadata, i);
|
832
|
+
|
833
|
+
/* TODO: support GI_DIRECTION_INOUT */
|
834
|
+
if (metadata->direction != GI_DIRECTION_OUT) {
|
835
|
+
continue;
|
836
|
+
}
|
837
|
+
|
838
|
+
argument = &g_array_index(out_args, GIArgument, metadata->out_arg_index);
|
839
|
+
type_info = g_arg_info_get_type(&(metadata->arg_info));
|
840
|
+
transfer = g_arg_info_get_ownership_transfer(&(metadata->arg_info));
|
841
|
+
out_argument_to_raw_data(callable_info,
|
842
|
+
RARRAY_AREF(rb_results, i_rb_result),
|
843
|
+
argument->v_pointer,
|
844
|
+
type_info,
|
845
|
+
transfer);
|
846
|
+
i_rb_result++;
|
847
|
+
g_base_info_unref(type_info);
|
848
|
+
}
|
849
|
+
}
|
850
|
+
|
851
|
+
static void
|
852
|
+
ffi_closure_callback(G_GNUC_UNUSED ffi_cif *cif,
|
853
|
+
void *result,
|
854
|
+
void **raw_args,
|
855
|
+
void *data)
|
856
|
+
{
|
857
|
+
RBGICallback *callback = data;
|
858
|
+
RBGICallbackData *callback_data = NULL;
|
859
|
+
GArray *in_args;
|
860
|
+
GArray *out_args;
|
861
|
+
GPtrArray *args_metadata;
|
862
|
+
VALUE rb_results;
|
863
|
+
|
864
|
+
arguments_init(&in_args, &out_args, &args_metadata);
|
865
|
+
allocate_arguments(callback->callback_info,
|
866
|
+
in_args,
|
867
|
+
out_args,
|
868
|
+
args_metadata);
|
869
|
+
fill_metadata(args_metadata);
|
870
|
+
arguments_from_raw_data(callback->callback_info,
|
871
|
+
raw_args,
|
872
|
+
in_args,
|
873
|
+
out_args,
|
874
|
+
args_metadata);
|
875
|
+
|
876
|
+
{
|
877
|
+
guint i;
|
878
|
+
|
879
|
+
for (i = 0; i < args_metadata->len; i++) {
|
880
|
+
RBGIArgMetadata *metadata;
|
881
|
+
|
882
|
+
metadata = g_ptr_array_index(args_metadata, i);
|
883
|
+
if (!metadata->closure_p) {
|
884
|
+
continue;
|
885
|
+
}
|
886
|
+
|
887
|
+
callback_data = *((RBGICallbackData **)(raw_args[i]));
|
888
|
+
break;
|
889
|
+
}
|
890
|
+
}
|
891
|
+
|
892
|
+
{
|
893
|
+
ID id_call;
|
894
|
+
GArray *rb_args;
|
895
|
+
|
896
|
+
rb_args = g_array_new(FALSE, FALSE, sizeof(VALUE));
|
897
|
+
in_arguments_to_ruby(in_args,
|
898
|
+
out_args,
|
899
|
+
args_metadata,
|
900
|
+
rb_args);
|
901
|
+
CONST_ID(id_call, "call");
|
902
|
+
/* TODO: use rb_protect() */
|
903
|
+
rb_results = rb_funcallv(callback_data->rb_callback,
|
904
|
+
id_call,
|
905
|
+
rb_args->len,
|
906
|
+
(VALUE *)(rb_args->data));
|
907
|
+
g_array_free(rb_args, TRUE);
|
908
|
+
}
|
909
|
+
|
910
|
+
out_arguments_to_raw_data(callback->callback_info,
|
911
|
+
rb_results,
|
912
|
+
result,
|
913
|
+
out_args,
|
914
|
+
args_metadata);
|
915
|
+
|
916
|
+
if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) {
|
917
|
+
rb_gi_callback_data_free(callback_data);
|
918
|
+
}
|
919
|
+
}
|
920
|
+
|
383
921
|
static void
|
384
922
|
in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
|
385
923
|
{
|
386
|
-
gpointer
|
924
|
+
gpointer callback_function;
|
387
925
|
GIArgInfo *arg_info;
|
388
926
|
GIArgument *callback_argument;
|
389
927
|
GIArgument *closure_argument = NULL;
|
390
928
|
GIArgument *destroy_argument = NULL;
|
929
|
+
RBGICallback *callback = NULL;
|
391
930
|
|
392
931
|
arg_info = &(metadata->arg_info);
|
393
932
|
|
@@ -416,26 +955,26 @@ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
|
|
416
955
|
return;
|
417
956
|
}
|
418
957
|
|
419
|
-
|
420
|
-
if (
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
958
|
+
callback_function = find_callback_function(arg_info);
|
959
|
+
if (callback_function) {
|
960
|
+
callback_argument->v_pointer = callback_function;
|
961
|
+
} else {
|
962
|
+
callback = RB_ZALLOC(RBGICallback);
|
963
|
+
callback->type_info = g_arg_info_get_type(arg_info);
|
964
|
+
callback->callback_info = g_type_info_get_interface(callback->type_info);
|
965
|
+
callback->closure =
|
966
|
+
g_callable_info_prepare_closure(callback->callback_info,
|
967
|
+
&(callback->cif),
|
968
|
+
ffi_closure_callback,
|
969
|
+
callback);
|
970
|
+
callback_argument->v_pointer = callback->closure;
|
432
971
|
}
|
433
|
-
callback_argument->v_pointer = callback;
|
434
972
|
|
435
973
|
if (closure_argument) {
|
436
974
|
RBGICallbackData *callback_data;
|
437
975
|
|
438
976
|
callback_data = ALLOC(RBGICallbackData);
|
977
|
+
callback_data->callback = callback;
|
439
978
|
callback_data->metadata = metadata;
|
440
979
|
callback_data->rb_callback = rb_block_proc();
|
441
980
|
callback_data_guard_from_gc(callback_data);
|