/* 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;
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 */
/*
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 {
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);
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_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);
* 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);
* 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);
/*
* 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);