Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Need to include surf/surf_routing.h now.
[simgrid.git] / src / xbt / config.c
index 4ec5c93..71f9025 100644 (file)
 #include "xbt/peer.h"
 
 #include "xbt/config.h"         /* prototypes of this module */
-#include "surf/surf.h"                 /* COORD_HOST_LEVEL and COORD_ASR_LEVEL */
+#include "surf/surf_routing.h" /* COORD_HOST_LEVEL and COORD_ASR_LEVEL */
+
+xbt_lib_t host_lib;
+int    COORD_HOST_LEVEL;       //Coordinates level
+xbt_lib_t as_router_lib;
+int COORD_ASR_LEVEL;   //Coordinates level
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
 
@@ -84,7 +89,7 @@ void xbt_cfg_cpy(xbt_cfg_t tocopy, xbt_cfg_t * whereto)
 
   XBT_DEBUG("Copy cfg set %p", tocopy);
   *whereto = NULL;
-  xbt_assert0(tocopy, "cannot copy NULL config");
+  xbt_assert(tocopy, "cannot copy NULL config");
 
   xbt_dict_foreach((xbt_dict_t) tocopy, cursor, name, variable) {
     xbt_cfg_register(whereto, name, variable->desc, variable->type, NULL,
@@ -212,7 +217,7 @@ xbt_cfg_register(xbt_cfg_t * cfg,
 
   if (*cfg == NULL)
     *cfg = xbt_cfg_new();
-  xbt_assert4(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer,
+  xbt_assert(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer,
               "type of %s not valid (%d should be between %d and %d)",
               name, type, xbt_cfgelm_int, xbt_cfgelm_peer);
   res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name);
@@ -292,7 +297,7 @@ void xbt_cfg_unregister(xbt_cfg_t cfg, const char *name)
  * Each of them must use the following syntax: \<name\>:\<min nb\>_to_\<max nb\>_\<type\>
  * with type being one of  'string','int', 'peer' or 'double'.
  *
- * @fixme: this does not allow to set the description
+ * FIXME: this does not allow to set the description
  */
 
 void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry)
@@ -305,24 +310,24 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry)
   XBT_DEBUG("Register string '%s'", entry);
 
   tok = strchr(entrycpy, ':');
-  xbt_assert2(tok, "Invalid config element descriptor: %s%s",
+  xbt_assert(tok, "Invalid config element descriptor: %s%s",
               entry, "; Should be <name>:<min nb>_to_<max nb>_<type>");
   *(tok++) = '\0';
 
   min = strtol(tok, &tok, 10);
-  xbt_assert1(tok, "Invalid minimum in config element descriptor %s",
+  xbt_assert(tok, "Invalid minimum in config element descriptor %s",
               entry);
 
-  xbt_assert2(strcmp(tok, "_to_"),
+  xbt_assert(strcmp(tok, "_to_"),
               "Invalid config element descriptor : %s%s",
               entry, "; Should be <name>:<min nb>_to_<max nb>_<type>");
   tok += strlen("_to_");
 
   max = strtol(tok, &tok, 10);
-  xbt_assert1(tok, "Invalid maximum in config element descriptor %s",
+  xbt_assert(tok, "Invalid maximum in config element descriptor %s",
               entry);
 
-  xbt_assert2(*tok == '_',
+  xbt_assert(*tok == '_',
               "Invalid config element descriptor: %s%s", entry,
               "; Should be <name>:<min nb>_to_<max nb>_<type>");
   tok++;
@@ -330,7 +335,7 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry)
   for (type = 0;
        type < xbt_cfgelm_type_count
        && strcmp(tok, xbt_cfgelm_type_name[type]); type++);
-  xbt_assert2(type < xbt_cfgelm_type_count,
+  xbt_assert(type < xbt_cfgelm_type_count,
               "Invalid type in config element descriptor: %s%s", entry,
               "; Should be one of 'string', 'int', 'peer' or 'double'.");
 
@@ -426,7 +431,7 @@ void xbt_cfg_check(xbt_cfg_t cfg)
   char *name;
   int size;
 
-  xbt_assert0(cfg, "NULL config set.");
+  xbt_assert(cfg, "NULL config set.");
   XBT_DEBUG("Check cfg set %p", cfg);
 
   xbt_dict_foreach((xbt_dict_t) cfg, cursor, name, variable) {
@@ -464,7 +469,7 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg,
            "No registered variable '%s' in this config set", name);
   }
 
-  xbt_assert3(type == xbt_cfgelm_any || res->type == type,
+  xbt_assert(type == xbt_cfgelm_any || res->type == type,
               "You tried to access to the config element %s as an %s, but its type is %s.",
               name,
               xbt_cfgelm_type_name[type], xbt_cfgelm_type_name[res->type]);
@@ -663,7 +668,7 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
                xbt_die("Setting CMD prop coordinates must be \"yes\"");
     }
 
-    if (strcmp(name,"contexts/factory"))
+    if (strncmp(name, "contexts/", strlen("contexts/")))
       XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
 
     TRY {