2012-02-03 19:42:56 +01:00
|
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
|
|
|
* GObject introspection: Virtual Function implementation
|
2010-06-07 00:52:12 +02:00
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2005 Matthias Clasen
|
|
|
|
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
|
|
|
|
*
|
2023-10-25 18:10:10 +02:00
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
*
|
2010-06-07 00:52:12 +02:00
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-07-04 12:27:41 +02:00
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2010-06-07 00:52:12 +02:00
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
2023-10-25 18:45:42 +02:00
|
|
|
|
#include <girepository/girepository.h>
|
2010-06-07 00:52:12 +02:00
|
|
|
|
#include "girepository-private.h"
|
|
|
|
|
#include "gitypelib-internal.h"
|
2023-10-25 19:11:38 +02:00
|
|
|
|
#include "givfuncinfo.h"
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
2010-06-11 16:11:01 +02:00
|
|
|
|
/**
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* GIVFuncInfo:
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* `GIVfuncInfo` represents a virtual function.
|
2010-06-12 01:16:00 +02:00
|
|
|
|
*
|
2022-02-13 15:20:51 +01:00
|
|
|
|
* A virtual function is a callable object that belongs to either a
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* [alias@GIRepository.ObjectInfo] or a [alias@GIRepository.InterfaceInfo].
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.80
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*/
|
|
|
|
|
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIVFuncInfo *
|
2023-11-08 16:23:31 +01:00
|
|
|
|
gi_base_info_find_vfunc (GIRealInfo *rinfo,
|
|
|
|
|
guint32 offset,
|
|
|
|
|
gint n_vfuncs,
|
|
|
|
|
const gchar *name)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
/* FIXME hash */
|
|
|
|
|
Header *header = (Header *)rinfo->typelib->data;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_vfuncs; i++)
|
|
|
|
|
{
|
|
|
|
|
VFuncBlob *fblob = (VFuncBlob *)&rinfo->typelib->data[offset];
|
|
|
|
|
const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
|
|
|
|
|
|
|
|
|
|
if (strcmp (name, fname) == 0)
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
|
2010-06-07 00:52:12 +02:00
|
|
|
|
rinfo->typelib, offset);
|
|
|
|
|
|
|
|
|
|
offset += header->vfunc_blob_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 16:11:01 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_vfunc_info_get_flags:
|
2010-06-11 16:11:01 +02:00
|
|
|
|
* @info: a #GIVFuncInfo
|
|
|
|
|
*
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Obtain the flags for this virtual function info.
|
|
|
|
|
*
|
|
|
|
|
* See [flags@GIRepository.VFuncInfoFlags] for more information about possible
|
|
|
|
|
* flag values.
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*
|
|
|
|
|
* Returns: the flags
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Since: 2.80
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIVFuncInfoFlags
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_vfunc_info_get_flags (GIVFuncInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIVFuncInfoFlags flags;
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
2010-06-11 16:11:01 +02:00
|
|
|
|
VFuncBlob *blob;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (info != NULL, 0);
|
|
|
|
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (info), 0);
|
|
|
|
|
|
|
|
|
|
blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
|
|
|
|
|
|
if (blob->must_chain_up)
|
|
|
|
|
flags = flags | GI_VFUNC_MUST_CHAIN_UP;
|
|
|
|
|
|
|
|
|
|
if (blob->must_be_implemented)
|
|
|
|
|
flags = flags | GI_VFUNC_MUST_OVERRIDE;
|
|
|
|
|
|
|
|
|
|
if (blob->must_not_be_implemented)
|
|
|
|
|
flags = flags | GI_VFUNC_MUST_NOT_OVERRIDE;
|
|
|
|
|
|
2012-02-03 19:20:00 +01:00
|
|
|
|
if (blob->throws)
|
|
|
|
|
flags = flags | GI_VFUNC_THROWS;
|
|
|
|
|
|
2010-06-07 00:52:12 +02:00
|
|
|
|
return flags;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 16:11:01 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_vfunc_info_get_offset:
|
2010-06-11 16:11:01 +02:00
|
|
|
|
* @info: a #GIVFuncInfo
|
|
|
|
|
*
|
|
|
|
|
* Obtain the offset of the function pointer in the class struct. The value
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* `0xFFFF` indicates that the struct offset is unknown.
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Returns: the struct offset or `0xFFFF` if it’s unknown
|
|
|
|
|
* Since: 2.80
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
gint
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_vfunc_info_get_offset (GIVFuncInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
2010-06-11 16:11:01 +02:00
|
|
|
|
VFuncBlob *blob;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (info != NULL, 0);
|
|
|
|
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (info), 0);
|
|
|
|
|
|
|
|
|
|
blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
|
|
|
|
return blob->struct_offset;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 16:11:01 +02:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_vfunc_info_get_signal:
|
2010-06-11 16:11:01 +02:00
|
|
|
|
* @info: a #GIVFuncInfo
|
|
|
|
|
*
|
|
|
|
|
* Obtain the signal for the virtual function if one is set.
|
2023-11-09 00:36:19 +01:00
|
|
|
|
*
|
2010-06-11 16:11:01 +02:00
|
|
|
|
* The signal comes from the object or interface to which
|
|
|
|
|
* this virtual function belongs.
|
|
|
|
|
*
|
2023-11-09 00:42:11 +01:00
|
|
|
|
* Returns: (transfer full) (nullable): the signal or `NULL` if none set
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Since: 2.80
|
2010-06-11 16:11:01 +02:00
|
|
|
|
*/
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GISignalInfo *
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_vfunc_info_get_signal (GIVFuncInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
2010-06-11 16:11:01 +02:00
|
|
|
|
VFuncBlob *blob;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (info != NULL, 0);
|
|
|
|
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (info), 0);
|
|
|
|
|
|
|
|
|
|
blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
|
|
|
|
if (blob->class_closure)
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return gi_interface_info_get_signal ((GIInterfaceInfo *)rinfo->container, blob->signal);
|
2010-06-07 00:52:12 +02:00
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_vfunc_info_get_invoker:
|
2010-06-07 00:52:12 +02:00
|
|
|
|
* @info: a #GIVFuncInfo
|
|
|
|
|
*
|
|
|
|
|
* If this virtual function has an associated invoker method, this
|
|
|
|
|
* method will return it. An invoker method is a C entry point.
|
|
|
|
|
*
|
|
|
|
|
* Not all virtuals will have invokers.
|
|
|
|
|
*
|
2023-11-09 00:42:11 +01:00
|
|
|
|
* Returns: (transfer full) (nullable): the [alias@GIRepository.FunctionInfo] or
|
|
|
|
|
* `NULL`. Free it with gi_base_info_unref() when done.
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Since: 2.80
|
2010-06-07 00:52:12 +02:00
|
|
|
|
*/
|
|
|
|
|
GIFunctionInfo *
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_vfunc_info_get_invoker (GIVFuncInfo *info)
|
2010-06-07 00:52:12 +02:00
|
|
|
|
{
|
|
|
|
|
GIRealInfo *rinfo = (GIRealInfo *)info;
|
2010-06-11 16:11:01 +02:00
|
|
|
|
VFuncBlob *blob;
|
|
|
|
|
GIBaseInfo *container;
|
2010-06-07 00:52:12 +02:00
|
|
|
|
GIInfoType parent_type;
|
|
|
|
|
|
2010-06-11 16:11:01 +02:00
|
|
|
|
g_return_val_if_fail (info != NULL, 0);
|
|
|
|
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (info), 0);
|
|
|
|
|
|
|
|
|
|
blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
|
|
|
|
|
|
2010-06-07 00:52:12 +02:00
|
|
|
|
/* 1023 = 0x3ff is the maximum of the 10 bits for invoker index */
|
|
|
|
|
if (blob->invoker == 1023)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2010-06-11 16:11:01 +02:00
|
|
|
|
container = rinfo->container;
|
2023-11-08 15:17:52 +01:00
|
|
|
|
parent_type = gi_base_info_get_type (container);
|
2010-06-07 00:52:12 +02:00
|
|
|
|
if (parent_type == GI_INFO_TYPE_OBJECT)
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return gi_object_info_get_method ((GIObjectInfo*)container, blob->invoker);
|
2010-06-07 00:52:12 +02:00
|
|
|
|
else if (parent_type == GI_INFO_TYPE_INTERFACE)
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return gi_interface_info_get_method ((GIInterfaceInfo*)container, blob->invoker);
|
2010-06-07 00:52:12 +02:00
|
|
|
|
else
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 13:53:55 +01:00
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_vfunc_info_get_address:
|
2010-12-13 13:53:55 +01:00
|
|
|
|
* @info: a #GIVFuncInfo
|
|
|
|
|
* @implementor_gtype: #GType implementing this virtual function
|
|
|
|
|
* @error: return location for a #GError
|
|
|
|
|
*
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Looks up where inside the type struct of @implementor_gtype is the
|
|
|
|
|
* implementation for @info.
|
2010-12-13 13:53:55 +01:00
|
|
|
|
*
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Returns: address to a function or `NULL` if an error happened
|
|
|
|
|
* Since: 2.80
|
2010-12-13 13:53:55 +01:00
|
|
|
|
*/
|
|
|
|
|
gpointer
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
|
|
|
|
|
GType implementor_gtype,
|
|
|
|
|
GError **error)
|
2010-12-13 13:53:55 +01:00
|
|
|
|
{
|
2013-10-13 02:02:22 +02:00
|
|
|
|
GIBaseInfo *container_info;
|
|
|
|
|
GIInterfaceInfo *interface_info;
|
2010-12-13 13:53:55 +01:00
|
|
|
|
GIObjectInfo *object_info;
|
|
|
|
|
GIStructInfo *struct_info;
|
|
|
|
|
GIFieldInfo *field_info = NULL;
|
|
|
|
|
int length, i, offset;
|
2013-10-13 02:02:22 +02:00
|
|
|
|
gpointer implementor_class, implementor_vtable;
|
2012-08-25 09:05:17 +02:00
|
|
|
|
gpointer func = NULL;
|
2010-12-13 13:53:55 +01:00
|
|
|
|
|
2023-11-09 00:45:46 +01:00
|
|
|
|
g_return_val_if_fail (vfunc_info != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (vfunc_info), NULL);
|
|
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
|
|
|
|
|
2023-11-28 18:14:30 +01:00
|
|
|
|
container_info = gi_base_info_get_container ((GIBaseInfo *) vfunc_info);
|
2023-11-08 15:17:52 +01:00
|
|
|
|
if (gi_base_info_get_type (container_info) == GI_INFO_TYPE_OBJECT)
|
2013-10-13 02:02:22 +02:00
|
|
|
|
{
|
|
|
|
|
object_info = (GIObjectInfo*) container_info;
|
|
|
|
|
interface_info = NULL;
|
2023-11-08 15:17:52 +01:00
|
|
|
|
struct_info = gi_object_info_get_class_struct (object_info);
|
2013-10-13 02:02:22 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
interface_info = (GIInterfaceInfo*) container_info;
|
|
|
|
|
object_info = NULL;
|
2023-11-08 15:17:52 +01:00
|
|
|
|
struct_info = gi_interface_info_get_iface_struct (interface_info);
|
2013-10-13 02:02:22 +02:00
|
|
|
|
}
|
2010-12-13 13:53:55 +01:00
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
length = gi_struct_info_get_n_fields (struct_info);
|
2010-12-13 13:53:55 +01:00
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
|
{
|
2023-11-08 15:17:52 +01:00
|
|
|
|
field_info = gi_struct_info_get_field (struct_info, i);
|
2010-12-13 13:53:55 +01:00
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
if (strcmp (gi_base_info_get_name ( (GIBaseInfo*) field_info),
|
|
|
|
|
gi_base_info_get_name ( (GIBaseInfo*) vfunc_info)) != 0) {
|
2023-11-28 18:14:30 +01:00
|
|
|
|
gi_base_info_unref ((GIBaseInfo *) field_info);
|
2010-12-13 13:53:55 +01:00
|
|
|
|
field_info = NULL;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (field_info == NULL)
|
|
|
|
|
{
|
|
|
|
|
g_set_error (error,
|
2023-11-08 15:17:52 +01:00
|
|
|
|
GI_INVOKE_ERROR,
|
|
|
|
|
GI_INVOKE_ERROR_SYMBOL_NOT_FOUND,
|
2010-12-13 13:53:55 +01:00
|
|
|
|
"Couldn't find struct field for this vfunc");
|
2012-08-25 09:05:17 +02:00
|
|
|
|
goto out;
|
2010-12-13 13:53:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-13 02:02:22 +02:00
|
|
|
|
implementor_class = g_type_class_ref (implementor_gtype);
|
|
|
|
|
|
|
|
|
|
if (object_info)
|
|
|
|
|
{
|
|
|
|
|
implementor_vtable = implementor_class;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GType interface_type;
|
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
interface_type = gi_registered_type_info_get_g_type ((GIRegisteredTypeInfo*) interface_info);
|
2013-10-13 02:02:22 +02:00
|
|
|
|
implementor_vtable = g_type_interface_peek (implementor_class, interface_type);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
offset = gi_field_info_get_offset (field_info);
|
2010-12-13 13:53:55 +01:00
|
|
|
|
func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset);
|
2013-10-13 02:02:22 +02:00
|
|
|
|
g_type_class_unref (implementor_class);
|
2023-11-28 18:14:30 +01:00
|
|
|
|
gi_base_info_unref ((GIBaseInfo *) field_info);
|
2010-12-13 13:53:55 +01:00
|
|
|
|
|
|
|
|
|
if (func == NULL)
|
|
|
|
|
{
|
|
|
|
|
g_set_error (error,
|
2023-11-08 15:17:52 +01:00
|
|
|
|
GI_INVOKE_ERROR,
|
|
|
|
|
GI_INVOKE_ERROR_SYMBOL_NOT_FOUND,
|
2010-12-13 13:53:55 +01:00
|
|
|
|
"Class %s doesn't implement %s",
|
|
|
|
|
g_type_name (implementor_gtype),
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_base_info_get_name ( (GIBaseInfo*) vfunc_info));
|
2012-08-25 09:05:17 +02:00
|
|
|
|
goto out;
|
2010-12-13 13:53:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-25 09:05:17 +02:00
|
|
|
|
out:
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_base_info_unref ((GIBaseInfo*) struct_info);
|
2012-08-25 09:05:17 +02:00
|
|
|
|
|
2010-12-13 13:53:55 +01:00
|
|
|
|
return func;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-11-08 15:17:52 +01:00
|
|
|
|
* gi_vfunc_info_invoke: (skip)
|
2010-12-13 13:53:55 +01:00
|
|
|
|
* @info: a #GIVFuncInfo describing the virtual function to invoke
|
|
|
|
|
* @implementor: #GType of the type that implements this virtual function
|
2023-11-09 00:42:11 +01:00
|
|
|
|
* @in_args: (array length=n_in_args) (nullable): an array of
|
|
|
|
|
* [struct@GIRepository.Argument]s, one for each in parameter of @info. If
|
|
|
|
|
* there are no in parameter, @in_args can be `NULL`
|
2010-12-13 13:53:55 +01:00
|
|
|
|
* @n_in_args: the length of the @in_args array
|
2023-11-09 00:42:11 +01:00
|
|
|
|
* @out_args: (array length=n_out_args) (nullable): an array of
|
|
|
|
|
* [struct@GIRepository.Argument]s, one for each out parameter of @info. If
|
|
|
|
|
* there are no out parameters, @out_args may be `NULL`
|
2010-12-13 13:53:55 +01:00
|
|
|
|
* @n_out_args: the length of the @out_args array
|
2023-11-09 00:42:11 +01:00
|
|
|
|
* @return_value: (nullable): return location for the return value of the
|
2010-12-13 13:53:55 +01:00
|
|
|
|
* function. If the function returns void, @return_value may be
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* `NULL`
|
|
|
|
|
* @error: return location for detailed error information, or `NULL`
|
2010-12-13 13:53:55 +01:00
|
|
|
|
*
|
|
|
|
|
* Invokes the function described in @info with the given
|
|
|
|
|
* arguments. Note that inout parameters must appear in both
|
|
|
|
|
* argument lists.
|
|
|
|
|
*
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Returns: true if the function has been invoked, false if an
|
2010-12-13 13:53:55 +01:00
|
|
|
|
* error occurred.
|
2023-11-09 00:36:19 +01:00
|
|
|
|
* Since: 2.80
|
2010-12-13 13:53:55 +01:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2023-11-08 15:17:52 +01:00
|
|
|
|
gi_vfunc_info_invoke (GIVFuncInfo *info,
|
|
|
|
|
GType implementor,
|
|
|
|
|
const GIArgument *in_args,
|
|
|
|
|
int n_in_args,
|
|
|
|
|
const GIArgument *out_args,
|
|
|
|
|
int n_out_args,
|
|
|
|
|
GIArgument *return_value,
|
|
|
|
|
GError **error)
|
2010-12-13 13:53:55 +01:00
|
|
|
|
{
|
|
|
|
|
gpointer func;
|
2023-11-09 00:42:44 +01:00
|
|
|
|
GError *local_error = NULL;
|
2010-12-13 13:53:55 +01:00
|
|
|
|
|
2023-11-09 00:45:46 +01:00
|
|
|
|
g_return_val_if_fail (info != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (GI_IS_VFUNC_INFO (info), FALSE);
|
|
|
|
|
g_return_val_if_fail (in_args != NULL || n_in_args == 0, FALSE);
|
|
|
|
|
g_return_val_if_fail (out_args != NULL || n_out_args == 0, FALSE);
|
|
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
|
|
|
|
|
2023-11-09 00:42:44 +01:00
|
|
|
|
func = gi_vfunc_info_get_address (info, implementor, &local_error);
|
|
|
|
|
if (local_error != NULL)
|
|
|
|
|
{
|
|
|
|
|
g_propagate_error (error, g_steal_pointer (&local_error));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2010-12-13 13:53:55 +01:00
|
|
|
|
|
2023-11-08 15:17:52 +01:00
|
|
|
|
return gi_callable_info_invoke ((GICallableInfo*) info,
|
|
|
|
|
func,
|
|
|
|
|
in_args,
|
|
|
|
|
n_in_args,
|
|
|
|
|
out_args,
|
|
|
|
|
n_out_args,
|
|
|
|
|
return_value,
|
|
|
|
|
TRUE,
|
|
|
|
|
FALSE,
|
|
|
|
|
error);
|
2010-12-13 13:53:55 +01:00
|
|
|
|
}
|