From: Martin Quinson Date: Thu, 10 Nov 2011 13:21:35 +0000 (+0100) Subject: Rename sg_platf_new_AS_{open,close} to {begin,end} since you cannot reopen them to... X-Git-Tag: exp_20120216~356 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8cc10e99f53995bc7486e4467b4e6ad8d7be3460?ds=sidebyside Rename sg_platf_new_AS_{open,close} to {begin,end} since you cannot reopen them to add stuff afterward (and other similar call renaming) --- diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index b57e5b6e4e..c449f3f1d0 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -87,11 +87,11 @@ typedef struct s_sg_platf_linkctn_cbarg { } s_sg_platf_linkctn_cbarg_t; -XBT_PUBLIC(void) sg_platf_open(void); // Start a new platform -XBT_PUBLIC(void) sg_platf_close(void); // Finish the creation of the platform +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_open(const char *id, const char *mode); // Begin description of new AS -XBT_PUBLIC(void) sg_platf_new_AS_close(void); // That AS is fully described +XBT_PUBLIC(void) sg_platf_new_AS_begin(const char *id, const char *mode); // 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_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS XBT_PUBLIC(void) sg_platf_new_router(sg_platf_router_cbarg_t router); // Add a router to the currently described AS diff --git a/include/surf/surf_routing.h b/include/surf/surf_routing.h index b348c640c5..3c945cc4e6 100644 --- a/include/surf/surf_routing.h +++ b/include/surf/surf_routing.h @@ -31,7 +31,7 @@ extern int NS3_ASR_LEVEL; //host node for ns3 /* The callbacks to register for the routing to work */ -void routing_AS_open(const char *AS_id, const char *wanted_routing_type); -void routing_AS_close(void); +void routing_AS_begin(const char *AS_id, const char *wanted_routing_type); +void routing_AS_end(void); #endif /* _SURF_SURF_H */ diff --git a/src/bindings/lua/lua_console.c b/src/bindings/lua/lua_console.c index c6f01ae2b4..c96a02ee8e 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; } @@ -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; } diff --git a/src/include/simgrid/platf_interface.h b/src/include/simgrid/platf_interface.h index 07da10daf4..050a8b7826 100644 --- a/src/include/simgrid/platf_interface.h +++ b/src/include/simgrid/platf_interface.h @@ -21,15 +21,15 @@ typedef void (*sg_platf_host_cb_t)(sg_platf_host_cbarg_t); typedef void (*sg_platf_router_cb_t)(sg_platf_router_cbarg_t); typedef void (*sg_platf_link_cb_t)(sg_platf_link_cbarg_t); typedef void (*sg_platf_peer_cb_t)(sg_platf_peer_cbarg_t); -typedef void (*sg_platf_ASopen_cb_t)(const char*id, const char*routing); +typedef void (*sg_platf_AS_begin_cb_t)(const char*id, const char*routing); void sg_platf_host_add_cb(sg_platf_host_cb_t); void sg_platf_router_add_cb(sg_platf_router_cb_t); void sg_platf_link_add_cb(sg_platf_link_cb_t); void sg_platf_peer_add_cb(sg_platf_peer_cb_t fct); void sg_platf_postparse_add_cb(void_f_void_t fct); -void sg_platf_ASopen_add_cb(sg_platf_ASopen_cb_t fct); -void sg_platf_ASclose_add_cb(void_f_void_t fct); +void sg_platf_AS_begin_add_cb(sg_platf_AS_begin_cb_t fct); +void sg_platf_AS_end_add_cb(void_f_void_t fct); diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index b346c196ea..df7e05bbe8 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -288,8 +288,8 @@ void instr_routing_define_callbacks () if (!TRACE_is_enabled()) return; //always need the call backs to ASes (we need only the root AS), //to create the rootContainer and the rootType properly - sg_platf_ASopen_add_cb(instr_routing_parse_start_AS); - sg_platf_ASclose_add_cb(instr_routing_parse_end_AS); + sg_platf_AS_begin_add_cb(instr_routing_parse_start_AS); + sg_platf_AS_end_add_cb(instr_routing_parse_end_AS); if (!TRACE_needs_platform()) return; sg_platf_link_add_cb(instr_routing_parse_start_link); sg_platf_host_add_cb(instr_routing_parse_start_host); diff --git a/src/surf/sg_platf.c b/src/surf/sg_platf.c index 382dd2e5fb..1f765621ca 100644 --- a/src/surf/sg_platf.c +++ b/src/surf/sg_platf.c @@ -15,8 +15,8 @@ xbt_dynar_t sg_platf_host_cb_list = NULL; // of sg_platf_host_cb_t xbt_dynar_t sg_platf_link_cb_list = NULL; // of sg_platf_link_cb_t xbt_dynar_t sg_platf_router_cb_list = NULL; // of sg_platf_router_cb_t xbt_dynar_t sg_platf_peer_cb_list = NULL; // of sg_platf_peer_cb_t -xbt_dynar_t sg_platf_ASopen_cb_list = NULL; //of sg_platf_ASopen_cb_t -xbt_dynar_t sg_platf_ASclose_cb_list = NULL; //of void_f_void_t +xbt_dynar_t sg_platf_AS_begin_cb_list = NULL; //of sg_platf_AS_begin_cb_t +xbt_dynar_t sg_platf_AS_end_cb_list = NULL; //of void_f_void_t xbt_dynar_t sg_platf_postparse_cb_list = NULL; // of void_f_void_t /** Module management function: creates all internal data structures */ @@ -26,8 +26,8 @@ void sg_platf_init(void) { sg_platf_link_cb_list = xbt_dynar_new(sizeof(sg_platf_host_cb_t), NULL); sg_platf_peer_cb_list = xbt_dynar_new(sizeof(sg_platf_peer_cb_t), NULL); sg_platf_postparse_cb_list = xbt_dynar_new(sizeof(sg_platf_link_cb_t),NULL); - sg_platf_ASopen_cb_list = xbt_dynar_new(sizeof(sg_platf_ASopen_cb_t),NULL); - sg_platf_ASclose_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); + sg_platf_AS_begin_cb_list = xbt_dynar_new(sizeof(sg_platf_AS_begin_cb_t),NULL); + sg_platf_AS_end_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL); } /** Module management function: frees all internal data structures */ void sg_platf_exit(void) { @@ -36,8 +36,8 @@ void sg_platf_exit(void) { xbt_dynar_free(&sg_platf_link_cb_list); xbt_dynar_free(&sg_platf_postparse_cb_list); xbt_dynar_free(&sg_platf_peer_cb_list); - xbt_dynar_free(&sg_platf_ASopen_cb_list); - xbt_dynar_free(&sg_platf_ASclose_cb_list); + xbt_dynar_free(&sg_platf_AS_begin_cb_list); + xbt_dynar_free(&sg_platf_AS_end_cb_list); } void sg_platf_new_host(sg_platf_host_cbarg_t h){ @@ -69,9 +69,9 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer){ } } -void sg_platf_open() { /* Do nothing: just for symmetry of user code */ } +void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ } -void sg_platf_close() { +void sg_platf_end() { unsigned int iterator; void_f_void_t fun; xbt_dynar_foreach(sg_platf_postparse_cb_list, iterator, fun) { @@ -79,18 +79,18 @@ void sg_platf_close() { } } -void sg_platf_new_AS_open(const char *id, const char *routing) { +void sg_platf_new_AS_begin(const char *id, const char *routing) { unsigned int iterator; - sg_platf_ASopen_cb_t fun; - xbt_dynar_foreach(sg_platf_ASopen_cb_list, iterator, fun) { + sg_platf_AS_begin_cb_t fun; + xbt_dynar_foreach(sg_platf_AS_begin_cb_list, iterator, fun) { (*fun) (id,routing); } } -void sg_platf_new_AS_close() { +void sg_platf_new_AS_end() { unsigned int iterator; void_f_void_t fun; - xbt_dynar_foreach(sg_platf_ASclose_cb_list, iterator, fun) { + xbt_dynar_foreach(sg_platf_AS_end_cb_list, iterator, fun) { (*fun) (); } } @@ -111,10 +111,10 @@ void sg_platf_peer_add_cb(sg_platf_peer_cb_t fct) { void sg_platf_postparse_add_cb(void_f_void_t fct) { xbt_dynar_push(sg_platf_postparse_cb_list, &fct); } -void sg_platf_ASopen_add_cb(sg_platf_ASopen_cb_t fct) { - xbt_dynar_push(sg_platf_ASopen_cb_list, &fct); +void sg_platf_AS_begin_add_cb(sg_platf_AS_begin_cb_t fct) { + xbt_dynar_push(sg_platf_AS_begin_cb_list, &fct); } -void sg_platf_ASclose_add_cb(void_f_void_t fct) { - xbt_dynar_push(sg_platf_ASclose_cb_list, &fct); +void sg_platf_AS_end_add_cb(void_f_void_t fct) { + xbt_dynar_push(sg_platf_AS_end_cb_list, &fct); } diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 0ac0e57aee..d1a77e1a39 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -292,7 +292,7 @@ static void routing_parse_E_bypassRoute(void) * @param AS_id name of this autonomous system. Must be unique in the platform * @param wanted_routing_type one of Full, Floyd, Dijkstra or similar. Full list in the variable routing_models, in src/surf/surf_routing.c */ -void routing_AS_open(const char *AS_id, const char *wanted_routing_type) +void routing_AS_begin(const char *AS_id, const char *wanted_routing_type) { routing_component_t new_routing; model_type_t model = NULL; @@ -367,7 +367,7 @@ void routing_AS_open(const char *AS_id, const char *wanted_routing_type) * even if you add stuff to a closed AS * */ -void routing_AS_close() +void routing_AS_end() { if (current_routing == NULL) { @@ -901,7 +901,7 @@ static void routing_parse_cluster(void) xbt_dynar_t radical_ends; XBT_DEBUG("", struct_cluster->id); - sg_platf_new_AS_open(struct_cluster->id, "Cluster"); + sg_platf_new_AS_begin(struct_cluster->id, "Cluster"); //Make all hosts radical_elements = xbt_str_split(struct_cluster->radical, ","); @@ -1085,7 +1085,7 @@ static void routing_parse_cluster(void) xbt_dict_free(&patterns); XBT_DEBUG(""); - sg_platf_new_AS_close(); + sg_platf_new_AS_end(); XBT_DEBUG(" "); } @@ -1133,7 +1133,7 @@ static void routing_parse_peer(sg_platf_peer_cbarg_t peer) surfxml_bufferstack_push(1); XBT_DEBUG("", peer->id); - sg_platf_new_AS_open(peer->id, "Full"); + sg_platf_new_AS_begin(peer->id, "Full"); XBT_DEBUG(" "); host_id = HOST_PEER(peer->id); @@ -1219,7 +1219,7 @@ static void routing_parse_peer(sg_platf_peer_cbarg_t peer) SURFXML_END_TAG(route); XBT_DEBUG(""); - sg_platf_new_AS_close(); + sg_platf_new_AS_end(); XBT_DEBUG(" "); //xbt_dynar_free(&tab_elements_num); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 46faca1914..10c9ff03d6 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -254,10 +254,10 @@ void STag_surfxml_platform(void) { "This program is installed automatically with SimGrid, or " "available in the tools/ directory of the source archive."); - sg_platf_open(); + sg_platf_begin(); } void ETag_surfxml_platform(void){ - sg_platf_close(); + sg_platf_end(); } void STag_surfxml_host(void){ @@ -411,10 +411,10 @@ void STag_surfxml_trace_connect(void){ surfxml_call_cb_functions(STag_surfxml_trace_connect_cb_list); } void STag_surfxml_AS(void){ - sg_platf_new_AS_open(A_surfxml_AS_id,A_surfxml_AS_routing); + sg_platf_new_AS_begin(A_surfxml_AS_id,A_surfxml_AS_routing); } void ETag_surfxml_AS(void){ - sg_platf_new_AS_close(); + sg_platf_new_AS_end(); } void STag_surfxml_ASroute(void){ surfxml_call_cb_functions(STag_surfxml_ASroute_cb_list); diff --git a/src/surf/surfxml_parseplatf.c b/src/surf/surfxml_parseplatf.c index 9f2e6de3f5..4fa418fcfa 100644 --- a/src/surf/surfxml_parseplatf.c +++ b/src/surf/surfxml_parseplatf.c @@ -156,8 +156,8 @@ static void init_data(void) &parse_Stag_trace_connect); /* we care about the ASes while parsing the platf. Incredible, isnt it? */ - sg_platf_ASclose_add_cb(routing_AS_close); - sg_platf_ASopen_add_cb(routing_AS_open); + sg_platf_AS_end_add_cb(routing_AS_end); + sg_platf_AS_begin_add_cb(routing_AS_begin); } static void free_data(void)