X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/af959d56a01cc9112000d8cb9937d5a274db43f3..f780443504c3b73f0b9d1c58c6c5a21e2affce2d:/src/xbt/config.c diff --git a/src/xbt/config.c b/src/xbt/config.c index 67f2e4cfee..56213d5a16 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -21,39 +21,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support"); -/* xbt_cfgelm_t: the typedef corresponding to a config variable. - - Both data and DTD are mixed, but fixing it now would prevent me to ever - defend my thesis. */ - -typedef struct { - /* Description */ - char *desc; - - /* Allowed type of the variable */ - e_xbt_cfgelm_type_t type; - int min, max; - int isdefault:1; - - /* Callbacks */ - xbt_cfg_cb_t cb_set; - xbt_cfg_cb_t cb_rm; - - /* actual content - (cannot be an union because type peer uses both str and i) */ - xbt_dynar_t content; -} s_xbt_cfgelm_t, *xbt_cfgelm_t; - static const char *xbt_cfgelm_type_name[xbt_cfgelm_type_count] = { "int", "double", "string", "peer", "any" }; /* Internal stuff used in cache to free a variable */ static void xbt_cfgelm_free(void *data); -/* Retrieve the variable we'll modify */ -static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, const char *name, - e_xbt_cfgelm_type_t type); - /*----[ Memory management ]-----------------------------------------------*/ /** @brief Constructor @@ -434,7 +407,7 @@ void xbt_cfg_check(xbt_cfg_t cfg) xbt_dict_cursor_free(&cursor); } -static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, +xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, const char *name, e_xbt_cfgelm_type_t type) { @@ -636,7 +609,8 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) } *(val++) = '\0'; - DEBUG2("Configuration change: Set '%s' to '%s'", name, val); + if(strcmp(name,"simix/context")) + INFO2("Configuration change: Set '%s' to '%s'", name, val); TRY { variable = xbt_dict_get((xbt_dict_t) cfg, name); @@ -728,9 +702,11 @@ void xbt_cfg_setdefault_int(xbt_cfg_t cfg, const char *name, int val) { xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int); - if (variable->isdefault) + if (variable->isdefault){ xbt_cfg_set_int(cfg, name, val); - else + variable->isdefault = 1; + } + else DEBUG2 ("Do not override configuration variable '%s' with value '%d' because it was already set.", name, val); @@ -745,8 +721,10 @@ void xbt_cfg_setdefault_double(xbt_cfg_t cfg, const char *name, double val) { xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double); - if (variable->isdefault) + if (variable->isdefault) { xbt_cfg_set_double(cfg, name, val); + variable->isdefault = 1; + } else DEBUG2 ("Do not override configuration variable '%s' with value '%lf' because it was already set.", @@ -763,8 +741,10 @@ void xbt_cfg_setdefault_string(xbt_cfg_t cfg, const char *name, { xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string); - if (variable->isdefault) + if (variable->isdefault){ xbt_cfg_set_string(cfg, name, val); + variable->isdefault = 1; + } else DEBUG2 ("Do not override configuration variable '%s' with value '%s' because it was already set.", @@ -781,8 +761,10 @@ void xbt_cfg_setdefault_peer(xbt_cfg_t cfg, const char *name, { xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer); - if (variable->isdefault) + if (variable->isdefault){ xbt_cfg_set_peer(cfg, name, host, port); + variable->isdefault = 1; + } else DEBUG3 ("Do not override configuration variable '%s' with value '%s:%d' because it was already set.",