upload tizen1.0 source
[framework/telephony/libslp-tapi.git] / src / porting / tel_marshaler.c
1 /*
2  * libslp-tapi
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #include        <glib-object.h>
22
23 #ifdef G_ENABLE_DEBUG
24 #define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
25 #define g_marshal_value_peek_char(v)     g_value_get_char (v)
26 #define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
27 #define g_marshal_value_peek_int(v)      g_value_get_int (v)
28 #define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
29 #define g_marshal_value_peek_long(v)     g_value_get_long (v)
30 #define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
31 #define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
32 #define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
33 #define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
34 #define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
35 #define g_marshal_value_peek_float(v)    g_value_get_float (v)
36 #define g_marshal_value_peek_double(v)   g_value_get_double (v)
37 #define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
38 #define g_marshal_value_peek_param(v)    g_value_get_param (v)
39 #define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
40 #define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
41 #define g_marshal_value_peek_object(v)   g_value_get_object (v)
42 #else /* !G_ENABLE_DEBUG */
43 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
44  *          Do not access GValues directly in your code. Instead, use the
45  *          g_value_get_*() functions
46  */
47 #define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
48 #define g_marshal_value_peek_char(v)     (v)->data[0].v_int
49 #define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
50 #define g_marshal_value_peek_int(v)      (v)->data[0].v_int
51 #define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
52 #define g_marshal_value_peek_long(v)     (v)->data[0].v_long
53 #define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
54 #define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
55 #define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
56 #define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
57 #define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
58 #define g_marshal_value_peek_float(v)    (v)->data[0].v_float
59 #define g_marshal_value_peek_double(v)   (v)->data[0].v_double
60 #define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
61 #define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
62 #define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
63 #define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
64 #define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
65 #endif /* !G_ENABLE_DEBUG */
66
67 /* VOID:INT,STRING (mashal.in:1) */
68 void g_cclosure_user_marshal_VOID__INT_STRING(
69                 GClosure *closure,
70                 GValue *return_value G_GNUC_UNUSED,
71                 guint n_param_values,
72                 const GValue *param_values,
73                 gpointer invocation_hint G_GNUC_UNUSED,
74                 gpointer marshal_data)
75 {
76         typedef void (*GMarshalFunc_VOID__INT_STRING)(gpointer data1, gint arg_1, gpointer arg_2, gpointer data2);
77
78         register GMarshalFunc_VOID__INT_STRING callback;
79         register GCClosure *cc = (GCClosure*) closure;
80         register gpointer data1, data2;
81
82         g_return_if_fail (n_param_values == 3);
83
84         if (G_CCLOSURE_SWAP_DATA (closure)) {
85                 data1 = closure->data;
86                 data2 = g_value_peek_pointer(param_values + 0);
87         }
88         else {
89                 data1 = g_value_peek_pointer(param_values + 0);
90                 data2 = closure->data;
91         }
92         callback = (GMarshalFunc_VOID__INT_STRING) (marshal_data ? marshal_data : cc->callback);
93
94         callback(data1, g_marshal_value_peek_int (param_values + 1), g_marshal_value_peek_string (param_values + 2), data2);
95 }
96
97 /* VOID:INT,INT,INT,STRING (mashal.in:2) */
98 void g_cclosure_user_marshal_VOID__INT_INT_INT_STRING(
99                 GClosure *closure,
100                 GValue *return_value G_GNUC_UNUSED,
101                 guint n_param_values,
102                 const GValue *param_values,
103                 gpointer invocation_hint G_GNUC_UNUSED,
104                 gpointer marshal_data)
105 {
106         typedef void (*GMarshalFunc_VOID__INT_INT_INT_STRING)(
107                         gpointer data1,
108                         gint arg_1,
109                         gint arg_2,
110                         gint arg_3,
111                         gpointer arg_4,
112                         gpointer data2);
113
114         register GMarshalFunc_VOID__INT_INT_INT_STRING callback;
115         register GCClosure *cc = (GCClosure*) closure;
116         register gpointer data1, data2;
117
118         g_return_if_fail (n_param_values == 5);
119
120         if (G_CCLOSURE_SWAP_DATA (closure)) {
121                 data1 = closure->data;
122                 data2 = g_value_peek_pointer(param_values + 0);
123         }
124         else {
125                 data1 = g_value_peek_pointer(param_values + 0);
126                 data2 = closure->data;
127         }
128         callback = (GMarshalFunc_VOID__INT_INT_INT_STRING) (marshal_data ? marshal_data : cc->callback);
129
130         callback(data1, g_marshal_value_peek_int (param_values + 1), g_marshal_value_peek_int (param_values + 2),
131                         g_marshal_value_peek_int (param_values + 3), g_marshal_value_peek_string (param_values + 4), data2);
132 }
133
134 /* VOID:INT,INT,INT,INT,STRING (mashal.in:3) */
135 void g_cclosure_user_marshal_VOID__INT_INT_INT_INT_STRING(
136                 GClosure *closure,
137                 GValue *return_value G_GNUC_UNUSED,
138                 guint n_param_values,
139                 const GValue *param_values,
140                 gpointer invocation_hint G_GNUC_UNUSED,
141                 gpointer marshal_data)
142 {
143         typedef void (*GMarshalFunc_VOID__INT_INT_INT_INT_STRING)(
144                         gpointer data1,
145                         gint arg_1,
146                         gint arg_2,
147                         gint arg_3,
148                         gint arg_4,
149                         gpointer arg_5,
150                         gpointer data2);
151
152         register GMarshalFunc_VOID__INT_INT_INT_INT_STRING callback;
153         register GCClosure *cc = (GCClosure*) closure;
154         register gpointer data1, data2;
155
156         g_return_if_fail (n_param_values == 6);
157
158         if (G_CCLOSURE_SWAP_DATA (closure)) {
159                 data1 = closure->data;
160                 data2 = g_value_peek_pointer(param_values + 0);
161         }
162         else {
163                 data1 = g_value_peek_pointer(param_values + 0);
164                 data2 = closure->data;
165         }
166         callback = (GMarshalFunc_VOID__INT_INT_INT_INT_STRING) (marshal_data ? marshal_data : cc->callback);
167
168         callback(data1, g_marshal_value_peek_int (param_values + 1), g_marshal_value_peek_int (param_values + 2),
169                         g_marshal_value_peek_int (param_values + 3), g_marshal_value_peek_int (param_values + 4),
170                         g_marshal_value_peek_string (param_values + 5), data2);
171 }
172