Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stringify s4u::Engine
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 11 Jul 2018 09:13:57 +0000 (11:13 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 11 Jul 2018 15:01:47 +0000 (17:01 +0200)
14 files changed:
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/NetZone.hpp
include/simgrid/simix.h
include/simgrid/simix.hpp
src/include/surf/surf.hpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Netzone.cpp
src/simix/smx_deployment.cpp
src/simix/smx_environment.cpp
src/surf/surf_interface.cpp
src/surf/surf_private.hpp
src/surf/xml/platf.hpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp

index d30bc2f..dc400f0 100644 (file)
@@ -49,11 +49,10 @@ public:
    * The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
    * Some examples can be found in the directory examples/platforms.
    */
    * The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
    * Some examples can be found in the directory examples/platforms.
    */
-  void load_platform(const char* platf);
+  void load_platform(std::string platf);
 
   /** Registers the main function of an actor that will be launched from the deployment file */
 
   /** Registers the main function of an actor that will be launched from the deployment file */
-  void register_function(const char* name, int (*code)(int, char**));
-  // FIXME: provide a register_function(std::string, void (*code)(int, char**)) and deprecate the int returning one
+  void register_function(std::string name, int (*code)(int, char**));
   // FIXME: provide a register_function(std::string, std::vector<std::string>)
 
   /** Registers a function as the default main function of actors
   // FIXME: provide a register_function(std::string, std::vector<std::string>)
 
   /** Registers a function as the default main function of actors
@@ -63,7 +62,7 @@ public:
    */
   void register_default(int (*code)(int, char**));
 
    */
   void register_default(int (*code)(int, char**));
 
-  template <class F> void register_actor(const char* name)
+  template <class F> void register_actor(std::string name)
   {
     simgrid::simix::register_function(name, [](std::vector<std::string> args) {
       return simgrid::simix::ActorCode([args] {
   {
     simgrid::simix::register_function(name, [](std::vector<std::string> args) {
       return simgrid::simix::ActorCode([args] {
@@ -73,7 +72,7 @@ public:
     });
   }
 
     });
   }
 
-  template <class F> void register_actor(const char* name, F code)
+  template <class F> void register_actor(std::string name, F code)
   {
     simgrid::simix::register_function(name, [code](std::vector<std::string> args) {
       return simgrid::simix::ActorCode([code, args] { code(std::move(args)); });
   {
     simgrid::simix::register_function(name, [code](std::vector<std::string> args) {
       return simgrid::simix::ActorCode([code, args] { code(std::move(args)); });
@@ -81,7 +80,7 @@ public:
   }
 
   /** @brief Load a deployment file and launch the actors that it contains */
   }
 
   /** @brief Load a deployment file and launch the actors that it contains */
-  void load_deployment(const char* deploy);
+  void load_deployment(std::string deploy);
 
 protected:
   friend s4u::Host;
 
 protected:
   friend s4u::Host;
@@ -127,7 +126,7 @@ public:
   simgrid::s4u::NetZone* get_netzone_root();
   void set_netzone_root(s4u::NetZone* netzone);
 
   simgrid::s4u::NetZone* get_netzone_root();
   void set_netzone_root(s4u::NetZone* netzone);
 
-  simgrid::s4u::NetZone* netzone_by_name_or_null(const char* name);
+  simgrid::s4u::NetZone* netzone_by_name_or_null(std::string name);
 
   /** @brief Retrieves all netzones of the type indicated by the template argument */
   template <class T> std::vector<T*> get_filtered_netzones()
 
   /** @brief Retrieves all netzones of the type indicated by the template argument */
   template <class T> std::vector<T*> get_filtered_netzones()
@@ -157,11 +156,11 @@ private:
 
   //////////////// Deprecated functions
 public:
 
   //////////////// Deprecated functions
 public:
-  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(const char* platf)
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(std::string platf)
   {
     load_platform(platf);
   }
   {
     load_platform(platf);
   }
-  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_function()") void registerFunction(const char* name,
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_function()") void registerFunction(std::string name,
                                                                                              int (*code)(int, char**))
   {
     register_function(name, code);
                                                                                              int (*code)(int, char**))
   {
     register_function(name, code);
@@ -171,17 +170,17 @@ public:
     register_default(code);
   }
   template <class F>
     register_default(code);
   }
   template <class F>
-  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(const char* name)
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(std::string name)
   {
     register_actor<F>(name);
   }
   template <class F>
   {
     register_actor<F>(name);
   }
   template <class F>
-  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(const char* name, F code)
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::register_actor()") void registerFunction(std::string name, F code)
   {
     register_actor<F>(name, code);
   }
 
   {
     register_actor<F>(name, code);
   }
 
-  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_deployment()") void loadDeployment(const char* deploy)
+  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_deployment()") void loadDeployment(std::string deploy)
   {
     load_deployment(deploy);
   }
   {
     load_deployment(deploy);
   }
@@ -232,7 +231,8 @@ public:
   {
     return get_netzone_root();
   }
   {
     return get_netzone_root();
   }
-  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::netzone_by_name_or_null()") simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name)
+  XBT_ATTRIB_DEPRECATED_v323(
+      "Please use Engine::netzone_by_name_or_null()") simgrid::s4u::NetZone* getNetzoneByNameOrNull(std::string name)
   {
     return netzone_by_name_or_null(name);
   }
   {
     return netzone_by_name_or_null(name);
   }
index e4d56e0..1771886 100644 (file)
@@ -54,8 +54,8 @@ public:
   std::vector<NetZone*> get_children();
 
   /** Retrieve the property value (or nullptr if not set) */
   std::vector<NetZone*> get_children();
 
   /** Retrieve the property value (or nullptr if not set) */
-  const char* get_property(const char* key);
-  void set_property(const char* key, const char* value);
+  const char* get_property(std::string key);
+  void set_property(std::string key, std::string value);
 
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
   int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
 
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
   int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */
index 1c20d8e..ac0f026 100644 (file)
@@ -111,14 +111,14 @@ XBT_PUBLIC double SIMIX_timer_get_date(smx_timer_t timer);
 XBT_PUBLIC void SIMIX_display_process_status();
 
 /******************************* Environment **********************************/
 XBT_PUBLIC void SIMIX_display_process_status();
 
 /******************************* Environment **********************************/
-XBT_PUBLIC void SIMIX_create_environment(const char* file);
+XBT_PUBLIC void SIMIX_create_environment(std::string file);
 
 /******************************** Deployment **********************************/
 
 
 /******************************** Deployment **********************************/
 
-XBT_PUBLIC void SIMIX_function_register(const char* name, xbt_main_func_t code);
+XBT_PUBLIC void SIMIX_function_register(std::string name, xbt_main_func_t code);
 XBT_PUBLIC void SIMIX_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC void SIMIX_init_application();
 XBT_PUBLIC void SIMIX_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC void SIMIX_init_application();
-XBT_PUBLIC void SIMIX_launch_application(const char* file);
+XBT_PUBLIC void SIMIX_launch_application(std::string file);
 
 XBT_PUBLIC void SIMIX_process_set_function(const char* process_host, const char* process_function,
                                            xbt_dynar_t arguments, double process_start_time, double process_kill_time);
 
 XBT_PUBLIC void SIMIX_process_set_function(const char* process_host, const char* process_function,
                                            xbt_dynar_t arguments, double process_start_time, double process_kill_time);
index a88cf53..0af3963 100644 (file)
@@ -73,8 +73,7 @@ typedef std::function<void()> ActorCode;
 // Create ActorCode based on argv:
 typedef std::function<ActorCode(std::vector<std::string> args)> ActorCodeFactory;
 
 // Create ActorCode based on argv:
 typedef std::function<ActorCode(std::vector<std::string> args)> ActorCodeFactory;
 
-XBT_PUBLIC void register_function(const char* name, ActorCodeFactory factory);
-
+XBT_PUBLIC void register_function(std::string name, ActorCodeFactory factory);
 }
 }
 
 }
 }
 
index 0d9f99a..6c7e702 100644 (file)
@@ -79,6 +79,6 @@ XBT_PUBLIC double surf_get_clock();
 XBT_PUBLIC void surf_exit();
 
 /* surf parse file related (public because called from a test suite) */
 XBT_PUBLIC void surf_exit();
 
 /* surf parse file related (public because called from a test suite) */
-XBT_PUBLIC void parse_platform_file(const char* file);
+XBT_PUBLIC void parse_platform_file(std::string file);
 
 #endif
 
 #endif
index e437212..58a77c8 100644 (file)
@@ -20,6 +20,8 @@
 #include "src/surf/network_interface.hpp"
 #include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
 
 #include "src/surf/network_interface.hpp"
 #include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
 
+#include <string>
+
 XBT_LOG_NEW_CATEGORY(s4u, "Log channels of the S4U (Simgrid for you) interface");
 
 namespace simgrid {
 XBT_LOG_NEW_CATEGORY(s4u, "Log channels of the S4U (Simgrid for you) interface");
 
 namespace simgrid {
@@ -69,12 +71,12 @@ double Engine::get_clock()
   return SIMIX_get_clock();
 }
 
   return SIMIX_get_clock();
 }
 
-void Engine::load_platform(const char* platf)
+void Engine::load_platform(std::string platf)
 {
   SIMIX_create_environment(platf);
 }
 
 {
   SIMIX_create_environment(platf);
 }
 
-void Engine::register_function(const char* name, int (*code)(int, char**))
+void Engine::register_function(std::string name, int (*code)(int, char**))
 {
   SIMIX_function_register(name, code);
 }
 {
   SIMIX_function_register(name, code);
 }
@@ -82,7 +84,7 @@ void Engine::register_default(int (*code)(int, char**))
 {
   SIMIX_function_register_default(code);
 }
 {
   SIMIX_function_register_default(code);
 }
-void Engine::load_deployment(const char* deploy)
+void Engine::load_deployment(std::string deploy)
 {
   SIMIX_launch_application(deploy);
 }
 {
   SIMIX_launch_application(deploy);
 }
@@ -272,9 +274,9 @@ void Engine::set_netzone_root(s4u::NetZone* netzone)
   pimpl->netzone_root_ = netzone->get_impl();
 }
 
   pimpl->netzone_root_ = netzone->get_impl();
 }
 
-static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char* name)
+static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, std::string name)
 {
 {
-  if (not strcmp(current->get_cname(), name))
+  if (current->get_name() == name)
     return current;
 
   for (auto const& elem : current->get_children()) {
     return current;
 
   for (auto const& elem : current->get_children()) {
@@ -287,7 +289,7 @@ static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char
 }
 
 /** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
 }
 
 /** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
-NetZone* Engine::netzone_by_name_or_null(const char* name)
+NetZone* Engine::netzone_by_name_or_null(std::string name)
 {
   return netzone_by_name_recursive(get_netzone_root(), name);
 }
 {
   return netzone_by_name_recursive(get_netzone_root(), name);
 }
index c9dc1bd..cc6071c 100644 (file)
@@ -33,11 +33,11 @@ std::unordered_map<std::string, std::string>* NetZone::get_properties()
 }
 
 /** Retrieve the property value (or nullptr if not set) */
 }
 
 /** Retrieve the property value (or nullptr if not set) */
-const char* NetZone::get_property(const char* key)
+const char* NetZone::get_property(std::string key)
 {
   return properties_.at(key).c_str();
 }
 {
   return properties_.at(key).c_str();
 }
-void NetZone::set_property(const char* key, const char* value)
+void NetZone::set_property(std::string key, std::string value)
 {
   simgrid::simix::simcall([this, key, value] { properties_[key] = value; });
 }
 {
   simgrid::simix::simcall([this, key, value] { properties_[key] = value; });
 }
index 1033c13..e18a281 100644 (file)
@@ -35,7 +35,7 @@ void SIMIX_init_application()
  *     \include small_deployment.xml
  *
  */
  *     \include small_deployment.xml
  *
  */
-void SIMIX_launch_application(const char *file)
+void SIMIX_launch_application(std::string file)
 {
   XBT_ATTRIB_UNUSED int parse_status;
   xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_launch_application.");
 {
   XBT_ATTRIB_UNUSED int parse_status;
   xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_launch_application.");
@@ -46,11 +46,12 @@ void SIMIX_launch_application(const char *file)
   try {
     parse_status = surf_parse();
     surf_parse_close();
   try {
     parse_status = surf_parse();
     surf_parse_close();
-    xbt_assert(not parse_status, "Parse error at %s:%d", file, surf_parse_lineno);
+    xbt_assert(not parse_status, "Parse error at %s:%d", file.c_str(), surf_parse_lineno);
   }
   catch (xbt_ex& e) {
   }
   catch (xbt_ex& e) {
-    XBT_ERROR("Unrecoverable error at %s:%d. The full exception stack follows, in case it helps you to diagnose the problem.",
-        file, surf_parse_lineno);
+    XBT_ERROR(
+        "Unrecoverable error at %s:%d. The full exception stack follows, in case it helps you to diagnose the problem.",
+        file.c_str(), surf_parse_lineno);
     throw;
   }
 }
     throw;
   }
 }
@@ -69,7 +70,7 @@ static simgrid::simix::ActorCodeFactory toActorCodeFactory(xbt_main_func_t code)
  * \param name the reference name of the function.
  * \param code the function
  */
  * \param name the reference name of the function.
  * \param code the function
  */
-void SIMIX_function_register(const char *name, xbt_main_func_t code)
+void SIMIX_function_register(std::string name, xbt_main_func_t code)
 {
   xbt_assert(simix_global,
     "SIMIX_global_init has to be called before SIMIX_function_register.");
 {
   xbt_assert(simix_global,
     "SIMIX_global_init has to be called before SIMIX_function_register.");
@@ -144,7 +145,7 @@ void SIMIX_process_set_function(const char* process_host, const char* process_fu
 namespace simgrid {
 namespace simix {
 
 namespace simgrid {
 namespace simix {
 
-void register_function(const char* name, ActorCodeFactory factory)
+void register_function(std::string name, ActorCodeFactory factory)
 {
   simix_global->registered_functions[name] = std::move(factory);
 }
 {
   simix_global->registered_functions[name] = std::move(factory);
 }
index ad6fe51..5010842 100644 (file)
@@ -27,7 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix, "Logging specific to S
  *     \include small_platform.xml
  *
  */
  *     \include small_platform.xml
  *
  */
-void SIMIX_create_environment(const char *file)
+void SIMIX_create_environment(std::string file)
 {
   double start = 0;
   double end = 0;
 {
   double start = 0;
   double end = 0;
@@ -37,7 +37,7 @@ void SIMIX_create_environment(const char *file)
     parse_platform_file(file);
   }
   catch (xbt_ex& e) {
     parse_platform_file(file);
   }
   catch (xbt_ex& e) {
-    xbt_die("Error while loading %s: %s", file, e.what());
+    xbt_die("Error while loading %s: %s", file.c_str(), e.what());
   }
   if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
     end = xbt_os_time();
   }
   if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug))
     end = xbt_os_time();
index 61081b2..40a5736 100644 (file)
@@ -127,11 +127,11 @@ double surf_get_clock()
 }
 
 /* returns whether #file_path is a absolute file path. Surprising, isn't it ? */
 }
 
 /* returns whether #file_path is a absolute file path. Surprising, isn't it ? */
-static bool is_absolute_file_path(const char* file_path)
+static bool is_absolute_file_path(std::string file_path)
 {
 #ifdef _WIN32
   WIN32_FIND_DATA wfd = {0};
 {
 #ifdef _WIN32
   WIN32_FIND_DATA wfd = {0};
-  HANDLE hFile        = FindFirstFile(file_path, &wfd);
+  HANDLE hFile        = FindFirstFile(file_path.c_str(), &wfd);
 
   if (INVALID_HANDLE_VALUE == hFile)
     return false;
 
   if (INVALID_HANDLE_VALUE == hFile)
     return false;
@@ -139,7 +139,7 @@ static bool is_absolute_file_path(const char* file_path)
   FindClose(hFile);
   return true;
 #else
   FindClose(hFile);
   return true;
 #else
-  return (file_path[0] == '/');
+  return (file_path.c_str()[0] == '/');
 #endif
 }
 
 #endif
 }
 
@@ -166,14 +166,12 @@ std::ifstream* surf_ifsopen(std::string name)
   return fs;
 }
 
   return fs;
 }
 
-FILE *surf_fopen(const char *name, const char *mode)
+FILE* surf_fopen(std::string name, const char* mode)
 {
   FILE *file = nullptr;
 
 {
   FILE *file = nullptr;
 
-  xbt_assert(name);
-
   if (is_absolute_file_path(name)) /* don't mess with absolute file names */
   if (is_absolute_file_path(name)) /* don't mess with absolute file names */
-    return fopen(name, mode);
+    return fopen(name.c_str(), mode);
 
   /* search relative files in the path */
   for (auto const& path_elm : surf_path) {
 
   /* search relative files in the path */
   for (auto const& path_elm : surf_path) {
index 06530ad..4540c40 100644 (file)
@@ -11,7 +11,7 @@
 
 /* Generic functions common to all models */
 
 
 /* Generic functions common to all models */
 
-XBT_PRIVATE FILE* surf_fopen(const char* name, const char* mode);
+XBT_PRIVATE FILE* surf_fopen(std::string name, const char* mode);
 XBT_PRIVATE std::ifstream* surf_ifsopen(std::string name);
 
 XBT_PRIVATE void check_disk_attachment();
 XBT_PRIVATE std::ifstream* surf_ifsopen(std::string name);
 
 XBT_PRIVATE void check_disk_attachment();
index 1e095b6..5306835 100644 (file)
@@ -12,7 +12,7 @@
 XBT_PUBLIC void sg_platf_init();
 XBT_PUBLIC void sg_platf_exit();
 
 XBT_PUBLIC void sg_platf_init();
 XBT_PUBLIC void sg_platf_exit();
 
-XBT_PUBLIC void surf_parse_open(const char* file);
+XBT_PUBLIC void surf_parse_open(std::string file);
 XBT_PUBLIC void surf_parse_close();
 XBT_PUBLIC void surf_parse_assert(bool cond, std::string msg);
 XBT_ATTRIB_NORETURN XBT_PUBLIC void surf_parse_error(std::string msg);
 XBT_PUBLIC void surf_parse_close();
 XBT_PUBLIC void surf_parse_assert(bool cond, std::string msg);
 XBT_ATTRIB_NORETURN XBT_PUBLIC void surf_parse_error(std::string msg);
index e3cb42b..4794750 100644 (file)
@@ -60,11 +60,12 @@ void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs*
 }
 
 /* This function acts as a main in the parsing area. */
 }
 
 /* This function acts as a main in the parsing area. */
-void parse_platform_file(const char *file)
+void parse_platform_file(std::string file)
 {
 #if SIMGRID_HAVE_LUA
 {
 #if SIMGRID_HAVE_LUA
-  int len    = (file == nullptr ? 0 : strlen(file));
-  int is_lua = (file != nullptr && len > 3 && file[len - 3] == 'l' && file[len - 2] == 'u' && file[len - 1] == 'a');
+  const char* cfile = file.c_str();
+  int len           = strlen(cfile);
+  int is_lua        = len > 3 && file[len - 3] == 'l' && file[len - 2] == 'u' && file[len - 1] == 'a';
 #endif
 
   sg_platf_init();
 #endif
 
   sg_platf_init();
@@ -78,7 +79,7 @@ void parse_platform_file(const char *file)
     lua_State* L = luaL_newstate();
     luaL_openlibs(L);
 
     lua_State* L = luaL_newstate();
     luaL_openlibs(L);
 
-    luaL_loadfile(L, file); // This loads the file without executing it.
+    luaL_loadfile(L, cfile); // This loads the file without executing it.
 
     /* Run the script */
     if (lua_pcall(L, 0, 0, 0)) {
 
     /* Run the script */
     if (lua_pcall(L, 0, 0, 0)) {
index ebc12b7..715d57d 100644 (file)
@@ -24,7 +24,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF
 
 #include "simgrid_dtd.c"
 
 
 #include "simgrid_dtd.c"
 
-static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
+static std::string surf_parsed_filename; // Currently parsed file (for the error messages)
 std::vector<simgrid::kernel::resource::LinkImpl*>
     parsed_link_list; /* temporary store of current list link of a route */
 
 std::vector<simgrid::kernel::resource::LinkImpl*>
     parsed_link_list; /* temporary store of current list link of a route */
 
@@ -36,7 +36,7 @@ void surf_parse_assert(bool cond, std::string msg)
   if (not cond) {
     int lineno = surf_parse_lineno;
     cleanup();
   if (not cond) {
     int lineno = surf_parse_lineno;
     cleanup();
-    XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename, lineno, msg.c_str());
+    XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename.c_str(), lineno, msg.c_str());
     surf_exit();
     xbt_die("Exiting now");
   }
     surf_exit();
     xbt_die("Exiting now");
   }
@@ -46,7 +46,7 @@ void surf_parse_error(std::string msg)
 {
   int lineno = surf_parse_lineno;
   cleanup();
 {
   int lineno = surf_parse_lineno;
   cleanup();
-  XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename, lineno, msg.c_str());
+  XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename.c_str(), lineno, msg.c_str());
   surf_exit();
   xbt_die("Exiting now");
 }
   surf_exit();
   xbt_die("Exiting now");
 }
@@ -377,19 +377,20 @@ void STag_surfxml_platform() {
              "Use simgrid_update_xml to update your file automatically. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
              "Use simgrid_update_xml to update your file automatically. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
-             surf_parsed_filename, version);
+             surf_parsed_filename.c_str(), version);
   if (version < 4.1) {
     XBT_INFO("You're using a v%.1f XML file (%s) while the current standard is v4.1 "
              "That's fine, the new version is backward compatible. \n\n"
              "Use simgrid_update_xml to update your file automatically to get rid of this warning. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
   if (version < 4.1) {
     XBT_INFO("You're using a v%.1f XML file (%s) while the current standard is v4.1 "
              "That's fine, the new version is backward compatible. \n\n"
              "Use simgrid_update_xml to update your file automatically to get rid of this warning. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
-             version, surf_parsed_filename);
+             version, surf_parsed_filename.c_str());
   }
   }
-  xbt_assert(version <= 4.1, "******* FILE %s COMES FROM THE FUTURE (v:%.1f) *********\n "
-                             "The most recent formalism that this version of SimGrid understands is v4.1.\n"
-                             "Please update your code, or use another, more adapted, file.",
-             surf_parsed_filename, version);
+  xbt_assert(version <= 4.1,
+             "******* FILE %s COMES FROM THE FUTURE (v:%.1f) *********\n "
+             "The most recent formalism that this version of SimGrid understands is v4.1.\n"
+             "Please update your code, or use another, more adapted, file.",
+             surf_parsed_filename.c_str(), version);
 }
 void ETag_surfxml_platform(){
   simgrid::s4u::on_platform_created();
 }
 void ETag_surfxml_platform(){
   simgrid::s4u::on_platform_created();
@@ -406,7 +407,7 @@ void STag_surfxml_prop()
     XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
     simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::get_instance()->netzone_by_name_or_null(A_surfxml_zone_id);
 
     XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
     simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::get_instance()->netzone_by_name_or_null(A_surfxml_zone_id);
 
-    netzone->set_property(A_surfxml_prop_id, A_surfxml_prop_value);
+    netzone->set_property(std::string(A_surfxml_prop_id), A_surfxml_prop_value);
   } else {
     if (not current_property_set)
       current_property_set = new std::unordered_map<std::string, std::string>; // Maybe, it should raise an error
   } else {
     if (not current_property_set)
       current_property_set = new std::unordered_map<std::string, std::string>; // Maybe, it should raise an error
@@ -962,17 +963,15 @@ void ETag_surfxml_model___prop(){/* Nothing to do */}
 /* Open and Close parse file */
 YY_BUFFER_STATE surf_input_buffer;
 
 /* Open and Close parse file */
 YY_BUFFER_STATE surf_input_buffer;
 
-void surf_parse_open(const char *file)
+void surf_parse_open(std::string file)
 {
 {
-  xbt_assert(file, "Cannot parse the nullptr file. Bypassing the parser is strongly deprecated nowadays.");
-
   surf_parsed_filename = file;
   std::string dir      = simgrid::xbt::Path(file).get_dir_name();
   surf_path.push_back(dir);
 
   surf_file_to_parse = surf_fopen(file, "r");
   if (surf_file_to_parse == nullptr)
   surf_parsed_filename = file;
   std::string dir      = simgrid::xbt::Path(file).get_dir_name();
   surf_path.push_back(dir);
 
   surf_file_to_parse = surf_fopen(file, "r");
   if (surf_file_to_parse == nullptr)
-    xbt_die("Unable to open '%s'\n", file);
+    xbt_die("Unable to open '%s'\n", file.c_str());
   surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
   surf_parse__switch_to_buffer(surf_input_buffer);
   surf_parse_lineno = 1;
   surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
   surf_parse__switch_to_buffer(surf_input_buffer);
   surf_parse_lineno = 1;