-static int data_libsimgrid_region_compare(void *d1, void *d2, size_t size){
- int distance = 0;
- size_t i = 0, ignore_size = 0;
- int pointer_align;
- void *addr_pointed1 = NULL, *addr_pointed2 = NULL;
-
- for(i=0; i<size; i++){
- if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
- if((ignore_size = ignore((char *)start_data_libsimgrid+i)) > 0){
- i = i + ignore_size;
- continue;
+static int compare_areas_with_type(void *area1, void *area2, xbt_dict_t types, xbt_dict_t other_types, char *type_id, int region_size, int region_type, void *start_data, int pointer_level){
+
+ dw_type_t type = xbt_dict_get_or_null(types, type_id);;
+ unsigned int cursor = 0;
+ dw_type_t member, subtype, subsubtype;
+ int elm_size, i, res, switch_types = 0;
+ void *addr_pointed1, *addr_pointed2;
+ int pointed_area_size1, pointed_area_size2;
+
+ switch(type->type){
+ case e_dw_base_type:
+ case e_dw_enumeration_type:
+ case e_dw_union_type:
+ return (memcmp(area1, area2, type->size) != 0);
+ break;
+ case e_dw_typedef:
+ case e_dw_volatile_type:
+ return compare_areas_with_type(area1, area2, types, other_types, type->dw_type_id, region_size, region_type, start_data, pointer_level);
+ break;
+ case e_dw_const_type: /* Const variable cannot be modified */
+ return -1;
+ break;
+ case e_dw_array_type:
+ subtype = xbt_dict_get_or_null(types, type->dw_type_id);
+ switch(subtype->type){
+ case e_dw_base_type:
+ case e_dw_enumeration_type:
+ case e_dw_pointer_type:
+ case e_dw_structure_type:
+ case e_dw_union_type:
+ if(subtype->size == 0){ /*declaration of the type, need the complete description */
+ subtype = xbt_dict_get_or_null(types, get_type_description(types, subtype->name));
+ if(subtype == NULL){
+ subtype = xbt_dict_get_or_null(other_types, get_type_description(other_types, subtype->name));
+ switch_types = 1;
+ }
+ }
+ elm_size = subtype->size;
+ break;
+ case e_dw_typedef:
+ case e_dw_volatile_type:
+ subsubtype = xbt_dict_get_or_null(types, subtype->dw_type_id);
+ if(subsubtype->size == 0){ /*declaration of the type, need the complete description */
+ subsubtype = xbt_dict_get_or_null(types, get_type_description(types, subsubtype->name));
+ if(subsubtype == NULL){
+ subsubtype = xbt_dict_get_or_null(other_types, get_type_description(other_types, subsubtype->name));
+ switch_types = 1;
+ }