2008-08-09 14:46:48 +02:00
|
|
|
/* GObject introspection: Parsed GIR
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Matthias Clasen
|
|
|
|
*
|
|
|
|
* 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_IR_NODE_H__
|
|
|
|
#define __G_IR_NODE_H__
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2008-11-11 01:48:17 +01:00
|
|
|
#include "girmodule.h"
|
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
typedef struct _GIrNode GIrNode;
|
2008-08-09 14:46:48 +02:00
|
|
|
typedef struct _GIrNodeFunction GIrNodeFunction;
|
|
|
|
typedef struct _GIrNodeParam GIrNodeParam;
|
|
|
|
typedef struct _GIrNodeType GIrNodeType;
|
|
|
|
typedef struct _GIrNodeInterface GIrNodeInterface;
|
|
|
|
typedef struct _GIrNodeSignal GIrNodeSignal;
|
|
|
|
typedef struct _GIrNodeProperty GIrNodeProperty;
|
|
|
|
typedef struct _GIrNodeVFunc GIrNodeVFunc;
|
|
|
|
typedef struct _GIrNodeField GIrNodeField;
|
|
|
|
typedef struct _GIrNodeValue GIrNodeValue;
|
|
|
|
typedef struct _GIrNodeEnum GIrNodeEnum;
|
|
|
|
typedef struct _GIrNodeBoxed GIrNodeBoxed;
|
|
|
|
typedef struct _GIrNodeStruct GIrNodeStruct;
|
|
|
|
typedef struct _GIrNodeConstant GIrNodeConstant;
|
|
|
|
typedef struct _GIrNodeXRef GIrNodeXRef;
|
|
|
|
typedef struct _GIrNodeUnion GIrNodeUnion;
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
typedef enum
|
2008-08-09 14:46:48 +02:00
|
|
|
{
|
|
|
|
G_IR_NODE_INVALID = 0,
|
|
|
|
G_IR_NODE_FUNCTION = 1,
|
|
|
|
G_IR_NODE_CALLBACK = 2,
|
|
|
|
G_IR_NODE_STRUCT = 3,
|
|
|
|
G_IR_NODE_BOXED = 4,
|
|
|
|
G_IR_NODE_ENUM = 5,
|
2010-03-24 19:00:06 +01:00
|
|
|
G_IR_NODE_FLAGS = 6,
|
2008-08-09 14:46:48 +02:00
|
|
|
G_IR_NODE_OBJECT = 7,
|
|
|
|
G_IR_NODE_INTERFACE = 8,
|
|
|
|
G_IR_NODE_CONSTANT = 9,
|
2011-05-19 22:12:03 +02:00
|
|
|
G_IR_NODE_INVALID_0 = 10, /* DELETED - used to be ERROR_DOMAIN */
|
2008-08-09 14:46:48 +02:00
|
|
|
G_IR_NODE_UNION = 11,
|
|
|
|
G_IR_NODE_PARAM = 12,
|
|
|
|
G_IR_NODE_TYPE = 13,
|
|
|
|
G_IR_NODE_PROPERTY = 14,
|
|
|
|
G_IR_NODE_SIGNAL = 15,
|
|
|
|
G_IR_NODE_VALUE = 16,
|
|
|
|
G_IR_NODE_VFUNC = 17,
|
|
|
|
G_IR_NODE_FIELD = 18,
|
|
|
|
G_IR_NODE_XREF = 19
|
|
|
|
} GIrNodeTypeId;
|
|
|
|
|
|
|
|
struct _GIrNode
|
|
|
|
{
|
|
|
|
GIrNodeTypeId type;
|
|
|
|
gchar *name;
|
2010-07-26 22:26:46 +02:00
|
|
|
GIrModule *module;
|
2009-02-20 03:48:51 +01:00
|
|
|
|
|
|
|
guint32 offset; /* Assigned as we build the typelib */
|
|
|
|
|
|
|
|
GHashTable *attributes;
|
2008-08-09 14:46:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeXRef
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gchar *namespace;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeFunction
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
2010-03-24 19:00:06 +01:00
|
|
|
gboolean is_varargs; /* Not in typelib yet */
|
2008-08-09 14:46:48 +02:00
|
|
|
|
|
|
|
gboolean is_method;
|
|
|
|
gboolean is_setter;
|
|
|
|
gboolean is_getter;
|
|
|
|
gboolean is_constructor;
|
|
|
|
gboolean wraps_vfunc;
|
2008-10-21 19:04:11 +02:00
|
|
|
gboolean throws;
|
2008-08-09 14:46:48 +02:00
|
|
|
|
|
|
|
gchar *symbol;
|
|
|
|
|
|
|
|
GIrNodeParam *result;
|
|
|
|
GList *parameters;
|
|
|
|
};
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
struct _GIrNodeType
|
2008-08-09 14:46:48 +02:00
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean is_pointer;
|
|
|
|
gboolean is_basic;
|
|
|
|
gboolean is_array;
|
|
|
|
gboolean is_glist;
|
|
|
|
gboolean is_gslist;
|
|
|
|
gboolean is_ghashtable;
|
|
|
|
gboolean is_interface;
|
|
|
|
gboolean is_error;
|
|
|
|
gint tag;
|
|
|
|
|
|
|
|
gchar *unparsed;
|
|
|
|
|
|
|
|
gboolean zero_terminated;
|
|
|
|
gboolean has_length;
|
|
|
|
gint length;
|
2008-10-25 17:20:54 +02:00
|
|
|
gboolean has_size;
|
|
|
|
gint size;
|
2010-05-04 16:57:51 +02:00
|
|
|
gint array_type;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GIrNodeType *parameter_type1;
|
2010-03-24 19:00:06 +01:00
|
|
|
GIrNodeType *parameter_type2;
|
2008-08-09 14:46:48 +02:00
|
|
|
|
|
|
|
gchar *interface;
|
|
|
|
gchar **errors;
|
|
|
|
};
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
struct _GIrNodeParam
|
2008-08-09 14:46:48 +02:00
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean in;
|
|
|
|
gboolean out;
|
2009-12-16 17:47:19 +01:00
|
|
|
gboolean caller_allocates;
|
2008-08-09 14:46:48 +02:00
|
|
|
gboolean optional;
|
|
|
|
gboolean retval;
|
2008-10-22 16:02:02 +02:00
|
|
|
gboolean allow_none;
|
2011-05-13 18:20:05 +02:00
|
|
|
gboolean skip;
|
2008-08-09 14:46:48 +02:00
|
|
|
gboolean transfer;
|
|
|
|
gboolean shallow_transfer;
|
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 scope;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
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
|
|
|
gint8 closure;
|
|
|
|
gint8 destroy;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GIrNodeType *type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeProperty
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
|
|
|
|
|
|
|
gchar *name;
|
|
|
|
gboolean readable;
|
|
|
|
gboolean writable;
|
|
|
|
gboolean construct;
|
|
|
|
gboolean construct_only;
|
2010-06-08 16:40:35 +02:00
|
|
|
gboolean transfer;
|
|
|
|
gboolean shallow_transfer;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GIrNodeType *type;
|
|
|
|
};
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
struct _GIrNodeSignal
|
2008-08-09 14:46:48 +02:00
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
|
|
|
|
|
|
|
gboolean run_first;
|
|
|
|
gboolean run_last;
|
|
|
|
gboolean run_cleanup;
|
|
|
|
gboolean no_recurse;
|
|
|
|
gboolean detailed;
|
|
|
|
gboolean action;
|
|
|
|
gboolean no_hooks;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
gboolean has_class_closure;
|
|
|
|
gboolean true_stops_emit;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
gint class_closure;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *parameters;
|
2010-03-24 19:00:06 +01:00
|
|
|
GIrNodeParam *result;
|
2008-08-09 14:46:48 +02:00
|
|
|
};
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
struct _GIrNodeVFunc
|
2008-08-09 14:46:48 +02:00
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
gboolean is_varargs; /* Not in typelib yet */
|
2008-08-09 14:46:48 +02:00
|
|
|
gboolean must_chain_up;
|
|
|
|
gboolean must_be_implemented;
|
|
|
|
gboolean must_not_be_implemented;
|
|
|
|
gboolean is_class_closure;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2009-02-28 01:02:48 +01:00
|
|
|
char *invoker;
|
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *parameters;
|
2010-03-24 19:00:06 +01:00
|
|
|
GIrNodeParam *result;
|
2008-08-09 14:46:48 +02:00
|
|
|
|
|
|
|
gint offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeField
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean readable;
|
|
|
|
gboolean writable;
|
|
|
|
gint bits;
|
|
|
|
gint offset;
|
2009-11-09 19:17:23 +01:00
|
|
|
GIrNodeFunction *callback;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GIrNodeType *type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeInterface
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
2008-10-20 19:04:17 +02:00
|
|
|
gboolean abstract;
|
2008-08-09 14:46:48 +02:00
|
|
|
gboolean deprecated;
|
2010-06-12 23:08:56 +02:00
|
|
|
gboolean fundamental;
|
2008-08-09 14:46:48 +02:00
|
|
|
|
|
|
|
gchar *gtype_name;
|
|
|
|
gchar *gtype_init;
|
|
|
|
|
2010-06-12 23:08:56 +02:00
|
|
|
gchar *ref_func;
|
|
|
|
gchar *unref_func;
|
|
|
|
gchar *set_value_func;
|
|
|
|
gchar *get_value_func;
|
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
gchar *parent;
|
2009-02-20 23:34:20 +01:00
|
|
|
gchar *glib_type_struct;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *interfaces;
|
|
|
|
GList *prerequisites;
|
|
|
|
|
2008-11-11 22:10:12 +01:00
|
|
|
gint alignment;
|
|
|
|
gint size;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *members;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeValue
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
|
|
|
|
2010-09-14 17:59:03 +02:00
|
|
|
gint64 value;
|
2008-08-09 14:46:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeConstant
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
|
|
|
|
|
|
|
GIrNodeType *type;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
gchar *value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeEnum
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
2008-11-18 13:29:10 +01:00
|
|
|
gint storage_type;
|
2008-08-09 14:46:48 +02:00
|
|
|
|
|
|
|
gchar *gtype_name;
|
|
|
|
gchar *gtype_init;
|
|
|
|
|
|
|
|
GList *values;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeBoxed
|
2010-03-24 19:00:06 +01:00
|
|
|
{
|
2008-08-09 14:46:48 +02:00
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
|
|
|
|
|
|
|
gchar *gtype_name;
|
|
|
|
gchar *gtype_init;
|
2008-11-11 06:10:36 +01:00
|
|
|
|
|
|
|
gint alignment;
|
|
|
|
gint size;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *members;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeStruct
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
2008-11-11 00:58:49 +01:00
|
|
|
gboolean disguised;
|
2009-02-20 23:34:20 +01:00
|
|
|
gboolean is_gtype_struct;
|
2010-03-26 03:12:12 +01:00
|
|
|
gboolean foreign;
|
2008-09-06 22:33:51 +02:00
|
|
|
|
|
|
|
gchar *gtype_name;
|
|
|
|
gchar *gtype_init;
|
2008-11-11 06:10:36 +01:00
|
|
|
|
|
|
|
gint alignment;
|
|
|
|
gint size;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *members;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GIrNodeUnion
|
|
|
|
{
|
|
|
|
GIrNode node;
|
|
|
|
|
|
|
|
gboolean deprecated;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
GList *members;
|
|
|
|
GList *discriminators;
|
|
|
|
|
|
|
|
gchar *gtype_name;
|
|
|
|
gchar *gtype_init;
|
|
|
|
|
2008-11-11 06:10:36 +01:00
|
|
|
gint alignment;
|
|
|
|
gint size;
|
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
gint discriminator_offset;
|
|
|
|
GIrNodeType *discriminator_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-16 21:08:33 +01:00
|
|
|
GIrNode * _g_ir_node_new (GIrNodeTypeId type,
|
2010-07-26 22:26:46 +02:00
|
|
|
GIrModule *module);
|
2010-11-16 21:08:33 +01:00
|
|
|
void _g_ir_node_free (GIrNode *node);
|
|
|
|
guint32 _g_ir_node_get_size (GIrNode *node);
|
|
|
|
guint32 _g_ir_node_get_full_size (GIrNode *node);
|
|
|
|
void _g_ir_node_build_typelib (GIrNode *node,
|
|
|
|
GIrNode *parent,
|
|
|
|
GIrTypelibBuild *build,
|
|
|
|
guint32 *offset,
|
|
|
|
guint32 *offset2);
|
|
|
|
int _g_ir_node_cmp (GIrNode *node,
|
2008-08-09 14:55:32 +02:00
|
|
|
GIrNode *other);
|
2010-11-16 21:08:33 +01:00
|
|
|
gboolean _g_ir_node_can_have_member (GIrNode *node);
|
|
|
|
void _g_ir_node_add_member (GIrNode *node,
|
|
|
|
GIrNodeFunction *member);
|
|
|
|
guint32 _g_ir_write_string (const gchar *str,
|
|
|
|
GHashTable *strings,
|
|
|
|
guchar *data,
|
|
|
|
guint32 *offset);
|
|
|
|
|
|
|
|
const gchar * _g_ir_node_param_direction_string (GIrNodeParam * node);
|
|
|
|
const gchar * _g_ir_node_type_to_string (GIrNodeTypeId type);
|
|
|
|
|
|
|
|
GIrNode *_g_ir_find_node (GIrTypelibBuild *build,
|
2010-07-26 22:26:46 +02:00
|
|
|
GIrModule *module,
|
|
|
|
const char *name);
|
2008-11-11 01:48:17 +01:00
|
|
|
|
2008-11-11 06:10:36 +01:00
|
|
|
/* In giroffsets.c */
|
|
|
|
|
2010-11-16 21:08:33 +01:00
|
|
|
void _g_ir_node_compute_offsets (GIrTypelibBuild *build,
|
2010-07-26 22:26:46 +02:00
|
|
|
GIrNode *node);
|
2008-11-11 06:10:36 +01:00
|
|
|
|
|
|
|
|
2008-08-09 14:46:48 +02:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __G_IR_NODE_H__ */
|