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;
}
// 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
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);
// 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 */
//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
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);
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);
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);
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;
}
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;
}