Codebase list libglib-object-introspection-perl / d9b10c1
Imported Upstream version 0.028 intrigeri 9 years ago
10 changed file(s) with 96 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
396396 info_type = g_base_info_get_type (info);
397397 name = g_base_info_get_name (info);
398398
399 dwarn ("setting up %s.%s\n", namespace, name);
399 dwarn ("setting up %s::%s\n", namespace, name);
400400
401401 if (info_type == GI_INFO_TYPE_CONSTANT) {
402402 av_push (constants, newSVpv (name, 0));
447447
448448 type = get_gtype ((GIRegisteredTypeInfo *) info);
449449 if (!type) {
450 ccroak ("Could not find GType for type %s::%s",
450 ccroak ("Could not find GType for type %s%s",
451451 namespace, name);
452452 }
453453 if (type == G_TYPE_NONE) {
542542 reg_info = g_irepository_find_by_name (repository, reg_basename, reg_name);
543543 reg_type = reg_info ? get_gtype (reg_info) : 0;
544544 if (!reg_type)
545 ccroak ("Could not lookup GType for type %s.%s",
545 ccroak ("Could not lookup GType for type %s%s",
546546 reg_basename, reg_name);
547547
548548 /* The GType in question (e.g., GdkRectangle) hasn't been loaded yet,
758758 GType gtype;
759759 gpointer klass;
760760 CODE:
761 dwarn ("_install_overrides: %s.%s for %s\n",
761 dwarn ("_install_overrides: %s%s for %s\n",
762762 basename, object_name, target_package);
763763 repository = g_irepository_get_default ();
764764 info = g_irepository_find_by_name (repository, basename, object_name);
855855 gint field_offset;
856856 gpointer func_pointer;
857857 PPCODE:
858 dwarn ("_invoke_fallback_vfunc: %s.%s, target = %s\n",
858 dwarn ("_invoke_fallback_vfunc: %s::%s, target = %s\n",
859859 vfunc_package, vfunc_name, target_package);
860860 gtype = gperl_object_type_from_package (target_package);
861861 klass = g_type_class_peek (gtype);
33 "Glib::Object::Introspection Team <gtk-perl-list at gnome dot org>"
44 ],
55 "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",
77 "license" : [
88 "lgpl_2_1"
99 ],
6565 "x_IRC" : "irc://irc.gimp.org/#gtk-perl",
6666 "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list"
6767 },
68 "version" : "0.025"
68 "version" : "0.028"
6969 }
99 ExtUtils::PkgConfig: '1'
1010 Glib: '1.28'
1111 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'
1313 license: lgpl
1414 meta-spec:
1515 url: http://module-build.sourceforge.net/META-spec-v1.4.html
3535 homepage: http://gtk2-perl.sourceforge.net
3636 license: http://www.gnu.org/licenses/lgpl-2.1.html
3737 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
018 Overview of changes in Glib::Object::Introspection 0.025
119 ========================================================
220
5454 get_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer)
5555 {
5656 GITypeInfo *field_type;
57 GITypeTag field_tag;
5758 GIBaseInfo *interface_info;
59 GIInfoType interface_type;
5860 GIArgument value;
5961 SV *sv = NULL;
6062
6163 field_type = g_field_info_get_type (field_info);
64 field_tag = g_type_info_get_tag (field_type);
6265 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. */
6571 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);
7277 sv = arg_to_sv (&value,
7378 field_type,
7479 GI_TRANSFER_NOTHING,
7580 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)) {
7796 sv = arg_to_sv (&value,
7897 field_type,
7998 transfer,
8099 NULL);
81 } else {
100 }
101
102 else {
82103 ccroak ("Could not get field '%s'",
83104 g_base_info_get_name (field_info));
84105 }
94115 set_field (GIFieldInfo *field_info, gpointer mem, GITransfer transfer, SV *sv)
95116 {
96117 GITypeInfo *field_type;
118 GITypeTag field_tag;
97119 GIBaseInfo *interface_info;
98 GITypeTag tag;
99 GIInfoType info_type;
120 GIInfoType interface_type;
100121 GIArgument arg;
101122
102123 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);
104125 interface_info = g_type_info_get_interface (field_type);
105 info_type = interface_info
126 interface_type = interface_info
106127 ? g_base_info_get_type (interface_info)
107128 : GI_INFO_TYPE_INVALID;
108129
109130 /* 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)
112133 {
113134 /* FIXME: No GIArgInfo and no GPerlI11nInvocationInfo here.
114135 * What if the struct contains an object pointer, or a callback
121142 * 'mem' */
122143 arg.v_pointer = sv_to_struct (GI_TRANSFER_NOTHING,
123144 interface_info,
124 info_type,
145 interface_type,
125146 sv);
126147 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);
128149 } else { /* Pointer */
129150 GType gtype = get_gtype (interface_info);
130151 if (g_type_is_a (gtype, G_TYPE_BOXED)) {
149170 G_STRUCT_MEMBER (gpointer, mem, offset) =
150171 sv_to_struct (GI_TRANSFER_NOTHING,
151172 interface_info,
152 info_type,
173 interface_type,
153174 sv);
154175 }
155176 }
156177 }
157178
158179 /* 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 &&
162182 g_type_info_is_pointer (field_type))
163183 {
164184 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);
168188 }
169189
170190 else {
349349 dwarn ("C invoke: %s\n"
350350 " n_args: %d, n_invoke_args: %d, n_given_args: %d\n"
351351 " 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,
354354 iinfo->is_constructor, iinfo->is_method);
355355
356356 /* allocate enough space for all args in both the out and in lists.
437437
438438 /* We need to undo the special handling that GInitiallyUnowned
439439 * 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. */
441458 if (iinfo->is_constructor &&
442459 g_type_info_get_tag (iinfo->base.return_type_info) == GI_TYPE_TAG_INTERFACE)
443460 {
366366 GITypeInfo *length_arg_type = iinfo->base.arg_types[pos];
367367 raw_to_arg (args[pos], &iinfo->base.aux_args[pos], length_arg_type);
368368 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);
370370 }
371371 }
372372 }
3131 case GI_TYPE_TAG_VOID:
3232 /* returns NULL if no match is found */
3333 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 }
3934 dwarn (" argument with no type information -> pointer %p\n",
4035 arg->v_pointer);
4136 break;
167162 SV *sv = callback_data_to_sv (arg->v_pointer, iinfo);
168163 if (sv) {
169164 SvREFCNT_inc (sv);
170 } else {
171 if (arg->v_pointer && g_type_info_is_pointer (info)) {
172 sv = newRV (arg->v_pointer);
173 }
174165 }
175166 dwarn (" argument with no type information -> SV %p\n", sv);
176167 return sv ? sv : &PL_sv_undef;
1818 use warnings;
1919 use Glib;
2020
21 our $VERSION = '0.025';
21 our $VERSION = '0.028';
2222
2323 use Carp;
2424 $Carp::Internal{(__PACKAGE__)}++;
88
99 is (Regress::test_enum_param ('value1'), 'value1');
1010 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']);
1212
1313 SKIP: {
1414 skip 'non-GType flags tests', 1
1515 unless (check_gi_version (0, 10, 3));
1616
1717 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/]);
1919 }