+static
+struct definition *_integer_definition_new(struct declaration *declaration,
+ struct definition_scope *parent_scope,
+ GQuark field_name, int index,
+ const char *root_name);
+static
+void _integer_definition_free(struct definition *definition);
+
+static
+void _integer_declaration_free(struct declaration *declaration)
+{
+ struct declaration_integer *integer_declaration =
+ container_of(declaration, struct declaration_integer, p);
+ g_free(integer_declaration);
+}
+
+struct declaration_integer *
+ integer_declaration_new(size_t len, int byte_order,
+ int signedness, size_t alignment, int base,
+ enum ctf_string_encoding encoding,
+ struct ctf_clock *clock)
+{
+ struct declaration_integer *integer_declaration;
+
+ integer_declaration = g_new(struct declaration_integer, 1);
+ integer_declaration->p.id = CTF_TYPE_INTEGER;
+ integer_declaration->p.alignment = alignment;
+ integer_declaration->p.declaration_free = _integer_declaration_free;
+ integer_declaration->p.definition_free = _integer_definition_free;
+ integer_declaration->p.definition_new = _integer_definition_new;
+ integer_declaration->p.ref = 1;
+ integer_declaration->len = len;
+ integer_declaration->byte_order = byte_order;
+ integer_declaration->signedness = signedness;
+ integer_declaration->base = base;
+ integer_declaration->encoding = encoding;
+ integer_declaration->clock = clock;
+ return integer_declaration;
+}
+
+static
+struct definition *
+ _integer_definition_new(struct declaration *declaration,
+ struct definition_scope *parent_scope,
+ GQuark field_name, int index,
+ const char *root_name)
+{
+ struct declaration_integer *integer_declaration =
+ container_of(declaration, struct declaration_integer, p);
+ struct definition_integer *integer;
+ int ret;
+
+ integer = g_new(struct definition_integer, 1);
+ declaration_ref(&integer_declaration->p);
+ integer->p.declaration = declaration;
+ integer->declaration = integer_declaration;
+ integer->p.ref = 1;
+ /*
+ * Use INT_MAX order to ensure that all fields of the parent
+ * scope are seen as being prior to this scope.
+ */
+ integer->p.index = root_name ? INT_MAX : index;
+ integer->p.name = field_name;
+ integer->p.path = new_definition_path(parent_scope, field_name,
+ root_name);
+ integer->p.scope = NULL;
+ integer->value._unsigned = 0;
+ ret = register_field_definition(field_name, &integer->p,
+ parent_scope);
+ assert(!ret);
+ return &integer->p;
+}
+
+static
+void _integer_definition_free(struct definition *definition)
+{
+ struct definition_integer *integer =
+ container_of(definition, struct definition_integer, p);
+
+ declaration_unref(integer->p.declaration);
+ g_free(integer);
+}
+
+enum ctf_string_encoding get_int_encoding(const struct definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->encoding;
+}
+
+int get_int_base(const struct definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->base;
+}
+
+int get_int_byte_order(const struct definition *field)
+{
+ struct definition_integer *integer_definition;
+ const struct declaration_integer *integer_declaration;
+
+ integer_definition = container_of(field, struct definition_integer, p);
+ integer_declaration = integer_definition->declaration;
+
+ return integer_declaration->byte_order;
+}
+
+int get_int_signedness(const struct definition *field)