X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Ftypes.h;h=19022e194e39d9cefb05b446e38fde6e35d34b9a;hb=8fdba45b901de93c40077bf23466f702f2b15bf5;hp=c8e31337c7bf452baed599e0b3fd3dfd50998a53;hpb=d60cb676b003e5eb83566f9a2707b4dfea005020;p=babeltrace.git diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h index c8e31337..19022e19 100644 --- a/include/babeltrace/types.h +++ b/include/babeltrace/types.h @@ -90,6 +90,7 @@ struct definition; /* type scope */ struct declaration_scope { /* Hash table mapping type name GQuark to "struct declaration" */ + /* Used for both typedef and typealias. */ GHashTable *typedef_declarations; /* Hash table mapping struct name GQuark to "struct declaration_struct" */ GHashTable *struct_declarations; @@ -132,7 +133,6 @@ enum ctf_type_id { struct declaration { enum ctf_type_id id; - GQuark name; /* type name */ size_t alignment; /* type alignment, in bits */ int ref; /* number of references to the type */ /* @@ -252,8 +252,15 @@ struct definition_enum { GArray *value; }; +enum ctf_string_encoding { + CTF_STRING_UTF8 = 0, + CTF_STRING_ASCII, + CTF_STRING_UNKNOWN, +}; + struct declaration_string { struct declaration p; + enum ctf_string_encoding encoding; }; struct definition_string { @@ -397,18 +404,14 @@ void declaration_unref(struct declaration *declaration); void definition_ref(struct definition *definition); void definition_unref(struct definition *definition); -/* Nameless declarations can be created by passing a NULL name */ - -struct declaration_integer *integer_declaration_new(const char *name, - size_t len, int byte_order, +struct declaration_integer *integer_declaration_new(size_t len, int byte_order, int signedness, size_t alignment); /* * 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 declaration_float *float_declaration_new(const char *name, - size_t mantissa_len, +struct declaration_float *float_declaration_new(size_t mantissa_len, size_t exp_len, int byte_order, size_t alignment); @@ -445,12 +448,13 @@ void enum_unsigned_insert(struct declaration_enum *enum_declaration, size_t enum_get_nr_enumerators(struct declaration_enum *enum_declaration); struct declaration_enum * - enum_declaration_new(const char *name, - struct declaration_integer *integer_declaration); + enum_declaration_new(struct declaration_integer *integer_declaration); + +struct declaration_string * + string_declaration_new(enum ctf_string_encoding encoding); struct declaration_struct * - struct_declaration_new(const char *name, - struct declaration_scope *parent_scope); + struct_declaration_new(struct declaration_scope *parent_scope); void struct_declaration_add_field(struct declaration_struct *struct_declaration, const char *field_name, struct declaration *field_declaration); @@ -474,7 +478,7 @@ struct_get_field_from_index(struct definition_struct *struct_definition, * from numeric values to a single tag. Overlapping tag value ranges are * therefore forbidden. */ -struct declaration_untagged_variant *untagged_variant_declaration_new(const char *name, +struct declaration_untagged_variant *untagged_variant_declaration_new( struct declaration_scope *parent_scope); struct declaration_variant *variant_declaration_new(struct declaration_untagged_variant *untagged_variant, const char *tag); @@ -503,8 +507,7 @@ struct field *variant_get_current_field(struct definition_variant *variant); * array. */ struct declaration_array * - array_declaration_new(const char *name, - size_t len, struct declaration *elem_declaration, + array_declaration_new(size_t len, struct declaration *elem_declaration, struct declaration_scope *parent_scope); /* @@ -512,8 +515,7 @@ struct declaration_array * * to the sequence. No need to free them explicitly. */ struct declaration_sequence * - sequence_declaration_new(const char *name, - struct declaration_integer *len_declaration, + sequence_declaration_new(struct declaration_integer *len_declaration, struct declaration *elem_declaration, struct declaration_scope *parent_scope);