gobject-introspection 2.0.0-x86-mingw32 → 2.0.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -1
- data/ext/gobject-introspection/extconf.rb +0 -3
- data/ext/gobject-introspection/rb-gi-argument.c +206 -16
- data/ext/gobject-introspection/rb-gi-constructor-info.c +14 -6
- data/ext/gobject-introspection/rb-gi-conversions.h +8 -8
- data/ext/gobject-introspection/rb-gi-field-info.c +2 -2
- data/ext/gobject-introspection/rb-gi-function-info.c +135 -29
- data/ext/gobject-introspection/rb-gi-method-info.c +4 -30
- data/ext/gobject-introspection/rb-gi-private.h +1 -6
- data/lib/1.9/gobject_introspection.so +0 -0
- data/lib/2.0/gobject_introspection.so +0 -0
- data/lib/gobject-introspection.rb +1 -0
- data/lib/gobject-introspection/boxed-info.rb +28 -0
- data/lib/gobject-introspection/loader.rb +57 -14
- 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/lib/girepository-1.0/GLib-2.0.typelib +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -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/docwriter.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -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.pyc +0 -0
- data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -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/share/gir-1.0/GLib-2.0.gir +1 -1
- metadata +7 -6
data/Rakefile
CHANGED
@@ -34,7 +34,7 @@ package_task = GNOME2::Rake::PackageTask.new do |_package|
|
|
34
34
|
:name => "glib",
|
35
35
|
:download_site => :gnome,
|
36
36
|
:label => "GLib",
|
37
|
-
:version => "2.36.
|
37
|
+
:version => "2.36.2",
|
38
38
|
:compression_method => "xz",
|
39
39
|
:windows => {
|
40
40
|
:build => false,
|
@@ -42,6 +42,7 @@ package_task = GNOME2::Rake::PackageTask.new do |_package|
|
|
42
42
|
:native => {
|
43
43
|
:build => true,
|
44
44
|
},
|
45
|
+
:need_autoreconf => true,
|
45
46
|
},
|
46
47
|
{
|
47
48
|
:name => "gobject-introspection",
|
@@ -201,7 +201,11 @@ rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
|
201
201
|
type_tag = g_type_info_get_tag(type_info);
|
202
202
|
switch (type_tag) {
|
203
203
|
case GI_TYPE_TAG_VOID:
|
204
|
-
|
204
|
+
if (g_type_info_is_pointer(type_info)) {
|
205
|
+
rb_argument = ULONG2NUM(GPOINTER_TO_UINT(argument->v_pointer));
|
206
|
+
} else {
|
207
|
+
rb_argument = Qnil;
|
208
|
+
}
|
205
209
|
break;
|
206
210
|
case GI_TYPE_TAG_BOOLEAN:
|
207
211
|
rb_argument = CBOOL2RVAL(argument->v_boolean);
|
@@ -273,6 +277,66 @@ rb_gi_argument_to_ruby(GIArgument *argument, GITypeInfo *type_info)
|
|
273
277
|
return rb_argument;
|
274
278
|
}
|
275
279
|
|
280
|
+
static void
|
281
|
+
rb_gi_out_argument_init_interface(GIArgument *argument, GIArgInfo *arg_info,
|
282
|
+
GITypeInfo *type_info)
|
283
|
+
{
|
284
|
+
GIBaseInfo *interface_info;
|
285
|
+
GIInfoType interface_type;
|
286
|
+
|
287
|
+
if (!g_arg_info_is_caller_allocates(arg_info)) {
|
288
|
+
argument->v_pointer = ALLOC(gpointer);
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
|
292
|
+
interface_info = g_type_info_get_interface(type_info);
|
293
|
+
interface_type = g_base_info_get_type(interface_info);
|
294
|
+
|
295
|
+
switch (interface_type) {
|
296
|
+
case GI_INFO_TYPE_INVALID:
|
297
|
+
case GI_INFO_TYPE_FUNCTION:
|
298
|
+
case GI_INFO_TYPE_CALLBACK:
|
299
|
+
rb_raise(rb_eNotImpError,
|
300
|
+
"TODO: allocates GIArgument(interface)[%s] for output",
|
301
|
+
g_info_type_to_string(interface_type));
|
302
|
+
break;
|
303
|
+
case GI_INFO_TYPE_STRUCT:
|
304
|
+
{
|
305
|
+
gsize struct_size;
|
306
|
+
|
307
|
+
struct_size = g_struct_info_get_size(interface_info);
|
308
|
+
argument->v_pointer = xmalloc(struct_size);
|
309
|
+
memset(argument->v_pointer, 0, struct_size);
|
310
|
+
}
|
311
|
+
break;
|
312
|
+
case GI_INFO_TYPE_BOXED:
|
313
|
+
case GI_INFO_TYPE_ENUM:
|
314
|
+
case GI_INFO_TYPE_FLAGS:
|
315
|
+
case GI_INFO_TYPE_OBJECT:
|
316
|
+
case GI_INFO_TYPE_INTERFACE:
|
317
|
+
case GI_INFO_TYPE_CONSTANT:
|
318
|
+
case GI_INFO_TYPE_INVALID_0:
|
319
|
+
case GI_INFO_TYPE_UNION:
|
320
|
+
case GI_INFO_TYPE_VALUE:
|
321
|
+
case GI_INFO_TYPE_SIGNAL:
|
322
|
+
case GI_INFO_TYPE_VFUNC:
|
323
|
+
case GI_INFO_TYPE_PROPERTY:
|
324
|
+
case GI_INFO_TYPE_FIELD:
|
325
|
+
case GI_INFO_TYPE_ARG:
|
326
|
+
case GI_INFO_TYPE_TYPE:
|
327
|
+
case GI_INFO_TYPE_UNRESOLVED:
|
328
|
+
rb_raise(rb_eNotImpError,
|
329
|
+
"TODO: allocates GIArgument(interface)[%s] for output",
|
330
|
+
g_info_type_to_string(interface_type));
|
331
|
+
break;
|
332
|
+
default:
|
333
|
+
g_assert_not_reached();
|
334
|
+
break;
|
335
|
+
}
|
336
|
+
|
337
|
+
g_base_info_unref(interface_info);
|
338
|
+
}
|
339
|
+
|
276
340
|
void
|
277
341
|
rb_gi_out_argument_init(GIArgument *argument, GIArgInfo *arg_info)
|
278
342
|
{
|
@@ -330,7 +394,7 @@ rb_gi_out_argument_init(GIArgument *argument, GIArgInfo *arg_info)
|
|
330
394
|
argument->v_pointer = ALLOC(gpointer);
|
331
395
|
break;
|
332
396
|
case GI_TYPE_TAG_INTERFACE:
|
333
|
-
argument
|
397
|
+
rb_gi_out_argument_init_interface(argument, arg_info, &type_info);
|
334
398
|
break;
|
335
399
|
case GI_TYPE_TAG_GLIST:
|
336
400
|
case GI_TYPE_TAG_GSLIST:
|
@@ -408,7 +472,11 @@ rb_gi_out_argument_to_ruby(GIArgument *argument, GIArgInfo *arg_info)
|
|
408
472
|
case GI_TYPE_TAG_GLIST:
|
409
473
|
case GI_TYPE_TAG_GSLIST:
|
410
474
|
case GI_TYPE_TAG_GHASH:
|
411
|
-
|
475
|
+
if (g_arg_info_is_caller_allocates(arg_info)) {
|
476
|
+
normalized_argument.v_pointer = argument->v_pointer;
|
477
|
+
} else {
|
478
|
+
normalized_argument.v_pointer = *((gpointer *)(argument->v_pointer));
|
479
|
+
}
|
412
480
|
break;
|
413
481
|
case GI_TYPE_TAG_ERROR:
|
414
482
|
normalized_argument.v_pointer = *((GError **)(argument->v_pointer));
|
@@ -630,8 +698,8 @@ rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
|
|
630
698
|
|
631
699
|
|
632
700
|
GIArgument *
|
633
|
-
|
634
|
-
|
701
|
+
rb_gi_value_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
702
|
+
VALUE rb_argument)
|
635
703
|
{
|
636
704
|
GITypeTag type_tag;
|
637
705
|
|
@@ -640,6 +708,9 @@ rb_gi_in_argument_from_ruby(GIArgument *argument, GITypeInfo *type_info,
|
|
640
708
|
type_tag = g_type_info_get_tag(type_info);
|
641
709
|
switch (type_tag) {
|
642
710
|
case GI_TYPE_TAG_VOID:
|
711
|
+
if (g_type_info_is_pointer(type_info)) {
|
712
|
+
argument->v_pointer = GUINT_TO_POINTER(NUM2ULONG(rb_argument));
|
713
|
+
}
|
643
714
|
break;
|
644
715
|
case GI_TYPE_TAG_BOOLEAN:
|
645
716
|
argument->v_boolean = RVAL2CBOOL(rb_argument);
|
@@ -716,7 +787,7 @@ rb_gi_inout_argument_from_ruby(GIArgument *argument,
|
|
716
787
|
GIArgument in_argument;
|
717
788
|
GITypeTag type_tag;
|
718
789
|
|
719
|
-
|
790
|
+
rb_gi_value_argument_from_ruby(&in_argument, type_info, rb_argument);
|
720
791
|
|
721
792
|
type_tag = g_type_info_get_tag(type_info);
|
722
793
|
switch (type_tag) {
|
@@ -797,8 +868,123 @@ rb_gi_inout_argument_from_ruby(GIArgument *argument,
|
|
797
868
|
}
|
798
869
|
}
|
799
870
|
|
871
|
+
static void
|
872
|
+
rb_gi_in_argument_transfer_interface(GIArgument *argument,
|
873
|
+
G_GNUC_UNUSED GITransfer transfer,
|
874
|
+
GITypeInfo *type_info,
|
875
|
+
G_GNUC_UNUSED VALUE rb_argument)
|
876
|
+
{
|
877
|
+
GIBaseInfo *interface_info;
|
878
|
+
GIInfoType interface_type;
|
879
|
+
G_GNUC_UNUSED GType gtype;
|
880
|
+
|
881
|
+
interface_info = g_type_info_get_interface(type_info);
|
882
|
+
interface_type = g_base_info_get_type(interface_info);
|
883
|
+
gtype = g_registered_type_info_get_g_type(interface_info);
|
884
|
+
g_base_info_unref(interface_info);
|
885
|
+
|
886
|
+
switch (interface_type) {
|
887
|
+
case GI_INFO_TYPE_INVALID:
|
888
|
+
case GI_INFO_TYPE_FUNCTION:
|
889
|
+
case GI_INFO_TYPE_CALLBACK:
|
890
|
+
rb_raise(rb_eNotImpError,
|
891
|
+
"TODO: in transfer (interface) [%s]",
|
892
|
+
g_info_type_to_string(interface_type));
|
893
|
+
break;
|
894
|
+
case GI_INFO_TYPE_STRUCT:
|
895
|
+
rbgobj_boxed_unown(rb_argument);
|
896
|
+
break;
|
897
|
+
case GI_INFO_TYPE_BOXED:
|
898
|
+
case GI_INFO_TYPE_ENUM:
|
899
|
+
case GI_INFO_TYPE_FLAGS:
|
900
|
+
rb_raise(rb_eNotImpError,
|
901
|
+
"TODO: in transfer (interface) [%s]",
|
902
|
+
g_info_type_to_string(interface_type));
|
903
|
+
break;
|
904
|
+
case GI_INFO_TYPE_OBJECT:
|
905
|
+
g_object_ref(argument->v_pointer);
|
906
|
+
break;
|
907
|
+
case GI_INFO_TYPE_INTERFACE:
|
908
|
+
case GI_INFO_TYPE_CONSTANT:
|
909
|
+
rb_raise(rb_eNotImpError,
|
910
|
+
"TODO: in transfer (interface) [%s]",
|
911
|
+
g_info_type_to_string(interface_type));
|
912
|
+
break;
|
913
|
+
case GI_INFO_TYPE_INVALID_0:
|
914
|
+
g_assert_not_reached();
|
915
|
+
break;
|
916
|
+
case GI_INFO_TYPE_UNION:
|
917
|
+
case GI_INFO_TYPE_VALUE:
|
918
|
+
case GI_INFO_TYPE_SIGNAL:
|
919
|
+
case GI_INFO_TYPE_VFUNC:
|
920
|
+
case GI_INFO_TYPE_PROPERTY:
|
921
|
+
case GI_INFO_TYPE_FIELD:
|
922
|
+
case GI_INFO_TYPE_ARG:
|
923
|
+
case GI_INFO_TYPE_TYPE:
|
924
|
+
case GI_INFO_TYPE_UNRESOLVED:
|
925
|
+
rb_raise(rb_eNotImpError,
|
926
|
+
"TODO: in transfer (interface) [%s]",
|
927
|
+
g_info_type_to_string(interface_type));
|
928
|
+
break;
|
929
|
+
default:
|
930
|
+
g_assert_not_reached();
|
931
|
+
break;
|
932
|
+
}
|
933
|
+
}
|
934
|
+
|
935
|
+
static void
|
936
|
+
rb_gi_in_argument_transfer(GIArgument *argument, GITransfer transfer,
|
937
|
+
GITypeInfo *type_info, VALUE rb_argument)
|
938
|
+
{
|
939
|
+
GITypeTag type_tag;
|
940
|
+
|
941
|
+
if (transfer == GI_TRANSFER_NOTHING) {
|
942
|
+
return;
|
943
|
+
}
|
944
|
+
|
945
|
+
type_tag = g_type_info_get_tag(type_info);
|
946
|
+
switch (type_tag) {
|
947
|
+
case GI_TYPE_TAG_VOID:
|
948
|
+
case GI_TYPE_TAG_BOOLEAN:
|
949
|
+
case GI_TYPE_TAG_INT8:
|
950
|
+
case GI_TYPE_TAG_UINT8:
|
951
|
+
case GI_TYPE_TAG_INT16:
|
952
|
+
case GI_TYPE_TAG_UINT16:
|
953
|
+
case GI_TYPE_TAG_INT32:
|
954
|
+
case GI_TYPE_TAG_UINT32:
|
955
|
+
case GI_TYPE_TAG_INT64:
|
956
|
+
case GI_TYPE_TAG_UINT64:
|
957
|
+
case GI_TYPE_TAG_FLOAT:
|
958
|
+
case GI_TYPE_TAG_DOUBLE:
|
959
|
+
case GI_TYPE_TAG_GTYPE:
|
960
|
+
break;
|
961
|
+
case GI_TYPE_TAG_UTF8:
|
962
|
+
case GI_TYPE_TAG_FILENAME:
|
963
|
+
case GI_TYPE_TAG_ARRAY:
|
964
|
+
rb_raise(rb_eNotImpError,
|
965
|
+
"TODO: in transfer (%s)",
|
966
|
+
g_type_tag_to_string(type_tag));
|
967
|
+
break;
|
968
|
+
case GI_TYPE_TAG_INTERFACE:
|
969
|
+
rb_gi_in_argument_transfer_interface(argument, transfer,
|
970
|
+
type_info, rb_argument);
|
971
|
+
break;
|
972
|
+
case GI_TYPE_TAG_GLIST:
|
973
|
+
case GI_TYPE_TAG_GSLIST:
|
974
|
+
case GI_TYPE_TAG_GHASH:
|
975
|
+
case GI_TYPE_TAG_ERROR:
|
976
|
+
case GI_TYPE_TAG_UNICHAR:
|
977
|
+
rb_raise(rb_eNotImpError,
|
978
|
+
"TODO: in transfer (%s)",
|
979
|
+
g_type_tag_to_string(type_tag));
|
980
|
+
default:
|
981
|
+
g_assert_not_reached();
|
982
|
+
break;
|
983
|
+
}
|
984
|
+
}
|
985
|
+
|
800
986
|
GIArgument *
|
801
|
-
|
987
|
+
rb_gi_in_argument_from_ruby(GIArgument *argument, GIArgInfo *arg_info,
|
802
988
|
VALUE rb_argument)
|
803
989
|
{
|
804
990
|
GITypeInfo type_info;
|
@@ -813,14 +999,18 @@ rb_gi_call_argument_from_ruby(GIArgument *argument, GIArgInfo *arg_info,
|
|
813
999
|
rb_gi_inout_argument_from_ruby(argument, arg_info, &type_info,
|
814
1000
|
rb_argument);
|
815
1001
|
} else {
|
816
|
-
|
1002
|
+
rb_gi_value_argument_from_ruby(argument, &type_info, rb_argument);
|
1003
|
+
rb_gi_in_argument_transfer(argument,
|
1004
|
+
g_arg_info_get_ownership_transfer(arg_info),
|
1005
|
+
&type_info,
|
1006
|
+
rb_argument);
|
817
1007
|
}
|
818
1008
|
|
819
1009
|
return argument;
|
820
1010
|
}
|
821
1011
|
|
822
1012
|
static void
|
823
|
-
|
1013
|
+
rb_gi_value_argument_free_array(GIArgument *argument, GITypeInfo *type_info)
|
824
1014
|
{
|
825
1015
|
GIArrayType array_type;
|
826
1016
|
|
@@ -840,7 +1030,7 @@ rb_gi_in_argument_free_array(GIArgument *argument, GITypeInfo *type_info)
|
|
840
1030
|
}
|
841
1031
|
|
842
1032
|
static void
|
843
|
-
|
1033
|
+
rb_gi_value_argument_free_interface(GIArgument *argument, GITypeInfo *type_info)
|
844
1034
|
{
|
845
1035
|
GIBaseInfo *interface_info;
|
846
1036
|
GIInfoType interface_type;
|
@@ -863,7 +1053,7 @@ rb_gi_in_argument_free_interface(GIArgument *argument, GITypeInfo *type_info)
|
|
863
1053
|
}
|
864
1054
|
|
865
1055
|
void
|
866
|
-
|
1056
|
+
rb_gi_value_argument_free(GIArgument *argument, GITypeInfo *type_info)
|
867
1057
|
{
|
868
1058
|
GITypeTag type_tag;
|
869
1059
|
|
@@ -886,10 +1076,10 @@ rb_gi_in_argument_free(GIArgument *argument, GITypeInfo *type_info)
|
|
886
1076
|
case GI_TYPE_TAG_FILENAME:
|
887
1077
|
break;
|
888
1078
|
case GI_TYPE_TAG_ARRAY:
|
889
|
-
|
1079
|
+
rb_gi_value_argument_free_array(argument, type_info);
|
890
1080
|
break;
|
891
1081
|
case GI_TYPE_TAG_INTERFACE:
|
892
|
-
|
1082
|
+
rb_gi_value_argument_free_interface(argument, type_info);
|
893
1083
|
break;
|
894
1084
|
case GI_TYPE_TAG_GLIST:
|
895
1085
|
case GI_TYPE_TAG_GSLIST:
|
@@ -991,12 +1181,12 @@ rb_gi_inout_argument_free(GIArgument *argument, GITypeInfo *type_info)
|
|
991
1181
|
break;
|
992
1182
|
}
|
993
1183
|
|
994
|
-
|
1184
|
+
rb_gi_value_argument_free(&in_argument, type_info);
|
995
1185
|
xfree(argument->v_pointer);
|
996
1186
|
}
|
997
1187
|
|
998
1188
|
void
|
999
|
-
|
1189
|
+
rb_gi_in_argument_free(GIArgument *argument, GIArgInfo *arg_info)
|
1000
1190
|
{
|
1001
1191
|
GITypeInfo type_info;
|
1002
1192
|
|
@@ -1004,7 +1194,7 @@ rb_gi_call_argument_free(GIArgument *argument, GIArgInfo *arg_info)
|
|
1004
1194
|
if (g_arg_info_get_direction(arg_info) == GI_DIRECTION_INOUT) {
|
1005
1195
|
rb_gi_inout_argument_free(argument, &type_info);
|
1006
1196
|
} else {
|
1007
|
-
|
1197
|
+
rb_gi_value_argument_free(argument, &type_info);
|
1008
1198
|
}
|
1009
1199
|
}
|
1010
1200
|
|
@@ -82,7 +82,7 @@ initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
|
|
82
82
|
}
|
83
83
|
|
84
84
|
static VALUE
|
85
|
-
rg_invoke(
|
85
|
+
rg_invoke(VALUE self, VALUE rb_options)
|
86
86
|
{
|
87
87
|
GIFunctionInfo *info;
|
88
88
|
GICallableInfo *callable_info;
|
@@ -93,11 +93,19 @@ rg_invoke(int argc, VALUE *argv, VALUE self)
|
|
93
93
|
info = SELF(self);
|
94
94
|
callable_info = (GICallableInfo *)info;
|
95
95
|
|
96
|
-
|
97
|
-
receiver =
|
96
|
+
rb_options = rbg_to_hash(rb_options);
|
97
|
+
receiver = rb_hash_delete(rb_options, ID2SYM(rb_intern("receiver")));
|
98
|
+
if (NIL_P(receiver)) {
|
99
|
+
receiver = rb_hash_delete(rb_options, rb_str_new_cstr("receiver"));
|
100
|
+
}
|
101
|
+
if (NIL_P(receiver)) {
|
102
|
+
rb_raise(rb_eArgError,
|
103
|
+
"receiver is missing: %s",
|
104
|
+
RBG_INSPECT(rb_options));
|
105
|
+
}
|
98
106
|
/* TODO: use rb_protect */
|
99
|
-
rb_gi_function_info_invoke_raw(info,
|
100
|
-
|
107
|
+
rb_gi_function_info_invoke_raw(info,
|
108
|
+
rb_options,
|
101
109
|
&return_value);
|
102
110
|
|
103
111
|
g_callable_info_load_return_type(callable_info, &return_value_info);
|
@@ -116,5 +124,5 @@ rb_gi_constructor_info_init(VALUE rb_mGI, VALUE rb_cGIFunctionInfo)
|
|
116
124
|
"ConstructorInfo", rb_mGI,
|
117
125
|
rb_cGIFunctionInfo);
|
118
126
|
|
119
|
-
RG_DEF_METHOD(invoke,
|
127
|
+
RG_DEF_METHOD(invoke, 1);
|
120
128
|
}
|
@@ -37,10 +37,10 @@
|
|
37
37
|
(rb_gi_out_argument_to_ruby((argument), (arg_info)))
|
38
38
|
#define GI_RETURN_ARGUMENT2RVAL(argument, callable_info) \
|
39
39
|
(rb_gi_return_argument_to_ruby((argument), (callable_info)))
|
40
|
-
#define
|
41
|
-
(
|
42
|
-
#define
|
43
|
-
(
|
40
|
+
#define RVAL2GI_VALUE_ARGUMENT(argument, type_info, rb_argument) \
|
41
|
+
(rb_gi_value_argument_from_ruby((argument), (type_info), (rb_argument)))
|
42
|
+
#define RVAL2GI_IN_ARGUMENT(argument, arg_info, rb_argument) \
|
43
|
+
(rb_gi_in_argument_from_ruby((argument), (arg_info), (rb_argument)))
|
44
44
|
|
45
45
|
|
46
46
|
#define RVAL2GI_REGISTERED_TYPE_INFO(rb_object) \
|
@@ -99,15 +99,15 @@ void rb_gi_out_argument_fin (GIArgument *argument,
|
|
99
99
|
GIArgInfo *arg_info);
|
100
100
|
VALUE rb_gi_return_argument_to_ruby (GIArgument *argument,
|
101
101
|
GICallableInfo *callable_info);
|
102
|
-
GIArgument *
|
102
|
+
GIArgument *rb_gi_value_argument_from_ruby (GIArgument *argument,
|
103
103
|
GITypeInfo *type_info,
|
104
104
|
VALUE rb_argument);
|
105
|
-
GIArgument *
|
105
|
+
GIArgument *rb_gi_in_argument_from_ruby (GIArgument *argument,
|
106
106
|
GIArgInfo *arg_info,
|
107
107
|
VALUE rb_argument);
|
108
|
-
void
|
108
|
+
void rb_gi_value_argument_free (GIArgument *argument,
|
109
109
|
GITypeInfo *type_info);
|
110
|
-
void
|
110
|
+
void rb_gi_in_argument_free (GIArgument *argument,
|
111
111
|
GIArgInfo *arg_info);
|
112
112
|
|
113
113
|
VALUE rb_gi_array_type_to_ruby (GIArrayType type);
|
@@ -98,10 +98,10 @@ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
|
|
98
98
|
gboolean succeeded;
|
99
99
|
|
100
100
|
type_info = g_field_info_get_type(info);
|
101
|
-
|
101
|
+
RVAL2GI_VALUE_ARGUMENT(&field_value, type_info, rb_field_value);
|
102
102
|
|
103
103
|
succeeded = g_field_info_set_field(info, memory, &field_value);
|
104
|
-
|
104
|
+
rb_gi_value_argument_free(&field_value, type_info);
|
105
105
|
g_base_info_unref(type_info);
|
106
106
|
|
107
107
|
if (!succeeded) {
|
@@ -20,6 +20,17 @@
|
|
20
20
|
|
21
21
|
#include "rb-gi-private.h"
|
22
22
|
|
23
|
+
#ifdef HAVE_RUBY_THREAD_H
|
24
|
+
# include <ruby/thread.h>
|
25
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE void *
|
26
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE NULL
|
27
|
+
#else
|
28
|
+
# define rb_thread_call_without_gvl(func, func_data, ubf, ubf_data) \
|
29
|
+
rb_thread_blocking_region(func, func_data, ubf, ubf_data)
|
30
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE VALUE
|
31
|
+
# define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE Qnil
|
32
|
+
#endif
|
33
|
+
|
23
34
|
#define RG_TARGET_NAMESPACE rb_cGIFunctionInfo
|
24
35
|
#define SELF(self) RVAL2GI_FUNCTION_INFO(self)
|
25
36
|
|
@@ -322,8 +333,7 @@ source_func_callback_finder(GIArgInfo *arg_info)
|
|
322
333
|
}
|
323
334
|
|
324
335
|
static void
|
325
|
-
in_callback_argument_from_ruby(RBGIArgMetadata *metadata,
|
326
|
-
GArray *in_args)
|
336
|
+
in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
|
327
337
|
{
|
328
338
|
gpointer callback;
|
329
339
|
GIArgInfo *arg_info;
|
@@ -374,21 +384,26 @@ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, VALUE *argv,
|
|
374
384
|
}
|
375
385
|
|
376
386
|
static void
|
377
|
-
in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE
|
387
|
+
in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments,
|
388
|
+
GArray *in_args)
|
378
389
|
{
|
379
390
|
if (metadata->rb_arg_index == -1) {
|
380
391
|
return;
|
381
392
|
}
|
382
393
|
|
383
394
|
if (metadata->callback_p) {
|
384
|
-
in_callback_argument_from_ruby(metadata,
|
395
|
+
in_callback_argument_from_ruby(metadata, in_args);
|
385
396
|
} else {
|
386
397
|
GIArgument *argument;
|
398
|
+
VALUE rb_argument = Qnil;
|
387
399
|
|
400
|
+
if (RARRAY_LEN(rb_arguments) > metadata->rb_arg_index) {
|
401
|
+
rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index];
|
402
|
+
}
|
388
403
|
argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index));
|
389
|
-
|
390
|
-
|
391
|
-
|
404
|
+
RVAL2GI_IN_ARGUMENT(argument,
|
405
|
+
&(metadata->arg_info),
|
406
|
+
rb_argument);
|
392
407
|
}
|
393
408
|
}
|
394
409
|
|
@@ -413,8 +428,7 @@ arg_metadata_free(gpointer data)
|
|
413
428
|
}
|
414
429
|
|
415
430
|
static void
|
416
|
-
arguments_from_ruby(GICallableInfo *info,
|
417
|
-
int argc, VALUE *argv,
|
431
|
+
arguments_from_ruby(GICallableInfo *info, VALUE rb_arguments,
|
418
432
|
GArray *in_args, GArray *out_args,
|
419
433
|
GPtrArray *args_metadata)
|
420
434
|
{
|
@@ -423,15 +437,13 @@ arguments_from_ruby(GICallableInfo *info,
|
|
423
437
|
allocate_arguments(info, in_args, out_args, args_metadata);
|
424
438
|
fill_metadata(args_metadata);
|
425
439
|
|
426
|
-
/* TODO: validate_rb_args(args_metadata); */
|
427
|
-
|
428
440
|
n_args = g_callable_info_get_n_args(info);
|
429
441
|
for (i = 0; i < n_args; i++) {
|
430
442
|
RBGIArgMetadata *metadata;
|
431
443
|
|
432
444
|
metadata = g_ptr_array_index(args_metadata, i);
|
433
445
|
if (metadata->in_arg_index != -1) {
|
434
|
-
in_argument_from_ruby(metadata,
|
446
|
+
in_argument_from_ruby(metadata, rb_arguments, in_args);
|
435
447
|
} else {
|
436
448
|
out_argument_from_ruby(metadata, out_args);
|
437
449
|
}
|
@@ -535,7 +547,7 @@ arguments_free(GArray *in_args, GArray *out_args, GPtrArray *args_metadata)
|
|
535
547
|
if (in_arg_index != -1) {
|
536
548
|
GIArgument *argument;
|
537
549
|
argument = &(g_array_index(in_args, GIArgument, in_arg_index));
|
538
|
-
|
550
|
+
rb_gi_in_argument_free(argument, &(metadata->arg_info));
|
539
551
|
}
|
540
552
|
} else {
|
541
553
|
GIArgument *argument;
|
@@ -550,33 +562,126 @@ arguments_free(GArray *in_args, GArray *out_args, GPtrArray *args_metadata)
|
|
550
562
|
g_ptr_array_unref(args_metadata);
|
551
563
|
}
|
552
564
|
|
565
|
+
typedef struct {
|
566
|
+
GIFunctionInfo *info;
|
567
|
+
GArray *in_args;
|
568
|
+
GArray *out_args;
|
569
|
+
GIArgument *return_value;
|
570
|
+
GError **error;
|
571
|
+
gboolean succeeded;
|
572
|
+
} InvokeData;
|
573
|
+
|
574
|
+
static void
|
575
|
+
rb_gi_function_info_invoke_raw_call(InvokeData *data)
|
576
|
+
{
|
577
|
+
data->succeeded =
|
578
|
+
g_function_info_invoke(data->info,
|
579
|
+
(GIArgument *)(data->in_args->data),
|
580
|
+
data->in_args->len,
|
581
|
+
(GIArgument *)(data->out_args->data),
|
582
|
+
data->out_args->len,
|
583
|
+
data->return_value,
|
584
|
+
data->error);
|
585
|
+
}
|
586
|
+
|
587
|
+
static RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE
|
588
|
+
rb_gi_function_info_invoke_raw_call_without_gvl_body(void *user_data)
|
589
|
+
{
|
590
|
+
InvokeData *data = (InvokeData *)user_data;
|
591
|
+
|
592
|
+
rb_gi_function_info_invoke_raw_call(data);
|
593
|
+
|
594
|
+
return RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE;
|
595
|
+
}
|
596
|
+
|
597
|
+
static gboolean
|
598
|
+
gobject_based_p(GIBaseInfo *info)
|
599
|
+
{
|
600
|
+
GIBaseInfo *container_info;
|
601
|
+
GIRegisteredTypeInfo *registered_type_info;
|
602
|
+
|
603
|
+
container_info = g_base_info_get_container(info);
|
604
|
+
if (g_base_info_get_type(container_info) != GI_INFO_TYPE_STRUCT) {
|
605
|
+
return TRUE;
|
606
|
+
}
|
607
|
+
|
608
|
+
registered_type_info = (GIRegisteredTypeInfo *)container_info;
|
609
|
+
if (g_registered_type_info_get_type_init(registered_type_info)) {
|
610
|
+
return TRUE;
|
611
|
+
}
|
612
|
+
|
613
|
+
return FALSE;
|
614
|
+
}
|
615
|
+
|
553
616
|
VALUE
|
554
|
-
rb_gi_function_info_invoke_raw(GIFunctionInfo *info,
|
555
|
-
int argc, VALUE *argv,
|
617
|
+
rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
|
556
618
|
GIArgument *return_value)
|
557
619
|
{
|
558
620
|
GICallableInfo *callable_info;
|
621
|
+
GIArgument receiver;
|
559
622
|
GArray *in_args, *out_args;
|
560
623
|
GPtrArray *args_metadata;
|
561
624
|
VALUE rb_out_args = Qnil;
|
562
625
|
gboolean succeeded;
|
563
626
|
GError *error = NULL;
|
627
|
+
gboolean unlock_gvl = FALSE;
|
628
|
+
VALUE rb_receiver, rb_arguments, rb_unlock_gvl;
|
629
|
+
|
630
|
+
if (RB_TYPE_P(rb_options, RUBY_T_ARRAY)) {
|
631
|
+
rb_receiver = Qnil;
|
632
|
+
rb_arguments = rb_options;
|
633
|
+
rb_unlock_gvl = Qnil;
|
634
|
+
} else if (NIL_P(rb_options)) {
|
635
|
+
rb_receiver = Qnil;
|
636
|
+
rb_arguments = rb_ary_new();
|
637
|
+
rb_unlock_gvl = Qnil;
|
638
|
+
} else {
|
639
|
+
rb_options = rbg_check_hash_type(rb_options);
|
640
|
+
rbg_scan_options(rb_options,
|
641
|
+
"receiver", &rb_receiver,
|
642
|
+
"arguments", &rb_arguments,
|
643
|
+
"unlock_gvl", &rb_unlock_gvl,
|
644
|
+
NULL);
|
645
|
+
}
|
646
|
+
|
647
|
+
if (NIL_P(rb_receiver)) {
|
648
|
+
receiver.v_pointer = NULL;
|
649
|
+
} else {
|
650
|
+
if (gobject_based_p((GIBaseInfo *)info)) {
|
651
|
+
receiver.v_pointer = RVAL2GOBJ(rb_receiver);
|
652
|
+
} else {
|
653
|
+
receiver.v_pointer = DATA_PTR(rb_receiver);
|
654
|
+
}
|
655
|
+
}
|
656
|
+
rb_arguments = rbg_to_array(rb_arguments);
|
657
|
+
if (!NIL_P(rb_unlock_gvl) && RVAL2CBOOL(rb_unlock_gvl)) {
|
658
|
+
unlock_gvl = TRUE;
|
659
|
+
}
|
564
660
|
|
565
661
|
callable_info = (GICallableInfo *)info;
|
566
662
|
arguments_init(&in_args, &out_args, &args_metadata);
|
567
|
-
if (receiver) {
|
568
|
-
g_array_append_val(in_args,
|
663
|
+
if (receiver.v_pointer) {
|
664
|
+
g_array_append_val(in_args, receiver);
|
569
665
|
}
|
570
|
-
arguments_from_ruby(callable_info,
|
571
|
-
argc, argv,
|
666
|
+
arguments_from_ruby(callable_info, rb_arguments,
|
572
667
|
in_args, out_args, args_metadata);
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
668
|
+
{
|
669
|
+
InvokeData data;
|
670
|
+
data.info = info;
|
671
|
+
data.in_args = in_args;
|
672
|
+
data.out_args = out_args;
|
673
|
+
data.return_value = return_value;
|
674
|
+
data.error = &error;
|
675
|
+
if (unlock_gvl) {
|
676
|
+
rb_thread_call_without_gvl(
|
677
|
+
rb_gi_function_info_invoke_raw_call_without_gvl_body, &data,
|
678
|
+
NULL, NULL);
|
679
|
+
} else {
|
680
|
+
rb_gi_function_info_invoke_raw_call(&data);
|
681
|
+
}
|
682
|
+
succeeded = data.succeeded;
|
683
|
+
}
|
684
|
+
|
580
685
|
if (succeeded) {
|
581
686
|
rb_out_args = out_arguments_to_ruby(callable_info,
|
582
687
|
in_args, out_args,
|
@@ -599,7 +704,7 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, GIArgument *receiver,
|
|
599
704
|
}
|
600
705
|
|
601
706
|
static VALUE
|
602
|
-
rg_invoke(
|
707
|
+
rg_invoke(VALUE self, VALUE rb_options)
|
603
708
|
{
|
604
709
|
GIFunctionInfo *info;
|
605
710
|
GICallableInfo *callable_info;
|
@@ -609,7 +714,8 @@ rg_invoke(int argc, VALUE *argv, VALUE self)
|
|
609
714
|
|
610
715
|
info = SELF(self);
|
611
716
|
/* TODO: use rb_protect() */
|
612
|
-
rb_out_args = rb_gi_function_info_invoke_raw(info,
|
717
|
+
rb_out_args = rb_gi_function_info_invoke_raw(info,
|
718
|
+
rb_options,
|
613
719
|
&return_value);
|
614
720
|
|
615
721
|
callable_info = (GICallableInfo *)info;
|
@@ -649,7 +755,7 @@ rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
|
|
649
755
|
RG_DEF_METHOD(flags, 0);
|
650
756
|
RG_DEF_METHOD(property, 0);
|
651
757
|
RG_DEF_METHOD(vfunc, 0);
|
652
|
-
RG_DEF_METHOD(invoke,
|
758
|
+
RG_DEF_METHOD(invoke, 1);
|
653
759
|
|
654
760
|
G_DEF_CLASS(G_TYPE_I_FUNCTION_INFO_FLAGS, "FunctionInfoFlags", rb_mGI);
|
655
761
|
|
@@ -35,46 +35,20 @@ gi_method_info_get_type(void)
|
|
35
35
|
return type;
|
36
36
|
}
|
37
37
|
|
38
|
-
static gboolean
|
39
|
-
gobject_based_p(GIFunctionInfo *info)
|
40
|
-
{
|
41
|
-
GIBaseInfo *container_info;
|
42
|
-
GIRegisteredTypeInfo *registered_type_info;
|
43
|
-
|
44
|
-
container_info = g_base_info_get_container((GIBaseInfo *)info);
|
45
|
-
if (g_base_info_get_type(container_info) != GI_INFO_TYPE_STRUCT) {
|
46
|
-
return TRUE;
|
47
|
-
}
|
48
|
-
|
49
|
-
registered_type_info = (GIRegisteredTypeInfo *)container_info;
|
50
|
-
if (g_registered_type_info_get_type_init(registered_type_info)) {
|
51
|
-
return TRUE;
|
52
|
-
}
|
53
|
-
|
54
|
-
return FALSE;
|
55
|
-
}
|
56
|
-
|
57
38
|
static VALUE
|
58
|
-
rg_invoke(
|
39
|
+
rg_invoke(VALUE self, VALUE rb_options)
|
59
40
|
{
|
60
41
|
GIFunctionInfo *info;
|
61
42
|
GICallableInfo *callable_info;
|
62
|
-
GIArgument receiver;
|
63
43
|
GIArgument return_value;
|
64
44
|
VALUE rb_out_args;
|
65
45
|
VALUE rb_return_value;
|
66
46
|
|
67
47
|
info = SELF(self);
|
68
48
|
|
69
|
-
/* TODO: check argc >= 1 */
|
70
|
-
if (gobject_based_p(info)) {
|
71
|
-
receiver.v_pointer = RVAL2GOBJ(argv[0]);
|
72
|
-
} else {
|
73
|
-
receiver.v_pointer = DATA_PTR(argv[0]);
|
74
|
-
}
|
75
49
|
/* TODO: use rb_protect */
|
76
|
-
rb_out_args = rb_gi_function_info_invoke_raw(info,
|
77
|
-
|
50
|
+
rb_out_args = rb_gi_function_info_invoke_raw(info,
|
51
|
+
rb_options,
|
78
52
|
&return_value);
|
79
53
|
|
80
54
|
callable_info = (GICallableInfo *)info;
|
@@ -105,5 +79,5 @@ rb_gi_method_info_init(VALUE rb_mGI, VALUE rb_cGIFunctionInfo)
|
|
105
79
|
G_DEF_CLASS_WITH_PARENT(GI_TYPE_METHOD_INFO, "MethodInfo", rb_mGI,
|
106
80
|
rb_cGIFunctionInfo);
|
107
81
|
|
108
|
-
RG_DEF_METHOD(invoke,
|
82
|
+
RG_DEF_METHOD(invoke, 1);
|
109
83
|
}
|
@@ -39,10 +39,6 @@
|
|
39
39
|
# define RB_TYPE_P(object, type) (TYPE(object) == type)
|
40
40
|
#endif
|
41
41
|
|
42
|
-
#ifndef HAVE_TYPE_ENUM_RUBY_VALUE_TYPE
|
43
|
-
# define RUBY_T_FIXNUM T_FIXNUM
|
44
|
-
#endif
|
45
|
-
|
46
42
|
extern void Init_gobject_introspection(void);
|
47
43
|
|
48
44
|
void rb_gi_argument_init (void);
|
@@ -97,8 +93,7 @@ void rb_gi_repository_init (VALUE rb_mGI);
|
|
97
93
|
void rb_gi_loader_init (VALUE rb_mGI);
|
98
94
|
|
99
95
|
VALUE rb_gi_function_info_invoke_raw (GIFunctionInfo *info,
|
100
|
-
|
101
|
-
int argc, VALUE *argv,
|
96
|
+
VALUE rb_options,
|
102
97
|
GIArgument *return_value);
|
103
98
|
|
104
99
|
VALUE rb_gi_field_info_get_field_raw (GIFieldInfo *info,
|
Binary file
|
Binary file
|
@@ -48,5 +48,6 @@ require "gobject-introspection/callable-info"
|
|
48
48
|
require "gobject-introspection/object-info"
|
49
49
|
require "gobject-introspection/interface-info"
|
50
50
|
require "gobject-introspection/struct-info"
|
51
|
+
require "gobject-introspection/boxed-info"
|
51
52
|
require "gobject-introspection/union-info"
|
52
53
|
require "gobject-introspection/loader"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "gobject-introspection/collection-reader"
|
18
|
+
|
19
|
+
module GObjectIntrospection
|
20
|
+
class BoxedInfo
|
21
|
+
extend CollectionReader
|
22
|
+
|
23
|
+
alias_method :__methods__, :methods
|
24
|
+
|
25
|
+
collection_reader("fields")
|
26
|
+
collection_reader("methods")
|
27
|
+
end
|
28
|
+
end
|
@@ -53,6 +53,8 @@ module GObjectIntrospection
|
|
53
53
|
load_function_info(info)
|
54
54
|
when StructInfo
|
55
55
|
load_struct_info(info)
|
56
|
+
when BoxedInfo
|
57
|
+
load_boxed_info(info)
|
56
58
|
when FlagsInfo
|
57
59
|
load_flags_info(info)
|
58
60
|
when EnumInfo
|
@@ -74,6 +76,7 @@ module GObjectIntrospection
|
|
74
76
|
end
|
75
77
|
|
76
78
|
def define_module_function(target_module, name, function_info)
|
79
|
+
unlock_gvl = should_unlock_gvl?(function_info, target_module)
|
77
80
|
validate = lambda do |arguments|
|
78
81
|
method_name = "#{target_module}\#.#{name}"
|
79
82
|
validate_arguments(function_info, method_name, arguments)
|
@@ -81,7 +84,11 @@ module GObjectIntrospection
|
|
81
84
|
target_module.module_eval do
|
82
85
|
define_method(name) do |*arguments, &block|
|
83
86
|
validate.call(arguments, &block)
|
84
|
-
function_info.invoke(
|
87
|
+
function_info.invoke({
|
88
|
+
:arguments => arguments,
|
89
|
+
:unlock_gvl => unlock_gvl,
|
90
|
+
},
|
91
|
+
&block)
|
85
92
|
end
|
86
93
|
module_function(name)
|
87
94
|
end
|
@@ -105,6 +112,17 @@ module GObjectIntrospection
|
|
105
112
|
define_struct(info)
|
106
113
|
end
|
107
114
|
|
115
|
+
def define_boxed(info)
|
116
|
+
klass = self.class.define_class(info.gtype, info.name, @base_module)
|
117
|
+
# TODO
|
118
|
+
# load_fields(info, klass)
|
119
|
+
# load_methods(info, klass)
|
120
|
+
end
|
121
|
+
|
122
|
+
def load_boxed_info(info)
|
123
|
+
define_boxed(info)
|
124
|
+
end
|
125
|
+
|
108
126
|
def load_enum_value(value_info, enum_module)
|
109
127
|
enum_module.const_set(value_info.name.upcase, value_info.value)
|
110
128
|
end
|
@@ -146,19 +164,23 @@ module GObjectIntrospection
|
|
146
164
|
def load_fields(info, klass)
|
147
165
|
info.n_fields.times do |i|
|
148
166
|
field_info = info.get_field(i)
|
149
|
-
|
150
|
-
|
167
|
+
load_field(info, i, field_info, klass)
|
168
|
+
end
|
169
|
+
end
|
151
170
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
171
|
+
def load_field(info, i, field_info, klass)
|
172
|
+
name = field_info.name
|
173
|
+
flags = field_info.flags
|
174
|
+
|
175
|
+
if flags.readable?
|
176
|
+
klass.__send__(:define_method, name) do ||
|
177
|
+
info.get_field_value(self, i)
|
156
178
|
end
|
179
|
+
end
|
157
180
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
end
|
181
|
+
if flags.writable?
|
182
|
+
klass.__send__(:define_method, "#{name}=") do |value|
|
183
|
+
info.set_field_value(self, i, value)
|
162
184
|
end
|
163
185
|
end
|
164
186
|
end
|
@@ -190,9 +212,15 @@ module GObjectIntrospection
|
|
190
212
|
end
|
191
213
|
infos.each do |info|
|
192
214
|
name = "initialize_#{info.name}"
|
215
|
+
unlock_gvl = should_unlock_gvl?(info, klass)
|
193
216
|
klass.__send__(:define_method, name) do |*arguments, &block|
|
194
217
|
validate.call(info, name, arguments, &block)
|
195
|
-
info.invoke(
|
218
|
+
info.invoke({
|
219
|
+
:receiver => self,
|
220
|
+
:arguments => arguments,
|
221
|
+
:unlock_gvl => unlock_gvl,
|
222
|
+
},
|
223
|
+
&block)
|
196
224
|
end
|
197
225
|
klass.__send__(:private, name)
|
198
226
|
end
|
@@ -265,6 +293,10 @@ module GObjectIntrospection
|
|
265
293
|
end
|
266
294
|
end
|
267
295
|
|
296
|
+
def should_unlock_gvl?(function_info, klass)
|
297
|
+
false
|
298
|
+
end
|
299
|
+
|
268
300
|
def load_method_infos(infos, klass)
|
269
301
|
infos.each do |info|
|
270
302
|
method_name = rubyish_method_name(info)
|
@@ -276,6 +308,7 @@ module GObjectIntrospection
|
|
276
308
|
end
|
277
309
|
|
278
310
|
def load_method_info(info, klass, method_name)
|
311
|
+
unlock_gvl = should_unlock_gvl?(info, klass)
|
279
312
|
validate = lambda do |arguments|
|
280
313
|
validate_arguments(info, "#{klass}\##{method_name}", arguments)
|
281
314
|
end
|
@@ -284,7 +317,12 @@ module GObjectIntrospection
|
|
284
317
|
if block.nil? and info.require_callback?
|
285
318
|
Enumerator.new(self, method_name, *arguments)
|
286
319
|
else
|
287
|
-
info.invoke(
|
320
|
+
info.invoke({
|
321
|
+
:receiver => self,
|
322
|
+
:arguments => arguments,
|
323
|
+
:unlock_gvl => unlock_gvl,
|
324
|
+
},
|
325
|
+
&block)
|
288
326
|
end
|
289
327
|
end
|
290
328
|
end
|
@@ -294,6 +332,7 @@ module GObjectIntrospection
|
|
294
332
|
name = rubyish_method_name(info)
|
295
333
|
next if name == "new"
|
296
334
|
next if name == "alloc"
|
335
|
+
unlock_gvl = should_unlock_gvl?(info, klass)
|
297
336
|
validate = lambda do |arguments|
|
298
337
|
validate_arguments(info, "#{klass}.#{name}", arguments)
|
299
338
|
end
|
@@ -303,7 +342,11 @@ module GObjectIntrospection
|
|
303
342
|
if block.nil? and info.require_callback?
|
304
343
|
Enumerator.new(self, name, *arguments)
|
305
344
|
else
|
306
|
-
info.invoke(
|
345
|
+
info.invoke({
|
346
|
+
:arguments => arguments,
|
347
|
+
:unlock_gvl => unlock_gvl,
|
348
|
+
},
|
349
|
+
&block)
|
307
350
|
end
|
308
351
|
end
|
309
352
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -12140,7 +12140,7 @@ linked against at application run time.</doc>
|
|
12140
12140
|
<doc xml:whitespace="preserve">The maximum value which can be held in a #guint8.</doc>
|
12141
12141
|
<type name="guint8" c:type="guint8"/>
|
12142
12142
|
</constant>
|
12143
|
-
<constant name="MICRO_VERSION" value="
|
12143
|
+
<constant name="MICRO_VERSION" value="2" c:type="GLIB_MICRO_VERSION">
|
12144
12144
|
<doc xml:whitespace="preserve">The micro version number of the GLib library.
|
12145
12145
|
|
12146
12146
|
Like #gtk_micro_version, but from the headers used at
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gobject-introspection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: x86-mingw32
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: glib2
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
21
|
+
version: 2.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
29
|
+
version: 2.0.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: test-unit
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- extconf.rb
|
54
54
|
- lib/gobject-introspection.rb
|
55
|
+
- lib/gobject-introspection/boxed-info.rb
|
55
56
|
- lib/gobject-introspection/callable-info.rb
|
56
57
|
- lib/gobject-introspection/collection-reader.rb
|
57
58
|
- lib/gobject-introspection/interface-info.rb
|