From: Martin Quinson Date: Tue, 8 Nov 2011 14:06:44 +0000 (+0100) Subject: further parser cleanups X-Git-Tag: exp_20120216~426 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/83b6eb642c9777ecc8f947d1a645cbec1874173b further parser cleanups - kill some dead code related to the old lua console - do not load a header at the *end* of another header - solve some header inclusion madness created in this process --- diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 8de4bd2899..e17d1b28f9 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -12,6 +12,10 @@ #include typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */ +XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new(const char *filename); +XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id, + const char *input, + double periodicity); /** Defines whether a given resource is working or not */ typedef enum { diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index cafb3d3295..3d38e2afda 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -703,96 +703,5 @@ XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency; XBT_PUBLIC(double) get_cpu_power(const char *power); -/*public interface to create resource bypassing the parser via cpu/network model - * - * see surfxml_parse.c - * */ -XBT_PUBLIC(void*) surf_host_create_resource(char *name, double power_peak, - double power_scale, - tmgr_trace_t power_trace, - int core, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - xbt_dict_t cpu_properties); - -/*public interface to create resource bypassing the parser via workstation_ptask_L07 model - * - * see surfxml_parse.c - * */ -XBT_PUBLIC(void*) surf_wsL07_host_create_resource(char *name, - double power_peak, - double power_scale, - tmgr_trace_t power_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - xbt_dict_t - cpu_properties); -/** - * create link resource - * see surfxml_parse.c - */ -XBT_PUBLIC(void*) surf_link_create_resource(char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t - policy, xbt_dict_t properties); - - -XBT_PUBLIC(void*) surf_wsL07_link_create_resource(char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t - policy, - xbt_dict_t properties); -/** - * add route element (link_ctn) bypassing the parser - * - * see surfxml_parse.c - * - */ -XBT_PUBLIC(void) surf_add_route_element(char *link_ctn_id); - -/** - * set route src_id,dest_id, and create a route resource - * - * see surf_routing.c && surfxml_parse.c - */ - -XBT_PUBLIC(void) surf_set_routes(void); - - -/** - * add traces - * see surfxml_parse.c - */ -XBT_PUBLIC(void) surf_add_host_traces(void); -XBT_PUBLIC(void) surf_add_link_traces(void); -XBT_PUBLIC(void) surf_wsL07_add_traces(void); - -//Set a new link on the actual list of link for a route or ASroute -XBT_PUBLIC(void) routing_add_link(const char *link_id); -//Set the endpoints for a route -XBT_PUBLIC(void) routing_set_route(const char *src_id, const char *dst_id); -//Store the route -XBT_PUBLIC(void) routing_store_route(void); -XBT_PUBLIC(void) surf_routing_add_route(const char *src_id, - const char *dest_id, - xbt_dynar_t links_id); - -#include "surf/surf_resource.h" -#include "surf/surf_resource_lmm.h" - SG_END_DECL() #endif /* _SURF_SURF_H */ diff --git a/src/include/surf/surf_resource_lmm.h b/src/include/surf/surf_resource_lmm.h index e1c3a0b11b..4f7eb940f0 100644 --- a/src/include/surf/surf_resource_lmm.h +++ b/src/include/surf/surf_resource_lmm.h @@ -9,6 +9,8 @@ #define SURF_RESOURCE_LMM_H #include "surf/surf.h" #include "surf/trace_mgr.h" +#include "surf/surf_resource.h" + static XBT_INLINE surf_resource_lmm_t surf_resource_lmm_new(size_t childsize, diff --git a/src/include/surf/trace_mgr.h b/src/include/surf/trace_mgr.h index 394cddca52..0ea8271f3b 100644 --- a/src/include/surf/trace_mgr.h +++ b/src/include/surf/trace_mgr.h @@ -17,10 +17,6 @@ XBT_PUBLIC(tmgr_history_t) tmgr_history_new(void); XBT_PUBLIC(void) tmgr_history_free(tmgr_history_t history); -XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new(const char *filename); -XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id, - const char *input, - double periodicity); XBT_PUBLIC(tmgr_trace_t) tmgr_empty_trace_new(void); XBT_INLINE XBT_PUBLIC(void) tmgr_trace_free(tmgr_trace_t trace); /** diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index f3a3750fa7..5308684d18 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2006, 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2006-2011. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,6 +9,8 @@ #include "xbt/dict.h" #include "xbt/sysdep.h" #include "surf/surf.h" +#include "surf/surf_resource.h" + /* Creates a link and registers it in SD. */ diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 232b83ce6b..938e2236b7 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2006, 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2006-2011. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,6 +9,9 @@ #include "xbt/dict.h" #include "xbt/sysdep.h" #include "surf/surf.h" +#include "surf/surf_resource.h" + + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_workstation, sd, "Logging specific to SimDag (workstation)"); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index c9d2c8b4ab..5a0e491d71 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -4,6 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include // sqrt #include "private.h" #include "xbt/dict.h" #include "xbt/sysdep.h" diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 3106dbfd0a..f7ba2ce51b 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -1,10 +1,12 @@ -/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2004-2011. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #include "surf_private.h" +#include "surf/surf_resource.h" + typedef s_surf_action_lmm_t s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t; diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 6adc2bc4d9..eec52e0188 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -1,10 +1,12 @@ -/* Copyright (c) 2009, 2010. The SimGrid Team. +/* Copyright (c) 2009-2011. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #include "surf_private.h" +#include "surf/surf_resource.h" + #undef GENERIC_LMM_ACTION #undef GENERIC_ACTION diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index 6aabfd2f4e..38834c59e6 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -14,6 +14,7 @@ #include "trace_mgr_private.h" #include "cpu_ti_private.h" #include "xbt/heap.h" +#include "surf/surf_resource.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf, "Logging specific to the SURF CPU TRACE INTEGRATION module"); diff --git a/src/surf/network.c b/src/surf/network.c index 65c2fe4a0b..6d203b38f5 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2004-2011. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,6 +9,9 @@ #include "xbt/str.h" #include "surf/surfxml_parse_values.h" +#include "surf/surf_resource.h" +#include "surf/surf_resource_lmm.h" + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, "Logging specific to the SURF network module"); diff --git a/src/surf/network_im.c b/src/surf/network_im.c index bc94690fac..fc12e428d8 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -17,6 +17,8 @@ #include "surf_private.h" #include "xbt/dict.h" #include "maxmin_private.h" +#include "surf/surf_resource_lmm.h" + #undef GENERIC_ACTION #define GENERIC_ACTION(action) action->generic_action diff --git a/src/surf/surf.c b/src/surf/surf.c index 95cdc8f7f6..78f383487c 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -9,6 +9,9 @@ #include "surf_private.h" #include "xbt/module.h" #include "mc/mc.h" +#include "surf/surf_resource.h" +//#include "surf/surf_resource_lmm.h" + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (kernel)"); diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index f67846ac2f..0846990785 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -203,7 +203,7 @@ XBT_PUBLIC(void) routing_parse_Scluster(void); /* cluster bypass */ /** * Resource protected methods */ -xbt_dict_t surf_resource_properties(const void *resource); +static XBT_INLINE xbt_dict_t surf_resource_properties(const void *resource); XBT_PUBLIC(void) surfxml_bufferstack_push(int new); XBT_PUBLIC(void) surfxml_bufferstack_pop(int new); diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 775641e912..af28025a48 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -146,7 +146,7 @@ static void parse_S_router(sg_platf_router_cbarg_t router) xbt_lib_set(as_router_lib,router->id,ROUTING_ASR_LEVEL,(void *) info); if (strcmp(router->coord,"")) { if(!COORD_ASR_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'"); - xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_router_coordinates, " "); + xbt_dynar_t ctn = xbt_str_split_str(router->coord, " "); xbt_dynar_shrink(ctn, 0); xbt_lib_set(as_router_lib,router->id,COORD_ASR_LEVEL,(void *) ctn); } @@ -1932,27 +1932,3 @@ static void routing_parse_Srandom(void) } } - -/* - * Set a new link on the actual list of link for a route or ASroute - */ -void routing_add_link(const char *link_id) -{ - parse_E_link_c_ctn_new_elem_lua((char *) link_id); -} - -/* - *Set the endpoints for a route - */ -void routing_set_route(const char *src_id, const char *dst_id) -{ - parse_S_route_new_and_endpoints_lua(src_id, dst_id); -} - -/* - * Store the route by calling parse_E_route_store_route - */ -void routing_store_route(void) -{ - parse_E_route_store_route(); -} diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 915dfd78c3..2b21cc2ed1 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -633,122 +633,3 @@ static void add_randomness(void) &xbt_free_ref); } -/** - * create CPU resource via CPU Model - */ -void* surf_host_create_resource(char *name, double power_peak, - double power_scale, - tmgr_trace_t power_trace, int core, - e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace, - xbt_dict_t cpu_properties) -{ - return surf_cpu_model->extension.cpu.create_resource(name, power_peak, - power_scale, - power_trace, - core, - state_initial, - state_trace, - cpu_properties); -} - -/** - * create CPU resource via worsktation_ptask_L07 model - */ - -void* surf_wsL07_host_create_resource(char *name, double power_peak, - double power_scale, - tmgr_trace_t power_trace, - e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace, - xbt_dict_t cpu_properties) -{ - return surf_workstation_model->extension.workstation.cpu_create_resource(name, - power_peak, - power_scale, - power_trace, - state_initial, - state_trace, - cpu_properties); -} - -/** - * create link resource via network Model - */ -void* surf_link_create_resource(char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy, - xbt_dict_t properties) -{ - return surf_network_model->extension.network.create_resource(name, - bw_initial, - bw_trace, - lat_initial, - lat_trace, - state_initial, - state_trace, - policy, - properties); -} - -/** - * create link resource via workstation_ptask_L07 model - */ - -void* surf_wsL07_link_create_resource(char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t - state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t - policy, xbt_dict_t properties) -{ - return surf_workstation_model->extension.workstation. - link_create_resource(name, bw_initial, bw_trace, lat_initial, - lat_trace, state_initial, state_trace, policy, - properties); -} - -/** - * set route - */ -void surf_routing_add_route(const char *src_id, const char *dst_id, - xbt_dynar_t links_id) -{ - unsigned int i; - const char *link_id; - routing_set_route(src_id, dst_id); - xbt_dynar_foreach(links_id, i, link_id) { - routing_add_link(link_id); - } - - //store the route - routing_store_route(); -} - -/** - * Add Traces - */ -void surf_add_host_traces(void) -{ - return surf_cpu_model->extension.cpu.add_traces(); -} - -void surf_add_link_traces(void) -{ - return surf_network_model->extension.network.add_traces(); -} - -void surf_wsL07_add_traces(void) -{ - return surf_workstation_model->extension.workstation.add_traces(); -} diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 0a7641b535..f54ec0c0b9 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -8,6 +8,9 @@ #include "xbt/dict.h" #include "portable.h" #include "surf_private.h" +#include "surf/surf_resource.h" + + typedef struct workstation_CLM03 { s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */ diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index ee32783777..59ae4462a7 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -8,6 +8,8 @@ #include "xbt/str.h" #include "xbt/dict.h" #include "surf_private.h" +#include "surf/surf_resource.h" +//#include "surf/surf_resource_lmm.h" typedef enum { SURF_WORKSTATION_RESOURCE_CPU, diff --git a/testsuite/surf/surf_usage.c b/testsuite/surf/surf_usage.c index 103e1de846..db55b75a3d 100644 --- a/testsuite/surf/surf_usage.c +++ b/testsuite/surf/surf_usage.c @@ -12,6 +12,7 @@ #include #include "surf/surf.h" +#include "surf/surf_resource.h" #include "surf/surfxml_parse.h" // for reset callback #include "xbt/log.h" diff --git a/testsuite/surf/surf_usage2.c b/testsuite/surf/surf_usage2.c index c539bcb14e..a958e39eb3 100644 --- a/testsuite/surf/surf_usage2.c +++ b/testsuite/surf/surf_usage2.c @@ -11,6 +11,7 @@ #include #include "surf/surf.h" +#include "surf/surf_resource.h" #include "surf/surfxml_parse.h" // for reset callback #include "xbt/log.h"