1 /* -*- Mode: C; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */
2 
3 /*
4  * marshal.c - custom marshals collection.
5  * Copyright (C) 2001-2002 Takuro Ashie
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 3S30, Boston, MA 02111-1307, USA.
20  *
21  * $Id: gimv_marshal.c,v 1.2 2003/06/13 09:43:31 makeinu Exp $
22  */
23 
24 
25 #include "gimv_marshal.h"
26 
27 #if (GTK_MAJOR_VERSION >= 2)
28 
29 #ifdef G_ENABLE_DEBUG
30 #define g_marshal_value_peek_int(v)      g_value_get_int (v)
31 #else /* !G_ENABLE_DEBUG */
32 #define g_marshal_value_peek_int(v)      (v)->data[0].v_int
33 #endif /* !G_ENABLE_DEBUG */
34 
35 void
gtk_marshal_INT__INT_INT(GClosure * closure,GValue * return_value,guint n_param_values,const GValue * param_values,gpointer invocation_hint,gpointer marshal_data)36 gtk_marshal_INT__INT_INT (GClosure     *closure,
37                           GValue       *return_value,
38                           guint         n_param_values,
39                           const GValue *param_values,
40                           gpointer      invocation_hint,
41                           gpointer      marshal_data)
42 {
43    typedef gint (*GMarshalFunc_INT__INT_INT) (gpointer     data1,
44                                               gint         arg_1,
45                                               gint         arg_2,
46                                               gpointer     data2);
47    register GMarshalFunc_INT__INT_INT callback;
48    register GCClosure *cc = (GCClosure*) closure;
49    register gpointer data1, data2;
50    gint v_return;
51 
52    g_return_if_fail (return_value != NULL);
53    g_return_if_fail (n_param_values == 3);
54 
55    if (G_CCLOSURE_SWAP_DATA (closure)) {
56       data1 = closure->data;
57       data2 = g_value_peek_pointer (param_values + 0);
58    } else {
59       data1 = g_value_peek_pointer (param_values + 0);
60       data2 = closure->data;
61    }
62    callback = (GMarshalFunc_INT__INT_INT) (marshal_data ? marshal_data : cc->callback);
63 
64    v_return = callback (data1,
65                         g_marshal_value_peek_int (param_values + 1),
66                         g_marshal_value_peek_int (param_values + 2),
67                         data2);
68 
69    g_value_set_int (return_value, v_return);
70 }
71 
72 #else /* (GTK_MAJOR_VERSION >= 2) */
73 
74 typedef gint (*GtkSignal_INT__INT_INT) (GtkObject * object,
75                                         gint arg1,
76                                         gint arg2,
77                                         gpointer user_data);
78 
79 void
gtk_marshal_INT__INT_INT(GtkObject * object,GtkSignalFunc func,gpointer func_data,GtkArg * args)80 gtk_marshal_INT__INT_INT (GtkObject * object,
81                           GtkSignalFunc func,
82                           gpointer func_data,
83                           GtkArg * args)
84 {
85   GtkSignal_INT__INT_INT rfunc;
86   gint *return_val;
87   return_val = GTK_RETLOC_INT (args[2]);
88   rfunc = (GtkSignal_INT__INT_INT) func;
89   *return_val = (*rfunc) (object,
90                           GTK_VALUE_INT (args[0]),
91                           GTK_VALUE_INT (args[1]),
92                           func_data);
93 }
94 
95 #endif /* (GTK_MAJOR_VERSION >= 2) */
96