Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set level COORD_HOST_LEVEL and COORD_ASR_LEVEL if there are used.
[simgrid.git] / src / xbt / config.c
index 47d9cd2..fc93278 100644 (file)
@@ -18,6 +18,7 @@
 #include "xbt/peer.h"
 
 #include "xbt/config.h"         /* prototypes of this module */
 #include "xbt/peer.h"
 
 #include "xbt/config.h"         /* prototypes of this module */
+#include "surf/surf.h"                 /* COORD_HOST_LEVEL and COORD_ASR_LEVEL */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
 
@@ -321,9 +322,10 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry)
   xbt_assert1(tok, "Invalid maximum in config element descriptor %s",
               entry);
 
   xbt_assert1(tok, "Invalid maximum in config element descriptor %s",
               entry);
 
-  xbt_assert2(*(tok++) == '_',
+  xbt_assert2(*tok == '_',
               "Invalid config element descriptor: %s%s", entry,
               "; Should be <name>:<min nb>_to_<max nb>_<type>");
               "Invalid config element descriptor: %s%s", entry,
               "; Should be <name>:<min nb>_to_<max nb>_<type>");
+  tok++;
 
   for (type = 0;
        type < xbt_cfgelm_type_count
 
   for (type = 0;
        type < xbt_cfgelm_type_count
@@ -649,6 +651,18 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
     }
     *(val++) = '\0';
 
     }
     *(val++) = '\0';
 
+    if (!strcmp(name,"coordinates")){
+       if(!strcmp(val,"yes") && !COORD_HOST_LEVEL){
+               XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
+                       COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
+                       COORD_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
+                       free(optionlist_cpy);
+                       return;
+       }
+       if(strcmp(val,"yes"))
+               xbt_die("Setting CMD prop coordinates must be \"yes\"");
+    }
+
     if (strcmp(name,"contexts/factory"))
       XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
 
     if (strcmp(name,"contexts/factory"))
       XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);