X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/22b3e706eb926a52a50f895b3313e587a92ca0e5..06bae8eb4bc956a5ee70ec1d3cdbc5e7e782536f:/src/bindings/lua/lua_console.c diff --git a/src/bindings/lua/lua_console.c b/src/bindings/lua/lua_console.c index afa8a94f45..50f48e4eaa 100644 --- a/src/bindings/lua/lua_console.c +++ b/src/bindings/lua/lua_console.c @@ -15,13 +15,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_console, bindings, "Lua Bindings"); int console_open(lua_State *L) { sg_platf_init(); - sg_platf_open(); + sg_platf_begin(); surf_parse_init_callbacks(); return 0; } int console_close(lua_State *L) { - sg_platf_close(); + sg_platf_end(); sg_platf_exit(); return 0; } @@ -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); @@ -104,19 +104,19 @@ int console_add_link(lua_State *L) { // get Id Value lua_pushstring(L, "id"); lua_gettable(L, -2); - link.V_link_id = lua_tostring(L, -1); + link.id = lua_tostring(L, -1); lua_pop(L, 1); // get bandwidth value lua_pushstring(L, "bandwidth"); lua_gettable(L, -2); - link.V_link_bandwidth = lua_tonumber(L, -1); + link.bandwidth = lua_tonumber(L, -1); lua_pop(L, 1); //get latency value lua_pushstring(L, "latency"); lua_gettable(L, -2); - link.V_link_latency = lua_tonumber(L, -1); + link.latency = lua_tonumber(L, -1); lua_pop(L, 1); /*Optional Arguments */ @@ -124,28 +124,28 @@ int console_add_link(lua_State *L) { //get bandwidth_trace value lua_pushstring(L, "bandwidth_trace"); lua_gettable(L, -2); - link.V_link_bandwidth_file = tmgr_trace_new(lua_tostring(L, -1)); + link.bandwidth_trace = tmgr_trace_new(lua_tostring(L, -1)); lua_pop(L, 1); //get latency_trace value lua_pushstring(L, "latency_trace"); lua_gettable(L, -2); - link.V_link_latency_file = tmgr_trace_new(lua_tostring(L, -1)); + link.latency_trace = tmgr_trace_new(lua_tostring(L, -1)); lua_pop(L, 1); //get state_trace value lua_pushstring(L, "state_trace"); lua_gettable(L, -2); - link.V_link_state_file = tmgr_trace_new(lua_tostring(L, -1)); + link.state_trace = tmgr_trace_new(lua_tostring(L, -1)); lua_pop(L, 1); //get state_initial value lua_pushstring(L, "state_initial"); lua_gettable(L, -2); if (lua_tonumber(L, -1)) - link.V_link_state = SURF_RESOURCE_ON; + link.state = SURF_RESOURCE_ON; else - link.V_link_state = SURF_RESOURCE_OFF; + link.state = SURF_RESOURCE_OFF; lua_pop(L, 1); //get policy value @@ -154,11 +154,11 @@ int console_add_link(lua_State *L) { policy = lua_tostring(L, -1); lua_pop(L, 1); if (policy && !strcmp(policy,"FULLDUPLEX")) { - link.V_link_sharing_policy = SURF_LINK_FULLDUPLEX; + link.policy = SURF_LINK_FULLDUPLEX; } else if (policy && !strcmp(policy,"FATPIPE")) { - link.V_link_sharing_policy = SURF_LINK_FATPIPE; + link.policy = SURF_LINK_FATPIPE; } else { - link.V_link_sharing_policy = SURF_LINK_SHARED; + link.policy = SURF_LINK_SHARED; } sg_platf_new_link(&link); @@ -179,12 +179,12 @@ int console_add_router(lua_State* L) { lua_pushstring(L, "id"); lua_gettable(L, -2); - router.V_router_id = lua_tostring(L, -1); + router.id = lua_tostring(L, -1); lua_pop(L,1); lua_pushstring(L,"coord"); lua_gettable(L,-2); - router.V_router_coord = lua_tostring(L, -1); + router.coord = lua_tostring(L, -1); lua_pop(L,1); sg_platf_new_router(&router); @@ -226,7 +226,7 @@ int console_add_route(lua_State *L) { lua_pushstring(L,"links"); lua_gettable(L,-2); links = xbt_str_split(lua_tostring(L, -1), ", \t\r\n"); - if (xbt_dynar_length(links)==0) + if (xbt_dynar_is_empty(links)) xbt_dynar_push_as(links,char*,xbt_strdup(lua_tostring(L, -1))); lua_pop(L,1); @@ -279,12 +279,12 @@ int console_AS_open(lua_State *L) { mode = lua_tostring(L, -1); lua_pop(L, 1); - sg_platf_new_AS_open(id,mode); + sg_platf_new_AS_begin(id,mode); return 0; } int console_AS_close(lua_State *L) { - sg_platf_new_AS_close(); + sg_platf_new_AS_end(); return 0; } @@ -363,7 +363,7 @@ int console_host_set_property(lua_State *L) { return -1; } xbt_dict_t props = MSG_host_get_properties(host); - xbt_dict_set(props,prop_id,xbt_strdup(prop_value),free); + xbt_dict_set(props,prop_id,xbt_strdup(prop_value),NULL); return 0; }