+/** @brief Displays the declared aliases and their description */
+void xbt_cfg_aliases(xbt_cfg_t cfg)
+{
+ xbt_dict_cursor_t dict_cursor;
+ unsigned int dynar_cursor;
+ xbt_cfgelm_t variable;
+ char *name;
+ xbt_dynar_t names = xbt_dynar_new(sizeof(char *), NULL);
+
+ xbt_dict_foreach((xbt_dict_t )cfg, dict_cursor, name, variable)
+ xbt_dynar_push(names, &name);
+ xbt_dynar_sort_strings(names);
+
+ xbt_dynar_foreach(names, dynar_cursor, name) {
+ variable = xbt_dict_get((xbt_dict_t )cfg, name);
+
+ if (variable->type == xbt_cfgelm_alias)
+ printf(" %s: %s\n", name, variable->desc);
+ }
+}
+/** @brief Displays the declared options and their description */
+void xbt_cfg_help(xbt_cfg_t cfg)
+{
+ xbt_dict_cursor_t dict_cursor;
+ unsigned int dynar_cursor;
+ xbt_cfgelm_t variable;
+ char *name;
+ xbt_dynar_t names = xbt_dynar_new(sizeof(char *), NULL);
+
+ xbt_dict_foreach((xbt_dict_t )cfg, dict_cursor, name, variable)
+ xbt_dynar_push(names, &name);
+ xbt_dynar_sort_strings(names);
+
+ xbt_dynar_foreach(names, dynar_cursor, name) {
+ int i;
+ int size;
+ variable = xbt_dict_get((xbt_dict_t )cfg, name);
+ if (variable->type == xbt_cfgelm_alias)
+ continue;
+
+ printf(" %s: %s\n", name, variable->desc);
+ printf(" Type: %s; ", xbt_cfgelm_type_name[variable->type]);
+ if (variable->min != 1 || variable->max != 1) {
+ printf("Arity: min:%d to max:", variable->min);
+ if (variable->max == 0)
+ printf("(no bound); ");
+ else
+ printf("%d; ", variable->max);
+ }
+ size = xbt_dynar_length(variable->content);
+ printf("Current value%s: ", (size <= 1 ? "" : "s"));
+
+ if (size != 1)
+ printf(size == 0 ? "n/a\n" : "{ ");
+ for (i = 0; i < size; i++) {
+ const char *sep = (size == 1 ? "\n" : (i < size - 1 ? ", " : " }\n"));
+
+ switch (variable->type) {
+ case xbt_cfgelm_int:
+ printf("%d%s", xbt_dynar_get_as(variable->content, i, int), sep);
+ break;
+
+ case xbt_cfgelm_double:
+ printf("%f%s", xbt_dynar_get_as(variable->content, i, double), sep);
+ break;
+
+ case xbt_cfgelm_string:
+ printf("'%s'%s", xbt_dynar_get_as(variable->content, i, char *), sep);
+ break;
+
+ case xbt_cfgelm_boolean: {
+ int b = xbt_dynar_get_as(variable->content, i, int);
+ const char *bs = b ? xbt_cfgelm_boolean_values[0].true_val
+ : xbt_cfgelm_boolean_values[0].false_val;
+ if (b == 0 || b == 1)
+ printf("'%s'%s", bs, sep);
+ else
+ printf("'%s/%d'%s", bs, b, sep);
+ break;
+ }
+
+ default:
+ printf("Invalid type!!%s", sep);
+ }
+ }
+ }