Imported Upstream version 0.028
intrigeri
9 years ago
396 | 396 | info_type = g_base_info_get_type (info); |
397 | 397 | name = g_base_info_get_name (info); |
398 | 398 | |
399 | dwarn ("setting up %s.%s\n", namespace, name); | |
399 | dwarn ("setting up %s::%s\n", namespace, name); | |
400 | 400 | |
401 | 401 | if (info_type == GI_INFO_TYPE_CONSTANT) { |
402 | 402 | av_push (constants, newSVpv (name, 0)); |
447 | 447 | |
448 | 448 | type = get_gtype ((GIRegisteredTypeInfo *) info); |
449 | 449 | if (!type) { |
450 | ccroak ("Could not find GType for type %s::%s", | |
450 | ccroak ("Could not find GType for type %s%s", | |
451 | 451 | namespace, name); |
452 | 452 | } |
453 | 453 | if (type == G_TYPE_NONE) { |
542 | 542 | reg_info = g_irepository_find_by_name (repository, reg_basename, reg_name); |
543 | 543 | reg_type = reg_info ? get_gtype (reg_info) : 0; |
544 | 544 | if (!reg_type) |
545 | ccroak ("Could not lookup GType for type %s.%s", | |
545 | ccroak ("Could not lookup GType for type %s%s", | |
546 | 546 | reg_basename, reg_name); |
547 | 547 | |
548 | 548 | /* The GType in question (e.g., GdkRectangle) hasn't been loaded yet, |
758 | 758 | GType gtype; |
759 | 759 | gpointer klass; |
760 | 760 | CODE: |
761 | dwarn ("_install_overrides: %s.%s for %s\n", | |
761 | dwarn ("_install_overrides: %s%s for %s\n", | |
762 | 762 | basename, object_name, target_package); |
763 | 763 | repository = g_irepository_get_default (); |
764 | 764 | info = g_irepository_find_by_name (repository, basename, object_name); |
855 | 855 | gint field_offset; |
856 | 856 | gpointer func_pointer; |
857 | 857 | PPCODE: |
858 | dwarn ("_invoke_fallback_vfunc: %s.%s, target = %s\n", | |
858 | dwarn ("_invoke_fallback_vfunc: %s::%s, target = %s\n", | |
859 | 859 | vfunc_package, vfunc_name, target_package); |
860 | 860 | gtype = gperl_object_type_from_package (target_package); |
861 | 861 | klass = g_type_class_peek (gtype); |
3 | 3 | "Glib::Object::Introspection Team <gtk-perl-list at gnome dot org>" |
4 | 4 | ], |
5 | 5 | "dynamic_config" : 1, |
6 | "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520", | |
6 | "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240", | |
7 | 7 | "license" : [ |
8 | 8 | "lgpl_2_1" |
9 | 9 | ], |
65 | 65 | "x_IRC" : "irc://irc.gimp.org/#gtk-perl", |
66 | 66 | "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list" |
67 | 67 | }, |
68 | "version" : "0.025" | |
68 | "version" : "0.028" | |
69 | 69 | } |
9 | 9 | ExtUtils::PkgConfig: '1' |
10 | 10 | Glib: '1.28' |
11 | 11 | dynamic_config: 1 |
12 | generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520' | |
12 | generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.143240' | |
13 | 13 | license: lgpl |
14 | 14 | meta-spec: |
15 | 15 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
35 | 35 | homepage: http://gtk2-perl.sourceforge.net |
36 | 36 | license: http://www.gnu.org/licenses/lgpl-2.1.html |
37 | 37 | repository: git://git.gnome.org/perl-Glib-Object-Introspection |
38 | version: '0.025' | |
38 | version: '0.028' |
0 | Overview of changes in Glib::Object::Introspection 0.028 | |
1 | ======================================================== | |
2 | ||
3 | * Harmonize the format of type names in error messages | |
4 | * Add a FIXME about a corner case of GInitiallyUnowned handling | |
5 | ||
6 | Overview of changes in Glib::Object::Introspection 0.027 | |
7 | ======================================================== | |
8 | ||
9 | * Fix compilation problems when NOISY is defined | |
10 | * Move the handling of void record fields into the field accessors | |
11 | * Rename a few variables for clarity | |
12 | ||
13 | Overview of changes in Glib::Object::Introspection 0.026 | |
14 | ======================================================== | |
15 | ||
16 | * Fix t/enums.t for older versions of Test::More | |
17 | ||
0 | 18 | Overview of changes in Glib::Object::Introspection 0.025 |
1 | 19 | ======================================================== |
2 | 20 |
54 | 54 | get_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer) |
55 | 55 | { |
56 | 56 | GITypeInfo *field_type; |
57 | GITypeTag field_tag; | |
57 | 58 | GIBaseInfo *interface_info; |
59 | GIInfoType interface_type; | |
58 | 60 | GIArgument value; |
59 | 61 | SV *sv = NULL; |
60 | 62 | |
61 | 63 | field_type = g_field_info_get_type (field_info); |
64 | field_tag = g_type_info_get_tag (field_type); | |
62 | 65 | interface_info = g_type_info_get_interface (field_type); |
63 | ||
64 | /* This case is not handled by g_field_info_set_field. */ | |
66 | interface_type = interface_info | |
67 | ? g_base_info_get_type (interface_info) | |
68 | : GI_INFO_TYPE_INVALID; | |
69 | ||
70 | /* Non-pointer structs are not handled by g_field_info_get_field. */ | |
65 | 71 | if (!g_type_info_is_pointer (field_type) && |
66 | g_type_info_get_tag (field_type) == GI_TYPE_TAG_INTERFACE && | |
67 | g_base_info_get_type (interface_info) == GI_INFO_TYPE_STRUCT) | |
68 | { | |
69 | gint offset; | |
70 | offset = g_field_info_get_offset (field_info); | |
71 | value.v_pointer = mem + offset; | |
72 | field_tag == GI_TYPE_TAG_INTERFACE && | |
73 | interface_type == GI_INFO_TYPE_STRUCT) | |
74 | { | |
75 | gint offset = g_field_info_get_offset (field_info); | |
76 | value.v_pointer = G_STRUCT_MEMBER_P (mem, offset); | |
72 | 77 | sv = arg_to_sv (&value, |
73 | 78 | field_type, |
74 | 79 | GI_TRANSFER_NOTHING, |
75 | 80 | NULL); |
76 | } else if (g_field_info_get_field (field_info, mem, &value)) { | |
81 | } | |
82 | ||
83 | /* Neither are void pointers. We retrieve the RV to the SV that | |
84 | * set_field put into them. */ | |
85 | else if (field_tag == GI_TYPE_TAG_VOID && | |
86 | g_type_info_is_pointer (field_type)) | |
87 | { | |
88 | gint offset = g_field_info_get_offset (field_info); | |
89 | value.v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset); | |
90 | sv = value.v_pointer | |
91 | ? newRV (value.v_pointer) | |
92 | : &PL_sv_undef; | |
93 | } | |
94 | ||
95 | else if (g_field_info_get_field (field_info, mem, &value)) { | |
77 | 96 | sv = arg_to_sv (&value, |
78 | 97 | field_type, |
79 | 98 | transfer, |
80 | 99 | NULL); |
81 | } else { | |
100 | } | |
101 | ||
102 | else { | |
82 | 103 | ccroak ("Could not get field '%s'", |
83 | 104 | g_base_info_get_name (field_info)); |
84 | 105 | } |
94 | 115 | set_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer, SV *sv) |
95 | 116 | { |
96 | 117 | GITypeInfo *field_type; |
118 | GITypeTag field_tag; | |
97 | 119 | GIBaseInfo *interface_info; |
98 | GITypeTag tag; | |
99 | GIInfoType info_type; | |
120 | GIInfoType interface_type; | |
100 | 121 | GIArgument arg; |
101 | 122 | |
102 | 123 | field_type = g_field_info_get_type (field_info); |
103 | tag = g_type_info_get_tag (field_type); | |
124 | field_tag = g_type_info_get_tag (field_type); | |
104 | 125 | interface_info = g_type_info_get_interface (field_type); |
105 | info_type = interface_info | |
126 | interface_type = interface_info | |
106 | 127 | ? g_base_info_get_type (interface_info) |
107 | 128 | : GI_INFO_TYPE_INVALID; |
108 | 129 | |
109 | 130 | /* Structs are not handled by g_field_info_set_field. */ |
110 | if (tag == GI_TYPE_TAG_INTERFACE && | |
111 | info_type == GI_INFO_TYPE_STRUCT) | |
131 | if (field_tag == GI_TYPE_TAG_INTERFACE && | |
132 | interface_type == GI_INFO_TYPE_STRUCT) | |
112 | 133 | { |
113 | 134 | /* FIXME: No GIArgInfo and no GPerlI11nInvocationInfo here. |
114 | 135 | * What if the struct contains an object pointer, or a callback |
121 | 142 | * 'mem' */ |
122 | 143 | arg.v_pointer = sv_to_struct (GI_TRANSFER_NOTHING, |
123 | 144 | interface_info, |
124 | info_type, | |
145 | interface_type, | |
125 | 146 | sv); |
126 | 147 | size = g_struct_info_get_size (interface_info); |
127 | g_memmove (mem + offset, arg.v_pointer, size); | |
148 | g_memmove (G_STRUCT_MEMBER_P (mem, offset), arg.v_pointer, size); | |
128 | 149 | } else { /* Pointer */ |
129 | 150 | GType gtype = get_gtype (interface_info); |
130 | 151 | if (g_type_is_a (gtype, G_TYPE_BOXED)) { |
149 | 170 | G_STRUCT_MEMBER (gpointer, mem, offset) = |
150 | 171 | sv_to_struct (GI_TRANSFER_NOTHING, |
151 | 172 | interface_info, |
152 | info_type, | |
173 | interface_type, | |
153 | 174 | sv); |
154 | 175 | } |
155 | 176 | } |
156 | 177 | } |
157 | 178 | |
158 | 179 | /* Neither are void pointers. We put an RV to the SV into them, which |
159 | * goes hand in hand with what get_field() is doing above via | |
160 | * arg_to_sv(). */ | |
161 | else if (tag == GI_TYPE_TAG_VOID && | |
180 | * goes hand in hand with what get_field() is doing above. */ | |
181 | else if (field_tag == GI_TYPE_TAG_VOID && | |
162 | 182 | g_type_info_is_pointer (field_type)) |
163 | 183 | { |
164 | 184 | gint offset = g_field_info_get_offset (field_info); |
165 | sv_to_arg (sv, &arg, NULL, field_type, | |
166 | transfer, TRUE, NULL); | |
167 | G_STRUCT_MEMBER (gpointer, mem, offset) = arg.v_pointer; | |
185 | if (!gperl_sv_is_ref (sv)) | |
186 | ccroak ("Can only put references into void fields"); | |
187 | G_STRUCT_MEMBER (gpointer, mem, offset) = SvRV (sv); | |
168 | 188 | } |
169 | 189 | |
170 | 190 | else { |
349 | 349 | dwarn ("C invoke: %s\n" |
350 | 350 | " n_args: %d, n_invoke_args: %d, n_given_args: %d\n" |
351 | 351 | " is_constructor: %d, is_method: %d\n", |
352 | iinfo->is_vfunc ? g_base_info_get_name (info) : g_function_info_get_symbol (info), | |
353 | iinfo->n_args, iinfo->n_invoke_args, iinfo->n_given_args, | |
352 | iinfo->base.is_vfunc ? g_base_info_get_name (info) : g_function_info_get_symbol (info), | |
353 | iinfo->base.n_args, iinfo->n_invoke_args, iinfo->n_given_args, | |
354 | 354 | iinfo->is_constructor, iinfo->is_method); |
355 | 355 | |
356 | 356 | /* allocate enough space for all args in both the out and in lists. |
437 | 437 | |
438 | 438 | /* We need to undo the special handling that GInitiallyUnowned |
439 | 439 | * descendants receive from gobject-introspection: values of this type |
440 | * are always marked transfer=none, even for constructors. */ | |
440 | * are always marked transfer=none, even for constructors. | |
441 | * | |
442 | * FIXME: This is not correct for GtkWindow and its descendants, as | |
443 | * gtk+ keeps an internal reference to each window. Hence, | |
444 | * constructors like gtk_window_new return a non-floating object and do | |
445 | * not pass ownership of a reference on to us. But the sink func | |
446 | * currently registered for GInitiallyUnowned (sink_initially_unowned | |
447 | * in GObject.xs in Glib) is actually inadvertently conforming to this | |
448 | * requirement. It runs ref_sink+unref regardless of whether the | |
449 | * object is floating or not. So, in the non-floating window case, it | |
450 | * does nothing, resulting in an extra reference taken, despite the | |
451 | * request to transfer ownership. | |
452 | * | |
453 | * If we ever encounter a constructor of a GInitiallyUnowned descendant | |
454 | * that returns a non-floating object and passes ownership of a | |
455 | * reference on to us, or a constructor of a GInitiallyUnowned | |
456 | * descendant that returns a floating object but passes no reference on | |
457 | * to us, then we need to revisit this. */ | |
441 | 458 | if (iinfo->is_constructor && |
442 | 459 | g_type_info_get_tag (iinfo->base.return_type_info) == GI_TYPE_TAG_INTERFACE) |
443 | 460 | { |
366 | 366 | GITypeInfo *length_arg_type = iinfo->base.arg_types[pos]; |
367 | 367 | raw_to_arg (args[pos], &iinfo->base.aux_args[pos], length_arg_type); |
368 | 368 | dwarn (" pos %d is array length => %"G_GSIZE_FORMAT"\n", |
369 | pos, iinfo->aux_args[pos].v_size); | |
369 | pos, iinfo->base.aux_args[pos].v_size); | |
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
31 | 31 | case GI_TYPE_TAG_VOID: |
32 | 32 | /* returns NULL if no match is found */ |
33 | 33 | arg->v_pointer = sv_to_callback_data (sv, invocation_info); |
34 | if (!arg->v_pointer && g_type_info_is_pointer (type_info) | |
35 | && gperl_sv_is_ref (sv)) | |
36 | { | |
37 | arg->v_pointer = SvRV (sv); | |
38 | } | |
39 | 34 | dwarn (" argument with no type information -> pointer %p\n", |
40 | 35 | arg->v_pointer); |
41 | 36 | break; |
167 | 162 | SV *sv = callback_data_to_sv (arg->v_pointer, iinfo); |
168 | 163 | if (sv) { |
169 | 164 | SvREFCNT_inc (sv); |
170 | } else { | |
171 | if (arg->v_pointer && g_type_info_is_pointer (info)) { | |
172 | sv = newRV (arg->v_pointer); | |
173 | } | |
174 | 165 | } |
175 | 166 | dwarn (" argument with no type information -> SV %p\n", sv); |
176 | 167 | return sv ? sv : &PL_sv_undef; |
18 | 18 | use warnings; |
19 | 19 | use Glib; |
20 | 20 | |
21 | our $VERSION = '0.025'; | |
21 | our $VERSION = '0.028'; | |
22 | 22 | |
23 | 23 | use Carp; |
24 | 24 | $Carp::Internal{(__PACKAGE__)}++; |
8 | 8 | |
9 | 9 | is (Regress::test_enum_param ('value1'), 'value1'); |
10 | 10 | is (Regress::test_unsigned_enum_param ('value2'), 'value2'); |
11 | ok (Regress::global_get_flags_out () == ['flag1', 'flag3']); | |
11 | cmp_ok (Regress::global_get_flags_out (), '==', ['flag1', 'flag3']); | |
12 | 12 | |
13 | 13 | SKIP: { |
14 | 14 | skip 'non-GType flags tests', 1 |
15 | 15 | unless (check_gi_version (0, 10, 3)); |
16 | 16 | |
17 | 17 | GI::no_type_flags_in ([qw/value2/]); |
18 | is (GI::no_type_flags_returnv (), [qw/value2/]); | |
18 | cmp_ok (GI::no_type_flags_returnv (), '==', [qw/value2/]); | |
19 | 19 | } |