#include <babeltrace/format.h>
static
-struct declaration *_float_declaration_new(struct type *type,
- struct declaration_scope *parent_scope);
+struct definition *_float_definition_new(struct type *type,
+ struct definition_scope *parent_scope);
static
-void _float_declaration_free(struct declaration *declaration);
+void _float_definition_free(struct definition *definition);
void float_copy(struct stream_pos *destp,
const struct format *fdest,
struct stream_pos *srcp,
const struct format *fsrc,
- struct declaration *declaration)
+ struct definition *definition)
{
- struct declaration_float *_float =
- container_of(declaration, struct declaration_float, p);
+ struct definition_float *_float =
+ container_of(definition, struct definition_float, p);
struct type_float *float_type = _float->type;
if (fsrc->float_copy == fdest->float_copy) {
{
struct type_float *float_type;
struct type *type;
- int ret;
float_type = g_new(struct type_float, 1);
type = &float_type->p;
+ type->id = CTF_TYPE_FLOAT;
type->name = g_quark_from_string(name);
type->alignment = alignment;
type->copy = float_copy;
type->type_free = _float_type_free;
- type->declaration_new = _float_declaration_new;
- type->declaration_free = _float_declaration_free;
+ type->definition_new = _float_definition_new;
+ type->definition_free = _float_definition_free;
type->ref = 1;
float_type->byte_order = byte_order;
float_type->sign = integer_type_new(NULL, 1,
byte_order, false, 1);
- if (!float_type->mantissa)
- goto error_sign;
float_type->mantissa = integer_type_new(NULL, mantissa_len - 1,
byte_order, false, 1);
- if (!float_type->mantissa)
- goto error_mantissa;
float_type->exp = integer_type_new(NULL, exp_len,
byte_order, true, 1);
- if (!float_type->exp)
- goto error_exp;
-
- if (float_type->p.name) {
- ret = register_type(&float_type->p);
- if (ret)
- goto error_register;
- }
return float_type;
-
-error_register:
- type_unref(&float_type->exp->p);
-error_exp:
- type_unref(&float_type->mantissa->p);
-error_mantissa:
- type_unref(&float_type->sign->p);
-error_sign:
- g_free(float_type);
- return NULL;
}
static
-struct declaration *
- _float_declaration_new(struct type *type,
- struct declaration_scope *parent_scope)
+struct definition *
+ _float_definition_new(struct type *type,
+ struct definition_scope *parent_scope)
{
struct type_float *float_type =
container_of(type, struct type_float, p);
- struct declaration_float *_float;
+ struct definition_float *_float;
- _float = g_new(struct declaration_float, 1);
- type_ref(&_float_type->p);
- _float->p.type= _float_type;
+ _float = g_new(struct definition_float, 1);
+ type_ref(&float_type->p);
+ _float->p.type= type;
+ _float->type= float_type;
_float->p.ref = 1;
_float->value = 0.0;
return &_float->p;
}
static
-void _float_declaration_free(struct declaration *declaration)
+void _float_definition_free(struct definition *definition)
{
- struct declaration_float *_float =
- container_of(declaration, struct declaration_float, p);
+ struct definition_float *_float =
+ container_of(definition, struct definition_float, p);
type_unref(_float->p.type);
g_free(_float);