const struct type_class_float *float_class)
{
union doubleIEEE754 u;
- struct type_class_float *dest_class = float_type_new(NULL,
+ struct type_class_float *dest_class = float_type_class_new(NULL,
DBL_MANT_DIG,
sizeof(double) * CHAR_BIT - DBL_MANT_DIG,
BYTE_ORDER,
align_pos(srcp, float_class->p.alignment);
init_pos(&destp, (char *) u.bits);
_ctf_float_copy(&destp, dest_class, srcp, float_class);
- float_type_free(dest_class);
+ type_class_unref(&dest_class->p);
return u.v;
}
double v)
{
union doubleIEEE754 u;
- struct type_class_float *src_class = float_type_new(NULL,
+ struct type_class_float *src_class = float_type_class_new(NULL,
DBL_MANT_DIG,
sizeof(double) * CHAR_BIT - DBL_MANT_DIG,
BYTE_ORDER,
align_pos(destp, float_class->p.alignment);
init_pos(&srcp, (char *) u.bits);
_ctf_float_copy(destp, float_class, &srcp, src_class);
- float_type_free(src_class);
+ type_class_unref(&src_class->p);
}
long double ctf_ldouble_read(struct stream_pos *srcp,
const struct type_class_float *float_class)
{
union ldoubleIEEE754 u;
- struct type_class_float *dest_class = float_type_new(NULL,
+ struct type_class_float *dest_class = float_type_class_new(NULL,
LDBL_MANT_DIG,
sizeof(long double) * CHAR_BIT - LDBL_MANT_DIG,
BYTE_ORDER,
align_pos(srcp, float_class->p.alignment);
init_pos(&destp, (char *) u.bits);
_ctf_float_copy(&destp, dest_class, srcp, float_class);
- float_type_free(dest_class);
+ type_class_unref(&dest_class->p);
return u.v;
}
long double v)
{
union ldoubleIEEE754 u;
- struct type_class_float *src_class = float_type_new(NULL,
+ struct type_class_float *src_class = float_type_class_new(NULL,
LDBL_MANT_DIG,
sizeof(long double) * CHAR_BIT - LDBL_MANT_DIG,
BYTE_ORDER,
align_pos(destp, float_class->p.alignment);
init_pos(&srcp, (char *) u.bits);
_ctf_float_copy(destp, float_class, &srcp, src_class);
- float_type_free(src_class);
+ type_class_unref(&src_class->p);
}
const struct type_class_struct *struct_class);
void ctf_struct_end(struct stream_pos *pos,
const struct type_class_struct *struct_class);
+void ctf_variant_begin(struct stream_pos *pos,
+ const struct type_class_variant *variant_class);
+void ctf_variant_end(struct stream_pos *pos,
+ const struct type_class_variant *variant_class);
void ctf_array_begin(struct stream_pos *pos,
const struct type_class_array *array_class);
void ctf_array_end(struct stream_pos *pos,
struct format;
struct type;
+/* Type declaration scope */
+struct declaration_scope {
+ /* Hash table mapping type name GQuark to struct type_class */
+ GHashTable *type_classes;
+ struct declaration_scope *parent_scope;
+};
+
struct type_class {
GQuark name; /* type name */
size_t alignment; /* type alignment, in bits */
struct field current_element; /* struct field */
};
-/* Type declaration scope */
-struct declaration_scope {
- /* Hash table mapping type name GQuark to struct type_class */
- GHashTable *type_classes;
- struct declaration_scope *parent_scope;
-};
-
struct type_class *lookup_type_class(GQuark qname,
struct declaration_scope *scope);
int register_type_class(struct type_class *type_class,