Closures

Name

Closures -- 

Synopsis


#include <gobject.h>


void        (*GClosureMarshal)              (GClosure *closure,
                                             GValue *return_value,
                                             guint n_param_values,
                                             const GValue *param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data);
void        (*GClosureNotify)               (gpointer data,
                                             GClosure *closure);
struct      GClosure;
struct      GCClosure;
struct      GClosureNotifyData;
typedef     GCallback;
#define     G_CLOSURE_NEEDS_MARSHAL         (closure)
#define     G_CCLOSURE_SWAP_DATA            (cclosure)
GClosure*   g_cclosure_new                  (GCallback callback_func,
                                             gpointer user_data,
                                             GClosureNotify destroy_data);
GClosure*   g_cclosure_new_swap             (GCallback callback_func,
                                             gpointer user_data,
                                             GClosureNotify destroy_data);
GClosure*   g_cclosure_new_object           (GCallback callback_func,
                                             gpointer object);
GClosure*   g_cclosure_new_object_swap      (GCallback callback_func,
                                             gpointer object);
GClosure*   g_closure_ref                   (GClosure *closure);
void        g_closure_unref                 (GClosure *closure);
void        g_closure_invoke                (GClosure *closure,
                                             GValue *return_value,
                                             guint n_param_values,
                                             const GValue *param_values,
                                             gpointer invocation_hint);
void        g_closure_invalidate            (GClosure *closure);
void        g_closure_add_fnotify           (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);
void        g_closure_remove_fnotify        (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);
void        g_closure_add_inotify           (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);
void        g_closure_remove_inotify        (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);
GClosure*   g_closure_new_simple            (guint sizeof_closure,
                                             gpointer data);
void        g_closure_set_marshal           (GClosure *closure,
                                             GClosureMarshal marshal);
void        g_closure_add_marshal_guards    (GClosure *closure,
                                             gpointer pre_marshal_data,
                                             GClosureNotify pre_marshal_notify,
                                             gpointer post_marshal_data,
                                             GClosureNotify post_marshal_notify);
void        g_closure_set_meta_marshal      (GClosure *closure,
                                             gpointer marshal_data,
                                             GClosureMarshal meta_marshal);

Description

Details

GClosureMarshal ()

void        (*GClosureMarshal)              (GClosure *closure,
                                             GValue *return_value,
                                             guint n_param_values,
                                             const GValue *param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data);

closure : 
return_value : 
n_param_values : 
param_values : 
invocation_hint : 
marshal_data : 


GClosureNotify ()

void        (*GClosureNotify)               (gpointer data,
                                             GClosure *closure);

data : 
closure : 


struct GClosure

struct GClosure
{
  /*< private >*/	guint	 ref_count : 15;
  /*< private >*/	guint	 meta_marshal : 1;
  /*< private >*/	guint	 n_guards : 1;
  /*< private >*/	guint	 n_fnotifiers : 2;	/* finalization notifiers */
  /*< private >*/	guint	 n_inotifiers : 8;	/* invalidation notifiers */
  /*< private >*/	guint	 in_inotify : 1;
  /*< private >*/	guint	 floating : 1;
  /*< protected >*/	guint	 derivative_flag : 1;
  /*< puplic >*/	guint	 in_marshal : 1;
  /*< public >*/	guint	 is_invalid : 1;

  /*< private >*/	void   (*marshal)  (GClosure       *closure,
					    GValue /*out*/ *return_value,
					    guint           n_param_values,
					    const GValue   *param_values,
					    gpointer        invocation_hint,
					    gpointer	    marshal_data);
  /*< protected >*/	gpointer data;

  /*< private >*/	GClosureNotifyData *notifiers;

  /* invariants/constrains:
   * - ->marshal and ->data are _invalid_ as soon as ->is_invalid==TRUE
   * - invocation of all inotifiers occours prior to fnotifiers
   * - order of inotifiers is random
   *   inotifiers may _not_ free/invalidate parameter values (e.g. ->data)
   * - order of fnotifiers is random
   * - notifiers may only be removed before or during their invocation
   * - reference counting may only happen prior to fnotify invocation
   *   (in that sense, fnotifiers are really finalization handlers)
   */
};


struct GCClosure

struct GCClosure
{
  GClosure	closure;
  gpointer	callback;
};


struct GClosureNotifyData

struct GClosureNotifyData
{
  gpointer       data;
  GClosureNotify notify;
};


GCallback

typedef	gpointer GCallback;


G_CLOSURE_NEEDS_MARSHAL()

#define	G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)

closure : 


G_CCLOSURE_SWAP_DATA()

#define	G_CCLOSURE_SWAP_DATA(cclosure)	 (((GClosure*) (closure))->derivative_flag)

cclosure : 


g_cclosure_new ()

GClosure*   g_cclosure_new                  (GCallback callback_func,
                                             gpointer user_data,
                                             GClosureNotify destroy_data);

callback_func : 
user_data : 
destroy_data : 
Returns : 


g_cclosure_new_swap ()

GClosure*   g_cclosure_new_swap             (GCallback callback_func,
                                             gpointer user_data,
                                             GClosureNotify destroy_data);

callback_func : 
user_data : 
destroy_data : 
Returns : 


g_cclosure_new_object ()

GClosure*   g_cclosure_new_object           (GCallback callback_func,
                                             gpointer object);

callback_func : 
object : 
Returns : 


g_cclosure_new_object_swap ()

GClosure*   g_cclosure_new_object_swap      (GCallback callback_func,
                                             gpointer object);

callback_func : 
object : 
Returns : 


g_closure_ref ()

GClosure*   g_closure_ref                   (GClosure *closure);

closure : 
Returns : 


g_closure_unref ()

void        g_closure_unref                 (GClosure *closure);

closure : 


g_closure_invoke ()

void        g_closure_invoke                (GClosure *closure,
                                             GValue *return_value,
                                             guint n_param_values,
                                             const GValue *param_values,
                                             gpointer invocation_hint);

closure : 
return_value : 
n_param_values : 
param_values : 
invocation_hint : 


g_closure_invalidate ()

void        g_closure_invalidate            (GClosure *closure);

closure : 


g_closure_add_fnotify ()

void        g_closure_add_fnotify           (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);

closure : 
notify_data : 
notify_func : 


g_closure_remove_fnotify ()

void        g_closure_remove_fnotify        (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);

closure : 
notify_data : 
notify_func : 


g_closure_add_inotify ()

void        g_closure_add_inotify           (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);

closure : 
notify_data : 
notify_func : 


g_closure_remove_inotify ()

void        g_closure_remove_inotify        (GClosure *closure,
                                             gpointer notify_data,
                                             GClosureNotify notify_func);

closure : 
notify_data : 
notify_func : 


g_closure_new_simple ()

GClosure*   g_closure_new_simple            (guint sizeof_closure,
                                             gpointer data);

sizeof_closure : 
data : 
Returns : 


g_closure_set_marshal ()

void        g_closure_set_marshal           (GClosure *closure,
                                             GClosureMarshal marshal);

closure : 
marshal : 


g_closure_add_marshal_guards ()

void        g_closure_add_marshal_guards    (GClosure *closure,
                                             gpointer pre_marshal_data,
                                             GClosureNotify pre_marshal_notify,
                                             gpointer post_marshal_data,
                                             GClosureNotify post_marshal_notify);

closure : 
pre_marshal_data : 
pre_marshal_notify : 
post_marshal_data : 
post_marshal_notify : 


g_closure_set_meta_marshal ()

void        g_closure_set_meta_marshal      (GClosure *closure,
                                             gpointer marshal_data,
                                             GClosureMarshal meta_marshal);

closure : 
marshal_data : 
meta_marshal :