+ int i, flag;
+ type_descriptor_t * tmpTd;
+
+ switch(td->type) {
+ case LTT_ENUM:
+ fld->field_type->element_number = td->labels.position;
+ fld->field_type->enum_strings = g_new(GQuark,td->labels.position);
+ for(i=0;i<td->labels.position;i++){
+ fld->field_type->enum_strings[i]
+ = g_quark_from_string(((char*)(td->labels.array[i])));
+ }
+ break;
+ case LTT_ARRAY:
+ fld->field_type->element_number = (unsigned)td->size;
+ case LTT_SEQUENCE:
+ fld->field_type->element_type = g_new(LttType*,1);
+ tmpTd = td->nested_type;
+ fld->field_type->element_type[0] = lookup_named_type(fac, tmpTd);
+ fld->child = g_new(LttField*, 1);
+ fld->child[0] = g_new(LttField, 1);
+
+ fld->child[0]->field_type = fld->field_type->element_type[0];
+ fld->child[0]->offset_root = 0;
+ fld->child[0]->fixed_root = FIELD_UNKNOWN;
+ fld->child[0]->offset_parent = 0;
+ fld->child[0]->fixed_parent = FIELD_UNKNOWN;
+ fld->child[0]->field_size = 0;
+ fld->child[0]->fixed_size = FIELD_UNKNOWN;
+ fld->child[0]->parent = fld;
+ fld->child[0]->child = NULL;
+ fld->child[0]->current_element = 0;
+ construct_types_and_fields(fac, tmpTd, fld->child[0]);
+ break;
+ case LTT_STRUCT:
+ case LTT_UNION:
+ fld->field_type->element_number = td->fields.position;
+
+ g_assert(fld->field_type->element_type == NULL);
+ fld->field_type->element_type = g_new(LttType*, td->fields.position);
+
+ fld->child = g_new(LttField*, td->fields.position);
+ for(i=0;i<td->fields.position;i++){
+ tmpTd = ((field_t*)(td->fields.array[i]))->type;
+
+ fld->field_type->element_type[i] = lookup_named_type(fac, tmpTd);
+ fld->child[i] = g_new(LttField,1);
+
+ // fld->child[i]->field_pos = i;
+ fld->child[i]->field_type = fld->field_type->element_type[i];
+
+ fld->child[i]->field_type->element_name
+ = g_quark_from_string(((field_t*)(td->fields.array[i]))->name);
+
+ fld->child[i]->offset_root = 0;
+ fld->child[i]->fixed_root = FIELD_UNKNOWN;
+ fld->child[i]->offset_parent = 0;
+ fld->child[i]->fixed_parent = FIELD_UNKNOWN;
+ fld->child[i]->field_size = 0;
+ fld->child[i]->fixed_size = FIELD_UNKNOWN;
+ fld->child[i]->parent = fld;
+ fld->child[i]->child = NULL;
+ fld->child[i]->current_element = 0;
+ construct_types_and_fields(fac, tmpTd, fld->child[i]);
+ }
+
+ break;
+ default:
+ g_error("construct_types_and_fields : unknown type");
+ }
+
+
+}
+
+
+
+#if 0
+void construct_types_and_fields(LttFacility * fac, type_descriptor * td,
+ LttField * fld)
+{
+ int i, flag;