Index: GBoxed.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GBoxed.xs,v retrieving revision 1.11 diff -i -r1.11 GBoxed.xs 484a485,515 > > > static BoxedInfo * > lookup_known_package_recursive (const char * package) > { > BoxedInfo * boxed_info = > g_hash_table_lookup (info_by_package, package); > > if (!boxed_info) { > int i; > char * isa_name = form ("%s::ISA", package); > AV * isa = get_av (isa_name, FALSE); > if (!isa) > return NULL; > for (i = 0 ; i <= av_len (isa); i++) { > SV ** sv = av_fetch (isa, i, FALSE); > char * p = sv ? SvPV_nolen (*sv) : NULL; > if (p) { > boxed_info = > lookup_known_package_recursive (p); > if (boxed_info) > break; > } > } > } > > return boxed_info; > } > > > 490a522,576 > > =for object Glib::Boxed Generic wrappers for C structures > > =head1 DESCRIPTION > > Glib::Boxed is a generic wrapper mechanism for arbitrary C structures. > For the most part you don't care about this as a Perl developer, but it > is important to know that all Glib::Boxed descendents can be copied with > the C method. > > =cut > > =for apidoc > =for signature copy_of_boxed = $boxed->copy > Create and return a new copy of I<$boxed>. > =cut > SV * > copy (SV * sv) > PREINIT: > BoxedInfo * boxed_info; > GPerlBoxedWrapperClass * class; > gpointer boxed; > char * package; > CODE: > /* the sticky part is that we have to decipher from the SV what gtype > * we actually have; but the SV may have been blessed into some > * other type. however, if we got here, then Glib::Boxed is in the > * @ISA somewhere, so we should be able to walk the inheritance > * tree until we find a valid GType. */ > package = sv_reftype (SvRV (sv), TRUE); > G_LOCK (info_by_package); > boxed_info = lookup_known_package_recursive (package); > G_UNLOCK (info_by_package); > > if (!boxed_info) > croak ("can't find boxed class registration info for %s\n", > package); > > class = boxed_info->wrapper_class > ? boxed_info->wrapper_class > : &_default_wrapper_class; > > if (!class->wrap) > croak ("no function to wrap boxed objects of type %s / %s", > g_type_name (boxed_info->gtype), boxed_info->package); > if (!class->unwrap) > croak ("no function to unwrap boxed objects of type %s / %s", > g_type_name (boxed_info->gtype), boxed_info->package); > > boxed = class->unwrap (boxed_info->gtype, boxed_info->package, sv); > > RETVAL = class->wrap (boxed_info->gtype, boxed_info->package, > g_boxed_copy (boxed_info->gtype, boxed), TRUE); > OUTPUT: > RETVAL