Enumerations can be negative
[gnome.gobject-introspection] / girepository / gtypelib.h
index d4afa89..f02dcfc 100644 (file)
@@ -303,6 +303,20 @@ typedef struct {
  * @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
 {
@@ -313,7 +327,7 @@ typedef union
     guint pointer    : 1;
     guint reserved3  : 2;
     guint tag        : 5;    
-  };
+  } flags;
   guint32    offset;
 } SimpleTypeBlob;
 
@@ -492,7 +506,6 @@ typedef struct {
  * @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 {
@@ -516,8 +529,7 @@ 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;
@@ -532,7 +544,7 @@ typedef struct {
   union {
     guint16 length;
     guint16 size;
-  };
+  } dimensions;
 
   SimpleTypeBlob type;
 } ArrayTypeBlob;
@@ -602,7 +614,7 @@ typedef struct {
   guint32 deprecated : 1;
   guint32 reserved   :31;
   guint32 name;
-  guint32 value;
+  gint32 value;
 } ValueBlob;
 
 /**
@@ -610,6 +622,7 @@ typedef struct {
  * @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:
@@ -622,7 +635,8 @@ typedef struct {
 
   guint8         readable :1; 
   guint8         writable :1;
-  guint8         reserved :6;
+  guint8         has_embedded_type :1;
+  guint8         reserved :5;
   guint8         bits;
 
   guint16        struct_offset;
@@ -1023,6 +1037,7 @@ struct _GTypelib {
   gboolean owns_memory;
   GMappedFile *mfile;
   GList *modules;
+  gboolean open_attempted;
 };
 
 DirEntry *g_typelib_get_dir_entry (GTypelib *typelib,