epoc32/include/stdapis/glib-2.0/glib/ghook.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/glib-2.0/glib/ghook.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/glib-2.0/glib/ghook.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,180 @@
     1.4 -ghook.h
     1.5 +/* GLIB - Library of useful routines for C programming
     1.6 + * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
     1.7 + * Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
     1.8 + *
     1.9 + * This library is free software; you can redistribute it and/or
    1.10 + * modify it under the terms of the GNU Lesser General Public
    1.11 + * License as published by the Free Software Foundation; either
    1.12 + * version 2 of the License, or (at your option) any later version.
    1.13 + *
    1.14 + * This library is distributed in the hope that it will be useful,
    1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
    1.17 + * Lesser General Public License for more details.
    1.18 + *
    1.19 + * You should have received a copy of the GNU Lesser General Public
    1.20 + * License along with this library; if not, write to the
    1.21 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    1.22 + * Boston, MA 02111-1307, USA.
    1.23 + */
    1.24 +
    1.25 +/*
    1.26 + * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
    1.27 + * file for a list of people on the GLib Team.  See the ChangeLog
    1.28 + * files for a list of changes.  These files are distributed with
    1.29 + * GLib at ftp://ftp.gtk.org/pub/gtk/. 
    1.30 + */
    1.31 +
    1.32 +#ifndef __G_HOOK_H__
    1.33 +#define __G_HOOK_H__
    1.34 +
    1.35 +#include <_ansi.h>
    1.36 +#include <glib/gmem.h>
    1.37 +
    1.38 +G_BEGIN_DECLS
    1.39 +
    1.40 +
    1.41 +/* --- typedefs --- */
    1.42 +typedef struct _GHook		GHook;
    1.43 +typedef struct _GHookList	GHookList;
    1.44 +
    1.45 +typedef gint		(*GHookCompareFunc)	(GHook		*new_hook,
    1.46 +						 GHook		*sibling);
    1.47 +typedef gboolean	(*GHookFindFunc)	(GHook		*hook,
    1.48 +						 gpointer	 data);
    1.49 +typedef void		(*GHookMarshaller)	(GHook		*hook,
    1.50 +						 gpointer	 marshal_data);
    1.51 +typedef gboolean	(*GHookCheckMarshaller)	(GHook		*hook,
    1.52 +						 gpointer	 marshal_data);
    1.53 +typedef void		(*GHookFunc)		(gpointer	 data);
    1.54 +typedef gboolean	(*GHookCheckFunc)	(gpointer	 data);
    1.55 +typedef void		(*GHookFinalizeFunc)	(GHookList      *hook_list,
    1.56 +						 GHook          *hook);
    1.57 +typedef enum
    1.58 +{
    1.59 +  G_HOOK_FLAG_ACTIVE	    = 1 << 0,
    1.60 +  G_HOOK_FLAG_IN_CALL	    = 1 << 1,
    1.61 +  G_HOOK_FLAG_MASK	    = 0x0f
    1.62 +} GHookFlagMask;
    1.63 +#define G_HOOK_FLAG_USER_SHIFT	(4)
    1.64 +
    1.65 +
    1.66 +/* --- structures --- */
    1.67 +struct _GHookList
    1.68 +{
    1.69 +  gulong	    seq_id;
    1.70 +  guint		    hook_size : 16;
    1.71 +  guint		    is_setup : 1;
    1.72 +  GHook		   *hooks;
    1.73 +  gpointer	    dummy3;
    1.74 +  GHookFinalizeFunc finalize_hook;
    1.75 +  gpointer	    dummy[2];
    1.76 +};
    1.77 +struct _GHook
    1.78 +{
    1.79 +  gpointer	 data;
    1.80 +  GHook		*next;
    1.81 +  GHook		*prev;
    1.82 +  guint		 ref_count;
    1.83 +  gulong	 hook_id;
    1.84 +  guint		 flags;
    1.85 +  gpointer	 func;
    1.86 +  GDestroyNotify destroy;
    1.87 +};
    1.88 +
    1.89 +
    1.90 +/* --- macros --- */
    1.91 +#define	G_HOOK(hook)			((GHook*) (hook))
    1.92 +#define	G_HOOK_FLAGS(hook)		(G_HOOK (hook)->flags)
    1.93 +#define	G_HOOK_ACTIVE(hook)		((G_HOOK_FLAGS (hook) & \
    1.94 +					  G_HOOK_FLAG_ACTIVE) != 0)
    1.95 +#define	G_HOOK_IN_CALL(hook)		((G_HOOK_FLAGS (hook) & \
    1.96 +					  G_HOOK_FLAG_IN_CALL) != 0)
    1.97 +#define G_HOOK_IS_VALID(hook)		(G_HOOK (hook)->hook_id != 0 && \
    1.98 +					 (G_HOOK_FLAGS (hook) & \
    1.99 +                                          G_HOOK_FLAG_ACTIVE))
   1.100 +#define G_HOOK_IS_UNLINKED(hook)	(G_HOOK (hook)->next == NULL && \
   1.101 +					 G_HOOK (hook)->prev == NULL && \
   1.102 +					 G_HOOK (hook)->hook_id == 0 && \
   1.103 +					 G_HOOK (hook)->ref_count == 0)
   1.104 +
   1.105 +
   1.106 +/* --- prototypes --- */
   1.107 +/* callback maintenance functions */
   1.108 +IMPORT_C void	 g_hook_list_init		(GHookList		*hook_list,
   1.109 +					 guint			 hook_size);
   1.110 +IMPORT_C void	 g_hook_list_clear		(GHookList		*hook_list);
   1.111 +IMPORT_C GHook*	 g_hook_alloc			(GHookList		*hook_list);
   1.112 +IMPORT_C void	 g_hook_free			(GHookList		*hook_list,
   1.113 +					 GHook			*hook);
   1.114 +IMPORT_C GHook *	 g_hook_ref			(GHookList		*hook_list,
   1.115 +					 GHook			*hook);
   1.116 +IMPORT_C void	 g_hook_unref			(GHookList		*hook_list,
   1.117 +					 GHook			*hook);
   1.118 +IMPORT_C gboolean g_hook_destroy			(GHookList		*hook_list,
   1.119 +					 gulong			 hook_id);
   1.120 +IMPORT_C void	 g_hook_destroy_link		(GHookList		*hook_list,
   1.121 +					 GHook			*hook);
   1.122 +IMPORT_C void	 g_hook_prepend			(GHookList		*hook_list,
   1.123 +					 GHook			*hook);
   1.124 +IMPORT_C void	 g_hook_insert_before		(GHookList		*hook_list,
   1.125 +					 GHook			*sibling,
   1.126 +					 GHook			*hook);
   1.127 +IMPORT_C void	 g_hook_insert_sorted		(GHookList		*hook_list,
   1.128 +					 GHook			*hook,
   1.129 +					 GHookCompareFunc	 func);
   1.130 +IMPORT_C GHook*	 g_hook_get			(GHookList		*hook_list,
   1.131 +					 gulong			 hook_id);
   1.132 +IMPORT_C GHook*	 g_hook_find			(GHookList		*hook_list,
   1.133 +					 gboolean		 need_valids,
   1.134 +					 GHookFindFunc		 func,
   1.135 +					 gpointer		 data);
   1.136 +IMPORT_C GHook*	 g_hook_find_data		(GHookList		*hook_list,
   1.137 +					 gboolean		 need_valids,
   1.138 +					 gpointer		 data);
   1.139 +IMPORT_C GHook*	 g_hook_find_func		(GHookList		*hook_list,
   1.140 +					 gboolean		 need_valids,
   1.141 +					 gpointer		 func);
   1.142 +IMPORT_C GHook*	 g_hook_find_func_data		(GHookList		*hook_list,
   1.143 +					 gboolean		 need_valids,
   1.144 +					 gpointer		 func,
   1.145 +					 gpointer		 data);
   1.146 +/* return the first valid hook, and increment its reference count */
   1.147 +IMPORT_C GHook*	 g_hook_first_valid		(GHookList		*hook_list,
   1.148 +					 gboolean		 may_be_in_call);
   1.149 +/* return the next valid hook with incremented reference count, and
   1.150 + * decrement the reference count of the original hook
   1.151 + */
   1.152 +IMPORT_C GHook*	 g_hook_next_valid		(GHookList		*hook_list,
   1.153 +					 GHook			*hook,
   1.154 +					 gboolean		 may_be_in_call);
   1.155 +/* GHookCompareFunc implementation to insert hooks sorted by their id */
   1.156 +IMPORT_C gint	 g_hook_compare_ids		(GHook			*new_hook,
   1.157 +					 GHook			*sibling);
   1.158 +/* convenience macros */
   1.159 +#define	 g_hook_append( hook_list, hook )  \
   1.160 +     g_hook_insert_before ((hook_list), NULL, (hook))
   1.161 +/* invoke all valid hooks with the (*GHookFunc) signature.
   1.162 + */
   1.163 +IMPORT_C void	 g_hook_list_invoke		(GHookList		*hook_list,
   1.164 +					 gboolean		 may_recurse);
   1.165 +/* invoke all valid hooks with the (*GHookCheckFunc) signature,
   1.166 + * and destroy the hook if FALSE is returned.
   1.167 + */
   1.168 +IMPORT_C void	 g_hook_list_invoke_check	(GHookList		*hook_list,
   1.169 +					 gboolean		 may_recurse);
   1.170 +/* invoke a marshaller on all valid hooks.
   1.171 + */
   1.172 +IMPORT_C void	 g_hook_list_marshal		(GHookList		*hook_list,
   1.173 +					 gboolean		 may_recurse,
   1.174 +					 GHookMarshaller	 marshaller,
   1.175 +					 gpointer		 marshal_data);
   1.176 +IMPORT_C void	 g_hook_list_marshal_check	(GHookList		*hook_list,
   1.177 +					 gboolean		 may_recurse,
   1.178 +					 GHookCheckMarshaller	 marshaller,
   1.179 +					 gpointer		 marshal_data);
   1.180 +
   1.181 +G_END_DECLS
   1.182 +
   1.183 +#endif /* __G_HOOK_H__ */
   1.184 +