summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-06-05 12:11:58 -0300
committerJohan Dahlin <johan@gnome.org>2010-06-05 12:40:28 -0300
commit6039032537282a8f33ffb13c640bb824b5296650 (patch)
tree590006e960311e290202c715554a62aa45fe5050
parentbb832d71f7cb9648d2682ea490684da5f357bac0 (diff)
downloadgobject-introspection-6039032537282a8f33ffb13c640bb824b5296650.tar.gz
[girepository] Move GICallableInfo out of ginfo.ch
-rw-r--r--girepository/Makefile.am3
-rw-r--r--girepository/gibaseinfo.c41
-rw-r--r--girepository/gibaseinfo.h1
-rw-r--r--girepository/gicallableinfo.c251
-rw-r--r--girepository/gicallableinfo.h54
-rw-r--r--girepository/ginfo.c262
-rw-r--r--girepository/ginfo.h42
-rw-r--r--girepository/girepository-private.h16
-rw-r--r--girepository/girepository.c8
-rw-r--r--girepository/girepository.h36
-rw-r--r--girepository/gitypes.h16
11 files changed, 384 insertions, 346 deletions
diff --git a/girepository/Makefile.am b/girepository/Makefile.am
index 09fc0ee7..b173dba5 100644
--- a/girepository/Makefile.am
+++ b/girepository/Makefile.am
@@ -1,6 +1,7 @@
girepodir = $(includedir)/gobject-introspection-1.0/
girepo_HEADERS = \
gibaseinfo.h \
+ gicallableinfo.h \
gifunctioninfo.h \
girepository.h \
girffi.h \
@@ -15,8 +16,8 @@ libgirepository_1_0_la_SOURCES = \
gfield.c \
gibaseinfo.c \
gifunctioninfo.c \
+ gicallableinfo.c \
ginfo.c \
- ginfo.h \
ginvoke.c \
girepository.c \
girepository-private.h \
diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c
index 2f714492..e128a9a4 100644
--- a/girepository/gibaseinfo.c
+++ b/girepository/gibaseinfo.c
@@ -26,18 +26,17 @@
#include <glib-object.h>
#include "gitypelib-internal.h"
-#include "ginfo.h"
#include "girepository-private.h"
#define INVALID_REFCOUNT 0x7FFFFFFF
/* info creation */
GIBaseInfo *
-g_info_new_full (GIInfoType type,
- GIRepository *repository,
- GIBaseInfo *container,
- GTypelib *typelib,
- guint32 offset)
+_g_info_new_full (GIInfoType type,
+ GIRepository *repository,
+ GIBaseInfo *container,
+ GTypelib *typelib,
+ guint32 offset)
{
GIRealInfo *info;
@@ -62,7 +61,7 @@ g_info_new (GIInfoType type,
GTypelib *typelib,
guint32 offset)
{
- return g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
+ return _g_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
}
void
@@ -98,7 +97,7 @@ _g_info_from_entry (GIRepository *repository,
DirEntry *entry = g_typelib_get_dir_entry (typelib, index);
if (entry->local)
- result = g_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
+ result = _g_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
else
{
const gchar *namespace = g_typelib_get_string (typelib, entry->offset);
@@ -126,6 +125,31 @@ _g_info_from_entry (GIRepository *repository,
return (GIBaseInfo *)result;
}
+GITypeInfo *
+_g_type_info_new (GIBaseInfo *container,
+ GTypelib *typelib,
+ guint32 offset)
+{
+ SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
+
+ return (GITypeInfo *) g_info_new (GI_INFO_TYPE_TYPE, container, typelib,
+ (type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
+}
+
+void
+_g_type_info_init (GIBaseInfo *info,
+ GIBaseInfo *container,
+ GTypelib *typelib,
+ guint32 offset)
+{
+ GIRealInfo *rinfo = (GIRealInfo*)container;
+ SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
+
+ _g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
+ (type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
+}
+
+
/* GIBaseInfo functions */
/**
@@ -589,3 +613,4 @@ g_base_info_equal (GIBaseInfo *info1, GIBaseInfo *info2)
return rinfo1->typelib->data + rinfo1->offset == rinfo2->typelib->data + rinfo2->offset;
}
+
diff --git a/girepository/gibaseinfo.h b/girepository/gibaseinfo.h
index c6175c3e..79f50ce9 100644
--- a/girepository/gibaseinfo.h
+++ b/girepository/gibaseinfo.h
@@ -81,7 +81,6 @@ GIBaseInfo * g_info_new (GIInfoType type,
GTypelib *typelib,
guint32 offset);
-
G_END_DECLS
#endif /* __GIBASEINFO_H__ */
diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c
new file mode 100644
index 00000000..5013c5d6
--- /dev/null
+++ b/girepository/gicallableinfo.c
@@ -0,0 +1,251 @@
+/* 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 <glib.h>
+
+#include <girepository.h>
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+
+/* GICallableInfo functions */
+
+/**
+ * SECTION:gicallableinfo
+ * @Short_description: Struct representing a callable
+ * @Title: GICallableInfo
+ *
+ * GICallableInfo represents an entity which is callable.
+ * Currently a function (#GIFunctionInfo), virtual function,
+ * (#GIVirtualFunc) or callback (#GICallbackInfo).
+ *
+ * A callable has a list of arguments (#GIArgInfo), a return type,
+ * direction and a flag which decides if it returns null.
+ *
+ */
+
+static guint32
+signature_offset (GICallableInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo*)info;
+ int sigoff = -1;
+
+ switch (rinfo->type)
+ {
+ case GI_INFO_TYPE_FUNCTION:
+ sigoff = G_STRUCT_OFFSET (FunctionBlob, signature);
+ break;
+ case GI_INFO_TYPE_VFUNC:
+ sigoff = G_STRUCT_OFFSET (VFuncBlob, signature);
+ break;
+ case GI_INFO_TYPE_CALLBACK:
+ sigoff = G_STRUCT_OFFSET (CallbackBlob, signature);
+ break;
+ case GI_INFO_TYPE_SIGNAL:
+ sigoff = G_STRUCT_OFFSET (SignalBlob, signature);
+ break;
+ }
+ if (sigoff >= 0)
+ return *(guint32 *)&rinfo->typelib->data[rinfo->offset + sigoff];
+ return 0;
+}
+
+/**
+ * g_callable_info_get_return_type:
+ * @info: a #GICallableInfo
+ *
+ * Obtain the return type of a callable item as a #GITypeInfo.
+ *
+ * Returns: (transfer full): the #GITypeInfo. Free the struct by calling
+ * g_base_info_unref() when done.
+ */
+GITypeInfo *
+g_callable_info_get_return_type (GICallableInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ guint32 offset;
+
+ g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
+
+ offset = signature_offset (info);
+
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, offset);
+}
+
+
+/**
+ * g_callable_info_load_return_type:
+ * @info: a #GICallableInfo
+ * @type: (out caller-allocates): Initialized with return type of @info
+ *
+ * Obtain information about a return value of callable; this
+ * function is a variant of g_callable_info_get_return_type() designed for stack
+ * allocation.
+ *
+ * The initialized @type must not be referenced after @info is deallocated.
+ */
+void
+g_callable_info_load_return_type (GICallableInfo *info,
+ GITypeInfo *type)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ guint32 offset;
+
+ g_return_if_fail (info != NULL);
+ g_return_if_fail (GI_IS_CALLABLE_INFO (info));
+
+ offset = signature_offset (info);
+
+ _g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, offset);
+}
+
+/**
+ * g_callable_info_may_return_null:
+ * @info: a #GICallableInfo
+ *
+ * See if a callable could return %NULL.
+ *
+ * Returns: %TRUE if callable could return %NULL
+ */
+gboolean
+g_callable_info_may_return_null (GICallableInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ SignatureBlob *blob;
+
+ g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), FALSE);
+
+ blob = (SignatureBlob *)&rinfo->typelib->data[signature_offset (info)];
+
+ return blob->may_return_null;
+}
+
+/**
+ * g_callable_info_get_caller_owns:
+ * @info: a #GICallableInfo
+ *
+ * See whether the caller owns the return value of this callable.
+ * #GITransfer contains a list of possible transfer values.
+ *
+ * Returns: %TRUE if the caller owns the return value, %FALSE otherwise.
+ */
+GITransfer
+g_callable_info_get_caller_owns (GICallableInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo*) info;
+ SignatureBlob *blob;
+
+ g_return_val_if_fail (info != NULL, -1);
+ g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), -1);
+
+ blob = (SignatureBlob *)&rinfo->typelib->data[signature_offset (info)];
+
+ if (blob->caller_owns_return_value)
+ return GI_TRANSFER_EVERYTHING;
+ else if (blob->caller_owns_return_container)
+ return GI_TRANSFER_CONTAINER;
+ else
+ return GI_TRANSFER_NOTHING;
+}
+
+/**
+ * g_callable_info_get_n_args:
+ * @info: a #GICallableInfo
+ *
+ * Obtain the number of arguments (both IN and OUT) for this callable.
+ *
+ * Returns: The number of arguments this callable expects.
+ */
+gint
+g_callable_info_get_n_args (GICallableInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ gint offset;
+ SignatureBlob *blob;
+
+ g_return_val_if_fail (info != NULL, -1);
+ g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), -1);
+
+ offset = signature_offset (info);
+ blob = (SignatureBlob *)&rinfo->typelib->data[offset];
+
+ return blob->n_arguments;
+}
+
+/**
+ * g_callable_info_get_arg:
+ * @info: a #GICallableInfo
+ * @n: the argument index to fetch
+ *
+ * Obtain information about a particular argument of this callable.
+ *
+ * Returns: (transfer full): the #GIArgInfo. Free it with
+ * g_base_info_unref() when done.
+ */
+GIArgInfo *
+g_callable_info_get_arg (GICallableInfo *info,
+ gint n)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header;
+ gint offset;
+
+ g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
+
+ offset = signature_offset (info);
+ header = (Header *)rinfo->typelib->data;
+
+ return (GIArgInfo *) g_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
+ offset + header->signature_blob_size + n * header->arg_blob_size);
+}
+
+/**
+ * g_callable_info_load_arg:
+ * @info: a #GICallableInfo
+ * @n: the argument index to fetch
+ * @arg: (out caller-allocates): Initialize with argument number @n
+ *
+ * Obtain information about a particular argument of this callable; this
+ * function is a variant of g_callable_info_get_arg() designed for stack
+ * allocation.
+ *
+ * The initialized @arg must not be referenced after @info is deallocated.
+ */
+void
+g_callable_info_load_arg (GICallableInfo *info,
+ gint n,
+ GIArgInfo *arg)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ Header *header;
+ gint offset;
+
+ g_return_if_fail (info != NULL);
+ g_return_if_fail (GI_IS_CALLABLE_INFO (info));
+
+ offset = signature_offset (info);
+ header = (Header *)rinfo->typelib->data;
+
+ _g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
+ offset + header->signature_blob_size + n * header->arg_blob_size);
+}
diff --git a/girepository/gicallableinfo.h b/girepository/gicallableinfo.h
new file mode 100644
index 00000000..c122bd5d
--- /dev/null
+++ b/girepository/gicallableinfo.h
@@ -0,0 +1,54 @@
+/* GObject introspection: 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 __GICALLABLEINFO_H__
+#define __GICALLABLEINFO_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_CALLABLE_INFO(info) \
+ ((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FUNCTION) || \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CALLBACK) || \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL) || \
+ (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC))
+
+GITypeInfo * g_callable_info_get_return_type (GICallableInfo *info);
+void g_callable_info_load_return_type (GICallableInfo *info,
+ GITypeInfo *type);
+GITransfer g_callable_info_get_caller_owns (GICallableInfo *info);
+gboolean g_callable_info_may_return_null (GICallableInfo *info);
+gint g_callable_info_get_n_args (GICallableInfo *info);
+GIArgInfo * g_callable_info_get_arg (GICallableInfo *info,
+ gint n);
+void g_callable_info_load_arg (GICallableInfo *info,
+ gint n,
+ GIArgInfo *arg);
+G_END_DECLS
+
+
+#endif /* __G_IREPOSITORY_H__ */
+
diff --git a/girepository/ginfo.c b/girepository/ginfo.c
index 0c717cfa..7a6ecbfe 100644
--- a/girepository/ginfo.c
+++ b/girepository/ginfo.c
@@ -26,256 +26,8 @@
#include <glib-object.h>
#include "gitypelib-internal.h"
-#include "ginfo.h"
#include "girepository-private.h"
-/* GICallableInfo functions */
-
-/**
- * SECTION:gicallableinfo
- * @Short_description: Struct representing a callable
- * @Title: GICallableInfo
- *
- * GICallableInfo represents an entity which is callable.
- * Currently a function (#GIFunctionInfo), virtual function,
- * (#GIVirtualFunc) or callback (#GICallbackInfo).
- *
- * A callable has a list of arguments (#GIArgInfo), a return type,
- * direction and a flag which decides if it returns null.
- *
- */
-static guint32
-signature_offset (GICallableInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo*)info;
- int sigoff = -1;
-
- switch (rinfo->type)
- {
- case GI_INFO_TYPE_FUNCTION:
- sigoff = G_STRUCT_OFFSET (FunctionBlob, signature);
- break;
- case GI_INFO_TYPE_VFUNC:
- sigoff = G_STRUCT_OFFSET (VFuncBlob, signature);
- break;
- case GI_INFO_TYPE_CALLBACK:
- sigoff = G_STRUCT_OFFSET (CallbackBlob, signature);
- break;
- case GI_INFO_TYPE_SIGNAL:
- sigoff = G_STRUCT_OFFSET (SignalBlob, signature);
- break;
- }
- if (sigoff >= 0)
- return *(guint32 *)&rinfo->typelib->data[rinfo->offset + sigoff];
- return 0;
-}
-
-GITypeInfo *
-g_type_info_new (GIBaseInfo *container,
- GTypelib *typelib,
- guint32 offset)
-{
- SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
-
- return (GITypeInfo *) g_info_new (GI_INFO_TYPE_TYPE, container, typelib,
- (type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
-}
-
-static void
-g_type_info_init (GIBaseInfo *info,
- GIBaseInfo *container,
- GTypelib *typelib,
- guint32 offset)
-{
- GIRealInfo *rinfo = (GIRealInfo*)container;
- SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
-
- _g_info_init ((GIRealInfo*)info, GI_INFO_TYPE_TYPE, rinfo->repository, container, typelib,
- (type->flags.reserved == 0 && type->flags.reserved2 == 0) ? offset : type->offset);
-}
-
-/**
- * g_callable_info_get_return_type:
- * @info: a #GICallableInfo
- *
- * Obtain the return type of a callable item as a #GITypeInfo.
- *
- * Returns: (transfer full): the #GITypeInfo. Free the struct by calling
- * g_base_info_unref() when done.
- */
-GITypeInfo *
-g_callable_info_get_return_type (GICallableInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- guint32 offset;
-
- g_return_val_if_fail (info != NULL, NULL);
- g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
-
- offset = signature_offset (info);
-
- return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, offset);
-}
-
-
-/**
- * g_callable_info_load_return_type:
- * @info: a #GICallableInfo
- * @type: (out caller-allocates): Initialized with return type of @info
- *
- * Obtain information about a return value of callable; this
- * function is a variant of g_callable_info_get_return_type() designed for stack
- * allocation.
- *
- * The initialized @type must not be referenced after @info is deallocated.
- */
-void
-g_callable_info_load_return_type (GICallableInfo *info,
- GITypeInfo *type)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- guint32 offset;
-
- g_return_if_fail (info != NULL);
- g_return_if_fail (GI_IS_CALLABLE_INFO (info));
-
- offset = signature_offset (info);
-
- g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, offset);
-}
-
-/**
- * g_callable_info_may_return_null:
- * @info: a #GICallableInfo
- *
- * See if a callable could return %NULL.
- *
- * Returns: %TRUE if callable could return %NULL
- */
-gboolean
-g_callable_info_may_return_null (GICallableInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- SignatureBlob *blob;
-
- g_return_val_if_fail (info != NULL, FALSE);
- g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), FALSE);
-
- blob = (SignatureBlob *)&rinfo->typelib->data[signature_offset (info)];
-
- return blob->may_return_null;
-}
-
-/**
- * g_callable_info_get_caller_owns:
- * @info: a #GICallableInfo
- *
- * See whether the caller owns the return value of this callable.
- * #GITransfer contains a list of possible transfer values.
- *
- * Returns: %TRUE if the caller owns the return value, %FALSE otherwise.
- */
-GITransfer
-g_callable_info_get_caller_owns (GICallableInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo*) info;
- SignatureBlob *blob;
-
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), -1);
-
- blob = (SignatureBlob *)&rinfo->typelib->data[signature_offset (info)];
-
- if (blob->caller_owns_return_value)
- return GI_TRANSFER_EVERYTHING;
- else if (blob->caller_owns_return_container)
- return GI_TRANSFER_CONTAINER;
- else
- return GI_TRANSFER_NOTHING;
-}
-
-/**
- * g_callable_info_get_n_args:
- * @info: a #GICallableInfo
- *
- * Obtain the number of arguments (both IN and OUT) for this callable.
- *
- * Returns: The number of arguments this callable expects.
- */
-gint
-g_callable_info_get_n_args (GICallableInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- gint offset;
- SignatureBlob *blob;
-
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), -1);
-
- offset = signature_offset (info);
- blob = (SignatureBlob *)&rinfo->typelib->data[offset];
-
- return blob->n_arguments;
-}
-
-/**
- * g_callable_info_get_arg:
- * @info: a #GICallableInfo
- * @n: the argument index to fetch
- *
- * Obtain information about a particular argument of this callable.
- *
- * Returns: (transfer full): the #GIArgInfo. Free it with
- * g_base_info_unref() when done.
- */
-GIArgInfo *
-g_callable_info_get_arg (GICallableInfo *info,
- gint n)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header;
- gint offset;
-
- g_return_val_if_fail (info != NULL, NULL);
- g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
-
- offset = signature_offset (info);
- header = (Header *)rinfo->typelib->data;
-
- return (GIArgInfo *) g_info_new (GI_INFO_TYPE_ARG, (GIBaseInfo*)info, rinfo->typelib,
- offset + header->signature_blob_size + n * header->arg_blob_size);
-}
-
-/**
- * g_callable_info_load_arg:
- * @info: a #GICallableInfo
- * @n: the argument index to fetch
- * @arg: (out caller-allocates): Initialize with argument number @n
- *
- * Obtain information about a particular argument of this callable; this
- * function is a variant of g_callable_info_get_arg() designed for stack
- * allocation.
- *
- * The initialized @arg must not be referenced after @info is deallocated.
- */
-void
-g_callable_info_load_arg (GICallableInfo *info,
- gint n,
- GIArgInfo *arg)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- Header *header;
- gint offset;
-
- g_return_if_fail (info != NULL);
- g_return_if_fail (GI_IS_CALLABLE_INFO (info));
-
- offset = signature_offset (info);
- header = (Header *)rinfo->typelib->data;
-
- _g_info_init ((GIRealInfo*)arg, GI_INFO_TYPE_ARG, rinfo->repository, (GIBaseInfo*)info, rinfo->typelib,
- offset + header->signature_blob_size + n * header->arg_blob_size);
-}
/* GIArgInfo function */
@@ -526,7 +278,7 @@ g_arg_info_get_type (GIArgInfo *info)
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ARG_INFO (info), NULL);
- return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
}
/**
@@ -549,7 +301,7 @@ g_arg_info_load_type (GIArgInfo *info,
g_return_if_fail (info != NULL);
g_return_if_fail (GI_IS_ARG_INFO (info));
- g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
+ _g_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
}
/* GITypeInfo functions */
@@ -663,7 +415,7 @@ g_type_info_get_param_type (GITypeInfo *info,
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
- return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib,
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib,
rinfo->offset + sizeof (ParamTypeBlob)
+ sizeof (SimpleTypeBlob) * n);
break;
@@ -1171,7 +923,7 @@ g_field_info_get_type (GIFieldInfo *info)
type_info->type_is_embedded = TRUE;
}
else
- return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type));
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type));
return (GIBaseInfo*)type_info;
}
@@ -1964,7 +1716,7 @@ 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));
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (PropertyBlob, type));
}
@@ -2107,7 +1859,7 @@ g_constant_info_get_type (GIConstantInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
- return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 8);
}
gint
@@ -2257,7 +2009,7 @@ g_union_info_get_discriminator_type (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
- return g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
+ return _g_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + 24);
}
GIConstantInfo *
diff --git a/girepository/ginfo.h b/girepository/ginfo.h
deleted file mode 100644
index 15138cfb..00000000
--- a/girepository/ginfo.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* GObject introspection: Typelib info functions
- *
- * Copyright (C) 2008 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 __GIRINFO_H__
-#define __GIRINFO_H__
-
-#include "girepository.h"
-
-G_BEGIN_DECLS
-
-GITypeInfo *
-g_type_info_new (GIBaseInfo *container,
- GTypelib *typelib,
- guint32 offset);
-
-GIBaseInfo *
-g_info_new_full (GIInfoType type,
- GIRepository *repository,
- GIBaseInfo *container,
- GTypelib *typelib,
- guint32 offset);
-
-G_END_DECLS
-
-#endif
diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h
index 4ded32b8..52fc749a 100644
--- a/girepository/girepository-private.h
+++ b/girepository/girepository-private.h
@@ -80,5 +80,21 @@ GIBaseInfo * _g_info_from_entry (GIRepository *repository,
GTypelib *typelib,
guint16 index);
+GIBaseInfo * _g_info_new_full (GIInfoType type,
+ GIRepository *repository,
+ GIBaseInfo *container,
+ GTypelib *typelib,
+ guint32 offset);
+
+GITypeInfo * _g_type_info_new (GIBaseInfo *container,
+ GTypelib *typelib,
+ guint32 offset);
+
+void _g_type_info_init (GIBaseInfo *info,
+ GIBaseInfo *container,
+ GTypelib *typelib,
+ guint32 offset);
+
+
#endif /* __GIREPOSITORY_PRIVATE_H__ */
diff --git a/girepository/girepository.c b/girepository/girepository.c
index f06270eb..66a604eb 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -30,7 +30,7 @@
#include <gmodule.h>
#include "girepository.h"
#include "gitypelib-internal.h"
-#include "ginfo.h"
+#include "girepository-private.h"
#include "glib-compat.h"
#include "config.h"
@@ -606,9 +606,9 @@ find_interface (gpointer key,
if (index != 0)
{
entry = g_typelib_get_dir_entry (typelib, index);
- iface_data->iface = g_info_new_full (entry->blob_type,
- iface_data->repo,
- NULL, typelib, entry->offset);
+ iface_data->iface = _g_info_new_full (entry->blob_type,
+ iface_data->repo,
+ NULL, typelib, entry->offset);
}
}
diff --git a/girepository/girepository.h b/girepository/girepository.h
index 7ddb70f5..543dab44 100644
--- a/girepository/girepository.h
+++ b/girepository/girepository.h
@@ -27,6 +27,7 @@
#include <glib-object.h>
#include <gmodule.h>
#include <gibaseinfo.h>
+#include <gicallableinfo.h>
#include <gifunctioninfo.h>
#include <gitypelib.h>
#include <gitypes.h>
@@ -145,41 +146,6 @@ void gi_cclosure_marshal_generic (GClosure *closure,
gpointer invocation_hint,
gpointer marshal_data);
-/* GICallableInfo */
-
-#define GI_IS_CALLABLE_INFO(info) \
- ((g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_FUNCTION) || \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_CALLBACK) || \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_SIGNAL) || \
- (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_VFUNC))
-
-/**
- * GITransfer:
- * @GI_TRANSFER_NOTHING: transfer nothing to the caller
- * @GI_TRANSFER_CONTAINER: transfer the container (eg list, array,
- * hashtable), but no the contents to the caller.
- * @GI_TRANSFER_EVERYTHING: transfer everything to the caller.
- *
- * Represent the transfer ownership information of a #GICallableInfo or
- * a #GIArgInfo.
- */
-typedef enum {
- GI_TRANSFER_NOTHING,
- GI_TRANSFER_CONTAINER,
- GI_TRANSFER_EVERYTHING
-} GITransfer;
-
-GITypeInfo * g_callable_info_get_return_type (GICallableInfo *info);
-void g_callable_info_load_return_type (GICallableInfo *info,
- GITypeInfo *type);
-GITransfer g_callable_info_get_caller_owns (GICallableInfo *info);
-gboolean g_callable_info_may_return_null (GICallableInfo *info);
-gint g_callable_info_get_n_args (GICallableInfo *info);
-GIArgInfo * g_callable_info_get_arg (GICallableInfo *info,
- gint n);
-void g_callable_info_load_arg (GICallableInfo *info,
- gint n,
- GIArgInfo *arg);
/* GIArgInfo */
diff --git a/girepository/gitypes.h b/girepository/gitypes.h
index 49fe017d..424e4ebf 100644
--- a/girepository/gitypes.h
+++ b/girepository/gitypes.h
@@ -243,6 +243,22 @@ typedef enum
GI_INFO_TYPE_UNRESOLVED
} GIInfoType;
+/**
+ * GITransfer:
+ * @GI_TRANSFER_NOTHING: transfer nothing to the caller
+ * @GI_TRANSFER_CONTAINER: transfer the container (eg list, array,
+ * hashtable), but no the contents to the caller.
+ * @GI_TRANSFER_EVERYTHING: transfer everything to the caller.
+ *
+ * Represent the transfer ownership information of a #GICallableInfo or
+ * a #GIArgInfo.
+ */
+typedef enum {
+ GI_TRANSFER_NOTHING,
+ GI_TRANSFER_CONTAINER,
+ GI_TRANSFER_EVERYTHING
+} GITransfer;
+
G_END_DECLS