- xbt_dict_cursor_t dict_cursor;
- unsigned int dynar_cursor;
- simgrid::config::ConfigurationElement* variable;
- char *name;
- xbt_dynar_t names = xbt_dynar_new(sizeof(char *), NULL);
-
- xbt_dict_foreach(simgrid_config->options, dict_cursor, name, variable)
- xbt_dynar_push(names, &name);
- xbt_dynar_sort_strings(names);
-
- xbt_dynar_foreach(names, dynar_cursor, name) {
- int size;
- variable = (simgrid::config::ConfigurationElement*) xbt_dict_get(simgrid_config->options, name);
- if (variable->type == xbt_cfgelm_alias)
- continue;
-
- printf(" %s: %s\n", name, variable->desc.c_str());
- printf(" Type: %s; ", xbt_cfgelm_type_name[variable->type]);
- size = xbt_dynar_length(variable->content);
- printf("Current value: ");
-
- if (size != 1)
- printf(size == 0 ? "n/a\n" : "{ ");
- for (int 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);
- break;
- }
- }