Rename "declaration" to "definition"
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Apr 2011 19:45:10 +0000 (15:45 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Apr 2011 19:45:10 +0000 (15:45 -0400)
Follow current CTF pre-v1.7 as of
commit 457d8b0a0cff67a7489b7eead5b8b26701b430f8

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 files changed:
formats/ctf/metadata/ctf-visitor-generate-io-struct.c
include/babeltrace/ctf/metadata.h
include/babeltrace/types.h
types/array.c
types/enum.c
types/float.c
types/integer.c
types/sequence.c
types/string.c
types/struct.c
types/types.c
types/variant.c

index d3ee63fa99d4788c76bde546bf38b874684c6a97..2b8b676b3c36cef3beffc87a2c2ce66df4875abd 100644 (file)
@@ -210,7 +210,7 @@ static
 struct ctf_type *ctf_type_specifier_visit(FILE *fd,
                                          int depth, struct list_head *head,
                                          struct type_scope *type_scope,
-                                         struct declaration_scope *declaration_scope)
+                                         struct definition_scope *definition_scope)
 {
        struct ctf_type *type;
        struct node *first;
@@ -247,19 +247,19 @@ static
 struct ctf_declaration *ctf_declaration_specifier_visit(FILE *fd,
                                        int depth, struct list_head *head,
                                        struct type_scope *type_scope,
-                                       struct declaration_scope *declaration_scope)
+                                       struct definition_scope *definition_scope)
 {
        struct ctf_declaration *declaration;
        struct ctf_type *type;
 
        type = ctf_type_specifier_visit(fd, depth, head, type_scope,
-                                       declaration_scope);
-       declaration = type->declaration_new(type, declaration_scope);
+                                       definition_scope);
+       declaration = type->declaration_new(type, definition_scope);
        if (type->id == CTF_TYPE_VARIANT) {
                struct declaration_variant *variant =
                        container_of(declaration, struct declaration_variant, p);
                struct declaration *enum_tag =
-                       lookup_field_declaration(enum_tag_name, declaration_scope);
+                       lookup_field_declaration(enum_tag_name, definition_scope);
                if (!enum_tag) {
                        fprintf(fd, "[error]: expected enumeration tag field %s for variant\n",
                                enum_tag_name);
@@ -279,7 +279,7 @@ static
 int ctf_typedef_declarator_visit(FILE *fd, int depth,
                                struct list_head *declaration_specifier,
                                struct node *type_declarator, struct type_scope *type_scope,
-                               struct declaration_scope *declaration_scope)
+                               struct definition_scope *definition_scope)
 {
        /*
         * Build the type using declaration specifier (creating
@@ -298,14 +298,14 @@ int ctf_typedef_visit(FILE *fd, int depth,
                      struct list_head *declaration_specifier,
                      struct list_head *type_declarators,
                      struct type_scope *type_scope,
-                     struct declaration_scope *declaration_scope)
+                     struct definition_scope *definition_scope)
 {
        struct ctf_node *iter;
 
        cds_list_for_each_entry(iter, type_declarators, siblings) {
                ret = ctf_typedef_declarator_visit(fd, depth + 1,
                        &node->u._typedef.declaration_specifier, iter,
-                       type_scope, declaration_scope);
+                       type_scope, definition_scope);
                if (ret)
                        return ret;
        }
@@ -315,7 +315,7 @@ int ctf_typedef_visit(FILE *fd, int depth,
 static
 int ctf_typealias_visit(FILE *fd, int depth, struct ctf_node *target,
                        struct ctf_node *alias, struct type_scope *type_scope,
-                       struct declaration_scope *declaration_scope)
+                       struct definition_scope *definition_scope)
 {
        /* Build target type, check that it is reachable in current type scope. */
        /* Only one type declarator is allowed */
@@ -334,14 +334,14 @@ int ctf_event_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                ret = ctf_typedef_visit(fd, depth + 1,
                                        &node->u._typedef.declaration_specifier,
                                        &node->u._typedef.type_declarators,
-                                       event->type_scope, event->declaration_scope);
+                                       event->type_scope, event->definition_scope);
                if (ret)
                        return ret;
                break;
        case NODE_TYPEALIAS:
                ret = ctf_typealias_visit(fd, depth + 1,
                                &node->u.typealias.target, &node->u.typealias.alias
-                               event->type_scope, event->declaration_scope);
+                               event->type_scope, event->definition_scope);
                if (ret)
                        return ret;
                break;
@@ -385,8 +385,8 @@ int ctf_event_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                                fprintf(stderr, "[error] %s: stream id %" PRIu64 " cannot be found\n", __func__, event->stream_id);
                                return -EINVAL;
                        }
-                       event->declaration_scope = new_declaration_scope(stream->declaration_scope);
-                       if (!event->declaration_scope) {
+                       event->definition_scope = new_definition_scope(stream->definition_scope);
+                       if (!event->definition_scope) {
                                fprintf(stderr, "[error] %s: Error allocating declaration scope\n", __func__);
                                return -EPERM;
                        }
@@ -394,11 +394,11 @@ int ctf_event_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                } else if (!strcmp(left, "context")) {
                        struct declaration *declaration;
 
-                       if (!event->declaration_scope)
+                       if (!event->definition_scope)
                                return -EPERM;
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       event->type_scope, event->declaration_scope);
+                                       event->type_scope, event->definition_scope);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -407,11 +407,11 @@ int ctf_event_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                } else if (!strcmp(left, "fields")) {
                        struct declaration *declaration;
 
-                       if (!event->declaration_scope)
+                       if (!event->definition_scope)
                                return -EPERM;
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       event->type_scope, event->declaration_scope);
+                                       event->type_scope, event->definition_scope);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -467,7 +467,7 @@ int ctf_event_visit(FILE *fd, int depth, struct ctf_node *node,
 error:
        declaration_unref(event->fields);
        declaration_unref(event->context);
-       free_declaration_scope(event->declaration_scope);
+       free_definition_scope(event->definition_scope);
        free_type_scope(event->type_scope);
        g_free(event);
        return ret;
@@ -484,14 +484,14 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
                ret = ctf_typedef_visit(fd, depth + 1,
                                        &node->u._typedef.declaration_specifier,
                                        &node->u._typedef.type_declarators,
-                                       stream->type_scope, stream->declaration_scope);
+                                       stream->type_scope, stream->definition_scope);
                if (ret)
                        return ret;
                break;
        case NODE_TYPEALIAS:
                ret = ctf_typealias_visit(fd, depth + 1,
                                &node->u.typealias.target, &node->u.typealias.alias
-                               stream->type_scope, stream->declaration_scope);
+                               stream->type_scope, stream->definition_scope);
                if (ret)
                        return ret;
                break;
@@ -514,7 +514,7 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
 
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       stream->type_scope, stream->declaration_scope);
+                                       stream->type_scope, stream->definition_scope);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -525,7 +525,7 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
 
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       stream->type_scope, stream->declaration_scope);
+                                       stream->type_scope, stream->definition_scope);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -536,7 +536,7 @@ int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, str
 
                        declaration = ctf_declaration_specifier_visit(fd, depth,
                                        &node->u.ctf_expression.right,
-                                       stream->type_scope, stream->declaration_scope);
+                                       stream->type_scope, stream->definition_scope);
                        if (!declaration)
                                return -EPERM;
                        if (declaration->type->id != CTF_TYPE_STRUCT)
@@ -564,7 +564,7 @@ int ctf_stream_visit(FILE *fd, int depth, struct ctf_node *node,
 
        stream = g_new0(struct ctf_stream, 1);
        stream->type_scope = new_type_scope(parent_type_scope);
-       stream->declaration_scope = new_declaration_scope(trace->declaration_scope);
+       stream->definition_scope = new_definition_scope(trace->definition_scope);
        stream->events_by_id = g_ptr_array_new();
        stream->event_quark_to_id = g_hash_table_new(g_int_hash, g_int_equal);
        cds_list_for_each_entry(iter, &node->u.stream.declaration_list, siblings) {
@@ -587,7 +587,7 @@ error:
        declaration_unref(stream->packet_context);
        g_ptr_array_free(stream->events_by_id, TRUE);
        g_hash_table_free(stream->event_quark_to_id);
-       free_declaration_scope(stream->declaration_scope);
+       free_definition_scope(stream->definition_scope);
        free_type_scope(stream->type_scope);
        g_free(stream);
        return ret;
@@ -603,14 +603,14 @@ int ctf_trace_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                ret = ctf_typedef_visit(fd, depth + 1,
                                        &node->u._typedef.declaration_specifier,
                                        &node->u._typedef.type_declarators,
-                                       trace->type_scope, trace->declaration_scope);
+                                       trace->type_scope, trace->definition_scope);
                if (ret)
                        return ret;
                break;
        case NODE_TYPEALIAS:
                ret = ctf_typealias_visit(fd, depth + 1,
                                &node->u.typealias.target, &node->u.typealias.alias
-                               trace->type_scope, trace->declaration_scope);
+                               trace->type_scope, trace->definition_scope);
                if (ret)
                        return ret;
                break;
@@ -677,7 +677,7 @@ int ctf_trace_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace
        if (trace->type_scope)
                return -EEXIST;
        trace->type_scope = new_type_scope(trace->root_type_scope);
-       trace->declaration_scope = new_declaration_scope(trace->root_declaration_scope);
+       trace->definition_scope = new_definition_scope(trace->root_definition_scope);
        trace->streams = g_ptr_array_new();
        cds_list_for_each_entry(iter, &node->u.trace.declaration_list, siblings) {
                ret = ctf_trace_declaration_visit(fd, depth + 1, iter, trace);
@@ -704,7 +704,7 @@ int ctf_trace_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace
 
 error:
        g_ptr_array_free(trace->streams, TRUE);
-       free_declaration_scope(stream->declaration_scope);
+       free_definition_scope(stream->definition_scope);
        free_type_scope(stream->type_scope);
        return ret;
 }
@@ -721,7 +721,7 @@ int _ctf_visitor(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace *t
                        ret = ctf_typedef_visit(fd, depth + 1,
                                                &iter->u._typedef.declaration_specifier,
                                                &iter->u._typedef.type_declarators,
-                                               trace->type_scope, trace->declaration_scope);
+                                               trace->type_scope, trace->definition_scope);
                        if (ret)
                                return ret;
                }
@@ -729,14 +729,14 @@ int _ctf_visitor(FILE *fd, int depth, struct ctf_node *node, struct ctf_trace *t
                                        siblings) {
                        ret = ctf_typealias_visit(fd, depth + 1,
                                        &iter->u.typealias.target, &iter->u.typealias.alias
-                                       trace->type_scope, trace->declaration_scope);
+                                       trace->type_scope, trace->definition_scope);
                        if (ret)
                                return ret;
                }
                cds_list_for_each_entry(iter, &node->u.root.declaration_specifier, siblings) {
                        ret = ctf_declaration_specifier_visit(fd, depth, iter,
                                        trace->root_type_scope,
-                                       trace->root_declaration_scope);
+                                       trace->root_definition_scope);
                        if (ret)
                                return ret;
                }
index e9ab83dde971faf91dd330ec437a9ebba4f01ba2..5547480922ede2466ea78fac251caad80404797c 100644 (file)
@@ -48,10 +48,10 @@ struct ctf_trace {
        /* root scope */
        struct type_scope *root_type_scope;
        /* root scope */
-       struct declaration_scope *root_declaration_scope;
+       struct definition_scope *root_definition_scope;
 
        struct type_scope *type_scope;
-       struct declaration_scope *declaration_scope;
+       struct definition_scope *definition_scope;
        GPtrArray *streams;                     /* Array of struct ctf_stream pointers*/
 
        uint64_t major;
@@ -87,13 +87,13 @@ struct ctf_stream {
        /* parent is lexical scope conaining the stream scope */
        struct type_scope *type_scope;
        /* parent is trace scope */
-       struct declaration_scope *declaration_scope;
+       struct definition_scope *definition_scope;
        GPtrArray *events_by_id;                /* Array of struct ctf_event pointers indexed by id */
        GHashTable *event_quark_to_id;          /* GQuark to numeric id */
 
-       struct declaration_struct *event_header;
-       struct declaration_struct *event_context;
-       struct declaration_struct *packet_context;
+       struct definition_struct *event_header;
+       struct definition_struct *event_context;
+       struct definition_struct *packet_context;
 
        uint64_t stream_id;
 
@@ -122,9 +122,9 @@ struct ctf_event {
        /* parent is lexical scope conaining the event scope */
        struct type_scope *type_scope;
        /* parent is stream scope */
-       struct declaration_scope *declaration_scope;
-       struct declaration_struct *context;
-       struct declaration_struct *fields;
+       struct definition_scope *definition_scope;
+       struct definition_struct *context;
+       struct definition_struct *fields;
 
        GQuark name;
        uint64_t id;            /* Numeric identifier within the stream */
index c8595f1231571bb573cbd0bb6358456f77cd49cd..144b018a6146264f76819a29cfbda2f4c3612d8e 100644 (file)
@@ -85,12 +85,12 @@ char *get_pos_addr(struct stream_pos *pos)
 }
 
 struct format;
-struct declaration;
+struct definition;
 
 /* type scope */
 struct type_scope {
        /* Hash table mapping type name GQuark to "struct declaration" */
-       GHashTable *type_declarations;
+       GHashTable *type_definitions;
        /* Hash table mapping struct name GQuark to "struct type_struct" */
        GHashTable *struct_types;
        /* Hash table mapping variant name GQuark to "struct type_variant" */
@@ -100,11 +100,11 @@ struct type_scope {
        struct type_scope *parent_scope;
 };
 
-/* declaration scope */
-struct declaration_scope {
-       /* Hash table mapping field name GQuark to "struct declaration" */
-       GHashTable *declarations;
-       struct declaration_scope *parent_scope;
+/* definition scope */
+struct definition_scope {
+       /* Hash table mapping field name GQuark to "struct definition" */
+       GHashTable *definitions;
+       struct definition_scope *parent_scope;
 };
 
 enum ctf_type_id {
@@ -129,25 +129,25 @@ struct type {
         * type_free called with type ref is decremented to 0.
         */
        void (*type_free)(struct type *type);
-       struct declaration *
-               (*declaration_new)(struct type *type,
-                                  struct declaration_scope *parent_scope);
+       struct definition *
+               (*definition_new)(struct type *type,
+                                 struct definition_scope *parent_scope);
        /*
-        * declaration_free called with declaration ref is decremented to 0.
+        * definition_free called with definition ref is decremented to 0.
         */
-       void (*declaration_free)(struct declaration *declaration);
+       void (*definition_free)(struct definition *definition);
        /*
-        * Declaration copy function. Knows how to find the child declaration
-        * from the parent declaration.
+        * Definition copy function. Knows how to find the child
+        * definition from the parent definition.
         */
        void (*copy)(struct stream_pos *dest, const struct format *fdest, 
                     struct stream_pos *src, const struct format *fsrc,
-                    struct declaration *declaration);
+                    struct definition *definition);
 };
 
-struct declaration {
+struct definition {
        struct type *type;
-       int ref;                /* number of references to the declaration */
+       int ref;                /* number of references to the definition */
 };
 
 /*
@@ -162,8 +162,8 @@ struct type_integer {
        int signedness;
 };
 
-struct declaration_integer {
-       struct declaration p;
+struct definition_integer {
+       struct definition p;
        struct type_integer *type;
        /* Last values read */
        union {
@@ -181,8 +181,8 @@ struct type_float {
        /* TODO: we might want to express more info about NaN, +inf and -inf */
 };
 
-struct declaration_float {
-       struct declaration p;
+struct definition_float {
+       struct definition p;
        struct type_float *type;
        /* Last values read */
        long double value;
@@ -232,9 +232,9 @@ struct type_enum {
        struct enum_table table;
 };
 
-struct declaration_enum {
-       struct declaration p;
-       struct declaration_integer *integer;
+struct definition_enum {
+       struct definition p;
+       struct definition_integer *integer;
        struct type_enum *type;
        /* Last GQuark values read. Keeping a reference on the GQuark array. */
        GArray *value;
@@ -244,10 +244,10 @@ struct type_string {
        struct type p;
 };
 
-struct declaration_string {
-       struct declaration p;
+struct definition_string {
+       struct definition p;
        struct type_string *type;
-       char *value;    /* freed at declaration_string teardown */
+       char *value;    /* freed at definition_string teardown */
 };
 
 struct type_field {
@@ -257,7 +257,7 @@ struct type_field {
 
 struct field {
        GQuark name;
-       struct declaration *declaration;
+       struct definition *definition;
 };
 
 struct type_struct {
@@ -267,10 +267,10 @@ struct type_struct {
        GArray *fields;                 /* Array of type_field */
 };
 
-struct declaration_struct {
-       struct declaration p;
+struct definition_struct {
+       struct definition p;
        struct type_struct *type;
-       struct declaration_scope *scope;
+       struct definition_scope *scope;
        GArray *fields;                 /* Array of struct field */
 };
 
@@ -283,11 +283,11 @@ struct type_variant {
        /* Tag name must be nonzero and must exist when defining the variant */
 };
 
-struct declaration_variant {
-       struct declaration p;
+struct definition_variant {
+       struct definition p;
        struct type_variant *type;
-       struct declaration_scope *scope;
-       struct declaration *enum_tag;
+       struct definition_scope *scope;
+       struct definition *enum_tag;
        GArray *fields;                 /* Array of struct field */
        struct field *current_field;    /* Last field read */
 };
@@ -299,10 +299,10 @@ struct type_array {
        struct type_scope *scope;
 };
 
-struct declaration_array {
-       struct declaration p;
+struct definition_array {
+       struct definition p;
        struct type_array *type;
-       struct declaration_scope *scope;
+       struct definition_scope *scope;
        struct field current_element;           /* struct field */
 };
 
@@ -313,26 +313,22 @@ struct type_sequence {
        struct type_scope *scope;
 };
 
-struct declaration_sequence {
-       struct declaration p;
+struct definition_sequence {
+       struct definition p;
        struct type_sequence *type;
-       struct declaration_scope *scope;
-       struct declaration_integer *len;
+       struct definition_scope *scope;
+       struct definition_integer *len;
        struct field current_element;           /* struct field */
 };
 
-/*
- * type_declaration is for typedef and typealias. They are registered
- * into type scopes.
- */
-int register_type_declaration(GQuark type_name, struct declaration *declaration,
-                             struct type_scope *scope);
-struct declaration *lookup_type_declaration(GQuark type_name,
-                                           struct type_scope *scope);
+int register_type(GQuark type_name, struct definition *definition,
+                 struct type_scope *scope);
+struct definition *lookup_type(GQuark type_name,
+                              struct type_scope *scope);
 
 /*
  * Type scopes also contain a separate registry for struct, variant and
- * enum types. Those register types rather than type declarations, so
+ * enum types. Those register types rather than type definitions, so
  * that a named variant can be declared without specifying its target
  * "choice" tag field immediately.
  */
@@ -354,24 +350,24 @@ struct type_scope *new_type_scope(struct type_scope *parent_scope);
 void free_type_scope(struct type_scope *scope);
 
 /*
- * field_declaration is for field declarations. They are registered into
- * declaration scopes.
+ * field_definition is for field definitions. They are registered into
+ * definition scopes.
  */
-struct declaration *
-       lookup_field_declaration(GQuark field_name,
-                                struct declaration_scope *scope);
-int register_field_declaration(GQuark field_name,
-                              struct declaration *declaration,
-                              struct declaration_scope *scope);
-struct declaration_scope *
-       new_declaration_scope(struct declaration_scope *parent_scope);
-void free_declaration_scope(struct declaration_scope *scope);
+struct definition *
+       lookup_field_definition(GQuark field_name,
+                               struct definition_scope *scope);
+int register_field_definition(GQuark field_name,
+                             struct definition *definition,
+                             struct definition_scope *scope);
+struct definition_scope *
+       new_definition_scope(struct definition_scope *parent_scope);
+void free_definition_scope(struct definition_scope *scope);
 
 void type_ref(struct type *type);
 void type_unref(struct type *type);
 
-void declaration_ref(struct declaration *declaration);
-void declaration_unref(struct declaration *declaration);
+void definition_ref(struct definition *definition);
+void definition_unref(struct definition *definition);
 
 /* Nameless types can be created by passing a NULL name */
 
@@ -436,7 +432,7 @@ struct type_field *
 struct_type_get_field_from_index(struct type_struct *struct_type,
                                 unsigned long index);
 struct field *
-struct_get_field_from_index(struct declaration_struct *struct_declaration,
+struct_get_field_from_index(struct definition_struct *struct_definition,
                            unsigned long index);
 
 /*
@@ -453,15 +449,15 @@ variant_type_get_field_from_tag(struct type_variant *variant_type, GQuark tag);
 /*
  * Returns 0 on success, -EPERM on error.
  */
-int variant_declaration_set_tag(struct declaration_variant *variant,
-                               struct declaration *enum_tag);
+int variant_definition_set_tag(struct definition_variant *variant,
+                              struct definition *enum_tag);
 /*
  * Returns the field selected by the current tag value.
  * field returned only valid as long as the variant structure is not appended
  * to.
  */
 struct field *
-variant_get_current_field(struct declaration_variant *variant);
+variant_get_current_field(struct definition_variant *variant);
 
 /*
  * elem_type passed as parameter now belongs to the array. No need to free it
index 02a154e9ab148ea9abd843821a2ae6eca13ac4fc..b13ba39267c0dbbec791c2d30980ef50938d5cfa 100644 (file)
 #include <babeltrace/format.h>
 
 static
-struct declaration *_array_declaration_new(struct type *type,
-                       struct declaration_scope *parent_scope);
+struct definition *_array_definition_new(struct type *type,
+                       struct definition_scope *parent_scope);
 static
-void _array_declaration_free(struct declaration *declaration);
+void _array_definition_free(struct definition *definition);
 
 void array_copy(struct stream_pos *dest, const struct format *fdest, 
                struct stream_pos *src, const struct format *fsrc,
-               struct declaration *declaration)
+               struct definition *definition)
 {
-       struct declaration_array *array =
-               container_of(declaration, struct declaration_array, p);
+       struct definition_array *array =
+               container_of(definition, struct definition_array, p);
        struct type_array *array_type = array->type;
        uint64_t i;
 
@@ -38,7 +38,7 @@ void array_copy(struct stream_pos *dest, const struct format *fdest,
        fdest->array_begin(dest, array_type);
 
        for (i = 0; i < array_type->len; i++) {
-               struct declaration *elem = array->current_element.declaration;
+               struct definition *elem = array->current_element.definition;
                elem->type->copy(dest, fdest, src, fsrc, elem);
        }
        fsrc->array_end(src, array_type);
@@ -75,43 +75,43 @@ struct type_array *
        type->alignment = 1;
        type->copy = array_copy;
        type->type_free = _array_type_free;
-       type->declaration_new = _array_declaration_new;
-       type->declaration_free = _array_declaration_free;
+       type->definition_new = _array_definition_new;
+       type->definition_free = _array_definition_free;
        type->ref = 1;
        return array_type;
 }
 
 static
-struct declaration *
-       _array_declaration_new(struct type *type,
-                              struct declaration_scope *parent_scope)
+struct definition *
+       _array_definition_new(struct type *type,
+                             struct definition_scope *parent_scope)
 {
        struct type_array *array_type =
                container_of(type, struct type_array, p);
-       struct declaration_array *array;
+       struct definition_array *array;
 
-       array = g_new(struct declaration_array, 1);
+       array = g_new(struct definition_array, 1);
        type_ref(&array_type->p);
        array->p.type = type;
        array->type = array_type;
        array->p.ref = 1;
-       array->scope = new_declaration_scope(parent_scope);
-       array->current_element.declaration =
-               array_type->elem->declaration_new(array_type->elem,
+       array->scope = new_definition_scope(parent_scope);
+       array->current_element.definition =
+               array_type->elem->definition_new(array_type->elem,
                                                  parent_scope);
        return &array->p;
 }
 
 static
-void _array_declaration_free(struct declaration *declaration)
+void _array_definition_free(struct definition *definition)
 {
-       struct declaration_array *array =
-               container_of(declaration, struct declaration_array, p);
-       struct declaration *elem_declaration =
-               array->current_element.declaration;
+       struct definition_array *array =
+               container_of(definition, struct definition_array, p);
+       struct definition *elem_definition =
+               array->current_element.definition;
 
-       elem_declaration->type->declaration_free(elem_declaration);
-       free_declaration_scope(array->scope);
+       elem_definition->type->definition_free(elem_definition);
+       free_definition_scope(array->scope);
        type_unref(array->p.type);
        g_free(array);
 }
index b17551fa90e6b3fdcacf8ff7dcbeee219d38abf4..932eedf5ed3e554d07a324f7b115efaa85776793 100644 (file)
 #include <glib.h>
 
 static
-struct declaration *_enum_declaration_new(struct type *type,
-                                struct declaration_scope *parent_scope);
+struct definition *_enum_definition_new(struct type *type,
+                                struct definition_scope *parent_scope);
 static
-void _enum_declaration_free(struct declaration *declaration);
+void _enum_definition_free(struct definition *definition);
 
 static
 void enum_range_set_free(void *ptr)
@@ -349,10 +349,10 @@ size_t enum_get_nr_enumerators(struct type_enum *enum_type)
 
 void enum_copy(struct stream_pos *dest, const struct format *fdest, 
               struct stream_pos *src, const struct format *fsrc,
-              struct declaration *declaration)
+              struct definition *definition)
 {
-       struct declaration_enum *_enum =
-               container_of(declaration, struct declaration_enum, p);
+       struct definition_enum *_enum =
+               container_of(definition, struct definition_enum, p);
        struct type_enum *enum_type= _enum->type;
        GArray *array;
        GQuark v;
@@ -411,43 +411,43 @@ struct type_enum *
        enum_type->p.alignment = 1;
        enum_type->p.copy = enum_copy;
        enum_type->p.type_free = _enum_type_free;
-       enum_type->p.declaration_new = _enum_declaration_new;
-       enum_type->p.declaration_free = _enum_declaration_free;
+       enum_type->p.definition_new = _enum_definition_new;
+       enum_type->p.definition_free = _enum_definition_free;
        enum_type->p.ref = 1;
        return enum_type;
 }
 
 static
-struct declaration *
-       _enum_declaration_new(struct type *type,
-                             struct declaration_scope *parent_scope)
+struct definition *
+       _enum_definition_new(struct type *type,
+                            struct definition_scope *parent_scope)
 {
        struct type_enum *enum_type =
                container_of(type, struct type_enum, p);
-       struct declaration_enum *_enum;
-       struct declaration *declaration_integer_parent;
+       struct definition_enum *_enum;
+       struct definition *definition_integer_parent;
 
-       _enum = g_new(struct declaration_enum, 1);
+       _enum = g_new(struct definition_enum, 1);
        type_ref(&enum_type->p);
        _enum->p.type = type;
        _enum->type = enum_type;
        _enum->p.ref = 1;
        _enum->value = NULL;
-       declaration_integer_parent =
-               enum_type->integer_type->p.declaration_new(&enum_type->integer_type->p,
+       definition_integer_parent =
+               enum_type->integer_type->p.definition_new(&enum_type->integer_type->p,
                                                           parent_scope);
-       _enum->integer = container_of(declaration_integer_parent,
-                                     struct declaration_integer, p);
+       _enum->integer = container_of(definition_integer_parent,
+                                     struct definition_integer, p);
        return &_enum->p;
 }
 
 static
-void _enum_declaration_free(struct declaration *declaration)
+void _enum_definition_free(struct definition *definition)
 {
-       struct declaration_enum *_enum =
-               container_of(declaration, struct declaration_enum, p);
+       struct definition_enum *_enum =
+               container_of(definition, struct definition_enum, p);
 
-       declaration_unref(&_enum->integer->p);
+       definition_unref(&_enum->integer->p);
        type_unref(_enum->p.type);
        if (_enum->value)
                g_array_unref(_enum->value);
index 5ceb9f3ada1fa5a54fdd7c2be579b7efc21df74e..c120ae3a756a2ec5f626f0a67f7c6b0742232dbd 100644 (file)
 #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) {
@@ -71,8 +71,8 @@ struct type_float *
        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;
 
@@ -86,15 +86,15 @@ struct type_float *
 }
 
 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);
+       _float = g_new(struct definition_float, 1);
        type_ref(&float_type->p);
        _float->p.type= type;
        _float->type= float_type;
@@ -104,10 +104,10 @@ struct declaration *
 }
 
 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);
index 373e4bc4af85ea068a13ddfff22a6e452409c99e..41dd7751febf1065cb24b407de55c7f492841c49 100644 (file)
 #include <stdint.h>
 
 static
-struct declaration *_integer_declaration_new(struct type *type,
-                              struct declaration_scope *parent_scope);
+struct definition *_integer_definition_new(struct type *type,
+                              struct definition_scope *parent_scope);
 static
-void _integer_declaration_free(struct declaration *declaration);
+void _integer_definition_free(struct definition *definition);
 
 void integer_copy(struct stream_pos *dest, const struct format *fdest, 
                  struct stream_pos *src, const struct format *fsrc,
-                 struct declaration *declaration)
+                 struct definition *definition)
 {
-       struct declaration_integer *integer =
-               container_of(declaration, struct declaration_integer, p);
+       struct definition_integer *integer =
+               container_of(definition, struct definition_integer, p);
        struct type_integer *integer_type = integer->type;
 
        if (!integer_type->signedness) {
@@ -68,8 +68,8 @@ struct type_integer *
        integer_type->p.alignment = alignment;
        integer_type->p.copy = integer_copy;
        integer_type->p.type_free = _integer_type_free;
-       integer_type->p.declaration_free = _integer_declaration_free;
-       integer_type->p.declaration_new = _integer_declaration_new;
+       integer_type->p.definition_free = _integer_definition_free;
+       integer_type->p.definition_new = _integer_definition_new;
        integer_type->p.ref = 1;
        integer_type->len = len;
        integer_type->byte_order = byte_order;
@@ -78,15 +78,15 @@ struct type_integer *
 }
 
 static
-struct declaration *
-       _integer_declaration_new(struct type *type,
-                                struct declaration_scope *parent_scope)
+struct definition *
+       _integer_definition_new(struct type *type,
+                               struct definition_scope *parent_scope)
 {
        struct type_integer *integer_type =
                container_of(type, struct type_integer, p);
-       struct declaration_integer *integer;
+       struct definition_integer *integer;
 
-       integer = g_new(struct declaration_integer, 1);
+       integer = g_new(struct definition_integer, 1);
        type_ref(&integer_type->p);
        integer->p.type = type;
        integer->type = integer_type;
@@ -96,10 +96,10 @@ struct declaration *
 }
 
 static
-void _integer_declaration_free(struct declaration *declaration)
+void _integer_definition_free(struct definition *definition)
 {
-       struct declaration_integer *integer =
-               container_of(declaration, struct declaration_integer, p);
+       struct definition_integer *integer =
+               container_of(definition, struct definition_integer, p);
 
        type_unref(integer->p.type);
        g_free(integer);
index 9d84d0eece59e8a9d4a1f878e5da8cb5296a7818..d455dff337e7469ecb1fdf7ddfb0b7f35d78e82e 100644 (file)
 #endif
 
 static
-struct declaration *_sequence_declaration_new(struct type *type,
-                                       struct declaration_scope *parent_scope);
+struct definition *_sequence_definition_new(struct type *type,
+                                       struct definition_scope *parent_scope);
 static
-void _sequence_declaration_free(struct declaration *declaration);
+void _sequence_definition_free(struct definition *definition);
 
 void sequence_copy(struct stream_pos *dest, const struct format *fdest, 
                   struct stream_pos *src, const struct format *fsrc,
-                  struct declaration *declaration)
+                  struct definition *definition)
 {
-       struct declaration_sequence *sequence =
-               container_of(declaration, struct declaration_sequence, p);
+       struct definition_sequence *sequence =
+               container_of(definition, struct definition_sequence, p);
        struct type_sequence *sequence_type = sequence->type;
        uint64_t i;
 
@@ -45,8 +45,8 @@ void sequence_copy(struct stream_pos *dest, const struct format *fdest,
                                    &sequence->len->p);
 
        for (i = 0; i < sequence->len->value._unsigned; i++) {
-               struct declaration *elem =
-                       sequence->current_element.declaration;
+               struct definition *elem =
+                       sequence->current_element.definition;
                elem->type->copy(dest, fdest, src, fsrc, elem);
        }
        fsrc->sequence_end(src, sequence_type);
@@ -86,49 +86,49 @@ struct type_sequence *
        type->alignment = max(len_type->p.alignment, elem_type->alignment);
        type->copy = sequence_copy;
        type->type_free = _sequence_type_free;
-       type->declaration_new = _sequence_declaration_new;
-       type->declaration_free = _sequence_declaration_free;
+       type->definition_new = _sequence_definition_new;
+       type->definition_free = _sequence_definition_free;
        type->ref = 1;
        return sequence_type;
 }
 
 static
-struct declaration *_sequence_declaration_new(struct type *type,
-                               struct declaration_scope *parent_scope)
+struct definition *_sequence_definition_new(struct type *type,
+                               struct definition_scope *parent_scope)
 {
        struct type_sequence *sequence_type =
                container_of(type, struct type_sequence, p);
-       struct declaration_sequence *sequence;
-       struct declaration *len_parent;
+       struct definition_sequence *sequence;
+       struct definition *len_parent;
 
-       sequence = g_new(struct declaration_sequence, 1);
+       sequence = g_new(struct definition_sequence, 1);
        type_ref(&sequence_type->p);
        sequence->p.type = type;
        sequence->type = sequence_type;
        sequence->p.ref = 1;
-       sequence->scope = new_declaration_scope(parent_scope);
-       len_parent = sequence_type->len_type->p.declaration_new(&sequence_type->len_type->p,
+       sequence->scope = new_definition_scope(parent_scope);
+       len_parent = sequence_type->len_type->p.definition_new(&sequence_type->len_type->p,
                                                                parent_scope);
        sequence->len =
-               container_of(len_parent, struct declaration_integer, p);
-       sequence->current_element.declaration =
-               sequence_type->elem->declaration_new(sequence_type->elem,
+               container_of(len_parent, struct definition_integer, p);
+       sequence->current_element.definition =
+               sequence_type->elem->definition_new(sequence_type->elem,
                                                     parent_scope);
        return &sequence->p;
 }
 
 static
-void _sequence_declaration_free(struct declaration *declaration)
+void _sequence_definition_free(struct definition *definition)
 {
-       struct declaration_sequence *sequence =
-               container_of(declaration, struct declaration_sequence, p);
-       struct declaration *len_declaration = &sequence->len->p;
-       struct declaration *elem_declaration =
-               sequence->current_element.declaration;
+       struct definition_sequence *sequence =
+               container_of(definition, struct definition_sequence, p);
+       struct definition *len_definition = &sequence->len->p;
+       struct definition *elem_definition =
+               sequence->current_element.definition;
 
-       len_declaration->type->declaration_free(len_declaration);
-       elem_declaration->type->declaration_free(elem_declaration);
-       free_declaration_scope(sequence->scope);
+       len_definition->type->definition_free(len_definition);
+       elem_definition->type->definition_free(elem_definition);
+       free_definition_scope(sequence->scope);
        type_unref(sequence->p.type);
        g_free(sequence);
 }
index 9a80b0387e0b33f4103af978dda0fe2ca639e29e..71b9f8232a73e3135551be939e5bc0a731bcd267 100644 (file)
 #include <babeltrace/format.h>
 
 static
-struct declaration *_string_declaration_new(struct type *type,
-                               struct declaration_scope *parent_scope);
+struct definition *_string_definition_new(struct type *type,
+                               struct definition_scope *parent_scope);
 static
-void _string_declaration_free(struct declaration *declaration);
+void _string_definition_free(struct definition *definition);
 
 void string_copy(struct stream_pos *dest, const struct format *fdest, 
                 struct stream_pos *src, const struct format *fsrc,
-                struct declaration *declaration)
+                struct definition *definition)
 {
-       struct declaration_string *string =
-               container_of(declaration, struct declaration_string, p);
+       struct definition_string *string =
+               container_of(definition, struct definition_string, p);
        struct type_string *string_type = string->type;
 
        if (fsrc->string_copy == fdest->string_copy) {
@@ -63,22 +63,22 @@ struct type_string *string_type_new(const char *name)
        string_type->p.alignment = CHAR_BIT;
        string_type->p.copy = string_copy;
        string_type->p.type_free = _string_type_free;
-       string_type->p.declaration_new = _string_declaration_new;
-       string_type->p.declaration_free = _string_declaration_free;
+       string_type->p.definition_new = _string_definition_new;
+       string_type->p.definition_free = _string_definition_free;
        string_type->p.ref = 1;
        return string_type;
 }
 
 static
-struct declaration *
-       _string_declaration_new(struct type *type,
-                               struct declaration_scope *parent_scope)
+struct definition *
+       _string_definition_new(struct type *type,
+                              struct definition_scope *parent_scope)
 {
        struct type_string *string_type =
                container_of(type, struct type_string, p);
-       struct declaration_string *string;
+       struct definition_string *string;
 
-       string = g_new(struct declaration_string, 1);
+       string = g_new(struct definition_string, 1);
        type_ref(&string_type->p);
        string->p.type = type;
        string->type = string_type;
@@ -88,10 +88,10 @@ struct declaration *
 }
 
 static
-void _string_declaration_free(struct declaration *declaration)
+void _string_definition_free(struct definition *definition)
 {
-       struct declaration_string *string =
-               container_of(declaration, struct declaration_string, p);
+       struct definition_string *string =
+               container_of(definition, struct definition_string, p);
 
        type_unref(string->p.type);
        g_free(string->value);
index 779cca5c504064d3c03bb4a86962ab58a1917808..062874784f05165439f9109a387f201a0bf8860a 100644 (file)
 #endif
 
 static
-struct declaration *_struct_declaration_new(struct type *type,
-                               struct declaration_scope *parent_scope);
+struct definition *_struct_definition_new(struct type *type,
+                               struct definition_scope *parent_scope);
 static
-void _struct_declaration_free(struct declaration *declaration);
+void _struct_definition_free(struct definition *definition);
 
 void struct_copy(struct stream_pos *dest, const struct format *fdest, 
                 struct stream_pos *src, const struct format *fsrc,
-                struct declaration *declaration)
+                struct definition *definition)
 {
-       struct declaration_struct *_struct =
-               container_of(declaration, struct declaration_struct, p);
+       struct definition_struct *_struct =
+               container_of(definition, struct definition_struct, p);
        struct type_struct *struct_type = _struct->type;
        unsigned long i;
 
@@ -44,9 +44,9 @@ void struct_copy(struct stream_pos *dest, const struct format *fdest,
        for (i = 0; i < _struct->fields->len; i++) {
                struct field *field = &g_array_index(_struct->fields,
                                                     struct field, i);
-               struct type *field_type = field->declaration->type;
+               struct type *field_type = field->definition->type;
 
-               field_type->copy(dest, fdest, src, fsrc, field->declaration);
+               field_type->copy(dest, fdest, src, fsrc, field->definition);
 
        }
        fsrc->struct_end(src, struct_type);
@@ -92,29 +92,29 @@ struct type_struct *struct_type_new(const char *name,
        type->alignment = 1;
        type->copy = struct_copy;
        type->type_free = _struct_type_free;
-       type->declaration_new = _struct_declaration_new;
-       type->declaration_free = _struct_declaration_free;
+       type->definition_new = _struct_definition_new;
+       type->definition_free = _struct_definition_free;
        type->ref = 1;
        return struct_type;
 }
 
 static
-struct declaration *
-       _struct_declaration_new(struct type *type,
-                               struct declaration_scope *parent_scope)
+struct definition *
+       _struct_definition_new(struct type *type,
+                              struct definition_scope *parent_scope)
 {
        struct type_struct *struct_type =
                container_of(type, struct type_struct, p);
-       struct declaration_struct *_struct;
+       struct definition_struct *_struct;
        unsigned long i;
        int ret;
 
-       _struct = g_new(struct declaration_struct, 1);
+       _struct = g_new(struct definition_struct, 1);
        type_ref(&struct_type->p);
        _struct->p.type = type;
        _struct->type = struct_type;
        _struct->p.ref = 1;
-       _struct->scope = new_declaration_scope(parent_scope);
+       _struct->scope = new_definition_scope(parent_scope);
        _struct->fields = g_array_sized_new(FALSE, TRUE,
                                            sizeof(struct field),
                                            DEFAULT_NR_STRUCT_FIELDS);
@@ -127,30 +127,31 @@ struct declaration *
                                                     struct field, i);
 
                field->name = type_field->name;
-               field->declaration =
-                       type_field->type->declaration_new(type_field->type,
+               field->definition =
+                       type_field->type->definition_new(type_field->type,
                                                          _struct->scope);
-               ret = register_declaration(field->name,
-                                          field->declaration, _struct->scope);
+               ret = register_field_definition(field->name,
+                                               field->definition,
+                                               _struct->scope);
                assert(!ret);
        }
        return &_struct->p;
 }
 
 static
-void _struct_declaration_free(struct declaration *declaration)
+void _struct_definition_free(struct definition *definition)
 {
-       struct declaration_struct *_struct =
-               container_of(declaration, struct declaration_struct, p);
+       struct definition_struct *_struct =
+               container_of(definition, struct definition_struct, p);
        unsigned long i;
 
        assert(_struct->fields->len == _struct->type->fields->len);
        for (i = 0; i < _struct->fields->len; i++) {
                struct field *field = &g_array_index(_struct->fields,
                                                     struct field, i);
-               declaration_unref(field->declaration);
+               definition_unref(field->definition);
        }
-       free_declaration_scope(_struct->scope);
+       free_definition_scope(_struct->scope);
        type_unref(_struct->p.type);
        g_free(_struct);
 }
@@ -205,7 +206,7 @@ struct type_field *
  * field returned only valid as long as the field structure is not appended to.
  */
 struct field *
-struct_declaration_get_field_from_index(struct declaration_struct *_struct,
+struct_definition_get_field_from_index(struct definition_struct *_struct,
                                        unsigned long index)
 {
        return &g_array_index(_struct->fields, struct field, index);
index 2f262987f4d3a2b4997887ee96dc4d3be6cdda80..e36c7a1f5221ba7f016b2105763564689722d37a 100644 (file)
 #include <errno.h>
 
 static
-struct declaration *
-       lookup_type_declaration_scope(GQuark type_name, struct type_scope *scope)
+struct definition *
+       lookup_type_definition_scope(GQuark type_name, struct type_scope *scope)
 {
-       return g_hash_table_lookup(scope->type_declarations,
+       return g_hash_table_lookup(scope->type_definitions,
                                   (gconstpointer) (unsigned long) type_name);
 }
 
-struct declaration *lookup_type_declaration(GQuark type_name, struct type_scope *scope)
+struct definition *lookup_type_definition(GQuark type_name, struct type_scope *scope)
 {
-       struct declaration *declaration;
+       struct definition *definition;
 
        while (scope) {
-               declaration = lookup_type_declaration_scope(type_name, scope);
-               if (declaration)
-                       return declaration;
+               definition = lookup_type_definition_scope(type_name, scope);
+               if (definition)
+                       return definition;
                scope = scope->parent_scope;
        }
        return NULL;
 }
 
-int register_type_declaration(GQuark name, struct declaration *declaration,
-                             struct type_scope *scope)
+int register_type_definition(GQuark name, struct definition *definition,
+                            struct type_scope *scope)
 {
        if (!name)
                return -EPERM;
 
        /* Only lookup in local scope */
-       if (lookup_type_declaration_scope(name, scope))
+       if (lookup_type_definition_scope(name, scope))
                return -EEXIST;
 
-       g_hash_table_insert(scope->type_declarations,
+       g_hash_table_insert(scope->type_definitions,
                            (gpointer) (unsigned long) name,
-                           declaration);
-       declaration_ref(declaration);
+                           definition);
+       definition_ref(definition);
        return 0;
 }
 
 static
-struct declaration *
-       lookup_field_declaration_scope(GQuark field_name, struct declaration_scope *scope)
+struct definition *
+       lookup_field_definition_scope(GQuark field_name, struct definition_scope *scope)
 {
-       return g_hash_table_lookup(scope->declarations,
+       return g_hash_table_lookup(scope->definitions,
                                   (gconstpointer) (unsigned long) field_name);
 }
 
-struct declaration *
-       lookup_field_declaration(GQuark field_name, struct declaration_scope *scope)
+struct definition *
+       lookup_field_definition(GQuark field_name, struct definition_scope *scope)
 {
-       struct declaration *declaration;
+       struct definition *definition;
 
        while (scope) {
-               declaration = lookup_field_declaration_scope(field_name, scope);
-               if (declaration)
-                       return declaration;
+               definition = lookup_field_definition_scope(field_name, scope);
+               if (definition)
+                       return definition;
                scope = scope->parent_scope;
        }
        return NULL;
 }
 
-int register_field_declaration(GQuark field_name, struct declaration *declaration,
-                              struct declaration_scope *scope)
+int register_field_definition(GQuark field_name, struct definition *definition,
+                             struct definition_scope *scope)
 {
        if (!field_name)
                return -EPERM;
 
        /* Only lookup in local scope */
-       if (lookup_field_declaration_scope(field_name, scope))
+       if (lookup_field_definition_scope(field_name, scope))
                return -EEXIST;
 
-       g_hash_table_insert(scope->declarations,
+       g_hash_table_insert(scope->definitions,
                            (gpointer) (unsigned long) field_name,
-                           declaration);
-       declaration_ref(declaration);
+                           definition);
+       definition_ref(definition);
        return 0;
 }
 
@@ -110,15 +110,15 @@ void type_unref(struct type *type)
                type->type_free(type);
 }
 
-void declaration_ref(struct declaration *declaration)
+void definition_ref(struct definition *definition)
 {
-       declaration->ref++;
+       definition->ref++;
 }
 
-void declaration_unref(struct declaration *declaration)
+void definition_unref(struct definition *definition)
 {
-       if (!--declaration->ref)
-               declaration->type->declaration_free(declaration);
+       if (!--definition->ref)
+               definition->type->definition_free(definition);
 }
 
 struct type_scope *
@@ -126,9 +126,9 @@ struct type_scope *
 {
        struct type_scope *scope = g_new(struct type_scope, 1);
 
-       scope->type_declarations = g_hash_table_new_full(g_direct_hash,
+       scope->type_definitions = g_hash_table_new_full(g_direct_hash,
                                        g_direct_equal, NULL,
-                                       (GDestroyNotify) declaration_unref);
+                                       (GDestroyNotify) definition_unref);
        scope->struct_types = g_hash_table_new_full(g_direct_hash,
                                        g_direct_equal, NULL,
                                        (GDestroyNotify) type_unref);
@@ -147,7 +147,7 @@ void free_type_scope(struct type_scope *scope)
        g_hash_table_destroy(scope->enum_types);
        g_hash_table_destroy(scope->variant_types);
        g_hash_table_destroy(scope->struct_types);
-       g_hash_table_destroy(scope->type_declarations);
+       g_hash_table_destroy(scope->type_definitions);
        g_free(scope);
 }
 
@@ -269,20 +269,20 @@ int register_enum_type(GQuark enum_name, struct type_enum *enum_type,
        return 0;
 }
 
-struct declaration_scope *
-       new_declaration_scope(struct declaration_scope *parent_scope)
+struct definition_scope *
+       new_definition_scope(struct definition_scope *parent_scope)
 {
-       struct declaration_scope *scope = g_new(struct declaration_scope, 1);
+       struct definition_scope *scope = g_new(struct definition_scope, 1);
 
-       scope->declarations = g_hash_table_new_full(g_direct_hash,
+       scope->definitions = g_hash_table_new_full(g_direct_hash,
                                        g_direct_equal, NULL,
-                                       (GDestroyNotify) declaration_unref);
+                                       (GDestroyNotify) definition_unref);
        scope->parent_scope = parent_scope;
        return scope;
 }
 
-void free_declaration_scope(struct declaration_scope *scope)
+void free_definition_scope(struct definition_scope *scope)
 {
-       g_hash_table_destroy(scope->declarations);
+       g_hash_table_destroy(scope->definitions);
        g_free(scope);
 }
index ea20808b7205f1e31ea1fee4dce603e5584359bf..66c8f59f7051a0378360a2b947e61f6062bb11cb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * variant.c
+* variant.c
  *
  * BabelTrace - Variant Type Converter
  *
 #include <errno.h>
 
 static
-struct declaration *_variant_declaration_new(struct type *type,
-                               struct declaration_scope *parent_scope);
+struct definition *_variant_definition_new(struct type *type,
+                               struct definition_scope *parent_scope);
 static
-void _variant_declaration_free(struct declaration *declaration);
+void _variant_definition_free(struct definition *definition);
 
 void variant_copy(struct stream_pos *dest, const struct format *fdest, 
                  struct stream_pos *src, const struct format *fsrc,
-                 struct declaration *declaration)
+                 struct definition *definition)
 {
-       struct declaration_variant *variant =
-               container_of(declaration, struct declaration_variant, p);
+       struct definition_variant *variant =
+               container_of(definition, struct definition_variant, p);
        struct type_variant *variant_type = variant->type;
        struct field *field;
        struct type *field_type;
@@ -40,8 +40,8 @@ void variant_copy(struct stream_pos *dest, const struct format *fdest,
        fdest->variant_begin(dest, variant_type);
 
        field = variant_get_current_field(variant);
-       field_type = field->declaration->type;
-       field_type->copy(dest, fdest, src, fsrc, field->declaration);
+       field_type = field->definition->type;
+       field_type->copy(dest, fdest, src, fsrc, field->definition);
 
        fsrc->variant_end(src, variant_type);
        fdest->variant_end(dest, variant_type);
@@ -86,28 +86,28 @@ struct type_variant *variant_type_new(const char *name,
        type->alignment = 1;
        type->copy = variant_copy;
        type->type_free = _variant_type_free;
-       type->declaration_new = _variant_declaration_new;
-       type->declaration_free = _variant_declaration_free;
+       type->definition_new = _variant_definition_new;
+       type->definition_free = _variant_definition_free;
        type->ref = 1;
        return variant_type;
 }
 
 static
-struct declaration *
-       _variant_declaration_new(struct type *type,
-                                struct declaration_scope *parent_scope)
+struct definition *
+       _variant_definition_new(struct type *type,
+                               struct definition_scope *parent_scope)
 {
        struct type_variant *variant_type =
                container_of(type, struct type_variant, p);
-       struct declaration_variant *variant;
+       struct definition_variant *variant;
        unsigned long i;
 
-       variant = g_new(struct declaration_variant, 1);
+       variant = g_new(struct definition_variant, 1);
        type_ref(&variant_type->p);
        variant->p.type = type;
        variant->type = variant_type;
        variant->p.ref = 1;
-       variant->scope = new_declaration_scope(parent_scope);
+       variant->scope = new_definition_scope(parent_scope);
        variant->fields = g_array_sized_new(FALSE, TRUE,
                                            sizeof(struct field),
                                            DEFAULT_NR_STRUCT_FIELDS);
@@ -120,8 +120,8 @@ struct declaration *
                                                     struct field, i);
 
                field->name = type_field->name;
-               field->declaration =
-                       type_field->type->declaration_new(type_field->type,
+               field->definition =
+                       type_field->type->definition_new(type_field->type,
                                                          variant->scope);
        }
        variant->current_field = NULL;
@@ -129,19 +129,19 @@ struct declaration *
 }
 
 static
-void _variant_declaration_free(struct declaration *declaration)
+void _variant_definition_free(struct definition *definition)
 {
-       struct declaration_variant *variant =
-               container_of(declaration, struct declaration_variant, p);
+       struct definition_variant *variant =
+               container_of(definition, struct definition_variant, p);
        unsigned long i;
 
        assert(variant->fields->len == variant->type->fields->len);
        for (i = 0; i < variant->fields->len; i++) {
                struct field *field = &g_array_index(variant->fields,
                                                     struct field, i);
-               declaration_unref(field->declaration);
+               definition_unref(field->definition);
        }
-       free_declaration_scope(variant->scope);
+       free_definition_scope(variant->scope);
        type_unref(variant->p.type);
        g_free(variant);
 }
@@ -183,11 +183,11 @@ struct_type_get_field_from_tag(struct type_variant *variant_type, GQuark tag)
 /*
  * tag_instance is assumed to be an enumeration.
  */
-int variant_declaration_set_tag(struct declaration_variant *variant,
-                               struct declaration *enum_tag)
+int variant_definition_set_tag(struct definition_variant *variant,
+                              struct definition *enum_tag)
 {
-       struct declaration_enum *_enum =
-               container_of(variant->enum_tag, struct declaration_enum, p);
+       struct definition_enum *_enum =
+               container_of(variant->enum_tag, struct definition_enum, p);
        struct type_enum *enum_type = _enum->type;
        int missing_field = 0;
        unsigned long i;
@@ -229,10 +229,10 @@ int variant_declaration_set_tag(struct declaration_variant *variant,
 /*
  * field returned only valid as long as the field structure is not appended to.
  */
-struct field *variant_get_current_field(struct declaration_variant *variant)
+struct field *variant_get_current_field(struct definition_variant *variant)
 {
-       struct declaration_enum *_enum =
-               container_of(variant->enum_tag, struct declaration_enum, p);
+       struct definition_enum *_enum =
+               container_of(variant->enum_tag, struct definition_enum, p);
        struct type_variant *variant_type = variant->type;
        unsigned long index;
        GArray *tag_array;
This page took 0.096993 seconds and 4 git commands to generate.