*
* The typelib has the following general format.
*
- * typelib ::= header, directory, blobs, annotations
+ * typelib ::= header, directory, blobs, attributes, attributedata
*
* directory ::= list of entries
*
* entry ::= blob type, name, namespace, offset
* blob ::= function|callback|struct|boxed|enum|flags|object|interface|constant|errordomain|union
- * annotations ::= list of annotations, sorted by offset
- * annotation ::= offset, key, value
+ * attributes ::= list of attributes, sorted by offset
+ * attribute ::= offset, key, value
+ * attributedata ::= string data for attributes
*
* Details
*
TYPELIB HISTORY
-----
Version 1.0
+- Rename class_struct to gtype_struct, add to interfaces
Changes since 0.9:
- Add padding to structures
* @n_local_entries: The number of entries referring to blobs in this typelib. The
* local entries must occur before the unresolved entries.
* @directory: Offset of the directory in the typelib.
- * @n_annotations: Number of annotation blocks
- * @annotations: Offset of the list of annotations in the typelib.
+ * @n_attributes: Number of attribute blocks
+ * @attributes: Offset of the list of attributes in the typelib.
* @dependencies: Offset of a single string, which is the list of
* dependencies, separated by the '|' character. The
* dependencies are required in order to avoid having programs
* @property_blob_size: See above.
* @field_blob_size: See above.
* @value_blob_size: See above.
- * @annotation_blob_size: See above.
+ * @attribute_blob_size: See above.
* @constant_blob_size: See above.
* @object_blob_size: See above.
* @union_blob_size: See above.
guint16 n_entries;
guint16 n_local_entries;
guint32 directory;
- guint32 n_annotations;
- guint32 annotations;
+ guint32 n_attributes;
+ guint32 attributes;
guint32 dependencies;
guint32 namespace;
guint32 nsversion;
guint32 shared_library;
+ guint32 c_prefix;
guint16 entry_blob_size;
guint16 function_blob_size;
guint16 property_blob_size;
guint16 field_blob_size;
guint16 value_blob_size;
- guint16 annotation_blob_size;
+ guint16 attribute_blob_size;
guint16 constant_blob_size;
guint16 error_domain_blob_size;
* @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 "reserved2", 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.
+ *
+ * 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
{
guint pointer : 1;
guint reserved3 : 2;
guint tag : 5;
- };
+ } flags;
guint32 offset;
} SimpleTypeBlob;
* @tag: A #GITypeTag
* @interface: Index of the directory entry for the interface.
*
- * Types which are described by an entry in the typelib have a tag value of 21.
* If the interface is an enum of flags type, is_pointer is 0, otherwise it is 1.
*/
typedef struct {
* direction as this one.
* @type: The type of the array elements.
*
- * Arrays have a tag value of 20. They are passed by reference, thus is_pointer
- * is always 1.
+ * Arrays are passed by reference, thus is_pointer is always 1.
*/
typedef struct {
guint16 pointer :1;
union {
guint16 length;
guint16 size;
- };
+ } dimensions;
SimpleTypeBlob type;
} ArrayTypeBlob;
guint32 deprecated : 1;
guint32 reserved :31;
guint32 name;
- guint32 value;
+ gint32 value;
} ValueBlob;
/**
* @name: The name of the field.
* @readable:
* @writable: How the field may be accessed.
+ * @has_embedded_type: An anonymous type follows the FieldBlob.
* @bits: If this field is part of a bitfield, the number of bits which it
* uses, otherwise 0.
* @struct_offset:
guint8 readable :1;
guint8 writable :1;
- guint8 reserved :6;
+ guint8 has_embedded_type :1;
+ guint8 reserved :5;
guint8 bits;
guint16 struct_offset;
* @deprecated: Whether this structure is deprecated
* @unregistered: If this is set, the type is not registered with GType.
* @alignment: The byte boundary that the struct is aligned to in memory
- * @is_class_struct: Whether this structure is the "class structure" for a GObject
+ * @is_gtype_struct: Whether this structure is the class or interface layout for a GObject
* @size: The size of the struct in bytes.
* @gtype_name: String name of the associated #GType
* @gtype_init: String naming the symbol which gets the runtime #GType
guint16 deprecated : 1;
guint16 unregistered : 1;
- guint16 is_class_struct : 1;
+ guint16 is_gtype_struct : 1;
guint16 alignment : 6;
guint16 reserved : 7;
* @class_closure: Set if this virtual function is the class closure of a signal.
* @signal: The index of the signal in the list of signals of the object or
* interface to which this virtual function belongs.
- * @struct_offset:
- * The offset of the function pointer in the class struct. The value
+ * @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.
* @signature:
* Offset of the SignatureBlob describing the parameter types and the
* return value type.
guint16 signal;
guint16 struct_offset;
- guint16 reserved2;
+ guint16 invoker : 10; /* Number of bits matches @index in FunctionBlob */
+ guint16 reserved2 : 6;
guint32 reserved3;
guint32 signature;
guint32 gtype_init;
guint16 parent;
- guint16 class_struct;
+ guint16 gtype_struct;
guint16 n_interfaces;
guint16 n_fields;
/**
* InterfaceBlob:
+ * @gtype_struct: Name of the interface "class" C structure
* @n_prerequisites: Number of prerequisites
* @n_properties: Number of properties
* @n_methods: Number of methods
guint32 gtype_name;
guint32 gtype_init;
+ guint16 gtype_struct;
guint16 n_prerequisites;
guint16 n_properties;
} ConstantBlob;
/**
- * AnnotationBlob:
- * @offset: The offset of the typelib entry to which this annotation refers.
- * Annotations are kept sorted by offset, so that the annotations
+ * AttributeBlob:
+ * @offset: The offset of the typelib entry to which this attribute refers.
+ * Attributes are kept sorted by offset, so that the attributes
* of an entry can be found by a binary search.
- * @name: The name of the annotation, a string.
- * @value: The value of the annotation (also a string)
+ * @name: The name of the attribute, a string.
+ * @value: The value of the attribute (also a string)
*/
typedef struct {
guint32 offset;
guint32 name;
guint32 value;
-} AnnotationBlob;
+} AttributeBlob;
struct _GTypelib {
guchar *data;
gboolean owns_memory;
GMappedFile *mfile;
GList *modules;
+ gboolean open_attempted;
};
DirEntry *g_typelib_get_dir_entry (GTypelib *typelib,