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