+struct type_class_array {
+ struct type_class p;
+ size_t len;
+ struct type_class *elem;
+};
+
+struct type_class_sequence {
+ struct type_class p;
+ struct type_class_integer *len_class;
+ struct type_class *elem;
+};
+
+struct type_class *lookup_type(GQuark qname);
+int register_type(struct type_class *type_class);
+
+void type_ref(struct type_class *type_class);
+void type_unref(struct type_class *type_class);
+
+/* Nameless types can be created by passing a NULL name */
+
+struct type_class_integer *integer_type_new(const char *name,
+ size_t len, int byte_order,
+ int signedness,
+ size_t alignment);
+void integer_type_free(struct type_class_integer *int_class);
+
+/*
+ * mantissa_len is the length of the number of bytes represented by the mantissa
+ * (e.g. result of DBL_MANT_DIG). It includes the leading 1.
+ */
+struct type_class_float *float_type_new(const char *name,
+ size_t mantissa_len,
+ size_t exp_len, int byte_order,
+ size_t alignment);
+void float_type_free(struct type_class_float *float_class);
+
+/*
+ * A GQuark can be translated to/from strings with g_quark_from_string() and
+ * g_quark_to_string().
+ */
+
+/*
+ * Returns a GArray of GQuark or NULL.
+ * Caller must release the GArray with g_array_unref().
+ */
+GArray *enum_uint_to_quark_set(const struct type_class_enum *enum_class,
+ uint64_t v);
+
+/*
+ * Returns a GArray of GQuark or NULL.
+ * Caller must release the GArray with g_array_unref().
+ */
+GArray *enum_int_to_quark_set(const struct type_class_enum *enum_class,
+ uint64_t v);
+
+/*
+ * Returns a GArray of struct enum_range or NULL.
+ * Callers do _not_ own the returned GArray (and therefore _don't_ need to
+ * release it).
+ */
+GArray *enum_quark_to_range_set(const struct type_class_enum *enum_class,
+ GQuark q);
+void enum_signed_insert(struct type_class_enum *enum_class,
+ int64_t start, int64_t end, GQuark q);
+void enum_unsigned_insert(struct type_class_enum *enum_class,
+ uint64_t start, uint64_t end, GQuark q);
+
+struct type_class_enum *enum_type_new(const char *name,
+ size_t len, int byte_order,
+ int signedness,
+ size_t alignment);
+void enum_type_free(struct type_class_enum *enum_class);
+
+struct type_class_struct *struct_type_new(const char *name);
+void struct_type_free(struct type_class_struct *struct_class);
+void struct_type_add_field(struct type_class_struct *struct_class,
+ const char *field_name,
+ struct type_class *type_class);
+/*
+ * Returns the index of a field within a structure.
+ */
+unsigned long
+struct_type_lookup_field_index(struct type_class_struct *struct_class,
+ GQuark field_name);
+/*
+ * field returned only valid as long as the field structure is not appended to.
+ */
+struct field *
+struct_type_get_field_from_index(struct type_class_struct *struct_class,
+ unsigned long index);
+
+/*
+ * elem_class passed as parameter now belongs to the array. No need to free it
+ * explicitely.
+ */
+struct type_class_array *array_type_new(const char *name,
+ size_t len,
+ struct type_class *elem_class);
+void array_type_free(struct type_class_array *array_class);
+
+/*
+ * int_class and elem_class passed as parameter now belongs to the sequence. No
+ * need to free them explicitely.
+ */
+struct type_class_sequence *sequence_type_new(const char *name,
+ struct type_class_integer *len_class,
+ struct type_class *elem_class);
+void sequence_type_free(struct type_class_sequence *sequence_class);
+