? Glib/.GType.xs.swp Index: Glib/GSignal.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GSignal.xs,v retrieving revision 1.16 diff -r1.16 GSignal.xs 182,183c182,183 < g_hash_table_new_full (g_str_hash, < g_str_equal, --- > g_hash_table_new_full (gperl_str_hash, > gperl_str_eq, Index: Glib/GType.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GType.xs,v retrieving revision 1.25 diff -r1.25 GType.xs 136,150d135 < static gboolean < streq_enum (register const char * a, < register const char * b) < { < while (*a && *b) { < if (*a == *b || < ((*a == '-' || *a == '_') && (*b == '-' || *b == '_'))) { < a++; < b++; < } else < return FALSE; < } < return *a == *b; < } < 189,190c174,175 < if (streq_enum (val_p, vals->value_nick) || < streq_enum (val_p, vals->value_name)) { --- > if (gperl_str_eq (val_p, vals->value_nick) || > gperl_str_eq (val_p, vals->value_name)) { 288,289c273,274 < if (streq_enum (val_p, vals->value_name) || < streq_enum (val_p, vals->value_nick)) { --- > if (gperl_str_eq (val_p, vals->value_name) || > gperl_str_eq (val_p, vals->value_nick)) { Index: Glib/Glib.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/Glib.xs,v retrieving revision 1.11 diff -r1.11 Glib.xs 145a146,185 > =item gboolean gperl_str_eq (const char * a, const char * b); > > Compare a pair of ascii strings, considering '-' and '_' to be equivalent. > Used for things like enum value nicknames and signal names. > > =cut > gboolean > gperl_str_eq (const char * a, > const char * b) > { > g_printerr ("gperl_str_eq %s <=> %s\n", a, b); > while (*a && *b) { > if (*a == *b || > ((*a == '-' || *a == '_') && (*b == '-' || *b == '_'))) { > a++; > b++; > } else > return FALSE; > } > return *a == *b; > } > > =item guint gperl_str_hash (gconstpointer key) > > Like g_str_hash(), but considers '-' and '_' to be equivalent. > > =cut > guint > gperl_str_hash (gconstpointer key) > { > const char *p = key; > guint h = *p; > > if (h) > for (p += 1; *p != '\0'; p++) > h = (h << 5) - h + (*p == '-' ? '_' : *p); > > return h; > } > Index: Glib/gperl.h =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/gperl.h,v retrieving revision 1.26 diff -r1.26 gperl.h 64a65,67 > gboolean gperl_str_eq (const char * a, const char * b); > guint gperl_str_hash (gconstpointer key); > Index: Gtk2/xs/GtkEditable.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GtkEditable.xs,v retrieving revision 1.5 diff -r1.5 GtkEditable.xs 23a24,128 > /* > GtkEditable's insert-text signal uses an integer pointer as a write-through > parameter; unlike GtkWidget's size-request signal, we can't just pass an > editable object, because an integer is an integral type. > > void user_function (GtkEditable *editable, > gchar *new_text, > gint new_text_length, > gint *position, <<=== that's the problem > gpointer user_data); > > this custom marshaller re-defines the call signature for the signal handler. > this is evil, as the change won't be picked up by the auto-generated docs > and will not comply with the C api reference, but i really can't think of > another way to handle this situation. > */ > static void > gtk2perl_editable_insert_text_marshal (GClosure * closure, > GValue * return_value, > guint n_param_values, > const GValue * param_values, > gpointer invocation_hint, > gpointer marshal_data) > { > GPerlClosure *pc = (GPerlClosure *)closure; > SV * data; > SV * instance; > int len; > gint * position_p; > SV * string, * position; > #ifndef PERL_IMPLICIT_CONTEXT > dSP; > #else > SV **SP; > > PERL_UNUSED_VAR (return_value); > PERL_UNUSED_VAR (n_param_values); > PERL_UNUSED_VAR (invocation_hint); > > /* make sure we're executed by the same interpreter that created > * the closure object. */ > PERL_SET_CONTEXT (marshal_data); > > SPAGAIN; > #endif > > ENTER; > SAVETMPS; > > PUSHMARK (SP); > > if (GPERL_CLOSURE_SWAP_DATA (pc)) { > /* swap instance and data */ > data = gperl_sv_from_value (param_values); > instance = pc->data; > } else { > /* normal */ > instance = gperl_sv_from_value (param_values); > data = pc->data; > } > > EXTEND (SP, 4); > /* the instance is always the first item in @_ */ > PUSHs (instance); > > /* new_text */ > //PUSHs (sv_2mortal (newSVpv (g_value_get_string (param_values+1), 0))); > string = newSVpv (g_value_get_string (param_values+1), 0); > PUSHs (string); > > /* we leave out the text length -- it's redundant. */ > > /* insert position */ > position_p = g_value_get_pointer (param_values+3); > //PUSHs (sv_2mortal (newSViv (*position_p))); > position = newSViv (*position_p); > PUSHs (position); > > if (data) > XPUSHs (data); > PUTBACK; > > call_sv (pc->callback, G_DISCARD|G_EVAL); > > if (SvTRUE (ERRSV)) > gperl_run_exception_handlers (); > > sv_utf8_upgrade (string); > g_value_set_string (param_values+1, SvPV (string, len)); > g_value_set_int (param_values+2, len); > *position_p = SvIV (position); > if (*position_p < 0) > *position_p = 0; > > /* > * clean up > */ > SvREFCNT_dec (string); > SvREFCNT_dec (position); > > FREETMPS; > LEAVE; > } > > 24a130,133 > > BOOT: > gperl_signal_set_marshaller_for (GTK_TYPE_EDITABLE, "insert_text", > gtk2perl_editable_insert_text_marshal);