1 /* Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
11 #include "surf/surfxml_parse.h"
12 #include "surf/surf_private.h"
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf,
15 "Logging specific to the SURF parsing module");
17 int ETag_surfxml_include_state(void);
19 #include "simgrid_dtd.c"
24 void surf_parse_error(const char *msg) {
25 xbt_die("Parse error on line %d: %s\n", surf_parse_lineno, msg);
28 double surf_parse_get_double(const char *string) {
30 int ret = sscanf(string, "%lg", &res);
32 surf_parse_error(bprintf("%s is not a double", string));
36 int surf_parse_get_int(const char *string) {
38 int ret = sscanf(string, "%d", &res);
40 surf_parse_error(bprintf("%s is not an integer", string));
46 * All the callback lists that can be overiden anywhere.
47 * (this list should probably be reduced to the bare minimum to allow the models to work)
50 /* make sure these symbols are defined as strong ones in this file so that the linker can resolve them */
51 xbt_dynar_t STag_surfxml_route_cb_list = NULL;
52 xbt_dynar_t ETag_surfxml_route_cb_list = NULL;
53 xbt_dynar_t STag_surfxml_link_ctn_cb_list = NULL;
54 xbt_dynar_t ETag_surfxml_link_ctn_cb_list = NULL;
55 xbt_dynar_t STag_surfxml_process_cb_list = NULL;
56 xbt_dynar_t ETag_surfxml_process_cb_list = NULL;
57 xbt_dynar_t STag_surfxml_argument_cb_list = NULL;
58 xbt_dynar_t ETag_surfxml_argument_cb_list = NULL;
59 xbt_dynar_t STag_surfxml_prop_cb_list = NULL;
60 xbt_dynar_t ETag_surfxml_prop_cb_list = NULL;
61 xbt_dynar_t STag_surfxml_peer_cb_list = NULL;
62 xbt_dynar_t ETag_surfxml_peer_cb_list = NULL;
63 xbt_dynar_t STag_surfxml_trace_cb_list = NULL;
64 xbt_dynar_t ETag_surfxml_trace_cb_list = NULL;
65 xbt_dynar_t STag_surfxml_trace_connect_cb_list = NULL;
66 xbt_dynar_t ETag_surfxml_trace_connect_cb_list = NULL;
67 xbt_dynar_t STag_surfxml_random_cb_list = NULL;
68 xbt_dynar_t ETag_surfxml_random_cb_list = NULL;
69 xbt_dynar_t STag_surfxml_ASroute_cb_list = NULL;
70 xbt_dynar_t ETag_surfxml_ASroute_cb_list = NULL;
71 xbt_dynar_t STag_surfxml_bypassRoute_cb_list = NULL;
72 xbt_dynar_t ETag_surfxml_bypassRoute_cb_list = NULL;
73 xbt_dynar_t STag_surfxml_include_cb_list = NULL;
74 xbt_dynar_t ETag_surfxml_include_cb_list = NULL;
76 /* The default current property receiver. Setup in the corresponding opening callbacks. */
77 xbt_dict_t current_property_set = NULL;
78 /* dictionary of random generator data */
79 xbt_dict_t random_data_list = NULL;
81 /* Call all the callbacks of a specific SAX event */
82 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t);
84 YY_BUFFER_STATE surf_input_buffer;
85 FILE *surf_file_to_parse = NULL;
87 static void init_randomness(void);
88 static void add_randomness(void);
91 * Stuff relative to the <include> tag
94 static xbt_dynar_t surf_input_buffer_stack = NULL;
95 static xbt_dynar_t surf_file_to_parse_stack = NULL;
97 void STag_surfxml_include(void)
99 XBT_INFO("STag_surfxml_include '%s'",A_surfxml_include_file);
100 xbt_dynar_push(surf_file_to_parse_stack, &surf_file_to_parse); //save old filename
102 surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r"); // read new filename
103 xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n",
104 A_surfxml_include_file);
105 xbt_dynar_push(surf_input_buffer_stack,&surf_input_buffer);
106 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
107 surf_parse_push_buffer_state(surf_input_buffer);
111 void ETag_surfxml_include(void) {
112 /* Nothing to do when done with reading the include tag.
113 * Instead, the handling should be deferred until the EOF of current buffer -- see below */
116 /** @brief When reaching EOF, check whether we are in an include tag, and behave accordingly if yes
118 * This function is called automatically by sedding the parser in buildtools/Cmake/MaintainerMode.cmake
119 * Every FAIL on "Premature EOF" is preceded by a call to this function, which role is to restore the
120 * previous buffer if we reached the EOF /of an include file/. Its return code is used to avoid the
121 * error message in that case.
123 * Yeah, that's terribly hackish, but it works. A better solution should be dealed with in flexml
124 * directly: a command line flag could instruct it to do the correct thing when #include is encountered
127 int ETag_surfxml_include_state(void)
130 XBT_INFO("ETag_surfxml_include_state '%s'",A_surfxml_include_file);
131 if(!xbt_dynar_is_empty(surf_input_buffer_stack))
133 fclose(surf_file_to_parse);
134 xbt_dynar_pop(surf_file_to_parse_stack, &surf_file_to_parse);
135 surf_parse_pop_buffer_state();
136 xbt_dynar_pop(surf_input_buffer_stack,surf_input_buffer);
141 void surf_parse_init_callbacks(void)
143 sg_platf_init(); // FIXME: move to a proper place?
145 STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
146 ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
147 STag_surfxml_link_ctn_cb_list =
148 xbt_dynar_new(sizeof(void_f_void_t), NULL);
149 ETag_surfxml_link_ctn_cb_list =
150 xbt_dynar_new(sizeof(void_f_void_t), NULL);
151 STag_surfxml_process_cb_list =
152 xbt_dynar_new(sizeof(void_f_void_t), NULL);
153 ETag_surfxml_process_cb_list =
154 xbt_dynar_new(sizeof(void_f_void_t), NULL);
155 STag_surfxml_argument_cb_list =
156 xbt_dynar_new(sizeof(void_f_void_t), NULL);
157 ETag_surfxml_argument_cb_list =
158 xbt_dynar_new(sizeof(void_f_void_t), NULL);
159 STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
160 ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
161 STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
162 ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
163 STag_surfxml_trace_connect_cb_list =
164 xbt_dynar_new(sizeof(void_f_void_t), NULL);
165 ETag_surfxml_trace_connect_cb_list =
166 xbt_dynar_new(sizeof(void_f_void_t), NULL);
167 STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
168 ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
169 STag_surfxml_ASroute_cb_list =
170 xbt_dynar_new(sizeof(void_f_void_t), NULL);
171 ETag_surfxml_ASroute_cb_list =
172 xbt_dynar_new(sizeof(void_f_void_t), NULL);
173 STag_surfxml_bypassRoute_cb_list =
174 xbt_dynar_new(sizeof(void_f_void_t), NULL);
175 ETag_surfxml_bypassRoute_cb_list =
176 xbt_dynar_new(sizeof(void_f_void_t), NULL);
177 STag_surfxml_peer_cb_list =
178 xbt_dynar_new(sizeof(void_f_void_t), NULL);
179 ETag_surfxml_peer_cb_list =
180 xbt_dynar_new(sizeof(void_f_void_t), NULL);
181 STag_surfxml_include_cb_list =
182 xbt_dynar_new(sizeof(void_f_void_t), NULL);
183 ETag_surfxml_include_cb_list =
184 xbt_dynar_new(sizeof(void_f_void_t), NULL);
187 void surf_parse_reset_callbacks(void)
189 surf_parse_free_callbacks();
190 surf_parse_init_callbacks();
193 void surf_parse_free_callbacks(void)
195 sg_platf_exit(); // FIXME: better place?
197 xbt_dynar_free(&STag_surfxml_route_cb_list);
198 xbt_dynar_free(&ETag_surfxml_route_cb_list);
199 xbt_dynar_free(&STag_surfxml_link_ctn_cb_list);
200 xbt_dynar_free(&ETag_surfxml_link_ctn_cb_list);
201 xbt_dynar_free(&STag_surfxml_process_cb_list);
202 xbt_dynar_free(&ETag_surfxml_process_cb_list);
203 xbt_dynar_free(&STag_surfxml_argument_cb_list);
204 xbt_dynar_free(&ETag_surfxml_argument_cb_list);
205 xbt_dynar_free(&STag_surfxml_prop_cb_list);
206 xbt_dynar_free(&ETag_surfxml_prop_cb_list);
207 xbt_dynar_free(&STag_surfxml_trace_cb_list);
208 xbt_dynar_free(&ETag_surfxml_trace_cb_list);
209 xbt_dynar_free(&STag_surfxml_trace_connect_cb_list);
210 xbt_dynar_free(&ETag_surfxml_trace_connect_cb_list);
211 xbt_dynar_free(&STag_surfxml_random_cb_list);
212 xbt_dynar_free(&ETag_surfxml_random_cb_list);
213 xbt_dynar_free(&STag_surfxml_ASroute_cb_list);
214 xbt_dynar_free(&ETag_surfxml_ASroute_cb_list);
215 xbt_dynar_free(&STag_surfxml_bypassRoute_cb_list);
216 xbt_dynar_free(&ETag_surfxml_bypassRoute_cb_list);
217 xbt_dynar_free(&STag_surfxml_peer_cb_list);
218 xbt_dynar_free(&ETag_surfxml_peer_cb_list);
219 xbt_dynar_free(&STag_surfxml_include_cb_list);
220 xbt_dynar_free(&ETag_surfxml_include_cb_list);
223 /* Stag and Etag parse functions */
224 void ETag_surfxml_router(void) { /* ignored -- do not add content here */ }
226 void STag_surfxml_platform(void) {
227 _XBT_GNUC_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
229 xbt_assert((version >= 1.0), "******* BIG FAT WARNING *********\n "
230 "You're using an ancient XML file.\n"
231 "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
232 "instead of MBytes, MFlops and seconds.\n"
234 "Use simgrid_update_xml to update your file automatically. "
235 "This program is installed automatically with SimGrid, or "
236 "available in the tools/ directory of the source archive.\n"
238 "Please check also out the SURF section of the ChangeLog for "
239 "the 3.1 version for more information. \n"
241 "Last, do not forget to also update your values for "
242 "the calls to MSG_task_create (if any).");
243 xbt_assert((version >= 3.0), "******* BIG FAT WARNING *********\n "
244 "You're using an old XML file.\n"
245 "Use simgrid_update_xml to update your file automatically. "
246 "This program is installed automatically with SimGrid, or "
247 "available in the tools/ directory of the source archive.");
251 void ETag_surfxml_platform(void){
255 void STag_surfxml_host(void){
256 xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
259 void ETag_surfxml_host(void) {
260 s_sg_platf_host_cbarg_t host;
261 memset(&host,0,sizeof(host));
263 host.properties = current_property_set;
265 host.id = A_surfxml_host_id;
266 host.power_peak = get_cpu_power(A_surfxml_host_power);
267 host.power_scale = surf_parse_get_double( A_surfxml_host_availability);
268 host.core_amount = surf_parse_get_int(A_surfxml_host_core);
269 host.power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
270 host.state_trace = tmgr_trace_new(A_surfxml_host_state_file);
271 xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
272 (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state");
273 if (A_surfxml_host_state == A_surfxml_host_state_ON)
274 host.initial_state = SURF_RESOURCE_ON;
275 if (A_surfxml_host_state == A_surfxml_host_state_OFF)
276 host.initial_state = SURF_RESOURCE_OFF;
277 host.coord = A_surfxml_host_coordinates;
279 sg_platf_new_host(&host);
280 current_property_set = NULL;
283 void STag_surfxml_router(void){
284 s_sg_platf_router_cbarg_t router;
285 memset(&router, 0, sizeof(router));
287 router.id = A_surfxml_router_id;
288 router.coord = A_surfxml_router_coordinates;
290 sg_platf_new_router(&router);
293 void STag_surfxml_cluster(void){
294 s_sg_platf_cluster_cbarg_t cluster;
295 memset(&cluster,0,sizeof(cluster));
296 cluster.id = A_surfxml_cluster_id;
297 cluster.prefix = A_surfxml_cluster_prefix;
298 cluster.suffix = A_surfxml_cluster_suffix;
299 cluster.radical = A_surfxml_cluster_radical;
300 cluster.power= surf_parse_get_double(A_surfxml_cluster_power);
301 cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core);
302 cluster.bw = surf_parse_get_double(A_surfxml_cluster_bw);
303 cluster.lat = surf_parse_get_double(A_surfxml_cluster_lat);
304 if(strcmp(A_surfxml_cluster_bb_bw,""))
305 cluster.bb_bw = surf_parse_get_double(A_surfxml_cluster_bb_bw);
306 if(strcmp(A_surfxml_cluster_bb_lat,""))
307 cluster.bb_lat = surf_parse_get_double(A_surfxml_cluster_bb_lat);
308 cluster.router_id = A_surfxml_cluster_router_id;
310 switch (AX_surfxml_cluster_sharing_policy) {
311 case A_surfxml_cluster_sharing_policy_SHARED:
312 cluster.sharing_policy = SURF_LINK_SHARED;
314 case A_surfxml_cluster_sharing_policy_FULLDUPLEX:
315 cluster.sharing_policy = SURF_LINK_FULLDUPLEX;
317 case A_surfxml_cluster_sharing_policy_FATPIPE:
318 cluster.sharing_policy = SURF_LINK_FATPIPE;
321 surf_parse_error(bprintf
322 ("Invalid cluster sharing policy for cluster %s",
326 switch (AX_surfxml_cluster_bb_sharing_policy) {
327 case A_surfxml_cluster_bb_sharing_policy_FATPIPE:
328 cluster.bb_sharing_policy = SURF_LINK_FATPIPE;
330 case A_surfxml_cluster_bb_sharing_policy_SHARED:
331 cluster.bb_sharing_policy = SURF_LINK_SHARED;
334 surf_parse_error(bprintf
335 ("Invalid bb sharing policy in cluster %s",
340 cluster.availability_trace = A_surfxml_cluster_availability_file;
341 cluster.state_trace = A_surfxml_cluster_state_file;
342 sg_platf_new_cluster(&cluster);
344 void ETag_surfxml_cluster(void){
345 /* nothing I can think of */
348 void STag_surfxml_peer(void){
349 s_sg_platf_peer_cbarg_t peer;
350 memset(&peer,0,sizeof(peer));
351 peer.id = A_surfxml_peer_id;
352 peer.power = surf_parse_get_double(A_surfxml_peer_power);
353 peer.bw_in = surf_parse_get_double(A_surfxml_peer_bw_in);
354 peer.bw_out = surf_parse_get_double(A_surfxml_peer_bw_out);
355 peer.lat = surf_parse_get_double(A_surfxml_peer_lat);
356 peer.coord = A_surfxml_peer_coordinates;
357 peer.availability_trace = tmgr_trace_new(A_surfxml_peer_availability_file);
358 peer.state_trace = tmgr_trace_new(A_surfxml_peer_state_file);
360 surfxml_call_cb_functions(STag_surfxml_peer_cb_list);
361 sg_platf_new_peer(&peer);
363 void ETag_surfxml_peer(void){
364 /* nothing to do here */
366 void STag_surfxml_link(void){
367 xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
369 void ETag_surfxml_link(void){
370 s_sg_platf_link_cbarg_t link;
371 memset(&link,0,sizeof(link));
373 link.properties = current_property_set;
375 link.id = A_surfxml_link_id;
376 link.bandwidth = surf_parse_get_double(A_surfxml_link_bandwidth);
377 link.bandwidth_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
378 link.latency = surf_parse_get_double(A_surfxml_link_latency);
379 link.latency_trace = tmgr_trace_new(A_surfxml_link_latency_file);
381 switch (A_surfxml_link_state) {
382 case A_surfxml_link_state_ON:
383 link.state = SURF_RESOURCE_ON;
385 case A_surfxml_link_state_OFF:
386 link.state = SURF_RESOURCE_OFF;
389 surf_parse_error(bprintf("invalid state for link %s",link.id));
392 link.state_trace = tmgr_trace_new(A_surfxml_link_state_file);
394 switch (A_surfxml_link_sharing_policy) {
395 case A_surfxml_link_sharing_policy_SHARED:
396 link.policy = SURF_LINK_SHARED;
398 case A_surfxml_link_sharing_policy_FATPIPE:
399 link.policy = SURF_LINK_FATPIPE;
401 case A_surfxml_link_sharing_policy_FULLDUPLEX:
402 link.policy = SURF_LINK_FULLDUPLEX;
405 surf_parse_error(bprintf("Invalid sharing policy in link %s",link.id));
409 sg_platf_new_link(&link);
411 current_property_set = NULL;
414 void STag_surfxml_route(void){
415 surfxml_call_cb_functions(STag_surfxml_route_cb_list);
417 void STag_surfxml_link_ctn(void){
418 surfxml_call_cb_functions(STag_surfxml_link_ctn_cb_list);
420 void STag_surfxml_process(void){
421 surfxml_call_cb_functions(STag_surfxml_process_cb_list);
423 void STag_surfxml_argument(void){
424 surfxml_call_cb_functions(STag_surfxml_argument_cb_list);
426 void STag_surfxml_prop(void){
427 surfxml_call_cb_functions(STag_surfxml_prop_cb_list);
429 void STag_surfxml_trace(void){
430 surfxml_call_cb_functions(STag_surfxml_trace_cb_list);
432 void STag_surfxml_trace_connect(void){
433 surfxml_call_cb_functions(STag_surfxml_trace_connect_cb_list);
435 void STag_surfxml_AS(void){
436 sg_platf_new_AS_begin(A_surfxml_AS_id,A_surfxml_AS_routing);
438 void ETag_surfxml_AS(void){
439 sg_platf_new_AS_end();
441 void STag_surfxml_ASroute(void){
442 surfxml_call_cb_functions(STag_surfxml_ASroute_cb_list);
444 void STag_surfxml_bypassRoute(void){
445 surfxml_call_cb_functions(STag_surfxml_bypassRoute_cb_list);
447 void STag_surfxml_config(void){
448 XBT_DEBUG("START configuration name = %s",A_surfxml_config_id);
449 xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
451 void ETag_surfxml_config(void){
452 xbt_dict_cursor_t cursor = NULL;
456 xbt_dict_foreach(current_property_set, cursor, key, elem) {
457 cfg = bprintf("%s:%s",key,elem);
458 if(xbt_cfg_is_default_value(_surf_cfg_set, key))
459 xbt_cfg_set_parse(_surf_cfg_set, cfg);
461 XBT_INFO("The custom configuration '%s' is already defined by user!",key);
464 XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
465 xbt_dict_free(¤t_property_set);
467 void STag_surfxml_random(void){
468 surfxml_call_cb_functions(STag_surfxml_random_cb_list);
471 #define parse_method(type,name) \
472 void type##Tag_surfxml_##name(void) \
473 { surfxml_call_cb_functions(type##Tag_surfxml_##name##_cb_list); }
474 parse_method(E, route);
475 parse_method(E, link_ctn);
476 parse_method(E, process);
477 parse_method(E, argument);
478 parse_method(E, prop);
479 parse_method(E, trace);
480 parse_method(E, trace_connect);
481 parse_method(E, random);
482 parse_method(E, ASroute);
483 parse_method(E, bypassRoute);
485 /* Open and Close parse file */
487 void surf_parse_open(const char *file)
489 static int warned = 0; /* warn only once */
493 ("Bypassing the XML parser since surf_parse_open received a NULL pointer. "
494 "If it is not what you want, go fix your code.");
500 if (!surf_input_buffer_stack)
501 surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), NULL);
502 if (!surf_file_to_parse_stack)
503 surf_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL);
505 surf_file_to_parse = surf_fopen(file, "r");
506 xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", file);
507 surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
508 surf_parse__switch_to_buffer(surf_input_buffer);
509 surf_parse_lineno = 1;
512 void surf_parse_close(void)
514 xbt_dynar_free(&surf_input_buffer_stack);
515 xbt_dynar_free(&surf_file_to_parse_stack);
517 if (surf_file_to_parse) {
518 surf_parse__delete_buffer(surf_input_buffer);
519 fclose(surf_file_to_parse);
520 surf_file_to_parse = NULL; //Must be reset for Bypass
524 /* Call the lexer to parse the currently opened file. This pointer to function enables bypassing of the parser */
526 static int _surf_parse(void) {
527 return surf_parse_lex();
529 int_f_void_t surf_parse = _surf_parse;
532 /* Aux parse functions */
534 void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
536 xbt_dynar_push(cb_list, &function);
539 void surfxml_del_callback(xbt_dynar_t cb_list, void_f_void_t function)
543 void_f_void_t null_f=NULL;
546 it = xbt_dynar_search(cb_list,&function);
549 if (e.category == not_found_error) {
551 xbt_die("Trying to remove a callback that is not here! This should not happen");
556 xbt_dynar_replace(cb_list, it,&null_f);
559 static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
561 unsigned int iterator;
563 xbt_dynar_foreach(cb_list, iterator, fun) {
569 /* Prop tag functions */
574 void parse_properties(void)
576 if (!current_property_set)
577 current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error
579 xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL);
583 /* Random tag functions */
585 double get_cpu_power(const char *power)
587 double power_scale = 0.0;
590 random_data_t random = NULL;
591 /* randomness is inserted like this: power="$rand(my_random)" */
592 if (((p = strstr(power, "$rand(")) != NULL)
593 && ((q = strstr(power, ")")) != NULL)) {
595 generator = xbt_malloc(q - (p + 6) + 1);
596 memcpy(generator, p + 6, q - (p + 6));
597 generator[q - (p + 6)] = '\0';
598 random = xbt_dict_get_or_null(random_data_list, generator);
599 xbt_assert(random, "Random generator %s undefined", generator);
600 power_scale = random_generate(random);
603 power_scale = surf_parse_get_double(power);
608 double random_min, random_max, random_mean, random_std_deviation,
612 static void init_randomness(void)
614 random_id = A_surfxml_random_id;
615 random_min = surf_parse_get_double(A_surfxml_random_min);
616 random_max = surf_parse_get_double(A_surfxml_random_max);
617 random_mean = surf_parse_get_double(A_surfxml_random_mean);
618 random_std_deviation = surf_parse_get_double(A_surfxml_random_std_deviation);
619 random_generator = A_surfxml_random_generator;
622 static void add_randomness(void)
624 /* If needed aditional properties can be added by using the prop tag */
625 random_data_t random =
626 random_new(random_generator, 0, random_min, random_max, random_mean,
627 random_std_deviation);
628 xbt_dict_set(random_data_list, random_id, (void *) random,