1 /* GObject - GLib Type, Object, Parameter and Signal Library 2 * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General 15 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. 16 */ 17 #ifndef __G_TYPE_PRIVATE_H__ 18 #define __G_TYPE_PRIVATE_H__ 19 20 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) 21 #error "Only <glib-object.h> can be included directly." 22 #endif 23 24 #include "gboxed.h" 25 #include "gclosure.h" 26 #include "gobject.h" 27 28 /*< private > 29 * GOBJECT_IF_DEBUG: 30 * @debug_type: Currently only OBJECTS and SIGNALS are supported. 31 * @code_block: Custom debug code. 32 * 33 * A convenience macro for debugging GObject. 34 * This macro is only used internally. 35 */ 36 #ifdef G_ENABLE_DEBUG 37 #define GOBJECT_IF_DEBUG(debug_type, code_block) \ 38 G_STMT_START { \ 39 if (_g_type_debug_flags & G_TYPE_DEBUG_ ## debug_type) \ 40 { code_block; } \ 41 } G_STMT_END 42 #else /* !G_ENABLE_DEBUG */ 43 #define GOBJECT_IF_DEBUG(debug_type, code_block) 44 #endif /* G_ENABLE_DEBUG */ 45 46 G_BEGIN_DECLS 47 48 G_GNUC_BEGIN_IGNORE_DEPRECATIONS 49 extern GTypeDebugFlags _g_type_debug_flags; 50 G_GNUC_END_IGNORE_DEPRECATIONS 51 52 typedef struct _GRealClosure GRealClosure; 53 struct _GRealClosure 54 { 55 GClosureMarshal meta_marshal; 56 gpointer meta_marshal_data; 57 GVaClosureMarshal va_meta_marshal; 58 GVaClosureMarshal va_marshal; 59 GClosure closure; 60 }; 61 62 #define G_REAL_CLOSURE(_c) \ 63 ((GRealClosure *)G_STRUCT_MEMBER_P ((_c), -G_STRUCT_OFFSET (GRealClosure, closure))) 64 65 void _g_value_c_init (void); /* sync with gvalue.c */ 66 void _g_value_types_init (void); /* sync with gvaluetypes.c */ 67 void _g_enum_types_init (void); /* sync with genums.c */ 68 void _g_param_type_init (void); /* sync with gparam.c */ 69 void _g_boxed_type_init (void); /* sync with gboxed.c */ 70 void _g_object_type_init (void); /* sync with gobject.c */ 71 void _g_param_spec_types_init (void); /* sync with gparamspecs.c */ 72 void _g_value_transforms_init (void); /* sync with gvaluetransform.c */ 73 void _g_signal_init (void); /* sync with gsignal.c */ 74 75 /* for gboxed.c */ 76 gpointer _g_type_boxed_copy (GType type, 77 gpointer value); 78 void _g_type_boxed_free (GType type, 79 gpointer value); 80 void _g_type_boxed_init (GType type, 81 GBoxedCopyFunc copy_func, 82 GBoxedFreeFunc free_func); 83 84 gboolean _g_closure_is_void (GClosure *closure, 85 gpointer instance); 86 gboolean _g_closure_supports_invoke_va (GClosure *closure); 87 void _g_closure_set_va_marshal (GClosure *closure, 88 GVaClosureMarshal marshal); 89 void _g_closure_invoke_va (GClosure *closure, 90 GValue /*out*/ *return_value, 91 gpointer instance, 92 va_list args, 93 int n_params, 94 GType *param_types); 95 96 gboolean _g_object_has_signal_handler (GObject *object); 97 void _g_object_set_has_signal_handler (GObject *object); 98 99 /** 100 * _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE: 101 * 102 * See also G_DEFINE_TYPE_EXTENDED(). This macro is generally only 103 * necessary as a workaround for classes which have properties of 104 * object types that may be initialized in distinct threads. See: 105 * https://bugzilla.gnome.org/show_bug.cgi?id=674885 106 * 107 * Currently private. 108 */ 109 #define _G_DEFINE_TYPE_EXTENDED_WITH_PRELUDE(TN, t_n, T_P, _f_, _P_, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE (TN, t_n, T_P) {_P_;} _G_DEFINE_TYPE_EXTENDED_BEGIN_REGISTER (TN, t_n, T_P, _f_){_C_;} _G_DEFINE_TYPE_EXTENDED_END() 110 111 G_END_DECLS 112 113 #endif /* __G_TYPE_PRIVATE_H__ */ 114