Commit 8cf49d7c authored by Elliot Lee's avatar Elliot Lee

genmarshal.pl: Handle complex types, and functions with a return value but



genmarshal.pl: Handle complex types, and functions with a return value but
	       no parameters.
genmarshal.pl gtkmarshal.* gtkwidget.c: Remove support for GDK_EVENT and
				        STYLE parameter types.
parent 5f8748c5
......@@ -9,10 +9,16 @@
"DOUBLE"=>"gdouble", "STRING"=>"gpointer",
"ENUM"=>"gint", "FLAGS"=>"gint",
"BOXED"=>"gpointer", "FOREIGN"=>"gpointer",
"C_CALLBACK"=>"C_CALLBACK", "POINTER"=>"gpointer",
"ARGS"=>"gpointer", "SIGNAL"=>"gpointer",
"POINTER"=>"gpointer",
"OBJECT"=>"gpointer",
"STYLE"=>"gpointer", "GDK_EVENT"=>"gpointer");
# complex types. These need special handling.
"FOREIGN"=>"FOREIGN",
"C_CALLBACK"=>"C_CALLBACK",
"SIGNAL"=>"SIGNAL",
"ARGS"=>"ARGS",
"CALLBACK"=>"CALLBACK"
);
$srcdir = $ENV{'srcdir'} || '.';
......@@ -100,7 +106,25 @@ EOT
for (@params) {
if($_ eq "C_CALLBACK") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn++."b,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} elsif($_ eq "SIGNAL") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} elsif($_ eq "ARGS") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} elsif($_ eq "CALLBACK") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
print OS "gpointer arg".$argn."c,\n";
$argn++;
} elsif($_ eq "FOREIGN") {
print OS "gpointer arg".$argn."a,\n";
print OS "gpointer arg".$argn."b,\n";
$argn++;
} else {
print OS "$trans{$_} arg".$argn++.",\n" unless $_ eq "NONE";
}
......@@ -118,7 +142,9 @@ EOT
if($retval ne "NONE") {
print OS " $trans{$retval} *return_val;\n";
print OS " return_val = GTK_RETLOC_$retval (args[".(scalar @params)."]);\n";
$retn = 0;
$retn = scalar @params unless $params[0] eq "NONE";
print OS " return_val = GTK_RETLOC_$retval (args[$retn]);\n";
}
print OS " rfunc = (GtkSignal_$funcname) func;\n";
print OS " *return_val = " unless $retval eq "NONE";
......@@ -129,6 +155,22 @@ EOT
print OS <<EOT;
GTK_VALUE_C_CALLBACK(args[$i]).func,
GTK_VALUE_C_CALLBACK(args[$i]).func_data,
EOT
} elsif ($params[$i] eq "SIGNAL") {
print OS <<EOT;
GTK_VALUE_SIGNAL(args[$i]).f,
GTK_VALUE_SIGNAL(args[$i]).d,
EOT
} elsif ($params[$i] eq "CALLBACK") {
print OS <<EOT;
GTK_VALUE_CALLBACK(args[$i]).marshal,
GTK_VALUE_CALLBACK(args[$i]).data,
GTK_VALUE_CALLBACK(args[$i]).notify,
EOT
} elsif ($params[$i] eq "FOREIGN") {
print OS <<EOT;
GTK_VALUE_FOREIGN(args[$i]).data,
GTK_VALUE_FOREIGN(args[$i]).notify,
EOT
} elsif ($params[$i] eq "NONE") {
} else {
......
#include "gtkmarshal.h"
typedef gboolean (*GtkSignal_BOOL__NONE) (GtkObject * object,
gpointer user_data);
void
gtk_marshal_BOOL__NONE (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
GtkSignal_BOOL__NONE rfunc;
gboolean *return_val;
return_val = GTK_RETLOC_BOOL (args[0]);
rfunc = (GtkSignal_BOOL__NONE) func;
*return_val = (*rfunc) (object,
func_data);
}
typedef gboolean (*GtkSignal_BOOL__POINTER) (GtkObject * object,
gpointer arg1,
gpointer user_data);
......@@ -18,22 +34,6 @@ gtk_marshal_BOOL__POINTER (GtkObject * object,
func_data);
}
typedef gboolean (*GtkSignal_BOOL__NONE) (GtkObject * object,
gpointer user_data);
void
gtk_marshal_BOOL__NONE (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
GtkSignal_BOOL__NONE rfunc;
gboolean *return_val;
return_val = GTK_RETLOC_BOOL (args[1]);
rfunc = (GtkSignal_BOOL__NONE) func;
*return_val = (*rfunc) (object,
func_data);
}
typedef gboolean (*GtkSignal_BOOL__POINTER_POINTER_INT_INT) (GtkObject * object,
gpointer arg1,
gpointer arg2,
......
......@@ -12,18 +12,16 @@ extern "C"
#define gtk_signal_default_marshaller gtk_marshal_NONE__NONE
#define gtk_marshal_BOOL__GDK_EVENT gtk_marshal_BOOL__POINTER
void gtk_marshal_BOOL__NONE (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args);
void gtk_marshal_BOOL__POINTER (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args);
void gtk_marshal_BOOL__NONE (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args);
void gtk_marshal_BOOL__POINTER_POINTER_INT_INT (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
......@@ -150,8 +148,6 @@ extern "C"
gpointer func_data,
GtkArg * args);
#define gtk_marshal_NONE__STYLE gtk_marshal_NONE__POINTER
#define gtk_marshal_NONE__UINT gtk_marshal_NONE__INT
#define gtk_marshal_NONE__UINT_POINTER_UINT_ENUM_ENUM_POINTER gtk_marshal_NONE__INT_POINTER_INT_INT_INT_POINTER
......
BOOL:GDK_EVENT
BOOL:NONE
BOOL:POINTER
BOOL:POINTER,POINTER,INT,INT
......@@ -28,7 +27,6 @@ NONE:POINTER,UINT,ENUM
NONE:POINTER,UINT,UINT
NONE:STRING
NONE:STRING,INT,POINTER
NONE:STYLE
NONE:UINT
NONE:UINT,POINTER,UINT,ENUM,ENUM,POINTER
NONE:UINT,POINTER,UINT,UINT,ENUM
......
BOOL:GDK_EVENT
BOOL:NONE
BOOL:POINTER
BOOL:POINTER,POINTER,INT,INT
......@@ -28,7 +27,6 @@ NONE:POINTER,UINT,ENUM
NONE:POINTER,UINT,UINT
NONE:STRING
NONE:STRING,INT,POINTER
NONE:STYLE
NONE:UINT
NONE:UINT,POINTER,UINT,ENUM,ENUM,POINTER
NONE:UINT,POINTER,UINT,UINT,ENUM
......
......@@ -371,7 +371,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, style_set),
gtk_marshal_NONE__STYLE,
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_STYLE);
widget_signals[ADD_ACCELERATOR] =
......@@ -385,7 +385,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[BUTTON_PRESS_EVENT] =
......@@ -393,7 +393,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, button_press_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[BUTTON_RELEASE_EVENT] =
......@@ -401,7 +401,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, button_release_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[MOTION_NOTIFY_EVENT] =
......@@ -409,7 +409,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, motion_notify_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DELETE_EVENT] =
......@@ -417,7 +417,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, delete_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DESTROY_EVENT] =
......@@ -425,7 +425,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, destroy_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[EXPOSE_EVENT] =
......@@ -433,7 +433,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, expose_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[KEY_PRESS_EVENT] =
......@@ -441,7 +441,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, key_press_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[KEY_RELEASE_EVENT] =
......@@ -449,7 +449,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, key_release_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[ENTER_NOTIFY_EVENT] =
......@@ -457,7 +457,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, enter_notify_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[LEAVE_NOTIFY_EVENT] =
......@@ -465,7 +465,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, leave_notify_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[CONFIGURE_EVENT] =
......@@ -473,7 +473,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, configure_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[FOCUS_IN_EVENT] =
......@@ -481,7 +481,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, focus_in_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[FOCUS_OUT_EVENT] =
......@@ -489,7 +489,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, focus_out_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[MAP_EVENT] =
......@@ -497,7 +497,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, map_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[UNMAP_EVENT] =
......@@ -505,7 +505,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, unmap_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[PROPERTY_NOTIFY_EVENT] =
......@@ -513,7 +513,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, property_notify_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[SELECTION_CLEAR_EVENT] =
......@@ -521,7 +521,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_clear_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[SELECTION_REQUEST_EVENT] =
......@@ -529,7 +529,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_request_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[SELECTION_NOTIFY_EVENT] =
......@@ -537,7 +537,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_notify_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[SELECTION_RECEIVED] =
......@@ -553,7 +553,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, proximity_in_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[PROXIMITY_OUT_EVENT] =
......@@ -561,7 +561,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, proximity_out_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DRAG_BEGIN_EVENT] =
......@@ -569,7 +569,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_begin_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DRAG_REQUEST_EVENT] =
......@@ -577,7 +577,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_request_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DRAG_END_EVENT] =
......@@ -585,7 +585,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_end_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DROP_ENTER_EVENT] =
......@@ -593,7 +593,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, drop_enter_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DROP_LEAVE_EVENT] =
......@@ -601,7 +601,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, drop_leave_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DROP_DATA_AVAILABLE_EVENT] =
......@@ -610,7 +610,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass,
drop_data_available_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[VISIBILITY_NOTIFY_EVENT] =
......@@ -618,7 +618,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, visibility_notify_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[CLIENT_EVENT] =
......@@ -626,7 +626,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, client_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[NO_EXPOSE_EVENT] =
......@@ -634,7 +634,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, no_expose_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[OTHER_EVENT] =
......@@ -642,7 +642,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (GtkWidgetClass, other_event),
gtk_marshal_BOOL__GDK_EVENT,
gtk_marshal_BOOL__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_GDK_EVENT);
widget_signals[DEBUG_MSG] =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment