- name = xbt_strdup(surf_parse_text);
-
- token = surf_parse(); /* power_scale */
- xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
- xbt_assert2((sscanf(surf_parse_text, XBT_MAXMIN_FLOAT_T, &power_scale) ==
- 1), "Parse error line %d : %s not a number", line_pos,
- surf_parse_text);
-
- token = surf_parse(); /* initial_power */
- xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
- xbt_assert2((sscanf(surf_parse_text, XBT_MAXMIN_FLOAT_T, &initial_power)
- == 1), "Parse error line %d : %s not a number", line_pos,
- surf_parse_text);
-
- token = surf_parse(); /* power_trace */
- xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
- if (strcmp(surf_parse_text, "") == 0)
- power_trace = NULL;
- else
- power_trace = tmgr_trace_new(surf_parse_text);
-
- token = surf_parse(); /* initial_state */
- xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
- if (strcmp(surf_parse_text, "ON") == 0)
- initial_state = SURF_CPU_ON;
- else if (strcmp(surf_parse_text, "OFF") == 0)
- initial_state = SURF_CPU_OFF;
- else {
- CRITICAL2("Invalid cpu state (line %d): %s neq ON or OFF\n", line_pos,
- surf_parse_text);
- xbt_abort();
- }
-
- token = surf_parse(); /* state_trace */
- xbt_assert1((token == TOKEN_WORD), "Parse error line %d", line_pos);
- if (strcmp(surf_parse_text, "") == 0)
- state_trace = NULL;
- else
- state_trace = tmgr_trace_new(surf_parse_text);
-
- cpu_new(name, power_scale, initial_power, power_trace, initial_state,
+ name = xbt_strdup(A_surfxml_cpu_name);
+ surf_parse_get_double(&power_scale, A_surfxml_cpu_power);
+ surf_parse_get_double(&power_initial, A_surfxml_cpu_availability);
+ surf_parse_get_trace(&power_trace, A_surfxml_cpu_availability_file);
+
+ xbt_assert0((A_surfxml_cpu_state == A_surfxml_cpu_state_ON) ||
+ (A_surfxml_cpu_state == A_surfxml_cpu_state_OFF),
+ "Invalid state");
+ if (A_surfxml_cpu_state == A_surfxml_cpu_state_ON)
+ state_initial = SURF_CPU_ON;
+ if (A_surfxml_cpu_state == A_surfxml_cpu_state_OFF)
+ state_initial = SURF_CPU_OFF;
+ surf_parse_get_trace(&state_trace, A_surfxml_cpu_state_file);
+
+ cpu_new(name, power_scale, power_initial, power_trace, state_initial,