A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bypass the surf callbacks to parse XML... almost done
[simgrid.git]
/
src
/
bindings
/
lua
/
simgrid_lua.c
diff --git
a/src/bindings/lua/simgrid_lua.c
b/src/bindings/lua/simgrid_lua.c
index
2e48b76
..
7326253
100644
(file)
--- a/
src/bindings/lua/simgrid_lua.c
+++ b/
src/bindings/lua/simgrid_lua.c
@@
-344,10
+344,6
@@
static xbt_dynar_t route_list_d ;
//create resource
//create resource
-/*FIXME : still have to use a dictionary as argument make it possible to
-consider some arguments as optional and removes the importance of the
-parameter order */
-
static void create_host(const char* id,double power_peak,double power_sc,
const char* power_tr,int state_init,
const char* state_tr)
static void create_host(const char* id,double power_peak,double power_sc,
const char* power_tr,int state_init,
const char* state_tr)
@@
-359,10
+355,10
@@
static void create_host(const char* id,double power_peak,double power_sc,
tmgr_trace_t state_trace;
if(power_sc) // !=0
power_scale = power_sc;
tmgr_trace_t state_trace;
if(power_sc) // !=0
power_scale = power_sc;
- if (state_init == 1)
- state_initial = SURF_RESOURCE_O
N
;
+ if (state_init ==
-
1)
+ state_initial = SURF_RESOURCE_O
FF
;
else
else
- state_init
= SURF_RESOURCE_OFF
;
+ state_init
ial = SURF_RESOURCE_ON
;
if(power_tr)
power_trace = tmgr_trace_new(power_tr);
else
if(power_tr)
power_trace = tmgr_trace_new(power_tr);
else
@@
-447,7
+443,6
@@
static int Host_new(lua_State *L)
}
}
-
static int Link_new(lua_State *L) // (id,bandwidth,latency)
{
if(xbt_dynar_is_empty(link_list_d))
static int Link_new(lua_State *L) // (id,bandwidth,latency)
{
if(xbt_dynar_is_empty(link_list_d))
@@
-492,7
+487,6
@@
static int Route_new(lua_State *L) // (src_id,dest_id,links_number,link_table)
{
if(xbt_dynar_is_empty(route_list_d))
route_list_d = xbt_dynar_new(sizeof(p_route_attr), &xbt_free_ref);
{
if(xbt_dynar_is_empty(route_list_d))
route_list_d = xbt_dynar_new(sizeof(p_route_attr), &xbt_free_ref);
- int i;
const char * link_id;
p_route_attr route = malloc(sizeof(route_attr));
route->src_id = luaL_checkstring(L,1);
const char * link_id;
p_route_attr route = malloc(sizeof(route_attr));
route->src_id = luaL_checkstring(L,1);
@@
-549,21
+543,18
@@
static int Host_set_function(lua_State *L) //(host,function,nb_args,list_args)
*/
static int surf_parse_bypass_platform()
{
*/
static int surf_parse_bypass_platform()
{
- char buffer[22];
- unsigned int i,j;
- char* link_id;
+ unsigned int i;
p_host_attr p_host;
p_link_attr p_link;
p_route_attr p_route;
p_host_attr p_host;
p_link_attr p_link;
p_route_attr p_route;
- static int AX_ptr = 0;
- static int surfxml_bufferstack_size = 2048;
-
/* FIXME allocating memory for the buffer, I think 2kB should be enough */
surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
/* <platform> */
/* FIXME allocating memory for the buffer, I think 2kB should be enough */
surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
/* <platform> */
-#ifndef BYPASS_CPU
+#ifndef BYPASS_MODEL
+ static int AX_ptr = 0;
+ static int surfxml_bufferstack_size = 2048;
SURFXML_BUFFER_SET(platform_version, "2");
SURFXML_START_TAG(platform);
#endif
SURFXML_BUFFER_SET(platform_version, "2");
SURFXML_START_TAG(platform);
#endif
@@
-578,7
+569,7
@@
static int surf_parse_bypass_platform()
//add to routing model host list
surf_route_add_host((char*)p_host->id);
#else
//add to routing model host list
surf_route_add_host((char*)p_host->id);
#else
-
+ char buffer[22];
SURFXML_BUFFER_SET(host_id,p_host->id);
sprintf(buffer,"%f",p_host->power_peak);
SURFXML_BUFFER_SET(host_power,buffer);
SURFXML_BUFFER_SET(host_id,p_host->id);
sprintf(buffer,"%f",p_host->power_peak);
SURFXML_BUFFER_SET(host_power,buffer);
@@
-601,7
+592,7
@@
static int surf_parse_bypass_platform()
#ifdef BYPASS_MODEL
surf_link_create_resouce((char*)p_link->id,p_link->bandwidth,p_link->latency);
#else
#ifdef BYPASS_MODEL
surf_link_create_resouce((char*)p_link->id,p_link->bandwidth,p_link->latency);
#else
-
+ char buffer[22];
SURFXML_BUFFER_SET(link_id,p_link->id);
sprintf(buffer,"%f",p_link->bandwidth);
SURFXML_BUFFER_SET(link_bandwidth,buffer);
SURFXML_BUFFER_SET(link_id,p_link->id);
sprintf(buffer,"%f",p_link->bandwidth);
SURFXML_BUFFER_SET(link_bandwidth,buffer);
@@
-616,7
+607,6
@@
static int surf_parse_bypass_platform()
SURFXML_END_TAG(link);
#endif
}
SURFXML_END_TAG(link);
#endif
}
-
// add route
xbt_dynar_foreach(route_list_d,i,p_route)
{
// add route
xbt_dynar_foreach(route_list_d,i,p_route)
{
@@
-632,6
+622,8
@@
static int surf_parse_bypass_platform()
SURFXML_BUFFER_SET(route_impact_on_dst_with_other_send, "0.0");
SURFXML_START_TAG(route);
SURFXML_BUFFER_SET(route_impact_on_dst_with_other_send, "0.0");
SURFXML_START_TAG(route);
+ unsigned int j;
+ char* link_id;
xbt_dynar_foreach(p_route->links_id,j,link_id)
{
SURFXML_BUFFER_SET(link_c_ctn_id,link_id);
xbt_dynar_foreach(p_route->links_id,j,link_id)
{
SURFXML_BUFFER_SET(link_c_ctn_id,link_id);
@@
-646,8
+638,11
@@
static int surf_parse_bypass_platform()
/* </platform> */
#ifndef BYPASS_MODEL
SURFXML_END_TAG(platform);
/* </platform> */
#ifndef BYPASS_MODEL
SURFXML_END_TAG(platform);
+#else
+ surf_add_host_traces();
+ surf_set_routes();
+ surf_add_link_traces();
#endif
#endif
-
free(surfxml_bufferstack);
return 0; // must return 0 ?!!
free(surfxml_bufferstack);
return 0; // must return 0 ?!!
@@
-657,10
+652,8
@@
static int surf_parse_bypass_platform()
*/
static int surf_parse_bypass_application()
{
*/
static int surf_parse_bypass_application()
{
- unsigned int i
,j
;
+ unsigned int i;
p_host_attr p_host;
p_host_attr p_host;
- char * arg;
- static int AX_ptr;
static int surfxml_bufferstack_size = 2048;
/* FIXME ( should be manual )allocating memory to the buffer, I think 2MB should be enough */
surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
static int surfxml_bufferstack_size = 2048;
/* FIXME ( should be manual )allocating memory to the buffer, I think 2MB should be enough */
surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
@@
-672,7
+665,9
@@
static int surf_parse_bypass_application()
MSG_set_function(p_host->id,p_host->function,p_host->args_list);
}
#else
MSG_set_function(p_host->id,p_host->function,p_host->args_list);
}
#else
-
+ unsigned int j;
+ char* arg;
+ static int AX_ptr;
/* <platform> */
SURFXML_BUFFER_SET(platform_version, "2");
SURFXML_START_TAG(platform);
/* <platform> */
SURFXML_BUFFER_SET(platform_version, "2");
SURFXML_START_TAG(platform);
@@
-828,7
+823,7
@@
static int clean(lua_State *L) {
}
/*
}
/*
- * Bypass XML Par
e
ser
+ * Bypass XML Parser
*/
static int register_platform(lua_State *L)
{
*/
static int register_platform(lua_State *L)
{