2012-02-03 19:42:56 +01:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
|
|
* GObject introspection: struct definitions for the binary
|
2008-08-09 14:55:32 +02:00
|
|
|
* typelib format, validation
|
2008-02-08 16:31:03 +01:00
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Matthias Clasen
|
2009-02-12 02:46:59 +01:00
|
|
|
* Copyright (C) 2008,2009 Red Hat, Inc.
|
2008-02-08 16:31:03 +01:00
|
|
|
*
|
2023-10-25 18:10:10 +02:00
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*
|
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.
|
|
|
|
*/
|
|
|
|
|
2023-11-07 19:23:17 +01:00
|
|
|
#pragma once
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
#include <gmodule.h>
|
|
|
|
#include "girepository.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
2013-10-10 22:21:18 +02:00
|
|
|
* SECTION:gitypelib-internal
|
2018-12-12 09:32:44 +01:00
|
|
|
* @title: GITypelib Internals
|
2009-02-12 02:46:59 +01:00
|
|
|
* @short_description: Layout and accessors for typelib
|
|
|
|
* @stability: Stable
|
|
|
|
*
|
|
|
|
* The "typelib" is a binary, readonly, memory-mappable database
|
|
|
|
* containing reflective information about a GObject library.
|
2022-02-13 15:27:09 +01:00
|
|
|
*
|
2016-03-24 05:15:51 +01:00
|
|
|
* What the typelib describes and the types used are the same for every
|
|
|
|
* platform so, apart the endianness of its scalar values, the typelib
|
|
|
|
* database must be considered architecture-independent.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
|
|
|
* The format of GObject typelib is strongly influenced by the Mozilla XPCOM
|
|
|
|
* format.
|
2009-02-12 02:46:59 +01:00
|
|
|
*
|
|
|
|
* Some of the differences to XPCOM include:
|
2022-02-13 15:27:09 +01:00
|
|
|
*
|
2010-03-24 19:00:06 +01:00
|
|
|
* - Type information is stored not quite as compactly (XPCOM stores it inline
|
2013-10-10 22:21:18 +02:00
|
|
|
* in function descriptions in variable-sized blobs of 1 to n bytes. We store
|
|
|
|
* 16 bits of type information for each parameter, which is enough to encode
|
|
|
|
* simple types inline. Complex (e.g. recursive) types are stored out of line
|
|
|
|
* in a separate list of types.
|
2010-03-24 19:00:06 +01:00
|
|
|
* - String and complex type data is stored outside of typelib entry blobs,
|
2013-10-10 22:21:18 +02:00
|
|
|
* references are stored as offsets relative to the start of the typelib.
|
|
|
|
* One possibility is to store the strings and types in a pools at the end
|
|
|
|
* of the typelib.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2013-10-10 22:21:18 +02:00
|
|
|
* The typelib has the following general format:
|
2009-02-12 02:46:59 +01:00
|
|
|
*
|
2022-02-13 15:27:09 +01:00
|
|
|
* |[<!-- language="C" -->
|
2013-10-10 22:21:18 +02:00
|
|
|
* typelib ::= header, section-index, directory, blobs, attributes, attributedata
|
2009-02-12 02:46:59 +01:00
|
|
|
*
|
2013-10-10 22:21:18 +02:00
|
|
|
* directory ::= list of entries
|
2009-02-12 02:46:59 +01:00
|
|
|
*
|
2013-10-10 22:21:18 +02:00
|
|
|
* entry ::= blob type, name, namespace, offset
|
|
|
|
* blob ::= function|callback|struct|boxed|enum|flags|object|interface|constant|union
|
|
|
|
* attribute ::= offset, key, value
|
|
|
|
* attributedata ::= string data for attributes
|
2022-02-13 15:27:09 +01:00
|
|
|
* ]|
|
2009-02-12 02:46:59 +01:00
|
|
|
*
|
|
|
|
* Details
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
|
|
|
* We describe the fragments that make up the typelib in the form of C structs
|
2013-10-10 22:21:18 +02:00
|
|
|
* (although some fall short of being valid C structs since they contain
|
|
|
|
* multiple flexible arrays).
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
TYPELIB HISTORY
|
|
|
|
-----
|
2010-06-12 23:08:56 +02:00
|
|
|
|
|
|
|
Version 1.1
|
|
|
|
- Add ref/unref/set-value/get-value functions to Object, to be able
|
|
|
|
to support instantiatable fundamental types which are not GObject based.
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
Version 1.0
|
2009-02-20 23:34:20 +01:00
|
|
|
- Rename class_struct to gtype_struct, add to interfaces
|
2009-02-12 02:46:59 +01:00
|
|
|
|
|
|
|
Changes since 0.9:
|
|
|
|
- Add padding to structures
|
|
|
|
|
|
|
|
Changes since 0.8:
|
|
|
|
- Add class struct concept to ObjectBlob
|
|
|
|
- Add is_class_struct bit to StructBlob
|
|
|
|
|
|
|
|
Changes since 0.7:
|
|
|
|
- Add dependencies
|
|
|
|
|
|
|
|
Changes since 0.6:
|
|
|
|
- rename metadata to typelib, to follow xpcom terminology
|
|
|
|
|
|
|
|
Changes since 0.5:
|
|
|
|
- basic type cleanup:
|
|
|
|
+ remove GString
|
|
|
|
+ add [u]int, [u]long, [s]size_t
|
|
|
|
+ rename string to utf8, add filename
|
|
|
|
- allow blob_type to be zero for non-local entries
|
|
|
|
|
|
|
|
Changes since 0.4:
|
|
|
|
- add a UnionBlob
|
|
|
|
|
|
|
|
Changes since 0.3:
|
|
|
|
- drop short_name for ValueBlob
|
|
|
|
|
|
|
|
Changes since 0.2:
|
|
|
|
- make inline types 4 bytes after all, remove header->types and allow
|
|
|
|
types to appear anywhere
|
|
|
|
- allow error domains in the directory
|
|
|
|
|
|
|
|
Changes since 0.1:
|
|
|
|
|
|
|
|
- drop comments about _GOBJ_METADATA
|
|
|
|
- drop string pool, strings can appear anywhere
|
|
|
|
- use 'blob' as collective name for the various blob types
|
|
|
|
- rename 'type' field in blobs to 'blob_type'
|
|
|
|
- rename 'type_name' and 'type_init' fields to 'gtype_name', 'gtype_init'
|
2010-03-24 19:00:06 +01:00
|
|
|
- shrink directory entries to 12 bytes
|
2009-02-12 02:46:59 +01:00
|
|
|
- merge struct and boxed blobs
|
|
|
|
- split interface blobs into enum, object and interface blobs
|
|
|
|
- add an 'unregistered' flag to struct and enum blobs
|
2010-03-24 19:00:06 +01:00
|
|
|
- add a 'wraps_vfunc' flag to function blobs and link them to
|
2009-02-12 02:46:59 +01:00
|
|
|
the vfuncs they wrap
|
|
|
|
- restrict value blobs to only occur inside enums and flags again
|
|
|
|
- add constant blobs, allow them toplevel, in interfaces and in objects
|
|
|
|
- rename 'receiver_owns_value' and 'receiver_owns_container' to
|
|
|
|
'transfer_ownership' and 'transfer_container_ownership'
|
|
|
|
- add a 'struct_offset' field to virtual function and field blobs
|
|
|
|
- add 'dipper' and 'optional' flags to arg blobs
|
|
|
|
- add a 'true_stops_emit' flag to signal blobs
|
|
|
|
- add variable blob sizes to header
|
|
|
|
- store offsets to signature blobs instead of including them directly
|
|
|
|
- change the type offset to be measured in words rather than bytes
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* G_IR_MAGIC:
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
|
|
|
* Identifying prefix for the typelib. This was inspired by XPCOM,
|
2009-02-12 02:46:59 +01:00
|
|
|
* which in turn borrowed from PNG.
|
|
|
|
*/
|
Merge in the gir-compiler branch. Thanks to Philip and Colin for their
2008-08-08 Johan Dahlin <johan@gnome.org>
* girepository/gtypelib.c (validate_header):
* girepository/gtypelib.h:
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/sourcescanner.c (gi_source_symbol_ref),
(gi_source_symbol_unref):
* tests/array.test:
* tests/boxed.test:
* tests/constant.test:
* tests/enum.test:
* tests/errors.test:
* tests/function.test:
* tests/gobject.test:
* tests/interface.test:
* tests/invoke/Makefile.am:
* tests/invoke/testfns.xml:
* tests/object.test:
* tests/parser/Makefile.am:
* tests/roundtrips.sh:
* tests/struct.test:
* tests/types.test:
* tests/union.test:
* tests/xref1.test:
* tests/xref2.test:
* tools/Makefile.am:
* tools/compiler.c (main):
* tools/generate.c (write_callable_info), (write_function_info),
(write_repository):
* tools/gidlmodule.c:
* tools/gidlmodule.h:
* tools/gidlnode.c:
* tools/gidlnode.h:
* tools/gidlparser.c:
* tools/gidlparser.h:
* tools/gidlwriter.c:
* tools/gidlwriter.h:
* tools/scanner.c (create_node_from_gtype),
(create_node_from_ctype), (g_igenerator_process_properties),
(g_igenerator_process_signals), (g_igenerator_create_object),
(g_igenerator_create_interface), (g_igenerator_create_boxed),
(g_igenerator_create_enum), (g_igenerator_create_flags),
(g_igenerator_process_function_symbol),
(g_igenerator_process_unregistered_struct_typedef),
(g_igenerator_process_struct_typedef),
(g_igenerator_process_union_typedef),
(g_igenerator_process_enum_typedef),
(g_igenerator_process_function_typedef),
(g_igenerator_process_constant), (g_igenerator_process_symbols),
(g_igenerator_add_module), (g_igenerator_add_include_idl):
Merge in the gir-compiler branch.
Thanks to Philip and Colin for their help.
svn path=/trunk/; revision=325
2008-08-08 21:09:17 +02:00
|
|
|
#define G_IR_MAGIC "GOBJ\nMETADATA\r\n\032"
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* GTypelibBlobType:
|
|
|
|
* @BLOB_TYPE_INVALID: Should not appear in code
|
|
|
|
* @BLOB_TYPE_FUNCTION: A #FunctionBlob
|
|
|
|
* @BLOB_TYPE_CALLBACK: A #CallbackBlob
|
|
|
|
* @BLOB_TYPE_STRUCT: A #StructBlob
|
|
|
|
* @BLOB_TYPE_BOXED: Can be either a #StructBlob or #UnionBlob
|
|
|
|
* @BLOB_TYPE_ENUM: An #EnumBlob
|
|
|
|
* @BLOB_TYPE_FLAGS: An #EnumBlob
|
|
|
|
* @BLOB_TYPE_OBJECT: An #ObjectBlob
|
|
|
|
* @BLOB_TYPE_INTERFACE: An #InterfaceBlob
|
|
|
|
* @BLOB_TYPE_CONSTANT: A #ConstantBlob
|
2013-10-10 22:21:18 +02:00
|
|
|
* @BLOB_TYPE_INVALID_0: Deleted, used to be ErrorDomain.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @BLOB_TYPE_UNION: A #UnionBlob
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2013-10-10 22:21:18 +02:00
|
|
|
* The integral value of this enumeration appears in each "Blob" component of
|
|
|
|
* a typelib to identify its type.
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef enum {
|
2008-02-08 16:31:03 +01:00
|
|
|
BLOB_TYPE_INVALID,
|
|
|
|
BLOB_TYPE_FUNCTION,
|
|
|
|
BLOB_TYPE_CALLBACK,
|
|
|
|
BLOB_TYPE_STRUCT,
|
|
|
|
BLOB_TYPE_BOXED,
|
|
|
|
BLOB_TYPE_ENUM,
|
|
|
|
BLOB_TYPE_FLAGS,
|
|
|
|
BLOB_TYPE_OBJECT,
|
|
|
|
BLOB_TYPE_INTERFACE,
|
|
|
|
BLOB_TYPE_CONSTANT,
|
2013-10-10 22:21:18 +02:00
|
|
|
BLOB_TYPE_INVALID_0,
|
2008-02-08 16:31:03 +01:00
|
|
|
BLOB_TYPE_UNION
|
2009-02-12 02:46:59 +01:00
|
|
|
} GTypelibBlobType;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2020-08-24 13:48:24 +02:00
|
|
|
|
|
|
|
#if defined (G_CAN_INLINE) && defined (G_ALWAYS_INLINE)
|
|
|
|
|
|
|
|
G_ALWAYS_INLINE
|
|
|
|
inline gboolean
|
|
|
|
_blob_is_registered_type (GTypelibBlobType blob_type)
|
|
|
|
{
|
|
|
|
switch (blob_type)
|
|
|
|
{
|
|
|
|
case BLOB_TYPE_STRUCT:
|
|
|
|
case BLOB_TYPE_UNION:
|
|
|
|
case BLOB_TYPE_ENUM:
|
|
|
|
case BLOB_TYPE_FLAGS:
|
|
|
|
case BLOB_TYPE_OBJECT:
|
|
|
|
case BLOB_TYPE_INTERFACE:
|
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define BLOB_IS_REGISTERED_TYPE(blob) \
|
|
|
|
_blob_is_registered_type ((GTypelibBlobType) (blob)->blob_type)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2008-10-12 22:53:26 +02:00
|
|
|
#define BLOB_IS_REGISTERED_TYPE(blob) \
|
|
|
|
((blob)->blob_type == BLOB_TYPE_STRUCT || \
|
|
|
|
(blob)->blob_type == BLOB_TYPE_UNION || \
|
|
|
|
(blob)->blob_type == BLOB_TYPE_ENUM || \
|
2010-07-28 16:35:47 +02:00
|
|
|
(blob)->blob_type == BLOB_TYPE_FLAGS || \
|
2008-10-12 22:53:26 +02:00
|
|
|
(blob)->blob_type == BLOB_TYPE_OBJECT || \
|
|
|
|
(blob)->blob_type == BLOB_TYPE_INTERFACE)
|
|
|
|
|
2020-08-24 13:48:24 +02:00
|
|
|
#endif /* defined (G_CAN_INLINE) && defined (G_ALWAYS_INLINE) */
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* Header:
|
|
|
|
* @magic: See #G_IR_MAGIC.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @major_version: The major version number of the typelib format. Major version
|
|
|
|
* number changes indicate incompatible changes to the tyeplib format.
|
|
|
|
* @minor_version: The minor version number of the typelib format. Minor version
|
|
|
|
* number changes indicate compatible changes and should still allow the
|
|
|
|
* typelib to be parsed by a parser designed for the same @major_version.
|
|
|
|
* @reserved: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @n_entries: The number of entries in the directory.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @n_local_entries: The number of entries referring to blobs in this typelib.
|
|
|
|
* The local entries must occur before the unresolved entries.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @directory: Offset of the directory in the typelib.
|
2009-02-20 03:48:51 +01:00
|
|
|
* @n_attributes: Number of attribute blocks
|
|
|
|
* @attributes: Offset of the list of attributes in the typelib.
|
2015-01-31 23:21:14 +01:00
|
|
|
* @dependencies: Offset of a single string, which is the list of immediate
|
|
|
|
* dependencies, separated by the '|' character. The dependencies are
|
|
|
|
* required in order to avoid having programs consuming a typelib check for
|
|
|
|
* an "Unresolved" type return from every API call.
|
2010-03-24 19:00:06 +01:00
|
|
|
* @size: The size in bytes of the typelib.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @namespace: Offset of the namespace string in the typelib.
|
|
|
|
* @nsversion: Offset of the namespace version string in the typelib.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @shared_library: This field is the set of shared libraries associated with
|
|
|
|
* the typelib. The entries are separated by the '|' (pipe) character.
|
2010-05-18 23:10:51 +02:00
|
|
|
* @c_prefix: The prefix for the function names of the library
|
2013-10-10 22:21:18 +02:00
|
|
|
* @entry_blob_size: The sizes of fixed-size blobs. Recording this information
|
|
|
|
* here allows to write parser which continue to work if the format is
|
|
|
|
* extended by adding new fields to the end of the fixed-size blobs.
|
|
|
|
* @function_blob_size: See @entry_blob_size.
|
|
|
|
* @callback_blob_size: See @entry_blob_size.
|
|
|
|
* @signal_blob_size: See @entry_blob_size.
|
|
|
|
* @vfunc_blob_size: See @entry_blob_size.
|
|
|
|
* @arg_blob_size: See @entry_blob_size.
|
|
|
|
* @property_blob_size: See @entry_blob_size.
|
|
|
|
* @field_blob_size: See @entry_blob_size.
|
|
|
|
* @value_blob_size: See @entry_blob_size.
|
|
|
|
* @attribute_blob_size: See @entry_blob_size.
|
|
|
|
* @constant_blob_size: See @entry_blob_size.
|
|
|
|
* @error_domain_blob_size: See @entry_blob_size.
|
|
|
|
* @signature_blob_size: See @entry_blob_size.
|
|
|
|
* @enum_blob_size: See @entry_blob_size.
|
|
|
|
* @struct_blob_size: See @entry_blob_size.
|
|
|
|
* @object_blob_size: See @entry_blob_size.
|
|
|
|
* @interface_blob_size: For variable-size blobs, the size of the struct up to
|
|
|
|
* the first flexible array member. Recording this information here allows
|
|
|
|
* to write parser which continue to work if the format is extended by
|
|
|
|
* adding new fields before the first flexible array member in
|
|
|
|
* variable-size blobs.
|
|
|
|
* @union_blob_size: See @entry_blob_size.
|
2010-10-25 19:33:01 +02:00
|
|
|
* @sections: Offset of section blob array
|
2013-10-10 22:21:18 +02:00
|
|
|
* @padding: TODO
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2009-02-12 02:46:59 +01:00
|
|
|
* The header structure appears exactly once at the beginning of a typelib. It is a
|
2010-03-24 19:00:06 +01:00
|
|
|
* collection of meta-information, such as the number of entries and dependencies.
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
gchar magic[16];
|
|
|
|
guint8 major_version;
|
|
|
|
guint8 minor_version;
|
|
|
|
guint16 reserved;
|
|
|
|
guint16 n_entries;
|
|
|
|
guint16 n_local_entries;
|
|
|
|
guint32 directory;
|
2009-02-20 03:48:51 +01:00
|
|
|
guint32 n_attributes;
|
|
|
|
guint32 attributes;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2008-08-30 22:31:07 +02:00
|
|
|
guint32 dependencies;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 size;
|
|
|
|
guint32 namespace;
|
2008-10-12 06:51:48 +02:00
|
|
|
guint32 nsversion;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 shared_library;
|
2009-02-13 00:42:47 +01:00
|
|
|
guint32 c_prefix;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint16 entry_blob_size;
|
|
|
|
guint16 function_blob_size;
|
|
|
|
guint16 callback_blob_size;
|
|
|
|
guint16 signal_blob_size;
|
|
|
|
guint16 vfunc_blob_size;
|
|
|
|
guint16 arg_blob_size;
|
|
|
|
guint16 property_blob_size;
|
|
|
|
guint16 field_blob_size;
|
|
|
|
guint16 value_blob_size;
|
2009-02-20 03:48:51 +01:00
|
|
|
guint16 attribute_blob_size;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 constant_blob_size;
|
|
|
|
guint16 error_domain_blob_size;
|
|
|
|
|
|
|
|
guint16 signature_blob_size;
|
|
|
|
guint16 enum_blob_size;
|
|
|
|
guint16 struct_blob_size;
|
|
|
|
guint16 object_blob_size;
|
|
|
|
guint16 interface_blob_size;
|
|
|
|
guint16 union_blob_size;
|
2010-03-24 19:00:06 +01:00
|
|
|
|
2010-10-25 19:33:01 +02:00
|
|
|
guint32 sections;
|
|
|
|
|
2012-02-08 15:02:37 +01:00
|
|
|
guint16 padding[6];
|
2008-02-08 16:31:03 +01:00
|
|
|
} Header;
|
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
/**
|
|
|
|
* SectionType:
|
|
|
|
* @GI_SECTION_END: TODO
|
|
|
|
* @GI_SECTION_DIRECTORY_INDEX: TODO
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*/
|
2010-10-25 19:33:01 +02:00
|
|
|
typedef enum {
|
|
|
|
GI_SECTION_END = 0,
|
|
|
|
GI_SECTION_DIRECTORY_INDEX = 1
|
|
|
|
} SectionType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Section:
|
|
|
|
* @id: A #SectionType
|
|
|
|
* @offset: Integer offset for this section
|
|
|
|
*
|
|
|
|
* A section is a blob of data that's (at least theoretically) optional,
|
|
|
|
* and may or may not be present in the typelib. Presently, just used
|
|
|
|
* for the directory index. This allows a form of dynamic extensibility
|
|
|
|
* with different tradeoffs from the format minor version.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
guint32 id;
|
|
|
|
guint32 offset;
|
|
|
|
} Section;
|
|
|
|
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* DirEntry:
|
|
|
|
* @blob_type: A #GTypelibBlobType
|
|
|
|
* @local: Whether this entry refers to a blob in this typelib.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @name: The name of the entry.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @offset: If is_local is set, this is the offset of the blob in the typelib.
|
|
|
|
* Otherwise, it is the offset of the namespace in which the blob has to be
|
|
|
|
* looked up by name.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2009-02-12 02:46:59 +01:00
|
|
|
* References to directory entries are stored as 1-based 16-bit indexes.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
|
|
|
* All blobs pointed to by a directory entry start with the same layout for
|
2009-02-12 02:46:59 +01:00
|
|
|
* the first 8 bytes (the reserved flags may be used by some blob types)
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type;
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 local : 1;
|
|
|
|
guint16 reserved :15;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
guint32 offset;
|
|
|
|
} DirEntry;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
2013-10-10 22:21:18 +02:00
|
|
|
* SimpleTypeBlobFlags:
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
* @pointer: TODO
|
|
|
|
* @reserved3: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @tag: A #GITypeTag
|
2009-11-04 17:43:13 +01:00
|
|
|
*
|
2013-10-10 22:21:18 +02:00
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
2013-10-10 22:21:18 +02:00
|
|
|
typedef struct {
|
|
|
|
guint reserved : 8;
|
|
|
|
guint reserved2 :16;
|
|
|
|
guint pointer : 1;
|
|
|
|
guint reserved3 : 2;
|
|
|
|
guint tag : 5;
|
|
|
|
} SimpleTypeBlobFlags;
|
|
|
|
|
|
|
|
union _SimpleTypeBlob
|
2008-03-10 18:46:58 +01:00
|
|
|
{
|
2013-10-10 22:21:18 +02:00
|
|
|
SimpleTypeBlobFlags flags;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 offset;
|
2013-10-10 22:21:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SimpleTypeBlob:
|
|
|
|
* @flags: TODO
|
|
|
|
* @offset: Offset relative to header->types that points to a TypeBlob.
|
|
|
|
* Unlike other offsets, this is in words (ie 32bit units) rather
|
|
|
|
* than bytes.
|
|
|
|
*
|
|
|
|
* The SimpleTypeBlob is the general purpose "reference to a type" construct,
|
|
|
|
* used in method parameters, returns, callback definitions, fields, constants,
|
|
|
|
* etc. It's actually just a 32 bit integer which you can see from the union
|
|
|
|
* definition. This is for efficiency reasons, since there are so many
|
|
|
|
* references to types.
|
|
|
|
*
|
|
|
|
* SimpleTypeBlob is divided into two cases; first, if "reserved" and
|
2022-01-28 22:22:05 +01:00
|
|
|
* "reserved2" are both zero, the type tag for a basic type is embedded in the
|
|
|
|
* "tag" bits. This allows e.g. GI_TYPE_TAG_UTF8, GI_TYPE_TAG_INT and the like
|
|
|
|
* to be embedded directly without taking up extra space.
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* References to "interfaces" (objects, interfaces) are more complicated;
|
|
|
|
* In this case, the integer is actually an offset into the directory (see
|
|
|
|
* above). Because the header is larger than 2^8=256 bits, all offsets will
|
|
|
|
* have one of the upper 24 bits set.
|
|
|
|
*/
|
|
|
|
typedef union _SimpleTypeBlob SimpleTypeBlob;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-05-18 23:10:51 +02:00
|
|
|
/**
|
2009-02-12 02:46:59 +01:00
|
|
|
* ArgBlob:
|
2010-03-24 19:00:06 +01:00
|
|
|
* @name: A suggested name for the parameter.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @in: The parameter is an input to the function
|
2013-10-10 22:21:18 +02:00
|
|
|
* @out: The parameter is used to return an output of the function. Parameters
|
|
|
|
* can be both in and out. Out parameters implicitly add another level of
|
|
|
|
* indirection to the parameter type. Ie if the type is uint32 in an out
|
|
|
|
* parameter, the function actually takes an uint32*.
|
|
|
|
* @caller_allocates: The parameter is a pointer to a struct or object that
|
|
|
|
* will receive an output of the function.
|
2014-04-16 17:33:36 +02:00
|
|
|
* @nullable: Only meaningful for types which are passed as pointers. For an
|
2013-10-10 22:21:18 +02:00
|
|
|
* in parameter, indicates if it is ok to pass NULL in. Gor an out
|
|
|
|
* parameter, indicates whether it may return NULL. Note that NULL is a
|
|
|
|
* valid GList and GSList value, thus allow_none will normally be set
|
|
|
|
* for parameters of these types.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @optional: For an out parameter, indicates that NULL may be passed in
|
2013-10-10 22:21:18 +02:00
|
|
|
* if the value is not needed.
|
|
|
|
* @transfer_ownership: For an in parameter, indicates that the function takes
|
|
|
|
* over ownership of the parameter value. For an out parameter, it indicates
|
|
|
|
* that the caller is responsible for freeing the return value.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @transfer_container_ownership: For container types, indicates that the
|
2013-10-10 22:21:18 +02:00
|
|
|
* ownership of the container, but not of its contents is transferred.
|
|
|
|
* This is typically the case for out parameters returning lists of
|
|
|
|
* statically allocated things.
|
|
|
|
* @return_value: The parameter should be considered the return value of the
|
|
|
|
* function. Only out parameters can be marked as return value, and there
|
|
|
|
* can be at most one per function call. If an out parameter is marked as
|
|
|
|
* return value, the actual return value of the function should be either
|
|
|
|
* void or a boolean indicating the success of the call.
|
|
|
|
* @scope: A #GIScopeType. If the parameter is of a callback type, this denotes
|
|
|
|
* the scope of the user_data and the callback function pointer itself
|
|
|
|
* (for languages that emit code at run-time).
|
2011-05-13 18:20:05 +02:00
|
|
|
* @skip: Indicates that the parameter is only useful in C and should be skipped.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @closure: Index of the closure (user_data) parameter associated with the
|
|
|
|
* callback, or -1.
|
|
|
|
* @destroy: Index of the destroy notfication callback parameter associated
|
|
|
|
* with the callback, or -1.
|
|
|
|
* @padding: TODO
|
|
|
|
* @arg_type: Describes the type of the parameter. See details below.
|
2009-02-12 02:46:59 +01:00
|
|
|
*
|
|
|
|
* Types are specified by four bytes. If the three high bytes are zero,
|
|
|
|
* the low byte describes a basic type, otherwise the 32bit number is an
|
|
|
|
* offset which points to a TypeBlob.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
|
|
|
|
guint in : 1;
|
|
|
|
guint out : 1;
|
2009-12-16 17:47:19 +01:00
|
|
|
guint caller_allocates : 1;
|
2014-04-16 17:33:36 +02:00
|
|
|
guint nullable : 1;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint optional : 1;
|
|
|
|
guint transfer_ownership : 1;
|
|
|
|
guint transfer_container_ownership : 1;
|
|
|
|
guint return_value : 1;
|
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
|
|
|
guint scope : 3;
|
2011-05-13 18:20:05 +02:00
|
|
|
guint skip : 1;
|
|
|
|
guint reserved :20;
|
2013-10-10 22:21:18 +02:00
|
|
|
gint8 closure;
|
|
|
|
gint8 destroy;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
guint16 padding;
|
2012-02-08 15:02:37 +01:00
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
SimpleTypeBlob arg_type;
|
|
|
|
} ArgBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* SignatureBlob:
|
|
|
|
* @return_type: Describes the type of the return value. See details below.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @may_return_null: Only relevant for pointer types. Indicates whether the
|
|
|
|
* caller must expect NULL as a return value.
|
|
|
|
* @caller_owns_return_value: If set, the caller is responsible for freeing
|
|
|
|
* the return value if it is no longer needed.
|
|
|
|
* @caller_owns_return_container: This flag is only relevant if the return type
|
|
|
|
* is a container type. If the flag is set, the caller is resonsible for
|
|
|
|
* freeing the container, but not its contents.
|
|
|
|
* @skip_return: Indicates that the return value is only useful in C and should
|
|
|
|
* be skipped.
|
2014-05-06 18:53:21 +02:00
|
|
|
* @instance_transfer_ownership: When calling, the function assumes ownership of
|
|
|
|
* the instance parameter.
|
2015-06-03 14:24:21 +02:00
|
|
|
* @throws: Denotes the signature takes an additional #GError argument beyond
|
|
|
|
* the annotated arguments.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @n_arguments: The number of arguments that this function expects, also the
|
|
|
|
* length of the array of ArgBlobs.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @arguments: An array of ArgBlob for the arguments of the function.
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
SimpleTypeBlob return_type;
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 may_return_null : 1;
|
|
|
|
guint16 caller_owns_return_value : 1;
|
|
|
|
guint16 caller_owns_return_container : 1;
|
2011-05-13 18:20:05 +02:00
|
|
|
guint16 skip_return : 1;
|
2014-05-06 18:53:21 +02:00
|
|
|
guint16 instance_transfer_ownership : 1;
|
2015-06-03 14:24:21 +02:00
|
|
|
guint16 throws : 1;
|
|
|
|
guint16 reserved :10;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint16 n_arguments;
|
|
|
|
|
|
|
|
ArgBlob arguments[];
|
|
|
|
} SignatureBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* CommonBlob:
|
|
|
|
* @blob_type: A #GTypelibBlobType
|
|
|
|
* @deprecated: Whether the blob is deprecated.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @name: The name of the blob.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2009-02-12 02:46:59 +01:00
|
|
|
* The #CommonBlob is shared between #FunctionBlob,
|
2010-03-24 19:00:06 +01:00
|
|
|
* #CallbackBlob, #SignalBlob.
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type; /* 1 */
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 deprecated : 1;
|
|
|
|
guint16 reserved :15;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
} CommonBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* FunctionBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: #BLOB_TYPE_FUNCTION
|
2009-02-12 02:46:59 +01:00
|
|
|
* @deprecated: The function is deprecated.
|
2010-03-24 19:00:06 +01:00
|
|
|
* @setter: The function is a setter for a property. Language bindings may
|
2013-10-10 22:21:18 +02:00
|
|
|
* prefer to not bind individual setters and rely on the generic
|
|
|
|
* g_object_set().
|
2010-03-24 19:00:06 +01:00
|
|
|
* @getter: The function is a getter for a property. Language bindings may
|
2013-10-10 22:21:18 +02:00
|
|
|
* prefer to not bind individual getters and rely on the generic
|
|
|
|
* g_object_get().
|
|
|
|
* @constructor: The function acts as a constructor for the object it is
|
|
|
|
* contained in.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @wraps_vfunc: The function is a simple wrapper for a virtual function.
|
2018-12-09 18:04:49 +01:00
|
|
|
* @throws: This is now additionally stored in the #SignatureBlob. (deprecated)
|
2010-03-24 19:00:06 +01:00
|
|
|
* @index: Index of the property that this function is a setter or getter of
|
2013-10-10 22:21:18 +02:00
|
|
|
* in the array of properties of the containing interface, or index
|
|
|
|
* of the virtual function that this function wraps.
|
|
|
|
* @name: TODO
|
|
|
|
* @symbol: The symbol which can be used to obtain the function pointer with
|
|
|
|
* dlsym().
|
2010-03-24 19:00:06 +01:00
|
|
|
* @signature: Offset of the SignatureBlob describing the parameter types and the
|
2013-10-10 22:21:18 +02:00
|
|
|
* return value type.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @is_static: The function is a "static method"; in other words it's a pure
|
2013-10-10 22:21:18 +02:00
|
|
|
* function whose name is conceptually scoped to the object.
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type; /* 1 */
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 deprecated : 1;
|
2008-10-21 19:04:11 +02:00
|
|
|
guint16 setter : 1;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 getter : 1;
|
|
|
|
guint16 constructor : 1;
|
|
|
|
guint16 wraps_vfunc : 1;
|
2008-10-21 19:04:11 +02:00
|
|
|
guint16 throws : 1;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 index :10;
|
2008-11-25 23:29:20 +01:00
|
|
|
/* Note the bits above need to match CommonBlob
|
|
|
|
* and are thus exhausted, extend things using
|
|
|
|
* the reserved block below. */
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint32 name;
|
|
|
|
guint32 symbol;
|
|
|
|
guint32 signature;
|
2008-11-25 23:29:20 +01:00
|
|
|
|
|
|
|
guint16 is_static : 1;
|
|
|
|
guint16 reserved : 15;
|
|
|
|
guint16 reserved2 : 16;
|
2008-02-08 16:31:03 +01:00
|
|
|
} FunctionBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* CallbackBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: TODO
|
|
|
|
* @deprecated: TODO
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
|
|
|
* @signature: Offset of the #SignatureBlob describing the parameter types and
|
|
|
|
* the return value type.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type; /* 2 */
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 deprecated : 1;
|
|
|
|
guint16 reserved :15;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
guint32 signature;
|
|
|
|
} CallbackBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* InterfaceTypeBlob:
|
|
|
|
* @pointer: Whether this type represents an indirection
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @tag: A #GITypeTag
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved2: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @interface: Index of the directory entry for the interface.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2009-02-12 02:46:59 +01:00
|
|
|
* If the interface is an enum of flags type, is_pointer is 0, otherwise it is 1.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-08-28 12:24:35 +02:00
|
|
|
guint8 pointer :1;
|
|
|
|
guint8 reserved :2;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint8 tag :5;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint8 reserved2;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 interface;
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
} InterfaceTypeBlob;
|
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
/**
|
|
|
|
* ArrayTypeDimension:
|
|
|
|
* @length: TODO
|
|
|
|
* @size: TODO
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*/
|
|
|
|
typedef union {
|
|
|
|
guint16 length;
|
|
|
|
guint16 size;
|
|
|
|
} ArrayTypeDimension;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* ArrayTypeBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @pointer: TODO
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @tag: TODO
|
|
|
|
* @zero_terminated: Indicates that the array must be terminated by a suitable
|
|
|
|
* #NULL value.
|
|
|
|
* @has_length: Indicates that length points to a parameter specifying the
|
|
|
|
* length of the array. If both has_length and zero_terminated are set, the
|
|
|
|
* convention is to pass -1 for the length if the array is zero-terminated.
|
2010-05-04 16:57:51 +02:00
|
|
|
* @has_size: Indicates that size is the fixed size of the array.
|
|
|
|
* @array_type: Indicates whether this is a C array, GArray, GPtrArray, or
|
2013-10-10 22:21:18 +02:00
|
|
|
* GByteArray. If something other than a C array, the length and element
|
|
|
|
* size are implicit in the structure.
|
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
* @dimensions: TODO
|
|
|
|
* @type: TODO
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 pointer :1;
|
|
|
|
guint16 reserved :2;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 tag :5;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 zero_terminated :1;
|
|
|
|
guint16 has_length :1;
|
2008-10-25 17:20:54 +02:00
|
|
|
guint16 has_size :1;
|
2010-05-04 16:57:51 +02:00
|
|
|
guint16 array_type :2;
|
|
|
|
guint16 reserved2 :3;
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
ArrayTypeDimension dimensions;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
SimpleTypeBlob type;
|
|
|
|
} ArrayTypeBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* ParamTypeBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @pointer: TODO
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @tag: TODO
|
|
|
|
* @reserved2: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @n_types: The number of parameter types to follow.
|
|
|
|
* @type: Describes the type of the list elements.
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2013-10-10 22:21:18 +02:00
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2010-03-24 19:20:14 +01:00
|
|
|
guint8 pointer :1;
|
|
|
|
guint8 reserved :2;
|
|
|
|
guint8 tag :5;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-03-24 19:20:14 +01:00
|
|
|
guint8 reserved2;
|
|
|
|
guint16 n_types;
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
SimpleTypeBlob type[];
|
|
|
|
} ParamTypeBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* ErrorTypeBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @pointer: TODO
|
|
|
|
* @reserved: TODO
|
|
|
|
* @tag: TODO
|
|
|
|
* @reserved2: TODO
|
|
|
|
* @n_domains: TODO: must be 0
|
|
|
|
* @domains: TODO
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-08-28 12:24:35 +02:00
|
|
|
guint8 pointer :1;
|
|
|
|
guint8 reserved :2;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint8 tag :5;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint8 reserved2;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2011-05-19 22:12:03 +02:00
|
|
|
guint16 n_domains; /* Must be 0 */
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 domains[];
|
2008-02-08 16:31:03 +01:00
|
|
|
} ErrorTypeBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* ValueBlob:
|
|
|
|
* @deprecated: Whether this value is deprecated
|
2010-09-14 17:59:03 +02:00
|
|
|
* @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @name: Name of blob
|
2013-10-10 22:21:18 +02:00
|
|
|
* @value: The numerical value
|
2010-03-24 19:00:06 +01:00
|
|
|
*
|
2009-02-12 02:46:59 +01:00
|
|
|
* Values commonly occur in enums and flags.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-08-28 12:24:35 +02:00
|
|
|
guint32 deprecated : 1;
|
2010-09-14 17:59:03 +02:00
|
|
|
guint32 unsigned_value : 1;
|
|
|
|
guint32 reserved :30;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
2010-03-18 00:28:01 +01:00
|
|
|
gint32 value;
|
2008-02-08 16:31:03 +01:00
|
|
|
} ValueBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* FieldBlob:
|
|
|
|
* @name: The name of the field.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @readable: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @writable: How the field may be accessed.
|
2009-11-09 19:17:23 +01:00
|
|
|
* @has_embedded_type: An anonymous type follows the FieldBlob.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @bits: If this field is part of a bitfield, the number of bits which it
|
2013-10-10 22:21:18 +02:00
|
|
|
* uses, otherwise 0.
|
|
|
|
* @struct_offset: The offset of the field in the struct. The value 0xFFFF
|
|
|
|
* indicates that the struct offset is unknown.
|
|
|
|
* @reserved2: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @type: The type of the field.
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
guint8 readable :1;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint8 writable :1;
|
2009-11-09 19:17:23 +01:00
|
|
|
guint8 has_embedded_type :1;
|
|
|
|
guint8 reserved :5;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint8 bits;
|
|
|
|
|
2009-02-12 21:17:25 +01:00
|
|
|
guint16 struct_offset;
|
|
|
|
|
|
|
|
guint32 reserved2;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
SimpleTypeBlob type;
|
|
|
|
} FieldBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* RegisteredTypeBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: TODO
|
|
|
|
* @deprecated: TODO
|
|
|
|
* @unregistered: TODO
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @gtype_name: The name under which the type is registered with GType.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @gtype_init: The symbol name of the get_type<!-- -->() function which registers the
|
|
|
|
* type.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 blob_type;
|
|
|
|
guint16 deprecated : 1;
|
2008-10-12 21:30:22 +02:00
|
|
|
guint16 unregistered : 1;
|
|
|
|
guint16 reserved :14;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint32 name;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint32 gtype_name;
|
|
|
|
guint32 gtype_init;
|
|
|
|
} RegisteredTypeBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* StructBlob:
|
|
|
|
* @blob_type: #BLOB_TYPE_STRUCT
|
|
|
|
* @deprecated: Whether this structure is deprecated
|
|
|
|
* @unregistered: If this is set, the type is not registered with GType.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @is_gtype_struct: Whether this structure is the class or interface layout
|
|
|
|
* for a GObject
|
2009-02-12 02:46:59 +01:00
|
|
|
* @alignment: The byte boundary that the struct is aligned to in memory
|
2010-03-26 03:12:12 +01:00
|
|
|
* @foreign: If the type is foreign, eg if it's expected to be overridden by
|
2013-10-10 22:21:18 +02:00
|
|
|
* a native language binding instead of relying of introspected bindings.
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @gtype_name: String name of the associated #GType
|
|
|
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
2013-10-10 22:21:18 +02:00
|
|
|
* @size: The size of the struct in bytes.
|
|
|
|
* @n_fields: TODO
|
|
|
|
* @n_methods: TODO
|
2022-10-29 19:09:23 +02:00
|
|
|
* @copy_func: String pointing to a function which can be called to copy
|
|
|
|
* the contents of this struct type
|
|
|
|
* @free_func: String pointing to a function which can be called to free
|
|
|
|
* the contents of this struct type
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type;
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 deprecated : 1;
|
|
|
|
guint16 unregistered : 1;
|
2009-02-20 23:34:20 +01:00
|
|
|
guint16 is_gtype_struct : 1;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 alignment : 6;
|
2010-03-26 03:12:12 +01:00
|
|
|
guint16 foreign : 1;
|
|
|
|
guint16 reserved : 6;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint32 name;
|
|
|
|
|
|
|
|
guint32 gtype_name;
|
|
|
|
guint32 gtype_init;
|
|
|
|
|
2008-11-16 22:15:54 +01:00
|
|
|
guint32 size;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 n_fields;
|
|
|
|
guint16 n_methods;
|
|
|
|
|
2022-10-29 19:09:23 +02:00
|
|
|
guint32 copy_func;
|
|
|
|
guint32 free_func;
|
2008-02-08 16:31:03 +01:00
|
|
|
} StructBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
2010-05-18 18:37:51 +02:00
|
|
|
* UnionBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: TODO
|
|
|
|
* @deprecated: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @unregistered: If this is set, the type is not registered with GType.
|
|
|
|
* @discriminated: Is set if the union is discriminated
|
|
|
|
* @alignment: The byte boundary that the union is aligned to in memory
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @gtype_name: String name of the associated #GType
|
|
|
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
2013-10-10 22:21:18 +02:00
|
|
|
* @size: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @n_fields: Length of the arrays
|
2013-10-10 22:21:18 +02:00
|
|
|
* @n_functions: TODO
|
2022-10-29 19:09:23 +02:00
|
|
|
* @copy_func: String pointing to a function which can be called to copy
|
|
|
|
* the contents of this union type
|
|
|
|
* @free_func: String pointing to a function which can be called to free
|
|
|
|
* the contents of this union type
|
2009-02-12 02:46:59 +01:00
|
|
|
* @discriminator_offset: Offset from the beginning of the union where the
|
2013-10-10 22:21:18 +02:00
|
|
|
* discriminator of a discriminated union is located. The value 0xFFFF
|
|
|
|
* indicates that the discriminator offset is unknown.
|
2010-03-24 19:00:06 +01:00
|
|
|
* @discriminator_type: Type of the discriminator
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 blob_type;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 deprecated : 1;
|
|
|
|
guint16 unregistered : 1;
|
|
|
|
guint16 discriminated : 1;
|
2008-11-16 22:15:54 +01:00
|
|
|
guint16 alignment : 6;
|
|
|
|
guint16 reserved : 7;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
|
|
|
|
guint32 gtype_name;
|
|
|
|
guint32 gtype_init;
|
|
|
|
|
2008-11-16 22:15:54 +01:00
|
|
|
guint32 size;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 n_fields;
|
|
|
|
guint16 n_functions;
|
|
|
|
|
2022-10-29 19:09:23 +02:00
|
|
|
guint32 copy_func;
|
|
|
|
guint32 free_func;
|
2009-02-12 21:17:25 +01:00
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
gint32 discriminator_offset;
|
2008-02-08 16:31:03 +01:00
|
|
|
SimpleTypeBlob discriminator_type;
|
|
|
|
} UnionBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* EnumBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: TODO
|
|
|
|
* @deprecated: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @unregistered: If this is set, the type is not registered with GType.
|
|
|
|
* @storage_type: The tag of the type used for the enum in the C ABI
|
2013-10-10 22:21:18 +02:00
|
|
|
* (will be a signed or unsigned integral type)
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @gtype_name: String name of the associated #GType
|
|
|
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
2011-08-13 17:28:30 +02:00
|
|
|
* @n_values: The length of the values array.
|
|
|
|
* @n_methods: The length of the methods array.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @error_domain: String naming the #GError domain this enum is associated with
|
|
|
|
* @values: TODO
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type;
|
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 deprecated : 1;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 unregistered : 1;
|
2008-11-18 13:29:10 +01:00
|
|
|
guint16 storage_type : 5;
|
|
|
|
guint16 reserved : 9;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
guint32 name;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint32 gtype_name;
|
|
|
|
guint32 gtype_init;
|
|
|
|
|
|
|
|
guint16 n_values;
|
2011-08-13 17:28:30 +02:00
|
|
|
guint16 n_methods;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2011-05-19 22:21:13 +02:00
|
|
|
guint32 error_domain;
|
2009-02-12 21:17:25 +01:00
|
|
|
|
2010-03-24 19:00:06 +01:00
|
|
|
ValueBlob values[];
|
2008-02-08 16:31:03 +01:00
|
|
|
} EnumBlob;
|
|
|
|
|
2021-06-29 00:22:35 +02:00
|
|
|
#define ACCESSOR_SENTINEL 0x3ff
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* PropertyBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @name: The name of the property.
|
|
|
|
* @deprecated: TODO
|
|
|
|
* @readable: TODO
|
|
|
|
* @writable: TODO
|
|
|
|
* @construct: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @construct_only: The ParamFlags used when registering the property.
|
2010-06-08 16:40:35 +02:00
|
|
|
* @transfer_ownership: When writing, the type containing the property takes
|
2013-10-10 22:21:18 +02:00
|
|
|
* ownership of the value. When reading, the returned value needs to be
|
|
|
|
* released by the caller.
|
2010-06-08 16:40:35 +02:00
|
|
|
* @transfer_container_ownership: For container types indicates that the
|
2013-10-10 22:21:18 +02:00
|
|
|
* ownership of the container, but not of its contents, is transferred.
|
|
|
|
* This is typically the case when reading lists of statically allocated
|
|
|
|
* things.
|
Add introspection data for property accessors
A GObject property can be accessed generically through the GObject API,
e.g. g_object_set_property() and g_object_get_property(). Properties
typically also have public accessor functions, which are (according to
our own best practices) called through the generic API.
The introspection data is currently missing the relation between a
property and its public accessor functions. With this information, a
language binding could, for instance, avoid exposing the C API entirely,
thus minimizing the chances of collisions between property names and
accessor functions; alternatively, a binding could call the C API
directly instead of going through the generic GObject API, thus avoiding
the boxing and unboxing from a native type to a GIArgument and finally
into a GValue, and vice versa.
In the GIR, we add two new attributes to the `property` element:
- setter="SYMBOL"
- getter="SYMBOL"
where "symbol" is the C function identifier of the setter and getter
functions, respectively. The `setter` attribute is only applied to
writable, non-construct-only properties; the `getter` attribute is only
applied to readable properties.
We maintain the ABI compatibility of the typelib data by using 20 bits
of the 25 reserved bits inside the PropertyBlob structure. The data is
exposed through two new GIPropertyInfo methods:
- g_property_info_get_setter()
- g_property_info_get_getter()
which return the GIFunctionInfo for the setter and getter functions,
respectively.
2021-06-17 14:07:35 +02:00
|
|
|
* @setter: the index of the setter function for this property, if @writable
|
2021-06-29 00:22:35 +02:00
|
|
|
* is set; if the method is not known, the value will be set to %ACCESSOR_SENTINEL
|
Add introspection data for property accessors
A GObject property can be accessed generically through the GObject API,
e.g. g_object_set_property() and g_object_get_property(). Properties
typically also have public accessor functions, which are (according to
our own best practices) called through the generic API.
The introspection data is currently missing the relation between a
property and its public accessor functions. With this information, a
language binding could, for instance, avoid exposing the C API entirely,
thus minimizing the chances of collisions between property names and
accessor functions; alternatively, a binding could call the C API
directly instead of going through the generic GObject API, thus avoiding
the boxing and unboxing from a native type to a GIArgument and finally
into a GValue, and vice versa.
In the GIR, we add two new attributes to the `property` element:
- setter="SYMBOL"
- getter="SYMBOL"
where "symbol" is the C function identifier of the setter and getter
functions, respectively. The `setter` attribute is only applied to
writable, non-construct-only properties; the `getter` attribute is only
applied to readable properties.
We maintain the ABI compatibility of the typelib data by using 20 bits
of the 25 reserved bits inside the PropertyBlob structure. The data is
exposed through two new GIPropertyInfo methods:
- g_property_info_get_setter()
- g_property_info_get_getter()
which return the GIFunctionInfo for the setter and getter functions,
respectively.
2021-06-17 14:07:35 +02:00
|
|
|
* @getter: ths index of the getter function for this property, if @readable
|
2021-06-29 00:22:35 +02:00
|
|
|
* is set; if the method is not known, the value will be set to %ACCESSOR_SENTINEL
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @reserved2: Reserved for future use.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @type: Describes the type of the property.
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
|
2010-06-08 16:40:35 +02:00
|
|
|
guint32 deprecated : 1;
|
|
|
|
guint32 readable : 1;
|
|
|
|
guint32 writable : 1;
|
|
|
|
guint32 construct : 1;
|
|
|
|
guint32 construct_only : 1;
|
|
|
|
guint32 transfer_ownership : 1;
|
|
|
|
guint32 transfer_container_ownership : 1;
|
Add introspection data for property accessors
A GObject property can be accessed generically through the GObject API,
e.g. g_object_set_property() and g_object_get_property(). Properties
typically also have public accessor functions, which are (according to
our own best practices) called through the generic API.
The introspection data is currently missing the relation between a
property and its public accessor functions. With this information, a
language binding could, for instance, avoid exposing the C API entirely,
thus minimizing the chances of collisions between property names and
accessor functions; alternatively, a binding could call the C API
directly instead of going through the generic GObject API, thus avoiding
the boxing and unboxing from a native type to a GIArgument and finally
into a GValue, and vice versa.
In the GIR, we add two new attributes to the `property` element:
- setter="SYMBOL"
- getter="SYMBOL"
where "symbol" is the C function identifier of the setter and getter
functions, respectively. The `setter` attribute is only applied to
writable, non-construct-only properties; the `getter` attribute is only
applied to readable properties.
We maintain the ABI compatibility of the typelib data by using 20 bits
of the 25 reserved bits inside the PropertyBlob structure. The data is
exposed through two new GIPropertyInfo methods:
- g_property_info_get_setter()
- g_property_info_get_getter()
which return the GIFunctionInfo for the setter and getter functions,
respectively.
2021-06-17 14:07:35 +02:00
|
|
|
guint32 setter :10;
|
|
|
|
guint32 getter :10;
|
|
|
|
guint32 reserved : 5;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2009-02-12 21:17:25 +01:00
|
|
|
guint32 reserved2;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2009-02-12 21:17:25 +01:00
|
|
|
SimpleTypeBlob type;
|
2008-02-08 16:31:03 +01:00
|
|
|
} PropertyBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* SignalBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @deprecated: TODO
|
|
|
|
* @run_first: TODO
|
|
|
|
* @run_last: TODO
|
|
|
|
* @run_cleanup: TODO
|
|
|
|
* @no_recurse: TODO
|
|
|
|
* @detailed: TODO
|
|
|
|
* @action: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @no_hooks: The flags used when registering the signal.
|
|
|
|
* @has_class_closure: Set if the signal has a class closure.
|
|
|
|
* @true_stops_emit: Whether the signal has true-stops-emit semantics
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @class_closure: The index of the class closure in the list of virtual
|
|
|
|
* functions of the object or interface on which the signal is defined.
|
|
|
|
* @name: The name of the signal.
|
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
* @signature: Offset of the SignatureBlob describing the parameter types
|
|
|
|
* and the return value type.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 deprecated : 1;
|
|
|
|
guint16 run_first : 1;
|
|
|
|
guint16 run_last : 1;
|
|
|
|
guint16 run_cleanup : 1;
|
|
|
|
guint16 no_recurse : 1;
|
|
|
|
guint16 detailed : 1;
|
|
|
|
guint16 action : 1;
|
|
|
|
guint16 no_hooks : 1;
|
|
|
|
guint16 has_class_closure : 1;
|
|
|
|
guint16 true_stops_emit : 1;
|
|
|
|
guint16 reserved : 6;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint16 class_closure;
|
|
|
|
|
|
|
|
guint32 name;
|
|
|
|
|
2009-02-12 21:17:25 +01:00
|
|
|
guint32 reserved2;
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 signature;
|
|
|
|
} SignalBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* VFuncBlob:
|
|
|
|
* @name: The name of the virtual function.
|
|
|
|
* @must_chain_up: If set, every implementation of this virtual function must
|
2013-10-10 22:21:18 +02:00
|
|
|
* chain up to the implementation of the parent class.
|
|
|
|
* @must_be_implemented: If set, every derived class must override this virtual
|
|
|
|
* function.
|
|
|
|
* @must_not_be_implemented: If set, derived class must not override this
|
|
|
|
* virtual function.
|
|
|
|
* @class_closure: Set if this virtual function is the class closure of a
|
|
|
|
* signal.
|
2018-12-09 18:04:49 +01:00
|
|
|
* @throws: This is now additionally stored in the #SignatureBlob. (deprecated)
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
2010-03-24 19:00:06 +01:00
|
|
|
* @signal: The index of the signal in the list of signals of the object or
|
2013-10-10 22:21:18 +02:00
|
|
|
* interface to which this virtual function belongs.
|
|
|
|
* @struct_offset: The offset of the function pointer in the class struct.
|
|
|
|
* The value 0xFFFF indicates that the struct offset is unknown.
|
|
|
|
* @invoker: If a method invoker for this virtual exists, this is the offset
|
|
|
|
* in the class structure of the method. If no method is known, this value
|
|
|
|
* will be 0x3ff.
|
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
* @reserved3: Reserved for future use.
|
|
|
|
* @signature: Offset of the SignatureBlob describing the parameter types and
|
|
|
|
* the return value type.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 name;
|
|
|
|
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 must_chain_up : 1;
|
|
|
|
guint16 must_be_implemented : 1;
|
|
|
|
guint16 must_not_be_implemented : 1;
|
|
|
|
guint16 class_closure : 1;
|
2012-02-03 19:20:00 +01:00
|
|
|
guint16 throws : 1;
|
|
|
|
guint16 reserved :11;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 signal;
|
|
|
|
|
|
|
|
guint16 struct_offset;
|
2009-02-28 01:02:48 +01:00
|
|
|
guint16 invoker : 10; /* Number of bits matches @index in FunctionBlob */
|
|
|
|
guint16 reserved2 : 6;
|
2009-02-12 21:17:25 +01:00
|
|
|
|
|
|
|
guint32 reserved3;
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 signature;
|
|
|
|
} VFuncBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* ObjectBlob:
|
|
|
|
* @blob_type: #BLOB_TYPE_OBJECT
|
2021-02-09 12:38:27 +01:00
|
|
|
* @deprecated: whether the type is deprecated
|
|
|
|
* @abstract: whether the type can be instantiated
|
2010-06-12 23:08:56 +02:00
|
|
|
* @fundamental: this object is not a GObject derived type, instead it's
|
2013-10-10 22:21:18 +02:00
|
|
|
* an additional fundamental type.
|
2022-02-13 15:27:30 +01:00
|
|
|
* @final_: whether the type can be derived
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
* @gtype_name: String name of the associated #GType
|
|
|
|
* @gtype_init: String naming the symbol which gets the runtime #GType
|
2010-03-24 19:00:06 +01:00
|
|
|
* @parent: The directory index of the parent type. This is only set for
|
2013-10-10 22:21:18 +02:00
|
|
|
* objects. If an object does not have a parent, it is zero.
|
|
|
|
* @gtype_struct: TODO
|
|
|
|
* @n_interfaces: TODO
|
|
|
|
* @n_fields: TODO
|
|
|
|
* @n_properties: TODO
|
|
|
|
* @n_methods: TODO
|
|
|
|
* @n_signals: TODO
|
|
|
|
* @n_vfuncs: TODO
|
|
|
|
* @n_constants: The lengths of the arrays.Up to 16bits of padding may be
|
|
|
|
* inserted between the arrays to ensure that they start on a 32bit
|
|
|
|
* boundary.
|
2014-02-28 02:10:19 +01:00
|
|
|
* @n_field_callbacks: The number of n_fields which are also callbacks.
|
|
|
|
* This is used to calculate the fields section size in constant time.
|
2010-06-12 23:08:56 +02:00
|
|
|
* @ref_func: String pointing to a function which can be called to increase
|
2013-10-10 22:21:18 +02:00
|
|
|
* the reference count for an instance of this object type.
|
2010-06-12 23:08:56 +02:00
|
|
|
* @unref_func: String pointing to a function which can be called to decrease
|
2013-10-10 22:21:18 +02:00
|
|
|
* the reference count for an instance of this object type.
|
2010-06-12 23:08:56 +02:00
|
|
|
* @set_value_func: String pointing to a function which can be called to
|
2013-10-10 22:21:18 +02:00
|
|
|
* convert a pointer of this object to a GValue
|
2010-06-12 23:08:56 +02:00
|
|
|
* @get_value_func: String pointing to a function which can be called to
|
2013-10-10 22:21:18 +02:00
|
|
|
* convert extract a pointer to this object from a GValue
|
|
|
|
* @reserved3: Reserved for future use.
|
|
|
|
* @reserved4: Reserved for future use.
|
|
|
|
* @interfaces: An array of indices of directory entries for the implemented
|
|
|
|
* interfaces.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type; /* 7 */
|
2008-10-20 19:04:17 +02:00
|
|
|
guint16 deprecated : 1;
|
|
|
|
guint16 abstract : 1;
|
2010-06-12 23:08:56 +02:00
|
|
|
guint16 fundamental : 1;
|
2021-02-09 12:38:27 +01:00
|
|
|
guint16 final_ : 1;
|
|
|
|
guint16 reserved :12;
|
2008-10-20 19:04:17 +02:00
|
|
|
guint32 name;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint32 gtype_name;
|
|
|
|
guint32 gtype_init;
|
|
|
|
|
|
|
|
guint16 parent;
|
2009-02-20 23:34:20 +01:00
|
|
|
guint16 gtype_struct;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint16 n_interfaces;
|
|
|
|
guint16 n_fields;
|
|
|
|
guint16 n_properties;
|
|
|
|
guint16 n_methods;
|
|
|
|
guint16 n_signals;
|
|
|
|
guint16 n_vfuncs;
|
|
|
|
guint16 n_constants;
|
2014-02-28 02:10:19 +01:00
|
|
|
guint16 n_field_callbacks;
|
2009-02-12 21:17:25 +01:00
|
|
|
|
2010-06-12 23:08:56 +02:00
|
|
|
guint32 ref_func;
|
|
|
|
guint32 unref_func;
|
|
|
|
guint32 set_value_func;
|
|
|
|
guint32 get_value_func;
|
|
|
|
|
2009-02-12 21:17:25 +01:00
|
|
|
guint32 reserved3;
|
|
|
|
guint32 reserved4;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
guint16 interfaces[];
|
2008-02-08 16:31:03 +01:00
|
|
|
} ObjectBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* InterfaceBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: TODO
|
|
|
|
* @deprecated: TODO
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
|
|
|
* @gtype_name: TODO
|
|
|
|
* @gtype_init: TODO
|
2009-02-20 23:34:20 +01:00
|
|
|
* @gtype_struct: Name of the interface "class" C structure
|
2009-02-12 02:46:59 +01:00
|
|
|
* @n_prerequisites: Number of prerequisites
|
|
|
|
* @n_properties: Number of properties
|
|
|
|
* @n_methods: Number of methods
|
|
|
|
* @n_signals: Number of signals
|
|
|
|
* @n_vfuncs: Number of virtual functions
|
2013-10-10 22:21:18 +02:00
|
|
|
* @n_constants: The lengths of the arrays. Up to 16bits of padding may be
|
|
|
|
* inserted between the arrays to ensure that they start on a 32bit
|
|
|
|
* boundary.
|
|
|
|
* @padding: TODO
|
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
* @reserved3: Reserved for future use.
|
|
|
|
* @prerequisites: An array of indices of directory entries for required
|
|
|
|
* interfaces.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 blob_type;
|
2008-10-20 19:04:17 +02:00
|
|
|
guint16 deprecated : 1;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 reserved :15;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint32 name;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint32 gtype_name;
|
|
|
|
guint32 gtype_init;
|
2009-02-20 23:34:20 +01:00
|
|
|
guint16 gtype_struct;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
guint16 n_prerequisites;
|
|
|
|
guint16 n_properties;
|
|
|
|
guint16 n_methods;
|
|
|
|
guint16 n_signals;
|
|
|
|
guint16 n_vfuncs;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 n_constants;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2012-02-08 15:02:37 +01:00
|
|
|
guint16 padding;
|
|
|
|
|
2009-02-12 21:17:25 +01:00
|
|
|
guint32 reserved2;
|
|
|
|
guint32 reserved3;
|
|
|
|
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
guint16 prerequisites[];
|
2008-02-08 16:31:03 +01:00
|
|
|
} InterfaceBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
|
|
|
* ConstantBlob:
|
2013-10-10 22:21:18 +02:00
|
|
|
* @blob_type: TODO
|
|
|
|
* @deprecated: TODO
|
|
|
|
* @reserved: Reserved for future use.
|
|
|
|
* @name: TODO
|
|
|
|
* @type: The type of the value. In most cases this should be a numeric type
|
|
|
|
* or string.
|
2009-02-12 02:46:59 +01:00
|
|
|
* @size: The size of the value in bytes.
|
|
|
|
* @offset: The offset of the value in the typelib.
|
2013-10-10 22:21:18 +02:00
|
|
|
* @reserved2: Reserved for future use.
|
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint16 blob_type;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint16 deprecated : 1;
|
2008-08-28 12:24:35 +02:00
|
|
|
guint16 reserved :15;
|
2010-03-24 19:00:06 +01:00
|
|
|
guint32 name;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
SimpleTypeBlob type;
|
|
|
|
|
|
|
|
guint32 size;
|
|
|
|
guint32 offset;
|
2009-02-12 21:17:25 +01:00
|
|
|
|
|
|
|
guint32 reserved2;
|
2008-02-08 16:31:03 +01:00
|
|
|
} ConstantBlob;
|
|
|
|
|
2009-02-12 02:46:59 +01:00
|
|
|
/**
|
2009-02-20 03:48:51 +01:00
|
|
|
* AttributeBlob:
|
|
|
|
* @offset: The offset of the typelib entry to which this attribute refers.
|
2013-10-10 22:21:18 +02:00
|
|
|
* Attributes are kept sorted by offset, so that the attributes of an
|
|
|
|
* entry can be found by a binary search.
|
2009-02-20 03:48:51 +01:00
|
|
|
* @name: The name of the attribute, a string.
|
|
|
|
* @value: The value of the attribute (also a string)
|
2013-10-10 22:21:18 +02:00
|
|
|
*
|
|
|
|
* TODO
|
2009-02-12 02:46:59 +01:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2008-02-08 16:31:03 +01:00
|
|
|
guint32 offset;
|
|
|
|
guint32 name;
|
|
|
|
guint32 value;
|
2009-02-20 03:48:51 +01:00
|
|
|
} AttributeBlob;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-08-31 22:36:06 +02:00
|
|
|
struct _GITypelib {
|
2022-02-13 15:20:03 +01:00
|
|
|
/*< private >*/
|
2008-02-08 16:31:03 +01:00
|
|
|
guchar *data;
|
|
|
|
gsize len;
|
|
|
|
gboolean owns_memory;
|
|
|
|
GMappedFile *mfile;
|
2008-10-07 23:25:01 +02:00
|
|
|
GList *modules;
|
2009-08-18 16:23:09 +02:00
|
|
|
gboolean open_attempted;
|
2008-02-08 16:31:03 +01:00
|
|
|
};
|
|
|
|
|
2010-08-31 22:36:06 +02:00
|
|
|
DirEntry *g_typelib_get_dir_entry (GITypelib *typelib,
|
2008-08-09 14:55:32 +02:00
|
|
|
guint16 index);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2010-10-18 18:04:08 +02:00
|
|
|
DirEntry *g_typelib_get_dir_entry_by_name (GITypelib *typelib,
|
|
|
|
const char *name);
|
|
|
|
|
Optimize g_irepository_find_by_gtype
When g_irepository_find_by_gtype() doesn't succeed on a simple prefix
match (the current 'fastpass' mechanism), it ends up taking a
considerable amount of CPU time, traversing the contents of all typelibs.
I imagine that the reasons to have the exhaustive search fallback are
not as strong as they used to be. For example, the case mentioned
(Clutter including Cogl) no longer seems to be true.
Also, typelibs (as generated by g-ir-scanner) now provide
comma-separated C prefix info for cases when the typelib includes
introspection info for multiple prefixes. For example, the Sugar typelib
has a c_prefix string of Sugar,EggSM,Gsm,Acme. So I imagine there are
not many remaining justified cases where the exhaustive search is needed.
With that in mind, I found two ways to optimize this function:
1. Support comma-separated C prefixes
2. Don't bother with an exhaustive search if we did find a typelib
claiming support for the prefix. For example, if we're looking for
GdkDeviceManagerXI2 (currently non-introspectable) and we already found
typelib files providing the 'Gdk' prefix that didn't offer this, lets
not bother with the exhaustive search, we aren't going to find anything.
2013-03-19 18:04:42 +01:00
|
|
|
DirEntry *g_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
|
|
|
|
const gchar *gtype_name);
|
2010-10-18 18:04:08 +02:00
|
|
|
|
2011-05-19 23:46:36 +02:00
|
|
|
DirEntry *g_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
|
|
|
|
GQuark error_domain);
|
|
|
|
|
Optimize g_irepository_find_by_gtype
When g_irepository_find_by_gtype() doesn't succeed on a simple prefix
match (the current 'fastpass' mechanism), it ends up taking a
considerable amount of CPU time, traversing the contents of all typelibs.
I imagine that the reasons to have the exhaustive search fallback are
not as strong as they used to be. For example, the case mentioned
(Clutter including Cogl) no longer seems to be true.
Also, typelibs (as generated by g-ir-scanner) now provide
comma-separated C prefix info for cases when the typelib includes
introspection info for multiple prefixes. For example, the Sugar typelib
has a c_prefix string of Sugar,EggSM,Gsm,Acme. So I imagine there are
not many remaining justified cases where the exhaustive search is needed.
With that in mind, I found two ways to optimize this function:
1. Support comma-separated C prefixes
2. Don't bother with an exhaustive search if we did find a typelib
claiming support for the prefix. For example, if we're looking for
GdkDeviceManagerXI2 (currently non-introspectable) and we already found
typelib files providing the 'Gdk' prefix that didn't offer this, lets
not bother with the exhaustive search, we aren't going to find anything.
2013-03-19 18:04:42 +01:00
|
|
|
gboolean g_typelib_matches_gtype_name_prefix (GITypelib *typelib,
|
|
|
|
const gchar *gtype_name);
|
|
|
|
|
2014-07-04 12:18:32 +02:00
|
|
|
|
|
|
|
GI_AVAILABLE_IN_ALL
|
2008-06-08 16:37:30 +02:00
|
|
|
void g_typelib_check_sanity (void);
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
/**
|
|
|
|
* g_typelib_get_string:
|
|
|
|
* @typelib: TODO
|
|
|
|
* @offset: TODO
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*
|
|
|
|
* Returns: TODO
|
|
|
|
*/
|
2008-08-09 14:55:32 +02:00
|
|
|
#define g_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
|
2008-02-08 16:31:03 +01:00
|
|
|
|
Revert revisions 157,149-148,136-129 and 120. Move back to using
2008-04-22 Johan Dahlin <johan@gnome.org>
* girepository/ginfo.c (g_info_from_entry), (g_type_info_new),
(g_type_info_is_pointer), (g_type_info_get_tag),
(g_type_info_get_param_type), (g_type_info_get_interface),
(g_type_info_get_array_length), (g_type_info_is_zero_terminated),
(g_type_info_get_n_error_domains), (g_type_info_get_error_domain),
(g_error_domain_info_get_codes), (g_enum_info_get_value),
(g_object_info_get_interface), (g_object_info_get_field),
(g_interface_info_get_prerequisite),
(g_signal_info_get_class_closure), (g_constant_info_get_value):
* girepository/ginvoke.c (get_ffi_type):
* girepository/girepository.h:
* girepository/gmetadata.c (g_metadata_get_dir_entry),
(g_metadata_check_sanity), (validate_header),
(validate_array_type_blob), (validate_iface_type_blob),
(validate_param_type_blob), (validate_error_type_blob),
(validate_type_blob), (validate_constant_blob),
(validate_struct_blob), (validate_enum_blob):
* girepository/gmetadata.h:
* tests/Makefile.am:
* tests/invoke/Makefile.am:
* tests/invoke/invoke.c (main):
* tests/roundtrips.sh:
* tools/Makefile.am:
* tools/compiler.c (format_output), (write_out_metadata), (main):
* tools/generate.c (write_type_name), (write_type_info),
(write_constant_value), (write_enum_info), (load_metadata), (main):
* tools/gidlcompilercontext.c:
* tools/gidlcompilercontext.h:
* tools/gidlcompilerentrynode.c:
* tools/gidlcompilerentrynode.h:
* tools/gidlcompilertypenode.c:
* tools/gidlcompilertypenode.h:
* tools/gidlmodule.c (g_idl_module_build_metadata):
* tools/gidlmodule.h:
* tools/gidlnode.c (init_stats), (dump_stats),
(g_idl_node_get_size), (g_idl_node_get_full_size),
(g_idl_node_cmp), (g_idl_node_can_have_member),
(g_idl_node_add_member), (g_idl_node_param_direction_string),
(parse_int_value), (parse_uint_value), (parse_float_value),
(parse_boolean_value), (find_entry_node), (find_entry),
(serialize_type), (g_idl_node_build_metadata), (write_string):
* tools/gidlnode.h:
* tools/gidlparser.c (parse_type_internal):
* tools/quote-file.sh:
Revert revisions 157,149-148,136-129 and 120.
Move back to using g-idl-generate to generate the metadata and
avoids dependency on a c compiler.
svn path=/trunk/; revision=214
2008-04-23 00:48:16 +02:00
|
|
|
|
2010-05-18 23:10:51 +02:00
|
|
|
/**
|
2010-08-31 22:36:06 +02:00
|
|
|
* GITypelibError:
|
2010-05-18 23:10:51 +02:00
|
|
|
* @G_TYPELIB_ERROR_INVALID: the typelib is invalid
|
|
|
|
* @G_TYPELIB_ERROR_INVALID_HEADER: the typelib header is invalid
|
|
|
|
* @G_TYPELIB_ERROR_INVALID_DIRECTORY: the typelib directory is invalid
|
|
|
|
* @G_TYPELIB_ERROR_INVALID_ENTRY: a typelib entry is invalid
|
|
|
|
* @G_TYPELIB_ERROR_INVALID_BLOB: a typelib blob is invalid
|
|
|
|
*
|
2010-08-31 22:36:06 +02:00
|
|
|
* A error set while validating the #GITypelib
|
2010-05-18 23:10:51 +02:00
|
|
|
*/
|
2008-02-08 16:31:03 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
2008-06-08 16:37:30 +02:00
|
|
|
G_TYPELIB_ERROR_INVALID,
|
|
|
|
G_TYPELIB_ERROR_INVALID_HEADER,
|
|
|
|
G_TYPELIB_ERROR_INVALID_DIRECTORY,
|
|
|
|
G_TYPELIB_ERROR_INVALID_ENTRY,
|
|
|
|
G_TYPELIB_ERROR_INVALID_BLOB
|
2010-08-31 22:36:06 +02:00
|
|
|
} GITypelibError;
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
/**
|
|
|
|
* G_TYPELIB_ERROR:
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*/
|
2008-06-08 16:37:30 +02:00
|
|
|
#define G_TYPELIB_ERROR (g_typelib_error_quark ())
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2008-06-08 16:37:30 +02:00
|
|
|
GQuark g_typelib_error_quark (void);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
2014-07-04 12:18:32 +02:00
|
|
|
|
|
|
|
GI_AVAILABLE_IN_ALL
|
2010-08-31 22:36:06 +02:00
|
|
|
gboolean g_typelib_validate (GITypelib *typelib,
|
2008-08-09 14:55:32 +02:00
|
|
|
GError **error);
|
2008-02-08 16:31:03 +01:00
|
|
|
|
|
|
|
|
2010-06-15 17:01:37 +02:00
|
|
|
/* defined in gibaseinfo.c */
|
|
|
|
AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
|
|
|
|
guint32 blob_offset);
|
|
|
|
|
2013-10-10 22:21:18 +02:00
|
|
|
/**
|
|
|
|
* GITypelibHashBuilder:
|
|
|
|
*
|
|
|
|
* TODO
|
|
|
|
*/
|
2010-10-25 13:56:05 +02:00
|
|
|
typedef struct _GITypelibHashBuilder GITypelibHashBuilder;
|
|
|
|
|
|
|
|
GITypelibHashBuilder * _gi_typelib_hash_builder_new (void);
|
|
|
|
|
|
|
|
void _gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value);
|
|
|
|
|
|
|
|
gboolean _gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder);
|
|
|
|
|
|
|
|
guint32 _gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
|
|
|
|
|
|
|
|
void _gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size);
|
|
|
|
|
|
|
|
void _gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder);
|
|
|
|
|
2012-05-12 07:44:57 +02:00
|
|
|
guint16 _gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries);
|
2010-10-25 13:56:05 +02:00
|
|
|
|
|
|
|
|
2008-02-08 16:31:03 +01:00
|
|
|
G_END_DECLS
|