X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e816186fdeaf53fa5abf6886f157c499e09c4622..872cf95ab5a2b08aa1f2c6ebba29b9f86b0ba54e:/src/simgrid/sg_config.cpp?ds=sidebyside diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index aad9dd65fa..10d160af21 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -1,20 +1,26 @@ -/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2009-2022. 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. */ /* sg_config: configuration infrastructure for the simulation world */ +#include +#include +#include + #include "simgrid/sg_config.hpp" -#include "simgrid/instr.h" +#include "src/include/xbt/mmalloc.h" #include "src/instr/instr_private.hpp" #include "src/internal_config.h" +#include "src/kernel/context/Context.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "src/mc/mc_config.hpp" #include "src/mc/mc_replay.hpp" +#include "src/smpi/include/smpi_config.hpp" #include "src/surf/surf_interface.hpp" -#include "surf/surf.hpp" -#include "xbt/config.hpp" + +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of SimGrid"); @@ -41,24 +47,14 @@ void sg_config_continue_after_help() */ int _sg_cfg_init_status = 0; -/* instruct the upper layer (simix or simdag) to exit as soon as possible */ -bool _sg_cfg_exit_asap = false; - -#define sg_cfg_exit_early() \ - do { \ - _sg_cfg_exit_asap = true; \ - return; \ - } while (0) - /* Parse the command line, looking for options */ static void sg_config_cmd_line(int *argc, char **argv) { bool shall_exit = false; - int i; - int j; bool parse_args = true; // Stop parsing the parameters once we found '--' - for (j = i = 1; i < *argc; i++) { + int j = 1; + for (int i = j; i < *argc; i++) { if (not strcmp("--", argv[i])) { parse_args = false; // Remove that '--' from the arguments @@ -69,44 +65,42 @@ static void sg_config_cmd_line(int *argc, char **argv) simgrid::config::set_parse(opt); XBT_DEBUG("Did apply '%s' as config setting", opt); } else if (parse_args && not strcmp(argv[i], "--version")) { - printf("%s\n", SIMGRID_VERSION_STRING); + sg_version(); shall_exit = true; } else if (parse_args && (not strcmp(argv[i], "--cfg-help") || not strcmp(argv[i], "--help"))) { - printf("Description of the configuration accepted by this simulator:\n"); + XBT_HELP("Description of the configuration accepted by this simulator:"); simgrid::config::help(); - printf( - "\n" - "Each of these configurations can be used by adding\n" - " --cfg=