2008-02-08 16:31:03 +01:00
|
|
|
/* GObject introspection: Repository
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Matthias Clasen
|
2009-02-20 03:48:51 +01:00
|
|
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
2008-02-08 16:31:03 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __G_IREPOSITORY_H__
|
|
|
|
#define __G_IREPOSITORY_H__
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <gmodule.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2009-12-08 00:35:06 +01:00
|
|
|
#define G_TYPE_IREPOSITORY (g_irepository_get_type ())
|
|
|
|
#define G_IREPOSITORY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_IREPOSITORY, GIRepository))
|
|
|
|
#define G_IREPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_IREPOSITORY, GIRepositoryClass))
|
|
|
|
#define G_IS_IREPOSITORY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_IREPOSITORY))
|
|
|
|
#define G_IS_IREPOSITORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_IREPOSITORY))
|
|
|
|
#define G_IREPOSITORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G_TYPE_IREPOSITORY, GIRepositoryClass))
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
typedef struct _GIRepository GIRepository;
|
|
|
|
typedef struct _GIRepositoryClass GIRepositoryClass;
|
|
|
|
typedef struct _GIRepositoryPrivate GIRepositoryPrivate;
|
2009-12-08 00:35:06 +01:00
|
|
|
|
|
|
|
typedef struct _GIBaseInfoStub GIBaseInfo;
|
|
|
|
|
|
|
|
struct _GIBaseInfoStub {
|
|
|
|
gint32 dummy1;
|
|
|
|
gint32 dummy2;
|
|
|
|
gpointer dummy3;
|
|
|
|
gpointer dummy4;
|
|
|
|
gpointer dummy5;
|
|
|
|
guint32 dummy6;
|
|
|
|
guint32 dummy7;
|
|
|
|
gpointer padding[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef GIBaseInfo GICallableInfo;
|
|
|
|
typedef GIBaseInfo GIFunctionInfo;
|
|
|
|
typedef GIBaseInfo GICallbackInfo;
|
|
|
|
typedef GIBaseInfo GIRegisteredTypeInfo;
|
|
|
|
typedef GIBaseInfo GIStructInfo;
|
|
|
|
typedef GIBaseInfo GIUnionInfo;
|
|
|
|
typedef GIBaseInfo GIEnumInfo;
|
|
|
|
typedef GIBaseInfo GIObjectInfo;
|
|
|
|
typedef GIBaseInfo GIInterfaceInfo;
|
|
|
|
typedef GIBaseInfo GIConstantInfo;
|
|
|
|
typedef GIBaseInfo GIValueInfo;
|
|
|
|
typedef GIBaseInfo GISignalInfo;
|
|
|
|
typedef GIBaseInfo GIVFuncInfo;
|
|
|
|
typedef GIBaseInfo GIPropertyInfo;
|
|
|
|
typedef GIBaseInfo GIFieldInfo;
|
|
|
|
typedef GIBaseInfo GIArgInfo;
|
|
|
|
typedef GIBaseInfo GITypeInfo;
|
|
|
|
typedef GIBaseInfo GIErrorDomainInfo;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
typedef struct _GIUnresolvedInfo GIUnresolvedInfo;
|
2008-06-08 16:37:30 +02:00
|
|
|
typedef struct _GTypelib GTypelib;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
struct _GIRepository
|
|
|
|
{
|
2009-12-08 00:35:06 +01:00
|
|
|
GObject parent;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
GIRepositoryPrivate *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIRepositoryClass
|
2010-03-24 19:00:06 +01:00
|
|
|
{
|
|
|
|
GObjectClass parent;
|
2008-02-08 16:31:03 +01:00
|
|
|
};
|
|
|
|
|
2008-08-30 22:31:12 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
G_IREPOSITORY_LOAD_FLAG_LAZY = 1 << 0
|
|
|
|
} GIRepositoryLoadFlags;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* Repository */
|
|
|
|
|
|
|
|
GType g_irepository_get_type (void) G_GNUC_CONST;
|
|
|
|
GIRepository *g_irepository_get_default (void);
|
2008-08-30 22:31:07 +02:00
|
|
|
void g_irepository_prepend_search_path (const char *directory);
|
2008-11-12 13:40:34 +01:00
|
|
|
GSList * g_irepository_get_search_path (void);
|
2008-08-30 22:31:07 +02:00
|
|
|
const char * g_irepository_load_typelib (GIRepository *repository,
|
|
|
|
GTypelib *typelib,
|
2008-08-30 22:31:12 +02:00
|
|
|
GIRepositoryLoadFlags flags,
|
2008-08-30 22:31:07 +02:00
|
|
|
GError **error);
|
2008-10-13 18:59:09 +02:00
|
|
|
gboolean g_irepository_is_registered (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_,
|
2008-10-12 06:51:48 +02:00
|
|
|
const gchar *version);
|
2008-02-08 16:31:03 +01:00
|
|
|
GIBaseInfo * g_irepository_find_by_name (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_,
|
2008-02-08 16:31:03 +01:00
|
|
|
const gchar *name);
|
2008-10-25 17:48:50 +02:00
|
|
|
GTypelib * g_irepository_require (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_,
|
2008-10-13 18:59:09 +02:00
|
|
|
const gchar *version,
|
2008-08-30 22:31:12 +02:00
|
|
|
GIRepositoryLoadFlags flags,
|
2008-08-21 01:56:40 +02:00
|
|
|
GError **error);
|
2008-08-30 22:31:07 +02:00
|
|
|
gchar ** g_irepository_get_dependencies (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_);
|
2008-10-12 06:51:48 +02:00
|
|
|
gchar ** g_irepository_get_loaded_namespaces (GIRepository *repository);
|
2008-02-08 16:31:03 +01:00
|
|
|
GIBaseInfo * g_irepository_find_by_gtype (GIRepository *repository,
|
|
|
|
GType gtype);
|
|
|
|
gint g_irepository_get_n_infos (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_);
|
2008-02-08 16:31:03 +01:00
|
|
|
GIBaseInfo * g_irepository_get_info (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_,
|
2008-02-08 16:31:03 +01:00
|
|
|
gint index);
|
2008-08-21 05:06:13 +02:00
|
|
|
const gchar * g_irepository_get_typelib_path (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_);
|
2008-02-08 16:31:03 +01:00
|
|
|
const gchar * g_irepository_get_shared_library (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_);
|
2009-02-13 00:42:47 +01:00
|
|
|
const gchar * g_irepository_get_c_prefix (GIRepository *repository,
|
|
|
|
const gchar *namespace_);
|
2008-10-12 06:51:48 +02:00
|
|
|
const gchar * g_irepository_get_version (GIRepository *repository,
|
2009-02-10 22:01:08 +01:00
|
|
|
const gchar *namespace_);
|
2008-10-12 06:51:48 +02:00
|
|
|
|
2008-11-13 20:57:09 +01:00
|
|
|
GOptionGroup * g_irepository_get_option_group (void);
|
|
|
|
|
|
|
|
gboolean g_irepository_dump (const char *arg, GError **error);
|
|
|
|
|
2008-08-09 14:55:32 +02:00
|
|
|
/* Typelib */
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2008-06-08 16:37:30 +02:00
|
|
|
GTypelib * g_typelib_new_from_memory (guchar *memory,
|
2008-02-08 16:31:03 +01:00
|
|
|
gsize len);
|
2008-06-08 16:37:30 +02:00
|
|
|
GTypelib * g_typelib_new_from_const_memory (const guchar *memory,
|
2008-02-08 16:31:03 +01:00
|
|
|
gsize len);
|
2008-06-08 16:37:30 +02:00
|
|
|
GTypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile);
|
2008-08-09 14:55:32 +02:00
|
|
|
void g_typelib_free (GTypelib *typelib);
|
2008-10-12 06:51:48 +02:00
|
|
|
|
2008-10-07 23:25:01 +02:00
|
|
|
gboolean g_typelib_symbol (GTypelib *typelib,
|
|
|
|
const gchar *symbol_name,
|
|
|
|
gpointer *symbol);
|
2008-08-09 14:55:32 +02:00
|
|
|
const gchar * g_typelib_get_namespace (GTypelib *typelib);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2008-08-09 14:55:32 +02:00
|
|
|
G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
2008-02-08 16:31:03 +01:00
|
|
|
G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH,
|
2008-10-12 06:51:48 +02:00
|
|
|
G_IREPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
|
2008-02-08 16:31:03 +01:00
|
|
|
G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND
|
|
|
|
} GIRepositoryError;
|
|
|
|
|
|
|
|
#define G_IREPOSITORY_ERROR (g_irepository_error_quark ())
|
|
|
|
|
|
|
|
GQuark g_irepository_error_quark (void);
|
|
|
|
|
|
|
|
|
2009-01-12 22:31:43 +01:00
|
|
|
/* Global utility functions */
|
|
|
|
|
|
|
|
void gi_cclosure_marshal_generic (GClosure *closure,
|
|
|
|
GValue *return_gvalue,
|
|
|
|
guint n_param_values,
|
|
|
|
const GValue *param_values,
|
|
|
|
gpointer invocation_hint,
|
|
|
|
gpointer marshal_data);
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
/* Types of objects registered in the repository */
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
typedef enum
|
2008-02-08 16:31:03 +01:00
|
|
|
{
|
|
|
|
GI_INFO_TYPE_INVALID,
|
|
|
|
GI_INFO_TYPE_FUNCTION,
|
|
|
|
GI_INFO_TYPE_CALLBACK,
|
|
|
|
GI_INFO_TYPE_STRUCT,
|
|
|
|
GI_INFO_TYPE_BOXED,
|
2009-11-09 19:17:23 +01:00
|
|
|
GI_INFO_TYPE_ENUM, /* 5 */
|
2008-02-08 16:31:03 +01:00
|
|
|
GI_INFO_TYPE_FLAGS,
|
|
|
|
GI_INFO_TYPE_OBJECT,
|
|
|
|
GI_INFO_TYPE_INTERFACE,
|
|
|
|
GI_INFO_TYPE_CONSTANT,
|
2009-11-09 19:17:23 +01:00
|
|
|
GI_INFO_TYPE_ERROR_DOMAIN, /* 10 */
|
2008-02-08 16:31:03 +01:00
|
|
|
GI_INFO_TYPE_UNION,
|
|
|
|
GI_INFO_TYPE_VALUE,
|
|
|
|
GI_INFO_TYPE_SIGNAL,
|
|
|
|
GI_INFO_TYPE_VFUNC,
|
2009-11-09 19:17:23 +01:00
|
|
|
GI_INFO_TYPE_PROPERTY, /* 15 */
|
2008-02-08 16:31:03 +01:00
|
|
|
GI_INFO_TYPE_FIELD,
|
|
|
|
GI_INFO_TYPE_ARG,
|
2008-08-30 22:31:16 +02:00
|
|
|
GI_INFO_TYPE_TYPE,
|
|
|
|
GI_INFO_TYPE_UNRESOLVED
|
2008-02-08 16:31:03 +01:00
|
|
|
} GIInfoType;
|
|
|
|
|
|
|
|
|
|
|
|
/* GIBaseInfo */
|
|
|
|
|
2009-02-20 03:48:51 +01:00
|
|
|
typedef struct {
|
|
|
|
gpointer data;
|
|
|
|
gpointer data2;
|
|
|
|
gpointer data3;
|
|
|
|
gpointer data4;
|
|
|
|
} GIAttributeIter;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
GIBaseInfo * g_base_info_ref (GIBaseInfo *info);
|
|
|
|
void g_base_info_unref (GIBaseInfo *info);
|
|
|
|
GIInfoType g_base_info_get_type (GIBaseInfo *info);
|
|
|
|
const gchar * g_base_info_get_name (GIBaseInfo *info);
|
|
|
|
const gchar * g_base_info_get_namespace (GIBaseInfo *info);
|
|
|
|
gboolean g_base_info_is_deprecated (GIBaseInfo *info);
|
2009-02-20 03:48:51 +01:00
|
|
|
const gchar * g_base_info_get_attribute (GIBaseInfo *info,
|
2008-02-08 16:31:03 +01:00
|
|
|
const gchar *name);
|
2009-02-20 03:48:51 +01:00
|
|
|
gboolean g_base_info_iterate_attributes (GIBaseInfo *info,
|
|
|
|
GIAttributeIter *iterator,
|
|
|
|
char **name,
|
|
|
|
char **value);
|
2008-02-08 16:31:03 +01:00
|
|
|
GIBaseInfo * g_base_info_get_container (GIBaseInfo *info);
|
2008-08-09 14:55:32 +02:00
|
|
|
GTypelib * g_base_info_get_typelib (GIBaseInfo *info);
|
2009-11-20 10:38:36 +01:00
|
|
|
gboolean g_base_info_equal (GIBaseInfo *info1,
|
|
|
|
GIBaseInfo *info2);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2008-08-09 14:55:32 +02:00
|
|
|
GIBaseInfo * g_info_new (GIInfoType type,
|
|
|
|
GIBaseInfo *container,
|
2010-03-24 19:00:06 +01:00
|
|
|
GTypelib *typelib,
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 offset);
|
|
|
|
|
|
|
|
|
|
|
|
/* GIFunctionInfo */
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GI_FUNCTION_IS_METHOD = 1 << 0,
|
|
|
|
GI_FUNCTION_IS_CONSTRUCTOR = 1 << 1,
|
|
|
|
GI_FUNCTION_IS_GETTER = 1 << 2,
|
|
|
|
GI_FUNCTION_IS_SETTER = 1 << 3,
|
2008-10-21 19:04:11 +02:00
|
|
|
GI_FUNCTION_WRAPS_VFUNC = 1 << 4,
|
|
|
|
GI_FUNCTION_THROWS = 1 << 5
|
2008-02-08 16:31:03 +01:00
|
|
|
} GIFunctionInfoFlags;
|
|
|
|
|
|
|
|
const gchar * g_function_info_get_symbol (GIFunctionInfo *info);
|
|
|
|
GIFunctionInfoFlags g_function_info_get_flags (GIFunctionInfo *info);
|
|
|
|
GIPropertyInfo * g_function_info_get_property (GIFunctionInfo *info);
|
|
|
|
GIVFuncInfo * g_function_info_get_vfunc (GIFunctionInfo *info);
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
typedef union
|
2008-02-08 16:31:03 +01:00
|
|
|
{
|
|
|
|
gboolean v_boolean;
|
|
|
|
gint8 v_int8;
|
|
|
|
guint8 v_uint8;
|
|
|
|
gint16 v_int16;
|
|
|
|
guint16 v_uint16;
|
|
|
|
gint32 v_int32;
|
|
|
|
guint32 v_uint32;
|
|
|
|
gint64 v_int64;
|
|
|
|
guint64 v_uint64;
|
|
|
|
gfloat v_float;
|
|
|
|
gdouble v_double;
|
2009-06-20 01:53:03 +02:00
|
|
|
gshort v_short;
|
|
|
|
gushort v_ushort;
|
2008-02-08 16:31:03 +01:00
|
|
|
gint v_int;
|
|
|
|
guint v_uint;
|
|
|
|
glong v_long;
|
|
|
|
gulong v_ulong;
|
|
|
|
gssize v_ssize;
|
|
|
|
gsize v_size;
|
|
|
|
gchar * v_string;
|
|
|
|
gpointer v_pointer;
|
|
|
|
} GArgument;
|
|
|
|
|
|
|
|
#define G_INVOKE_ERROR (g_invoke_error_quark ())
|
|
|
|
GQuark g_invoke_error_quark (void);
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
G_INVOKE_ERROR_FAILED,
|
|
|
|
G_INVOKE_ERROR_SYMBOL_NOT_FOUND,
|
|
|
|
G_INVOKE_ERROR_ARGUMENT_MISMATCH
|
|
|
|
} GInvokeError;
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
gboolean g_function_info_invoke (GIFunctionInfo *info,
|
2008-02-08 16:31:03 +01:00
|
|
|
const GArgument *in_args,
|
|
|
|
int n_in_args,
|
|
|
|
const GArgument *out_args,
|
|
|
|
int n_out_args,
|
|
|
|
GArgument *return_value,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
|
|
/* GICallableInfo */
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
GI_TRANSFER_NOTHING,
|
|
|
|
GI_TRANSFER_CONTAINER,
|
|
|
|
GI_TRANSFER_EVERYTHING
|
|
|
|
} GITransfer;
|
|
|
|
|
|
|
|
GITypeInfo * g_callable_info_get_return_type (GICallableInfo *info);
|
2009-12-08 00:35:06 +01:00
|
|
|
void g_callable_info_load_return_type (GICallableInfo *info,
|
|
|
|
GITypeInfo *type);
|
2008-02-08 16:31:03 +01:00
|
|
|
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,
|
2009-12-08 00:35:06 +01:00
|
|
|
gint n);
|
|
|
|
void g_callable_info_load_arg (GICallableInfo *info,
|
|
|
|
gint n,
|
|
|
|
GIArgInfo *arg);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* GIArgInfo */
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
GI_DIRECTION_IN,
|
|
|
|
GI_DIRECTION_OUT,
|
|
|
|
GI_DIRECTION_INOUT
|
|
|
|
} GIDirection;
|
|
|
|
|
Bug 556489 – callback annotations
2008-01-03 Andreas Rottmann <a.rottmann@gmx.at>
Bug 556489 – callback annotations
* giscanner/transformer.py
* tools/generate.c (write_callable_info): Write out the new scope,
closure and destroy attributes.
* giscanner/transformer.py (Transformer._type_is_callback): New
method, checking if a given type is a callback.
(Transformer._augment_callback_params): New method; adds
information (closure, destroy) to callback parameters.
(Transformer._handle_closure, Transformer._handle_destroy): New methods,
auxiliary to _augment_callback_params.
(Transformer._create_function): Call _augment_callback_params().
(Transformer._create_parameter): Handle scope option.
(Transformer._create_typedef_callback): New method, creates a
callback, and registers it in the typedef namespace
(Transformer._create_typedef): Use _create_typedef_callback()
instead of the plain _create_callback().
* giscanner/ast.py (Parameter): Added callback-related fields.
* giscanner/girwriter.py: Write out new Parameter fields.
* girepository/girnode.h (GIrNodeParam): Added fields scope,
closure and destroy.
* girepository/gtypelib.h (ArgBlob): Ditto.
* girepository/girparser.c (start_parameter): Handle new fields.
* girepository/girmodule.c (g_ir_module_build_typelib): Adjust
arg_blob_size, bump major version due to this change.
* girepository/girnode.c (g_ir_node_get_full_size_internal)
(g_ir_node_build_typelib)
* girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size
adjustments.
(g_ir_node_build_typelib): Fill in new ArgBlob flags from param.
* girepository/girepository.h (GIScope): New enumeration, listing
the different possible scopes for callbacks.
* girepository/ginfo.c (g_arg_info_get_scope)
(g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for
callback-related argument indices (callback scope, closure for a
callback, destroy notification for a callback).
* tests/scanner/: Added testcases for new features.
svn path=/trunk/; revision=998
2009-01-03 14:44:42 +01:00
|
|
|
typedef enum {
|
2009-02-12 02:46:59 +01:00
|
|
|
GI_SCOPE_TYPE_INVALID, /* The argument is not of callback type */
|
|
|
|
GI_SCOPE_TYPE_CALL, /* The callback and associated user_data is only used during the
|
|
|
|
call to this function */
|
2010-03-24 19:00:06 +01:00
|
|
|
GI_SCOPE_TYPE_ASYNC, /* The callback and associated user_data is
|
|
|
|
only used until the callback is invoked, and the callback
|
2009-02-12 02:46:59 +01:00
|
|
|
is invoked always exactly once. */
|
|
|
|
GI_SCOPE_TYPE_NOTIFIED /* The callback and and associated user_data is
|
|
|
|
used until the caller is notfied via the destroy_notify */
|
Bug 556489 – callback annotations
2008-01-03 Andreas Rottmann <a.rottmann@gmx.at>
Bug 556489 – callback annotations
* giscanner/transformer.py
* tools/generate.c (write_callable_info): Write out the new scope,
closure and destroy attributes.
* giscanner/transformer.py (Transformer._type_is_callback): New
method, checking if a given type is a callback.
(Transformer._augment_callback_params): New method; adds
information (closure, destroy) to callback parameters.
(Transformer._handle_closure, Transformer._handle_destroy): New methods,
auxiliary to _augment_callback_params.
(Transformer._create_function): Call _augment_callback_params().
(Transformer._create_parameter): Handle scope option.
(Transformer._create_typedef_callback): New method, creates a
callback, and registers it in the typedef namespace
(Transformer._create_typedef): Use _create_typedef_callback()
instead of the plain _create_callback().
* giscanner/ast.py (Parameter): Added callback-related fields.
* giscanner/girwriter.py: Write out new Parameter fields.
* girepository/girnode.h (GIrNodeParam): Added fields scope,
closure and destroy.
* girepository/gtypelib.h (ArgBlob): Ditto.
* girepository/girparser.c (start_parameter): Handle new fields.
* girepository/girmodule.c (g_ir_module_build_typelib): Adjust
arg_blob_size, bump major version due to this change.
* girepository/girnode.c (g_ir_node_get_full_size_internal)
(g_ir_node_build_typelib)
* girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size
adjustments.
(g_ir_node_build_typelib): Fill in new ArgBlob flags from param.
* girepository/girepository.h (GIScope): New enumeration, listing
the different possible scopes for callbacks.
* girepository/ginfo.c (g_arg_info_get_scope)
(g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for
callback-related argument indices (callback scope, closure for a
callback, destroy notification for a callback).
* tests/scanner/: Added testcases for new features.
svn path=/trunk/; revision=998
2009-01-03 14:44:42 +01:00
|
|
|
} GIScopeType;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
GIDirection g_arg_info_get_direction (GIArgInfo *info);
|
|
|
|
gboolean g_arg_info_is_dipper (GIArgInfo *info);
|
|
|
|
gboolean g_arg_info_is_return_value (GIArgInfo *info);
|
|
|
|
gboolean g_arg_info_is_optional (GIArgInfo *info);
|
|
|
|
gboolean g_arg_info_may_be_null (GIArgInfo *info);
|
|
|
|
GITransfer g_arg_info_get_ownership_transfer (GIArgInfo *info);
|
Bug 556489 – callback annotations
2008-01-03 Andreas Rottmann <a.rottmann@gmx.at>
Bug 556489 – callback annotations
* giscanner/transformer.py
* tools/generate.c (write_callable_info): Write out the new scope,
closure and destroy attributes.
* giscanner/transformer.py (Transformer._type_is_callback): New
method, checking if a given type is a callback.
(Transformer._augment_callback_params): New method; adds
information (closure, destroy) to callback parameters.
(Transformer._handle_closure, Transformer._handle_destroy): New methods,
auxiliary to _augment_callback_params.
(Transformer._create_function): Call _augment_callback_params().
(Transformer._create_parameter): Handle scope option.
(Transformer._create_typedef_callback): New method, creates a
callback, and registers it in the typedef namespace
(Transformer._create_typedef): Use _create_typedef_callback()
instead of the plain _create_callback().
* giscanner/ast.py (Parameter): Added callback-related fields.
* giscanner/girwriter.py: Write out new Parameter fields.
* girepository/girnode.h (GIrNodeParam): Added fields scope,
closure and destroy.
* girepository/gtypelib.h (ArgBlob): Ditto.
* girepository/girparser.c (start_parameter): Handle new fields.
* girepository/girmodule.c (g_ir_module_build_typelib): Adjust
arg_blob_size, bump major version due to this change.
* girepository/girnode.c (g_ir_node_get_full_size_internal)
(g_ir_node_build_typelib)
* girepository/gtypelib.c (g_typelib_check_sanity): ArgBlob size
adjustments.
(g_ir_node_build_typelib): Fill in new ArgBlob flags from param.
* girepository/girepository.h (GIScope): New enumeration, listing
the different possible scopes for callbacks.
* girepository/ginfo.c (g_arg_info_get_scope)
(g_arg_info_get_closure, g_arg_info_get_destroy): Accessors for
callback-related argument indices (callback scope, closure for a
callback, destroy notification for a callback).
* tests/scanner/: Added testcases for new features.
svn path=/trunk/; revision=998
2009-01-03 14:44:42 +01:00
|
|
|
GIScopeType g_arg_info_get_scope (GIArgInfo *info);
|
|
|
|
gint g_arg_info_get_closure (GIArgInfo *info);
|
|
|
|
gint g_arg_info_get_destroy (GIArgInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
GITypeInfo * g_arg_info_get_type (GIArgInfo *info);
|
2009-12-08 00:35:06 +01:00
|
|
|
void g_arg_info_load_type (GIArgInfo *info,
|
|
|
|
GITypeInfo *type);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* GITypeInfo */
|
|
|
|
|
|
|
|
typedef enum {
|
2008-10-02 15:25:46 +02:00
|
|
|
/* Basic types */
|
2008-02-08 16:31:03 +01:00
|
|
|
GI_TYPE_TAG_VOID = 0,
|
|
|
|
GI_TYPE_TAG_BOOLEAN = 1,
|
|
|
|
GI_TYPE_TAG_INT8 = 2,
|
|
|
|
GI_TYPE_TAG_UINT8 = 3,
|
|
|
|
GI_TYPE_TAG_INT16 = 4,
|
2010-03-24 19:00:06 +01:00
|
|
|
GI_TYPE_TAG_UINT16 = 5,
|
2008-02-08 16:31:03 +01:00
|
|
|
GI_TYPE_TAG_INT32 = 6,
|
|
|
|
GI_TYPE_TAG_UINT32 = 7,
|
|
|
|
GI_TYPE_TAG_INT64 = 8,
|
|
|
|
GI_TYPE_TAG_UINT64 = 9,
|
2009-06-20 01:53:03 +02:00
|
|
|
GI_TYPE_TAG_SHORT = 10,
|
|
|
|
GI_TYPE_TAG_USHORT = 11,
|
|
|
|
GI_TYPE_TAG_INT = 12,
|
|
|
|
GI_TYPE_TAG_UINT = 13,
|
|
|
|
GI_TYPE_TAG_LONG = 14,
|
|
|
|
GI_TYPE_TAG_ULONG = 15,
|
|
|
|
GI_TYPE_TAG_SSIZE = 16,
|
|
|
|
GI_TYPE_TAG_SIZE = 17,
|
|
|
|
GI_TYPE_TAG_FLOAT = 18,
|
|
|
|
GI_TYPE_TAG_DOUBLE = 19,
|
|
|
|
GI_TYPE_TAG_TIME_T = 20,
|
|
|
|
GI_TYPE_TAG_GTYPE = 21,
|
|
|
|
GI_TYPE_TAG_UTF8 = 22,
|
|
|
|
GI_TYPE_TAG_FILENAME = 23,
|
2008-10-02 15:25:46 +02:00
|
|
|
/* Non-basic types */
|
2009-06-20 01:53:03 +02:00
|
|
|
GI_TYPE_TAG_ARRAY = 24,
|
|
|
|
GI_TYPE_TAG_INTERFACE = 25,
|
|
|
|
GI_TYPE_TAG_GLIST = 26,
|
|
|
|
GI_TYPE_TAG_GSLIST = 27,
|
|
|
|
GI_TYPE_TAG_GHASH = 28,
|
|
|
|
GI_TYPE_TAG_ERROR = 29
|
2008-10-02 15:25:46 +02:00
|
|
|
/* Note - there is only room currently for 32 tags.
|
|
|
|
* See docs/typelib-format.txt SimpleTypeBlob definition */
|
2008-02-08 16:31:03 +01:00
|
|
|
} GITypeTag;
|
|
|
|
|
2010-05-04 16:57:51 +02:00
|
|
|
typedef enum {
|
|
|
|
GI_ARRAY_TYPE_C,
|
|
|
|
GI_ARRAY_TYPE_ARRAY,
|
|
|
|
GI_ARRAY_TYPE_PTR_ARRAY,
|
|
|
|
GI_ARRAY_TYPE_BYTE_ARRAY
|
|
|
|
} GIArrayType;
|
|
|
|
|
2008-10-02 15:25:46 +02:00
|
|
|
#define G_TYPE_TAG_IS_BASIC(tag) (tag < GI_TYPE_TAG_ARRAY)
|
|
|
|
|
2008-08-18 10:52:47 +02:00
|
|
|
const gchar* g_type_tag_to_string (GITypeTag type);
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
gboolean g_type_info_is_pointer (GITypeInfo *info);
|
|
|
|
GITypeTag g_type_info_get_tag (GITypeInfo *info);
|
|
|
|
GITypeInfo * g_type_info_get_param_type (GITypeInfo *info,
|
|
|
|
gint n);
|
|
|
|
GIBaseInfo * g_type_info_get_interface (GITypeInfo *info);
|
|
|
|
gint g_type_info_get_array_length (GITypeInfo *info);
|
2008-10-25 17:20:54 +02:00
|
|
|
gint g_type_info_get_array_fixed_size(GITypeInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
gboolean g_type_info_is_zero_terminated (GITypeInfo *info);
|
2010-05-04 16:57:51 +02:00
|
|
|
GIArrayType g_type_info_get_array_type (GITypeInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
gint g_type_info_get_n_error_domains (GITypeInfo *info);
|
|
|
|
GIErrorDomainInfo *g_type_info_get_error_domain (GITypeInfo *info,
|
|
|
|
gint n);
|
|
|
|
|
|
|
|
/* GIErrorDomainInfo */
|
|
|
|
|
|
|
|
const gchar * g_error_domain_info_get_quark (GIErrorDomainInfo *info);
|
|
|
|
GIInterfaceInfo * g_error_domain_info_get_codes (GIErrorDomainInfo *info);
|
|
|
|
|
|
|
|
|
|
|
|
/* GIValueInfo */
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
glong g_value_info_get_value (GIValueInfo *info);
|
|
|
|
|
|
|
|
|
|
|
|
/* GIFieldInfo */
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GI_FIELD_IS_READABLE = 1 << 0,
|
|
|
|
GI_FIELD_IS_WRITABLE = 1 << 1
|
|
|
|
} GIFieldInfoFlags;
|
|
|
|
|
|
|
|
GIFieldInfoFlags g_field_info_get_flags (GIFieldInfo *info);
|
|
|
|
gint g_field_info_get_size (GIFieldInfo *info);
|
|
|
|
gint g_field_info_get_offset (GIFieldInfo *info);
|
|
|
|
GITypeInfo * g_field_info_get_type (GIFieldInfo *info);
|
|
|
|
|
2008-11-16 22:14:19 +01:00
|
|
|
gboolean g_field_info_get_field (GIFieldInfo *field_info,
|
|
|
|
gpointer mem,
|
|
|
|
GArgument *value);
|
|
|
|
gboolean g_field_info_set_field (GIFieldInfo *field_info,
|
|
|
|
gpointer mem,
|
|
|
|
const GArgument *value);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* GIUnionInfo */
|
|
|
|
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);
|
2008-10-15 00:25:13 +02:00
|
|
|
GIFunctionInfo * g_union_info_find_method (GIUnionInfo *info,
|
|
|
|
const gchar *name);
|
2008-11-16 22:15:54 +01:00
|
|
|
gsize g_union_info_get_size (GIUnionInfo *info);
|
|
|
|
gsize g_union_info_get_alignment (GIUnionInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* GIStructInfo */
|
|
|
|
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);
|
2008-11-16 22:15:54 +01:00
|
|
|
gsize g_struct_info_get_size (GIStructInfo *info);
|
|
|
|
gsize g_struct_info_get_alignment (GIStructInfo *info);
|
2009-02-20 23:34:20 +01:00
|
|
|
gboolean g_struct_info_is_gtype_struct (GIStructInfo *info);
|
2010-03-26 03:12:12 +01:00
|
|
|
gboolean g_struct_info_is_foreign (GIStructInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* GIRegisteredTypeInfo */
|
|
|
|
|
|
|
|
const gchar * g_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
|
|
|
|
const gchar * g_registered_type_info_get_type_init (GIRegisteredTypeInfo *info);
|
2008-04-23 02:57:48 +02:00
|
|
|
GType g_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* GIEnumInfo */
|
|
|
|
|
|
|
|
gint g_enum_info_get_n_values (GIEnumInfo *info);
|
|
|
|
GIValueInfo * g_enum_info_get_value (GIEnumInfo *info,
|
|
|
|
gint n);
|
2008-11-18 13:29:10 +01:00
|
|
|
GITypeTag g_enum_info_get_storage_type (GIEnumInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* GIObjectInfo */
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
const gchar * g_object_info_get_type_name (GIObjectInfo *info);
|
|
|
|
const gchar * g_object_info_get_type_init (GIObjectInfo *info);
|
2008-10-20 19:04:17 +02:00
|
|
|
gboolean g_object_info_get_abstract (GIObjectInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
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);
|
2009-02-28 01:02:48 +01:00
|
|
|
GIVFuncInfo * g_object_info_find_vfunc (GIObjectInfo *info,
|
|
|
|
const gchar *name);
|
2008-02-08 16:31:03 +01:00
|
|
|
gint g_object_info_get_n_constants (GIObjectInfo *info);
|
|
|
|
GIConstantInfo * g_object_info_get_constant (GIObjectInfo *info,
|
|
|
|
gint n);
|
2009-02-06 19:37:13 +01:00
|
|
|
GIStructInfo * g_object_info_get_class_struct (GIObjectInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
/* GIInterfaceInfo */
|
|
|
|
|
|
|
|
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,
|
2010-03-24 19:00:06 +01:00
|
|
|
const gchar *name);
|
2008-02-08 16:31:03 +01:00
|
|
|
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);
|
2009-02-28 01:02:48 +01:00
|
|
|
GIVFuncInfo * g_interface_info_find_vfunc (GIInterfaceInfo *info,
|
|
|
|
const gchar *name);
|
2008-02-08 16:31:03 +01:00
|
|
|
gint g_interface_info_get_n_constants (GIInterfaceInfo *info);
|
|
|
|
GIConstantInfo * g_interface_info_get_constant (GIInterfaceInfo *info,
|
|
|
|
gint n);
|
|
|
|
|
2009-02-20 23:34:20 +01:00
|
|
|
GIStructInfo * g_interface_info_get_iface_struct (GIInterfaceInfo *info);
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
/* GIPropertyInfo */
|
|
|
|
|
|
|
|
GParamFlags g_property_info_get_flags (GIPropertyInfo *info);
|
|
|
|
GITypeInfo * g_property_info_get_type (GIPropertyInfo *info);
|
|
|
|
|
|
|
|
|
|
|
|
/* GISignalInfo */
|
|
|
|
|
|
|
|
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 */
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GI_VFUNC_MUST_CHAIN_UP = 1 << 0,
|
|
|
|
GI_VFUNC_MUST_OVERRIDE = 1 << 1,
|
|
|
|
GI_VFUNC_MUST_NOT_OVERRIDE = 1 << 2
|
|
|
|
} GIVFuncInfoFlags;
|
|
|
|
|
|
|
|
GIVFuncInfoFlags g_vfunc_info_get_flags (GIVFuncInfo *info);
|
|
|
|
gint g_vfunc_info_get_offset (GIVFuncInfo *info);
|
|
|
|
GISignalInfo * g_vfunc_info_get_signal (GIVFuncInfo *info);
|
2009-02-28 01:02:48 +01:00
|
|
|
GIFunctionInfo * g_vfunc_info_get_invoker (GIVFuncInfo *info);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* GIConstantInfo */
|
|
|
|
|
|
|
|
GITypeInfo * g_constant_info_get_type (GIConstantInfo *info);
|
|
|
|
gint g_constant_info_get_value (GIConstantInfo *info,
|
|
|
|
GArgument *value);
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __G_IREPOSITORY_H__ */
|
|
|
|
|