On Tue, Aug 17, 2004 at 09:01:39AM +0200, Leopold Toetsch wrote:
> >> It returns a PerlUndef.
> >     60 dlfunc P2, P1, "g_signal_connect", "lptpP"   - \
> >     P2=NCI=PMC(0x8363fd0), P1=ParrotLibrary=PMC(0x8364108), ,
> >     65 store_global "Gtk::g_signal_connec", P2      - , \
> >        P2=PerlUndef=PMC(0x8363fb8 Num:0 Int:0)
>             ^^^^^^^^^
> 
> The symbol "g_signal_connect" isn't found in that lib.
ow.. ok, this one is actaully a macro.. the actual function is

  gulong  g_signal_connect_object  (gpointer instance,
                                    const gchar *detailed_signal,
                                    GCallback c_handler,
                                    gpointer gobject,
                                    GConnectFlags connect_flags);

so I've changed this and now it does find it. And it does seem to
"callback" as well, but there must something else wrong (or I'm
missing something) as it dies anyway.

Attached are again the test files, plus two dumps of my tries to
run it.  In one of them (run.null) I simply null the user data
to be passed through. In that case it displays the button but
dies as soon as it is clicked on (in this case it dies because
the user data is null actually, but at least it let me now it does
actually callback :) Parrot_callback_D then verify_CD).

On other one (run), there is an actual (not null) user data.
Know it goes somewhere into the g_signal function and (guess)
also someway back.. but I'm really blind as to what is really
happening there..?

> leo
Thanks
Stephane
     8 saveall
     9 loadlib P1, "libgtk-x11-2.0"     - P1=NULL, 
    12 dlfunc P2, P1, "gtk_init", "vii"         - P2=NULL, 
P1=ParrotLibrary=PMC(0x8364108), , 
    17 store_global "Gtk::gtk_init", P2         - , P2=NCI=PMC(0x8364048)
    20 dlfunc P2, P1, "gtk_main", "vv"          - P2=NCI=PMC(0x8364048), 
P1=ParrotLibrary=PMC(0x8364108), , 
       GC
    25 store_global "Gtk::gtk_main", P2         - , P2=NCI=PMC(0x8364030)
    28 dlfunc P2, P1, "gtk_widget_show", "vp"   - P2=NCI=PMC(0x8364030), 
P1=ParrotLibrary=PMC(0x8364108), , 
    33 store_global "Gtk::gtk_widget_show", P2          - , P2=NCI=PMC(0x8364018)
    36 dlfunc P2, P1, "gtk_container_add", "vpp"        - P2=NCI=PMC(0x8364018), 
P1=ParrotLibrary=PMC(0x8364108), , 
    41 store_global "Gtk::gtk_container_a", P2          - , P2=NCI=PMC(0x8364000)
       GC
    44 dlfunc P2, P1, "gtk_button_new_with_", "pt"      - P2=NCI=PMC(0x8364000), 
P1=ParrotLibrary=PMC(0x8364108), , 
    49 store_global "Gtk::gtk_button_new_", P2          - , P2=NCI=PMC(0x8363fe8)
    52 dlfunc P2, P1, "gtk_window_new", "pi"    - P2=NCI=PMC(0x8363fe8), 
P1=ParrotLibrary=PMC(0x8364108), , 
    57 store_global "Gtk::gtk_window_new", P2   - , P2=NCI=PMC(0x8363fd0)
       GC
    60 dlfunc P2, P1, "g_signal_connect_obj", "lptpPi"          - 
P2=NCI=PMC(0x8363fd0), P1=ParrotLibrary=PMC(0x8364108), , 
    65 store_global "Gtk::g_signal_connec", P2          - , P2=NCI=PMC(0x8363fb8)
    68 restoreall
    69 find_global P0, "Gtk::gtk_init"          - P0=NULL, 
    72 set I5, 0        - I5=0, 
    75 invoke
    76 find_global P0, "Gtk::gtk_window_new"    - P0=NCI=PMC(0x8364048), 
       GC
    79 null I5          - I5=0
    81 invoke
    82 set P15, P5      - P15=NULL, P5=UnManagedStruct=PMC(0x8363fa0)
    85 find_global P0, "Gtk::gtk_button_new_"   - P0=NCI=PMC(0x8363fd0), 
    88 set S5, "Parrot"         - , 
    91 invoke
    92 set P6, P5       - P6=NULL, P5=UnManagedStruct=PMC(0x8363f88)
       GC
    95 set P11, P5      - P11=NULL, P5=UnManagedStruct=PMC(0x8363f88)
    98 newsub P6, 22, -98       - P6=UnManagedStruct=PMC(0x8363f88), , 
   102 new P7, 31       - P7=NULL, 
   105 set P7, 42       - P7=Integer=PMC(0x8363f58), 
   108 new_callback P5, P6, P7, "Ut"    - P5=UnManagedStruct=PMC(0x8363f88), 
P6=Sub=PMC(0x8363f70 Adr:0x84e6628), P7=Integer=PMC(0x8363f58), 
       GC
   113 find_global P0, "Gtk::g_signal_connec"   - P0=NCI=PMC(0x8363fe8), 
   116 set S5, "clicked"        - S5="Parrot", 
   119 set I5, 0        - I5=0, 
   122 set P6, P5       - P6=Sub=PMC(0x8363f70 Adr:0x84e6628), 
P5=UnManagedStruct=PMC(0x8363ef8)
   125 set P5, P11      - P5=UnManagedStruct=PMC(0x8363ef8), 
P11=UnManagedStruct=PMC(0x8363f88)
       GC
   128 invoke
Segmentation fault
     8 saveall
     9 loadlib P1, "libgtk-x11-2.0"     - P1=NULL, 
    12 dlfunc P2, P1, "gtk_init", "vii"         - P2=NULL, 
P1=ParrotLibrary=PMC(0x8364108), , 
    17 store_global "Gtk::gtk_init", P2         - , P2=NCI=PMC(0x8364048)
    20 dlfunc P2, P1, "gtk_main", "vv"          - P2=NCI=PMC(0x8364048), 
P1=ParrotLibrary=PMC(0x8364108), , 
       GC
    25 store_global "Gtk::gtk_main", P2         - , P2=NCI=PMC(0x8364030)
    28 dlfunc P2, P1, "gtk_widget_show", "vp"   - P2=NCI=PMC(0x8364030), 
P1=ParrotLibrary=PMC(0x8364108), , 
    33 store_global "Gtk::gtk_widget_show", P2          - , P2=NCI=PMC(0x8364018)
    36 dlfunc P2, P1, "gtk_container_add", "vpp"        - P2=NCI=PMC(0x8364018), 
P1=ParrotLibrary=PMC(0x8364108), , 
    41 store_global "Gtk::gtk_container_a", P2          - , P2=NCI=PMC(0x8364000)
       GC
    44 dlfunc P2, P1, "gtk_button_new_with_", "pt"      - P2=NCI=PMC(0x8364000), 
P1=ParrotLibrary=PMC(0x8364108), , 
    49 store_global "Gtk::gtk_button_new_", P2          - , P2=NCI=PMC(0x8363fe8)
    52 dlfunc P2, P1, "gtk_window_new", "pi"    - P2=NCI=PMC(0x8363fe8), 
P1=ParrotLibrary=PMC(0x8364108), , 
    57 store_global "Gtk::gtk_window_new", P2   - , P2=NCI=PMC(0x8363fd0)
       GC
    60 dlfunc P2, P1, "g_signal_connect_obj", "lptpPi"          - 
P2=NCI=PMC(0x8363fd0), P1=ParrotLibrary=PMC(0x8364108), , 
    65 store_global "Gtk::g_signal_connec", P2          - , P2=NCI=PMC(0x8363fb8)
    68 restoreall
    69 find_global P0, "Gtk::gtk_init"          - P0=NULL, 
    72 set I5, 0        - I5=0, 
    75 invoke
    76 find_global P0, "Gtk::gtk_window_new"    - P0=NCI=PMC(0x8364048), 
       GC
    79 null I5          - I5=0
    81 invoke
    82 set P15, P5      - P15=NULL, P5=UnManagedStruct=PMC(0x8363fa0)
    85 find_global P0, "Gtk::gtk_button_new_"   - P0=NCI=PMC(0x8363fd0), 
    88 set S5, "Parrot"         - , 
    91 invoke
    92 set P6, P5       - P6=NULL, P5=UnManagedStruct=PMC(0x8363f88)
       GC
    95 set P11, P5      - P11=NULL, P5=UnManagedStruct=PMC(0x8363f88)
    98 newsub P6, 22, -98       - P6=UnManagedStruct=PMC(0x8363f88), , 
   102 new P7, 31       - P7=NULL, 
   105 set P7, 42       - P7=Integer=PMC(0x8363f58), 
   108 new_callback P5, P6, P7, "Ut"    - P5=UnManagedStruct=PMC(0x8363f88), 
P6=Sub=PMC(0x8363f70 Adr:0x84e66a8), P7=Integer=PMC(0x8363f58), 
       GC
   113 find_global P0, "Gtk::g_signal_connec"   - P0=NCI=PMC(0x8363fe8), 
   116 set S5, "clicked"        - S5="Parrot", 
   119 set I5, 0        - I5=0, 
   122 null P7          - P7=Integer=PMC(0x8363f58)
   124 set P6, P5       - P6=Sub=PMC(0x8363f70 Adr:0x84e66a8), 
P5=UnManagedStruct=PMC(0x8363ef8)
   127 set P5, P11      - P5=UnManagedStruct=PMC(0x8363ef8), 
P11=UnManagedStruct=PMC(0x8363f88)
       GC
   130 invoke
   131 set P5, P11      - P5=UnManagedStruct=PMC(0x8363f88), 
P11=UnManagedStruct=PMC(0x8363f88)
   134 set P6, P11      - P6=UnManagedStruct=PMC(0x8363ef8), 
P11=UnManagedStruct=PMC(0x8363f88)
   137 find_global P0, "Gtk::gtk_widget_show"   - P0=NCI=PMC(0x8363fb8), 
   140 invoke
   141 set P5, P15      - P5=UnManagedStruct=PMC(0x8363f88), 
P15=UnManagedStruct=PMC(0x8363fa0)
       GC
   144 find_global P0, "Gtk::gtk_container_a"   - P0=NCI=PMC(0x8364018), 
   147 invoke
   148 find_global P0, "Gtk::gtk_widget_show"   - P0=NCI=PMC(0x8364000), 
   151 invoke
   152 find_global P0, "Gtk::gtk_main"          - P0=NCI=PMC(0x8364018), 
   155 invoke

# -- afther click on the button:
Parrot VM: PANIC: callback_info isn't a PMC!
C file src/inter_cb.c, line 160
Parrot file (unknown file), line 0

We highly suggest you notify the Parrot team if you have not been working on
Parrot.  Use bugs6.perl.org or send an e-mail to [EMAIL PROTECTED]
Include the entire text of this error message and the text of the script that
generated the error.  If you've made any modifications to Parrot, please
describe them as well.

Version     : 0.1.0-devel
Configured  : Fri Aug 13 22:56:58 2004
Architecture: i386-linux
JIT Capable : Yes
Interp Flags: 0x2
Exceptions  : (missing from core)

Dumping Core...
Quit
# -- Gtk Button Example.

.sub _gtkcallback
  print "Hello\n"
.end

.sub main @MAIN
  .include "work/gtk.pasm"

  P0 = global "Gtk::gtk_init"
  I5 = 0
  invoke

  P0 = global "Gtk::gtk_window_new"
  null I5
  invoke

  P15 = P5

  P0 = global "Gtk::gtk_button_new_with_label"
  S5 = "Parrot"
  invoke

  # -- Save it.
  P6  = P5
  P11 = P5

  # -- install callback?
  newsub P6, .Sub, _gtkcallback
  new P7, .Integer  # -- just give it something even if dont care
  set P7, 42
  new_callback P5, P6, P7, "Ut"

  # -- function sig is "'lptpPi', then we have:
  #    P5 is the button
  #    P6 the callback
  #    P7 data we may to pass through.
  #    S5 "clicked"
  #    I5 is 0
  P0 = global "Gtk::g_signal_connect_object"
  S5 = "clicked"
I5 = 0
#null P7
  P6 = P5
  P5 = P11
  invoke
  # -- .

  P5 = P11
  P6 = P11

  P0 = global "Gtk::gtk_widget_show"
  invoke

  # -- Set the container.
  P5 = P15
 
  P0 = global "Gtk::gtk_container_add"
  invoke

  P0 = global "Gtk::gtk_widget_show"
  invoke

  P0 = global "Gtk::gtk_main"
  invoke

  end
.end
saveall
loadlib P1, 'libgtk-x11-2.0'
dlfunc P2, P1, 'gtk_init', 'vii'
store_global 'Gtk::gtk_init', P2
dlfunc P2, P1, 'gtk_main', 'vv'
store_global 'Gtk::gtk_main', P2
dlfunc P2, P1, 'gtk_widget_show', 'vp'
store_global 'Gtk::gtk_widget_show', P2
dlfunc P2, P1, 'gtk_container_add', 'vpp'
store_global 'Gtk::gtk_container_add', P2
dlfunc P2, P1, 'gtk_button_new_with_label', 'pt'
store_global 'Gtk::gtk_button_new_with_label', P2
dlfunc P2, P1, 'gtk_window_new', 'pi'
store_global 'Gtk::gtk_window_new', P2
dlfunc P2, P1, 'g_signal_connect_object', 'lptpPi'
store_global 'Gtk::g_signal_connect_object', P2
restoreall

Reply via email to