Mercurial > pidgin
annotate src/signals.c @ 6560:aeb5ee62debc
[gaim-migrate @ 7082]
(14:16:38) Robot101: I've got a nice patch to stop the ticker from crashing the 2nd time you load it
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 21 Aug 2003 18:20:05 +0000 |
parents | 9e4fa4853cfe |
children | 800ef4a51096 |
rev | line source |
---|---|
6485 | 1 /** |
6488
e5e8d21bd4d8
[gaim-migrate @ 7002]
Christian Hammond <chipx86@chipx86.com>
parents:
6485
diff
changeset
|
2 * @file signals.c Signal API |
6485 | 3 * @ingroup core |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 */ | |
23 #include "internal.h" | |
24 | |
25 #include "debug.h" | |
26 #include "signals.h" | |
27 | |
28 typedef struct | |
29 { | |
30 void *instance; | |
31 | |
32 GHashTable *signals; | |
33 size_t signal_count; | |
34 | |
35 gulong next_signal_id; | |
36 | |
37 } GaimInstanceData; | |
38 | |
39 typedef struct | |
40 { | |
41 gulong id; | |
42 | |
43 GaimSignalMarshalFunc marshal; | |
44 | |
45 GList *handlers; | |
46 size_t handler_count; | |
47 | |
48 gulong next_handler_id; | |
49 | |
50 } GaimSignalData; | |
51 | |
52 typedef struct | |
53 { | |
54 gulong id; | |
55 GaimCallback cb; | |
56 void *handle; | |
57 void *data; | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
58 gboolean use_vargs; |
6485 | 59 |
60 } GaimSignalHandlerData; | |
61 | |
62 static GHashTable *instance_table = NULL; | |
63 | |
64 static void | |
65 destroy_instance_data(GaimInstanceData *instance_data) | |
66 { | |
67 g_hash_table_destroy(instance_data->signals); | |
68 | |
69 g_free(instance_data); | |
70 } | |
71 | |
72 static void | |
73 destroy_signal_data(GaimSignalData *signal_data) | |
74 { | |
75 GaimSignalHandlerData *handler_data; | |
76 GList *l; | |
77 | |
78 for (l = signal_data->handlers; l != NULL; l = l->next) | |
79 { | |
80 handler_data = (GaimSignalHandlerData *)l->data; | |
81 | |
82 g_free(l->data); | |
83 } | |
84 | |
85 g_list_free(signal_data->handlers); | |
86 | |
87 g_free(signal_data); | |
88 } | |
89 | |
90 gulong | |
91 gaim_signal_register(void *instance, const char *signal, | |
92 GaimSignalMarshalFunc marshal) | |
93 { | |
94 GaimInstanceData *instance_data; | |
95 GaimSignalData *signal_data; | |
96 | |
97 g_return_val_if_fail(instance != NULL, 0); | |
98 g_return_val_if_fail(signal != NULL, 0); | |
99 g_return_val_if_fail(marshal != NULL, 0); | |
100 | |
101 instance_data = | |
102 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
103 | |
104 if (instance_data == NULL) | |
105 { | |
106 instance_data = g_new0(GaimInstanceData, 1); | |
107 | |
108 instance_data->instance = instance; | |
109 instance_data->next_signal_id = 1; | |
110 | |
111 instance_data->signals = | |
112 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, | |
113 (GDestroyNotify)destroy_signal_data); | |
114 | |
115 g_hash_table_insert(instance_table, instance, instance_data); | |
116 } | |
117 | |
118 signal_data = g_new0(GaimSignalData, 1); | |
119 signal_data->id = instance_data->next_signal_id; | |
120 signal_data->marshal = marshal; | |
121 signal_data->next_handler_id = 1; | |
122 | |
123 g_hash_table_insert(instance_data->signals, | |
124 g_strdup(signal), signal_data); | |
125 | |
126 instance_data->next_signal_id++; | |
127 instance_data->signal_count++; | |
128 | |
129 return signal_data->id; | |
130 } | |
131 | |
132 void | |
133 gaim_signal_unregister(void *instance, const char *signal) | |
134 { | |
135 GaimInstanceData *instance_data; | |
136 | |
137 g_return_if_fail(instance != NULL); | |
138 g_return_if_fail(signal != NULL); | |
139 | |
140 instance_data = | |
141 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
142 | |
143 g_return_if_fail(instance_data != NULL); | |
144 | |
145 g_hash_table_remove(instance_data->signals, signal); | |
146 | |
147 instance_data->signal_count--; | |
148 | |
149 if (instance_data->signal_count == 0) | |
150 { | |
151 /* Unregister the instance. */ | |
152 g_hash_table_remove(instance_table, instance); | |
153 } | |
154 } | |
155 | |
156 void | |
157 gaim_signals_unregister_by_instance(void *instance) | |
158 { | |
159 gboolean found; | |
160 | |
161 g_return_if_fail(instance != NULL); | |
162 | |
163 found = g_hash_table_remove(instance_table, instance); | |
164 | |
165 /* | |
166 * Makes things easier (more annoying?) for developers who don't have | |
167 * things registering and unregistering in the right order :) | |
168 */ | |
169 g_return_if_fail(found); | |
170 } | |
171 | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
172 static gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
173 signal_connect_common(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
174 GaimCallback func, void *data, gboolean use_vargs) |
6485 | 175 { |
176 GaimInstanceData *instance_data; | |
177 GaimSignalData *signal_data; | |
178 GaimSignalHandlerData *handler_data; | |
179 | |
180 g_return_val_if_fail(instance != NULL, 0); | |
181 g_return_val_if_fail(signal != NULL, 0); | |
182 g_return_val_if_fail(handle != NULL, 0); | |
183 g_return_val_if_fail(func != NULL, 0); | |
184 | |
185 /* Get the instance data */ | |
186 instance_data = | |
187 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
188 | |
189 g_return_val_if_fail(instance_data != NULL, 0); | |
190 | |
191 /* Get the signal data */ | |
192 signal_data = | |
193 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
194 | |
195 if (signal_data == NULL) | |
196 { | |
197 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
198 "Signal data for %s not found!\n", signal); | |
199 return 0; | |
200 } | |
201 | |
202 /* Create the signal handler data */ | |
203 handler_data = g_new0(GaimSignalHandlerData, 1); | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
204 handler_data->id = signal_data->next_handler_id; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
205 handler_data->cb = func; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
206 handler_data->handle = handle; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
207 handler_data->data = data; |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
208 handler_data->use_vargs = use_vargs; |
6485 | 209 |
210 signal_data->handlers = g_list_append(signal_data->handlers, handler_data); | |
211 signal_data->handler_count++; | |
212 signal_data->next_handler_id++; | |
213 | |
214 return handler_data->id; | |
215 } | |
6553
9e4fa4853cfe
[gaim-migrate @ 7075]
Christian Hammond <chipx86@chipx86.com>
parents:
6547
diff
changeset
|
216 |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
217 gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
218 gaim_signal_connect(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
219 GaimCallback func, void *data) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
220 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
221 return signal_connect_common(instance, signal, handle, func, data, FALSE); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
222 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
223 |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
224 gulong |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
225 gaim_signal_connect_vargs(void *instance, const char *signal, void *handle, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
226 GaimCallback func, void *data) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
227 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
228 return signal_connect_common(instance, signal, handle, func, data, TRUE); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
229 } |
6485 | 230 |
231 void | |
232 gaim_signal_disconnect(void *instance, const char *signal, | |
233 void *handle, GaimCallback func) | |
234 { | |
235 GaimInstanceData *instance_data; | |
236 GaimSignalData *signal_data; | |
237 GaimSignalHandlerData *handler_data; | |
238 GList *l; | |
239 gboolean found = FALSE; | |
240 | |
241 g_return_if_fail(instance != NULL); | |
242 g_return_if_fail(signal != NULL); | |
243 g_return_if_fail(handle != NULL); | |
244 g_return_if_fail(func != NULL); | |
245 | |
246 /* Get the instance data */ | |
247 instance_data = | |
248 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
249 | |
250 g_return_if_fail(instance_data != NULL); | |
251 | |
252 /* Get the signal data */ | |
253 signal_data = | |
254 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
255 | |
256 if (signal_data == NULL) | |
257 { | |
258 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
259 "Signal data for %s not found!\n", signal); | |
260 return; | |
261 } | |
262 | |
263 /* Find the handler data. */ | |
264 for (l = signal_data->handlers; l != NULL; l = l->next) | |
265 { | |
266 handler_data = (GaimSignalHandlerData *)l->data; | |
267 | |
268 if (handler_data->handle == handle && handler_data->cb == func) | |
269 { | |
270 g_free(handler_data); | |
271 | |
272 signal_data->handlers = g_list_remove(signal_data->handlers, | |
273 handler_data); | |
274 signal_data->handler_count--; | |
275 | |
276 found = TRUE; | |
277 | |
278 break; | |
279 } | |
280 } | |
281 | |
282 /* See note somewhere about this actually helping developers.. */ | |
283 g_return_if_fail(found); | |
284 } | |
285 | |
286 /* | |
287 * TODO: Make this all more efficient by storing a list of handlers, keyed | |
288 * to a handle. | |
289 */ | |
290 static void | |
291 disconnect_handle_from_signals(const char *signal, | |
292 GaimSignalData *signal_data, void *handle) | |
293 { | |
294 GList *l, *l_next; | |
295 GaimSignalHandlerData *handler_data; | |
296 | |
297 for (l = signal_data->handlers; l != NULL; l = l_next) | |
298 { | |
299 handler_data = (GaimSignalHandlerData *)l->data; | |
300 l_next = l->next; | |
301 | |
302 if (handler_data->handle == handle) | |
303 { | |
304 g_free(handler_data); | |
305 | |
306 signal_data->handler_count--; | |
307 signal_data->handlers = g_list_remove(signal_data->handlers, | |
308 handler_data); | |
309 } | |
310 } | |
311 } | |
312 | |
313 static void | |
314 disconnect_handle_from_instance(void *instance, | |
315 GaimInstanceData *instance_data, | |
316 void *handle) | |
317 { | |
318 g_hash_table_foreach(instance_data->signals, | |
319 (GHFunc)disconnect_handle_from_signals, handle); | |
320 } | |
321 | |
322 void | |
323 gaim_signals_disconnect_by_handle(void *handle) | |
324 { | |
325 g_return_if_fail(handle != NULL); | |
326 | |
327 g_hash_table_foreach(instance_table, | |
328 (GHFunc)disconnect_handle_from_instance, handle); | |
329 } | |
330 | |
331 void | |
332 gaim_signal_emit(void *instance, const char *signal, ...) | |
333 { | |
334 va_list args; | |
335 | |
336 va_start(args, signal); | |
337 gaim_signal_emit_vargs(instance, signal, args); | |
338 va_end(args); | |
339 } | |
340 | |
341 void | |
342 gaim_signal_emit_vargs(void *instance, const char *signal, va_list args) | |
343 { | |
344 GaimInstanceData *instance_data; | |
345 GaimSignalData *signal_data; | |
346 GaimSignalHandlerData *handler_data; | |
347 GList *l; | |
348 | |
349 g_return_if_fail(instance != NULL); | |
350 g_return_if_fail(signal != NULL); | |
351 | |
352 instance_data = | |
353 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
354 | |
355 g_return_if_fail(instance_data != NULL); | |
356 | |
357 signal_data = | |
358 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
359 | |
360 if (signal_data == NULL) | |
361 { | |
362 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
363 "Signal data for %s not found!\n", signal); | |
364 return; | |
365 } | |
366 | |
367 for (l = signal_data->handlers; l != NULL; l = l->next) | |
368 { | |
369 handler_data = (GaimSignalHandlerData *)l->data; | |
370 | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
371 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
372 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
373 ((void (*)(va_list, void *))handler_data->cb)(args, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
374 handler_data->data); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
375 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
376 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
377 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
378 signal_data->marshal(handler_data->cb, args, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
379 handler_data->data, NULL); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
380 } |
6485 | 381 } |
382 } | |
383 | |
384 void * | |
385 gaim_signal_emit_return_1(void *instance, const char *signal, ...) | |
386 { | |
387 void *ret_val; | |
388 va_list args; | |
389 | |
390 va_start(args, signal); | |
391 ret_val = gaim_signal_emit_vargs_return_1(instance, signal, args); | |
392 va_end(args); | |
393 | |
394 return ret_val; | |
395 } | |
396 | |
397 void * | |
398 gaim_signal_emit_vargs_return_1(void *instance, const char *signal, | |
399 va_list args) | |
400 { | |
401 GaimInstanceData *instance_data; | |
402 GaimSignalData *signal_data; | |
403 GaimSignalHandlerData *handler_data; | |
404 void *ret_val = NULL; | |
405 GList *l; | |
406 | |
407 g_return_val_if_fail(instance != NULL, NULL); | |
408 g_return_val_if_fail(signal != NULL, NULL); | |
409 | |
410 instance_data = | |
411 (GaimInstanceData *)g_hash_table_lookup(instance_table, instance); | |
412 | |
413 g_return_val_if_fail(instance_data != NULL, NULL); | |
414 | |
415 signal_data = | |
416 (GaimSignalData *)g_hash_table_lookup(instance_data->signals, signal); | |
417 | |
418 if (signal_data == NULL) | |
419 { | |
420 gaim_debug(GAIM_DEBUG_ERROR, "signals", | |
421 "Signal data for %s not found!\n", signal); | |
422 return 0; | |
423 } | |
424 | |
425 for (l = signal_data->handlers; l != NULL; l = l->next) | |
426 { | |
427 handler_data = (GaimSignalHandlerData *)l->data; | |
428 | |
6547
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
429 if (handler_data->use_vargs) |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
430 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
431 ret_val = ((void *(*)(va_list, void *))handler_data->cb)( |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
432 args, handler_data->data); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
433 } |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
434 else |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
435 { |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
436 signal_data->marshal(handler_data->cb, args, |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
437 handler_data->data, &ret_val); |
adf168f002ad
[gaim-migrate @ 7069]
Christian Hammond <chipx86@chipx86.com>
parents:
6509
diff
changeset
|
438 } |
6485 | 439 } |
440 | |
441 return ret_val; | |
442 } | |
443 | |
444 void | |
445 gaim_signals_init() | |
446 { | |
447 g_return_if_fail(instance_table == NULL); | |
448 | |
449 instance_table = | |
450 g_hash_table_new_full(g_direct_hash, g_direct_equal, | |
451 NULL, (GDestroyNotify)destroy_instance_data); | |
452 } | |
453 | |
454 void | |
455 gaim_signals_uninit() | |
456 { | |
457 g_return_if_fail(instance_table != NULL); | |
458 | |
459 g_hash_table_destroy(instance_table); | |
460 instance_table = NULL; | |
461 } | |
462 | |
463 /************************************************************************** | |
464 * Marshallers | |
465 **************************************************************************/ | |
466 void | |
467 gaim_marshal_VOID(GaimCallback cb, va_list args, void *data, | |
468 void **return_val) | |
469 { | |
470 ((void (*)(void *))cb)(data); | |
471 } | |
472 | |
473 void | |
474 gaim_marshal_VOID__POINTER(GaimCallback cb, va_list args, void *data, | |
475 void **return_val) | |
476 { | |
6505 | 477 void *arg1 = va_arg(args, void *); |
478 | |
479 ((void (*)(void *, void *))cb)(arg1, data); | |
6485 | 480 } |
481 | |
482 void | |
483 gaim_marshal_VOID__POINTER_POINTER(GaimCallback cb, va_list args, | |
484 void *data, void **return_val) | |
485 { | |
6505 | 486 void *arg1 = va_arg(args, void *); |
487 void *arg2 = va_arg(args, void *); | |
488 | |
489 ((void (*)(void *, void *, void *))cb)(arg1, arg2, data); | |
6485 | 490 } |
491 | |
492 void | |
493 gaim_marshal_VOID__POINTER_POINTER_UINT(GaimCallback cb, va_list args, | |
494 void *data, void **return_val) | |
495 { | |
6505 | 496 void *arg1 = va_arg(args, void *); |
497 void *arg2 = va_arg(args, void *); | |
498 guint arg3 = va_arg(args, guint); | |
499 | |
500 ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 501 } |
502 | |
503 void | |
504 gaim_marshal_VOID__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, | |
505 void *data, void **return_val) | |
506 { | |
6505 | 507 void *arg1 = va_arg(args, void *); |
508 void *arg2 = va_arg(args, void *); | |
509 void *arg3 = va_arg(args, void *); | |
510 | |
511 ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data); | |
6485 | 512 } |
513 | |
514 void | |
515 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
516 va_list args, | |
517 void *data, | |
518 void **return_val) | |
519 { | |
6505 | 520 void *arg1 = va_arg(args, void *); |
521 void *arg2 = va_arg(args, void *); | |
522 void *arg3 = va_arg(args, void *); | |
523 void *arg4 = va_arg(args, void *); | |
524 | |
525 ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data); | |
6485 | 526 } |
6509 | 527 |
528 void | |
529 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT(GaimCallback cb, | |
530 va_list args, | |
531 void *data, | |
532 void **return_val) | |
533 { | |
534 void *arg1 = va_arg(args, void *); | |
535 void *arg2 = va_arg(args, void *); | |
536 void *arg3 = va_arg(args, void *); | |
537 guint arg4 = va_arg(args, guint); | |
538 | |
539 ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data); | |
540 } | |
541 | |
6485 | 542 void |
543 gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(GaimCallback cb, | |
544 va_list args, | |
545 void *data, | |
546 void **return_val) | |
547 { | |
6505 | 548 void *arg1 = va_arg(args, void *); |
549 void *arg2 = va_arg(args, void *); | |
550 void *arg3 = va_arg(args, void *); | |
551 guint arg4 = va_arg(args, guint); | |
552 guint arg5 = va_arg(args, guint); | |
553 | |
6485 | 554 ((void (*)(void *, void *, void *, guint, guint, void *))cb)( |
6505 | 555 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 556 } |
557 | |
558 void | |
559 gaim_marshal_BOOLEAN__POINTER(GaimCallback cb, va_list args, void *data, | |
560 void **return_val) | |
561 { | |
562 gboolean ret_val; | |
6505 | 563 void *arg1 = va_arg(args, void *); |
6485 | 564 |
6505 | 565 ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data); |
6485 | 566 |
567 if (return_val != NULL) | |
568 *return_val = GINT_TO_POINTER(ret_val); | |
569 } | |
570 | |
571 void | |
572 gaim_marshal_BOOLEAN__POINTER_POINTER(GaimCallback cb, va_list args, | |
573 void *data, void **return_val) | |
574 { | |
575 gboolean ret_val; | |
6505 | 576 void *arg1 = va_arg(args, void *); |
577 void *arg2 = va_arg(args, void *); | |
6485 | 578 |
6505 | 579 ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data); |
6485 | 580 |
581 if (return_val != NULL) | |
582 *return_val = GINT_TO_POINTER(ret_val); | |
583 } | |
584 | |
585 void | |
6509 | 586 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER(GaimCallback cb, va_list args, |
587 void *data, void **return_val) | |
588 { | |
589 gboolean ret_val; | |
590 void *arg1 = va_arg(args, void *); | |
591 void *arg2 = va_arg(args, void *); | |
592 void *arg3 = va_arg(args, void *); | |
593 | |
594 ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2, | |
595 arg3, data); | |
596 | |
597 if (return_val != NULL) | |
598 *return_val = GINT_TO_POINTER(ret_val); | |
599 } | |
600 | |
601 void | |
602 gaim_marshal_BOOLEAN__POINTER_POINTER_UINT(GaimCallback cb, | |
603 va_list args, | |
604 void *data, | |
605 void **return_val) | |
606 { | |
607 gboolean ret_val; | |
608 void *arg1 = va_arg(args, void *); | |
609 void *arg2 = va_arg(args, void *); | |
610 guint arg3 = va_arg(args, guint); | |
611 | |
612 ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)( | |
613 arg1, arg2, arg3, data); | |
614 | |
615 if (return_val != NULL) | |
616 *return_val = GINT_TO_POINTER(ret_val); | |
617 } | |
618 | |
619 void | |
6485 | 620 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(GaimCallback cb, |
621 va_list args, | |
622 void *data, | |
623 void **return_val) | |
624 { | |
625 gboolean ret_val; | |
6505 | 626 void *arg1 = va_arg(args, void *); |
627 void *arg2 = va_arg(args, void *); | |
628 void *arg3 = va_arg(args, void *); | |
629 guint arg4 = va_arg(args, guint); | |
6485 | 630 |
631 ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)( | |
6505 | 632 arg1, arg2, arg3, arg4, data); |
6485 | 633 |
634 if (return_val != NULL) | |
635 *return_val = GINT_TO_POINTER(ret_val); | |
636 } | |
637 | |
638 void | |
639 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(GaimCallback cb, | |
640 va_list args, | |
641 void *data, | |
642 void **return_val) | |
643 { | |
644 gboolean ret_val; | |
6505 | 645 void *arg1 = va_arg(args, void *); |
646 void *arg2 = va_arg(args, void *); | |
647 void *arg3 = va_arg(args, void *); | |
648 void *arg4 = va_arg(args, void *); | |
6485 | 649 |
650 ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)( | |
6505 | 651 arg1, arg2, arg3, arg4, data); |
6485 | 652 |
653 if (return_val != NULL) | |
654 *return_val = GINT_TO_POINTER(ret_val); | |
655 } | |
656 | |
657 void | |
658 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( | |
659 GaimCallback cb, va_list args, void *data, void **return_val) | |
660 { | |
661 gboolean ret_val; | |
6505 | 662 void *arg1 = va_arg(args, void *); |
663 void *arg2 = va_arg(args, void *); | |
664 void *arg3 = va_arg(args, void *); | |
665 void *arg4 = va_arg(args, void *); | |
666 void *arg5 = va_arg(args, void *); | |
6485 | 667 |
668 ret_val = | |
669 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)( | |
6505 | 670 arg1, arg2, arg3, arg4, arg5, data); |
6485 | 671 |
672 if (return_val != NULL) | |
673 *return_val = GINT_TO_POINTER(ret_val); | |
674 } |