- xbt_dict_free(&route_table);
- route_link_list = NULL;
-
- xbt_dict_free(&route_multi_table);
-
- xbt_dynar_foreach(route_multi_elements, cpt, name) free(name);
- xbt_dynar_free(&route_multi_elements);
-
- xbt_dict_foreach(set_list, cursor, key, data) {
- xbt_dynar_t set = (xbt_dynar_t) data;
-
- xbt_dynar_foreach(set, cpt, name) free(name);
- xbt_dynar_free(&set);
- }
- xbt_dict_free(&set_list);
-
- xbt_dynar_free(&surfxml_bufferstack_stack);
-
- xbt_dict_free(&traces_set_list);
- xbt_dict_free(&trace_connect_list_host_avail);
- xbt_dict_free(&trace_connect_list_power);
- xbt_dict_free(&trace_connect_list_link_avail);
- xbt_dict_free(&trace_connect_list_bandwidth);
- xbt_dict_free(&trace_connect_list_latency);
- xbt_dict_free(&traces_set_list);
-}
-
-void parse_platform_file(const char *file)
-{
- surf_parse_open(file);
- init_data();
- xbt_assert1((!(*surf_parse) ()), "Parse error in %s", file);
- free_data();
- surf_parse_close();
-}
-
-/* Functions to bypass route, host and link tags. Used by the foreach and route:multi tags */
-
-static void parse_make_temporary_route(const char *src, const char *dst,
- int action)
-{
- int AX_ptr = 0;
-
- A_surfxml_route_action = action;
- SURFXML_BUFFER_SET(route_src, src);
- SURFXML_BUFFER_SET(route_dst, dst);
-}
-
-static void parse_change_cpu_data(const char *hostName,
- const char *surfxml_host_power,
- const char *surfxml_host_availability,
- const char *surfxml_host_availability_file,
- const char *surfxml_host_state_file)
-{
- int AX_ptr = 0;
-
- SURFXML_BUFFER_SET(host_id, hostName);
- SURFXML_BUFFER_SET(host_power, surfxml_host_power /*hostPower */ );
- SURFXML_BUFFER_SET(host_availability, surfxml_host_availability);
- SURFXML_BUFFER_SET(host_availability_file, surfxml_host_availability_file);
- SURFXML_BUFFER_SET(host_state_file, surfxml_host_state_file);
-}
-
-static void parse_change_link_data(const char *linkName,
- const char *surfxml_link_bandwidth,
- const char *surfxml_link_bandwidth_file,
- const char *surfxml_link_latency,
- const char *surfxml_link_latency_file,
- const char *surfxml_link_state_file)
-{
- int AX_ptr = 0;
-
- SURFXML_BUFFER_SET(link_id, linkName);
- SURFXML_BUFFER_SET(link_bandwidth, surfxml_link_bandwidth);
- SURFXML_BUFFER_SET(link_bandwidth_file, surfxml_link_bandwidth_file);
- SURFXML_BUFFER_SET(link_latency, surfxml_link_latency);
- SURFXML_BUFFER_SET(link_latency_file, surfxml_link_latency_file);
- SURFXML_BUFFER_SET(link_state_file, surfxml_link_state_file);
-}
-
-/* Functions for the sets and foreach tags */
-
-static void parse_sets(void)
-{
- char *id, *suffix, *prefix, *radical;
- int start, end;
- xbt_dynar_t radical_elements;
- xbt_dynar_t radical_ends;
- xbt_dynar_t current_set;
- char *value, *groups;
- int i;
- unsigned int iter;
-
- id = xbt_strdup(A_surfxml_set_id);
- prefix = xbt_strdup(A_surfxml_set_prefix);
- suffix = xbt_strdup(A_surfxml_set_suffix);
- radical = xbt_strdup(A_surfxml_set_radical);
-
- if (xbt_dict_get_or_null(set_list, id))
- surf_parse_error(bprintf
- ("Set '%s' declared several times in the platform file.",
- id));
-
- current_set = xbt_dynar_new(sizeof(char *), NULL);
-
- radical_elements = xbt_str_split(radical, ",");
- xbt_dynar_foreach(radical_elements, iter, groups) {
-
- radical_ends = xbt_str_split(groups, "-");
- switch (xbt_dynar_length(radical_ends)) {
- case 1:
- surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
- value = bprintf("%s%d%s", prefix, start, suffix);
- xbt_dynar_push(current_set, &value);
- break;
-
- case 2:
-
- surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
- surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
-
-
- for (i = start; i <= end; i++) {
- value = bprintf("%s%d%s", prefix, i, suffix);
- xbt_dynar_push(current_set, &value);
- }
- break;
-
- default:
- surf_parse_error(xbt_strdup("Malformed radical"));