[gobject-introspection] [girepository] Move GICallableInfo out of ginfo.ch



commit 6039032537282a8f33ffb13c640bb824b5296650
Author: Johan Dahlin <johan gnome org>
Date:   Sat Jun 5 12:11:58 2010 -0300

    [girepository] Move GICallableInfo out of ginfo.ch

 girepository/Makefile.am            |    3 +-
 girepository/gibaseinfo.c           |   41 +++++-
 girepository/gibaseinfo.h           |    1 -
 girepository/gicallableinfo.c       |  251 +++++++++++++++++++++++++++++++++
 girepository/gicallableinfo.h       |   54 +++++++
 girepository/ginfo.c                |  262 +----------------------------------
 girepository/ginfo.h                |   42 ------
 girepository/girepository-private.h |   16 ++
 girepository/girepository.c         |    8 +-
 girepository/girepository.h         |   36 +-----
 girepository/gitypes.h              |   16 ++
 11 files changed, 384 insertions(+), 346 deletions(-)
---
diff --git a/girepository/Makefile.am b/girepository/Makefile.am
index 09fc0ee..b173dba 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 2f71449..e128a9a 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 c6175c3..79f50ce 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 0000000..5013c5d
--- /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 0000000..c122bd5
--- /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 0c717cf..7a6ecbf 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/girepository-private.h b/girepository/girepository-private.h
index 4ded32b..52fc749 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 f06270e..66a604e 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 7ddb70f..543dab4 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 49fe017..424e4eb 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
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]