From: Martin Quinson Date: Tue, 8 Nov 2011 10:42:19 +0000 (+0100) Subject: Parser cleanup: simplify structure's fields' names X-Git-Tag: exp_20120216~441 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fb17c31966c617a068f0d69d3a419041150d905d Parser cleanup: simplify structure's fields' names Damn, my eclipse fail that refactoring! That's manual, pity me... --- diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index e67f56d1f4..a10f8846a2 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -31,14 +31,14 @@ typedef enum { */ typedef struct { - const char* V_host_id; //id - double V_host_power_peak; //power - int V_host_core; //core - double V_host_power_scale; //availability - tmgr_trace_t V_host_power_trace; //availability file - e_surf_resource_state_t V_host_state_initial; //state - tmgr_trace_t V_host_state_trace; //state file - const char* V_host_coord; + const char* id; + double power_peak; + int core_amount; + double power_scale; + tmgr_trace_t power_trace; + e_surf_resource_state_t initial_state; + tmgr_trace_t state_trace; + const char* coord; xbt_dict_t properties; } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t; diff --git a/src/bindings/lua/lua_console.c b/src/bindings/lua/lua_console.c index afa8a94f45..6749e65216 100644 --- a/src/bindings/lua/lua_console.c +++ b/src/bindings/lua/lua_console.c @@ -41,32 +41,32 @@ int console_add_host(lua_State *L) { // get Id Value lua_pushstring(L, "id"); lua_gettable(L, -2); - host.V_host_id = lua_tostring(L, -1); + host.id = lua_tostring(L, -1); lua_pop(L, 1); // get power value lua_pushstring(L, "power"); lua_gettable(L, -2); - host.V_host_power_peak = lua_tonumber(L, -1); + host.power_peak = lua_tonumber(L, -1); lua_pop(L, 1); //get power_scale lua_pushstring(L, "power_scale"); lua_gettable(L, -2); - host.V_host_power_scale = lua_tonumber(L, -1); + host.power_scale = lua_tonumber(L, -1); lua_pop(L, 1); //get power_trace lua_pushstring(L, "power_trace"); lua_gettable(L, -2); - host.V_host_power_trace = tmgr_trace_new(lua_tostring(L, -1)); + host.power_trace = tmgr_trace_new(lua_tostring(L, -1)); lua_pop(L, 1); lua_pushstring(L, "core"); lua_gettable(L, -2); - host.V_host_core = lua_tonumber(L, -1); - if (host.V_host_core == 0) - host.V_host_core = 1; + host.core_amount = lua_tonumber(L, -1); + if (host.core_amount == 0) + host.core_amount = 1; lua_pop(L, 1); //get state initial @@ -75,14 +75,14 @@ int console_add_host(lua_State *L) { state = lua_tonumber(L, -1); lua_pop(L, 1); if (state) - host.V_host_state_initial = SURF_RESOURCE_ON; + host.initial_state = SURF_RESOURCE_ON; else - host.V_host_state_initial = SURF_RESOURCE_OFF; + host.initial_state = SURF_RESOURCE_OFF; //get trace state lua_pushstring(L, "state_trace"); lua_gettable(L, -2); - host.V_host_state_trace = tmgr_trace_new(lua_tostring(L, -1)); + host.state_trace = tmgr_trace_new(lua_tostring(L, -1)); lua_pop(L, 1); sg_platf_new_host(&host); diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index ae62d45190..e764a6a38d 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -228,11 +228,11 @@ static void instr_routing_parse_start_link (sg_platf_link_cbarg_t link) static void instr_routing_parse_start_host (sg_platf_host_cbarg_t host) { container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1); - container_t new = newContainer (host->V_host_id, INSTR_HOST, father); + container_t new = newContainer (host->id, INSTR_HOST, father); if (TRACE_categorized() || TRACE_uncategorized()) { type_t power = getVariableType ("power", NULL, new->type); - new_pajeSetVariable (0, new, power, host->V_host_power_peak); + new_pajeSetVariable (0, new, power, host->power_peak); } if (TRACE_uncategorized()){ getVariableType ("power_used", "0.5 0.5 0.5", new->type); diff --git a/src/surf/cpu.c b/src/surf/cpu.c index d08b7e0ddc..3106dbfd0a 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -73,15 +73,15 @@ static void* cpu_create_resource(const char *name, double power_peak, static void parse_cpu_init(sg_platf_host_cbarg_t host) { - if(strcmp(host->V_host_coord,"")) xbt_die("Coordinates not implemented yet!"); - - cpu_create_resource(host->V_host_id, - host->V_host_power_peak, - host->V_host_power_scale, - host->V_host_power_trace, - host->V_host_core, - host->V_host_state_initial, - host->V_host_state_trace, + if(strcmp(host->coord,"")) xbt_die("Coordinates not implemented yet!"); + + cpu_create_resource(host->id, + host->power_peak, + host->power_scale, + host->power_trace, + host->core_amount, + host->initial_state, + host->state_trace, host->properties); } diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index d1c841ec97..6adc2bc4d9 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -90,13 +90,13 @@ static void* cpu_im_create_resource(const char *name, double power_peak, static void parse_cpu_im_init(sg_platf_host_cbarg_t host) { - cpu_im_create_resource(host->V_host_id, - host->V_host_power_peak, - host->V_host_power_scale, - host->V_host_power_trace, - host->V_host_core, - host->V_host_state_initial, - host->V_host_state_trace, + cpu_im_create_resource(host->id, + host->power_peak, + host->power_scale, + host->power_trace, + host->core_amount, + host->initial_state, + host->state_trace, host->properties); } diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index db57d05c00..6aabfd2f4e 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -192,13 +192,13 @@ static void* cpu_ti_create_resource(const char *name, double power_peak, static void parse_cpu_ti_init(sg_platf_host_cbarg_t host) { - cpu_ti_create_resource(host->V_host_id, - host->V_host_power_peak, - host->V_host_power_scale, - host->V_host_power_trace, - host->V_host_core, - host->V_host_state_initial, - host->V_host_state_trace, + cpu_ti_create_resource(host->id, + host->power_peak, + host->power_scale, + host->power_trace, + host->core_amount, + host->initial_state, + host->state_trace, host->properties); } diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index cfd09c54e2..d81bfe508c 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -105,22 +105,22 @@ static void parse_S_host(sg_platf_host_cbarg_t host) { network_element_info_t info = NULL; if (current_routing->hierarchy == SURF_ROUTING_NULL) current_routing->hierarchy = SURF_ROUTING_BASE; - xbt_assert(!xbt_lib_get_or_null(host_lib, host->V_host_id,ROUTING_HOST_LEVEL), + xbt_assert(!xbt_lib_get_or_null(host_lib, host->id,ROUTING_HOST_LEVEL), "Reading a host, processing unit \"%s\" already exists", - host->V_host_id); + host->id); xbt_assert(current_routing->set_processing_unit, "no defined method \"set_processing_unit\" in \"%s\"", current_routing->name); - (*(current_routing->set_processing_unit)) (current_routing, host->V_host_id); + (*(current_routing->set_processing_unit)) (current_routing, host->id); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing; info->rc_type = SURF_NETWORK_ELEMENT_HOST; - xbt_lib_set(host_lib,host->V_host_id,ROUTING_HOST_LEVEL,(void *) info); - if (host->V_host_coord && strcmp(host->V_host_coord,"")) { + xbt_lib_set(host_lib,host->id,ROUTING_HOST_LEVEL,(void *) info); + if (host->coord && strcmp(host->coord,"")) { if(!COORD_HOST_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'"); - xbt_dynar_t ctn = xbt_str_split_str(host->V_host_coord, " "); + xbt_dynar_t ctn = xbt_str_split_str(host->coord, " "); xbt_dynar_shrink(ctn, 0); - xbt_lib_set(host_lib,host->V_host_id,COORD_HOST_LEVEL,(void *) ctn); + xbt_lib_set(host_lib,host->id,COORD_HOST_LEVEL,(void *) ctn); } } @@ -1425,13 +1425,13 @@ void routing_parse_Scluster(void) link_id = bprintf("%s_link_%d", struct_cluster->V_cluster_id, start); XBT_DEBUG("", host_id, struct_cluster->S_cluster_power); - host.V_host_id = host_id; + host.id = host_id; if(strcmp(struct_cluster->V_cluster_availability_file,"")){ xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free); char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file); xbt_str_varsubst(tmp_availability_file,patterns); XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file); - host.V_host_power_trace = tmgr_trace_new(tmp_availability_file); + host.power_trace = tmgr_trace_new(tmp_availability_file); xbt_free(tmp_availability_file); } else @@ -1442,7 +1442,7 @@ void routing_parse_Scluster(void) char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file); xbt_str_varsubst(tmp_state_file,patterns); XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file); - host.V_host_state_trace = tmgr_trace_new(tmp_state_file); + host.state_trace = tmgr_trace_new(tmp_state_file); xbt_free(tmp_state_file); } else @@ -1450,11 +1450,11 @@ void routing_parse_Scluster(void) XBT_DEBUG("\tstate_file=\"\""); } - host.V_host_power_peak = struct_cluster->S_cluster_power; - host.V_host_power_scale = 1.0; - host.V_host_core = struct_cluster->S_cluster_core; - host.V_host_state_initial = SURF_RESOURCE_ON; - host.V_host_coord = ""; + host.power_peak = struct_cluster->S_cluster_power; + host.power_scale = 1.0; + host.core_amount = struct_cluster->S_cluster_core; + host.initial_state = SURF_RESOURCE_ON; + host.coord = ""; sg_platf_new_host(&host); XBT_DEBUG(""); @@ -1523,13 +1523,13 @@ void routing_parse_Scluster(void) A_surfxml_host_state = A_surfxml_host_state_ON; XBT_DEBUG("", host_id, struct_cluster->S_cluster_power); - host.V_host_id = host_id; + host.id = host_id; if(strcmp(struct_cluster->V_cluster_availability_file,"")){ xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free); char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file); xbt_str_varsubst(tmp_availability_file,patterns); XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file); - host.V_host_power_trace = tmgr_trace_new(tmp_availability_file); + host.power_trace = tmgr_trace_new(tmp_availability_file); xbt_free(tmp_availability_file); } else @@ -1540,7 +1540,7 @@ void routing_parse_Scluster(void) char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file); xbt_str_varsubst(tmp_state_file,patterns); XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file); - host.V_host_state_trace = tmgr_trace_new(tmp_state_file); + host.state_trace = tmgr_trace_new(tmp_state_file); xbt_free(tmp_state_file); } else @@ -1548,11 +1548,11 @@ void routing_parse_Scluster(void) XBT_DEBUG("\tstate_file=\"\""); } - host.V_host_power_peak = struct_cluster->S_cluster_power; - host.V_host_power_scale = 1.0; - host.V_host_core = struct_cluster->S_cluster_core; - host.V_host_state_initial = SURF_RESOURCE_ON; - host.V_host_coord = ""; + host.power_peak = struct_cluster->S_cluster_power; + host.power_scale = 1.0; + host.core_amount = struct_cluster->S_cluster_core; + host.initial_state = SURF_RESOURCE_ON; + host.coord = ""; sg_platf_new_host(&host); XBT_DEBUG(""); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index e18e079a53..1f110ecf67 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -277,19 +277,19 @@ void STag_surfxml_host(void){ xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)"); host.properties = current_property_set = xbt_dict_new(); - host.V_host_id = A_surfxml_host_id; - host.V_host_power_peak = get_cpu_power(A_surfxml_host_power); - host.V_host_power_scale = surf_parse_get_double( A_surfxml_host_availability); - host.V_host_core = surf_parse_get_int(A_surfxml_host_core); - host.V_host_power_trace = tmgr_trace_new(A_surfxml_host_availability_file); - host.V_host_state_trace = tmgr_trace_new(A_surfxml_host_state_file); + host.id = A_surfxml_host_id; + host.power_peak = get_cpu_power(A_surfxml_host_power); + host.power_scale = surf_parse_get_double( A_surfxml_host_availability); + host.core_amount = surf_parse_get_int(A_surfxml_host_core); + host.power_trace = tmgr_trace_new(A_surfxml_host_availability_file); + host.state_trace = tmgr_trace_new(A_surfxml_host_state_file); xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) || (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state"); if (A_surfxml_host_state == A_surfxml_host_state_ON) - host.V_host_state_initial = SURF_RESOURCE_ON; + host.initial_state = SURF_RESOURCE_ON; if (A_surfxml_host_state == A_surfxml_host_state_OFF) - host.V_host_state_initial = SURF_RESOURCE_OFF; - host.V_host_coord = A_surfxml_host_coordinates; + host.initial_state = SURF_RESOURCE_OFF; + host.coord = A_surfxml_host_coordinates; sg_platf_new_host(&host); } diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 86f3e7a32a..cf5ca3056e 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -657,12 +657,12 @@ static void* ptask_cpu_create_resource(const char *name, double power_scale, static void ptask_parse_cpu_init(sg_platf_host_cbarg_t host) { ptask_cpu_create_resource( - host->V_host_id, - host->V_host_power_peak, - host->V_host_power_scale, - host->V_host_power_trace, - host->V_host_state_initial, - host->V_host_state_trace, + host->id, + host->power_peak, + host->power_scale, + host->power_trace, + host->initial_state, + host->state_trace, host->properties); }