summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--girepository/Makefile.am20
-rw-r--r--girepository/gibaseinfo.c1
-rw-r--r--girepository/giconstantinfo.c113
-rw-r--r--girepository/giconstantinfo.h43
-rw-r--r--girepository/gifunctioninfo.c28
-rw-r--r--girepository/giinterfaceinfo.c256
-rw-r--r--girepository/giinterfaceinfo.h65
-rw-r--r--girepository/ginfo.c1122
-rw-r--r--girepository/giobjectinfo.c333
-rw-r--r--girepository/giobjectinfo.h74
-rw-r--r--girepository/gipropertyinfo.c60
-rw-r--r--girepository/gipropertyinfo.h42
-rw-r--r--girepository/giregisteredtypeinfo.c2
-rw-r--r--girepository/girepository-private.h10
-rw-r--r--girepository/girepository.h156
-rw-r--r--girepository/gisignalinfo.c83
-rw-r--r--girepository/gisignalinfo.h44
-rw-r--r--girepository/gistructinfo.c151
-rw-r--r--girepository/gistructinfo.h52
-rw-r--r--girepository/giunioninfo.c156
-rw-r--r--girepository/giunioninfo.h56
-rw-r--r--girepository/givfuncinfo.c131
-rw-r--r--girepository/givfuncinfo.h44
23 files changed, 1767 insertions, 1275 deletions
diff --git a/girepository/Makefile.am b/girepository/Makefile.am
index 34cdfabf..bec0cfce 100644
--- a/girepository/Makefile.am
+++ b/girepository/Makefile.am
@@ -3,16 +3,23 @@ girepo_HEADERS = \
giarginfo.h \
gibaseinfo.h \
gicallableinfo.h \
+ giconstantinfo.h \
gienuminfo.h \
gierrordomaininfo.h \
gifieldinfo.h \
gifunctioninfo.h \
+ giinterfaceinfo.h \
+ giobjectinfo.h \
+ gipropertyinfo.h \
giregisteredtypeinfo.h \
girepository.h \
girffi.h \
+ gisignalinfo.h \
gitypeinfo.h \
gitypelib.h \
- gitypes.h
+ gitypes.h \
+ giunioninfo.h \
+ givfuncinfo.h
lib_LTLIBRARIES = libgirepository-1.0.la
noinst_LTLIBRARIES = libgirepository-parser.la
@@ -22,22 +29,29 @@ libgirepository_1_0_la_SOURCES = \
giarginfo.c \
gibaseinfo.c \
gicallableinfo.c \
+ giconstantinfo.c \
gienuminfo.c \
gierrordomaininfo.c \
gifieldinfo.c \
gifunctioninfo.c \
- ginfo.c \
ginvoke.c \
+ giinterfaceinfo.c \
+ giobjectinfo.c \
+ gipropertyinfo.c \
giregisteredtypeinfo.c \
girepository.c \
girepository-private.h \
girffi.c \
girffi.h \
girffi-private.h \
+ gisignalinfo.c \
+ gistructinfo.c \
gitypeinfo.c \
gitypelib.c \
gitypelib-internal.h \
- glib-compat.h
+ glib-compat.h \
+ giunioninfo.c \
+ givfuncinfo.c
libgirepository_1_0_la_CPPFLAGS = $(GIREPO_CFLAGS)
libgirepository_1_0_la_LIBADD = $(GIREPO_LIBS)
diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c
index 10e5d7c3..5cb15323 100644
--- a/girepository/gibaseinfo.c
+++ b/girepository/gibaseinfo.c
@@ -149,7 +149,6 @@ _g_type_info_init (GIBaseInfo *info,
(type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
}
-
/* GIBaseInfo functions */
/**
diff --git a/girepository/giconstantinfo.c b/girepository/giconstantinfo.c
new file mode 100644
index 00000000..72cc0436
--- /dev/null
+++ b/girepository/giconstantinfo.c
@@ -0,0 +1,113 @@
+/* GObject introspection: Constant implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+GITypeInfo *
+g_constant_info_get_type (GIConstantInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
+}
+
+gint
+g_constant_info_get_value (GIConstantInfo *info,
+ GArgument *value)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ConstantBlob *blob = (ConstantBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ /* FIXME non-basic types ? */
+ if (blob->type.flags.reserved == 0 && blob->type.flags.reserved2 == 0)
+ {
+ if (blob->type.flags.pointer)
+ value->v_pointer = g_memdup (&rinfo->typelib->data[blob->offset], blob->size);
+ else
+ {
+ switch (blob->type.flags.tag)
+ {
+ case GI_TYPE_TAG_BOOLEAN:
+ value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT8:
+ value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT8:
+ value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT16:
+ value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT16:
+ value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT32:
+ value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT32:
+ value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT64:
+ value->v_int64 = *(gint64*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT64:
+ value->v_uint64 = *(guint64*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ value->v_float = *(gfloat*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ value->v_double = *(gdouble*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_TIME_T:
+ value->v_long = *(long*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_SHORT:
+ value->v_short = *(gshort*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_USHORT:
+ value->v_ushort = *(gushort*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT:
+ value->v_int = *(gint*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT:
+ value->v_uint = *(guint*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_LONG:
+ value->v_long = *(glong*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_ULONG:
+ value->v_ulong = *(gulong*)&rinfo->typelib->data[blob->offset];
+ break;
+ }
+ }
+ }
+
+ return blob->size;
+}
+
diff --git a/girepository/giconstantinfo.h b/girepository/giconstantinfo.h
new file mode 100644
index 00000000..eea0f66d
--- /dev/null
+++ b/girepository/giconstantinfo.h
@@ -0,0 +1,43 @@
+/* GObject introspection: Constant
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GICONSTANTINFO_H__
+#define __GICONSTANTINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_CONSTANT_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CONSTANT)
+
+GITypeInfo * g_constant_info_get_type (GIConstantInfo *info);
+gint g_constant_info_get_value(GIConstantInfo *info,
+ GArgument *value);
+G_END_DECLS
+
+
+#endif /* __GICONSTANTINFO_H__ */
+
diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c
index 1bda54df..33852801 100644
--- a/girepository/gifunctioninfo.c
+++ b/girepository/gifunctioninfo.c
@@ -19,6 +19,8 @@
* Boston, MA 02111-1307, USA.
*/
+#include <string.h>
+
#include <glib.h>
#include <girepository.h>
@@ -39,6 +41,32 @@
* other metadata.
*/
+GIFunctionInfo *
+_g_base_info_find_method (GIBaseInfo *base,
+ guint32 offset,
+ gint n_methods,
+ const gchar *name)
+{
+ /* FIXME hash */
+ GIRealInfo *rinfo = (GIRealInfo*)base;
+ Header *header = (Header *)rinfo->typelib->data;
+ gint i;
+
+ for (i = 0; i < n_methods; i++)
+ {
+ FunctionBlob *fblob = (FunctionBlob *)&rinfo->typelib->data[offset];
+ const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
+
+ if (strcmp (name, fname) == 0)
+ return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, base,
+ rinfo->typelib, offset);
+
+ offset += header->function_blob_size;
+ }
+
+ return NULL;
+}
+
/**
* g_function_info_get_symbol:
* @info: a #GIFunctionInfo
diff --git a/girepository/giinterfaceinfo.c b/girepository/giinterfaceinfo.c
new file mode 100644
index 00000000..070343dd
--- /dev/null
+++ b/girepository/giinterfaceinfo.c
@@ -0,0 +1,256 @@
+/* GObject introspection: Interface implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+gint
+g_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_prerequisites;
+}
+
+GIBaseInfo *
+g_interface_info_get_prerequisite (GIInterfaceInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return _g_info_from_entry (rinfo->repository,
+ rinfo->typelib, blob->prerequisites[n]);
+}
+
+
+gint
+g_interface_info_get_n_properties (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_properties;
+}
+
+GIPropertyInfo *
+g_interface_info_get_property (GIInterfaceInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ + n * header->property_blob_size;
+
+ return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+gint
+g_interface_info_get_n_methods (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_methods;
+}
+
+GIFunctionInfo *
+g_interface_info_get_method (GIInterfaceInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ + blob->n_properties * header->property_blob_size
+ + n * header->function_blob_size;
+
+ return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+GIFunctionInfo *
+g_interface_info_find_method (GIInterfaceInfo *info,
+ const gchar *name)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ + blob->n_properties * header->property_blob_size;
+
+ return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
+}
+
+gint
+g_interface_info_get_n_signals (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_signals;
+}
+
+GISignalInfo *
+g_interface_info_get_signal (GIInterfaceInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + n * header->signal_blob_size;
+
+ return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+gint
+g_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_vfuncs;
+}
+
+GIVFuncInfo *
+g_interface_info_get_vfunc (GIInterfaceInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + blob->n_signals * header->signal_blob_size
+ + n * header->vfunc_blob_size;
+
+ return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+/**
+ * g_interface_info_find_vfunc:
+ * @info: a #GIObjectInfo
+ * @name: The name of a virtual function to find.
+ *
+ * Locate a virtual function slot with name @name. See the documentation
+ * for g_object_info_find_vfunc() for more information on virtuals.
+ *
+ * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
+ * g_base_info_unref() when done.
+ */
+GIVFuncInfo *
+g_interface_info_find_vfunc (GIInterfaceInfo *info,
+ const gchar *name)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + blob->n_prerequisites % 2) * 2
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + blob->n_signals * header->signal_blob_size;
+
+ return _g_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
+}
+
+gint
+g_interface_info_get_n_constants (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_constants;
+}
+
+GIConstantInfo *
+g_interface_info_get_constant (GIInterfaceInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->interface_blob_size
+ + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + blob->n_signals * header->signal_blob_size
+ + blob->n_vfuncs * header->vfunc_blob_size
+ + n * header->constant_blob_size;
+
+ return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+/**
+ * g_interface_info_get_iface_struct:
+ * @info: a #GIInterfaceInfo
+ *
+ * Returns the layout C structure associated with this #GInterface.
+ *
+ * Returns: (transfer full): the #GIStructInfo or %NULL. Free it with
+ * g_base_info_unref() when done.
+ */
+GIStructInfo *
+g_interface_info_get_iface_struct (GIInterfaceInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->gtype_struct)
+ return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
+ rinfo->typelib, blob->gtype_struct);
+ else
+ return NULL;
+}
+
diff --git a/girepository/giinterfaceinfo.h b/girepository/giinterfaceinfo.h
new file mode 100644
index 00000000..4f4c05c9
--- /dev/null
+++ b/girepository/giinterfaceinfo.h
@@ -0,0 +1,65 @@
+/* GObject introspection: Interface
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GIINTERFACEINFO_H__
+#define __GIINTERFACEINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_INTERFACE_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_INTERFACE)
+
+gint g_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
+GIBaseInfo * g_interface_info_get_prerequisite (GIInterfaceInfo *info,
+ gint n);
+gint g_interface_info_get_n_properties (GIInterfaceInfo *info);
+GIPropertyInfo * g_interface_info_get_property (GIInterfaceInfo *info,
+ gint n);
+gint g_interface_info_get_n_methods (GIInterfaceInfo *info);
+GIFunctionInfo * g_interface_info_get_method (GIInterfaceInfo *info,
+ gint n);
+GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
+ const gchar *name);
+gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
+GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
+ gint n);
+gint g_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
+GIVFuncInfo * g_interface_info_get_vfunc (GIInterfaceInfo *info,
+ gint n);
+GIVFuncInfo * g_interface_info_find_vfunc (GIInterfaceInfo *info,
+ const gchar *name);
+gint g_interface_info_get_n_constants (GIInterfaceInfo *info);
+GIConstantInfo * g_interface_info_get_constant (GIInterfaceInfo *info,
+ gint n);
+
+GIStructInfo * g_interface_info_get_iface_struct (GIInterfaceInfo *info);
+
+G_END_DECLS
+
+
+#endif /* __GIINTERFACEINFO_H__ */
+
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
deleted file mode 100644
index 5048431a..00000000
--- a/girepository/ginfo.c
+++ /dev/null
@@ -1,1122 +0,0 @@
-/* GObject introspection: Repository implementation
- *
- * Copyright (C) 2005 Matthias Clasen
- * Copyright (C) 2008,2009 Red Hat, Inc.
- *
- * 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 <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include "gitypelib-internal.h"
-#include "girepository-private.h"
-
-/* GIStructInfo functions */
-gint
-g_struct_info_get_n_fields (GIStructInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_fields;
-}
-
-static gint32
-g_struct_get_field_offset (GIStructInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- guint32 offset = rinfo->offset + header->struct_blob_size;
- gint i;
- FieldBlob *field_blob;
-
- for (i = 0; i < n; i++)
- {
- field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
- offset += header->field_blob_size;
- if (field_blob->has_embedded_type)
- offset += header->callback_blob_size;
- }
-
- return offset;
-}
-
-GIFieldInfo *
-g_struct_info_get_field (GIStructInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
-
- return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
- g_struct_get_field_offset (info, n));
-}
-
-gint
-g_struct_info_get_n_methods (GIStructInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_methods;
-}
-
-GIFunctionInfo *
-g_struct_info_get_method (GIStructInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
- Header *header = (Header *)rinfo->typelib->data;
- gint offset;
-
- offset = g_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
- return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-static GIFunctionInfo *
-find_method (GIBaseInfo *base,
- guint32 offset,
- gint n_methods,
- const gchar *name)
-{
- /* FIXME hash */
- GIRealInfo *rinfo = (GIRealInfo*)base;
- Header *header = (Header *)rinfo->typelib->data;
- gint i;
-
- for (i = 0; i < n_methods; i++)
- {
- FunctionBlob *fblob = (FunctionBlob *)&rinfo->typelib->data[offset];
- const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
-
- if (strcmp (name, fname) == 0)
- return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, base,
- rinfo->typelib, offset);
-
- offset += header->function_blob_size;
- }
-
- return NULL;
-}
-
-GIFunctionInfo *
-g_struct_info_find_method (GIStructInfo *info,
- const gchar *name)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->struct_blob_size
- + blob->n_fields * header->field_blob_size;
-
- return find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
-}
-
-gsize
-g_struct_info_get_size (GIStructInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->size;
-}
-
-gsize
-g_struct_info_get_alignment (GIStructInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->alignment;
-}
-
-gboolean
-g_struct_info_is_foreign (GIStructInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->foreign;
-}
-
-/**
- * g_struct_info_is_gtype_struct:
- * @info: a #GIStructInfo
- *
- * Return true if this structure represents the "class structure" for some
- * #GObject or #GInterface. This function is mainly useful to hide this kind of structure
- * from generated public APIs.
- *
- * Returns: %TRUE if this is a class struct, %FALSE otherwise
- */
-gboolean
-g_struct_info_is_gtype_struct (GIStructInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->is_gtype_struct;
-}
-
-/* GIObjectInfo functions */
-GIObjectInfo *
-g_object_info_get_parent (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->parent)
- return (GIObjectInfo *) _g_info_from_entry (rinfo->repository,
- rinfo->typelib, blob->parent);
- else
- return NULL;
-}
-
-gboolean
-g_object_info_get_abstract (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
- return blob->abstract != 0;
-}
-
-const gchar *
-g_object_info_get_type_name (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return g_typelib_get_string (rinfo->typelib, blob->gtype_name);
-}
-
-const gchar *
-g_object_info_get_type_init (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return g_typelib_get_string (rinfo->typelib, blob->gtype_init);
-}
-
-gint
-g_object_info_get_n_interfaces (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_interfaces;
-}
-
-GIInterfaceInfo *
-g_object_info_get_interface (GIObjectInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
- rinfo->typelib, blob->interfaces[n]);
-}
-
-gint
-g_object_info_get_n_fields (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_fields;
-}
-
-GIFieldInfo *
-g_object_info_get_field (GIObjectInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + n * header->field_blob_size;
-
- return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
-}
-
-gint
-g_object_info_get_n_properties (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_properties;
-}
-
-GIPropertyInfo *
-g_object_info_get_property (GIObjectInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size
- + n * header->property_blob_size;
-
- return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-gint
-g_object_info_get_n_methods (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_methods;
-}
-
-GIFunctionInfo *
-g_object_info_get_method (GIObjectInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size
- + blob->n_properties * header->property_blob_size
- + n * header->function_blob_size;
-
- return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-GIFunctionInfo *
-g_object_info_find_method (GIObjectInfo *info,
- const gchar *name)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size +
- + blob->n_properties * header->property_blob_size;
-
- return find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
-}
-
-gint
-g_object_info_get_n_signals (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_signals;
-}
-
-GISignalInfo *
-g_object_info_get_signal (GIObjectInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + n * header->signal_blob_size;
-
- return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-gint
-g_object_info_get_n_vfuncs (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_vfuncs;
-}
-
-GIVFuncInfo *
-g_object_info_get_vfunc (GIObjectInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + blob->n_signals * header->signal_blob_size
- + n * header->vfunc_blob_size;
-
- return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-static GIVFuncInfo *
-find_vfunc (GIRealInfo *rinfo,
- guint32 offset,
- gint n_vfuncs,
- const gchar *name)
-{
- /* 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)
- return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
- rinfo->typelib, offset);
-
- offset += header->vfunc_blob_size;
- }
-
- return NULL;
-}
-
-/**
- * g_object_info_find_vfunc:
- * @info: a #GIObjectInfo
- * @name: The name of a virtual function to find.
- *
- * Locate a virtual function slot with name @name. Note that the namespace
- * for virtuals is distinct from that of methods; there may or may not be
- * a concrete method associated for a virtual. If there is one, it may
- * be retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
- * returned.
- * See the documentation for g_vfunc_info_get_invoker() for more
- * information on invoking virtuals.
- *
- * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
- * g_base_info_unref() when done.
- */
-GIVFuncInfo *
-g_object_info_find_vfunc (GIObjectInfo *info,
- const gchar *name)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + blob->n_signals * header->signal_blob_size;
-
- return find_vfunc (rinfo, offset, blob->n_vfuncs, name);
-}
-
-gint
-g_object_info_get_n_constants (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_constants;
-}
-
-GIConstantInfo *
-g_object_info_get_constant (GIObjectInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->object_blob_size
- + (blob->n_interfaces + blob->n_interfaces % 2) * 2
- + blob->n_fields * header->field_blob_size
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + blob->n_signals * header->signal_blob_size
- + blob->n_vfuncs * header->vfunc_blob_size
- + n * header->constant_blob_size;
-
- return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-/**
- * g_object_info_get_class_struct:
- * @info: a #GIObjectInfo
- *
- * Every #GObject has two structures; an instance structure and a class
- * structure. This function returns the metadata for the class structure.
- *
- * Returns: (transfer full): the #GIStructInfo or %NULL. Free with
- * g_base_info_unref() when done.
- */
-GIStructInfo *
-g_object_info_get_class_struct (GIObjectInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->gtype_struct)
- return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
- rinfo->typelib, blob->gtype_struct);
- else
- return NULL;
-}
-
-/* GIInterfaceInfo functions */
-gint
-g_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_prerequisites;
-}
-
-GIBaseInfo *
-g_interface_info_get_prerequisite (GIInterfaceInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return _g_info_from_entry (rinfo->repository,
- rinfo->typelib, blob->prerequisites[n]);
-}
-
-
-gint
-g_interface_info_get_n_properties (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_properties;
-}
-
-GIPropertyInfo *
-g_interface_info_get_property (GIInterfaceInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
- + n * header->property_blob_size;
-
- return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-gint
-g_interface_info_get_n_methods (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_methods;
-}
-
-GIFunctionInfo *
-g_interface_info_get_method (GIInterfaceInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
- + blob->n_properties * header->property_blob_size
- + n * header->function_blob_size;
-
- return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-GIFunctionInfo *
-g_interface_info_find_method (GIInterfaceInfo *info,
- const gchar *name)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
- + blob->n_properties * header->property_blob_size;
-
- return find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
-}
-
-gint
-g_interface_info_get_n_signals (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_signals;
-}
-
-GISignalInfo *
-g_interface_info_get_signal (GIInterfaceInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + n * header->signal_blob_size;
-
- return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-gint
-g_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_vfuncs;
-}
-
-GIVFuncInfo *
-g_interface_info_get_vfunc (GIInterfaceInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + blob->n_signals * header->signal_blob_size
- + n * header->vfunc_blob_size;
-
- return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-/**
- * g_interface_info_find_vfunc:
- * @info: a #GIObjectInfo
- * @name: The name of a virtual function to find.
- *
- * Locate a virtual function slot with name @name. See the documentation
- * for g_object_info_find_vfunc() for more information on virtuals.
- *
- * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
- * g_base_info_unref() when done.
- */
-GIVFuncInfo *
-g_interface_info_find_vfunc (GIInterfaceInfo *info,
- const gchar *name)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + blob->n_prerequisites % 2) * 2
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + blob->n_signals * header->signal_blob_size;
-
- return find_vfunc (rinfo, offset, blob->n_vfuncs, name);
-}
-
-gint
-g_interface_info_get_n_constants (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_constants;
-}
-
-GIConstantInfo *
-g_interface_info_get_constant (GIInterfaceInfo *info,
- gint n)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->interface_blob_size
- + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
- + blob->n_properties * header->property_blob_size
- + blob->n_methods * header->function_blob_size
- + blob->n_signals * header->signal_blob_size
- + blob->n_vfuncs * header->vfunc_blob_size
- + n * header->constant_blob_size;
-
- return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-/**
- * g_interface_info_get_iface_struct:
- * @info: a #GIInterfaceInfo
- *
- * Returns the layout C structure associated with this #GInterface.
- *
- * Returns: (transfer full): the #GIStructInfo or %NULL. Free it with
- * g_base_info_unref() when done.
- */
-GIStructInfo *
-g_interface_info_get_iface_struct (GIInterfaceInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->gtype_struct)
- return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
- rinfo->typelib, blob->gtype_struct);
- else
- return NULL;
-}
-
-/* GIPropertyInfo functions */
-GParamFlags
-g_property_info_get_flags (GIPropertyInfo *info)
-{
- GParamFlags flags;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
-
- flags = 0;
-
- if (blob->readable)
- flags = flags | G_PARAM_READABLE;
-
- if (blob->writable)
- flags = flags | G_PARAM_WRITABLE;
-
- if (blob->construct)
- flags = flags | G_PARAM_CONSTRUCT;
-
- if (blob->construct_only)
- flags = flags | G_PARAM_CONSTRUCT_ONLY;
-
- return flags;
-}
-
-GITypeInfo *
-g_property_info_get_type (GIPropertyInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
-
- return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (PropertyBlob, type));
-}
-
-
-/* GISignalInfo functions */
-GSignalFlags
-g_signal_info_get_flags (GISignalInfo *info)
-{
- GSignalFlags flags;
-
- GIRealInfo *rinfo = (GIRealInfo *)info;
- SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
-
- flags = 0;
-
- if (blob->run_first)
- flags = flags | G_SIGNAL_RUN_FIRST;
-
- if (blob->run_last)
- flags = flags | G_SIGNAL_RUN_LAST;
-
- if (blob->run_cleanup)
- flags = flags | G_SIGNAL_RUN_CLEANUP;
-
- if (blob->no_recurse)
- flags = flags | G_SIGNAL_NO_RECURSE;
-
- if (blob->detailed)
- flags = flags | G_SIGNAL_DETAILED;
-
- if (blob->action)
- flags = flags | G_SIGNAL_ACTION;
-
- if (blob->no_hooks)
- flags = flags | G_SIGNAL_NO_HOOKS;
-
- return flags;
-}
-
-GIVFuncInfo *
-g_signal_info_get_class_closure (GISignalInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->has_class_closure)
- return g_interface_info_get_vfunc ((GIInterfaceInfo *)rinfo->container, blob->class_closure);
-
- return NULL;
-}
-
-gboolean
-g_signal_info_true_stops_emit (GISignalInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->true_stops_emit;
-}
-
-/* GIVFuncInfo functions */
-GIVFuncInfoFlags
-g_vfunc_info_get_flags (GIVFuncInfo *info)
-{
- GIVFuncInfoFlags flags;
-
- GIRealInfo *rinfo = (GIRealInfo *)info;
- VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
-
- 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;
-
- return flags;
-}
-
-gint
-g_vfunc_info_get_offset (GIVFuncInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->struct_offset;
-}
-
-GISignalInfo *
-g_vfunc_info_get_signal (GIVFuncInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->class_closure)
- return g_interface_info_get_signal ((GIInterfaceInfo *)rinfo->container, blob->signal);
-
- return NULL;
-}
-
-/**
- * g_vfunc_info_get_invoker:
- * @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.
- *
- * Returns: (transfer full): the #GIVFuncInfo or %NULL. Free it with
- * g_base_info_unref() when done.
- */
-GIFunctionInfo *
-g_vfunc_info_get_invoker (GIVFuncInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
- GIBaseInfo *container = rinfo->container;
- GIInfoType parent_type;
-
- /* 1023 = 0x3ff is the maximum of the 10 bits for invoker index */
- if (blob->invoker == 1023)
- return NULL;
-
- parent_type = g_base_info_get_type (container);
- if (parent_type == GI_INFO_TYPE_OBJECT)
- return g_object_info_get_method ((GIObjectInfo*)container, blob->invoker);
- else if (parent_type == GI_INFO_TYPE_INTERFACE)
- return g_interface_info_get_method ((GIInterfaceInfo*)container, blob->invoker);
- else
- g_assert_not_reached ();
-}
-
-/* GIConstantInfo functions */
-GITypeInfo *
-g_constant_info_get_type (GIConstantInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
-
- return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
-}
-
-gint
-g_constant_info_get_value (GIConstantInfo *info,
- GArgument *value)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ConstantBlob *blob = (ConstantBlob *)&rinfo->typelib->data[rinfo->offset];
-
- /* FIXME non-basic types ? */
- if (blob->type.flags.reserved == 0 && blob->type.flags.reserved2 == 0)
- {
- if (blob->type.flags.pointer)
- value->v_pointer = g_memdup (&rinfo->typelib->data[blob->offset], blob->size);
- else
- {
- switch (blob->type.flags.tag)
- {
- case GI_TYPE_TAG_BOOLEAN:
- value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT8:
- value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT8:
- value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT16:
- value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT16:
- value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT32:
- value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT32:
- value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT64:
- value->v_int64 = *(gint64*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT64:
- value->v_uint64 = *(guint64*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_FLOAT:
- value->v_float = *(gfloat*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_DOUBLE:
- value->v_double = *(gdouble*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_TIME_T:
- value->v_long = *(long*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_SHORT:
- value->v_short = *(gshort*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_USHORT:
- value->v_ushort = *(gushort*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT:
- value->v_int = *(gint*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT:
- value->v_uint = *(guint*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_LONG:
- value->v_long = *(glong*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_ULONG:
- value->v_ulong = *(gulong*)&rinfo->typelib->data[blob->offset];
- break;
- }
- }
- }
-
- return blob->size;
-}
-
-/* GIUnionInfo functions */
-gint
-g_union_info_get_n_fields (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_fields;
-}
-
-GIFieldInfo *
-g_union_info_get_field (GIUnionInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
-
- return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
- rinfo->offset + header->union_blob_size +
- n * header->field_blob_size);
-}
-
-gint
-g_union_info_get_n_methods (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->n_functions;
-}
-
-GIFunctionInfo *
-g_union_info_get_method (GIUnionInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
- Header *header = (Header *)rinfo->typelib->data;
- gint offset;
-
- offset = rinfo->offset + header->union_blob_size
- + blob->n_fields * header->field_blob_size
- + n * header->function_blob_size;
- return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
- rinfo->typelib, offset);
-}
-
-gboolean
-g_union_info_is_discriminated (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->discriminated;
-}
-
-gint
-g_union_info_get_discriminator_offset (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->discriminator_offset;
-}
-
-GITypeInfo *
-g_union_info_get_discriminator_type (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
-
- return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
-}
-
-GIConstantInfo *
-g_union_info_get_discriminator (GIUnionInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->discriminated)
- {
- Header *header = (Header *)rinfo->typelib->data;
- gint offset;
-
- offset = rinfo->offset + header->union_blob_size
- + blob->n_fields * header->field_blob_size
- + blob->n_functions * header->function_blob_size
- + n * header->constant_blob_size;
-
- return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
- rinfo->typelib, offset);
- }
-
- return NULL;
-}
-
-GIFunctionInfo *
-g_union_info_find_method (GIUnionInfo *info,
- const gchar *name)
-{
- gint offset;
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header = (Header *)rinfo->typelib->data;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- offset = rinfo->offset + header->union_blob_size
- + blob->n_fields * header->field_blob_size;
-
- return find_method ((GIBaseInfo*)info, offset, blob->n_functions, name);
-}
-
-gsize
-g_union_info_get_size (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->size;
-}
-
-gsize
-g_union_info_get_alignment (GIUnionInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
-
- return blob->alignment;
-}
diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c
new file mode 100644
index 00000000..ac7de59e
--- /dev/null
+++ b/girepository/giobjectinfo.c
@@ -0,0 +1,333 @@
+/* GObject introspection: Object implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+/* GIObjectInfo functions */
+GIObjectInfo *
+g_object_info_get_parent (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->parent)
+ return (GIObjectInfo *) _g_info_from_entry (rinfo->repository,
+ rinfo->typelib, blob->parent);
+ else
+ return NULL;
+}
+
+gboolean
+g_object_info_get_abstract (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+ return blob->abstract != 0;
+}
+
+const gchar *
+g_object_info_get_type_name (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return g_typelib_get_string (rinfo->typelib, blob->gtype_name);
+}
+
+const gchar *
+g_object_info_get_type_init (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return g_typelib_get_string (rinfo->typelib, blob->gtype_init);
+}
+
+gint
+g_object_info_get_n_interfaces (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_interfaces;
+}
+
+GIInterfaceInfo *
+g_object_info_get_interface (GIObjectInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
+ rinfo->typelib, blob->interfaces[n]);
+}
+
+gint
+g_object_info_get_n_fields (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_fields;
+}
+
+GIFieldInfo *
+g_object_info_get_field (GIObjectInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + n * header->field_blob_size;
+
+ return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib, offset);
+}
+
+gint
+g_object_info_get_n_properties (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_properties;
+}
+
+GIPropertyInfo *
+g_object_info_get_property (GIObjectInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size
+ + n * header->property_blob_size;
+
+ return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+gint
+g_object_info_get_n_methods (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_methods;
+}
+
+GIFunctionInfo *
+g_object_info_get_method (GIObjectInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size
+ + blob->n_properties * header->property_blob_size
+ + n * header->function_blob_size;
+
+ return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+GIFunctionInfo *
+g_object_info_find_method (GIObjectInfo *info,
+ const gchar *name)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size +
+ + blob->n_properties * header->property_blob_size;
+
+ return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
+}
+
+gint
+g_object_info_get_n_signals (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_signals;
+}
+
+GISignalInfo *
+g_object_info_get_signal (GIObjectInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + n * header->signal_blob_size;
+
+ return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+gint
+g_object_info_get_n_vfuncs (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_vfuncs;
+}
+
+GIVFuncInfo *
+g_object_info_get_vfunc (GIObjectInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + blob->n_signals * header->signal_blob_size
+ + n * header->vfunc_blob_size;
+
+ return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+/**
+ * g_object_info_find_vfunc:
+ * @info: a #GIObjectInfo
+ * @name: The name of a virtual function to find.
+ *
+ * Locate a virtual function slot with name @name. Note that the namespace
+ * for virtuals is distinct from that of methods; there may or may not be
+ * a concrete method associated for a virtual. If there is one, it may
+ * be retrieved using g_vfunc_info_get_invoker(), otherwise %NULL will be
+ * returned.
+ * See the documentation for g_vfunc_info_get_invoker() for more
+ * information on invoking virtuals.
+ *
+ * Returns: (transfer full): the #GIVFuncInfo, or %NULL. Free it with
+ * g_base_info_unref() when done.
+ */
+GIVFuncInfo *
+g_object_info_find_vfunc (GIObjectInfo *info,
+ const gchar *name)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + blob->n_signals * header->signal_blob_size;
+
+ return _g_base_info_find_vfunc (rinfo, offset, blob->n_vfuncs, name);
+}
+
+gint
+g_object_info_get_n_constants (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_constants;
+}
+
+GIConstantInfo *
+g_object_info_get_constant (GIObjectInfo *info,
+ gint n)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->object_blob_size
+ + (blob->n_interfaces + blob->n_interfaces % 2) * 2
+ + blob->n_fields * header->field_blob_size
+ + blob->n_properties * header->property_blob_size
+ + blob->n_methods * header->function_blob_size
+ + blob->n_signals * header->signal_blob_size
+ + blob->n_vfuncs * header->vfunc_blob_size
+ + n * header->constant_blob_size;
+
+ return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+/**
+ * g_object_info_get_class_struct:
+ * @info: a #GIObjectInfo
+ *
+ * Every #GObject has two structures; an instance structure and a class
+ * structure. This function returns the metadata for the class structure.
+ *
+ * Returns: (transfer full): the #GIStructInfo or %NULL. Free with
+ * g_base_info_unref() when done.
+ */
+GIStructInfo *
+g_object_info_get_class_struct (GIObjectInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->gtype_struct)
+ return (GIStructInfo *) _g_info_from_entry (rinfo->repository,
+ rinfo->typelib, blob->gtype_struct);
+ else
+ return NULL;
+}
+
diff --git a/girepository/giobjectinfo.h b/girepository/giobjectinfo.h
new file mode 100644
index 00000000..50a85b7a
--- /dev/null
+++ b/girepository/giobjectinfo.h
@@ -0,0 +1,74 @@
+/* GObject introspection: Object
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GIOBJECTINFO_H__
+#define __GIOBJECTINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+/* GIObjectInfo */
+
+#define GI_IS_OBJECT_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_OBJECT)
+
+const gchar * g_object_info_get_type_name (GIObjectInfo *info);
+const gchar * g_object_info_get_type_init (GIObjectInfo *info);
+gboolean g_object_info_get_abstract (GIObjectInfo *info);
+GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info);
+gint g_object_info_get_n_interfaces (GIObjectInfo *info);
+GIInterfaceInfo * g_object_info_get_interface (GIObjectInfo *info,
+ gint n);
+gint g_object_info_get_n_fields (GIObjectInfo *info);
+GIFieldInfo * g_object_info_get_field (GIObjectInfo *info,
+ gint n);
+gint g_object_info_get_n_properties (GIObjectInfo *info);
+GIPropertyInfo * g_object_info_get_property (GIObjectInfo *info,
+ gint n);
+gint g_object_info_get_n_methods (GIObjectInfo *info);
+GIFunctionInfo * g_object_info_get_method (GIObjectInfo *info,
+ gint n);
+GIFunctionInfo * g_object_info_find_method (GIObjectInfo *info,
+ const gchar *name);
+gint g_object_info_get_n_signals (GIObjectInfo *info);
+GISignalInfo * g_object_info_get_signal (GIObjectInfo *info,
+ gint n);
+gint g_object_info_get_n_vfuncs (GIObjectInfo *info);
+GIVFuncInfo * g_object_info_get_vfunc (GIObjectInfo *info,
+ gint n);
+GIVFuncInfo * g_object_info_find_vfunc (GIObjectInfo *info,
+ const gchar *name);
+gint g_object_info_get_n_constants (GIObjectInfo *info);
+GIConstantInfo * g_object_info_get_constant (GIObjectInfo *info,
+ gint n);
+GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
+
+
+G_END_DECLS
+
+
+#endif /* __GIOBJECTINFO_H__ */
+
diff --git a/girepository/gipropertyinfo.c b/girepository/gipropertyinfo.c
new file mode 100644
index 00000000..56b763c4
--- /dev/null
+++ b/girepository/gipropertyinfo.c
@@ -0,0 +1,60 @@
+/* GObject introspection: Property implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+GParamFlags
+g_property_info_get_flags (GIPropertyInfo *info)
+{
+ GParamFlags flags;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ PropertyBlob *blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ flags = 0;
+
+ if (blob->readable)
+ flags = flags | G_PARAM_READABLE;
+
+ if (blob->writable)
+ flags = flags | G_PARAM_WRITABLE;
+
+ if (blob->construct)
+ flags = flags | G_PARAM_CONSTRUCT;
+
+ if (blob->construct_only)
+ flags = flags | G_PARAM_CONSTRUCT_ONLY;
+
+ return flags;
+}
+
+GITypeInfo *
+g_property_info_get_type (GIPropertyInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (PropertyBlob, type));
+}
+
diff --git a/girepository/gipropertyinfo.h b/girepository/gipropertyinfo.h
new file mode 100644
index 00000000..168b88cc
--- /dev/null
+++ b/girepository/gipropertyinfo.h
@@ -0,0 +1,42 @@
+/* GObject introspection: Property
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GIPROPERTYINFO_H__
+#define __GIPROPERTYINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_PROPERTY_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_PROPERTY)
+
+GParamFlags g_property_info_get_flags (GIPropertyInfo *info);
+GITypeInfo * g_property_info_get_type (GIPropertyInfo *info);
+
+G_END_DECLS
+
+#endif /* __GIPROPERTYINFO_H__ */
+
diff --git a/girepository/giregisteredtypeinfo.c b/girepository/giregisteredtypeinfo.c
index 944444f0..0f3493f3 100644
--- a/girepository/giregisteredtypeinfo.c
+++ b/girepository/giregisteredtypeinfo.c
@@ -19,6 +19,8 @@
* Boston, MA 02111-1307, USA.
*/
+#include <string.h>
+
#include <glib.h>
#include <girepository.h>
diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h
index 52fc749a..a4c0393e 100644
--- a/girepository/girepository-private.h
+++ b/girepository/girepository-private.h
@@ -95,6 +95,14 @@ void _g_type_info_init (GIBaseInfo *info,
GTypelib *typelib,
guint32 offset);
-
+GIFunctionInfo * _g_base_info_find_method (GIBaseInfo *base,
+ guint32 offset,
+ gint n_methods,
+ const gchar *name);
+
+GIVFuncInfo * _g_base_info_find_vfunc (GIRealInfo *rinfo,
+ guint32 offset,
+ gint n_vfuncs,
+ const gchar *name);
#endif /* __GIREPOSITORY_PRIVATE_H__ */
diff --git a/girepository/girepository.h b/girepository/girepository.h
index 47d02b59..5138e4ae 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -29,14 +29,22 @@
#include <giarginfo.h>
#include <gibaseinfo.h>
#include <gicallableinfo.h>
+#include <giconstantinfo.h>
#include <gienuminfo.h>
#include <gierrordomaininfo.h>
#include <gifieldinfo.h>
#include <gifunctioninfo.h>
+#include <giinterfaceinfo.h>
+#include <giobjectinfo.h>
+#include <gipropertyinfo.h>
#include <giregisteredtypeinfo.h>
+#include <gisignalinfo.h>
+#include <gistructinfo.h>
#include <gitypeinfo.h>
#include <gitypelib.h>
#include <gitypes.h>
+#include <giunioninfo.h>
+#include <givfuncinfo.h>
G_BEGIN_DECLS
@@ -152,154 +160,6 @@ void gi_cclosure_marshal_generic (GClosure *closure,
gpointer invocation_hint,
gpointer marshal_data);
-/* GIUnionInfo */
-
-#define GI_IS_UNION_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION)
-
-gint g_union_info_get_n_fields (GIUnionInfo *info);
-GIFieldInfo * g_union_info_get_field (GIUnionInfo *info,
- gint n);
-gint g_union_info_get_n_methods (GIUnionInfo *info);
-GIFunctionInfo * g_union_info_get_method (GIUnionInfo *info,
- gint n);
-gboolean g_union_info_is_discriminated (GIUnionInfo *info);
-gint g_union_info_get_discriminator_offset (GIUnionInfo *info);
-GITypeInfo * g_union_info_get_discriminator_type (GIUnionInfo *info);
-GIConstantInfo * g_union_info_get_discriminator (GIUnionInfo *info,
- gint n);
-GIFunctionInfo * g_union_info_find_method (GIUnionInfo *info,
- const gchar *name);
-gsize g_union_info_get_size (GIUnionInfo *info);
-gsize g_union_info_get_alignment (GIUnionInfo *info);
-
-
-/* GIStructInfo */
-
-#define GI_IS_STRUCT_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_STRUCT)
-
-gint g_struct_info_get_n_fields (GIStructInfo *info);
-GIFieldInfo * g_struct_info_get_field (GIStructInfo *info,
- gint n);
-gint g_struct_info_get_n_methods (GIStructInfo *info);
-GIFunctionInfo * g_struct_info_get_method (GIStructInfo *info,
- gint n);
-GIFunctionInfo * g_struct_info_find_method (GIStructInfo *info,
- const gchar *name);
-gsize g_struct_info_get_size (GIStructInfo *info);
-gsize g_struct_info_get_alignment (GIStructInfo *info);
-gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
-gboolean g_struct_info_is_foreign (GIStructInfo *info);
-
-/* GIObjectInfo */
-
-#define GI_IS_OBJECT_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_OBJECT)
-
-const gchar * g_object_info_get_type_name (GIObjectInfo *info);
-const gchar * g_object_info_get_type_init (GIObjectInfo *info);
-gboolean g_object_info_get_abstract (GIObjectInfo *info);
-GIObjectInfo * g_object_info_get_parent (GIObjectInfo *info);
-gint g_object_info_get_n_interfaces (GIObjectInfo *info);
-GIInterfaceInfo * g_object_info_get_interface (GIObjectInfo *info,
- gint n);
-gint g_object_info_get_n_fields (GIObjectInfo *info);
-GIFieldInfo * g_object_info_get_field (GIObjectInfo *info,
- gint n);
-gint g_object_info_get_n_properties (GIObjectInfo *info);
-GIPropertyInfo * g_object_info_get_property (GIObjectInfo *info,
- gint n);
-gint g_object_info_get_n_methods (GIObjectInfo *info);
-GIFunctionInfo * g_object_info_get_method (GIObjectInfo *info,
- gint n);
-GIFunctionInfo * g_object_info_find_method (GIObjectInfo *info,
- const gchar *name);
-gint g_object_info_get_n_signals (GIObjectInfo *info);
-GISignalInfo * g_object_info_get_signal (GIObjectInfo *info,
- gint n);
-gint g_object_info_get_n_vfuncs (GIObjectInfo *info);
-GIVFuncInfo * g_object_info_get_vfunc (GIObjectInfo *info,
- gint n);
-GIVFuncInfo * g_object_info_find_vfunc (GIObjectInfo *info,
- const gchar *name);
-gint g_object_info_get_n_constants (GIObjectInfo *info);
-GIConstantInfo * g_object_info_get_constant (GIObjectInfo *info,
- gint n);
-GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
-
-
-/* GIInterfaceInfo */
-
-#define GI_IS_INTERFACE_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_INTERFACE)
-
-gint g_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
-GIBaseInfo * g_interface_info_get_prerequisite (GIInterfaceInfo *info,
- gint n);
-gint g_interface_info_get_n_properties (GIInterfaceInfo *info);
-GIPropertyInfo * g_interface_info_get_property (GIInterfaceInfo *info,
- gint n);
-gint g_interface_info_get_n_methods (GIInterfaceInfo *info);
-GIFunctionInfo * g_interface_info_get_method (GIInterfaceInfo *info,
- gint n);
-GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
- const gchar *name);
-gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
-GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
- gint n);
-gint g_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
-GIVFuncInfo * g_interface_info_get_vfunc (GIInterfaceInfo *info,
- gint n);
-GIVFuncInfo * g_interface_info_find_vfunc (GIInterfaceInfo *info,
- const gchar *name);
-gint g_interface_info_get_n_constants (GIInterfaceInfo *info);
-GIConstantInfo * g_interface_info_get_constant (GIInterfaceInfo *info,
- gint n);
-
-GIStructInfo * g_interface_info_get_iface_struct (GIInterfaceInfo *info);
-
-
-/* GIPropertyInfo */
-
-#define GI_IS_PROPERTY_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_PROPERTY)
-
-GParamFlags g_property_info_get_flags (GIPropertyInfo *info);
-GITypeInfo * g_property_info_get_type (GIPropertyInfo *info);
-
-
-/* GISignalInfo */
-
-#define GI_IS_SIGNAL_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL)
-
-GSignalFlags g_signal_info_get_flags (GISignalInfo *info);
-GIVFuncInfo * g_signal_info_get_class_closure (GISignalInfo *info);
-gboolean g_signal_info_true_stops_emit (GISignalInfo *info);
-
-
-/* GIVFuncInfo */
-
-#define GI_IS_VFUNC_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC)
-
-GIVFuncInfoFlags g_vfunc_info_get_flags (GIVFuncInfo *info);
-gint g_vfunc_info_get_offset (GIVFuncInfo *info);
-GISignalInfo * g_vfunc_info_get_signal (GIVFuncInfo *info);
-GIFunctionInfo * g_vfunc_info_get_invoker (GIVFuncInfo *info);
-
-
-/* GIConstantInfo */
-
-#define GI_IS_CONSTANT_INFO(info) \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CONSTANT)
-
-GITypeInfo * g_constant_info_get_type (GIConstantInfo *info);
-gint g_constant_info_get_value (GIConstantInfo *info,
- GArgument *value);
-
-
G_END_DECLS
diff --git a/girepository/gisignalinfo.c b/girepository/gisignalinfo.c
new file mode 100644
index 00000000..2516a8b6
--- /dev/null
+++ b/girepository/gisignalinfo.c
@@ -0,0 +1,83 @@
+/* GObject introspection: Signal implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+GSignalFlags
+g_signal_info_get_flags (GISignalInfo *info)
+{
+ GSignalFlags flags;
+
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ flags = 0;
+
+ if (blob->run_first)
+ flags = flags | G_SIGNAL_RUN_FIRST;
+
+ if (blob->run_last)
+ flags = flags | G_SIGNAL_RUN_LAST;
+
+ if (blob->run_cleanup)
+ flags = flags | G_SIGNAL_RUN_CLEANUP;
+
+ if (blob->no_recurse)
+ flags = flags | G_SIGNAL_NO_RECURSE;
+
+ if (blob->detailed)
+ flags = flags | G_SIGNAL_DETAILED;
+
+ if (blob->action)
+ flags = flags | G_SIGNAL_ACTION;
+
+ if (blob->no_hooks)
+ flags = flags | G_SIGNAL_NO_HOOKS;
+
+ return flags;
+}
+
+GIVFuncInfo *
+g_signal_info_get_class_closure (GISignalInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->has_class_closure)
+ return g_interface_info_get_vfunc ((GIInterfaceInfo *)rinfo->container, blob->class_closure);
+
+ return NULL;
+}
+
+gboolean
+g_signal_info_true_stops_emit (GISignalInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ SignalBlob *blob = (SignalBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->true_stops_emit;
+}
+
diff --git a/girepository/gisignalinfo.h b/girepository/gisignalinfo.h
new file mode 100644
index 00000000..12054b00
--- /dev/null
+++ b/girepository/gisignalinfo.h
@@ -0,0 +1,44 @@
+/* GObject introspection: Signal
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GISIGNALINFO_H__
+#define __GISIGNALINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_SIGNAL_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL)
+
+GSignalFlags g_signal_info_get_flags (GISignalInfo *info);
+GIVFuncInfo * g_signal_info_get_class_closure (GISignalInfo *info);
+gboolean g_signal_info_true_stops_emit (GISignalInfo *info);
+
+G_END_DECLS
+
+
+#endif /* __GISIGNALINFO_H__ */
diff --git a/girepository/gistructinfo.c b/girepository/gistructinfo.c
new file mode 100644
index 00000000..eee5609c
--- /dev/null
+++ b/girepository/gistructinfo.c
@@ -0,0 +1,151 @@
+/* GObject introspection: Struct implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+gint
+g_struct_info_get_n_fields (GIStructInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_fields;
+}
+
+static gint32
+g_struct_get_field_offset (GIStructInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ guint32 offset = rinfo->offset + header->struct_blob_size;
+ gint i;
+ FieldBlob *field_blob;
+
+ for (i = 0; i < n; i++)
+ {
+ field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
+ offset += header->field_blob_size;
+ if (field_blob->has_embedded_type)
+ offset += header->callback_blob_size;
+ }
+
+ return offset;
+}
+
+GIFieldInfo *
+g_struct_info_get_field (GIStructInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+
+ return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
+ g_struct_get_field_offset (info, n));
+}
+
+gint
+g_struct_info_get_n_methods (GIStructInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_methods;
+}
+
+GIFunctionInfo *
+g_struct_info_get_method (GIStructInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+ Header *header = (Header *)rinfo->typelib->data;
+ gint offset;
+
+ offset = g_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
+ return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+GIFunctionInfo *
+g_struct_info_find_method (GIStructInfo *info,
+ const gchar *name)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->struct_blob_size
+ + blob->n_fields * header->field_blob_size;
+
+ return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_methods, name);
+}
+
+gsize
+g_struct_info_get_size (GIStructInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->size;
+}
+
+gsize
+g_struct_info_get_alignment (GIStructInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->alignment;
+}
+
+gboolean
+g_struct_info_is_foreign (GIStructInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->foreign;
+}
+
+/**
+ * g_struct_info_is_gtype_struct:
+ * @info: a #GIStructInfo
+ *
+ * Return true if this structure represents the "class structure" for some
+ * #GObject or #GInterface. This function is mainly useful to hide this kind of structure
+ * from generated public APIs.
+ *
+ * Returns: %TRUE if this is a class struct, %FALSE otherwise
+ */
+gboolean
+g_struct_info_is_gtype_struct (GIStructInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->is_gtype_struct;
+}
diff --git a/girepository/gistructinfo.h b/girepository/gistructinfo.h
new file mode 100644
index 00000000..91296c1c
--- /dev/null
+++ b/girepository/gistructinfo.h
@@ -0,0 +1,52 @@
+/* GObject introspection: Struct
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GISTRUCTINFO_H__
+#define __GISTRUCTINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_STRUCT_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_STRUCT)
+
+gint g_struct_info_get_n_fields (GIStructInfo *info);
+GIFieldInfo * g_struct_info_get_field (GIStructInfo *info,
+ gint n);
+gint g_struct_info_get_n_methods (GIStructInfo *info);
+GIFunctionInfo * g_struct_info_get_method (GIStructInfo *info,
+ gint n);
+GIFunctionInfo * g_struct_info_find_method (GIStructInfo *info,
+ const gchar *name);
+gsize g_struct_info_get_size (GIStructInfo *info);
+gsize g_struct_info_get_alignment (GIStructInfo *info);
+gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
+gboolean g_struct_info_is_foreign (GIStructInfo *info);
+
+G_END_DECLS
+
+
+#endif /* __GISTRUCTINFO_H__ */
diff --git a/girepository/giunioninfo.c b/girepository/giunioninfo.c
new file mode 100644
index 00000000..007eabd2
--- /dev/null
+++ b/girepository/giunioninfo.c
@@ -0,0 +1,156 @@
+/* GObject introspection: Union implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+gint
+g_union_info_get_n_fields (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_fields;
+}
+
+GIFieldInfo *
+g_union_info_get_field (GIUnionInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+
+ return (GIFieldInfo *) g_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
+ rinfo->offset + header->union_blob_size +
+ n * header->field_blob_size);
+}
+
+gint
+g_union_info_get_n_methods (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->n_functions;
+}
+
+GIFunctionInfo *
+g_union_info_get_method (GIUnionInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+ Header *header = (Header *)rinfo->typelib->data;
+ gint offset;
+
+ offset = rinfo->offset + header->union_blob_size
+ + blob->n_fields * header->field_blob_size
+ + n * header->function_blob_size;
+ return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+}
+
+gboolean
+g_union_info_is_discriminated (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->discriminated;
+}
+
+gint
+g_union_info_get_discriminator_offset (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->discriminator_offset;
+}
+
+GITypeInfo *
+g_union_info_get_discriminator_type (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
+}
+
+GIConstantInfo *
+g_union_info_get_discriminator (GIUnionInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->discriminated)
+ {
+ Header *header = (Header *)rinfo->typelib->data;
+ gint offset;
+
+ offset = rinfo->offset + header->union_blob_size
+ + blob->n_fields * header->field_blob_size
+ + blob->n_functions * header->function_blob_size
+ + n * header->constant_blob_size;
+
+ return (GIConstantInfo *) g_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
+ rinfo->typelib, offset);
+ }
+
+ return NULL;
+}
+
+GIFunctionInfo *
+g_union_info_find_method (GIUnionInfo *info,
+ const gchar *name)
+{
+ gint offset;
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header = (Header *)rinfo->typelib->data;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ offset = rinfo->offset + header->union_blob_size
+ + blob->n_fields * header->field_blob_size;
+
+ return _g_base_info_find_method ((GIBaseInfo*)info, offset, blob->n_functions, name);
+}
+
+gsize
+g_union_info_get_size (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->size;
+}
+
+gsize
+g_union_info_get_alignment (GIUnionInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->alignment;
+}
diff --git a/girepository/giunioninfo.h b/girepository/giunioninfo.h
new file mode 100644
index 00000000..e42fe6f8
--- /dev/null
+++ b/girepository/giunioninfo.h
@@ -0,0 +1,56 @@
+/* GObject introspection: Union
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GIUNIONINFO_H__
+#define __GIUNIONINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_UNION_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_UNION)
+
+gint g_union_info_get_n_fields (GIUnionInfo *info);
+GIFieldInfo * g_union_info_get_field (GIUnionInfo *info,
+ gint n);
+gint g_union_info_get_n_methods (GIUnionInfo *info);
+GIFunctionInfo * g_union_info_get_method (GIUnionInfo *info,
+ gint n);
+gboolean g_union_info_is_discriminated (GIUnionInfo *info);
+gint g_union_info_get_discriminator_offset (GIUnionInfo *info);
+GITypeInfo * g_union_info_get_discriminator_type (GIUnionInfo *info);
+GIConstantInfo * g_union_info_get_discriminator (GIUnionInfo *info,
+ gint n);
+GIFunctionInfo * g_union_info_find_method (GIUnionInfo *info,
+ const gchar *name);
+gsize g_union_info_get_size (GIUnionInfo *info);
+gsize g_union_info_get_alignment (GIUnionInfo *info);
+
+G_END_DECLS
+
+
+#endif /* __GIUNIONINFO_H__ */
+
diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c
new file mode 100644
index 00000000..e0bb6874
--- /dev/null
+++ b/girepository/givfuncinfo.c
@@ -0,0 +1,131 @@
+/* GObject introspection: Virtual Function implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 <string.h>
+
+#include <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "girffi.h"
+
+GIVFuncInfo *
+_g_base_info_find_vfunc (GIRealInfo *rinfo,
+ guint32 offset,
+ gint n_vfuncs,
+ const gchar *name)
+{
+ /* 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)
+ return (GIVFuncInfo *) g_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
+ rinfo->typelib, offset);
+
+ offset += header->vfunc_blob_size;
+ }
+
+ return NULL;
+}
+
+GIVFuncInfoFlags
+g_vfunc_info_get_flags (GIVFuncInfo *info)
+{
+ GIVFuncInfoFlags flags;
+
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ 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;
+
+ return flags;
+}
+
+gint
+g_vfunc_info_get_offset (GIVFuncInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ return blob->struct_offset;
+}
+
+GISignalInfo *
+g_vfunc_info_get_signal (GIVFuncInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->class_closure)
+ return g_interface_info_get_signal ((GIInterfaceInfo *)rinfo->container, blob->signal);
+
+ return NULL;
+}
+
+/**
+ * g_vfunc_info_get_invoker:
+ * @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.
+ *
+ * Returns: (transfer full): the #GIVFuncInfo or %NULL. Free it with
+ * g_base_info_unref() when done.
+ */
+GIFunctionInfo *
+g_vfunc_info_get_invoker (GIVFuncInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ VFuncBlob *blob = (VFuncBlob *)&rinfo->typelib->data[rinfo->offset];
+ GIBaseInfo *container = rinfo->container;
+ GIInfoType parent_type;
+
+ /* 1023 = 0x3ff is the maximum of the 10 bits for invoker index */
+ if (blob->invoker == 1023)
+ return NULL;
+
+ parent_type = g_base_info_get_type (container);
+ if (parent_type == GI_INFO_TYPE_OBJECT)
+ return g_object_info_get_method ((GIObjectInfo*)container, blob->invoker);
+ else if (parent_type == GI_INFO_TYPE_INTERFACE)
+ return g_interface_info_get_method ((GIInterfaceInfo*)container, blob->invoker);
+ else
+ g_assert_not_reached ();
+}
+
diff --git a/girepository/givfuncinfo.h b/girepository/givfuncinfo.h
new file mode 100644
index 00000000..6629cad8
--- /dev/null
+++ b/girepository/givfuncinfo.h
@@ -0,0 +1,44 @@
+/* GObject introspection: Virtual Functions
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __GIVFUNCINFO_H__
+#define __GIVFUNCINFO_H__
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_IS_VFUNC_INFO(info) \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC)
+
+GIVFuncInfoFlags g_vfunc_info_get_flags (GIVFuncInfo *info);
+gint g_vfunc_info_get_offset (GIVFuncInfo *info);
+GISignalInfo * g_vfunc_info_get_signal (GIVFuncInfo *info);
+GIFunctionInfo * g_vfunc_info_get_invoker (GIVFuncInfo *info);
+
+G_END_DECLS
+
+
+#endif /* __GIVFUNCINFO_H__ */