X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/78d426efd0d78380e29df1c1496897d2bc62f596..5916afe8cc535a67f2dd5d233080c3f005ba5a51:/src/kernel/xml/sg_platf.cpp diff --git a/src/kernel/xml/sg_platf.cpp b/src/kernel/xml/sg_platf.cpp index 6d3b433fd1..0d64feb5ab 100644 --- a/src/kernel/xml/sg_platf.cpp +++ b/src/kernel/xml/sg_platf.cpp @@ -3,6 +3,8 @@ /* 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. */ +/* This file implements the public API to platform parsing */ + #include #include #include @@ -18,19 +20,31 @@ #include #include -#include "simgrid/sg_config.hpp" #include "src/kernel/EngineImpl.hpp" #include "src/kernel/resource/DiskImpl.hpp" #include "src/kernel/resource/HostImpl.hpp" #include "src/kernel/resource/profile/Profile.hpp" #include "src/kernel/xml/platf.hpp" #include "src/kernel/xml/platf_private.hpp" +#include "src/simgrid/sg_config.hpp" #include #include XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(platf_parse); +/* This function acts as a main in the parsing area. */ +void parse_platform_file(const std::string& file) +{ + /* init the flex parser */ + simgrid_parse_open(file); + + /* Do the actual parsing */ + simgrid_parse(true); + + simgrid_parse_close(); +} + namespace simgrid::kernel::routing { xbt::signal on_cluster_creation; } // namespace simgrid::kernel::routing @@ -359,12 +373,12 @@ static void sg_platf_build_hostlink(simgrid::kernel::routing::StarZone* zone, const simgrid::kernel::routing::HostLinkCreationArgs* hostlink, const simgrid::s4u::Link* backbone) { - const auto engine = simgrid::s4u::Engine::get_instance(); - auto netpoint = engine->host_by_name(hostlink->id)->get_netpoint(); + const auto* engine = simgrid::s4u::Engine::get_instance(); + auto* netpoint = engine->host_by_name(hostlink->id)->get_netpoint(); xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str()); - const auto linkUp = engine->link_by_name_or_null(hostlink->link_up); - const auto linkDown = engine->link_by_name_or_null(hostlink->link_down); + const auto* linkUp = engine->link_by_name_or_null(hostlink->link_up); + const auto* linkDown = engine->link_by_name_or_null(hostlink->link_down); xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up.c_str()); xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down.c_str());