diff --git a/girepository/giarginfo.c b/girepository/giarginfo.c index 58eed2c5f..04c67c019 100644 --- a/girepository/giarginfo.c +++ b/girepository/giarginfo.c @@ -26,6 +26,7 @@ #include +#include "gibaseinfo-private.h" #include "gitypelib-internal.h" #include "girepository-private.h" #include "giarginfo.h" @@ -333,3 +334,12 @@ gi_arg_info_load_type (GIArgInfo *info, gi_type_info_init ((GIBaseInfo *) type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type)); } + +void +gi_arg_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_ARG; +} diff --git a/girepository/gibaseinfo-private.h b/girepository/gibaseinfo-private.h new file mode 100644 index 000000000..3c115ee4a --- /dev/null +++ b/girepository/gibaseinfo-private.h @@ -0,0 +1,58 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Parsed GIR + * + * Copyright 2023 GNOME Foundation Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#pragma once + +#include +#include + +#include "gitypes.h" + +G_BEGIN_DECLS + +/* Keep this in sync with the GIInfoType enumeration. + * + * We don't add an "n-types" value to avoid having to handle + * it in every single switch. + */ +#define GI_INFO_TYPE_N_TYPES (GI_INFO_TYPE_REGISTERED_TYPE + 1) + +#define GI_IS_BASE_INFO_TYPE(info,type) \ + (G_TYPE_INSTANCE_GET_CLASS ((info), GI_TYPE_BASE_INFO, GIBaseInfoClass)->info_type == (type)) + +struct _GIBaseInfoClass +{ + GTypeClass parent_class; + + GIInfoType info_type; + + void (* finalize) (GIBaseInfo *info); +}; + +void gi_base_info_init_types (void); + +GType gi_base_info_type_register_static (const char *type_name, + gsize instance_size, + GClassInitFunc class_init); + +G_END_DECLS diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c index 6eaf9b09e..1ed1ae162 100644 --- a/girepository/gibaseinfo.c +++ b/girepository/gibaseinfo.c @@ -29,26 +29,284 @@ #include #include +#include #include "gitypelib-internal.h" #include "girepository-private.h" #include "gibaseinfo.h" +#include "gibaseinfo-private.h" #define INVALID_REFCOUNT 0x7FFFFFFF -/* GBoxed registration of BaseInfo. */ +/* Type registration of BaseInfo. */ +#define GI_BASE_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GI_TYPE_BASE_INFO, GIBaseInfoClass)) + +static void +value_base_info_init (GValue *value) +{ + value->data[0].v_pointer = NULL; +} + +static void +value_base_info_free_value (GValue *value) +{ + if (value->data[0].v_pointer != NULL) + gi_base_info_unref (value->data[0].v_pointer); +} + +static void +value_base_info_copy_value (const GValue *src, + GValue *dst) +{ + if (src->data[0].v_pointer != NULL) + dst->data[0].v_pointer = gi_base_info_ref (src->data[0].v_pointer); + else + dst->data[0].v_pointer = NULL; +} + +static gpointer +value_base_info_peek_pointer (const GValue *value) +{ + return value->data[0].v_pointer; +} + +static char * +value_base_info_collect_value (GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags) +{ + GIBaseInfo *info = collect_values[0].v_pointer; + + if (info == NULL) + { + value->data[0].v_pointer = NULL; + return NULL; + } + + if (info->parent_instance.g_class == NULL) + return g_strconcat ("invalid unclassed GIBaseInfo pointer for " + "value type '", + G_VALUE_TYPE_NAME (value), + "'", + NULL); + + value->data[0].v_pointer = gi_base_info_ref (info); + + return NULL; +} + +static gchar * +value_base_info_lcopy_value (const GValue *value, + guint n_collect_values, + GTypeCValue *collect_values, + guint collect_flags) +{ + GIBaseInfo **node_p = collect_values[0].v_pointer; + + if (node_p == NULL) + return g_strconcat ("value location for '", + G_VALUE_TYPE_NAME (value), + "' passed as NULL", + NULL); + + if (value->data[0].v_pointer == NULL) + *node_p = NULL; + else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) + *node_p = value->data[0].v_pointer; + else + *node_p = gi_base_info_ref (value->data[0].v_pointer); + + return NULL; +} + +static void +gi_base_info_finalize (GIBaseInfo *self) +{ + if (self->container && self->container->ref_count != INVALID_REFCOUNT) + gi_base_info_unref (self->container); + + g_clear_object (&self->repository); + + g_type_free_instance ((GTypeInstance *) self); +} + +static void +gi_base_info_class_init (GIBaseInfoClass *klass) +{ + klass->info_type = GI_INFO_TYPE_INVALID; + klass->finalize = gi_base_info_finalize; +} + +static void +gi_base_info_init (GIBaseInfo *self) +{ + g_atomic_ref_count_init (&self->ref_count); +} + GType gi_base_info_gtype_get_type (void) { - static GType our_type = 0; - - if (our_type == 0) - our_type = - g_boxed_type_register_static ("GIBaseInfo", - (GBoxedCopyFunc) gi_base_info_ref, - (GBoxedFreeFunc) gi_base_info_unref); + static GType base_info_type = 0; - return our_type; + if (g_once_init_enter_pointer (&base_info_type)) + { + static const GTypeFundamentalInfo finfo = { + (G_TYPE_FLAG_CLASSED | + G_TYPE_FLAG_INSTANTIATABLE | + G_TYPE_FLAG_DERIVABLE | + G_TYPE_FLAG_DEEP_DERIVABLE), + }; + + static const GTypeValueTable value_table = { + value_base_info_init, + value_base_info_free_value, + value_base_info_copy_value, + value_base_info_peek_pointer, + "p", + value_base_info_collect_value, + "p", + value_base_info_lcopy_value, + }; + + const GTypeInfo type_info = { + /* Class */ + sizeof (GIBaseInfoClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gi_base_info_class_init, + (GClassFinalizeFunc) NULL, + NULL, + + /* Instance */ + sizeof (GIBaseInfo), + 0, + (GInstanceInitFunc) gi_base_info_init, + + /* GValue */ + &value_table, + }; + + GType _base_info_type = + g_type_register_fundamental (g_type_fundamental_next (), + g_intern_static_string ("GIBaseInfo"), + &type_info, &finfo, + G_TYPE_FLAG_ABSTRACT); + + g_once_init_leave_pointer (&base_info_type, _base_info_type); + } + + return base_info_type; +} + +/*< private > + * gi_base_info_type_register_static: + * @type_name: the name of the type + * @instance_size: size (in bytes) of the type’s instance struct + * @class_init: class init function for the type + * + * Registers a new [type@GIRepository.BaseInfo] type for the given @type_name + * using the type information provided. + * + * Returns: the newly registered [type@GObject.Type] + * Since: 2.80 + */ +GType +gi_base_info_type_register_static (const char *type_name, + gsize instance_size, + GClassInitFunc class_init) +{ + GTypeInfo info; + + info.class_size = sizeof (GIBaseInfoClass); + info.base_init = NULL; + info.base_finalize = NULL; + info.class_init = class_init; + info.class_finalize = NULL; + info.instance_size = instance_size; + info.n_preallocs = 0; + info.instance_init = NULL; + info.value_table = NULL; + + return g_type_register_static (GI_TYPE_BASE_INFO, type_name, &info, 0); +} + +static GType gi_base_info_types[GI_INFO_TYPE_N_TYPES]; + +#define GI_DEFINE_BASE_INFO_TYPE(type_name, TYPE_ENUM_VALUE) \ +GType \ +type_name ## _get_type (void) \ +{ \ + gi_base_info_init_types (); \ + g_assert (gi_base_info_types[TYPE_ENUM_VALUE] != G_TYPE_INVALID); \ + return gi_base_info_types[TYPE_ENUM_VALUE]; \ +} + +GI_DEFINE_BASE_INFO_TYPE (gi_callable_info, GI_INFO_TYPE_CALLABLE) +GI_DEFINE_BASE_INFO_TYPE (gi_function_info, GI_INFO_TYPE_FUNCTION) +GI_DEFINE_BASE_INFO_TYPE (gi_callback_info, GI_INFO_TYPE_CALLBACK) +GI_DEFINE_BASE_INFO_TYPE (gi_registered_type_info, GI_INFO_TYPE_REGISTERED_TYPE) +GI_DEFINE_BASE_INFO_TYPE (gi_struct_info, GI_INFO_TYPE_STRUCT) +GI_DEFINE_BASE_INFO_TYPE (gi_union_info, GI_INFO_TYPE_UNION) +GI_DEFINE_BASE_INFO_TYPE (gi_enum_info, GI_INFO_TYPE_ENUM) +GI_DEFINE_BASE_INFO_TYPE (gi_object_info, GI_INFO_TYPE_OBJECT) +GI_DEFINE_BASE_INFO_TYPE (gi_interface_info, GI_INFO_TYPE_INTERFACE) +GI_DEFINE_BASE_INFO_TYPE (gi_constant_info, GI_INFO_TYPE_CONSTANT) +GI_DEFINE_BASE_INFO_TYPE (gi_value_info, GI_INFO_TYPE_VALUE) +GI_DEFINE_BASE_INFO_TYPE (gi_signal_info, GI_INFO_TYPE_SIGNAL) +GI_DEFINE_BASE_INFO_TYPE (gi_vfunc_info, GI_INFO_TYPE_VFUNC) +GI_DEFINE_BASE_INFO_TYPE (gi_property_info, GI_INFO_TYPE_PROPERTY) +GI_DEFINE_BASE_INFO_TYPE (gi_field_info, GI_INFO_TYPE_FIELD) +GI_DEFINE_BASE_INFO_TYPE (gi_arg_info, GI_INFO_TYPE_ARG) +GI_DEFINE_BASE_INFO_TYPE (gi_type_info, GI_INFO_TYPE_TYPE) +GI_DEFINE_BASE_INFO_TYPE (gi_unresolved_info, GI_INFO_TYPE_UNRESOLVED) + +void +gi_base_info_init_types (void) +{ + static gsize register_types_once = 0; + + if (g_once_init_enter (®ister_types_once)) + { + const struct + { + GIInfoType info_type; + const char *type_name; + gsize instance_size; + GClassInitFunc class_init; + } + types[] = + { + { GI_INFO_TYPE_CALLABLE, "GICallableInfo", sizeof (GICallableInfo), gi_callable_info_class_init }, + { GI_INFO_TYPE_FUNCTION, "GIFunctionInfo", sizeof (GIFunctionInfo), gi_function_info_class_init }, + { GI_INFO_TYPE_CALLBACK, "GICallbackInfo", sizeof (GICallbackInfo), gi_callback_info_class_init }, + { GI_INFO_TYPE_REGISTERED_TYPE, "GIRegisteredTypeInfo", sizeof (GIRegisteredTypeInfo), gi_registered_type_info_class_init }, + { GI_INFO_TYPE_STRUCT, "GIStructInfo", sizeof (GIStructInfo), gi_struct_info_class_init }, + { GI_INFO_TYPE_UNION, "GIUnionInfo", sizeof (GIUnionInfo), gi_union_info_class_init }, + { GI_INFO_TYPE_ENUM, "GIEnumInfo", sizeof (GIEnumInfo), gi_enum_info_class_init }, + { GI_INFO_TYPE_OBJECT, "GIObjectInfo", sizeof (GIObjectInfo), gi_object_info_class_init }, + { GI_INFO_TYPE_INTERFACE, "GIInterfaceInfo", sizeof (GIInterfaceInfo), gi_interface_info_class_init }, + { GI_INFO_TYPE_CONSTANT, "GIConstantInfo", sizeof (GIConstantInfo), gi_constant_info_class_init }, + { GI_INFO_TYPE_VALUE, "GIValueInfo", sizeof (GIValueInfo), gi_value_info_class_init }, + { GI_INFO_TYPE_SIGNAL, "GISignalInfo", sizeof (GISignalInfo), gi_signal_info_class_init }, + { GI_INFO_TYPE_VFUNC, "GIVFuncInfo", sizeof (GIVFuncInfo), gi_vfunc_info_class_init }, + { GI_INFO_TYPE_PROPERTY, "GIPropertyInfo", sizeof (GIPropertyInfo), gi_property_info_class_init }, + { GI_INFO_TYPE_FIELD, "GIFieldInfo", sizeof (GIFieldInfo), gi_field_info_class_init }, + { GI_INFO_TYPE_ARG, "GIArgInfo", sizeof (GIArgInfo), gi_arg_info_class_init }, + { GI_INFO_TYPE_TYPE, "GITypeInfo", sizeof (GITypeInfo), gi_type_info_class_init }, + { GI_INFO_TYPE_UNRESOLVED, "GIUnresolvedInfo", sizeof (GIUnresolvedInfo), gi_unresolved_info_class_init }, + }; + + for (gsize i = 0; i < G_N_ELEMENTS (types); i++) + { + GType registered_type = gi_base_info_type_register_static (g_intern_static_string (types[i].type_name), + types[i].instance_size, + types[i].class_init); + gi_base_info_types[types[i].info_type] = registered_type; + } + + g_once_init_leave (®ister_types_once, 1); + } } /* info creation */ @@ -62,16 +320,21 @@ gi_info_new_full (GIInfoType type, GIRealInfo *info; g_return_val_if_fail (container != NULL || repository != NULL, NULL); + g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL); - info = g_slice_new (GIRealInfo); + gi_base_info_init_types (); + g_assert (gi_base_info_types[type] != G_TYPE_INVALID); + info = (GIRealInfo *) g_type_create_instance (gi_base_info_types[type]); - gi_info_init (info, type, repository, container, typelib, offset); - info->ref_count = 1; + info->typelib = typelib; + info->offset = offset; - if (container && ((GIRealInfo *) container)->ref_count != INVALID_REFCOUNT) + if (container) + info->container = container; + if (container && container->ref_count != INVALID_REFCOUNT) gi_base_info_ref (info->container); - g_object_ref (info->repository); + info->repository = g_object_ref (repository); return (GIBaseInfo*)info; } @@ -108,8 +371,6 @@ gi_info_init (GIRealInfo *info, /* Invalid refcount used to flag stack-allocated infos */ info->ref_count = INVALID_REFCOUNT; - info->type = type; - info->typelib = typelib; info->offset = offset; @@ -140,12 +401,12 @@ gi_info_from_entry (GIRepository *repository, { GIUnresolvedInfo *unresolved; - unresolved = g_slice_new0 (GIUnresolvedInfo); + unresolved = (GIUnresolvedInfo *) gi_info_new_full (GI_INFO_TYPE_UNRESOLVED, + repository, + NULL, + typelib, + entry->offset); - unresolved->type = GI_INFO_TYPE_UNRESOLVED; - unresolved->ref_count = 1; - unresolved->repository = g_object_ref (repository); - unresolved->container = NULL; unresolved->name = name; unresolved->namespace = namespace; @@ -243,7 +504,7 @@ gi_base_info_ref (GIBaseInfo *info) GIRealInfo *rinfo = (GIRealInfo*)info; g_assert (rinfo->ref_count != INVALID_REFCOUNT); - g_atomic_int_inc (&rinfo->ref_count); + g_atomic_ref_count_inc (&rinfo->ref_count); return info; } @@ -262,19 +523,8 @@ gi_base_info_unref (GIBaseInfo *info) g_assert (rinfo->ref_count > 0 && rinfo->ref_count != INVALID_REFCOUNT); - if (!g_atomic_int_dec_and_test (&rinfo->ref_count)) - return; - - if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT) - gi_base_info_unref (rinfo->container); - - if (rinfo->repository) - g_object_unref (rinfo->repository); - - if (rinfo->type == GI_INFO_TYPE_UNRESOLVED) - g_slice_free (GIUnresolvedInfo, (GIUnresolvedInfo *) rinfo); - else - g_slice_free (GIRealInfo, rinfo); + if (g_atomic_ref_count_dec (&rinfo->ref_count)) + GI_BASE_INFO_GET_CLASS (info)->finalize (info); } /** @@ -288,8 +538,7 @@ gi_base_info_unref (GIBaseInfo *info) GIInfoType gi_base_info_get_info_type (GIBaseInfo *info) { - - return ((GIRealInfo*)info)->type; + return GI_BASE_INFO_GET_CLASS (info)->info_type; } /** diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c index b94cd677b..1d0e001cd 100644 --- a/girepository/gicallableinfo.c +++ b/girepository/gicallableinfo.c @@ -29,6 +29,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "girffi.h" @@ -791,3 +792,12 @@ gi_callable_info_invoke (GICallableInfo *info, gi_base_info_unref ((GIBaseInfo *)rinfo); return success; } + +void +gi_callable_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_CALLABLE; +} diff --git a/girepository/gicallbackinfo.c b/girepository/gicallbackinfo.c new file mode 100644 index 000000000..b7e88ea97 --- /dev/null +++ b/girepository/gicallbackinfo.c @@ -0,0 +1,52 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Callable implementation + * + * Copyright (C) 2005 Matthias Clasen + * Copyright 2023 GNOME Foundation, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include +#include "gibaseinfo-private.h" +#include "girepository-private.h" +#include "gitypelib-internal.h" +#include "gicallbackinfo.h" + +/** + * SECTION:gicallback + * @title: GICallbackInfo + * @short_description: Struct representing a callback + * + * GICallbackInfo represents a callback. + */ + +void +gi_callback_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_CALLBACK; +} diff --git a/girepository/gicallbackinfo.h b/girepository/gicallbackinfo.h new file mode 100644 index 000000000..c14c6fd7a --- /dev/null +++ b/girepository/gicallbackinfo.h @@ -0,0 +1,43 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Callable + * + * Copyright 2023 GNOME Foundation, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#pragma once + +#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +/** + * GI_IS_CALLBACK_INFO + * @info: an info structure + * + * Checks if @info is a #GICallbackInfo or derived from it. + */ +#define GI_IS_CALLBACK_INFO(info) \ + (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) + +G_END_DECLS diff --git a/girepository/giconstantinfo.c b/girepository/giconstantinfo.c index 28ef282b5..69e103ba0 100644 --- a/girepository/giconstantinfo.c +++ b/girepository/giconstantinfo.c @@ -28,6 +28,7 @@ #include // memcpy #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "giconstantinfo.h" @@ -176,3 +177,11 @@ gi_constant_info_get_value (GIConstantInfo *info, return blob->size; } +void +gi_constant_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_CONSTANT; +} diff --git a/girepository/gienuminfo.c b/girepository/gienuminfo.c index 4176ab2fc..8daa3ff5b 100644 --- a/girepository/gienuminfo.c +++ b/girepository/gienuminfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "gienuminfo.h" @@ -207,6 +208,15 @@ gi_enum_info_get_storage_type (GIEnumInfo *info) return blob->storage_type; } +void +gi_enum_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_ENUM; +} + /** * gi_value_info_get_value: * @info: a #GIValueInfo @@ -233,3 +243,12 @@ gi_value_info_get_value (GIValueInfo *info) else return (gint64)blob->value; } + +void +gi_value_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_VALUE; +} diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c index 8bb510a37..a204ddd16 100644 --- a/girepository/gifieldinfo.c +++ b/girepository/gifieldinfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "config.h" @@ -554,3 +555,12 @@ gi_field_info_set_field (GIFieldInfo *field_info, return result; } + +void +gi_field_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_FIELD; +} diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c index 5180299c1..abab97906 100644 --- a/girepository/gifunctioninfo.c +++ b/girepository/gifunctioninfo.c @@ -29,6 +29,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "gifunctioninfo.h" @@ -294,3 +295,12 @@ gi_function_info_invoke (GIFunctionInfo *info, throws, error); } + +void +gi_function_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_FUNCTION; +} diff --git a/girepository/giinterfaceinfo.c b/girepository/giinterfaceinfo.c index 1097c9537..17ffeb4da 100644 --- a/girepository/giinterfaceinfo.c +++ b/girepository/giinterfaceinfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "giinterfaceinfo.h" @@ -501,3 +502,11 @@ gi_interface_info_get_iface_struct (GIInterfaceInfo *info) return NULL; } +void +gi_interface_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_INTERFACE; +} diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c index f9248f260..5afeafb1c 100644 --- a/girepository/giobjectinfo.c +++ b/girepository/giobjectinfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "giobjectinfo.h" @@ -1097,3 +1098,12 @@ gi_object_info_get_get_value_function_pointer (GIObjectInfo *info) return (GIObjectInfoGetValueFunction)_get_func(info, (SymbolGetter)gi_object_info_get_get_value_function); } + +void +gi_object_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_OBJECT; +} diff --git a/girepository/gipropertyinfo.c b/girepository/gipropertyinfo.c index 76255a711..463a289b7 100644 --- a/girepository/gipropertyinfo.c +++ b/girepository/gipropertyinfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "gipropertyinfo.h" @@ -207,3 +208,12 @@ gi_property_info_get_getter (GIPropertyInfo *info) else return NULL; } + +void +gi_property_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_PROPERTY; +} diff --git a/girepository/giregisteredtypeinfo.c b/girepository/giregisteredtypeinfo.c index 3537cf188..d3274c867 100644 --- a/girepository/giregisteredtypeinfo.c +++ b/girepository/giregisteredtypeinfo.c @@ -29,6 +29,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "giregisteredtypeinfo.h" @@ -144,3 +145,11 @@ gi_registered_type_info_get_g_type (GIRegisteredTypeInfo *info) return (* get_type_func) (); } +void +gi_registered_type_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_REGISTERED_TYPE; +} diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h index 18d784876..83b9c1ef5 100644 --- a/girepository/girepository-private.h +++ b/girepository/girepository-private.h @@ -32,7 +32,9 @@ #include #include -typedef struct _GIRealInfo GIRealInfo; +/* FIXME: For now, GIRealInfo is a compatibility define. This will eventually + * be removed. */ +typedef struct _GIBaseInfo GIRealInfo; /* We changed a gint32 -> gint in the structure below, which should be * valid everywhere we care about. @@ -45,39 +47,169 @@ G_STATIC_ASSERT (sizeof (int) == sizeof (gint32)); * from the typelib, and not having computed data in * per-type structures. */ -struct _GIRealInfo +struct _GIBaseInfo { - /* Keep this part in sync with GIUnresolvedInfo below */ - gint32 type; - volatile gint ref_count; + /*< private >*/ + GTypeInstance parent_instance; + gatomicrefcount ref_count; + GIRepository *repository; GIBaseInfo *container; - /* Resolved specific */ - GITypelib *typelib; guint32 offset; guint32 type_is_embedded : 1; /* Used by GITypeInfo */ - guint32 reserved : 31; - - gpointer reserved2[4]; }; +/* Subtypes */ +struct _GICallableInfo +{ + GIBaseInfo parent; +}; + +void gi_callable_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIFunctionInfo +{ + GIBaseInfo parent; +}; + +void gi_function_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GICallbackInfo +{ + GIBaseInfo parent; +}; + +void gi_callback_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIRegisteredTypeInfo +{ + GIBaseInfo parent; +}; + +void gi_registered_type_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIStructInfo +{ + GIBaseInfo parent; +}; + +void gi_struct_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIUnionInfo +{ + GIBaseInfo parent; +}; + +void gi_union_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIEnumInfo +{ + GIBaseInfo parent; +}; + +void gi_enum_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIObjectInfo +{ + GIBaseInfo parent; +}; + +void gi_object_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIInterfaceInfo +{ + GIBaseInfo parent; +}; + +void gi_interface_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIConstantInfo +{ + GIBaseInfo parent; +}; + +void gi_constant_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIValueInfo +{ + GIBaseInfo parent; +}; + +void gi_value_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GISignalInfo +{ + GIBaseInfo parent; +}; + +void gi_signal_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIVFuncInfo +{ + GIBaseInfo parent; +}; + +void gi_vfunc_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIPropertyInfo +{ + GIBaseInfo parent; +}; + +void gi_property_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIFieldInfo +{ + GIBaseInfo parent; +}; + +void gi_field_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GIArgInfo +{ + GIBaseInfo parent; +}; + +void gi_arg_info_class_init (gpointer g_class, + gpointer class_data); + +struct _GITypeInfo +{ + GIBaseInfo parent; +}; + +void gi_type_info_class_init (gpointer g_class, + gpointer class_data); + struct _GIUnresolvedInfo { - /* Keep this part in sync with GIBaseInfo above */ - gint32 type; - volatile gint ref_count; - GIRepository *repository; - GIBaseInfo *container; - - /* Unresolved specific */ + GIBaseInfo parent; const gchar *name; const gchar *namespace; }; +void gi_unresolved_info_class_init (gpointer g_class, + gpointer class_data); + void gi_info_init (GIRealInfo *info, GIInfoType type, GIRepository *repository, diff --git a/girepository/girepository.h b/girepository/girepository.h index 7cf9a6768..96ac7194b 100644 --- a/girepository/girepository.h +++ b/girepository/girepository.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,7 @@ #include #include #include +#include #include G_BEGIN_DECLS diff --git a/girepository/gisignalinfo.c b/girepository/gisignalinfo.c index 9424c16f9..b4fc61c56 100644 --- a/girepository/gisignalinfo.c +++ b/girepository/gisignalinfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "gisignalinfo.h" @@ -141,3 +142,11 @@ gi_signal_info_true_stops_emit (GISignalInfo *info) return blob->true_stops_emit; } +void +gi_signal_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_SIGNAL; +} diff --git a/girepository/gistructinfo.c b/girepository/gistructinfo.c index 4b36cbb9a..eda380f2e 100644 --- a/girepository/gistructinfo.c +++ b/girepository/gistructinfo.c @@ -29,6 +29,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "gistructinfo.h" @@ -338,3 +339,12 @@ gi_struct_info_get_free_function (GIStructInfo *info) return NULL; } + +void +gi_struct_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_STRUCT; +} diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c index 4c4a37c14..cf64ae78e 100644 --- a/girepository/gitypeinfo.c +++ b/girepository/gitypeinfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "gitypeinfo.h" @@ -569,3 +570,12 @@ gi_type_info_hash_pointer_from_argument (GITypeInfo *info, GITypeTag storage_type = gi_type_info_get_storage_type (info); return gi_type_tag_hash_pointer_from_argument (storage_type, arg); } + +void +gi_type_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_TYPE; +} diff --git a/girepository/gitypes.h b/girepository/gitypes.h index cd432c762..b555a959d 100644 --- a/girepository/gitypes.h +++ b/girepository/gitypes.h @@ -29,155 +29,87 @@ #endif #include +#include + +#include "gi-visibility.h" G_BEGIN_DECLS -typedef struct _GIBaseInfoStub { - /*< private >*/ - gint32 dummy1; - gint32 dummy2; - gpointer dummy3; - gpointer dummy4; - gpointer dummy5; - guint32 dummy6; - guint32 dummy7; - gpointer padding[4]; -} GIBaseInfo; +/* Documented in gibaseinfo.c */ +typedef struct _GIBaseInfo GIBaseInfo; +typedef struct _GIBaseInfoClass GIBaseInfoClass; -/** - * GICallableInfo: - * - * Represents a callable, either #GIFunctionInfo, #GICallbackInfo or - * #GIVFuncInfo. - */ -typedef GIBaseInfo GICallableInfo; +/* Documented in gicallableinfo.c */ +typedef struct _GICallableInfo GICallableInfo; +GI_AVAILABLE_IN_ALL GType gi_callable_info_get_type (void); -/** - * GIFunctionInfo: - * - * Represents a function, eg arguments and return value. - */ -typedef GIBaseInfo GIFunctionInfo; +/* Documented in gifunctioninfo.c */ +typedef struct _GIFunctionInfo GIFunctionInfo; +GI_AVAILABLE_IN_ALL GType gi_function_info_get_type (void); -/** - * SECTION:gicallbackinfo - * @title: GICallbackInfo - * @short_description: Struct representing a callback - * - * GICallbackInfo represents a callback. - */ +/* Documented in gicallbackinfo.c */ +typedef struct _GICallbackInfo GICallbackInfo; +GI_AVAILABLE_IN_ALL GType gi_callback_info_get_type (void); -/** - * GICallbackInfo: - * - * Represents a callback, eg arguments and return value. - */ -typedef GIBaseInfo GICallbackInfo; +/* Documented in giregisteredtypeinfo.c */ +typedef struct _GIRegisteredTypeInfo GIRegisteredTypeInfo; +GI_AVAILABLE_IN_ALL GType gi_registered_type_info_get_type (void); -/** - * GIRegisteredTypeInfo: - * - * Represent a registered type. - */ -typedef GIBaseInfo GIRegisteredTypeInfo; - -/** - * GIStructInfo: - * - * Represents a struct. - */ -typedef GIBaseInfo GIStructInfo; +/* Documented in gistructinfo.c */ +typedef struct _GIStructInfo GIStructInfo; +GI_AVAILABLE_IN_ALL GType gi_struct_info_get_type (void); /* Documented in giunioninfo.c */ -typedef GIBaseInfo GIUnionInfo; +typedef struct _GIUnionInfo GIUnionInfo; +GI_AVAILABLE_IN_ALL GType gi_union_info_get_type (void); -/** - * GIEnumInfo: - * - * Represents an enum or a flag. - */ -typedef GIBaseInfo GIEnumInfo; +/* Documented in gienuminfo.c */ +typedef struct _GIEnumInfo GIEnumInfo; +GI_AVAILABLE_IN_ALL GType gi_enum_info_get_type (void); -/** - * GIObjectInfo: - * - * Represents an object. - */ -typedef GIBaseInfo GIObjectInfo; +/* Documented in giobjectinfo.c */ +typedef struct _GIObjectInfo GIObjectInfo; +GI_AVAILABLE_IN_ALL GType gi_object_info_get_type (void); -/** - * GIInterfaceInfo: - * - * Represents an interface. - */ -typedef GIBaseInfo GIInterfaceInfo; +/* Documented in giinterfaceinfo.c */ +typedef struct _GIInterfaceInfo GIInterfaceInfo; +GI_AVAILABLE_IN_ALL GType gi_interface_info_get_type (void); -/** - * GIConstantInfo: - * - * Represents a constant. - */ -typedef GIBaseInfo GIConstantInfo; +/* Documented in giconstantinfo.c */ +typedef struct _GIConstantInfo GIConstantInfo; +GI_AVAILABLE_IN_ALL GType gi_constant_info_get_type (void); -/** - * SECTION:givalueinfo - * @title: GIValueInfo - * @short_description: Struct representing a value - * - * GIValueInfo represents a value. - */ +/* Documented in givalueinfo.c */ +typedef struct _GIValueInfo GIValueInfo; +GI_AVAILABLE_IN_ALL GType gi_value_info_get_type (void); -/** - * GIValueInfo: - * - * Represents a enum value of a #GIEnumInfo. - */ -typedef GIBaseInfo GIValueInfo; - -/** - * GISignalInfo: - * - * Represents a signal. - */ -typedef GIBaseInfo GISignalInfo; +/* Documented in gisignalinfo.c */ +typedef struct _GISignalInfo GISignalInfo; +GI_AVAILABLE_IN_ALL GType gi_signal_info_get_type (void); /* Documented in givfuncinfo.c */ -typedef GIBaseInfo GIVFuncInfo; +typedef struct _GIVFuncInfo GIVFuncInfo; +GI_AVAILABLE_IN_ALL GType gi_vfunc_info_get_type (void); -/** - * GIPropertyInfo: - * - * Represents a property of a #GIObjectInfo or a #GIInterfaceInfo. - */ -typedef GIBaseInfo GIPropertyInfo; +/* Documented in gipropertyinfo.c */ +typedef struct _GIPropertyInfo GIPropertyInfo; +GI_AVAILABLE_IN_ALL GType gi_property_info_get_type (void); -/** - * GIFieldInfo: - * - * Represents a field of a #GIStructInfo or a #GIUnionInfo. - */ -typedef GIBaseInfo GIFieldInfo; +/* Documented in gifieldinfo.c */ +typedef struct _GIFieldInfo GIFieldInfo; +GI_AVAILABLE_IN_ALL GType gi_field_info_get_type (void); -/** - * GIArgInfo: - * - * Represents an argument. - */ -typedef GIBaseInfo GIArgInfo; +/* Documented in giarginfo.c */ +typedef struct _GIArgInfo GIArgInfo; +GI_AVAILABLE_IN_ALL GType gi_arg_info_get_type (void); -/** - * GITypeInfo: - * - * Represents type information, direction, transfer etc. - */ -typedef GIBaseInfo GITypeInfo; +/* Documented in gitypeinfo.c */ +typedef struct _GITypeInfo GITypeInfo; +GI_AVAILABLE_IN_ALL GType gi_type_info_get_type (void); -/** - * GIUnresolvedInfo: - * - * Represents a unresolved type in a typelib. - */ +/* Documented in giunresolvedinfo.c */ typedef struct _GIUnresolvedInfo GIUnresolvedInfo; +GI_AVAILABLE_IN_ALL GType gi_unresolved_info_get_type (void); union _GIArgument { @@ -255,6 +187,10 @@ typedef union _GIArgument GIArgument; * @GI_INFO_TYPE_TYPE: type information, see #GITypeInfo * @GI_INFO_TYPE_UNRESOLVED: unresolved type, a type which is not present in * the typelib, or any of its dependencies. + * @GI_INFO_TYPE_CALLABLE: an abstract type representing any callable (function, + * callback, vfunc) (Since: 2.80) + * @GI_INFO_TYPE_REGISTERED_TYPE: an abstract type representing any registered + * type (enum, interface, object, struct, union) (Since: 2.80) * * The type of a GIBaseInfo struct. */ @@ -279,7 +215,10 @@ typedef enum GI_INFO_TYPE_FIELD, GI_INFO_TYPE_ARG, GI_INFO_TYPE_TYPE, - GI_INFO_TYPE_UNRESOLVED + GI_INFO_TYPE_UNRESOLVED, + GI_INFO_TYPE_CALLABLE, /* 20 */ + GI_INFO_TYPE_REGISTERED_TYPE, + /* keep GI_INFO_TYPE_N_TYPES in sync with this */ } GIInfoType; /** diff --git a/girepository/giunioninfo.c b/girepository/giunioninfo.c index d80f50c0f..d1133554d 100644 --- a/girepository/giunioninfo.c +++ b/girepository/giunioninfo.c @@ -27,6 +27,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "giunioninfo.h" @@ -68,8 +69,8 @@ gi_union_info_get_n_fields (GIUnionInfo *info) * * Obtain the type information for the field with the specified index. * - * Returns: (transfer full): the [alias@GIRepository.FieldInfo], free it with - * gi_base_info_unref() when done. + * Returns: (transfer full): the [type@GIRepository.FieldInfo], free it with + * [method@GIRepository.BaseInfo.unref] when done. * Since: 2.80 */ GIFieldInfo * @@ -109,8 +110,8 @@ gi_union_info_get_n_methods (GIUnionInfo *info) * * Obtain the type information for the method with the specified index. * - * Returns: (transfer full): the [alias@GIRepository.FunctionInfo], free it - * with gi_base_info_unref() when done. + * Returns: (transfer full): the [type@GIRepository.FunctionInfo], free it + * with [method@GIRepository.BaseInfo.unref] when done. * Since: 2.80 */ GIFunctionInfo * @@ -171,8 +172,8 @@ gi_union_info_get_discriminator_offset (GIUnionInfo *info) * * Obtain the type information of the union discriminator. * - * Returns: (transfer full): the [alias@GIRepository.TypeInfo], free it with - * gi_base_info_unref() when done. + * Returns: (transfer full): the [type@GIRepository.TypeInfo], free it with + * [method@GIRepository.BaseInfo.unref] when done. * Since: 2.80 */ GITypeInfo * @@ -194,8 +195,8 @@ gi_union_info_get_discriminator_type (GIUnionInfo *info) * * If the union is not discriminated, `NULL` is returned. * - * Returns: (transfer full) (nullable): the [alias@GIRepository.ConstantInfo], - * free it with gi_base_info_unref() when done. + * Returns: (transfer full) (nullable): the [type@GIRepository.ConstantInfo], + * free it with [method@GIRepository.BaseInfo.unref] when done. * Since: 2.80 */ GIConstantInfo * @@ -229,8 +230,8 @@ gi_union_info_get_discriminator (GIUnionInfo *info, * * Obtain the type information for the method named @name. * - * Returns: (transfer full): the [alias@GIRepository.FunctionInfo], free it - * with gi_base_info_unref() when done. + * Returns: (transfer full): the [type@GIRepository.FunctionInfo], free it + * with [method@GIRepository.BaseInfo.unref] when done. * Since: 2.80 */ GIFunctionInfo * @@ -337,3 +338,12 @@ gi_union_info_get_free_function (GIUnionInfo *info) return NULL; } + +void +gi_union_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_UNION; +} diff --git a/girepository/giunresolvedinfo.c b/girepository/giunresolvedinfo.c new file mode 100644 index 000000000..c1b4584ee --- /dev/null +++ b/girepository/giunresolvedinfo.c @@ -0,0 +1,52 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Callable implementation + * + * Copyright (C) 2005 Matthias Clasen + * Copyright 2023 GNOME Foundation, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include + +#include +#include "gibaseinfo-private.h" +#include "girepository-private.h" +#include "gitypelib-internal.h" +#include "giunresolvedinfo.h" + +/** + * SECTION:giunresolved + * @title: GIUnresolvedInfo + * @short_description: Struct representing an unresolved symbol + * + * GIUnresolvedInfo represents an unresolved symbol. + */ + +void +gi_unresolved_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_UNRESOLVED; +} diff --git a/girepository/giunresolvedinfo.h b/girepository/giunresolvedinfo.h new file mode 100644 index 000000000..b69c85e5b --- /dev/null +++ b/girepository/giunresolvedinfo.h @@ -0,0 +1,43 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * GObject introspection: Callable + * + * Copyright 2023 GNOME Foundation, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#pragma once + +#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +/** + * GI_IS_UNRESOLVED_INFO + * @info: an info structure + * + * Checks if @info is a #GIUnresolvedInfo or derived from it. + */ +#define GI_IS_UNRESOLVED_INFO(info) \ + (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNRESOLVED) + +G_END_DECLS diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c index b979ebb33..45587ab53 100644 --- a/girepository/givfuncinfo.c +++ b/girepository/givfuncinfo.c @@ -29,6 +29,7 @@ #include #include +#include "gibaseinfo-private.h" #include "girepository-private.h" #include "gitypelib-internal.h" #include "givfuncinfo.h" @@ -39,7 +40,7 @@ * `GIVfuncInfo` represents a virtual function. * * A virtual function is a callable object that belongs to either a - * [alias@GIRepository.ObjectInfo] or a [alias@GIRepository.InterfaceInfo]. + * [type@GIRepository.ObjectInfo] or a [type@GIRepository.InterfaceInfo]. * * Since: 2.80 */ @@ -172,7 +173,7 @@ gi_vfunc_info_get_signal (GIVFuncInfo *info) * * Not all virtuals will have invokers. * - * Returns: (transfer full) (nullable): the [alias@GIRepository.FunctionInfo] or + * Returns: (transfer full) (nullable): the [type@GIRepository.FunctionInfo] or * `NULL`. Free it with gi_base_info_unref() when done. * Since: 2.80 */ @@ -369,3 +370,12 @@ gi_vfunc_info_invoke (GIVFuncInfo *info, FALSE, error); } + +void +gi_vfunc_info_class_init (gpointer g_class, + gpointer class_data) +{ + GIBaseInfoClass *info_class = g_class; + + info_class->info_type = GI_INFO_TYPE_VFUNC; +} diff --git a/girepository/meson.build b/girepository/meson.build index f8ab670b3..e24183bd2 100644 --- a/girepository/meson.build +++ b/girepository/meson.build @@ -45,6 +45,7 @@ girepo_headers = files( 'giarginfo.h', 'gibaseinfo.h', 'gicallableinfo.h', + 'gicallbackinfo.h', 'giconstantinfo.h', 'gienuminfo.h', 'gifieldinfo.h', @@ -60,6 +61,7 @@ girepo_headers = files( 'gitypelib.h', 'gitypes.h', 'giunioninfo.h', + 'giunresolvedinfo.h', 'givfuncinfo.h', ) @@ -142,6 +144,7 @@ girepo_sources = files( 'giarginfo.c', 'gibaseinfo.c', 'gicallableinfo.c', + 'gicallbackinfo.c', 'giconstantinfo.c', 'gienuminfo.c', 'gifieldinfo.c', @@ -158,6 +161,7 @@ girepo_sources = files( 'gitypeinfo.c', 'gitypelib.c', 'giunioninfo.c', + 'giunresolvedinfo.c', 'givfuncinfo.c', )