From 982cab33412abf91552a74e5cb567164d4a9a647 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 27 Mar 2016 11:35:12 +0200 Subject: [PATCH] let's seal() the AS in lua too --- examples/platforms/cluster_prototype.lua | 2 +- examples/platforms/routing_cluster.lua | 6 +++--- examples/platforms/small_platform.lua | 2 +- src/bindings/lua/lua_platf.cpp | 8 ++++---- src/bindings/lua/simgrid_lua.h | 2 +- src/surf/sg_platf.cpp | 12 ++++++------ src/surf/xml/platf_private.hpp | 2 +- src/surf/xml/surfxml_sax_cb.cpp | 9 +++------ 8 files changed, 20 insertions(+), 23 deletions(-) diff --git a/examples/platforms/cluster_prototype.lua b/examples/platforms/cluster_prototype.lua index de2c0f87fe..19c45e0e45 100644 --- a/examples/platforms/cluster_prototype.lua +++ b/examples/platforms/cluster_prototype.lua @@ -47,7 +47,7 @@ simgrid.platf.link_new{id=linkname .. "_loopback",bandwidth=args.loopback_bw,latency=args.loopback_lat,sharing_policy="FATPIPE"} end end - simgrid.platf.AS_close() + simgrid.platf.AS_seal() end end diff --git a/examples/platforms/routing_cluster.lua b/examples/platforms/routing_cluster.lua index ee134cf50e..b70de8d65d 100644 --- a/examples/platforms/routing_cluster.lua +++ b/examples/platforms/routing_cluster.lua @@ -22,7 +22,7 @@ simgrid.platf.AS_open{id="AS0",mode="Full"} simgrid.platf.backbone_new{id="backbone1",bandwidth="2.25GBps",lat="500us"}; - simgrid.platf.AS_close() + simgrid.platf.AS_seal() simgrid.platf.AS_open{id="my_cluster2",mode="Cluster"} simgrid.platf.router_new{id="router2"} @@ -41,11 +41,11 @@ simgrid.platf.AS_open{id="AS0",mode="Full"} simgrid.platf.backbone_new{id="backbone2",bandwidth="2.25GBps",lat="500us"} - simgrid.platf.AS_close() + simgrid.platf.AS_seal() simgrid.platf.link_new{id="link1-2",bandwidth="2.25GBps",lat="500us"}; simgrid.platf.ASroute_new{src="my_cluster1", dst="my_cluster2", gw_src="router1", gw_dst="router2", links="link1-2"} -simgrid.platf.AS_close() +simgrid.platf.AS_seal() simgrid.platf.close() diff --git a/examples/platforms/small_platform.lua b/examples/platforms/small_platform.lua index 9696c2434a..aa88cc313b 100644 --- a/examples/platforms/small_platform.lua +++ b/examples/platforms/small_platform.lua @@ -51,6 +51,6 @@ simgrid.platf.route_new{AS="AS0",src="Ginette",dest="Bourassa",links="5,2,0,1,6,7"}; - simgrid.platf.AS_close(); + simgrid.platf.AS_seal(); simgrid.platf.close(); diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index d180552213..e9136189e7 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -32,7 +32,7 @@ static const luaL_Reg platf_functions[] = { {"open", console_open}, {"close", console_close}, {"AS_open", console_AS_open}, - {"AS_close", console_AS_close}, + {"AS_seal", console_AS_seal}, {"backbone_new", console_add_backbone}, {"host_link_new", console_add_host___link}, {"host_new", console_add_host}, @@ -537,9 +537,9 @@ int console_AS_open(lua_State *L) { return 0; } -int console_AS_close(lua_State *L) { - XBT_DEBUG("Closing AS"); - sg_platf_new_AS_end(); +int console_AS_seal(lua_State *L) { + XBT_DEBUG("Sealing AS"); + sg_platf_new_AS_seal(); return 0; } diff --git a/src/bindings/lua/simgrid_lua.h b/src/bindings/lua/simgrid_lua.h index d5162e6eed..289974f6b2 100644 --- a/src/bindings/lua/simgrid_lua.h +++ b/src/bindings/lua/simgrid_lua.h @@ -25,7 +25,7 @@ int console_add_router(lua_State* L); int console_add_route(lua_State*); int console_add_ASroute(lua_State*); int console_AS_open(lua_State*); -int console_AS_close(lua_State *L); +int console_AS_seal(lua_State *L); int console_set_function(lua_State*); int console_host_set_property(lua_State*); } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 4076bf6c1e..8cfb69d991 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -378,7 +378,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster) } XBT_DEBUG(""); - sg_platf_new_AS_end(); + sg_platf_new_AS_seal(); simgrid::surf::on_cluster(cluster); } @@ -693,7 +693,7 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) static_cast(current_routing)->router_ = static_cast(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL)); XBT_DEBUG(""); - sg_platf_new_AS_end(); + sg_platf_new_AS_seal(); XBT_DEBUG(" "); free(router_id); @@ -780,7 +780,7 @@ static void surf_config_models_setup() * * Add a new autonomous system to the platform. Any elements (such as host, * router or sub-AS) added after this call and before the corresponding call - * to sg_platf_new_AS_close() will be added to this AS. + * to sg_platf_new_AS_seal() will be added to this AS. * * Once this function was called, the configuration concerning the used * models cannot be changed anymore. @@ -857,12 +857,12 @@ void sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS) } /** - * \brief Specify that the current description of AS is finished + * \brief Specify that the description of the current AS is finished * - * Once you've declared all the content of your AS, you have to close + * Once you've declared all the content of your AS, you have to seal * it with this call. Your AS is not usable until you call this function. */ -void sg_platf_new_AS_end() +void sg_platf_new_AS_seal() { xbt_assert(current_routing, "Cannot seal the current AS: none under construction"); current_routing->seal(); diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 1066e86577..79e42b7909 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -201,7 +201,7 @@ XBT_PUBLIC(void) sg_platf_begin(void); // Start a new platform XBT_PUBLIC(void) sg_platf_end(void); // Finish the creation of the platform XBT_PUBLIC(void) sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS); // Begin description of new AS -XBT_PUBLIC(void) sg_platf_new_AS_end(void); // That AS is fully described +XBT_PUBLIC(void) sg_platf_new_AS_seal(void); // That AS is fully described XBT_PUBLIC(void) sg_platf_new_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS XBT_PUBLIC(void) sg_platf_new_hostlink(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 43a7a952ab..056620d6d9 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -410,7 +410,7 @@ void STag_surfxml_host(void){ void STag_surfxml_prop(void) { - if(AS_TAG){ + if(AS_TAG){ // We need a stack here to retrieve the most recently opened AS if (!as_current_property_set){ xbt_assert(as_prop_nb < 1024, "Number of AS property reach the limit!!!"); as_current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error @@ -882,13 +882,10 @@ void ETag_surfxml_AS(void){ xbt_dict_t dict = (xbt_dict_t) as_dict_tab[as_prop_nb-1]; as_prop_nb--; XBT_DEBUG("POP prop %p for AS '%s'",dict,name); - xbt_lib_set(as_router_lib, - name, - ROUTING_PROP_ASR_LEVEL, - dict); + xbt_lib_set(as_router_lib, name, ROUTING_PROP_ASR_LEVEL, dict); xbt_free(name); } - sg_platf_new_AS_end(); + sg_platf_new_AS_seal(); } void STag_surfxml_config(void){ -- 2.20.1