1.1 --- a/epoc32/include/stdapis/glib-2.0/gobject/gclosure.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/glib-2.0/gobject/gclosure.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,168 @@
1.4 -gclosure.h
1.5 +/* GObject - GLib Type, Object, Parameter and Signal Library
1.6 + * Copyright (C) 2000-2001 Red Hat, Inc.
1.7 + * Copyright (C) 2005 Imendio AB
1.8 + * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.9 + *
1.10 + * This library is free software; you can redistribute it and/or
1.11 + * modify it under the terms of the GNU Lesser General Public
1.12 + * License as published by the Free Software Foundation; either
1.13 + * version 2 of the License, or (at your option) any later version.
1.14 + *
1.15 + * This library is distributed in the hope that it will be useful,
1.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.18 + * Lesser General Public License for more details.
1.19 + *
1.20 + * You should have received a copy of the GNU Lesser General
1.21 + * Public License along with this library; if not, write to the
1.22 + * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
1.23 + * Boston, MA 02111-1307, USA.
1.24 + */
1.25 +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
1.26 +#error "Only <glib-object.h> can be included directly."
1.27 +#endif
1.28 +
1.29 +#ifndef __G_CLOSURE_H__
1.30 +#define __G_CLOSURE_H__
1.31 +
1.32 +#include <_ansi.h>
1.33 +#include <gobject/gtype.h>
1.34 +
1.35 +G_BEGIN_DECLS
1.36 +
1.37 +/* --- defines --- */
1.38 +#define G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
1.39 +#define G_CLOSURE_N_NOTIFIERS(cl) ((cl)->meta_marshal + ((cl)->n_guards << 1L) + \
1.40 + (cl)->n_fnotifiers + (cl)->n_inotifiers)
1.41 +#define G_CCLOSURE_SWAP_DATA(cclosure) (((GClosure*) (closure))->derivative_flag)
1.42 +#define G_CALLBACK(f) ((GCallback) (f))
1.43 +
1.44 +
1.45 +/* -- typedefs --- */
1.46 +typedef struct _GClosure GClosure;
1.47 +typedef struct _GClosureNotifyData GClosureNotifyData;
1.48 +typedef void (*GCallback) (void);
1.49 +typedef void (*GClosureNotify) (gpointer data,
1.50 + GClosure *closure);
1.51 +typedef void (*GClosureMarshal) (GClosure *closure,
1.52 + GValue *return_value,
1.53 + guint n_param_values,
1.54 + const GValue *param_values,
1.55 + gpointer invocation_hint,
1.56 + gpointer marshal_data);
1.57 +typedef struct _GCClosure GCClosure;
1.58 +
1.59 +
1.60 +/* --- structures --- */
1.61 +struct _GClosureNotifyData
1.62 +{
1.63 + gpointer data;
1.64 + GClosureNotify notify;
1.65 +};
1.66 +struct _GClosure
1.67 +{
1.68 + /*< private >*/
1.69 + volatile guint ref_count : 15;
1.70 + volatile guint meta_marshal : 1;
1.71 + volatile guint n_guards : 1;
1.72 + volatile guint n_fnotifiers : 2; /* finalization notifiers */
1.73 + volatile guint n_inotifiers : 8; /* invalidation notifiers */
1.74 + volatile guint in_inotify : 1;
1.75 + volatile guint floating : 1;
1.76 + /*< protected >*/
1.77 + volatile guint derivative_flag : 1;
1.78 + /*< public >*/
1.79 + volatile guint in_marshal : 1;
1.80 + volatile guint is_invalid : 1;
1.81 +
1.82 + /*< private >*/ void (*marshal) (GClosure *closure,
1.83 + GValue /*out*/ *return_value,
1.84 + guint n_param_values,
1.85 + const GValue *param_values,
1.86 + gpointer invocation_hint,
1.87 + gpointer marshal_data);
1.88 + /*< protected >*/ gpointer data;
1.89 +
1.90 + /*< private >*/ GClosureNotifyData *notifiers;
1.91 +
1.92 + /* invariants/constrains:
1.93 + * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE
1.94 + * - invocation of all inotifiers occours prior to fnotifiers
1.95 + * - order of inotifiers is random
1.96 + * inotifiers may _not_ free/invalidate parameter values (e.g. ->data)
1.97 + * - order of fnotifiers is random
1.98 + * - each notifier may only be removed before or during its invocation
1.99 + * - reference counting may only happen prior to fnotify invocation
1.100 + * (in that sense, fnotifiers are really finalization handlers)
1.101 + */
1.102 +};
1.103 +/* closure for C function calls, callback() is the user function
1.104 + */
1.105 +struct _GCClosure
1.106 +{
1.107 + GClosure closure;
1.108 + gpointer callback;
1.109 +};
1.110 +
1.111 +
1.112 +/* --- prototypes --- */
1.113 +IMPORT_C GClosure* g_cclosure_new (GCallback callback_func,
1.114 + gpointer user_data,
1.115 + GClosureNotify destroy_data);
1.116 +IMPORT_C GClosure* g_cclosure_new_swap (GCallback callback_func,
1.117 + gpointer user_data,
1.118 + GClosureNotify destroy_data);
1.119 +IMPORT_C GClosure* g_signal_type_cclosure_new (GType itype,
1.120 + guint struct_offset);
1.121 +
1.122 +
1.123 +/* --- prototypes --- */
1.124 +IMPORT_C GClosure* g_closure_ref (GClosure *closure);
1.125 +IMPORT_C void g_closure_sink (GClosure *closure);
1.126 +IMPORT_C void g_closure_unref (GClosure *closure);
1.127 +/* intimidating */
1.128 +IMPORT_C GClosure* g_closure_new_simple (guint sizeof_closure,
1.129 + gpointer data);
1.130 +IMPORT_C void g_closure_add_finalize_notifier (GClosure *closure,
1.131 + gpointer notify_data,
1.132 + GClosureNotify notify_func);
1.133 +IMPORT_C void g_closure_remove_finalize_notifier (GClosure *closure,
1.134 + gpointer notify_data,
1.135 + GClosureNotify notify_func);
1.136 +IMPORT_C void g_closure_add_invalidate_notifier (GClosure *closure,
1.137 + gpointer notify_data,
1.138 + GClosureNotify notify_func);
1.139 +IMPORT_C void g_closure_remove_invalidate_notifier (GClosure *closure,
1.140 + gpointer notify_data,
1.141 + GClosureNotify notify_func);
1.142 +IMPORT_C void g_closure_add_marshal_guards (GClosure *closure,
1.143 + gpointer pre_marshal_data,
1.144 + GClosureNotify pre_marshal_notify,
1.145 + gpointer post_marshal_data,
1.146 + GClosureNotify post_marshal_notify);
1.147 +IMPORT_C void g_closure_set_marshal (GClosure *closure,
1.148 + GClosureMarshal marshal);
1.149 +IMPORT_C void g_closure_set_meta_marshal (GClosure *closure,
1.150 + gpointer marshal_data,
1.151 + GClosureMarshal meta_marshal);
1.152 +IMPORT_C void g_closure_invalidate (GClosure *closure);
1.153 +IMPORT_C void g_closure_invoke (GClosure *closure,
1.154 + GValue /*out*/ *return_value,
1.155 + guint n_param_values,
1.156 + const GValue *param_values,
1.157 + gpointer invocation_hint);
1.158 +
1.159 +/* FIXME:
1.160 + OK: data_object::destroy -> closure_invalidate();
1.161 + MIS: closure_invalidate() -> disconnect(closure);
1.162 + MIS: disconnect(closure) -> (unlink) closure_unref();
1.163 + OK: closure_finalize() -> g_free (data_string);
1.164 +
1.165 + random remarks:
1.166 + - need marshaller repo with decent aliasing to base types
1.167 + - provide marshaller collection, virtually covering anything out there
1.168 +*/
1.169 +
1.170 +G_END_DECLS
1.171 +
1.172 +#endif /* __G_CLOSURE_H__ */