+static char* get_offset_type(char* type_id, int offset, xbt_dict_t all_types, xbt_dict_t other_types, int area_size, int *switch_type){
+ dw_type_t type = xbt_dict_get_or_null(all_types, type_id);
+ if(type == NULL){
+ type = xbt_dict_get_or_null(other_types, type_id);
+ *switch_type = 1;
+ }
+ char* type_desc;
+ switch(type->type){
+ case e_dw_structure_type :
+ if(type->size == 0){ /*declaration of the structure, need the complete description */
+ if(*switch_type == 0){
+ type_desc = get_type_description(all_types, type->name);
+ if(type_desc){
+ type = xbt_dict_get_or_null(all_types, type_desc);
+ }else{
+ type = xbt_dict_get_or_null(other_types, get_type_description(other_types, type->name));
+ *switch_type = 1;
+ }
+ }else{
+ type_desc = get_type_description(other_types, type->name);
+ if(type_desc){
+ type = xbt_dict_get_or_null(other_types, type_desc);
+ }else{
+ type = xbt_dict_get_or_null(all_types, get_type_description(other_types, type->name));
+ *switch_type = 0;
+ }
+ }
+
+ }
+ if(area_size != -1 && type->size != area_size){
+ if(area_size>type->size && area_size%type->size == 0)
+ return type_id;
+ else
+ return NULL;
+ }else{
+ unsigned int cursor = 0;
+ dw_type_t member;
+ xbt_dynar_foreach(type->members, cursor, member){
+ if(member->offset == offset)
+ return member->dw_type_id;
+ }
+ return NULL;
+ }
+ break;
+ default:
+ /* FIXME : other cases ? */
+ return NULL;
+ break;
+ }
+}
+