How is the type converted



Hi,
I'am reading the XS source code of the Gtk2. But I'm confuse about the
type convertion between Perl object and GObject.

I found the typemap file in Gtk2/build/gtk2perl.typemap, all
widget point is using T_GPERL_GENERIC_WRAPPER, which declared in
Glib/typemap. According to the INPUT and OUTPUT section,
GtkWidget will use SvGtkWidget and newSVGtkWidget to convert. The
function is declared in Gtk2/build/gtk2perl-autogen.h which
called gperl_get_object_check and gtk2perl_new_gtkobject. But I
can find where are gperl_get_object_check and
gtk2perl_new_gtkobject defined. I checked all .c files in Gtk2
and Glib, but seem there are no files define them.

By the way, I wonder why the object create by Gtk2::Window->new contain
an empty hash, but the function in c can find the pointer of the window.
I use Devel::Peek to Dump the object:
    SV = RV(0x817da1c) at 0x8153720
      REFCNT = 1
      FLAGS = (ROK)
      RV = 0x83ee1d0
      SV = PVHV(0x841e2c8) at 0x83ee1d0
        REFCNT = 1
        FLAGS = (OBJECT,RMG,SHAREKEYS)
        IV = 0
        NV = 0
        MAGIC = 0x8580a48
          MG_VIRTUAL = 0
          MG_TYPE = PERL_MAGIC_ext(~)
          MG_PTR = 0x8570800 ""
        STASH = 0x83ee1a0       "Gtk2::Window"
        ARRAY = 0x85814c0
        KEYS = 0
        FILL = 0
        MAX = 7
        RITER = -1
        EITER = 0x0

Is it because of the PERL_MAGIC_ext?
--
Best regards,
Ye Wenbin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]