X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/15badc71ce964f6dae6428c9a4c0198fad5d4936..6f065c16d0eca6e4d75c009fc578e59c30b3f392:/src/simgrid/sg_config.c diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 6abbd4de3c..b5f11e3b9d 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010. The SimGrid Team. +/* Copyright (c) 2009-2010, 2012-2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -11,7 +11,7 @@ #include "xbt/log.h" #include "xbt/mallocator.h" #include "xbt/str.h" -#include "xbt/lib.h" +#include "xbt/lib.h" #include "xbt/sysdep.h" #include "surf/surf.h" #include "surf/maxmin.h" @@ -21,17 +21,25 @@ #include "smpi/smpi_interface.h" #include "mc/mc.h" #include "instr/instr.h" -#include "surf/vm_workstation_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of simgrid"); xbt_cfg_t _sg_cfg_set = NULL; -int _sg_init_status = 0; /* 0: beginning of time (config cannot be changed yet); - 1: initialized: cfg_set created (config can now be changed); - 2: configured: command line parsed and config part of platform file was integrated also, platform construction ongoing or done. - (Config cannot be changed anymore!) */ +/* 0: beginning of time (config cannot be changed yet); + * 1: initialized: cfg_set created (config can now be changed); + * 2: configured: command line parsed and config part of platform file was + * integrated also, platform construction ongoing or done. + * (Config cannot be changed anymore!) + */ +int _sg_cfg_init_status = 0; + +/* instruct the upper layer (simix or simdag) to exit as soon as possible + */ +int _sg_cfg_exit_asap = 0; + +#define sg_cfg_exit_early() do { _sg_cfg_exit_asap = 1; return; } while (0) /* Parse the command line, looking for options */ static void sg_config_cmd_line(int *argc, char **argv) @@ -47,6 +55,9 @@ static void sg_config_cmd_line(int *argc, char **argv) xbt_cfg_set_parse(_sg_cfg_set, opt); XBT_DEBUG("Did apply '%s' as config setting", opt); + } else if (!strcmp(argv[i], "--version")) { + printf("%s\n", SIMGRID_VERSION_STRING); + shall_exit = 1; } else if (!strcmp(argv[i], "--cfg-help") || !strcmp(argv[i], "--help")) { printf ("Description of the configuration accepted by this simulator:\n"); @@ -56,6 +67,7 @@ static void sg_config_cmd_line(int *argc, char **argv) "Each of these configurations can be used by adding\n" " --cfg=