Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reindent everything (possibly breaking all branches, but for the last time)
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 26 May 2009 15:29:22 +0000 (15:29 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 26 May 2009 15:29:22 +0000 (15:29 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6309 48e7efb5-ca39-0410-a469-dd3cf9ba447f

318 files changed:
examples/amok/bandwidth/bandwidth.c
examples/amok/saturate/saturate.c
examples/gras/all2all/all2all.c
examples/gras/chrono/chrono.c
examples/gras/mmrpc/mmrpc.h
examples/gras/mmrpc/mmrpc_client.c
examples/gras/mmrpc/mmrpc_common.c
examples/gras/mmrpc/mmrpc_server.c
examples/gras/mutual_exclusion/simple_token/simple_token.c
examples/gras/ping/ping.h
examples/gras/ping/ping_client.c
examples/gras/ping/ping_common.c
examples/gras/ping/ping_server.c
examples/gras/pmm/pmm.c
examples/gras/properties/properties.c
examples/gras/rpc/rpc.c
examples/gras/spawn/spawn.h
examples/gras/spawn/spawn_child.c
examples/gras/spawn/spawn_common.c
examples/gras/spawn/spawn_father.c
examples/gras/synchro/philosopher.c
examples/gras/timer/timer.c
examples/msg/actions/actions.c
examples/msg/gtnets/gtnets.c
examples/msg/gtnets/gtnets_kayo.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/migration/migration.c
examples/msg/parallel_task/parallel_task.c
examples/msg/parallel_task/test_ptask.c
examples/msg/priority/priority.c
examples/msg/properties/msg_prop.c
examples/msg/sendrecv/sendrecv.c
examples/msg/suspend/suspend.c
examples/simdag/metaxml/sd_meta.c
examples/simdag/properties/sd_prop.c
examples/simdag/sd_test.c
examples/simdag/sd_test2.c
include/amok/bandwidth.h
include/amok/peermanagement.h
include/gras.h
include/gras/datadesc.h
include/gras/emul.h
include/gras/messages.h
include/gras/module.h
include/gras/process.h
include/gras/timer.h
include/gras/transport.h
include/gras/virtu.h
include/msg/datatypes.h
include/msg/msg.h
include/simdag/datatypes.h
include/simdag/simdag.h
include/smpi/smpi.h
include/surf/simgrid_dtd.h
include/surf/surfxml_parse.h
include/xbt/asserts.h
include/xbt/config.h
include/xbt/cunit.h
include/xbt/dict.h
include/xbt/dynar.h
include/xbt/ex.h
include/xbt/fifo.h
include/xbt/function_types.h
include/xbt/graph.h
include/xbt/graphxml.h
include/xbt/graphxml_parse.h
include/xbt/hash.h
include/xbt/heap.h
include/xbt/log.h
include/xbt/mallocator.h
include/xbt/matrix.h
include/xbt/misc.h
include/xbt/module.h
include/xbt/peer.h
include/xbt/queue.h
include/xbt/set.h
include/xbt/str.h
include/xbt/strbuff.h
include/xbt/swag.h
include/xbt/synchro.h
include/xbt/sysdep.h
include/xbt/time.h
include/xbt/virtu.h
src/amok/Bandwidth/bandwidth.c
src/amok/Bandwidth/bandwidth_private.h
src/amok/Bandwidth/saturate.c
src/amok/PeerManagement/peermanagement.c
src/amok/amok_base.c
src/gras/DataDesc/cbps.c
src/gras/DataDesc/datadesc.c
src/gras/DataDesc/datadesc_interface.h
src/gras/DataDesc/datadesc_private.h
src/gras/DataDesc/ddt_convert.c
src/gras/DataDesc/ddt_create.c
src/gras/DataDesc/ddt_exchange.c
src/gras/DataDesc/ddt_parse.c
src/gras/DataDesc/ddt_parse.yy.c
src/gras/DataDesc/ddt_parse.yy.h
src/gras/Msg/gras_msg_exchange.c
src/gras/Msg/gras_msg_listener.c
src/gras/Msg/gras_msg_mod.c
src/gras/Msg/gras_msg_types.c
src/gras/Msg/msg_interface.h
src/gras/Msg/msg_private.h
src/gras/Msg/rl_msg.c
src/gras/Msg/rpc.c
src/gras/Msg/sg_msg.c
src/gras/Msg/timer.c
src/gras/Transport/rl_transport.c
src/gras/Transport/sg_transport.c
src/gras/Transport/transport.c
src/gras/Transport/transport_interface.h
src/gras/Transport/transport_plugin_file.c
src/gras/Transport/transport_plugin_sg.c
src/gras/Transport/transport_plugin_tcp.c
src/gras/Transport/transport_private.h
src/gras/Virtu/gras_module.c
src/gras/Virtu/process.c
src/gras/Virtu/rl_dns.c
src/gras/Virtu/rl_emul.c
src/gras/Virtu/rl_process.c
src/gras/Virtu/sg_dns.c
src/gras/Virtu/sg_emul.c
src/gras/Virtu/sg_process.c
src/gras/Virtu/virtu_interface.h
src/gras/Virtu/virtu_private.h
src/gras/Virtu/virtu_sg.h
src/gras/gras.c
src/gras/rl_stubs.c
src/gras_modinter.h
src/include/simix/datatypes.h
src/include/simix/simix.h
src/include/surf/maxmin.h
src/include/surf/random_mgr.h
src/include/surf/surf.h
src/include/surf/surfxml_parse_private.h
src/include/surf/trace_mgr.h
src/include/xbt/context.h
src/include/xbt/wine_dbghelp.h
src/include/xbt/xbt_os_thread.h
src/include/xbt/xbt_os_time.h
src/java/jmsg.c
src/java/jmsg.h
src/java/jmsg_application_handler.c
src/java/jmsg_application_handler.h
src/java/jmsg_channel.c
src/java/jmsg_channel.h
src/java/jmsg_host.c
src/java/jmsg_host.h
src/java/jmsg_process.c
src/java/jmsg_process.h
src/java/jmsg_task.c
src/java/jmsg_task.h
src/java/jxbt_utilities.c
src/java/jxbt_utilities.h
src/msg/deployment.c
src/msg/environment.c
src/msg/global.c
src/msg/gos.c
src/msg/host.c
src/msg/m_process.c
src/msg/mailbox.h
src/msg/msg_actions.c
src/msg/msg_config.c
src/msg/msg_mailbox.c
src/msg/private.h
src/msg/task.c
src/portable.h
src/simdag/private.h
src/simdag/sd_global.c
src/simdag/sd_link.c
src/simdag/sd_task.c
src/simdag/sd_workstation.c
src/simix/private.h
src/simix/smx_action.c
src/simix/smx_config.c
src/simix/smx_deployment.c
src/simix/smx_environment.c
src/simix/smx_global.c
src/simix/smx_host.c
src/simix/smx_process.c
src/simix/smx_synchro.c
src/smpi/private.h
src/smpi/smpi_base.c
src/smpi/smpi_bench.c
src/smpi/smpi_global.c
src/smpi/smpi_mpi.c
src/smpi/smpi_receiver.c
src/smpi/smpi_sender.c
src/smpi/smpi_util.c
src/surf/cpu.c
src/surf/cpu_private.h
src/surf/fair_bottleneck.c
src/surf/gtnets/gtnets_interface.h
src/surf/gtnets/gtnets_simulator.h
src/surf/gtnets/gtnets_topology.h
src/surf/lagrange.c
src/surf/maxmin.c
src/surf/maxmin_private.h
src/surf/network.c
src/surf/network_common.h
src/surf/network_constant.c
src/surf/network_gtnets.c
src/surf/network_gtnets_private.h
src/surf/network_private.h
src/surf/random_mgr.c
src/surf/sdp.c
src/surf/simgrid_dtd.c
src/surf/surf.c
src/surf/surf_private.h
src/surf/surf_timer.c
src/surf/surf_timer_private.h
src/surf/surfxml_parse.c
src/surf/trace_mgr.c
src/surf/trace_mgr_private.h
src/surf/workstation.c
src/surf/workstation_private.h
src/surf/workstation_ptask_L07.c
src/xbt/asserts.c
src/xbt/backtrace_dummy.c
src/xbt/backtrace_linux.c
src/xbt/backtrace_windows.c
src/xbt/config.c
src/xbt/cunit.c
src/xbt/dict.c
src/xbt/dict_cursor.c
src/xbt/dict_elm.c
src/xbt/dict_multi.c
src/xbt/dict_private.h
src/xbt/dynar.c
src/xbt/dynar_private.h
src/xbt/ex.c
src/xbt/ex_interface.h
src/xbt/fifo.c
src/xbt/fifo_private.h
src/xbt/graph.c
src/xbt/graph_private.h
src/xbt/graphxml.c
src/xbt/graphxml_parse.c
src/xbt/heap.c
src/xbt/heap_private.h
src/xbt/log.c
src/xbt/log_private.h
src/xbt/mallocator.c
src/xbt/mallocator_private.h
src/xbt/set.c
src/xbt/snprintf.c
src/xbt/swag.c
src/xbt/xbt_context.c
src/xbt/xbt_context_java.h
src/xbt/xbt_context_private.h
src/xbt/xbt_log_appender_file.c
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_log_layout_simple.c
src/xbt/xbt_main.c
src/xbt/xbt_matrix.c
src/xbt/xbt_os_thread.c
src/xbt/xbt_os_time.c
src/xbt/xbt_peer.c
src/xbt/xbt_queue.c
src/xbt/xbt_rl_synchro.c
src/xbt/xbt_rl_time.c
src/xbt/xbt_sg_stubs.c
src/xbt/xbt_sg_synchro.c
src/xbt/xbt_sg_time.c
src/xbt/xbt_sha.c
src/xbt/xbt_str.c
src/xbt/xbt_strbuff.c
src/xbt/xbt_virtu.c
src/xbt_modinter.h
teshsuite/gras/datadesc/datadesc_structs.c
teshsuite/gras/datadesc/datadesc_usage.c
teshsuite/gras/empty_main/empty_main.c
teshsuite/gras/msg_handle/msg_handle.c
teshsuite/gras/small_sleep/small_sleep.c
teshsuite/msg/get_sender.c
teshsuite/simdag/basic0.c
teshsuite/simdag/basic1.c
teshsuite/simdag/basic2.c
teshsuite/simdag/basic3.c
teshsuite/simdag/basic4.c
teshsuite/simdag/basic5.c
teshsuite/simdag/basic6.c
teshsuite/simdag/network/mxn/test_intra_all2all.c
teshsuite/simdag/network/mxn/test_intra_independent_comm.c
teshsuite/simdag/network/mxn/test_intra_scatter.c
teshsuite/simdag/network/p2p/test_latency1.c
teshsuite/simdag/network/p2p/test_latency2.c
teshsuite/simdag/network/p2p/test_latency3.c
teshsuite/simdag/network/p2p/test_latency_bound.c
teshsuite/simdag/network/test_reinit_costs.c
teshsuite/simdag/partask/test_comp_only_par.c
teshsuite/simdag/partask/test_comp_only_seq.c
teshsuite/simdag/platforms/basic_parsing_test.c
teshsuite/simdag/platforms/flatifier.c
teshsuite/xbt/log_large_test.c
teshsuite/xbt/parallel_log_crashtest.c
testsuite/simdag/sd_test.c
testsuite/surf/lmm_usage.c
testsuite/surf/maxmin_bench.c
testsuite/surf/surf_usage.c
testsuite/surf/surf_usage2.c
testsuite/surf/trace_usage.c
testsuite/xbt/context_usage.c
testsuite/xbt/graphxml_usage.c
testsuite/xbt/heap_bench.c
testsuite/xbt/log_usage.c
tools/gras/gras_stub_generator.h
tools/gras/stub_generator.c
tools/gras/unix_stub_generator.c
tools/gras/windows_stub_generator.c
tools/tesh/run_context.c
tools/tesh/run_context.h
tools/tesh/signal.c
tools/tesh/tesh.c
tools/tesh/tesh.h

index 5f1b720..65538fe 100644 (file)
 #include "amok/bandwidth.h"
 #include "amok/peermanagement.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth, "Messages specific to this example");
 
 /* **********************************************************************
  * Sensor code
  * **********************************************************************/
 
 /* Function prototypes */
-int sensor (int argc,char *argv[]);
+int sensor(int argc, char *argv[]);
 
-int sensor (int argc,char *argv[]) {
+int sensor(int argc, char *argv[])
+{
   gras_socket_t mysock;
-  gras_socket_t master=NULL;
+  gras_socket_t master = NULL;
   int connection_try = 10;
   xbt_ex_t e;
 
   gras_init(&argc, argv);
   amok_bw_init();
   amok_pm_init();
-  mysock = gras_socket_server_range(3000,9999,0,0);
-  INFO1("Sensor starting (on port %d)",gras_os_myport());
+
+  mysock = gras_socket_server_range(3000, 9999, 0, 0);
+  INFO1("Sensor starting (on port %d)", gras_os_myport());
   while (connection_try > 0 && master == NULL) {
-     int connected = 0;
-     TRY {
-       master = gras_socket_client_from_string(argv[1]);
-       connected = 1;
-     } CATCH(e) {
-       xbt_ex_free(e);
-     }
-     if (!connected) {
-       connection_try--;
-       gras_os_sleep(0.5); /* let the master get ready */
-     }
+    int connected = 0;
+    TRY {
+      master = gras_socket_client_from_string(argv[1]);
+      connected = 1;
+    } CATCH(e) {
+      xbt_ex_free(e);
+    }
+    if (!connected) {
+      connection_try--;
+      gras_os_sleep(0.5);       /* let the master get ready */
+    }
   }
-                                             
-  amok_pm_group_join(master,"bandwidth",-1);
+
+  amok_pm_group_join(master, "bandwidth", -1);
   amok_pm_mainloop(60);
 
   gras_socket_close(mysock);
@@ -61,18 +62,19 @@ int sensor (int argc,char *argv[]) {
  * **********************************************************************/
 
 /* Function prototypes */
-int maestro (int argc,char *argv[]);
+int maestro(int argc, char *argv[]);
 
-int maestro(int argc,char *argv[]) {
+int maestro(int argc, char *argv[])
+{
   double sec, bw;
-  int buf_size=32  *1024;
-  int msg_size=512 *1024;
+  int buf_size = 32 * 1024;
+  int msg_size = 512 * 1024;
   int msg_amount = 1;
   double min_duration = 1;
-   
+
   gras_socket_t peer;
   gras_socket_t mysock;
-  xbt_peer_t h1,h2,h_temp;
+  xbt_peer_t h1, h2, h_temp;
   xbt_dynar_t group;
 
   gras_init(&argc, argv);
@@ -81,49 +83,50 @@ int maestro(int argc,char *argv[]) {
 
   INFO0("Maestro starting");
   if (argc != 2) {
-     ERROR0("Usage: maestro port\n");
-     return 1;
+    ERROR0("Usage: maestro port\n");
+    return 1;
   }
-  mysock=gras_socket_server(atoi(argv[1]));
-  group=amok_pm_group_new("bandwidth");
+  mysock = gras_socket_server(atoi(argv[1]));
+  group = amok_pm_group_new("bandwidth");
   INFO0("Wait for peers for 5 sec");
-  gras_msg_handleall(5); /* friends, we're ready. Come and play */
-   
+  gras_msg_handleall(5);        /* friends, we're ready. Come and play */
+
   if (xbt_dynar_length(group) < 2) {
-     char *msg;
-     asprintf(&msg,"Not enough peers arrived. Expected 2 got %ld",
-             xbt_dynar_length(group));
-     amok_pm_group_shutdown("bandwidth");
-     xbt_die(msg);
+    char *msg;
+    asprintf(&msg, "Not enough peers arrived. Expected 2 got %ld",
+             xbt_dynar_length(group));
+    amok_pm_group_shutdown("bandwidth");
+    xbt_die(msg);
   }
-  h1 = *(xbt_peer_t*)xbt_dynar_get_ptr(group, 0);
-  h2 = *(xbt_peer_t*)xbt_dynar_get_ptr(group, 1);
+  h1 = *(xbt_peer_t *) xbt_dynar_get_ptr(group, 0);
+  h2 = *(xbt_peer_t *) xbt_dynar_get_ptr(group, 1);
   /* sort peers in right order to keep output right */
-  if (strcmp(h1->name,h2->name) < 0 || h1->port > h2->port) {
-     h_temp = h1;
-     h1 = h2;
-     h2 = h_temp;
+  if (strcmp(h1->name, h2->name) < 0 || h1->port > h2->port) {
+    h_temp = h1;
+    h1 = h2;
+    h2 = h_temp;
   }
 
-  INFO2("Contact %s:%d",h1->name, h1->port);
+  INFO2("Contact %s:%d", h1->name, h1->port);
   peer = gras_socket_client(h1->name, h1->port);
 
-  INFO0("Test the BW between me and one of the sensors");  
-  amok_bw_test(peer,buf_size,msg_size,msg_amount,min_duration,&sec,&bw);
-  INFO7("Experience between me and %s:%d (initially %d msgs of %d bytes, maybe modified to fill the pipe at least %.1fs) took %f sec, achieving %f kb/s",
-       h1->name, h1->port,
-       msg_amount,msg_size,min_duration,
-       sec,((double)bw)/1024.0);
-
-  INFO4("Test the BW between %s:%d and %s:%d", h1->name, h1->port,     h2->name, h2->port);
-  amok_bw_request(h1->name, h1->port,  h2->name, h2->port,
-                 buf_size,msg_size,msg_amount,min_duration,&sec,&bw);
-  INFO6("Experience between %s:%d and %s:%d took took %f sec, achieving %f kb/s",
-       h1->name, h1->port,     h2->name, h2->port,
-       sec,((double)bw)/1024.0);
+  INFO0("Test the BW between me and one of the sensors");
+  amok_bw_test(peer, buf_size, msg_size, msg_amount, min_duration, &sec, &bw);
+  INFO7
+    ("Experience between me and %s:%d (initially %d msgs of %d bytes, maybe modified to fill the pipe at least %.1fs) took %f sec, achieving %f kb/s",
+     h1->name, h1->port, msg_amount, msg_size, min_duration, sec,
+     ((double) bw) / 1024.0);
+
+  INFO4("Test the BW between %s:%d and %s:%d", h1->name, h1->port, h2->name,
+        h2->port);
+  amok_bw_request(h1->name, h1->port, h2->name, h2->port, buf_size, msg_size,
+                  msg_amount, min_duration, &sec, &bw);
+  INFO6
+    ("Experience between %s:%d and %s:%d took took %f sec, achieving %f kb/s",
+     h1->name, h1->port, h2->name, h2->port, sec, ((double) bw) / 1024.0);
 
   /* Game is over, friends */
-  amok_pm_group_shutdown ("bandwidth");
+  amok_pm_group_shutdown("bandwidth");
 
   gras_socket_close(mysock);
   gras_exit();
index 6734088..70d6cad 100644 (file)
 #include "amok/bandwidth.h"
 #include "amok/peermanagement.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(saturate,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(saturate, "Messages specific to this example");
 
 /* **********************************************************************
  * Sensor code
  * **********************************************************************/
 
 /* Function prototypes */
-int sensor (int argc,char *argv[]);
+int sensor(int argc, char *argv[]);
 
-int sensor (int argc,char *argv[]) {
+int sensor(int argc, char *argv[])
+{
   gras_socket_t mysock;
   gras_socket_t master;
 
   gras_init(&argc, argv);
   amok_bw_init();
   amok_pm_init();
-  mysock = gras_socket_server_range(3000,9999,0,0);
-  INFO1("Sensor starting (on port %d)",gras_os_myport());
-  gras_os_sleep(2); /* let the master get ready */
+
+  mysock = gras_socket_server_range(3000, 9999, 0, 0);
+  INFO1("Sensor starting (on port %d)", gras_os_myport());
+  gras_os_sleep(2);             /* let the master get ready */
   master = gras_socket_client_from_string(argv[1]);
-                                             
-  amok_pm_group_join(master,"saturate",-1);
+
+  amok_pm_group_join(master, "saturate", -1);
   amok_pm_mainloop(600);
 
   gras_socket_close(mysock);
@@ -53,7 +54,7 @@ int sensor (int argc,char *argv[]) {
  * **********************************************************************/
 
 /* Function prototypes */
-int maestro (int argc,char *argv[]);
+int maestro(int argc, char *argv[]);
 
 /* XP setups */
 const int buf_size = 0;
@@ -63,110 +64,117 @@ const int sat_size = 1024 * 1024 * 10;
 const double min_duration = 1;
 
 static double XP(const char *bw1, const char *bw2,
-                const char *sat1, const char *sat2) {
+                 const char *sat1, const char *sat2)
+{
 
-  double sec, bw, sec_sat,bw_sat;
+  double sec, bw, sec_sat, bw_sat;
 
-  gras_os_sleep(5.0); /* wait for the sensors to show up */
+  gras_os_sleep(5.0);           /* wait for the sensors to show up */
   /* Test BW without saturation */
-  amok_bw_request(bw1,4000,bw2,4000,
-                 buf_size,msg_size,msg_amount,min_duration,&sec,&bw);
+  amok_bw_request(bw1, 4000, bw2, 4000,
+                  buf_size, msg_size, msg_amount, min_duration, &sec, &bw);
   INFO4("BW(%s,%s) => %f sec, achieving %f Mb/s",
-       bw1, bw2, sec, (bw/1024.0/1024.0));
+        bw1, bw2, sec, (bw / 1024.0 / 1024.0));
 
 
-  /* Test BW with saturation */  
-  amok_bw_saturate_start(sat1,4000,sat2,4000, sat_size,60);
-  gras_os_sleep(1.0); /* let it start */
+  /* Test BW with saturation */
+  amok_bw_saturate_start(sat1, 4000, sat2, 4000, sat_size, 60);
+  gras_os_sleep(1.0);           /* let it start */
 
-  amok_bw_request(bw1,4000,bw2,4000,
-                 buf_size,msg_size,msg_amount,min_duration,&sec_sat,&bw_sat);
-  INFO6("BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s",
-       bw1,bw2,sat1,sat2,sec,bw/1024.0/1024.0);
-  
-  amok_bw_saturate_stop(sat1,4000,NULL,NULL);
+  amok_bw_request(bw1, 4000, bw2, 4000,
+                  buf_size, msg_size, msg_amount, min_duration, &sec_sat,
+                  &bw_sat);
+  INFO6("BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s", bw1, bw2, sat1, sat2,
+        sec, bw / 1024.0 / 1024.0);
 
-  if (bw_sat/bw < 0.7) {
+  amok_bw_saturate_stop(sat1, 4000, NULL, NULL);
+
+  if (bw_sat / bw < 0.7) {
     INFO0("THERE IS SOME INTERFERENCE !!!");
-  } 
-  if (bw/bw_sat < 0.7) {
+  }
+  if (bw / bw_sat < 0.7) {
     INFO0("THERE IS SOME INTERFERENCE (and I'm an idiot) !!!");
-  } 
-  return bw_sat/bw;
+  }
+  return bw_sat / bw;
 }
 
-static void kill_buddy(char *name,int port){
-  gras_socket_t sock=gras_socket_client(name,port);
-  gras_msg_send(sock,"kill",NULL);
+static void kill_buddy(char *name, int port)
+{
+  gras_socket_t sock = gras_socket_client(name, port);
+  gras_msg_send(sock, "kill", NULL);
   gras_socket_close(sock);
 }
-static void kill_buddy_dynar(void *b) {
-  xbt_peer_t buddy=*(xbt_peer_t*)b;
-  kill_buddy(buddy->name,buddy->port);
+
+static void kill_buddy_dynar(void *b)
+{
+  xbt_peer_t buddy = *(xbt_peer_t *) b;
+  kill_buddy(buddy->name, buddy->port);
 }
 
-static void free_peer(void *d){
-  xbt_peer_t h=*(xbt_peer_t*)d;
+static void free_peer(void *d)
+{
+  xbt_peer_t h = *(xbt_peer_t *) d;
   free(h->name);
   free(h);
 }
 
-static void simple_saturation(int argc, char*argv[]) {
+static void simple_saturation(int argc, char *argv[])
+{
   xbt_ex_t e;
 
   /* where are the sensors */
   xbt_dynar_t peers;
-  xbt_peer_t h1,h2;
+  xbt_peer_t h1, h2;
   /* results */
-  double duration,bw;
+  double duration, bw;
 
   /* Init the group */
-  peers=amok_pm_group_new("saturate");
+  peers = amok_pm_group_new("saturate");
   /* wait for dudes */
   gras_msg_handleall(5);
 
   /* Stop all sensors but two of them */
   while (xbt_dynar_length(peers) > 2) {
-     xbt_dynar_pop(peers,&h1);
-     amok_pm_kill_hp(h1->name,h1->port);
-     xbt_peer_free(h1);
+    xbt_dynar_pop(peers, &h1);
+    amok_pm_kill_hp(h1->name, h1->port);
+    xbt_peer_free(h1);
   }
-   
+
   /* get 2 friends */
-  xbt_dynar_get_cpy(peers,0,&h1);
-  xbt_dynar_get_cpy(peers,1,&h2);
-   
+  xbt_dynar_get_cpy(peers, 0, &h1);
+  xbt_dynar_get_cpy(peers, 1, &h2);
+
   /* Start saturation */
   INFO4("Start saturation between %s:%d and %s:%d",
-       h1->name,h1->port,
-       h2->name,h2->port);
+        h1->name, h1->port, h2->name, h2->port);
 
-  amok_bw_saturate_start(h1->name,h1->port,
-                        h2->name,h2->port,
-                        0, /* Be a nice boy, compute msg_size yourself */
-                        30  /* 5 sec timeout */);  
+  amok_bw_saturate_start(h1->name, h1->port, h2->name, h2->port, 0,     /* Be a nice boy, compute msg_size yourself */
+                         30 /* 5 sec timeout */ );
 
   /* Stop it after a while */
   INFO0("Have a rest");
   gras_os_sleep(1);
   TRY {
     INFO0("Stop the saturation");
-    amok_bw_saturate_stop(h1->name,h1->port, &duration,&bw);
-  } CATCH(e) {
+    amok_bw_saturate_stop(h1->name, h1->port, &duration, &bw);
+  }
+  CATCH(e) {
     INFO0("Ooops, stoping the saturation raised an exception");
     xbt_ex_free(e);
   }
-  INFO2("Saturation took %.2fsec, achieving %fb/s",duration,bw);
-   
+  INFO2("Saturation took %.2fsec, achieving %fb/s", duration, bw);
+
   /* Game is over, friends */
-  amok_pm_group_shutdown ("saturate");
+  amok_pm_group_shutdown("saturate");
 }
+
 /********************************************************************************************/
-static void full_fledged_saturation(int argc, char*argv[]) {
+static void full_fledged_saturation(int argc, char *argv[])
+{
   xbt_ex_t e;
-  double time1=5.0,bw1=5.0; // 0.5 for test
+  double time1 = 5.0, bw1 = 5.0;        // 0.5 for test
   /* timers */
-  double begin_simulated; 
+  double begin_simulated;
   int begin;
 
   /* where are the sensors */
@@ -178,11 +186,11 @@ static void full_fledged_saturation(int argc, char*argv[]) {
   double *bw_sat;
 
   /* iterators */
-  unsigned int i,j,k,l;
-  xbt_peer_t h1,h2,h3,h4;
+  unsigned int i, j, k, l;
+  xbt_peer_t h1, h2, h3, h4;
 
   /* Init the group */
-  peers=amok_pm_group_new("saturate");
+  peers = amok_pm_group_new("saturate");
   /* wait 4 dudes */
   gras_msg_handle(60);
   gras_msg_handle(60);
@@ -193,76 +201,81 @@ static void full_fledged_saturation(int argc, char*argv[]) {
   INFO0("Let's go for the bw_matrix");
 
   /* Do the test without saturation */
-  begin=time(NULL);
-  begin_simulated=gras_os_time();
+  begin = time(NULL);
+  begin_simulated = gras_os_time();
 
-  bw=amok_bw_matrix(peers,buf_size,msg_size,msg_amount,min_duration);
+  bw = amok_bw_matrix(peers, buf_size, msg_size, msg_amount, min_duration);
 
   INFO2("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
-        (long int) (time(NULL)-begin),gras_os_time()-begin_simulated);
+        (long int) (time(NULL) - begin), gras_os_time() - begin_simulated);
 
   /* Do the test with saturation */
-  bw_sat=xbt_new(double,nb_peers*nb_peers);
-  xbt_dynar_foreach(peers,i,h1) {
-    xbt_dynar_foreach(peers,j,h2) {
-      if (i==j) continue;
+  bw_sat = xbt_new(double, nb_peers * nb_peers);
+  xbt_dynar_foreach(peers, i, h1) {
+    xbt_dynar_foreach(peers, j, h2) {
+      if (i == j)
+        continue;
 
       TRY {
-       amok_bw_saturate_start(h1->name,h1->port,
-                              h2->name,h2->port,
-                              0, /* Be nice, compute msg_size yourself */
-                              0  /* no timeout */);  
-      } CATCH(e) {
-       RETHROW0("Cannot ask peers to saturate the link: %s");
+        amok_bw_saturate_start(h1->name, h1->port, h2->name, h2->port, 0,       /* Be nice, compute msg_size yourself */
+                               0 /* no timeout */ );
+      }
+      CATCH(e) {
+        RETHROW0("Cannot ask peers to saturate the link: %s");
       }
       gras_os_sleep(5);
 
-      begin=time(NULL);
-      begin_simulated=gras_os_time();
-      xbt_dynar_foreach(peers,k,h3) {
-       if (i==k || j==k) continue;
-
-       xbt_dynar_foreach(peers,l,h4) {
-         double ratio;
-         if (i==l || j==l || k==l) continue;
-
-         VERB4("TEST %s %s // %s %s",
-               h1->name,h2->name,h3->name,h4->name);
-         amok_bw_request(h3->name,h3->port, h4->name,h4->port,
-                         buf_size,msg_size,msg_amount,min_duration,
-                         NULL,&(bw_sat[k*nb_peers + l]));
-
-         ratio=bw_sat[k*nb_peers + l] / bw[k*nb_peers + l];
-         INFO8("SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s",
-               h1->name,h2->name,h3->name,h4->name,
-               ratio,
-               bw[k*nb_peers + l] , bw_sat[k*nb_peers + l],
-               ratio < 0.7 ? " THERE IS SOME INTERFERENCE !!!": "");
-       }
+      begin = time(NULL);
+      begin_simulated = gras_os_time();
+      xbt_dynar_foreach(peers, k, h3) {
+        if (i == k || j == k)
+          continue;
+
+        xbt_dynar_foreach(peers, l, h4) {
+          double ratio;
+          if (i == l || j == l || k == l)
+            continue;
+
+          VERB4("TEST %s %s // %s %s",
+                h1->name, h2->name, h3->name, h4->name);
+          amok_bw_request(h3->name, h3->port, h4->name, h4->port,
+                          buf_size, msg_size, msg_amount, min_duration,
+                          NULL, &(bw_sat[k * nb_peers + l]));
+
+          ratio = bw_sat[k * nb_peers + l] / bw[k * nb_peers + l];
+          INFO8("SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s",
+                h1->name, h2->name, h3->name, h4->name,
+                ratio,
+                bw[k * nb_peers + l], bw_sat[k * nb_peers + l],
+                ratio < 0.7 ? " THERE IS SOME INTERFERENCE !!!" : "");
+        }
       }
-      amok_bw_saturate_stop(h1->name,h1->port,&time1,&bw1);
+      amok_bw_saturate_stop(h1->name, h1->port, &time1, &bw1);
 
-      INFO2("Did an iteration on saturation pair in %ld sec (%.2f simulated sec)",
-             (long int) (time(NULL)-begin), gras_os_time()-begin_simulated);
-       INFO2("the duration of the experiment >>>>> %.3f sec (%.3f bandwidth)",time1,bw1);
+      INFO2
+        ("Did an iteration on saturation pair in %ld sec (%.2f simulated sec)",
+         (long int) (time(NULL) - begin), gras_os_time() - begin_simulated);
+      INFO2("the duration of the experiment >>>>> %.3f sec (%.3f bandwidth)",
+            time1, bw1);
     }
   }
   free(bw_sat);
   free(bw);
   /* Game is over, friends */
-  amok_pm_group_shutdown ("saturate");
+  amok_pm_group_shutdown("saturate");
 }
 
 
-int maestro(int argc,char *argv[]) {
+int maestro(int argc, char *argv[])
+{
 
-  gras_init(&argc,argv);
+  gras_init(&argc, argv);
   amok_bw_init();
   amok_pm_init();
 
   gras_socket_server(atoi(argv[1]));
 
-  simple_saturation(argc,argv);
+  simple_saturation(argc, argv);
   //full_fledged_saturation(argc, argv);  
 
   gras_exit();
index 9efad71..d722c56 100644 (file)
@@ -5,40 +5,42 @@
 /* Copyright (c) 2006 Ahmed Harbaoui. All rights reserved.                  */
 
  /* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
 * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "gras.h"
 #include "xbt/ex.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(all2all,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(all2all, "Messages specific to this example");
 
 /* register data which may be sent (common to client and server) */
-static void register_messages(void) {
+static void register_messages(void)
+{
 }
 
 /* Function prototypes */
-int receiver (int argc,char *argv[]);
-int sender (int argc,char *argv[]);
+int receiver(int argc, char *argv[]);
+int sender(int argc, char *argv[]);
 
 
 /* **********************************************************************
  * Receiver code
  * **********************************************************************/
-int receiver (int argc,char *argv[]) {
+int receiver(int argc, char *argv[])
+{
 
-  int myport; /* port on which I receive stuff */
-  int todo; /* amount of messages I should get */
-  char *data; /* message content */
+  int myport;                   /* port on which I receive stuff */
+  int todo;                     /* amount of messages I should get */
+  char *data;                   /* message content */
 
-  gras_socket_t mysock;  /* socket on which other people contact me */
-  gras_socket_t expeditor;  /* to notice who wrote me */
+  gras_socket_t mysock;         /* socket on which other people contact me */
+  gras_socket_t expeditor;      /* to notice who wrote me */
 
   /* Init the GRAS infrastructure and declare my globals */
-  gras_init(&argc,argv);
+  gras_init(&argc, argv);
 
   /* Get my settings from the command line */
-  myport=atoi(argv[1]);
-  todo=atoi(argv[2]);
+  myport = atoi(argv[1]);
+  todo = atoi(argv[2]);
 
   /* Register the known messages */
   gras_msgtype_declare("data", gras_datadesc_by_name("string"));
@@ -48,19 +50,16 @@ int receiver (int argc,char *argv[]) {
 
   /* Get the data */
   INFO2("Listening on port %d (expecting %d messages)",
-       gras_socket_my_port(mysock),
-       todo);
-  while (todo>0) {
-     gras_msg_wait(60 /* wait up to one minute */,
-                  "data",
-                  &expeditor,
-                  &data);
-     todo--;
-     free(data);
-
-     INFO3("Got Data from %s:%d (still %d to go)",
-          gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
-          todo);
+        gras_socket_my_port(mysock), todo);
+  while (todo > 0) {
+    gras_msg_wait(60 /* wait up to one minute */ ,
+                  "data", &expeditor, &data);
+    todo--;
+    free(data);
+
+    INFO3("Got Data from %s:%d (still %d to go)",
+          gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
+          todo);
 
   }
 
@@ -69,38 +68,39 @@ int receiver (int argc,char *argv[]) {
 
   gras_exit();
   return 0;
-} /* end_of_receiver */
+}                               /* end_of_receiver */
 
 /* **********************************************************************
  * Sender code
  * **********************************************************************/
 
-int sender (int argc,char *argv[]) {
+int sender(int argc, char *argv[])
+{
 
-  unsigned int iter; /* iterator */
-  char *data; /* data exchanged */
-  int datasize; /* size of message */
-  xbt_peer_t h; /* iterator */
+  unsigned int iter;            /* iterator */
+  char *data;                   /* data exchanged */
+  int datasize;                 /* size of message */
+  xbt_peer_t h;                 /* iterator */
   int connected = 0;
 
-  gras_socket_t peer=NULL;  /* socket to node */
+  gras_socket_t peer = NULL;    /* socket to node */
 
 
   /* xbt_dynar for peers */
-  xbt_dynar_t peers = xbt_dynar_new(sizeof(xbt_peer_t),&xbt_peer_free_voidp);
+  xbt_dynar_t peers = xbt_dynar_new(sizeof(xbt_peer_t), &xbt_peer_free_voidp);
 
   /* Init the GRAS infrastructure and declare my globals */
-  gras_init(&argc,argv);
+  gras_init(&argc, argv);
 
   /* Get the node location from argc/argv */
-  for (iter=1; iter<argc-1; iter++){
+  for (iter = 1; iter < argc - 1; iter++) {
     xbt_peer_t peer = xbt_peer_from_string(argv[iter]);
-    xbt_dynar_push(peers,&peer);
+    xbt_dynar_push(peers, &peer);
   }
 
-  datasize=atoi(argv[argc-1]);
+  datasize = atoi(argv[argc - 1]);
 
-  data=(char *) malloc(datasize+1);  // allocation of datasize octets
+  data = (char *) malloc(datasize + 1); // allocation of datasize octets
   memset(data, 32, datasize);
   data[datasize] = '\0';
 
@@ -111,28 +111,30 @@ int sender (int argc,char *argv[]) {
 
 
   /* write to the receivers */
-  xbt_dynar_foreach(peers,iter,h) {
-     connected = 0;
-     while (!connected) {
-       xbt_ex_t e;
-       TRY {
-          peer = gras_socket_client(h->name,h->port);
-          connected=1;
-       } CATCH(e) {
-          if (e.category != system_error /*in RL*/&& e.category != mismatch_error/*in SG*/)
-            RETHROW;
-          xbt_ex_free(e);
-          gras_os_sleep(0.01);
-       }
-     }
-     gras_msg_send(peer,"data",&data);
-     if (gras_if_SG()) {
-       INFO2("  Sent Data from %s to %s", gras_os_myname(),h->name);
-     } else {
-       INFO0("  Sent Data");
-     }
-
-     gras_socket_close(peer);
+  xbt_dynar_foreach(peers, iter, h) {
+    connected = 0;
+    while (!connected) {
+      xbt_ex_t e;
+      TRY {
+        peer = gras_socket_client(h->name, h->port);
+        connected = 1;
+      }
+      CATCH(e) {
+        if (e.category != system_error  /*in RL */
+            && e.category != mismatch_error /*in SG */ )
+          RETHROW;
+        xbt_ex_free(e);
+        gras_os_sleep(0.01);
+      }
+    }
+    gras_msg_send(peer, "data", &data);
+    if (gras_if_SG()) {
+      INFO2("  Sent Data from %s to %s", gras_os_myname(), h->name);
+    } else {
+      INFO0("  Sent Data");
+    }
+
+    gras_socket_close(peer);
   }
 
   /* Free the allocated resources, and shut GRAS down */
@@ -141,4 +143,4 @@ int sender (int argc,char *argv[]) {
 
   gras_exit();
   return 0;
-} /* end_of_sender */
+}                               /* end_of_sender */
index c703981..450508b 100644 (file)
 #include "gras.h"
 #include "xbt/log.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Chrono, "Messages specific to this example");
 
 
 /* Function prototypes */
-int multiplier (int argc,char *argv[]);
+int multiplier(int argc, char *argv[]);
 
-int multiplier (int argc,char *argv[])
+int multiplier(int argc, char *argv[])
 {
-  int i,j,k,l;
-  double *A,*B,*C;
+  int i, j, k, l;
+  double *A, *B, *C;
   int n = 100;
   double start = 0.0;
   double now = 0.0;
 
   gras_init(&argc, argv);
 
-  A = malloc(n*n*sizeof(double));
-  B = malloc(n*n*sizeof(double));
-  C = malloc(n*n*sizeof(double));
+  A = malloc(n * n * sizeof(double));
+  B = malloc(n * n * sizeof(double));
+  C = malloc(n * n * sizeof(double));
 
-  start=now=gras_os_time();
+  start = now = gras_os_time();
 
   INFO1("Begin matrix multiplication loop (time: %g)", start);
 
-  for(l=0; l<4; l++) {
-    now=gras_os_time();
+  for (l = 0; l < 4; l++) {
+    now = gras_os_time();
     GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
-    for(i=0; i<n; i++)
-      for(j=0; j<n; j++) {
-       A[i*n+j]=2/n;
-       B[i*n+j]=1/n;
-       C[i*n+j]=0.0;
+    for (i = 0; i < n; i++)
+      for (j = 0; j < n; j++) {
+        A[i * n + j] = 2 / n;
+        B[i * n + j] = 1 / n;
+        C[i * n + j] = 0.0;
       }
-    
-    for(i=0; i<n; i++)
-      for(j=0; j<n; j++)
-       for(k=0; k<n; k++)      
-         C[i*n+j] += A[i*n+k]*B[k*n+j];
-    
+
+    for (i = 0; i < n; i++)
+      for (j = 0; j < n; j++)
+        for (k = 0; k < n; k++)
+          C[i * n + j] += A[i * n + k] * B[k * n + j];
+
     GRAS_BENCH_ONCE_RUN_ONCE_END();
-    now=gras_os_time()-now;
+    now = gras_os_time() - now;
     INFO2("Iteration %d : %g ", l, now);
   }
 
-  now=gras_os_time()-start;
-  INFO2("End matrix multiplication loop (time: %g; Duration: %g)", gras_os_time(), now);
+  now = gras_os_time() - start;
+  INFO2("End matrix multiplication loop (time: %g; Duration: %g)",
+        gras_os_time(), now);
 
-  start=now=gras_os_time();
+  start = now = gras_os_time();
   INFO1("Begin malloc loop (time: %g)", start);
-  for(l=0; l<4; l++) {
-    now=gras_os_time();
+  for (l = 0; l < 4; l++) {
+    now = gras_os_time();
     GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
-     free(A);
-     A = malloc(n*n*sizeof(double));
+    free(A);
+    A = malloc(n * n * sizeof(double));
     GRAS_BENCH_ONCE_RUN_ONCE_END();
-    now=gras_os_time()-now;
+    now = gras_os_time() - now;
     INFO2("Iteration %d : %g ", l, now);
   }
-   
-  start=now=gras_os_time();
+
+  start = now = gras_os_time();
   INFO1("Begin integer incrementation loop (time: %g)", start);
-  for(l=0; l<4; l++) {
+  for (l = 0; l < 4; l++) {
     GRAS_BENCH_ONCE_RUN_ONCE_BEGIN();
     j++;
     GRAS_BENCH_ONCE_RUN_ONCE_END();
@@ -79,7 +80,7 @@ int multiplier (int argc,char *argv[])
   free(A);
   free(B);
   free(C);
-   
+
   gras_exit();
   return 0;
 }
index 781d05a..0daa525 100644 (file)
@@ -19,7 +19,7 @@
 void mmrpc_register_messages(void);
 
 /* Function prototypes */
-int server (int argc,char *argv[]);
-int client (int argc,char *argv[]);
+int server(int argc, char *argv[]);
+int client(int argc, char *argv[]);
 
 #endif /* MMRPC_H */
index 7a0e1fc..897959b 100644 (file)
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(MatMult);
 
-int client(int argc,char *argv[]) {
-  xbt_ex_t e; 
-  gras_socket_t toserver=NULL; /* peer */
+int client(int argc, char *argv[])
+{
+  xbt_ex_t e;
+  gras_socket_t toserver = NULL;        /* peer */
   int connected = 0;
 
   gras_socket_t from;
   xbt_matrix_t request[2], answer;
 
-  int i,j;
+  int i, j;
 
   const char *host = "127.0.0.1";
-        int   port = 4000;
+  int port = 4000;
 
   /* 1. Init the GRAS's infrastructure */
   gras_init(&argc, argv);
-   
+
   /* 2. Get the server's address. The command line override defaults when specified */
   if (argc == 3) {
-    host=argv[1];
-    port=atoi(argv[2]);
-  } 
+    host = argv[1];
+    port = atoi(argv[2]);
+  }
+
+  INFO2("Launch client (server on %s:%d)", host, port);
 
-  INFO2("Launch client (server on %s:%d)",host,port);
-   
   /* 3. Create a socket to speak to the server */
   while (!connected) {
-     TRY {
-       toserver=gras_socket_client(host,port);
-       connected=1;
-     } CATCH(e) {
-       if (e.category != system_error)
-         RETHROW0("Unable to connect to the server: %s");
-       xbt_ex_free(e);
-       gras_os_sleep(0.05);
-     }
+    TRY {
+      toserver = gras_socket_client(host, port);
+      connected = 1;
+    }
+    CATCH(e) {
+      if (e.category != system_error)
+        RETHROW0("Unable to connect to the server: %s");
+      xbt_ex_free(e);
+      gras_os_sleep(0.05);
+    }
   }
-  INFO2("Connected to %s:%d.",host,port);    
+  INFO2("Connected to %s:%d.", host, port);
 
 
   /* 4. Register the messages (before use) */
   mmrpc_register_messages();
 
   /* 5. Keep the user informed of what's going on */
-  INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<", 
-       gras_socket_peer_name(toserver),gras_socket_peer_port(toserver));
+  INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
+        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
 
   /* 6. Prepare and send the request to the server */
 
-  request[0] = xbt_matrix_double_new_id(MATSIZE,MATSIZE);
-  request[1] = xbt_matrix_double_new_rand(MATSIZE,MATSIZE);
+  request[0] = xbt_matrix_double_new_id(MATSIZE, MATSIZE);
+  request[1] = xbt_matrix_double_new_rand(MATSIZE, MATSIZE);
 
   /*
-  xbt_matrix_dump(request[0],"C:sent0",0,xbt_matrix_dump_display_double);
-  xbt_matrix_dump(request[1],"C:sent1",0,xbt_matrix_dump_display_double);
-  */
+     xbt_matrix_dump(request[0],"C:sent0",0,xbt_matrix_dump_display_double);
+     xbt_matrix_dump(request[1],"C:sent1",0,xbt_matrix_dump_display_double);
+   */
 
   gras_msg_send(toserver, "request", &request);
 
   xbt_matrix_free(request[0]);
 
   INFO2(">>>>>>>> Request sent to %s:%d <<<<<<<<",
-       gras_socket_peer_name(toserver),gras_socket_peer_port(toserver));
+        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
 
   /* 7. Wait for the answer from the server, and deal with issues */
-  gras_msg_wait(6000,"answer",&from,&answer);
+  gras_msg_wait(6000, "answer", &from, &answer);
 
   /*
-  xbt_matrix_dump(answer,"C:answer",0,xbt_matrix_dump_display_double);
-  */
-  for (i=0; i<MATSIZE; i++) 
-    for (j=0; i<MATSIZE; i++) 
-      xbt_assert4(xbt_matrix_get_as(answer,i,j,double)==xbt_matrix_get_as(request[1],i,j,double),
-                 "Answer does not match expectations. Found %f at cell %d,%d instead of %f",
-                 xbt_matrix_get_as(answer,i,j,double),i,j,
-                 xbt_matrix_get_as(request[1],i,j,double));
+     xbt_matrix_dump(answer,"C:answer",0,xbt_matrix_dump_display_double);
+   */
+  for (i = 0; i < MATSIZE; i++)
+    for (j = 0; i < MATSIZE; i++)
+      xbt_assert4(xbt_matrix_get_as(answer, i, j, double) ==
+                  xbt_matrix_get_as(request[1], i, j, double),
+                  "Answer does not match expectations. Found %f at cell %d,%d instead of %f",
+                  xbt_matrix_get_as(answer, i, j, double), i, j,
+                  xbt_matrix_get_as(request[1], i, j, double));
 
   /* 8. Keep the user informed of what's going on, again */
-  INFO2(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<", 
-       gras_socket_peer_name(from),gras_socket_peer_port(from));
+  INFO2(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
+        gras_socket_peer_name(from), gras_socket_peer_port(from));
 
   /* 9. Free the allocated resources, and shut GRAS down */
   xbt_matrix_free(request[1]);
@@ -99,4 +102,4 @@ int client(int argc,char *argv[]) {
   gras_socket_close(toserver);
   gras_exit();
   return 0;
-} /* end_of_client */
+}                               /* end_of_client */
index 41b3163..09df910 100644 (file)
@@ -9,19 +9,18 @@
 
 #include "mmrpc.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(MatMult,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(MatMult, "Messages specific to this example");
 
 /* register messages which may be sent and their payload
    (common to client and server) */
-void mmrpc_register_messages(void) {
+void mmrpc_register_messages(void)
+{
   gras_datadesc_type_t matrix_type, request_type;
 
-  matrix_type=gras_datadesc_matrix(gras_datadesc_by_name("double"),
-                                  NULL);
-  request_type=gras_datadesc_array_fixed("s_matrix_t(double)[2]",matrix_type,2);
-  
+  matrix_type = gras_datadesc_matrix(gras_datadesc_by_name("double"), NULL);
+  request_type =
+    gras_datadesc_array_fixed("s_matrix_t(double)[2]", matrix_type, 2);
+
   gras_msgtype_declare("answer", matrix_type);
   gras_msgtype_declare("request", request_type);
 }
-
-
index eacd9d2..ef24fab 100644 (file)
@@ -15,15 +15,16 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(MatMult);
 
 
 typedef xbt_matrix_t request_t[2];
-static int server_cb_request_handler(gras_msg_cb_ctx_t ctx, 
-                                    void *payload_data) {
+static int server_cb_request_handler(gras_msg_cb_ctx_t ctx,
+                                     void *payload_data)
+{
+
+  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
-  gras_socket_t expeditor=gras_msg_cb_ctx_from(ctx);
-                            
   /* 1. Get the payload into the data variable */
-  xbt_matrix_t *request = (xbt_matrix_t*)payload_data;
+  xbt_matrix_t *request = (xbt_matrix_t *) payload_data;
   xbt_matrix_t result;
-  
+
   /* 2. Do the computation */
   result = xbt_matrix_double_new_mult(request[0], request[1]);
 
@@ -34,43 +35,45 @@ static int server_cb_request_handler(gras_msg_cb_ctx_t ctx,
   xbt_matrix_free(request[0]);
   xbt_matrix_free(request[1]);
   xbt_matrix_free(result);
-   
+
   return 0;
-} /* end_of_server_cb_request_handler */
+}                               /* end_of_server_cb_request_handler */
 
-int server (int argc,char *argv[]) {
-  xbt_ex_t e; 
-  gras_socket_t sock=NULL;
+int server(int argc, char *argv[])
+{
+  xbt_ex_t e;
+  gras_socket_t sock = NULL;
   int port = 4000;
-  
+
   /* 1. Init the GRAS infrastructure */
-  gras_init(&argc,argv);
-   
+  gras_init(&argc, argv);
+
   /* 2. Get the port I should listen on from the command line, if specified */
   if (argc == 2) {
-    port=atoi(argv[1]);
+    port = atoi(argv[1]);
   }
 
   /* 3. Create my master socket */
   INFO1("Launch server (port=%d)", port);
   TRY {
     sock = gras_socket_server(port);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     RETHROW0("Unable to establish a server socket: %s");
   }
 
   /* 4. Register the known messages and payloads. */
   mmrpc_register_messages();
-   
+
   /* 5. Register my callback */
-  gras_cb_register("request",&server_cb_request_handler);
+  gras_cb_register("request", &server_cb_request_handler);
 
   /* 6. Wait up to 10 minutes for an incomming message to handle */
   gras_msg_handle(600.0);
-   
+
   /* 7. Free the allocated resources, and shut GRAS down */
   gras_socket_close(sock);
   gras_exit();
-   
+
   return 0;
-} /* end_of_server */
+}                               /* end_of_server */
index f0d8fcb..7960919 100644 (file)
@@ -8,16 +8,17 @@
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #include "gras.h"
+
 #define NBLOOPS 3
 /*#define NBLOOPS 30000*/
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(SimpleToken,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(SimpleToken,
+                             "Messages specific to this example");
 
 /* Function prototypes */
-int node (int argc,char *argv[]);
+int node(int argc, char *argv[]);
 
 
 /* **********************************************************************
@@ -26,135 +27,139 @@ int node (int argc,char *argv[]);
 
 /* Global private data */
 typedef struct {
-  gras_socket_t sock; /* server socket on which I hear */
-  int remaining_loop; /* number of loops to do until done */
-  int create;        /* whether I have to create the token */
-  gras_socket_t tosuccessor; /* how to connect to the successor on ring */
-  double start_time; /* to measure the elapsed time. Only used by the 
-                        node that creates the token */
+  gras_socket_t sock;           /* server socket on which I hear */
+  int remaining_loop;           /* number of loops to do until done */
+  int create;                   /* whether I have to create the token */
+  gras_socket_t tosuccessor;    /* how to connect to the successor on ring */
+  double start_time;            /* to measure the elapsed time. Only used by the 
+                                   node that creates the token */
 } node_data_t;
 
 
 /* Callback function */
-static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload) {
-  
+static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload)
+{
+
   xbt_ex_t e;
-  
+
   /* 1. Get the payload into the msg variable, and retrieve my caller */
-  int msg=*(int*)payload;
+  int msg = *(int *) payload;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
 
   /* 2. Retrieve the node's state (globals) */
-  node_data_t *globals=(node_data_t*)gras_userdata_get();
+  node_data_t *globals = (node_data_t *) gras_userdata_get();
+
   /* 3. Log which predecessor connected */
-  int supersteps = 1; /* only log every superstep loop */
+  int supersteps = 1;           /* only log every superstep loop */
   if (NBLOOPS >= 1000) {
     supersteps = 100;
   } else if (NBLOOPS >= 100) {
     supersteps = 10;
-  } else if (NBLOOPS <=10) {
+  } else if (NBLOOPS <= 10) {
     supersteps = 1;
   }
-  if (globals->create && (! (globals->remaining_loop % supersteps))) {
+  if (globals->create && (!(globals->remaining_loop % supersteps))) {
     INFO1("Begin a new loop. Still to do: %d", globals->remaining_loop);
-  } else if (! (globals->remaining_loop % supersteps)) {
-    VERB3("Got token(%d) from %s remaining_loop=%d", 
-         msg, gras_socket_peer_name(expeditor),globals->remaining_loop);
+  } else if (!(globals->remaining_loop % supersteps)) {
+    VERB3("Got token(%d) from %s remaining_loop=%d",
+          msg, gras_socket_peer_name(expeditor), globals->remaining_loop);
   }
-  
+
   /* 4. If the right shouldn't be stopped yet */
   if (globals->remaining_loop > 0) {
     msg += 1;
-     
-    DEBUG3("Send token(%d) to %s:%d", msg, 
-          gras_socket_peer_name(globals->tosuccessor),
-          gras_socket_peer_port(globals->tosuccessor));
-     
+
+    DEBUG3("Send token(%d) to %s:%d", msg,
+           gras_socket_peer_name(globals->tosuccessor),
+           gras_socket_peer_port(globals->tosuccessor));
+
     /* 5. Send the token as payload of a stoken message to the successor */
     TRY {
       gras_msg_send(globals->tosuccessor, "stoken", &msg);
-     
-    /* 6. Deal with errors */
-    } CATCH(e) {
+
+      /* 6. Deal with errors */
+    }
+    CATCH(e) {
       gras_socket_close(globals->sock);
       RETHROW0("Unable to forward token: %s");
     }
-  
+
   }
-             
+
   /* DO NOT CLOSE THE expeditor SOCKET since the client socket is
      reused by our predecessor.
      Closing this side would thus create troubles */
-  
+
   /* 7. Decrease the remaining_loop integer. */
   globals->remaining_loop -= 1;
-   
+
   /* 8. Repport the hop number to the user at the end */
   if (globals->remaining_loop == -1 && globals->create) {
-    double elapsed = gras_os_time() - globals->start_time; 
-    INFO1("Shut down the token-ring. There was %d hops.",msg);
+    double elapsed = gras_os_time() - globals->start_time;
+    INFO1("Shut down the token-ring. There was %d hops.", msg);
     VERB1("Elapsed time: %g", elapsed);
   }
 
   /* 9. Tell GRAS that we consummed this message */
   return 0;
-} /* end_of_node_cb_stoken_handler */
+}                               /* end_of_node_cb_stoken_handler */
 
-int node (int argc,char *argv[]) {
+int node(int argc, char *argv[])
+{
   node_data_t *globals;
-  
+
   const char *host;
-  int   myport;
-  int   peerport;
-    
+  int myport;
+  int peerport;
+
   xbt_ex_t e;
-  
+
   /* 1. Init the GRAS infrastructure and declare my globals */
-  gras_init(&argc,argv);
-  globals=gras_userdata_new(node_data_t);
-  
-  
+  gras_init(&argc, argv);
+  globals = gras_userdata_new(node_data_t);
+
+
   /* 2. Get the successor's address. The command line overrides
-        defaults when specified */
+     defaults when specified */
   host = "127.0.0.1";
   myport = 4000;
   peerport = 4000;
   if (argc >= 4) {
-    myport=atoi(argv[1]);
-    host=argv[2];
-    peerport=atoi(argv[3]);
+    myport = atoi(argv[1]);
+    host = argv[2];
+    peerport = atoi(argv[3]);
   }
 
   /* 3. Save successor's address in global var */
-  globals->remaining_loop=NBLOOPS;
+  globals->remaining_loop = NBLOOPS;
   globals->create = 0;
   globals->tosuccessor = NULL;
 
   if (!gras_os_getpid() % 100)
-  INFO4("Launch node %d (successor on %s:%d; listening on %d)",
-       gras_os_getpid(), host,peerport, myport);
+    INFO4("Launch node %d (successor on %s:%d; listening on %d)",
+          gras_os_getpid(), host, peerport, myport);
 
   /* 4. Register the known messages.  */
   gras_msgtype_declare("stoken", gras_datadesc_by_name("int"));
-   
+
   /* 5. Create my master socket for listening */
   globals->sock = gras_socket_server(myport);
-  gras_os_sleep(1.0); /* Make sure all server sockets are created */
-   
+  gras_os_sleep(1.0);           /* Make sure all server sockets are created */
+
   /* 6. Create socket to the successor on the ring */
-  DEBUG2("Connect to my successor on %s:%d",host,peerport);
+  DEBUG2("Connect to my successor on %s:%d", host, peerport);
+
+  globals->tosuccessor = gras_socket_client(host, peerport);
 
-  globals->tosuccessor = gras_socket_client(host,peerport);
-  
   /* 7. Register my callback */
-  gras_cb_register("stoken",&node_cb_stoken_handler);  
+  gras_cb_register("stoken", &node_cb_stoken_handler);
 
   /* 8. One node has to create the token at startup. 
-        It's specified by a command line argument */
-  if (argc >= 5 && !strncmp("--create-token", argv[4],strlen("--create-token")))
-    globals->create=1;
+     It's specified by a command line argument */
+  if (argc >= 5
+      && !strncmp("--create-token", argv[4], strlen("--create-token")))
+    globals->create = 1;
 
   if (globals->create) {
     int token = 0;
@@ -162,31 +167,31 @@ int node (int argc,char *argv[]) {
     globals->start_time = gras_os_time();
 
     globals->remaining_loop = NBLOOPS - 1;
-      
+
     INFO3("Create the token (with value %d) and send it to %s:%d",
-         token, host, peerport);
+          token, host, peerport);
 
-    TRY {        
+    TRY {
       gras_msg_send(globals->tosuccessor, "stoken", &token);
     } CATCH(e) {
       RETHROW0("Unable to send the freshly created token: %s");
     }
-  } 
-  
+  }
+
   /* 8. Wait up to 10 seconds for an incomming message to handle */
   while (globals->remaining_loop > (globals->create ? -1 : 0)) {
     gras_msg_handle(-1);
-  
+
     DEBUG1("looping (remaining_loop=%d)", globals->remaining_loop);
   }
 
-  gras_os_sleep(1.0); /* FIXME: if the sender quited, receive fail */
+  gras_os_sleep(1.0);           /* FIXME: if the sender quited, receive fail */
 
-  /* 9. Free the allocated resources, and shut GRAS down */ 
+  /* 9. Free the allocated resources, and shut GRAS down */
   gras_socket_close(globals->sock);
   gras_socket_close(globals->tosuccessor);
   free(globals);
   gras_exit();
-  
+
   return 0;
-} /* end_of_node */
+}                               /* end_of_node */
index a5a7b2c..af20392 100644 (file)
@@ -16,7 +16,7 @@
 void ping_register_messages(void);
 
 /* Function prototypes */
-int server (int argc,char *argv[]);
-int client (int argc,char *argv[]);
+int server(int argc, char *argv[]);
+int client(int argc, char *argv[]);
 
 #endif
index 2482ee5..2b286e3 100644 (file)
 #include "ping.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping);
 
-int client(int argc,char *argv[]) {
+int client(int argc, char *argv[])
+{
   xbt_ex_t e;
-  gras_socket_t toserver=NULL; /* peer */
+  gras_socket_t toserver = NULL;        /* peer */
   int connected = 0;
 
   gras_socket_t from;
   int ping, pong;
 
   const char *host = "127.0.0.1";
-        int   port = 4000;
+  int port = 4000;
 
   /* 1. Init the GRAS's infrastructure */
   gras_init(&argc, argv);
 
   /* 2. Get the server's address. The command line override defaults when specified */
   if (argc == 3) {
-    host=argv[1];
-    port=atoi(argv[2]);
+    host = argv[1];
+    port = atoi(argv[2]);
   }
 
-  INFO2("Launch client (server on %s:%d)",host,port);
+  INFO2("Launch client (server on %s:%d)", host, port);
 
   /* 3. Create a socket to speak to the server */
   while (!connected) {
-     TRY {
-       toserver=gras_socket_client(host,port);
-       connected = 1;
-     } CATCH(e) {
-       if (e.category != system_error)
-         /* dunno what happened, let the exception go through */
-         RETHROW0("Unable to connect to the server: %s");
-       xbt_ex_free(e);
-       gras_os_sleep(0.05);
-     }
+    TRY {
+      toserver = gras_socket_client(host, port);
+      connected = 1;
+    }
+    CATCH(e) {
+      if (e.category != system_error)
+        /* dunno what happened, let the exception go through */
+        RETHROW0("Unable to connect to the server: %s");
+      xbt_ex_free(e);
+      gras_os_sleep(0.05);
+    }
   }
 
-  INFO2("Connected to %s:%d.",host,port);
+  INFO2("Connected to %s:%d.", host, port);
 
   /* 4. Register the messages.
-        See, it doesn't have to be done completely at the beginning, only before use */
+     See, it doesn't have to be done completely at the beginning, only before use */
   ping_register_messages();
 
   /* 5. Keep the user informed of what's going on */
   INFO2(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
-       gras_socket_peer_name(toserver),gras_socket_peer_port(toserver));
+        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
 
   /* 6. Prepare and send the ping message to the server */
   ping = 1234;
   TRY {
     gras_msg_send(toserver, "ping", &ping);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     gras_socket_close(toserver);
     RETHROW0("Failed to send PING to server: %s");
   }
   INFO3(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
-       ping,
-       gras_socket_peer_name(toserver),gras_socket_peer_port(toserver));
+        ping,
+        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
 
   /* 7. Wait for the answer from the server, and deal with issues */
   TRY {
-    gras_msg_wait(6000,"pong", &from,&pong);
-  } CATCH(e) {
+    gras_msg_wait(6000, "pong", &from, &pong);
+  }
+  CATCH(e) {
     gras_socket_close(toserver);
     RETHROW0("Why can't I get my PONG message like everyone else: %s");
   }
 
   /* 8. Keep the user informed of what's going on, again */
   INFO3(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
-       pong,
-       gras_socket_peer_name(from),gras_socket_peer_port(from));
+        pong, gras_socket_peer_name(from), gras_socket_peer_port(from));
 
   /* 9. Free the allocated resources, and shut GRAS down */
   gras_socket_close(toserver);
   INFO0("Done.");
   gras_exit();
   return 0;
-} /* end_of_client */
+}                               /* end_of_client */
index eeb095c..f03154b 100644 (file)
@@ -8,12 +8,12 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "ping.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(Ping,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Ping, "Messages specific to this example");
 
 /* register messages which may be sent (common to client and server) */
-void ping_register_messages(void) {
+void ping_register_messages(void)
+{
   gras_msgtype_declare("ping", gras_datadesc_by_name("int"));
   gras_msgtype_declare("pong", gras_datadesc_by_name("int"));
   INFO0("Messages registered");
 }
-
index 3e8b95b..09c70c4 100644 (file)
@@ -18,56 +18,58 @@ typedef struct {
 } server_data_t;
 
 
-static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) {
-                            
+static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
+{
+
   xbt_ex_t e;
   /* 1. Get the payload into the msg variable, and retrieve my caller */
-  int msg=*(int*)payload;
+  int msg = *(int *) payload;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   /* 2. Retrieve the server's state (globals) */
 
-  server_data_t *globals=(server_data_t*)gras_userdata_get();
+  server_data_t *globals = (server_data_t *) gras_userdata_get();
   globals->endcondition = 0;
-   
+
   /* 3. Log which client connected */
-  INFO3(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<", 
-       msg, 
-       gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
-  
+  INFO3(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
+        msg,
+        gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
+
   /* 4. Change the value of the msg variable */
   msg = 4321;
   /* 5. Send it back as payload of a pong message to the expeditor */
   TRY {
     gras_msg_send(expeditor, "pong", &msg);
 
-  /* 6. Deal with errors: add some details to the exception */
+    /* 6. Deal with errors: add some details to the exception */
   } CATCH(e) {
     gras_socket_close(globals->sock);
     RETHROW0("Unable answer with PONG: %s");
   }
 
   INFO0(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
-   
+
   /* 7. Set the endcondition boolean to true (and make sure the server stops after receiving it). */
   globals->endcondition = 1;
-     
+
   /* 8. Tell GRAS that we consummed this message */
   return 0;
-} /* end_of_server_cb_ping_handler */
+}                               /* end_of_server_cb_ping_handler */
 
-int server (int argc,char *argv[]) {
+int server(int argc, char *argv[])
+{
   server_data_t *globals;
 
   int port = 4000;
-  
+
   /* 1. Init the GRAS infrastructure and declare my globals */
-  gras_init(&argc,argv);
-  globals=gras_userdata_new(server_data_t);
-   
+  gras_init(&argc, argv);
+  globals = gras_userdata_new(server_data_t);
+
   /* 2. Get the port I should listen on from the command line, if specified */
   if (argc == 2) {
-    port=atoi(argv[1]);
+    port = atoi(argv[1]);
   }
 
   INFO1("Launch server (port=%d)", port);
@@ -76,28 +78,29 @@ int server (int argc,char *argv[]) {
   globals->sock = gras_socket_server(port);
 
   /* 4. Register the known messages. This function is called twice here, but it's because
-        this file also acts as regression test, no need to do so yourself of course. */
+     this file also acts as regression test, no need to do so yourself of course. */
   ping_register_messages();
-  ping_register_messages(); /* just to make sure it works ;) */
-   
+  ping_register_messages();     /* just to make sure it works ;) */
+
   /* 5. Register my callback */
-  gras_cb_register("ping",&server_cb_ping_handler);
+  gras_cb_register("ping", &server_cb_ping_handler);
 
-  INFO1(">>>>>>>> Listening on port %d <<<<<<<<", gras_socket_my_port(globals->sock));
-  globals->endcondition=0;
+  INFO1(">>>>>>>> Listening on port %d <<<<<<<<",
+        gras_socket_my_port(globals->sock));
+  globals->endcondition = 0;
 
   /* 6. Wait up to 10 minutes for an incomming message to handle */
   gras_msg_handle(10.0);
-   
+
   /* 7. Housekeeping */
   if (!globals->endcondition)
-     WARN0("An error occured, the endcondition was not set by the callback");
-  
+    WARN0("An error occured, the endcondition was not set by the callback");
+
   /* 8. Free the allocated resources, and shut GRAS down */
   gras_socket_close(globals->sock);
   free(globals);
   INFO0("Done.");
   gras_exit();
-   
+
   return 0;
-} /* end_of_server */
+}                               /* end_of_server */
index 408b70d..a09c143 100755 (executable)
 #define SLAVE_COUNT (PROC_MATRIX_SIZE*PROC_MATRIX_SIZE)
 
 #define DATA_MATRIX_SIZE 18
-const int submatrix_size = DATA_MATRIX_SIZE/PROC_MATRIX_SIZE;
+const int submatrix_size = DATA_MATRIX_SIZE / PROC_MATRIX_SIZE;
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(pmm,"Parallel Matrix Multiplication");
+XBT_LOG_NEW_DEFAULT_CATEGORY(pmm, "Parallel Matrix Multiplication");
 
 /* struct for recovering results */
-GRAS_DEFINE_TYPE(s_result,struct s_result {
-  int linepos;
-  int rowpos;
-  xbt_matrix_t C GRAS_ANNOTE(subtype,double);
-});
+GRAS_DEFINE_TYPE(s_result, struct s_result {
+                 int linepos; int rowpos;
+                 xbt_matrix_t C GRAS_ANNOTE(subtype, double);
+                 });
+
 typedef struct s_result result_t;
 
 /* struct to send initial data to slave */
-GRAS_DEFINE_TYPE(s_pmm_assignment,struct s_pmm_assignment {
-  int linepos;
-  int rowpos;
-  xbt_peer_t line[NEIGHBOR_COUNT];
-  xbt_peer_t row[NEIGHBOR_COUNT];
-  xbt_matrix_t A GRAS_ANNOTE(subtype,double);
-  xbt_matrix_t B GRAS_ANNOTE(subtype,double);
-});
+GRAS_DEFINE_TYPE(s_pmm_assignment, struct s_pmm_assignment {
+                 int linepos;
+                 int rowpos;
+                 xbt_peer_t line[NEIGHBOR_COUNT];
+                 xbt_peer_t row[NEIGHBOR_COUNT];
+                 xbt_matrix_t A GRAS_ANNOTE(subtype, double);
+                 xbt_matrix_t B GRAS_ANNOTE(subtype, double);
+                 });
+
 typedef struct s_pmm_assignment s_pmm_assignment_t;
 
 /* register messages which may be sent (common to client and server) */
-static void register_messages(void) {
+static void register_messages(void)
+{
   gras_datadesc_type_t result_type;
   gras_datadesc_type_t pmm_assignment_type;
 
-  gras_datadesc_set_const("NEIGHBOR_COUNT",NEIGHBOR_COUNT);
-  result_type=gras_datadesc_by_symbol(s_result);
-  pmm_assignment_type=gras_datadesc_by_symbol(s_pmm_assignment);
-       
+  gras_datadesc_set_const("NEIGHBOR_COUNT", NEIGHBOR_COUNT);
+  result_type = gras_datadesc_by_symbol(s_result);
+  pmm_assignment_type = gras_datadesc_by_symbol(s_pmm_assignment);
+
   /* receive a final result from slave */
   gras_msgtype_declare("result", result_type);
 
@@ -54,13 +56,17 @@ static void register_messages(void) {
   gras_msgtype_declare("pmm_slave", pmm_assignment_type);
 
   /* send data between slaves */
-  gras_msgtype_declare("dataA", gras_datadesc_matrix(gras_datadesc_by_name("double"),NULL));
-  gras_msgtype_declare("dataB", gras_datadesc_matrix(gras_datadesc_by_name("double"),NULL));
+  gras_msgtype_declare("dataA",
+                       gras_datadesc_matrix(gras_datadesc_by_name("double"),
+                                            NULL));
+  gras_msgtype_declare("dataB",
+                       gras_datadesc_matrix(gras_datadesc_by_name("double"),
+                                            NULL));
 }
 
 /* Function prototypes */
-int slave (int argc,char *argv[]);
-int master (int argc,char *argv[]);
+int slave(int argc, char *argv[]);
+int master(int argc, char *argv[]);
 
 
 /* **********************************************************************
@@ -69,106 +75,104 @@ int master (int argc,char *argv[]);
 
 /* Global private data */
 typedef struct {
-  int nbr_row,nbr_line;
+  int nbr_row, nbr_line;
   int remaining_step;
   int remaining_ack;
 } master_data_t;
 
 
-int master (int argc,char *argv[]) {
+int master(int argc, char *argv[])
+{
 
   int i;
 
-  xbt_matrix_t A,B,C;
+  xbt_matrix_t A, B, C;
   result_t result;
 
   gras_socket_t from;
 
-  xbt_dynar_t peers; /* group of slaves */
+  xbt_dynar_t peers;            /* group of slaves */
   xbt_peer_t grid[SLAVE_COUNT]; /* The slaves as an array */
-  gras_socket_t socket[SLAVE_COUNT]; /* sockets for brodcast to slaves */
+  gras_socket_t socket[SLAVE_COUNT];    /* sockets for brodcast to slaves */
 
   /* Init the GRAS's infrastructure */
   gras_init(&argc, argv);
   amok_pm_init();
   register_messages();
-      
+
   /* Initialize data matrices */
-  A = xbt_matrix_double_new_id(DATA_MATRIX_SIZE,DATA_MATRIX_SIZE);
-  B = xbt_matrix_double_new_seq(DATA_MATRIX_SIZE,DATA_MATRIX_SIZE);
-  C = xbt_matrix_double_new_zeros(DATA_MATRIX_SIZE,DATA_MATRIX_SIZE);
-       
+  A = xbt_matrix_double_new_id(DATA_MATRIX_SIZE, DATA_MATRIX_SIZE);
+  B = xbt_matrix_double_new_seq(DATA_MATRIX_SIZE, DATA_MATRIX_SIZE);
+  C = xbt_matrix_double_new_zeros(DATA_MATRIX_SIZE, DATA_MATRIX_SIZE);
+
   /* Create the connexions */
-  xbt_assert0(argc>1, "Usage: master <port>");
+  xbt_assert0(argc > 1, "Usage: master <port>");
   gras_socket_server(atoi(argv[1]));
-  peers=amok_pm_group_new("pmm");
-   
+  peers = amok_pm_group_new("pmm");
+
   /* friends, we're ready. Come and play */
   INFO0("Wait for peers for 5 sec");
   gras_msg_handleall(5);
-  INFO1("Got %ld pals",xbt_dynar_length(peers));
+  INFO1("Got %ld pals", xbt_dynar_length(peers));
 
-  for (i=0;
-       i<xbt_dynar_length(peers) && i<SLAVE_COUNT;
-       i++) {
+  for (i = 0; i < xbt_dynar_length(peers) && i < SLAVE_COUNT; i++) {
 
-    xbt_dynar_get_cpy(peers,i,&grid[i]);
-    socket[i]=gras_socket_client(grid[i]->name,grid[i]->port);
+    xbt_dynar_get_cpy(peers, i, &grid[i]);
+    socket[i] = gras_socket_client(grid[i]->name, grid[i]->port);
   }
-  xbt_assert2(i==SLAVE_COUNT,
-             "Not enough slaves for this setting (got %d of %d). Change the deployment file",
-             i,SLAVE_COUNT);
+  xbt_assert2(i == SLAVE_COUNT,
+              "Not enough slaves for this setting (got %d of %d). Change the deployment file",
+              i, SLAVE_COUNT);
 
   /* Kill surnumerous slaves */
-  for (i=SLAVE_COUNT; i<xbt_dynar_length(peers); ) {
+  for (i = SLAVE_COUNT; i < xbt_dynar_length(peers);) {
     xbt_peer_t h;
 
-    xbt_dynar_remove_at(peers,i,&h);
+    xbt_dynar_remove_at(peers, i, &h);
     INFO2("Too much slaves. Killing %s:%d", h->name, h->port);
-    amok_pm_kill_hp(h->name,h->port);
+    amok_pm_kill_hp(h->name, h->port);
     free(h);
   }
 
 
   /* Assign job to slaves */
-  int row=0, line=0;
+  int row = 0, line = 0;
   INFO0("XXXXXXXXXXXXXXXXXXXXXX begin Multiplication");
-  for(i=0 ; i<SLAVE_COUNT; i++){
+  for (i = 0; i < SLAVE_COUNT; i++) {
     s_pmm_assignment_t assignment;
-    int j,k;
+    int j, k;
 
-    assignment.linepos=line; // assigned line
-    assignment.rowpos=row;   // assigned row
+    assignment.linepos = line;  // assigned line
+    assignment.rowpos = row;    // assigned row
 
     /* Neiborhood */
-    for (j=0,k=0; j<PROC_MATRIX_SIZE; j++) {
-      if (i != j*PROC_MATRIX_SIZE+(row)) {         
-        assignment.row[k] = grid[ j*PROC_MATRIX_SIZE+(row) ] ;
-        k++;
+    for (j = 0, k = 0; j < PROC_MATRIX_SIZE; j++) {
+      if (i != j * PROC_MATRIX_SIZE + (row)) {
+        assignment.row[k] = grid[j * PROC_MATRIX_SIZE + (row)];
+        k++;
       }
     }
-    for (j=0,k=0; j<PROC_MATRIX_SIZE; j++) {
-      if (i != (line)*PROC_MATRIX_SIZE+j) {        
-        assignment.line[k] =  grid[ (line)*PROC_MATRIX_SIZE+j ] ;
-        k++;
+    for (j = 0, k = 0; j < PROC_MATRIX_SIZE; j++) {
+      if (i != (line) * PROC_MATRIX_SIZE + j) {
+        assignment.line[k] = grid[(line) * PROC_MATRIX_SIZE + j];
+        k++;
       }
     }
 
-    assignment.A=xbt_matrix_new_sub(A,
-                                   submatrix_size,submatrix_size,
-                                   submatrix_size*line,submatrix_size*row,
-                                   NULL);
-    assignment.B=xbt_matrix_new_sub(B,
-                                   submatrix_size,submatrix_size,
-                                   submatrix_size*line,submatrix_size*row,
-                                   NULL);
+    assignment.A = xbt_matrix_new_sub(A,
+                                      submatrix_size, submatrix_size,
+                                      submatrix_size * line,
+                                      submatrix_size * row, NULL);
+    assignment.B =
+      xbt_matrix_new_sub(B, submatrix_size, submatrix_size,
+                         submatrix_size * line, submatrix_size * row, NULL);
     row++;
     if (row >= PROC_MATRIX_SIZE) {
-      row=0;
+      row = 0;
       line++;
     }
-               
-    gras_msg_send(socket[i],"pmm_slave",&assignment);
+
+    gras_msg_send(socket[i], "pmm_slave", &assignment);
     xbt_matrix_free(assignment.A);
     xbt_matrix_free(assignment.B);
   }
@@ -176,157 +180,157 @@ int master (int argc,char *argv[]) {
   /* (have a rest while the slave perform the multiplication) */
 
   /* Retrieve the results */
-  for( i=0;i< SLAVE_COUNT;i++){
-    gras_msg_wait(6000,"result",&from,&result);
-    VERB2("%d slaves are done already. Waiting for %d",i+1, SLAVE_COUNT);
-    xbt_matrix_copy_values(C,result.C,   submatrix_size,submatrix_size,
-                          submatrix_size*result.linepos,
-                          submatrix_size*result.rowpos,
-                          0,0,NULL);
+  for (i = 0; i < SLAVE_COUNT; i++) {
+    gras_msg_wait(6000, "result", &from, &result);
+    VERB2("%d slaves are done already. Waiting for %d", i + 1, SLAVE_COUNT);
+    xbt_matrix_copy_values(C, result.C, submatrix_size, submatrix_size,
+                           submatrix_size * result.linepos,
+                           submatrix_size * result.rowpos, 0, 0, NULL);
     xbt_matrix_free(result.C);
   }
   /*    end of gather   */
 
   if (DATA_MATRIX_SIZE < 30) {
-     INFO0 ("The Result of Multiplication is :");
-     xbt_matrix_dump(C,"C:res",0,xbt_matrix_dump_display_double);
+    INFO0("The Result of Multiplication is :");
+    xbt_matrix_dump(C, "C:res", 0, xbt_matrix_dump_display_double);
   } else {
-     INFO1("Matrix size too big (%d>30) to be displayed here",DATA_MATRIX_SIZE);
+    INFO1("Matrix size too big (%d>30) to be displayed here",
+          DATA_MATRIX_SIZE);
   }
 
-  amok_pm_group_shutdown ("pmm");   /* Ok, we're out of here */
+  amok_pm_group_shutdown("pmm");        /* Ok, we're out of here */
 
-  for(i=0; i<SLAVE_COUNT; i++) {
-     gras_socket_close(socket[i]);
+  for (i = 0; i < SLAVE_COUNT; i++) {
+    gras_socket_close(socket[i]);
   }
-   
+
   xbt_matrix_free(A);
   xbt_matrix_free(B);
   xbt_matrix_free(C);
   gras_exit();
   return 0;
-} /* end_of_master */
+}                               /* end_of_master */
 
 /* **********************************************************************
  * slave code
  * **********************************************************************/
 
-static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload) {
-  /* Recover my initialized Data and My Position*/
-  s_pmm_assignment_t assignment = *(s_pmm_assignment_t*)payload;
+static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  /* Recover my initialized Data and My Position */
+  s_pmm_assignment_t assignment = *(s_pmm_assignment_t *) payload;
   gras_socket_t master = gras_msg_cb_ctx_from(ctx);
 
-  xbt_ex_t e; 
+  xbt_ex_t e;
+
+  int step, l;
+  xbt_matrix_t bA = xbt_matrix_new(submatrix_size, submatrix_size,
+                                   sizeof(double), NULL);
+  xbt_matrix_t bB = xbt_matrix_new(submatrix_size, submatrix_size,
+                                   sizeof(double), NULL);
 
-  int step,l;
-  xbt_matrix_t bA=xbt_matrix_new(submatrix_size,submatrix_size,
-                                sizeof(double),NULL);
-  xbt_matrix_t bB=xbt_matrix_new(submatrix_size,submatrix_size,
-                                sizeof(double),NULL);
+  int myline, myrow;
+  xbt_matrix_t mydataA, mydataB;
+  xbt_matrix_t bC =
+    xbt_matrix_double_new_zeros(submatrix_size, submatrix_size);
 
-  int myline,myrow;
-  xbt_matrix_t mydataA,mydataB;
-  xbt_matrix_t bC=xbt_matrix_double_new_zeros(submatrix_size,submatrix_size);
-  
   result_t result;
-  gras_socket_t from;  /* to exchange data with my neighbor */
+
+  gras_socket_t from;           /* to exchange data with my neighbor */
 
   /* sockets for brodcast to other slave */
-  gras_socket_t socket_line[PROC_MATRIX_SIZE-1];
-  gras_socket_t socket_row[PROC_MATRIX_SIZE-1];
-  memset(socket_line,0,sizeof(socket_line));
-  memset(socket_row,0,sizeof(socket_row));
-   
+  gras_socket_t socket_line[PROC_MATRIX_SIZE - 1];
+  gras_socket_t socket_row[PROC_MATRIX_SIZE - 1];
+  memset(socket_line, 0, sizeof(socket_line));
+  memset(socket_row, 0, sizeof(socket_row));
+
   int i;
 
-  gras_os_sleep(1); /* wait for my pals */
+  gras_os_sleep(1);             /* wait for my pals */
 
-  myline  = assignment.linepos;
-  myrow   = assignment.rowpos;
+  myline = assignment.linepos;
+  myrow = assignment.rowpos;
   mydataA = assignment.A;
   mydataB = assignment.B;
 
-  INFO2("Receive my pos (%d,%d) and assignment",myline,myrow);
+  INFO2("Receive my pos (%d,%d) and assignment", myline, myrow);
 
   /* Get my neighborhood from the assignment message (skipping myself) */
-  for (i=0 ; i<PROC_MATRIX_SIZE-1 ; i++){
-    socket_line[i]=gras_socket_client(assignment.line[i]->name,
-                                     assignment.line[i]->port);
+  for (i = 0; i < PROC_MATRIX_SIZE - 1; i++) {
+    socket_line[i] = gras_socket_client(assignment.line[i]->name,
+                                        assignment.line[i]->port);
     xbt_peer_free(assignment.line[i]);
   }
-  for (i=0 ; i<PROC_MATRIX_SIZE-1 ; i++){
-    socket_row[i]=gras_socket_client(assignment.row[i]->name,
-                                    assignment.row[i]->port);
-    xbt_peer_free(assignment.row[i]);    
+  for (i = 0; i < PROC_MATRIX_SIZE - 1; i++) {
+    socket_row[i] = gras_socket_client(assignment.row[i]->name,
+                                       assignment.row[i]->port);
+    xbt_peer_free(assignment.row[i]);
   }
 
-  for (step=0; step<PROC_MATRIX_SIZE;step++) {
-       
+  for (step = 0; step < PROC_MATRIX_SIZE; step++) {
+
     /* a line brodcast */
-    if(myline==step){
-       INFO2("LINE: step(%d) = Myline(%d). Broadcast my data.",
-            step,myline);
-       for (l=0;l < PROC_MATRIX_SIZE-1 ;l++) {
-         INFO1("LINE:   Send to %s",
-               gras_socket_peer_name(socket_row[l]));
-        gras_msg_send(socket_row[l], "dataB", &mydataB);
-       }
-       
-       
-       xbt_matrix_free(bB);
-       bB = xbt_matrix_new_sub(mydataB,
-                              submatrix_size,submatrix_size,
-                              0,0,NULL);       
+    if (myline == step) {
+      INFO2("LINE: step(%d) = Myline(%d). Broadcast my data.", step, myline);
+      for (l = 0; l < PROC_MATRIX_SIZE - 1; l++) {
+        INFO1("LINE:   Send to %s", gras_socket_peer_name(socket_row[l]));
+        gras_msg_send(socket_row[l], "dataB", &mydataB);
+      }
+
+
+      xbt_matrix_free(bB);
+      bB = xbt_matrix_new_sub(mydataB,
+                              submatrix_size, submatrix_size, 0, 0, NULL);
     } else {
       TRY {
-       xbt_matrix_free(bB);
-       gras_msg_wait(600,"dataB",&from,&bB);
-      } CATCH(e) {
-       RETHROW0("Can't get a data message from line : %s");
+        xbt_matrix_free(bB);
+        gras_msg_wait(600, "dataB", &from, &bB);
       }
-      INFO3("LINE: step(%d) <> Myline(%d). Receive data from %s",step,myline,
-           gras_socket_peer_name(from));
+      CATCH(e) {
+        RETHROW0("Can't get a data message from line : %s");
+      }
+      INFO3("LINE: step(%d) <> Myline(%d). Receive data from %s", step,
+            myline, gras_socket_peer_name(from));
     }
 
     /* a row brodcast */
-    if (myrow==step) { 
-       INFO2("ROW: step(%d)=myrow(%d). Broadcast my data.",step,myrow);
-       for (l=1;l < PROC_MATRIX_SIZE ; l++) {
-         INFO1("ROW:   Send to %s",
-               gras_socket_peer_name(socket_line[l-1]));
-         gras_msg_send(socket_line[l-1],"dataA", &mydataA);
-       }
-       xbt_matrix_free(bA);
-       bA = xbt_matrix_new_sub(mydataA,
-                              submatrix_size,submatrix_size,
-                              0,0,NULL);
+    if (myrow == step) {
+      INFO2("ROW: step(%d)=myrow(%d). Broadcast my data.", step, myrow);
+      for (l = 1; l < PROC_MATRIX_SIZE; l++) {
+        INFO1("ROW:   Send to %s", gras_socket_peer_name(socket_line[l - 1]));
+        gras_msg_send(socket_line[l - 1], "dataA", &mydataA);
+      }
+      xbt_matrix_free(bA);
+      bA = xbt_matrix_new_sub(mydataA,
+                              submatrix_size, submatrix_size, 0, 0, NULL);
     } else {
       TRY {
-       xbt_matrix_free(bA);
-       gras_msg_wait(1200,"dataA", &from,&bA);
-      } CATCH(e) {
-       RETHROW0("Can't get a data message from row : %s");
+        xbt_matrix_free(bA);
+        gras_msg_wait(1200, "dataA", &from, &bA);
+      }
+      CATCH(e) {
+        RETHROW0("Can't get a data message from row : %s");
       }
-      INFO3("ROW: step(%d)<>myrow(%d). Receive data from %s",step,myrow,
-           gras_socket_peer_name(from));
+      INFO3("ROW: step(%d)<>myrow(%d). Receive data from %s", step, myrow,
+            gras_socket_peer_name(from));
     }
-    xbt_matrix_double_addmult(bA,bB,bC);
+    xbt_matrix_double_addmult(bA, bB, bC);
 
   };
-  /* send Result to master */  
-  result.C=bC;
-  result.linepos=myline;
-  result.rowpos=myrow;
+
+  /* send Result to master */
+  result.C = bC;
+  result.linepos = myline;
+  result.rowpos = myrow;
 
   TRY {
-    gras_msg_send(master, "result",&result);
-  } CATCH(e) {
+    gras_msg_send(master, "result", &result);
+  }
+  CATCH(e) {
     RETHROW0("Failed to send answer to server: %s");
   }
   INFO2(">>>>>>>> Result sent to %s:%d <<<<<<<<",
-       gras_socket_peer_name(master),gras_socket_peer_port(master));
+        gras_socket_peer_name(master), gras_socket_peer_port(master));
   /*  Free the allocated resources, and shut GRAS down */
 
   xbt_matrix_free(bA);
@@ -336,19 +340,20 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload) {
   xbt_matrix_free(mydataA);
   xbt_matrix_free(mydataB);
   /* FIXME: some are said to be unknown 
-  gras_socket_close(master);
-  gras_socket_close(from);
-  for (l=0; l < PROC_MATRIX_SIZE-1; l++) {
+     gras_socket_close(master);
+     gras_socket_close(from);
+     for (l=0; l < PROC_MATRIX_SIZE-1; l++) {
      if (socket_line[l])
-       gras_socket_close(socket_line[l]);
+     gras_socket_close(socket_line[l]);
      if (socket_row[l])
-       gras_socket_close(socket_row[l]); 
-  }*/
+     gras_socket_close(socket_row[l]); 
+     } */
 
   return 0;
 }
 
-int slave(int argc,char *argv[]) {
+int slave(int argc, char *argv[])
+{
   gras_socket_t mysock;
   gras_socket_t master = NULL;
   int connected = 0;
@@ -357,35 +362,36 @@ int slave(int argc,char *argv[]) {
   /* Init the GRAS's infrastructure */
   gras_init(&argc, argv);
   amok_pm_init();
-  if (argc != 3 && argc !=2)
-     xbt_die("Usage: slave masterhost:masterport [rank]");
-  if (argc == 2) 
-     rank = -1;
-  else 
-     rank = atoi(argv[2]);
+  if (argc != 3 && argc != 2)
+    xbt_die("Usage: slave masterhost:masterport [rank]");
+  if (argc == 2)
+    rank = -1;
+  else
+    rank = atoi(argv[2]);
 
   /*  Register the known messages and my callback */
   register_messages();
-  gras_cb_register("pmm_slave",pmm_worker_cb);
+  gras_cb_register("pmm_slave", pmm_worker_cb);
 
   /* Create the connexions */
-  mysock = gras_socket_server_range(3000,9999,0,0);
-  INFO1("Sensor %d starting",rank);
-  while (!connected) { 
-     xbt_ex_t e;
-     TRY {       
-       master = gras_socket_client_from_string(argv[1]);
-       connected = 1;
-     } CATCH(e) {
-       if (e.category != system_error)
-         RETHROW;
-       xbt_ex_free(e);
-       gras_os_sleep(0.5);
-     }
+  mysock = gras_socket_server_range(3000, 9999, 0, 0);
+  INFO1("Sensor %d starting", rank);
+  while (!connected) {
+    xbt_ex_t e;
+    TRY {
+      master = gras_socket_client_from_string(argv[1]);
+      connected = 1;
+    }
+    CATCH(e) {
+      if (e.category != system_error)
+        RETHROW;
+      xbt_ex_free(e);
+      gras_os_sleep(0.5);
+    }
   }
-                               
+
   /* Join and run the group */
-  amok_pm_group_join(master,"pmm",rank);
+  amok_pm_group_join(master, "pmm", rank);
   amok_pm_mainloop(600);
 
   /* housekeeping */
@@ -393,4 +399,4 @@ int slave(int argc,char *argv[]) {
   //  gras_socket_close(master); Unknown
   gras_exit();
   return 0;
-} /* end_of_slave */
+}                               /* end_of_slave */
index 732d0cc..2d70f33 100644 (file)
@@ -2,77 +2,84 @@
 
 #include "gras.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Simple Property example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Simple Property example");
 
 int alice(int argc, char *argv[]);
 int bob(int argc, char *argv[]);
 
-int alice(int argc, char *argv[]) {
-  gras_init(&argc,argv);
+int alice(int argc, char *argv[])
+{
+  gras_init(&argc, argv);
 
   /* Get the properties */
   xbt_dict_t process_props = gras_process_properties();
   xbt_dict_t host_props = gras_os_host_properties();
 
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key, *data;
   const char *value;
 
   /* Let the other process change the host props */
-  gras_os_sleep(1); 
-   
+  gras_os_sleep(1);
+
   INFO0("== Dump all the properties of current host");
-  xbt_dict_foreach(host_props,cursor,key,data)
-       INFO2("  Host property: '%s' has value: '%s'",key,data);
+  xbt_dict_foreach(host_props, cursor, key, data)
+    INFO2("  Host property: '%s' has value: '%s'", key, data);
 
   INFO0("== Dump all the properties of alice");
-  xbt_dict_foreach(process_props,cursor,key,data)
-    if (!strncmp(key,"SG_TEST_",8))
-       INFO2("  Process property: '%s' has value: '%s'",key,data);
+  xbt_dict_foreach(process_props, cursor, key, data)
+    if (!strncmp(key, "SG_TEST_", 8))
+    INFO2("  Process property: '%s' has value: '%s'", key, data);
+
   INFO0("== Try to get a process property that does not exist");
   value = gras_process_property_value("Nonexisting");
   xbt_assert0(!value, "nonexisting property exists!!");
+
   /* Modify an existing property. First check it exists */
   INFO0("== Trying to modify a process property");
   value = gras_process_property_value("new prop");
-  xbt_assert0(!value,"Property 'new prop' exists before I add it!");
-  xbt_dict_set(process_props, "new prop", xbt_strdup("new value"), xbt_free_f);
+  xbt_assert0(!value, "Property 'new prop' exists before I add it!");
+  xbt_dict_set(process_props, "new prop", xbt_strdup("new value"),
+               xbt_free_f);
+
   /* Test if we have changed the value */
   value = gras_process_property_value("new prop");
-  xbt_assert1(!strcmp(value,"new value"), "New property does have the value I've set ('%s' != 'new value')",value);
+  xbt_assert1(!strcmp(value, "new value"),
+              "New property does have the value I've set ('%s' != 'new value')",
+              value);
 
   gras_exit();
   return 0;
 }
 
-int bob(int argc, char *argv[]) {
-  gras_init(&argc,argv);
+int bob(int argc, char *argv[])
+{
+  gras_init(&argc, argv);
 
   /* Get the properties */
   xbt_dict_t host_props = gras_os_host_properties();
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key, *data;
   const char *value;
 
   INFO0("== Dump all the properties of host1");
-  xbt_dict_foreach(host_props,cursor,key,data)
-     INFO2("  Host property: '%s' has value: '%s'",key,data);
+  xbt_dict_foreach(host_props, cursor, key, data)
+    INFO2("  Host property: '%s' has value: '%s'", key, data);
+
   INFO0("== Try to get a property that does not exist");
   value = gras_os_host_property_value("non existing key");
-  xbt_assert1(value == NULL, "The key 'non existing key' exists (with value '%s')!!",value);
+  xbt_assert1(value == NULL,
+              "The key 'non existing key' exists (with value '%s')!!", value);
 
-  INFO0("== Set a host property that alice will try to retrieve in SG (from bob->hello)");
-  xbt_dict_set(host_props,"from bob",xbt_strdup("hello"), xbt_free_f);
+  INFO0
+    ("== Set a host property that alice will try to retrieve in SG (from bob->hello)");
+  xbt_dict_set(host_props, "from bob", xbt_strdup("hello"), xbt_free_f);
 
   INFO0("== Dump all the properties of host1 again to check the addition");
-  xbt_dict_foreach(host_props,cursor,key,data)
-     INFO2("  Host property: '%s' has value: '%s'",key,data);
-   
-  gras_os_sleep(1); /* KILLME once bug on empty main is solved */
+  xbt_dict_foreach(host_props, cursor, key, data)
+    INFO2("  Host property: '%s' has value: '%s'", key, data);
+
+  gras_os_sleep(1);             /* KILLME once bug on empty main is solved */
   gras_exit();
   return 0;
 }
index b43db35..c6ffc36 100644 (file)
@@ -9,46 +9,50 @@
 
 #include "gras.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(Rpc,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Rpc, "Messages specific to this example");
 
 /* register messages which may be sent (common to client and server) */
-static void register_messages(void) {
+static void register_messages(void)
+{
   gras_msgtype_declare_rpc("plain ping",
-                          gras_datadesc_by_name("int"),
-                          gras_datadesc_by_name("int"));
+                           gras_datadesc_by_name("int"),
+                           gras_datadesc_by_name("int"));
 
   gras_msgtype_declare_rpc("raise exception", NULL, NULL);
   gras_msgtype_declare_rpc("forward exception", NULL, NULL);
-  gras_msgtype_declare("kill",NULL);
+  gras_msgtype_declare("kill", NULL);
 }
 
 /* Function prototypes */
-int server (int argc,char *argv[]);
-int forwarder (int argc,char *argv[]);
-int client (int argc,char *argv[]);
+int server(int argc, char *argv[]);
+int forwarder(int argc, char *argv[]);
+int client(int argc, char *argv[]);
 
 #define exception_msg       "Error for the client"
 #define exception_raising() THROW0(unknown_error,42,exception_msg)
 
-static void exception_catching(void) {
-  int gotit = 0,i;
+static void exception_catching(void)
+{
+  int gotit = 0, i;
   xbt_ex_t e;
 
-  for (i=0; i<5; i++) {
-    gotit=0;
+  for (i = 0; i < 5; i++) {
+    gotit = 0;
     TRY {
       exception_raising();
-    } CATCH(e) {
+    }
+    CATCH(e) {
       gotit = 1;
     }
     if (!gotit) {
-      THROW0(unknown_error,0,"Didn't got the remote exception!");
+      THROW0(unknown_error, 0, "Didn't got the remote exception!");
     }
-    xbt_assert2(e.category == unknown_error, "Got wrong category: %d (instead of %d)",
-               e.category,unknown_error);
+    xbt_assert2(e.category == unknown_error,
+                "Got wrong category: %d (instead of %d)", e.category,
+                unknown_error);
     xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value);
-    xbt_assert1(!strncmp(e.msg,exception_msg, strlen(exception_msg)),
-               "Got wrong message: %s", e.msg);
+    xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)),
+                "Got wrong message: %s", e.msg);
     xbt_ex_free(e);
   }
 }
@@ -58,29 +62,30 @@ static void exception_catching(void) {
  * **********************************************************************/
 
 
-int client(int argc,char *argv[]) {
+int client(int argc, char *argv[])
+{
   xbt_ex_t e;
-  gras_socket_t toserver=NULL; /* peer */
-  gras_socket_t toforwarder=NULL; /* peer */
+  gras_socket_t toserver = NULL;        /* peer */
+  gras_socket_t toforwarder = NULL;     /* peer */
 
   int ping, pong, i;
-  volatile int gotit=0;
+  volatile int gotit = 0;
 
 
   const char *host = "127.0.0.1";
-               int   port = 4000;
+  int port = 4000;
 
-  memset(&e,0,sizeof(xbt_ex_t));
+  memset(&e, 0, sizeof(xbt_ex_t));
 
   /* 1. Init the GRAS's infrastructure */
   gras_init(&argc, argv);
 
   /* 2. Get the server's address. The command line override defaults when specified */
   if (argc == 5) {
-    host=argv[1];
-    port=atoi(argv[2]);
+    host = argv[1];
+    port = atoi(argv[2]);
   }
-  INFO2("Launch client (server on %s:%d)",host,port);
+  INFO2("Launch client (server on %s:%d)", host, port);
 
   exception_catching();
 
@@ -90,30 +95,32 @@ int client(int argc,char *argv[]) {
   /* 4. Create a socket to speak to the server */
   TRY {
     exception_catching();
-    toserver=gras_socket_client(host,port);
-    toforwarder=gras_socket_client(argv[3],atoi(argv[4]));
-  } CATCH(e) {
+    toserver = gras_socket_client(host, port);
+    toforwarder = gras_socket_client(argv[3], atoi(argv[4]));
+  }
+  CATCH(e) {
     RETHROW0("Unable to connect to the server: %s");
   }
-  INFO2("Connected to %s:%d.",host,port);
+  INFO2("Connected to %s:%d.", host, port);
 
 
   /* 5. Register the messages.
-        See, it doesn't have to be done completely at the beginning,
-       but only before use */
+     See, it doesn't have to be done completely at the beginning,
+     but only before use */
   exception_catching();
   register_messages();
 
   /* 6. Keep the user informed of what's going on */
   INFO2("Connected to server which is on %s:%d",
-       gras_socket_peer_name(toserver),gras_socket_peer_port(toserver));
+        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
 
   /* 7. Prepare and send the ping message to the server */
   ping = 1234;
   TRY {
     exception_catching();
     gras_msg_rpccall(toserver, 6000.0, "plain ping", &ping, &pong);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     gras_socket_close(toserver);
     RETHROW0("Failed to execute a PING rpc on the server: %s");
   }
@@ -121,74 +128,81 @@ int client(int argc,char *argv[]) {
 
   /* 8. Keep the user informed of what's going on, again */
   INFO4("The answer to PING(%d) on %s:%d is PONG(%d)",
-       ping,
-       gras_socket_peer_name(toserver),gras_socket_peer_port(toserver),
-       pong);
+        ping,
+        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver),
+        pong);
 
   /* 9. Call a RPC which raises an exception (to test exception propagation) */
   INFO0("Call the exception raising RPC");
   TRY {
     gras_msg_rpccall(toserver, 6000.0, "raise exception", NULL, NULL);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     gotit = 1;
     xbt_assert2(e.category == unknown_error,
-               "Got wrong category: %d (instead of %d)",
-             e.category,unknown_error);
+                "Got wrong category: %d (instead of %d)",
+                e.category, unknown_error);
     xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value);
-    xbt_assert1(!strncmp(e.msg,exception_msg,strlen(exception_msg)),
-               "Got wrong message: %s", e.msg);
-    INFO0("Got the expected exception when calling the exception raising RPC");
+    xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)),
+                "Got wrong message: %s", e.msg);
+    INFO0
+      ("Got the expected exception when calling the exception raising RPC");
     xbt_ex_free(e);
   }
 
   if (!gotit)
-    THROW0(unknown_error,0,"Didn't got the remote exception!");
+    THROW0(unknown_error, 0, "Didn't got the remote exception!");
 
   INFO0("Called the exception raising RPC");
   exception_catching();
 
   /* doxygen_ignore */
-  for (i=0; i<5; i++) {
-
-     INFO1("Call the exception raising RPC (i=%d)",i);
-     TRY {
-       gras_msg_rpccall(toserver, 6000.0, "raise exception", NULL, NULL);
-     } CATCH(e) {
-       gotit = 1;
-       xbt_ex_free(e);
-     }
-     if (!gotit) {
-       THROW0(unknown_error,0,"Didn't got the remote exception!");
-     }
+  for (i = 0; i < 5; i++) {
+
+    INFO1("Call the exception raising RPC (i=%d)", i);
+    TRY {
+      gras_msg_rpccall(toserver, 6000.0, "raise exception", NULL, NULL);
+    }
+    CATCH(e) {
+      gotit = 1;
+      xbt_ex_free(e);
+    }
+    if (!gotit) {
+      THROW0(unknown_error, 0, "Didn't got the remote exception!");
+    }
   }
   /* doxygen_resume */
 
   /* 9. Call a RPC which raises an exception (to test that exception propagation works) */
-  for (i=0;i<5;i++) {
-    INFO1("Call the exception raising RPC on the forwarder (i=%d)",i);
+  for (i = 0; i < 5; i++) {
+    INFO1("Call the exception raising RPC on the forwarder (i=%d)", i);
     TRY {
       gras_msg_rpccall(toforwarder, 6000.0, "forward exception", NULL, NULL);
-    } CATCH(e) {
+    }
+    CATCH(e) {
       gotit = 1;
     }
     if (!gotit) {
-      THROW0(unknown_error,0,"Didn't got the remote exception!");
+      THROW0(unknown_error, 0, "Didn't got the remote exception!");
     }
     xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value);
-    xbt_assert1(!strncmp(e.msg,exception_msg,strlen(exception_msg)),
-               "Got wrong message: %s", e.msg);
+    xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)),
+                "Got wrong message: %s", e.msg);
     xbt_assert2(e.category == unknown_error,
-               "Got wrong category: %d (instead of %d)",
-               e.category,unknown_error);
-    INFO0("Got the expected exception when calling the exception raising RPC");
+                "Got wrong category: %d (instead of %d)",
+                e.category, unknown_error);
+    INFO0
+      ("Got the expected exception when calling the exception raising RPC");
     xbt_ex_free(e);
     exception_catching();
   }
 
-  INFO2("Ask %s:%d to die",gras_socket_peer_name(toforwarder),gras_socket_peer_port(toforwarder));
-  gras_msg_send(toforwarder,"kill",NULL);
-  INFO2("Ask %s:%d to die",gras_socket_peer_name(toserver),gras_socket_peer_port(toserver));
-  gras_msg_send(toserver,"kill",NULL);
+  INFO2("Ask %s:%d to die", gras_socket_peer_name(toforwarder),
+        gras_socket_peer_port(toforwarder));
+  gras_msg_send(toforwarder, "kill", NULL);
+  INFO2("Ask %s:%d to die", gras_socket_peer_name(toserver),
+        gras_socket_peer_port(toserver));
+  gras_msg_send(toserver, "kill", NULL);
 
   /* 11. Cleanup the place before leaving */
   gras_socket_close(toserver);
@@ -196,7 +210,7 @@ int client(int argc,char *argv[]) {
   INFO0("Done.");
   gras_exit();
   return 0;
-} /* end_of_client */
+}                               /* end_of_client */
 
 
 /* **********************************************************************
@@ -207,47 +221,49 @@ typedef struct {
   int done;
 } s_forward_data_t, *forward_data_t;
 
-static int forwarder_cb_kill(gras_msg_cb_ctx_t ctx,
-                                void             *payload_data) {
+static int forwarder_cb_kill(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
   forward_data_t fdata;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
-  INFO2("Asked to die by %s:%d",gras_socket_peer_name(expeditor),gras_socket_peer_port(expeditor));
-  fdata=gras_userdata_get();
+  INFO2("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
+        gras_socket_peer_port(expeditor));
+  fdata = gras_userdata_get();
   fdata->done = 1;
   return 0;
 }
 
-static int forwarder_cb_forward_ex(gras_msg_cb_ctx_t ctx,
-                                  void             *payload_data) {
-  forward_data_t fdata=gras_userdata_get();
+static int forwarder_cb_forward_ex(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
+  forward_data_t fdata = gras_userdata_get();
 
   INFO0("Forward a request");
-  gras_msg_rpccall(fdata->server, 60, "raise exception",NULL,NULL);
+  gras_msg_rpccall(fdata->server, 60, "raise exception", NULL, NULL);
   return 0;
 }
 
-int forwarder (int argc,char *argv[]) {
+int forwarder(int argc, char *argv[])
+{
   gras_socket_t mysock;
   int port;
   forward_data_t fdata;
 
-  gras_init(&argc,argv);
+  gras_init(&argc, argv);
 
   xbt_assert(argc == 4);
 
-  fdata=gras_userdata_new(s_forward_data_t);
+  fdata = gras_userdata_new(s_forward_data_t);
   fdata->done = 0;
-  port=atoi(argv[1]);
+  port = atoi(argv[1]);
 
   INFO1("Launch forwarder (port=%d)", port);
   mysock = gras_socket_server(port);
 
-  gras_os_sleep(1); /* wait for the server to be ready */
-  fdata->server=gras_socket_client(argv[2],atoi(argv[3]));
+  gras_os_sleep(1);             /* wait for the server to be ready */
+  fdata->server = gras_socket_client(argv[2], atoi(argv[3]));
 
   register_messages();
   gras_cb_register("forward exception", &forwarder_cb_forward_ex);
-  gras_cb_register("kill",              &forwarder_cb_kill);
+  gras_cb_register("kill", &forwarder_cb_kill);
 
   while (!fdata->done) {
     gras_msg_handle(600.0);
@@ -269,64 +285,66 @@ typedef struct {
   int done;
 } s_server_data_t, *server_data_t;
 
-static int server_cb_kill(gras_msg_cb_ctx_t ctx,
-                         void             *payload_data) {
+static int server_cb_kill(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
   server_data_t sdata;
 
-  INFO2("Asked to die by %s:%d",gras_socket_peer_name(expeditor),gras_socket_peer_port(expeditor));
+  INFO2("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
+        gras_socket_peer_port(expeditor));
 
-  sdata=gras_userdata_get();
+  sdata = gras_userdata_get();
   sdata->done = 1;
   return 0;
 }
 
-static int server_cb_raise_ex(gras_msg_cb_ctx_t ctx,
-                             void             *payload_data) {
+static int server_cb_raise_ex(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
   exception_raising();
   return 0;
 }
 
-static int server_cb_ping(gras_msg_cb_ctx_t ctx,
-                         void             *payload_data) {
+static int server_cb_ping(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
 
   /* 1. Get the payload into the msg variable, and retrieve who called us */
-  int msg=*(int*)payload_data;
+  int msg = *(int *) payload_data;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   /* 2. Log which client connected */
   INFO3("Got message PING(%d) from %s:%d",
-       msg,
-       gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
+        msg,
+        gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
 
   /* 4. Change the value of the msg variable */
   msg = 4321;
 
   /* 5. Return as result */
-  gras_msg_rpcreturn(6000,ctx,&msg);
+  gras_msg_rpcreturn(6000, ctx, &msg);
   INFO0("Answered with PONG(4321)");
 
   /* 6. Cleanups, if any */
 
   /* 7. Tell GRAS that we consummed this message */
   return 0;
-} /* end_of_server_cb_ping */
+}                               /* end_of_server_cb_ping */
 
 
-int server (int argc,char *argv[]) {
+int server(int argc, char *argv[])
+{
   gras_socket_t mysock;
   server_data_t sdata;
 
   int port = 4000;
 
   /* 1. Init the GRAS infrastructure */
-  gras_init(&argc,argv);
+  gras_init(&argc, argv);
 
   /* 2. Get the port I should listen on from the command line, if specified */
   if (argc == 2)
-    port=atoi(argv[1]);
+    port = atoi(argv[1]);
 
-  sdata=gras_userdata_new(s_server_data_t);
+  sdata = gras_userdata_new(s_server_data_t);
   sdata->done = 0;
 
   INFO1("Launch server (port=%d)", port);
@@ -336,9 +354,9 @@ int server (int argc,char *argv[]) {
 
   /* 4. Register the known messages and register my callback */
   register_messages();
-  gras_cb_register("plain ping",&server_cb_ping);
-  gras_cb_register("raise exception",&server_cb_raise_ex);
-  gras_cb_register("kill",&server_cb_kill);
+  gras_cb_register("plain ping", &server_cb_ping);
+  gras_cb_register("raise exception", &server_cb_raise_ex);
+  gras_cb_register("kill", &server_cb_kill);
 
   INFO1("Listening on port %d", gras_socket_my_port(mysock));
 
@@ -380,5 +398,4 @@ int server (int argc,char *argv[]) {
   gras_exit();
 
   return 0;
-} /* end_of_server */
-
+}                               /* end_of_server */
index 358569e..30ddc76 100644 (file)
@@ -16,7 +16,7 @@
 void spawn_register_messages(void);
 
 /* Function prototypes */
-int father (int argc,char *argv[]);
-int child (int argc,char *argv[]);
+int father(int argc, char *argv[]);
+int child(int argc, char *argv[]);
 
 #endif
index dd9b7f5..c8812ec 100644 (file)
 #include "spawn.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Spawn);
 
-int child(int argc,char *argv[]) {
-  xbt_ex_t e; 
-  gras_socket_t dady=NULL; /* peer */
+int child(int argc, char *argv[])
+{
+  xbt_ex_t e;
+  gras_socket_t dady = NULL;    /* peer */
 
   gras_socket_t from;
   int ping, pong;
 
   const char *host = gras_os_myname();
-        int   port = 4000;
+  int port = 4000;
 
   /* 1. Init the GRAS's infrastructure */
   gras_init(&argc, argv);
-   
+
   /* 2. Get the server's address. The command line override defaults when specified */
   if (argc == 2) {
-    port=atoi(argv[1]);
-  } 
+    port = atoi(argv[1]);
+  }
+
+  gras_socket_server_range(4000, 5000, 0, 0);
 
-  gras_socket_server_range(4000,5000,0,0);
-   
   /* 3. Connect back to my father */
   TRY {
-    dady=gras_socket_client(host,port);
-  } CATCH(e) {
+    dady = gras_socket_client(host, port);
+  }
+  CATCH(e) {
     RETHROW0("Unable to connect to my dady: %s");
   }
   INFO4("I (%s:%d) have found my dady on %s:%d.",
-       gras_os_myname(),gras_os_myport(),host,port);
+        gras_os_myname(), gras_os_myport(), host, port);
 
 
   /* 4. Register the messages. */
@@ -47,22 +49,24 @@ int child(int argc,char *argv[]) {
   ping = 1234;
   TRY {
     gras_msg_send(dady, "ping", &ping);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     gras_socket_close(dady);
     RETHROW0("Failed to ping my dady: %s");
   }
 
   /* 6. Wait for the answer from the server, and deal with issues */
   TRY {
-    gras_msg_wait(6000,"pong", &from,&pong);
-  } CATCH(e) {
+    gras_msg_wait(6000, "pong", &from, &pong);
+  }
+  CATCH(e) {
     gras_socket_close(dady);
     RETHROW0("Dad don't want to speak with me! : %s");
   }
   INFO2("Pinged dad with %d, he answered with %d; leaving now.", ping, pong);
-   
+
   /* 7. Free the allocated resources, and shut GRAS down */
   gras_socket_close(dady);
   gras_exit();
   return 0;
-} /* end_of_child */
+}                               /* end_of_child */
index 26d2cba..ac272a0 100644 (file)
@@ -8,11 +8,11 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "spawn.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(Spawn,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Spawn, "Messages specific to this example");
 
 /* register messages which may be sent (common to client and server) */
-void spawn_register_messages(void) {
+void spawn_register_messages(void)
+{
   gras_msgtype_declare("ping", gras_datadesc_by_name("int"));
   gras_msgtype_declare("pong", gras_datadesc_by_name("int"));
 }
-
index c8f88ac..3110064 100644 (file)
@@ -18,86 +18,89 @@ typedef struct {
 } father_data_t;
 
 
-static int father_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) {
-                            
+static int father_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
+{
+
   xbt_ex_t e;
   /* 1. Get the payload into the msg variable, and retrieve my caller */
-  int msg=*(int*)payload;
+  int msg = *(int *) payload;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   /* 2. Retrieve the father's state (globals) */
-  father_data_t *globals=(father_data_t*)gras_userdata_get();
+  father_data_t *globals = (father_data_t *) gras_userdata_get();
   globals->msg_got++;
-   
+
   /* 3. Log which client connected */
-  INFO3("Kid %s:%d pinged me with %d", 
-       gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),msg);
-  
+  INFO3("Kid %s:%d pinged me with %d",
+        gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
+        msg);
+
   /* 4. Change the value of the msg variable */
   msg = 4321;
   /* 5. Send it back as payload of a pong message to the expeditor */
   TRY {
     gras_msg_send(expeditor, "pong", &msg);
 
-  /* 6. Deal with errors: add some details to the exception */
+    /* 6. Deal with errors: add some details to the exception */
   } CATCH(e) {
     gras_socket_close(globals->sock);
     RETHROW0("Unable to answer to my poor child: %s");
   }
   INFO2("Answered to %s:%d's request",
-       gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
-   
+        gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
+
   /* 7. Tell GRAS that we consummed this message */
   return 0;
-} /* end_of_father_cb_ping_handler */
+}                               /* end_of_father_cb_ping_handler */
 
-int father (int argc,char *argv[]) {
+int father(int argc, char *argv[])
+{
   father_data_t *globals;
 
   int port = 4000;
   int child_amount = 5;
   char **child_args;
   int i;
-  
+
   /* 1. Init the GRAS infrastructure and declare my globals */
-  gras_init(&argc,argv);
-  globals=gras_userdata_new(father_data_t);
-   
+  gras_init(&argc, argv);
+  globals = gras_userdata_new(father_data_t);
+
   /* 2. Get args from the command line, if specified */
   if (argc == 2) {
-    port=atoi(argv[1]);
-    child_amount=atoi(argv[2]);
+    port = atoi(argv[1]);
+    child_amount = atoi(argv[2]);
   }
 
   /* 3. Initialize my globals (mainly create my master socket) */
   globals->sock = gras_socket_server(port);
-  globals->msg_got = 0;   
-   
+  globals->msg_got = 0;
+
   /* 4. Register the known messages. */
   spawn_register_messages();
-   
+
   /* 5. Register my callback */
-  gras_cb_register("ping",&father_cb_ping_handler);
+  gras_cb_register("ping", &father_cb_ping_handler);
 
-  /* 6. Spawn the kids */   
+  /* 6. Spawn the kids */
   INFO0("Spawn the kids");
-  for (i=0; i<child_amount; i++) {     
-     child_args = xbt_new0(char*,3);
-     child_args[0] = xbt_strdup("child");
-     child_args[1] = bprintf("%d",port);
-     child_args[2] = NULL;
-     gras_agent_spawn("child",NULL,child,2,child_args,NULL);
+  for (i = 0; i < child_amount; i++) {
+    child_args = xbt_new0(char *, 3);
+    child_args[0] = xbt_strdup("child");
+    child_args[1] = bprintf("%d", port);
+    child_args[2] = NULL;
+    gras_agent_spawn("child", NULL, child, 2, child_args, NULL);
   }
-     
+
   /* 7. Wait to be contacted be the kids */
   while (globals->msg_got < child_amount)
-     gras_msg_handle(60.0);
+    gras_msg_handle(60.0);
   INFO0("All kids gone. Leave now.");
-   
+
   /* 8. Free the allocated resources, and shut GRAS down */
   gras_socket_close(globals->sock);
   free(globals);
   gras_exit();
-   
+
   return 0;
-} /* end_of_father */
+}                               /* end_of_father */
index a19c3c9..5289892 100644 (file)
@@ -10,7 +10,7 @@
 #include "gras.h"
 #include "xbt/synchro.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(philo,"Logs of this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(philo, "Logs of this example");
 
 
 /** Philosopher logic **/
@@ -24,34 +24,39 @@ xbt_cond_t *forks;
 #define EATING 1
 int *state;
 
-int *id; /* to pass a pointer to the threads without race condition */
-
-static void pickup(int id, int lunch)  {
-   INFO2("Thread %d gets hungry (lunch #%d)",id,lunch);
-   xbt_mutex_acquire(mutex);
-   while (state[(id + (philosopher_amount-1))%philosopher_amount] == EATING ||
-         state[(id + 1)%philosopher_amount] == EATING) 
-     {
-       xbt_cond_wait(forks[id], mutex);
-     }
-   
-   state[id] = EATING;
-   xbt_assert1(state[(id + (philosopher_amount-1))%philosopher_amount] == THINKING &&
-              state[(id + 1)%philosopher_amount] == THINKING ,
-              "Philosopher %d eats at the same time that one of its neighbors!!!",id);
-       
-   xbt_mutex_release(mutex);
-   INFO1("Thread %d eats",id);
+int *id;                        /* to pass a pointer to the threads without race condition */
+
+static void pickup(int id, int lunch)
+{
+  INFO2("Thread %d gets hungry (lunch #%d)", id, lunch);
+  xbt_mutex_acquire(mutex);
+  while (state[(id + (philosopher_amount - 1)) % philosopher_amount] == EATING
+         || state[(id + 1) % philosopher_amount] == EATING) {
+    xbt_cond_wait(forks[id], mutex);
+  }
+
+  state[id] = EATING;
+  xbt_assert1(state[(id + (philosopher_amount - 1)) % philosopher_amount] ==
+              THINKING
+              && state[(id + 1) % philosopher_amount] == THINKING,
+              "Philosopher %d eats at the same time that one of its neighbors!!!",
+              id);
+
+  xbt_mutex_release(mutex);
+  INFO1("Thread %d eats", id);
 }
-static void putdown(int id)  {
-   INFO1("Thread %d is full",id);
-   xbt_mutex_acquire(mutex);
-   state[id] = THINKING;
-   xbt_cond_signal(forks[(id+(philosopher_amount-1))%philosopher_amount]);
-   xbt_cond_signal(forks[(id+1)%philosopher_amount]);
-   
-   xbt_mutex_release(mutex);
-   INFO1("Thread %d thinks",id);
+
+static void putdown(int id)
+{
+  INFO1("Thread %d is full", id);
+  xbt_mutex_acquire(mutex);
+  state[id] = THINKING;
+  xbt_cond_signal(forks
+                  [(id + (philosopher_amount - 1)) % philosopher_amount]);
+  xbt_cond_signal(forks[(id + 1) % philosopher_amount]);
+
+  xbt_mutex_release(mutex);
+  INFO1("Thread %d thinks", id);
 }
 
 /*
@@ -64,74 +69,80 @@ int running_threads;
 xbt_mutex_t dead_end;
 
 /* Code ran by each thread */
-static void philo_thread(void *arg) {
-   int id = *(int*)arg;
-   int i;
-   
-   for (i=0; i<lunch_amount; i++) {
-      pickup(id,i);
-      gras_os_sleep(id / 100.0); /* each philosopher sleeps and eat a time related to its ID */
-      putdown(id);
-      gras_os_sleep(id / 100.0);
-   }
-   
-   xbt_mutex_acquire(mut_end);
-   running_threads--;
-   xbt_cond_signal(cond_end);
-   xbt_mutex_release(mut_end);
-
-   /* Enter an endless loop to test the killing facilities */
-   INFO1("Thread %d tries to enter the dead-end; hopefully, the master will cancel it",id);
-   xbt_mutex_acquire(dead_end);
-   INFO1("Oops, thread %d reached the dead-end. Cancelation failed",id);
+static void philo_thread(void *arg)
+{
+  int id = *(int *) arg;
+  int i;
+
+  for (i = 0; i < lunch_amount; i++) {
+    pickup(id, i);
+    gras_os_sleep(id / 100.0);  /* each philosopher sleeps and eat a time related to its ID */
+    putdown(id);
+    gras_os_sleep(id / 100.0);
+  }
+
+  xbt_mutex_acquire(mut_end);
+  running_threads--;
+  xbt_cond_signal(cond_end);
+  xbt_mutex_release(mut_end);
+
+  /* Enter an endless loop to test the killing facilities */
+  INFO1
+    ("Thread %d tries to enter the dead-end; hopefully, the master will cancel it",
+     id);
+  xbt_mutex_acquire(dead_end);
+  INFO1("Oops, thread %d reached the dead-end. Cancelation failed", id);
 }
 
-int philosopher (int argc,char *argv[]);
-int philosopher (int argc,char *argv[]) {
+int philosopher(int argc, char *argv[]);
+int philosopher(int argc, char *argv[])
+{
   int i;
   xbt_thread_t *philosophers;
-   
-  gras_init(&argc,argv);
-  xbt_assert0(argc>=2,"This program expects one argument (the amount of philosophers)");
+
+  gras_init(&argc, argv);
+  xbt_assert0(argc >= 2,
+              "This program expects one argument (the amount of philosophers)");
 
   /* initializations of the philosopher mecanisms */
   philosopher_amount = atoi(argv[1]);
-  state = xbt_new0(int,philosopher_amount); 
-  id = xbt_new0(int,philosopher_amount); 
-  forks = xbt_new(xbt_cond_t,philosopher_amount);
-  philosophers = xbt_new(xbt_thread_t,philosopher_amount);
-     
+  state = xbt_new0(int, philosopher_amount);
+  id = xbt_new0(int, philosopher_amount);
+  forks = xbt_new(xbt_cond_t, philosopher_amount);
+  philosophers = xbt_new(xbt_thread_t, philosopher_amount);
+
   mutex = xbt_mutex_init();
-  for (i=0; i<philosopher_amount; i++) {
-     state[i] = THINKING;
-     id[i] = i;
-     forks[i] = xbt_cond_init();
+  for (i = 0; i < philosopher_amount; i++) {
+    state[i] = THINKING;
+    id[i] = i;
+    forks[i] = xbt_cond_init();
   }
-   
+
   /* setup the ending mecanism */
-  running_threads = philosopher_amount; 
+  running_threads = philosopher_amount;
   cond_end = xbt_cond_init();
   mut_end = xbt_mutex_init();
   dead_end = xbt_mutex_init();
   xbt_mutex_acquire(dead_end);
-  
-  INFO2("Spawn the %d threads (%d lunches scheduled)", philosopher_amount, lunch_amount);
+
+  INFO2("Spawn the %d threads (%d lunches scheduled)", philosopher_amount,
+        lunch_amount);
   /* spawn threads */
-  for (i=0; i<philosopher_amount; i++) {
-     char *name = bprintf("thread %d",i);
-     philosophers[i] = xbt_thread_create(name,philo_thread,&id[i]);
-     free(name);
+  for (i = 0; i < philosopher_amount; i++) {
+    char *name = bprintf("thread %d", i);
+    philosophers[i] = xbt_thread_create(name, philo_thread, &id[i]);
+    free(name);
   }
-  
+
   /* wait for them */
   xbt_mutex_acquire(mut_end);
-  while (running_threads) 
-     xbt_cond_wait(cond_end,mut_end);
+  while (running_threads)
+    xbt_cond_wait(cond_end, mut_end);
   xbt_mutex_release(mut_end);
-       
+
   INFO0("Cancel all childs");
   /* nuke them threads */
-  for (i=0; i<philosopher_amount; i++) {
+  for (i = 0; i < philosopher_amount; i++) {
     xbt_thread_cancel(philosophers[i]);
   }
 
index b46d388..33ff4e1 100644 (file)
@@ -7,77 +7,82 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-int client(int argc,char *argv[]); /* Placed here to not bother doxygen inclusion */
+int client(int argc, char *argv[]);     /* Placed here to not bother doxygen inclusion */
 
 #include "gras.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this test");
 
 #define REPEAT_INTERVAL 1.0
 #define DELAY_INTERVAL 2.0
 #define LOOP_COUNT 5
 
 typedef struct {
-   int still_to_do;
+  int still_to_do;
 } my_globals;
 
-static void repetitive_action(void) {
-   my_globals *globals=(my_globals*)gras_userdata_get();
-   
-   /* Stop if nothing to do yet */
-   if (globals->still_to_do <= 0) {
-     INFO0("Repetitive_action has nothing to do yet");
-     return;
-   }
-   
-   if (globals->still_to_do == 1) {
-      /* Unregister myself if I'm done */
-      gras_timer_cancel_repeat(REPEAT_INTERVAL,repetitive_action);
-   }
-
-   INFO1("repetitive_action decrementing globals->still_to_do. New value: %d",
-        globals->still_to_do-1);
-   
-   globals->still_to_do--; /* should be the last line of the action since value=0 stops the program */
-} /* end_of_repetitive_action */
-
-static void delayed_action(void) {
-   my_globals *globals=(my_globals*)gras_userdata_get();
-   
-   INFO1("delayed_action setting globals->still_to_do to %d",LOOP_COUNT);
-
-   globals->still_to_do = LOOP_COUNT;
-} /* end_of_delayed_action */
-
-int client(int argc,char *argv[]) {
+static void repetitive_action(void)
+{
+  my_globals *globals = (my_globals *) gras_userdata_get();
+
+  /* Stop if nothing to do yet */
+  if (globals->still_to_do <= 0) {
+    INFO0("Repetitive_action has nothing to do yet");
+    return;
+  }
+
+  if (globals->still_to_do == 1) {
+    /* Unregister myself if I'm done */
+    gras_timer_cancel_repeat(REPEAT_INTERVAL, repetitive_action);
+  }
+
+  INFO1("repetitive_action decrementing globals->still_to_do. New value: %d",
+        globals->still_to_do - 1);
+
+  globals->still_to_do--;       /* should be the last line of the action since value=0 stops the program */
+}                               /* end_of_repetitive_action */
+
+static void delayed_action(void)
+{
+  my_globals *globals = (my_globals *) gras_userdata_get();
+
+  INFO1("delayed_action setting globals->still_to_do to %d", LOOP_COUNT);
+
+  globals->still_to_do = LOOP_COUNT;
+}                               /* end_of_delayed_action */
+
+int client(int argc, char *argv[])
+{
   my_globals *globals;
 
-  gras_init(&argc,argv);
-  globals=gras_userdata_new(my_globals);
+  gras_init(&argc, argv);
+  globals = gras_userdata_new(my_globals);
   globals->still_to_do = -1;
 
-  INFO1("Programming the repetitive_action with a frequency of %f sec", REPEAT_INTERVAL);
-  gras_timer_repeat(REPEAT_INTERVAL,repetitive_action);
-   
+  INFO1("Programming the repetitive_action with a frequency of %f sec",
+        REPEAT_INTERVAL);
+  gras_timer_repeat(REPEAT_INTERVAL, repetitive_action);
+
   INFO1("Programming the delayed_action for after %f sec", DELAY_INTERVAL);
-  gras_timer_delay(REPEAT_INTERVAL,delayed_action);
+  gras_timer_delay(REPEAT_INTERVAL, delayed_action);
 
-  INFO0("Have a rest");  
+  INFO0("Have a rest");
   gras_os_sleep(DELAY_INTERVAL / 2.0);
-   
+
   INFO0("Canceling the delayed_action.");
-  gras_timer_cancel_delay(REPEAT_INTERVAL,delayed_action);
+  gras_timer_cancel_delay(REPEAT_INTERVAL, delayed_action);
 
-  INFO1("Re-programming the delayed_action for after %f sec",DELAY_INTERVAL);
-  gras_timer_delay(REPEAT_INTERVAL,delayed_action);
+  INFO1("Re-programming the delayed_action for after %f sec", DELAY_INTERVAL);
+  gras_timer_delay(REPEAT_INTERVAL, delayed_action);
 
   while (globals->still_to_do == -1 ||  /* Before delayed action runs */
-        globals->still_to_do > 0 /* after delayed_action, and not enough repetitive_action */) {
+         globals->still_to_do >
+         0 /* after delayed_action, and not enough repetitive_action */ ) {
 
-     DEBUG1("Prepare to handle messages for 5 sec (still_to_do=%d)", globals->still_to_do);
-     gras_msg_handle(5.0);
+    DEBUG1("Prepare to handle messages for 5 sec (still_to_do=%d)",
+           globals->still_to_do);
+    gras_msg_handle(5.0);
   }
   gras_exit();
   return 0;
-} /* end_of_client */
-
+}                               /* end_of_client */
index 97de6b3..7dfd787 100644 (file)
@@ -6,83 +6,93 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt.h" /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt.h"                /* calloc, printf */
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 /* My actions */
-static void send(xbt_dynar_t action) {
-       char *name=xbt_str_join(action," ");
-       char *to = xbt_dynar_get_as(action,2,char*);
-       char *size=xbt_dynar_get_as(action,3,char*);
-       INFO1("Send: %s",name);
-       MSG_task_send(MSG_task_create(name, 0, atoi(size), NULL), to);
-       INFO1("Sent %s",name);
-   free(name);
+static void send(xbt_dynar_t action)
+{
+  char *name = xbt_str_join(action, " ");
+  char *to = xbt_dynar_get_as(action, 2, char *);
+  char *size = xbt_dynar_get_as(action, 3, char *);
+  INFO1("Send: %s", name);
+  MSG_task_send(MSG_task_create(name, 0, atoi(size), NULL), to);
+  INFO1("Sent %s", name);
+  free(name);
 }
-static void recv(xbt_dynar_t action) {
-       char *name=xbt_str_join(action," ");
-       m_task_t task = NULL;
-       INFO1("Receiving: %s",name);
-       //FIXME: argument of action ignored so far; semantic not clear
-       //char *from=xbt_dynar_get_as(action,2,char*);
-       MSG_task_receive(&task,MSG_process_get_name(MSG_process_self()));
-       INFO1("Received %s",MSG_task_get_name(task));
-       MSG_task_destroy(task);
-   free(name);
+
+static void recv(xbt_dynar_t action)
+{
+  char *name = xbt_str_join(action, " ");
+  m_task_t task = NULL;
+  INFO1("Receiving: %s", name);
+  //FIXME: argument of action ignored so far; semantic not clear
+  //char *from=xbt_dynar_get_as(action,2,char*);
+  MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
+  INFO1("Received %s", MSG_task_get_name(task));
+  MSG_task_destroy(task);
+  free(name);
 }
-static void sleep(xbt_dynar_t action) {
-       char *name=xbt_str_join(action," ");
-       char *duration=xbt_dynar_get_as(action,2,char*);
-       INFO1("sleep: %s",name);
-       MSG_process_sleep(atoi(duration));
-       INFO1("sleept: %s",name);
-   free(name);
+
+static void sleep(xbt_dynar_t action)
+{
+  char *name = xbt_str_join(action, " ");
+  char *duration = xbt_dynar_get_as(action, 2, char *);
+  INFO1("sleep: %s", name);
+  MSG_process_sleep(atoi(duration));
+  INFO1("sleept: %s", name);
+  free(name);
 }
-static void compute(xbt_dynar_t action) {
-       char *name=xbt_str_join(action," ");
-       char *amout=xbt_dynar_get_as(action,2,char*);
-       m_task_t task = MSG_task_create(name, atoi(amout), 0, NULL);
-       INFO1("computing: %s",name);
-       MSG_task_execute(task);
-       MSG_task_destroy(task);
-       INFO1("computed: %s",name);
-   free(name);
+
+static void compute(xbt_dynar_t action)
+{
+  char *name = xbt_str_join(action, " ");
+  char *amout = xbt_dynar_get_as(action, 2, char *);
+  m_task_t task = MSG_task_create(name, atoi(amout), 0, NULL);
+  INFO1("computing: %s", name);
+  MSG_task_execute(task);
+  MSG_task_destroy(task);
+  INFO1("computed: %s", name);
+  free(name);
 }
 
 /** Main function */
-int main(int argc, char *argv[]){
-       MSG_error_t res = MSG_OK;
-
-       /* Check the given arguments */
-       MSG_global_init(&argc,argv);
-       if (argc < 4) {
-               printf ("Usage: %s platform_file deployment_file action_files\n",argv[0]);
-               printf ("example: %s msg_platform.xml msg_deployment.xml actions\n",argv[0]);
-               exit(1);
-       }
-
-       /*  Simulation setting */
-       MSG_create_environment(argv[1]);
-
-       /* No need to register functions as in classical MSG programs: the actions get started anyway */
-       MSG_launch_application(argv[2]);
-
-       /*   Action registration */
-       MSG_action_register("send", send);
-       MSG_action_register("recv", recv);
-       MSG_action_register("sleep", sleep);
-       MSG_action_register("compute", compute);
-
-       /* Actually do the simulation using MSG_action_trace_run */
-       res = MSG_action_trace_run(argv[3]);
-
-       INFO1("Simulation time %g",MSG_get_clock());
-       MSG_clean();
-
-       if(res==MSG_OK)
-               return 0;
-       else
-               return 1;
-} /* end_of_main */
+int main(int argc, char *argv[])
+{
+  MSG_error_t res = MSG_OK;
+
+  /* Check the given arguments */
+  MSG_global_init(&argc, argv);
+  if (argc < 4) {
+    printf("Usage: %s platform_file deployment_file action_files\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml actions\n",
+           argv[0]);
+    exit(1);
+  }
+
+  /*  Simulation setting */
+  MSG_create_environment(argv[1]);
+
+  /* No need to register functions as in classical MSG programs: the actions get started anyway */
+  MSG_launch_application(argv[2]);
+
+  /*   Action registration */
+  MSG_action_register("send", send);
+  MSG_action_register("recv", recv);
+  MSG_action_register("sleep", sleep);
+  MSG_action_register("compute", compute);
+
+  /* Actually do the simulation using MSG_action_trace_run */
+  res = MSG_action_trace_run(argv[3]);
+
+  INFO1("Simulation time %g", MSG_get_clock());
+  MSG_clean();
+
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
index 32430c2..43b2826 100644 (file)
@@ -4,7 +4,8 @@
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 int master(int argc, char *argv[]);
 int slave(int argc, char *argv[]);
@@ -17,15 +18,15 @@ typedef enum {
 
 //keep a pointer to all surf running tasks.
 #define NTASKS 1500
-int bool_printed=0;
+int bool_printed = 0;
 double start_time, end_time, elapsed_time;
-double   gl_data_size[NTASKS];
+double gl_data_size[NTASKS];
 m_task_t gl_task_array[NTASKS];
-const char * slavenames[NTASKS];
-const char * masternames[NTASKS];
-int gl_task_array_id=0;
+const char *slavenames[NTASKS];
+const char *masternames[NTASKS];
+int gl_task_array_id = 0;
 
-#define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
+#define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
 /** master */
 int master(int argc, char *argv[])
@@ -38,45 +39,46 @@ int master(int argc, char *argv[])
   //unique id to control statistics
   int id = -1;
 
-  if(argc != 4){
-    INFO1("Strange number of arguments expected 3 got %d", argc-1 );
+  if (argc != 4) {
+    INFO1("Strange number of arguments expected 3 got %d", argc - 1);
   }
 
   /* data size */
-  xbt_assert1(sscanf(argv[1],"%lg", &task_comm_size),
-             "Invalid argument %s\n", argv[1]);
+  xbt_assert1(sscanf(argv[1], "%lg", &task_comm_size),
+              "Invalid argument %s\n", argv[1]);
 
   /* slave name */
   slavename = argv[2];
   id = atoi(argv[3]);
-  sprintf(id_alias, "%d",id);
+  sprintf(id_alias, "%d", id);
   slavenames[id] = slavename;
 
   masternames[id] = MSG_host_get_name(MSG_host_self());
-  
-  { /*  Task creation.  */
+
+  {                             /*  Task creation.  */
     char sprintf_buffer[64] = "Task_0";
     todo = MSG_task_create(sprintf_buffer, 0, task_comm_size, NULL);
     //keep track of running tasks
     gl_task_array[id] = todo;
-    gl_data_size[id]=task_comm_size;
+    gl_data_size[id] = task_comm_size;
   }
 
-  { /* Process organisation */
+  {                             /* Process organisation */
     slave = MSG_get_host_by_name(slavename);
   }
 
   /* time measurement */
   start_time = MSG_get_clock();
-  MSG_task_send(todo, id_alias);  
+  MSG_task_send(todo, id_alias);
 
   end_time = MSG_get_clock();
   INFO3("Send completed (to %s). Transfer time: %f\t Agregate bandwidth: %f",
-       slave->name, (end_time - start_time), task_comm_size/(end_time-start_time));
-  INFO2("Completed peer: %s time: %f", slave->name, (end_time-start_time));
+        slave->name, (end_time - start_time),
+        task_comm_size / (end_time - start_time));
+  INFO2("Completed peer: %s time: %f", slave->name, (end_time - start_time));
 
   return 0;
-} /* end_of_master */
+}                               /* end_of_master */
 
 /** Receiver function  */
 int slave(int argc, char *argv[])
@@ -84,42 +86,48 @@ int slave(int argc, char *argv[])
 
   m_task_t task = NULL;
   int a;
-  int id=0;
-  double remaining=0;
+  int id = 0;
+  double remaining = 0;
   char id_alias[10];
 
-  if(argc != 2){
-    INFO1("Strange number of arguments expected 1 got %d", argc-1 );
+  if (argc != 2) {
+    INFO1("Strange number of arguments expected 1 got %d", argc - 1);
   }
 
   id = atoi(argv[1]);
-  sprintf(id_alias, "%d",id);
+  sprintf(id_alias, "%d", id);
 
-  a = MSG_task_receive(&(task), id_alias ); 
+  a = MSG_task_receive(&(task), id_alias);
 
   if (a != MSG_OK) {
     INFO0("Hey?! What's up?");
-    xbt_assert0(0,"Unexpected behavior.");
+    xbt_assert0(0, "Unexpected behavior.");
   }
-  
+
   elapsed_time = MSG_get_clock() - start_time;
 
-  if(!bool_printed){
-    bool_printed=1;
-    for(id=0; id<NTASKS; id++){
-      if(gl_task_array[id] == NULL){
-      }else if(gl_task_array[id] == task){
-       INFO5("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f", id,  gl_data_size[id]/elapsed_time, masternames[id], slavenames[id],  0.0);
-      }else{
-       remaining = MSG_task_get_remaining_communication(gl_task_array[id]);
-       INFO5("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f", id,  (gl_data_size[id]-remaining)/elapsed_time, masternames[id], slavenames[id],  remaining);
+  if (!bool_printed) {
+    bool_printed = 1;
+    for (id = 0; id < NTASKS; id++) {
+      if (gl_task_array[id] == NULL) {
+      } else if (gl_task_array[id] == task) {
+        INFO5
+          ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
+           id, gl_data_size[id] / elapsed_time, masternames[id],
+           slavenames[id], 0.0);
+      } else {
+        remaining = MSG_task_get_remaining_communication(gl_task_array[id]);
+        INFO5
+          ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
+           id, (gl_data_size[id] - remaining) / elapsed_time, masternames[id],
+           slavenames[id], remaining);
       }
     }
     exit(0);
   }
 
-  for(id=0; id<NTASKS; id++){
-    if(gl_task_array[id] == task){
+  for (id = 0; id < NTASKS; id++) {
+    if (gl_task_array[id] == task) {
       MSG_task_destroy(task);
       gl_task_array[id] = NULL;
       return 0;
@@ -127,29 +135,28 @@ int slave(int argc, char *argv[])
   }
 
   return 0;
-} /* end_of_slave */
+}                               /* end_of_slave */
 
 /** Test function */
-MSG_error_t test_all(const char *platform_file,
-                    const char *application_file)
+MSG_error_t test_all(const char *platform_file, const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
   /* MSG_config("workstation_model", "GTNETS"); */
   /* MSG_config("workstation_model","KCCFLN05"); */
-  {                            /*  Simulation setting */
+  {                             /*  Simulation setting */
     MSG_set_channel_number(MAX_CHANNEL);
     //MSG_paje_output("msg_test.trace");
     MSG_create_environment(platform_file);
   }
-  {                   /*   Application deployment */
+  {                             /*   Application deployment */
     MSG_function_register("master", master);
     MSG_function_register("slave", slave);
     MSG_launch_application(application_file);
   }
   res = MSG_main();
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 /** Main function */
 int main(int argc, char *argv[])
@@ -157,15 +164,17 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
   bool_printed = 0;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    exit(1);
   }
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
 
   MSG_clean();
 
-  if(res==MSG_OK) return 0; 
-  else return 1;
-} /* end_of_main */
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
index 9bb9f39..4e9fc92 100644 (file)
@@ -4,7 +4,8 @@
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 int master(int argc, char *argv[]);
 int slave(int argc, char *argv[]);
@@ -17,15 +18,15 @@ typedef enum {
 
 //keep a pointer to all surf running tasks.
 #define NTASKS 1500
-int bool_printed=0;
+int bool_printed = 0;
 double start_time, end_time, elapsed_time;
-double   gl_data_size[NTASKS];
+double gl_data_size[NTASKS];
 m_task_t gl_task_array[NTASKS];
-const char * slavenames[NTASKS];
-const char * masternames[NTASKS];
-int gl_task_array_id=0;
+const char *slavenames[NTASKS];
+const char *masternames[NTASKS];
+int gl_task_array_id = 0;
 
-#define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
+#define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
 /** master */
 int master(int argc, char *argv[])
@@ -38,44 +39,47 @@ int master(int argc, char *argv[])
   //unique id to control statistics
   int id = -1;
 
-  if(argc != 4){
-    INFO1("Strange number of arguments expected 3 got %d", argc-1 );
+  if (argc != 4) {
+    INFO1("Strange number of arguments expected 3 got %d", argc - 1);
   }
 
   /* data size */
-  xbt_assert1(sscanf(argv[1],"%lg", &task_comm_size),
-             "Invalid argument %s\n", argv[1]);
+  xbt_assert1(sscanf(argv[1], "%lg", &task_comm_size),
+              "Invalid argument %s\n", argv[1]);
 
   /* slave name */
   slavename = argv[2];
   id = atoi(argv[3]);
-  sprintf(id_alias, "%d",id);
+  sprintf(id_alias, "%d", id);
   slavenames[id] = slavename;
 
   masternames[id] = MSG_host_get_name(MSG_host_self());
-  
-  { /*  Task creation.  */
+
+  {                             /*  Task creation.  */
     char sprintf_buffer[64] = "Task_0";
     todo = MSG_task_create(sprintf_buffer, 0, task_comm_size, NULL);
     //keep track of running tasks
     gl_task_array[id] = todo;
-    gl_data_size[id]=task_comm_size;
+    gl_data_size[id] = task_comm_size;
   }
 
-  { /* Process organisation */
+  {                             /* Process organisation */
     slave = MSG_get_host_by_name(slavename);
   }
 
   /* time measurement */
   start_time = MSG_get_clock();
-  MSG_task_send(todo, id_alias);  
+  MSG_task_send(todo, id_alias);
   end_time = MSG_get_clock();
 
-  INFO5("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f", id+1,  task_comm_size/(end_time-start_time), masternames[id], slavenames[id],  0.0);
+  INFO5
+    ("===> Estimated Bw of FLOW[%d] : %f ;  message from %s to %s  with remaining : %f",
+     id + 1, task_comm_size / (end_time - start_time), masternames[id],
+     slavenames[id], 0.0);
 
 
   return 0;
-} /* end_of_master */
+}                               /* end_of_master */
 
 /** Receiver function  */
 int slave(int argc, char *argv[])
@@ -83,22 +87,22 @@ int slave(int argc, char *argv[])
 
   m_task_t task = NULL;
   int a;
-  int id=0;
+  int id = 0;
   char id_alias[10];
 
-  if(argc != 2){
-    INFO1("Strange number of arguments expected 1 got %d", argc-1 );
+  if (argc != 2) {
+    INFO1("Strange number of arguments expected 1 got %d", argc - 1);
   }
   id = atoi(argv[1]);
-  sprintf(id_alias, "%d",id);
+  sprintf(id_alias, "%d", id);
 
-  a = MSG_task_receive(&(task), id_alias ); 
+  a = MSG_task_receive(&(task), id_alias);
   return 0;
-} /* end_of_slave */
+}                               /* end_of_slave */
 
 /** Test function */
-MSG_error_t test_all(const char *platform_file,
-                    const char *application_file){
+MSG_error_t test_all(const char *platform_file, const char *application_file)
+{
   MSG_error_t res = MSG_OK;
   MSG_set_channel_number(MAX_CHANNEL);
   MSG_create_environment(platform_file);
@@ -107,7 +111,7 @@ MSG_error_t test_all(const char *platform_file,
   MSG_launch_application(application_file);
   res = MSG_main();
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 /** Main function */
 int main(int argc, char *argv[])
@@ -115,15 +119,17 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
   bool_printed = 0;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    exit(1);
   }
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
 
   MSG_clean();
 
-  if(res==MSG_OK) return 0; 
-  else return 1;
-} /* end_of_main */
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
index 15f458f..df34e56 100644 (file)
@@ -6,13 +6,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h"  /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
 #include "surf/surfxml_parse.h" /* to override surf_parse and bypass the parser */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
-#define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
+#define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
 static int surf_parse_bypass_platform(void)
 {
@@ -21,14 +22,14 @@ static int surf_parse_bypass_platform(void)
 
   /* allocating memory for the buffer, I think 2kB should be enough */
   surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
-  
+
   /* <platform> */
-  SURFXML_BUFFER_SET(platform_version,"2");
+  SURFXML_BUFFER_SET(platform_version, "2");
 
   SURFXML_START_TAG(platform);
 
 /*   <host id="host A" power="100000000.00"/> */
-  SURFXML_BUFFER_SET(host_id,"host A");
+  SURFXML_BUFFER_SET(host_id, "host A");
   SURFXML_BUFFER_SET(host_power, "100000000.00");
   SURFXML_BUFFER_SET(host_availability, "1.0");
   SURFXML_BUFFER_SET(host_availability_file, "");
@@ -107,18 +108,19 @@ static int surf_parse_bypass_platform(void)
   return 0;
 }
 
-static int surf_parse_bypass_application(void) {   
+static int surf_parse_bypass_application(void)
+{
   static int AX_ptr;
   static int surfxml_bufferstack_size = 2048;
 
   /* allocating memory to the buffer, I think 2MB should be enough */
   surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
-  
+
   /* <platform> */
-  SURFXML_BUFFER_SET(platform_version,"2");
+  SURFXML_BUFFER_SET(platform_version, "2");
 
   SURFXML_START_TAG(platform);
-   
+
 /*   <process host="host A" function="master"> */
   SURFXML_BUFFER_SET(process_host, "host A");
   SURFXML_BUFFER_SET(process_function, "master");
@@ -186,33 +188,34 @@ int master(int argc, char *argv[])
 
   int i;
 
-  xbt_assert1(sscanf(argv[1],"%d", &number_of_tasks),
-        "Invalid argument %s\n",argv[1]);
-  xbt_assert1(sscanf(argv[2],"%lg", &task_comp_size),
-        "Invalid argument %s\n",argv[2]);
-  xbt_assert1(sscanf(argv[3],"%lg", &task_comm_size),
-        "Invalid argument %s\n",argv[3]);
+  xbt_assert1(sscanf(argv[1], "%d", &number_of_tasks),
+              "Invalid argument %s\n", argv[1]);
+  xbt_assert1(sscanf(argv[2], "%lg", &task_comp_size),
+              "Invalid argument %s\n", argv[2]);
+  xbt_assert1(sscanf(argv[3], "%lg", &task_comm_size),
+              "Invalid argument %s\n", argv[3]);
 
-  {                  /*  Task creation */
+  {                             /*  Task creation */
     char sprintf_buffer[64];
 
-    todo = xbt_new0(m_task_t,number_of_tasks);
+    todo = xbt_new0(m_task_t, number_of_tasks);
 
     for (i = 0; i < number_of_tasks; i++) {
       sprintf(sprintf_buffer, "Task_%d", i);
-      todo[i] = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
+      todo[i] =
+        MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
     }
   }
 
-  {                  /* Process organisation */
+  {                             /* Process organisation */
     slaves_count = argc - 4;
-    slaves = xbt_new0(m_host_t,slaves_count);
-    
+    slaves = xbt_new0(m_host_t, slaves_count);
+
     for (i = 4; i < argc; i++) {
-      slaves[i-4] = MSG_get_host_by_name(argv[i]);
-      if(slaves[i-4]==NULL) {
-       INFO1("Unknown host %s. Stopping Now! ", argv[i]);
-       abort();
+      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      if (slaves[i - 4] == NULL) {
+        INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+        abort();
       }
     }
   }
@@ -228,40 +231,39 @@ int master(int argc, char *argv[])
 
   for (i = 0; i < number_of_tasks; i++) {
     INFO2("Sending \"%s\" to \"%s\"",
-                  todo[i]->name,
-                  slaves[i % slaves_count]->name);
-    if(MSG_host_self()==slaves[i % slaves_count]) {
+          todo[i]->name, slaves[i % slaves_count]->name);
+    if (MSG_host_self() == slaves[i % slaves_count]) {
       INFO0("Hey ! It's me ! :)");
     }
-    MSG_task_put(todo[i], slaves[i % slaves_count],
-                 PORT_22);
+    MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22);
     INFO0("Send completed");
   }
-  
-  INFO0("All tasks have been dispatched. Let's tell everybody the computation is over.");
-  for (i = 0; i < slaves_count; i++) 
+
+  INFO0
+    ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+  for (i = 0; i < slaves_count; i++)
     MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
-                slaves[i], PORT_22);
-  
+                 slaves[i], PORT_22);
+
   INFO0("Goodbye now!");
   free(slaves);
   free(todo);
   return 0;
-} /* end_of_master */
+}                               /* end_of_master */
 
 /** Receiver function  */
 int slave(int argc, char *argv[])
 {
   INFO0("I'm a slave");
-  while(1) {
+  while (1) {
     m_task_t task = NULL;
     int a;
     a = MSG_task_get(&(task), PORT_22);
     if (a == MSG_OK) {
       INFO1("Received \"%s\" ", MSG_task_get_name(task));
-      if(MSG_task_get_data(task)==FINALIZE) {
-       MSG_task_destroy(task);
-       break;
+      if (MSG_task_get_data(task) == FINALIZE) {
+        MSG_task_destroy(task);
+        break;
       }
       INFO1("Processing \"%s\" ", MSG_task_get_name(task));
       MSG_task_execute(task);
@@ -269,46 +271,47 @@ int slave(int argc, char *argv[])
       MSG_task_destroy(task);
     } else {
       INFO0("Hey ?! What's up ? ");
-      xbt_assert0(0,"Unexpected behavior");
+      xbt_assert0(0, "Unexpected behavior");
     }
   }
   INFO0("I'm done. See you!");
   return 0;
-} /* end_of_slave */
+}                               /* end_of_slave */
 
 /** Test function */
 MSG_error_t test_all(void)
 {
   MSG_error_t res = MSG_OK;
 
-   /*  Simulation setting */
-   MSG_set_channel_number(MAX_CHANNEL);
-   MSG_paje_output("msg_test.trace");
-   surf_parse = surf_parse_bypass_platform;
-   MSG_create_environment(NULL);
-  
-   /*   Application deployment */
-   MSG_function_register("master", master);
-   MSG_function_register("slave", slave);
-   surf_parse = surf_parse_bypass_application;
-   MSG_launch_application(NULL);
-   
-   res = MSG_main();
-  
-  INFO1("Simulation time %g",MSG_get_clock());
+  /*  Simulation setting */
+  MSG_set_channel_number(MAX_CHANNEL);
+  MSG_paje_output("msg_test.trace");
+  surf_parse = surf_parse_bypass_platform;
+  MSG_create_environment(NULL);
+
+  /*   Application deployment */
+  MSG_function_register("master", master);
+  MSG_function_register("slave", slave);
+  surf_parse = surf_parse_bypass_application;
+  MSG_launch_application(NULL);
+
+  res = MSG_main();
+
+  INFO1("Simulation time %g", MSG_get_clock());
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 /** Main function */
 int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   res = test_all();
   MSG_clean();
 
-  if(res==MSG_OK) return 0; 
-  else return 1;
-} /* end_of_main */
-
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
index 57502fa..53d1116 100644 (file)
@@ -6,13 +6,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 int master(int argc, char *argv[]);
 int slave(int argc, char *argv[]);
@@ -24,7 +25,7 @@ typedef enum {
   MAX_CHANNEL
 } channel_t;
 
-#define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
+#define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
 /** Emitter function  */
 int master(int argc, char *argv[])
@@ -38,22 +39,22 @@ int master(int argc, char *argv[])
 
   int i;
 
-  xbt_assert1(sscanf(argv[1],"%d", &number_of_tasks),
-        "Invalid argument %s\n",argv[1]);
-  xbt_assert1(sscanf(argv[2],"%lg", &task_comp_size),
-        "Invalid argument %s\n",argv[2]);
-  xbt_assert1(sscanf(argv[3],"%lg", &task_comm_size),
-        "Invalid argument %s\n",argv[3]);
+  xbt_assert1(sscanf(argv[1], "%d", &number_of_tasks),
+              "Invalid argument %s\n", argv[1]);
+  xbt_assert1(sscanf(argv[2], "%lg", &task_comp_size),
+              "Invalid argument %s\n", argv[2]);
+  xbt_assert1(sscanf(argv[3], "%lg", &task_comm_size),
+              "Invalid argument %s\n", argv[3]);
 
-  {                  /* Process organisation */
+  {                             /* Process organisation */
     slaves_count = argc - 4;
-    slaves = xbt_new0(m_host_t,slaves_count);
-    
+    slaves = xbt_new0(m_host_t, slaves_count);
+
     for (i = 4; i < argc; i++) {
-      slaves[i-4] = MSG_get_host_by_name(argv[i]);
-      if(slaves[i-4]==NULL) {
-       INFO1("Unknown host %s. Stopping Now! ", argv[i]);
-       abort();
+      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      if (slaves[i - 4] == NULL) {
+        INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+        abort();
       }
     }
   }
@@ -65,120 +66,128 @@ int master(int argc, char *argv[])
   INFO1("Got %d task to process :", number_of_tasks);
 
   for (i = 0; i < number_of_tasks; i++) {
-    m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size, 
-                                   xbt_new0(double,1));
+    m_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
+                                    xbt_new0(double, 1));
     int a;
-    *((double*) task->data) = MSG_get_clock();
-    
-    a = MSG_task_put_with_timeout(task, slaves[i % slaves_count], PORT_22,10.0);
+    *((double *) task->data) = MSG_get_clock();
+
+    a =
+      MSG_task_put_with_timeout(task, slaves[i % slaves_count], PORT_22,
+                                10.0);
     if (a == MSG_OK) {
       INFO0("Send completed");
     } else if (a == MSG_HOST_FAILURE) {
-      INFO0("Gloups. The cpu on which I'm running just turned off!. See you!");
+      INFO0
+        ("Gloups. The cpu on which I'm running just turned off!. See you!");
       free(slaves);
       return 0;
     } else if (a == MSG_TRANSFER_FAILURE) {
-      INFO1("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
-           slaves[i % slaves_count]->name);
+      INFO1
+        ("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
+         slaves[i % slaves_count]->name);
       MSG_task_destroy(task);
     } else {
       INFO0("Hey ?! What's up ? ");
-      xbt_assert0(0,"Unexpected behavior");
+      xbt_assert0(0, "Unexpected behavior");
     }
   }
-  
-  INFO0("All tasks have been dispatched. Let's tell everybody the computation is over.");
+
+  INFO0
+    ("All tasks have been dispatched. Let's tell everybody the computation is over.");
   for (i = 0; i < slaves_count; i++) {
     m_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
-    int a = MSG_task_put_with_timeout(task, slaves[i], PORT_22,1.0); 
-    if (a == MSG_OK) continue;
+    int a = MSG_task_put_with_timeout(task, slaves[i], PORT_22, 1.0);
+    if (a == MSG_OK)
+      continue;
     if (a == MSG_HOST_FAILURE) {
-      INFO0("Gloups. The cpu on which I'm running just turned off!. See you!");
+      INFO0
+        ("Gloups. The cpu on which I'm running just turned off!. See you!");
       return 0;
     } else if (a == MSG_TRANSFER_FAILURE) {
       INFO1("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
-           slaves[i]->name);
+            slaves[i]->name);
       MSG_task_destroy(task);
     } else {
       INFO0("Hey ?! What's up ? ");
-      xbt_assert2(0,"Unexpected behavior with '%s': %d",slaves[i]->name,a);
-    }    
+      xbt_assert2(0, "Unexpected behavior with '%s': %d", slaves[i]->name, a);
+    }
   }
-  
+
   INFO0("Goodbye now!");
   free(slaves);
   return 0;
-} /* end_of_master */
+}                               /* end_of_master */
 
 /** Receiver function  */
 int slave(int argc, char *argv[])
 {
-  while(1) {
+  while (1) {
     m_task_t task = NULL;
     int a;
-    double time1,time2;
+    double time1, time2;
 
     time1 = MSG_get_clock();
     a = MSG_task_get(&(task), PORT_22);
     time2 = MSG_get_clock();
     if (a == MSG_OK) {
       INFO1("Received \"%s\"", MSG_task_get_name(task));
-      if(MSG_task_get_data(task)==FINALIZE) {
-       MSG_task_destroy(task);
-       break;
+      if (MSG_task_get_data(task) == FINALIZE) {
+        MSG_task_destroy(task);
+        break;
       }
-      if(time1<*((double *)task->data))
-       time1 = *((double *) task->data);
-      INFO1("Communication time : \"%f\"", time2-time1);
+      if (time1 < *((double *) task->data))
+        time1 = *((double *) task->data);
+      INFO1("Communication time : \"%f\"", time2 - time1);
       INFO1("Processing \"%s\"", MSG_task_get_name(task));
       a = MSG_task_execute(task);
       if (a == MSG_OK) {
-      INFO1("\"%s\" done", MSG_task_get_name(task));
-      free(task->data);
-      MSG_task_destroy(task);
+        INFO1("\"%s\" done", MSG_task_get_name(task));
+        free(task->data);
+        MSG_task_destroy(task);
       } else if (a == MSG_HOST_FAILURE) {
-       INFO0("Gloups. The cpu on which I'm running just turned off!. See you!");
-       return 0;
+        INFO0
+          ("Gloups. The cpu on which I'm running just turned off!. See you!");
+        return 0;
       } else {
-       INFO0("Hey ?! What's up ? ");
-       xbt_assert0(0,"Unexpected behavior");
+        INFO0("Hey ?! What's up ? ");
+        xbt_assert0(0, "Unexpected behavior");
       }
     } else if (a == MSG_HOST_FAILURE) {
-      INFO0("Gloups. The cpu on which I'm running just turned off!. See you!");
+      INFO0
+        ("Gloups. The cpu on which I'm running just turned off!. See you!");
       return 0;
     } else if (a == MSG_TRANSFER_FAILURE) {
-      INFO0("Mmh. Something went wrong. Nevermind. Let's keep going!");      
+      INFO0("Mmh. Something went wrong. Nevermind. Let's keep going!");
     } else {
       INFO0("Hey ?! What's up ? ");
-      xbt_assert0(0,"Unexpected behavior");
+      xbt_assert0(0, "Unexpected behavior");
     }
   }
   INFO0("I'm done. See you!");
   return 0;
-} /* end_of_slave */
+}                               /* end_of_slave */
 
 /** Test function */
-MSG_error_t test_all(const char *platform_file,
-                           const char *application_file)
+MSG_error_t test_all(const char *platform_file, const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
   /* MSG_config("workstation_model","KCCFLN05"); */
-  {                            /*  Simulation setting */
+  {                             /*  Simulation setting */
     MSG_set_channel_number(MAX_CHANNEL);
     MSG_paje_output("msg_test.trace");
     MSG_create_environment(platform_file);
   }
-  {                            /*   Application deployment */
+  {                             /*   Application deployment */
     MSG_function_register("master", master);
     MSG_function_register("slave", slave);
     MSG_launch_application(application_file);
   }
   res = MSG_main();
-  
-  INFO1("Simulation time %g",MSG_get_clock());
+
+  INFO1("Simulation time %g", MSG_get_clock());
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 
 /** Main function */
@@ -186,17 +195,17 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
+    exit(1);
   }
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
   MSG_clean();
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
     return 1;
-} /* end_of_main */
+}                               /* end_of_main */
index c3179a0..3ddef7c 100644 (file)
@@ -6,13 +6,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 int master(int argc, char *argv[]);
 int slave(int argc, char *argv[]);
@@ -24,7 +25,7 @@ typedef enum {
   MAX_CHANNEL
 } channel_t;
 
-#define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
+#define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
 
 /** Emitter function  */
 int master(int argc, char *argv[])
@@ -39,77 +40,79 @@ int master(int argc, char *argv[])
 
   int i;
 
-  xbt_assert1(sscanf(argv[1],"%d", &number_of_tasks),
-        "Invalid argument %s\n",argv[1]);
-  xbt_assert1(sscanf(argv[2],"%lg", &task_comp_size),
-        "Invalid argument %s\n",argv[2]);
-  xbt_assert1(sscanf(argv[3],"%lg", &task_comm_size),
-        "Invalid argument %s\n",argv[3]);
+  xbt_assert1(sscanf(argv[1], "%d", &number_of_tasks),
+              "Invalid argument %s\n", argv[1]);
+  xbt_assert1(sscanf(argv[2], "%lg", &task_comp_size),
+              "Invalid argument %s\n", argv[2]);
+  xbt_assert1(sscanf(argv[3], "%lg", &task_comm_size),
+              "Invalid argument %s\n", argv[3]);
 
-  {                  /*  Task creation */
+  {                             /*  Task creation */
     char sprintf_buffer[64];
 
-    todo = xbt_new0(m_task_t,number_of_tasks);
+    todo = xbt_new0(m_task_t, number_of_tasks);
 
     for (i = 0; i < number_of_tasks; i++) {
       sprintf(sprintf_buffer, "Task_%d", i);
-      todo[i] = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
+      todo[i] =
+        MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL);
     }
   }
 
-  {                  /* Process organisation */
+  {                             /* Process organisation */
     slaves_count = argc - 4;
-    slaves = xbt_new0(m_host_t,slaves_count);
-    
+    slaves = xbt_new0(m_host_t, slaves_count);
+
     for (i = 4; i < argc; i++) {
-      slaves[i-4] = MSG_get_host_by_name(argv[i]);
-      xbt_assert1(slaves[i-4]!=NULL, "Unknown host %s. Stopping Now! ", argv[i]);
+      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      xbt_assert1(slaves[i - 4] != NULL, "Unknown host %s. Stopping Now! ",
+                  argv[i]);
     }
   }
 
-  INFO2("Got %d slaves and %d tasks to process", slaves_count,number_of_tasks);
+  INFO2("Got %d slaves and %d tasks to process", slaves_count,
+        number_of_tasks);
   for (i = 0; i < slaves_count; i++)
     DEBUG1("%s", slaves[i]->name);
 
   for (i = 0; i < number_of_tasks; i++) {
     INFO2("Sending \"%s\" to \"%s\"",
-                  todo[i]->name,
-                  slaves[i % slaves_count]->name);
-    if(MSG_host_self()==slaves[i % slaves_count]) {
+          todo[i]->name, slaves[i % slaves_count]->name);
+    if (MSG_host_self() == slaves[i % slaves_count]) {
       INFO0("Hey ! It's me ! :)");
     }
 
-    MSG_task_put(todo[i], slaves[i % slaves_count],
-                 PORT_22);
+    MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22);
     INFO0("Sent");
   }
-  
-  INFO0("All tasks have been dispatched. Let's tell everybody the computation is over.");
-  for (i = 0; i < slaves_count; i++) 
+
+  INFO0
+    ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+  for (i = 0; i < slaves_count; i++)
     MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
-                slaves[i], PORT_22);
-  
+                 slaves[i], PORT_22);
+
   INFO0("Goodbye now!");
   free(slaves);
   free(todo);
   return 0;
-} /* end_of_master */
+}                               /* end_of_master */
 
 /** Receiver function  */
 int slave(int argc, char *argv[])
 {
   m_task_t task = NULL;
   int res;
-  while(1) {
+  while (1) {
     res = MSG_task_get(&(task), PORT_22);
     xbt_assert0(res == MSG_OK, "MSG_task_get failed");
 
     INFO1("Received \"%s\"", MSG_task_get_name(task));
-    if (!strcmp(MSG_task_get_name(task),"finalize")) {
-       MSG_task_destroy(task);
-       break;
+    if (!strcmp(MSG_task_get_name(task), "finalize")) {
+      MSG_task_destroy(task);
+      break;
     }
-     
+
     INFO1("Processing \"%s\"", MSG_task_get_name(task));
     MSG_task_execute(task);
     INFO1("\"%s\" done", MSG_task_get_name(task));
@@ -118,7 +121,7 @@ int slave(int argc, char *argv[])
   }
   INFO0("I'm done. See you!");
   return 0;
-} /* end_of_slave */
+}                               /* end_of_slave */
 
 /** Forwarder function */
 int forwarder(int argc, char *argv[])
@@ -127,73 +130,71 @@ int forwarder(int argc, char *argv[])
   int slaves_count;
   m_host_t *slaves;
 
-  {                  /* Process organisation */
+  {                             /* Process organisation */
     slaves_count = argc - 1;
-    slaves = xbt_new0(m_host_t,slaves_count);
-    
+    slaves = xbt_new0(m_host_t, slaves_count);
+
     for (i = 1; i < argc; i++) {
-      slaves[i-1] = MSG_get_host_by_name(argv[i]);
-      if(slaves[i-1]==NULL) {
-       INFO1("Unknown host %s. Stopping Now! ", argv[i]);
-       abort();
+      slaves[i - 1] = MSG_get_host_by_name(argv[i]);
+      if (slaves[i - 1] == NULL) {
+        INFO1("Unknown host %s. Stopping Now! ", argv[i]);
+        abort();
       }
     }
   }
 
-  i=0;
-  while(1) {
+  i = 0;
+  while (1) {
     m_task_t task = NULL;
     int a;
     a = MSG_task_get(&(task), PORT_22);
     if (a == MSG_OK) {
       INFO1("Received \"%s\"", MSG_task_get_name(task));
-      if(MSG_task_get_data(task)==FINALIZE) {
-       INFO0("All tasks have been dispatched. Let's tell everybody the computation is over.");
-       for (i = 0; i < slaves_count; i++) 
-         MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
-                      slaves[i], PORT_22);
-       MSG_task_destroy(task);
-       break;
+      if (MSG_task_get_data(task) == FINALIZE) {
+        INFO0
+          ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+        for (i = 0; i < slaves_count; i++)
+          MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE),
+                       slaves[i], PORT_22);
+        MSG_task_destroy(task);
+        break;
       }
       INFO2("Sending \"%s\" to \"%s\"",
-                   MSG_task_get_name(task),
-                   slaves[i% slaves_count]->name);
-      MSG_task_put(task, slaves[i % slaves_count],
-                  PORT_22);
+            MSG_task_get_name(task), slaves[i % slaves_count]->name);
+      MSG_task_put(task, slaves[i % slaves_count], PORT_22);
       i++;
     } else {
       INFO0("Hey ?! What's up ? ");
-      xbt_assert0(0,"Unexpected behavior");
+      xbt_assert0(0, "Unexpected behavior");
     }
   }
 
   INFO0("I'm done. See you!");
   return 0;
-} /* end_of_forwarder */
+}                               /* end_of_forwarder */
 
 /** Test function */
-MSG_error_t test_all(const char *platform_file,
-                           const char *application_file)
+MSG_error_t test_all(const char *platform_file, const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
   /* MSG_config("surf_workstation_model","KCCFLN05"); */
-  {                            /*  Simulation setting */
+  {                             /*  Simulation setting */
     MSG_set_channel_number(MAX_CHANNEL);
     MSG_paje_output("msg_test.trace");
     MSG_create_environment(platform_file);
   }
-  {                            /*   Application deployment */
+  {                             /*   Application deployment */
     MSG_function_register("master", master);
     MSG_function_register("slave", slave);
     MSG_function_register("forwarder", forwarder);
     MSG_launch_application(application_file);
   }
   res = MSG_main();
-  
-  INFO1("Simulation time %g",MSG_get_clock());
+
+  INFO1("Simulation time %g", MSG_get_clock());
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 
 /** Main function */
@@ -201,17 +202,17 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
+    exit(1);
   }
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
   MSG_clean();
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
     return 1;
-} /* end_of_main */
+}                               /* end_of_main */
index 8ac3813..04186be 100644 (file)
@@ -5,28 +5,30 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "msg/msg.h" /* core library */
-#include "xbt/sysdep.h" /* calloc */
+#include "msg/msg.h"            /* core library */
+#include "xbt/sysdep.h"         /* calloc */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 /** The guy we will move from host to host. It move alone and then is moved by policeman back  */
 static int emigrant(int argc, char *argv[])
 {
-       m_task_t task;
-  INFO0("I'll look for a new job on another machine where the grass is greener.");
+  m_task_t task;
+  INFO0
+    ("I'll look for a new job on another machine where the grass is greener.");
   MSG_process_change_host(MSG_get_host_by_name("Boivin"));
   INFO0("Yeah, found something to do");
-  task = MSG_task_create("job",98095000,0,NULL);
+  task = MSG_task_create("job", 98095000, 0, NULL);
   MSG_task_execute(task);
   MSG_task_destroy(task);
   INFO0("Moving back home after work");
   MSG_process_change_host(MSG_get_host_by_name("Jacquelin"));
   INFO0("Uh, nothing to do here. Stopping now");
   return 0;
-} /* end_of_emigrant */
+}                               /* end_of_emigrant */
 
 /* This function would move the emigrant back home, if it were possible to do so in the MSG API.
  * Nothing for now.
@@ -35,19 +37,21 @@ static int policeman(int argc, char *argv[])
 {
   INFO0("No function in the API to move the emigrant back, so do nothing.");
   return 0;
-} /* end_of_policeman */
+}                               /* end_of_policeman */
 
 
 /** Main function */
-int main(int argc, char *argv[]) {
+int main(int argc, char *argv[])
+{
   MSG_error_t res = MSG_OK;
 
   /* Argument checking */
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     CRITICAL1 ("Usage: %s platform_file deployment_file\n",argv[0]);
-     CRITICAL1 ("example: %s msg_platform.xml msg_deployment_suspend.xml\n",argv[0]);
-     exit(1);
+    CRITICAL1("Usage: %s platform_file deployment_file\n", argv[0]);
+    CRITICAL1("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
+              argv[0]);
+    exit(1);
   }
 
   /* Simulation setting */
@@ -59,12 +63,12 @@ int main(int argc, char *argv[]) {
 
   /* Run the simulation */
   res = MSG_main();
-  INFO1("Simulation time %g",MSG_get_clock());
-  if (res==MSG_OK)
-         res = MSG_clean();
+  INFO1("Simulation time %g", MSG_get_clock());
+  if (res == MSG_OK)
+    res = MSG_clean();
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
     return 1;
-} /* end_of_main */
+}                               /* end_of_main */
index 7dd8748..771a97b 100644 (file)
@@ -6,13 +6,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 int test(int argc, char *argv[]);
 MSG_error_t test_all(const char *platform_file);
@@ -27,50 +28,49 @@ int test(int argc, char *argv[])
   double *computation_amount = NULL;
   double *communication_amount = NULL;
   m_task_t ptask = NULL;
-  int i,j;
+  int i, j;
 
   slaves_count = MSG_get_host_number();
   slaves = MSG_get_host_table();
 
-  computation_amount = xbt_new0(double,slaves_count);
-  communication_amount = xbt_new0(double,slaves_count*slaves_count);
-  
-  for(i=0;i<slaves_count;i++) 
-    computation_amount[i]=task_comp_size;
+  computation_amount = xbt_new0(double, slaves_count);
+  communication_amount = xbt_new0(double, slaves_count * slaves_count);
 
-  for(i=0;i<slaves_count;i++) 
-    for(j=i+1;j<slaves_count;j++) 
-      communication_amount[i*slaves_count+j]=task_comm_size;
+  for (i = 0; i < slaves_count; i++)
+    computation_amount[i] = task_comp_size;
+
+  for (i = 0; i < slaves_count; i++)
+    for (j = i + 1; j < slaves_count; j++)
+      communication_amount[i * slaves_count + j] = task_comm_size;
 
   ptask = MSG_parallel_task_create("parallel task",
-                                  slaves_count, slaves,
-                                  computation_amount,
-                                  communication_amount,
-                                  NULL);
+                                   slaves_count, slaves,
+                                   computation_amount,
+                                   communication_amount, NULL);
   MSG_parallel_task_execute(ptask);
 
   /* There is no need to free that! */
 /*   free(communication_amount); */
 /*   free(computation_amount); */
-  
+
   INFO0("Goodbye now!");
   free(slaves);
   return 0;
-} 
+}
 
 /** Test function */
 MSG_error_t test_all(const char *platform_file)
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_config("workstation_model","ptask_L07");
+  MSG_config("workstation_model", "ptask_L07");
   MSG_set_channel_number(1);
   MSG_create_environment(platform_file);
 
-  MSG_process_create("test",test,NULL,MSG_get_host_table()[0]);
+  MSG_process_create("test", test, NULL, MSG_get_host_table()[0]);
   res = MSG_main();
-  
-  INFO1("Simulation time %g",MSG_get_clock());
+
+  INFO1("Simulation time %g", MSG_get_clock());
   return res;
 }
 
@@ -78,16 +78,16 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 2) {
-     printf ("Usage: %s platform_file\n",argv[0]);
-     printf ("example: %s msg_platform.xml\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file\n", argv[0]);
+    printf("example: %s msg_platform.xml\n", argv[0]);
+    exit(1);
   }
   res = test_all(argv[1]);
   MSG_clean();
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
     return 1;
index b74a2e2..df74c53 100644 (file)
@@ -1,18 +1,17 @@
 #include <stdio.h>
-#include "msg/msg.h"           /* Yeah! If you want to use msg, you
-                                  need to include msg/msg.h */
-#include "xbt/sysdep.h"                /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you
+                                   need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
-                            "Messages specific for this msg example");
+                             "Messages specific for this msg example");
 
 int execute(int argc, char *argv[]);
 int redistribute(int argc, char *argv[]);
-MSG_error_t test_all(const char *platform_file,
-                    const char *application_file);
+MSG_error_t test_all(const char *platform_file, const char *application_file);
 
 typedef enum {
   PORT_22 = 0,
@@ -40,29 +39,29 @@ int execute(int argc, char *argv[])
   for (i = 1; i <= host_list_size; i++) {
     m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
     xbt_assert1(m_host_list[i - 1] != NULL,
-               "Unknown host %s. Stopping Now! ", argv[i]);
+                "Unknown host %s. Stopping Now! ", argv[i]);
   }
 
   xbt_assert1(sscanf(argv[argc - 2], "%lg", &computation_amount),
-             "Invalid argument %s\n",argv[argc - 2]);
+              "Invalid argument %s\n", argv[argc - 2]);
   xbt_assert1(sscanf(argv[argc - 1], "%lg", &communication_amount),
-             "Invalid argument %s\n",argv[argc - 1]);
+              "Invalid argument %s\n", argv[argc - 1]);
   computation_duration = (double *) calloc(host_list_size, sizeof(double));
   communication_table =
-      (double *) calloc(host_list_size * host_list_size, sizeof(double));
+    (double *) calloc(host_list_size * host_list_size, sizeof(double));
   for (i = 0; i < host_list_size; i++) {
     computation_duration[i] = computation_amount / host_list_size;
     for (j = 0; j < host_list_size; j++)
-      communication_table[i * host_list_size + j]  =
-       communication_amount / (host_list_size * host_list_size);
+      communication_table[i * host_list_size + j] =
+        communication_amount / (host_list_size * host_list_size);
   }
 
   sprintf(buffer, "redist#0\n");
   task = MSG_parallel_task_create(buffer,
-                                 host_list_size,
-                                 m_host_list,
-                                 computation_duration,
-                                 communication_table, NULL);
+                                  host_list_size,
+                                  m_host_list,
+                                  computation_duration,
+                                  communication_table, NULL);
 
   execution_time = MSG_get_clock();
   MSG_parallel_task_execute(task);
@@ -93,26 +92,26 @@ int redistribute(int argc, char *argv[])
   for (i = 1; i <= host_list_size; i++) {
     m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
     xbt_assert1(m_host_list[i - 1] != NULL,
-               "Unknown host %s. Stopping Now! ", argv[i]);
+                "Unknown host %s. Stopping Now! ", argv[i]);
   }
 
   xbt_assert1(sscanf(argv[argc - 1], "%lg", &communication_amount),
-             "Invalid argument %s\n",argv[argc - 1]);
+              "Invalid argument %s\n", argv[argc - 1]);
   computation_duration = (double *) calloc(host_list_size, sizeof(double));
   communication_table =
-      (double *) calloc(host_list_size * host_list_size, sizeof(double));
+    (double *) calloc(host_list_size * host_list_size, sizeof(double));
   for (i = 0; i < host_list_size; i++) {
     for (j = 0; j < host_list_size; j++)
-      communication_table[i * host_list_size + j]  =
-       communication_amount / (host_list_size * host_list_size);
+      communication_table[i * host_list_size + j] =
+        communication_amount / (host_list_size * host_list_size);
   }
 
   sprintf(buffer, "redist#0\n");
   task = MSG_parallel_task_create(buffer,
-                                 host_list_size,
-                                 m_host_list,
-                                 computation_duration,
-                                 communication_table, NULL);
+                                  host_list_size,
+                                  m_host_list,
+                                  computation_duration,
+                                  communication_table, NULL);
 
   redistribution_time = MSG_get_clock();
   MSG_parallel_task_execute(task);
@@ -124,23 +123,22 @@ int redistribute(int argc, char *argv[])
 }
 
 
-MSG_error_t test_all(const char *platform_file,
-                    const char *application_file)
+MSG_error_t test_all(const char *platform_file, const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
 
-  MSG_config("workstation_model","ptask_L07");
+  MSG_config("workstation_model", "ptask_L07");
 
   /*  Simulation setting */
   MSG_set_channel_number(MAX_CHANNEL);
   MSG_create_environment(platform_file);
-  
+
   /*   Application deployment */
   MSG_function_register("execute", execute);
   MSG_function_register("redistribute", redistribute);
   MSG_launch_application(application_file);
-  
+
   res = MSG_main();
 
   INFO1("Simulation time %g", MSG_get_clock());
index 291039d..8eaf731 100644 (file)
@@ -6,13 +6,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdio.h>
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 static int test(int argc, char *argv[])
 {
@@ -21,66 +22,66 @@ static int test(int argc, char *argv[])
   m_task_t task = NULL;
 
 
-  xbt_assert1(sscanf(argv[1],"%lg", &computation_amount),
-        "Invalid argument %s\n",argv[1]);
-  xbt_assert1(sscanf(argv[2],"%lg", &priority),
-        "Invalid argument %s\n",argv[2]);
+  xbt_assert1(sscanf(argv[1], "%lg", &computation_amount),
+              "Invalid argument %s\n", argv[1]);
+  xbt_assert1(sscanf(argv[2], "%lg", &priority),
+              "Invalid argument %s\n", argv[2]);
 
   INFO2("Hello! Running a task of size %g with priority %g",
-       computation_amount, priority);
-  task = MSG_task_create("Task", computation_amount, 0.0,NULL);
+        computation_amount, priority);
+  task = MSG_task_create("Task", computation_amount, 0.0, NULL);
   MSG_task_set_priority(task, priority);
 
   MSG_task_execute(task);
 
-  
+
   INFO0("Goodbye now!");
   return 0;
-} 
+}
 
 static MSG_error_t test_all(const char *platform_file,
-                           const char *application_file)
+                            const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
-  {                            /*  Simulation setting */
+  {                             /*  Simulation setting */
     MSG_set_channel_number(1);
     MSG_paje_output("msg_test.trace");
     MSG_create_environment(platform_file);
   }
-  {                            /*   Application deployment */
+  {                             /*   Application deployment */
     MSG_function_register("test", test);
     MSG_launch_application(application_file);
   }
   res = MSG_main();
-  
-  INFO1("Simulation time %g",MSG_get_clock());
+
+  INFO1("Simulation time %g", MSG_get_clock());
   return res;
 }
 
 int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
-  
-  #ifdef _MSC_VER
+
+#ifdef _MSC_VER
   unsigned int prev_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
-  #endif
+#endif
 
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
+    exit(1);
   }
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
   MSG_clean();
-  
-  #ifdef _MSC_VER
+
+#ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
-  #endif
+#endif
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
     return 1;
index ca19687..0e26b45 100644 (file)
@@ -5,8 +5,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
@@ -15,7 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Property test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Property test");
 
 int alice(int argc, char *argv[]);
 int bob(int argc, char *argv[]);
@@ -26,33 +26,37 @@ int alice(int argc, char *argv[])
 {
   m_host_t host1 = MSG_get_host_by_name("host1");
   xbt_dict_t props = MSG_host_get_properties(host1);
-  xbt_dict_cursor_t cursor=NULL;
-  char *key,*data;
-  const char *noexist="Unknown";
-  const char*value;
-  char exist[]="SG_TEST_Hdd";
+  xbt_dict_cursor_t cursor = NULL;
+  char *key, *data;
+  const char *noexist = "Unknown";
+  const char *value;
+  char exist[] = "SG_TEST_Hdd";
 
   INFO0("== Print the properties of the host");
-  xbt_dict_foreach(props,cursor,key,data)
-    INFO2("  Host property: '%s' -> '%s'",key,data);
+  xbt_dict_foreach(props, cursor, key, data)
+    INFO2("  Host property: '%s' -> '%s'", key, data);
 
-  INFO0("== Try to get a host property that does not exist");     
+  INFO0("== Try to get a host property that does not exist");
   value = MSG_host_get_property_value(host1, noexist);
   xbt_assert0(!value, "The key exists (it's not supposed to)");
 
-  INFO0("== Try to get a host property that does exist");     
-  value = MSG_host_get_property_value(host1,exist);
-  xbt_assert1(value,"\tProperty %s is undefined (where it should)", exist);
-  xbt_assert2(!strcmp(value,"180"),"\tValue of property %s is defined to %s (where it should be 180)", exist, value);
+  INFO0("== Try to get a host property that does exist");
+  value = MSG_host_get_property_value(host1, exist);
+  xbt_assert1(value, "\tProperty %s is undefined (where it should)", exist);
+  xbt_assert2(!strcmp(value, "180"),
+              "\tValue of property %s is defined to %s (where it should be 180)",
+              exist, value);
   INFO2("   Property: %s old value: %s", exist, value);
 
   INFO0("== Trying to modify a host property");
   xbt_dict_set(props, exist, xbt_strdup("250"), xbt_free_f);
-  
+
   /* Test if we have changed the value */
-  value = MSG_host_get_property_value(host1,exist);
-  xbt_assert1(value,"Property %s is undefined (where it should)", exist);
-  xbt_assert2(!strcmp(value,"250"),"Value of property %s is defined to %s (where it should be 250)", exist, value);
+  value = MSG_host_get_property_value(host1, exist);
+  xbt_assert1(value, "Property %s is undefined (where it should)", exist);
+  xbt_assert2(!strcmp(value, "250"),
+              "Value of property %s is defined to %s (where it should be 250)",
+              exist, value);
   INFO2("   Property: %s old value: %s", exist, value);
 
   return 0;
@@ -62,35 +66,34 @@ int bob(int argc, char *argv[])
 {
   /* Get the property list of current bob process */
   xbt_dict_t props = MSG_process_get_properties(MSG_process_self());
-  xbt_dict_cursor_t cursor=NULL;
-  char *key,*data;
-  const char *noexist="UnknownProcessProp";
+  xbt_dict_cursor_t cursor = NULL;
+  char *key, *data;
+  const char *noexist = "UnknownProcessProp";
   const char *value;
 
   INFO0("== Print the properties of the process");
-  xbt_dict_foreach(props,cursor,key,data)
-    INFO2("   Process property: %s -> %s",key,data);
+  xbt_dict_foreach(props, cursor, key, data)
+    INFO2("   Process property: %s -> %s", key, data);
 
   INFO0("== Try to get a process property that does not exist");
-  value = MSG_process_get_property_value(MSG_process_self(),noexist);
-  xbt_assert0(!value,"The property is defined (it shouldnt)");
+
+  value = MSG_process_get_property_value(MSG_process_self(), noexist);
+  xbt_assert0(!value, "The property is defined (it shouldnt)");
 
   return 0;
-} 
+}
 
 /** Test function */
-MSG_error_t test_all(const char *platform_file,
-                           const char *application_file)
+MSG_error_t test_all(const char *platform_file, const char *application_file)
 {
   MSG_function_register("alice", alice);
   MSG_function_register("bob", bob);
-   
+
   MSG_create_environment(platform_file);
   MSG_launch_application(application_file);
 
   return MSG_main();
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 
 /** Main function */
@@ -98,17 +101,17 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     printf ("Usage: %s platform_file deployment_file\n",argv[0]);
-     printf ("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-     exit(1);
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
+    exit(1);
   }
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
   MSG_clean();
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
     return 1;
-} /* end_of_main */
+}                               /* end_of_main */
index 0f5051f..58b6b09 100644 (file)
@@ -5,72 +5,72 @@
 
 #include<stdio.h>
 
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 int sender(int argc, char *argv[]);
 int receiver(int argc, char *argv[]);
 
 MSG_error_t test_all(const char *platform_file, const char *application_file);
 
-typedef enum 
-  {
-    PORT_22 = 0,
-    MAX_CHANNEL
-  } channel_t;
+typedef enum {
+  PORT_22 = 0,
+  MAX_CHANNEL
+} channel_t;
 
 double task_comm_size_lat = 10e0;
-double task_comm_size_bw  = 10e8;
+double task_comm_size_bw = 10e8;
 
 /** Emitter function  */
-int sender(int argc,char *argv[] )
+int sender(int argc, char *argv[])
 {
-  m_host_t host = NULL; 
+  m_host_t host = NULL;
   double time;
-  m_task_t task_la=NULL;
-  m_task_t task_bw=NULL;
+  m_task_t task_la = NULL;
+  m_task_t task_bw = NULL;
   char sprintf_buffer_la[64];
   char sprintf_buffer_bw[64];
 
   INFO0("sender");
-  /*host = xbt_new0(m_host_t,1);*/
-    
+
+  /*host = xbt_new0(m_host_t,1); */
+
   INFO1("host = %s", argv[1]);
-  
+
   host = MSG_get_host_by_name(argv[1]);
-  
-  if(host==NULL){
+
+  if (host == NULL) {
     INFO1("Unknown host %s. Stopping Now! ", argv[1]);
     abort();
   }
 
   /* Latency */
-  time= MSG_get_clock();
+  time = MSG_get_clock();
   sprintf(sprintf_buffer_la, "latency task");
   task_la = MSG_task_create(sprintf_buffer_la, 0.0, task_comm_size_lat, NULL);
   task_la->data = xbt_new(double, 1);
-  *(double *)task_la->data = time;
-  INFO1("task_la->data = %le", *((double *)task_la->data));
-  MSG_task_put(task_la, host,PORT_22);
-  
+  *(double *) task_la->data = time;
+  INFO1("task_la->data = %le", *((double *) task_la->data));
+  MSG_task_put(task_la, host, PORT_22);
+
   /* Bandwidth */
-  time=MSG_get_clock();
+  time = MSG_get_clock();
   sprintf(sprintf_buffer_bw, "bandwidth task");
   task_bw = MSG_task_create(sprintf_buffer_bw, 0.0, task_comm_size_bw, NULL);
   task_bw->data = xbt_new(double, 1);
-  *(double *)task_bw->data = time;
-  INFO1("task_bw->data = %le", *((double *)task_bw->data) ); 
-  MSG_task_put(task_bw, host,PORT_22);  
+  *(double *) task_bw->data = time;
+  INFO1("task_bw->data = %le", *((double *) task_bw->data));
+  MSG_task_put(task_bw, host, PORT_22);
 
   return 0;
-} /* end_of_client */
+}                               /* end_of_client */
 
 /** Receiver function  */
 int receiver(int argc, char *argv[])
@@ -79,92 +79,93 @@ int receiver(int argc, char *argv[])
   m_task_t task_la = NULL;
   m_task_t task_bw = NULL;
   int a;
-  double communication_time=0;
+  double communication_time = 0;
 
   INFO0("receiver");
 
   time = MSG_get_clock();
-  
+
   /* Get Latency */
-  a = MSG_task_get(&task_la,PORT_22);
+  a = MSG_task_get(&task_la, PORT_22);
   if (a == MSG_OK) {
-    time1=MSG_get_clock();
-    sender_time= *((double*)(task_la->data));
-    time=sender_time;
-    communication_time=time1-time;
+    time1 = MSG_get_clock();
+    sender_time = *((double *) (task_la->data));
+    time = sender_time;
+    communication_time = time1 - time;
     INFO1("Task received : %s", task_la->name);
     MSG_task_destroy(task_la);
-    INFO1("Communic. time %le",communication_time);
-    INFO1("--- la %f ----",communication_time);
-  }else{
-    xbt_assert0(0,"Unexpected behavior");
+    INFO1("Communic. time %le", communication_time);
+    INFO1("--- la %f ----", communication_time);
+  } else {
+    xbt_assert0(0, "Unexpected behavior");
   }
 
 
   /* Get Bandwidth */
-  a=MSG_task_get(&task_bw,PORT_22);
+  a = MSG_task_get(&task_bw, PORT_22);
   if (a == MSG_OK) {
-    time1=MSG_get_clock();
-    sender_time= *((double*)(task_bw->data));
-    time=sender_time;
-    communication_time=time1-time;
+    time1 = MSG_get_clock();
+    sender_time = *((double *) (task_bw->data));
+    time = sender_time;
+    communication_time = time1 - time;
     INFO1("Task received : %s", task_bw->name);
     MSG_task_destroy(task_bw);
-    INFO1("Communic. time %le",communication_time);
-    INFO1("--- bw %f ----",task_comm_size_bw/communication_time);
-  }else{
-    xbt_assert0(0,"Unexpected behavior");
+    INFO1("Communic. time %le", communication_time);
+    INFO1("--- bw %f ----", task_comm_size_bw / communication_time);
+  } else {
+    xbt_assert0(0, "Unexpected behavior");
   }
 
-  
+
   return 0;
-}/* end_of_receiver */
+}                               /* end_of_receiver */
 
 
 /** Test function */
-MSG_error_t test_all(const char *platform_file,
-                           const char *application_file)
+MSG_error_t test_all(const char *platform_file, const char *application_file)
 {
 
   MSG_error_t res = MSG_OK;
 
-  
 
-  INFO0("test_all"); 
-                       
+
+  INFO0("test_all");
+
   /*  Simulation setting */
   MSG_set_channel_number(MAX_CHANNEL);
   MSG_paje_output("msg_test.trace");
   MSG_create_environment(platform_file);
+
   /*   Application deployment */
   MSG_function_register("sender", sender);
   MSG_function_register("receiver", receiver);
-   
+
   MSG_launch_application(application_file);
-  
+
   res = MSG_main();
 
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 
 /** Main function */
 int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
-       
-  #ifdef _MSC_VER
+
+#ifdef _MSC_VER
   unsigned int prev_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
-  #endif
-  
-  MSG_global_init(&argc,argv);
+#endif
+
+  MSG_global_init(&argc, argv);
 
 
-  if (argc != 3){
-     CRITICAL1 ("Usage: %s platform_file deployment_file <model>\n",argv[0]);
-     CRITICAL1 ("example: %s msg_platform.xml msg_deployment.xml KCCFLN05_Vegas\n",argv[0]);
-     exit(1);
+  if (argc != 3) {
+    CRITICAL1("Usage: %s platform_file deployment_file <model>\n", argv[0]);
+    CRITICAL1
+      ("example: %s msg_platform.xml msg_deployment.xml KCCFLN05_Vegas\n",
+       argv[0]);
+    exit(1);
   }
 
   /* Options for the workstation_model:
@@ -173,19 +174,21 @@ int main(int argc, char *argv[])
      KCCFLN05_proportional => for proportional (Vegas)
      KCCFLN05_Vegas        => for TCP Vegas
      KCCFLN05_Reno         => for TCP Reno
-  */
+   */
   //MSG_config("workstation_model", argv[3]);
 
-  res = test_all(argv[1],argv[2]);
+  res = test_all(argv[1], argv[2]);
 
   INFO1("Total simulation time: %le", MSG_get_clock());
 
   MSG_clean();
 
-  #ifdef _MSC_VER
+#ifdef _MSC_VER
   _set_output_format(prev_exponent_format);
-  #endif
+#endif
 
-  if(res==MSG_OK) return 0; 
-  else return 1;
-} /* end_of_main */
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
index 8bcba55..0f0ca9c 100644 (file)
@@ -5,12 +5,13 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "xbt/sysdep.h" /* calloc */
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
 
 typedef enum {
   PORT_22 = 0,
@@ -26,7 +27,7 @@ static int lazy_guy(int argc, char *argv[])
   INFO0("Uuuh ? Did somebody call me ?");
   INFO0("Mmmh, goodbye now.");
   return 0;
-} /* end_of_lazy_guy */
+}                               /* end_of_lazy_guy */
 
 /** Dream master function. This process creates a lazy_guy process and
     resumes it 10 seconds later. */
@@ -42,27 +43,28 @@ static int dream_master(int argc, char *argv[])
   MSG_process_resume(lazy);
   INFO0("OK, goodbye now.");
   return 0;
-} /* end_of_dram_master */
+}                               /* end_of_dram_master */
 
 /** Test function */
-static MSG_error_t test_all(const char *platform_file,const char *application_file)
+static MSG_error_t test_all(const char *platform_file,
+                            const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
-  {                            /*  Simulation setting */
+  {                             /*  Simulation setting */
     MSG_set_channel_number(MAX_CHANNEL);
     MSG_paje_output("msg_test.trace");
     MSG_create_environment(platform_file);
   }
-  {                            /*   Application deployment */
+  {                             /*   Application deployment */
     MSG_function_register("dream_master", dream_master);
     MSG_launch_application(application_file);
   }
   res = MSG_main();
-  
-  INFO1("Simulation time %g",MSG_get_clock());
+
+  INFO1("Simulation time %g", MSG_get_clock());
   return res;
-} /* end_of_test_all */
+}                               /* end_of_test_all */
 
 
 /** Main function */
@@ -70,17 +72,18 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   if (argc < 3) {
-     CRITICAL1 ("Usage: %s platform_file deployment_file\n",argv[0]);
-     CRITICAL1 ("example: %s msg_platform.xml msg_deployment_suspend.xml\n",argv[0]);
-     exit(1);
+    CRITICAL1("Usage: %s platform_file deployment_file\n", argv[0]);
+    CRITICAL1("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
+              argv[0]);
+    exit(1);
   }
-  test_all(argv[1],argv[2]);
+  test_all(argv[1], argv[2]);
   res = MSG_clean();
 
-  if(res==MSG_OK)
+  if (res == MSG_OK)
     return 0;
   else
-    return 1;              
-} /* end_of_main */
+    return 1;
+}                               /* end_of_main */
index 6122aca..d2a54f2 100644 (file)
 #include "xbt/time.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
-                            "Logging specific to this SimDag example");
+                             "Logging specific to this SimDag example");
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
-       const char * platform_file;
-       const SD_workstation_t *workstations;
+  const char *platform_file;
+  const SD_workstation_t *workstations;
   int ws_nr;
-   SD_workstation_t w1 = NULL;
+  SD_workstation_t w1 = NULL;
   SD_workstation_t w2 = NULL;
   const char *name1, *name2;
-   int i,j,k;
+  int i, j, k;
 
   /* initialisation of SD */
   SD_init(&argc, argv);
@@ -42,23 +43,25 @@ int main(int argc, char **argv) {
   workstations = SD_workstation_get_list();
   ws_nr = SD_workstation_get_number();
 
+
   /* Show routes between all workstation */
-  for (i=0; i<ws_nr; i++){
-    for (j=0;j<ws_nr; j++){
-                const SD_link_t *route;
-                int route_size;
+
+  for (i = 0; i < ws_nr; i++) {
+    for (j = 0; j < ws_nr; j++) {
+      const SD_link_t *route;
+      int route_size;
       w1 = workstations[i];
       w2 = workstations[j];
       name1 = SD_workstation_get_name(w1);
       name2 = SD_workstation_get_name(w2);
-      INFO2("Route between %s and %s:", name1, name2);   
+      INFO2("Route between %s and %s:", name1, name2);
       route = SD_route_get_list(w1, w2);
       route_size = SD_route_get_size(w1, w2);
       for (k = 0; k < route_size; k++) {
-        INFO3("\tLink %s: latency = %f, bandwidth = %f", SD_link_get_name(route[k]),
-         SD_link_get_current_latency(route[k]), SD_link_get_current_bandwidth(route[k]));
+        INFO3("\tLink %s: latency = %f, bandwidth = %f",
+              SD_link_get_name(route[k]),
+              SD_link_get_current_latency(route[k]),
+              SD_link_get_current_bandwidth(route[k]));
       }
     }
   }
@@ -66,4 +69,3 @@ int main(int argc, char **argv) {
   SD_exit();
   return 0;
 }
-
index 0ab21cb..1195000 100755 (executable)
@@ -8,10 +8,10 @@
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,
-                            "Property test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Property test");
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   int i;
   const SD_workstation_t *workstations;
   SD_workstation_t w1;
@@ -20,16 +20,16 @@ int main(int argc, char **argv) {
   const char *name2;
   xbt_dict_t props;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
-  char noexist[]="NoProp";
+  char *key, *data;
+  char noexist[] = "NoProp";
   const char *value;
-  char exist[]="SG_TEST_Hdd";
-   
+  char exist[] = "SG_TEST_Hdd";
+
   const SD_link_t *route;
   int route_size;
 
   /* initialisation of SD */
-  SD_init(&argc, argv);        
+  SD_init(&argc, argv);
   if (argc < 2) {
     INFO1("Usage: %s platform_file", argv[0]);
     INFO1("example: %s sd_platform.xml", argv[0]);
@@ -47,24 +47,24 @@ int main(int argc, char **argv) {
 
 
   /* The host properties can be retrived from all interfaces */
-  
+
   INFO1("Property list for workstation %s", name1);
   /* Get the property list of the workstation 1 */
   props = SD_workstation_get_properties(w1);
-  
 
-    /* Trying to set a new property */
+
+  /* Trying to set a new property */
   xbt_dict_set(props, xbt_strdup("NewProp"), strdup("newValue"), free);
 
   /* Print the properties of the workstation 1 */
-  xbt_dict_foreach(props,cursor,key,data) {
-    INFO2("\tProperty: %s has value: %s",key,data);
+  xbt_dict_foreach(props, cursor, key, data) {
+    INFO2("\tProperty: %s has value: %s", key, data);
   }
+
   /* Try to get a property that does not exist */
-  
-  value = SD_workstation_get_property_value(w1,noexist);
-  if ( value == NULL) 
+
+  value = SD_workstation_get_property_value(w1, noexist);
+  if (value == NULL)
     INFO1("\tProperty: %s is undefined", noexist);
   else
     INFO2("\tProperty: %s has value: %s", noexist, value);
@@ -76,24 +76,24 @@ int main(int argc, char **argv) {
   cursor = NULL;
 
   /* Print the properties of the workstation 2 */
-  xbt_dict_foreach(props,cursor,key,data) {
-    INFO2("\tProperty: %s on host: %s",key,data);
+  xbt_dict_foreach(props, cursor, key, data) {
+    INFO2("\tProperty: %s on host: %s", key, data);
   }
 
-  /* Modify an existing property test. First check it exists */\
+  /* Modify an existing property test. First check it exists */
   INFO0("Modify an existing property");
-  
-  value = SD_workstation_get_property_value(w2,exist);
-  if ( value == NULL) 
+
+  value = SD_workstation_get_property_value(w2, exist);
+  if (value == NULL)
     INFO1("\tProperty: %s is undefined", exist);
   else {
     INFO2("\tProperty: %s old value: %s", exist, value);
-    xbt_dict_set(props, exist, strdup("250"), free);  
+    xbt_dict_set(props, exist, strdup("250"), free);
   }
+
   /* Test if we have changed the value */
-  value = SD_workstation_get_property_value(w2,exist);
-  if ( value == NULL) 
+  value = SD_workstation_get_property_value(w2, exist);
+  if (value == NULL)
     INFO1("\tProperty: %s is undefined", exist);
   else
     INFO2("\tProperty: %s new value: %s", exist, value);
@@ -103,27 +103,29 @@ int main(int argc, char **argv) {
   route_size = SD_route_get_size(w1, w2);
   for (i = 0; i < route_size; i++) {
     xbt_dict_cursor_t cursor = NULL;
-    char *key,*data;
-       char noexist1[]="Other";
+    char *key, *data;
+    char noexist1[] = "Other";
     props = SD_link_get_properties(route[i]);
-    
+
 
     /* Print the properties of the current link */
-    xbt_dict_foreach(props,cursor,key,data) {
-    INFO3("\tLink %s property: %s has value: %s",SD_link_get_name(route[i]),key,data);
-
-    /* Try to get a property that does not exist */
-    
-    value = SD_link_get_property_value(route[i], noexist1);
-    if ( value == NULL) 
-      INFO2("\tProperty: %s for link %s is undefined", noexist, SD_link_get_name(route[i]));
-    else
-      INFO3("\tLink %s property: %s has value: %s",SD_link_get_name(route[i]),noexist,value);
-  }
+    xbt_dict_foreach(props, cursor, key, data) {
+      INFO3("\tLink %s property: %s has value: %s",
+            SD_link_get_name(route[i]), key, data);
+
+      /* Try to get a property that does not exist */
+
+      value = SD_link_get_property_value(route[i], noexist1);
+      if (value == NULL)
+        INFO2("\tProperty: %s for link %s is undefined", noexist,
+              SD_link_get_name(route[i]));
+      else
+        INFO3("\tLink %s property: %s has value: %s",
+              SD_link_get_name(route[i]), noexist, value);
+    }
 
   }
 
   SD_exit();
   return 0;
 }
-
index 120c1d8..9d70ef8 100644 (file)
@@ -5,11 +5,12 @@
 #include "xbt/log.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
-                            "Logging specific to this SimDag example");
+                             "Logging specific to this SimDag example");
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   int i;
-  const char * platform_file;
+  const char *platform_file;
   const SD_workstation_t *workstations;
   const char *name1;
   const char *name2;
@@ -25,7 +26,7 @@ int main(int argc, char **argv) {
   const int workstation_number = 2;
   SD_workstation_t workstation_list[2];
   double computation_amount[2];
-  double communication_amount[4] = {0};
+  double communication_amount[4] = { 0 };
   double rate = -1.0;
   SD_workstation_t w1, w2;
 
@@ -56,30 +57,34 @@ int main(int argc, char **argv) {
   communication_amount12 = 2000000;
   communication_amount21 = 3000000;
   INFO3("Computation time for %f flops on %s: %f", computation_amount1, name1,
-       SD_workstation_get_computation_time(w1, computation_amount1));
+        SD_workstation_get_computation_time(w1, computation_amount1));
   INFO3("Computation time for %f flops on %s: %f", computation_amount2, name2,
-       SD_workstation_get_computation_time(w2, computation_amount2));
+        SD_workstation_get_computation_time(w2, computation_amount2));
 
   INFO2("Route between %s and %s:", name1, name2);
   route = SD_route_get_list(w1, w2);
   route_size = SD_route_get_size(w1, w2);
   for (i = 0; i < route_size; i++) {
-    INFO3("   Link %s: latency = %f, bandwidth = %f", SD_link_get_name(route[i]),
-         SD_link_get_current_latency(route[i]), SD_link_get_current_bandwidth(route[i]));
+    INFO3("   Link %s: latency = %f, bandwidth = %f",
+          SD_link_get_name(route[i]), SD_link_get_current_latency(route[i]),
+          SD_link_get_current_bandwidth(route[i]));
   }
-  INFO2("Route latency = %f, route bandwidth = %f", SD_route_get_current_latency(w1, w2),
-       SD_route_get_current_bandwidth(w1, w2));
-  INFO4("Communication time for %f bytes between %s and %s: %f", communication_amount12, name1, name2,
-       SD_route_get_communication_time(w1, w2, communication_amount12));
-  INFO4("Communication time for %f bytes between %s and %s: %f", communication_amount21, name2, name1,
-       SD_route_get_communication_time(w2, w1, communication_amount21));
+  INFO2("Route latency = %f, route bandwidth = %f",
+        SD_route_get_current_latency(w1, w2),
+        SD_route_get_current_bandwidth(w1, w2));
+  INFO4("Communication time for %f bytes between %s and %s: %f",
+        communication_amount12, name1, name2,
+        SD_route_get_communication_time(w1, w2, communication_amount12));
+  INFO4("Communication time for %f bytes between %s and %s: %f",
+        communication_amount21, name2, name1,
+        SD_route_get_communication_time(w2, w1, communication_amount21));
 
   /* creation of the tasks and their dependencies */
   taskA = SD_task_create("Task A", NULL, 10.0);
   taskB = SD_task_create("Task B", NULL, 40.0);
   taskC = SD_task_create("Task C", NULL, 30.0);
   taskD = SD_task_create("Task D", NULL, 60.0);
-  
+
 
   SD_task_dependency_add(NULL, NULL, taskB, taskA);
   SD_task_dependency_add(NULL, NULL, taskC, taskA);
@@ -87,43 +92,43 @@ int main(int argc, char **argv) {
   SD_task_dependency_add(NULL, NULL, taskD, taskC);
   /*  SD_task_dependency_add(NULL, NULL, taskA, taskD); /\* deadlock */
 
-  
+
 
   TRY {
-    SD_task_dependency_add(NULL, NULL, taskA, taskA); /* shouldn't work and must raise an exception */
+    SD_task_dependency_add(NULL, NULL, taskA, taskA);   /* shouldn't work and must raise an exception */
     xbt_die("Hey, I can add a dependency between Task A and Task A!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
     if (ex.category != arg_error)
-      RETHROW; /* this is a serious error */
+      RETHROW;                  /* this is a serious error */
     xbt_ex_free(ex);
   }
-  
+
   TRY {
-    SD_task_dependency_add(NULL, NULL, taskB, taskA); /* shouldn't work and must raise an exception */
+    SD_task_dependency_add(NULL, NULL, taskB, taskA);   /* shouldn't work and must raise an exception */
     xbt_die("Oh oh, I can add an already existing dependency!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
     if (ex.category != arg_error)
       RETHROW;
     xbt_ex_free(ex);
   }
 
   TRY {
-    SD_task_dependency_remove(taskA, taskC); /* shouldn't work and must raise an exception */
+    SD_task_dependency_remove(taskA, taskC);    /* shouldn't work and must raise an exception */
     xbt_die("Dude, I can remove an unknown dependency!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
     if (ex.category != arg_error)
       RETHROW;
     xbt_ex_free(ex);
   }
 
   TRY {
-    SD_task_dependency_remove(taskC, taskC); /* shouldn't work and must raise an exception */
+    SD_task_dependency_remove(taskC, taskC);    /* shouldn't work and must raise an exception */
     xbt_die("Wow, I can remove a dependency between Task C and itself!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
     if (ex.category != arg_error)
       RETHROW;
     xbt_ex_free(ex);
@@ -136,46 +141,46 @@ int main(int argc, char **argv) {
   SD_task_watch(taskD, SD_DONE);
   SD_task_watch(taskB, SD_DONE);
   SD_task_unwatch(taskD, SD_DONE);
-  
+
 
   /* scheduling parameters */
   workstation_list[0] = w1;
   workstation_list[1] = w2;
   computation_amount[0] = computation_amount1;
   computation_amount[1] = computation_amount2;
-  
+
   communication_amount[1] = communication_amount12;
   communication_amount[2] = communication_amount21;
 
   /* estimated time */
   task = taskD;
   INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
-       SD_task_get_execution_time(task, workstation_number, workstation_list,
-                                  computation_amount, communication_amount, rate));
+        SD_task_get_execution_time(task, workstation_number, workstation_list,
+                                   computation_amount, communication_amount,
+                                   rate));
 
   /* let's launch the simulation! */
 
   SD_task_schedule(taskA, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
+                   computation_amount, communication_amount, rate);
   SD_task_schedule(taskB, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
+                   computation_amount, communication_amount, rate);
   SD_task_schedule(taskC, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
+                   computation_amount, communication_amount, rate);
   SD_task_schedule(taskD, workstation_number, workstation_list,
-                  computation_amount, communication_amount, rate);
+                   computation_amount, communication_amount, rate);
 
   changed_tasks = SD_simulate(-1.0);
   for (i = 0; changed_tasks[i] != NULL; i++) {
     INFO3("Task '%s' start time: %f, finish time: %f",
-         SD_task_get_name(changed_tasks[i]),
-         SD_task_get_start_time(changed_tasks[i]),
-         SD_task_get_finish_time(changed_tasks[i]));
+          SD_task_get_name(changed_tasks[i]),
+          SD_task_get_start_time(changed_tasks[i]),
+          SD_task_get_finish_time(changed_tasks[i]));
   }
-  
+
   xbt_assert0(changed_tasks[0] == taskD &&
-             changed_tasks[1] == taskB &&
-             changed_tasks[2] == NULL,
-             "Unexpected simulation results");
+              changed_tasks[1] == taskB &&
+              changed_tasks[2] == NULL, "Unexpected simulation results");
 
   xbt_free(changed_tasks);
 
@@ -191,4 +196,3 @@ int main(int argc, char **argv) {
   SD_exit();
   return 0;
 }
-
index 9f77f01..893654c 100644 (file)
@@ -5,22 +5,23 @@
 #include "simdag/simdag.h"
 #include "xbt/log.h"
 
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
-                            "Logging specific to this SimDag example");
+                             "Logging specific to this SimDag example");
 
 static int nameCompareHosts(const void *n1, const void *n2)
 {
-  return strcmp(SD_workstation_get_name(*((SD_workstation_t *)n1)),
-               SD_workstation_get_name(*((SD_workstation_t *)n2)));
+  return strcmp(SD_workstation_get_name(*((SD_workstation_t *) n1)),
+                SD_workstation_get_name(*((SD_workstation_t *) n2)));
 }
 
-int main(int argc, char **argv) {
-  int i,j;
+int main(int argc, char **argv)
+{
+  int i, j;
   SD_task_t *changed_tasks;
   int n_hosts;
-  const SD_workstation_t * hosts;
+  const SD_workstation_t *hosts;
   SD_task_t taskInit;
   SD_task_t PtoPComm1;
   SD_task_t PtoPComm2;
@@ -30,27 +31,27 @@ int main(int argc, char **argv) {
   SD_task_t InterRedist;
   SD_task_t taskFinal;
   SD_task_t ParComp_wcomm2;
-  const double no_cost[] = {1.0, 1.0};
+  const double no_cost[] = { 1.0, 1.0 };
   SD_workstation_t PtoPcomm1_hosts[2];
   SD_workstation_t PtoPcomm2_hosts[2];
-  double PtoPcomm1_table[] = { 0, 12500000, 0, 0 }; /* 100Mb */
-  double PtoPcomm2_table[] = { 0, 1250000, 0, 0 }; /* 10Mb */
-  double ParComp_wocomm_cost[] = {1e+9,1e+9,1e+9,1e+9,1e+9}; /* 1 Gflop per Proc */
+  double PtoPcomm1_table[] = { 0, 12500000, 0, 0 };     /* 100Mb */
+  double PtoPcomm2_table[] = { 0, 1250000, 0, 0 };      /* 10Mb */
+  double ParComp_wocomm_cost[] = { 1e+9, 1e+9, 1e+9, 1e+9, 1e+9 };      /* 1 Gflop per Proc */
   double *ParComp_wocomm_table;
   SD_workstation_t ParComp_wocomm_hosts[5];
   double *IntraRedist_cost;
   double *IntraRedist_table;
   SD_workstation_t IntraRedist_hosts[5];
-  double ParComp_wcomm1_cost[] = {1e+9,1e+9,1e+9,1e+9,1e+9}; /* 1 Gflop per Proc */
+  double ParComp_wcomm1_cost[] = { 1e+9, 1e+9, 1e+9, 1e+9, 1e+9 };      /* 1 Gflop per Proc */
   double *ParComp_wcomm1_table;
   SD_workstation_t ParComp_wcomm1_hosts[5];
   double *InterRedist_cost;
   double *InterRedist_table;
-  double ParComp_wcomm2_cost[] = {1e+8,1e+8,1e+8,1e+8,1e+8}; /* 1 Gflop per Proc (0.02sec duration) */
+  double ParComp_wcomm2_cost[] = { 1e+8, 1e+8, 1e+8, 1e+8, 1e+8 };      /* 1 Gflop per Proc (0.02sec duration) */
   SD_workstation_t ParComp_wcomm2_hosts[5];
   double final_cost = 5e+9;
   double *ParComp_wcomm2_table;
+
   /* initialisation of SD */
   SD_init(&argc, argv);
 
@@ -59,24 +60,23 @@ int main(int argc, char **argv) {
 
   /* getting platform infos */
   n_hosts = SD_workstation_get_number();
-  hosts= SD_workstation_get_list();
+  hosts = SD_workstation_get_list();
 
   /* sorting hosts by hostname */
-  qsort((void *)hosts,n_hosts,
-       sizeof(SD_workstation_t),nameCompareHosts);
+  qsort((void *) hosts, n_hosts, sizeof(SD_workstation_t), nameCompareHosts);
 
   /* creation of the tasks */
-  taskInit = SD_task_create("Initial",NULL,1.0);
+  taskInit = SD_task_create("Initial", NULL, 1.0);
   PtoPComm1 = SD_task_create("PtoP Comm 1", NULL, 1.0);
   PtoPComm2 = SD_task_create("PtoP Comm 2", NULL, 1.0);
-  ParComp_wocomm =  SD_task_create("Par Comp without comm", NULL, 1.0);
-  IntraRedist =  SD_task_create("intra redist", NULL, 1.0);
-  ParComp_wcomm1 =  SD_task_create("Par Comp with comm 1", NULL, 1.0);
-  InterRedist =  SD_task_create("inter redist", NULL, 1.0);
-  taskFinal = SD_task_create("Final",NULL,1.0);
-  ParComp_wcomm2 =  SD_task_create("Par Comp with comm 2", NULL, 1.0);
-  
-  
+  ParComp_wocomm = SD_task_create("Par Comp without comm", NULL, 1.0);
+  IntraRedist = SD_task_create("intra redist", NULL, 1.0);
+  ParComp_wcomm1 = SD_task_create("Par Comp with comm 1", NULL, 1.0);
+  InterRedist = SD_task_create("inter redist", NULL, 1.0);
+  taskFinal = SD_task_create("Final", NULL, 1.0);
+  ParComp_wcomm2 = SD_task_create("Par Comp with comm 2", NULL, 1.0);
+
+
   /* creation of the dependencies */
   SD_task_dependency_add(NULL, NULL, taskInit, PtoPComm1);
   SD_task_dependency_add(NULL, NULL, taskInit, PtoPComm2);
@@ -87,100 +87,107 @@ int main(int argc, char **argv) {
   SD_task_dependency_add(NULL, NULL, InterRedist, ParComp_wcomm2);
   SD_task_dependency_add(NULL, NULL, ParComp_wcomm2, taskFinal);
   SD_task_dependency_add(NULL, NULL, PtoPComm2, taskFinal);
-  
-  
+
+
   /* scheduling parameters */
-  
-  /* large point-to-point communication (0.1 sec duration) */ 
+
+  /* large point-to-point communication (0.1 sec duration) */
   PtoPcomm1_hosts[0] = hosts[0];
-  PtoPcomm1_hosts[1]  =hosts[1];
+  PtoPcomm1_hosts[1] hosts[1];
 
-  /* small point-to-point communication (0.01 sec duration) */ 
+  /* small point-to-point communication (0.01 sec duration) */
   PtoPcomm2_hosts[0] = hosts[0];
   PtoPcomm2_hosts[1] = hosts[2];
+
   /* parallel task without intra communications (1 sec duration) */
-  ParComp_wocomm_table = xbt_new0(double,25);
+  ParComp_wocomm_table = xbt_new0(double, 25);
 
-  for (i=0; i<5;i++){
-    ParComp_wocomm_hosts[i]=hosts[i];
+  for (i = 0; i < 5; i++) {
+    ParComp_wocomm_hosts[i] = hosts[i];
   }
-  
+
   /* redistribution within a cluster (small latencies) */
   /* each host send (4*2.5Mb =) 10Mb */
   /* bandwidth is shared between 5 flows (0.05sec duration) */
-  IntraRedist_cost = xbt_new0(double,5);
-  IntraRedist_table = xbt_new0(double,25);
-  for (i=0;i<5;i++){
-    for (j=0;j<5;j++){
-      if (i==j) 
-       IntraRedist_table[i*5+j] = 0.;
+  IntraRedist_cost = xbt_new0(double, 5);
+  IntraRedist_table = xbt_new0(double, 25);
+  for (i = 0; i < 5; i++) {
+    for (j = 0; j < 5; j++) {
+      if (i == j)
+        IntraRedist_table[i * 5 + j] = 0.;
       else
-       IntraRedist_table[i*5+j] = 312500.; /* 2.5Mb */
+        IntraRedist_table[i * 5 + j] = 312500.; /* 2.5Mb */
     }
   }
 
-  for (i=0; i<5;i++){
-    IntraRedist_hosts[i]=hosts[i];
+  for (i = 0; i < 5; i++) {
+    IntraRedist_hosts[i] = hosts[i];
   }
-  
+
   /* parallel task with intra communications */
   /* Computation domination (1 sec duration) */
-  ParComp_wcomm1_table = xbt_new0(double,25);
-  
-  for (i=0; i<5;i++){
-    ParComp_wcomm1_hosts[i]=hosts[i];
+  ParComp_wcomm1_table = xbt_new0(double, 25);
+
+  for (i = 0; i < 5; i++) {
+    ParComp_wcomm1_hosts[i] = hosts[i];
   }
 
-  for (i=0;i<5;i++){
-    for (j=0;j<5;j++){
-      if (i==j) 
-       ParComp_wcomm1_table[i*5+j] = 0.;
+  for (i = 0; i < 5; i++) {
+    for (j = 0; j < 5; j++) {
+      if (i == j)
+        ParComp_wcomm1_table[i * 5 + j] = 0.;
       else
-       ParComp_wcomm1_table[i*5+j] = 312500.; /* 2.5Mb */
+        ParComp_wcomm1_table[i * 5 + j] = 312500.;      /* 2.5Mb */
     }
   }
-  
+
   /* inter cluster redistribution (big latency on the backbone) */
-  /* (0.5sec duration without latency impact)*/
-  InterRedist_cost = xbt_new0(double,10);
-  InterRedist_table = xbt_new0(double,100);
-  for (i=0;i<5;i++){
-    InterRedist_table[i*10+i+5] = 1250000.; /* 10Mb */
+  /* (0.5sec duration without latency impact) */
+  InterRedist_cost = xbt_new0(double, 10);
+  InterRedist_table = xbt_new0(double, 100);
+  for (i = 0; i < 5; i++) {
+    InterRedist_table[i * 10 + i + 5] = 1250000.;       /* 10Mb */
   }
 
   /* parallel task with intra communications */
   /* Communication domination (0.1 sec duration) */
-  
-  ParComp_wcomm2_table = xbt_new0(double,25);
-  
-  for (i=0; i<5;i++){
-    ParComp_wcomm2_hosts[i]=hosts[i+5];
+
+  ParComp_wcomm2_table = xbt_new0(double, 25);
+
+  for (i = 0; i < 5; i++) {
+    ParComp_wcomm2_hosts[i] = hosts[i + 5];
   }
 
-  for (i=0;i<5;i++){
-    for (j=0;j<5;j++){
-      if (i==j) 
-       ParComp_wcomm2_table[i*5+j] = 0.;
+  for (i = 0; i < 5; i++) {
+    for (j = 0; j < 5; j++) {
+      if (i == j)
+        ParComp_wcomm2_table[i * 5 + j] = 0.;
       else
-       ParComp_wcomm2_table[i*5+j] = 625000.; /* 5Mb */
+        ParComp_wcomm2_table[i * 5 + j] = 625000.;      /* 5Mb */
     }
   }
-  
+
   /* Sequential task */
-  
+
 
   /* scheduling the tasks */
   SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
-  SD_task_schedule(PtoPComm1, 2, PtoPcomm1_hosts, no_cost, PtoPcomm1_table, -1.0);
-  SD_task_schedule(PtoPComm2, 2, PtoPcomm2_hosts, no_cost, PtoPcomm2_table, -1.0);
-  SD_task_schedule(ParComp_wocomm, 5, ParComp_wocomm_hosts, ParComp_wocomm_cost, ParComp_wocomm_table, -1.0);
-  SD_task_schedule(IntraRedist, 5, IntraRedist_hosts, IntraRedist_cost, IntraRedist_table, -1.0);
-  SD_task_schedule(ParComp_wcomm1, 5, ParComp_wcomm1_hosts, ParComp_wcomm1_cost, ParComp_wcomm1_table, -1.0);
-  SD_task_schedule(InterRedist, 10, hosts, InterRedist_cost, InterRedist_table, -1.0);
-  SD_task_schedule(ParComp_wcomm2, 5, ParComp_wcomm2_hosts, ParComp_wcomm2_cost, ParComp_wcomm2_table, -1.0);
+  SD_task_schedule(PtoPComm1, 2, PtoPcomm1_hosts, no_cost, PtoPcomm1_table,
+                   -1.0);
+  SD_task_schedule(PtoPComm2, 2, PtoPcomm2_hosts, no_cost, PtoPcomm2_table,
+                   -1.0);
+  SD_task_schedule(ParComp_wocomm, 5, ParComp_wocomm_hosts,
+                   ParComp_wocomm_cost, ParComp_wocomm_table, -1.0);
+  SD_task_schedule(IntraRedist, 5, IntraRedist_hosts, IntraRedist_cost,
+                   IntraRedist_table, -1.0);
+  SD_task_schedule(ParComp_wcomm1, 5, ParComp_wcomm1_hosts,
+                   ParComp_wcomm1_cost, ParComp_wcomm1_table, -1.0);
+  SD_task_schedule(InterRedist, 10, hosts, InterRedist_cost,
+                   InterRedist_table, -1.0);
+  SD_task_schedule(ParComp_wcomm2, 5, ParComp_wcomm2_hosts,
+                   ParComp_wcomm2_cost, ParComp_wcomm2_table, -1.0);
   SD_task_schedule(taskFinal, 1, &(hosts[9]), &final_cost, no_cost, -1.0);
-  
+
   /* let's launch the simulation! */
   changed_tasks = SD_simulate(-1.0);
 
@@ -193,7 +200,7 @@ int main(int argc, char **argv) {
   free(InterRedist_cost);
   free(InterRedist_table);
   free(ParComp_wcomm2_table);
-  
+
   SD_task_destroy(taskInit);
   SD_task_destroy(PtoPComm1);
   SD_task_destroy(PtoPComm2);
@@ -207,4 +214,3 @@ int main(int argc, char **argv) {
   SD_exit();
   return 0;
 }
-
index 80a99bc..295afbd 100644 (file)
@@ -93,38 +93,46 @@ XBT_PUBLIC(void) amok_bw_init(void);
 XBT_PUBLIC(void) amok_bw_exit(void);
 
 XBT_PUBLIC(void) amok_bw_test(gras_socket_t peer,
-                            unsigned long int buf_size,
-                            unsigned long int msg_size,
-                            unsigned long int msg_amount,
-                            double min_duration,
-                            /*OUT*/ double *sec, double *bw);
-
-XBT_PUBLIC(void) amok_bw_request(const char* from_name,unsigned int from_port,
-                    const char* to_name,unsigned int to_port,
-                               unsigned long int buf_size,
-                               unsigned long int msg_size,
-                               unsigned long int msg_amount,
-                               double min_duration,
-                               /*OUT*/ double *sec, double*bw);
-
-XBT_PUBLIC(double*) amok_bw_matrix(xbt_dynar_t hosts, /* dynar of xbt_host_t */
-                                  int buf_size_bw, int msg_size_bw, int msg_amount_bw, double min_duration);
+                              unsigned long int buf_size,
+                              unsigned long int msg_size,
+                              unsigned long int msg_amount,
+                              double min_duration,
+                              /*OUT*/ double *sec, double *bw);
+
+XBT_PUBLIC(void) amok_bw_request(const char *from_name,
+                                 unsigned int from_port, const char *to_name,
+                                 unsigned int to_port,
+                                 unsigned long int buf_size,
+                                 unsigned long int msg_size,
+                                 unsigned long int msg_amount,
+                                 double min_duration, /*OUT*/ double *sec,
+                                 double *bw);
+
+XBT_PUBLIC(double *) amok_bw_matrix(xbt_dynar_t hosts,  /* dynar of xbt_host_t */
+                                    int buf_size_bw, int msg_size_bw,
+                                    int msg_amount_bw, double min_duration);
 
 /* ***************************************************************************
  * Link saturation
  * ***************************************************************************/
 
 
-XBT_PUBLIC(void) amok_bw_saturate_start(const char* from_name,unsigned int from_port,
-                           const char* to_name,unsigned int to_port,
-                           unsigned int msg_size, double duration);
+XBT_PUBLIC(void) amok_bw_saturate_start(const char *from_name,
+                                        unsigned int from_port,
+                                        const char *to_name,
+                                        unsigned int to_port,
+                                        unsigned int msg_size,
+                                        double duration);
 
-XBT_PUBLIC(void) amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
-                           unsigned int msg_size, double duration,
-                           /*out*/ double *elapsed, double *bw);
+XBT_PUBLIC(void) amok_bw_saturate_begin(const char *to_name,
+                                        unsigned int to_port,
+                                        unsigned int msg_size,
+                                        double duration,
+                                        /*out */ double *elapsed, double *bw);
 
-XBT_PUBLIC(void) amok_bw_saturate_stop(const char* from_name,unsigned int from_port,
-                          /*out*/ double *time, double *bw);
+XBT_PUBLIC(void) amok_bw_saturate_stop(const char *from_name,
+                                       unsigned int from_port,
+                                       /*out */ double *time, double *bw);
 
 /** @} */
 
index 624abdc..b96b0e1 100644 (file)
@@ -61,19 +61,23 @@ XBT_PUBLIC(void) amok_pm_exit(void);
 
 XBT_PUBLIC(void) amok_pm_mainloop(double timeOut);
 
-XBT_PUBLIC(void) amok_pm_kill_hp(char *name,int port);
+XBT_PUBLIC(void) amok_pm_kill_hp(char *name, int port);
 XBT_PUBLIC(void) amok_pm_kill(gras_socket_t buddy);
 XBT_PUBLIC(void) amok_pm_kill_sync(gras_socket_t buddy);
 
 XBT_PUBLIC(xbt_dynar_t) amok_pm_group_new(const char *group_name);
-XBT_PUBLIC(xbt_dynar_t) amok_pm_group_get(gras_socket_t master, const char *group_name);
+XBT_PUBLIC(xbt_dynar_t) amok_pm_group_get(gras_socket_t master,
+                                          const char *group_name);
 
-XBT_PUBLIC(void)        amok_pm_group_join(gras_socket_t master, const char *group_name, int rank);
-XBT_PUBLIC(void)        amok_pm_group_leave(gras_socket_t master, const char *group_name);
+XBT_PUBLIC(void) amok_pm_group_join(gras_socket_t master,
+                                    const char *group_name, int rank);
+XBT_PUBLIC(void) amok_pm_group_leave(gras_socket_t master,
+                                     const char *group_name);
 
 
 XBT_PUBLIC(void) amok_pm_group_shutdown(const char *group_name);
-XBT_PUBLIC(void) amok_pm_group_shutdown_remote(gras_socket_t master, const char *group_name);
+XBT_PUBLIC(void) amok_pm_group_shutdown_remote(gras_socket_t master,
+                                               const char *group_name);
 
 
 /** @} */
index 6563a7a..ef4358f 100644 (file)
@@ -10,8 +10,8 @@
 #ifndef GRAS_H
 #define GRAS_H
 
-#include <xbt.h> /* our toolbox */
-#include <xbt/ex.h> /* There's a whole bunch of exception handling in GRAS */
+#include <xbt.h>                /* our toolbox */
+#include <xbt/ex.h>             /* There's a whole bunch of exception handling in GRAS */
 
 #include <gras/process.h>
 #include <gras/module.h>
index f19da0a..903902d 100644 (file)
@@ -10,8 +10,8 @@
 #ifndef GRAS_DATADESC_H
 #define GRAS_DATADESC_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
-#include "xbt/dynar.h" /* void_f_pvoid_t */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
+#include "xbt/dynar.h"          /* void_f_pvoid_t */
 
 SG_BEGIN_DECL()
 
@@ -36,7 +36,6 @@ SG_BEGIN_DECL()
  *     - Section \ref GRAS_dd_cb_simple provides a simple interface to do so, allowing to share integers stored on a stack.
  *     - Section \ref GRAS_dd_cb_full provides a full featured interface to do so, but it may reveal somehow difficult to use.
  **/
-
 /** @defgroup GRAS_dd_basic Basic operations on data descriptions
  *  @ingroup GRAS_dd
  * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Basics" --> \endhtmlonly
@@ -54,16 +53,16 @@ SG_BEGIN_DECL()
  *
  */
 /* @{ */
-  
 /** @brief Opaque type describing a type description. */
-typedef struct s_gras_datadesc_type *gras_datadesc_type_t;
+     typedef struct s_gras_datadesc_type *gras_datadesc_type_t;
 
 /** \brief Search a type description from its name */
 XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_by_name(const char *name);
-XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_by_name_or_null(const char *name);
+XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_by_name_or_null(const char
+                                                               *name);
 
 /* @} */
-    
+
 /** @defgroup GRAS_dd_auto Automatic parsing of data descriptions
  *  @ingroup GRAS_dd
  * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Automatic parsing" --> \endhtmlonly
@@ -220,14 +219,14 @@ int server(int argc, char *argv[]) {
  */
 /** @{ */
 
+
 /**   @brief Automatically parse C code
  *    @hideinitializer
  */
 #define GRAS_DEFINE_TYPE(name,def) \
   const char * _gras_this_type_symbol_does_not_exist__##name=#def; def
 
-#ifndef DOXYGEN_SKIP /* doxygen don't like macro fun too much */
+#ifndef DOXYGEN_SKIP            /* doxygen don't like macro fun too much */
 #  ifdef GRAS_DEFINE_TYPE_EXTERN
 #    undef  GRAS_DEFINE_TYPE
 #    define GRAS_DEFINE_TYPE(name,def)  def
@@ -240,7 +239,7 @@ int server(int argc, char *argv[]) {
  */
 #define GRAS_DEFINE_TYPE_EXTERN 1
 /* leave the fun of declaring this to the user */
-#undef GRAS_DEFINE_TYPE_EXTERN 
+#undef GRAS_DEFINE_TYPE_EXTERN
 
 /** @brief Define a symbol to be automatically parsed, disregarding #GRAS_DEFINE_TYPE_EXTERN
  *  @hideinitializer
@@ -251,7 +250,7 @@ int server(int argc, char *argv[]) {
  */
 #define GRAS_DEFINE_TYPE_LOCAL(name, def) \
   const char * _gras_this_type_symbol_does_not_exist__##name=#def; def
-  
+
 /** @brief Retrieve a datadesc which was previously parsed 
  *  @hideinitializer
  */
@@ -266,15 +265,15 @@ int server(int argc, char *argv[]) {
  *  @brief Add an annotation to a type to be automatically parsed
  */
 #define GRAS_ANNOTE(key,val)
+
 /** @brief Defines the value of a define to the datatype parsing infrastructure
  */
-XBT_PUBLIC(void) gras_datadesc_set_const(const char*name, int value);
+XBT_PUBLIC(void) gras_datadesc_set_const(const char *name, int value);
 
 /* @} */
 
-XBT_PUBLIC(gras_datadesc_type_t) 
-gras_datadesc_parse(const char *name, const char *C_statement);
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_parse(const char *name, const char *C_statement);
 
 /** @defgroup GRAS_dd_manual Simple manual data description
  *  @ingroup GRAS_dd
@@ -315,15 +314,25 @@ gras_datadesc_parse(const char *name, const char *C_statement);
 
 
 /** \brief Opaque type describing a type description callback persistant state. */
-typedef struct s_gras_cbps *gras_cbps_t;
+     typedef struct s_gras_cbps *gras_cbps_t;
 
 /* callbacks prototypes */
 /** \brief Prototype of type callbacks returning nothing. */
-typedef void (*gras_datadesc_type_cb_void_t)(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+     typedef void (*gras_datadesc_type_cb_void_t) (gras_datadesc_type_t
+                                                   typedesc, gras_cbps_t vars,
+                                                   void *data);
 /** \brief Prototype of type callbacks returning an int. */
-typedef int (*gras_datadesc_type_cb_int_t)(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+     typedef int (*gras_datadesc_type_cb_int_t) (gras_datadesc_type_t
+                                                 typedesc, gras_cbps_t vars,
+                                                 void *data);
 /** \brief Prototype of type callbacks selecting a type. */
-typedef gras_datadesc_type_t (*gras_datadesc_selector_t)(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+     typedef
+
+      
+       gras_datadesc_type_t(*gras_datadesc_selector_t) (gras_datadesc_type_t
+                                                        typedesc,
+                                                        gras_cbps_t vars,
+                                                        void *data);
 
 
 /******************************************
@@ -331,47 +340,44 @@ typedef gras_datadesc_type_t (*gras_datadesc_selector_t)(gras_datadesc_type_t ty
  ******************************************/
 
 XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_struct(const char *name);
-XBT_PUBLIC(void) gras_datadesc_struct_append(gras_datadesc_type_t  struct_type,
-                                const char           *name,
-                                gras_datadesc_type_t  field_type);
-XBT_PUBLIC(void) gras_datadesc_struct_close(gras_datadesc_type_t   struct_type);
-
-
-XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_union(const char                 *name,
-                                        gras_datadesc_type_cb_int_t selector);
-XBT_PUBLIC(void) gras_datadesc_union_append(gras_datadesc_type_t   union_type,
-                               const char            *name,
-                               gras_datadesc_type_t   field_type);
-XBT_PUBLIC(void) gras_datadesc_union_close(gras_datadesc_type_t    union_type);
-
-
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_ref(const char          *name,
-                   gras_datadesc_type_t referenced_type);
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_copy(const char          *name,
-                    gras_datadesc_type_t copied_type);
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_ref_generic(const char              *name,
-                           gras_datadesc_selector_t selector);
-
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_array_fixed(const char          *name,
-                           gras_datadesc_type_t element_type,
-                           long int             fixed_size);
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_array_dyn(const char                 *name,
-                         gras_datadesc_type_t        element_type,
-                         gras_datadesc_type_cb_int_t dynamic_size);
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_ref_pop_arr(gras_datadesc_type_t  element_type);
-
-XBT_PUBLIC(gras_datadesc_type_t) 
-  gras_datadesc_dynar(gras_datadesc_type_t elm_t,
-                     void_f_pvoid_t free_func);
+XBT_PUBLIC(void) gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
+                                             const char *name,
+                                             gras_datadesc_type_t field_type);
+XBT_PUBLIC(void) gras_datadesc_struct_close(gras_datadesc_type_t struct_type);
+
+
+XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_union(const char *name,
+                                                     gras_datadesc_type_cb_int_t
+                                                     selector);
+XBT_PUBLIC(void) gras_datadesc_union_append(gras_datadesc_type_t union_type,
+                                            const char *name,
+                                            gras_datadesc_type_t field_type);
+XBT_PUBLIC(void) gras_datadesc_union_close(gras_datadesc_type_t union_type);
+
+
 XBT_PUBLIC(gras_datadesc_type_t)
-  gras_datadesc_matrix(gras_datadesc_type_t elm_t,
-                      void_f_pvoid_t const free_f);
+  gras_datadesc_ref(const char *name, gras_datadesc_type_t referenced_type);
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_copy(const char *name, gras_datadesc_type_t copied_type);
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_ref_generic(const char *name,
+                          gras_datadesc_selector_t selector);
+
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_array_fixed(const char *name,
+                          gras_datadesc_type_t element_type,
+                          long int fixed_size);
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_array_dyn(const char *name,
+                        gras_datadesc_type_t element_type,
+                        gras_datadesc_type_cb_int_t dynamic_size);
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type);
+
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_dynar(gras_datadesc_type_t elm_t, void_f_pvoid_t free_func);
+XBT_PUBLIC(gras_datadesc_type_t)
+  gras_datadesc_matrix(gras_datadesc_type_t elm_t, void_f_pvoid_t const free_f);
 
 /*********************************
  * Change stuff within datadescs *
@@ -382,25 +388,28 @@ XBT_PUBLIC(void) gras_datadesc_cycle_set(gras_datadesc_type_t type);
 /** \brief Specify that this type do not contain any cycles (default) */
 XBT_PUBLIC(void) gras_datadesc_cycle_unset(gras_datadesc_type_t type);
 /** \brief Add a pre-send callback to this datadesc. */
-XBT_PUBLIC(void) gras_datadesc_cb_send (gras_datadesc_type_t         type,
-                           gras_datadesc_type_cb_void_t pre);
+XBT_PUBLIC(void) gras_datadesc_cb_send(gras_datadesc_type_t type,
+                                       gras_datadesc_type_cb_void_t pre);
 /** \brief Add a post-receive callback to this datadesc.*/
-XBT_PUBLIC(void) gras_datadesc_cb_recv(gras_datadesc_type_t          type,
-                          gras_datadesc_type_cb_void_t  post);
+XBT_PUBLIC(void) gras_datadesc_cb_recv(gras_datadesc_type_t type,
+                                       gras_datadesc_type_cb_void_t post);
 /** \brief Add a pre-send callback to the given field of the datadesc */
-XBT_PUBLIC(void) gras_datadesc_cb_field_send (gras_datadesc_type_t   type,
-                                 const char            *field_name,
-                                 gras_datadesc_type_cb_void_t  pre);
+XBT_PUBLIC(void) gras_datadesc_cb_field_send(gras_datadesc_type_t type,
+                                             const char *field_name,
+                                             gras_datadesc_type_cb_void_t
+                                             pre);
 /** \brief Add a post-receive callback to the given field of the datadesc */
-XBT_PUBLIC(void) gras_datadesc_cb_field_recv(gras_datadesc_type_t    type,
-                                const char             *field_name,
-                                gras_datadesc_type_cb_void_t  post);
+XBT_PUBLIC(void) gras_datadesc_cb_field_recv(gras_datadesc_type_t type,
+                                             const char *field_name,
+                                             gras_datadesc_type_cb_void_t
+                                             post);
 /** \brief Add a pre-send callback to the given field resulting in its value to be pushed */
-XBT_PUBLIC(void) gras_datadesc_cb_field_push (gras_datadesc_type_t   type,
-                                 const char            *field_name);
+XBT_PUBLIC(void) gras_datadesc_cb_field_push(gras_datadesc_type_t type,
+                                             const char *field_name);
 /** \brief Add a pre-send callback to the given field resulting in its value multiplied to any previously pushed value and then pushed back */
-XBT_PUBLIC(void) gras_datadesc_cb_field_push_multiplier (gras_datadesc_type_t type,
-                                            const char          *field_name);
+XBT_PUBLIC(void) gras_datadesc_cb_field_push_multiplier(gras_datadesc_type_t
+                                                        type, const char
+                                                        *field_name);
 
 /******************************
  * Get stuff within datadescs *
@@ -459,22 +468,32 @@ gras_datadesc_struct_close(my_type);
  */
 /* @{ */
 
-XBT_PUBLIC(void)
-gras_cbps_i_push(gras_cbps_t ps, int val);
-XBT_PUBLIC(int) 
-gras_cbps_i_pop(gras_cbps_t ps);
-
-XBT_PUBLIC(int) gras_datadesc_cb_pop(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-
-XBT_PUBLIC(void) gras_datadesc_cb_push_int(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_uint(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_lint(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_ulint(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-
-XBT_PUBLIC(void) gras_datadesc_cb_push_int_mult(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_uint_mult(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_lint_mult(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+XBT_PUBLIC(void) gras_cbps_i_push(gras_cbps_t ps, int val);
+XBT_PUBLIC(int) gras_cbps_i_pop(gras_cbps_t ps);
+
+XBT_PUBLIC(int) gras_datadesc_cb_pop(gras_datadesc_type_t typedesc,
+                                     gras_cbps_t vars, void *data);
+
+XBT_PUBLIC(void) gras_datadesc_cb_push_int(gras_datadesc_type_t typedesc,
+                                           gras_cbps_t vars, void *data);
+XBT_PUBLIC(void) gras_datadesc_cb_push_uint(gras_datadesc_type_t typedesc,
+                                            gras_cbps_t vars, void *data);
+XBT_PUBLIC(void) gras_datadesc_cb_push_lint(gras_datadesc_type_t typedesc,
+                                            gras_cbps_t vars, void *data);
+XBT_PUBLIC(void) gras_datadesc_cb_push_ulint(gras_datadesc_type_t typedesc,
+                                             gras_cbps_t vars, void *data);
+
+XBT_PUBLIC(void) gras_datadesc_cb_push_int_mult(gras_datadesc_type_t typedesc,
+                                                gras_cbps_t vars, void *data);
+XBT_PUBLIC(void) gras_datadesc_cb_push_uint_mult(gras_datadesc_type_t
+                                                 typedesc, gras_cbps_t vars,
+                                                 void *data);
+XBT_PUBLIC(void) gras_datadesc_cb_push_lint_mult(gras_datadesc_type_t
+                                                 typedesc, gras_cbps_t vars,
+                                                 void *data);
+XBT_PUBLIC(void) gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t
+                                                  typedesc, gras_cbps_t vars,
+                                                  void *data);
 
 
 /* @} */
@@ -493,22 +512,18 @@ XBT_PUBLIC(void) gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t typedesc,
 
 /* @{ */
 
-XBT_PUBLIC(void)   gras_cbps_v_pop (gras_cbps_t            ps, 
-                       const char            *name,
-             /* OUT */ gras_datadesc_type_t  *ddt,
-             /* OUT */ void                 **res);
-XBT_PUBLIC(void)   gras_cbps_v_push(gras_cbps_t            ps,
-                       const char            *name,
-                       void                  *data,
-                       gras_datadesc_type_t   ddt);
-XBT_PUBLIC(void)   gras_cbps_v_set (gras_cbps_t            ps,
-                       const char            *name,
-                       void                  *data,
-                       gras_datadesc_type_t   ddt);
-
-XBT_PUBLIC(void*) gras_cbps_v_get (gras_cbps_t            ps, 
-                       const char            *name,
-             /* OUT */ gras_datadesc_type_t  *ddt);
+XBT_PUBLIC(void) gras_cbps_v_pop(gras_cbps_t ps, const char *name,
+                                 /* OUT */ gras_datadesc_type_t * ddt,
+                                 /* OUT */ void **res);
+XBT_PUBLIC(void) gras_cbps_v_push(gras_cbps_t ps,
+                                  const char *name,
+                                  void *data, gras_datadesc_type_t ddt);
+XBT_PUBLIC(void) gras_cbps_v_set(gras_cbps_t ps,
+                                 const char *name,
+                                 void *data, gras_datadesc_type_t ddt);
+
+XBT_PUBLIC(void *) gras_cbps_v_get(gras_cbps_t ps, const char *name,
+                                   /* OUT */ gras_datadesc_type_t * ddt);
 
 XBT_PUBLIC(void) gras_cbps_block_begin(gras_cbps_t ps);
 XBT_PUBLIC(void) gras_cbps_block_end(gras_cbps_t ps);
@@ -530,10 +545,10 @@ XBT_PUBLIC(int) gras_arch_selfid(void); /* ID of this arch */
 /**
  * Basic types we can embeed in DataDescriptors.
  */
-typedef enum
-  {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
-   UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE}
-  DataTypes;
+     typedef enum
+       { CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
+       UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE
+     } DataTypes;
 #define SIMPLE_TYPE_COUNT 9
 
 /**  \brief Describe a collection of data.
@@ -548,14 +563,14 @@ typedef enum
 ** padding bytes the compiler adds to the end of the structure.
 */
 
-typedef struct DataDescriptorStruct {
-  DataTypes type;
-  size_t repetitions;
-  size_t offset;
-  /*@null@*/ struct DataDescriptorStruct *members;
-  size_t length;
-  size_t tailPadding;
-} DataDescriptor;
+     typedef struct DataDescriptorStruct {
+       DataTypes type;
+       size_t repetitions;
+       size_t offset;
+       /*@null@ */ struct DataDescriptorStruct *members;
+       size_t length;
+       size_t tailPadding;
+     } DataDescriptor;
 /** DataDescriptor for an array */
 #define SIMPLE_DATA(type,repetitions) \
   {type, repetitions, 0, NULL, 0, 0}
@@ -568,11 +583,9 @@ typedef struct DataDescriptorStruct {
   sizeof(memberType) * repetitions
 
 XBT_PUBLIC(gras_datadesc_type_t)
-gras_datadesc_import_nws(const char           *name,
-                        const DataDescriptor *desc,
-                        unsigned long         howmany);
+  gras_datadesc_import_nws(const char *name,
+                         const DataDescriptor * desc, unsigned long howmany);
 
 
 SG_END_DECL()
-
 #endif /* GRAS_DATADESC_H */
index 99b04f0..7b3865d 100644 (file)
@@ -2,7 +2,7 @@
 
 /* gras/emul.h - public interface to emulation support                      */
 /*                (specific parts for SG or RL)                             */
+
 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -11,7 +11,7 @@
 #ifndef GRAS_COND_H
 #define GRAS_COND_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 
 SG_BEGIN_DECL()
 /** @addtogroup GRAS_emul
@@ -43,7 +43,6 @@ SG_BEGIN_DECL()
  * 
  *  @{
  */
-  
 /** \brief Returns true only if the program runs on real life */
 XBT_PUBLIC(int) gras_if_RL(void);
 
@@ -160,13 +159,11 @@ XBT_PUBLIC(int) gras_bench_once_end(void);
 
 /** \brief Start benchmarking this code block if it has never been benchmarked, ignore it if it was
     \hideinitializer */
-#define GRAS_BENCH_ONCE_RUN_ONCE_BEGIN()    if (gras_bench_once_begin(__FILE__, __LINE__)) { 
+#define GRAS_BENCH_ONCE_RUN_ONCE_BEGIN()    if (gras_bench_once_begin(__FILE__, __LINE__)) {
 /** \brief Stop benchmarking this part of the code
     \hideinitializer */
 #define GRAS_BENCH_ONCE_RUN_ONCE_END()      } gras_bench_once_end()
 /** @} */
 
 SG_END_DECL()
-
 #endif /* GRAS_COND_H */
-
index fd10f8a..e748515 100644 (file)
@@ -36,7 +36,6 @@ SG_BEGIN_DECL()
  *  contains much more examples, but their are not properly integrated into
  *  this documentation yet. 
  */
-
 /** @defgroup GRAS_msg_decl Message declaration and retrival 
  *  @ingroup  GRAS_msg
  *  
@@ -57,25 +56,26 @@ SG_BEGIN_DECL()
  *  change the semantic of a given message while still understanding the old
  *  one.
  */
-/** @{ */  
+/** @{ */
 /** \brief Opaque type */
-typedef struct s_gras_msgtype *gras_msgtype_t;
+     typedef struct s_gras_msgtype *gras_msgtype_t;
+
+XBT_PUBLIC(void) gras_msgtype_declare(const char *name,
+                                      gras_datadesc_type_t payload);
+XBT_PUBLIC(void) gras_msgtype_declare_v(const char *name,
+                                        short int version,
+                                        gras_datadesc_type_t payload);
 
-  XBT_PUBLIC(void) gras_msgtype_declare  (const char           *name,
-                             gras_datadesc_type_t  payload);
-  XBT_PUBLIC(void) gras_msgtype_declare_v(const char           *name,
-                             short int             version,
-                             gras_datadesc_type_t  payload);
+XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_name(const char *name);
+XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_name_or_null(const char *name);
+XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_namev(const char *name,
+                                                 short int version);
+XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_id(int id);
 
-  XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_name (const char *name);
-  XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_name_or_null (const char *name);
-  XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_namev(const char *name, short int version);
-  XBT_PUBLIC(gras_msgtype_t) gras_msgtype_by_id(int id);
+XBT_PUBLIC(void) gras_msgtype_dumpall(void);
 
-  XBT_PUBLIC(void) gras_msgtype_dumpall(void);
-   
 
-/** @} */  
+/** @} */
 /** @defgroup GRAS_msg_cb Callback declaration and use
  *  @ingroup  GRAS_msg
  * 
@@ -91,13 +91,13 @@ typedef struct s_gras_msgtype *gras_msgtype_t;
  * 
  * @{
  */
+
   /** \brief Context of callbacks (opaque structure, created by the middleware only, never by user) */
-  typedef struct s_gras_msg_cb_ctx *gras_msg_cb_ctx_t;
+     typedef struct s_gras_msg_cb_ctx *gras_msg_cb_ctx_t;
+
+XBT_PUBLIC(void) gras_msg_cb_ctx_free(gras_msg_cb_ctx_t ctx);
+XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
 
-XBT_PUBLIC(void) gras_msg_cb_ctx_free(gras_msg_cb_ctx_t ctx) ;
-XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);   
-   
   /** \brief Type of message callback functions. 
    *
    * \param expeditor: a socket to contact who sent this message
@@ -113,8 +113,7 @@ XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
    *
    * If the callback accepts the message, it should free it after use.
    */
-  typedef int (*gras_msg_cb_t)(gras_msg_cb_ctx_t  ctx,
-                              void             *payload);
+     typedef int (*gras_msg_cb_t) (gras_msg_cb_ctx_t ctx, void *payload);
 
  /**
   * @brief Bind the given callback to the given message type (described by its name)
@@ -138,10 +137,11 @@ XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
   */
 #define gras_cb_unregister(msgtype_name, cb) gras_cb_unregister_(gras_msgtype_by_name(msgtype_name),cb)
 
-  XBT_PUBLIC(void) gras_cb_register_  (gras_msgtype_t msgtype, gras_msg_cb_t cb);
-  XBT_PUBLIC(void) gras_cb_unregister_(gras_msgtype_t msgtype, gras_msg_cb_t cb);
+XBT_PUBLIC(void) gras_cb_register_(gras_msgtype_t msgtype, gras_msg_cb_t cb);
+XBT_PUBLIC(void) gras_cb_unregister_(gras_msgtype_t msgtype,
+                                     gras_msg_cb_t cb);
 
-/** @} */  
+/** @} */
 
 /** @defgroup GRAS_msg_exchange Message exchange 
  *  @ingroup  GRAS_msg
@@ -156,10 +156,9 @@ XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
  * has to search for the given msgtype in the hash table.
  */
 #define gras_msg_send(sock,name,payload) gras_msg_send_(sock,gras_msgtype_by_name(name),payload)
-  XBT_PUBLIC(void) gras_msg_send_(gras_socket_t   sock,
-                                 gras_msgtype_t  msgtype,
-                                 void           *payload);
-                                 
+XBT_PUBLIC(void) gras_msg_send_(gras_socket_t sock,
+                                gras_msgtype_t msgtype, void *payload);
+
 /** \brief Waits for a message to come in over a given socket
  *  @hideinitializer
  * @param timeout: How long should we wait for this message.
@@ -174,14 +173,13 @@ XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
  * Using gras_msg_wait() is a bit slower than using gras_msg_wait_() since GRAS
  * has to search for the given msgtype in the hash table.
  */
-                                 
+
 #define gras_msg_wait(timeout,msgt_want,expeditor,payload) gras_msg_wait_(timeout,gras_msgtype_by_name(msgt_want),expeditor,payload)
-  XBT_PUBLIC(void) gras_msg_wait_(double          timeout,
-                                 gras_msgtype_t  msgt_want,
-                                 gras_socket_t  *expeditor,
-                                 void           *payload);
-  XBT_PUBLIC(void) gras_msg_handleall(double period);
-  XBT_PUBLIC(void) gras_msg_handle(double timeOut);
+XBT_PUBLIC(void) gras_msg_wait_(double timeout,
+                                gras_msgtype_t msgt_want,
+                                gras_socket_t * expeditor, void *payload);
+XBT_PUBLIC(void) gras_msg_handleall(double period);
+XBT_PUBLIC(void) gras_msg_handle(double timeOut);
 
 /** @} */
 
@@ -202,14 +200,18 @@ XBT_PUBLIC(gras_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
 /** @{ */
 
 /* declaration */
-XBT_PUBLIC(void) gras_msgtype_declare_rpc(const char           *name,
-                             gras_datadesc_type_t  payload_request,
-                             gras_datadesc_type_t  payload_answer);
-
-XBT_PUBLIC(void) gras_msgtype_declare_rpc_v(const char           *name,
-                               short int             version,
-                               gras_datadesc_type_t  payload_request,
-                               gras_datadesc_type_t  payload_answer);
+XBT_PUBLIC(void) gras_msgtype_declare_rpc(const char *name,
+                                          gras_datadesc_type_t
+                                          payload_request,
+                                          gras_datadesc_type_t
+                                          payload_answer);
+
+XBT_PUBLIC(void) gras_msgtype_declare_rpc_v(const char *name,
+                                            short int version,
+                                            gras_datadesc_type_t
+                                            payload_request,
+                                            gras_datadesc_type_t
+                                            payload_answer);
 
 /* client side */
 
@@ -218,25 +220,23 @@ XBT_PUBLIC(void) gras_msgtype_declare_rpc_v(const char           *name,
  */
 #define gras_msg_rpccall(server,timeout,msg,req,ans) gras_msg_rpccall_(server,timeout,gras_msgtype_by_name(msg),req,ans)
 XBT_PUBLIC(void) gras_msg_rpccall_(gras_socket_t server,
-                                  double timeOut,
-                                  gras_msgtype_t msgtype,
-                                  void *request, void *answer);
+                                   double timeOut,
+                                   gras_msgtype_t msgtype,
+                                   void *request, void *answer);
 XBT_PUBLIC(gras_msg_cb_ctx_t)
-  
+
 /** @brief Launch a RPC call, but do not block for the answer
  *  @hideinitializer
  */
-  
 #define gras_msg_rpc_async_call(server,timeout,msg,req) gras_msg_rpc_async_call_(server,timeout,gras_msgtype_by_name(msg),req)
-gras_msg_rpc_async_call_(gras_socket_t server,
-                       double timeOut,
-                       gras_msgtype_t msgtype,
-                       void *request);
-XBT_PUBLIC(void) gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx,
-                                        void *answer);
+  gras_msg_rpc_async_call_(gras_socket_t server,
+                         double timeOut,
+                         gras_msgtype_t msgtype, void *request);
+XBT_PUBLIC(void) gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer);
 
 /* server side */
-XBT_PUBLIC(void) gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx,void *answer);
+XBT_PUBLIC(void) gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx,
+                                    void *answer);
 
 
 /** @} */
@@ -248,58 +248,58 @@ XBT_PUBLIC(void) gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx,void *
 /** @{ */
 
 /** @brief Message kind (internal enum) */
-typedef enum {
-  e_gras_msg_kind_unknown = 0,
-
-  e_gras_msg_kind_oneway=1,    /**< good old regular messages */
-
-  e_gras_msg_kind_rpccall=2,   /**< RPC request */
-  /* HACK: e_gras_msg_kind_rpccall also designate RPC message *type* in 
-     msgtype_t, not only in msg_t*/
-  e_gras_msg_kind_rpcanswer=3, /**< RPC successful answer */
-  e_gras_msg_kind_rpcerror=4,  /**< RPC failure on server (payload=exception); should not leak to user-space */
-
-   /* future:
-       call cancel, and others
-     even after:
-       forwarding request and other application level routing stuff
-       group communication
-  */
+     typedef enum {
+       e_gras_msg_kind_unknown = 0,
+
+       e_gras_msg_kind_oneway = 1,
+                               /**< good old regular messages */
 
-  e_gras_msg_kind_count=5 /* sentinel, dont mess with */
-} e_gras_msg_kind_t;
+       e_gras_msg_kind_rpccall = 2,
+                               /**< RPC request */
+       /* HACK: e_gras_msg_kind_rpccall also designate RPC message *type* in 
+          msgtype_t, not only in msg_t */
+       e_gras_msg_kind_rpcanswer = 3,
+                               /**< RPC successful answer */
+       e_gras_msg_kind_rpcerror = 4,
+                               /**< RPC failure on server (payload=exception); should not leak to user-space */
+
+       /* future:
+          call cancel, and others
+          even after:
+          forwarding request and other application level routing stuff
+          group communication
+        */
+
+       e_gras_msg_kind_count = 5        /* sentinel, dont mess with */
+     } e_gras_msg_kind_t;
 
 
 /** @brief Message instance (internal struct) */
-typedef struct {
-    gras_socket_t   expe;
-  e_gras_msg_kind_t kind;
-    gras_msgtype_t  type;
-    unsigned long int ID;
-    void           *payl;
-    int             payl_size;
-} s_gras_msg_t, *gras_msg_t;
-
-typedef int (*gras_msg_filter_t)(gras_msg_t msg,void *ctx);
-
-#define gras_msg_wait_ext(timeout, msg, expe, filter, fctx,got) gras_msg_wait_ext_(timeout, gras_msgtype_by_name(msg), expe, filter, fctx,got) 
-XBT_PUBLIC(void) gras_msg_wait_ext_(double           timeout,    
-                                   gras_msgtype_t   msgt_want,
-                                   gras_socket_t    expe_want,
-                                   gras_msg_filter_t filter,
-                                   void             *filter_ctx, 
-                                   gras_msg_t       msg_got);
-
-XBT_PUBLIC(void) gras_msg_wait_or(double         timeout,    
-                                 xbt_dynar_t    msgt_want,
-                                 gras_msg_cb_ctx_t *ctx,
-                                 int           *msgt_got,
-                                 void          *payload);
+     typedef struct {
+       gras_socket_t expe;
+       e_gras_msg_kind_t kind;
+       gras_msgtype_t type;
+       unsigned long int ID;
+       void *payl;
+       int payl_size;
+     } s_gras_msg_t, *gras_msg_t;
+
+     typedef int (*gras_msg_filter_t) (gras_msg_t msg, void *ctx);
+
+#define gras_msg_wait_ext(timeout, msg, expe, filter, fctx,got) gras_msg_wait_ext_(timeout, gras_msgtype_by_name(msg), expe, filter, fctx,got)
+XBT_PUBLIC(void) gras_msg_wait_ext_(double timeout,
+                                    gras_msgtype_t msgt_want,
+                                    gras_socket_t expe_want,
+                                    gras_msg_filter_t filter,
+                                    void *filter_ctx, gras_msg_t msg_got);
+
+XBT_PUBLIC(void) gras_msg_wait_or(double timeout,
+                                  xbt_dynar_t msgt_want,
+                                  gras_msg_cb_ctx_t * ctx,
+                                  int *msgt_got, void *payload);
 
 
 /* @} */
 
 SG_END_DECL()
-
 #endif /* GRAS_MSG_H */
-
index 3e45c9b..6c59081 100644 (file)
@@ -10,12 +10,13 @@ XBT_PUBLIC(void) gras_module_leave(const char *name);
 
 
 /* Functions module implementor should use */
-XBT_PUBLIC(void) gras_module_add(const char *name, unsigned int data_size, int *ID,
-                    void_f_void_t  init_f, void_f_void_t  exit_f,
-                    void_f_pvoid_t join_f, void_f_pvoid_t leave_f) ;
+XBT_PUBLIC(void) gras_module_add(const char *name, unsigned int data_size,
+                                 int *ID, void_f_void_t init_f,
+                                 void_f_void_t exit_f, void_f_pvoid_t join_f,
+                                 void_f_pvoid_t leave_f);
 
 
-XBT_PUBLIC(void*)gras_moddata_by_id(unsigned int ID);
+XBT_PUBLIC(void *) gras_moddata_by_id(unsigned int ID);
 
 
 #endif /* GRAS_MODULE_H */
index 3d5b95d..fb32a94 100644 (file)
 #ifndef GRAS_PROCESS_H
 #define GRAS_PROCESS_H
 
-#include "xbt/misc.h"  /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/dict.h"
 
 SG_BEGIN_DECL()
 
-void gras_agent_spawn(const char *name, void *data, xbt_main_func_t code, int argc, char *argv[], xbt_dict_t properties);
-  
-  
+     void gras_agent_spawn(const char *name, void *data, xbt_main_func_t code,
+                           int argc, char *argv[], xbt_dict_t properties);
+
+
 /****************************************************************************/
 /* Manipulating User Data                                                   */
 /****************************************************************************/
@@ -44,13 +45,13 @@ void gras_agent_spawn(const char *name, void *data, xbt_main_func_t code, int ar
  * \brief Get the data associated with the current process.
  * \ingroup GRAS_globals
  */
-XBT_PUBLIC(void*) gras_userdata_get(void);
+XBT_PUBLIC(void *) gras_userdata_get(void);
 
 /**
  * \brief Set the data associated with the current process.
  * \ingroup GRAS_globals
  */
-XBT_PUBLIC(void*) gras_userdata_set(void *ud);
+XBT_PUBLIC(void *) gras_userdata_set(void *ud);
 
 /** \brief Malloc and set the data associated with the current process.
  *
@@ -65,6 +66,4 @@ XBT_PUBLIC(void*) gras_userdata_set(void *ud);
 /* @} */
 
 SG_END_DECL()
-
 #endif /* GRAS_PROCESS_H */
-
index e1af19f..7e61237 100644 (file)
@@ -36,20 +36,20 @@ SG_BEGIN_DECL()
  * 
  *  @{
  */
+XBT_PUBLIC(void) gras_timer_delay(double delay, void_f_void_t action);
+XBT_PUBLIC(void) gras_timer_repeat(double interval, void_f_void_t action);
 
-  XBT_PUBLIC(void) gras_timer_delay(double delay, void_f_void_t action);
-  XBT_PUBLIC(void) gras_timer_repeat(double interval, void_f_void_t action);
+XBT_PUBLIC(void) gras_timer_cancel_delay(double interval,
+                                         void_f_void_t action);
+XBT_PUBLIC(void) gras_timer_cancel_repeat(double interval,
+                                          void_f_void_t action);
 
-  XBT_PUBLIC(void) gras_timer_cancel_delay(double interval, void_f_void_t action);
-  XBT_PUBLIC(void) gras_timer_cancel_repeat(double interval, void_f_void_t action);
+XBT_PUBLIC(void) gras_timer_cancel_delay_all(void);
+XBT_PUBLIC(void) gras_timer_cancel_repeat_all(void);
 
-  XBT_PUBLIC(void) gras_timer_cancel_delay_all(void);
-  XBT_PUBLIC(void) gras_timer_cancel_repeat_all(void);
-
-  XBT_PUBLIC(void) gras_timer_cancel_all(void);
+XBT_PUBLIC(void) gras_timer_cancel_all(void);
 
 /** @} */
 
 SG_END_DECL()
-
 #endif /* GRAS_TIMER_H */
index 40622fd..6151874 100644 (file)
@@ -26,7 +26,7 @@
  * If you need an example of how to use sockets, check \ref GRAS_ex_ping.
  *
  */
+
 /** \defgroup GRAS_sock_create Socket creation functions
  *  \ingroup GRAS_sock
  *
 typedef struct s_gras_socket *gras_socket_t;
 
 /** \brief Simply create a client socket (to speak to a remote host) */
-XBT_PUBLIC(gras_socket_t) gras_socket_client(const char *host, unsigned short port);
+XBT_PUBLIC(gras_socket_t) gras_socket_client(const char *host,
+                                             unsigned short port);
 XBT_PUBLIC(gras_socket_t) gras_socket_client_from_string(const char *host);
 /** \brief Simply create a server socket (to ear from remote hosts speaking to you) */
 XBT_PUBLIC(gras_socket_t) gras_socket_server(unsigned short port);
-XBT_PUBLIC(void)          gras_socket_close(gras_socket_t sd);
+XBT_PUBLIC(void) gras_socket_close(gras_socket_t sd);
 
 /** \brief Create a client socket, full interface to all relevant settings */
 XBT_PUBLIC(gras_socket_t) gras_socket_client_ext(const char *host,
-                                    unsigned short port,
-                                    unsigned long int bufSize,
-                                    int measurement);
+                                                 unsigned short port,
+                                                 unsigned long int bufSize,
+                                                 int measurement);
 /** \brief Create a server socket, full interface to all relevant settings */
 XBT_PUBLIC(gras_socket_t) gras_socket_server_ext(unsigned short port,
-                                    unsigned long int bufSize,
-                                    int measurement);
+                                                 unsigned long int bufSize,
+                                                 int measurement);
 XBT_PUBLIC(gras_socket_t)
-gras_socket_server_range(unsigned short minport, unsigned short maxport,
-                        unsigned long int buf_size, int measurement);
+  gras_socket_server_range(unsigned short minport, unsigned short maxport,
+                         unsigned long int buf_size, int measurement);
 
 /* @}*/
 /** \defgroup GRAS_sock_info Retrieving data about sockets and peers 
@@ -64,7 +65,7 @@ gras_socket_server_range(unsigned short minport, unsigned short maxport,
 /* @{*/
 
 /** Get the port number on which this socket is connected on my side */
-XBT_PUBLIC(int)   gras_socket_my_port  (gras_socket_t sock);
+XBT_PUBLIC(int) gras_socket_my_port(gras_socket_t sock);
 /** @brief Get the port number on which this socket is connected on remote side 
  *
  * This is the port declared on remote side with the
@@ -79,7 +80,7 @@ XBT_PUBLIC(int)   gras_socket_my_port  (gras_socket_t sock);
  * from BSD ones here. 
  */
 
-XBT_PUBLIC(int)   gras_socket_peer_port(gras_socket_t sock);
+XBT_PUBLIC(int) gras_socket_peer_port(gras_socket_t sock);
 /** Get the host name of the remote side */
 XBT_PUBLIC(char *) gras_socket_peer_name(gras_socket_t sock);
 /** Get the process name of the remote side */
@@ -100,16 +101,16 @@ XBT_PUBLIC(char *) gras_socket_peer_proc(gras_socket_t sock);
 
 
 XBT_PUBLIC(int) gras_socket_is_meas(gras_socket_t sock);
-XBT_PUBLIC(void) gras_socket_meas_send(gras_socket_t peer, 
-                                     unsigned int timeout,
-                                     unsigned long int msgSize, 
-                                     unsigned long int msgAmount);
-XBT_PUBLIC(void) gras_socket_meas_recv(gras_socket_t peer, 
-                                     unsigned int timeout,
-                                     unsigned long int msgSize, 
-                                     unsigned long int msgAmount);
+XBT_PUBLIC(void) gras_socket_meas_send(gras_socket_t peer,
+                                       unsigned int timeout,
+                                       unsigned long int msgSize,
+                                       unsigned long int msgAmount);
+XBT_PUBLIC(void) gras_socket_meas_recv(gras_socket_t peer,
+                                       unsigned int timeout,
+                                       unsigned long int msgSize,
+                                       unsigned long int msgAmount);
 XBT_PUBLIC(gras_socket_t) gras_socket_meas_accept(gras_socket_t peer);
-            
+
 /* @}*/
 
 /** \defgroup GRAS_sock_file Using files as sockets
@@ -124,9 +125,9 @@ XBT_PUBLIC(gras_socket_t) gras_socket_meas_accept(gras_socket_t peer);
  */
 /* @{*/
 /* debuging functions */
-XBT_PUBLIC(gras_socket_t) gras_socket_client_from_file(const char*path);
-XBT_PUBLIC(gras_socket_t) gras_socket_server_from_file(const char*path);
-                                         
+XBT_PUBLIC(gras_socket_t) gras_socket_client_from_file(const char *path);
+XBT_PUBLIC(gras_socket_t) gras_socket_server_from_file(const char *path);
+
 /* @} */
-   
+
 #endif /* GRAS_TRANSPORT_H */
index 962f1f1..d0c34e8 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef GRAS_VIRTU_H
 #define GRAS_VIRTU_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/time.h"
 #include "xbt/dict.h"
 
@@ -18,12 +18,12 @@ SG_BEGIN_DECL()
 
 /* Initialization of the simulation world. Do not call them in RL. 
    Indeed, do not call them at all. Let gras_stub_generator do it for you. */
-void gras_global_init(int *argc, char **argv);
-void gras_create_environment(const char *file);
-void gras_function_register(const char *name, xbt_main_func_t code);
-void gras_launch_application(const char *file);
-void gras_clean(void);
-void gras_main(void);
+     void gras_global_init(int *argc, char **argv);
+     void gras_create_environment(const char *file);
+     void gras_function_register(const char *name, xbt_main_func_t code);
+     void gras_launch_application(const char *file);
+     void gras_clean(void);
+     void gras_main(void);
 
 
 /** @addtogroup GRAS_virtu  
@@ -41,15 +41,14 @@ void gras_main(void);
 /** @brief sleeps for the given amount of time.
  *  @param sec: number of seconds to sleep
  */
-#define gras_os_sleep(sec) xbt_sleep(sec) 
+#define gras_os_sleep(sec) xbt_sleep(sec)
 /** @brief get the fully-qualified name of the current host
  *
  * Returns the fully-qualified name of the host machine, or "localhost" if the name
  * cannot be determined.  Always returns the same value, so multiple calls
  * cause no problems.
  */
-XBT_PUBLIC(const char *)
-gras_os_myname(void);
+XBT_PUBLIC(const char *) gras_os_myname(void);
 
 /** @brief returns the number on which this process is listening for incoming messages */
 XBT_PUBLIC(int) gras_os_myport(void);
@@ -58,8 +57,7 @@ XBT_PUBLIC(int) gras_os_myport(void);
  *
  * Returns the concatenation of gras_os_myname():gras_os_myport(). Please do not free the result.
  */
-XBT_PUBLIC(const char *)
-gras_os_hostport(void);
+XBT_PUBLIC(const char *) gras_os_hostport(void);
 
 /** @brief get process identification
  *
@@ -71,13 +69,11 @@ XBT_PUBLIC(int) gras_os_getpid(void);
 
 /* Properties related */
 XBT_PUBLIC(xbt_dict_t) gras_process_properties(void);
-XBT_PUBLIC(const char*) gras_process_property_value(const char* name);
+XBT_PUBLIC(const char *) gras_process_property_value(const char *name);
 
 XBT_PUBLIC(xbt_dict_t) gras_os_host_properties(void);
-XBT_PUBLIC(const char*) gras_os_host_property_value(const char* name);   
+XBT_PUBLIC(const char *) gras_os_host_property_value(const char *name);
 
 /** @} */
 SG_END_DECL()
-
 #endif /* GRAS_VIRTU_H */
-
index 1debf57..c9e8531 100644 (file)
@@ -14,15 +14,14 @@ SG_BEGIN_DECL()
 /* ******************************** Host ************************************ */
 /** @defgroup m_datatypes_management_details Details on MSG datatypes
     @ingroup  m_datatypes_management*/
-
-typedef struct simdata_host *simdata_host_t;
+     typedef struct simdata_host *simdata_host_t;
 /** @brief Host datatype 
     @ingroup m_datatypes_management_details */
-typedef struct m_host {
-  char *name;                  /**< @brief host name if any */
-  simdata_host_t simdata;      /**< @brief simulator data */
-  void *data;                  /**< @brief user data */
-} s_m_host_t;
+     typedef struct m_host {
+       char *name;              /**< @brief host name if any */
+       simdata_host_t simdata;  /**< @brief simulator data */
+       void *data;              /**< @brief user data */
+     } s_m_host_t;
 /** @brief Host datatype  
     @ingroup m_datatypes_management
 
@@ -35,18 +34,18 @@ typedef struct m_host {
 
     \see m_host_management
   @{ */
-typedef struct m_host *m_host_t;
+     typedef struct m_host *m_host_t;
 /** @} */
 /* ******************************** Task ************************************ */
 
-typedef struct simdata_task *simdata_task_t;
+     typedef struct simdata_task *simdata_task_t;
 /** @brief Task datatype 
     @ingroup m_datatypes_management_details */
-typedef struct m_task {
-  char *name;                  /**< @brief task name if any */
-  simdata_task_t simdata;      /**< @brief simulator data */
-  void *data;                  /**< @brief user data */
-} s_m_task_t;
+     typedef struct m_task {
+       char *name;              /**< @brief task name if any */
+       simdata_task_t simdata;  /**< @brief simulator data */
+       void *data;              /**< @brief user data */
+     } s_m_task_t;
 /** @brief Task datatype  
     @ingroup m_datatypes_management 
 
@@ -55,7 +54,7 @@ typedef struct m_task {
     data</em>.
     \see m_task_management
   @{ */
-typedef struct m_task  *m_task_t;
+     typedef struct m_task *m_task_t;
 
 /** \brief Default value for an uninitialized #m_task_t.
     \ingroup m_datatypes_management 
@@ -67,14 +66,15 @@ typedef struct m_task  *m_task_t;
 
 
 /* ****************************** Process *********************************** */
-typedef struct simdata_process *simdata_process_t;
+     typedef struct simdata_process *simdata_process_t;
 /** @brief Process datatype 
     @ingroup m_datatypes_management_details @{ */
-typedef struct m_process {
-  char *name;                  /**< @brief process name if any */
-  simdata_process_t simdata;   /**< @brief simulator data */
-  void *data;                  /**< @brief user data */
-} s_m_process_t;
+     typedef struct m_process {
+       char *name;              /**< @brief process name if any */
+       simdata_process_t simdata;
+                                /**< @brief simulator data */
+       void *data;              /**< @brief user data */
+     } s_m_process_t;
 /** @} */
 /** @brief Agent datatype  
     @ingroup m_datatypes_management 
@@ -83,7 +83,7 @@ typedef struct m_process {
     data</em>, executing in a <em>location</em>.
     \see m_process_management
   @{ */
-typedef struct m_process *m_process_t;
+     typedef struct m_process *m_process_t;
 /** @} */
 
 /* ********************************* Channel ******************************** */
@@ -94,17 +94,17 @@ typedef struct m_process *m_process_t;
     port number does).
     \see m_channel_management
    @{ */
-typedef int m_channel_t;
+     typedef int m_channel_t;
 /** @} */
 
 /* ******************************** Mailbox ************************************ */
 
-typedef struct s_msg_mailbox* msg_mailbox_t;
+     typedef struct s_msg_mailbox *msg_mailbox_t;
 /** @brief Mailbox datatype
     @ingroup m_datatypes_management_details @{ */
 
-msg_mailbox_t MSG_mailbox_create(const char *alias);
-void MSG_mailbox_free(void* mailbox);
+     msg_mailbox_t MSG_mailbox_create(const char *alias);
+     void MSG_mailbox_free(void *mailbox);
 
 
 /** @} */
@@ -115,20 +115,26 @@ void MSG_mailbox_free(void* mailbox);
     @ingroup m_datatypes_management 
     @{
 */
-typedef enum {
-  MSG_OK = 0,  /**< @brief Everything is right. Keep on going this way ! */
-  MSG_WARNING, /**< @brief Mmmh! Something must be not perfectly clean. But I
+     typedef enum {
+       MSG_OK = 0,
+               /**< @brief Everything is right. Keep on going this way ! */
+       MSG_WARNING,
+               /**< @brief Mmmh! Something must be not perfectly clean. But I
       may be a paranoid freak... ! */
-  MSG_TRANSFER_FAILURE, /**< @brief There has been a problem during you task
+       MSG_TRANSFER_FAILURE,
+                        /**< @brief There has been a problem during you task
       transfer. Either the network is down or the remote host has been
       shutdown. */
-  MSG_HOST_FAILURE, /**< @brief System shutdown. The host on which you are
+       MSG_HOST_FAILURE,
+                    /**< @brief System shutdown. The host on which you are
       running has just been rebooted. Free your datastructures and
       return now !*/
-  MSG_TASK_CANCELLED, /**< @brief Cancelled task. This task has been cancelled 
+       MSG_TASK_CANCELLED,
+                      /**< @brief Cancelled task. This task has been cancelled 
                        by somebody!*/
-  MSG_FATAL /**< @brief You've done something wrong. You'd better look at it... */
-} MSG_error_t;
+       MSG_FATAL
+            /**< @brief You've done something wrong. You'd better look at it... */
+     } MSG_error_t;
 /** @} */
 
 SG_END_DECL()
index 36a2336..d6df066 100644 (file)
@@ -22,7 +22,8 @@ XBT_PUBLIC(MSG_error_t) MSG_set_channel_number(int number);
 XBT_PUBLIC(int) MSG_get_channel_number(void);
 XBT_PUBLIC(MSG_error_t) MSG_main(void);
 XBT_PUBLIC(MSG_error_t) MSG_clean(void);
-XBT_PUBLIC(void) MSG_function_register(const char *name, xbt_main_func_t code);
+XBT_PUBLIC(void) MSG_function_register(const char *name,
+                                       xbt_main_func_t code);
 XBT_PUBLIC(void) MSG_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC(xbt_main_func_t) MSG_get_registered_function(const char *name);
 XBT_PUBLIC(void) MSG_launch_application(const char *file);
@@ -34,53 +35,63 @@ XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void);
 
 /************************** Host handling ***********************************/
 XBT_PUBLIC(MSG_error_t) MSG_host_set_data(m_host_t host, void *data);
-XBT_PUBLIC(void*) MSG_host_get_data(m_host_t host);
+XBT_PUBLIC(void *) MSG_host_get_data(m_host_t host);
 XBT_PUBLIC(const char *) MSG_host_get_name(m_host_t host);
 XBT_PUBLIC(m_host_t) MSG_host_self(void);
 XBT_PUBLIC(int) MSG_get_host_msgload(m_host_t host);
 /* int MSG_get_msgload(void); This function lacks specification; discard it */
 XBT_PUBLIC(double) MSG_get_host_speed(m_host_t h);
-XBT_PUBLIC(int) MSG_host_is_avail (m_host_t h);
+XBT_PUBLIC(int) MSG_host_is_avail(m_host_t h);
 
 /*property handlers*/
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(m_host_t host);
-XBT_PUBLIC(const char*) MSG_host_get_property_value(m_host_t host, const char* name);
+XBT_PUBLIC(const char *) MSG_host_get_property_value(m_host_t host,
+                                                     const char *name);
 
 XBT_PUBLIC(void) MSG_create_environment(const char *file);
 
 XBT_PUBLIC(m_host_t) MSG_get_host_by_name(const char *name);
 XBT_PUBLIC(int) MSG_get_host_number(void);
-XBT_PUBLIC(m_host_t *)MSG_get_host_table(void);
+XBT_PUBLIC(m_host_t *) MSG_get_host_table(void);
 
 /************************** Process handling *********************************/
 XBT_PUBLIC(m_process_t) MSG_process_create(const char *name,
-                              xbt_main_func_t code, void *data,
-                              m_host_t host);
+                                           xbt_main_func_t code, void *data,
+                                           m_host_t host);
 XBT_PUBLIC(m_process_t) MSG_process_create_with_arguments(const char *name,
-                                             xbt_main_func_t code, void *data,
-                                             m_host_t host, int argc, char **argv);
+                                                          xbt_main_func_t
+                                                          code, void *data,
+                                                          m_host_t host,
+                                                          int argc,
+                                                          char **argv);
 XBT_PUBLIC(m_process_t) MSG_process_create_with_environment(const char *name,
-                                             xbt_main_func_t code, void *data,
-                                             m_host_t host, int argc, char **argv, xbt_dict_t properties);
+                                                            xbt_main_func_t
+                                                            code, void *data,
+                                                            m_host_t host,
+                                                            int argc,
+                                                            char **argv,
+                                                            xbt_dict_t
+                                                            properties);
 XBT_PUBLIC(void) MSG_process_kill(m_process_t process);
 XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
 
 XBT_PUBLIC(MSG_error_t) MSG_process_change_host(m_host_t host);
 
-XBT_PUBLIC(void*) MSG_process_get_data(m_process_t process);
+XBT_PUBLIC(void *) MSG_process_get_data(m_process_t process);
 XBT_PUBLIC(MSG_error_t) MSG_process_set_data(m_process_t process, void *data);
 XBT_PUBLIC(m_host_t) MSG_process_get_host(m_process_t process);
 XBT_PUBLIC(m_process_t) MSG_process_from_PID(int PID);
 XBT_PUBLIC(int) MSG_process_get_PID(m_process_t process);
 XBT_PUBLIC(int) MSG_process_get_PPID(m_process_t process);
-XBT_PUBLIC(const char *)MSG_process_get_name(m_process_t process);
+XBT_PUBLIC(const char *) MSG_process_get_name(m_process_t process);
 XBT_PUBLIC(int) MSG_process_self_PID(void);
 XBT_PUBLIC(int) MSG_process_self_PPID(void);
 XBT_PUBLIC(m_process_t) MSG_process_self(void);
 
 /*property handlers*/
 XBT_PUBLIC(xbt_dict_t) MSG_process_get_properties(m_process_t process);
-XBT_PUBLIC(const char*) MSG_process_get_property_value(m_process_t process, const char* name);
+XBT_PUBLIC(const char *) MSG_process_get_property_value(m_process_t process,
+                                                        const char *name);
 
 XBT_PUBLIC(MSG_error_t) MSG_process_suspend(m_process_t process);
 XBT_PUBLIC(MSG_error_t) MSG_process_resume(m_process_t process);
@@ -88,15 +99,15 @@ XBT_PUBLIC(int) MSG_process_is_suspended(m_process_t process);
 
 /************************** Task handling ************************************/
 
-XBT_PUBLIC(m_task_t) MSG_task_create(const char *name, double compute_duration,
-                        double message_size, void *data);
-XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name,
-                                 int host_nb,
-                                 const m_host_t *host_list,
-                                 double *computation_amount,
-                                 double *communication_amount,
-                                 void *data);
-XBT_PUBLIC(void*) MSG_task_get_data(m_task_t task);
+XBT_PUBLIC(m_task_t) MSG_task_create(const char *name,
+                                     double compute_duration,
+                                     double message_size, void *data);
+XBT_PUBLIC(m_task_t) MSG_parallel_task_create(const char *name, int host_nb,
+                                              const m_host_t * host_list,
+                                              double *computation_amount,
+                                              double *communication_amount,
+                                              void *data);
+XBT_PUBLIC(void *) MSG_task_get_data(m_task_t task);
 XBT_PUBLIC(m_process_t) MSG_task_get_sender(m_task_t task);
 XBT_PUBLIC(m_host_t) MSG_task_get_source(m_task_t task);
 XBT_PUBLIC(const char *) MSG_task_get_name(m_task_t task);
@@ -104,23 +115,27 @@ XBT_PUBLIC(MSG_error_t) MSG_task_cancel(m_task_t task);
 XBT_PUBLIC(MSG_error_t) MSG_task_destroy(m_task_t task);
 
 XBT_PUBLIC(MSG_error_t) MSG_task_get(m_task_t * task, m_channel_t channel);
-XBT_PUBLIC(MSG_error_t) MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel,
-                                                  double max_duration);
+XBT_PUBLIC(MSG_error_t) MSG_task_get_with_timeout(m_task_t * task,
+                                                  m_channel_t channel,
+                                                  double max_duration);
 XBT_PUBLIC(MSG_error_t) MSG_task_get_from_host(m_task_t * task, int channel,
-                                              m_host_t host);
-MSG_error_t
-MSG_task_receive_from_host(m_task_t * task, const char* alias, m_host_t host);
+                                               m_host_t host);
+     MSG_error_t MSG_task_receive_from_host(m_task_t * task,
+                                            const char *alias, m_host_t host);
 XBT_PUBLIC(MSG_error_t) MSG_task_get_ext(m_task_t * task, int channel,
-                                        double max_duration, m_host_t host);
+                                         double max_duration, m_host_t host);
 
 
 XBT_PUBLIC(MSG_error_t) MSG_task_put(m_task_t task, m_host_t dest,
-                        m_channel_t channel);
+                                     m_channel_t channel);
 XBT_PUBLIC(MSG_error_t) MSG_task_put_bounded(m_task_t task,
-                                m_host_t dest, m_channel_t channel,
-                                double max_rate);
-XBT_PUBLIC(MSG_error_t) MSG_task_put_with_timeout(m_task_t task, m_host_t dest,
-                                     m_channel_t channel, double max_duration);
+                                             m_host_t dest,
+                                             m_channel_t channel,
+                                             double max_rate);
+XBT_PUBLIC(MSG_error_t) MSG_task_put_with_timeout(m_task_t task,
+                                                  m_host_t dest,
+                                                  m_channel_t channel,
+                                                  double max_duration);
 XBT_PUBLIC(MSG_error_t) MSG_task_execute(m_task_t task);
 XBT_PUBLIC(MSG_error_t) MSG_parallel_task_execute(m_task_t task);
 XBT_PUBLIC(void) MSG_task_set_priority(m_task_t task, double priority);
@@ -128,8 +143,9 @@ XBT_PUBLIC(void) MSG_task_set_priority(m_task_t task, double priority);
 XBT_PUBLIC(int) MSG_task_Iprobe(m_channel_t channel);
 XBT_PUBLIC(int) MSG_task_probe_from(m_channel_t channel);
 XBT_PUBLIC(int) MSG_task_probe_from_host(int channel, m_host_t host);
-XBT_PUBLIC(MSG_error_t) MSG_channel_select_from(m_channel_t channel, double max_duration,
-                                   int *PID);
+XBT_PUBLIC(MSG_error_t) MSG_channel_select_from(m_channel_t channel,
+                                                double max_duration,
+                                                int *PID);
 XBT_PUBLIC(MSG_error_t) MSG_process_sleep(double nb_sec);
 XBT_PUBLIC(MSG_error_t) MSG_get_errno(void);
 
@@ -140,47 +156,49 @@ XBT_PUBLIC(double) MSG_task_get_data_size(m_task_t task);
 
 
 XBT_PUBLIC(MSG_error_t)
-MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t host);
+  MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
+                     m_host_t host);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_task_receive_with_timeout(m_task_t * task, const char* alias, double timeout);
+  MSG_task_receive_with_timeout(m_task_t * task, const char *alias,
+                              double timeout);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_task_receive(m_task_t * task, const char* alias);
+  MSG_task_receive(m_task_t * task, const char *alias);
 
-XBT_PUBLIC(int)
-MSG_task_listen(const char* alias);
+XBT_PUBLIC(int) MSG_task_listen(const char *alias);
 
-XBT_PUBLIC(int)
-MSG_task_listen_from_host(const char* alias, m_host_t host);
+XBT_PUBLIC(int) MSG_task_listen_from_host(const char *alias, m_host_t host);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_alias_select_from(const char* alias, double timeout, int* PID);
+  MSG_alias_select_from(const char *alias, double timeout, int *PID);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_task_send_with_timeout(m_task_t task, const char* alias, double timeout);
+  MSG_task_send_with_timeout(m_task_t task, const char *alias, double timeout);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_task_send(m_task_t task,const char* alias);
+  MSG_task_send(m_task_t task, const char *alias);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_task_send_bounded(m_task_t task, const char* alias, double rate);
+  MSG_task_send_bounded(m_task_t task, const char *alias, double rate);
 
-XBT_PUBLIC(int)
-MSG_task_listen_from(const char* alias);
+XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
 
 /************************** Task handling ************************************/
 XBT_PUBLIC(MSG_error_t)
-MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t* task, m_host_t host, double timeout);
+  MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
+                         m_host_t host, double timeout);
 
 XBT_PUBLIC(MSG_error_t)
-MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task, double timeout);
+  MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
+                             double timeout);
 
 /************************** Action handling **********************************/
-typedef void (*msg_action_fun)(xbt_dynar_t args);
-XBT_PUBLIC(void) MSG_action_register(const char*action_name, msg_action_fun function);
-XBT_PUBLIC(void) MSG_action_unregister(const char*action_name);
-MSG_error_t MSG_action_trace_run(char*path);
+     typedef void (*msg_action_fun) (xbt_dynar_t args);
+XBT_PUBLIC(void) MSG_action_register(const char *action_name,
+                                     msg_action_fun function);
+XBT_PUBLIC(void) MSG_action_unregister(const char *action_name);
+     MSG_error_t MSG_action_trace_run(char *path);
 
 
 SG_END_DECL()
index dff2935..39a49b7 100644 (file)
@@ -30,7 +30,7 @@ typedef enum {
   SD_LINK_SHARED,
   SD_LINK_FATPIPE
 } e_SD_link_sharing_policy_t;
+
 /** @brief Link datatype
     @ingroup SD_datatypes_management
 
@@ -59,13 +59,13 @@ typedef struct SD_task *SD_task_t;
     @see SD_task_management */
 typedef enum {
   SD_NOT_SCHEDULED = 0,      /**< @brief Initial state (not valid for SD_watch and SD_unwatch). */
-  SD_SCHEDULED =     0x0001, /**< @brief A task becomes SD_SCHEDULED when you call function
+  SD_SCHEDULED = 0x0001,     /**< @brief A task becomes SD_SCHEDULED when you call function
                                SD_task_schedule. SD_simulate will execute it when it becomes SD_READY. */
-  SD_READY =         0x0002, /**< @brief A scheduled task becomes ready is SD_simulate as soon as its dependencies are satisfied. */
-  SD_IN_FIFO =       0x0004, /**< @brief A ready task can have to wait in a workstation fifo if the workstation is sequential */
-  SD_RUNNING =       0x0008, /**< @brief An SD_READY or SD_IN_FIFO becomes SD_RUNNING when it is launched. */
-  SD_DONE =          0x0010, /**< @brief The task is successfuly finished. */
-  SD_FAILED =        0x0020  /**< @brief A problem occured during the execution of the task. */
+  SD_READY = 0x0002,         /**< @brief A scheduled task becomes ready is SD_simulate as soon as its dependencies are satisfied. */
+  SD_IN_FIFO = 0x0004,       /**< @brief A ready task can have to wait in a workstation fifo if the workstation is sequential */
+  SD_RUNNING = 0x0008,       /**< @brief An SD_READY or SD_IN_FIFO becomes SD_RUNNING when it is launched. */
+  SD_DONE = 0x0010,          /**< @brief The task is successfuly finished. */
+  SD_FAILED = 0x0020         /**< @brief A problem occured during the execution of the task. */
 } e_SD_task_state_t;
 
 #endif
index 2665377..a99999a 100644 (file)
@@ -10,7 +10,6 @@
 SG_BEGIN_DECL()
 
 /************************** Link handling ***********************************/
-
 /** @defgroup SD_link_management Links
  *  @brief Functions for managing the network links
  * 
@@ -23,17 +22,19 @@ SG_BEGIN_DECL()
  *  @see SD_link_t
  *  @{
  */
-XBT_PUBLIC(const SD_link_t*)   SD_link_get_list(void);
-XBT_PUBLIC(int)                SD_link_get_number(void);
-XBT_PUBLIC(void*)              SD_link_get_data(SD_link_t link);
-XBT_PUBLIC(void)               SD_link_set_data(SD_link_t link, void *data);
-XBT_PUBLIC(const char*)        SD_link_get_name(SD_link_t link);
-XBT_PUBLIC(double)             SD_link_get_current_bandwidth(SD_link_t link);
-XBT_PUBLIC(double)             SD_link_get_current_latency(SD_link_t link);
-XBT_PUBLIC(e_SD_link_sharing_policy_t) SD_link_get_sharing_policy(SD_link_t link);
+XBT_PUBLIC(const SD_link_t *) SD_link_get_list(void);
+XBT_PUBLIC(int) SD_link_get_number(void);
+XBT_PUBLIC(void *) SD_link_get_data(SD_link_t link);
+XBT_PUBLIC(void) SD_link_set_data(SD_link_t link, void *data);
+XBT_PUBLIC(const char *) SD_link_get_name(SD_link_t link);
+XBT_PUBLIC(double) SD_link_get_current_bandwidth(SD_link_t link);
+XBT_PUBLIC(double) SD_link_get_current_latency(SD_link_t link);
+XBT_PUBLIC(e_SD_link_sharing_policy_t) SD_link_get_sharing_policy(SD_link_t
+                                                                  link);
 /*property handling functions*/
 XBT_PUBLIC(xbt_dict_t) SD_link_get_properties(SD_link_t link);
-XBT_PUBLIC(const char*) SD_link_get_property_value(SD_link_t link, const char* name);
+XBT_PUBLIC(const char *) SD_link_get_property_value(SD_link_t link,
+                                                    const char *name);
 /** @} */
 
 /************************** Workstation handling ****************************/
@@ -52,29 +53,45 @@ XBT_PUBLIC(const char*) SD_link_get_property_value(SD_link_t link, const char* n
  *  @see SD_workstation_t
  *  @{
  */
-XBT_PUBLIC(SD_workstation_t)        SD_workstation_get_by_name(const char *name);
-XBT_PUBLIC(const SD_workstation_t*) SD_workstation_get_list(void);
-XBT_PUBLIC(int)                     SD_workstation_get_number(void);
-XBT_PUBLIC(void)                    SD_workstation_set_data(SD_workstation_t workstation, void *data);
-XBT_PUBLIC(void*)                   SD_workstation_get_data(SD_workstation_t workstation);
-XBT_PUBLIC(const char*)             SD_workstation_get_name(SD_workstation_t workstation);
+XBT_PUBLIC(SD_workstation_t) SD_workstation_get_by_name(const char *name);
+XBT_PUBLIC(const SD_workstation_t *) SD_workstation_get_list(void);
+XBT_PUBLIC(int) SD_workstation_get_number(void);
+XBT_PUBLIC(void) SD_workstation_set_data(SD_workstation_t workstation,
+                                         void *data);
+XBT_PUBLIC(void *) SD_workstation_get_data(SD_workstation_t workstation);
+XBT_PUBLIC(const char *) SD_workstation_get_name(SD_workstation_t
+                                                 workstation);
 /*property handling functions*/
-XBT_PUBLIC(xbt_dict_t) SD_workstation_get_properties(SD_workstation_t workstation);
-XBT_PUBLIC(const char*) SD_workstation_get_property_value(SD_workstation_t workstation, const char* name);
-XBT_PUBLIC(const SD_link_t*)              SD_route_get_list(SD_workstation_t src, SD_workstation_t dst);
-XBT_PUBLIC(int)                     SD_route_get_size(SD_workstation_t src, SD_workstation_t dst);
-XBT_PUBLIC(double)                  SD_workstation_get_power(SD_workstation_t workstation);
-XBT_PUBLIC(double)                  SD_workstation_get_available_power(SD_workstation_t workstation);
-XBT_PUBLIC(e_SD_workstation_access_mode_t) SD_workstation_get_access_mode(SD_workstation_t workstation);
-XBT_PUBLIC(void)                    SD_workstation_set_access_mode(SD_workstation_t workstation,
-                                                      e_SD_workstation_access_mode_t access_mode);
-
-XBT_PUBLIC(double)    SD_workstation_get_computation_time(SD_workstation_t workstation, double computation_amount);
-XBT_PUBLIC(double)    SD_route_get_current_latency(SD_workstation_t src, SD_workstation_t dst);
-XBT_PUBLIC(double)    SD_route_get_current_bandwidth(SD_workstation_t src, SD_workstation_t dst);
-XBT_PUBLIC(double)    SD_route_get_communication_time(SD_workstation_t src, SD_workstation_t dst,
-                                                     double communication_amount);
+XBT_PUBLIC(xbt_dict_t) SD_workstation_get_properties(SD_workstation_t
+                                                     workstation);
+XBT_PUBLIC(const char *) SD_workstation_get_property_value(SD_workstation_t
+                                                           workstation,
+                                                           const char *name);
+
+XBT_PUBLIC(const SD_link_t *) SD_route_get_list(SD_workstation_t src,
+                                                SD_workstation_t dst);
+XBT_PUBLIC(int) SD_route_get_size(SD_workstation_t src, SD_workstation_t dst);
+XBT_PUBLIC(double) SD_workstation_get_power(SD_workstation_t workstation);
+XBT_PUBLIC(double) SD_workstation_get_available_power(SD_workstation_t
+                                                      workstation);
+XBT_PUBLIC(e_SD_workstation_access_mode_t)
+  SD_workstation_get_access_mode(SD_workstation_t workstation);
+XBT_PUBLIC(void) SD_workstation_set_access_mode(SD_workstation_t workstation,
+                                                e_SD_workstation_access_mode_t
+                                                access_mode);
+
+XBT_PUBLIC(double) SD_workstation_get_computation_time(SD_workstation_t
+                                                       workstation,
+                                                       double
+                                                       computation_amount);
+XBT_PUBLIC(double) SD_route_get_current_latency(SD_workstation_t src,
+                                                SD_workstation_t dst);
+XBT_PUBLIC(double) SD_route_get_current_bandwidth(SD_workstation_t src,
+                                                  SD_workstation_t dst);
+XBT_PUBLIC(double) SD_route_get_communication_time(SD_workstation_t src,
+                                                   SD_workstation_t dst,
+                                                   double
+                                                   communication_amount);
 
 /** @} */
 
@@ -94,26 +111,32 @@ XBT_PUBLIC(double)    SD_route_get_communication_time(SD_workstation_t src, SD_w
  *  @see SD_task_t, SD_task_dependency_management
  *  @{
  */
-XBT_PUBLIC(SD_task_t)         SD_task_create(const char *name, void *data, double amount);
-XBT_PUBLIC(void*)         SD_task_get_data(SD_task_t task);
-XBT_PUBLIC(void)              SD_task_set_data(SD_task_t task, void *data);
+XBT_PUBLIC(SD_task_t) SD_task_create(const char *name, void *data,
+                                     double amount);
+XBT_PUBLIC(void *) SD_task_get_data(SD_task_t task);
+XBT_PUBLIC(void) SD_task_set_data(SD_task_t task, void *data);
 XBT_PUBLIC(e_SD_task_state_t) SD_task_get_state(SD_task_t task);
-XBT_PUBLIC(const char*)       SD_task_get_name(SD_task_t task);
-XBT_PUBLIC(void)              SD_task_watch(SD_task_t task, e_SD_task_state_t state);
-XBT_PUBLIC(void)              SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
-XBT_PUBLIC(double)            SD_task_get_amount(SD_task_t task);
-XBT_PUBLIC(double)            SD_task_get_remaining_amount(SD_task_t task);
-XBT_PUBLIC(double)            SD_task_get_execution_time(SD_task_t task, int workstation_nb,
-                                            const SD_workstation_t *workstation_list,
-                                            const double *computation_amount, const double *communication_amount,
-                                            double rate);
-XBT_PUBLIC(void)              SD_task_schedule(SD_task_t task, int workstation_nb,
-                                  const SD_workstation_t *workstation_list, const double *computation_amount,
-                                  const double *communication_amount, double rate);
-XBT_PUBLIC(void)              SD_task_unschedule(SD_task_t task);
-XBT_PUBLIC(double)            SD_task_get_start_time(SD_task_t task);
-XBT_PUBLIC(double)            SD_task_get_finish_time(SD_task_t task);
-XBT_PUBLIC(void)              SD_task_destroy(SD_task_t task);
+XBT_PUBLIC(const char *) SD_task_get_name(SD_task_t task);
+XBT_PUBLIC(void) SD_task_watch(SD_task_t task, e_SD_task_state_t state);
+XBT_PUBLIC(void) SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
+XBT_PUBLIC(double) SD_task_get_amount(SD_task_t task);
+XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task);
+XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task,
+                                              int workstation_nb,
+                                              const SD_workstation_t *
+                                              workstation_list, const double
+                                              *computation_amount, const double
+                                              *communication_amount,
+                                              double rate);
+XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int workstation_nb,
+                                  const SD_workstation_t * workstation_list,
+                                  const double *computation_amount,
+                                  const double *communication_amount,
+                                  double rate);
+XBT_PUBLIC(void) SD_task_unschedule(SD_task_t task);
+XBT_PUBLIC(double) SD_task_get_start_time(SD_task_t task);
+XBT_PUBLIC(double) SD_task_get_finish_time(SD_task_t task);
+XBT_PUBLIC(void) SD_task_destroy(SD_task_t task);
 /** @} */
 
 
@@ -125,10 +148,11 @@ XBT_PUBLIC(void)              SD_task_destroy(SD_task_t task);
  *  @see SD_task_management
  *  @{
  */
-XBT_PUBLIC(void)              SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst);
-XBT_PUBLIC(void)              SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
-XBT_PUBLIC(void*)             SD_task_dependency_get_data(SD_task_t src, SD_task_t dst);
-XBT_PUBLIC(int)               SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
+XBT_PUBLIC(void) SD_task_dependency_add(const char *name, void *data,
+                                        SD_task_t src, SD_task_t dst);
+XBT_PUBLIC(void) SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
+XBT_PUBLIC(void *) SD_task_dependency_get_data(SD_task_t src, SD_task_t dst);
+XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
 /** @} */
 
 /************************** Global *******************************************/
@@ -141,14 +165,13 @@ XBT_PUBLIC(int)               SD_task_dependency_exists(SD_task_t src, SD_task_t
  *  
  *  @{
  */
-XBT_PUBLIC(void)              SD_init(int *argc, char **argv);
-XBT_PUBLIC(void)              SD_application_reinit(void);
-XBT_PUBLIC(void)              SD_create_environment(const char *platform_file);
-XBT_PUBLIC(SD_task_t*)        SD_simulate(double how_long);
-XBT_PUBLIC(double)            SD_get_clock(void);
-XBT_PUBLIC(void)              SD_exit(void);
+XBT_PUBLIC(void) SD_init(int *argc, char **argv);
+XBT_PUBLIC(void) SD_application_reinit(void);
+XBT_PUBLIC(void) SD_create_environment(const char *platform_file);
+XBT_PUBLIC(SD_task_t *) SD_simulate(double how_long);
+XBT_PUBLIC(double) SD_get_clock(void);
+XBT_PUBLIC(void) SD_exit(void);
 /** @} */
 
 SG_END_DECL()
-
 #endif
index 8b0352b..67a740e 100644 (file)
@@ -7,15 +7,10 @@
 #include <xbt/function_types.h>
 
 SG_BEGIN_DECL()
-
 #define SMPI_RAND_SEED 5
-
 #define MPI_ANY_SOURCE -1
-
 #define MPI_ANY_TAG -1
-
 #define MPI_UNDEFINED -1
-
 // errorcodes
 #define MPI_SUCCESS     0
 #define MPI_ERR_COMM    1
@@ -26,47 +21,46 @@ SG_BEGIN_DECL()
 #define MPI_ERR_COUNT   6
 #define MPI_ERR_RANK    7
 #define MPI_ERR_TAG     8
-
 // MPI_Comm
-typedef struct smpi_mpi_communicator_t *smpi_mpi_communicator_t;
-typedef smpi_mpi_communicator_t MPI_Comm;
+     typedef struct smpi_mpi_communicator_t *smpi_mpi_communicator_t;
+     typedef smpi_mpi_communicator_t MPI_Comm;
 
 // MPI_Datatype
-typedef struct smpi_mpi_datatype_t *smpi_mpi_datatype_t;
-typedef smpi_mpi_datatype_t MPI_Datatype;
+     typedef struct smpi_mpi_datatype_t *smpi_mpi_datatype_t;
+     typedef smpi_mpi_datatype_t MPI_Datatype;
 
 // MPI_Request
-typedef struct smpi_mpi_request_t *smpi_mpi_request_t;
-typedef smpi_mpi_request_t MPI_Request;
+     typedef struct smpi_mpi_request_t *smpi_mpi_request_t;
+     typedef smpi_mpi_request_t MPI_Request;
 
 // MPI_Op
-typedef struct smpi_mpi_op_t *smpi_mpi_op_t;
-typedef smpi_mpi_op_t MPI_Op;
+     typedef struct smpi_mpi_op_t *smpi_mpi_op_t;
+     typedef smpi_mpi_op_t MPI_Op;
 
 // MPI_Status
-struct smpi_mpi_status_t {
-  int MPI_SOURCE;
-  int MPI_TAG;
-  int MPI_ERROR;
-};
-typedef struct smpi_mpi_status_t smpi_mpi_status_t;
-typedef smpi_mpi_status_t MPI_Status;
+     struct smpi_mpi_status_t {
+       int MPI_SOURCE;
+       int MPI_TAG;
+       int MPI_ERROR;
+     };
+     typedef struct smpi_mpi_status_t smpi_mpi_status_t;
+     typedef smpi_mpi_status_t MPI_Status;
 
 // global SMPI data structure
-typedef struct smpi_mpi_global_t {
+     typedef struct smpi_mpi_global_t {
 
-       smpi_mpi_communicator_t mpi_comm_world;
+       smpi_mpi_communicator_t mpi_comm_world;
 
-       smpi_mpi_datatype_t     mpi_byte;
-       smpi_mpi_datatype_t     mpi_int;
-       smpi_mpi_datatype_t     mpi_double;
+       smpi_mpi_datatype_t mpi_byte;
+       smpi_mpi_datatype_t mpi_int;
+       smpi_mpi_datatype_t mpi_double;
 
-       smpi_mpi_op_t           mpi_land;
-       smpi_mpi_op_t           mpi_sum;
+       smpi_mpi_op_t mpi_land;
+       smpi_mpi_op_t mpi_sum;
 
-} s_smpi_mpi_global_t;
-typedef struct smpi_mpi_global_t *smpi_mpi_global_t;
-extern smpi_mpi_global_t smpi_mpi_global;
+     } s_smpi_mpi_global_t;
+     typedef struct smpi_mpi_global_t *smpi_mpi_global_t;
+     extern smpi_mpi_global_t smpi_mpi_global;
 
 #define MPI_COMM_WORLD    (smpi_mpi_global->mpi_comm_world)
 #define MPI_COMM_NULL     NULL
@@ -102,15 +96,24 @@ XBT_PUBLIC(int) SMPI_MPI_Finalize(void);
 XBT_PUBLIC(int) SMPI_MPI_Abort(MPI_Comm comm, int errorcode);
 XBT_PUBLIC(int) SMPI_MPI_Comm_size(MPI_Comm comm, int *size);
 XBT_PUBLIC(int) SMPI_MPI_Comm_rank(MPI_Comm comm, int *rank);
-XBT_PUBLIC(int) SMPI_MPI_Type_size(MPI_Datatype datatype, size_t *size);
+XBT_PUBLIC(int) SMPI_MPI_Type_size(MPI_Datatype datatype, size_t * size);
 XBT_PUBLIC(int) SMPI_MPI_Barrier(MPI_Comm comm);
-XBT_PUBLIC(int) SMPI_MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request);
-XBT_PUBLIC(int) SMPI_MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status);
-XBT_PUBLIC(int) SMPI_MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request *request);
-XBT_PUBLIC(int) SMPI_MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
-XBT_PUBLIC(int) SMPI_MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
-XBT_PUBLIC(int) SMPI_MPI_Wait(MPI_Request *request, MPI_Status *status);
-XBT_PUBLIC(int) SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out);
+XBT_PUBLIC(int) SMPI_MPI_Irecv(void *buf, int count, MPI_Datatype datatype,
+                               int src, int tag, MPI_Comm comm,
+                               MPI_Request * request);
+XBT_PUBLIC(int) SMPI_MPI_Recv(void *buf, int count, MPI_Datatype datatype,
+                              int src, int tag, MPI_Comm comm,
+                              MPI_Status * status);
+XBT_PUBLIC(int) SMPI_MPI_Isend(void *buf, int count, MPI_Datatype datatype,
+                               int dst, int tag, MPI_Comm comm,
+                               MPI_Request * request);
+XBT_PUBLIC(int) SMPI_MPI_Send(void *buf, int count, MPI_Datatype datatype,
+                              int dst, int tag, MPI_Comm comm);
+XBT_PUBLIC(int) SMPI_MPI_Bcast(void *buf, int count, MPI_Datatype datatype,
+                               int root, MPI_Comm comm);
+XBT_PUBLIC(int) SMPI_MPI_Wait(MPI_Request * request, MPI_Status * status);
+XBT_PUBLIC(int) SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key,
+                                    MPI_Comm * comm_out);
 
 // smpi functions
 XBT_IMPORT_NO_EXPORT(int) smpi_simulated_main(int argc, char **argv);
@@ -119,11 +122,10 @@ XBT_PUBLIC(void) smpi_exit(int);
 XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv, struct timezone *tz);
 
 XBT_PUBLIC(void) smpi_do_once_1(const char *file, int line);
-XBT_PUBLIC(int)  smpi_do_once_2(void);
+XBT_PUBLIC(int) smpi_do_once_2(void);
 XBT_PUBLIC(void) smpi_do_once_3(void);
 
 #define SMPI_DO_ONCE for (smpi_do_once_1(__FILE__, __LINE__); smpi_do_once_2(); smpi_do_once_3())
 
 SG_END_DECL()
-
 #endif
index cd48cd2..f003aee 100644 (file)
 #ifndef _FLEXML_simgrid_H
 #define _FLEXML_simgrid_H
 
-\r
-SG_BEGIN_DECL()
+\r SG_BEGIN_DECL()
 
 /* XML application entry points. */
-XBT_PUBLIC(void ) STag_surfxml_platform(void);
-XBT_PUBLIC(void ) ETag_surfxml_platform(void);
-XBT_PUBLIC(void ) STag_surfxml_include(void);
-XBT_PUBLIC(void ) ETag_surfxml_include(void);
-XBT_PUBLIC(void ) STag_surfxml_trace(void);
-XBT_PUBLIC(void ) ETag_surfxml_trace(void);
-XBT_PUBLIC(void ) STag_surfxml_random(void);
-XBT_PUBLIC(void ) ETag_surfxml_random(void);
-XBT_PUBLIC(void ) STag_surfxml_trace_c_connect(void);
-XBT_PUBLIC(void ) ETag_surfxml_trace_c_connect(void);
-XBT_PUBLIC(void ) STag_surfxml_set(void);
-XBT_PUBLIC(void ) ETag_surfxml_set(void);
-XBT_PUBLIC(void ) STag_surfxml_foreach(void);
-XBT_PUBLIC(void ) ETag_surfxml_foreach(void);
-XBT_PUBLIC(void ) STag_surfxml_host(void);
-XBT_PUBLIC(void ) ETag_surfxml_host(void);
-XBT_PUBLIC(void ) STag_surfxml_prop(void);
-XBT_PUBLIC(void ) ETag_surfxml_prop(void);
-XBT_PUBLIC(void ) STag_surfxml_cluster(void);
-XBT_PUBLIC(void ) ETag_surfxml_cluster(void);
-XBT_PUBLIC(void ) STag_surfxml_router(void);
-XBT_PUBLIC(void ) ETag_surfxml_router(void);
-XBT_PUBLIC(void ) STag_surfxml_link(void);
-XBT_PUBLIC(void ) ETag_surfxml_link(void);
-XBT_PUBLIC(void ) STag_surfxml_route_c_multi(void);
-XBT_PUBLIC(void ) ETag_surfxml_route_c_multi(void);
-XBT_PUBLIC(void ) STag_surfxml_route(void);
-XBT_PUBLIC(void ) ETag_surfxml_route(void);
-XBT_PUBLIC(void ) STag_surfxml_link_c_ctn(void);
-XBT_PUBLIC(void ) ETag_surfxml_link_c_ctn(void);
-XBT_PUBLIC(void ) STag_surfxml_process(void);
-XBT_PUBLIC(void ) ETag_surfxml_process(void);
-XBT_PUBLIC(void ) STag_surfxml_argument(void);
-XBT_PUBLIC(void ) ETag_surfxml_argument(void);
+XBT_PUBLIC(void) STag_surfxml_platform(void);
+XBT_PUBLIC(void) ETag_surfxml_platform(void);
+XBT_PUBLIC(void) STag_surfxml_include(void);
+XBT_PUBLIC(void) ETag_surfxml_include(void);
+XBT_PUBLIC(void) STag_surfxml_trace(void);
+XBT_PUBLIC(void) ETag_surfxml_trace(void);
+XBT_PUBLIC(void) STag_surfxml_random(void);
+XBT_PUBLIC(void) ETag_surfxml_random(void);
+XBT_PUBLIC(void) STag_surfxml_trace_c_connect(void);
+XBT_PUBLIC(void) ETag_surfxml_trace_c_connect(void);
+XBT_PUBLIC(void) STag_surfxml_set(void);
+XBT_PUBLIC(void) ETag_surfxml_set(void);
+XBT_PUBLIC(void) STag_surfxml_foreach(void);
+XBT_PUBLIC(void) ETag_surfxml_foreach(void);
+XBT_PUBLIC(void) STag_surfxml_host(void);
+XBT_PUBLIC(void) ETag_surfxml_host(void);
+XBT_PUBLIC(void) STag_surfxml_prop(void);
+XBT_PUBLIC(void) ETag_surfxml_prop(void);
+XBT_PUBLIC(void) STag_surfxml_cluster(void);
+XBT_PUBLIC(void) ETag_surfxml_cluster(void);
+XBT_PUBLIC(void) STag_surfxml_router(void);
+XBT_PUBLIC(void) ETag_surfxml_router(void);
+XBT_PUBLIC(void) STag_surfxml_link(void);
+XBT_PUBLIC(void) ETag_surfxml_link(void);
+XBT_PUBLIC(void) STag_surfxml_route_c_multi(void);
+XBT_PUBLIC(void) ETag_surfxml_route_c_multi(void);
+XBT_PUBLIC(void) STag_surfxml_route(void);
+XBT_PUBLIC(void) ETag_surfxml_route(void);
+XBT_PUBLIC(void) STag_surfxml_link_c_ctn(void);
+XBT_PUBLIC(void) ETag_surfxml_link_c_ctn(void);
+XBT_PUBLIC(void) STag_surfxml_process(void);
+XBT_PUBLIC(void) ETag_surfxml_process(void);
+XBT_PUBLIC(void) STag_surfxml_argument(void);
+XBT_PUBLIC(void) ETag_surfxml_argument(void);
 
 /* XML application data. */
-typedef enum { AU_surfxml_random_generator, A_surfxml_random_generator_DRAND48,A_surfxml_random_generator_RAND } AT_surfxml_random_generator;
-typedef int AT_surfxml_prop_id;
+     typedef enum { AU_surfxml_random_generator,
+       A_surfxml_random_generator_DRAND48,
+       A_surfxml_random_generator_RAND
+     } AT_surfxml_random_generator;
+     typedef int AT_surfxml_prop_id;
 #define AU_surfxml_prop_id NULL
-typedef int AT_surfxml_host_interference_recv;
+     typedef int AT_surfxml_host_interference_recv;
 #define AU_surfxml_host_interference_recv NULL
-typedef int AT_surfxml_host_id;
+     typedef int AT_surfxml_host_id;
 #define AU_surfxml_host_id NULL
-typedef int AT_surfxml_set_id;
+     typedef int AT_surfxml_set_id;
 #define AU_surfxml_set_id NULL
-typedef int AT_surfxml_link_latency_file;
+     typedef int AT_surfxml_link_latency_file;
 #define AU_surfxml_link_latency_file NULL
-typedef enum { AU_surfxml_host_state, A_surfxml_host_state_ON,A_surfxml_host_state_OFF } AT_surfxml_host_state;
-typedef int AT_surfxml_host_interference_send_recv;
+     typedef enum { AU_surfxml_host_state, A_surfxml_host_state_ON,
+       A_surfxml_host_state_OFF
+     } AT_surfxml_host_state;
+     typedef int AT_surfxml_host_interference_send_recv;
 #define AU_surfxml_host_interference_send_recv NULL
-typedef int AT_surfxml_host_interference_send;
+     typedef int AT_surfxml_host_interference_send;
 #define AU_surfxml_host_interference_send NULL
-typedef int AT_surfxml_set_suffix;
+     typedef int AT_surfxml_set_suffix;
 #define AU_surfxml_set_suffix NULL
-typedef int AT_surfxml_route_impact_on_dst;
+     typedef int AT_surfxml_route_impact_on_dst;
 #define AU_surfxml_route_impact_on_dst NULL
-typedef int AT_surfxml_host_power;
+     typedef int AT_surfxml_host_power;
 #define AU_surfxml_host_power NULL
-typedef int AT_surfxml_router_id;
+     typedef int AT_surfxml_router_id;
 #define AU_surfxml_router_id NULL
-typedef int AT_surfxml_process_start_time;
+     typedef int AT_surfxml_process_start_time;
 #define AU_surfxml_process_start_time NULL
-typedef int AT_surfxml_cluster_suffix;
+     typedef int AT_surfxml_cluster_suffix;
 #define AU_surfxml_cluster_suffix NULL
-typedef int AT_surfxml_platform_xmlns_c_route;
+     typedef int AT_surfxml_platform_xmlns_c_route;
 #define AU_surfxml_platform_xmlns_c_route NULL
-typedef int AT_surfxml_cluster_prefix;
+     typedef int AT_surfxml_cluster_prefix;
 #define AU_surfxml_cluster_prefix NULL
-typedef int AT_surfxml_trace_file;
+     typedef int AT_surfxml_trace_file;
 #define AU_surfxml_trace_file NULL
-typedef enum { AU_surfxml_route_action, A_surfxml_route_action_POSTPEND,A_surfxml_route_action_PREPEND,A_surfxml_route_action_OVERRIDE } AT_surfxml_route_action;
-typedef enum { AU_surfxml_link_sharing_policy, A_surfxml_link_sharing_policy_SHARED,A_surfxml_link_sharing_policy_FATPIPE } AT_surfxml_link_sharing_policy;
-typedef int AT_surfxml_random_min;
+     typedef enum { AU_surfxml_route_action, A_surfxml_route_action_POSTPEND,
+       A_surfxml_route_action_PREPEND,
+       A_surfxml_route_action_OVERRIDE
+     } AT_surfxml_route_action;
+     typedef enum { AU_surfxml_link_sharing_policy,
+       A_surfxml_link_sharing_policy_SHARED,
+       A_surfxml_link_sharing_policy_FATPIPE
+     } AT_surfxml_link_sharing_policy;
+     typedef int AT_surfxml_random_min;
 #define AU_surfxml_random_min NULL
-typedef int AT_surfxml_process_kill_time;
+     typedef int AT_surfxml_process_kill_time;
 #define AU_surfxml_process_kill_time NULL
-typedef int AT_surfxml_cluster_bb_bw;
+     typedef int AT_surfxml_cluster_bb_bw;
 #define AU_surfxml_cluster_bb_bw NULL
-typedef int AT_surfxml_trace_c_connect_element;
+     typedef int AT_surfxml_trace_c_connect_element;
 #define AU_surfxml_trace_c_connect_element NULL
-typedef int AT_surfxml_argument_value;
+     typedef int AT_surfxml_argument_value;
 #define AU_surfxml_argument_value NULL
-typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON,A_surfxml_link_state_OFF } AT_surfxml_link_state;
-typedef int AT_surfxml_route_impact_on_src;
+     typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON,
+       A_surfxml_link_state_OFF
+     } AT_surfxml_link_state;
+     typedef int AT_surfxml_route_impact_on_src;
 #define AU_surfxml_route_impact_on_src NULL
-typedef int AT_surfxml_link_bandwidth;
+     typedef int AT_surfxml_link_bandwidth;
 #define AU_surfxml_link_bandwidth NULL
-typedef int AT_surfxml_cluster_id;
+     typedef int AT_surfxml_cluster_id;
 #define AU_surfxml_cluster_id NULL
-typedef int AT_surfxml_random_mean;
+     typedef int AT_surfxml_random_mean;
 #define AU_surfxml_random_mean NULL
-typedef int AT_surfxml_cluster_bb_lat;
+     typedef int AT_surfxml_cluster_bb_lat;
 #define AU_surfxml_cluster_bb_lat NULL
-typedef int AT_surfxml_link_latency;
+     typedef int AT_surfxml_link_latency;
 #define AU_surfxml_link_latency NULL
-typedef int AT_surfxml_platform_xmlns_c_link;
+     typedef int AT_surfxml_platform_xmlns_c_link;
 #define AU_surfxml_platform_xmlns_c_link NULL
-typedef int AT_surfxml_link_bandwidth_file;
+     typedef int AT_surfxml_link_bandwidth_file;
 #define AU_surfxml_link_bandwidth_file NULL
-typedef int AT_surfxml_random_id;
+     typedef int AT_surfxml_random_id;
 #define AU_surfxml_random_id NULL
-typedef int AT_surfxml_set_radical;
+     typedef int AT_surfxml_set_radical;
 #define AU_surfxml_set_radical NULL
-typedef int AT_surfxml_random_max;
+     typedef int AT_surfxml_random_max;
 #define AU_surfxml_random_max NULL
-typedef int AT_surfxml_link_id;
+     typedef int AT_surfxml_link_id;
 #define AU_surfxml_link_id NULL
-typedef int AT_surfxml_process_host;
+     typedef int AT_surfxml_process_host;
 #define AU_surfxml_process_host NULL
-typedef int AT_surfxml_host_availability_file;
+     typedef int AT_surfxml_host_availability_file;
 #define AU_surfxml_host_availability_file NULL
-typedef int AT_surfxml_cluster_lat;
+     typedef int AT_surfxml_cluster_lat;
 #define AU_surfxml_cluster_lat NULL
-typedef int AT_surfxml_trace_periodicity;
+     typedef int AT_surfxml_trace_periodicity;
 #define AU_surfxml_trace_periodicity NULL
-typedef int AT_surfxml_foreach_set_id;
+     typedef int AT_surfxml_foreach_set_id;
 #define AU_surfxml_foreach_set_id NULL
-typedef int AT_surfxml_route_impact_on_dst_with_other_send;
+     typedef int AT_surfxml_route_impact_on_dst_with_other_send;
 #define AU_surfxml_route_impact_on_dst_with_other_send NULL
-typedef int AT_surfxml_prop_value;
+     typedef int AT_surfxml_prop_value;
 #define AU_surfxml_prop_value NULL
-typedef int AT_surfxml_route_impact_on_src_with_other_recv;
+     typedef int AT_surfxml_route_impact_on_src_with_other_recv;
 #define AU_surfxml_route_impact_on_src_with_other_recv NULL
-typedef int AT_surfxml_link_state_file;
+     typedef int AT_surfxml_link_state_file;
 #define AU_surfxml_link_state_file NULL
-typedef int AT_surfxml_set_prefix;
+     typedef int AT_surfxml_set_prefix;
 #define AU_surfxml_set_prefix NULL
-typedef int AT_surfxml_cluster_power;
+     typedef int AT_surfxml_cluster_power;
 #define AU_surfxml_cluster_power NULL
-typedef int AT_surfxml_process_function;
+     typedef int AT_surfxml_process_function;
 #define AU_surfxml_process_function NULL
-typedef int AT_surfxml_host_max_outgoing_rate;
+     typedef int AT_surfxml_host_max_outgoing_rate;
 #define AU_surfxml_host_max_outgoing_rate NULL
-typedef int AT_surfxml_link_c_ctn_id;
+     typedef int AT_surfxml_link_c_ctn_id;
 #define AU_surfxml_link_c_ctn_id NULL
-typedef int AT_surfxml_host_availability;
+     typedef int AT_surfxml_host_availability;
 #define AU_surfxml_host_availability NULL
-typedef int AT_surfxml_route_src;
+     typedef int AT_surfxml_route_src;
 #define AU_surfxml_route_src NULL
-typedef int AT_surfxml_route_c_multi_src;
+     typedef int AT_surfxml_route_c_multi_src;
 #define AU_surfxml_route_c_multi_src NULL
-typedef enum { AU_surfxml_route_c_multi_action, A_surfxml_route_c_multi_action_POSTPEND,A_surfxml_route_c_multi_action_PREPEND,A_surfxml_route_c_multi_action_OVERRIDE } AT_surfxml_route_c_multi_action;
-typedef int AT_surfxml_trace_c_connect_trace;
+     typedef enum { AU_surfxml_route_c_multi_action,
+       A_surfxml_route_c_multi_action_POSTPEND,
+       A_surfxml_route_c_multi_action_PREPEND,
+       A_surfxml_route_c_multi_action_OVERRIDE
+     } AT_surfxml_route_c_multi_action;
+     typedef int AT_surfxml_trace_c_connect_trace;
 #define AU_surfxml_trace_c_connect_trace NULL
-typedef int AT_surfxml_trace_id;
+     typedef int AT_surfxml_trace_id;
 #define AU_surfxml_trace_id NULL
-typedef int AT_surfxml_cluster_radical;
+     typedef int AT_surfxml_cluster_radical;
 #define AU_surfxml_cluster_radical NULL
-typedef int AT_surfxml_include_file;
+     typedef int AT_surfxml_include_file;
 #define AU_surfxml_include_file NULL
-typedef int AT_surfxml_random_std_deviation;
+     typedef int AT_surfxml_random_std_deviation;
 #define AU_surfxml_random_std_deviation NULL
-typedef enum { AU_surfxml_trace_c_connect_kind, A_surfxml_trace_c_connect_kind_HOST_AVAIL,A_surfxml_trace_c_connect_kind_POWER,A_surfxml_trace_c_connect_kind_LINK_AVAIL,A_surfxml_trace_c_connect_kind_BANDWIDTH,A_surfxml_trace_c_connect_kind_LATENCY } AT_surfxml_trace_c_connect_kind;
-typedef int AT_surfxml_route_c_multi_dst;
+     typedef enum { AU_surfxml_trace_c_connect_kind,
+       A_surfxml_trace_c_connect_kind_HOST_AVAIL,
+       A_surfxml_trace_c_connect_kind_POWER,
+       A_surfxml_trace_c_connect_kind_LINK_AVAIL,
+       A_surfxml_trace_c_connect_kind_BANDWIDTH,
+       A_surfxml_trace_c_connect_kind_LATENCY
+     } AT_surfxml_trace_c_connect_kind;
+     typedef int AT_surfxml_route_c_multi_dst;
 #define AU_surfxml_route_c_multi_dst NULL
-typedef int AT_surfxml_host_state_file;
+     typedef int AT_surfxml_host_state_file;
 #define AU_surfxml_host_state_file NULL
-typedef enum { AU_surfxml_route_c_multi_symmetric, A_surfxml_route_c_multi_symmetric_YES,A_surfxml_route_c_multi_symmetric_NO } AT_surfxml_route_c_multi_symmetric;
-typedef int AT_surfxml_route_dst;
+     typedef enum { AU_surfxml_route_c_multi_symmetric,
+       A_surfxml_route_c_multi_symmetric_YES,
+       A_surfxml_route_c_multi_symmetric_NO
+     } AT_surfxml_route_c_multi_symmetric;
+     typedef int AT_surfxml_route_dst;
 #define AU_surfxml_route_dst NULL
-typedef int AT_surfxml_cluster_bw;
+     typedef int AT_surfxml_cluster_bw;
 #define AU_surfxml_cluster_bw NULL
-typedef int AT_surfxml_platform_version;
+     typedef int AT_surfxml_platform_version;
 #define AU_surfxml_platform_version NULL
 
 /* FleXML-provided data. */
-XBT_PUBLIC_DATA(int ) surfxml_pcdata_ix;
+XBT_PUBLIC_DATA(int) surfxml_pcdata_ix;
 XBT_PUBLIC_DATA(char *) surfxml_bufferstack;
 #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix)
-XBT_PUBLIC_DATA(AT_surfxml_random_generator ) AX_surfxml_random_generator;
+XBT_PUBLIC_DATA(AT_surfxml_random_generator) AX_surfxml_random_generator;
 #define A_surfxml_random_generator AX_surfxml_random_generator
-XBT_PUBLIC_DATA(AT_surfxml_prop_id ) AX_surfxml_prop_id;
+XBT_PUBLIC_DATA(AT_surfxml_prop_id) AX_surfxml_prop_id;
 #define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id)
-XBT_PUBLIC_DATA(AT_surfxml_host_interference_recv ) AX_surfxml_host_interference_recv;
+XBT_PUBLIC_DATA(AT_surfxml_host_interference_recv)
+  AX_surfxml_host_interference_recv;
 #define A_surfxml_host_interference_recv (surfxml_bufferstack + AX_surfxml_host_interference_recv)
-XBT_PUBLIC_DATA(AT_surfxml_host_id ) AX_surfxml_host_id;
+XBT_PUBLIC_DATA(AT_surfxml_host_id) AX_surfxml_host_id;
 #define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id)
-XBT_PUBLIC_DATA(AT_surfxml_set_id ) AX_surfxml_set_id;
+XBT_PUBLIC_DATA(AT_surfxml_set_id) AX_surfxml_set_id;
 #define A_surfxml_set_id (surfxml_bufferstack + AX_surfxml_set_id)
-XBT_PUBLIC_DATA(AT_surfxml_link_latency_file ) AX_surfxml_link_latency_file;
+XBT_PUBLIC_DATA(AT_surfxml_link_latency_file) AX_surfxml_link_latency_file;
 #define A_surfxml_link_latency_file (surfxml_bufferstack + AX_surfxml_link_latency_file)
-XBT_PUBLIC_DATA(AT_surfxml_host_state ) AX_surfxml_host_state;
+XBT_PUBLIC_DATA(AT_surfxml_host_state) AX_surfxml_host_state;
 #define A_surfxml_host_state AX_surfxml_host_state
-XBT_PUBLIC_DATA(AT_surfxml_host_interference_send_recv ) AX_surfxml_host_interference_send_recv;
+XBT_PUBLIC_DATA(AT_surfxml_host_interference_send_recv)
+  AX_surfxml_host_interference_send_recv;
 #define A_surfxml_host_interference_send_recv (surfxml_bufferstack + AX_surfxml_host_interference_send_recv)
-XBT_PUBLIC_DATA(AT_surfxml_host_interference_send ) AX_surfxml_host_interference_send;
+XBT_PUBLIC_DATA(AT_surfxml_host_interference_send)
+  AX_surfxml_host_interference_send;
 #define A_surfxml_host_interference_send (surfxml_bufferstack + AX_surfxml_host_interference_send)
-XBT_PUBLIC_DATA(AT_surfxml_set_suffix ) AX_surfxml_set_suffix;
+XBT_PUBLIC_DATA(AT_surfxml_set_suffix) AX_surfxml_set_suffix;
 #define A_surfxml_set_suffix (surfxml_bufferstack + AX_surfxml_set_suffix)
-XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst ) AX_surfxml_route_impact_on_dst;
+XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst)
+  AX_surfxml_route_impact_on_dst;
 #define A_surfxml_route_impact_on_dst (surfxml_bufferstack + AX_surfxml_route_impact_on_dst)
-XBT_PUBLIC_DATA(AT_surfxml_host_power ) AX_surfxml_host_power;
+XBT_PUBLIC_DATA(AT_surfxml_host_power) AX_surfxml_host_power;
 #define A_surfxml_host_power (surfxml_bufferstack + AX_surfxml_host_power)
-XBT_PUBLIC_DATA(AT_surfxml_router_id ) AX_surfxml_router_id;
+XBT_PUBLIC_DATA(AT_surfxml_router_id) AX_surfxml_router_id;
 #define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id)
-XBT_PUBLIC_DATA(AT_surfxml_process_start_time ) AX_surfxml_process_start_time;
+XBT_PUBLIC_DATA(AT_surfxml_process_start_time) AX_surfxml_process_start_time;
 #define A_surfxml_process_start_time (surfxml_bufferstack + AX_surfxml_process_start_time)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix ) AX_surfxml_cluster_suffix;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix) AX_surfxml_cluster_suffix;
 #define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix)
-XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_route ) AX_surfxml_platform_xmlns_c_route;
+XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_route)
+  AX_surfxml_platform_xmlns_c_route;
 #define A_surfxml_platform_xmlns_c_route (surfxml_bufferstack + AX_surfxml_platform_xmlns_c_route)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_prefix ) AX_surfxml_cluster_prefix;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_prefix) AX_surfxml_cluster_prefix;
 #define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix)
-XBT_PUBLIC_DATA(AT_surfxml_trace_file ) AX_surfxml_trace_file;
+XBT_PUBLIC_DATA(AT_surfxml_trace_file) AX_surfxml_trace_file;
 #define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file)
-XBT_PUBLIC_DATA(AT_surfxml_route_action ) AX_surfxml_route_action;
+XBT_PUBLIC_DATA(AT_surfxml_route_action) AX_surfxml_route_action;
 #define A_surfxml_route_action AX_surfxml_route_action
-XBT_PUBLIC_DATA(AT_surfxml_link_sharing_policy ) AX_surfxml_link_sharing_policy;
+XBT_PUBLIC_DATA(AT_surfxml_link_sharing_policy)
+  AX_surfxml_link_sharing_policy;
 #define A_surfxml_link_sharing_policy AX_surfxml_link_sharing_policy
-XBT_PUBLIC_DATA(AT_surfxml_random_min ) AX_surfxml_random_min;
+XBT_PUBLIC_DATA(AT_surfxml_random_min) AX_surfxml_random_min;
 #define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min)
-XBT_PUBLIC_DATA(AT_surfxml_process_kill_time ) AX_surfxml_process_kill_time;
+XBT_PUBLIC_DATA(AT_surfxml_process_kill_time) AX_surfxml_process_kill_time;
 #define A_surfxml_process_kill_time (surfxml_bufferstack + AX_surfxml_process_kill_time)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_bw ) AX_surfxml_cluster_bb_bw;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_bw) AX_surfxml_cluster_bb_bw;
 #define A_surfxml_cluster_bb_bw (surfxml_bufferstack + AX_surfxml_cluster_bb_bw)
-XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_element ) AX_surfxml_trace_c_connect_element;
+XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_element)
+  AX_surfxml_trace_c_connect_element;
 #define A_surfxml_trace_c_connect_element (surfxml_bufferstack + AX_surfxml_trace_c_connect_element)
-XBT_PUBLIC_DATA(AT_surfxml_argument_value ) AX_surfxml_argument_value;
+XBT_PUBLIC_DATA(AT_surfxml_argument_value) AX_surfxml_argument_value;
 #define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value)
-XBT_PUBLIC_DATA(AT_surfxml_link_state ) AX_surfxml_link_state;
+XBT_PUBLIC_DATA(AT_surfxml_link_state) AX_surfxml_link_state;
 #define A_surfxml_link_state AX_surfxml_link_state
-XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src ) AX_surfxml_route_impact_on_src;
+XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src)
+  AX_surfxml_route_impact_on_src;
 #define A_surfxml_route_impact_on_src (surfxml_bufferstack + AX_surfxml_route_impact_on_src)
-XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth ) AX_surfxml_link_bandwidth;
+XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth) AX_surfxml_link_bandwidth;
 #define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_id ) AX_surfxml_cluster_id;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_id) AX_surfxml_cluster_id;
 #define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id)
-XBT_PUBLIC_DATA(AT_surfxml_random_mean ) AX_surfxml_random_mean;
+XBT_PUBLIC_DATA(AT_surfxml_random_mean) AX_surfxml_random_mean;
 #define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_lat ) AX_surfxml_cluster_bb_lat;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_bb_lat) AX_surfxml_cluster_bb_lat;
 #define A_surfxml_cluster_bb_lat (surfxml_bufferstack + AX_surfxml_cluster_bb_lat)
-XBT_PUBLIC_DATA(AT_surfxml_link_latency ) AX_surfxml_link_latency;
+XBT_PUBLIC_DATA(AT_surfxml_link_latency) AX_surfxml_link_latency;
 #define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency)
-XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_link ) AX_surfxml_platform_xmlns_c_link;
+XBT_PUBLIC_DATA(AT_surfxml_platform_xmlns_c_link)
+  AX_surfxml_platform_xmlns_c_link;
 #define A_surfxml_platform_xmlns_c_link (surfxml_bufferstack + AX_surfxml_platform_xmlns_c_link)
-XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth_file ) AX_surfxml_link_bandwidth_file;
+XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth_file)
+  AX_surfxml_link_bandwidth_file;
 #define A_surfxml_link_bandwidth_file (surfxml_bufferstack + AX_surfxml_link_bandwidth_file)
-XBT_PUBLIC_DATA(AT_surfxml_random_id ) AX_surfxml_random_id;
+XBT_PUBLIC_DATA(AT_surfxml_random_id) AX_surfxml_random_id;
 #define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id)
-XBT_PUBLIC_DATA(AT_surfxml_set_radical ) AX_surfxml_set_radical;
+XBT_PUBLIC_DATA(AT_surfxml_set_radical) AX_surfxml_set_radical;
 #define A_surfxml_set_radical (surfxml_bufferstack + AX_surfxml_set_radical)
-XBT_PUBLIC_DATA(AT_surfxml_random_max ) AX_surfxml_random_max;
+XBT_PUBLIC_DATA(AT_surfxml_random_max) AX_surfxml_random_max;
 #define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max)
-XBT_PUBLIC_DATA(AT_surfxml_link_id ) AX_surfxml_link_id;
+XBT_PUBLIC_DATA(AT_surfxml_link_id) AX_surfxml_link_id;
 #define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id)
-XBT_PUBLIC_DATA(AT_surfxml_process_host ) AX_surfxml_process_host;
+XBT_PUBLIC_DATA(AT_surfxml_process_host) AX_surfxml_process_host;
 #define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host)
-XBT_PUBLIC_DATA(AT_surfxml_host_availability_file ) AX_surfxml_host_availability_file;
+XBT_PUBLIC_DATA(AT_surfxml_host_availability_file)
+  AX_surfxml_host_availability_file;
 #define A_surfxml_host_availability_file (surfxml_bufferstack + AX_surfxml_host_availability_file)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_lat ) AX_surfxml_cluster_lat;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_lat) AX_surfxml_cluster_lat;
 #define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat)
-XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity ) AX_surfxml_trace_periodicity;
+XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity) AX_surfxml_trace_periodicity;
 #define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity)
-XBT_PUBLIC_DATA(AT_surfxml_foreach_set_id ) AX_surfxml_foreach_set_id;
+XBT_PUBLIC_DATA(AT_surfxml_foreach_set_id) AX_surfxml_foreach_set_id;
 #define A_surfxml_foreach_set_id (surfxml_bufferstack + AX_surfxml_foreach_set_id)
-XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst_with_other_send ) AX_surfxml_route_impact_on_dst_with_other_send;
+XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_dst_with_other_send)
+  AX_surfxml_route_impact_on_dst_with_other_send;
 #define A_surfxml_route_impact_on_dst_with_other_send (surfxml_bufferstack + AX_surfxml_route_impact_on_dst_with_other_send)
-XBT_PUBLIC_DATA(AT_surfxml_prop_value ) AX_surfxml_prop_value;
+XBT_PUBLIC_DATA(AT_surfxml_prop_value) AX_surfxml_prop_value;
 #define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value)
-XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src_with_other_recv ) AX_surfxml_route_impact_on_src_with_other_recv;
+XBT_PUBLIC_DATA(AT_surfxml_route_impact_on_src_with_other_recv)
+  AX_surfxml_route_impact_on_src_with_other_recv;
 #define A_surfxml_route_impact_on_src_with_other_recv (surfxml_bufferstack + AX_surfxml_route_impact_on_src_with_other_recv)
-XBT_PUBLIC_DATA(AT_surfxml_link_state_file ) AX_surfxml_link_state_file;
+XBT_PUBLIC_DATA(AT_surfxml_link_state_file) AX_surfxml_link_state_file;
 #define A_surfxml_link_state_file (surfxml_bufferstack + AX_surfxml_link_state_file)
-XBT_PUBLIC_DATA(AT_surfxml_set_prefix ) AX_surfxml_set_prefix;
+XBT_PUBLIC_DATA(AT_surfxml_set_prefix) AX_surfxml_set_prefix;
 #define A_surfxml_set_prefix (surfxml_bufferstack + AX_surfxml_set_prefix)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_power ) AX_surfxml_cluster_power;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_power) AX_surfxml_cluster_power;
 #define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power)
-XBT_PUBLIC_DATA(AT_surfxml_process_function ) AX_surfxml_process_function;
+XBT_PUBLIC_DATA(AT_surfxml_process_function) AX_surfxml_process_function;
 #define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function)
-XBT_PUBLIC_DATA(AT_surfxml_host_max_outgoing_rate ) AX_surfxml_host_max_outgoing_rate;
+XBT_PUBLIC_DATA(AT_surfxml_host_max_outgoing_rate)
+  AX_surfxml_host_max_outgoing_rate;
 #define A_surfxml_host_max_outgoing_rate (surfxml_bufferstack + AX_surfxml_host_max_outgoing_rate)
-XBT_PUBLIC_DATA(AT_surfxml_link_c_ctn_id ) AX_surfxml_link_c_ctn_id;
+XBT_PUBLIC_DATA(AT_surfxml_link_c_ctn_id) AX_surfxml_link_c_ctn_id;
 #define A_surfxml_link_c_ctn_id (surfxml_bufferstack + AX_surfxml_link_c_ctn_id)
-XBT_PUBLIC_DATA(AT_surfxml_host_availability ) AX_surfxml_host_availability;
+XBT_PUBLIC_DATA(AT_surfxml_host_availability) AX_surfxml_host_availability;
 #define A_surfxml_host_availability (surfxml_bufferstack + AX_surfxml_host_availability)
-XBT_PUBLIC_DATA(AT_surfxml_route_src ) AX_surfxml_route_src;
+XBT_PUBLIC_DATA(AT_surfxml_route_src) AX_surfxml_route_src;
 #define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src)
-XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_src ) AX_surfxml_route_c_multi_src;
+XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_src) AX_surfxml_route_c_multi_src;
 #define A_surfxml_route_c_multi_src (surfxml_bufferstack + AX_surfxml_route_c_multi_src)
-XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_action ) AX_surfxml_route_c_multi_action;
+XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_action)
+  AX_surfxml_route_c_multi_action;
 #define A_surfxml_route_c_multi_action AX_surfxml_route_c_multi_action
-XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_trace ) AX_surfxml_trace_c_connect_trace;
+XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_trace)
+  AX_surfxml_trace_c_connect_trace;
 #define A_surfxml_trace_c_connect_trace (surfxml_bufferstack + AX_surfxml_trace_c_connect_trace)
-XBT_PUBLIC_DATA(AT_surfxml_trace_id ) AX_surfxml_trace_id;
+XBT_PUBLIC_DATA(AT_surfxml_trace_id) AX_surfxml_trace_id;
 #define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_radical ) AX_surfxml_cluster_radical;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_radical) AX_surfxml_cluster_radical;
 #define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical)
-XBT_PUBLIC_DATA(AT_surfxml_include_file ) AX_surfxml_include_file;
+XBT_PUBLIC_DATA(AT_surfxml_include_file) AX_surfxml_include_file;
 #define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file)
-XBT_PUBLIC_DATA(AT_surfxml_random_std_deviation ) AX_surfxml_random_std_deviation;
+XBT_PUBLIC_DATA(AT_surfxml_random_std_deviation)
+  AX_surfxml_random_std_deviation;
 #define A_surfxml_random_std_deviation (surfxml_bufferstack + AX_surfxml_random_std_deviation)
-XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_kind ) AX_surfxml_trace_c_connect_kind;
+XBT_PUBLIC_DATA(AT_surfxml_trace_c_connect_kind)
+  AX_surfxml_trace_c_connect_kind;
 #define A_surfxml_trace_c_connect_kind AX_surfxml_trace_c_connect_kind
-XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_dst ) AX_surfxml_route_c_multi_dst;
+XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_dst) AX_surfxml_route_c_multi_dst;
 #define A_surfxml_route_c_multi_dst (surfxml_bufferstack + AX_surfxml_route_c_multi_dst)
-XBT_PUBLIC_DATA(AT_surfxml_host_state_file ) AX_surfxml_host_state_file;
+XBT_PUBLIC_DATA(AT_surfxml_host_state_file) AX_surfxml_host_state_file;
 #define A_surfxml_host_state_file (surfxml_bufferstack + AX_surfxml_host_state_file)
-XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_symmetric ) AX_surfxml_route_c_multi_symmetric;
+XBT_PUBLIC_DATA(AT_surfxml_route_c_multi_symmetric)
+  AX_surfxml_route_c_multi_symmetric;
 #define A_surfxml_route_c_multi_symmetric AX_surfxml_route_c_multi_symmetric
-XBT_PUBLIC_DATA(AT_surfxml_route_dst ) AX_surfxml_route_dst;
+XBT_PUBLIC_DATA(AT_surfxml_route_dst) AX_surfxml_route_dst;
 #define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst)
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bw ) AX_surfxml_cluster_bw;
+XBT_PUBLIC_DATA(AT_surfxml_cluster_bw) AX_surfxml_cluster_bw;
 #define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw)
-XBT_PUBLIC_DATA(AT_surfxml_platform_version ) AX_surfxml_platform_version;
+XBT_PUBLIC_DATA(AT_surfxml_platform_version) AX_surfxml_platform_version;
 #define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version)
 
 /* XML application utilities. */
-XBT_PUBLIC(int ) surfxml_element_context(int);
+XBT_PUBLIC(int) surfxml_element_context(int);
 
 /* XML processor entry point. */
-XBT_PUBLIC(int ) yylex(void);
+XBT_PUBLIC(int) yylex(void);
 
 /* Flexml error handling function (useful only when -q flag passed to flexml) */
-const char * surfxml_parse_err_msg(void);
-
-\r
-SG_END_DECL()
+     const char *surfxml_parse_err_msg(void);
 
+\rSG_END_DECL()
 #endif
index 421845e..5a28005 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef _SURF_SURFXML_PARSE_H
 #define _SURF_SURFXML_PARSE_H
 
-#include <stdio.h> /* to have FILE */
+#include <stdio.h>              /* to have FILE */
 #include "surf/simgrid_dtd.h"
 #include "xbt/function_types.h"
 #include "xbt/dict.h"
@@ -17,7 +17,7 @@
 SG_BEGIN_DECL()
 
 /* Hook for the different tags. All the functions which pointer to are push into here are run when the tag is encountered */
-XBT_PUBLIC(xbt_dynar_t) STag_surfxml_platform_cb_list;
+  XBT_PUBLIC(xbt_dynar_t) STag_surfxml_platform_cb_list;
 XBT_PUBLIC(xbt_dynar_t) ETag_surfxml_platform_cb_list;
 XBT_PUBLIC(xbt_dynar_t) STag_surfxml_host_cb_list;
 XBT_PUBLIC(xbt_dynar_t) ETag_surfxml_host_cb_list;
@@ -54,16 +54,16 @@ XBT_PUBLIC(void) surf_parse_open(const char *file);
 XBT_PUBLIC(void) surf_parse_close(void);
 XBT_PUBLIC(void) surf_parse_reset_parser(void);
 XBT_PUBLIC(void) surf_parse_free_callbacks(void);
-XBT_PUBLIC(void) surf_parse_get_double(double *value,const char *string);
-XBT_PUBLIC(void) surf_parse_get_int(int *value,const char *string);
+XBT_PUBLIC(void) surf_parse_get_double(double *value, const char *string);
+XBT_PUBLIC(void) surf_parse_get_int(int *value, const char *string);
 
 /* Prototypes of the functions offered by flex */
 XBT_PUBLIC(int) surf_parse_lex(void);
 XBT_PUBLIC(int) surf_parse_get_lineno(void);
-XBT_PUBLIC(FILE*) surf_parse_get_in(void);
-XBT_PUBLIC(FILE*) surf_parse_get_out(void);
+XBT_PUBLIC(FILE *) surf_parse_get_in(void);
+XBT_PUBLIC(FILE *) surf_parse_get_out(void);
 XBT_PUBLIC(int) surf_parse_get_leng(void);
-XBT_PUBLIC(char*) surf_parse_get_text(void);
+XBT_PUBLIC(char *) surf_parse_get_text(void);
 XBT_PUBLIC(void) surf_parse_set_lineno(int line_number);
 XBT_PUBLIC(void) surf_parse_set_in(FILE * in_str);
 XBT_PUBLIC(void) surf_parse_set_out(FILE * out_str);
@@ -72,7 +72,7 @@ XBT_PUBLIC(void) surf_parse_set_debug(int bdebug);
 XBT_PUBLIC(int) surf_parse_lex_destroy(void);
 
 /* What is needed to bypass the parser. */
-XBT_PUBLIC_DATA(int_f_void_t) surf_parse; /* Entry-point to the parser. Set this to your function. */
+XBT_PUBLIC_DATA(int_f_void_t) surf_parse;       /* Entry-point to the parser. Set this to your function. */
 
 /* Set of macros to make the bypassing work easier.
  * See examples/msg/masterslave_bypass.c for an example of use */
@@ -86,12 +86,11 @@ XBT_PUBLIC_DATA(int_f_void_t) surf_parse; /* Entry-point to the parser. Set this
   memset(surfxml_bufferstack,0,surfxml_bufferstack_size); } while(0)
 
 #define SURFXML_START_TAG(tag)  STag_surfxml_##tag()
-#define SURFXML_END_TAG(tag)  do { ETag_surfxml_##tag(); SURFXML_BUFFER_RESET(); } while(0)     
+#define SURFXML_END_TAG(tag)  do { ETag_surfxml_##tag(); SURFXML_BUFFER_RESET(); } while(0)
 
-XBT_PUBLIC(void) surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function);
+XBT_PUBLIC(void) surfxml_add_callback(xbt_dynar_t cb_list,
+                                      void_f_void_t function);
 
 
 SG_END_DECL()
-
-
 #endif
index 0b719ea..6bcd297 100644 (file)
@@ -12,7 +12,7 @@
 #include "xbt/misc.h"
 #include "xbt/log.h"
 #include "xbt/ex.h"
-  
+
 SG_BEGIN_DECL()
 
 /**
@@ -24,7 +24,6 @@ SG_BEGIN_DECL()
  *
  * @{
  */
-
 #ifdef NDEBUG
 #define xbt_assert(cond)
 #define xbt_assert0(cond,msg)
@@ -53,10 +52,6 @@ SG_BEGIN_DECL()
      /** @hideinitializer  */
 #define xbt_assert6(cond,msg,a,b,c,d,e,f) if (!(cond)) THROW6(0,0,msg,a,b,c,d,e,f)
 #endif
-     
-
-/** @} */     
-  
-SG_END_DECL()
-
+/** @} */
+  SG_END_DECL()
 #endif /* _XBT_ASSERTS_H */
index 05e49eb..a4b1bf1 100644 (file)
@@ -73,7 +73,6 @@ SG_BEGIN_DECL()
  *  \until cfg_free
  * 
  */
-
 /** @defgroup XBT_cfg_use User interface: changing values
  *  @ingroup XBT_config
  *
@@ -89,46 +88,44 @@ SG_BEGIN_DECL()
  *
  * @{
  */
-
   /** @brief Configuration set are only special dynars. But don't rely on it, it may change. */
-  typedef xbt_dynar_t xbt_cfg_t;
+     typedef xbt_dynar_t xbt_cfg_t;
 
-  XBT_PUBLIC(void) xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...);
-  XBT_PUBLIC(void) xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa);
-  XBT_PUBLIC(void) xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options);
+XBT_PUBLIC(void) xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...);
+XBT_PUBLIC(void) xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name,
+                                   va_list pa);
+XBT_PUBLIC(void) xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options);
 
 
 /*
   Set the value of the cell \a name in \a cfg with the provided value.
  */
-XBT_PUBLIC(void) xbt_cfg_set_int   (xbt_cfg_t cfg, const char *name, 
-                       int val);
-XBT_PUBLIC(void) xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, 
-                       double val);
-XBT_PUBLIC(void) xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, 
-                       const char *val);
-XBT_PUBLIC(void) xbt_cfg_set_peer  (xbt_cfg_t cfg, const char *name, 
-                       const char *peer,int port);
+XBT_PUBLIC(void) xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val);
+XBT_PUBLIC(void) xbt_cfg_set_double(xbt_cfg_t cfg, const char *name,
+                                    double val);
+XBT_PUBLIC(void) xbt_cfg_set_string(xbt_cfg_t cfg, const char *name,
+                                    const char *val);
+XBT_PUBLIC(void) xbt_cfg_set_peer(xbt_cfg_t cfg, const char *name,
+                                  const char *peer, int port);
 
 /*
  Remove the provided value from the cell @name in @cfg.
  */
-XBT_PUBLIC(void) xbt_cfg_rm_int   (xbt_cfg_t cfg, const char *name, 
-                      int val);
-XBT_PUBLIC(void) xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, 
-                      double val);
-XBT_PUBLIC(void) xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, 
-                      const char *val);
-XBT_PUBLIC(void) xbt_cfg_rm_peer  (xbt_cfg_t cfg, const char *name, 
-                      const char *peer,int port);
-                                 
+XBT_PUBLIC(void) xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val);
+XBT_PUBLIC(void) xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name,
+                                   double val);
+XBT_PUBLIC(void) xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name,
+                                   const char *val);
+XBT_PUBLIC(void) xbt_cfg_rm_peer(xbt_cfg_t cfg, const char *name,
+                                 const char *peer, int port);
+
 /*
  Remove the value at position \e pos from the config \e cfg
  */
-XBT_PUBLIC(void) xbt_cfg_rm_at   (xbt_cfg_t cfg, const char *name, int pos);
+XBT_PUBLIC(void) xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos);
 
 /* rm every values */
-XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);       
+XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
 
 /* @} */
 
@@ -139,23 +136,27 @@ XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
  */
 
   /** @brief possible content of each configuration cell */
-  typedef enum {
-    xbt_cfgelm_int=0,  /**< int */
-    xbt_cfgelm_double, /**< double */
-    xbt_cfgelm_string, /**< char* */
-    xbt_cfgelm_peer,   /**< both a char* (representing the peername) and an integer (representing the port) */
-    
-    xbt_cfgelm_any,    /* not shown to users to prevent errors */
-    xbt_cfgelm_type_count 
-  } e_xbt_cfgelm_type_t;
-  
+     typedef enum {
+       xbt_cfgelm_int = 0,
+                       /**< int */
+       xbt_cfgelm_double,
+                       /**< double */
+       xbt_cfgelm_string,
+                       /**< char* */
+       xbt_cfgelm_peer,/**< both a char* (representing the peername) and an integer (representing the port) */
+
+       xbt_cfgelm_any,          /* not shown to users to prevent errors */
+       xbt_cfgelm_type_count
+     } e_xbt_cfgelm_type_t;
+
   /** \brief Callback types. They get the name of the modified entry, and the position of the changed value */
-  typedef void (*xbt_cfg_cb_t)(const char*, int);
+     typedef void (*xbt_cfg_cb_t) (const char *, int);
 
-  XBT_PUBLIC(xbt_cfg_t) xbt_cfg_new (void);
-  XBT_PUBLIC(void) xbt_cfg_cpy(xbt_cfg_t tocopy, /* OUT */ xbt_cfg_t *whereto);
-  XBT_PUBLIC(void) xbt_cfg_free(xbt_cfg_t *cfg);
-  XBT_PUBLIC(void) xbt_cfg_dump(const char *name,const char*indent,xbt_cfg_t cfg);
+XBT_PUBLIC(xbt_cfg_t) xbt_cfg_new(void);
+XBT_PUBLIC(void) xbt_cfg_cpy(xbt_cfg_t tocopy, /* OUT */ xbt_cfg_t * whereto);
+XBT_PUBLIC(void) xbt_cfg_free(xbt_cfg_t * cfg);
+XBT_PUBLIC(void) xbt_cfg_dump(const char *name, const char *indent,
+                              xbt_cfg_t cfg);
 
  /** @} */
 
@@ -167,14 +168,15 @@ XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
  *
  *  @{
  */
-  XBT_PUBLIC(void) xbt_cfg_register(xbt_cfg_t cfg,
-                       const char *name, e_xbt_cfgelm_type_t type,
-                       int min, int max,
-                        xbt_cfg_cb_t cb_set, xbt_cfg_cb_t cb_rm);
-  XBT_PUBLIC(void) xbt_cfg_unregister(xbt_cfg_t cfg, const char *name);
-  XBT_PUBLIC(void) xbt_cfg_register_str(xbt_cfg_t cfg, const char *entry);
-  XBT_PUBLIC(void) xbt_cfg_check(xbt_cfg_t cfg);
-  XBT_PUBLIC(e_xbt_cfgelm_type_t) xbt_cfg_get_type(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(void) xbt_cfg_register(xbt_cfg_t cfg,
+                                  const char *name, e_xbt_cfgelm_type_t type,
+                                  int min, int max,
+                                  xbt_cfg_cb_t cb_set, xbt_cfg_cb_t cb_rm);
+XBT_PUBLIC(void) xbt_cfg_unregister(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(void) xbt_cfg_register_str(xbt_cfg_t cfg, const char *entry);
+XBT_PUBLIC(void) xbt_cfg_check(xbt_cfg_t cfg);
+XBT_PUBLIC(e_xbt_cfgelm_type_t) xbt_cfg_get_type(xbt_cfg_t cfg,
+                                                 const char *name);
 /*  @} */
 /** @defgroup XBT_cfg_get Getting the stored values
  *  @ingroup XBT_config
@@ -190,19 +192,22 @@ XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
  *  @{
  */
 
-  XBT_PUBLIC(int)         xbt_cfg_get_int   (xbt_cfg_t cfg, const char *name);
-  XBT_PUBLIC(double)      xbt_cfg_get_double(xbt_cfg_t cfg, const char *name);
-  XBT_PUBLIC(char*)       xbt_cfg_get_string(xbt_cfg_t cfg, const char *name);
-  XBT_PUBLIC(void)        xbt_cfg_get_peer  (xbt_cfg_t cfg, const char *name, char  **peer, int *port);
-  XBT_PUBLIC(xbt_dynar_t) xbt_cfg_get_dynar (xbt_cfg_t cfg, const char *name);
-
-  XBT_PUBLIC(int)    xbt_cfg_get_int_at   (xbt_cfg_t cfg, const char *name, int pos);
-  XBT_PUBLIC(double) xbt_cfg_get_double_at(xbt_cfg_t cfg, const char *name, int pos);
-  XBT_PUBLIC(char*)  xbt_cfg_get_string_at(xbt_cfg_t cfg, const char *name, int pos);
-  XBT_PUBLIC(void)   xbt_cfg_get_peer_at  (xbt_cfg_t cfg, const char *name, int pos, char  **peer, int *port);
+XBT_PUBLIC(int) xbt_cfg_get_int(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(double) xbt_cfg_get_double(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(char *) xbt_cfg_get_string(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(void) xbt_cfg_get_peer(xbt_cfg_t cfg, const char *name,
+                                  char **peer, int *port);
+XBT_PUBLIC(xbt_dynar_t) xbt_cfg_get_dynar(xbt_cfg_t cfg, const char *name);
+
+XBT_PUBLIC(int) xbt_cfg_get_int_at(xbt_cfg_t cfg, const char *name, int pos);
+XBT_PUBLIC(double) xbt_cfg_get_double_at(xbt_cfg_t cfg, const char *name,
+                                         int pos);
+XBT_PUBLIC(char *) xbt_cfg_get_string_at(xbt_cfg_t cfg, const char *name,
+                                         int pos);
+XBT_PUBLIC(void) xbt_cfg_get_peer_at(xbt_cfg_t cfg, const char *name, int pos,
+                                     char **peer, int *port);
 
 /** @} */
 
 SG_END_DECL()
-  
 #endif /* _XBT_CONFIG_H_ */
index ec4c43a..5bfe398 100644 (file)
 #ifndef _XBT_CUNIT_H_
 #define _XBT_CUNIT_H_
 
-#include "xbt/sysdep.h"    /* XBT_GNU_PRINTF */
+#include "xbt/sysdep.h"         /* XBT_GNU_PRINTF */
 #include "xbt/ex.h"
 
 SG_BEGIN_DECL()
 
 /* test suite object type */
-typedef struct s_xbt_test_suite *xbt_test_suite_t;
+     typedef struct s_xbt_test_suite *xbt_test_suite_t;
 
 /* test object type */
-typedef struct s_xbt_test_unit *xbt_test_unit_t;
+     typedef struct s_xbt_test_unit *xbt_test_unit_t;
 
 /* test callback function type */
-typedef void (*ts_test_cb_t)(void);
+     typedef void (*ts_test_cb_t) (void);
 
 /* test suite operations */
-XBT_PUBLIC(xbt_test_suite_t) xbt_test_suite_new  (const char *name,const char *fmt, ...);
-XBT_PUBLIC(xbt_test_suite_t) xbt_test_suite_by_name(const char *name,const char *fmt, ...);
-XBT_PUBLIC(void)             xbt_test_suite_dump (xbt_test_suite_t suite);
-XBT_PUBLIC(void)             xbt_test_suite_push (xbt_test_suite_t suite, const char *name,
-                                                 ts_test_cb_t func, const char *fmt, ...);
+XBT_PUBLIC(xbt_test_suite_t) xbt_test_suite_new(const char *name,
+                                                const char *fmt, ...);
+XBT_PUBLIC(xbt_test_suite_t) xbt_test_suite_by_name(const char *name,
+                                                    const char *fmt, ...);
+XBT_PUBLIC(void) xbt_test_suite_dump(xbt_test_suite_t suite);
+XBT_PUBLIC(void) xbt_test_suite_push(xbt_test_suite_t suite, const char *name,
+                                     ts_test_cb_t func, const char *fmt, ...);
 
 /* Run all the specified tests. what_to_do allows to disable some tests.
  * It is a coma (,) separated list of directives. They are applied from left to right.
@@ -56,7 +58,8 @@ XBT_PUBLIC(void) xbt_test_dump(char *selection);
 XBT_PUBLIC(void) xbt_test_exit(void);
 
 /* test operations */
-XBT_PUBLIC(void)    _xbt_test_add(const char*file,int line, const char *fmt, ...)_XBT_GNUC_PRINTF(3,4);
+XBT_PUBLIC(void) _xbt_test_add(const char *file, int line, const char *fmt,
+                               ...) _XBT_GNUC_PRINTF(3, 4);
 #define xbt_test_add0(fmt)           _xbt_test_add(__FILE__,__LINE__,fmt)
 #define xbt_test_add1(fmt,a)         _xbt_test_add(__FILE__,__LINE__,fmt,a)
 #define xbt_test_add2(fmt,a,b)       _xbt_test_add(__FILE__,__LINE__,fmt,a,b)
@@ -64,7 +67,8 @@ XBT_PUBLIC(void)    _xbt_test_add(const char*file,int line, const char *fmt, ...
 #define xbt_test_add4(fmt,a,b,c,d)   _xbt_test_add(__FILE__,__LINE__,fmt,a,b,c,d)
 #define xbt_test_add5(fmt,a,b,c,d,e) _xbt_test_add(__FILE__,__LINE__,fmt,a,b,c,d,e)
 
-XBT_PUBLIC(void)    _xbt_test_fail(const char*file,int line, const char *fmt, ...) _XBT_GNUC_PRINTF(3,4);
+XBT_PUBLIC(void) _xbt_test_fail(const char *file, int line, const char *fmt,
+                                ...) _XBT_GNUC_PRINTF(3, 4);
 #define xbt_test_fail0(fmt)           _xbt_test_fail(__FILE__, __LINE__, fmt)
 #define xbt_test_fail1(fmt,a)         _xbt_test_fail(__FILE__, __LINE__, fmt,a)
 #define xbt_test_fail2(fmt,a,b)       _xbt_test_fail(__FILE__, __LINE__, fmt,a,b)
@@ -80,7 +84,8 @@ XBT_PUBLIC(void)    _xbt_test_fail(const char*file,int line, const char *fmt, ..
 #define xbt_test_assert5(cond,fmt,a,b,c,d,e) if(!(cond)) xbt_test_fail5(fmt,a,b,c,d,e)
 #define xbt_test_assert(cond)                xbt_test_assert0(cond,#cond)
 
-XBT_PUBLIC(void)    _xbt_test_log (const char*file,int line, const char *fmt, ...)_XBT_GNUC_PRINTF(3,4);
+XBT_PUBLIC(void) _xbt_test_log(const char *file, int line, const char *fmt,
+                               ...) _XBT_GNUC_PRINTF(3, 4);
 #define xbt_test_log0(fmt)           _xbt_test_log(__FILE__, __LINE__, fmt)
 #define xbt_test_log1(fmt,a)         _xbt_test_log(__FILE__, __LINE__, fmt,a)
 #define xbt_test_log2(fmt,a,b)       _xbt_test_log(__FILE__, __LINE__, fmt,a,b)
@@ -97,8 +102,6 @@ XBT_PUBLIC(void) xbt_test_skip(void);
 #define XBT_TEST_UNIT(name,func,title)    \
     void func(void);  /*prototype*/       \
     void func(void)
-    
-SG_END_DECL() 
 
+SG_END_DECL()
 #endif /* _TS_H_ */
-
index 03162e7..980cca0 100644 (file)
@@ -11,8 +11,8 @@
 #ifndef _XBT_DICT_H
 #define _XBT_DICT_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
-#include "xbt/dynar.h" /* void_f_pvoid_t */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
+#include "xbt/dynar.h"          /* void_f_pvoid_t */
 
 SG_BEGIN_DECL();
 
@@ -43,10 +43,10 @@ SG_BEGIN_DECL();
  */
 
   /** \brief Dictionary data type (opaque structure) */
-  typedef struct xbt_dict_ *xbt_dict_t;
-  XBT_PUBLIC(xbt_dict_t) xbt_dict_new(void);
-  XBT_PUBLIC(void) xbt_dict_free(xbt_dict_t *dict);
-  XBT_PUBLIC(unsigned int) xbt_dict_size(xbt_dict_t dict);
+typedef struct xbt_dict_ *xbt_dict_t;
+XBT_PUBLIC(xbt_dict_t) xbt_dict_new(void);
+XBT_PUBLIC(void) xbt_dict_free(xbt_dict_t * dict);
+XBT_PUBLIC(unsigned int) xbt_dict_size(xbt_dict_t dict);
 
 /** @} */
 /** @defgroup XBT_dict_basic Dictionaries basic usage
@@ -57,16 +57,17 @@ SG_BEGIN_DECL();
  *  @{
  */
 
-  XBT_PUBLIC(void)  xbt_dict_set(xbt_dict_t dict, const char *key, void *data, void_f_pvoid_t free_ctn);
-  XBT_PUBLIC(void*) xbt_dict_get(xbt_dict_t dict,const char *key);
-  XBT_PUBLIC(void*) xbt_dict_get_or_null(xbt_dict_t dict, const char *key);
+XBT_PUBLIC(void) xbt_dict_set(xbt_dict_t dict, const char *key, void *data,
+                              void_f_pvoid_t free_ctn);
+XBT_PUBLIC(void *) xbt_dict_get(xbt_dict_t dict, const char *key);
+XBT_PUBLIC(void *) xbt_dict_get_or_null(xbt_dict_t dict, const char *key);
 
-  XBT_PUBLIC(void) xbt_dict_remove(xbt_dict_t dict, const char *key);
-  XBT_PUBLIC(void) xbt_dict_reset(xbt_dict_t dict);
-  XBT_PUBLIC(int) xbt_dict_length(xbt_dict_t dict);
-  XBT_PUBLIC(void) xbt_dict_dump_output_string(void *s);
-  XBT_PUBLIC(void) xbt_dict_dump(xbt_dict_t dict, void (*output)(void*));
-  XBT_PUBLIC(void) xbt_dict_dump_sizes(xbt_dict_t dict);
+XBT_PUBLIC(void) xbt_dict_remove(xbt_dict_t dict, const char *key);
+XBT_PUBLIC(void) xbt_dict_reset(xbt_dict_t dict);
+XBT_PUBLIC(int) xbt_dict_length(xbt_dict_t dict);
+XBT_PUBLIC(void) xbt_dict_dump_output_string(void *s);
+XBT_PUBLIC(void) xbt_dict_dump(xbt_dict_t dict, void (*output) (void *));
+XBT_PUBLIC(void) xbt_dict_dump_sizes(xbt_dict_t dict);
 
 
 /** @} */
@@ -77,13 +78,15 @@ SG_BEGIN_DECL();
  *
  *  @{
  */
-  XBT_PUBLIC(void)  xbt_dict_set_ext(xbt_dict_t     dict,
-                        const char     *key, int  key_len,
-                        void           *data,
-                        void_f_pvoid_t free_ctn);
-  XBT_PUBLIC(void*) xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len);
-  XBT_PUBLIC(void*) xbt_dict_get_or_null_ext(xbt_dict_t dict, const char *key, int key_len);
-  XBT_PUBLIC(void)  xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len);
+XBT_PUBLIC(void) xbt_dict_set_ext(xbt_dict_t dict,
+                                  const char *key, int key_len,
+                                  void *data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC(void *) xbt_dict_get_ext(xbt_dict_t dict, const char *key,
+                                    int key_len);
+XBT_PUBLIC(void *) xbt_dict_get_or_null_ext(xbt_dict_t dict, const char *key,
+                                            int key_len);
+XBT_PUBLIC(void) xbt_dict_remove_ext(xbt_dict_t dict, const char *key,
+                                     int key_len);
 
 
 /** @} */
@@ -109,22 +112,21 @@ SG_BEGIN_DECL();
  *  @{ */
 
   /** @brief Cursor on dictionaries (opaque type) */
-  typedef struct xbt_dict_cursor_ *xbt_dict_cursor_t;
-  XBT_PUBLIC(xbt_dict_cursor_t) xbt_dict_cursor_new(const xbt_dict_t dict);
-  XBT_PUBLIC(void)               xbt_dict_cursor_free(xbt_dict_cursor_t *cursor);
+     typedef struct xbt_dict_cursor_ *xbt_dict_cursor_t;
+XBT_PUBLIC(xbt_dict_cursor_t) xbt_dict_cursor_new(const xbt_dict_t dict);
+XBT_PUBLIC(void) xbt_dict_cursor_free(xbt_dict_cursor_t * cursor);
 
-  XBT_PUBLIC(void) xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
+XBT_PUBLIC(void) xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
 
 
-  XBT_PUBLIC(char *) xbt_dict_cursor_get_key     (xbt_dict_cursor_t cursor);
-  XBT_PUBLIC(void *) xbt_dict_cursor_get_data    (xbt_dict_cursor_t cursor);
+XBT_PUBLIC(char *) xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor);
+XBT_PUBLIC(void *) xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor);
 
-  XBT_PUBLIC(void) xbt_dict_cursor_first (const xbt_dict_t   dict,
-                            xbt_dict_cursor_t *cursor);
-  XBT_PUBLIC(void)         xbt_dict_cursor_step        (xbt_dict_cursor_t  cursor);
-  XBT_PUBLIC(int)          xbt_dict_cursor_get_or_free (xbt_dict_cursor_t *cursor,
-                                           char              **key,
-                                           void              **data);
+XBT_PUBLIC(void) xbt_dict_cursor_first(const xbt_dict_t dict,
+                                       xbt_dict_cursor_t * cursor);
+XBT_PUBLIC(void) xbt_dict_cursor_step(xbt_dict_cursor_t cursor);
+XBT_PUBLIC(int) xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor,
+                                            char **key, void **data);
   /** @def xbt_dict_foreach
       @hideinitializer */
 #  define xbt_dict_foreach(dict,cursor,key,data)                       \
@@ -155,24 +157,24 @@ XBT_PUBLIC(void) xbt_dict_prints(void *data);
 /*----[ xbt_multidict_set ]--------------------------------------------------*/
 XBT_PUBLIC(void)
 xbt_multidict_set(xbt_dict_t mdict,
-                  xbt_dynar_t keys,
-                  void *data,void (*free_ctn)(void*));
+                  xbt_dynar_t keys, void *data, void (*free_ctn) (void *));
 XBT_PUBLIC(void)
 xbt_multidict_set_ext(xbt_dict_t mdict,
                       xbt_dynar_t keys, xbt_dynar_t lens,
-                      void *data,void_f_pvoid_t free_ctn);
+                      void *data, void_f_pvoid_t free_ctn);
 
 /*----[ xbt_multidict_get ]--------------------------------------------------*/
-XBT_PUBLIC(void*) xbt_multidict_get    (xbt_dict_t mdict, xbt_dynar_t keys);
-XBT_PUBLIC(void*) xbt_multidict_get_ext(xbt_dict_t mdict, xbt_dynar_t keys, xbt_dynar_t lens);
+XBT_PUBLIC(void *) xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys);
+XBT_PUBLIC(void *) xbt_multidict_get_ext(xbt_dict_t mdict, xbt_dynar_t keys,
+                                         xbt_dynar_t lens);
 
 /*----[ xbt_multidict_remove ]-----------------------------------------------*/
 /*---------------------------------------------------------------------------*/
 XBT_PUBLIC(void) xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys);
-XBT_PUBLIC(void) xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, xbt_dynar_t lens);
+XBT_PUBLIC(void) xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys,
+                                          xbt_dynar_t lens);
 
 /** @} */
 
 SG_END_DECL()
-
 #endif /* _XBT_DICT_H */
index 6eb3ab5..6d7b090 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef _XBT_DYNAR_H
 #define _XBT_DYNAR_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/function_types.h"
 
 SG_BEGIN_DECL()
@@ -52,29 +52,28 @@ SG_BEGIN_DECL()
   * \until }
   *
   */
-
 /** @defgroup XBT_dynar_cons Dynar constructor and destructor
  *  @ingroup XBT_dynar
  *
  *  @{
  */
    /** \brief Dynar data type (opaque type) */
-   typedef struct xbt_dynar_s *xbt_dynar_t;
+     typedef struct xbt_dynar_s *xbt_dynar_t;
 
 
-  XBT_PUBLIC(xbt_dynar_t)   xbt_dynar_new(const unsigned long elm_size, 
-                                         void_f_pvoid_t const free_f);
-  XBT_PUBLIC(xbt_dynar_t)   xbt_dynar_new_sync(const unsigned long elm_size, 
-                                              void_f_pvoid_t const free_f);
-  XBT_PUBLIC(void)          xbt_dynar_free(xbt_dynar_t *dynar);
-  XBT_PUBLIC(void)          xbt_dynar_free_voidp(void *dynar);
-  XBT_PUBLIC(void)          xbt_dynar_free_container(xbt_dynar_t *dynar);
+XBT_PUBLIC(xbt_dynar_t) xbt_dynar_new(const unsigned long elm_size,
+                                      void_f_pvoid_t const free_f);
+XBT_PUBLIC(xbt_dynar_t) xbt_dynar_new_sync(const unsigned long elm_size,
+                                           void_f_pvoid_t const free_f);
+XBT_PUBLIC(void) xbt_dynar_free(xbt_dynar_t * dynar);
+XBT_PUBLIC(void) xbt_dynar_free_voidp(void *dynar);
+XBT_PUBLIC(void) xbt_dynar_free_container(xbt_dynar_t * dynar);
 
-  XBT_PUBLIC(unsigned long) xbt_dynar_length(const xbt_dynar_t dynar);
-  XBT_PUBLIC(void)          xbt_dynar_reset(xbt_dynar_t const dynar);
-  XBT_PUBLIC(void)          xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots);
+XBT_PUBLIC(unsigned long) xbt_dynar_length(const xbt_dynar_t dynar);
+XBT_PUBLIC(void) xbt_dynar_reset(xbt_dynar_t const dynar);
+XBT_PUBLIC(void) xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots);
 
-  XBT_PUBLIC(void)          xbt_dynar_dump(xbt_dynar_t dynar);
+XBT_PUBLIC(void) xbt_dynar_dump(xbt_dynar_t dynar);
 
 /** @} */
 /** @defgroup XBT_dynar_array Dynar as a regular array
@@ -83,16 +82,21 @@ SG_BEGIN_DECL()
  *  @{
  */
 
-  XBT_PUBLIC(void) xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void * const dst);
-  
-  XBT_PUBLIC(void) xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void *src);
-  XBT_PUBLIC(void) xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void *object);
+XBT_PUBLIC(void) xbt_dynar_get_cpy(const xbt_dynar_t dynar,
+                                   const unsigned long idx, void *const dst);
+
+XBT_PUBLIC(void) xbt_dynar_set(xbt_dynar_t dynar, const int idx,
+                               const void *src);
+XBT_PUBLIC(void) xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx,
+                                   const void *object);
 
-  XBT_PUBLIC(void) xbt_dynar_insert_at(xbt_dynar_t  const dynar, const int  idx, const void *src);
-  XBT_PUBLIC(void) xbt_dynar_remove_at(xbt_dynar_t  const dynar, const int  idx, void * const dst);
+XBT_PUBLIC(void) xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx,
+                                     const void *src);
+XBT_PUBLIC(void) xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx,
+                                     void *const dst);
 
-  XBT_PUBLIC(int)  xbt_dynar_search(xbt_dynar_t  const dynar, void *elem);
-  XBT_PUBLIC(int)  xbt_dynar_member(xbt_dynar_t  const dynar, void *elem);
+XBT_PUBLIC(int) xbt_dynar_search(xbt_dynar_t const dynar, void *elem);
+XBT_PUBLIC(int) xbt_dynar_member(xbt_dynar_t const dynar, void *elem);
 /** @} */
 /** @defgroup XBT_dynar_perl Perl-like use of dynars
  *  @ingroup XBT_dynar
@@ -100,11 +104,12 @@ SG_BEGIN_DECL()
  *  @{
  */
 
-  XBT_PUBLIC(void) xbt_dynar_push    (xbt_dynar_t  const dynar, const void *src);
-  XBT_PUBLIC(void) xbt_dynar_pop     (xbt_dynar_t  const dynar, void *const dst);
-  XBT_PUBLIC(void) xbt_dynar_unshift (xbt_dynar_t  const dynar, const void *src);
-  XBT_PUBLIC(void) xbt_dynar_shift   (xbt_dynar_t  const dynar, void *const dst);
-  XBT_PUBLIC(void) xbt_dynar_map     (const xbt_dynar_t dynar, void_f_pvoid_t const op);
+XBT_PUBLIC(void) xbt_dynar_push(xbt_dynar_t const dynar, const void *src);
+XBT_PUBLIC(void) xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst);
+XBT_PUBLIC(void) xbt_dynar_unshift(xbt_dynar_t const dynar, const void *src);
+XBT_PUBLIC(void) xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst);
+XBT_PUBLIC(void) xbt_dynar_map(const xbt_dynar_t dynar,
+                               void_f_pvoid_t const op);
 
 /** @} */
 /** @defgroup XBT_dynar_ctn Direct manipulation to the dynars content
@@ -115,10 +120,12 @@ SG_BEGIN_DECL()
  *  @{
  */
 
-  XBT_PUBLIC(void*) xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx);
-  XBT_PUBLIC(void*) xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx);
-  XBT_PUBLIC(void*) xbt_dynar_push_ptr(xbt_dynar_t  const dynar);
-  XBT_PUBLIC(void*) xbt_dynar_pop_ptr(xbt_dynar_t  const dynar);
+XBT_PUBLIC(void *) xbt_dynar_get_ptr(const xbt_dynar_t dynar,
+                                     const unsigned long idx);
+XBT_PUBLIC(void *) xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
+                                           const int idx);
+XBT_PUBLIC(void *) xbt_dynar_push_ptr(xbt_dynar_t const dynar);
+XBT_PUBLIC(void *) xbt_dynar_pop_ptr(xbt_dynar_t const dynar);
 
 /** @} */
 /** @defgroup XBT_dynar_speed Speed optimized access to dynars of scalars
@@ -174,13 +181,16 @@ SG_BEGIN_DECL()
  *  @{
  */
 
-  XBT_PUBLIC(void) _xbt_dynar_cursor_first (const xbt_dynar_t dynar, unsigned int * const cursor);
-  XBT_PUBLIC(void) _xbt_dynar_cursor_step  (const xbt_dynar_t dynar, unsigned int * const cursor);
-  XBT_PUBLIC(int)  _xbt_dynar_cursor_get   (const xbt_dynar_t dynar, unsigned int * const cursor, 
-                                           void *whereto);
-  XBT_PUBLIC(void) xbt_dynar_cursor_rm(xbt_dynar_t dynar,
-                                      unsigned int *const cursor);
-  XBT_PUBLIC(void) xbt_dynar_cursor_unlock(xbt_dynar_t dynar);
+XBT_PUBLIC(void) _xbt_dynar_cursor_first(const xbt_dynar_t dynar,
+                                         unsigned int *const cursor);
+XBT_PUBLIC(void) _xbt_dynar_cursor_step(const xbt_dynar_t dynar,
+                                        unsigned int *const cursor);
+XBT_PUBLIC(int) _xbt_dynar_cursor_get(const xbt_dynar_t dynar,
+                                      unsigned int *const cursor,
+                                      void *whereto);
+XBT_PUBLIC(void) xbt_dynar_cursor_rm(xbt_dynar_t dynar,
+                                     unsigned int *const cursor);
+XBT_PUBLIC(void) xbt_dynar_cursor_unlock(xbt_dynar_t dynar);
 
 /** @brief Iterates over the whole dynar. 
  * 
@@ -207,5 +217,4 @@ xbt_dynar_foreach (dyn,cpt,str) {
 /** @} */
 
 SG_END_DECL()
-
 #endif /* _XBT_DYNAR_H */
index e3a8d14..a688f0d 100644 (file)
 /*-*-* end of debugging stuff *-*-*/
 
 #if defined(__EX_MCTX_MCSC__)
-#include <ucontext.h>            /* POSIX.1 ucontext(3) */
+#include <ucontext.h>           /* POSIX.1 ucontext(3) */
 #define __ex_mctx_struct         ucontext_t uc;
 #define __ex_mctx_save(mctx)     (getcontext(&(mctx)->uc) == 0)
-#define __ex_mctx_restored(mctx) /* noop */
+#define __ex_mctx_restored(mctx)        /* noop */
 #define __ex_mctx_restore(mctx)  (void)setcontext(&(mctx)->uc)
 
 #elif defined(__EX_MCTX_SSJLJ__)
-#include <setjmp.h>              /* POSIX.1 sigjmp_buf(3) */
+#include <setjmp.h>             /* POSIX.1 sigjmp_buf(3) */
 #define __ex_mctx_struct         sigjmp_buf jb;
 #define __ex_mctx_save(mctx)     (sigsetjmp((mctx)->jb, 1) == 0)
-#define __ex_mctx_restored(mctx) /* noop */
+#define __ex_mctx_restored(mctx)        /* noop */
 #define __ex_mctx_restore(mctx)  (void)siglongjmp((mctx)->jb, 1)
 
 #elif defined(__EX_MCTX_SJLJ__) || !defined(__EX_MCTX_CUSTOM__) || defined(__EX_MAYDAY)
-#include <setjmp.h>              /* ISO-C jmp_buf(3) */
+#include <setjmp.h>             /* ISO-C jmp_buf(3) */
 #define __ex_mctx_struct         jmp_buf jb;
 #define __ex_mctx_save(mctx)     ( MAYDAY_SAVE(mctx) setjmp((mctx)->jb) == 0)
-#define __ex_mctx_restored(mctx) /* noop */
+#define __ex_mctx_restored(mctx)        /* noop */
 #define __ex_mctx_restore(mctx)  ( MAYDAY_RESTORE(mctx) (void)longjmp((mctx)->jb, 1))
 #endif
 
 /* declare the machine context type */
-typedef struct { __ex_mctx_struct } __ex_mctx_t;
+typedef struct {
+__ex_mctx_struct} __ex_mctx_t;
 
 /** @addtogroup XBT_ex
  *  @brief A set of macros providing exception a la C++ in ANSI C (grounding feature)
@@ -225,47 +226,50 @@ typedef struct { __ex_mctx_struct } __ex_mctx_t;
 
 /** @brief different kind of errors */
 typedef enum {
-  unknown_error=0,  /**< unknown error */
+  unknown_error = 0,/**< unknown error */
   arg_error,        /**< Invalid argument */
   bound_error,      /**< Out of bounds argument */
   mismatch_error,   /**< The provided ID does not match */
   not_found_error,  /**< The searched element was not found */
-  
+
   system_error,   /**< a syscall did fail */
   network_error,  /**< error while sending/receiving data */
   timeout_error,  /**< not quick enough, dude */
   thread_error,    /**< error while [un]locking */
-       host_error                      /**< host failed */
+  host_error                            /**< host failed */
 } xbt_errcat_t;
 
 XBT_PUBLIC(const char *) xbt_ex_catname(xbt_errcat_t cat);
 
 /** @brief Structure describing an exception */
-typedef struct {
-  char        *msg;      /**< human readable message */
-  xbt_errcat_t category; /**< category like HTTP (what went wrong) */
-  int          value;    /**< like errno (why did it went wrong) */
-  /* throw point */
-  short int remote; /**< whether it was raised remotely */
-  char *host;     /**< NULL locally thrown exceptions; full hostname if remote ones */
-  /* FIXME: host should be hostname:port[#thread] */
-  char *procname; /**< Name of the process who thrown this */
-  int pid;        /**< PID of the process who thrown this */
-  char *file;     /**< Thrown point */
-  int   line;     /**< Thrown point */
-  char *func;     /**< Thrown point */
-  /* Backtrace */
-  int   used;
-  char **bt_strings; /* only filed on display (or before the network propagation) */
-  void *bt[XBT_BACKTRACE_SIZE];
-} xbt_ex_t;
+     typedef struct {
+       char *msg;        /**< human readable message */
+       xbt_errcat_t category;
+                         /**< category like HTTP (what went wrong) */
+       int value;        /**< like errno (why did it went wrong) */
+       /* throw point */
+       short int remote;
+                    /**< whether it was raised remotely */
+       char *host;/**< NULL locally thrown exceptions; full hostname if remote ones */
+       /* FIXME: host should be hostname:port[#thread] */
+       char *procname;
+                  /**< Name of the process who thrown this */
+       int pid;   /**< PID of the process who thrown this */
+       char *file;/**< Thrown point */
+       int line;  /**< Thrown point */
+       char *func;/**< Thrown point */
+       /* Backtrace */
+       int used;
+       char **bt_strings;       /* only filed on display (or before the network propagation) */
+       void *bt[XBT_BACKTRACE_SIZE];
+     } xbt_ex_t;
 
 /* declare the context type (private) */
-typedef struct {
-    __ex_mctx_t  *ctx_mctx;     /* permanent machine context of enclosing try/catch */
-    volatile int ctx_caught;    /* temporary flag whether exception was caught */
-    volatile xbt_ex_t ctx_ex;   /* temporary exception storage */
-} ex_ctx_t;
+     typedef struct {
+       __ex_mctx_t *ctx_mctx;   /* permanent machine context of enclosing try/catch */
+       volatile int ctx_caught; /* temporary flag whether exception was caught */
+       volatile xbt_ex_t ctx_ex;        /* temporary exception storage */
+     } ex_ctx_t;
 
 /* the static and dynamic initializers for a context structure */
 #define XBT_CTX_INITIALIZER \
@@ -301,14 +305,14 @@ typedef struct {
     } while (0)
 
 /* the exception context */
-typedef ex_ctx_t *(*ex_ctx_cb_t)(void);
+     typedef ex_ctx_t *(*ex_ctx_cb_t) (void);
 XBT_PUBLIC_DATA(ex_ctx_cb_t) __xbt_ex_ctx;
-extern ex_ctx_t *__xbt_ex_ctx_default(void);
+     extern ex_ctx_t *__xbt_ex_ctx_default(void);
 
 /* the termination handler */
-typedef void (*ex_term_cb_t)(xbt_ex_t *);
+     typedef void (*ex_term_cb_t) (xbt_ex_t *);
 XBT_PUBLIC_DATA(ex_term_cb_t) __xbt_ex_terminate;
-extern void __xbt_ex_terminate_default(xbt_ex_t *e);
+     extern void __xbt_ex_terminate_default(xbt_ex_t * e);
 
 /** @brief Introduce a block where exception may be dealed with 
  *  @hideinitializer
@@ -344,7 +348,7 @@ extern void __xbt_ex_terminate_default(xbt_ex_t *e);
 #  ifdef __cplusplus
 #    define XBT_EX_T_CPLUSPLUSCAST (xbt_ex_t&)
 #  else
-#    define XBT_EX_T_CPLUSPLUSCAST 
+#    define XBT_EX_T_CPLUSPLUSCAST
 #  endif
 #endif
 
@@ -375,7 +379,7 @@ extern void __xbt_ex_terminate_default(xbt_ex_t *e);
        __xbt_ex_terminate((xbt_ex_t *)&(e)); /* not catched */\
      else                                                                      \
        __ex_mctx_restore(__xbt_ex_ctx()->ctx_mctx); /* catched somewhere */    \
-     abort()/* nope, stupid GCC, we won't survive a THROW (this won't be reached) */
+     abort()                    /* nope, stupid GCC, we won't survive a THROW (this won't be reached) */
 
 /** @brief Helper macro for THROWS0-6
  *  @hideinitializer
@@ -505,10 +509,9 @@ XBT_PUBLIC(void) xbt_ex_free(xbt_ex_t e);
 /** @brief Shows a backtrace of the current location */
 XBT_PUBLIC(void) xbt_backtrace_display_current(void);
 /** @brief Captures a backtrace for further use */
-XBT_PUBLIC(void) xbt_backtrace_current(xbt_ex_t *e);
+XBT_PUBLIC(void) xbt_backtrace_current(xbt_ex_t * e);
 /** @brief Display a previously captured backtrace */
-XBT_PUBLIC(void) xbt_backtrace_display(xbt_ex_t *e);
+XBT_PUBLIC(void) xbt_backtrace_display(xbt_ex_t * e);
 
 /** @} */
 #endif /* __XBT_EX_H__ */
index b325512..5f8bac9 100644 (file)
@@ -7,7 +7,7 @@
 
 #ifndef _XBT_FIFO_H
 #define _XBT_FIFO_H
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 
 SG_BEGIN_DECL()
 
@@ -17,20 +17,18 @@ SG_BEGIN_DECL()
  * These functions provide the same kind of functionnality as dynamic arrays but in time O(1).
  * However these functions use malloc/free way too much often.            
  */
-
 /** @defgroup XBT_fifo_cons Fifo constructor and destructor
  *  @ingroup XBT_fifo
  *
  *  @{
  */
-
 /** \brief  Bucket structure 
 */
-typedef struct xbt_fifo_item *xbt_fifo_item_t;
+     typedef struct xbt_fifo_item *xbt_fifo_item_t;
 
 /** \brief  FIFO structure
 */
-typedef struct xbt_fifo *xbt_fifo_t;
+     typedef struct xbt_fifo *xbt_fifo_t;
 
 XBT_PUBLIC(xbt_fifo_t) xbt_fifo_new(void);
 XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t);
@@ -42,9 +40,9 @@ XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t);
  *  @{
  */
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_push(xbt_fifo_t, void *);
-XBT_PUBLIC(void*) xbt_fifo_pop(xbt_fifo_t);
+XBT_PUBLIC(void *) xbt_fifo_pop(xbt_fifo_t);
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_unshift(xbt_fifo_t, void *);
-XBT_PUBLIC(void*) xbt_fifo_shift(xbt_fifo_t);
+XBT_PUBLIC(void *) xbt_fifo_shift(xbt_fifo_t);
 XBT_PUBLIC(int) xbt_fifo_size(xbt_fifo_t);
 XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t, void *);
 /** @} */
@@ -57,7 +55,7 @@ XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t, void *);
 
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_new_item(void);
 XBT_PUBLIC(void) xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
-XBT_PUBLIC(void*) xbt_fifo_get_item_content(xbt_fifo_item_t);
+XBT_PUBLIC(void *) xbt_fifo_get_item_content(xbt_fifo_item_t);
 XBT_PUBLIC(void) xbt_fifo_free_item(xbt_fifo_item_t);
 
 XBT_PUBLIC(void) xbt_fifo_push_item(xbt_fifo_t, xbt_fifo_item_t);
@@ -96,7 +94,7 @@ XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_prev_item(xbt_fifo_item_t i);
  *
  *  @{
  */
-XBT_PUBLIC(void**) xbt_fifo_to_array(xbt_fifo_t);
+XBT_PUBLIC(void **) xbt_fifo_to_array(xbt_fifo_t);
 XBT_PUBLIC(xbt_fifo_t) xbt_fifo_copy(xbt_fifo_t);
 /** @} */
 
@@ -110,6 +108,4 @@ XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getPrevItem(xbt_fifo_item_t i);
 
 
 SG_END_DECL()
-
-
-#endif                         /* _XBT_FIFO_H */
+#endif /* _XBT_FIFO_H */
index a5044bd..305d10a 100644 (file)
 
 SG_BEGIN_DECL()
 
-   typedef void  (*void_f_ppvoid_t)(void**);
-   typedef void  (*void_f_pvoid_t) (void*);
-   typedef void* (*pvoid_f_void_t)(void);
-   typedef void* (*pvoid_f_pvoid_t)(void*);
-   typedef void  (*void_f_void_t) (void);
+     typedef void (*void_f_ppvoid_t) (void **);
+     typedef void (*void_f_pvoid_t) (void *);
+     typedef void *(*pvoid_f_void_t) (void);
+     typedef void *(*pvoid_f_pvoid_t) (void *);
+     typedef void (*void_f_void_t) (void);
 
-   typedef int   (*int_f_void_t)   (void);
+     typedef int (*int_f_void_t) (void);
 
-   typedef int  (*int_f_pvoid_pvoid_t) (void*,void*);
+     typedef int (*int_f_pvoid_pvoid_t) (void *, void *);
 
-   typedef int  (*xbt_main_func_t)(int argc, char *argv[]);
+     typedef int (*xbt_main_func_t) (int argc, char *argv[]);
 
 SG_END_DECL()
-
 #endif /* XBT_FUNCTION_TYPE_H */
index 399bc21..27ee96d 100644 (file)
@@ -8,7 +8,7 @@
 
 #ifndef _XBT_GRAPH_H
 #define _XBT_GRAPH_H
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/dynar.h"
 SG_BEGIN_DECL()
 
@@ -17,35 +17,37 @@ SG_BEGIN_DECL()
    * 
    * @{
    */
-
-typedef struct xbt_node  *xbt_node_t;
-typedef struct xbt_edge  *xbt_edge_t;
-typedef struct xbt_graph *xbt_graph_t;
+     typedef struct xbt_node *xbt_node_t;
+     typedef struct xbt_edge *xbt_edge_t;
+     typedef struct xbt_graph *xbt_graph_t;
 
 /* API */
-XBT_PUBLIC(xbt_graph_t) xbt_graph_new_graph(unsigned short int directed, void *data);
+XBT_PUBLIC(xbt_graph_t) xbt_graph_new_graph(unsigned short int directed,
+                                            void *data);
 XBT_PUBLIC(xbt_node_t) xbt_graph_new_node(xbt_graph_t g, void *data);
-XBT_PUBLIC(xbt_edge_t) xbt_graph_new_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst, 
-                             void *data);
-XBT_PUBLIC(void*) xbt_graph_node_get_data(xbt_node_t node);
-XBT_PUBLIC(void)  xbt_graph_node_set_data(xbt_node_t node, void *data);
-XBT_PUBLIC(void*) xbt_graph_edge_get_data(xbt_edge_t edge);
-XBT_PUBLIC(void)  xbt_graph_edge_set_data(xbt_edge_t edge, void *data);
+XBT_PUBLIC(xbt_edge_t) xbt_graph_new_edge(xbt_graph_t g, xbt_node_t src,
+                                          xbt_node_t dst, void *data);
+XBT_PUBLIC(void *) xbt_graph_node_get_data(xbt_node_t node);
+XBT_PUBLIC(void) xbt_graph_node_set_data(xbt_node_t node, void *data);
+XBT_PUBLIC(void *) xbt_graph_edge_get_data(xbt_edge_t edge);
+XBT_PUBLIC(void) xbt_graph_edge_set_data(xbt_edge_t edge, void *data);
 
-XBT_PUBLIC(xbt_edge_t) xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst);
+XBT_PUBLIC(xbt_edge_t) xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src,
+                                          xbt_node_t dst);
 
 XBT_PUBLIC(void) xbt_graph_edge_set_length(xbt_edge_t e, double length);
 XBT_PUBLIC(double) xbt_graph_edge_get_length(xbt_edge_t e);
-XBT_PUBLIC(double*) xbt_graph_get_length_matrix(xbt_graph_t g);
-
-XBT_PUBLIC(void) xbt_graph_free_node(xbt_graph_t g, xbt_node_t n, 
-                          void_f_pvoid_t node_free_function , void_f_pvoid_t edge_free_function);
-XBT_PUBLIC(void) xbt_graph_free_edge(xbt_graph_t g, xbt_edge_t e, 
-                          void_f_pvoid_t free_function);
-XBT_PUBLIC(void) xbt_graph_free_graph(xbt_graph_t g, 
-                         void_f_pvoid_t node_free_function,
-                         void_f_pvoid_t edge_free_function,
-                         void_f_pvoid_t graph_free_function);
+XBT_PUBLIC(double *) xbt_graph_get_length_matrix(xbt_graph_t g);
+
+XBT_PUBLIC(void) xbt_graph_free_node(xbt_graph_t g, xbt_node_t n,
+                                     void_f_pvoid_t node_free_function,
+                                     void_f_pvoid_t edge_free_function);
+XBT_PUBLIC(void) xbt_graph_free_edge(xbt_graph_t g, xbt_edge_t e,
+                                     void_f_pvoid_t free_function);
+XBT_PUBLIC(void) xbt_graph_free_graph(xbt_graph_t g,
+                                      void_f_pvoid_t node_free_function,
+                                      void_f_pvoid_t edge_free_function,
+                                      void_f_pvoid_t graph_free_function);
 
 XBT_PUBLIC(int) __xbt_find_in_dynar(xbt_dynar_t dynar, void *p);
 
@@ -53,23 +55,32 @@ XBT_PUBLIC(xbt_dynar_t) xbt_graph_get_nodes(xbt_graph_t g);
 XBT_PUBLIC(xbt_dynar_t) xbt_graph_get_edges(xbt_graph_t g);
 XBT_PUBLIC(xbt_node_t) xbt_graph_edge_get_source(xbt_edge_t e);
 XBT_PUBLIC(xbt_node_t) xbt_graph_edge_get_target(xbt_edge_t e);
-XBT_PUBLIC(xbt_graph_t) xbt_graph_read(const char *filename,
-                          void *(node_label_and_data)(xbt_node_t, const char*, const char*),
-                          void *(edge_label_and_data)(xbt_edge_t, const char*, const char*)
-                          );
-XBT_PUBLIC(void) xbt_graph_export_graphviz(xbt_graph_t g, const char *filename,
-                              const char *(node_name)(xbt_node_t),
-                              const char *(edge_name)(xbt_edge_t));
-XBT_PUBLIC(void) xbt_graph_export_graphxml(xbt_graph_t g, const char *filename,
-                              const char *(node_name)(xbt_node_t),
-                              const char *(edge_name)(xbt_edge_t),
-                              const char *(node_data_print)(void *),
-                              const char *(edge_data_print)(void *));
+XBT_PUBLIC(xbt_graph_t) xbt_graph_read(const char *filename, void
+                                       * (node_label_and_data) (xbt_node_t,
+                                                                const char *,
+                                                                const char *),
+                                       void
+                                       * (edge_label_and_data) (xbt_edge_t,
+                                                                const char *,
+                                                                const char *)
+  );
+
+XBT_PUBLIC(void) xbt_graph_export_graphviz(xbt_graph_t g,
+                                           const char *filename, const char
+                                           * (node_name) (xbt_node_t), const char
+                                           * (edge_name) (xbt_edge_t));
+XBT_PUBLIC(void) xbt_graph_export_graphxml(xbt_graph_t g,
+                                           const char *filename, const char
+                                           * (node_name) (xbt_node_t), const char
+                                           * (edge_name) (xbt_edge_t),
+                                           const char *(node_data_print) (void
+                                                                          *),
+                                           const char *(edge_data_print) (void
+                                                                          *));
 
 /* Not implemented yet ! */
 /* void *xbt_graph_to_array(xbt_graph_t g);  */
-XBT_PUBLIC(xbt_node_t*) xbt_graph_shortest_paths(xbt_graph_t g);
+XBT_PUBLIC(xbt_node_t *) xbt_graph_shortest_paths(xbt_graph_t g);
 
 
 
@@ -78,9 +89,9 @@ XBT_PUBLIC(xbt_node_t*) xbt_graph_shortest_paths(xbt_graph_t g);
             if a cycle is detected an exception is raised  
   */
 
-XBT_PUBLIC(xbt_node_t*) xbt_graph_topo_sort(xbt_graph_t g);
+XBT_PUBLIC(xbt_node_t *) xbt_graph_topo_sort(xbt_graph_t g);
 
-XBT_PUBLIC(xbt_edge_t*) xbt_graph_spanning_tree_prim(xbt_graph_t g);
+XBT_PUBLIC(xbt_edge_t *) xbt_graph_spanning_tree_prim(xbt_graph_t g);
 
 
 
@@ -100,11 +111,5 @@ XBT_PUBLIC(xbt_edge_t*) xbt_graph_spanning_tree_prim(xbt_graph_t g);
 
 
 SG_END_DECL()
-
-#endif                         /* _XBT_GRAPH_H */
+#endif /* _XBT_GRAPH_H */
 /** @} */
-
-
-
-
-
index 4150440..54a4bc7 100644 (file)
 #define _FLEXML_graphxml_H
 
 /* XML application entry points. */
-XBT_PUBLIC(void ) STag_graphxml_graph(void);
-XBT_PUBLIC(void ) ETag_graphxml_graph(void);
-XBT_PUBLIC(void ) STag_graphxml_node(void);
-XBT_PUBLIC(void ) ETag_graphxml_node(void);
-XBT_PUBLIC(void ) STag_graphxml_edge(void);
-XBT_PUBLIC(void ) ETag_graphxml_edge(void);
+XBT_PUBLIC(void) STag_graphxml_graph(void);
+XBT_PUBLIC(void) ETag_graphxml_graph(void);
+XBT_PUBLIC(void) STag_graphxml_node(void);
+XBT_PUBLIC(void) ETag_graphxml_node(void);
+XBT_PUBLIC(void) STag_graphxml_edge(void);
+XBT_PUBLIC(void) ETag_graphxml_edge(void);
 
 /* XML application data. */
-typedef int AT_graphxml_node_name;
+     typedef int AT_graphxml_node_name;
 #define AU_graphxml_node_name NULL
-typedef int AT_graphxml_edge_source;
+     typedef int AT_graphxml_edge_source;
 #define AU_graphxml_edge_source NULL
-typedef int AT_graphxml_node_position_y;
+     typedef int AT_graphxml_node_position_y;
 #define AU_graphxml_node_position_y NULL
-typedef int AT_graphxml_node_position_x;
+     typedef int AT_graphxml_node_position_x;
 #define AU_graphxml_node_position_x NULL
-typedef int AT_graphxml_edge_data;
+     typedef int AT_graphxml_edge_data;
 #define AU_graphxml_edge_data NULL
-typedef int AT_graphxml_edge_target;
+     typedef int AT_graphxml_edge_target;
 #define AU_graphxml_edge_target NULL
-typedef enum { AU_graphxml_graph_isDirected, A_graphxml_graph_isDirected_true,A_graphxml_graph_isDirected_false } AT_graphxml_graph_isDirected;
-typedef int AT_graphxml_node_label;
+     typedef enum { AU_graphxml_graph_isDirected,
+       A_graphxml_graph_isDirected_true,
+       A_graphxml_graph_isDirected_false
+     } AT_graphxml_graph_isDirected;
+     typedef int AT_graphxml_node_label;
 #define AU_graphxml_node_label NULL
-typedef int AT_graphxml_node_data;
+     typedef int AT_graphxml_node_data;
 #define AU_graphxml_node_data NULL
-typedef int AT_graphxml_edge_label;
+     typedef int AT_graphxml_edge_label;
 #define AU_graphxml_edge_label NULL
-typedef int AT_graphxml_edge_length;
+     typedef int AT_graphxml_edge_length;
 #define AU_graphxml_edge_length NULL
-typedef int AT_graphxml_edge_name;
+     typedef int AT_graphxml_edge_name;
 #define AU_graphxml_edge_name NULL
 
 /* FleXML-provided data. */
-XBT_PUBLIC_DATA(int ) graphxml_pcdata_ix;
+XBT_PUBLIC_DATA(int) graphxml_pcdata_ix;
 XBT_PUBLIC_DATA(char *) graphxml_bufferstack;
 #define graphxml_pcdata (graphxml_bufferstack + graphxml_pcdata_ix)
-XBT_PUBLIC_DATA(AT_graphxml_node_name ) AX_graphxml_node_name;
+XBT_PUBLIC_DATA(AT_graphxml_node_name) AX_graphxml_node_name;
 #define A_graphxml_node_name (graphxml_bufferstack + AX_graphxml_node_name)
-XBT_PUBLIC_DATA(AT_graphxml_edge_source ) AX_graphxml_edge_source;
+XBT_PUBLIC_DATA(AT_graphxml_edge_source) AX_graphxml_edge_source;
 #define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source)
-XBT_PUBLIC_DATA(AT_graphxml_node_position_y ) AX_graphxml_node_position_y;
+XBT_PUBLIC_DATA(AT_graphxml_node_position_y) AX_graphxml_node_position_y;
 #define A_graphxml_node_position_y (graphxml_bufferstack + AX_graphxml_node_position_y)
-XBT_PUBLIC_DATA(AT_graphxml_node_position_x ) AX_graphxml_node_position_x;
+XBT_PUBLIC_DATA(AT_graphxml_node_position_x) AX_graphxml_node_position_x;
 #define A_graphxml_node_position_x (graphxml_bufferstack + AX_graphxml_node_position_x)
-XBT_PUBLIC_DATA(AT_graphxml_edge_data ) AX_graphxml_edge_data;
+XBT_PUBLIC_DATA(AT_graphxml_edge_data) AX_graphxml_edge_data;
 #define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data)
-XBT_PUBLIC_DATA(AT_graphxml_edge_target ) AX_graphxml_edge_target;
+XBT_PUBLIC_DATA(AT_graphxml_edge_target) AX_graphxml_edge_target;
 #define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target)
-XBT_PUBLIC_DATA(AT_graphxml_graph_isDirected ) AX_graphxml_graph_isDirected;
+XBT_PUBLIC_DATA(AT_graphxml_graph_isDirected) AX_graphxml_graph_isDirected;
 #define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected
-XBT_PUBLIC_DATA(AT_graphxml_node_label ) AX_graphxml_node_label;
+XBT_PUBLIC_DATA(AT_graphxml_node_label) AX_graphxml_node_label;
 #define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label)
-XBT_PUBLIC_DATA(AT_graphxml_node_data ) AX_graphxml_node_data;
+XBT_PUBLIC_DATA(AT_graphxml_node_data) AX_graphxml_node_data;
 #define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data)
-XBT_PUBLIC_DATA(AT_graphxml_edge_label ) AX_graphxml_edge_label;
+XBT_PUBLIC_DATA(AT_graphxml_edge_label) AX_graphxml_edge_label;
 #define A_graphxml_edge_label (graphxml_bufferstack + AX_graphxml_edge_label)
-XBT_PUBLIC_DATA(AT_graphxml_edge_length ) AX_graphxml_edge_length;
+XBT_PUBLIC_DATA(AT_graphxml_edge_length) AX_graphxml_edge_length;
 #define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length)
-XBT_PUBLIC_DATA(AT_graphxml_edge_name ) AX_graphxml_edge_name;
+XBT_PUBLIC_DATA(AT_graphxml_edge_name) AX_graphxml_edge_name;
 #define A_graphxml_edge_name (graphxml_bufferstack + AX_graphxml_edge_name)
 
 /* XML application utilities. */
-XBT_PUBLIC(int ) graphxml_element_context(int);
+XBT_PUBLIC(int) graphxml_element_context(int);
 
 /* XML processor entry point. */
-XBT_PUBLIC(int ) yylex(void);
+XBT_PUBLIC(int) yylex(void);
 
 /* Flexml error handling function (useful only when -q flag passed to flexml) */
-const char * graphxml_parse_err_msg(void);
+     const char *graphxml_parse_err_msg(void);
 #endif
index bce68a7..157cf30 100644 (file)
@@ -27,7 +27,8 @@ extern void_f_void_t ETag_graphxml_edge_fun;
 XBT_PUBLIC(void) xbt_graph_parse_open(const char *file);
 XBT_PUBLIC(void) xbt_graph_parse_close(void);
 XBT_PUBLIC(void) xbt_graph_parse_reset_parser(void);
-XBT_PUBLIC(void) xbt_graph_parse_get_double(double *value,const char *string);
+XBT_PUBLIC(void) xbt_graph_parse_get_double(double *value,
+                                            const char *string);
 
 /* Prototypes of the functions offered by flex */
 XBT_PUBLIC(int) xbt_graph_parse_lex(void);
index 43b483c..651aaba 100644 (file)
 /* Chord needs a SHA1 algorithm. Let's drop it in there */
 typedef struct s_xbt_sha_ s_xbt_sha_t, *xbt_sha_t;
 
-XBT_PUBLIC(xbt_sha_t) xbt_sha_new (void);
-XBT_PUBLIC(void)      xbt_sha_free (xbt_sha_t sha);
+XBT_PUBLIC(xbt_sha_t) xbt_sha_new(void);
+XBT_PUBLIC(void) xbt_sha_free(xbt_sha_t sha);
 
-XBT_PUBLIC(void)      xbt_sha_feed (xbt_sha_t sha, const unsigned char *data, size_t len);
-XBT_PUBLIC(void)      xbt_sha_reset (xbt_sha_t sha);
+XBT_PUBLIC(void) xbt_sha_feed(xbt_sha_t sha, const unsigned char *data,
+                              size_t len);
+XBT_PUBLIC(void) xbt_sha_reset(xbt_sha_t sha);
 
-XBT_PUBLIC(void)      xbt_sha_print (xbt_sha_t sha, char *hash);
-XBT_PUBLIC(char *)    xbt_sha_read(xbt_sha_t sha);
-   
-XBT_PUBLIC(void)      xbt_sha (const char *data, char *hash);
+XBT_PUBLIC(void) xbt_sha_print(xbt_sha_t sha, char *hash);
+XBT_PUBLIC(char *) xbt_sha_read(xbt_sha_t sha);
+
+XBT_PUBLIC(void) xbt_sha(const char *data, char *hash);
 
 
 #endif /* XBT_HASH_H */
index 99b4d7b..eb0a285 100644 (file)
@@ -9,7 +9,7 @@
 #define _XBT_HEAP_H
 
 #include "xbt/misc.h"
-#include "xbt/dynar.h" /* void_f_pvoid_t */
+#include "xbt/dynar.h"          /* void_f_pvoid_t */
 
 /** @addtogroup XBT_heap
  *  @brief This section describes the API to generic heap with O(log(n)) access.
@@ -24,10 +24,10 @@ XBT_PUBLIC(void) xbt_heap_free(xbt_heap_t H);
 XBT_PUBLIC(int) xbt_heap_size(xbt_heap_t H);
 
 XBT_PUBLIC(void) xbt_heap_push(xbt_heap_t H, void *content, double key);
-XBT_PUBLIC(void*) xbt_heap_pop(xbt_heap_t H);
+XBT_PUBLIC(void *) xbt_heap_pop(xbt_heap_t H);
 
 XBT_PUBLIC(double) xbt_heap_maxkey(xbt_heap_t H);
-XBT_PUBLIC(void*) xbt_heap_maxcontent(xbt_heap_t H);
+XBT_PUBLIC(void *) xbt_heap_maxcontent(xbt_heap_t H);
 
 /* @} */
-#endif                         /* _XBT_HEAP_H */
+#endif /* _XBT_HEAP_H */
index 3d7aabc..cd31e12 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  */
+
 /** \defgroup XBT_log_cats Existing log categories
  *  \ingroup XBT_log
  *  \brief (automatically extracted) 
@@ -43,21 +43,21 @@ SG_BEGIN_DECL()
  *
  * The different existing priorities.
 */
-typedef enum {
-  xbt_log_priority_none          = 0,  /* used internally (don't poke with) */
-  xbt_log_priority_trace         = 1,  /**< enter and return of some functions */
-  xbt_log_priority_debug         = 2,  /**< crufty output  */
-  xbt_log_priority_verbose       = 3,  /**< verbose output for the user wanting more */
-  xbt_log_priority_info          = 4,  /**< output about the regular functionning */
-  xbt_log_priority_warning       = 5,  /**< minor issue encountered */
-  xbt_log_priority_error         = 6,  /**< issue encountered */
-  xbt_log_priority_critical      = 7,  /**< major issue encountered */
-
-  xbt_log_priority_infinite      = 8,  /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
-
-  xbt_log_priority_uninitialized = -1  /* used internally (don't poke with) */
-} e_xbt_log_priority_t;
-             
+     typedef enum {
+       xbt_log_priority_none = 0,       /* used internally (don't poke with) */
+       xbt_log_priority_trace = 1,     /**< enter and return of some functions */
+       xbt_log_priority_debug = 2,     /**< crufty output  */
+       xbt_log_priority_verbose = 3,   /**< verbose output for the user wanting more */
+       xbt_log_priority_info = 4,      /**< output about the regular functionning */
+       xbt_log_priority_warning = 5,   /**< minor issue encountered */
+       xbt_log_priority_error = 6,     /**< issue encountered */
+       xbt_log_priority_critical = 7,  /**< major issue encountered */
+
+       xbt_log_priority_infinite = 8,  /**< value for XBT_LOG_STATIC_THRESHOLD to not log */
+
+       xbt_log_priority_uninitialized = -1      /* used internally (don't poke with) */
+     } e_xbt_log_priority_t;
+
 
 /*
  * define NLOG to disable at compilation time any logging request
@@ -114,9 +114,9 @@ typedef enum {
 #if defined(__STRICT_ANSI__) || defined(_MSC_VER)
 # define _XBT_LOG_PARENT_INITIALIZER(parent) NULL
 # define XBT_LOG_CONNECT(parent_cat,child)       _XBT_LOGV(child).parent = &_XBT_LOGV(parent_cat)
-#else 
+#else
 # define _XBT_LOG_PARENT_INITIALIZER(parent) &_XBT_LOGV(parent)
-# define XBT_LOG_CONNECT(parent_cat,child)     /*  xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat))*/
+# define XBT_LOG_CONNECT(parent_cat,child)      /*  xbt_assert(_XBT_LOGV(child).parent == &_XBT_LOGV(parent_cat)) */
 #endif
 
 /* XBT_LOG_NEW_SUBCATEGORY_helper:
@@ -157,7 +157,7 @@ typedef enum {
  * Creates a new subcategory of the root category.
  */
 # define XBT_LOG_NEW_CATEGORY(catName,desc)  \
-   XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)  
+   XBT_LOG_NEW_SUBCATEGORY_helper(catName, XBT_LOG_ROOT_CAT, desc)
 
 
 /**
@@ -168,11 +168,11 @@ typedef enum {
  * Indicates which category is the default one.
  */
 
-#if defined(XBT_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
+#if defined(XBT_LOG_MAYDAY)     /*|| defined (NLOG) * turning logging off */
 # define XBT_LOG_DEFAULT_CATEGORY(cname)
 #else
 # define XBT_LOG_DEFAULT_CATEGORY(cname) \
-        static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname) 
+        static xbt_log_category_t _XBT_LOGV(default) _XBT_GNUC_UNUSED = &_XBT_LOGV(cname)
 #endif
 
 /**
@@ -228,48 +228,50 @@ typedef enum {
 
 /* Functions you may call */
 
-XBT_PUBLIC(void) xbt_log_control_set(const charcs);
+XBT_PUBLIC(void) xbt_log_control_set(const char *cs);
 
 /* Forward declarations */
-typedef struct xbt_log_appender_s s_xbt_log_appender_t,*xbt_log_appender_t;
-typedef struct xbt_log_layout_s   s_xbt_log_layout_t,  *xbt_log_layout_t;
-typedef struct xbt_log_event_s    s_xbt_log_event_t,   *xbt_log_event_t;
-typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
+     typedef struct xbt_log_appender_s s_xbt_log_appender_t,
+       *xbt_log_appender_t;
+     typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t;
+     typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t;
+     typedef struct xbt_log_category_s s_xbt_log_category_t,
+       *xbt_log_category_t;
 
 /*
  * Do NOT access any members of this structure directly. FIXME: move to private?
  */
 #ifdef WIN32
-#define XBT_LOG_BUFF_SIZE  16384/* Size of the static string in which we build the log string */
+#define XBT_LOG_BUFF_SIZE  16384        /* Size of the static string in which we build the log string */
 #else
-#define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */
+#define XBT_LOG_BUFF_SIZE 2048  /* Size of the static string in which we build the log string */
 #endif
-struct xbt_log_category_s {
-  xbt_log_category_t parent;
-  xbt_log_category_t firstChild; 
-  xbt_log_category_t nextSibling;
-  const char *name;
-  int threshold;
-  int isThreshInherited;
-  xbt_log_appender_t appender;
-  xbt_log_layout_t layout;
-  int additivity;
-};
-
-struct xbt_log_event_s {
-  xbt_log_category_t cat;
-  e_xbt_log_priority_t priority;
-  const char* fileName;
-  const char* functionName;
-  int lineNum; 
-  va_list ap;
-  va_list ap_copy; /* need a copy to launch dynamic layouts when the static ones overflowed */
-  #ifdef WIN32
-  char* buffer;
-  #else
-  char buffer[XBT_LOG_BUFF_SIZE];
-  #endif
-};
+     struct xbt_log_category_s {
+       xbt_log_category_t parent;
+       xbt_log_category_t firstChild;
+       xbt_log_category_t nextSibling;
+       const char *name;
+       int threshold;
+       int isThreshInherited;
+       xbt_log_appender_t appender;
+       xbt_log_layout_t layout;
+       int additivity;
+     };
+
+     struct xbt_log_event_s {
+       xbt_log_category_t cat;
+       e_xbt_log_priority_t priority;
+       const char *fileName;
+       const char *functionName;
+       int lineNum;
+       va_list ap;
+       va_list ap_copy;         /* need a copy to launch dynamic layouts when the static ones overflowed */
+#ifdef WIN32
+       char *buffer;
+#else
+       char buffer[XBT_LOG_BUFF_SIZE];
+#endif
+     };
 
 /**
  * \ingroup XBT_log_implem
@@ -279,7 +281,8 @@ struct xbt_log_event_s {
  * Programatically alters a category's threshold priority (don't use).
  */
 XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat,
-                                      e_xbt_log_priority_t thresholdPriority);
+                                       e_xbt_log_priority_t
+                                       thresholdPriority);
 
 /**
  * \ingroup XBT_log_implem  
@@ -291,7 +294,7 @@ XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat,
  *
  */
 XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat,
-                                     xbt_log_appender_t app);
+                                      xbt_log_appender_t app);
 /**
  * \ingroup XBT_log_implem  
  * \param cat the category (not only its name, but the variable)
@@ -301,8 +304,8 @@ XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat,
  * (the prefered interface is throught xbt_log_control_set())
  *
  */
-XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat, 
-                                   xbt_log_layout_t lay);
+XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat,
+                                    xbt_log_layout_t lay);
 
 /**
  * \ingroup XBT_log_implem  
@@ -315,33 +318,33 @@ XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat,
  *
  */
 XBT_PUBLIC(void) xbt_log_additivity_set(xbt_log_category_t cat,
-                                       int additivity);
+                                        int additivity);
 
 /** @brief create a new simple layout 
  *
  * This layout is not as flexible as the pattern one
  */
-XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char*arg);
-XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char*arg);
-XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char*arg);
+XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char *arg);
+XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char *arg);
+XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char *arg);
 
 
 /* ********************************** */
 /* Functions that you shouldn't call  */
 /* ********************************** */
 XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev,
-                               const char *fmt,
-                               ...) _XBT_GNUC_PRINTF(2,3);
+                                    const char *fmt,
+                                    ...) _XBT_GNUC_PRINTF(2, 3);
 
-XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t   category,
-                                 e_xbt_log_priority_t priority);
+XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category,
+                                  e_xbt_log_priority_t priority);
 
 
 XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
 
 
-extern xbt_log_appender_t xbt_log_default_appender;
-extern xbt_log_layout_t xbt_log_default_layout;
+     extern xbt_log_appender_t xbt_log_default_appender;
+     extern xbt_log_layout_t xbt_log_default_layout;
 
 /* ********************** */
 /* Public functions again */
@@ -401,7 +404,7 @@ extern xbt_log_layout_t xbt_log_default_layout;
              {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
                 _log_ev.cat = &(catv);                           \
               _xbt_log_event_log(&_log_ev                       \
-              
+
 #endif
 
 #define _XBT_LOG_POST                          \
@@ -413,19 +416,19 @@ extern xbt_log_layout_t xbt_log_default_layout;
 
 #ifdef XBT_LOG_MAYDAY
 # define CLOG0(c, p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
-# define CLOG1(c, p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
-# define CLOG2(c, p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
-# define CLOG3(c, p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
-# define CLOG4(c, p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
-# define CLOG5(c, p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
+# define CLOG1(c, p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
+# define CLOG2(c, p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
+# define CLOG3(c, p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
+# define CLOG4(c, p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
+# define CLOG5(c, p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
 # define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
 # define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
 # define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
 # define CLOG9(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9)
 # define CLOG10(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
 #else
-# define CLOG0(c, p, f)                   _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST                   
-# define CLOG1(c, p, f,a1)                _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST                
+# define CLOG0(c, p, f)                   _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST
+# define CLOG1(c, p, f,a1)                _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST
 # define CLOG2(c, p, f,a1,a2)             _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
 # define CLOG3(c, p, f,a1,a2,a3)          _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
 # define CLOG4(c, p, f,a1,a2,a3,a4)       _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
@@ -546,11 +549,11 @@ extern xbt_log_layout_t xbt_log_default_layout;
 
 #ifdef XBT_LOG_MAYDAY
 # define LOG0(p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
-# define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
-# define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
-# define LOG3(p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)         
-# define LOG4(p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)      
-# define LOG5(p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)   
+# define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)
+# define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)
+# define LOG3(p, f,a1,a2,a3)          fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3)
+# define LOG4(p, f,a1,a2,a3,a4)       fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4)
+# define LOG5(p, f,a1,a2,a3,a4,a5)    fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5)
 # define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6)
 # define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
 # define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
@@ -705,5 +708,4 @@ extern xbt_log_layout_t xbt_log_default_layout;
 
 
 SG_END_DECL()
-
 #endif /* ! _XBT_LOG_H_ */
index 90273ba..1de19a2 100644 (file)
@@ -9,7 +9,7 @@
 #define _XBT_MALLOCATOR_H
 
 #include "xbt/function_types.h"
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 
 SG_BEGIN_DECL()
 
@@ -28,16 +28,17 @@ SG_BEGIN_DECL()
  *  new object, the object is just extracted from the mallocator. No malloc() is
  *  done, unless there is no more object in the mallocator.
  */
-
 /** @defgroup XBT_mallocator_cons Mallocator constructor and destructor
  *  @ingroup XBT_mallocator
  *
  *  @{
  */
-
 /** \brief Mallocator data type (opaque structure) */
-typedef struct s_xbt_mallocator *xbt_mallocator_t;
-XBT_PUBLIC(xbt_mallocator_t) xbt_mallocator_new(int size, pvoid_f_void_t new_f, void_f_pvoid_t free_f, void_f_pvoid_t reset_f);
+     typedef struct s_xbt_mallocator *xbt_mallocator_t;
+XBT_PUBLIC(xbt_mallocator_t) xbt_mallocator_new(int size,
+                                                pvoid_f_void_t new_f,
+                                                void_f_pvoid_t free_f,
+                                                void_f_pvoid_t reset_f);
 XBT_PUBLIC(void) xbt_mallocator_free(xbt_mallocator_t mallocator);
 /** @} */
 
@@ -47,10 +48,10 @@ XBT_PUBLIC(void) xbt_mallocator_free(xbt_mallocator_t mallocator);
  *
  *  @{
  */
-XBT_PUBLIC(void*) xbt_mallocator_get(xbt_mallocator_t mallocator);
-XBT_PUBLIC(void) xbt_mallocator_release(xbt_mallocator_t mallocator, void *object);
+XBT_PUBLIC(void *) xbt_mallocator_get(xbt_mallocator_t mallocator);
+XBT_PUBLIC(void) xbt_mallocator_release(xbt_mallocator_t mallocator,
+                                        void *object);
 /** @} */
 
 SG_END_DECL()
-
 #endif /* _XBT_MALLOCATOR_H */
index a224fa1..1b95b5f 100644 (file)
 
 SG_BEGIN_DECL()
 
-typedef struct {
-  unsigned int lines, rows;
-  unsigned long elmsize;
+     typedef struct {
+       unsigned int lines, rows;
+       unsigned long elmsize;
 
-  char *data;
-  void_f_pvoid_t free_f;
-} s_xbt_matrix_t, *xbt_matrix_t;
+       char *data;
+       void_f_pvoid_t free_f;
+     } s_xbt_matrix_t, *xbt_matrix_t;
 
 
   /** @brief Retrieve the address of a cell (not its content)
@@ -31,38 +31,40 @@ typedef struct {
 
   /** @brief Quick retrieval of scalar content
    *  @hideinitializer */
-#define xbt_matrix_get_as(mat,l,c,type) *(type*)xbt_matrix_get_ptr(mat,l,c) 
+#define xbt_matrix_get_as(mat,l,c,type) *(type*)xbt_matrix_get_ptr(mat,l,c)
 
-XBT_PUBLIC(xbt_matrix_t) xbt_matrix_new(int lines, int rows, 
-                           const unsigned long elmsize,
-                           void_f_pvoid_t const free_f);
+XBT_PUBLIC(xbt_matrix_t) xbt_matrix_new(int lines, int rows,
+                                        const unsigned long elmsize,
+                                        void_f_pvoid_t const free_f);
 XBT_PUBLIC(xbt_matrix_t) xbt_matrix_new_sub(xbt_matrix_t from,
-                               int lsize, int rsize,
-                               int lpos, int rpos,
-                               pvoid_f_pvoid_t const cpy_f);
+                                            int lsize, int rsize,
+                                            int lpos, int rpos,
+                                            pvoid_f_pvoid_t const cpy_f);
 
 XBT_PUBLIC(void) xbt_matrix_free(xbt_matrix_t matrix);
 XBT_PUBLIC(void) xbt_matrix_free_voidp(void *d);
 
 XBT_PUBLIC(void) xbt_matrix_copy_values(xbt_matrix_t dest, xbt_matrix_t src,
-                           unsigned int lsize, unsigned int rsize,
-                           unsigned int lpos_dst,unsigned int rpos_dst,
-                           unsigned int lpos_src,unsigned int rpos_src,
-                           pvoid_f_pvoid_t const cpy_f);
+                                        unsigned int lsize,
+                                        unsigned int rsize,
+                                        unsigned int lpos_dst,
+                                        unsigned int rpos_dst,
+                                        unsigned int lpos_src,
+                                        unsigned int rpos_src,
+                                        pvoid_f_pvoid_t const cpy_f);
 
-XBT_PUBLIC(void) xbt_matrix_dump(xbt_matrix_t matrix, const char *name, int coords,
-                    void_f_pvoid_t display_fun);
-XBT_PUBLIC(void) xbt_matrix_dump_display_double(void*d);
+XBT_PUBLIC(void) xbt_matrix_dump(xbt_matrix_t matrix, const char *name,
+                                 int coords, void_f_pvoid_t display_fun);
+XBT_PUBLIC(void) xbt_matrix_dump_display_double(void *d);
 
 
 XBT_PUBLIC(xbt_matrix_t) xbt_matrix_double_new_zeros(int lines, int rows);
 XBT_PUBLIC(xbt_matrix_t) xbt_matrix_double_new_id(int lines, int rows);
 XBT_PUBLIC(xbt_matrix_t) xbt_matrix_double_new_rand(int lines, int rows);
 XBT_PUBLIC(xbt_matrix_t) xbt_matrix_double_new_seq(int lines, int rows);
-XBT_PUBLIC(xbt_matrix_t) xbt_matrix_double_new_mult(xbt_matrix_t A,xbt_matrix_t B);
-XBT_PUBLIC(void) xbt_matrix_double_addmult(xbt_matrix_t A,xbt_matrix_t B,
-                      /*OUT*/ xbt_matrix_t C);
+XBT_PUBLIC(xbt_matrix_t) xbt_matrix_double_new_mult(xbt_matrix_t A,
+                                                    xbt_matrix_t B);
+XBT_PUBLIC(void) xbt_matrix_double_addmult(xbt_matrix_t A, xbt_matrix_t B,
+                                           /*OUT*/ xbt_matrix_t C);
 SG_END_DECL()
-
-
 #endif /* XBT_MATRIX_H */
index cfa461e..42173ad 100644 (file)
 # define _XBT_GNUC_NORETURN __attribute__((__noreturn__))
 # define _XBT_GNUC_UNUSED  __attribute__((unused))
 
-#else   /* !__GNUC__ */
+#else /* !__GNUC__ */
 # define _XBT_GNUC_PRINTF( format_idx, arg_idx )
 # define _XBT_GNUC_SCANF( format_idx, arg_idx )
 # define _XBT_GNUC_FORMAT( arg_idx )
 # define _XBT_GNUC_NORETURN
 # define _XBT_GNUC_UNUSED
 
-#endif  /* !__GNUC__ */
+#endif /* !__GNUC__ */
 
 /* inline and __FUNCTION__ are only in GCC when -ansi is off */
 
 #if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
 # define _XBT_FUNCTION __FUNCTION__
 #elif (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
-# define _XBT_FUNC__ __func__      /* ISO-C99 compliant */
+# define _XBT_FUNC__ __func__   /* ISO-C99 compliant */
 #else
 # define _XBT_FUNCTION "function"
 #endif
 /* 
  * Function calling convention (not used for now) 
  */
+
 #ifdef _WIN32
 #  ifndef _XBT_CALL
 #    define _XBT_CALL __cdecl
 #   endif
-#else 
+#else
 #  define _XBT_CALL
 #endif
 
 #if defined(DLL_EXPORT)
 #  define XBT_PUBLIC(type)            __declspec(dllexport) type
 #  define XBT_EXPORT_NO_IMPORT(type)  __declspec(dllexport) type
-#  define XBT_IMPORT_NO_EXPORT(type)  type 
+#  define XBT_IMPORT_NO_EXPORT(type)  type
 #  define XBT_PUBLIC_DATA(type)              __declspec(dllexport) type
 
 /* Pack everything up statically */
 #  define XBT_EXPORT_NO_IMPORT(type)  type
 #  define XBT_IMPORT_NO_EXPORT(type)  type
 #  define XBT_PUBLIC_DATA(type)       extern type
-     
+
 
 /* Link against the DLL */
 #elif (defined(_WIN32) && !defined(DLL_EXPORT) && !defined(DLL_STATIC))
 #  define XBT_IMPORT_NO_EXPORT(type)  type
 #  define XBT_PUBLIC_DATA(type)       extern type
 #endif
-   
+
 #if !defined (max) && !defined(__cplusplus)
 #  define max(a,b)     (((a) > (b)) ? (a) : (b))
 #endif
 #define TRUE  1
 #define FALSE 0
 
-#define XBT_MAX_CHANNEL 10 /* FIXME: killme */
+#define XBT_MAX_CHANNEL 10      /* FIXME: killme */
 /*! C++ users need love */
 #ifndef SG_BEGIN_DECL
 # ifdef __cplusplus
 #  define SG_BEGIN_DECL() extern "C" {
 # else
-#  define SG_BEGIN_DECL() 
+#  define SG_BEGIN_DECL()
 # endif
 #endif
 
 # ifdef __cplusplus
 #  define SG_END_DECL() }
 # else
-#  define SG_END_DECL() 
+#  define SG_END_DECL()
 # endif
 #endif
 /* End of cruft for C++ */
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(const char *)xbt_procname(void);
+XBT_PUBLIC(const char *) xbt_procname(void);
 
-#define XBT_BACKTRACE_SIZE 10 /* FIXME: better place? Do document */
-   
-SG_END_DECL()
+#define XBT_BACKTRACE_SIZE 10   /* FIXME: better place? Do document */
 
+SG_END_DECL()
 #endif /* XBT_MISC_H */
-
-
-
-
index 33d6a5a..1422e7c 100644 (file)
 #ifndef _XBT_MODULE_H
 #define _XBT_MODULE_H
 
-#include <xbt/misc.h> /* XBT_PUBLIC */
+#include <xbt/misc.h>           /* XBT_PUBLIC */
 
 extern char *xbt_binary_name;
 
-XBT_PUBLIC(void) xbt_init(int *argc,char **argv);
+XBT_PUBLIC(void) xbt_init(int *argc, char **argv);
 XBT_PUBLIC(void) xbt_exit(void);
 #endif /* _XBT_MODULE_H */
index b9b8425..e99ae7c 100644 (file)
 
 SG_BEGIN_DECL()
 
-typedef struct {  
-   char *name;
-   int port;
-} s_xbt_peer_t, *xbt_peer_t;
+     typedef struct {
+       char *name;
+       int port;
+     } s_xbt_peer_t, *xbt_peer_t;
 
 XBT_PUBLIC(xbt_peer_t) xbt_peer_new(const char *name, int port);
 XBT_PUBLIC(xbt_peer_t) xbt_peer_from_string(const char *peerport);
@@ -28,6 +28,4 @@ XBT_PUBLIC(void) xbt_peer_free(xbt_peer_t peer);
 XBT_PUBLIC(void) xbt_peer_free_voidp(void *d);
 
 SG_END_DECL()
-
-
 #endif /* XBT_PEER_H */
index 136ac04..b42482b 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef _XBT_QUEUE_H
 #define _XBT_QUEUE_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 /* #include "xbt/function_types.h" */
 
 SG_BEGIN_DECL()
@@ -27,28 +27,30 @@ SG_BEGIN_DECL()
   * 
   * @{
   */
-
   /** \brief Queue data type (opaque type) */
-  typedef struct s_xbt_queue_ *xbt_queue_t;
+     typedef struct s_xbt_queue_ *xbt_queue_t;
 
 
-  XBT_PUBLIC(xbt_queue_t)   xbt_queue_new(int capacity, unsigned long elm_size);
-  XBT_PUBLIC(void)          xbt_queue_free(xbt_queue_t *queue);
+XBT_PUBLIC(xbt_queue_t) xbt_queue_new(int capacity, unsigned long elm_size);
+XBT_PUBLIC(void) xbt_queue_free(xbt_queue_t * queue);
 
-  XBT_PUBLIC(unsigned long) xbt_queue_length(const xbt_queue_t queue);
+XBT_PUBLIC(unsigned long) xbt_queue_length(const xbt_queue_t queue);
 
-  XBT_PUBLIC(void) xbt_queue_push     (xbt_queue_t queue, const void *src);
-  XBT_PUBLIC(void) xbt_queue_pop      (xbt_queue_t queue, void *const dst);
-  XBT_PUBLIC(void) xbt_queue_unshift (xbt_queue_t queue, const void *src);
-  XBT_PUBLIC(void) xbt_queue_shift   (xbt_queue_t queue, void *const dst);
+XBT_PUBLIC(void) xbt_queue_push(xbt_queue_t queue, const void *src);
+XBT_PUBLIC(void) xbt_queue_pop(xbt_queue_t queue, void *const dst);
+XBT_PUBLIC(void) xbt_queue_unshift(xbt_queue_t queue, const void *src);
+XBT_PUBLIC(void) xbt_queue_shift(xbt_queue_t queue, void *const dst);
 
-  XBT_PUBLIC(void) xbt_queue_push_timed    (xbt_queue_t queue, const void *src, double delay);
-  XBT_PUBLIC(void) xbt_queue_unshift_timed (xbt_queue_t queue, const void *src, double delay);
-  XBT_PUBLIC(void) xbt_queue_shift_timed   (xbt_queue_t queue, void *const dst, double delay);
-  XBT_PUBLIC(void) xbt_queue_pop_timed     (xbt_queue_t queue, void *const dst, double delay);
+XBT_PUBLIC(void) xbt_queue_push_timed(xbt_queue_t queue, const void *src,
+                                      double delay);
+XBT_PUBLIC(void) xbt_queue_unshift_timed(xbt_queue_t queue, const void *src,
+                                         double delay);
+XBT_PUBLIC(void) xbt_queue_shift_timed(xbt_queue_t queue, void *const dst,
+                                       double delay);
+XBT_PUBLIC(void) xbt_queue_pop_timed(xbt_queue_t queue, void *const dst,
+                                     double delay);
 
 /** @} */
 
 SG_END_DECL()
-
 #endif /* _XBT_QUEUE_H */
index 0d79c10..db57ed8 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef _XBT_SET_H
 #define _XBT_SET_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/function_types.h"
 
 SG_BEGIN_DECL()
@@ -44,15 +44,13 @@ SG_BEGIN_DECL()
  *  descriptions, but it should be reworked to become generic.
  *
  */
-
-
 /** @defgroup XBT_set_cons Set and set elements, constructor/destructor
  *  @ingroup XBT_set
  *
  *  @{
  */
 /** \brief Opaque type representing a set */
-typedef struct xbt_set_ *xbt_set_t;
+     typedef struct xbt_set_ *xbt_set_t;
 
 #define XBT_SET_HEADERS \
   unsigned int ID;      \
@@ -60,15 +58,16 @@ typedef struct xbt_set_ *xbt_set_t;
   unsigned int name_len
 
 /** \brief It must be possible to cast set elements to this type */
-typedef struct xbt_set_elm_ {
-  unsigned int ID;      /**< Identificator (system assigned) */
-  char        *name;    /**< Name (user assigned) */
-  unsigned int name_len;/**< Length of the name */
-} s_xbt_set_elm_t,*xbt_set_elm_t;
+     typedef struct xbt_set_elm_ {
+       unsigned int ID; /**< Identificator (system assigned) */
+       char *name;      /**< Name (user assigned) */
+       unsigned int name_len;
+                        /**< Length of the name */
+     } s_xbt_set_elm_t, *xbt_set_elm_t;
 
 /*####[ Functions ]##########################################################*/
-XBT_PUBLIC(xbt_set_t) xbt_set_new (void);
-XBT_PUBLIC(void) xbt_set_free(xbt_set_t *set);
+XBT_PUBLIC(xbt_set_t) xbt_set_new(void);
+XBT_PUBLIC(void) xbt_set_free(xbt_set_t * set);
 
 /** @} */
 /** @defgroup XBT_set_basic Sets basic usage
@@ -77,18 +76,22 @@ XBT_PUBLIC(void) xbt_set_free(xbt_set_t *set);
  *  @{
  */
 
-XBT_PUBLIC(void) xbt_set_add (xbt_set_t set, xbt_set_elm_t  elm, void_f_pvoid_t free_func);
-XBT_PUBLIC(void) xbt_set_remove (xbt_set_t set, xbt_set_elm_t elm);
-XBT_PUBLIC(void) xbt_set_remove_by_name (xbt_set_t set, const char *key);
-XBT_PUBLIC(void) xbt_set_remove_by_name_ext (xbt_set_t set, const char *key, int key_len);
-XBT_PUBLIC(void) xbt_set_remove_by_id (xbt_set_t set, int id);
+XBT_PUBLIC(void) xbt_set_add(xbt_set_t set, xbt_set_elm_t elm,
+                             void_f_pvoid_t free_func);
+XBT_PUBLIC(void) xbt_set_remove(xbt_set_t set, xbt_set_elm_t elm);
+XBT_PUBLIC(void) xbt_set_remove_by_name(xbt_set_t set, const char *key);
+XBT_PUBLIC(void) xbt_set_remove_by_name_ext(xbt_set_t set, const char *key,
+                                            int key_len);
+XBT_PUBLIC(void) xbt_set_remove_by_id(xbt_set_t set, int id);
 
-XBT_PUBLIC(xbt_set_elm_t) xbt_set_get_by_name    (xbt_set_t set, const char *key);
-XBT_PUBLIC(xbt_set_elm_t) xbt_set_get_by_name_ext(xbt_set_t set, const char *key, int key_len);
-XBT_PUBLIC(xbt_set_elm_t) xbt_set_get_by_id      (xbt_set_t set, int         id);
+XBT_PUBLIC(xbt_set_elm_t) xbt_set_get_by_name(xbt_set_t set, const char *key);
+XBT_PUBLIC(xbt_set_elm_t) xbt_set_get_by_name_ext(xbt_set_t set,
+                                                  const char *key,
+                                                  int key_len);
+XBT_PUBLIC(xbt_set_elm_t) xbt_set_get_by_id(xbt_set_t set, int id);
+
+XBT_PUBLIC(unsigned long) xbt_set_length(const xbt_set_t set);
 
-XBT_PUBLIC(unsigned long) xbt_set_length (const xbt_set_t set);
-   
 
 /** @} */
 /** @defgroup XBT_set_curs Sets cursors
@@ -100,13 +103,13 @@ XBT_PUBLIC(unsigned long) xbt_set_length (const xbt_set_t set);
  */
 
 /** @brief Cursor type */
-typedef struct xbt_set_cursor_ *xbt_set_cursor_t;
+     typedef struct xbt_set_cursor_ *xbt_set_cursor_t;
 
-XBT_PUBLIC(void)         xbt_set_cursor_first       (xbt_set_t         set,
-                                         xbt_set_cursor_t *cursor);
-XBT_PUBLIC(void)         xbt_set_cursor_step        (xbt_set_cursor_t  cursor);
-XBT_PUBLIC(int)          xbt_set_cursor_get_or_free (xbt_set_cursor_t *cursor,
-                                         xbt_set_elm_t    *elm);
+XBT_PUBLIC(void) xbt_set_cursor_first(xbt_set_t set,
+                                      xbt_set_cursor_t * cursor);
+XBT_PUBLIC(void) xbt_set_cursor_step(xbt_set_cursor_t cursor);
+XBT_PUBLIC(int) xbt_set_cursor_get_or_free(xbt_set_cursor_t * cursor,
+                                           xbt_set_elm_t * elm);
 
 /** @brief Iterates over the whole set
  *  @hideinitializer
@@ -118,5 +121,4 @@ XBT_PUBLIC(int)          xbt_set_cursor_get_or_free (xbt_set_cursor_t *cursor,
 
 /* @} */
 SG_END_DECL()
-
 #endif /* _XBT_SET_H */
index 14ed932..333461a 100644 (file)
 #ifndef XBT_STR_H
 #define XBT_STR_H
 
-#include <stdarg.h> /* va_* */
+#include <stdarg.h>             /* va_* */
 #include "xbt/misc.h"
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
-#include <stdio.h> /* FILE for getline */
+#include <stdio.h>              /* FILE for getline */
 
 SG_BEGIN_DECL()
 
@@ -27,7 +27,6 @@ SG_BEGIN_DECL()
  * asprintf()), while some other are a bit more exotic.
  * @{
  */
-
 /* snprintf related functions */
 /** @brief print to allocated string (reimplemented when not provided by the system)
  *
@@ -38,27 +37,28 @@ SG_BEGIN_DECL()
  * should be passed to free(3) to release the allocated storage when
  * it is no longer needed.
  */
-XBT_PUBLIC(int) asprintf  (char **ptr, const char *fmt, /*args*/ ...) _XBT_GNUC_PRINTF(2,3);
+XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt,   /*args */
+                         ...) _XBT_GNUC_PRINTF(2, 3);
 /** @brief print to allocated string (reimplemented when not provided by the system)
  *
  * See asprintf()
  */
-XBT_PUBLIC(int) vasprintf (char **ptr, const char *fmt, va_list ap);
+XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
 /** @brief print to allocated string
  *
  * Works just like asprintf(), but returns a pointer to the newly created string
  */
-XBT_PUBLIC(char*) bprintf   (const char*fmt, ...) _XBT_GNUC_PRINTF(1,2);
+XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
 
 /* the gettext function. It gets redefined here only if not yet available */
 #if !defined(__USE_GNU) || defined(DOXYGEN)
-XBT_PUBLIC(long) getline(char **lineptr, size_t *n, FILE *stream);
+XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
 #endif
 
 /* Trim related functions */
-XBT_PUBLIC(void) xbt_str_rtrim(char* s, const char* char_list);
-XBT_PUBLIC(void) xbt_str_ltrim( char* s, const char* char_list);
-XBT_PUBLIC(void) xbt_str_trim(char* s, const char* char_list);
+XBT_PUBLIC(void) xbt_str_rtrim(char *s, const char *char_list);
+XBT_PUBLIC(void) xbt_str_ltrim(char *s, const char *char_list);
+XBT_PUBLIC(void) xbt_str_trim(char *s, const char *char_list);
 
 XBT_PUBLIC(xbt_dynar_t) xbt_str_split(const char *s, const char *sep);
 XBT_PUBLIC(xbt_dynar_t) xbt_str_split_quoted(const char *s);
@@ -68,7 +68,7 @@ XBT_PUBLIC(char *) xbt_str_join(xbt_dynar_t dynar, const char *sep);
 
 /* */
 XBT_PUBLIC(void) xbt_str_subst(char *str, char from, char to, int amount);
-XBT_PUBLIC(char *)xbt_str_varsubst(char *str, xbt_dict_t patterns);
+XBT_PUBLIC(char *) xbt_str_varsubst(char *str, xbt_dict_t patterns);
 
 /* */
 XBT_PUBLIC(void) xbt_str_strip_spaces(char *);
@@ -78,14 +78,9 @@ XBT_PUBLIC(char *) xbt_str_diff(char *a, char *b);
  *
  * This of almost no use, beside cosmetics and the GRAS parsing macro (see \ref GRAS_dd_auto).
  */
-typedef char *xbt_string_t;
+     typedef char *xbt_string_t;
 
 /**@}*/
 
 SG_END_DECL()
-
 #endif /* XBT_STR_H */
-
-
-
-
index ad2f739..1230c03 100644 (file)
  **/
 typedef struct {
   char *data;
-  int used,size;
+  int used, size;
 } s_xbt_strbuff_t, *xbt_strbuff_t;
 
 
-XBT_PUBLIC(void)          xbt_strbuff_empty(xbt_strbuff_t b);
+XBT_PUBLIC(void) xbt_strbuff_empty(xbt_strbuff_t b);
 XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(void);
-XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new_from(chars);
-XBT_PUBLIC(void)          xbt_strbuff_free(xbt_strbuff_t b);
-XBT_PUBLIC(void)          xbt_strbuff_free_container(xbt_strbuff_t b);
-XBT_PUBLIC(void)          xbt_strbuff_append(xbt_strbuff_t b, const char *toadd);
-XBT_PUBLIC(void)          xbt_strbuff_chomp(xbt_strbuff_t b);
-XBT_PUBLIC(void)          xbt_strbuff_trim(xbt_strbuff_t b);
-XBT_PUBLIC(void)          xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns);
+XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new_from(char *s);
+XBT_PUBLIC(void) xbt_strbuff_free(xbt_strbuff_t b);
+XBT_PUBLIC(void) xbt_strbuff_free_container(xbt_strbuff_t b);
+XBT_PUBLIC(void) xbt_strbuff_append(xbt_strbuff_t b, const char *toadd);
+XBT_PUBLIC(void) xbt_strbuff_chomp(xbt_strbuff_t b);
+XBT_PUBLIC(void) xbt_strbuff_trim(xbt_strbuff_t b);
+XBT_PUBLIC(void) xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns);
 
 #endif
index 135b041..de5d207 100644 (file)
@@ -13,7 +13,7 @@
 #define _XBT_SWAG_H
 
 #include "xbt/misc.h"
-#include "xbt/sysdep.h" /* size_t */
+#include "xbt/sysdep.h"         /* size_t */
 
 SG_BEGIN_DECL()
 
@@ -28,7 +28,6 @@ SG_BEGIN_DECL()
  *  no call to malloc/free is done.
  *
  */
-
 /** @defgroup XBT_swag_type Swag types
     @ingroup XBT_swag
 
@@ -40,10 +39,10 @@ SG_BEGIN_DECL()
     those structs directly. Use them as an abstract datatype.
 */
 /* @{ */
-typedef struct xbt_swag_hookup {
-  void *next;
-  void *prev;
-} s_xbt_swag_hookup_t; 
+     typedef struct xbt_swag_hookup {
+       void *next;
+       void *prev;
+     } s_xbt_swag_hookup_t;
 /**< This type should be added to a type that is to be used in a swag. 
  *
  *  Whenever a new object with this struct is created, all fields have
@@ -70,15 +69,15 @@ typedef struct foo {
 }
 \endcode
 */
-typedef s_xbt_swag_hookup_t  *xbt_swag_hookup_t;
+     typedef s_xbt_swag_hookup_t *xbt_swag_hookup_t;
 
 
-typedef struct xbt_swag {
-  void *head;
-  void *tail;
-  size_t offset;
-  int count;
-} s_xbt_swag_t, *xbt_swag_t;
+     typedef struct xbt_swag {
+       void *head;
+       void *tail;
+       size_t offset;
+       int count;
+     } s_xbt_swag_t, *xbt_swag_t;
 /**< A typical swag */
 /* @} */
 
@@ -94,12 +93,12 @@ XBT_PUBLIC(void) xbt_swag_init(xbt_swag_t swag, size_t offset);
 XBT_PUBLIC(void) xbt_swag_insert(void *obj, xbt_swag_t swag);
 XBT_PUBLIC(void) xbt_swag_insert_at_head(void *obj, xbt_swag_t swag);
 XBT_PUBLIC(void) xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag);
-XBT_PUBLIC(void*) xbt_swag_remove(void *obj, xbt_swag_t swag);
-XBT_PUBLIC(void*)xbt_swag_extract(xbt_swag_t swag);
+XBT_PUBLIC(void *) xbt_swag_remove(void *obj, xbt_swag_t swag);
+XBT_PUBLIC(void *) xbt_swag_extract(xbt_swag_t swag);
 XBT_PUBLIC(int) xbt_swag_size(xbt_swag_t swag);
 XBT_PUBLIC(int) xbt_swag_belongs(void *obj, xbt_swag_t swag);
 
-static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag)
+     static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag)
 {
   return (swag->head);
 }
@@ -161,5 +160,4 @@ static XBT_INLINE void *xbt_swag_getFirst(xbt_swag_t swag)
 /* @} */
 
 SG_END_DECL()
-
-#endif    /* _XBT_SWAG_H */
+#endif /* _XBT_SWAG_H */
index f442bb9..0ecb2e4 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _XBT_THREAD_H
 #define _XBT_THREAD_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/function_types.h"
 
 SG_BEGIN_DECL()
@@ -28,50 +28,48 @@ SG_BEGIN_DECL()
  * 
  *  @{
  */
-
   /** \brief Thread data type (opaque structure) */
-  typedef struct s_xbt_thread_ *xbt_thread_t;
-
-  XBT_PUBLIC(xbt_thread_t) xbt_thread_create(const char *name, void_f_pvoid_t start_routine,void* param);
-  XBT_PUBLIC(void) xbt_thread_exit();
-  XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
-  XBT_PUBLIC(const char*) xbt_thread_name(xbt_thread_t t);
-  XBT_PUBLIC(const char*) xbt_thread_self_name(void);
+     typedef struct s_xbt_thread_ *xbt_thread_t;
+
+XBT_PUBLIC(xbt_thread_t) xbt_thread_create(const char *name,
+                                           void_f_pvoid_t start_routine,
+                                           void *param);
+XBT_PUBLIC(void) xbt_thread_exit();
+XBT_PUBLIC(xbt_thread_t) xbt_thread_self(void);
+XBT_PUBLIC(const char *) xbt_thread_name(xbt_thread_t t);
+XBT_PUBLIC(const char *) xbt_thread_self_name(void);
   /* xbt_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
-  XBT_PUBLIC(void) xbt_thread_join(xbt_thread_t thread);
+XBT_PUBLIC(void) xbt_thread_join(xbt_thread_t thread);
   /* Ends the life of the poor victim (not always working if it's computing, but working if it's blocked in the OS) */
-  XBT_PUBLIC(void) xbt_thread_cancel(xbt_thread_t thread);
+XBT_PUBLIC(void) xbt_thread_cancel(xbt_thread_t thread);
   /* suicide */
-  XBT_PUBLIC(void) xbt_thread_exit(void);
+XBT_PUBLIC(void) xbt_thread_exit(void);
   /* current thread pass control to any possible thread wanting it */
-  XBT_PUBLIC(void) xbt_thread_yield(void);
+XBT_PUBLIC(void) xbt_thread_yield(void);
 
 
   /** \brief Thread mutex data type (opaque structure) */
-  typedef struct s_xbt_mutex_ *xbt_mutex_t;
+     typedef struct s_xbt_mutex_ *xbt_mutex_t;
 
-  XBT_PUBLIC(xbt_mutex_t) xbt_mutex_init(void);
-  XBT_PUBLIC(void)        xbt_mutex_acquire(xbt_mutex_t mutex);
-  XBT_PUBLIC(void)        xbt_mutex_release(xbt_mutex_t mutex);
-  XBT_PUBLIC(void)        xbt_mutex_timedacquire(xbt_mutex_t mutex, double delay);
-  XBT_PUBLIC(void)        xbt_mutex_destroy(xbt_mutex_t mutex);
+XBT_PUBLIC(xbt_mutex_t) xbt_mutex_init(void);
+XBT_PUBLIC(void) xbt_mutex_acquire(xbt_mutex_t mutex);
+XBT_PUBLIC(void) xbt_mutex_release(xbt_mutex_t mutex);
+XBT_PUBLIC(void) xbt_mutex_timedacquire(xbt_mutex_t mutex, double delay);
+XBT_PUBLIC(void) xbt_mutex_destroy(xbt_mutex_t mutex);
 
 
   /** \brief Thread condition data type (opaque structure) */
-  typedef struct s_xbt_cond_ *xbt_cond_t;
-
-  XBT_PUBLIC(xbt_cond_t) xbt_cond_init(void);
-  XBT_PUBLIC(void)       xbt_cond_wait(xbt_cond_t cond,
-                                      xbt_mutex_t mutex);
-  XBT_PUBLIC(void)       xbt_cond_timedwait(xbt_cond_t cond,
-                                           xbt_mutex_t mutex,
-                                           double delay);
-  XBT_PUBLIC(void)       xbt_cond_signal(xbt_cond_t cond);
-  XBT_PUBLIC(void)       xbt_cond_broadcast(xbt_cond_t cond);
-  XBT_PUBLIC(void)       xbt_cond_destroy(xbt_cond_t cond);
+     typedef struct s_xbt_cond_ *xbt_cond_t;
+
+XBT_PUBLIC(xbt_cond_t) xbt_cond_init(void);
+XBT_PUBLIC(void) xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex);
+XBT_PUBLIC(void) xbt_cond_timedwait(xbt_cond_t cond,
+                                    xbt_mutex_t mutex, double delay);
+XBT_PUBLIC(void) xbt_cond_signal(xbt_cond_t cond);
+XBT_PUBLIC(void) xbt_cond_broadcast(xbt_cond_t cond);
+XBT_PUBLIC(void) xbt_cond_destroy(xbt_cond_t cond);
 
 /** @} */
 
 SG_END_DECL()
-
 #endif /* _XBT_THREAD_H */
index 34a2f57..de2ef82 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <string.h>
 #include <stdlib.h>
-#include <stdarg.h> /* va_list */
+#include <stdarg.h>             /* va_list */
 
 #include "xbt/misc.h"
 #include "xbt/asserts.h"
@@ -33,11 +33,12 @@ XBT_PUBLIC(void) xbt_die(const char *msg) _XBT_GNUC_NORETURN;
 
 /* these ones live in str.h, but redeclare them here so that we do
    not need to load the whole str.h and its heavy dependencies */
-#ifndef __USE_GNU /* do not redeclare existing headers */
-  XBT_PUBLIC(int) asprintf  (char **ptr, const char *fmt, /*args*/ ...) _XBT_GNUC_PRINTF(2,3);
-  XBT_PUBLIC(int) vasprintf (char **ptr, const char *fmt, va_list ap);
+#ifndef __USE_GNU               /* do not redeclare existing headers */
+XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt,   /*args */
+                         ...) _XBT_GNUC_PRINTF(2, 3);
+XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
 #endif
-XBT_PUBLIC(char*) bprintf   (const char*fmt, ...) _XBT_GNUC_PRINTF(1,2);
+XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
 
 /** @addtogroup XBT_syscall
  *  @brief Malloc and associated functions, killing the program on error (with \ref XBT_ex)
@@ -47,55 +48,60 @@ XBT_PUBLIC(char*) bprintf   (const char*fmt, ...) _XBT_GNUC_PRINTF(1,2);
 
 #if defined(__GNUC__) || defined(DOXYGEN)
 /** @brief Like strdup, but xbt_die() on error */
-static XBT_INLINE char *xbt_strdup(const char *s) {
+     static XBT_INLINE char *xbt_strdup(const char *s)
+{
   char *res = NULL;
   if (s) {
-    res=strdup(s);
+    res = strdup(s);
     if (!res)
       xbt_die("memory allocation error (strdup returned NULL)");
   }
   return res;
 }
+
 extern void xbt_backtrace_display_current(void);
 
 /** @brief Like malloc, but xbt_die() on error
     @hideinitializer */
-static XBT_INLINE void *xbt_malloc(unsigned int n){
+static XBT_INLINE void *xbt_malloc(unsigned int n)
+{
   void *res;
 /*  if (n==0) {
      xbt_backtrace_display_current();
      xbt_die("malloc(0) is not portable");
   }*/
 
-  res=malloc(n);
+  res = malloc(n);
   if (!res)
-     xbt_die(bprintf("Memory allocation of %d bytes failed",n));
+    xbt_die(bprintf("Memory allocation of %d bytes failed", n));
   return res;
 }
 
 /** @brief like malloc, but xbt_die() on error and memset data to 0
     @hideinitializer */
-static XBT_INLINE void *xbt_malloc0(unsigned int n) {
+static XBT_INLINE void *xbt_malloc0(unsigned int n)
+{
   void *res;
   //if (n==0) xbt_die("calloc(0) is not portable");
-  res=calloc(n,1);
+  res = calloc(n, 1);
   if (!res)
-     xbt_die(bprintf("Memory callocation of %d bytes failed",n));
+    xbt_die(bprintf("Memory callocation of %d bytes failed", n));
   return res;
 }
 
 /** @brief like realloc, but xbt_die() on error
     @hideinitializer */
-static XBT_INLINE void *xbt_realloc(void*p,unsigned int s){
-  void *res=res;
+static XBT_INLINE void *xbt_realloc(void *p, unsigned int s)
+{
+  void *res = res;
   //if (s==0) xbt_die("realloc(0) is not portable");
   if (s) {
     if (p) {
-      res=realloc(p,s);
+      res = realloc(p, s);
       if (!res)
-       xbt_die(bprintf("memory (re)allocation of %d bytes failed",s));
+        xbt_die(bprintf("memory (re)allocation of %d bytes failed", s));
     } else {
-      res=xbt_malloc(s);
+      res = xbt_malloc(s);
     }
   } else {
     if (p) {
@@ -113,11 +119,11 @@ static XBT_INLINE void *xbt_realloc(void*p,unsigned int s){
 
 /** @brief like free
     @hideinitializer */
-#define xbt_free free /*nothing specific to do here. A poor valgrind replacement?*/
+#define xbt_free free           /*nothing specific to do here. A poor valgrind replacement? */
 /*#define xbt_free_fct free * replacement with the guareenty of being a function  FIXME:KILLME*/
 
 /** @brief like free, but you can be sure that it is a function  */
-XBT_PUBLIC(void) xbt_free_f(voidp);
+XBT_PUBLIC(void) xbt_free_f(void *p);
 /** @brief should be given a pointer to pointer, and frees the second one */
 XBT_PUBLIC(void) xbt_free_ref(void *d);
 
@@ -132,5 +138,4 @@ XBT_PUBLIC(void) xbt_free_ref(void *d);
 
 
 SG_END_DECL()
-
 #endif /* _XBT_SYSDEP_H */
index ba74316..9f02570 100644 (file)
@@ -6,7 +6,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 
 SG_BEGIN_DECL()
 
@@ -14,7 +14,6 @@ SG_BEGIN_DECL()
  *
  * Time management functions, returns the system time or sleeps a process. They work both on the simulated and real systems(GRAS). 
  */
-
 XBT_PUBLIC(double) xbt_time(void);
 XBT_PUBLIC(void) xbt_sleep(double sec);
 
index d1a0fec..067377e 100644 (file)
 
 SG_BEGIN_DECL()
 
-     /* Get the PID of the current process */
-     XBT_PUBLIC_DATA(int_f_void_t) xbt_getpid;
+  /* Get the PID of the current process */
+  XBT_PUBLIC_DATA(int_f_void_t) xbt_getpid;
 
 SG_END_DECL()
-
 #endif /* __XBT_VIRTU_H__ */
index f8ea7b7..a5a9b1a 100644 (file)
@@ -13,7 +13,7 @@
 #include "amok/Bandwidth/bandwidth_private.h"
 #include "gras/messages.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw,amok,"Bandwidth testing");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw, amok, "Bandwidth testing");
 
 
 /******************************
@@ -23,13 +23,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw,amok,"Bandwidth testing");
 static short _amok_bw_initialized = 0;
 
 /** @brief module initialization; all participating nodes must run this */
-void amok_bw_init(void) {
+void amok_bw_init(void)
+{
 
-  if (! _amok_bw_initialized) {
+  if (!_amok_bw_initialized) {
     amok_bw_bw_init();
     amok_bw_sat_init();
   }
-   
+
   amok_bw_bw_join();
   amok_bw_sat_join();
 
@@ -37,10 +38,11 @@ void amok_bw_init(void) {
 }
 
 /** @brief module finalization */
-void amok_bw_exit(void) {
-  if (! _amok_bw_initialized)
+void amok_bw_exit(void)
+{
+  if (!_amok_bw_initialized)
     return;
-   
+
   amok_bw_bw_leave();
   amok_bw_sat_leave();
 
@@ -53,45 +55,53 @@ void amok_bw_exit(void) {
 static int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload);
 static int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx, void *payload);
 
-void amok_bw_bw_init() {
+void amok_bw_bw_init()
+{
   gras_datadesc_type_t bw_request_desc, bw_res_desc;
 
-  /* Build the Bandwidth datatype descriptions */ 
+  /* Build the Bandwidth datatype descriptions */
   bw_request_desc = gras_datadesc_struct("s_bw_request_t");
-  gras_datadesc_struct_append(bw_request_desc,"peer",
-                             gras_datadesc_by_name("s_xbt_peer_t"));
-  gras_datadesc_struct_append(bw_request_desc,"buf_size",
-                             gras_datadesc_by_name("unsigned long int"));
-  gras_datadesc_struct_append(bw_request_desc,"msg_size",
-                             gras_datadesc_by_name("unsigned long int"));
-  gras_datadesc_struct_append(bw_request_desc,"msg_amount",
-                             gras_datadesc_by_name("unsigned long int"));
-  gras_datadesc_struct_append(bw_request_desc,"min_duration",
-                             gras_datadesc_by_name("double"));
+  gras_datadesc_struct_append(bw_request_desc, "peer",
+                              gras_datadesc_by_name("s_xbt_peer_t"));
+  gras_datadesc_struct_append(bw_request_desc, "buf_size",
+                              gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(bw_request_desc, "msg_size",
+                              gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(bw_request_desc, "msg_amount",
+                              gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(bw_request_desc, "min_duration",
+                              gras_datadesc_by_name("double"));
   gras_datadesc_struct_close(bw_request_desc);
-  bw_request_desc = gras_datadesc_ref("bw_request_t",bw_request_desc);
-  
+  bw_request_desc = gras_datadesc_ref("bw_request_t", bw_request_desc);
+
   bw_res_desc = gras_datadesc_struct("s_bw_res_t");
-  gras_datadesc_struct_append(bw_res_desc,"timestamp",gras_datadesc_by_name("unsigned int"));
-  gras_datadesc_struct_append(bw_res_desc,"seconds",gras_datadesc_by_name("double"));
-  gras_datadesc_struct_append(bw_res_desc,"bw",gras_datadesc_by_name("double"));
+  gras_datadesc_struct_append(bw_res_desc, "timestamp",
+                              gras_datadesc_by_name("unsigned int"));
+  gras_datadesc_struct_append(bw_res_desc, "seconds",
+                              gras_datadesc_by_name("double"));
+  gras_datadesc_struct_append(bw_res_desc, "bw",
+                              gras_datadesc_by_name("double"));
   gras_datadesc_struct_close(bw_res_desc);
-  bw_res_desc = gras_datadesc_ref("bw_res_t",bw_res_desc);
-  
-  gras_msgtype_declare_rpc("BW handshake",bw_request_desc,bw_request_desc);
+  bw_res_desc = gras_datadesc_ref("bw_res_t", bw_res_desc);
+
+  gras_msgtype_declare_rpc("BW handshake", bw_request_desc, bw_request_desc);
 
-  gras_msgtype_declare_rpc("BW reask",bw_request_desc,NULL);
+  gras_msgtype_declare_rpc("BW reask", bw_request_desc, NULL);
   gras_msgtype_declare("BW stop", NULL);
 
-  gras_msgtype_declare_rpc("BW request",  bw_request_desc,bw_res_desc);
+  gras_msgtype_declare_rpc("BW request", bw_request_desc, bw_res_desc);
 }
-void amok_bw_bw_join() {
-  gras_cb_register("BW request",  &amok_bw_cb_bw_request);
-  gras_cb_register("BW handshake",&amok_bw_cb_bw_handshake);
+
+void amok_bw_bw_join()
+{
+  gras_cb_register("BW request", &amok_bw_cb_bw_request);
+  gras_cb_register("BW handshake", &amok_bw_cb_bw_handshake);
 }
-void amok_bw_bw_leave() {
-  gras_cb_unregister("BW request",  &amok_bw_cb_bw_request);
-  gras_cb_unregister("BW handshake",&amok_bw_cb_bw_handshake);
+
+void amok_bw_bw_leave()
+{
+  gras_cb_unregister("BW request", &amok_bw_cb_bw_request);
+  gras_cb_unregister("BW handshake", &amok_bw_cb_bw_handshake);
 }
 
 /**
@@ -126,105 +136,114 @@ void amok_bw_bw_leave() {
  * 
  */
 void amok_bw_test(gras_socket_t peer,
-                 unsigned long int buf_size,
-                 unsigned long int msg_size,
-                 unsigned long int msg_amount,
-                 double min_duration,
-         /*OUT*/ double *sec, double *bw) {
+                  unsigned long int buf_size,
+                  unsigned long int msg_size,
+                  unsigned long int msg_amount,
+                  double min_duration, /*OUT*/ double *sec, double *bw)
+{
 
   /* Measurement sockets for the experiments */
-  gras_socket_t measMasterIn=NULL,measIn,measOut=NULL;
+  gras_socket_t measMasterIn = NULL, measIn, measOut = NULL;
   int port;
-  bw_request_t request,request_ack;
+  bw_request_t request, request_ack;
   xbt_ex_t e;
-  int first_pass; 
-  
+  int first_pass;
+
   for (port = 5000; port < 10000 && measMasterIn == NULL; port++) {
     TRY {
-      measMasterIn = gras_socket_server_ext(++port,buf_size,1);
-    } CATCH(e) {
+      measMasterIn = gras_socket_server_ext(++port, buf_size, 1);
+    }
+    CATCH(e) {
       measMasterIn = NULL;
-      if (port == 10000 -1) {
-       RETHROW0("Error caught while opening a measurement socket: %s");
+      if (port == 10000 - 1) {
+        RETHROW0("Error caught while opening a measurement socket: %s");
       } else {
-       xbt_ex_free(e); 
+        xbt_ex_free(e);
       }
     }
   }
-  
-  request=xbt_new0(s_bw_request_t,1);
-  request->buf_size=buf_size;
-  request->msg_size=msg_size;
-  request->msg_amount=msg_amount;
+
+  request = xbt_new0(s_bw_request_t, 1);
+  request->buf_size = buf_size;
+  request->msg_size = msg_size;
+  request->msg_amount = msg_amount;
   request->peer.name = NULL;
   request->peer.port = gras_socket_my_port(measMasterIn);
-  DEBUG6("Handshaking with %s:%d to connect it back on my %d (bufsize=%ld, msg_size=%ld, msg_amount=%ld)", 
-       gras_socket_peer_name(peer),gras_socket_peer_port(peer), request->peer.port,
-       request->buf_size,request->msg_size,request->msg_amount);
+  DEBUG6
+    ("Handshaking with %s:%d to connect it back on my %d (bufsize=%ld, msg_size=%ld, msg_amount=%ld)",
+     gras_socket_peer_name(peer), gras_socket_peer_port(peer),
+     request->peer.port, request->buf_size, request->msg_size,
+     request->msg_amount);
 
   TRY {
-    gras_msg_rpccall(peer,15,"BW handshake",&request, &request_ack);
-  } CATCH(e) {
+    gras_msg_rpccall(peer, 15, "BW handshake", &request, &request_ack);
+  }
+  CATCH(e) {
     RETHROW0("Error encountered while sending the BW request: %s");
   }
   measIn = gras_socket_meas_accept(measMasterIn);
-   
+
   TRY {
-    measOut=gras_socket_client_ext(gras_socket_peer_name(peer),
-                                  request_ack->peer.port, 
-                                  request->buf_size,1);
-  } CATCH(e) {
-    RETHROW2("Error encountered while opening the measurement socket to %s:%d for BW test: %s",
-            gras_socket_peer_name(peer),request_ack->peer.port);
+    measOut = gras_socket_client_ext(gras_socket_peer_name(peer),
+                                     request_ack->peer.port,
+                                     request->buf_size, 1);
+  }
+  CATCH(e) {
+    RETHROW2
+      ("Error encountered while opening the measurement socket to %s:%d for BW test: %s",
+       gras_socket_peer_name(peer), request_ack->peer.port);
   }
   DEBUG2("Got ACK; conduct the experiment (msg_size = %ld, msg_amount=%ld)",
-        request->msg_size, request->msg_amount);
+         request->msg_size, request->msg_amount);
 
   *sec = 0;
   first_pass = 1;
   do {
     if (first_pass == 0) {
-      double meas_duration=*sec;
+      double meas_duration = *sec;
       double increase;
-      if (*sec != 0.0 ) {
-        increase = (min_duration / meas_duration) * 1.1;
+      if (*sec != 0.0) {
+        increase = (min_duration / meas_duration) * 1.1;
       } else {
-        increase = 4; 
+        increase = 4;
       }
-      /* Do not increase the exp size too fast since our decision would be based on wrong measurements*/
+      /* Do not increase the exp size too fast since our decision would be based on wrong measurements */
       if (increase > 20)
-        increase = 20; 
-           
+        increase = 20;
+
       request->msg_size = request->msg_size * increase;
 
       /* Do not do too large experiments messages or the sensors 
-        will start to swap to store one of them.
-        And then increase the number of messages to compensate (check for overflow there, too) */
-      if (request->msg_size > 64*1024*1024) {
-        unsigned long int new_amount = ( (request->msg_size / ((double)64*1024*1024)) 
-                                         * request->msg_amount ) + 1;
-       
-        xbt_assert0(new_amount > request->msg_amount,
-                    "Overflow on the number of messages! You must have a *really* fat pipe. Please fix your platform");
-        request->msg_amount = new_amount;
-        
-        request->msg_size = 64*1024*1024;
+         will start to swap to store one of them.
+         And then increase the number of messages to compensate (check for overflow there, too) */
+      if (request->msg_size > 64 * 1024 * 1024) {
+        unsigned long int new_amount =
+          ((request->msg_size / ((double) 64 * 1024 * 1024))
+           * request->msg_amount) + 1;
+
+        xbt_assert0(new_amount > request->msg_amount,
+                    "Overflow on the number of messages! You must have a *really* fat pipe. Please fix your platform");
+        request->msg_amount = new_amount;
+
+        request->msg_size = 64 * 1024 * 1024;
       }
 
-      VERB5("The experiment was too short (%f sec<%f sec). Redo it with msg_size=%lu (nb_messages=%lu) (got %fMb/s)",
-           meas_duration, min_duration, 
-           request->msg_size, request->msg_amount,
-           ((double)request->msg_size) * ((double)request->msg_amount / (*sec) /1024.0/1024.0));
+      VERB5
+        ("The experiment was too short (%f sec<%f sec). Redo it with msg_size=%lu (nb_messages=%lu) (got %fMb/s)",
+         meas_duration, min_duration, request->msg_size, request->msg_amount,
+         ((double) request->msg_size) * ((double) request->msg_amount /
+                                         (*sec) / 1024.0 / 1024.0));
 
-      gras_msg_rpccall(peer, 60, "BW reask",&request, NULL);      
+      gras_msg_rpccall(peer, 60, "BW reask", &request, NULL);
     }
 
     first_pass = 0;
-    *sec=gras_os_time();
+    *sec = gras_os_time();
     TRY {
-      gras_socket_meas_send(measOut,120,request->msg_size,request->msg_amount);
+      gras_socket_meas_send(measOut, 120, request->msg_size,
+                            request->msg_amount);
       DEBUG0("Data sent. Wait ACK");
-      gras_socket_meas_recv(measIn,120,1,1);
+      gras_socket_meas_recv(measIn, 120, 1, 1);
     } CATCH(e) {
       gras_socket_close(measOut);
       gras_socket_close(measMasterIn);
@@ -232,8 +251,10 @@ void amok_bw_test(gras_socket_t peer,
       RETHROW0("Unable to conduct the experiment: %s");
     }
     *sec = gras_os_time() - *sec;
-    if (*sec != 0.0) { 
-       *bw = ((double)request->msg_size) * ((double)request->msg_amount) / (*sec);
+    if (*sec != 0.0) {
+      *bw =
+        ((double) request->msg_size) * ((double) request->msg_amount) /
+        (*sec);
     }
     DEBUG1("Experiment done ; it took %f sec", *sec);
     if (*sec <= 0) {
@@ -243,8 +264,8 @@ void amok_bw_test(gras_socket_t peer,
   } while (*sec < min_duration);
 
   DEBUG2("This measurement was long enough (%f sec; found %f b/s). Stop peer",
-        *sec,*bw);
-  gras_msg_send(peer, "BW stop", NULL);      
+         *sec, *bw);
+  gras_msg_send(peer, "BW stop", NULL);
 
   free(request_ack);
   free(request);
@@ -263,46 +284,50 @@ void amok_bw_test(gras_socket_t peer,
 
    sizes are in byte
 */
-int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
-                           void          *payload) {
+int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
+{
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
-  gras_socket_t measMasterIn=NULL,measIn=NULL,measOut=NULL;
-  bw_request_t request=*(bw_request_t*)payload;
+  gras_socket_t measMasterIn = NULL, measIn = NULL, measOut = NULL;
+  bw_request_t request = *(bw_request_t *) payload;
   bw_request_t answer;
   xbt_ex_t e;
   int port;
   int tooshort = 1;
   gras_msg_cb_ctx_t ctx_reask;
-  static xbt_dynar_t msgtwaited=NULL;
-  
-  DEBUG5("Handshaked to connect to %s:%d (sizes: buf=%lu msg=%lu msg_amount=%lu)",
-       gras_socket_peer_name(expeditor),request->peer.port,
-       request->buf_size,request->msg_size, request->msg_amount);     
+  static xbt_dynar_t msgtwaited = NULL;
+
+  DEBUG5
+    ("Handshaked to connect to %s:%d (sizes: buf=%lu msg=%lu msg_amount=%lu)",
+     gras_socket_peer_name(expeditor), request->peer.port, request->buf_size,
+     request->msg_size, request->msg_amount);
 
   /* Build our answer */
-  answer = xbt_new0(s_bw_request_t,1);
-  
+  answer = xbt_new0(s_bw_request_t, 1);
+
   for (port = 6000; port <= 10000 && measMasterIn == NULL; port++) {
     TRY {
-      measMasterIn = gras_socket_server_ext(port,request->buf_size,1);
-    } CATCH(e) {
+      measMasterIn = gras_socket_server_ext(port, request->buf_size, 1);
+    }
+    CATCH(e) {
       measMasterIn = NULL;
       if (port < 10000)
-       xbt_ex_free(e);
+        xbt_ex_free(e);
       else
-       /* FIXME: tell error to remote */
-       RETHROW0("Error encountered while opening a measurement server socket: %s");
+        /* FIXME: tell error to remote */
+        RETHROW0
+          ("Error encountered while opening a measurement server socket: %s");
     }
   }
-   
-  answer->buf_size=request->buf_size;
-  answer->msg_size=request->msg_size;
-  answer->msg_amount=request->msg_amount;
-  answer->peer.port=gras_socket_my_port(measMasterIn);
+
+  answer->buf_size = request->buf_size;
+  answer->msg_size = request->msg_size;
+  answer->msg_amount = request->msg_amount;
+  answer->peer.port = gras_socket_my_port(measMasterIn);
 
   TRY {
-    gras_msg_rpcreturn(60,ctx,&answer);
-  } CATCH(e) { 
+    gras_msg_rpcreturn(60, ctx, &answer);
+  }
+  CATCH(e) {
     gras_socket_close(measMasterIn);
     /* FIXME: tell error to remote */
     RETHROW0("Error encountered while sending the answer: %s");
@@ -312,19 +337,24 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
   /* Don't connect asap to leave time to other side to enter the accept() */
   TRY {
     measOut = gras_socket_client_ext(gras_socket_peer_name(expeditor),
-                                    request->peer.port,
-                                    request->buf_size,1);
-  } CATCH(e) {
-    RETHROW2("Error encountered while opening a measurement socket back to %s:%d : %s", 
-            gras_socket_peer_name(expeditor),request->peer.port);
+                                     request->peer.port,
+                                     request->buf_size, 1);
+  }
+  CATCH(e) {
+    RETHROW2
+      ("Error encountered while opening a measurement socket back to %s:%d : %s",
+       gras_socket_peer_name(expeditor), request->peer.port);
     /* FIXME: tell error to remote */
   }
 
   TRY {
     measIn = gras_socket_meas_accept(measMasterIn);
-    DEBUG4("BW handshake answered. buf_size=%lu msg_size=%lu msg_amount=%lu port=%d",
-          answer->buf_size,answer->msg_size,answer->msg_amount, answer->peer.port);
-  } CATCH(e) {
+    DEBUG4
+      ("BW handshake answered. buf_size=%lu msg_size=%lu msg_amount=%lu port=%d",
+       answer->buf_size, answer->msg_size, answer->msg_amount,
+       answer->peer.port);
+  }
+  CATCH(e) {
     gras_socket_close(measMasterIn);
     gras_socket_close(measIn);
     gras_socket_close(measOut);
@@ -333,17 +363,18 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
   }
 
   if (!msgtwaited) {
-    msgtwaited = xbt_dynar_new(sizeof(gras_msgtype_t),NULL);
-    xbt_dynar_push(msgtwaited,gras_msgtype_by_name("BW stop"));
-    xbt_dynar_push(msgtwaited,gras_msgtype_by_name("BW reask"));
+    msgtwaited = xbt_dynar_new(sizeof(gras_msgtype_t), NULL);
+    xbt_dynar_push(msgtwaited, gras_msgtype_by_name("BW stop"));
+    xbt_dynar_push(msgtwaited, gras_msgtype_by_name("BW reask"));
   }
 
   while (tooshort) {
     void *payload;
     int msggot;
     TRY {
-      gras_socket_meas_recv(measIn, 120,request->msg_size,request->msg_amount);
-      gras_socket_meas_send(measOut,120,1,1);
+      gras_socket_meas_recv(measIn, 120, request->msg_size,
+                            request->msg_amount);
+      gras_socket_meas_send(measOut, 120, 1, 1);
     } CATCH(e) {
       gras_socket_close(measMasterIn);
       gras_socket_close(measIn);
@@ -351,17 +382,17 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
       /* FIXME: tell error to remote ? */
       RETHROW0("Error encountered while receiving the experiment: %s");
     }
-    gras_msg_wait_or(60,msgtwaited,&ctx_reask,&msggot,&payload);
-    switch(msggot) {
-    case 0: /* BW stop */
+    gras_msg_wait_or(60, msgtwaited, &ctx_reask, &msggot, &payload);
+    switch (msggot) {
+    case 0:                    /* BW stop */
       tooshort = 0;
       break;
-    case 1: /* BW reask */
+    case 1:                    /* BW reask */
       tooshort = 1;
       free(request);
-      request = (bw_request_t)payload;
+      request = (bw_request_t) payload;
       VERB0("Return the reasking RPC");
-      gras_msg_rpcreturn(60,ctx_reask,NULL);
+      gras_msg_rpcreturn(60, ctx_reask, NULL);
     }
     gras_msg_cb_ctx_free(ctx_reask);
   }
@@ -401,78 +432,77 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t  ctx,
  * 
  * Results are reported in last args, and sizes are in bytes.
  */
-void amok_bw_request(const char* from_name,unsigned int from_port,
-                    const char* to_name,unsigned int to_port,
-                    unsigned long int buf_size,
-                    unsigned long int msg_size,
-                    unsigned long int msg_amount,
-                    double min_duration,
-            /*OUT*/ double *sec, double*bw) {
-  
+void amok_bw_request(const char *from_name, unsigned int from_port,
+                     const char *to_name, unsigned int to_port,
+                     unsigned long int buf_size,
+                     unsigned long int msg_size,
+                     unsigned long int msg_amount,
+                     double min_duration, /*OUT*/ double *sec, double *bw)
+{
+
   gras_socket_t sock;
   /* The request */
   bw_request_t request;
   bw_res_t result;
-  request=xbt_new0(s_bw_request_t,1);
-  request->buf_size=buf_size;
-  request->msg_size=msg_size;
-  request->msg_amount=msg_amount;
+  request = xbt_new0(s_bw_request_t, 1);
+  request->buf_size = buf_size;
+  request->msg_size = msg_size;
+  request->msg_amount = msg_amount;
   request->min_duration = min_duration;
 
 
-  request->peer.name = (char*)to_name;
+  request->peer.name = (char *) to_name;
   request->peer.port = to_port;
 
 
-  sock = gras_socket_client(from_name,from_port);
-    
-  DEBUG4("Ask for a BW test between %s:%d and %s:%d",  from_name,from_port, to_name,to_port);
-  gras_msg_rpccall(sock,20*60,"BW request", &request, &result);
+  sock = gras_socket_client(from_name, from_port);
+
+
+
+  DEBUG4("Ask for a BW test between %s:%d and %s:%d", from_name, from_port,
+         to_name, to_port);
+  gras_msg_rpccall(sock, 20 * 60, "BW request", &request, &result);
 
   if (sec)
-    *sec=result->sec;
+    *sec = result->sec;
   if (bw)
-    *bw =result->bw;
+    *bw = result->bw;
 
   VERB6("BW test (%s:%d -> %s:%d) took %f sec (%f kb/s)",
-       from_name,from_port, to_name,to_port,
-       result->sec,((double)result->bw)/1024.0);
+        from_name, from_port, to_name, to_port,
+        result->sec, ((double) result->bw) / 1024.0);
 
   gras_socket_close(sock);
   free(result);
   free(request);
 }
 
-int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx,
-                         void            *payload) {
-                         
+int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx, void *payload)
+{
+
   /* specification of the test to run, and our answer */
-  bw_request_t request = *(bw_request_t*)payload;
-  bw_res_t result = xbt_new0(s_bw_res_t,1);
-  gras_socket_t peer,asker;
+  bw_request_t request = *(bw_request_t *) payload;
+  bw_res_t result = xbt_new0(s_bw_res_t, 1);
+  gras_socket_t peer, asker;
 
-  asker=gras_msg_cb_ctx_from(ctx);
+  asker = gras_msg_cb_ctx_from(ctx);
   VERB6("Asked by %s:%d to conduct a bw XP with %s:%d (request: %ld %ld)",
-       gras_socket_peer_name(asker),gras_socket_peer_port(asker),
-
-       request->peer.name,request->peer.port,
-       request->msg_size,request->msg_amount);
-  peer = gras_socket_client(request->peer.name,request->peer.port);
+        gras_socket_peer_name(asker), gras_socket_peer_port(asker),
+        request->peer.name, request->peer.port,
+        request->msg_size, request->msg_amount);
+  peer = gras_socket_client(request->peer.name, request->peer.port);
   amok_bw_test(peer,
-              request->buf_size,request->msg_size,request->msg_amount,
-              request->min_duration,
-              &(result->sec),&(result->bw));
-  gras_msg_rpcreturn(240,ctx,&result);
+               request->buf_size, request->msg_size, request->msg_amount,
+               request->min_duration, &(result->sec), &(result->bw));
+
+  gras_msg_rpcreturn(240, ctx, &result);
 
   gras_os_sleep(1);
-  gras_socket_close(peer); /* FIXME: it should be blocking in RL until everything is sent */
+  gras_socket_close(peer);      /* FIXME: it should be blocking in RL until everything is sent */
   free(request->peer.name);
   free(request);
   free(result);
-  
+
   return 0;
 }
 
@@ -483,27 +513,28 @@ int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx,
  *           was changed for the fool wanting to send more than MAXINT
  *           bytes in a fat pipe.
  */
-double * amok_bw_matrix(xbt_dynar_t peers,
-                       int buf_size_bw, int msg_size_bw, int msg_amount_bw,
-                       double min_duration) { 
+double *amok_bw_matrix(xbt_dynar_t peers,
+                       int buf_size_bw, int msg_size_bw, int msg_amount_bw,
+                       double min_duration)
+{
   double sec;
   /* construction of matrices for bandwith and latency */
 
 
-  unsigned int i,j;
-  int len=xbt_dynar_length(peers);
+  unsigned int i, j;
+  int len = xbt_dynar_length(peers);
 
-  double *matrix_res = xbt_new0(double, len*len);
-  xbt_peer_t p1,p2;
+  double *matrix_res = xbt_new0(double, len * len);
+  xbt_peer_t p1, p2;
 
-  xbt_dynar_foreach (peers,i,p1) {
-    xbt_dynar_foreach (peers,j,p2) {
-      if (i!=j) {
+  xbt_dynar_foreach(peers, i, p1) {
+    xbt_dynar_foreach(peers, j, p2) {
+      if (i != j) {
         /* Mesurements of Bandwidth */
-        amok_bw_request(p1->name,p1->port,p2->name,p2->port,
-                        buf_size_bw,msg_size_bw,msg_amount_bw,min_duration,
-                       &sec,&matrix_res[i*len + j]);
-      } 
+        amok_bw_request(p1->name, p1->port, p2->name, p2->port,
+                        buf_size_bw, msg_size_bw, msg_amount_bw, min_duration,
+                        &sec, &matrix_res[i * len + j]);
+      }
     }
   }
   return matrix_res;
index 1ddcc24..a580ef3 100644 (file)
 #include "gras.h"
 #include "amok/bandwidth.h"
 
-void amok_bw_bw_init(void); /* Must be called only once per node */
-void amok_bw_bw_join(void); /* Each process must run it */
-void amok_bw_bw_leave(void);/* Each process must run it */
+void amok_bw_bw_init(void);     /* Must be called only once per node */
+void amok_bw_bw_join(void);     /* Each process must run it */
+void amok_bw_bw_leave(void);    /* Each process must run it */
 
-void amok_bw_sat_init(void); /* Must be called only once per node */
-void amok_bw_sat_join(void); /* Each process must run it */
-void amok_bw_sat_leave(void);/* Each process must run it */
+void amok_bw_sat_init(void);    /* Must be called only once per node */
+void amok_bw_sat_join(void);    /* Each process must run it */
+void amok_bw_sat_leave(void);   /* Each process must run it */
 
 /***
  * Plain bandwidth measurement stuff
@@ -33,19 +33,19 @@ void amok_bw_sat_leave(void);/* Each process must run it */
  * If not, it should be between between the receiver and peer (3-tiers).
  */
 typedef struct {
-  s_xbt_peer_t peer; /* peer+raw socket to use */
+  s_xbt_peer_t peer;            /* peer+raw socket to use */
   unsigned long int buf_size;
   unsigned long int msg_size;
   unsigned long int msg_amount;
   double min_duration;
-} s_bw_request_t,*bw_request_t;
+} s_bw_request_t, *bw_request_t;
 
 /* Result of a BW experiment (payload when answering). */
 typedef struct {
   unsigned int timestamp;
   double sec;
   double bw;
-} s_bw_res_t,*bw_res_t;
+} s_bw_res_t, *bw_res_t;
 
 
 /***
@@ -55,13 +55,13 @@ typedef struct {
 /* Description of a saturation experiment (payload asking some peer to collaborate for that)
  */
 typedef struct {
-  s_xbt_peer_t peer; /* peer+raw socket to use */
+  s_xbt_peer_t peer;            /* peer+raw socket to use */
   unsigned int msg_size;
   unsigned int duration;
-} s_sat_request_t,*sat_request_t;
+} s_sat_request_t, *sat_request_t;
 
-void amok_bw_sat_start(const char* from_name,unsigned int from_port,
-                                  const char* to_name,unsigned int to_port,
-                                  unsigned int msg_size, unsigned int duration);
+void amok_bw_sat_start(const char *from_name, unsigned int from_port,
+                       const char *to_name, unsigned int to_port,
+                       unsigned int msg_size, unsigned int duration);
 
 #endif /* AMOK_BANDWIDTH_PRIVATE_H */
index fe15223..2cbcec3 100644 (file)
@@ -8,38 +8,48 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "amok/Bandwidth/bandwidth_private.h"
-#include "gras/Msg/msg_private.h" /* FIXME: This mucks with contextes to answer RPC directly */
+#include "gras/Msg/msg_private.h"       /* FIXME: This mucks with contextes to answer RPC directly */
 #include "xbt/ex.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw_sat,amok_bw,"Everything concerning the SATuration part of the amok_bw module");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_bw_sat, amok_bw,
+                                "Everything concerning the SATuration part of the amok_bw module");
 
 static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload);
 static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload);
 
 
-void amok_bw_sat_init(void) {
-  gras_datadesc_type_t bw_res_desc=gras_datadesc_by_name("bw_res_t");
+void amok_bw_sat_init(void)
+{
+  gras_datadesc_type_t bw_res_desc = gras_datadesc_by_name("bw_res_t");
   gras_datadesc_type_t sat_request_desc;
-  /* Build the saturation datatype descriptions */ 
-  
+  /* Build the saturation datatype descriptions */
+
   sat_request_desc = gras_datadesc_struct("s_sat_request_desc_t");
-  gras_datadesc_struct_append(sat_request_desc,"peer",gras_datadesc_by_name("s_xbt_peer_t"));
-  gras_datadesc_struct_append(sat_request_desc,"msg_size",gras_datadesc_by_name("unsigned int"));
-  gras_datadesc_struct_append(sat_request_desc,"duration",gras_datadesc_by_name("unsigned int"));
+  gras_datadesc_struct_append(sat_request_desc, "peer",
+                              gras_datadesc_by_name("s_xbt_peer_t"));
+  gras_datadesc_struct_append(sat_request_desc, "msg_size",
+                              gras_datadesc_by_name("unsigned int"));
+  gras_datadesc_struct_append(sat_request_desc, "duration",
+                              gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_close(sat_request_desc);
-  sat_request_desc = gras_datadesc_ref("sat_request_t",sat_request_desc);
-  
+  sat_request_desc = gras_datadesc_ref("sat_request_t", sat_request_desc);
+
   /* Register the saturation messages */
   gras_msgtype_declare_rpc("amok_bw_sat start", sat_request_desc, NULL);
-  gras_msgtype_declare_rpc("amok_bw_sat begin", sat_request_desc, sat_request_desc);
-  gras_msgtype_declare_rpc("amok_bw_sat stop",  NULL,             bw_res_desc);
+  gras_msgtype_declare_rpc("amok_bw_sat begin", sat_request_desc,
+                           sat_request_desc);
+  gras_msgtype_declare_rpc("amok_bw_sat stop", NULL, bw_res_desc);
 
 }
-void amok_bw_sat_join(void) {
+
+void amok_bw_sat_join(void)
+{
   gras_cb_register("amok_bw_sat start", &amok_bw_cb_sat_start);
   gras_cb_register("amok_bw_sat begin", &amok_bw_cb_sat_begin);
 }
-void amok_bw_sat_leave(void) {
+
+void amok_bw_sat_leave(void)
+{
   gras_cb_unregister("amok_bw_sat start", &amok_bw_cb_sat_start);
   gras_cb_unregister("amok_bw_sat begin", &amok_bw_cb_sat_begin);
 }
@@ -63,44 +73,44 @@ void amok_bw_sat_leave(void) {
  * Ask the process 'from_name:from_port' to start to saturate the link between itself
  * and to_name:to_name.
  */
-void amok_bw_saturate_start(const char* from_name,unsigned int from_port,
-                           const char* to_name,unsigned int to_port,
-                           unsigned int msg_size, double duration) {
+void amok_bw_saturate_start(const char *from_name, unsigned int from_port,
+                            const char *to_name, unsigned int to_port,
+                            unsigned int msg_size, double duration)
+{
   gras_socket_t sock;
-  sat_request_t request = xbt_new(s_sat_request_t,1);
+  sat_request_t request = xbt_new(s_sat_request_t, 1);
 
   VERB4("Start from_name %s:%d -> to_name %s:%d",
-       from_name, from_port, to_name, to_port);
-  sock = gras_socket_client(from_name,from_port);
+        from_name, from_port, to_name, to_port);
+  sock = gras_socket_client(from_name, from_port);
 
-  request->peer.name = (char*)to_name;
+  request->peer.name = (char *) to_name;
   request->peer.port = to_port;
-  
-  request->duration=duration;
-  request->msg_size=msg_size;
 
-  gras_msg_rpccall(sock,60,"amok_bw_sat start",&request, NULL);
+  request->duration = duration;
+  request->msg_size = msg_size;
+
+  gras_msg_rpccall(sock, 60, "amok_bw_sat start", &request, NULL);
 
   free(request);
   gras_socket_close(sock);
 }
 
 /* Asked to begin a saturation */
-static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload){
-  sat_request_t request = *(sat_request_t*)payload;
+static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  sat_request_t request = *(sat_request_t *) payload;
   gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+
   VERB4("Asked by %s:%d to start a saturation to %s:%d",
-       gras_socket_peer_name(expeditor),gras_socket_peer_port(expeditor),
-       request->peer.name,request->peer.port);
-       
-  gras_msg_rpcreturn(60,ctx, NULL);
+        gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
+        request->peer.name, request->peer.port);
+
+  gras_msg_rpcreturn(60, ctx, NULL);
 
-  amok_bw_saturate_begin(request->peer.name,request->peer.port,
+  amok_bw_saturate_begin(request->peer.name, request->peer.port,
+                         request->msg_size, request->duration, NULL, NULL);
 
-                        request->msg_size, request->duration,
-                        NULL,NULL);
   free(request->peer.name);
 
   free(request);
@@ -119,10 +129,11 @@ static int amok_bw_cb_sat_start(gras_msg_cb_ctx_t ctx, void *payload){
  * If msg_size=0, the size will be automatically computed to make sure that
  * each of the messages occupy the connexion one second
  */
-void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
-                           unsigned int msg_size, double duration,
-                           /*out*/ double *elapsed_res, double *bw_res) {
+void amok_bw_saturate_begin(const char *to_name, unsigned int to_port,
+                            unsigned int msg_size, double duration,
+                            /*out */ double *elapsed_res, double *bw_res)
+{
+
   xbt_ex_t e;
 
   gras_socket_t peer_cmd = gras_socket_client(to_name, to_port);
@@ -132,17 +143,17 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
 
   s_gras_msg_t msg_got;
 
-  unsigned int packet_sent=0;
-  double start,elapsed=-1; /* timer */
+  unsigned int packet_sent = 0;
+  double start, elapsed = -1;   /* timer */
   double bw;
 
-  volatile int saturate_further; /* boolean in the main loop */ 
+  volatile int saturate_further;        /* boolean in the main loop */
 
   /* Negociate the saturation with the peer */
-  sat_request_t request = xbt_new(s_sat_request_t,1);
+  sat_request_t request = xbt_new(s_sat_request_t, 1);
 
-  DEBUG2("Begin to saturate to %s:%d",to_name,to_port);
-  memset(&msg_got,0,sizeof(msg_got));
+  DEBUG2("Begin to saturate to %s:%d", to_name, to_port);
+  memset(&msg_got, 0, sizeof(msg_got));
 
   request->msg_size = msg_size;
   request->duration = duration;
@@ -154,32 +165,32 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
   if (!msg_size) {
     double bw;
     double sec;
-    amok_bw_test(peer_cmd,
-                0, /* check buffsize yourself */
-                512*1024,  /* 512k as first guess */
-                1, /* One packet only */
-                1, /* at least one sec */
-                &sec, &bw);
-    msg_size = request->msg_size = (int)bw;
-    DEBUG1("Saturate with packets of %d bytes",request->msg_size);
+    amok_bw_test(peer_cmd, 0,   /* check buffsize yourself */
+                 512 * 1024,    /* 512k as first guess */
+                 1,             /* One packet only */
+                 1,             /* at least one sec */
+                 &sec, &bw);
+    msg_size = request->msg_size = (int) bw;
+    DEBUG1("Saturate with packets of %d bytes", request->msg_size);
   }
-   
+
   /* Launch the saturation */
 
   ctx = gras_msg_rpc_async_call(peer_cmd, 60, "amok_bw_sat begin", &request);
   free(request);
-  gras_msg_rpc_async_wait(ctx,&request);
-  meas=gras_socket_client_ext( to_name, request->peer.port,
-                              0 /*bufsize: auto*/,
-                              1 /*meas: true*/);
+  gras_msg_rpc_async_wait(ctx, &request);
+  meas = gras_socket_client_ext(to_name, request->peer.port,
+                                0 /*bufsize: auto */ ,
+                                1 /*meas: true */ );
 
   free(request);
 
   gras_socket_close(peer_cmd);
-  INFO4("Saturation(%s:%d->%s:%d) started",gras_os_myname(),gras_os_myport(),to_name,to_port);
+  INFO4("Saturation(%s:%d->%s:%d) started", gras_os_myname(),
+        gras_os_myport(), to_name, to_port);
 
   /* Start experiment */
-  start=gras_os_time();
+  start = gras_os_time();
 
   do {
     /* do send it */
@@ -189,25 +200,27 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
     /* Check whether someone asked us to stop saturation */
     saturate_further = 0;
     TRY {
-      gras_msg_wait_ext(0/*no wait*/,"amok_bw_sat stop",
-                       NULL /* accept any sender */,
-                       NULL, NULL, /* No specific filter */
-                       &msg_got);
-    } CATCH(e) {
+      gras_msg_wait_ext(0 /*no wait */ , "amok_bw_sat stop",
+                        NULL /* accept any sender */ ,
+                        NULL, NULL,     /* No specific filter */
+                        &msg_got);
+    }
+    CATCH(e) {
       if (e.category == timeout_error) {
-       saturate_further=1;
-       memset(&msg_got,0,sizeof(msg_got)); /* may be overprotectiv here */
+        saturate_further = 1;
+        memset(&msg_got, 0, sizeof(msg_got));   /* may be overprotectiv here */
       }
       xbt_ex_free(e);
     }
 
     /* Check whether the experiment has to be terminated by now */
-    elapsed=gras_os_time()-start;
-    DEBUG3("elapsed %f duration %f (msg_size=%d)",elapsed, duration,msg_size);
+    elapsed = gras_os_time() - start;
+    DEBUG3("elapsed %f duration %f (msg_size=%d)", elapsed, duration,
+           msg_size);
 
-  } while (saturate_further && (duration==0 || elapsed < duration));
+  } while (saturate_further && (duration == 0 || elapsed < duration));
 
-  bw = ((double)(packet_sent*msg_size)) / elapsed;
+  bw = ((double) (packet_sent * msg_size)) / elapsed;
 
   if (elapsed_res)
     *elapsed_res = elapsed;
@@ -216,84 +229,92 @@ void amok_bw_saturate_begin(const char* to_name,unsigned int to_port,
 
   /* If someone stopped us, inform him about the achieved bandwidth */
   if (msg_got.expe) {
-    bw_res_t answer = xbt_new(s_bw_res_t,1);
+    bw_res_t answer = xbt_new(s_bw_res_t, 1);
     s_gras_msg_cb_ctx_t ctx;
 
     INFO6("Saturation from %s:%d to %s:%d stopped by %s:%d",
-         gras_os_myname(),gras_os_myport(),to_name,to_port, gras_socket_peer_name(msg_got.expe),gras_socket_peer_port(msg_got.expe));
-    answer->timestamp=gras_os_time();
-    answer->sec=elapsed;
-    answer->bw=bw;
+          gras_os_myname(), gras_os_myport(), to_name, to_port,
+          gras_socket_peer_name(msg_got.expe),
+          gras_socket_peer_port(msg_got.expe));
+    answer->timestamp = gras_os_time();
+    answer->sec = elapsed;
+    answer->bw = bw;
 
     ctx.expeditor = msg_got.expe;
     ctx.ID = msg_got.ID;
     ctx.msgtype = msg_got.type;
 
-    gras_msg_rpcreturn(60,&ctx,&answer);
+    gras_msg_rpcreturn(60, &ctx, &answer);
     free(answer);
   } else {
-    INFO6("Saturation from %s:%d to %s:%d elapsed after %f sec (achieving %f kb/s)",
-         gras_os_myname(),gras_os_myport(),to_name,to_port,elapsed,bw/1024.0);
+    INFO6
+      ("Saturation from %s:%d to %s:%d elapsed after %f sec (achieving %f kb/s)",
+       gras_os_myname(), gras_os_myport(), to_name, to_port, elapsed,
+       bw / 1024.0);
   }
-  
+
   gras_socket_close(meas);
 }
 
 /* Sender will saturate link to us */
-static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){
-  sat_request_t request=*(sat_request_t*)payload;
-  sat_request_t answer=xbt_new0(s_sat_request_t,1);
+static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  sat_request_t request = *(sat_request_t *) payload;
+  sat_request_t answer = xbt_new0(s_sat_request_t, 1);
   volatile int saturate_further = 1;
   xbt_ex_t e;
-  gras_socket_t measMaster=NULL,meas=NULL;
-  gras_socket_t from=gras_msg_cb_ctx_from(ctx);
+  gras_socket_t measMaster = NULL, meas = NULL;
+  gras_socket_t from = gras_msg_cb_ctx_from(ctx);
 
-  int port=6000;
+  int port = 6000;
   while (port <= 10000 && measMaster == NULL) {
     TRY {
-      measMaster = gras_socket_server_ext(port,
-                                         0 /*bufsize: auto*/,
-                                         1 /*meas: true*/);
-    CATCH(e) {
+      measMaster = gras_socket_server_ext(port, 0 /*bufsize: auto */ ,
+                                          1 /*meas: true */ );
+    }
+    CATCH(e) {
       measMaster = NULL;
       if (port < 10000)
-       xbt_ex_free(e);
+        xbt_ex_free(e);
       else
-       RETHROW0("Error encountered while opening a measurement server socket: %s");
+        RETHROW0
+          ("Error encountered while opening a measurement server socket: %s");
     }
-    if (measMaster == NULL) 
-      port++; /* prepare for a new loop */
+    if (measMaster == NULL)
+      port++;                   /* prepare for a new loop */
   }
-  answer->peer.port=port;
+  answer->peer.port = port;
 
   gras_msg_rpcreturn(60, ctx, &answer);
   free(answer);
 
-  gras_os_sleep(5); /* Wait for the accept */
+  gras_os_sleep(5);             /* Wait for the accept */
 
   TRY {
     meas = gras_socket_meas_accept(measMaster);
     DEBUG0("saturation handshake answered");
-  } CATCH(e) {
+  }
+  CATCH(e) {
     gras_socket_close(measMaster);
     RETHROW0("Error during saturation handshake: %s");
-  }  
+  }
 
   while (saturate_further) {
     TRY {
       gras_socket_meas_recv(meas, 5, request->msg_size, 1);
-    } CATCH(e) {
+    }
+    CATCH(e) {
       saturate_further = 0;
       xbt_ex_free(e);
     }
   }
   INFO4("Saturation comming from %s:%d stopped on %s:%d",
-       gras_socket_peer_name(from),gras_socket_peer_port(from),
-       gras_os_myname(),gras_os_myport());
+        gras_socket_peer_name(from), gras_socket_peer_port(from),
+        gras_os_myname(), gras_os_myport());
 
   gras_socket_close(meas);
-  if (gras_if_RL()) /* On SG, accepted=master */
-    gras_socket_close(measMaster); 
+  if (gras_if_RL())             /* On SG, accepted=master */
+    gras_socket_close(measMaster);
   free(request);
   return 0;
 }
@@ -306,20 +327,23 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload){
  * @param bw: the achieved bandwidth
  *
  */
-void amok_bw_saturate_stop(const char* from_name,unsigned int from_port,
-                          /*out*/ double *time, double *bw) {
+void amok_bw_saturate_stop(const char *from_name, unsigned int from_port,
+                           /*out */ double *time, double *bw)
+{
   xbt_ex_t e;
-   
-  gras_socket_t sock = gras_socket_client(from_name,from_port);
+
+  gras_socket_t sock = gras_socket_client(from_name, from_port);
   bw_res_t answer;
-  VERB2("Ask %s:%d to stop the saturation",from_name,from_port);
-  TRY {        
-     gras_msg_rpccall(sock,60,"amok_bw_sat stop",NULL,&answer);
+  VERB2("Ask %s:%d to stop the saturation", from_name, from_port);
+  TRY {
+    gras_msg_rpccall(sock, 60, "amok_bw_sat stop", NULL, &answer);
   } CATCH(e) {
-     RETHROW2("Cannot ask %s:%d to stop saturation: %s",from_name, from_port);
+    RETHROW2("Cannot ask %s:%d to stop saturation: %s", from_name, from_port);
   }
   gras_socket_close(sock);
-  if (time) *time=answer->sec;
-  if (bw)   *bw  =answer->bw;
+  if (time)
+    *time = answer->sec;
+  if (bw)
+    *bw = answer->bw;
   free(answer);
 }
index 9555fb0..022344c 100644 (file)
 #include "amok/peermanagement.h"
 
 #include "amok/amok_modinter.h" /* prototype of my module declaration */
-#include "gras/module.h" /* module mecanism */
+#include "gras/module.h"        /* module mecanism */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_pm,amok,"peer management");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok_pm, amok, "peer management");
 
 
 /* data management */
-int amok_pm_moddata_id=-1;
+int amok_pm_moddata_id = -1;
 typedef struct {
-   int done;
-   xbt_dict_t groups;
+  int done;
+  xbt_dict_t groups;
 } s_amok_pm_moddata_t, *amok_pm_moddata_t;
 
 /* Payload of join message */
 typedef struct {
-   char *group;
-   int rank;
-} s_amok_pm_msg_join_t,*amok_pm_msg_join_t;
+  char *group;
+  int rank;
+} s_amok_pm_msg_join_t, *amok_pm_msg_join_t;
 
 /* Message callbacks */
-static int amok_pm_cb_kill(gras_msg_cb_ctx_t ctx,
-                          void             *payload_data) {
+static int amok_pm_cb_kill(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
 
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
   g->done = 1;
   return 0;
 }
-static int amok_pm_cb_killrpc(gras_msg_cb_ctx_t ctx,
-                             void             *payload_data) {
 
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
+static int amok_pm_cb_killrpc(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
+
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
   g->done = 1;
-  gras_msg_rpcreturn(30,ctx,NULL);
+  gras_msg_rpcreturn(30, ctx, NULL);
   return 0;
 }
 
-static int amok_pm_cb_get(gras_msg_cb_ctx_t ctx, void *payload) {
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
-  char *name = *(void**)payload;
+static int amok_pm_cb_get(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
+  char *name = *(void **) payload;
   xbt_dynar_t res = xbt_dict_get(g->groups, name);
 
   gras_msg_rpcreturn(30, ctx, &res);
   return 0;
 }
-static int amok_pm_cb_join(gras_msg_cb_ctx_t ctx, void *payload) {
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
-  amok_pm_msg_join_t msg = *(amok_pm_msg_join_t*)payload;
+
+static int amok_pm_cb_join(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
+  amok_pm_msg_join_t msg = *(amok_pm_msg_join_t *) payload;
   xbt_dynar_t group = xbt_dict_get(g->groups, msg->group);
-  
+
   gras_socket_t exp = gras_msg_cb_ctx_from(ctx);
   xbt_peer_t dude = xbt_peer_new(gras_socket_peer_name(exp),
-                                gras_socket_peer_port(exp));
+                                 gras_socket_peer_port(exp));
   xbt_peer_t previous = NULL;
-  if (msg->rank >= 0 && xbt_dynar_length(group) >= msg->rank +1)
-     xbt_dynar_get_cpy(group,msg->rank,&previous);
 
-  VERB3("Contacted by %s:%d for rank %d",dude->name,dude->port,msg->rank);
+  if (msg->rank >= 0 && xbt_dynar_length(group) >= msg->rank + 1)
+    xbt_dynar_get_cpy(group, msg->rank, &previous);
+
+  VERB3("Contacted by %s:%d for rank %d", dude->name, dude->port, msg->rank);
   if (msg->rank < 0) {
-    xbt_dynar_push(group,&dude);
-  } else {     
-    if (previous) 
-       THROW4(arg_error,0,"You wanted to get rank %d of group %s, but %s:%d is already there",
-             msg->rank, msg->group, previous->name, previous->port);
-     xbt_dynar_set(group,msg->rank,&dude);
+    xbt_dynar_push(group, &dude);
+  } else {
+    if (previous)
+      THROW4(arg_error, 0,
+             "You wanted to get rank %d of group %s, but %s:%d is already there",
+             msg->rank, msg->group, previous->name, previous->port);
+    xbt_dynar_set(group, msg->rank, &dude);
   }
-   
+
   gras_msg_rpcreturn(10, ctx, NULL);
   free(msg->group);
   free(msg);
   return 0;
 }
-static int amok_pm_cb_leave(gras_msg_cb_ctx_t ctx, void *payload) {
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
-  char *name = *(void**)payload;
+
+static int amok_pm_cb_leave(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
+  char *name = *(void **) payload;
   xbt_dynar_t group = xbt_dict_get(g->groups, name);
-  
+
   gras_socket_t exp = gras_msg_cb_ctx_from(ctx);
   xbt_peer_t dude = xbt_peer_new(gras_socket_peer_name(exp),
-                                gras_socket_peer_port(exp));
+                                 gras_socket_peer_port(exp));
 
   unsigned int cpt;
   xbt_peer_t peer_it;
 
   xbt_dynar_foreach(group, cpt, peer_it) {
-    if (!strcmp(peer_it->name, dude->name) && 
-       peer_it->port == dude->port) {
-      xbt_dynar_cursor_rm (group,&cpt);
+    if (!strcmp(peer_it->name, dude->name) && peer_it->port == dude->port) {
+      xbt_dynar_cursor_rm(group, &cpt);
       goto end;
     }
   }
   WARN3("Asked to remove %s:%d from group '%s', but not found. Ignoring",
-       dude->name,dude->port, name);
+        dude->name, dude->port, name);
 
- end:
+end:
   gras_msg_rpcreturn(30, ctx, NULL);
   return 0;
 }
 
-static int amok_pm_cb_shutdown(gras_msg_cb_ctx_t ctx, void *payload) {
-  char *name = *(void**)payload;
+static int amok_pm_cb_shutdown(gras_msg_cb_ctx_t ctx, void *payload)
+{
+  char *name = *(void **) payload;
   amok_pm_group_shutdown(name);
 
   gras_msg_rpcreturn(30, ctx, NULL);
@@ -119,29 +126,33 @@ static int amok_pm_cb_shutdown(gras_msg_cb_ctx_t ctx, void *payload) {
 }
 
 /** \brief Enter the main loop of the program. It won't return until we get a kill message. */
-void amok_pm_mainloop(double timeOut) {
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
-  
+void amok_pm_mainloop(double timeOut)
+{
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
+
   while (!g->done) {
     gras_msg_handle(timeOut);
   }
 }
 
 /** \brief kill a buddy identified by its peername and port. Note that it is not removed from any group it may belong to. */
-void amok_pm_kill_hp(char *name,int port) {
-  gras_socket_t sock=gras_socket_client(name,port);
+void amok_pm_kill_hp(char *name, int port)
+{
+  gras_socket_t sock = gras_socket_client(name, port);
   amok_pm_kill(sock);
   gras_socket_close(sock);
 }
 
 /** \brief kill a buddy to which we have a socket already. Note that it is not removed from any group it may belong to. */
-void amok_pm_kill(gras_socket_t buddy) {
-  gras_msg_send(buddy,"amok_pm_kill",NULL);
+void amok_pm_kill(gras_socket_t buddy)
+{
+  gras_msg_send(buddy, "amok_pm_kill", NULL);
 }
 
 /** \brief kill syncronously a buddy (do not return before its death). Note that it is not removed from any group it may belong to. */
-void amok_pm_kill_sync(gras_socket_t buddy) {
-  gras_msg_rpccall(buddy,30,"amok_pm_killrpc",NULL,NULL);
+void amok_pm_kill_sync(gras_socket_t buddy)
+{
+  gras_msg_rpccall(buddy, 30, "amok_pm_killrpc", NULL, NULL);
 }
 
 
@@ -149,26 +160,29 @@ void amok_pm_kill_sync(gras_socket_t buddy) {
  *
  * The dynar elements are of type xbt_peer_t
  */
-xbt_dynar_t amok_pm_group_new(const char *group_name) {
+xbt_dynar_t amok_pm_group_new(const char *group_name)
+{
   amok_pm_moddata_t g;
   xbt_dynar_t res = xbt_dynar_new(sizeof(xbt_peer_t),
-                                 xbt_peer_free_voidp);
+                                  xbt_peer_free_voidp);
 
-  xbt_assert0(amok_pm_moddata_id != -1,"Run amok_pm_init first!");
-  g=gras_moddata_by_id(amok_pm_moddata_id);
+  xbt_assert0(amok_pm_moddata_id != -1, "Run amok_pm_init first!");
+  g = gras_moddata_by_id(amok_pm_moddata_id);
 
-  DEBUG1("retrieved groups=%p",g->groups);
-   
-  xbt_dict_set(g->groups,group_name,res,NULL); /*FIXME: leaking xbt_dynar_free_voidp);*/
-  VERB1("Group %s created",group_name);
+  DEBUG1("retrieved groups=%p", g->groups);
+
+  xbt_dict_set(g->groups, group_name, res, NULL);       /*FIXME: leaking xbt_dynar_free_voidp); */
+  VERB1("Group %s created", group_name);
 
   return res;
 }
+
 /** \brief retrieve all members of the given remote group */
-xbt_dynar_t amok_pm_group_get(gras_socket_t master, const char *group_name) {
+xbt_dynar_t amok_pm_group_get(gras_socket_t master, const char *group_name)
+{
   xbt_dynar_t res;
-  
-  gras_msg_rpccall(master,30,"amok_pm_get", &group_name,&res);
+
+  gras_msg_rpccall(master, 30, "amok_pm_get", &group_name, &res);
   return res;
 }
 
@@ -177,32 +191,40 @@ xbt_dynar_t amok_pm_group_get(gras_socket_t master, const char *group_name) {
  * You should provide rank only when you want to force the order of members 
  * (for example in strict test cases). Give -1 to leave the system choose it for you.
  */
-void        amok_pm_group_join(gras_socket_t master, const char *group_name,int rank) {
-  amok_pm_msg_join_t msg = xbt_new(s_amok_pm_msg_join_t,1);
-  msg->group = (char*)group_name;
+void amok_pm_group_join(gras_socket_t master, const char *group_name,
+                        int rank)
+{
+  amok_pm_msg_join_t msg = xbt_new(s_amok_pm_msg_join_t, 1);
+  msg->group = (char *) group_name;
   msg->rank = rank;
   VERB4("Join group '%s' on %s:%d (at rank %d)",
-       group_name,gras_socket_peer_name(master),gras_socket_peer_port(master),rank);
-  gras_msg_rpccall(master,30,"amok_pm_join", &msg,NULL);
+        group_name, gras_socket_peer_name(master),
+        gras_socket_peer_port(master), rank);
+  gras_msg_rpccall(master, 30, "amok_pm_join", &msg, NULL);
   free(msg);
   VERB3("Joined group '%s' on %s:%d",
-       group_name,gras_socket_peer_name(master),gras_socket_peer_port(master));
+        group_name, gras_socket_peer_name(master),
+        gras_socket_peer_port(master));
 }
+
 /** \brief remove current peer from the given remote group if found
  *
  * If not found, call is ignored 
  */
-void        amok_pm_group_leave(gras_socket_t master, const char *group_name) {
-  gras_msg_rpccall(master,30,"amok_pm_leave", &group_name,NULL);
+void amok_pm_group_leave(gras_socket_t master, const char *group_name)
+{
+  gras_msg_rpccall(master, 30, "amok_pm_leave", &group_name, NULL);
   VERB3("Leaved group '%s' on %s:%d",
-       group_name,gras_socket_peer_name(master),gras_socket_peer_port(master));
+        group_name, gras_socket_peer_name(master),
+        gras_socket_peer_port(master));
 }
 
 /** \brief stops all members of the given local group */
-void amok_pm_group_shutdown(const char *group_name) {
-  amok_pm_moddata_t g=gras_moddata_by_id(amok_pm_moddata_id);
+void amok_pm_group_shutdown(const char *group_name)
+{
+  amok_pm_moddata_t g = gras_moddata_by_id(amok_pm_moddata_id);
   xbt_dynar_t group = xbt_dict_get(g->groups, group_name);
-  
+
   unsigned int cpt;
   xbt_peer_t peer_it;
 
@@ -211,11 +233,14 @@ void amok_pm_group_shutdown(const char *group_name) {
   }
 
   xbt_dynar_free(&group);
-  xbt_dict_remove(g->groups,group_name);
+  xbt_dict_remove(g->groups, group_name);
 }
+
 /** \brief stops all members of the given remote group */
-void amok_pm_group_shutdown_remote(gras_socket_t master, const char *group_name){
-  gras_msg_rpccall(master,30,"amok_pm_shutdown", &group_name,NULL);
+void amok_pm_group_shutdown_remote(gras_socket_t master,
+                                   const char *group_name)
+{
+  gras_msg_rpccall(master, 30, "amok_pm_shutdown", &group_name, NULL);
 }
 
 
@@ -227,74 +252,86 @@ void amok_pm_group_shutdown_remote(gras_socket_t master, const char *group_name)
 
 
 
-static void _amok_pm_init(void) {
-   /* no world-wide globals */
-   /* Datatype and message declarations */
-   gras_datadesc_type_t pm_group_type = gras_datadesc_dynar(gras_datadesc_by_name("xbt_peer_t"), xbt_peer_free_voidp);
-   
-   gras_datadesc_type_t msg_join_t = gras_datadesc_struct("s_amok_pm_moddata_t");
-   gras_datadesc_struct_append(msg_join_t,"group", gras_datadesc_by_name("string"));
-   gras_datadesc_struct_append(msg_join_t,"rank", gras_datadesc_by_name("int"));
-   gras_datadesc_struct_close(msg_join_t);
-   msg_join_t=gras_datadesc_ref("amok_pm_moddata_t", gras_datadesc_by_name("s_amok_pm_moddata_t"));
-   
-   gras_msgtype_declare("amok_pm_kill",NULL);   
-   gras_msgtype_declare_rpc("amok_pm_killrpc",NULL,NULL);   
-   
-   gras_msgtype_declare_rpc("amok_pm_get",
-                           gras_datadesc_by_name("string"),
-                           pm_group_type);
-   gras_msgtype_declare_rpc("amok_pm_join", msg_join_t,NULL);
-   gras_msgtype_declare_rpc("amok_pm_leave",
-                           gras_datadesc_by_name("string"),
-                           NULL);
-   
-   gras_msgtype_declare_rpc("amok_pm_shutdown",
-                           gras_datadesc_by_name("string"),
-                           NULL);   
+static void _amok_pm_init(void)
+{
+  /* no world-wide globals */
+  /* Datatype and message declarations */
+  gras_datadesc_type_t pm_group_type =
+    gras_datadesc_dynar(gras_datadesc_by_name("xbt_peer_t"),
+                        xbt_peer_free_voidp);
+
+  gras_datadesc_type_t msg_join_t =
+    gras_datadesc_struct("s_amok_pm_moddata_t");
+  gras_datadesc_struct_append(msg_join_t, "group",
+                              gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(msg_join_t, "rank",
+                              gras_datadesc_by_name("int"));
+  gras_datadesc_struct_close(msg_join_t);
+  msg_join_t =
+    gras_datadesc_ref("amok_pm_moddata_t",
+                      gras_datadesc_by_name("s_amok_pm_moddata_t"));
+
+  gras_msgtype_declare("amok_pm_kill", NULL);
+  gras_msgtype_declare_rpc("amok_pm_killrpc", NULL, NULL);
+
+  gras_msgtype_declare_rpc("amok_pm_get",
+                           gras_datadesc_by_name("string"), pm_group_type);
+  gras_msgtype_declare_rpc("amok_pm_join", msg_join_t, NULL);
+  gras_msgtype_declare_rpc("amok_pm_leave",
+                           gras_datadesc_by_name("string"), NULL);
+
+  gras_msgtype_declare_rpc("amok_pm_shutdown",
+                           gras_datadesc_by_name("string"), NULL);
 }
 
-static void _amok_pm_join(void *p) {
+static void _amok_pm_join(void *p)
+{
   /* moddata management */
-  amok_pm_moddata_t mod = (amok_pm_moddata_t)p;
+  amok_pm_moddata_t mod = (amok_pm_moddata_t) p;
 
   mod->groups = NULL;
-  
+
   mod->done = 0;
   mod->groups = xbt_dict_new();
-  
+
   /* callbacks */
-  gras_cb_register("amok_pm_kill",   &amok_pm_cb_kill);
-  gras_cb_register("amok_pm_killrpc",&amok_pm_cb_killrpc);
+  gras_cb_register("amok_pm_kill", &amok_pm_cb_kill);
+  gras_cb_register("amok_pm_killrpc", &amok_pm_cb_killrpc);
 
-  gras_cb_register("amok_pm_get",      &amok_pm_cb_get);
-  gras_cb_register("amok_pm_join",     &amok_pm_cb_join);
-  gras_cb_register("amok_pm_leave",    &amok_pm_cb_leave);
-  gras_cb_register("amok_pm_shutdown", &amok_pm_cb_shutdown);   
+  gras_cb_register("amok_pm_get", &amok_pm_cb_get);
+  gras_cb_register("amok_pm_join", &amok_pm_cb_join);
+  gras_cb_register("amok_pm_leave", &amok_pm_cb_leave);
+  gras_cb_register("amok_pm_shutdown", &amok_pm_cb_shutdown);
 }
-static void _amok_pm_exit(void) {
+
+static void _amok_pm_exit(void)
+{
   /* no world-wide globals */
 }
-static void _amok_pm_leave(void *p) {
-   /* moddata */
-   amok_pm_moddata_t mod = (amok_pm_moddata_t)p;
-   
-   if (mod->groups)
-     xbt_dict_free(&mod->groups);
-   
-   /* callbacks */
-   gras_cb_unregister("amok_pm_kill",   &amok_pm_cb_kill);
-   gras_cb_unregister("amok_pm_killrpc",&amok_pm_cb_killrpc);
-
-   gras_cb_unregister("amok_pm_get",      &amok_pm_cb_get);
-   gras_cb_unregister("amok_pm_join",     &amok_pm_cb_join);
-   gras_cb_unregister("amok_pm_leave",    &amok_pm_cb_leave);
-   gras_cb_unregister("amok_pm_shutdown", &amok_pm_cb_shutdown);   
+
+static void _amok_pm_leave(void *p)
+{
+  /* moddata */
+  amok_pm_moddata_t mod = (amok_pm_moddata_t) p;
+
+  if (mod->groups)
+    xbt_dict_free(&mod->groups);
+
+  /* callbacks */
+  gras_cb_unregister("amok_pm_kill", &amok_pm_cb_kill);
+  gras_cb_unregister("amok_pm_killrpc", &amok_pm_cb_killrpc);
+
+  gras_cb_unregister("amok_pm_get", &amok_pm_cb_get);
+  gras_cb_unregister("amok_pm_join", &amok_pm_cb_join);
+  gras_cb_unregister("amok_pm_leave", &amok_pm_cb_leave);
+  gras_cb_unregister("amok_pm_shutdown", &amok_pm_cb_shutdown);
 }
 
-void amok_pm_modulecreate() {
+void amok_pm_modulecreate()
+{
   gras_module_add("amok_pm", sizeof(s_amok_pm_moddata_t), &amok_pm_moddata_id,
-                 _amok_pm_init,_amok_pm_exit,_amok_pm_join,_amok_pm_leave);
+                  _amok_pm_init, _amok_pm_exit, _amok_pm_join,
+                  _amok_pm_leave);
 }
 
 
@@ -305,11 +342,13 @@ void amok_pm_modulecreate() {
  * *
  * */
 /** \brief Initialize the peer management module. Every process must run it before use */
-void amok_pm_init() {
+void amok_pm_init()
+{
   gras_module_join("amok_pm");
 }
 
 /** \brief Finalize the peer management module. Every process should run it after use */
-void amok_pm_exit() {
+void amok_pm_exit()
+{
   gras_module_leave("amok_pm");
 }
index 44361c3..80251a0 100644 (file)
 #include "gras.h"
 #include "amok/amok_modinter.h"
 
-XBT_LOG_NEW_SUBCATEGORY(amok,XBT_LOG_ROOT_CAT,"All AMOK categories");
+XBT_LOG_NEW_SUBCATEGORY(amok, XBT_LOG_ROOT_CAT, "All AMOK categories");
 
-void amok_init(void) {
+void amok_init(void)
+{
 
   /* Create all the modules */
   amok_pm_modulecreate();
 }
 
-void amok_exit(void) {
-   /* FIXME: No real module mechanism in GRAS so far, nothing to do. */
+void amok_exit(void)
+{
+  /* FIXME: No real module mechanism in GRAS so far, nothing to do. */
 }
-
index 376a29d..add6192 100644 (file)
 
 #include "xbt/ex.h"
 #include "gras/DataDesc/datadesc_private.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_cbps,gras_ddt,"callback persistant state");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_cbps, gras_ddt,
+                                "callback persistant state");
 
 typedef struct {
-       gras_datadesc_type_t  type;
-       void                 *data;
+  gras_datadesc_type_t type;
+  void *data;
 } s_gras_cbps_elm_t, *gras_cbps_elm_t;
 
 typedef struct s_gras_cbps {
-       xbt_dynar_t lints; /* simple stack of long integers (easy interface) */
+  xbt_dynar_t lints;            /* simple stack of long integers (easy interface) */
 
-       xbt_dict_t  space; /* varname x dynar of gras_cbps_elm_t */
-       xbt_dynar_t frames; /* of dynar of names defined within this frame
-                          (and to pop when we leave it) */
-       xbt_dynar_t globals;
+  xbt_dict_t space;             /* varname x dynar of gras_cbps_elm_t */
+  xbt_dynar_t frames;           /* of dynar of names defined within this frame
+                                   (and to pop when we leave it) */
+  xbt_dynar_t globals;
 } s_gras_cbps_t;
 
-gras_cbps_t gras_cbps_new(void) {
-       gras_cbps_t  res;
+gras_cbps_t gras_cbps_new(void)
+{
+  gras_cbps_t res;
 
-       res=xbt_new(s_gras_cbps_t,1);
+  res = xbt_new(s_gras_cbps_t, 1);
 
-       res->lints = xbt_dynar_new(sizeof(int), NULL);
-       res->space = xbt_dict_new();
-       /* no leak, the content is freed manually on block_end */
-       res->frames = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
-       res->globals = xbt_dynar_new(sizeof(char*), NULL);
+  res->lints = xbt_dynar_new(sizeof(int), NULL);
+  res->space = xbt_dict_new();
+  /* no leak, the content is freed manually on block_end */
+  res->frames = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
+  res->globals = xbt_dynar_new(sizeof(char *), NULL);
 
-       gras_cbps_block_begin(res);
+  gras_cbps_block_begin(res);
 
-       return res;
+  return res;
 }
 
-void gras_cbps_free(gras_cbps_t *state) {
+void gras_cbps_free(gras_cbps_t * state)
+{
 
-       xbt_dynar_free( &( (*state)->lints   ) );
+  xbt_dynar_free(&((*state)->lints));
 
-       gras_cbps_block_end(*state);
-       xbt_dict_free ( &( (*state)->space   ) );
-       xbt_dynar_free( &( (*state)->frames  ) );
-       xbt_dynar_free( &( (*state)->globals ) );
+  gras_cbps_block_end(*state);
+  xbt_dict_free(&((*state)->space));
+  xbt_dynar_free(&((*state)->frames));
+  xbt_dynar_free(&((*state)->globals));
 
-       free(*state);
-       *state = NULL;
+  free(*state);
+  *state = NULL;
 }
 
-void gras_cbps_reset(gras_cbps_t state) {
+void gras_cbps_reset(gras_cbps_t state)
+{
 
-       xbt_dynar_reset(state->lints);
+  xbt_dynar_reset(state->lints);
 
-       xbt_dict_reset (state->space);
+  xbt_dict_reset(state->space);
 
-       xbt_dynar_reset(state->frames);
-       xbt_dynar_reset(state->globals);
+  xbt_dynar_reset(state->frames);
+  xbt_dynar_reset(state->globals);
 }
 
 /** \brief Declare a new element in the PS, and give it a value.
@@ -73,41 +77,41 @@ void gras_cbps_reset(gras_cbps_t state) {
  * seeable again only after a pop to remove the value this push adds.
  */
 void
-gras_cbps_v_push(gras_cbps_t          ps,
-               const char          *name,
-               void                *data,
-               gras_datadesc_type_t ddt) {
-
-       xbt_dynar_t     varstack=NULL,frame;
-       gras_cbps_elm_t var;
-       char           *varname = (char*)xbt_strdup(name);
-       xbt_ex_t        e;
-
-       DEBUG2("push(%s,%p)",name,(void*)data);
-
-       TRY {
-               varstack = xbt_dict_get(ps->space, name);
-       } CATCH(e) {
-               if (e.category != mismatch_error)
-                       RETHROW;
-
-               DEBUG1("Create a new variable stack for '%s' into the space",name);
-               varstack = xbt_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
-               xbt_dict_set(ps->space, varname, (void **)varstack, NULL);
-               xbt_ex_free(e);
-               /* leaking, you think? only if you do not close all the openned blocks ;)*/
-       }
-
-       var       = xbt_new0(s_gras_cbps_elm_t,1);
-       var->type = ddt;
-       var->data = data;
-
-       xbt_dynar_push(varstack, &var);
-
-       xbt_dynar_pop(ps->frames, &frame);
-       DEBUG4("Push %s (%p @%p) into frame %p",varname,(void*)varname,(void*)&varname,(void*)frame);
-       xbt_dynar_push(frame, &varname);
-       xbt_dynar_push(ps->frames, &frame);
+gras_cbps_v_push(gras_cbps_t ps,
+                 const char *name, void *data, gras_datadesc_type_t ddt)
+{
+
+  xbt_dynar_t varstack = NULL, frame;
+  gras_cbps_elm_t var;
+  char *varname = (char *) xbt_strdup(name);
+  xbt_ex_t e;
+
+  DEBUG2("push(%s,%p)", name, (void *) data);
+
+  TRY {
+    varstack = xbt_dict_get(ps->space, name);
+  } CATCH(e) {
+    if (e.category != mismatch_error)
+      RETHROW;
+
+    DEBUG1("Create a new variable stack for '%s' into the space", name);
+    varstack = xbt_dynar_new(sizeof(gras_cbps_elm_t *), NULL);
+    xbt_dict_set(ps->space, varname, (void **) varstack, NULL);
+    xbt_ex_free(e);
+    /* leaking, you think? only if you do not close all the openned blocks ;) */
+  }
+
+  var = xbt_new0(s_gras_cbps_elm_t, 1);
+  var->type = ddt;
+  var->data = data;
+
+  xbt_dynar_push(varstack, &var);
+
+  xbt_dynar_pop(ps->frames, &frame);
+  DEBUG4("Push %s (%p @%p) into frame %p", varname, (void *) varname,
+         (void *) &varname, (void *) frame);
+  xbt_dynar_push(frame, &varname);
+  xbt_dynar_push(ps->frames, &frame);
 }
 
 /** \brief Retrieve an element from the PS, and remove it from the PS.
@@ -116,57 +120,56 @@ gras_cbps_v_push(gras_cbps_t          ps,
  * and not search in upper blocks since this denotes a programmation error.
  */
 void
-gras_cbps_v_pop (gras_cbps_t            ps,
-               const char            *name,
-               gras_datadesc_type_t  *ddt,
-               void                 **res) {
-       xbt_dynar_t          varstack,frame;
-       gras_cbps_elm_t       var            = NULL;
-       void                 *data           = NULL;
-       xbt_ex_t e;
-
-       DEBUG1("pop(%s)",name);
-       TRY {
-               varstack = xbt_dict_get(ps->space, name);
-       } CATCH(e) {
-               if (e.category != mismatch_error)
-                       RETHROW;
-
-               xbt_ex_free(e);
-               THROW1(not_found_error,1,"Asked to pop the non-existant %s", name);
-       }
-       xbt_dynar_pop(varstack, &var);
-
-       if (!xbt_dynar_length(varstack)) {
-               DEBUG1("Last incarnation of %s poped. Kill it",name);
-               xbt_dict_remove(ps->space, name);
-               xbt_dynar_free(&varstack);
-       }
-
-       if (ddt)
-               *ddt = var->type;
-       data = var->data;
-
-       free(var);
-
-       xbt_dynar_pop(ps->frames, &frame);
-       {
-               int l = xbt_dynar_length(frame);
-
-               while (l--) {
-                       char *_name = NULL;
-
-                       _name = xbt_dynar_get_as(frame, l, char*);
-                       if (!strcmp(name, _name)) {
-                               xbt_dynar_remove_at(frame, l, &_name);
-                               free(_name);
-                               break;
-                       }
-               }
-       }
-       xbt_dynar_push(ps->frames, &frame);
-
-       *res = data;
+gras_cbps_v_pop(gras_cbps_t ps,
+                const char *name, gras_datadesc_type_t * ddt, void **res)
+{
+  xbt_dynar_t varstack, frame;
+  gras_cbps_elm_t var = NULL;
+  void *data = NULL;
+  xbt_ex_t e;
+
+  DEBUG1("pop(%s)", name);
+  TRY {
+    varstack = xbt_dict_get(ps->space, name);
+  } CATCH(e) {
+    if (e.category != mismatch_error)
+      RETHROW;
+
+    xbt_ex_free(e);
+    THROW1(not_found_error, 1, "Asked to pop the non-existant %s", name);
+  }
+  xbt_dynar_pop(varstack, &var);
+
+  if (!xbt_dynar_length(varstack)) {
+    DEBUG1("Last incarnation of %s poped. Kill it", name);
+    xbt_dict_remove(ps->space, name);
+    xbt_dynar_free(&varstack);
+  }
+
+  if (ddt)
+    *ddt = var->type;
+  data = var->data;
+
+  free(var);
+
+  xbt_dynar_pop(ps->frames, &frame);
+  {
+    int l = xbt_dynar_length(frame);
+
+    while (l--) {
+      char *_name = NULL;
+
+      _name = xbt_dynar_get_as(frame, l, char *);
+      if (!strcmp(name, _name)) {
+        xbt_dynar_remove_at(frame, l, &_name);
+        free(_name);
+        break;
+      }
+    }
+  }
+  xbt_dynar_push(ps->frames, &frame);
+
+  *res = data;
 }
 
 /** \brief Change the value of an element in the PS.
@@ -179,31 +182,30 @@ gras_cbps_v_pop (gras_cbps_t            ps,
  *   its value is changed.
  */
 void
-gras_cbps_v_set (gras_cbps_t          ps,
-               const char          *name,
-               void                *data,
-               gras_datadesc_type_t ddt) {
+gras_cbps_v_set(gras_cbps_t ps,
+                const char *name, void *data, gras_datadesc_type_t ddt)
+{
 
-       xbt_dynar_t dynar = NULL;
-       gras_cbps_elm_t elm = NULL;
+  xbt_dynar_t dynar = NULL;
+  gras_cbps_elm_t elm = NULL;
 
-       DEBUG1("set(%s)",name);
-       dynar = xbt_dict_get_or_null(ps->space, name);
+  DEBUG1("set(%s)", name);
+  dynar = xbt_dict_get_or_null(ps->space, name);
 
-       if (dynar == NULL) {
-               dynar = xbt_dynar_new(sizeof (gras_cbps_elm_t), NULL);
-               xbt_dict_set(ps->space, name, (void **)dynar, NULL);
+  if (dynar == NULL) {
+    dynar = xbt_dynar_new(sizeof(gras_cbps_elm_t), NULL);
+    xbt_dict_set(ps->space, name, (void **) dynar, NULL);
 
-               elm   = xbt_new0(s_gras_cbps_elm_t,1);
-               xbt_dynar_push(ps->globals, &name);
-       } else {
-               xbt_dynar_pop(dynar, &elm);
-       }
+    elm = xbt_new0(s_gras_cbps_elm_t, 1);
+    xbt_dynar_push(ps->globals, &name);
+  } else {
+    xbt_dynar_pop(dynar, &elm);
+  }
 
-       elm->type   = ddt;
-       elm->data   = data;
+  elm->type = ddt;
+  elm->data = data;
 
-       xbt_dynar_push(dynar, &elm);
+  xbt_dynar_push(dynar, &elm);
 
 }
 
@@ -214,24 +216,23 @@ gras_cbps_v_set (gras_cbps_t          ps,
  * If it's not present in any of them, look in the globals
  * If not present there neither, the code may segfault (Oli?).
  */
-void *
-gras_cbps_v_get (gras_cbps_t           ps,
-               const char           *name,
-               /* OUT */gras_datadesc_type_t *ddt) {
+void *gras_cbps_v_get(gras_cbps_t ps, const char *name,
+                      /* OUT */ gras_datadesc_type_t * ddt)
+{
 
-       xbt_dynar_t    dynar = NULL;
-       gras_cbps_elm_t elm   = NULL;
+  xbt_dynar_t dynar = NULL;
+  gras_cbps_elm_t elm = NULL;
 
-       DEBUG1("get(%s)",name);
-       dynar = xbt_dict_get(ps->space, name);
-       xbt_dynar_pop(dynar, &elm);
-       xbt_dynar_push(dynar, &elm);
+  DEBUG1("get(%s)", name);
+  dynar = xbt_dict_get(ps->space, name);
+  xbt_dynar_pop(dynar, &elm);
+  xbt_dynar_push(dynar, &elm);
 
-       if (ddt) {
-               *ddt = elm->type;
-       }
+  if (ddt) {
+    *ddt = elm->type;
+  }
 
-       return elm->data;
+  return elm->data;
 
 }
 
@@ -246,76 +247,79 @@ gras_cbps_v_get (gras_cbps_t           ps,
  * use block_{begin,end} to do the trick.
  */
 
-void
-gras_cbps_block_begin(gras_cbps_t ps) {
+void gras_cbps_block_begin(gras_cbps_t ps)
+{
 
-       xbt_dynar_t dynar = NULL;
+  xbt_dynar_t dynar = NULL;
 
-       DEBUG0(">>> Block begin");
-       dynar = xbt_dynar_new(sizeof (char *), NULL);
-       xbt_dynar_push(ps->frames, &dynar);
+  DEBUG0(">>> Block begin");
+  dynar = xbt_dynar_new(sizeof(char *), NULL);
+  xbt_dynar_push(ps->frames, &dynar);
 }
 
 /** \brief End the current block, and go back to the upper one. */
-void
-gras_cbps_block_end(gras_cbps_t ps) {
-
-       xbt_dynar_t  frame        = NULL;
-       unsigned int cursor       =    0;
-       char         *name         = NULL;
-
-       xbt_assert0(xbt_dynar_length(ps->frames),
-                       "More block_end than block_begin");
-       xbt_dynar_pop(ps->frames, &frame);
-
-       xbt_dynar_foreach(frame, cursor, name) {
-
-               xbt_dynar_t    varstack    = NULL;
-               gras_cbps_elm_t var         = NULL;
-
-               DEBUG2("Get ride of %s (%p)",name,(void*)name);
-               varstack = xbt_dict_get(ps->space, name);
-               xbt_dynar_pop(varstack, &var);
-
-               if (!xbt_dynar_length(varstack)) {
-                       xbt_dict_remove(ps->space, name);
-                       xbt_dynar_free_container(&varstack); /*already empty, save a test ;) */
-               }
-
-               if (var->data) free(var->data);
-               free(var);
-               free(name);
-       }
-       xbt_dynar_free_container(&frame);/* we just emptied it */
-       DEBUG0("<<< Block end");
+void gras_cbps_block_end(gras_cbps_t ps)
+{
+
+  xbt_dynar_t frame = NULL;
+  unsigned int cursor = 0;
+  char *name = NULL;
+
+  xbt_assert0(xbt_dynar_length(ps->frames),
+              "More block_end than block_begin");
+  xbt_dynar_pop(ps->frames, &frame);
+
+  xbt_dynar_foreach(frame, cursor, name) {
+
+    xbt_dynar_t varstack = NULL;
+    gras_cbps_elm_t var = NULL;
+
+    DEBUG2("Get ride of %s (%p)", name, (void *) name);
+    varstack = xbt_dict_get(ps->space, name);
+    xbt_dynar_pop(varstack, &var);
+
+    if (!xbt_dynar_length(varstack)) {
+      xbt_dict_remove(ps->space, name);
+      xbt_dynar_free_container(&varstack);      /*already empty, save a test ;) */
+    }
+
+    if (var->data)
+      free(var->data);
+    free(var);
+    free(name);
+  }
+  xbt_dynar_free_container(&frame);     /* we just emptied it */
+  DEBUG0("<<< Block end");
 }
 
 
 /** \brief Push a new integer value into the cbps. */
-void
-gras_cbps_i_push(gras_cbps_t ps,
-               int val) {
-       DEBUG1("push %d as a size",val);
-       xbt_dynar_push_as(ps->lints,int,val);
+void gras_cbps_i_push(gras_cbps_t ps, int val)
+{
+  DEBUG1("push %d as a size", val);
+  xbt_dynar_push_as(ps->lints, int, val);
 }
+
 /** \brief Pop the lastly pushed integer value from the cbps. */
-int
-gras_cbps_i_pop(gras_cbps_t ps) {
-       int ret;
-
-       xbt_assert0(xbt_dynar_length(ps->lints) > 0,
-                       "gras_cbps_i_pop: no value to pop");
-       ret = xbt_dynar_pop_as(ps->lints,int);
-       DEBUG1("pop %d as a size",ret);
-       return ret;
+int gras_cbps_i_pop(gras_cbps_t ps)
+{
+  int ret;
+
+  xbt_assert0(xbt_dynar_length(ps->lints) > 0,
+              "gras_cbps_i_pop: no value to pop");
+  ret = xbt_dynar_pop_as(ps->lints, int);
+  DEBUG1("pop %d as a size", ret);
+  return ret;
 }
 
 /** \brief Generic cb returning the lastly pushed value
  *
  * Used by \ref gras_datadesc_ref_pop_arr
  */
-int gras_datadesc_cb_pop(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       return gras_cbps_i_pop(vars);
+int gras_datadesc_cb_pop(gras_datadesc_type_t ignored, gras_cbps_t vars,
+                         void *data)
+{
+  return gras_cbps_i_pop(vars);
 }
 
 /* ************************* */
@@ -323,63 +327,81 @@ int gras_datadesc_cb_pop(gras_datadesc_type_t ignored, gras_cbps_t vars, void *d
 /* ************************* */
 
 /** \brief Cb to push an integer. Must be attached to the field you want to push */
-void gras_datadesc_cb_push_int(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       int *i = (int*)data;
-       gras_cbps_i_push(vars, (int) *i);
+void gras_datadesc_cb_push_int(gras_datadesc_type_t ignored, gras_cbps_t vars,
+                               void *data)
+{
+  int *i = (int *) data;
+  gras_cbps_i_push(vars, (int) *i);
 }
 
 /** \brief Cb to push an unsigned integer. Must be attached to the field you want to push */
-void gras_datadesc_cb_push_uint(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       unsigned int *i = (unsigned int*)data;
-       gras_cbps_i_push(vars, (int) *i);
+void gras_datadesc_cb_push_uint(gras_datadesc_type_t ignored,
+                                gras_cbps_t vars, void *data)
+{
+  unsigned int *i = (unsigned int *) data;
+  gras_cbps_i_push(vars, (int) *i);
 }
 
 /** \brief Cb to push an long integer. Must be attached to the field you want to push
  */
-void gras_datadesc_cb_push_lint(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       long int *i = (long int*)data;
-       gras_cbps_i_push(vars, (int) *i);
+void gras_datadesc_cb_push_lint(gras_datadesc_type_t ignored,
+                                gras_cbps_t vars, void *data)
+{
+  long int *i = (long int *) data;
+  gras_cbps_i_push(vars, (int) *i);
 }
+
 /** \brief Cb to push an unsigned long integer. Must be attached to the field you want to push
  */
-void gras_datadesc_cb_push_ulint(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       unsigned long int *i = (unsigned long int*)data;
-       gras_cbps_i_push(vars, (int) *i);
+void gras_datadesc_cb_push_ulint(gras_datadesc_type_t ignored,
+                                 gras_cbps_t vars, void *data)
+{
+  unsigned long int *i = (unsigned long int *) data;
+  gras_cbps_i_push(vars, (int) *i);
 }
 
 /* ************************************ */
 /* **** PUSHy multiplier callbacks **** */
 /* ************************************ */
 /** \brief Cb to push an integer as multiplier. Must be attached to the field you want to push */
-void gras_datadesc_cb_push_int_mult(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       int old = *(int*)data;
-       int new = gras_cbps_i_pop(vars);
-       DEBUG2("push %d x %d as a size",old,new);
-       gras_cbps_i_push(vars, old*new);
+void gras_datadesc_cb_push_int_mult(gras_datadesc_type_t ignored,
+                                    gras_cbps_t vars, void *data)
+{
+  int old = *(int *) data;
+  int new = gras_cbps_i_pop(vars);
+  DEBUG2("push %d x %d as a size", old, new);
+  gras_cbps_i_push(vars, old * new);
 }
 
 /** \brief Cb to push an unsigned integer as multiplier. Must be attached to the field you want to push */
-void gras_datadesc_cb_push_uint_mult(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       unsigned int old = *(unsigned int*)data;
-       unsigned int new = gras_cbps_i_pop(vars);
-
-       DEBUG2("push %d x %d as a size",old,new);
-       gras_cbps_i_push(vars, (int) (old*new));
+void gras_datadesc_cb_push_uint_mult(gras_datadesc_type_t ignored,
+                                     gras_cbps_t vars, void *data)
+{
+  unsigned int old = *(unsigned int *) data;
+  unsigned int new = gras_cbps_i_pop(vars);
+
+  DEBUG2("push %d x %d as a size", old, new);
+  gras_cbps_i_push(vars, (int) (old * new));
 }
 
 /** \brief Cb to push an long integer as multiplier. Must be attached to the field you want to push
  */
-void gras_datadesc_cb_push_lint_mult(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       long int i = *(long int*)data;
-       i *= gras_cbps_i_pop(vars);
-       gras_cbps_i_push(vars, (int) i);
+void gras_datadesc_cb_push_lint_mult(gras_datadesc_type_t ignored,
+                                     gras_cbps_t vars, void *data)
+{
+  long int i = *(long int *) data;
+  i *= gras_cbps_i_pop(vars);
+  gras_cbps_i_push(vars, (int) i);
 }
+
 /** \brief Cb to push an unsigned long integer as multiplier. Must be attached to the field you want to push
  */
-void gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t ignored, gras_cbps_t vars, void *data) {
-       unsigned long int old = *(unsigned long int*)data;
-       unsigned long int new = gras_cbps_i_pop(vars);
-
-       DEBUG2("push %ld x %ld as a size",old,new);
-       gras_cbps_i_push(vars, (int) (old * new) );
+void gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t ignored,
+                                      gras_cbps_t vars, void *data)
+{
+  unsigned long int old = *(unsigned long int *) data;
+  unsigned long int new = gras_cbps_i_pop(vars);
+
+  DEBUG2("push %ld x %ld as a size", old, new);
+  gras_cbps_i_push(vars, (int) (old * new));
 }
index 09ba9fc..b334488 100644 (file)
 
 #include "gras/DataDesc/datadesc_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt,gras,"Data description");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt, gras, "Data description");
 /* FIXME: make this host-dependent using a trick such as UserData*/
-/*@null@*/xbt_set_t gras_datadesc_set_local=NULL;
+/*@null@*/ xbt_set_t gras_datadesc_set_local = NULL;
 
 
 /* callback for array size when sending strings */
-static int
-_strlen_cb(/*@unused@*/gras_datadesc_type_t type,/*@unused@*/gras_cbps_t vars, void *data) {
+static int _strlen_cb( /*@unused@ */ gras_datadesc_type_t type, /*@unused@ */
+                      gras_cbps_t vars, void *data)
+{
 
-       return 1+(int)strlen(data);
+  return 1 + (int) strlen(data);
 }
 
 
@@ -31,128 +32,130 @@ _strlen_cb(/*@unused@*/gras_datadesc_type_t type,/*@unused@*/gras_cbps_t vars, v
  * FIXME: We assume that when neither signed nor unsigned is given,
  *    that means signed. To be checked by configure.
  **/
-void
-gras_datadesc_init(void) {
-       gras_datadesc_type_t ddt; /* What to add */
-
-       /* only initialize once */
-       if (gras_datadesc_set_local != NULL)
-               return;
-
-       VERB0("Initializing DataDesc");
-
-       gras_datadesc_set_local = xbt_set_new();
-
-
-       /* all known datatypes */
-
-       ddt = gras_datadesc_scalar("signed char",
-                       gras_ddt_scalar_char,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("char",
-                       gras_ddt_scalar_char,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("unsigned char",
-                       gras_ddt_scalar_char,
-                       e_gras_dd_scalar_encoding_uint);
-
-       ddt = gras_datadesc_scalar("signed short int",
-                       gras_ddt_scalar_short,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("short int",
-                       gras_ddt_scalar_short,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("short",
-                       gras_ddt_scalar_short,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("unsigned short int",
-                       gras_ddt_scalar_short,
-                       e_gras_dd_scalar_encoding_uint);
-
-       ddt = gras_datadesc_scalar("signed int",
-                       gras_ddt_scalar_int,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("int",
-                       gras_ddt_scalar_int,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("unsigned int",
-                       gras_ddt_scalar_int,
-                       e_gras_dd_scalar_encoding_uint);
-
-       ddt = gras_datadesc_scalar("signed long int",
-                       gras_ddt_scalar_long,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("long int",
-                       gras_ddt_scalar_long,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("long",
-                       gras_ddt_scalar_long,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("unsigned long int",
-                       gras_ddt_scalar_long,
-                       e_gras_dd_scalar_encoding_uint);
-
-       ddt = gras_datadesc_scalar("signed long long int",
-                       gras_ddt_scalar_long_long,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("long long int",
-                       gras_ddt_scalar_long_long,
-                       e_gras_dd_scalar_encoding_sint);
-       ddt = gras_datadesc_scalar("unsigned long long int",
-                       gras_ddt_scalar_long_long,
-                       e_gras_dd_scalar_encoding_uint);
-
-       ddt = gras_datadesc_scalar("data pointer",
-                       gras_ddt_scalar_pdata,
-                       e_gras_dd_scalar_encoding_uint);
-       ddt = gras_datadesc_scalar("function pointer",
-                       gras_ddt_scalar_pfunc,
-                       e_gras_dd_scalar_encoding_uint);
-
-       ddt = gras_datadesc_scalar("float",
-                       gras_ddt_scalar_float,
-                       e_gras_dd_scalar_encoding_float);
-       ddt = gras_datadesc_scalar("double",
-                       gras_ddt_scalar_double,
-                       e_gras_dd_scalar_encoding_float);
-
-       ddt = gras_datadesc_array_dyn("char[]",
-                       gras_datadesc_by_name("char"),
-                       _strlen_cb);
-       gras_datadesc_ref("string",ddt);
-       gras_datadesc_ref("xbt_string_t",ddt);
-
-       /* specific datatype: the exception type (for RPC) */
-       ddt = gras_datadesc_struct("ex_t");
-       gras_datadesc_struct_append(ddt,"msg",gras_datadesc_by_name("string"));
-       gras_datadesc_struct_append(ddt,"category",gras_datadesc_by_name("int"));
-       gras_datadesc_struct_append(ddt,"value",gras_datadesc_by_name("int"));
-
-       gras_datadesc_struct_append(ddt,"remote",gras_datadesc_by_name("short int"));
-
-       gras_datadesc_struct_append(ddt,"host",gras_datadesc_by_name("string"));
-       gras_datadesc_struct_append(ddt,"procname",gras_datadesc_by_name("string"));
-       gras_datadesc_struct_append(ddt,"pid",gras_datadesc_by_name("long int"));
-       gras_datadesc_struct_append(ddt,"file",gras_datadesc_by_name("string"));
-       gras_datadesc_struct_append(ddt,"line",gras_datadesc_by_name("int"));
-       gras_datadesc_struct_append(ddt,"func",gras_datadesc_by_name("string"));
-       gras_datadesc_struct_append(ddt,"used",gras_datadesc_by_name("int"));
-       gras_datadesc_cb_field_push(ddt,"used");
-       gras_datadesc_struct_append(ddt,"bt_strings",
-                       gras_datadesc_ref_pop_arr(gras_datadesc_by_name("string")));
-
-       gras_datadesc_struct_close(ddt);
-
-       /* specific datatype: xbt_peer_t */
-       ddt = gras_datadesc_struct("s_xbt_peer_t");
-       gras_datadesc_struct_append(ddt,"name",gras_datadesc_by_name("string"));
-       gras_datadesc_struct_append(ddt,"port",gras_datadesc_by_name("int"));
-       gras_datadesc_struct_close(ddt);
-
-       ddt = gras_datadesc_ref("xbt_peer_t",ddt);
-
-       /* Dict containing the constant value (for the parsing macro) */
-       gras_dd_constants = xbt_dict_new();
+void gras_datadesc_init(void)
+{
+  gras_datadesc_type_t ddt;     /* What to add */
+
+  /* only initialize once */
+  if (gras_datadesc_set_local != NULL)
+    return;
+
+  VERB0("Initializing DataDesc");
+
+  gras_datadesc_set_local = xbt_set_new();
+
+
+  /* all known datatypes */
+
+  ddt = gras_datadesc_scalar("signed char",
+                             gras_ddt_scalar_char,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("char",
+                             gras_ddt_scalar_char,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("unsigned char",
+                             gras_ddt_scalar_char,
+                             e_gras_dd_scalar_encoding_uint);
+
+  ddt = gras_datadesc_scalar("signed short int",
+                             gras_ddt_scalar_short,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("short int",
+                             gras_ddt_scalar_short,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("short",
+                             gras_ddt_scalar_short,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("unsigned short int",
+                             gras_ddt_scalar_short,
+                             e_gras_dd_scalar_encoding_uint);
+
+  ddt = gras_datadesc_scalar("signed int",
+                             gras_ddt_scalar_int,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("int",
+                             gras_ddt_scalar_int,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("unsigned int",
+                             gras_ddt_scalar_int,
+                             e_gras_dd_scalar_encoding_uint);
+
+  ddt = gras_datadesc_scalar("signed long int",
+                             gras_ddt_scalar_long,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("long int",
+                             gras_ddt_scalar_long,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("long",
+                             gras_ddt_scalar_long,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("unsigned long int",
+                             gras_ddt_scalar_long,
+                             e_gras_dd_scalar_encoding_uint);
+
+  ddt = gras_datadesc_scalar("signed long long int",
+                             gras_ddt_scalar_long_long,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("long long int",
+                             gras_ddt_scalar_long_long,
+                             e_gras_dd_scalar_encoding_sint);
+  ddt = gras_datadesc_scalar("unsigned long long int",
+                             gras_ddt_scalar_long_long,
+                             e_gras_dd_scalar_encoding_uint);
+
+  ddt = gras_datadesc_scalar("data pointer",
+                             gras_ddt_scalar_pdata,
+                             e_gras_dd_scalar_encoding_uint);
+  ddt = gras_datadesc_scalar("function pointer",
+                             gras_ddt_scalar_pfunc,
+                             e_gras_dd_scalar_encoding_uint);
+
+  ddt = gras_datadesc_scalar("float",
+                             gras_ddt_scalar_float,
+                             e_gras_dd_scalar_encoding_float);
+  ddt = gras_datadesc_scalar("double",
+                             gras_ddt_scalar_double,
+                             e_gras_dd_scalar_encoding_float);
+
+  ddt = gras_datadesc_array_dyn("char[]",
+                                gras_datadesc_by_name("char"), _strlen_cb);
+  gras_datadesc_ref("string", ddt);
+  gras_datadesc_ref("xbt_string_t", ddt);
+
+  /* specific datatype: the exception type (for RPC) */
+  ddt = gras_datadesc_struct("ex_t");
+  gras_datadesc_struct_append(ddt, "msg", gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt, "category", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_append(ddt, "value", gras_datadesc_by_name("int"));
+
+  gras_datadesc_struct_append(ddt, "remote",
+                              gras_datadesc_by_name("short int"));
+
+  gras_datadesc_struct_append(ddt, "host", gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt, "procname",
+                              gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt, "pid", gras_datadesc_by_name("long int"));
+  gras_datadesc_struct_append(ddt, "file", gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt, "line", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_append(ddt, "func", gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt, "used", gras_datadesc_by_name("int"));
+  gras_datadesc_cb_field_push(ddt, "used");
+  gras_datadesc_struct_append(ddt, "bt_strings",
+                              gras_datadesc_ref_pop_arr(gras_datadesc_by_name
+                                                        ("string")));
+
+  gras_datadesc_struct_close(ddt);
+
+  /* specific datatype: xbt_peer_t */
+  ddt = gras_datadesc_struct("s_xbt_peer_t");
+  gras_datadesc_struct_append(ddt, "name", gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt, "port", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_close(ddt);
+
+  ddt = gras_datadesc_ref("xbt_peer_t", ddt);
+
+  /* Dict containing the constant value (for the parsing macro) */
+  gras_dd_constants = xbt_dict_new();
 
 }
 
@@ -161,23 +164,24 @@ gras_datadesc_init(void) {
  *
  * Finalize the datadesc module
  **/
-void
-gras_datadesc_exit(void) {
-       VERB0("Exiting DataDesc");
-       xbt_set_free(&gras_datadesc_set_local);
-       xbt_dict_free(&gras_dd_constants);
-       DEBUG0("Exited DataDesc");
+void gras_datadesc_exit(void)
+{
+  VERB0("Exiting DataDesc");
+  xbt_set_free(&gras_datadesc_set_local);
+  xbt_dict_free(&gras_dd_constants);
+  DEBUG0("Exited DataDesc");
 }
 
 /** This is mainly to debug */
-const char *
-gras_datadesc_get_name(gras_datadesc_type_t ddt) {
-       return ddt?(const char*)ddt->name:"(null)";
+const char *gras_datadesc_get_name(gras_datadesc_type_t ddt)
+{
+  return ddt ? (const char *) ddt->name : "(null)";
 }
+
 /** This is mainly to debug */
-int
-gras_datadesc_get_id(gras_datadesc_type_t ddt) {
-       return ddt->code;
+int gras_datadesc_get_id(gras_datadesc_type_t ddt)
+{
+  return ddt->code;
 }
 
 /**
@@ -186,8 +190,9 @@ gras_datadesc_get_id(gras_datadesc_type_t ddt) {
  * Returns the size occuped by data of this type (on the current arch).
  *
  */
-int gras_datadesc_size(gras_datadesc_type_t type) {
-       return type?type->size[GRAS_THISARCH]:0;
+int gras_datadesc_size(gras_datadesc_type_t type)
+{
+  return type ? type->size[GRAS_THISARCH] : 0;
 }
 
 /**
@@ -195,57 +200,55 @@ int gras_datadesc_size(gras_datadesc_type_t type) {
  *
  * For debugging purpose
  */
-void gras_datadesc_type_dump(const gras_datadesc_type_t ddt){
-       unsigned int cpt;
-
-       printf("DataDesc dump:");
-       if(!ddt) {
-               printf("(null)\n");
-               return;
-       }
-       printf ("%s (ID:%d)\n",ddt->name,ddt->code);
-       printf ("  category: %s\n",gras_datadesc_cat_names[ddt->category_code]);
-
-       printf ("  size[");
-       for (cpt=0; cpt<gras_arch_count; cpt++) {
-               printf("%s%s%ld%s",
-                               cpt>0?", ":"",
-                                               cpt == GRAS_THISARCH ? ">":"",
-                                                               ddt->size[cpt],
-                                                               cpt == GRAS_THISARCH ? "<":"");
-       }
-       printf ("]\n");
-
-       printf ("  alignment[");
-       for (cpt=0; cpt<gras_arch_count; cpt++) {
-               printf("%s%s%ld%s",
-                               cpt>0?", ":"",
-                                               cpt == GRAS_THISARCH ? ">":"",
-                                                               ddt->alignment[cpt],
-                                                               cpt == GRAS_THISARCH ? "<":"");
-       }
-       printf ("]\n");
-
-       printf ("  aligned_size[");
-       for (cpt=0; cpt<gras_arch_count; cpt++) {
-               printf("%s%s%ld%s",
-                               cpt>0?", ":"",
-                                               cpt == GRAS_THISARCH ? ">":"",
-                                                               ddt->aligned_size[cpt],
-                                                               cpt == GRAS_THISARCH ? "<":"");
-       }
-       printf ("]\n");
-       if (ddt->category_code == e_gras_datadesc_type_cat_struct) {
-               gras_dd_cat_struct_t struct_data;
-               gras_dd_cat_field_t  field;
-
-               struct_data = ddt->category.struct_data;
-               xbt_dynar_foreach(struct_data.fields, cpt, field) {
-                       printf(">>> Dump field #%d (%s) (offset=%ld)\n",
-                                       cpt,field->name,field->offset[GRAS_THISARCH]);
-                       gras_datadesc_type_dump(field->type);
-                       printf("<<< end dump field #%d (%s)\n",cpt,field->name);
-               }
-       }
-       fflush(stdout);
+void gras_datadesc_type_dump(const gras_datadesc_type_t ddt)
+{
+  unsigned int cpt;
+
+  printf("DataDesc dump:");
+  if (!ddt) {
+    printf("(null)\n");
+    return;
+  }
+  printf("%s (ID:%d)\n", ddt->name, ddt->code);
+  printf("  category: %s\n", gras_datadesc_cat_names[ddt->category_code]);
+
+  printf("  size[");
+  for (cpt = 0; cpt < gras_arch_count; cpt++) {
+    printf("%s%s%ld%s",
+           cpt > 0 ? ", " : "",
+           cpt == GRAS_THISARCH ? ">" : "",
+           ddt->size[cpt], cpt == GRAS_THISARCH ? "<" : "");
+  }
+  printf("]\n");
+
+  printf("  alignment[");
+  for (cpt = 0; cpt < gras_arch_count; cpt++) {
+    printf("%s%s%ld%s",
+           cpt > 0 ? ", " : "",
+           cpt == GRAS_THISARCH ? ">" : "",
+           ddt->alignment[cpt], cpt == GRAS_THISARCH ? "<" : "");
+  }
+  printf("]\n");
+
+  printf("  aligned_size[");
+  for (cpt = 0; cpt < gras_arch_count; cpt++) {
+    printf("%s%s%ld%s",
+           cpt > 0 ? ", " : "",
+           cpt == GRAS_THISARCH ? ">" : "",
+           ddt->aligned_size[cpt], cpt == GRAS_THISARCH ? "<" : "");
+  }
+  printf("]\n");
+  if (ddt->category_code == e_gras_datadesc_type_cat_struct) {
+    gras_dd_cat_struct_t struct_data;
+    gras_dd_cat_field_t field;
+
+    struct_data = ddt->category.struct_data;
+    xbt_dynar_foreach(struct_data.fields, cpt, field) {
+      printf(">>> Dump field #%d (%s) (offset=%ld)\n",
+             cpt, field->name, field->offset[GRAS_THISARCH]);
+      gras_datadesc_type_dump(field->type);
+      printf("<<< end dump field #%d (%s)\n", cpt, field->name);
+    }
+  }
+  fflush(stdout);
 }
index c311b30..8e8f122 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef GRAS_DATADESC_INTERFACE_H
 #define GRAS_DATADESC_INTERFACE_H
 
-XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_by_id  (long int code);
+XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_by_id(long int code);
 
 /* to debug */
 XBT_PUBLIC(void) gras_datadesc_type_dump(const gras_datadesc_type_t ddt);
@@ -23,21 +23,27 @@ XBT_PUBLIC(const char *) gras_datadesc_arch_name(int code);
 /* compare two data type description */
 XBT_PUBLIC(int)
 gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
-               const gras_datadesc_type_t d2);
+                       const gras_datadesc_type_t d2);
 
 /* Access function */
-XBT_PUBLIC(int)  gras_datadesc_size(gras_datadesc_type_t type);
+XBT_PUBLIC(int) gras_datadesc_size(gras_datadesc_type_t type);
 /* Described data exchanges: direct use */
-XBT_PUBLIC(int) gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst);
-XBT_PUBLIC(void) gras_datadesc_send(gras_socket_t sock, gras_datadesc_type_t type, void *src);
-XBT_PUBLIC(void) gras_datadesc_recv(gras_socket_t sock, gras_datadesc_type_t type,
-               int r_arch, void *dst);
+XBT_PUBLIC(int) gras_datadesc_memcpy(gras_datadesc_type_t type, void *src,
+                                     void *dst);
+XBT_PUBLIC(void) gras_datadesc_send(gras_socket_t sock,
+                                    gras_datadesc_type_t type, void *src);
+XBT_PUBLIC(void) gras_datadesc_recv(gras_socket_t sock,
+                                    gras_datadesc_type_t type, int r_arch,
+                                    void *dst);
 
 /* Described data exchanges: IDL compilation FIXME: not implemented*/
-void gras_datadesc_gen_cpy(gras_datadesc_type_t type, void *src, void **dst);
-void gras_datadesc_gen_send(gras_socket_t sock, gras_datadesc_type_t type, void *src);
-void gras_datadesc_gen_recv(gras_socket_t sock, gras_datadesc_type_t type,
-               int r_arch, void *dst);
+     void gras_datadesc_gen_cpy(gras_datadesc_type_t type, void *src,
+                                void **dst);
+     void gras_datadesc_gen_send(gras_socket_t sock,
+                                 gras_datadesc_type_t type, void *src);
+     void gras_datadesc_gen_recv(gras_socket_t sock,
+                                 gras_datadesc_type_t type, int r_arch,
+                                 void *dst);
 
 
 #endif /* GRAS_DATADESC_INTERFACE_H */
index f54928b..e6ec846 100644 (file)
 #include "xbt/dict.h"
 #include "xbt/set.h"
 
-#include "portable.h" /* GRAS_THISARCH */
+#include "portable.h"           /* GRAS_THISARCH */
 
-#include "gras/transport.h"  /* socket handling */
+#include "gras/transport.h"     /* socket handling */
 
-#include "gras_modinter.h"   /* module init/exit */
-#include "gras/datadesc.h"   /* rest of module public interface */
+#include "gras_modinter.h"      /* module init/exit */
+#include "gras/datadesc.h"      /* rest of module public interface */
 
-#include "gras/DataDesc/datadesc_interface.h" /* semi-public API */
+#include "gras/DataDesc/datadesc_interface.h"   /* semi-public API */
 
 /**
  * ddt_aligned:
@@ -36,7 +36,7 @@
  */
 #define ddt_aligned(v, a) (((v) + (a - 1)) & ~(a - 1))
 
-/*@null@*/extern xbt_set_t gras_datadesc_set_local;
+/*@null@*/ extern xbt_set_t gras_datadesc_set_local;
 void gras_ddt_freev(void *ddt);
 /*******************************************
  * Descriptions of all known architectures *
@@ -44,26 +44,26 @@ void gras_ddt_freev(void *ddt);
 
 #define gras_arch_count 11
 typedef enum {
-       gras_ddt_scalar_char      = 0,
-       gras_ddt_scalar_short     = 1,
-       gras_ddt_scalar_int       = 2,
-       gras_ddt_scalar_long      = 3,
-       gras_ddt_scalar_long_long = 4,
+  gras_ddt_scalar_char = 0,
+  gras_ddt_scalar_short = 1,
+  gras_ddt_scalar_int = 2,
+  gras_ddt_scalar_long = 3,
+  gras_ddt_scalar_long_long = 4,
 
-       gras_ddt_scalar_pdata     = 5,
-       gras_ddt_scalar_pfunc     = 6,
+  gras_ddt_scalar_pdata = 5,
+  gras_ddt_scalar_pfunc = 6,
 
-       gras_ddt_scalar_float     = 7,
-       gras_ddt_scalar_double    = 8
+  gras_ddt_scalar_float = 7,
+  gras_ddt_scalar_double = 8
 } gras_ddt_scalar_type_t;
 
 typedef struct {
-       const char *name;
+  const char *name;
 
-       int endian;
+  int endian;
 
-       int sizeofs[9]; /* char,short,int,long,long_long,pdata,pfunc,float,double */
-       int boundaries[9]; /* idem */
+  int sizeofs[9];               /* char,short,int,long,long_long,pdata,pfunc,float,double */
+  int boundaries[9];            /* idem */
 } gras_arch_desc_t;
 
 extern const gras_arch_desc_t gras_arches[gras_arch_count];
@@ -80,17 +80,17 @@ extern const char *gras_datadesc_cat_names[9];
  */
 typedef enum e_gras_datadesc_type_category {
 
-       /* if you edit this, also fix gras_datadesc_cat_names in ddt_exchange.c */
+  /* if you edit this, also fix gras_datadesc_cat_names in ddt_exchange.c */
 
-       e_gras_datadesc_type_cat_undefined = 0,
+  e_gras_datadesc_type_cat_undefined = 0,
 
-       e_gras_datadesc_type_cat_scalar = 1,
-       e_gras_datadesc_type_cat_struct = 2,
-       e_gras_datadesc_type_cat_union = 3,
-       e_gras_datadesc_type_cat_ref = 4,       /* ref to an uniq element */
-       e_gras_datadesc_type_cat_array = 5,
+  e_gras_datadesc_type_cat_scalar = 1,
+  e_gras_datadesc_type_cat_struct = 2,
+  e_gras_datadesc_type_cat_union = 3,
+  e_gras_datadesc_type_cat_ref = 4,     /* ref to an uniq element */
+  e_gras_datadesc_type_cat_array = 5,
 
-       e_gras_datadesc_type_cat_invalid = 6
+  e_gras_datadesc_type_cat_invalid = 6
 } gras_datadesc_type_category_t;
 
 /*------------------------------------------------*/
@@ -103,14 +103,14 @@ typedef enum e_gras_datadesc_type_category {
  */
 typedef struct s_gras_dd_cat_field {
 
-       char       *name;
-       long int  offset[gras_arch_count];
-       gras_datadesc_type_t type;
+  char *name;
+  long int offset[gras_arch_count];
+  gras_datadesc_type_t type;
 
-       gras_datadesc_type_cb_void_t send;
-       gras_datadesc_type_cb_void_t recv;
+  gras_datadesc_type_cb_void_t send;
+  gras_datadesc_type_cb_void_t recv;
 
-} s_gras_dd_cat_field_t,*gras_dd_cat_field_t;
+} s_gras_dd_cat_field_t, *gras_dd_cat_field_t;
 
 void gras_dd_cat_field_free(void *f);
 
@@ -120,17 +120,17 @@ void gras_dd_cat_field_free(void *f);
  * Specific fields of a scalar
  */
 enum e_gras_dd_scalar_encoding {
-       e_gras_dd_scalar_encoding_undefined = 0,
+  e_gras_dd_scalar_encoding_undefined = 0,
 
-       e_gras_dd_scalar_encoding_uint,
-       e_gras_dd_scalar_encoding_sint,
-       e_gras_dd_scalar_encoding_float,
+  e_gras_dd_scalar_encoding_uint,
+  e_gras_dd_scalar_encoding_sint,
+  e_gras_dd_scalar_encoding_float,
 
-       e_gras_dd_scalar_encoding_invalid
+  e_gras_dd_scalar_encoding_invalid
 };
 typedef struct s_gras_dd_cat_scalar {
-       enum e_gras_dd_scalar_encoding encoding;
-       gras_ddt_scalar_type_t type; /* to check easily that redefinition matches */
+  enum e_gras_dd_scalar_encoding encoding;
+  gras_ddt_scalar_type_t type;  /* to check easily that redefinition matches */
 } gras_dd_cat_scalar_t;
 
 /**
@@ -139,8 +139,8 @@ typedef struct s_gras_dd_cat_scalar {
  * Specific fields of a struct
  */
 typedef struct s_gras_dd_cat_struct {
-       xbt_dynar_t fields; /* elm type = gras_dd_cat_field_t */
-       int closed; /* gras_datadesc_declare_struct_close() was called */
+  xbt_dynar_t fields;           /* elm type = gras_dd_cat_field_t */
+  int closed;                   /* gras_datadesc_declare_struct_close() was called */
 } gras_dd_cat_struct_t;
 
 /**
@@ -149,9 +149,9 @@ typedef struct s_gras_dd_cat_struct {
  * Specific fields of a union
  */
 typedef struct s_gras_dd_cat_union {
-       gras_datadesc_type_cb_int_t selector;
-       xbt_dynar_t fields; /* elm type = gras_dd_cat_field_t */
-       int closed; /* gras_datadesc_declare_union_close() was called */
+  gras_datadesc_type_cb_int_t selector;
+  xbt_dynar_t fields;           /* elm type = gras_dd_cat_field_t */
+  int closed;                   /* gras_datadesc_declare_union_close() was called */
 } gras_dd_cat_union_t;
 
 /**
@@ -160,10 +160,10 @@ typedef struct s_gras_dd_cat_union {
  * Specific fields of a reference
  */
 typedef struct s_gras_dd_cat_ref {
-       gras_datadesc_type_t      type;
+  gras_datadesc_type_t type;
 
-       /* callback used to return the referenced type number  */
-       gras_datadesc_selector_t  selector;
+  /* callback used to return the referenced type number  */
+  gras_datadesc_selector_t selector;
 } gras_dd_cat_ref_t;
 
 
@@ -173,13 +173,13 @@ typedef struct s_gras_dd_cat_ref {
  * Specific fields of an array
  */
 typedef struct s_gras_dd_cat_array {
-       gras_datadesc_type_t  type;
+  gras_datadesc_type_t type;
 
-       /* element_count == -1 means dynamically defined */
-       long int           fixed_size;
+  /* element_count == -1 means dynamically defined */
+  long int fixed_size;
 
-       /* callback used to return the dynamic length */
-       gras_datadesc_type_cb_int_t dynamic_size;
+  /* callback used to return the dynamic length */
+  gras_datadesc_type_cb_int_t dynamic_size;
 
 } gras_dd_cat_array_t;
 
@@ -189,12 +189,12 @@ typedef struct s_gras_dd_cat_array {
  * Specific data to each possible category
  */
 union u_gras_datadesc_category {
-       void                  *undefined_data;
-       gras_dd_cat_scalar_t   scalar_data;
-       gras_dd_cat_struct_t   struct_data;
-       gras_dd_cat_union_t    union_data;
-       gras_dd_cat_ref_t      ref_data;
-       gras_dd_cat_array_t    array_data;
+  void *undefined_data;
+  gras_dd_cat_scalar_t scalar_data;
+  gras_dd_cat_struct_t struct_data;
+  gras_dd_cat_union_t union_data;
+  gras_dd_cat_ref_t ref_data;
+  gras_dd_cat_array_t array_data;
 };
 
 /****************************************/
@@ -206,46 +206,46 @@ union u_gras_datadesc_category {
  * Type descriptor.
  */
 typedef struct s_gras_datadesc_type {
-       /* headers for the data set */
-       int                                  code;
-       char                                *name;
-       unsigned int                         name_len;
+  /* headers for the data set */
+  int code;
+  char *name;
+  unsigned int name_len;
 
-       /* payload */
-       long int                             size[gras_arch_count]; /* Cannot be unsigned: -1 means dynamic */
+  /* payload */
+  long int size[gras_arch_count];       /* Cannot be unsigned: -1 means dynamic */
 
-       unsigned long int                    alignment[gras_arch_count];
-       unsigned long int                    aligned_size[gras_arch_count];
+  unsigned long int alignment[gras_arch_count];
+  unsigned long int aligned_size[gras_arch_count];
 
-       enum  e_gras_datadesc_type_category  category_code;
-       union u_gras_datadesc_category       category;
+  enum e_gras_datadesc_type_category category_code;
+  union u_gras_datadesc_category category;
 
-       gras_datadesc_type_cb_void_t         send;
-       gras_datadesc_type_cb_void_t         recv;
+  gras_datadesc_type_cb_void_t send;
+  gras_datadesc_type_cb_void_t recv;
 
-       /* flags */
-       int                                  cycle :1;
+  /* flags */
+  int cycle:1;
 
-       /* random value for users (like default value or whatever) */
-       char                                 extra[SIZEOF_MAX];
+  /* random value for users (like default value or whatever) */
+  char extra[SIZEOF_MAX];
 
 } s_gras_datadesc_type_t;
 
 /***************************
  * constructor/desctructor *
  ***************************/
-void gras_datadesc_free(gras_datadesc_type_t *type);
+void gras_datadesc_free(gras_datadesc_type_t * type);
 
 gras_datadesc_type_t
-gras_datadesc_scalar(const char                       *name,
-               gras_ddt_scalar_type_t           type,
-               enum e_gras_dd_scalar_encoding   encoding);
+gras_datadesc_scalar(const char *name,
+                     gras_ddt_scalar_type_t type,
+                     enum e_gras_dd_scalar_encoding encoding);
 
 /****************************************************
  * Callback persistant state constructor/destructor *
  ****************************************************/
 gras_cbps_t gras_cbps_new(void);
-void gras_cbps_free(gras_cbps_t *state);
+void gras_cbps_free(gras_cbps_t * state);
 void gras_cbps_reset(gras_cbps_t state);
 
 /***************
@@ -253,13 +253,11 @@ void gras_cbps_reset(gras_cbps_t state);
  ***************/
 void
 gras_dd_convert_elm(gras_datadesc_type_t type, int count,
-               int r_arch,
-               void *src, void *dst);
+                    int r_arch, void *src, void *dst);
 
 /********************************************************************
  * Dictionnary containing the constant values for the parsing macro *
  ********************************************************************/
-extern xbt_dict_t gras_dd_constants; /* lives in ddt_parse.c of course */
+extern xbt_dict_t gras_dd_constants;    /* lives in ddt_parse.c of course */
 
 #endif /* GRAS_DATADESC_PRIVATE_H */
-
index e310edf..d94fdc3 100644 (file)
@@ -15,8 +15,8 @@
 
 #include "gras/DataDesc/datadesc_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_convert,gras_ddt,
-               "Inter-architecture convertions");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_convert, gras_ddt,
+                                "Inter-architecture convertions");
 
 /***
  *** Table of all known architectures:
@@ -37,54 +37,52 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_convert,gras_ddt,
 
 const gras_arch_desc_t gras_arches[gras_arch_count] = {
 
-               {"little32_1",  0, {1,2,4,4,8,   4,4,   4,8},   /* little endian, 1 byte alignement (win32) */
-                               {1,1,1,1,1,   1,1,   1,1}},
+  {"little32_1", 0, {1, 2, 4, 4, 8, 4, 4, 4, 8},        /* little endian, 1 byte alignement (win32) */
+   {1, 1, 1, 1, 1, 1, 1, 1, 1}},
 
-                               {"little32_2",  0, {1,2,4,4,8,   4,4,   4,8},   /* little endian, 2 bytes alignements (win32) */
-                                               {1,2,2,2,2,   2,2,   2,2}},
+  {"little32_2", 0, {1, 2, 4, 4, 8, 4, 4, 4, 8},        /* little endian, 2 bytes alignements (win32) */
+   {1, 2, 2, 2, 2, 2, 2, 2, 2}},
 
-                                               {"little32_4",    0, {1,2,4,4,8,   4,4,   4,8},   /* little endian, 4 bytes alignements (win32 and linux x86) */
-                                                               {1,2,4,4,4,   4,4,   4,4}},
+  {"little32_4", 0, {1, 2, 4, 4, 8, 4, 4, 4, 8},        /* little endian, 4 bytes alignements (win32 and linux x86) */
+   {1, 2, 4, 4, 4, 4, 4, 4, 4}},
 
-                                                               {"little32_8",    0, {1,2,4,4,8,   4,4,   4,8},         /* little endian, 8 bytes alignement (win32) */
-                                                                               {1,2,4,4,8,   4,4,   4,8}},
+  {"little32_8", 0, {1, 2, 4, 4, 8, 4, 4, 4, 8},        /* little endian, 8 bytes alignement (win32) */
+   {1, 2, 4, 4, 8, 4, 4, 4, 8}},
 
-                                                                               {"little64",      0, {1,2,4,8,8,   8,8,   4,8}, /* alpha, ia64 */
-                                                                                               {1,2,4,8,8,   8,8,   4,8}},
+  {"little64", 0, {1, 2, 4, 8, 8, 8, 8, 4, 8},  /* alpha, ia64 */
+   {1, 2, 4, 8, 8, 8, 8, 4, 8}},
 
-                                                                                               {"big32_8",       1, {1,2,4,4,8,   4,4,   4,8},
-                                                                                                               {1,2,4,4,8,   4,4,   4,8}},
+  {"big32_8", 1, {1, 2, 4, 4, 8, 4, 4, 4, 8},
+   {1, 2, 4, 4, 8, 4, 4, 4, 8}},
 
-                                                                                                               {"big32_8_4",     1, {1,2,4,4,8,   4,4,   4,8}, /* AIX */
-                                                                                                                               {1,2,4,4,8,   4,4,   4,4}},
+  {"big32_8_4", 1, {1, 2, 4, 4, 8, 4, 4, 4, 8}, /* AIX */
+   {1, 2, 4, 4, 8, 4, 4, 4, 4}},
 
-                                                                                                                               {"big32_4",       1, {1,2,4,4,8,   4,4,   4,8}, /* G5 */
-                                                                                                                                               {1,2,4,4,4,   4,4,   4,4}},
+  {"big32_4", 1, {1, 2, 4, 4, 8, 4, 4, 4, 8},   /* G5 */
+   {1, 2, 4, 4, 4, 4, 4, 4, 4}},
 
-                                                                                                                                               {"big32_2",       1, {1,2,4,4,8,   4,4,   4,8}, /* ARM */
-                                                                                                                                                               {1,2,2,2,2,   2,2,   2,2}},
+  {"big32_2", 1, {1, 2, 4, 4, 8, 4, 4, 4, 8},   /* ARM */
+   {1, 2, 2, 2, 2, 2, 2, 2, 2}},
 
-                                                                                                                                                               {"big64",         1, {1,2,4,8,8,   8,8,   4,8}, /* sparc */
-                                                                                                                                                                               {1,2,4,8,8,   8,8,   4,8}},
+  {"big64", 1, {1, 2, 4, 8, 8, 8, 8, 4, 8},     /* sparc */
+   {1, 2, 4, 8, 8, 8, 8, 4, 8}},
 
-                                                                                                                                                                               {"big64_8_4",     1, {1,2,4,8,8,   8,8,   4,8}, /* aix with -maix64 */
-                                                                                                                                                                                               {1,2,4,8,8,   8,8,   4,4}}
+  {"big64_8_4", 1, {1, 2, 4, 8, 8, 8, 8, 4, 8}, /* aix with -maix64 */
+   {1, 2, 4, 8, 8, 8, 8, 4, 4}}
 };
 
-const char *gras_datadesc_arch_name(int code) {
-       if (code < 0 || code >= gras_arch_count)
-               return "[unknown arch]";
-       return gras_arches[code].name;
+const char *gras_datadesc_arch_name(int code)
+{
+  if (code < 0 || code >= gras_arch_count)
+    return "[unknown arch]";
+  return gras_arches[code].name;
 }
 
 
 /**
  * Local function doing the grunt work
  */
-static void
-gras_dd_reverse_bytes(void *to,
-               const void *from,
-               size_t length);
+static void gras_dd_reverse_bytes(void *to, const void *from, size_t length);
 
 /**
  * gras_dd_convert_elm:
@@ -95,166 +93,158 @@ gras_dd_reverse_bytes(void *to,
  */
 void
 gras_dd_convert_elm(gras_datadesc_type_t type, int count,
-               int r_arch,
-               void *src, void *dst) {
-       gras_dd_cat_scalar_t scal = type->category.scalar_data;
-       int cpt;
-       const void *r_data;
-       void *l_data;
-       unsigned long r_size, l_size;
-       /* Hexadecimal displayer
-  union {
-    char c[sizeof(int)];
-    int i;
-  } tester;
-        */
-
-       xbt_assert(type->category_code == e_gras_datadesc_type_cat_scalar);
-       xbt_assert(r_arch != GRAS_THISARCH);
-
-       r_size = type->size[r_arch];
-       l_size = type->size[GRAS_THISARCH];
-       DEBUG4("r_size=%lu l_size=%lu,    src=%p dst=%p",
-                       r_size,l_size,src,dst);
-
-       DEBUG2("remote=%c local=%c", gras_arches[r_arch].endian?'B':'l',
-                       gras_arches[GRAS_THISARCH].endian?'B':'l');
-
-       if(r_size != l_size) {
-               for(cpt = 0, r_data = src, l_data = dst;
-               cpt < count;
-               cpt++,
-               r_data = (char *)r_data + r_size,
-               l_data = (char *)l_data + l_size) {
-
-                       /*
-      fprintf(stderr,"r_data=");
-      for (cpt=0; cpt<r_size; cpt++) {
-       tester.i=0;
-       tester.c[0]= ((char*)r_data)[cpt];
-       fprintf(stderr,"\\%02x", tester.i);
+                    int r_arch, void *src, void *dst)
+{
+  gras_dd_cat_scalar_t scal = type->category.scalar_data;
+  int cpt;
+  const void *r_data;
+  void *l_data;
+  unsigned long r_size, l_size;
+  /* Hexadecimal displayer
+     union {
+     char c[sizeof(int)];
+     int i;
+     } tester;
+   */
+
+  xbt_assert(type->category_code == e_gras_datadesc_type_cat_scalar);
+  xbt_assert(r_arch != GRAS_THISARCH);
+
+  r_size = type->size[r_arch];
+  l_size = type->size[GRAS_THISARCH];
+  DEBUG4("r_size=%lu l_size=%lu,    src=%p dst=%p", r_size, l_size, src, dst);
+
+  DEBUG2("remote=%c local=%c", gras_arches[r_arch].endian ? 'B' : 'l',
+         gras_arches[GRAS_THISARCH].endian ? 'B' : 'l');
+
+  if (r_size != l_size) {
+    for (cpt = 0, r_data = src, l_data = dst;
+         cpt < count;
+         cpt++,
+         r_data = (char *) r_data + r_size,
+         l_data = (char *) l_data + l_size) {
+
+      /*
+         fprintf(stderr,"r_data=");
+         for (cpt=0; cpt<r_size; cpt++) {
+         tester.i=0;
+         tester.c[0]= ((char*)r_data)[cpt];
+         fprintf(stderr,"\\%02x", tester.i);
+         }
+         fprintf(stderr,"\n");
+       */
+
+      /* Resize that damn integer, pal */
+
+      unsigned char *l_sign, *r_sign;
+      int padding;
+      int sizeChange = l_size - r_size;
+      int lowOrderFirst = !gras_arches[r_arch].endian ||
+        gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian;
+
+      DEBUG5("Resize integer %d from %lu @%p to %lu @%p",
+             cpt, r_size, r_data, l_size, l_data);
+      xbt_assert0(r_data != l_data, "Impossible to resize in place");
+
+      if (sizeChange < 0) {
+        DEBUG3("Truncate %d bytes (%s,%s)", -sizeChange,
+               lowOrderFirst ? "lowOrderFirst" : "bigOrderFirst",
+               scal.encoding ==
+               e_gras_dd_scalar_encoding_sint ? "signed" : "unsigned");
+        /* Truncate high-order bytes. */
+        memcpy(l_data,
+               gras_arches[r_arch].endian ? ((char *) r_data - sizeChange)
+               : r_data, l_size);
+
+        if (scal.encoding == e_gras_dd_scalar_encoding_sint) {
+          DEBUG0("This is signed");
+          /* Make sure the high order bit of r_data and l_data are the same */
+          l_sign = gras_arches[GRAS_THISARCH].endian
+            ? ((unsigned char *) l_data + l_size - 1)
+            : (unsigned char *) l_data;
+          r_sign = gras_arches[r_arch].endian
+            ? ((unsigned char *) r_data + r_size - 1)
+            : (unsigned char *) r_data;
+          DEBUG2("This is signed (r_sign=%c l_sign=%c", *r_sign, *l_sign);
+
+          if ((*r_sign > 127) != (*l_sign > 127)) {
+            if (*r_sign > 127)
+              *l_sign += 128;
+            else
+              *l_sign -= 128;
+          }
+        }
+      } else {
+        DEBUG1("Extend %d bytes", sizeChange);
+        if (scal.encoding != e_gras_dd_scalar_encoding_sint) {
+          DEBUG0("This is signed");
+          padding = 0;          /* pad unsigned with 0 */
+        } else {
+          /* extend sign */
+          r_sign =
+            gras_arches[r_arch].endian ? ((unsigned char *) r_data + r_size -
+                                          1)
+            : (unsigned char *) r_data;
+          padding = (*r_sign > 127) ? 0xff : 0;
+        }
+
+        memset(l_data, padding, l_size);
+        memcpy(!gras_arches[r_arch].endian ? l_data
+               : ((char *) l_data + sizeChange), r_data, r_size);
+
+        /*
+           fprintf(stderr,"r_data=");
+           for (cpt=0; cpt<r_size; cpt++) {
+           tester.i=0;
+           tester.c[0] = ((char*)r_data)[cpt];
+           fprintf(stderr,"\\%02x", tester.i);
+           }
+           fprintf(stderr,"\n");
+
+           fprintf(stderr,"l_data=");
+           for (cpt=0; cpt<l_size; cpt++) {
+           tester.i=0;
+           tester.c[0]= ((char*)l_data)[cpt];
+           fprintf(stderr,"\\%02x", tester.i);
+           } fprintf(stderr,"\n");
+         */
       }
-      fprintf(stderr,"\n");
-                        */
-
-                       /* Resize that damn integer, pal */
-
-                       unsigned char *l_sign, *r_sign;
-                       int padding;
-                       int sizeChange = l_size - r_size;
-                       int lowOrderFirst = !gras_arches[r_arch].endian ||
-                       gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian;
-
-                       DEBUG5("Resize integer %d from %lu @%p to %lu @%p",
-                                       cpt, r_size,r_data, l_size,l_data);
-                       xbt_assert0(r_data != l_data, "Impossible to resize in place");
-
-                       if(sizeChange < 0) {
-                               DEBUG3("Truncate %d bytes (%s,%s)", -sizeChange,
-                                               lowOrderFirst?"lowOrderFirst":"bigOrderFirst",
-                                                               scal.encoding == e_gras_dd_scalar_encoding_sint?"signed":"unsigned");
-                               /* Truncate high-order bytes. */
-                               memcpy(l_data,
-                                               gras_arches[r_arch].endian ? ((char*)r_data-sizeChange)
-                                                               :         r_data,
-                                                               l_size);
-
-                               if(scal.encoding == e_gras_dd_scalar_encoding_sint) {
-                                       DEBUG0("This is signed");
-                                       /* Make sure the high order bit of r_data and l_data are the same */
-                                       l_sign = gras_arches[GRAS_THISARCH].endian
-                                       ? ((unsigned char*)l_data + l_size - 1)
-                                                       :  (unsigned char*)l_data;
-                                       r_sign = gras_arches[r_arch].endian
-                                       ? ((unsigned char*)r_data + r_size - 1)
-                                                       :  (unsigned char*)r_data;
-                                       DEBUG2("This is signed (r_sign=%c l_sign=%c", *r_sign,*l_sign);
-
-                                       if ((*r_sign > 127) != (*l_sign > 127)) {
-                                               if(*r_sign > 127)
-                                                       *l_sign += 128;
-                                               else
-                                                       *l_sign -= 128;
-                                       }
-                               }
-                       } else {
-                               DEBUG1("Extend %d bytes", sizeChange);
-                               if (scal.encoding != e_gras_dd_scalar_encoding_sint) {
-                                       DEBUG0("This is signed");
-                                       padding = 0; /* pad unsigned with 0 */
-                               } else {
-                                       /* extend sign */
-                                       r_sign = gras_arches[r_arch].endian ? ((unsigned char*)r_data + r_size - 1)
-                                                       :  (unsigned char*)r_data;
-                                       padding = (*r_sign > 127) ? 0xff : 0;
-                               }
-
-                               memset(l_data, padding, l_size);
-                               memcpy(!gras_arches[r_arch].endian ? l_data : ((char *)l_data + sizeChange),
-                                               r_data, r_size);
-
-                               /*
-       fprintf(stderr,"r_data=");
-       for (cpt=0; cpt<r_size; cpt++) {
-         tester.i=0;
-         tester.c[0] = ((char*)r_data)[cpt];
-         fprintf(stderr,"\\%02x", tester.i);
-       }
-       fprintf(stderr,"\n");
-
-       fprintf(stderr,"l_data=");
-       for (cpt=0; cpt<l_size; cpt++) {
-         tester.i=0;
-         tester.c[0]= ((char*)l_data)[cpt];
-         fprintf(stderr,"\\%02x", tester.i);
-       } fprintf(stderr,"\n");
-                                */
-                       }
-               }
-       }
-
-       /* flip bytes if needed */
-       if(gras_arches[r_arch].endian != gras_arches[GRAS_THISARCH].endian &&
-                       (l_size * count)  > 1) {
-
-               for(cpt = 0, r_data=dst, l_data=dst;
-               cpt < count;
-               cpt++,
-               r_data = (char *)r_data + l_size, /* resizing already done */
-               l_data = (char *)l_data + l_size) {
-
-                       DEBUG1("Flip elm %d",cpt);
-                       gras_dd_reverse_bytes(l_data, r_data, l_size);
-               }
-       }
+    }
+  }
 
-}
-
-static void
-gras_dd_reverse_bytes(void *to,
-               const void *from,
-               size_t length) {
+  /* flip bytes if needed */
+  if (gras_arches[r_arch].endian != gras_arches[GRAS_THISARCH].endian &&
+      (l_size * count) > 1) {
 
-       char charBegin;
-       const char *fromBegin;
-       const char *fromEnd;
-       char *toBegin;
-       char *toEnd;
+    for (cpt = 0, r_data = dst, l_data = dst; cpt < count; cpt++, r_data = (char *) r_data + l_size,    /* resizing already done */
+         l_data = (char *) l_data + l_size) {
 
-       for(fromBegin = (const char *)from,
-                       fromEnd = fromBegin + length - 1,
-                       toBegin = (char *)to,
-                       toEnd = toBegin + length - 1;
+      DEBUG1("Flip elm %d", cpt);
+      gras_dd_reverse_bytes(l_data, r_data, l_size);
+    }
+  }
 
-       fromBegin <= fromEnd;
-
-       fromBegin++, fromEnd--,
-       toBegin++, toEnd--) {
+}
 
-               charBegin = *fromBegin;
-               *toBegin = *fromEnd;
-               *toEnd = charBegin;
-       }
+static void gras_dd_reverse_bytes(void *to, const void *from, size_t length)
+{
+
+  char charBegin;
+  const char *fromBegin;
+  const char *fromEnd;
+  char *toBegin;
+  char *toEnd;
+
+  for (fromBegin = (const char *) from,
+       fromEnd = fromBegin + length - 1,
+       toBegin = (char *) to,
+       toEnd = toBegin + length - 1;
+       fromBegin <= fromEnd; fromBegin++, fromEnd--, toBegin++, toEnd--) {
+
+    charBegin = *fromBegin;
+    *toBegin = *fromEnd;
+    *toEnd = charBegin;
+  }
 }
 
 
@@ -263,7 +253,7 @@ gras_dd_reverse_bytes(void *to,
  *
  * returns the ID of the architecture the process is running on
  */
-int
-gras_arch_selfid(void) {
-       return GRAS_THISARCH;
+int gras_arch_selfid(void)
+{
+  return GRAS_THISARCH;
 }
index db76927..f893efe 100644 (file)
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "xbt/misc.h" /* min()/max() */
+#include "xbt/misc.h"           /* min()/max() */
 #include "xbt/ex.h"
 #include "gras/DataDesc/datadesc_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_create,gras_ddt,"Creating new datadescriptions");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_create, gras_ddt,
+                                "Creating new datadescriptions");
 
 /*** prototypes ***/
 static gras_dd_cat_field_t
-gras_dd_find_field(gras_datadesc_type_t  type,
-               const char           *field_name);
+gras_dd_find_field(gras_datadesc_type_t type, const char *field_name);
 /**
  * gras_ddt_freev:
  *
  * gime that memory back, dude. I mean it.
  */
-void gras_ddt_freev(void *ddt) {
-       gras_datadesc_type_t type= (gras_datadesc_type_t)ddt;
+void gras_ddt_freev(void *ddt)
+{
+  gras_datadesc_type_t type = (gras_datadesc_type_t) ddt;
 
-       if (type) {
-               gras_datadesc_free(&type);
-       }
+  if (type) {
+    gras_datadesc_free(&type);
+  }
 }
 
-static gras_datadesc_type_t gras_ddt_new(const char *name) {
-       gras_datadesc_type_t res;
+static gras_datadesc_type_t gras_ddt_new(const char *name)
+{
+  gras_datadesc_type_t res;
 
-       XBT_IN1("(%s)",name);
-       res=xbt_new0(s_gras_datadesc_type_t,1);
+  XBT_IN1("(%s)", name);
+  res = xbt_new0(s_gras_datadesc_type_t, 1);
 
-       res->name = (char*)strdup(name);
-       res->name_len = strlen(name);
-       res->cycle = 0;
+  res->name = (char *) strdup(name);
+  res->name_len = strlen(name);
+  res->cycle = 0;
 
-       xbt_set_add(gras_datadesc_set_local,
-                       (xbt_set_elm_t)res,gras_ddt_freev);
-       XBT_OUT;
-       return res;
+  xbt_set_add(gras_datadesc_set_local, (xbt_set_elm_t) res, gras_ddt_freev);
+  XBT_OUT;
+  return res;
 }
 
 /** @brief retrieve an existing message type from its name (or NULL if it does not exist). */
-gras_datadesc_type_t gras_datadesc_by_name_or_null (const char *name) {
-       xbt_ex_t e;
-       gras_datadesc_type_t res = NULL;
-
-       TRY {
-               res = gras_datadesc_by_name(name);
-       } CATCH(e) {
-               res = NULL;
-               xbt_ex_free(e);
-       }
-       return res;
+gras_datadesc_type_t gras_datadesc_by_name_or_null(const char *name)
+{
+  xbt_ex_t e;
+  gras_datadesc_type_t res = NULL;
+
+  TRY {
+    res = gras_datadesc_by_name(name);
+  } CATCH(e) {
+    res = NULL;
+    xbt_ex_free(e);
+  }
+  return res;
 }
+
 /**
  * Search the given datadesc (or raises an exception if it can't be found)
  */
-gras_datadesc_type_t gras_datadesc_by_name(const char *name) {
-       xbt_ex_t e;
-       gras_datadesc_type_t res = NULL;
-       volatile int found = 0;
-       TRY {
-               res = (gras_datadesc_type_t)xbt_set_get_by_name(gras_datadesc_set_local,name);
-               found = 1;
-       } CATCH(e) {
-               if (e.category != not_found_error)
-                       RETHROW;
-               xbt_ex_free(e);
-       }
-       if (!found)
-               THROW1(not_found_error,0,"No registred datatype of that name: %s",name);
-
-       return res;
+gras_datadesc_type_t gras_datadesc_by_name(const char *name)
+{
+  xbt_ex_t e;
+  gras_datadesc_type_t res = NULL;
+  volatile int found = 0;
+  TRY {
+    res =
+      (gras_datadesc_type_t) xbt_set_get_by_name(gras_datadesc_set_local,
+                                                 name);
+    found = 1;
+  } CATCH(e) {
+    if (e.category != not_found_error)
+      RETHROW;
+    xbt_ex_free(e);
+  }
+  if (!found)
+    THROW1(not_found_error, 0, "No registred datatype of that name: %s",
+           name);
+
+  return res;
 }
 
 /**
  * Retrieve a type from its code (or NULL if not found)
  */
-gras_datadesc_type_t gras_datadesc_by_id(long int code) {
-       xbt_ex_t e;
-       gras_datadesc_type_t res=NULL;
-       TRY {
-               res = (gras_datadesc_type_t)xbt_set_get_by_id(gras_datadesc_set_local,code);
-       } CATCH(e) {
-               if (e.category != not_found_error)
-                       RETHROW;
-               xbt_ex_free(e);
-               res = NULL;
-       }
-       return res;
+gras_datadesc_type_t gras_datadesc_by_id(long int code)
+{
+  xbt_ex_t e;
+  gras_datadesc_type_t res = NULL;
+  TRY {
+    res =
+      (gras_datadesc_type_t) xbt_set_get_by_id(gras_datadesc_set_local, code);
+  } CATCH(e) {
+    if (e.category != not_found_error)
+      RETHROW;
+    xbt_ex_free(e);
+    res = NULL;
+  }
+  return res;
 }
 
 /**
  * Create a new scalar and give a pointer to it
  */
 gras_datadesc_type_t
-gras_datadesc_scalar(const char                      *name,
-               gras_ddt_scalar_type_t           type,
-               enum e_gras_dd_scalar_encoding   encoding) {
-
-       gras_datadesc_type_t res;
-       long int arch;
-
-       XBT_IN;
-       res = gras_datadesc_by_name_or_null(name);
-       if (res) {
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_scalar,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.scalar_data.encoding == encoding,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.scalar_data.type == type,
-                               "Redefinition of type %s does not match", name);
-               VERB1("Discarding redefinition of %s",name);
-               return res;
-       }
-       res = gras_ddt_new(name);
-
-       for (arch = 0; arch < gras_arch_count; arch ++) {
-               res->size[arch]         = gras_arches[arch].sizeofs[type];
-               res->alignment[arch]    = gras_arches[arch].boundaries[type];
-               res->aligned_size[arch] = ddt_aligned(res->size[arch], res->alignment[arch]);
-       }
-
-       res->category_code                 = e_gras_datadesc_type_cat_scalar;
-       res->category.scalar_data.encoding = encoding;
-       res->category.scalar_data.type     = type;
-       XBT_OUT;
-
-       return res;
+gras_datadesc_scalar(const char *name,
+                     gras_ddt_scalar_type_t type,
+                     enum e_gras_dd_scalar_encoding encoding)
+{
+
+  gras_datadesc_type_t res;
+  long int arch;
+
+  XBT_IN;
+  res = gras_datadesc_by_name_or_null(name);
+  if (res) {
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_scalar,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.scalar_data.encoding == encoding,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.scalar_data.type == type,
+                "Redefinition of type %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+    return res;
+  }
+  res = gras_ddt_new(name);
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = gras_arches[arch].sizeofs[type];
+    res->alignment[arch] = gras_arches[arch].boundaries[type];
+    res->aligned_size[arch] =
+      ddt_aligned(res->size[arch], res->alignment[arch]);
+  }
+
+  res->category_code = e_gras_datadesc_type_cat_scalar;
+  res->category.scalar_data.encoding = encoding;
+  res->category.scalar_data.type = type;
+  XBT_OUT;
+
+  return res;
 }
 
 
 /** Frees one struct or union field */
-void gras_dd_cat_field_free(void *f) {
-       gras_dd_cat_field_t field = *(gras_dd_cat_field_t *)f;
-       XBT_IN;
-       if (field) {
-               if (field->name)
-                       free(field->name);
-               free(field);
-       }
-       XBT_OUT;
+void gras_dd_cat_field_free(void *f)
+{
+  gras_dd_cat_field_t field = *(gras_dd_cat_field_t *) f;
+  XBT_IN;
+  if (field) {
+    if (field->name)
+      free(field->name);
+    free(field);
+  }
+  XBT_OUT;
 }
 
 /** \brief Declare a new structure description */
-gras_datadesc_type_t
-gras_datadesc_struct(const char            *name) {
-
-       gras_datadesc_type_t res;
-       long int arch;
-
-       XBT_IN1("(%s)",name);
-       res = gras_datadesc_by_name_or_null(name);
-       if (res) {
-               /* FIXME: Check that field redefinition matches */
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_struct,
-                               "Redefinition of type %s does not match", name);
-               VERB1("Discarding redefinition of %s",name);
-               return res;
-       }
-       res = gras_ddt_new(name);
-
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               res->size[arch] = 0;
-               res->alignment[arch] = 0;
-               res->aligned_size[arch] = 0;
-       }
-       res->category_code = e_gras_datadesc_type_cat_struct;
-       res->category.struct_data.fields =
-               xbt_dynar_new(sizeof(gras_dd_cat_field_t),
-                               gras_dd_cat_field_free);
-
-       XBT_OUT;
-       return res;
+gras_datadesc_type_t gras_datadesc_struct(const char *name)
+{
+
+  gras_datadesc_type_t res;
+  long int arch;
+
+  XBT_IN1("(%s)", name);
+  res = gras_datadesc_by_name_or_null(name);
+  if (res) {
+    /* FIXME: Check that field redefinition matches */
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_struct,
+                "Redefinition of type %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+    return res;
+  }
+  res = gras_ddt_new(name);
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = 0;
+    res->alignment[arch] = 0;
+    res->aligned_size[arch] = 0;
+  }
+  res->category_code = e_gras_datadesc_type_cat_struct;
+  res->category.struct_data.fields =
+    xbt_dynar_new(sizeof(gras_dd_cat_field_t), gras_dd_cat_field_free);
+
+  XBT_OUT;
+  return res;
 }
 
 /** \brief Append a new field to a structure description */
 void
 gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
-               const char          *name,
-               gras_datadesc_type_t field_type) {
-
-       gras_dd_cat_field_t field;
-       int arch;
-
-       xbt_assert2(field_type,
-                       "Cannot add the field '%s' into struct '%s': its type is NULL",
-                       name,struct_type->name);
-       XBT_IN3("(%s %s.%s;)",field_type->name,struct_type->name,name);
-       if (struct_type->category.struct_data.closed) {
-               VERB1("Ignoring request to add field to struct %s (closed. Redefinition?)",
-                               struct_type->name);
-               return;
-       }
-
-       xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
-                       "Cannot add a dynamically sized field in structure %s",
-                       struct_type->name);
-
-       field=xbt_new(s_gras_dd_cat_field_t,1);
-       field->name   = (char*)strdup(name);
-
-       DEBUG0("----------------");
-       DEBUG3("PRE s={size=%ld,align=%ld,asize=%ld}",
-                       struct_type->size[GRAS_THISARCH],
-                       struct_type->alignment[GRAS_THISARCH],
-                       struct_type->aligned_size[GRAS_THISARCH]);
-
-
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               field->offset[arch] = ddt_aligned(struct_type->size[arch],
-                               field_type->alignment[arch]);
-
-               struct_type->size[arch] = field->offset[arch] + field_type->size[arch];
-               struct_type->alignment[arch] = max(struct_type->alignment[arch],
-                               field_type->alignment[arch]);
-               struct_type->aligned_size[arch] = ddt_aligned(struct_type->size[arch],
-                               struct_type->alignment[arch]);
-       }
-       field->type   = field_type;
-       field->send   = NULL;
-       field->recv   = NULL;
-
-       xbt_dynar_push(struct_type->category.struct_data.fields, &field);
-
-       DEBUG3("Push a %s into %s at offset %ld.",
-                       field_type->name, struct_type->name,field->offset[GRAS_THISARCH]);
-       DEBUG3("  f={size=%ld,align=%ld,asize=%ld}",
-                       field_type->size[GRAS_THISARCH],
-                       field_type->alignment[GRAS_THISARCH],
-                       field_type->aligned_size[GRAS_THISARCH]);
-       DEBUG3("  s={size=%ld,align=%ld,asize=%ld}",
-                       struct_type->size[GRAS_THISARCH],
-                       struct_type->alignment[GRAS_THISARCH],
-                       struct_type->aligned_size[GRAS_THISARCH]);
-       XBT_OUT;
+                            const char *name, gras_datadesc_type_t field_type)
+{
+
+  gras_dd_cat_field_t field;
+  int arch;
+
+  xbt_assert2(field_type,
+              "Cannot add the field '%s' into struct '%s': its type is NULL",
+              name, struct_type->name);
+  XBT_IN3("(%s %s.%s;)", field_type->name, struct_type->name, name);
+  if (struct_type->category.struct_data.closed) {
+    VERB1
+      ("Ignoring request to add field to struct %s (closed. Redefinition?)",
+       struct_type->name);
+    return;
+  }
+
+  xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
+              "Cannot add a dynamically sized field in structure %s",
+              struct_type->name);
+
+  field = xbt_new(s_gras_dd_cat_field_t, 1);
+  field->name = (char *) strdup(name);
+
+  DEBUG0("----------------");
+  DEBUG3("PRE s={size=%ld,align=%ld,asize=%ld}",
+         struct_type->size[GRAS_THISARCH],
+         struct_type->alignment[GRAS_THISARCH],
+         struct_type->aligned_size[GRAS_THISARCH]);
+
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    field->offset[arch] = ddt_aligned(struct_type->size[arch],
+                                      field_type->alignment[arch]);
+
+    struct_type->size[arch] = field->offset[arch] + field_type->size[arch];
+    struct_type->alignment[arch] = max(struct_type->alignment[arch],
+                                       field_type->alignment[arch]);
+    struct_type->aligned_size[arch] = ddt_aligned(struct_type->size[arch],
+                                                  struct_type->alignment
+                                                  [arch]);
+  }
+  field->type = field_type;
+  field->send = NULL;
+  field->recv = NULL;
+
+  xbt_dynar_push(struct_type->category.struct_data.fields, &field);
+
+  DEBUG3("Push a %s into %s at offset %ld.",
+         field_type->name, struct_type->name, field->offset[GRAS_THISARCH]);
+  DEBUG3("  f={size=%ld,align=%ld,asize=%ld}",
+         field_type->size[GRAS_THISARCH],
+         field_type->alignment[GRAS_THISARCH],
+         field_type->aligned_size[GRAS_THISARCH]);
+  DEBUG3("  s={size=%ld,align=%ld,asize=%ld}",
+         struct_type->size[GRAS_THISARCH],
+         struct_type->alignment[GRAS_THISARCH],
+         struct_type->aligned_size[GRAS_THISARCH]);
+  XBT_OUT;
 }
 
 /** \brief Close a structure description
  *
  * No new field can be added afterward, and it is mandatory to close the structure before using it.
  */
-void
-gras_datadesc_struct_close(gras_datadesc_type_t struct_type) {
-       int arch;
-       XBT_IN;
-       struct_type->category.struct_data.closed = 1;
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               struct_type->size[arch] = struct_type->aligned_size[arch];
-       }
-       DEBUG4("structure %s closed. size=%ld,align=%ld,asize=%ld",
-                       struct_type->name,
-                       struct_type->size[GRAS_THISARCH],
-                       struct_type->alignment[GRAS_THISARCH],
-                       struct_type->aligned_size[GRAS_THISARCH]);
+void gras_datadesc_struct_close(gras_datadesc_type_t struct_type)
+{
+  int arch;
+  XBT_IN;
+  struct_type->category.struct_data.closed = 1;
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    struct_type->size[arch] = struct_type->aligned_size[arch];
+  }
+  DEBUG4("structure %s closed. size=%ld,align=%ld,asize=%ld",
+         struct_type->name,
+         struct_type->size[GRAS_THISARCH],
+         struct_type->alignment[GRAS_THISARCH],
+         struct_type->aligned_size[GRAS_THISARCH]);
 }
 
 /**
@@ -271,9 +284,9 @@ gras_datadesc_struct_close(gras_datadesc_type_t struct_type) {
  * Note that setting this option when not needed have a rather bad effect
  * on the performance (several times slower on big data).
  */
-void
-gras_datadesc_cycle_set(gras_datadesc_type_t ddt) {
-       ddt->cycle = 1;
+void gras_datadesc_cycle_set(gras_datadesc_type_t ddt)
+{
+  ddt->cycle = 1;
 }
 
 /**
@@ -283,86 +296,86 @@ gras_datadesc_cycle_set(gras_datadesc_type_t ddt) {
  * any loop and that cycle detection mechanism are not needed.
  * (default)
  */
-void
-gras_datadesc_cycle_unset(gras_datadesc_type_t ddt) {
-       ddt->cycle = 0;
+void gras_datadesc_cycle_unset(gras_datadesc_type_t ddt)
+{
+  ddt->cycle = 0;
 }
 
 /** \brief Declare a new union description */
 gras_datadesc_type_t
-gras_datadesc_union(const char                   *name,
-               gras_datadesc_type_cb_int_t   selector) {
-
-       gras_datadesc_type_t res;
-       int arch;
-
-       XBT_IN1("(%s)",name);
-       xbt_assert0(selector,
-                       "Attempt to creat an union without field_count function");
-
-       res = gras_datadesc_by_name_or_null(name);
-       if (res) {
-               /* FIXME: Check that field redefinition matches */
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_union,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.union_data.selector == selector,
-                               "Redefinition of type %s does not match", name);
-               VERB1("Discarding redefinition of %s",name);
-               return res;
-       }
-
-       res = gras_ddt_new(name);
-
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               res->size[arch] = 0;
-               res->alignment[arch] = 0;
-               res->aligned_size[arch] = 0;
-       }
-
-       res->category_code              = e_gras_datadesc_type_cat_union;
-       res->category.union_data.fields =
-               xbt_dynar_new(sizeof(gras_dd_cat_field_t*),
-                               gras_dd_cat_field_free);
-       res->category.union_data.selector = selector;
-
-       return res;
+gras_datadesc_union(const char *name, gras_datadesc_type_cb_int_t selector)
+{
+
+  gras_datadesc_type_t res;
+  int arch;
+
+  XBT_IN1("(%s)", name);
+  xbt_assert0(selector,
+              "Attempt to creat an union without field_count function");
+
+  res = gras_datadesc_by_name_or_null(name);
+  if (res) {
+    /* FIXME: Check that field redefinition matches */
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_union,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.union_data.selector == selector,
+                "Redefinition of type %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+    return res;
+  }
+
+  res = gras_ddt_new(name);
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = 0;
+    res->alignment[arch] = 0;
+    res->aligned_size[arch] = 0;
+  }
+
+  res->category_code = e_gras_datadesc_type_cat_union;
+  res->category.union_data.fields =
+    xbt_dynar_new(sizeof(gras_dd_cat_field_t *), gras_dd_cat_field_free);
+  res->category.union_data.selector = selector;
+
+  return res;
 }
 
 /** \brief Append a new field to an union description */
-void gras_datadesc_union_append(gras_datadesc_type_t  union_type,
-               const char           *name,
-               gras_datadesc_type_t  field_type) {
-
-       gras_dd_cat_field_t field;
-       int arch;
-
-       XBT_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
-       xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
-                       "Cannot add a dynamically sized field in union %s",
-                       union_type->name);
-
-       if (union_type->category.union_data.closed) {
-               VERB1("Ignoring request to add field to union %s (closed)",
-                               union_type->name);
-               return;
-       }
-
-       field=xbt_new0(s_gras_dd_cat_field_t,1);
-
-       field->name   = (char*)strdup(name);
-       field->type   = field_type;
-       /* All offset are left to 0 in an union */
-
-       xbt_dynar_push(union_type->category.union_data.fields, &field);
-
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               union_type->size[arch] = max(union_type->size[arch],
-                               field_type->size[arch]);
-               union_type->alignment[arch] = max(union_type->alignment[arch],
-                               field_type->alignment[arch]);
-               union_type->aligned_size[arch] = ddt_aligned(union_type->size[arch],
-                               union_type->alignment[arch]);
-       }
+void gras_datadesc_union_append(gras_datadesc_type_t union_type,
+                                const char *name,
+                                gras_datadesc_type_t field_type)
+{
+
+  gras_dd_cat_field_t field;
+  int arch;
+
+  XBT_IN3("(%s %s.%s;)", field_type->name, union_type->name, name);
+  xbt_assert1(field_type->size[GRAS_THISARCH] >= 0,
+              "Cannot add a dynamically sized field in union %s",
+              union_type->name);
+
+  if (union_type->category.union_data.closed) {
+    VERB1("Ignoring request to add field to union %s (closed)",
+          union_type->name);
+    return;
+  }
+
+  field = xbt_new0(s_gras_dd_cat_field_t, 1);
+
+  field->name = (char *) strdup(name);
+  field->type = field_type;
+  /* All offset are left to 0 in an union */
+
+  xbt_dynar_push(union_type->category.union_data.fields, &field);
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    union_type->size[arch] = max(union_type->size[arch],
+                                 field_type->size[arch]);
+    union_type->alignment[arch] = max(union_type->alignment[arch],
+                                      field_type->alignment[arch]);
+    union_type->aligned_size[arch] = ddt_aligned(union_type->size[arch],
+                                                 union_type->alignment[arch]);
+  }
 }
 
 
@@ -370,9 +383,9 @@ void gras_datadesc_union_append(gras_datadesc_type_t  union_type,
  *
  * No new field can be added afterward, and it is mandatory to close the union before using it.
  */
-void
-gras_datadesc_union_close(gras_datadesc_type_t union_type) {
-       union_type->category.union_data.closed = 1;
+void gras_datadesc_union_close(gras_datadesc_type_t union_type)
+{
+  union_type->category.union_data.closed = 1;
 }
 
 /** \brief Copy a type under another name
@@ -380,55 +393,56 @@ gras_datadesc_union_close(gras_datadesc_type_t union_type) {
  * This may reveal useful to circumvent parsing macro limitations
  */
 gras_datadesc_type_t
-gras_datadesc_copy(const char           *name,
-               gras_datadesc_type_t  copied) {
+gras_datadesc_copy(const char *name, gras_datadesc_type_t copied)
+{
 
-       gras_datadesc_type_t res = gras_ddt_new(name);
-       char *name_cpy = res->name;
+  gras_datadesc_type_t res = gras_ddt_new(name);
+  char *name_cpy = res->name;
 
-       memcpy(res,copied,sizeof(s_gras_datadesc_type_t));
-       res->name = name_cpy;
-       return res;
+  memcpy(res, copied, sizeof(s_gras_datadesc_type_t));
+  res->name = name_cpy;
+  return res;
 }
 
 /** \brief Declare a new type being a reference to the one passed in arg */
 gras_datadesc_type_t
-gras_datadesc_ref(const char           *name,
-               gras_datadesc_type_t  referenced_type) {
-
-       gras_datadesc_type_t res;
-       gras_datadesc_type_t pointer_type = gras_datadesc_by_name("data pointer");
-       int arch;
-
-       XBT_IN1("(%s)",name);
-       res = gras_datadesc_by_name_or_null(name);
-       if (res) {
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
-                               "Redefinition of %s does not match",name);
-               xbt_assert1(res->category.ref_data.type == referenced_type,
-                               "Redefinition of %s does not match",name);
-               xbt_assert1(res->category.ref_data.selector == NULL,
-                               "Redefinition of %s does not match",name);
-               VERB1("Discarding redefinition of %s",name);
-               return res;
-       }
-
-       res = gras_ddt_new(name);
-
-       xbt_assert0(pointer_type, "Cannot get the description of data pointer");
-
-       for (arch=0; arch<gras_arch_count; arch ++){
-               res->size[arch] = pointer_type->size[arch];
-               res->alignment[arch] = pointer_type->alignment[arch];
-               res->aligned_size[arch] = pointer_type->aligned_size[arch];
-       }
-
-       res->category_code                = e_gras_datadesc_type_cat_ref;
-       res->category.ref_data.type     = referenced_type;
-       res->category.ref_data.selector = NULL;
-
-       return res;
+gras_datadesc_ref(const char *name, gras_datadesc_type_t referenced_type)
+{
+
+  gras_datadesc_type_t res;
+  gras_datadesc_type_t pointer_type = gras_datadesc_by_name("data pointer");
+  int arch;
+
+  XBT_IN1("(%s)", name);
+  res = gras_datadesc_by_name_or_null(name);
+  if (res) {
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
+                "Redefinition of %s does not match", name);
+    xbt_assert1(res->category.ref_data.type == referenced_type,
+                "Redefinition of %s does not match", name);
+    xbt_assert1(res->category.ref_data.selector == NULL,
+                "Redefinition of %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+    return res;
+  }
+
+  res = gras_ddt_new(name);
+
+  xbt_assert0(pointer_type, "Cannot get the description of data pointer");
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = pointer_type->size[arch];
+    res->alignment[arch] = pointer_type->alignment[arch];
+    res->aligned_size[arch] = pointer_type->aligned_size[arch];
+  }
+
+  res->category_code = e_gras_datadesc_type_cat_ref;
+  res->category.ref_data.type = referenced_type;
+  res->category.ref_data.selector = NULL;
+
+  return res;
 }
+
 /** \brief Declare a new type being a generic reference.
  *
  * The callback passed in argument is to be used to select which type is currently used.
@@ -436,134 +450,139 @@ gras_datadesc_ref(const char           *name,
  * callback and expects it to return the type description to use.
  */
 gras_datadesc_type_t
-gras_datadesc_ref_generic(const char                *name,
-               gras_datadesc_selector_t   selector) {
-
-       gras_datadesc_type_t res;
-       gras_datadesc_type_t pointer_type = gras_datadesc_by_name("data pointer");
-       int arch;
-
-       XBT_IN1("(%s)",name);
-       res = gras_datadesc_by_name_or_null(name);
-
-       if (res) {
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.ref_data.type == NULL,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.ref_data.selector == selector,
-                               "Redefinition of type %s does not match", name);
-               VERB1("Discarding redefinition of %s",name);
-               return res;
-       }
-       res = gras_ddt_new(name);
-
-       xbt_assert0(pointer_type, "Cannot get the description of data pointer");
-
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               res->size[arch] = pointer_type->size[arch];
-               res->alignment[arch] = pointer_type->alignment[arch];
-               res->aligned_size[arch] = pointer_type->aligned_size[arch];
-       }
-
-       res->category_code              = e_gras_datadesc_type_cat_ref;
-
-       res->category.ref_data.type     = NULL;
-       res->category.ref_data.selector = selector;
-
-       return res;
+gras_datadesc_ref_generic(const char *name, gras_datadesc_selector_t selector)
+{
+
+  gras_datadesc_type_t res;
+  gras_datadesc_type_t pointer_type = gras_datadesc_by_name("data pointer");
+  int arch;
+
+  XBT_IN1("(%s)", name);
+  res = gras_datadesc_by_name_or_null(name);
+
+  if (res) {
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.ref_data.type == NULL,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.ref_data.selector == selector,
+                "Redefinition of type %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+    return res;
+  }
+  res = gras_ddt_new(name);
+
+  xbt_assert0(pointer_type, "Cannot get the description of data pointer");
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = pointer_type->size[arch];
+    res->alignment[arch] = pointer_type->alignment[arch];
+    res->aligned_size[arch] = pointer_type->aligned_size[arch];
+  }
+
+  res->category_code = e_gras_datadesc_type_cat_ref;
+
+  res->category.ref_data.type = NULL;
+  res->category.ref_data.selector = selector;
+
+  return res;
 }
 
 /** \brief Declare a new type being an array of fixed size and content */
 gras_datadesc_type_t
-gras_datadesc_array_fixed(const char           *name,
-               gras_datadesc_type_t  element_type,
-               long int              fixed_size) {
-
-       gras_datadesc_type_t res;
-       int arch;
-
-       XBT_IN1("(%s)",name);
-       res = gras_datadesc_by_name_or_null(name);
-       if (res) {
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
-                               "Redefinition of type %s does not match", name);
-
-               if (res->category.array_data.type != element_type) {
-                       ERROR1("Redefinition of type %s does not match: array elements differ", name);
-                       gras_datadesc_type_dump(res->category.array_data.type);
-                       gras_datadesc_type_dump(element_type);
-               }
-
-               xbt_assert1(res->category.array_data.fixed_size == fixed_size,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.array_data.dynamic_size == NULL,
-                               "Redefinition of type %s does not match", name);
-               VERB1("Discarding redefinition of %s",name);
-
-               return res;
-       }
-       res = gras_ddt_new(name);
-
-       xbt_assert1(fixed_size >= 0, "'%s' is a array of negative fixed size",name);
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               res->size[arch] = fixed_size * element_type->aligned_size[arch];
-               res->alignment[arch] = element_type->alignment[arch];
-               res->aligned_size[arch] = res->size[arch];
-       }
-
-       res->category_code              = e_gras_datadesc_type_cat_array;
-
-       res->category.array_data.type         = element_type;
-       res->category.array_data.fixed_size   = fixed_size;
-       res->category.array_data.dynamic_size = NULL;
-
-       return res;
+gras_datadesc_array_fixed(const char *name,
+                          gras_datadesc_type_t element_type,
+                          long int fixed_size)
+{
+
+  gras_datadesc_type_t res;
+  int arch;
+
+  XBT_IN1("(%s)", name);
+  res = gras_datadesc_by_name_or_null(name);
+  if (res) {
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
+                "Redefinition of type %s does not match", name);
+
+    if (res->category.array_data.type != element_type) {
+      ERROR1("Redefinition of type %s does not match: array elements differ",
+             name);
+      gras_datadesc_type_dump(res->category.array_data.type);
+      gras_datadesc_type_dump(element_type);
+    }
+
+    xbt_assert1(res->category.array_data.fixed_size == fixed_size,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.array_data.dynamic_size == NULL,
+                "Redefinition of type %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+
+    return res;
+  }
+  res = gras_ddt_new(name);
+
+  xbt_assert1(fixed_size >= 0, "'%s' is a array of negative fixed size",
+              name);
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = fixed_size * element_type->aligned_size[arch];
+    res->alignment[arch] = element_type->alignment[arch];
+    res->aligned_size[arch] = res->size[arch];
+  }
+
+  res->category_code = e_gras_datadesc_type_cat_array;
+
+  res->category.array_data.type = element_type;
+  res->category.array_data.fixed_size = fixed_size;
+  res->category.array_data.dynamic_size = NULL;
+
+  return res;
 }
 
 /** \brief Declare a new type being an array of fixed size, but accepting several content types. */
-gras_datadesc_type_t gras_datadesc_array_dyn(const char                 *name,
-               gras_datadesc_type_t        element_type,
-               gras_datadesc_type_cb_int_t dynamic_size) {
-
-       gras_datadesc_type_t res;
-       int arch;
-
-       XBT_IN1("(%s)",name);
-       xbt_assert1(dynamic_size,
-                       "'%s' is a dynamic array without size discriminant",
-                       name);
-
-       res = gras_datadesc_by_name_or_null(name);
-       if (res) {
-               xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.array_data.type == element_type,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.array_data.fixed_size == -1,
-                               "Redefinition of type %s does not match", name);
-               xbt_assert1(res->category.array_data.dynamic_size == dynamic_size,
-                               "Redefinition of type %s does not match", name);
-               VERB1("Discarding redefinition of %s",name);
-
-               return res;
-       }
-
-       res = gras_ddt_new(name);
-
-       for (arch=0; arch<gras_arch_count; arch ++) {
-               res->size[arch] = 0; /* make sure it indicates "dynamic" */
-               res->alignment[arch] = element_type->alignment[arch];
-               res->aligned_size[arch] = 0; /*FIXME: That was so in GS, but looks stupid*/
-       }
-
-       res->category_code              = e_gras_datadesc_type_cat_array;
-
-       res->category.array_data.type         = element_type;
-       res->category.array_data.fixed_size   = -1;
-       res->category.array_data.dynamic_size = dynamic_size;
-
-       return res;
+gras_datadesc_type_t gras_datadesc_array_dyn(const char *name,
+                                             gras_datadesc_type_t
+                                             element_type,
+                                             gras_datadesc_type_cb_int_t
+                                             dynamic_size)
+{
+
+  gras_datadesc_type_t res;
+  int arch;
+
+  XBT_IN1("(%s)", name);
+  xbt_assert1(dynamic_size,
+              "'%s' is a dynamic array without size discriminant", name);
+
+  res = gras_datadesc_by_name_or_null(name);
+  if (res) {
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.array_data.type == element_type,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.array_data.fixed_size == -1,
+                "Redefinition of type %s does not match", name);
+    xbt_assert1(res->category.array_data.dynamic_size == dynamic_size,
+                "Redefinition of type %s does not match", name);
+    VERB1("Discarding redefinition of %s", name);
+
+    return res;
+  }
+
+  res = gras_ddt_new(name);
+
+  for (arch = 0; arch < gras_arch_count; arch++) {
+    res->size[arch] = 0;        /* make sure it indicates "dynamic" */
+    res->alignment[arch] = element_type->alignment[arch];
+    res->aligned_size[arch] = 0;        /*FIXME: That was so in GS, but looks stupid */
+  }
+
+  res->category_code = e_gras_datadesc_type_cat_array;
+
+  res->category.array_data.type = element_type;
+  res->category.array_data.fixed_size = -1;
+  res->category.array_data.dynamic_size = dynamic_size;
+
+  return res;
 }
 
 /** \brief Declare a new type being an array which size can be found with \ref gras_cbps_i_pop
@@ -589,22 +608,22 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char                 *name,
  *
  */
 gras_datadesc_type_t
-gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type) {
+gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type)
+{
 
-       gras_datadesc_type_t res;
-       char *name=(char*)xbt_malloc(strlen(element_type->name) + 4);
+  gras_datadesc_type_t res;
+  char *name = (char *) xbt_malloc(strlen(element_type->name) + 4);
 
-       sprintf(name,"%s[]",element_type->name);
+  sprintf(name, "%s[]", element_type->name);
 
-       res = gras_datadesc_array_dyn(name,element_type,
-                       gras_datadesc_cb_pop);
+  res = gras_datadesc_array_dyn(name, element_type, gras_datadesc_cb_pop);
 
-       sprintf(name,"%s[]*",element_type->name);
-       res = gras_datadesc_ref(name,res);
+  sprintf(name, "%s[]*", element_type->name);
+  res = gras_datadesc_ref(name, res);
 
-       free(name);
+  free(name);
 
-       return res;
+  return res;
 }
 
 /*
@@ -614,24 +633,26 @@ gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type) {
  */
 
 #include "xbt/dynar_private.h"
-static void gras_datadesc_dynar_cb(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data) {
-       gras_datadesc_type_t subtype;
-       xbt_dynar_t dynar=(xbt_dynar_t)data;
+static void gras_datadesc_dynar_cb(gras_datadesc_type_t typedesc,
+                                   gras_cbps_t vars, void *data)
+{
+  gras_datadesc_type_t subtype;
+  xbt_dynar_t dynar = (xbt_dynar_t) data;
 
-       memcpy(&dynar->free_f, &typedesc->extra, sizeof(dynar->free_f));
+  memcpy(&dynar->free_f, &typedesc->extra, sizeof(dynar->free_f));
 
-       /* search for the elemsize in what we have. If elements are "int", typedesc got is "int[]*" */
-       subtype = gras_dd_find_field(typedesc,"data")->type;
+  /* search for the elemsize in what we have. If elements are "int", typedesc got is "int[]*" */
+  subtype = gras_dd_find_field(typedesc, "data")->type;
 
-       /* this is now a ref to array of what we're looking for */
-       subtype = subtype->category.ref_data.type;
-       subtype = subtype->category.array_data.type;
+  /* this is now a ref to array of what we're looking for */
+  subtype = subtype->category.ref_data.type;
+  subtype = subtype->category.array_data.type;
 
-       DEBUG1("subtype is %s",subtype->name);
+  DEBUG1("subtype is %s", subtype->name);
 
-       dynar->elmsize = subtype->size[GRAS_THISARCH];
-       dynar->size = dynar->used;
-       dynar->mutex = NULL;
+  dynar->elmsize = subtype->size[GRAS_THISARCH];
+  dynar->size = dynar->used;
+  dynar->mutex = NULL;
 }
 
 /** \brief Declare a new type being a dynar in which each elements are of the given type
@@ -644,152 +665,158 @@ static void gras_datadesc_dynar_cb(gras_datadesc_type_t typedesc, gras_cbps_t va
  *  \param free_func: the function to use to free the elements when the dynar gets freed
  */
 gras_datadesc_type_t
-gras_datadesc_dynar(gras_datadesc_type_t elm_t,
-               void_f_pvoid_t free_func) {
+gras_datadesc_dynar(gras_datadesc_type_t elm_t, void_f_pvoid_t free_func)
+{
 
-       char *buffname;
-       gras_datadesc_type_t res;
+  char *buffname;
+  gras_datadesc_type_t res;
 
-       asprintf(&buffname,"s_xbt_dynar_of_%s",elm_t->name);
+  asprintf(&buffname, "s_xbt_dynar_of_%s", elm_t->name);
 
-       res = gras_datadesc_struct(buffname);
+  res = gras_datadesc_struct(buffname);
 
-       gras_datadesc_struct_append(res, "size",
-                       gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(res, "size",
+                              gras_datadesc_by_name("unsigned long int"));
 
-       gras_datadesc_struct_append(res, "used",
-                       gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(res, "used",
+                              gras_datadesc_by_name("unsigned long int"));
 
-       gras_datadesc_struct_append(res, "elmsize",
-                       gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(res, "elmsize",
+                              gras_datadesc_by_name("unsigned long int"));
 
-       gras_datadesc_struct_append(res, "data",
-                       gras_datadesc_ref_pop_arr (elm_t));
+  gras_datadesc_struct_append(res, "data", gras_datadesc_ref_pop_arr(elm_t));
 
-       gras_datadesc_struct_append(res, "free_f",
-                       gras_datadesc_by_name("function pointer"));
-       memcpy(res->extra,&free_func,sizeof(free_func));
+  gras_datadesc_struct_append(res, "free_f",
+                              gras_datadesc_by_name("function pointer"));
+  memcpy(res->extra, &free_func, sizeof(free_func));
 
-       gras_datadesc_struct_append(res, "mutex",
-                       gras_datadesc_by_name("data pointer"));
+  gras_datadesc_struct_append(res, "mutex",
+                              gras_datadesc_by_name("data pointer"));
 
-       gras_datadesc_struct_close(res);
+  gras_datadesc_struct_close(res);
 
-       gras_datadesc_cb_field_push(res, "used");
-       gras_datadesc_cb_recv(res,  &gras_datadesc_dynar_cb);
+  gras_datadesc_cb_field_push(res, "used");
+  gras_datadesc_cb_recv(res, &gras_datadesc_dynar_cb);
 
-       /* build a ref to it */
-       free(buffname);
-       asprintf(&buffname,"xbt_dynar_of_%s",elm_t->name);
-       res=gras_datadesc_ref(buffname,res);
-       free(buffname);
-       return res;
+  /* build a ref to it */
+  free(buffname);
+  asprintf(&buffname, "xbt_dynar_of_%s", elm_t->name);
+  res = gras_datadesc_ref(buffname, res);
+  free(buffname);
+  return res;
 }
 
 #include "xbt/matrix.h"
-static void gras_datadesc_matrix_cb(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data) {
-       gras_datadesc_type_t subtype;
-       xbt_matrix_t matrix=(xbt_matrix_t)data;
+static void gras_datadesc_matrix_cb(gras_datadesc_type_t typedesc,
+                                    gras_cbps_t vars, void *data)
+{
+  gras_datadesc_type_t subtype;
+  xbt_matrix_t matrix = (xbt_matrix_t) data;
 
-       memcpy(&matrix->free_f, &typedesc->extra, sizeof(matrix->free_f));
+  memcpy(&matrix->free_f, &typedesc->extra, sizeof(matrix->free_f));
 
-       /* search for the elemsize in what we have. If elements are "int", typedesc got is "int[]*" */
-       subtype = gras_dd_find_field(typedesc,"data")->type;
+  /* search for the elemsize in what we have. If elements are "int", typedesc got is "int[]*" */
+  subtype = gras_dd_find_field(typedesc, "data")->type;
 
-       /* this is now a ref to array of what we're looking for */
-       subtype = subtype->category.ref_data.type;
-       subtype = subtype->category.array_data.type;
+  /* this is now a ref to array of what we're looking for */
+  subtype = subtype->category.ref_data.type;
+  subtype = subtype->category.array_data.type;
 
-       DEBUG1("subtype is %s",subtype->name);
+  DEBUG1("subtype is %s", subtype->name);
 
-       matrix->elmsize = subtype->size[GRAS_THISARCH];
+  matrix->elmsize = subtype->size[GRAS_THISARCH];
 }
+
 gras_datadesc_type_t
-gras_datadesc_matrix(gras_datadesc_type_t elm_t,
-               void_f_pvoid_t const free_f) {
-       char *buffname;
-       gras_datadesc_type_t res;
-
-       asprintf(&buffname,"s_xbt_matrix_t(%s)",elm_t->name);
-       res = gras_datadesc_struct(buffname);
-
-       gras_datadesc_struct_append(res, "lines",
-                       gras_datadesc_by_name("unsigned int"));
-       gras_datadesc_struct_append(res, "rows",
-                       gras_datadesc_by_name("unsigned int"));
-
-       gras_datadesc_struct_append(res, "elmsize",
-                       gras_datadesc_by_name("unsigned long int"));
-
-       gras_datadesc_struct_append(res, "data",
-                       gras_datadesc_ref_pop_arr (elm_t));
-       gras_datadesc_struct_append(res, "free_f",
-                       gras_datadesc_by_name("function pointer"));
-       gras_datadesc_struct_close(res);
-
-       gras_datadesc_cb_field_push(res, "lines");
-       gras_datadesc_cb_field_push_multiplier(res, "rows");
-
-       gras_datadesc_cb_recv(res,  &gras_datadesc_matrix_cb);
-       memcpy(res->extra,&free_f,sizeof(free_f));
-
-       /* build a ref to it */
-       free(buffname);
-       asprintf(&buffname,"xbt_matrix_t(%s)",elm_t->name);
-       res=gras_datadesc_ref(buffname,res);
-       free(buffname);
-       return res;
+gras_datadesc_matrix(gras_datadesc_type_t elm_t, void_f_pvoid_t const free_f)
+{
+  char *buffname;
+  gras_datadesc_type_t res;
+
+  asprintf(&buffname, "s_xbt_matrix_t(%s)", elm_t->name);
+  res = gras_datadesc_struct(buffname);
+
+  gras_datadesc_struct_append(res, "lines",
+                              gras_datadesc_by_name("unsigned int"));
+  gras_datadesc_struct_append(res, "rows",
+                              gras_datadesc_by_name("unsigned int"));
+
+  gras_datadesc_struct_append(res, "elmsize",
+                              gras_datadesc_by_name("unsigned long int"));
+
+  gras_datadesc_struct_append(res, "data", gras_datadesc_ref_pop_arr(elm_t));
+  gras_datadesc_struct_append(res, "free_f",
+                              gras_datadesc_by_name("function pointer"));
+  gras_datadesc_struct_close(res);
+
+  gras_datadesc_cb_field_push(res, "lines");
+  gras_datadesc_cb_field_push_multiplier(res, "rows");
+
+  gras_datadesc_cb_recv(res, &gras_datadesc_matrix_cb);
+  memcpy(res->extra, &free_f, sizeof(free_f));
+
+  /* build a ref to it */
+  free(buffname);
+  asprintf(&buffname, "xbt_matrix_t(%s)", elm_t->name);
+  res = gras_datadesc_ref(buffname, res);
+  free(buffname);
+  return res;
 }
 
 gras_datadesc_type_t
-gras_datadesc_import_nws(const char           *name,
-               const DataDescriptor *desc,
-               unsigned long         howmany) {
-       THROW_UNIMPLEMENTED;
+gras_datadesc_import_nws(const char *name,
+                         const DataDescriptor * desc, unsigned long howmany)
+{
+  THROW_UNIMPLEMENTED;
 }
 
 /**
  * (useful to push the sizes of the upcoming arrays, for example)
  */
-void gras_datadesc_cb_send (gras_datadesc_type_t          type,
-               gras_datadesc_type_cb_void_t  send) {
-       type->send = send;
+void gras_datadesc_cb_send(gras_datadesc_type_t type,
+                           gras_datadesc_type_cb_void_t send)
+{
+  type->send = send;
 }
+
 /**
  * (useful to put the function pointers to the rigth value, for example)
  */
-void gras_datadesc_cb_recv(gras_datadesc_type_t          type,
-               gras_datadesc_type_cb_void_t  recv) {
-       type->recv = recv;
+void gras_datadesc_cb_recv(gras_datadesc_type_t type,
+                           gras_datadesc_type_cb_void_t recv)
+{
+  type->recv = recv;
 }
+
 /*
  * gras_dd_find_field:
  *
  * Returns the type descriptor of the given field. Abort on error.
  */
 static gras_dd_cat_field_t
-gras_dd_find_field(gras_datadesc_type_t  type,
-               const char           *field_name) {
-       xbt_dynar_t         field_array;
-
-       gras_dd_cat_field_t  field=NULL;
-       unsigned int         field_num;
-
-       if (type->category_code == e_gras_datadesc_type_cat_union) {
-               field_array = type->category.union_data.fields;
-       } else if (type->category_code == e_gras_datadesc_type_cat_struct) {
-               field_array = type->category.struct_data.fields;
-       } else {
-               ERROR2("%s (%p) is not a struct nor an union. There is no field.", type->name,(void*)type);
-               xbt_abort();
-       }
-       xbt_dynar_foreach(field_array,field_num,field) {
-               if (!strcmp(field_name,field->name)) {
-                       return field;
-               }
-       }
-       ERROR2("No field named '%s' in '%s'",field_name,type->name);
-       xbt_abort();
+gras_dd_find_field(gras_datadesc_type_t type, const char *field_name)
+{
+  xbt_dynar_t field_array;
+
+  gras_dd_cat_field_t field = NULL;
+  unsigned int field_num;
+
+  if (type->category_code == e_gras_datadesc_type_cat_union) {
+    field_array = type->category.union_data.fields;
+  } else if (type->category_code == e_gras_datadesc_type_cat_struct) {
+    field_array = type->category.struct_data.fields;
+  } else {
+    ERROR2("%s (%p) is not a struct nor an union. There is no field.",
+           type->name, (void *) type);
+    xbt_abort();
+  }
+  xbt_dynar_foreach(field_array, field_num, field) {
+    if (!strcmp(field_name, field->name)) {
+      return field;
+    }
+  }
+  ERROR2("No field named '%s' in '%s'", field_name, type->name);
+  xbt_abort();
 
 }
 
@@ -797,12 +824,13 @@ gras_dd_find_field(gras_datadesc_type_t  type,
  * The given datadesc must be a struct or union (abort if not).
  * (useful to push the sizes of the upcoming arrays, for example)
  */
-void gras_datadesc_cb_field_send (gras_datadesc_type_t          type,
-               const char                   *field_name,
-               gras_datadesc_type_cb_void_t  send) {
+void gras_datadesc_cb_field_send(gras_datadesc_type_t type,
+                                 const char *field_name,
+                                 gras_datadesc_type_cb_void_t send)
+{
 
-       gras_dd_cat_field_t field=gras_dd_find_field(type,field_name);
-       field->send = send;
+  gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
+  field->send = send;
 }
 
 
@@ -811,27 +839,29 @@ void gras_datadesc_cb_field_send (gras_datadesc_type_t          type,
  * is pushed to the stacks of sizes and can then be retrieved with
  * \ref gras_datadesc_ref_pop_arr or directly with \ref gras_cbps_i_pop.
  */
-void gras_datadesc_cb_field_push (gras_datadesc_type_t  type,
-               const char           *field_name) {
-
-       gras_dd_cat_field_t  field=gras_dd_find_field(type,field_name);
-       gras_datadesc_type_t sub_type=field->type;
-
-       DEBUG3("add a PUSHy cb to '%s' field (type '%s') of '%s'",
-                       field_name,sub_type->name,type->name);
-       if (!strcmp("int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_int;
-       } else if (!strcmp("unsigned int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_uint;
-       } else if (!strcmp("long int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_lint;
-       } else if (!strcmp("unsigned long int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_ulint;
-       } else {
-               ERROR1("Field %s is not an int, unsigned int, long int neither unsigned long int",
-                               sub_type->name);
-               xbt_abort();
-       }
+void gras_datadesc_cb_field_push(gras_datadesc_type_t type,
+                                 const char *field_name)
+{
+
+  gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
+  gras_datadesc_type_t sub_type = field->type;
+
+  DEBUG3("add a PUSHy cb to '%s' field (type '%s') of '%s'",
+         field_name, sub_type->name, type->name);
+  if (!strcmp("int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_int;
+  } else if (!strcmp("unsigned int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_uint;
+  } else if (!strcmp("long int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_lint;
+  } else if (!strcmp("unsigned long int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_ulint;
+  } else {
+    ERROR1
+      ("Field %s is not an int, unsigned int, long int neither unsigned long int",
+       sub_type->name);
+    xbt_abort();
+  }
 }
 
 /**
@@ -842,70 +872,74 @@ void gras_datadesc_cb_field_push (gras_datadesc_type_t  type,
  *
  * The field must be an int, unsigned int, long int or unsigned long int.
  */
-void gras_datadesc_cb_field_push_multiplier (gras_datadesc_type_t  type,
-               const char         *field_name) {
-
-       gras_dd_cat_field_t  field=gras_dd_find_field(type,field_name);
-       gras_datadesc_type_t sub_type=field->type;
-
-       DEBUG3("add a MPUSHy cb to '%s' field (type '%s') of '%s'",
-                       field_name,sub_type->name,type->name);
-       if (!strcmp("int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_int_mult;
-       } else if (!strcmp("unsigned int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_uint_mult;
-       } else if (!strcmp("long int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_lint_mult;
-       } else if (!strcmp("unsigned long int",sub_type->name)) {
-               field->send = gras_datadesc_cb_push_ulint_mult;
-       } else {
-               ERROR1("Field %s is not an int, unsigned int, long int neither unsigned long int",
-                               sub_type->name);
-               xbt_abort();
-       }
+void gras_datadesc_cb_field_push_multiplier(gras_datadesc_type_t type,
+                                            const char *field_name)
+{
+
+  gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
+  gras_datadesc_type_t sub_type = field->type;
+
+  DEBUG3("add a MPUSHy cb to '%s' field (type '%s') of '%s'",
+         field_name, sub_type->name, type->name);
+  if (!strcmp("int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_int_mult;
+  } else if (!strcmp("unsigned int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_uint_mult;
+  } else if (!strcmp("long int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_lint_mult;
+  } else if (!strcmp("unsigned long int", sub_type->name)) {
+    field->send = gras_datadesc_cb_push_ulint_mult;
+  } else {
+    ERROR1
+      ("Field %s is not an int, unsigned int, long int neither unsigned long int",
+       sub_type->name);
+    xbt_abort();
+  }
 }
 
 /**
  * The given datadesc must be a struct or union (abort if not).
  * (useful to put the function pointers to the right value, for example)
  */
-void gras_datadesc_cb_field_recv(gras_datadesc_type_t          type,
-               const char                   *field_name,
-               gras_datadesc_type_cb_void_t  recv) {
+void gras_datadesc_cb_field_recv(gras_datadesc_type_t type,
+                                 const char *field_name,
+                                 gras_datadesc_type_cb_void_t recv)
+{
 
-       gras_dd_cat_field_t field=gras_dd_find_field(type,field_name);
-       field->recv = recv;
+  gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
+  field->recv = recv;
 }
 
 /*
  * Free a datadesc. Should only be called at xbt_exit.
  */
-void gras_datadesc_free(gras_datadesc_type_t *type) {
-
-       DEBUG1("Let's free ddt %s",(*type)->name);
-
-       switch ((*type)->category_code) {
-       case e_gras_datadesc_type_cat_scalar:
-       case e_gras_datadesc_type_cat_ref:
-       case e_gras_datadesc_type_cat_array:
-               /* nothing to free in there */
-               break;
-
-       case e_gras_datadesc_type_cat_struct:
-               xbt_dynar_free(&( (*type)->category.struct_data.fields ));
-               break;
-
-       case e_gras_datadesc_type_cat_union:
-               xbt_dynar_free(&( (*type)->category.union_data.fields ));
-               break;
-
-       default:
-               /* datadesc was invalid. Killing it is like euthanasy, I guess */
-               break;
-       }
-       free((*type)->name);
-       free(*type);
-       type=NULL;
+void gras_datadesc_free(gras_datadesc_type_t * type)
+{
+
+  DEBUG1("Let's free ddt %s", (*type)->name);
+
+  switch ((*type)->category_code) {
+  case e_gras_datadesc_type_cat_scalar:
+  case e_gras_datadesc_type_cat_ref:
+  case e_gras_datadesc_type_cat_array:
+    /* nothing to free in there */
+    break;
+
+  case e_gras_datadesc_type_cat_struct:
+    xbt_dynar_free(&((*type)->category.struct_data.fields));
+    break;
+
+  case e_gras_datadesc_type_cat_union:
+    xbt_dynar_free(&((*type)->category.union_data.fields));
+    break;
+
+  default:
+    /* datadesc was invalid. Killing it is like euthanasy, I guess */
+    break;
+  }
+  free((*type)->name);
+  free(*type);
+  type = NULL;
 }
 
 /**
@@ -917,149 +951,159 @@ void gras_datadesc_free(gras_datadesc_type_t *type) {
  * but only the payload (actual type description).
  */
 int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
-               const gras_datadesc_type_t d2) {
-       int ret;
-       unsigned int cpt;
-       gras_dd_cat_field_t field1,field2;
-       gras_datadesc_type_t field_desc_1,field_desc_2;
-
-       if (d1 == d2) return 0; /* easy optimization */
-
-       if (!d1 && d2) {
-               DEBUG0("ddt_cmp: !d1 && d2 => 1");
-               return 1;
-       }
-       if (!d1 && !d2) {
-               DEBUG0("ddt_cmp: !d1 && !d2 => 0");
-               return 0;
-       }
-       if ( d1 && !d2) {
-               DEBUG0("ddt_cmp: d1 && !d2 => -1");
-               return -1;
-       }
-
-       for (cpt=0; cpt<gras_arch_count; cpt++) {
-               if (d1->size[cpt] != d2->size[cpt]) {
-                       DEBUG5("ddt_cmp: %s->size=%ld  !=  %s->size=%ld (on %s)",
-                                       d1->name,d1->size[cpt],d2->name,d2->size[cpt],
-                                       gras_arches[cpt].name);
-                       return d1->size[cpt] >  d2->size[cpt] ? 1 : -1;
-               }
-
-               if (d1->alignment[cpt] != d2->alignment[cpt]) {
-                       DEBUG5("ddt_cmp: %s->alignment=%ld  !=  %s->alignment=%ld (on %s)",
-                                       d1->name,d1->alignment[cpt],d2->name,d2->alignment[cpt],
-                                       gras_arches[cpt].name);
-                       return d1->alignment[cpt] > d2->alignment[cpt] ? 1 : -1;
-               }
-
-               if (d1->aligned_size[cpt] != d2->aligned_size[cpt]) {
-                       DEBUG5("ddt_cmp: %s->aligned_size=%ld  !=  %s->aligned_size=%ld (on %s)",
-                                       d1->name,d1->aligned_size[cpt],d2->name,d2->aligned_size[cpt],
-                                       gras_arches[cpt].name);
-                       return d1->aligned_size[cpt] > d2->aligned_size[cpt] ? 1 : -1;
-               }
-       }
-
-       if (d1->category_code != d2->category_code) {
-               DEBUG4("ddt_cmp: %s->cat=%s  !=  %s->cat=%s",
-                               d1->name,gras_datadesc_cat_names[d1->category_code],
-                               d2->name,gras_datadesc_cat_names[d2->category_code]);
-               return d1->category_code > d2->category_code ? 1 : -1;
-       }
-
-       if (d1->send != d2->send) {
-               DEBUG4("ddt_cmp: %s->send=%p  !=  %s->send=%p",
-                               d1->name,(void*)d1->send, d2->name,(void*)d2->send);
-               return 1; /* ISO C forbids ordered comparisons of pointers to functions */
-       }
-
-       if (d1->recv != d2->recv) {
-               DEBUG4("ddt_cmp: %s->recv=%p  !=  %s->recv=%p",
-                               d1->name,(void*)d1->recv, d2->name,(void*)d2->recv);
-               return 1; /* ISO C forbids ordered comparisons of pointers to functions */
-       }
-
-       switch (d1->category_code) {
-       case e_gras_datadesc_type_cat_scalar:
-               if (d1->category.scalar_data.encoding != d2->category.scalar_data.encoding)
-                       return d1->category.scalar_data.encoding > d2->category.scalar_data.encoding ? 1 : -1 ;
-                       break;
-
-       case e_gras_datadesc_type_cat_struct:
-               if (xbt_dynar_length(d1->category.struct_data.fields) !=
-                       xbt_dynar_length(d2->category.struct_data.fields)) {
-                       DEBUG4("ddt_cmp: %s (having %lu fields) !=  %s (having %lu fields)",
-                                       d1->name, xbt_dynar_length(d1->category.struct_data.fields),
-                                       d2->name, xbt_dynar_length(d2->category.struct_data.fields));
-
-                       return xbt_dynar_length(d1->category.struct_data.fields) >
-                       xbt_dynar_length(d2->category.struct_data.fields) ?
-                                       1 : -1;
-               }
-               xbt_dynar_foreach(d1->category.struct_data.fields, cpt, field1) {
-
-                       field2 = xbt_dynar_get_as(d2->category.struct_data.fields, cpt, gras_dd_cat_field_t);
-                       field_desc_1 = field1->type;
-                       field_desc_2 = field2->type;
-                       ret = gras_datadesc_type_cmp(field_desc_1,field_desc_2);
-                       if (ret) {
-                               DEBUG6("%s->field[%d]=%s != %s->field[%d]=%s",
-                                               d1->name,cpt,field1->name,
-                                               d2->name,cpt,field2->name);
-                               return ret;
-                       }
-
-               }
-               break;
-
-       case e_gras_datadesc_type_cat_union:
-               if (d1->category.union_data.selector != d2->category.union_data.selector)
-                       return 1;  /* ISO C forbids ordered comparisons of pointers to functions */
-
-               if (xbt_dynar_length(d1->category.union_data.fields) !=
-                       xbt_dynar_length(d2->category.union_data.fields))
-                       return xbt_dynar_length(d1->category.union_data.fields) >
-               xbt_dynar_length(d2->category.union_data.fields) ?
-                               1 : -1;
-
-               xbt_dynar_foreach(d1->category.union_data.fields, cpt, field1) {
-
-                       field2 = xbt_dynar_get_as(d2->category.union_data.fields, cpt, gras_dd_cat_field_t);
-                       field_desc_1 = field1->type;
-                       field_desc_2 = field2->type;
-                       ret = gras_datadesc_type_cmp(field_desc_1,field_desc_2);
-                       if (ret)
-                               return ret;
-
-               }
-               break;
-
-
-       case e_gras_datadesc_type_cat_ref:
-               if (d1->category.ref_data.selector != d2->category.ref_data.selector)
-                       return 1; /* ISO C forbids ordered comparisons of pointers to functions */
-
-               if (d1->category.ref_data.type != d2->category.ref_data.type)
-                       return d1->category.ref_data.type > d2->category.ref_data.type ? 1 : -1;
-                       break;
-
-       case e_gras_datadesc_type_cat_array:
-               if (d1->category.array_data.type != d2->category.array_data.type)
-                       return d1->category.array_data.type > d2->category.array_data.type ? 1 : -1;
-
-                       if (d1->category.array_data.fixed_size != d2->category.array_data.fixed_size)
-                               return d1->category.array_data.fixed_size > d2->category.array_data.fixed_size ? 1 : -1;
-
-                               if (d1->category.array_data.dynamic_size != d2->category.array_data.dynamic_size)
-                                       return 1; /* ISO C forbids ordered comparisons of pointers to functions */
-
-                               break;
-
-       default:
-               /* two stupidly created ddt are equally stupid ;) */
-               break;
-       }
-       return 0;
+                           const gras_datadesc_type_t d2)
+{
+  int ret;
+  unsigned int cpt;
+  gras_dd_cat_field_t field1, field2;
+  gras_datadesc_type_t field_desc_1, field_desc_2;
+
+  if (d1 == d2)
+    return 0;                   /* easy optimization */
+
+  if (!d1 && d2) {
+    DEBUG0("ddt_cmp: !d1 && d2 => 1");
+    return 1;
+  }
+  if (!d1 && !d2) {
+    DEBUG0("ddt_cmp: !d1 && !d2 => 0");
+    return 0;
+  }
+  if (d1 && !d2) {
+    DEBUG0("ddt_cmp: d1 && !d2 => -1");
+    return -1;
+  }
+
+  for (cpt = 0; cpt < gras_arch_count; cpt++) {
+    if (d1->size[cpt] != d2->size[cpt]) {
+      DEBUG5("ddt_cmp: %s->size=%ld  !=  %s->size=%ld (on %s)",
+             d1->name, d1->size[cpt], d2->name, d2->size[cpt],
+             gras_arches[cpt].name);
+      return d1->size[cpt] > d2->size[cpt] ? 1 : -1;
+    }
+
+    if (d1->alignment[cpt] != d2->alignment[cpt]) {
+      DEBUG5("ddt_cmp: %s->alignment=%ld  !=  %s->alignment=%ld (on %s)",
+             d1->name, d1->alignment[cpt], d2->name, d2->alignment[cpt],
+             gras_arches[cpt].name);
+      return d1->alignment[cpt] > d2->alignment[cpt] ? 1 : -1;
+    }
+
+    if (d1->aligned_size[cpt] != d2->aligned_size[cpt]) {
+      DEBUG5
+        ("ddt_cmp: %s->aligned_size=%ld  !=  %s->aligned_size=%ld (on %s)",
+         d1->name, d1->aligned_size[cpt], d2->name, d2->aligned_size[cpt],
+         gras_arches[cpt].name);
+      return d1->aligned_size[cpt] > d2->aligned_size[cpt] ? 1 : -1;
+    }
+  }
+
+  if (d1->category_code != d2->category_code) {
+    DEBUG4("ddt_cmp: %s->cat=%s  !=  %s->cat=%s",
+           d1->name, gras_datadesc_cat_names[d1->category_code],
+           d2->name, gras_datadesc_cat_names[d2->category_code]);
+    return d1->category_code > d2->category_code ? 1 : -1;
+  }
+
+  if (d1->send != d2->send) {
+    DEBUG4("ddt_cmp: %s->send=%p  !=  %s->send=%p",
+           d1->name, (void *) d1->send, d2->name, (void *) d2->send);
+    return 1;                   /* ISO C forbids ordered comparisons of pointers to functions */
+  }
+
+  if (d1->recv != d2->recv) {
+    DEBUG4("ddt_cmp: %s->recv=%p  !=  %s->recv=%p",
+           d1->name, (void *) d1->recv, d2->name, (void *) d2->recv);
+    return 1;                   /* ISO C forbids ordered comparisons of pointers to functions */
+  }
+
+  switch (d1->category_code) {
+  case e_gras_datadesc_type_cat_scalar:
+    if (d1->category.scalar_data.encoding !=
+        d2->category.scalar_data.encoding)
+      return d1->category.scalar_data.encoding >
+        d2->category.scalar_data.encoding ? 1 : -1;
+    break;
+
+  case e_gras_datadesc_type_cat_struct:
+    if (xbt_dynar_length(d1->category.struct_data.fields) !=
+        xbt_dynar_length(d2->category.struct_data.fields)) {
+      DEBUG4("ddt_cmp: %s (having %lu fields) !=  %s (having %lu fields)",
+             d1->name, xbt_dynar_length(d1->category.struct_data.fields),
+             d2->name, xbt_dynar_length(d2->category.struct_data.fields));
+
+      return xbt_dynar_length(d1->category.struct_data.fields) >
+        xbt_dynar_length(d2->category.struct_data.fields) ? 1 : -1;
+    }
+    xbt_dynar_foreach(d1->category.struct_data.fields, cpt, field1) {
+
+      field2 =
+        xbt_dynar_get_as(d2->category.struct_data.fields, cpt,
+                         gras_dd_cat_field_t);
+      field_desc_1 = field1->type;
+      field_desc_2 = field2->type;
+      ret = gras_datadesc_type_cmp(field_desc_1, field_desc_2);
+      if (ret) {
+        DEBUG6("%s->field[%d]=%s != %s->field[%d]=%s",
+               d1->name, cpt, field1->name, d2->name, cpt, field2->name);
+        return ret;
+      }
+
+    }
+    break;
+
+  case e_gras_datadesc_type_cat_union:
+    if (d1->category.union_data.selector != d2->category.union_data.selector)
+      return 1;                 /* ISO C forbids ordered comparisons of pointers to functions */
+
+    if (xbt_dynar_length(d1->category.union_data.fields) !=
+        xbt_dynar_length(d2->category.union_data.fields))
+      return xbt_dynar_length(d1->category.union_data.fields) >
+        xbt_dynar_length(d2->category.union_data.fields) ? 1 : -1;
+
+    xbt_dynar_foreach(d1->category.union_data.fields, cpt, field1) {
+
+      field2 =
+        xbt_dynar_get_as(d2->category.union_data.fields, cpt,
+                         gras_dd_cat_field_t);
+      field_desc_1 = field1->type;
+      field_desc_2 = field2->type;
+      ret = gras_datadesc_type_cmp(field_desc_1, field_desc_2);
+      if (ret)
+        return ret;
+
+    }
+    break;
+
+
+  case e_gras_datadesc_type_cat_ref:
+    if (d1->category.ref_data.selector != d2->category.ref_data.selector)
+      return 1;                 /* ISO C forbids ordered comparisons of pointers to functions */
+
+    if (d1->category.ref_data.type != d2->category.ref_data.type)
+      return d1->category.ref_data.type > d2->category.ref_data.type ? 1 : -1;
+    break;
+
+  case e_gras_datadesc_type_cat_array:
+    if (d1->category.array_data.type != d2->category.array_data.type)
+      return d1->category.array_data.type >
+        d2->category.array_data.type ? 1 : -1;
+
+    if (d1->category.array_data.fixed_size !=
+        d2->category.array_data.fixed_size)
+      return d1->category.array_data.fixed_size >
+        d2->category.array_data.fixed_size ? 1 : -1;
+
+    if (d1->category.array_data.dynamic_size !=
+        d2->category.array_data.dynamic_size)
+      return 1;                 /* ISO C forbids ordered comparisons of pointers to functions */
+
+    break;
+
+  default:
+    /* two stupidly created ddt are equally stupid ;) */
+    break;
+  }
+  return 0;
 
 }
index a35b2de..28e07a4 100644 (file)
 #include "gras/DataDesc/datadesc_private.h"
 #include "gras/Transport/transport_interface.h" /* gras_trp_send/recv */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_exchange,gras_ddt,
-               "Sending data over the network");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_exchange, gras_ddt,
+                                "Sending data over the network");
 const char *gras_datadesc_cat_names[9] = {
-               "undefined",
-               "scalar", "struct", "union", "ref", "array", "ignored",
-               "invalid"};
+  "undefined",
+  "scalar", "struct", "union", "ref", "array", "ignored",
+  "invalid"
+};
 
 static gras_datadesc_type_t int_type = NULL;
 static gras_datadesc_type_t pointer_type = NULL;
 
 static XBT_INLINE void
-gras_dd_send_int(gras_socket_t sock, int *i, int stable) {
+gras_dd_send_int(gras_socket_t sock, int *i, int stable)
+{
 
-       if (!int_type) {
-               int_type = gras_datadesc_by_name("int");
-               xbt_assert(int_type);
-       }
+  if (!int_type) {
+    int_type = gras_datadesc_by_name("int");
+    xbt_assert(int_type);
+  }
 
-       DEBUG1("send_int(%u)",*i);
-       gras_trp_send(sock, (char*)i, int_type->size[GRAS_THISARCH], stable);
+  DEBUG1("send_int(%u)", *i);
+  gras_trp_send(sock, (char *) i, int_type->size[GRAS_THISARCH], stable);
 }
 
 static XBT_INLINE void
-gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
-
-       if (!int_type) {
-               int_type = gras_datadesc_by_name("int");
-               xbt_assert(int_type);
-       }
-
-       if (int_type->size[GRAS_THISARCH] >= int_type->size[r_arch]) {
-               gras_trp_recv(sock, (char*)i, int_type->size[r_arch]);
-               if (r_arch != GRAS_THISARCH)
-                       gras_dd_convert_elm(int_type,1,r_arch, i,i);
-       } else {
-               void *ptr = xbt_malloc(int_type->size[r_arch]);
-
-               gras_trp_recv(sock, (char*)ptr, int_type->size[r_arch]);
-               if (r_arch != GRAS_THISARCH)
-                       gras_dd_convert_elm(int_type,1,r_arch, ptr,i);
-               free(ptr);
-       }
-       DEBUG1("recv_int(%u)",*i);
+gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i)
+{
+
+  if (!int_type) {
+    int_type = gras_datadesc_by_name("int");
+    xbt_assert(int_type);
+  }
+
+  if (int_type->size[GRAS_THISARCH] >= int_type->size[r_arch]) {
+    gras_trp_recv(sock, (char *) i, int_type->size[r_arch]);
+    if (r_arch != GRAS_THISARCH)
+      gras_dd_convert_elm(int_type, 1, r_arch, i, i);
+  } else {
+    void *ptr = xbt_malloc(int_type->size[r_arch]);
+
+    gras_trp_recv(sock, (char *) ptr, int_type->size[r_arch]);
+    if (r_arch != GRAS_THISARCH)
+      gras_dd_convert_elm(int_type, 1, r_arch, ptr, i);
+    free(ptr);
+  }
+  DEBUG1("recv_int(%u)", *i);
 }
 
 /*
@@ -61,302 +64,315 @@ gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
  *       of 'length' bytes set to 0.
  * FIXME: Check in configure?
  */
-static XBT_INLINE int
-gras_dd_is_r_null(char **r_ptr, long int length) {
-       int i;
+static XBT_INLINE int gras_dd_is_r_null(char **r_ptr, long int length)
+{
+  int i;
 
-       for (i=0; i<length; i++) {
-               if ( ((unsigned char*)r_ptr) [i]) {
-                       return 0;
-               }
-       }
+  for (i = 0; i < length; i++) {
+    if (((unsigned char *) r_ptr)[i]) {
+      return 0;
+    }
+  }
 
-       return 1;
+  return 1;
 }
 
-static XBT_INLINE void
-gras_dd_alloc_ref(xbt_dict_t  refs,
-               long int     size,
-               char       **r_ref,
-               long int     r_len, /* pointer_type->size[r_arch] */
-               char         **l_ref,
-               int          detect_cycle) {
-       char *l_data = NULL;
-
-       xbt_assert1(size>0,"Cannot allocate %ld bytes!", size);
-       l_data = xbt_malloc((size_t)size);
-
-       *l_ref = l_data;
-       DEBUG5("alloc_ref: l_data=%p, &l_data=%p; r_ref=%p; *r_ref=%p, r_len=%ld",
-                       (void*)l_data,(void*)&l_data,
-                       (void*)r_ref, (void*)(r_ref?*r_ref:NULL), r_len);
-       if (detect_cycle && r_ref && !gras_dd_is_r_null( r_ref, r_len)) {
-               void *ptr = xbt_malloc(sizeof(void *));
-
-               memcpy(ptr,l_ref, sizeof(void *));
-
-               DEBUG2("Insert l_ref=%p under r_ref=%p",*(void**)ptr, *(void**)r_ref);
-
-               if (detect_cycle)
-                       xbt_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, xbt_free_f);
-       }
+static XBT_INLINE void gras_dd_alloc_ref(xbt_dict_t refs, long int size, char **r_ref, long int r_len,  /* pointer_type->size[r_arch] */
+                                         char **l_ref, int detect_cycle)
+{
+  char *l_data = NULL;
+
+  xbt_assert1(size > 0, "Cannot allocate %ld bytes!", size);
+  l_data = xbt_malloc((size_t) size);
+
+  *l_ref = l_data;
+  DEBUG5("alloc_ref: l_data=%p, &l_data=%p; r_ref=%p; *r_ref=%p, r_len=%ld",
+         (void *) l_data, (void *) &l_data,
+         (void *) r_ref, (void *) (r_ref ? *r_ref : NULL), r_len);
+  if (detect_cycle && r_ref && !gras_dd_is_r_null(r_ref, r_len)) {
+    void *ptr = xbt_malloc(sizeof(void *));
+
+    memcpy(ptr, l_ref, sizeof(void *));
+
+    DEBUG2("Insert l_ref=%p under r_ref=%p", *(void **) ptr,
+           *(void **) r_ref);
+
+    if (detect_cycle)
+      xbt_dict_set_ext(refs, (const char *) r_ref, r_len, ptr, xbt_free_f);
+  }
 }
 
 static int
-gras_datadesc_memcpy_rec(gras_cbps_t           state,
-               xbt_dict_t            refs,
-               gras_datadesc_type_t  type,
-               char                 *src,
-               char                 *dst,
-               int                   subsize,
-               int                   detect_cycle) {
-
-
-       xbt_ex_t             e;
-       unsigned int         cpt;
-       gras_datadesc_type_t sub_type; /* type on which we recurse */
-       int count = 0;
-
-       VERB5("Copy a %s (%s) from %p to %p (local sizeof=%ld)",
-                       type->name, gras_datadesc_cat_names[type->category_code],
-                       src,dst,type->size[GRAS_THISARCH]);
-
-       if (type->send) {
-               type->send(type,state,src);
-       }
-
-       switch (type->category_code) {
-       case e_gras_datadesc_type_cat_scalar:
-               memcpy(dst,src,type->size[GRAS_THISARCH]);
-               count += type->size[GRAS_THISARCH];
-               break;
-
-       case e_gras_datadesc_type_cat_struct: {
-               gras_dd_cat_struct_t struct_data;
-               gras_dd_cat_field_t  field;
-               char                *field_src;
-               char                *field_dst;
-
-               struct_data = type->category.struct_data;
-               xbt_assert1(struct_data.closed,
-                               "Please call gras_datadesc_declare_struct_close on %s before copying it",
-                               type->name);
-               VERB1(">> Copy all fields of the structure %s",type->name);
-               xbt_dynar_foreach(struct_data.fields, cpt, field) {
-                       field_src = src + field->offset[GRAS_THISARCH];
-                       field_dst = dst + field->offset[GRAS_THISARCH];
-
-                       sub_type = field->type;
-
-                       if (field->send)
-                               field->send(type,state,field_src);
-
-                       DEBUG1("Copy field %s",field->name);
-                       count += gras_datadesc_memcpy_rec(state,refs,sub_type, field_src, field_dst, 0,
-                                       detect_cycle || sub_type->cycle);
-
-                       if (XBT_LOG_ISENABLED(gras_ddt_exchange,xbt_log_priority_verbose)) {
-                               if (sub_type == gras_datadesc_by_name("unsigned int")) {
-                                       VERB2("Copied value for field '%s': %d (type: unsigned int)",field->name, *(unsigned int*)field_dst);
-                               } else if (sub_type == gras_datadesc_by_name("int")) {
-                                       VERB2("Copied value for field '%s': %d (type: int)",field->name, *(int*)field_dst);
-
-                               } else if (sub_type == gras_datadesc_by_name("unsigned long int")) {
-                                       VERB2("Copied value for field '%s': %ld (type: unsigned long int)",field->name, *(unsigned long int*)field_dst);
-                               } else if (sub_type == gras_datadesc_by_name("long int")) {
-                                       VERB2("Copied value for field '%s': %ld (type: long int)",field->name, *(long int*)field_dst);
-
-                               } else if (sub_type == gras_datadesc_by_name("string")) {
-                                       VERB2("Copied value for field '%s': '%s' (type: string)", field->name, *(char**)field_dst);
-                               } else {
-                                       VERB1("Copied a value for field '%s' (type not scalar?)", field->name);
-                               }
-                       }
-
-               }
-               VERB1("<< Copied all fields of the structure %s", type->name);
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_union: {
-               gras_dd_cat_union_t union_data;
-               gras_dd_cat_field_t field=NULL;
-               unsigned int        field_num;
-
-               union_data = type->category.union_data;
-
-               xbt_assert1(union_data.closed,
-                               "Please call gras_datadesc_declare_union_close on %s before copying it",
-                               type->name);
-               /* retrieve the field number */
-               field_num = union_data.selector(type, state, src);
-
-               xbt_assert1(field_num > 0,
-                               "union field selector of %s gave a negative value",
-                               type->name);
-
-               xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
-                               "union field selector of %s returned %d but there is only %lu fields",
-                               type->name, field_num, xbt_dynar_length(union_data.fields));
-
-               /* Copy the content */
-               field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
-               sub_type = field->type;
-
-               if (field->send)
-                       field->send(type,state,src);
-
-               count += gras_datadesc_memcpy_rec(state,refs, sub_type, src, dst,0,
-                               detect_cycle || sub_type->cycle);
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_ref: {
-               gras_dd_cat_ref_t      ref_data;
-               char                 **o_ref=NULL;
-               char                 **n_ref=NULL;
-               int                    reference_is_to_cpy;
-
-               ref_data = type->category.ref_data;
-
-               /* Detect the referenced type */
-               sub_type = ref_data.type;
-               if (sub_type == NULL) {
-                       sub_type = (*ref_data.selector)(type,state,src);
-               }
-
-               /* Send the pointed data only if not already sent */
-               if (*(void**)src == NULL) {
-                       VERB0("Not copying NULL referenced data");
-                       *(void**)dst = NULL;
-                       break;
-               }
-               o_ref=(char**)src;
-
-               reference_is_to_cpy = 0;
-               TRY {
-                       if (detect_cycle) {
-                               /* return ignored. Just checking whether it's known or not */
-                               n_ref=xbt_dict_get_ext(refs,(char*)o_ref, sizeof(char*));
-                       } else {
-                               reference_is_to_cpy = 1;
-                       }
-               } CATCH(e) {
-                       if (e.category != not_found_error)
-                               RETHROW;
-                       reference_is_to_cpy = 1;
-                       xbt_ex_free(e);
-               }
-
-               if (reference_is_to_cpy) {
-                       int subsubcount = -1;
-                       void *l_referenced=NULL;
-                       VERB2("Copy a ref to '%s' referenced at %p",sub_type->name, (void*)*o_ref);
-
-                       if (!pointer_type) {
-                               pointer_type = gras_datadesc_by_name("data pointer");
-                               xbt_assert(pointer_type);
-                       }
-
-                       if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
-                               /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
-                               gras_dd_cat_array_t array_data = sub_type->category.array_data;
-                               gras_datadesc_type_t subsub_type;
-
-                               subsub_type = array_data.type;
-                               subsubcount = array_data.fixed_size;
-                               if (subsubcount == -1)
-                                       subsubcount = array_data.dynamic_size(subsub_type,state,*o_ref);
-
-                               if (subsubcount != 0)
-                                       gras_dd_alloc_ref(refs,
-                                                       subsub_type->size[GRAS_THISARCH] * subsubcount,
-                                                       o_ref,pointer_type->size[GRAS_THISARCH],
-                                                       (char**)&l_referenced,
-                                                       detect_cycle);
-                       } else {
-                               gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH],
-                                               o_ref,pointer_type->size[GRAS_THISARCH],
-                                               (char**)&l_referenced,
-                                               detect_cycle);
-                       }
-
-                       count += gras_datadesc_memcpy_rec(state,refs, sub_type,
-                                       *o_ref,(char*)l_referenced, subsubcount,
-                                       detect_cycle || sub_type->cycle);
-
-                       *(void**)dst=l_referenced;
-                       VERB3("'%s' previously referenced at %p now at %p",
-                                       sub_type->name, *(void**)o_ref, l_referenced);
-
-               } else {
-                       VERB2("NOT copying data previously referenced @%p (already done, @%p now)",
-                                       *(void**)o_ref, *(void**)n_ref);
-
-                       *(void**)dst=*n_ref;
-
-               }
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_array: {
-               gras_dd_cat_array_t    array_data;
-               unsigned long int     array_count;
-               char                  *src_ptr=src;
-               char                  *dst_ptr=dst;
-               long int               elm_size;
-
-               array_data = type->category.array_data;
-
-               /* determine and send the element count */
-               array_count = array_data.fixed_size;
-               if (array_count == -1)
-                       array_count = subsize;
-               if (array_count == -1) {
-                       array_count = array_data.dynamic_size(type,state,src);
-                       xbt_assert1(array_count >=0,
-                                       "Invalid (negative) array size for type %s",type->name);
-               }
-
-               /* send the content */
-               sub_type = array_data.type;
-               elm_size = sub_type->aligned_size[GRAS_THISARCH];
-               if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
-                       VERB1("Array of %ld scalars, copy it in one shot",array_count);
-                       memcpy(dst, src, sub_type->aligned_size[GRAS_THISARCH] * array_count);
-                       count += sub_type->aligned_size[GRAS_THISARCH] * array_count;
-               } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
-                               sub_type->category.array_data.fixed_size > 0 &&
-                               sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) {
-
-                       VERB1("Array of %ld fixed array of scalars, copy it in one shot",
-                                       array_count);
-                       memcpy(dst,src,sub_type->category.array_data.type->aligned_size[GRAS_THISARCH]
-                                                                                       * array_count * sub_type->category.array_data.fixed_size);
-                       count += sub_type->category.array_data.type->aligned_size[GRAS_THISARCH]
-                                                                                 * array_count * sub_type->category.array_data.fixed_size;
-
-               } else {
-                       VERB1("Array of %ld stuff, copy it in one after the other",array_count);
-                       for (cpt=0; cpt<array_count; cpt++) {
-                               VERB2("Copy the %dth stuff out of %ld",cpt,array_count);
-                               count += gras_datadesc_memcpy_rec(state,refs, sub_type, src_ptr, dst_ptr, 0,
-                                               detect_cycle || sub_type->cycle);
-                               src_ptr += elm_size;
-                               dst_ptr += elm_size;
-                       }
-               }
-               break;
-       }
-
-       default:
-               xbt_die("Invalid type");
-       }
-
-       return count;
+gras_datadesc_memcpy_rec(gras_cbps_t state,
+                         xbt_dict_t refs,
+                         gras_datadesc_type_t type,
+                         char *src, char *dst, int subsize, int detect_cycle)
+{
+
+
+  xbt_ex_t e;
+  unsigned int cpt;
+  gras_datadesc_type_t sub_type;        /* type on which we recurse */
+  int count = 0;
+
+  VERB5("Copy a %s (%s) from %p to %p (local sizeof=%ld)",
+        type->name, gras_datadesc_cat_names[type->category_code],
+        src, dst, type->size[GRAS_THISARCH]);
+
+  if (type->send) {
+    type->send(type, state, src);
+  }
+
+  switch (type->category_code) {
+  case e_gras_datadesc_type_cat_scalar:
+    memcpy(dst, src, type->size[GRAS_THISARCH]);
+    count += type->size[GRAS_THISARCH];
+    break;
+
+  case e_gras_datadesc_type_cat_struct:{
+      gras_dd_cat_struct_t struct_data;
+      gras_dd_cat_field_t field;
+      char *field_src;
+      char *field_dst;
+
+      struct_data = type->category.struct_data;
+      xbt_assert1(struct_data.closed,
+                  "Please call gras_datadesc_declare_struct_close on %s before copying it",
+                  type->name);
+      VERB1(">> Copy all fields of the structure %s", type->name);
+      xbt_dynar_foreach(struct_data.fields, cpt, field) {
+        field_src = src + field->offset[GRAS_THISARCH];
+        field_dst = dst + field->offset[GRAS_THISARCH];
+
+        sub_type = field->type;
+
+        if (field->send)
+          field->send(type, state, field_src);
+
+        DEBUG1("Copy field %s", field->name);
+        count +=
+          gras_datadesc_memcpy_rec(state, refs, sub_type, field_src,
+                                   field_dst, 0, detect_cycle
+                                   || sub_type->cycle);
+
+        if (XBT_LOG_ISENABLED(gras_ddt_exchange, xbt_log_priority_verbose)) {
+          if (sub_type == gras_datadesc_by_name("unsigned int")) {
+            VERB2("Copied value for field '%s': %d (type: unsigned int)",
+                  field->name, *(unsigned int *) field_dst);
+          } else if (sub_type == gras_datadesc_by_name("int")) {
+            VERB2("Copied value for field '%s': %d (type: int)", field->name,
+                  *(int *) field_dst);
+
+          } else if (sub_type == gras_datadesc_by_name("unsigned long int")) {
+            VERB2
+              ("Copied value for field '%s': %ld (type: unsigned long int)",
+               field->name, *(unsigned long int *) field_dst);
+          } else if (sub_type == gras_datadesc_by_name("long int")) {
+            VERB2("Copied value for field '%s': %ld (type: long int)",
+                  field->name, *(long int *) field_dst);
+
+          } else if (sub_type == gras_datadesc_by_name("string")) {
+            VERB2("Copied value for field '%s': '%s' (type: string)",
+                  field->name, *(char **) field_dst);
+          } else {
+            VERB1("Copied a value for field '%s' (type not scalar?)",
+                  field->name);
+          }
+        }
+
+      }
+      VERB1("<< Copied all fields of the structure %s", type->name);
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_union:{
+      gras_dd_cat_union_t union_data;
+      gras_dd_cat_field_t field = NULL;
+      unsigned int field_num;
+
+      union_data = type->category.union_data;
+
+      xbt_assert1(union_data.closed,
+                  "Please call gras_datadesc_declare_union_close on %s before copying it",
+                  type->name);
+      /* retrieve the field number */
+      field_num = union_data.selector(type, state, src);
+
+      xbt_assert1(field_num > 0,
+                  "union field selector of %s gave a negative value",
+                  type->name);
+
+      xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
+                  "union field selector of %s returned %d but there is only %lu fields",
+                  type->name, field_num, xbt_dynar_length(union_data.fields));
+
+      /* Copy the content */
+      field =
+        xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
+      sub_type = field->type;
+
+      if (field->send)
+        field->send(type, state, src);
+
+      count += gras_datadesc_memcpy_rec(state, refs, sub_type, src, dst, 0,
+                                        detect_cycle || sub_type->cycle);
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_ref:{
+      gras_dd_cat_ref_t ref_data;
+      char **o_ref = NULL;
+      char **n_ref = NULL;
+      int reference_is_to_cpy;
+
+      ref_data = type->category.ref_data;
+
+      /* Detect the referenced type */
+      sub_type = ref_data.type;
+      if (sub_type == NULL) {
+        sub_type = (*ref_data.selector) (type, state, src);
+      }
+
+      /* Send the pointed data only if not already sent */
+      if (*(void **) src == NULL) {
+        VERB0("Not copying NULL referenced data");
+        *(void **) dst = NULL;
+        break;
+      }
+      o_ref = (char **) src;
+
+      reference_is_to_cpy = 0;
+      TRY {
+        if (detect_cycle) {
+          /* return ignored. Just checking whether it's known or not */
+          n_ref = xbt_dict_get_ext(refs, (char *) o_ref, sizeof(char *));
+        } else {
+          reference_is_to_cpy = 1;
+        }
+      }
+      CATCH(e) {
+        if (e.category != not_found_error)
+          RETHROW;
+        reference_is_to_cpy = 1;
+        xbt_ex_free(e);
+      }
+
+      if (reference_is_to_cpy) {
+        int subsubcount = -1;
+        void *l_referenced = NULL;
+        VERB2("Copy a ref to '%s' referenced at %p", sub_type->name,
+              (void *) *o_ref);
+
+        if (!pointer_type) {
+          pointer_type = gras_datadesc_by_name("data pointer");
+          xbt_assert(pointer_type);
+        }
+
+        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
+          /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
+          gras_dd_cat_array_t array_data = sub_type->category.array_data;
+          gras_datadesc_type_t subsub_type;
+
+          subsub_type = array_data.type;
+          subsubcount = array_data.fixed_size;
+          if (subsubcount == -1)
+            subsubcount = array_data.dynamic_size(subsub_type, state, *o_ref);
+
+          if (subsubcount != 0)
+            gras_dd_alloc_ref(refs,
+                              subsub_type->size[GRAS_THISARCH] * subsubcount,
+                              o_ref, pointer_type->size[GRAS_THISARCH],
+                              (char **) &l_referenced, detect_cycle);
+        } else {
+          gras_dd_alloc_ref(refs, sub_type->size[GRAS_THISARCH],
+                            o_ref, pointer_type->size[GRAS_THISARCH],
+                            (char **) &l_referenced, detect_cycle);
+        }
+
+        count += gras_datadesc_memcpy_rec(state, refs, sub_type,
+                                          *o_ref, (char *) l_referenced,
+                                          subsubcount, detect_cycle
+                                          || sub_type->cycle);
+
+        *(void **) dst = l_referenced;
+        VERB3("'%s' previously referenced at %p now at %p",
+              sub_type->name, *(void **) o_ref, l_referenced);
+
+      } else {
+        VERB2
+          ("NOT copying data previously referenced @%p (already done, @%p now)",
+           *(void **) o_ref, *(void **) n_ref);
+
+        *(void **) dst = *n_ref;
+
+      }
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_array:{
+      gras_dd_cat_array_t array_data;
+      unsigned long int array_count;
+      char *src_ptr = src;
+      char *dst_ptr = dst;
+      long int elm_size;
+
+      array_data = type->category.array_data;
+
+      /* determine and send the element count */
+      array_count = array_data.fixed_size;
+      if (array_count == -1)
+        array_count = subsize;
+      if (array_count == -1) {
+        array_count = array_data.dynamic_size(type, state, src);
+        xbt_assert1(array_count >= 0,
+                    "Invalid (negative) array size for type %s", type->name);
+      }
+
+      /* send the content */
+      sub_type = array_data.type;
+      elm_size = sub_type->aligned_size[GRAS_THISARCH];
+      if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
+        VERB1("Array of %ld scalars, copy it in one shot", array_count);
+        memcpy(dst, src, sub_type->aligned_size[GRAS_THISARCH] * array_count);
+        count += sub_type->aligned_size[GRAS_THISARCH] * array_count;
+      } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
+                 sub_type->category.array_data.fixed_size > 0 &&
+                 sub_type->category.array_data.type->category_code ==
+                 e_gras_datadesc_type_cat_scalar) {
+
+        VERB1("Array of %ld fixed array of scalars, copy it in one shot",
+              array_count);
+        memcpy(dst, src,
+               sub_type->category.array_data.type->aligned_size[GRAS_THISARCH]
+               * array_count * sub_type->category.array_data.fixed_size);
+        count +=
+          sub_type->category.array_data.type->aligned_size[GRAS_THISARCH]
+          * array_count * sub_type->category.array_data.fixed_size;
+
+      } else {
+        VERB1("Array of %ld stuff, copy it in one after the other",
+              array_count);
+        for (cpt = 0; cpt < array_count; cpt++) {
+          VERB2("Copy the %dth stuff out of %ld", cpt, array_count);
+          count +=
+            gras_datadesc_memcpy_rec(state, refs, sub_type, src_ptr, dst_ptr,
+                                     0, detect_cycle || sub_type->cycle);
+          src_ptr += elm_size;
+          dst_ptr += elm_size;
+        }
+      }
+      break;
+    }
+
+  default:
+    xbt_die("Invalid type");
+  }
+
+  return count;
 }
+
 /**
  * gras_datadesc_memcpy:
  *
@@ -364,31 +380,33 @@ gras_datadesc_memcpy_rec(gras_cbps_t           state,
  * to a new location, and store a pointer to it in dst.
  *
  */
-int gras_datadesc_memcpy(gras_datadesc_type_t type,
-               void *src, void *dst) {
-       xbt_ex_t e;
-       static gras_cbps_t state=NULL;
-       static xbt_dict_t  refs=NULL; /* all references already sent */
-       int size=0;
-
-       xbt_assert0(type,"called with NULL type descriptor");
-
-       DEBUG3("Memcopy a %s from %p to %p",gras_datadesc_get_name(type),src,dst);
-       if (!state) {
-               state = gras_cbps_new();
-               refs = xbt_dict_new();
-       }
-
-       TRY {
-               size = gras_datadesc_memcpy_rec(state,refs,type,(char*)src,(char*)dst,0,
-                               type->cycle);
-       } CLEANUP {
-               xbt_dict_reset(refs);
-               gras_cbps_reset(state);
-       } CATCH(e) {
-               RETHROW;
-       }
-       return size;
+int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst)
+{
+  xbt_ex_t e;
+  static gras_cbps_t state = NULL;
+  static xbt_dict_t refs = NULL;        /* all references already sent */
+  int size = 0;
+
+  xbt_assert0(type, "called with NULL type descriptor");
+
+  DEBUG3("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src,
+         dst);
+  if (!state) {
+    state = gras_cbps_new();
+    refs = xbt_dict_new();
+  }
+
+  TRY {
+    size =
+      gras_datadesc_memcpy_rec(state, refs, type, (char *) src, (char *) dst,
+                               0, type->cycle);
+  } CLEANUP {
+    xbt_dict_reset(refs);
+    gras_cbps_reset(state);
+  } CATCH(e) {
+    RETHROW;
+  }
+  return size;
 }
 
 /***
@@ -396,206 +414,212 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type,
  ***/
 
 static void
-gras_datadesc_send_rec(gras_socket_t         sock,
-               gras_cbps_t           state,
-               xbt_dict_t            refs,
-               gras_datadesc_type_t  type,
-               char                 *data,
-               int                   detect_cycle) {
-
-       xbt_ex_t             e;
-       unsigned int         cpt;
-       gras_datadesc_type_t sub_type; /* type on which we recurse */
-
-       VERB2("Send a %s (%s)",
-                       type->name, gras_datadesc_cat_names[type->category_code]);
-
-       if (!strcmp(type->name,"string"))
-               VERB1("value: '%s'",*(char**)data);
-
-       if (type->send) {
-               type->send(type,state,data);
-               DEBUG0("Run the emission callback");
-       }
-
-       switch (type->category_code) {
-       case e_gras_datadesc_type_cat_scalar:
-               gras_trp_send(sock, data, type->size[GRAS_THISARCH], 1);
-               break;
-
-       case e_gras_datadesc_type_cat_struct: {
-               gras_dd_cat_struct_t struct_data;
-               gras_dd_cat_field_t  field;
-               char                *field_data;
-
-               struct_data = type->category.struct_data;
-               xbt_assert1(struct_data.closed,
-                               "Please call gras_datadesc_declare_struct_close on %s before sending it",
-                               type->name);
-               VERB1(">> Send all fields of the structure %s",type->name);
-               xbt_dynar_foreach(struct_data.fields, cpt, field) {
-                       field_data = data;
-                       field_data += field->offset[GRAS_THISARCH];
-
-                       sub_type = field->type;
-
-                       if (field->send) {
-                               DEBUG1("Run the emission callback of field %s", field->name);
-                               field->send(type,state,field_data);
-                       }
-
-                       VERB1("Send field %s",field->name);
-                       gras_datadesc_send_rec(sock,state,refs,sub_type, field_data,
-                                       detect_cycle || sub_type->cycle);
-
-               }
-               VERB1("<< Sent all fields of the structure %s", type->name);
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_union: {
-               gras_dd_cat_union_t union_data;
-               gras_dd_cat_field_t field=NULL;
-               int field_num;
-
-               union_data = type->category.union_data;
-
-               xbt_assert1(union_data.closed,
-                               "Please call gras_datadesc_declare_union_close on %s before sending it",
-                               type->name);
-               /* retrieve the field number */
-               field_num = union_data.selector(type, state, data);
-
-               xbt_assert1(field_num > 0,
-                               "union field selector of %s gave a negative value",
-                               type->name);
-
-               xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
-                               "union field selector of %s returned %d but there is only %lu fields",
-                               type->name, field_num, xbt_dynar_length(union_data.fields));
-
-               /* Send the field number */
-               gras_dd_send_int(sock, &field_num, 0 /* not stable */);
-
-               /* Send the content */
-               field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
-               sub_type = field->type;
-
-               if (field->send)
-                       field->send(type,state,data);
-
-               gras_datadesc_send_rec(sock,state,refs, sub_type, data,
-                               detect_cycle || sub_type->cycle);
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_ref: {
-               gras_dd_cat_ref_t      ref_data;
-               void                 **ref=(void**)data;
-               int                    reference_is_to_send;
-
-               ref_data = type->category.ref_data;
-
-               /* Detect the referenced type and send it to peer if needed */
-               sub_type = ref_data.type;
-               if (sub_type == NULL) {
-                       sub_type = (*ref_data.selector)(type,state,data);
-                       gras_dd_send_int(sock, &(sub_type->code),1 /*stable*/);
-               }
-
-               /* Send the actual value of the pointer for cycle handling */
-               if (!pointer_type) {
-                       pointer_type = gras_datadesc_by_name("data pointer");
-                       xbt_assert(pointer_type);
-               }
-
-               gras_trp_send(sock, (char*)data,
-                               pointer_type->size[GRAS_THISARCH], 1 /*stable*/);
-
-               /* Send the pointed data only if not already sent */
-               if (*(void**)data == NULL) {
-                       VERB0("Not sending NULL referenced data");
-                       break;
-               }
-
-               reference_is_to_send = 0;
-               TRY {
-                       if (detect_cycle)
-                               /* return ignored. Just checking whether it's known or not */
-                               xbt_dict_get_ext(refs,(char*)ref, sizeof(char*));
-                       else
-                               reference_is_to_send = 1;
-               } CATCH(e) {
-                       if (e.category != not_found_error)
-                               RETHROW;
-                       reference_is_to_send = 1;
-                       xbt_ex_free(e);
-               }
-
-               if (reference_is_to_send) {
-                       VERB1("Sending data referenced at %p", (void*)*ref);
-                       if (detect_cycle)
-                               xbt_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL);
-                       gras_datadesc_send_rec(sock,state,refs, sub_type, *ref,
-                                       detect_cycle || sub_type->cycle);
-
-               } else {
-                       VERB1("Not sending data referenced at %p (already done)", (void*)*ref);
-               }
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_array: {
-               gras_dd_cat_array_t    array_data;
-               int                    count;
-               char                  *ptr=data;
-               long int               elm_size;
-
-               array_data = type->category.array_data;
-
-               /* determine and send the element count */
-               count = array_data.fixed_size;
-               if (count == -1) {
-                       count = array_data.dynamic_size(type,state,data);
-                       xbt_assert1(count >=0,
-                                       "Invalid (negative) array size for type %s",type->name);
-                       gras_dd_send_int(sock, &count, 0/*non-stable*/);
-               }
-
-               /* send the content */
-               sub_type = array_data.type;
-               elm_size = sub_type->aligned_size[GRAS_THISARCH];
-               if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
-                       VERB1("Array of %d scalars, send it in one shot",count);
-                       gras_trp_send(sock, data,
-                                       sub_type->aligned_size[GRAS_THISARCH] * count,
-                                       0 /* not stable */);
-               } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
-                               sub_type->category.array_data.fixed_size > 0 &&
-                               sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) {
-
-                       VERB1("Array of %d fixed array of scalars, send it in one shot",count);
-                       gras_trp_send(sock, data,
-                                       sub_type->category.array_data.type->aligned_size[GRAS_THISARCH]
-                                                                                        * count * sub_type->category.array_data.fixed_size,
-                                                                                        0 /* not stable */);
-
-               } else {
-                       for (cpt=0; cpt<count; cpt++) {
-                               gras_datadesc_send_rec(sock,state,refs, sub_type, ptr,
-                                               detect_cycle || sub_type->cycle);
-                               ptr += elm_size;
-                       }
-               }
-               break;
-       }
-
-       default:
-               xbt_die("Invalid type");
-       }
+gras_datadesc_send_rec(gras_socket_t sock,
+                       gras_cbps_t state,
+                       xbt_dict_t refs,
+                       gras_datadesc_type_t type,
+                       char *data, int detect_cycle)
+{
+
+  xbt_ex_t e;
+  unsigned int cpt;
+  gras_datadesc_type_t sub_type;        /* type on which we recurse */
+
+  VERB2("Send a %s (%s)",
+        type->name, gras_datadesc_cat_names[type->category_code]);
+
+  if (!strcmp(type->name, "string"))
+    VERB1("value: '%s'", *(char **) data);
+
+  if (type->send) {
+    type->send(type, state, data);
+    DEBUG0("Run the emission callback");
+  }
+
+  switch (type->category_code) {
+  case e_gras_datadesc_type_cat_scalar:
+    gras_trp_send(sock, data, type->size[GRAS_THISARCH], 1);
+    break;
+
+  case e_gras_datadesc_type_cat_struct:{
+      gras_dd_cat_struct_t struct_data;
+      gras_dd_cat_field_t field;
+      char *field_data;
+
+      struct_data = type->category.struct_data;
+      xbt_assert1(struct_data.closed,
+                  "Please call gras_datadesc_declare_struct_close on %s before sending it",
+                  type->name);
+      VERB1(">> Send all fields of the structure %s", type->name);
+      xbt_dynar_foreach(struct_data.fields, cpt, field) {
+        field_data = data;
+        field_data += field->offset[GRAS_THISARCH];
+
+        sub_type = field->type;
+
+        if (field->send) {
+          DEBUG1("Run the emission callback of field %s", field->name);
+          field->send(type, state, field_data);
+        }
+
+        VERB1("Send field %s", field->name);
+        gras_datadesc_send_rec(sock, state, refs, sub_type, field_data,
+                               detect_cycle || sub_type->cycle);
+
+      }
+      VERB1("<< Sent all fields of the structure %s", type->name);
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_union:{
+      gras_dd_cat_union_t union_data;
+      gras_dd_cat_field_t field = NULL;
+      int field_num;
+
+      union_data = type->category.union_data;
+
+      xbt_assert1(union_data.closed,
+                  "Please call gras_datadesc_declare_union_close on %s before sending it",
+                  type->name);
+      /* retrieve the field number */
+      field_num = union_data.selector(type, state, data);
+
+      xbt_assert1(field_num > 0,
+                  "union field selector of %s gave a negative value",
+                  type->name);
+
+      xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
+                  "union field selector of %s returned %d but there is only %lu fields",
+                  type->name, field_num, xbt_dynar_length(union_data.fields));
+
+      /* Send the field number */
+      gras_dd_send_int(sock, &field_num, 0 /* not stable */ );
+
+      /* Send the content */
+      field =
+        xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
+      sub_type = field->type;
+
+      if (field->send)
+        field->send(type, state, data);
+
+      gras_datadesc_send_rec(sock, state, refs, sub_type, data,
+                             detect_cycle || sub_type->cycle);
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_ref:{
+      gras_dd_cat_ref_t ref_data;
+      void **ref = (void **) data;
+      int reference_is_to_send;
+
+      ref_data = type->category.ref_data;
+
+      /* Detect the referenced type and send it to peer if needed */
+      sub_type = ref_data.type;
+      if (sub_type == NULL) {
+        sub_type = (*ref_data.selector) (type, state, data);
+        gras_dd_send_int(sock, &(sub_type->code), 1 /*stable */ );
+      }
+
+      /* Send the actual value of the pointer for cycle handling */
+      if (!pointer_type) {
+        pointer_type = gras_datadesc_by_name("data pointer");
+        xbt_assert(pointer_type);
+      }
+
+      gras_trp_send(sock, (char *) data,
+                    pointer_type->size[GRAS_THISARCH], 1 /*stable */ );
+
+      /* Send the pointed data only if not already sent */
+      if (*(void **) data == NULL) {
+        VERB0("Not sending NULL referenced data");
+        break;
+      }
+
+      reference_is_to_send = 0;
+      TRY {
+        if (detect_cycle)
+          /* return ignored. Just checking whether it's known or not */
+          xbt_dict_get_ext(refs, (char *) ref, sizeof(char *));
+        else
+          reference_is_to_send = 1;
+      }
+      CATCH(e) {
+        if (e.category != not_found_error)
+          RETHROW;
+        reference_is_to_send = 1;
+        xbt_ex_free(e);
+      }
+
+      if (reference_is_to_send) {
+        VERB1("Sending data referenced at %p", (void *) *ref);
+        if (detect_cycle)
+          xbt_dict_set_ext(refs, (char *) ref, sizeof(void *), ref, NULL);
+        gras_datadesc_send_rec(sock, state, refs, sub_type, *ref,
+                               detect_cycle || sub_type->cycle);
+
+      } else {
+        VERB1("Not sending data referenced at %p (already done)",
+              (void *) *ref);
+      }
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_array:{
+      gras_dd_cat_array_t array_data;
+      int count;
+      char *ptr = data;
+      long int elm_size;
+
+      array_data = type->category.array_data;
+
+      /* determine and send the element count */
+      count = array_data.fixed_size;
+      if (count == -1) {
+        count = array_data.dynamic_size(type, state, data);
+        xbt_assert1(count >= 0,
+                    "Invalid (negative) array size for type %s", type->name);
+        gras_dd_send_int(sock, &count, 0 /*non-stable */ );
+      }
+
+      /* send the content */
+      sub_type = array_data.type;
+      elm_size = sub_type->aligned_size[GRAS_THISARCH];
+      if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
+        VERB1("Array of %d scalars, send it in one shot", count);
+        gras_trp_send(sock, data,
+                      sub_type->aligned_size[GRAS_THISARCH] * count,
+                      0 /* not stable */ );
+      } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
+                 sub_type->category.array_data.fixed_size > 0 &&
+                 sub_type->category.array_data.type->category_code ==
+                 e_gras_datadesc_type_cat_scalar) {
+
+        VERB1("Array of %d fixed array of scalars, send it in one shot",
+              count);
+        gras_trp_send(sock, data,
+                      sub_type->category.array_data.
+                      type->aligned_size[GRAS_THISARCH]
+                      * count * sub_type->category.array_data.fixed_size,
+                      0 /* not stable */ );
+
+      } else {
+        for (cpt = 0; cpt < count; cpt++) {
+          gras_datadesc_send_rec(sock, state, refs, sub_type, ptr,
+                                 detect_cycle || sub_type->cycle);
+          ptr += elm_size;
+        }
+      }
+      break;
+    }
+
+  default:
+    xbt_die("Invalid type");
+  }
 }
 
 /**
@@ -604,29 +628,30 @@ gras_datadesc_send_rec(gras_socket_t         sock,
  * Copy the data pointed by src and described by type to the socket
  *
  */
-void gras_datadesc_send(gras_socket_t        sock,
-               gras_datadesc_type_t type,
-               void *src) {
-
-       xbt_ex_t e;
-       static gras_cbps_t state=NULL;
-       static xbt_dict_t  refs=NULL; /* all references already sent */
-
-       xbt_assert0(type,"called with NULL type descriptor");
-
-       if (!state) {
-               state = gras_cbps_new();
-               refs = xbt_dict_new();
-       }
-
-       TRY {
-               gras_datadesc_send_rec(sock,state,refs,type,(char*)src, type->cycle);
-       } CLEANUP {
-               xbt_dict_reset(refs);
-               gras_cbps_reset(state);
-       } CATCH(e) {
-               RETHROW;
-       }
+void gras_datadesc_send(gras_socket_t sock,
+                        gras_datadesc_type_t type, void *src)
+{
+
+  xbt_ex_t e;
+  static gras_cbps_t state = NULL;
+  static xbt_dict_t refs = NULL;        /* all references already sent */
+
+  xbt_assert0(type, "called with NULL type descriptor");
+
+  if (!state) {
+    state = gras_cbps_new();
+    refs = xbt_dict_new();
+  }
+
+  TRY {
+    gras_datadesc_send_rec(sock, state, refs, type, (char *) src,
+                           type->cycle);
+  } CLEANUP {
+    xbt_dict_reset(refs);
+    gras_cbps_reset(state);
+  } CATCH(e) {
+    RETHROW;
+  }
 }
 
 /**
@@ -642,296 +667,302 @@ void gras_datadesc_send(gras_socket_t        sock,
  * hack, but I was told that working code is sometimes better than neat one ;)
  */
 static void
-gras_datadesc_recv_rec(gras_socket_t         sock,
-               gras_cbps_t           state,
-               xbt_dict_t           refs,
-               gras_datadesc_type_t  type,
-               int                   r_arch,
-               char                **r_data,
-               long int              r_lgr,
-               char                 *l_data,
-               int                   subsize,
-               int                   detect_cycle) {
-
-       unsigned int         cpt;
-       gras_datadesc_type_t sub_type;
-       xbt_ex_t e;
-
-       VERB2("Recv a %s @%p", type->name, (void*)l_data);
-       xbt_assert(l_data);
-
-       switch (type->category_code) {
-       case e_gras_datadesc_type_cat_scalar:
-               if (type->size[GRAS_THISARCH] == type->size[r_arch]) {
-                       gras_trp_recv(sock, (char*)l_data, type->size[r_arch]);
-                       if (r_arch != GRAS_THISARCH)
-                               gras_dd_convert_elm(type,1,r_arch, l_data,l_data);
-               } else {
-                       void *ptr = xbt_malloc(type->size[r_arch]);
-
-                       gras_trp_recv(sock, (char*)ptr, type->size[r_arch]);
-                       if (r_arch != GRAS_THISARCH)
-                               gras_dd_convert_elm(type,1,r_arch, ptr,l_data);
-                       free(ptr);
-               }
-               break;
-
-       case e_gras_datadesc_type_cat_struct: {
-               gras_dd_cat_struct_t struct_data;
-               gras_dd_cat_field_t  field;
-
-               struct_data = type->category.struct_data;
-
-               xbt_assert1(struct_data.closed,
-                               "Please call gras_datadesc_declare_struct_close on %s before receiving it",
-                               type->name);
-               VERB1(">> Receive all fields of the structure %s",type->name);
-               xbt_dynar_foreach(struct_data.fields, cpt, field) {
-                       char                 *field_data = l_data + field->offset[GRAS_THISARCH];
-
-                       sub_type = field->type;
-
-                       gras_datadesc_recv_rec(sock,state,refs, sub_type,
-                                       r_arch,NULL,0,
-                                       field_data,-1,
-                                       detect_cycle || sub_type->cycle);
-
-                       if (field->recv) {
-                               DEBUG1("Run the reception callback of field %s", field->name);
-                               field->recv(type,state,(void*)l_data);
-                       }
-
-               }
-               VERB1("<< Received all fields of the structure %s", type->name);
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_union: {
-               gras_dd_cat_union_t union_data;
-               gras_dd_cat_field_t field=NULL;
-               int field_num;
-
-               union_data = type->category.union_data;
-
-               xbt_assert1(union_data.closed,
-                               "Please call gras_datadesc_declare_union_close on %s before receiving it",
-                               type->name);
-               /* retrieve the field number */
-               gras_dd_recv_int(sock, r_arch, &field_num);
-               if (field_num < 0)
-                       THROW1(mismatch_error,0,
-                                       "Received union field for %s is negative", type->name);
-               if (field_num > xbt_dynar_length(union_data.fields))
-                       THROW3(mismatch_error,0,
-                                       "Received union field for %s is said to be #%d but there is only %lu fields",
-                                       type->name, field_num, xbt_dynar_length(union_data.fields));
-
-               /* Recv the content */
-               field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
-               sub_type = field->type;
-
-               gras_datadesc_recv_rec(sock,state,refs, sub_type,
-                               r_arch,NULL,0,
-                               l_data,-1,
-                               detect_cycle || sub_type->cycle);
-               if (field->recv)
-                       field->recv(type,state,l_data);
-
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_ref: {
-               char             **r_ref = NULL;
-               char             **l_ref = NULL;
-               gras_dd_cat_ref_t  ref_data;
-               int reference_is_to_recv = 0;
-
-               ref_data = type->category.ref_data;
-
-               /* Get the referenced type locally or from peer */
-               sub_type = ref_data.type;
-               if (sub_type == NULL) {
-                       int ref_code;
-                       gras_dd_recv_int(sock, r_arch, &ref_code);
-                       sub_type = gras_datadesc_by_id(ref_code);
-               }
-
-               /* Get the actual value of the pointer for cycle handling */
-               if (!pointer_type) {
-                       pointer_type = gras_datadesc_by_name("data pointer");
-                       xbt_assert(pointer_type);
-               }
-
-               r_ref = xbt_malloc(pointer_type->size[r_arch]);
-
-               gras_trp_recv(sock, (char*)r_ref,
-                               pointer_type->size[r_arch]);
-
-               /* Receive the pointed data only if not already sent */
-               if (gras_dd_is_r_null(r_ref, pointer_type->size[r_arch])) {
-                       VERB1("Not receiving data remotely referenced @%p since it's NULL",
-                                       *(void **)r_ref);
-                       *(void**)l_data = NULL;
-                       free(r_ref);
-                       break;
-               }
-
-               reference_is_to_recv = 0;
-               TRY {
-                       if (detect_cycle) {
-                               l_ref = xbt_dict_get_ext(refs, (char*)r_ref, pointer_type->size[r_arch]);
-                       } else {
-                               reference_is_to_recv = 1;
-                       }
-               } CATCH(e) {
-                       if (e.category != not_found_error)
-                               RETHROW;
-                       reference_is_to_recv = 1;
-                       xbt_ex_free(e);
-               }
-
-               if (reference_is_to_recv) {
-                       int subsubcount = -1;
-                       void *l_referenced=NULL;
-
-                       VERB2("Receiving a ref to '%s', remotely @%p",
-                                       sub_type->name, *(void**)r_ref);
-                       if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
-                               /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
-                               gras_dd_cat_array_t array_data = sub_type->category.array_data;
-                               gras_datadesc_type_t subsub_type;
-
-                               subsubcount = array_data.fixed_size;
-                               if (subsubcount == -1)
-                                       gras_dd_recv_int(sock, r_arch, &subsubcount);
-
-                               subsub_type = array_data.type;
-
-                               if (subsubcount != 0)
-                                       gras_dd_alloc_ref(refs,
-                                                       subsub_type->size[GRAS_THISARCH] * subsubcount,
-                                                       r_ref,pointer_type->size[r_arch],
-                                                       (char**)&l_referenced,
-                                                       detect_cycle);
-                               else
-                                       l_referenced = NULL;
-                       } else {
-                               gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH],
-                                               r_ref,pointer_type->size[r_arch],
-                                               (char**)&l_referenced,
-                                               detect_cycle);
-                       }
-
-                       if (l_referenced != NULL)
-                               gras_datadesc_recv_rec(sock,state,refs, sub_type,
-                                               r_arch,r_ref,pointer_type->size[r_arch],
-                                               (char*)l_referenced, subsubcount,
-                                               detect_cycle || sub_type->cycle);
-
-                       *(void**)l_data=l_referenced;
-                       VERB3("'%s' remotely referenced at %p locally at %p",
-                                       sub_type->name, *(void**)r_ref, l_referenced);
-
-               } else {
-                       VERB2("NOT receiving data remotely referenced @%p (already done, @%p here)",
-                                       *(void**)r_ref, *(void**)l_ref);
-
-                       *(void**)l_data=*l_ref;
-
-               }
-               free(r_ref);
-               break;
-       }
-
-       case e_gras_datadesc_type_cat_array: {
-               gras_dd_cat_array_t    array_data;
-               int count;
-               char     *ptr;
-               long int  elm_size;
-
-               array_data = type->category.array_data;
-               /* determine element count locally, or from caller, or from peer */
-               count = array_data.fixed_size;
-               if (count == -1)
-                       count = subsize;
-               if (count == -1)
-                       gras_dd_recv_int(sock, r_arch, &count);
-               if (count == -1)
-                       THROW1(mismatch_error,0,
-                                       "Invalid (=-1) array size for type %s",type->name);
-
-               /* receive the content */
-               sub_type = array_data.type;
-               if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
-                       VERB1("Array of %d scalars, get it in one shoot", count);
-                       if (sub_type->aligned_size[GRAS_THISARCH] >=
-                                       sub_type->aligned_size[r_arch]) {
-                               gras_trp_recv(sock, (char*)l_data,
-                                               sub_type->aligned_size[r_arch] * count);
-                               if (r_arch != GRAS_THISARCH)
-                                       gras_dd_convert_elm(sub_type,count,r_arch, l_data,l_data);
-                       } else {
-                               ptr = xbt_malloc(sub_type->aligned_size[r_arch] * count);
-
-                               gras_trp_recv(sock, (char*)ptr,
-                                               sub_type->size[r_arch] * count);
-                               if (r_arch != GRAS_THISARCH)
-                                       gras_dd_convert_elm(sub_type,count,r_arch, ptr,l_data);
-                               free(ptr);
-                       }
-               } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
-                               sub_type->category.array_data.fixed_size >= 0 &&
-                               sub_type->category.array_data.type->category_code == e_gras_datadesc_type_cat_scalar) {
-                       gras_datadesc_type_t subsub_type;
-                       array_data = sub_type->category.array_data;
-                       subsub_type = array_data.type;
-
-                       VERB1("Array of %d fixed array of scalars, get it in one shot",count);
-                       if (subsub_type->aligned_size[GRAS_THISARCH] >=
-                                       subsub_type->aligned_size[r_arch]) {
-                               gras_trp_recv(sock, (char*)l_data,
-                                               subsub_type->aligned_size[r_arch] * count *
-                                               array_data.fixed_size);
-                               if (r_arch != GRAS_THISARCH)
-                                       gras_dd_convert_elm(subsub_type,count*array_data.fixed_size,r_arch, l_data,l_data);
-                       } else {
-                               ptr = xbt_malloc(subsub_type->aligned_size[r_arch] * count*array_data.fixed_size);
-
-                               gras_trp_recv(sock, (char*)ptr,
-                                               subsub_type->size[r_arch] * count*array_data.fixed_size);
-                               if (r_arch != GRAS_THISARCH)
-                                       gras_dd_convert_elm(subsub_type,count*array_data.fixed_size,r_arch, ptr,l_data);
-                               free(ptr);
-                       }
-
-
-               } else {
-                       /* not scalar content, get it recursively (may contain pointers) */
-                       elm_size = sub_type->aligned_size[GRAS_THISARCH];
-                       VERB2("Receive a %d-long array of %s",count, sub_type->name);
-
-                       ptr = l_data;
-                       for (cpt=0; cpt<count; cpt++) {
-                               gras_datadesc_recv_rec(sock,state,refs, sub_type,
-                                               r_arch, NULL, 0, ptr,-1,
-                                               detect_cycle || sub_type->cycle);
-
-                               ptr += elm_size;
-                       }
-               }
-               break;
-       }
-
-       default:
-               xbt_die("Invalid type");
-       }
-
-       if (type->recv)
-               type->recv(type,state,l_data);
-
-       if (!strcmp(type->name,"string"))
-               VERB1("value: '%s'",*(char**)l_data);
+gras_datadesc_recv_rec(gras_socket_t sock,
+                       gras_cbps_t state,
+                       xbt_dict_t refs,
+                       gras_datadesc_type_t type,
+                       int r_arch,
+                       char **r_data,
+                       long int r_lgr,
+                       char *l_data, int subsize, int detect_cycle)
+{
+
+  unsigned int cpt;
+  gras_datadesc_type_t sub_type;
+  xbt_ex_t e;
+
+  VERB2("Recv a %s @%p", type->name, (void *) l_data);
+  xbt_assert(l_data);
+
+  switch (type->category_code) {
+  case e_gras_datadesc_type_cat_scalar:
+    if (type->size[GRAS_THISARCH] == type->size[r_arch]) {
+      gras_trp_recv(sock, (char *) l_data, type->size[r_arch]);
+      if (r_arch != GRAS_THISARCH)
+        gras_dd_convert_elm(type, 1, r_arch, l_data, l_data);
+    } else {
+      void *ptr = xbt_malloc(type->size[r_arch]);
+
+      gras_trp_recv(sock, (char *) ptr, type->size[r_arch]);
+      if (r_arch != GRAS_THISARCH)
+        gras_dd_convert_elm(type, 1, r_arch, ptr, l_data);
+      free(ptr);
+    }
+    break;
+
+  case e_gras_datadesc_type_cat_struct:{
+      gras_dd_cat_struct_t struct_data;
+      gras_dd_cat_field_t field;
+
+      struct_data = type->category.struct_data;
+
+      xbt_assert1(struct_data.closed,
+                  "Please call gras_datadesc_declare_struct_close on %s before receiving it",
+                  type->name);
+      VERB1(">> Receive all fields of the structure %s", type->name);
+      xbt_dynar_foreach(struct_data.fields, cpt, field) {
+        char *field_data = l_data + field->offset[GRAS_THISARCH];
+
+        sub_type = field->type;
+
+        gras_datadesc_recv_rec(sock, state, refs, sub_type,
+                               r_arch, NULL, 0,
+                               field_data, -1,
+                               detect_cycle || sub_type->cycle);
+
+        if (field->recv) {
+          DEBUG1("Run the reception callback of field %s", field->name);
+          field->recv(type, state, (void *) l_data);
+        }
+
+      }
+      VERB1("<< Received all fields of the structure %s", type->name);
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_union:{
+      gras_dd_cat_union_t union_data;
+      gras_dd_cat_field_t field = NULL;
+      int field_num;
+
+      union_data = type->category.union_data;
+
+      xbt_assert1(union_data.closed,
+                  "Please call gras_datadesc_declare_union_close on %s before receiving it",
+                  type->name);
+      /* retrieve the field number */
+      gras_dd_recv_int(sock, r_arch, &field_num);
+      if (field_num < 0)
+        THROW1(mismatch_error, 0,
+               "Received union field for %s is negative", type->name);
+      if (field_num > xbt_dynar_length(union_data.fields))
+        THROW3(mismatch_error, 0,
+               "Received union field for %s is said to be #%d but there is only %lu fields",
+               type->name, field_num, xbt_dynar_length(union_data.fields));
+
+      /* Recv the content */
+      field =
+        xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
+      sub_type = field->type;
+
+      gras_datadesc_recv_rec(sock, state, refs, sub_type,
+                             r_arch, NULL, 0,
+                             l_data, -1, detect_cycle || sub_type->cycle);
+      if (field->recv)
+        field->recv(type, state, l_data);
+
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_ref:{
+      char **r_ref = NULL;
+      char **l_ref = NULL;
+      gras_dd_cat_ref_t ref_data;
+      int reference_is_to_recv = 0;
+
+      ref_data = type->category.ref_data;
+
+      /* Get the referenced type locally or from peer */
+      sub_type = ref_data.type;
+      if (sub_type == NULL) {
+        int ref_code;
+        gras_dd_recv_int(sock, r_arch, &ref_code);
+        sub_type = gras_datadesc_by_id(ref_code);
+      }
+
+      /* Get the actual value of the pointer for cycle handling */
+      if (!pointer_type) {
+        pointer_type = gras_datadesc_by_name("data pointer");
+        xbt_assert(pointer_type);
+      }
+
+      r_ref = xbt_malloc(pointer_type->size[r_arch]);
+
+      gras_trp_recv(sock, (char *) r_ref, pointer_type->size[r_arch]);
+
+      /* Receive the pointed data only if not already sent */
+      if (gras_dd_is_r_null(r_ref, pointer_type->size[r_arch])) {
+        VERB1("Not receiving data remotely referenced @%p since it's NULL",
+              *(void **) r_ref);
+        *(void **) l_data = NULL;
+        free(r_ref);
+        break;
+      }
+
+      reference_is_to_recv = 0;
+      TRY {
+        if (detect_cycle) {
+          l_ref =
+            xbt_dict_get_ext(refs, (char *) r_ref,
+                             pointer_type->size[r_arch]);
+        } else {
+          reference_is_to_recv = 1;
+        }
+      }
+      CATCH(e) {
+        if (e.category != not_found_error)
+          RETHROW;
+        reference_is_to_recv = 1;
+        xbt_ex_free(e);
+      }
+
+      if (reference_is_to_recv) {
+        int subsubcount = -1;
+        void *l_referenced = NULL;
+
+        VERB2("Receiving a ref to '%s', remotely @%p",
+              sub_type->name, *(void **) r_ref);
+        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
+          /* Damn. Reference to a dynamic array. Allocating the space for it is more complicated */
+          gras_dd_cat_array_t array_data = sub_type->category.array_data;
+          gras_datadesc_type_t subsub_type;
+
+          subsubcount = array_data.fixed_size;
+          if (subsubcount == -1)
+            gras_dd_recv_int(sock, r_arch, &subsubcount);
+
+          subsub_type = array_data.type;
+
+          if (subsubcount != 0)
+            gras_dd_alloc_ref(refs,
+                              subsub_type->size[GRAS_THISARCH] * subsubcount,
+                              r_ref, pointer_type->size[r_arch],
+                              (char **) &l_referenced, detect_cycle);
+          else
+            l_referenced = NULL;
+        } else {
+          gras_dd_alloc_ref(refs, sub_type->size[GRAS_THISARCH],
+                            r_ref, pointer_type->size[r_arch],
+                            (char **) &l_referenced, detect_cycle);
+        }
+
+        if (l_referenced != NULL)
+          gras_datadesc_recv_rec(sock, state, refs, sub_type,
+                                 r_arch, r_ref, pointer_type->size[r_arch],
+                                 (char *) l_referenced, subsubcount,
+                                 detect_cycle || sub_type->cycle);
+
+        *(void **) l_data = l_referenced;
+        VERB3("'%s' remotely referenced at %p locally at %p",
+              sub_type->name, *(void **) r_ref, l_referenced);
+
+      } else {
+        VERB2
+          ("NOT receiving data remotely referenced @%p (already done, @%p here)",
+           *(void **) r_ref, *(void **) l_ref);
+
+        *(void **) l_data = *l_ref;
+
+      }
+      free(r_ref);
+      break;
+    }
+
+  case e_gras_datadesc_type_cat_array:{
+      gras_dd_cat_array_t array_data;
+      int count;
+      char *ptr;
+      long int elm_size;
+
+      array_data = type->category.array_data;
+      /* determine element count locally, or from caller, or from peer */
+      count = array_data.fixed_size;
+      if (count == -1)
+        count = subsize;
+      if (count == -1)
+        gras_dd_recv_int(sock, r_arch, &count);
+      if (count == -1)
+        THROW1(mismatch_error, 0,
+               "Invalid (=-1) array size for type %s", type->name);
+
+      /* receive the content */
+      sub_type = array_data.type;
+      if (sub_type->category_code == e_gras_datadesc_type_cat_scalar) {
+        VERB1("Array of %d scalars, get it in one shoot", count);
+        if (sub_type->aligned_size[GRAS_THISARCH] >=
+            sub_type->aligned_size[r_arch]) {
+          gras_trp_recv(sock, (char *) l_data,
+                        sub_type->aligned_size[r_arch] * count);
+          if (r_arch != GRAS_THISARCH)
+            gras_dd_convert_elm(sub_type, count, r_arch, l_data, l_data);
+        } else {
+          ptr = xbt_malloc(sub_type->aligned_size[r_arch] * count);
+
+          gras_trp_recv(sock, (char *) ptr, sub_type->size[r_arch] * count);
+          if (r_arch != GRAS_THISARCH)
+            gras_dd_convert_elm(sub_type, count, r_arch, ptr, l_data);
+          free(ptr);
+        }
+      } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
+                 sub_type->category.array_data.fixed_size >= 0 &&
+                 sub_type->category.array_data.type->category_code ==
+                 e_gras_datadesc_type_cat_scalar) {
+        gras_datadesc_type_t subsub_type;
+        array_data = sub_type->category.array_data;
+        subsub_type = array_data.type;
+
+        VERB1("Array of %d fixed array of scalars, get it in one shot",
+              count);
+        if (subsub_type->aligned_size[GRAS_THISARCH] >=
+            subsub_type->aligned_size[r_arch]) {
+          gras_trp_recv(sock, (char *) l_data,
+                        subsub_type->aligned_size[r_arch] * count *
+                        array_data.fixed_size);
+          if (r_arch != GRAS_THISARCH)
+            gras_dd_convert_elm(subsub_type, count * array_data.fixed_size,
+                                r_arch, l_data, l_data);
+        } else {
+          ptr =
+            xbt_malloc(subsub_type->aligned_size[r_arch] * count *
+                       array_data.fixed_size);
+
+          gras_trp_recv(sock, (char *) ptr,
+                        subsub_type->size[r_arch] * count *
+                        array_data.fixed_size);
+          if (r_arch != GRAS_THISARCH)
+            gras_dd_convert_elm(subsub_type, count * array_data.fixed_size,
+                                r_arch, ptr, l_data);
+          free(ptr);
+        }
+
+
+      } else {
+        /* not scalar content, get it recursively (may contain pointers) */
+        elm_size = sub_type->aligned_size[GRAS_THISARCH];
+        VERB2("Receive a %d-long array of %s", count, sub_type->name);
+
+        ptr = l_data;
+        for (cpt = 0; cpt < count; cpt++) {
+          gras_datadesc_recv_rec(sock, state, refs, sub_type,
+                                 r_arch, NULL, 0, ptr, -1,
+                                 detect_cycle || sub_type->cycle);
+
+          ptr += elm_size;
+        }
+      }
+      break;
+    }
+
+  default:
+    xbt_die("Invalid type");
+  }
+
+  if (type->recv)
+    type->recv(type, state, l_data);
+
+  if (!strcmp(type->name, "string"))
+    VERB1("value: '%s'", *(char **) l_data);
 
 }
 
@@ -943,31 +974,27 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
  *
  */
 void
-gras_datadesc_recv(gras_socket_t         sock,
-               gras_datadesc_type_t  type,
-               int                   r_arch,
-               void                 *dst) {
-
-       xbt_ex_t e;
-       static gras_cbps_t state=NULL; /* callback persistent state */
-       static xbt_dict_t  refs=NULL;  /* all references already sent */
-
-       if (!state) {
-               state = gras_cbps_new();
-               refs = xbt_dict_new();
-       }
-
-       xbt_assert0(type,"called with NULL type descriptor");
-       TRY {
-               gras_datadesc_recv_rec(sock, state, refs, type,
-                               r_arch, NULL, 0,
-                               (char *) dst,-1,
-                               type->cycle);
-       } CLEANUP {
-               xbt_dict_reset(refs);
-               gras_cbps_reset(state);
-       } CATCH(e) {
-               RETHROW;
-       }
+gras_datadesc_recv(gras_socket_t sock,
+                   gras_datadesc_type_t type, int r_arch, void *dst)
+{
+
+  xbt_ex_t e;
+  static gras_cbps_t state = NULL;      /* callback persistent state */
+  static xbt_dict_t refs = NULL;        /* all references already sent */
+
+  if (!state) {
+    state = gras_cbps_new();
+    refs = xbt_dict_new();
+  }
+
+  xbt_assert0(type, "called with NULL type descriptor");
+  TRY {
+    gras_datadesc_recv_rec(sock, state, refs, type,
+                           r_arch, NULL, 0, (char *) dst, -1, type->cycle);
+  } CLEANUP {
+    xbt_dict_reset(refs);
+    gras_cbps_reset(state);
+  } CATCH(e) {
+    RETHROW;
+  }
 }
-
index 88646e4..b136eec 100644 (file)
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <ctype.h> /* isdigit */
+#include <ctype.h>              /* isdigit */
 
 #include "xbt/ex.h"
 #include "gras/DataDesc/datadesc_private.h"
 #include "gras/DataDesc/ddt_parse.yy.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_parse,gras_ddt,
-               "Parsing C data structures to build GRAS data description");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_parse, gras_ddt,
+                                "Parsing C data structures to build GRAS data description");
 
-typedef struct s_type_modifier{
-       short is_long;
-       int is_unsigned:1;
-       int is_short:1;
+typedef struct s_type_modifier {
+  short is_long;
+  int is_unsigned:1;
+  int is_short:1;
 
-       int is_struct:1;
-       int is_union:1;
-       int is_enum:1;
+  int is_struct:1;
+  int is_union:1;
+  int is_enum:1;
 
-       int is_ref:1;
+  int is_ref:1;
 
-       int is_dynar:2;
-       int is_matrix:2;
-} s_type_modifier_t,*type_modifier_t;
+  int is_dynar:2;
+  int is_matrix:2;
+} s_type_modifier_t, *type_modifier_t;
 
 typedef struct s_field {
-       gras_datadesc_type_t type;
-       char *type_name;
-       char *name;
-       s_type_modifier_t tm;
+  gras_datadesc_type_t type;
+  char *type_name;
+  char *name;
+  s_type_modifier_t tm;
 } s_identifier_t;
 
-extern char *gras_ddt_parse_text; /* text being considered in the parser */
+extern char *gras_ddt_parse_text;       /* text being considered in the parser */
 
 /* local functions */
-static void parse_type_modifier(type_modifier_t type_modifier)  {
-       XBT_IN;
-       do {
-               if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
-                       /* This only used when parsing 'short *' since this function returns when int, float, double,... is encountered */
-                       DEBUG0("This is a reference");
-                       type_modifier->is_ref++;
-
-               } else if (!strcmp(gras_ddt_parse_text,"unsigned")) {
-                       DEBUG0("This is an unsigned");
-                       type_modifier->is_unsigned = 1;
-
-               } else if (!strcmp(gras_ddt_parse_text,"short")) {
-                       DEBUG0("This is short");
-                       type_modifier->is_short = 1;
-
-               } else if (!strcmp(gras_ddt_parse_text,"long")) {
-                       DEBUG0("This is long");
-                       type_modifier->is_long++; /* handle "long long" */
-
-               } else if (!strcmp(gras_ddt_parse_text,"struct")) {
-                       DEBUG0("This is a struct");
-                       type_modifier->is_struct = 1;
-
-               } else if (!strcmp(gras_ddt_parse_text,"union")) {
-                       DEBUG0("This is an union");
-                       type_modifier->is_union = 1;
-
-               } else if (!strcmp(gras_ddt_parse_text,"enum")) {
-                       DEBUG0("This is an enum");
-                       type_modifier->is_enum = 1;
-
-               } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_EMPTY) {
-                       DEBUG0("Pass space");
-
-               } else {
-                       DEBUG1("Done with modifiers (got %s)",gras_ddt_parse_text);
-                       break;
-               }
-
-               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-               if((gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD) &&
-                               (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_STAR)) {
-                       DEBUG2("Done with modifiers (got %s,%d)",gras_ddt_parse_text,gras_ddt_parse_tok_num);
-                       break;
-               }
-       } while(1);
-       XBT_OUT;
+static void parse_type_modifier(type_modifier_t type_modifier)
+{
+  XBT_IN;
+  do {
+    if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
+      /* This only used when parsing 'short *' since this function returns when int, float, double,... is encountered */
+      DEBUG0("This is a reference");
+      type_modifier->is_ref++;
+
+    } else if (!strcmp(gras_ddt_parse_text, "unsigned")) {
+      DEBUG0("This is an unsigned");
+      type_modifier->is_unsigned = 1;
+
+    } else if (!strcmp(gras_ddt_parse_text, "short")) {
+      DEBUG0("This is short");
+      type_modifier->is_short = 1;
+
+    } else if (!strcmp(gras_ddt_parse_text, "long")) {
+      DEBUG0("This is long");
+      type_modifier->is_long++; /* handle "long long" */
+
+    } else if (!strcmp(gras_ddt_parse_text, "struct")) {
+      DEBUG0("This is a struct");
+      type_modifier->is_struct = 1;
+
+    } else if (!strcmp(gras_ddt_parse_text, "union")) {
+      DEBUG0("This is an union");
+      type_modifier->is_union = 1;
+
+    } else if (!strcmp(gras_ddt_parse_text, "enum")) {
+      DEBUG0("This is an enum");
+      type_modifier->is_enum = 1;
+
+    } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_EMPTY) {
+      DEBUG0("Pass space");
+
+    } else {
+      DEBUG1("Done with modifiers (got %s)", gras_ddt_parse_text);
+      break;
+    }
+
+    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+    if ((gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD) &&
+        (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_STAR)) {
+      DEBUG2("Done with modifiers (got %s,%d)", gras_ddt_parse_text,
+             gras_ddt_parse_tok_num);
+      break;
+    }
+  } while (1);
+  XBT_OUT;
 }
 
-static void print_type_modifier(s_type_modifier_t tm) {
-       int i;
+static void print_type_modifier(s_type_modifier_t tm)
+{
+  int i;
+
+  XBT_IN;
+  if (tm.is_unsigned)
+    printf("(unsigned) ");
+  if (tm.is_short)
+    printf("(short) ");
+  for (i = 0; i < tm.is_long; i++)
+    printf("(long) ");
+
+  if (tm.is_struct)
+    printf("(struct) ");
+  if (tm.is_enum)
+    printf("(enum) ");
+  if (tm.is_union)
+    printf("(union) ");
+
+  for (i = 0; i < tm.is_ref; i++)
+    printf("(ref) ");
+  XBT_OUT;
+}
 
-       XBT_IN;
-       if (tm.is_unsigned)             printf("(unsigned) ");
-       if (tm.is_short)                printf("(short) ");
-       for (i=0 ; i<tm.is_long ; i++)  printf("(long) ");
+static void change_to_fixed_array(xbt_dynar_t dynar, long int size)
+{
+  s_identifier_t former, array;
+  memset(&array, 0, sizeof(array));
+
+  XBT_IN;
+  xbt_dynar_pop(dynar, &former);
+  array.type_name = (char *) xbt_malloc(strlen(former.type->name) + 48);
+  DEBUG2("Array specification (size=%ld, elm='%s'), change pushed type",
+         size, former.type_name);
+  sprintf(array.type_name, "%s%s%s%s[%ld]",
+          (former.tm.is_unsigned ? "u " : ""),
+          (former.tm.is_short ? "s " : ""),
+          (former.tm.is_long ? "l " : ""), former.type_name, size);
+  free(former.type_name);
+
+  array.type = gras_datadesc_array_fixed(array.type_name, former.type, size);   /* redeclaration are ignored */
+  array.name = former.name;
+
+  xbt_dynar_push(dynar, &array);
+  XBT_OUT;
+}
 
-       if(tm.is_struct)                printf("(struct) ");
-       if(tm.is_enum)                  printf("(enum) ");
-       if(tm.is_union)                 printf("(union) ");
+static void change_to_ref(xbt_dynar_t dynar)
+{
+  s_identifier_t former, ref;
+  memset(&ref, 0, sizeof(ref));
 
-       for (i=0 ; i<tm.is_ref ; i++)   printf("(ref) ");
-       XBT_OUT;
-}
+  XBT_IN;
+  xbt_dynar_pop(dynar, &former);
+  ref.type_name = (char *) xbt_malloc(strlen(former.type->name) + 2);
+  DEBUG1("Ref specification (elm='%s'), change pushed type",
+         former.type_name);
+  sprintf(ref.type_name, "%s*", former.type_name);
+  free(former.type_name);
 
-static void change_to_fixed_array(xbt_dynar_t dynar, long int size) {
-       s_identifier_t former,array;
-       memset(&array,0,sizeof(array));
-
-       XBT_IN;
-       xbt_dynar_pop(dynar,&former);
-       array.type_name=(char*)xbt_malloc(strlen(former.type->name)+48);
-       DEBUG2("Array specification (size=%ld, elm='%s'), change pushed type",
-                       size,former.type_name);
-       sprintf(array.type_name,"%s%s%s%s[%ld]",
-                       (former.tm.is_unsigned?"u ":""),
-                       (former.tm.is_short?"s ":""),
-                       (former.tm.is_long?"l ":""),
-                       former.type_name,
-                       size);
-       free(former.type_name);
-
-       array.type = gras_datadesc_array_fixed(array.type_name, former.type, size); /* redeclaration are ignored */
-       array.name = former.name;
-
-       xbt_dynar_push(dynar,&array);
-       XBT_OUT;
-}
-static void change_to_ref(xbt_dynar_t dynar) {
-       s_identifier_t former,ref;
-       memset(&ref,0,sizeof(ref));
-
-       XBT_IN;
-       xbt_dynar_pop(dynar,&former);
-       ref.type_name=(char*)xbt_malloc(strlen(former.type->name)+2);
-       DEBUG1("Ref specification (elm='%s'), change pushed type", former.type_name);
-       sprintf(ref.type_name,"%s*",former.type_name);
-       free(former.type_name);
-
-       ref.type = gras_datadesc_ref(ref.type_name, former.type); /* redeclaration are ignored */
-       ref.name = former.name;
-
-       xbt_dynar_push(dynar,&ref);
-       XBT_OUT;
+  ref.type = gras_datadesc_ref(ref.type_name, former.type);     /* redeclaration are ignored */
+  ref.name = former.name;
+
+  xbt_dynar_push(dynar, &ref);
+  XBT_OUT;
 }
 
-static void change_to_ref_pop_array(xbt_dynar_t dynar) {
-       s_identifier_t former,ref;
-       memset(&ref,0,sizeof(ref));
+static void change_to_ref_pop_array(xbt_dynar_t dynar)
+{
+  s_identifier_t former, ref;
+  memset(&ref, 0, sizeof(ref));
 
-       XBT_IN;
-       xbt_dynar_pop(dynar,&former);
-       ref.type = gras_datadesc_ref_pop_arr(former.type); /* redeclaration are ignored */
-       ref.type_name = (char*)strdup(ref.type->name);
-       ref.name = former.name;
+  XBT_IN;
+  xbt_dynar_pop(dynar, &former);
+  ref.type = gras_datadesc_ref_pop_arr(former.type);    /* redeclaration are ignored */
+  ref.type_name = (char *) strdup(ref.type->name);
+  ref.name = former.name;
 
-       free(former.type_name);
+  free(former.type_name);
 
-       xbt_dynar_push(dynar,&ref);
-       XBT_OUT;
+  xbt_dynar_push(dynar, &ref);
+  XBT_OUT;
 }
 
-static void change_to_dynar_of(xbt_dynar_t dynar,gras_datadesc_type_t subtype) {
-       s_identifier_t former,ref;
-       memset(&ref,0,sizeof(ref));
+static void change_to_dynar_of(xbt_dynar_t dynar,
+                               gras_datadesc_type_t subtype)
+{
+  s_identifier_t former, ref;
+  memset(&ref, 0, sizeof(ref));
 
-       XBT_IN;
-       xbt_dynar_pop(dynar,&former);
-       ref.type = gras_datadesc_dynar(subtype,NULL); /* redeclaration are ignored */
-       ref.type_name = (char*)strdup(ref.type->name);
-       ref.name = former.name;
+  XBT_IN;
+  xbt_dynar_pop(dynar, &former);
+  ref.type = gras_datadesc_dynar(subtype, NULL);        /* redeclaration are ignored */
+  ref.type_name = (char *) strdup(ref.type->name);
+  ref.name = former.name;
 
-       free(former.type_name);
+  free(former.type_name);
 
-       xbt_dynar_push(dynar,&ref);
-       XBT_OUT;
+  xbt_dynar_push(dynar, &ref);
+  XBT_OUT;
 }
 
-static void change_to_matrix_of(xbt_dynar_t dynar,gras_datadesc_type_t subtype) {
-       s_identifier_t former,ref;
-       memset(&ref,0,sizeof(ref));
+static void change_to_matrix_of(xbt_dynar_t dynar,
+                                gras_datadesc_type_t subtype)
+{
+  s_identifier_t former, ref;
+  memset(&ref, 0, sizeof(ref));
 
-       XBT_IN;
-       xbt_dynar_pop(dynar,&former);
-       ref.type = gras_datadesc_matrix(subtype,NULL); /* redeclaration are ignored */
-       ref.type_name = (char*)strdup(ref.type->name);
-       ref.name = former.name;
+  XBT_IN;
+  xbt_dynar_pop(dynar, &former);
+  ref.type = gras_datadesc_matrix(subtype, NULL);       /* redeclaration are ignored */
+  ref.type_name = (char *) strdup(ref.type->name);
+  ref.name = former.name;
 
-       free(former.type_name);
+  free(former.type_name);
 
-       xbt_dynar_push(dynar,&ref);
-       XBT_OUT;
+  xbt_dynar_push(dynar, &ref);
+  XBT_OUT;
 }
 
-static void add_free_f(xbt_dynar_t dynar,void_f_pvoid_t free_f) {
-       s_identifier_t former,ref;
-       memset(&ref,0,sizeof(ref));
+static void add_free_f(xbt_dynar_t dynar, void_f_pvoid_t free_f)
+{
+  s_identifier_t former, ref;
+  memset(&ref, 0, sizeof(ref));
 
-       XBT_IN;
-       xbt_dynar_pop(dynar,&former);
-       memcpy(former.type->extra,free_f, sizeof(free_f));
-       xbt_dynar_push(dynar,&former);
-       XBT_OUT;
+  XBT_IN;
+  xbt_dynar_pop(dynar, &former);
+  memcpy(former.type->extra, free_f, sizeof(free_f));
+  xbt_dynar_push(dynar, &former);
+  XBT_OUT;
 }
 
-static void parse_statement(char        *definition,
-               xbt_dynar_t  identifiers,
-               xbt_dynar_t  fields_to_push) {
-       char buffname[512];
-
-       s_identifier_t identifier;
-
-       int expect_id_separator = 0;
-
-       XBT_IN;
-       memset(&identifier,0,sizeof(identifier));
-
-       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-       if(gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RA) {
-               XBT_OUT;
-               THROW0(mismatch_error,0,"End of the englobing structure or union");
-       }
-
-       if (XBT_LOG_ISENABLED(gras_ddt_parse,xbt_log_priority_debug)) {
-               int colon_pos;
-               for (colon_pos = gras_ddt_parse_col_pos;
-               definition[colon_pos] != ';';
-               colon_pos++);
-               definition[colon_pos] = '\0';
-               DEBUG3("Parse the statement \"%s%s;\" (col_pos=%d)",
-                               gras_ddt_parse_text,
-                               definition+gras_ddt_parse_col_pos,
-                               gras_ddt_parse_col_pos);
-               definition[colon_pos] = ';';
-       }
-
-       if(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
-               PARSE_ERROR1("Unparsable symbol: found a typeless statement (got '%s' instead)",
-                               gras_ddt_parse_text);
-
-       /**** get the type modifier of this statement ****/
-       parse_type_modifier(&identifier.tm);
-
-       /*  FIXME: This does not detect recursive definitions at all? */
-       if (identifier.tm.is_union || identifier.tm.is_enum || identifier.tm.is_struct)
-               PARSE_ERROR0("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle recursive type definition yet");
-
-       /**** get the base type, giving "short a" the needed love ****/
-       if (!identifier.tm.is_union &&
-                       !identifier.tm.is_enum  &&
-                       !identifier.tm.is_struct &&
-
-                       (identifier.tm.is_short || identifier.tm.is_long || identifier.tm.is_unsigned) &&
-
-                       strcmp(gras_ddt_parse_text,"char") &&
-                       strcmp(gras_ddt_parse_text,"float") &&
-                       strcmp(gras_ddt_parse_text,"double") &&
-                       strcmp(gras_ddt_parse_text,"int") ) {
-
-               /* bastard user, they omited "int" ! */
-               identifier.type_name=(char*)strdup("int");
-               DEBUG0("the base type is 'int', which were omited (you vicious user)");
-       } else {
-               identifier.type_name=(char*)strdup(gras_ddt_parse_text);
-               DEBUG1("the base type is '%s'",identifier.type_name);
-               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-       }
-
-       /**** build the base type for latter use ****/
-       if (identifier.tm.is_union) {
-               PARSE_ERROR0("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle union yet (get callback from annotation?)");
-
-       } else if (identifier.tm.is_enum) {
-               PARSE_ERROR0("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle enum yet");
-
-       } else if (identifier.tm.is_struct) {
-               sprintf(buffname,"struct %s",identifier.type_name);
-               identifier.type = gras_datadesc_struct(buffname); /* Get created when does not exist */
-
-       } else if (identifier.tm.is_unsigned) {
-               if (!strcmp(identifier.type_name,"int")) {
-                       if (identifier.tm.is_long == 2) {
-                               identifier.type = gras_datadesc_by_name("unsigned long long int");
-                       } else if (identifier.tm.is_long) {
-                               identifier.type = gras_datadesc_by_name("unsigned long int");
-                       } else if (identifier.tm.is_short) {
-                               identifier.type = gras_datadesc_by_name("unsigned short int");
-                       } else {
-                               identifier.type = gras_datadesc_by_name("unsigned int");
-                       }
-
-               } else if (!strcmp(identifier.type_name, "char")) {
-                       identifier.type = gras_datadesc_by_name("unsigned char");
-
-               } else { /* impossible, gcc parses this shit before us */
-                       THROW_IMPOSSIBLE;
-               }
-
-       } else if (!strcmp(identifier.type_name, "float")) {
-               /* no modificator allowed by gcc */
-               identifier.type = gras_datadesc_by_name("float");
-
-       } else if (!strcmp(identifier.type_name, "double")) {
-               if (identifier.tm.is_long)
-                       PARSE_ERROR0("long double not portable and thus not handled");
-
-               identifier.type = gras_datadesc_by_name("double");
-
-       } else { /* signed integer elemental */
-               if (!strcmp(identifier.type_name,"int")) {
-                       if (identifier.tm.is_long == 2) {
-                               identifier.type = gras_datadesc_by_name("signed long long int");
-                       } else if (identifier.tm.is_long) {
-                               identifier.type = gras_datadesc_by_name("signed long int");
-                       } else if (identifier.tm.is_short) {
-                               identifier.type = gras_datadesc_by_name("signed short int");
-                       } else {
-                               identifier.type = gras_datadesc_by_name("int");
-                       }
-
-               } else if (!strcmp(identifier.type_name, "char")) {
-                       identifier.type = gras_datadesc_by_name("char");
-
-               } else {
-                       DEBUG1("Base type is a constructed one (%s)",identifier.type_name);
-                       if (!strcmp(identifier.type_name,"xbt_matrix_t")) {
-                               identifier.tm.is_matrix = 1;
-                       } else if (!strcmp(identifier.type_name,"xbt_dynar_t")) {
-                               identifier.tm.is_dynar = 1;
-                       } else {
-                               identifier.type = gras_datadesc_by_name(identifier.type_name);
-                               if (!identifier.type)
-                                       PARSE_ERROR1("Unknown base type '%s'",identifier.type_name);
-                       }
-               }
-       }
-       /* Now identifier.type and identifier.name speak about the base type.
+static void parse_statement(char *definition,
+                            xbt_dynar_t identifiers,
+                            xbt_dynar_t fields_to_push)
+{
+  char buffname[512];
+
+  s_identifier_t identifier;
+
+  int expect_id_separator = 0;
+
+  XBT_IN;
+  memset(&identifier, 0, sizeof(identifier));
+
+  gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+  if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RA) {
+    XBT_OUT;
+    THROW0(mismatch_error, 0, "End of the englobing structure or union");
+  }
+
+  if (XBT_LOG_ISENABLED(gras_ddt_parse, xbt_log_priority_debug)) {
+    int colon_pos;
+    for (colon_pos = gras_ddt_parse_col_pos;
+         definition[colon_pos] != ';'; colon_pos++);
+    definition[colon_pos] = '\0';
+    DEBUG3("Parse the statement \"%s%s;\" (col_pos=%d)",
+           gras_ddt_parse_text,
+           definition + gras_ddt_parse_col_pos, gras_ddt_parse_col_pos);
+    definition[colon_pos] = ';';
+  }
+
+  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+    PARSE_ERROR1
+      ("Unparsable symbol: found a typeless statement (got '%s' instead)",
+       gras_ddt_parse_text);
+
+        /**** get the type modifier of this statement ****/
+  parse_type_modifier(&identifier.tm);
+
+  /*  FIXME: This does not detect recursive definitions at all? */
+  if (identifier.tm.is_union || identifier.tm.is_enum
+      || identifier.tm.is_struct)
+    PARSE_ERROR0
+      ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle recursive type definition yet");
+
+        /**** get the base type, giving "short a" the needed love ****/
+  if (!identifier.tm.is_union &&
+      !identifier.tm.is_enum &&
+      !identifier.tm.is_struct &&
+      (identifier.tm.is_short || identifier.tm.is_long
+       || identifier.tm.is_unsigned) && strcmp(gras_ddt_parse_text, "char")
+      && strcmp(gras_ddt_parse_text, "float")
+      && strcmp(gras_ddt_parse_text, "double")
+      && strcmp(gras_ddt_parse_text, "int")) {
+
+    /* bastard user, they omited "int" ! */
+    identifier.type_name = (char *) strdup("int");
+    DEBUG0("the base type is 'int', which were omited (you vicious user)");
+  } else {
+    identifier.type_name = (char *) strdup(gras_ddt_parse_text);
+    DEBUG1("the base type is '%s'", identifier.type_name);
+    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+  }
+
+        /**** build the base type for latter use ****/
+  if (identifier.tm.is_union) {
+    PARSE_ERROR0
+      ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle union yet (get callback from annotation?)");
+
+  } else if (identifier.tm.is_enum) {
+    PARSE_ERROR0
+      ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle enum yet");
+
+  } else if (identifier.tm.is_struct) {
+    sprintf(buffname, "struct %s", identifier.type_name);
+    identifier.type = gras_datadesc_struct(buffname);   /* Get created when does not exist */
+
+  } else if (identifier.tm.is_unsigned) {
+    if (!strcmp(identifier.type_name, "int")) {
+      if (identifier.tm.is_long == 2) {
+        identifier.type = gras_datadesc_by_name("unsigned long long int");
+      } else if (identifier.tm.is_long) {
+        identifier.type = gras_datadesc_by_name("unsigned long int");
+      } else if (identifier.tm.is_short) {
+        identifier.type = gras_datadesc_by_name("unsigned short int");
+      } else {
+        identifier.type = gras_datadesc_by_name("unsigned int");
+      }
+
+    } else if (!strcmp(identifier.type_name, "char")) {
+      identifier.type = gras_datadesc_by_name("unsigned char");
+
+    } else {                    /* impossible, gcc parses this shit before us */
+      THROW_IMPOSSIBLE;
+    }
+
+  } else if (!strcmp(identifier.type_name, "float")) {
+    /* no modificator allowed by gcc */
+    identifier.type = gras_datadesc_by_name("float");
+
+  } else if (!strcmp(identifier.type_name, "double")) {
+    if (identifier.tm.is_long)
+      PARSE_ERROR0("long double not portable and thus not handled");
+
+    identifier.type = gras_datadesc_by_name("double");
+
+  } else {                      /* signed integer elemental */
+    if (!strcmp(identifier.type_name, "int")) {
+      if (identifier.tm.is_long == 2) {
+        identifier.type = gras_datadesc_by_name("signed long long int");
+      } else if (identifier.tm.is_long) {
+        identifier.type = gras_datadesc_by_name("signed long int");
+      } else if (identifier.tm.is_short) {
+        identifier.type = gras_datadesc_by_name("signed short int");
+      } else {
+        identifier.type = gras_datadesc_by_name("int");
+      }
+
+    } else if (!strcmp(identifier.type_name, "char")) {
+      identifier.type = gras_datadesc_by_name("char");
+
+    } else {
+      DEBUG1("Base type is a constructed one (%s)", identifier.type_name);
+      if (!strcmp(identifier.type_name, "xbt_matrix_t")) {
+        identifier.tm.is_matrix = 1;
+      } else if (!strcmp(identifier.type_name, "xbt_dynar_t")) {
+        identifier.tm.is_dynar = 1;
+      } else {
+        identifier.type = gras_datadesc_by_name(identifier.type_name);
+        if (!identifier.type)
+          PARSE_ERROR1("Unknown base type '%s'", identifier.type_name);
+      }
+    }
+  }
+  /* Now identifier.type and identifier.name speak about the base type.
      Stars are not eaten unless 'int' was omitted.
      We will have to enhance it if we are in fact asked for array or reference.
 
      Dynars and matrices also need some extra love (prodiged as annotations)
-        */
-
-       /**** look for the symbols of this type ****/
-       for(expect_id_separator = 0;
-
-       (/*(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_EMPTY) && FIXME*/
-                       (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_SEMI_COLON)) ;
-
-       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()          ) {
-
-               if(expect_id_separator) {
-                       if(gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
-                               expect_id_separator = 0;
-                               continue;
-
-                       } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_LB) {
-                               /* Handle fixed size arrays */
-                               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-                               if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RB) {
-                                       PARSE_ERROR0("Unimplemented feature: GRAS_DEFINE_TYPE cannot deal with [] constructs (yet)");
-
-                               } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
-                                       char *end;
-                                       long int size=strtol(gras_ddt_parse_text, &end, 10);
-
-                                       if (end == gras_ddt_parse_text || *end != '\0') {
-                                               /* Not a number. Get the constant value, if any */
-                                               int *storage=xbt_dict_get_or_null(gras_dd_constants,gras_ddt_parse_text);
-                                               if (storage) {
-                                                       size = *storage;
-                                               } else {
-                                                       PARSE_ERROR1("Unparsable size of array. Found '%s', expected number or known constant. Need to use gras_datadesc_set_const(), huh?",
-                                                                       gras_ddt_parse_text);
-                                               }
-                                       }
-
-                                       /* replace the previously pushed type to an array of it */
-                                       change_to_fixed_array(identifiers,size);
-
-                                       /* eat the closing bracket */
-                                       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-                                       if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RB)
-                                               PARSE_ERROR0("Unparsable size of array");
-                                       DEBUG1("Fixed size array, size=%ld",size);
-                                       continue;
-                               } else {
-                                       PARSE_ERROR0("Unparsable size of array");
-                               }
-                               /* End of fixed size arrays handling */
-
-                       } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
-                               /* Handle annotation */
-                               s_identifier_t array;
-                               char *keyname = NULL;
-                               char *keyval  = NULL;
-                               memset(&array,0,sizeof(array));
-                               if (strcmp(gras_ddt_parse_text,"GRAS_ANNOTE"))
-                                       PARSE_ERROR1("Unparsable symbol: Expected 'GRAS_ANNOTE', got '%s'",gras_ddt_parse_text);
-
-                               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-                               if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LP)
-                                       PARSE_ERROR1("Unparsable annotation: Expected parenthesis, got '%s'",gras_ddt_parse_text);
-
-                               while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
-
-                               if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
-                                       PARSE_ERROR1("Unparsable annotation: Expected key name, got '%s'",gras_ddt_parse_text);
-                               keyname = (char*)strdup(gras_ddt_parse_text);
-
-                               while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
-
-                               if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_COLON)
-                                       PARSE_ERROR1("Unparsable annotation: expected ',' after the key name, got '%s'",gras_ddt_parse_text);
-
-                               while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
-
-                               /* get the value */
-
-                               if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
-                                       PARSE_ERROR1("Unparsable annotation: Expected key value, got '%s'",gras_ddt_parse_text);
-                               keyval = (char*)strdup(gras_ddt_parse_text);
-
-                               while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
-
-                               /* Done with parsing the annotation. Now deal with it by replacing previously pushed type with the right one */
-
-                               DEBUG2("Anotation: %s=%s",keyname,keyval);
-                               if (!strcmp(keyname,"size")) {
-                                       free(keyname);
-                                       if (!identifier.tm.is_ref)
-                                               PARSE_ERROR0("Size annotation for a field not being a reference");
-                                       identifier.tm.is_ref--;
-
-                                       if (!strcmp(keyval,"1")) {
-                                               change_to_ref(identifiers);
-                                               free(keyval);
-                                       } else {
-                                               char *p;
-                                               int fixed = 1;
-                                               for (p = keyval; *p != '\0'; p++)
-                                                       if (! isdigit(*p) )
-                                                               fixed = 0;
-                                               if (fixed) {
-                                                       change_to_fixed_array(identifiers,atoi(keyval));
-                                                       change_to_ref(identifiers);
-                                                       free(keyval);
-
-                                               } else {
-                                                       change_to_ref_pop_array(identifiers);
-                                                       xbt_dynar_push(fields_to_push,&keyval);
-                                               }
-                                       }
-                               } else if (!strcmp(keyname,"subtype")) {
-                                       gras_datadesc_type_t subtype = gras_datadesc_by_name(keyval);
-                                       if (identifier.tm.is_matrix) {
-                                               change_to_matrix_of(identifiers,subtype);
-                                               identifier.tm.is_matrix = -1;
-                                       } else if (identifier.tm.is_dynar) {
-                                               change_to_dynar_of(identifiers,subtype);
-                                               identifier.tm.is_dynar = -1;
-                                       } else {
-                                               PARSE_ERROR1("subtype annotation only accepted for dynars and matrices, but passed to '%s'",identifier.type_name);
-                                       }
-                                       free(keyval);
-                               } else if (!strcmp(keyname,"free_f")) {
-                                       int *storage=xbt_dict_get_or_null(gras_dd_constants,keyval);
-                                       if (!storage)
-                                               PARSE_ERROR1("value for free_f annotation of field %s is not a known constant",identifier.name);
-                                       if (identifier.tm.is_matrix == -1) {
-                                               add_free_f(identifiers,*(void_f_pvoid_t*)storage);
-                                               identifier.tm.is_matrix = 0;
-                                       } else if (identifier.tm.is_dynar == -1) {
-                                               add_free_f(identifiers,*(void_f_pvoid_t*)storage);
-                                               identifier.tm.is_dynar = 0;
-                                       } else {
-                                               PARSE_ERROR1("free_f annotation only accepted for dynars and matrices which subtype is already declared (field %s)",
-                                                               identifier.name);
-                                       }
-                                       free(keyval);
-                               } else {
-                                       free(keyval);
-                                       PARSE_ERROR1("Unknown annotation type: '%s'",keyname);
-                               }
-
-                               /* Get all the multipliers */
-                               while (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
-
-                                       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-
-                                       if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
-                                               PARSE_ERROR1("Unparsable annotation: Expected field name after '*', got '%s'",gras_ddt_parse_text);
-
-                                       keyval = xbt_malloc(strlen(gras_ddt_parse_text)+2);
-                                       sprintf(keyval,"*%s",gras_ddt_parse_text);
-
-                                       /* ask caller to push field as a multiplier */
-                                       xbt_dynar_push(fields_to_push,&keyval);
-
-                                       /* skip blanks after this block*/
-                                       while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump())
-                                                       == GRAS_DDT_PARSE_TOKEN_EMPTY );
-                               }
-
-                               if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RP)
-                                       PARSE_ERROR1("Unparsable annotation: Expected parenthesis, got '%s'",
-                                                       gras_ddt_parse_text);
-
-                               continue;
-
-                               /* End of annotation handling */
-                       } else {
-                               PARSE_ERROR1("Unparsable symbol: Got '%s' instead of expected comma (',')",gras_ddt_parse_text);
-                       }
-               } else if(gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
-                       PARSE_ERROR0("Unparsable symbol: Unexpected comma (',')");
-               }
-
-               if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
-                       identifier.tm.is_ref++; /* We indeed deal with multiple references with multiple annotations */
-                       continue;
-               }
-
-               /* found a symbol name. Build the type and push it to dynar */
-               if(gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
-
-                       identifier.name=(char*)strdup(gras_ddt_parse_text);
-                       DEBUG1("Found the identifier \"%s\"",identifier.name);
-
-                       xbt_dynar_push(identifiers, &identifier);
-                       DEBUG1("Dynar_len=%lu",xbt_dynar_length(identifiers));
-                       expect_id_separator = 1;
-                       continue;
-               }
-
-               PARSE_ERROR0("Unparasable symbol (maybe a def struct in a def struct or a parser bug ;)");
-       }
-
-       if (identifier.tm.is_matrix>0)
-               PARSE_ERROR0("xbt_matrix_t field without 'subtype' annotation");
-       if (identifier.tm.is_dynar>0)
-               PARSE_ERROR0("xbt_dynar_t field without 'subtype' annotation");
-
-       XBT_OUT;
+   */
+
+        /**** look for the symbols of this type ****/
+  for (expect_id_separator = 0; (       /*(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_EMPTY) && FIXME */
+                                  (gras_ddt_parse_tok_num !=
+                                   GRAS_DDT_PARSE_TOKEN_SEMI_COLON));
+       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) {
+
+    if (expect_id_separator) {
+      if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
+        expect_id_separator = 0;
+        continue;
+
+      } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_LB) {
+        /* Handle fixed size arrays */
+        gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+        if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RB) {
+          PARSE_ERROR0
+            ("Unimplemented feature: GRAS_DEFINE_TYPE cannot deal with [] constructs (yet)");
+
+        } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
+          char *end;
+          long int size = strtol(gras_ddt_parse_text, &end, 10);
+
+          if (end == gras_ddt_parse_text || *end != '\0') {
+            /* Not a number. Get the constant value, if any */
+            int *storage =
+              xbt_dict_get_or_null(gras_dd_constants, gras_ddt_parse_text);
+            if (storage) {
+              size = *storage;
+            } else {
+              PARSE_ERROR1
+                ("Unparsable size of array. Found '%s', expected number or known constant. Need to use gras_datadesc_set_const(), huh?",
+                 gras_ddt_parse_text);
+            }
+          }
+
+          /* replace the previously pushed type to an array of it */
+          change_to_fixed_array(identifiers, size);
+
+          /* eat the closing bracket */
+          gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+          if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RB)
+            PARSE_ERROR0("Unparsable size of array");
+          DEBUG1("Fixed size array, size=%ld", size);
+          continue;
+        } else {
+          PARSE_ERROR0("Unparsable size of array");
+        }
+        /* End of fixed size arrays handling */
+
+      } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
+        /* Handle annotation */
+        s_identifier_t array;
+        char *keyname = NULL;
+        char *keyval = NULL;
+        memset(&array, 0, sizeof(array));
+        if (strcmp(gras_ddt_parse_text, "GRAS_ANNOTE"))
+          PARSE_ERROR1("Unparsable symbol: Expected 'GRAS_ANNOTE', got '%s'",
+                       gras_ddt_parse_text);
+
+        gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LP)
+          PARSE_ERROR1
+            ("Unparsable annotation: Expected parenthesis, got '%s'",
+             gras_ddt_parse_text);
+
+        while ((gras_ddt_parse_tok_num =
+                gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY);
+
+        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+          PARSE_ERROR1("Unparsable annotation: Expected key name, got '%s'",
+                       gras_ddt_parse_text);
+        keyname = (char *) strdup(gras_ddt_parse_text);
+
+        while ((gras_ddt_parse_tok_num =
+                gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY);
+
+        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_COLON)
+          PARSE_ERROR1
+            ("Unparsable annotation: expected ',' after the key name, got '%s'",
+             gras_ddt_parse_text);
+
+        while ((gras_ddt_parse_tok_num =
+                gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY);
+
+        /* get the value */
+
+        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+          PARSE_ERROR1("Unparsable annotation: Expected key value, got '%s'",
+                       gras_ddt_parse_text);
+        keyval = (char *) strdup(gras_ddt_parse_text);
+
+        while ((gras_ddt_parse_tok_num =
+                gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY);
+
+        /* Done with parsing the annotation. Now deal with it by replacing previously pushed type with the right one */
+
+        DEBUG2("Anotation: %s=%s", keyname, keyval);
+        if (!strcmp(keyname, "size")) {
+          free(keyname);
+          if (!identifier.tm.is_ref)
+            PARSE_ERROR0("Size annotation for a field not being a reference");
+          identifier.tm.is_ref--;
+
+          if (!strcmp(keyval, "1")) {
+            change_to_ref(identifiers);
+            free(keyval);
+          } else {
+            char *p;
+            int fixed = 1;
+            for (p = keyval; *p != '\0'; p++)
+              if (!isdigit(*p))
+                fixed = 0;
+            if (fixed) {
+              change_to_fixed_array(identifiers, atoi(keyval));
+              change_to_ref(identifiers);
+              free(keyval);
+
+            } else {
+              change_to_ref_pop_array(identifiers);
+              xbt_dynar_push(fields_to_push, &keyval);
+            }
+          }
+        } else if (!strcmp(keyname, "subtype")) {
+          gras_datadesc_type_t subtype = gras_datadesc_by_name(keyval);
+          if (identifier.tm.is_matrix) {
+            change_to_matrix_of(identifiers, subtype);
+            identifier.tm.is_matrix = -1;
+          } else if (identifier.tm.is_dynar) {
+            change_to_dynar_of(identifiers, subtype);
+            identifier.tm.is_dynar = -1;
+          } else {
+            PARSE_ERROR1
+              ("subtype annotation only accepted for dynars and matrices, but passed to '%s'",
+               identifier.type_name);
+          }
+          free(keyval);
+        } else if (!strcmp(keyname, "free_f")) {
+          int *storage = xbt_dict_get_or_null(gras_dd_constants, keyval);
+          if (!storage)
+            PARSE_ERROR1
+              ("value for free_f annotation of field %s is not a known constant",
+               identifier.name);
+          if (identifier.tm.is_matrix == -1) {
+            add_free_f(identifiers, *(void_f_pvoid_t *) storage);
+            identifier.tm.is_matrix = 0;
+          } else if (identifier.tm.is_dynar == -1) {
+            add_free_f(identifiers, *(void_f_pvoid_t *) storage);
+            identifier.tm.is_dynar = 0;
+          } else {
+            PARSE_ERROR1
+              ("free_f annotation only accepted for dynars and matrices which subtype is already declared (field %s)",
+               identifier.name);
+          }
+          free(keyval);
+        } else {
+          free(keyval);
+          PARSE_ERROR1("Unknown annotation type: '%s'", keyname);
+        }
+
+        /* Get all the multipliers */
+        while (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
+
+          gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+
+          if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+            PARSE_ERROR1
+              ("Unparsable annotation: Expected field name after '*', got '%s'",
+               gras_ddt_parse_text);
+
+          keyval = xbt_malloc(strlen(gras_ddt_parse_text) + 2);
+          sprintf(keyval, "*%s", gras_ddt_parse_text);
+
+          /* ask caller to push field as a multiplier */
+          xbt_dynar_push(fields_to_push, &keyval);
+
+          /* skip blanks after this block */
+          while ((gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump())
+                 == GRAS_DDT_PARSE_TOKEN_EMPTY);
+        }
+
+        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RP)
+          PARSE_ERROR1
+            ("Unparsable annotation: Expected parenthesis, got '%s'",
+             gras_ddt_parse_text);
+
+        continue;
+
+        /* End of annotation handling */
+      } else {
+        PARSE_ERROR1
+          ("Unparsable symbol: Got '%s' instead of expected comma (',')",
+           gras_ddt_parse_text);
+      }
+    } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
+      PARSE_ERROR0("Unparsable symbol: Unexpected comma (',')");
+    }
+
+    if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
+      identifier.tm.is_ref++;   /* We indeed deal with multiple references with multiple annotations */
+      continue;
+    }
+
+    /* found a symbol name. Build the type and push it to dynar */
+    if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
+
+      identifier.name = (char *) strdup(gras_ddt_parse_text);
+      DEBUG1("Found the identifier \"%s\"", identifier.name);
+
+      xbt_dynar_push(identifiers, &identifier);
+      DEBUG1("Dynar_len=%lu", xbt_dynar_length(identifiers));
+      expect_id_separator = 1;
+      continue;
+    }
+
+    PARSE_ERROR0
+      ("Unparasable symbol (maybe a def struct in a def struct or a parser bug ;)");
+  }
+
+  if (identifier.tm.is_matrix > 0)
+    PARSE_ERROR0("xbt_matrix_t field without 'subtype' annotation");
+  if (identifier.tm.is_dynar > 0)
+    PARSE_ERROR0("xbt_dynar_t field without 'subtype' annotation");
+
+  XBT_OUT;
 }
 
-static gras_datadesc_type_t parse_struct(char *definition) {
-
-       xbt_ex_t e;
-
-       char buffname[32];
-       static int anonymous_struct=0;
-
-       xbt_dynar_t identifiers;
-       s_identifier_t field;
-       unsigned int iter;
-       int done;
-
-       xbt_dynar_t fields_to_push;
-       char *name;
-
-       gras_datadesc_type_t struct_type;
-
-       XBT_IN;
-       identifiers = xbt_dynar_new(sizeof(s_identifier_t),NULL);
-       fields_to_push = xbt_dynar_new(sizeof(char*),NULL);
-
-       /* Create the struct descriptor */
-       if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
-               struct_type = gras_datadesc_struct(gras_ddt_parse_text);
-               VERB1("Parse the struct '%s'", gras_ddt_parse_text);
-               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-       } else {
-               sprintf(buffname,"anonymous struct %d",anonymous_struct++);
-               VERB1("Parse the anonymous struct nb %d", anonymous_struct);
-               struct_type = gras_datadesc_struct(buffname);
-       }
-
-       if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LA)
-               PARSE_ERROR1("Unparasable symbol: Expecting struct definition, but got %s instead of '{'",
-                               gras_ddt_parse_text);
-
-       /* Parse the identifiers */
-       done = 0;
-       do {
-               TRY {
-                       parse_statement(definition,identifiers,fields_to_push);
-               } CATCH(e) {
-                       if (e.category != mismatch_error)
-                               RETHROW;
-                       xbt_ex_free(e);
-                       done = 1;
-               }
-
-               DEBUG1("This statement contained %lu identifiers",xbt_dynar_length(identifiers));
-               /* append the identifiers we've found */
-               xbt_dynar_foreach(identifiers,iter, field) {
-                       if (field.tm.is_ref)
-                               PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
-                                               field.name,field.tm.is_ref);
-
-                       VERB2("Append field '%s' to %p",field.name, (void*)struct_type);
-                       gras_datadesc_struct_append(struct_type, field.name, field.type);
-                       free(field.name);
-                       free(field.type_name);
-
-               }
-               xbt_dynar_reset(identifiers);
-               DEBUG1("struct_type=%p",(void*)struct_type);
-
-               /* Make sure that all fields declaring a size push it into the cbps */
-               xbt_dynar_foreach(fields_to_push,iter, name) {
-                       DEBUG1("struct_type=%p",(void*)struct_type);
-                       if (name[0] == '*') {
-                               VERB2("Push field '%s' as a multiplier into size stack of %p",
-                                               name+1, (void*)struct_type);
-                               gras_datadesc_cb_field_push_multiplier(struct_type, name+1);
-                       } else {
-                               VERB2("Push field '%s' into size stack of %p",
-                                               name, (void*)struct_type);
-                               gras_datadesc_cb_field_push(struct_type, name);
-                       }
-                       free(name);
-               }
-               xbt_dynar_reset(fields_to_push);
-       } while (!done);
-       gras_datadesc_struct_close(struct_type);
-
-       /* terminates */
-       if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RA)
-               PARSE_ERROR1("Unparasable symbol: Expected '}' at the end of struct definition, got '%s'",
-                               gras_ddt_parse_text);
-
-       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-
-       xbt_dynar_free(&identifiers);
-       xbt_dynar_free(&fields_to_push);
-       XBT_OUT;
-       return struct_type;
+static gras_datadesc_type_t parse_struct(char *definition)
+{
+
+  xbt_ex_t e;
+
+  char buffname[32];
+  static int anonymous_struct = 0;
+
+  xbt_dynar_t identifiers;
+  s_identifier_t field;
+  unsigned int iter;
+  int done;
+
+  xbt_dynar_t fields_to_push;
+  char *name;
+
+  gras_datadesc_type_t struct_type;
+
+  XBT_IN;
+  identifiers = xbt_dynar_new(sizeof(s_identifier_t), NULL);
+  fields_to_push = xbt_dynar_new(sizeof(char *), NULL);
+
+  /* Create the struct descriptor */
+  if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
+    struct_type = gras_datadesc_struct(gras_ddt_parse_text);
+    VERB1("Parse the struct '%s'", gras_ddt_parse_text);
+    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+  } else {
+    sprintf(buffname, "anonymous struct %d", anonymous_struct++);
+    VERB1("Parse the anonymous struct nb %d", anonymous_struct);
+    struct_type = gras_datadesc_struct(buffname);
+  }
+
+  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LA)
+    PARSE_ERROR1
+      ("Unparasable symbol: Expecting struct definition, but got %s instead of '{'",
+       gras_ddt_parse_text);
+
+  /* Parse the identifiers */
+  done = 0;
+  do {
+    TRY {
+      parse_statement(definition, identifiers, fields_to_push);
+    }
+    CATCH(e) {
+      if (e.category != mismatch_error)
+        RETHROW;
+      xbt_ex_free(e);
+      done = 1;
+    }
+
+    DEBUG1("This statement contained %lu identifiers",
+           xbt_dynar_length(identifiers));
+    /* append the identifiers we've found */
+    xbt_dynar_foreach(identifiers, iter, field) {
+      if (field.tm.is_ref)
+        PARSE_ERROR2
+          ("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
+           field.name, field.tm.is_ref);
+
+      VERB2("Append field '%s' to %p", field.name, (void *) struct_type);
+      gras_datadesc_struct_append(struct_type, field.name, field.type);
+      free(field.name);
+      free(field.type_name);
+
+    }
+    xbt_dynar_reset(identifiers);
+    DEBUG1("struct_type=%p", (void *) struct_type);
+
+    /* Make sure that all fields declaring a size push it into the cbps */
+    xbt_dynar_foreach(fields_to_push, iter, name) {
+      DEBUG1("struct_type=%p", (void *) struct_type);
+      if (name[0] == '*') {
+        VERB2("Push field '%s' as a multiplier into size stack of %p",
+              name + 1, (void *) struct_type);
+        gras_datadesc_cb_field_push_multiplier(struct_type, name + 1);
+      } else {
+        VERB2("Push field '%s' into size stack of %p",
+              name, (void *) struct_type);
+        gras_datadesc_cb_field_push(struct_type, name);
+      }
+      free(name);
+    }
+    xbt_dynar_reset(fields_to_push);
+  } while (!done);
+  gras_datadesc_struct_close(struct_type);
+
+  /* terminates */
+  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RA)
+    PARSE_ERROR1
+      ("Unparasable symbol: Expected '}' at the end of struct definition, got '%s'",
+       gras_ddt_parse_text);
+
+  gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+
+  xbt_dynar_free(&identifiers);
+  xbt_dynar_free(&fields_to_push);
+  XBT_OUT;
+  return struct_type;
 }
 
-static gras_datadesc_type_t parse_typedef(char *definition) {
+static gras_datadesc_type_t parse_typedef(char *definition)
+{
 
-       s_type_modifier_t tm;
+  s_type_modifier_t tm;
 
-       gras_datadesc_type_t struct_desc=NULL;
-       gras_datadesc_type_t typedef_desc=NULL;
+  gras_datadesc_type_t struct_desc = NULL;
+  gras_datadesc_type_t typedef_desc = NULL;
 
-       XBT_IN;
-       memset(&tm,0,sizeof(tm));
+  XBT_IN;
+  memset(&tm, 0, sizeof(tm));
 
-       /* get the aliased type */
-       parse_type_modifier(&tm);
+  /* get the aliased type */
+  parse_type_modifier(&tm);
 
-       if (tm.is_struct) {
-               struct_desc = parse_struct(definition);
-       }
+  if (tm.is_struct) {
+    struct_desc = parse_struct(definition);
+  }
 
-       parse_type_modifier(&tm);
+  parse_type_modifier(&tm);
 
-       if (tm.is_ref)
-               PARSE_ERROR0("GRAS_DEFINE_TYPE cannot handle reference without annotation");
+  if (tm.is_ref)
+    PARSE_ERROR0
+      ("GRAS_DEFINE_TYPE cannot handle reference without annotation");
 
-       /* get the aliasing name */
-       if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
-               PARSE_ERROR1("Unparsable typedef: Expected the alias name, and got '%s'",
-                               gras_ddt_parse_text);
+  /* get the aliasing name */
+  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+    PARSE_ERROR1("Unparsable typedef: Expected the alias name, and got '%s'",
+                 gras_ddt_parse_text);
 
-       /* (FIXME: should) build the alias */
-       PARSE_ERROR0("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle typedef yet");
+  /* (FIXME: should) build the alias */
+  PARSE_ERROR0
+    ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle typedef yet");
 
-       XBT_OUT;
-       return typedef_desc;
+  XBT_OUT;
+  return typedef_desc;
 }
 
 
@@ -686,67 +738,73 @@ static gras_datadesc_type_t parse_typedef(char *definition) {
  * Create a datadescription from the result of parsing the C type description
  */
 gras_datadesc_type_t
-gras_datadesc_parse(const char            *name,
-               const char            *C_statement) {
-
-       gras_datadesc_type_t res=NULL;
-       char *definition;
-       int semicolon_count=0;
-       int def_count,C_count;
-
-       XBT_IN;
-       /* reput the \n in place for debug */
-       for (C_count=0; C_statement[C_count] != '\0'; C_count++)
-               if (C_statement[C_count] == ';' || C_statement[C_count] == '{')
-                       semicolon_count++;
-       definition = (char*)xbt_malloc(C_count + semicolon_count + 1);
-       for (C_count=0,def_count=0; C_statement[C_count] != '\0'; C_count++) {
-               definition[def_count++] = C_statement[C_count];
-               if (C_statement[C_count] == ';' || C_statement[C_count] == '{') {
-                       definition[def_count++] = '\n';
-               }
-       }
-       definition[def_count] = '\0';
-
-       /* init */
-       VERB2("_gras_ddt_type_parse(%s) -> %d chars",definition, def_count);
-       gras_ddt_parse_pointer_string_init(definition);
-
-       /* Do I have a typedef, or a raw struct ?*/
-       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-
-       if ((gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) && (!strcmp(gras_ddt_parse_text,"struct"))) {
-               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-               res = parse_struct(definition);
-
-       } else if ((gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) && (!strcmp(gras_ddt_parse_text,"typedef"))) {
-               gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
-               res = parse_typedef(definition);
-
-       } else {
-               ERROR1("Failed to parse the following symbol (not a struct neither a typedef) :\n%s",definition);
-               xbt_abort();
-       }
-
-       gras_ddt_parse_pointer_string_close();
-       VERB0("end of _gras_ddt_type_parse()");
-       free(definition);
-       /* register it under the name provided as symbol */
-       if (strcmp(res->name,name)) {
-               ERROR2("In GRAS_DEFINE_TYPE, the provided symbol (here %s) must be the C type name (here %s)",
-                               name,res->name);
-               xbt_abort();
-       }
-       gras_ddt_parse_lex_destroy();
-       XBT_OUT;
-       return res;
+gras_datadesc_parse(const char *name, const char *C_statement)
+{
+
+  gras_datadesc_type_t res = NULL;
+  char *definition;
+  int semicolon_count = 0;
+  int def_count, C_count;
+
+  XBT_IN;
+  /* reput the \n in place for debug */
+  for (C_count = 0; C_statement[C_count] != '\0'; C_count++)
+    if (C_statement[C_count] == ';' || C_statement[C_count] == '{')
+      semicolon_count++;
+  definition = (char *) xbt_malloc(C_count + semicolon_count + 1);
+  for (C_count = 0, def_count = 0; C_statement[C_count] != '\0'; C_count++) {
+    definition[def_count++] = C_statement[C_count];
+    if (C_statement[C_count] == ';' || C_statement[C_count] == '{') {
+      definition[def_count++] = '\n';
+    }
+  }
+  definition[def_count] = '\0';
+
+  /* init */
+  VERB2("_gras_ddt_type_parse(%s) -> %d chars", definition, def_count);
+  gras_ddt_parse_pointer_string_init(definition);
+
+  /* Do I have a typedef, or a raw struct ? */
+  gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+
+  if ((gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD)
+      && (!strcmp(gras_ddt_parse_text, "struct"))) {
+    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+    res = parse_struct(definition);
+
+  } else if ((gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD)
+             && (!strcmp(gras_ddt_parse_text, "typedef"))) {
+    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+    res = parse_typedef(definition);
+
+  } else {
+    ERROR1
+      ("Failed to parse the following symbol (not a struct neither a typedef) :\n%s",
+       definition);
+    xbt_abort();
+  }
+
+  gras_ddt_parse_pointer_string_close();
+  VERB0("end of _gras_ddt_type_parse()");
+  free(definition);
+  /* register it under the name provided as symbol */
+  if (strcmp(res->name, name)) {
+    ERROR2
+      ("In GRAS_DEFINE_TYPE, the provided symbol (here %s) must be the C type name (here %s)",
+       name, res->name);
+    xbt_abort();
+  }
+  gras_ddt_parse_lex_destroy();
+  XBT_OUT;
+  return res;
 }
 
 xbt_dict_t gras_dd_constants;
 /** \brief Declare a constant to the parsing mecanism. See the "\#define and fixed size array" section */
-void gras_datadesc_set_const(const char*name, int value) {
-       int *stored = xbt_new(int, 1);
-       *stored=value;
+void gras_datadesc_set_const(const char *name, int value)
+{
+  int *stored = xbt_new(int, 1);
+  *stored = value;
 
-       xbt_dict_set(gras_dd_constants,name, stored, xbt_free_f);
+  xbt_dict_set(gras_dd_constants, name, stored, xbt_free_f);
 }
index cfb0ee1..4e0d0a1 100644 (file)
@@ -69,7 +69,7 @@ typedef uint32_t flex_uint32_t;
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
+typedef unsigned char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -111,15 +111,15 @@ typedef unsigned int flex_uint32_t;
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
-#else  /* ! __cplusplus */
+#else /* ! __cplusplus */
 
 /* C99 requires __STDC__ to be defined as 1. */
 #if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
 #define yyconst const
@@ -180,8 +180,8 @@ extern FILE *gras_ddt_parse_in, *gras_ddt_parse_out;
 #define EOB_ACT_END_OF_FILE 1
 #define EOB_ACT_LAST_MATCH 2
 
-    #define YY_LESS_LINENO(n)
-    
+#define YY_LESS_LINENO(n)
+
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
        do \
@@ -205,73 +205,72 @@ typedef size_t yy_size_t;
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-       {
-       FILE *yy_input_file;
-
-       char *yy_ch_buf;                /* input buffer */
-       char *yy_buf_pos;               /* current position in input buffer */
-
-       /* Size of input buffer in bytes, not including room for EOB
-        * characters.
-        */
-       yy_size_t yy_buf_size;
-
-       /* Number of characters read into yy_ch_buf, not including EOB
-        * characters.
-        */
-       int yy_n_chars;
-
-       /* Whether we "own" the buffer - i.e., we know we created it,
-        * and can realloc() it to grow it, and should free() it to
-        * delete it.
-        */
-       int yy_is_our_buffer;
-
-       /* Whether this is an "interactive" input source; if so, and
-        * if we're using stdio for input, then we want to use getc()
-        * instead of fread(), to make sure we stop fetching input after
-        * each newline.
-        */
-       int yy_is_interactive;
-
-       /* Whether we're considered to be at the beginning of a line.
-        * If so, '^' rules will be active on the next match, otherwise
-        * not.
-        */
-       int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-       /* Whether to try to fill the input buffer when we reach the
-        * end of it.
-        */
-       int yy_fill_buffer;
-
-       int yy_buffer_status;
+struct yy_buffer_state {
+  FILE *yy_input_file;
+
+  char *yy_ch_buf;              /* input buffer */
+  char *yy_buf_pos;             /* current position in input buffer */
+
+  /* Size of input buffer in bytes, not including room for EOB
+   * characters.
+   */
+  yy_size_t yy_buf_size;
+
+  /* Number of characters read into yy_ch_buf, not including EOB
+   * characters.
+   */
+  int yy_n_chars;
+
+  /* Whether we "own" the buffer - i.e., we know we created it,
+   * and can realloc() it to grow it, and should free() it to
+   * delete it.
+   */
+  int yy_is_our_buffer;
+
+  /* Whether this is an "interactive" input source; if so, and
+   * if we're using stdio for input, then we want to use getc()
+   * instead of fread(), to make sure we stop fetching input after
+   * each newline.
+   */
+  int yy_is_interactive;
+
+  /* Whether we're considered to be at the beginning of a line.
+   * If so, '^' rules will be active on the next match, otherwise
+   * not.
+   */
+  int yy_at_bol;
+
+  int yy_bs_lineno;   /**< The line count. */
+  int yy_bs_column;   /**< The column count. */
+
+  /* Whether to try to fill the input buffer when we reach the
+   * end of it.
+   */
+  int yy_fill_buffer;
+
+  int yy_buffer_status;
 
 #define YY_BUFFER_NEW 0
 #define YY_BUFFER_NORMAL 1
-       /* When an EOF's been seen but there's still some text to process
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-        * shouldn't try reading from the input source any more.  We might
-        * still have a bunch of tokens to match, though, because of
-        * possible backing-up.
-        *
-        * When we actually see the EOF, we change the status to "new"
-        * (via gras_ddt_parse_restart()), so that the user can continue scanning by
-        * just pointing gras_ddt_parse_in at a new input file.
-        */
+  /* When an EOF's been seen but there's still some text to process
+   * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+   * shouldn't try reading from the input source any more.  We might
+   * still have a bunch of tokens to match, though, because of
+   * possible backing-up.
+   *
+   * When we actually see the EOF, we change the status to "new"
+   * (via gras_ddt_parse_restart()), so that the user can continue scanning by
+   * just pointing gras_ddt_parse_in at a new input file.
+   */
 #define YY_BUFFER_EOF_PENDING 2
 
-       };
+};
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
 /* Stack of input buffers. */
 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+static YY_BUFFER_STATE *yy_buffer_stack = 0;  /**< Stack as an array. */
 
 /* We provide macros for accessing buffer states in case in the
  * future we want to put the buffer states in a more general
@@ -290,40 +289,40 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
 /* yy_hold_char holds the character lost when gras_ddt_parse_text is formed. */
 static char yy_hold_char;
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */
+static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 int gras_ddt_parse_leng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0;                /* whether we need to initialize */
-static int yy_start = 0;       /* start state number */
+static int yy_init = 0;         /* whether we need to initialize */
+static int yy_start = 0;        /* start state number */
 
 /* Flag which is used to allow gras_ddt_parse_wrap()'s to do buffer switches
  * instead of setting up a fresh gras_ddt_parse_in.  A bit of a hack ...
  */
 static int yy_did_buffer_switch_on_eof;
 
-void gras_ddt_parse_restart (FILE *input_file  );
-void gras_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
-YY_BUFFER_STATE gras_ddt_parse__create_buffer (FILE *file,int size  );
-void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE b  );
-void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE b  );
-void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer  );
-void gras_ddt_parse_pop_buffer_state (void );
+void gras_ddt_parse_restart(FILE * input_file);
+void gras_ddt_parse__switch_to_buffer(YY_BUFFER_STATE new_buffer);
+YY_BUFFER_STATE gras_ddt_parse__create_buffer(FILE * file, int size);
+void gras_ddt_parse__delete_buffer(YY_BUFFER_STATE b);
+void gras_ddt_parse__flush_buffer(YY_BUFFER_STATE b);
+void gras_ddt_parse_push_buffer_state(YY_BUFFER_STATE new_buffer);
+void gras_ddt_parse_pop_buffer_state(void);
 
-static void gras_ddt_parse_ensure_buffer_stack (void );
-static void gras_ddt_parse__load_buffer_state (void );
-static void gras_ddt_parse__init_buffer (YY_BUFFER_STATE b,FILE *file  );
+static void gras_ddt_parse_ensure_buffer_stack(void);
+static void gras_ddt_parse__load_buffer_state(void);
+static void gras_ddt_parse__init_buffer(YY_BUFFER_STATE b, FILE * file);
 
 #define YY_FLUSH_BUFFER gras_ddt_parse__flush_buffer(YY_CURRENT_BUFFER )
 
-YY_BUFFER_STATE gras_ddt_parse__scan_buffer (char *base,yy_size_t size  );
-YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE gras_ddt_parse__scan_buffer(char *base, yy_size_t size);
+YY_BUFFER_STATE gras_ddt_parse__scan_string(yyconst char *yy_str);
+YY_BUFFER_STATE gras_ddt_parse__scan_bytes(yyconst char *bytes, int len);
 
-void *gras_ddt_parse_alloc (yy_size_t  );
-void *gras_ddt_parse_realloc (void *,yy_size_t  );
-void gras_ddt_parse_free (void *  );
+void *gras_ddt_parse_alloc(yy_size_t);
+void *gras_ddt_parse_realloc(void *, yy_size_t);
+void gras_ddt_parse_free(void *);
 
 #define yy_new_buffer gras_ddt_parse__create_buffer
 
@@ -367,10 +366,10 @@ int gras_ddt_parse_lineno = 1;
 extern char *gras_ddt_parse_text;
 #define yytext_ptr gras_ddt_parse_text
 
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[]  );
+static yy_state_type yy_get_previous_state(void);
+static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
+static int yy_get_next_buffer(void);
+static void yy_fatal_error(yyconst char msg[]);
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up gras_ddt_parse_text.
@@ -386,112 +385,104 @@ static void yy_fatal_error (yyconst char msg[]  );
 #define YY_END_OF_BUFFER 27
 /* This struct is not used in this scanner,
    but its presence is necessary. */
-struct yy_trans_info
-       {
-       flex_int32_t yy_verify;
-       flex_int32_t yy_nxt;
-       };
-static yyconst flex_int16_t yy_accept[61] =
-    {   0,
-       14,   14,    7,    7,   10,   10,    0,    0,   27,   25,
-       24,   19,   20,   21,   23,   14,   25,   22,   17,   18,
-       15,   16,    7,    7,    6,    7,    7,   10,   12,   11,
-       26,   26,   14,    0,    1,    7,    7,    7,    5,    7,
-       10,   11,   11,   13,    0,    0,    2,    1,    4,    0,
-        3,    0,    2,    0,    3,    0,    0,    8,    9,    0
-    } ;
-
-static yyconst flex_int32_t yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    1,    1,    1,    1,    1,    1,    1,    4,
-        5,    6,    1,    7,    8,    8,    9,   10,   10,   10,
-       10,   10,   10,   10,   10,   10,   10,    1,   11,    1,
-        1,    1,    1,    1,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
-       12,    1,   13,   14,    8,    1,    8,    8,    8,    8,
-
-        8,    8,   15,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,   16,    1,   17,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst flex_int32_t yy_meta[18] =
-    {   0,
-        1,    1,    2,    1,    1,    3,    1,    4,    1,    4,
-        1,    1,    1,    1,    4,    1,    1
-    } ;
-
-static yyconst flex_int16_t yy_base[69] =
-    {   0,
-        0,    0,   16,   30,   17,   18,   78,   77,   85,   88,
-       88,   88,   88,   88,   88,    0,   19,   88,   88,   88,
-       88,   88,    0,   24,   88,   75,   77,    0,   88,   21,
-       88,   76,    0,   22,    0,    0,   27,   75,    0,   71,
-        0,   29,   34,   88,   29,   65,   76,    0,    0,   63,
-       74,   60,   72,   56,   65,   51,   50,   88,   88,   88,
-       45,   49,   53,   55,   57,   61,   65,   69
-    } ;
-
-static yyconst flex_int16_t yy_def[69] =
-    {   0,
-       60,    1,   61,   61,   62,   62,   63,   63,   60,   60,
-       60,   60,   60,   60,   60,   64,   60,   60,   60,   60,
-       60,   60,   65,   65,   60,   65,   65,   66,   60,   67,
-       60,   60,   64,   60,   68,   65,   65,   65,   65,   65,
-       66,   67,   67,   60,   60,   60,   60,   68,   65,   60,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,    0,
-       60,   60,   60,   60,   60,   60,   60,   60
-    } ;
-
-static yyconst flex_int16_t yy_nxt[106] =
-    {   0,
-       10,   10,   11,   12,   13,   14,   15,   16,   17,   16,
-       18,   19,   20,   10,   16,   21,   22,   24,   25,   29,
-       29,   26,   30,   30,   34,   37,   43,   35,   37,   44,
-       27,   24,   25,   46,   60,   26,   47,   60,   38,   43,
-       50,   38,   44,   51,   27,   23,   23,   23,   23,   28,
-       28,   28,   28,   31,   31,   31,   31,   36,   33,   36,
-       36,   41,   59,   58,   41,   42,   55,   42,   42,   48,
-       57,   48,   48,   53,   56,   55,   54,   53,   52,   49,
-       40,   45,   40,   39,   60,   32,   32,    9,   60,   60,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-
-       60,   60,   60,   60,   60
-    } ;
-
-static yyconst flex_int16_t yy_chk[106] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    3,    3,    5,
-        6,    3,    5,    6,   17,   24,   30,   17,   37,   30,
-        3,    4,    4,   34,   42,    4,   34,   42,   24,   43,
-       45,   37,   43,   45,    4,   61,   61,   61,   61,   62,
-       62,   62,   62,   63,   63,   63,   63,   65,   64,   65,
-       65,   66,   57,   56,   66,   67,   55,   67,   67,   68,
-       54,   68,   68,   53,   52,   51,   50,   47,   46,   40,
-       38,   32,   27,   26,    9,    8,    7,   60,   60,   60,
-       60,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-
-       60,   60,   60,   60,   60
-    } ;
+struct yy_trans_info {
+  flex_int32_t yy_verify;
+  flex_int32_t yy_nxt;
+};
+static yyconst flex_int16_t yy_accept[61] = { 0,
+  14, 14, 7, 7, 10, 10, 0, 0, 27, 25,
+  24, 19, 20, 21, 23, 14, 25, 22, 17, 18,
+  15, 16, 7, 7, 6, 7, 7, 10, 12, 11,
+  26, 26, 14, 0, 1, 7, 7, 7, 5, 7,
+  10, 11, 11, 13, 0, 0, 2, 1, 4, 0,
+  3, 0, 2, 0, 3, 0, 0, 8, 9, 0
+};
+
+static yyconst flex_int32_t yy_ec[256] = { 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
+  5, 6, 1, 7, 8, 8, 9, 10, 10, 10,
+  10, 10, 10, 10, 10, 10, 10, 1, 11, 1,
+  1, 1, 1, 1, 8, 8, 8, 8, 8, 8,
+  8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+  8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+  12, 1, 13, 14, 8, 1, 8, 8, 8, 8,
+
+  8, 8, 15, 8, 8, 8, 8, 8, 8, 8,
+  8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+  8, 8, 16, 1, 17, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1
+};
+
+static yyconst flex_int32_t yy_meta[18] = { 0,
+  1, 1, 2, 1, 1, 3, 1, 4, 1, 4,
+  1, 1, 1, 1, 4, 1, 1
+};
+
+static yyconst flex_int16_t yy_base[69] = { 0,
+  0, 0, 16, 30, 17, 18, 78, 77, 85, 88,
+  88, 88, 88, 88, 88, 0, 19, 88, 88, 88,
+  88, 88, 0, 24, 88, 75, 77, 0, 88, 21,
+  88, 76, 0, 22, 0, 0, 27, 75, 0, 71,
+  0, 29, 34, 88, 29, 65, 76, 0, 0, 63,
+  74, 60, 72, 56, 65, 51, 50, 88, 88, 88,
+  45, 49, 53, 55, 57, 61, 65, 69
+};
+
+static yyconst flex_int16_t yy_def[69] = { 0,
+  60, 1, 61, 61, 62, 62, 63, 63, 60, 60,
+  60, 60, 60, 60, 60, 64, 60, 60, 60, 60,
+  60, 60, 65, 65, 60, 65, 65, 66, 60, 67,
+  60, 60, 64, 60, 68, 65, 65, 65, 65, 65,
+  66, 67, 67, 60, 60, 60, 60, 68, 65, 60,
+  60, 60, 60, 60, 60, 60, 60, 60, 60, 0,
+  60, 60, 60, 60, 60, 60, 60, 60
+};
+
+static yyconst flex_int16_t yy_nxt[106] = { 0,
+  10, 10, 11, 12, 13, 14, 15, 16, 17, 16,
+  18, 19, 20, 10, 16, 21, 22, 24, 25, 29,
+  29, 26, 30, 30, 34, 37, 43, 35, 37, 44,
+  27, 24, 25, 46, 60, 26, 47, 60, 38, 43,
+  50, 38, 44, 51, 27, 23, 23, 23, 23, 28,
+  28, 28, 28, 31, 31, 31, 31, 36, 33, 36,
+  36, 41, 59, 58, 41, 42, 55, 42, 42, 48,
+  57, 48, 48, 53, 56, 55, 54, 53, 52, 49,
+  40, 45, 40, 39, 60, 32, 32, 9, 60, 60,
+  60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+
+  60, 60, 60, 60, 60
+};
+
+static yyconst flex_int16_t yy_chk[106] = { 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 3, 3, 5,
+  6, 3, 5, 6, 17, 24, 30, 17, 37, 30,
+  3, 4, 4, 34, 42, 4, 34, 42, 24, 43,
+  45, 37, 43, 45, 4, 61, 61, 61, 61, 62,
+  62, 62, 62, 63, 63, 63, 63, 65, 64, 65,
+  65, 66, 57, 56, 66, 67, 55, 67, 67, 68,
+  54, 68, 68, 53, 52, 51, 50, 47, 46, 40,
+  38, 32, 27, 26, 9, 8, 7, 60, 60, 60,
+  60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+
+  60, 60, 60, 60, 60
+};
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -515,15 +506,16 @@ char *gras_ddt_parse_text;
 #include "gras/DataDesc/datadesc_private.h"
 #include "gras/DataDesc/ddt_parse.yy.h"
 #include <string.h>
-  YY_BUFFER_STATE gras_ddt_input_buffer;
-  FILE *gras_ddt_file_to_parse;
-
-  int gras_ddt_parse_line_pos = 1;
-  int gras_ddt_parse_col_pos = 0;
-  int gras_ddt_parse_char_pos = 0;
-  int gras_ddt_parse_tok_num = 0;
-  const char *definition;
-  XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_lexer,gras_ddt_parse,"The crude internals of the lexer used for type parsing");
+YY_BUFFER_STATE gras_ddt_input_buffer;
+FILE *gras_ddt_file_to_parse;
+
+int gras_ddt_parse_line_pos = 1;
+int gras_ddt_parse_col_pos = 0;
+int gras_ddt_parse_char_pos = 0;
+int gras_ddt_parse_tok_num = 0;
+const char *definition;
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_lexer, gras_ddt_parse,
+                                "The crude internals of the lexer used for type parsing");
 #define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,gras_ddt_parse_text)
 
 #define INITIAL 0
@@ -543,36 +535,36 @@ char *gras_ddt_parse_text;
 #define YY_EXTRA_TYPE void *
 #endif
 
-static int yy_init_globals (void );
+static int yy_init_globals(void);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int gras_ddt_parse_lex_destroy (void );
+int gras_ddt_parse_lex_destroy(void);
 
-int gras_ddt_parse_get_debug (void );
+int gras_ddt_parse_get_debug(void);
 
-void gras_ddt_parse_set_debug (int debug_flag  );
+void gras_ddt_parse_set_debug(int debug_flag);
 
-YY_EXTRA_TYPE gras_ddt_parse_get_extra (void );
+YY_EXTRA_TYPE gras_ddt_parse_get_extra(void);
 
-void gras_ddt_parse_set_extra (YY_EXTRA_TYPE user_defined  );
+void gras_ddt_parse_set_extra(YY_EXTRA_TYPE user_defined);
 
-FILE *gras_ddt_parse_get_in (void );
+FILE *gras_ddt_parse_get_in(void);
 
-void gras_ddt_parse_set_in  (FILE * in_str  );
+void gras_ddt_parse_set_in(FILE * in_str);
 
-FILE *gras_ddt_parse_get_out (void );
+FILE *gras_ddt_parse_get_out(void);
 
-void gras_ddt_parse_set_out  (FILE * out_str  );
+void gras_ddt_parse_set_out(FILE * out_str);
 
-int gras_ddt_parse_get_leng (void );
+int gras_ddt_parse_get_leng(void);
 
-char *gras_ddt_parse_get_text (void );
+char *gras_ddt_parse_get_text(void);
 
-int gras_ddt_parse_get_lineno (void );
+int gras_ddt_parse_get_lineno(void);
 
-void gras_ddt_parse_set_lineno (int line_number  );
+void gras_ddt_parse_set_lineno(int line_number);
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -580,28 +572,28 @@ void gras_ddt_parse_set_lineno (int line_number  );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int gras_ddt_parse_wrap (void );
+extern "C" int gras_ddt_parse_wrap(void);
 #else
-extern int gras_ddt_parse_wrap (void );
+extern int gras_ddt_parse_wrap(void);
 #endif
 #endif
 
-    static void yyunput (int c,char *buf_ptr  );
-    
+static void yyunput(int c, char *buf_ptr);
+
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
+static void yy_flex_strncpy(char *, yyconst char *, int);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
+static int yy_flex_strlen(yyconst char *);
 #endif
 
 #ifndef YY_NO_INPUT
 
 #ifdef __cplusplus
-static int yyinput (void );
+static int yyinput(void);
 #else
-static int input (void );
+static int input(void);
 #endif
 
 #endif
@@ -681,7 +673,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int gras_ddt_parse_lex (void);
+extern int gras_ddt_parse_lex(void);
 
 #define YY_DECL int gras_ddt_parse_lex (void)
 #endif /* !YY_DECL */
@@ -703,440 +695,326 @@ extern int gras_ddt_parse_lex (void);
 
 /** The main scanner function which does all the work.
  */
-YY_DECL
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp, *yy_bp;
-       register int yy_act;
-    
-   int comment_caller=0;
-   int annotate_caller=0;
+YY_DECL {
+  register yy_state_type yy_current_state;
+  register char *yy_cp, *yy_bp;
+  register int yy_act;
 
-       if ( !(yy_init) )
-               {
-               (yy_init) = 1;
+  int comment_caller = 0;
+  int annotate_caller = 0;
+
+  if (!(yy_init)) {
+    (yy_init) = 1;
 
 #ifdef YY_USER_INIT
-               YY_USER_INIT;
+    YY_USER_INIT;
 #endif
 
-               if ( ! (yy_start) )
-                       (yy_start) = 1; /* first start state */
-
-               if ( ! gras_ddt_parse_in )
-                       gras_ddt_parse_in = stdin;
-
-               if ( ! gras_ddt_parse_out )
-                       gras_ddt_parse_out = stdout;
-
-               if ( ! YY_CURRENT_BUFFER ) {
-                       gras_ddt_parse_ensure_buffer_stack ();
-                       YY_CURRENT_BUFFER_LVALUE =
-                               gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
-               }
-
-               gras_ddt_parse__load_buffer_state( );
-               }
-
-       while ( 1 )             /* loops until end-of-file is reached */
-               {
-               yy_cp = (yy_c_buf_p);
-
-               /* Support of gras_ddt_parse_text. */
-               *yy_cp = (yy_hold_char);
-
-               /* yy_bp points to the position in yy_ch_buf of the start of
-                * the current run.
-                */
-               yy_bp = yy_cp;
-
-               yy_current_state = (yy_start);
-yy_match:
-               do
-                       {
-                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
-                       if ( yy_accept[yy_current_state] )
-                               {
-                               (yy_last_accepting_state) = yy_current_state;
-                               (yy_last_accepting_cpos) = yy_cp;
-                               }
-                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                               {
-                               yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 61 )
-                                       yy_c = yy_meta[(unsigned int) yy_c];
-                               }
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-                       ++yy_cp;
-                       }
-               while ( yy_base[yy_current_state] != 88 );
-
-yy_find_action:
-               yy_act = yy_accept[yy_current_state];
-               if ( yy_act == 0 )
-                       { /* have to back up */
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       yy_act = yy_accept[yy_current_state];
-                       }
-
-               YY_DO_BEFORE_ACTION;
-
-do_action:     /* This label is used only to access EOF actions. */
-
-               switch ( yy_act )
-       { /* beginning of action switch */
-                       case 0: /* must back up */
-                       /* undo the effects of YY_DO_BEFORE_ACTION */
-                       *yy_cp = (yy_hold_char);
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-
-       YY_BREAK
-case 2:
-YY_RULE_SETUP
-{ /****************** ANNOTATION ************************/
-  DEBUG0("Begin annotation");
-  annotate_caller = INITIAL;
-  gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
-  BEGIN(annotate);
-}
-       YY_BREAK
-case 3:
-YY_RULE_SETUP
-{ /* trim annotation */
-  DEBUG0("Begin annotation");
-  annotate_caller = foo;
-  gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
-  BEGIN(annotate);
-}
-       YY_BREAK
-case 4:
-YY_RULE_SETUP
-{
-  DEBUG0("End annotation");
-  gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
-  BEGIN(annotate_caller);
-}
-       YY_BREAK
-case 5:
-YY_RULE_SETUP
-{
-  PARSE_ERROR0("``/*g'' construct closed by a regular ``*/''");
-}
-       YY_BREAK
-case 6:
+    if (!(yy_start))
+      (yy_start) = 1;           /* first start state */
+
+    if (!gras_ddt_parse_in)
+      gras_ddt_parse_in = stdin;
+
+    if (!gras_ddt_parse_out)
+      gras_ddt_parse_out = stdout;
+
+    if (!YY_CURRENT_BUFFER) {
+      gras_ddt_parse_ensure_buffer_stack();
+      YY_CURRENT_BUFFER_LVALUE =
+        gras_ddt_parse__create_buffer(gras_ddt_parse_in, YY_BUF_SIZE);
+    }
+
+    gras_ddt_parse__load_buffer_state();
+  }
+
+  while (1) {                   /* loops until end-of-file is reached */
+    yy_cp = (yy_c_buf_p);
+
+    /* Support of gras_ddt_parse_text. */
+    *yy_cp = (yy_hold_char);
+
+    /* yy_bp points to the position in yy_ch_buf of the start of
+     * the current run.
+     */
+    yy_bp = yy_cp;
+
+    yy_current_state = (yy_start);
+  yy_match:
+    do {
+      register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+      if (yy_accept[yy_current_state]) {
+        (yy_last_accepting_state) = yy_current_state;
+        (yy_last_accepting_cpos) = yy_cp;
+      }
+      while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+        yy_current_state = (int) yy_def[yy_current_state];
+        if (yy_current_state >= 61)
+          yy_c = yy_meta[(unsigned int) yy_c];
+      }
+      yy_current_state =
+        yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+      ++yy_cp;
+    }
+    while (yy_base[yy_current_state] != 88);
+
+  yy_find_action:
+    yy_act = yy_accept[yy_current_state];
+    if (yy_act == 0) {          /* have to back up */
+      yy_cp = (yy_last_accepting_cpos);
+      yy_current_state = (yy_last_accepting_state);
+      yy_act = yy_accept[yy_current_state];
+    }
+
+    YY_DO_BEFORE_ACTION;
+
+  do_action:                   /* This label is used only to access EOF actions. */
+
+    switch (yy_act) {           /* beginning of action switch */
+    case 0:                    /* must back up */
+      /* undo the effects of YY_DO_BEFORE_ACTION */
+      *yy_cp = (yy_hold_char);
+      yy_cp = (yy_last_accepting_cpos);
+      yy_current_state = (yy_last_accepting_state);
+      goto yy_find_action;
+
+    case 1:
+    YY_RULE_SETUP YY_BREAK case 2:
+      YY_RULE_SETUP {
+  /****************** ANNOTATION ************************/
+        DEBUG0("Begin annotation");
+        annotate_caller = INITIAL;
+        gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
+        gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
+        BEGIN(annotate);
+      }
+      YY_BREAK case 3:YY_RULE_SETUP {   /* trim annotation */
+        DEBUG0("Begin annotation");
+        annotate_caller = foo;
+        gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
+        gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
+        BEGIN(annotate);
+      } YY_BREAK case 4:YY_RULE_SETUP {
+        DEBUG0("End annotation");
+        gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
+        gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
+        BEGIN(annotate_caller);
+      } YY_BREAK case 5:YY_RULE_SETUP {
+        PARSE_ERROR0("``/*g'' construct closed by a regular ``*/''");
+      } YY_BREAK case 6:
 /* rule 6 can match eol */
-YY_RULE_SETUP
-{
-  PARSE_ERROR0("Type annotation cannot spread over several lines");
-}
-       YY_BREAK
-case 7:
-YY_RULE_SETUP
-{ /* eat the rest */
-  gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
-  return GRAS_DDT_PARSE_TOKEN_ANNOTATE;
-}
-       YY_BREAK
-case 8:
-YY_RULE_SETUP
-{ /****************** COMMENTS ************************/
-  /* constructs like : */
-    /*g [string] g*/ 
-  /* are not comments but size annotations */
-  comment_caller = INITIAL;
-  BEGIN(comment);
-}
-       YY_BREAK
-case 9:
-YY_RULE_SETUP
-{
-  comment_caller = foo;
-  BEGIN(comment);
-}
-       YY_BREAK
-case 10:
-YY_RULE_SETUP
-{ /* eat anything that's not a '*' */
-}
-       YY_BREAK
-case 11:
-YY_RULE_SETUP
-{ /* eat up '*'s not followed by '/'s */
-}
-       YY_BREAK
-case 12:
+        YY_RULE_SETUP {
+        PARSE_ERROR0("Type annotation cannot spread over several lines");
+      } YY_BREAK case 7:YY_RULE_SETUP { /* eat the rest */
+        gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
+        gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
+        return GRAS_DDT_PARSE_TOKEN_ANNOTATE;
+      } YY_BREAK case 8:YY_RULE_SETUP {
+  /****************** COMMENTS ************************/
+        /* constructs like : */
+        /*g [string] g */
+        /* are not comments but size annotations */
+        comment_caller = INITIAL;
+        BEGIN(comment);
+      } YY_BREAK case 9:YY_RULE_SETUP {
+        comment_caller = foo;
+        BEGIN(comment);
+      } YY_BREAK case 10:YY_RULE_SETUP {        /* eat anything that's not a '*' */
+      } YY_BREAK case 11:YY_RULE_SETUP {        /* eat up '*'s not followed by '/'s */
+      } YY_BREAK case 12:
 /* rule 12 can match eol */
-YY_RULE_SETUP
-{
-  ++gras_ddt_parse_line_pos;
-  gras_ddt_parse_col_pos=0;
-  gras_ddt_parse_char_pos++;
-}
-       YY_BREAK
-case 13:
-YY_RULE_SETUP
-{
-  gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
-  BEGIN(comment_caller);
-}
-       YY_BREAK
-case 14:
-YY_RULE_SETUP
-{  /****************** STATEMENTS ************************/
-  gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_WORD);
-}
-       YY_BREAK
-case 15:
-YY_RULE_SETUP
-{ 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LA);
-}
-       YY_BREAK
-case 16:
-YY_RULE_SETUP
-{
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RA);
-}
-       YY_BREAK
-case 17:
-YY_RULE_SETUP
-{ 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LB);
-}
-       YY_BREAK
-case 18:
-YY_RULE_SETUP
-{
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RB);
-}
-       YY_BREAK
-case 19:
-YY_RULE_SETUP
-{ 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LP);
-}
-       YY_BREAK
-case 20:
-YY_RULE_SETUP
-{
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RP);
-}
-       YY_BREAK
-case 21:
-YY_RULE_SETUP
-{
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_STAR);
-}
-       YY_BREAK
-case 22:
-YY_RULE_SETUP
-{
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
-}
-       YY_BREAK
-case 23:
-YY_RULE_SETUP
-{ 
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_COLON);
-}
-       YY_BREAK
-case 24:
+        YY_RULE_SETUP {
+        ++gras_ddt_parse_line_pos;
+        gras_ddt_parse_col_pos = 0;
+        gras_ddt_parse_char_pos++;
+      } YY_BREAK case 13:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
+        gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
+        BEGIN(comment_caller);
+      } YY_BREAK case 14:YY_RULE_SETUP {
+   /****************** STATEMENTS ************************/
+        gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
+        gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_WORD);
+      } YY_BREAK case 15:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_LA);
+      } YY_BREAK case 16:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_RA);
+      } YY_BREAK case 17:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_LB);
+      } YY_BREAK case 18:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_RB);
+      } YY_BREAK case 19:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_LP);
+      } YY_BREAK case 20:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_RP);
+      } YY_BREAK case 21:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_STAR);
+      } YY_BREAK case 22:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
+      } YY_BREAK case 23:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+        return (GRAS_DDT_PARSE_TOKEN_COLON);
+      } YY_BREAK case 24:
 /* rule 24 can match eol */
-YY_RULE_SETUP
-{
- gras_ddt_parse_line_pos++; 
- gras_ddt_parse_char_pos++;
- gras_ddt_parse_col_pos=0;
-  SHOW_WHERE;
-}
-       YY_BREAK
-case 25:
-YY_RULE_SETUP
-{ 
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-}
-       YY_BREAK
-case 26:
-YY_RULE_SETUP
-ECHO;
-       YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(annotate):
-case YY_STATE_EOF(comment):
-case YY_STATE_EOF(foo):
-       yyterminate();
-
-       case YY_END_OF_BUFFER:
-               {
-               /* Amount of text matched not including the EOB char. */
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */
-               *yy_cp = (yy_hold_char);
-               YY_RESTORE_YY_MORE_OFFSET
-
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-                       {
-                       /* We're scanning a new file or input source.  It's
-                        * possible that this happened because the user
-                        * just pointed gras_ddt_parse_in at a new source and called
-                        * gras_ddt_parse_lex().  If so, then we have to assure
-                        * consistency between YY_CURRENT_BUFFER and our
-                        * globals.  Here is the right place to do so, because
-                        * this is the first action (other than possibly a
-                        * back-up) that will match for the new input source.
-                        */
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = gras_ddt_parse_in;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-                       }
-
-               /* Note that here we test for yy_c_buf_p "<=" to the position
-                * of the first EOB in the buffer, since yy_c_buf_p will
-                * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the
-                * end-of-buffer state).  Contrast this with the test
-                * in input().
-                */
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       { /* This was really a NUL. */
-                       yy_state_type yy_next_state;
-
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state(  );
-
-                       /* Okay, we're now positioned to make the NUL
-                        * transition.  We couldn't have
-                        * yy_get_previous_state() go ahead and do it
-                        * for us because it doesn't know how to deal
-                        * with the possibility of jamming (and we don't
-                        * want to build jamming into it because then it
-                        * will run more slowly).
-                        */
-
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );
-
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
-                       if ( yy_next_state )
-                               {
-                               /* Consume the NUL. */
-                               yy_cp = ++(yy_c_buf_p);
-                               yy_current_state = yy_next_state;
-                               goto yy_match;
-                               }
-
-                       else
-                               {
-                               yy_cp = (yy_c_buf_p);
-                               goto yy_find_action;
-                               }
-                       }
-
-               else switch ( yy_get_next_buffer(  ) )
-                       {
-                       case EOB_ACT_END_OF_FILE:
-                               {
-                               (yy_did_buffer_switch_on_eof) = 0;
-
-                               if ( gras_ddt_parse_wrap( ) )
-                                       {
-                                       /* Note: because we've taken care in
-                                        * yy_get_next_buffer() to have set up
-                                        * gras_ddt_parse_text, we can now set up
-                                        * yy_c_buf_p so that if some total
-                                        * hoser (like flex itself) wants to
-                                        * call the scanner after we return the
-                                        * YY_NULL, it'll still work - another
-                                        * YY_NULL will get returned.
-                                        */
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
-                                       yy_act = YY_STATE_EOF(YY_START);
-                                       goto do_action;
-                                       }
-
-                               else
-                                       {
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-                                       }
-                               break;
-                               }
-
-                       case EOB_ACT_CONTINUE_SCAN:
-                               (yy_c_buf_p) =
-                                       (yytext_ptr) + yy_amount_of_matched_text;
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_match;
-
-                       case EOB_ACT_LAST_MATCH:
-                               (yy_c_buf_p) =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_find_action;
-                       }
-               break;
-               }
-
-       default:
-               YY_FATAL_ERROR(
-                       "fatal flex scanner internal error--no action found" );
-       } /* end of action switch */
-               } /* end of scanning one token */
-} /* end of gras_ddt_parse_lex */
+        YY_RULE_SETUP {
+        gras_ddt_parse_line_pos++;
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos = 0;
+        SHOW_WHERE;
+      } YY_BREAK case 25:YY_RULE_SETUP {
+        gras_ddt_parse_char_pos++;
+        gras_ddt_parse_col_pos++;
+        SHOW_WHERE;
+      } YY_BREAK case 26:YY_RULE_SETUP ECHO;
+      YY_BREAK case YY_STATE_EOF(INITIAL):case YY_STATE_EOF(annotate):case
+        YY_STATE_EOF(comment):case YY_STATE_EOF(foo):yyterminate();
+
+    case YY_END_OF_BUFFER:
+      {
+        /* Amount of text matched not including the EOB char. */
+        int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+        /* Undo the effects of YY_DO_BEFORE_ACTION. */
+        *yy_cp = (yy_hold_char);
+        YY_RESTORE_YY_MORE_OFFSET
+          if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
+          /* We're scanning a new file or input source.  It's
+           * possible that this happened because the user
+           * just pointed gras_ddt_parse_in at a new source and called
+           * gras_ddt_parse_lex().  If so, then we have to assure
+           * consistency between YY_CURRENT_BUFFER and our
+           * globals.  Here is the right place to do so, because
+           * this is the first action (other than possibly a
+           * back-up) that will match for the new input source.
+           */
+          (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+          YY_CURRENT_BUFFER_LVALUE->yy_input_file = gras_ddt_parse_in;
+          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+        }
+
+        /* Note that here we test for yy_c_buf_p "<=" to the position
+         * of the first EOB in the buffer, since yy_c_buf_p will
+         * already have been incremented past the NUL character
+         * (since all states make transitions on EOB to the
+         * end-of-buffer state).  Contrast this with the test
+         * in input().
+         */
+        if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) {       /* This was really a NUL. */
+          yy_state_type yy_next_state;
+
+          (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+          yy_current_state = yy_get_previous_state();
+
+          /* Okay, we're now positioned to make the NUL
+           * transition.  We couldn't have
+           * yy_get_previous_state() go ahead and do it
+           * for us because it doesn't know how to deal
+           * with the possibility of jamming (and we don't
+           * want to build jamming into it because then it
+           * will run more slowly).
+           */
+
+          yy_next_state = yy_try_NUL_trans(yy_current_state);
+
+          yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+          if (yy_next_state) {
+            /* Consume the NUL. */
+            yy_cp = ++(yy_c_buf_p);
+            yy_current_state = yy_next_state;
+            goto yy_match;
+          }
+
+          else {
+            yy_cp = (yy_c_buf_p);
+            goto yy_find_action;
+          }
+        }
+
+        else
+          switch (yy_get_next_buffer()) {
+          case EOB_ACT_END_OF_FILE:
+            {
+              (yy_did_buffer_switch_on_eof) = 0;
+
+              if (gras_ddt_parse_wrap()) {
+                /* Note: because we've taken care in
+                 * yy_get_next_buffer() to have set up
+                 * gras_ddt_parse_text, we can now set up
+                 * yy_c_buf_p so that if some total
+                 * hoser (like flex itself) wants to
+                 * call the scanner after we return the
+                 * YY_NULL, it'll still work - another
+                 * YY_NULL will get returned.
+                 */
+                (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+                yy_act = YY_STATE_EOF(YY_START);
+                goto do_action;
+              }
+
+              else {
+                if (!(yy_did_buffer_switch_on_eof))
+                  YY_NEW_FILE;
+              }
+              break;
+            }
+
+          case EOB_ACT_CONTINUE_SCAN:
+            (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+            yy_current_state = yy_get_previous_state();
+
+            yy_cp = (yy_c_buf_p);
+            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+            goto yy_match;
+
+          case EOB_ACT_LAST_MATCH:
+            (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+            yy_current_state = yy_get_previous_state();
+
+            yy_cp = (yy_c_buf_p);
+            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+            goto yy_find_action;
+          }
+        break;
+      }
+
+    default:
+      YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
+    }                           /* end of action switch */
+  }                             /* end of scanning one token */
+}                               /* end of gras_ddt_parse_lex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -1145,165 +1023,154 @@ case YY_STATE_EOF(foo):
  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  *     EOB_ACT_END_OF_FILE - end of file
  */
-static int yy_get_next_buffer (void)
+static int yy_get_next_buffer(void)
 {
-       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-       register char *source = (yytext_ptr);
-       register int number_to_move, i;
-       int ret_val;
-
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
-               YY_FATAL_ERROR(
-               "fatal flex scanner internal error--end of buffer missed" );
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-               { /* Don't try to fill the buffer, so this is an EOF. */
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
-                       {
-                       /* We matched a single character, the EOB, so
-                        * treat this as a final EOF.
-                        */
-                       return EOB_ACT_END_OF_FILE;
-                       }
-
-               else
-                       {
-                       /* We matched some text prior to the EOB, first
-                        * process it.
-                        */
-                       return EOB_ACT_LAST_MATCH;
-                       }
-               }
-
-       /* Try to read more data. */
-
-       /* First move last chars to start of buffer. */
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
-
-       for ( i = 0; i < number_to_move; ++i )
-               *(dest++) = *(source++);
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-               /* don't do the read, it's not guaranteed to return an EOF,
-                * just force an EOF
-                */
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
-       else
-               {
-                       int num_to_read =
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-               while ( num_to_read <= 0 )
-                       { /* Not enough room in the buffer - grow it. */
-
-                       /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
-                       int yy_c_buf_p_offset =
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-                       if ( b->yy_is_our_buffer )
-                               {
-                               int new_size = b->yy_buf_size * 2;
-
-                               if ( new_size <= 0 )
-                                       b->yy_buf_size += b->yy_buf_size / 8;
-                               else
-                                       b->yy_buf_size *= 2;
-
-                               b->yy_ch_buf = (char *)
-                                       /* Include room in for 2 EOB chars. */
-                                       gras_ddt_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
-                               }
-                       else
-                               /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = 0;
-
-                       if ( ! b->yy_ch_buf )
-                               YY_FATAL_ERROR(
-                               "fatal error - scanner input buffer overflow" );
-
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-                                               number_to_move - 1;
-
-                       }
-
-               if ( num_to_read > YY_READ_BUF_SIZE )
-                       num_to_read = YY_READ_BUF_SIZE;
-
-               /* Read in more data. */
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), (size_t) num_to_read );
-
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       if ( (yy_n_chars) == 0 )
-               {
-               if ( number_to_move == YY_MORE_ADJ )
-                       {
-                       ret_val = EOB_ACT_END_OF_FILE;
-                       gras_ddt_parse_restart(gras_ddt_parse_in  );
-                       }
-
-               else
-                       {
-                       ret_val = EOB_ACT_LAST_MATCH;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-                               YY_BUFFER_EOF_PENDING;
-                       }
-               }
-
-       else
-               ret_val = EOB_ACT_CONTINUE_SCAN;
-
-       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-               /* Extend the array by 50%, plus the number we really need. */
-               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
-               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gras_ddt_parse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
-               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-       }
+  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+  register char *source = (yytext_ptr);
+  register int number_to_move, i;
+  int ret_val;
+
+  if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
+    YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
+
+  if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) {  /* Don't try to fill the buffer, so this is an EOF. */
+    if ((yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1) {
+      /* We matched a single character, the EOB, so
+       * treat this as a final EOF.
+       */
+      return EOB_ACT_END_OF_FILE;
+    }
+
+    else {
+      /* We matched some text prior to the EOB, first
+       * process it.
+       */
+      return EOB_ACT_LAST_MATCH;
+    }
+  }
+
+  /* Try to read more data. */
+
+  /* First move last chars to start of buffer. */
+  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+  for (i = 0; i < number_to_move; ++i)
+    *(dest++) = *(source++);
+
+  if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
+    /* don't do the read, it's not guaranteed to return an EOF,
+     * just force an EOF
+     */
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+  else {
+    int num_to_read =
+      YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+    while (num_to_read <= 0) {  /* Not enough room in the buffer - grow it. */
+
+      /* just a shorter name for the current buffer */
+      YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 
-       (yy_n_chars) += number_to_move;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+      int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+      if (b->yy_is_our_buffer) {
+        int new_size = b->yy_buf_size * 2;
 
-       return ret_val;
+        if (new_size <= 0)
+          b->yy_buf_size += b->yy_buf_size / 8;
+        else
+          b->yy_buf_size *= 2;
+
+        b->yy_ch_buf = (char *)
+          /* Include room in for 2 EOB chars. */
+          gras_ddt_parse_realloc((void *) b->yy_ch_buf, b->yy_buf_size + 2);
+      } else
+        /* Can't grow it, we don't own it. */
+        b->yy_ch_buf = 0;
+
+      if (!b->yy_ch_buf)
+        YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
+
+      (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+      num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+        number_to_move - 1;
+
+    }
+
+    if (num_to_read > YY_READ_BUF_SIZE)
+      num_to_read = YY_READ_BUF_SIZE;
+
+    /* Read in more data. */
+    YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+             (yy_n_chars), (size_t) num_to_read);
+
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  if ((yy_n_chars) == 0) {
+    if (number_to_move == YY_MORE_ADJ) {
+      ret_val = EOB_ACT_END_OF_FILE;
+      gras_ddt_parse_restart(gras_ddt_parse_in);
+    }
+
+    else {
+      ret_val = EOB_ACT_LAST_MATCH;
+      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
+    }
+  }
+
+  else
+    ret_val = EOB_ACT_CONTINUE_SCAN;
+
+  if ((yy_size_t) ((yy_n_chars) + number_to_move) >
+      YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+    /* Extend the array by 50%, plus the number we really need. */
+    yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf =
+      (char *) gras_ddt_parse_realloc((void *)
+                                      YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,
+                                      new_size);
+    if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+      YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
+  }
+
+  (yy_n_chars) += number_to_move;
+  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] =
+    YY_END_OF_BUFFER_CHAR;
+
+  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+  return ret_val;
 }
 
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
-    static yy_state_type yy_get_previous_state (void)
+static yy_state_type yy_get_previous_state(void)
 {
-       register yy_state_type yy_current_state;
-       register char *yy_cp;
-    
-       yy_current_state = (yy_start);
-
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-               {
-               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-               if ( yy_accept[yy_current_state] )
-                       {
-                       (yy_last_accepting_state) = yy_current_state;
-                       (yy_last_accepting_cpos) = yy_cp;
-                       }
-               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                       {
-                       yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 61 )
-                               yy_c = yy_meta[(unsigned int) yy_c];
-                       }
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-               }
-
-       return yy_current_state;
+  register yy_state_type yy_current_state;
+  register char *yy_cp;
+
+  yy_current_state = (yy_start);
+
+  for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
+    register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+    if (yy_accept[yy_current_state]) {
+      (yy_last_accepting_state) = yy_current_state;
+      (yy_last_accepting_cpos) = yy_cp;
+    }
+    while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+      yy_current_state = (int) yy_def[yy_current_state];
+      if (yy_current_state >= 61)
+        yy_c = yy_meta[(unsigned int) yy_c];
+    }
+    yy_current_state =
+      yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+  }
+
+  return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -1311,199 +1178,190 @@ static int yy_get_next_buffer (void)
  * synopsis
  *     next_state = yy_try_NUL_trans( current_state );
  */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
 {
-       register int yy_is_jam;
-       register char *yy_cp = (yy_c_buf_p);
-
-       register YY_CHAR yy_c = 1;
-       if ( yy_accept[yy_current_state] )
-               {
-               (yy_last_accepting_state) = yy_current_state;
-               (yy_last_accepting_cpos) = yy_cp;
-               }
-       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-               {
-               yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 61 )
-                       yy_c = yy_meta[(unsigned int) yy_c];
-               }
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 60);
-
-       return yy_is_jam ? 0 : yy_current_state;
+  register int yy_is_jam;
+  register char *yy_cp = (yy_c_buf_p);
+
+  register YY_CHAR yy_c = 1;
+  if (yy_accept[yy_current_state]) {
+    (yy_last_accepting_state) = yy_current_state;
+    (yy_last_accepting_cpos) = yy_cp;
+  }
+  while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+    yy_current_state = (int) yy_def[yy_current_state];
+    if (yy_current_state >= 61)
+      yy_c = yy_meta[(unsigned int) yy_c];
+  }
+  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+  yy_is_jam = (yy_current_state == 60);
+
+  return yy_is_jam ? 0 : yy_current_state;
 }
 
-    static void yyunput (int c, register char * yy_bp )
+static void yyunput(int c, register char *yy_bp)
 {
-       register char *yy_cp;
-    
-    yy_cp = (yy_c_buf_p);
+  register char *yy_cp;
 
-       /* undo effects of setting up gras_ddt_parse_text */
-       *yy_cp = (yy_hold_char);
+  yy_cp = (yy_c_buf_p);
 
-       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-               { /* need to shift things up to make room */
-               /* +2 for EOB chars. */
-               register int number_to_move = (yy_n_chars) + 2;
-               register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-               register char *source =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+  /* undo effects of setting up gras_ddt_parse_text */
+  *yy_cp = (yy_hold_char);
 
-               while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       *--dest = *--source;
+  if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) {        /* need to shift things up to make room */
+    /* +2 for EOB chars. */
+    register int number_to_move = (yy_n_chars) + 2;
+    register char *dest =
+      &YY_CURRENT_BUFFER_LVALUE->
+      yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+    register char *source =
+      &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
-               yy_cp += (int) (dest - source);
-               yy_bp += (int) (dest - source);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+    while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+      *--dest = *--source;
 
-               if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
-               }
+    yy_cp += (int) (dest - source);
+    yy_bp += (int) (dest - source);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+      (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
 
-       *--yy_cp = (char) c;
+    if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2)
+      YY_FATAL_ERROR("flex scanner push-back overflow");
+  }
 
-       (yytext_ptr) = yy_bp;
-       (yy_hold_char) = *yy_cp;
-       (yy_c_buf_p) = yy_cp;
+  *--yy_cp = (char) c;
+
+  (yytext_ptr) = yy_bp;
+  (yy_hold_char) = *yy_cp;
+  (yy_c_buf_p) = yy_cp;
 }
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-    static int yyinput (void)
+static int yyinput(void)
 #else
-    static int input  (void)
+static int input(void)
 #endif
-
 {
-       int c;
-    
-       *(yy_c_buf_p) = (yy_hold_char);
-
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
-               {
-               /* yy_c_buf_p now points to the character we want to return.
-                * If this occurs *before* the EOB characters, then it's a
-                * valid NUL; if not, then we've hit the end of the buffer.
-                */
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       /* This was really a NUL. */
-                       *(yy_c_buf_p) = '\0';
-
-               else
-                       { /* need more input */
-                       int offset = (yy_c_buf_p) - (yytext_ptr);
-                       ++(yy_c_buf_p);
-
-                       switch ( yy_get_next_buffer(  ) )
-                               {
-                               case EOB_ACT_LAST_MATCH:
-                                       /* This happens because yy_g_n_b()
-                                        * sees that we've accumulated a
-                                        * token and flags that we need to
-                                        * try matching the token before
-                                        * proceeding.  But for input(),
-                                        * there's no matching to consider.
-                                        * So convert the EOB_ACT_LAST_MATCH
-                                        * to EOB_ACT_END_OF_FILE.
-                                        */
-
-                                       /* Reset buffer status. */
-                                       gras_ddt_parse_restart(gras_ddt_parse_in );
-
-                                       /*FALLTHROUGH*/
-
-                               case EOB_ACT_END_OF_FILE:
-                                       {
-                                       if ( gras_ddt_parse_wrap( ) )
-                                               return EOF;
-
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
+  int c;
+
+  *(yy_c_buf_p) = (yy_hold_char);
+
+  if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
+    /* yy_c_buf_p now points to the character we want to return.
+     * If this occurs *before* the EOB characters, then it's a
+     * valid NUL; if not, then we've hit the end of the buffer.
+     */
+    if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
+      /* This was really a NUL. */
+      *(yy_c_buf_p) = '\0';
+
+    else {                      /* need more input */
+      int offset = (yy_c_buf_p) - (yytext_ptr);
+      ++(yy_c_buf_p);
+
+      switch (yy_get_next_buffer()) {
+      case EOB_ACT_LAST_MATCH:
+        /* This happens because yy_g_n_b()
+         * sees that we've accumulated a
+         * token and flags that we need to
+         * try matching the token before
+         * proceeding.  But for input(),
+         * there's no matching to consider.
+         * So convert the EOB_ACT_LAST_MATCH
+         * to EOB_ACT_END_OF_FILE.
+         */
+
+        /* Reset buffer status. */
+        gras_ddt_parse_restart(gras_ddt_parse_in);
+
+       /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE:
+        {
+          if (gras_ddt_parse_wrap())
+            return EOF;
+
+          if (!(yy_did_buffer_switch_on_eof))
+            YY_NEW_FILE;
 #ifdef __cplusplus
-                                       return yyinput();
+          return yyinput();
 #else
-                                       return input();
+          return input();
 #endif
-                                       }
+        }
 
-                               case EOB_ACT_CONTINUE_SCAN:
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;
-                                       break;
-                               }
-                       }
-               }
+      case EOB_ACT_CONTINUE_SCAN:
+        (yy_c_buf_p) = (yytext_ptr) + offset;
+        break;
+      }
+    }
+  }
 
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve gras_ddt_parse_text */
-       (yy_hold_char) = *++(yy_c_buf_p);
+  c = *(unsigned char *) (yy_c_buf_p);  /* cast for 8-bit char's */
+  *(yy_c_buf_p) = '\0';         /* preserve gras_ddt_parse_text */
+  (yy_hold_char) = *++(yy_c_buf_p);
 
-       return c;
+  return c;
 }
-#endif /* ifndef YY_NO_INPUT */
+#endif /* ifndef YY_NO_INPUT */
 
 /** Immediately switch to a different input stream.
  * @param input_file A readable stream.
  * 
  * @note This function does not reset the start condition to @c INITIAL .
  */
-    void gras_ddt_parse_restart  (FILE * input_file )
+void gras_ddt_parse_restart(FILE * input_file)
 {
-    
-       if ( ! YY_CURRENT_BUFFER ){
-        gras_ddt_parse_ensure_buffer_stack ();
-               YY_CURRENT_BUFFER_LVALUE =
-            gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
-       }
 
-       gras_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
-       gras_ddt_parse__load_buffer_state( );
+  if (!YY_CURRENT_BUFFER) {
+    gras_ddt_parse_ensure_buffer_stack();
+    YY_CURRENT_BUFFER_LVALUE =
+      gras_ddt_parse__create_buffer(gras_ddt_parse_in, YY_BUF_SIZE);
+  }
+
+  gras_ddt_parse__init_buffer(YY_CURRENT_BUFFER, input_file);
+  gras_ddt_parse__load_buffer_state();
 }
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
  * 
  */
-    void gras_ddt_parse__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+void gras_ddt_parse__switch_to_buffer(YY_BUFFER_STATE new_buffer)
 {
-    
-       /* TODO. We should be able to replace this entire function body
-        * with
-        *              gras_ddt_parse_pop_buffer_state();
-        *              gras_ddt_parse_push_buffer_state(new_buffer);
-     */
-       gras_ddt_parse_ensure_buffer_stack ();
-       if ( YY_CURRENT_BUFFER == new_buffer )
-               return;
-
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       gras_ddt_parse__load_buffer_state( );
-
-       /* We don't actually know whether we did this switch during
-        * EOF (gras_ddt_parse_wrap()) processing, but the only time this flag
-        * is looked at is after gras_ddt_parse_wrap() is called, so it's safe
-        * to go ahead and always set it.
-        */
-       (yy_did_buffer_switch_on_eof) = 1;
+
+  /* TODO. We should be able to replace this entire function body
+   * with
+   *              gras_ddt_parse_pop_buffer_state();
+   *              gras_ddt_parse_push_buffer_state(new_buffer);
+   */
+  gras_ddt_parse_ensure_buffer_stack();
+  if (YY_CURRENT_BUFFER == new_buffer)
+    return;
+
+  if (YY_CURRENT_BUFFER) {
+    /* Flush out information for old buffer. */
+    *(yy_c_buf_p) = (yy_hold_char);
+    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  YY_CURRENT_BUFFER_LVALUE = new_buffer;
+  gras_ddt_parse__load_buffer_state();
+
+  /* We don't actually know whether we did this switch during
+   * EOF (gras_ddt_parse_wrap()) processing, but the only time this flag
+   * is looked at is after gras_ddt_parse_wrap() is called, so it's safe
+   * to go ahead and always set it.
+   */
+  (yy_did_buffer_switch_on_eof) = 1;
 }
 
-static void gras_ddt_parse__load_buffer_state  (void)
+static void gras_ddt_parse__load_buffer_state(void)
 {
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-       gras_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-       (yy_hold_char) = *(yy_c_buf_p);
+  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+  gras_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+  (yy_hold_char) = *(yy_c_buf_p);
 }
 
 /** Allocate and initialize an input buffer state.
@@ -1512,106 +1370,107 @@ static void gras_ddt_parse__load_buffer_state  (void)
  * 
  * @return the allocated buffer state.
  */
-    YY_BUFFER_STATE gras_ddt_parse__create_buffer  (FILE * file, int  size )
+YY_BUFFER_STATE gras_ddt_parse__create_buffer(FILE * file, int size)
 {
-       YY_BUFFER_STATE b;
-    
-       b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
+  YY_BUFFER_STATE b;
+
+  b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof(struct yy_buffer_state));
+  if (!b)
+    YY_FATAL_ERROR
+      ("out of dynamic memory in gras_ddt_parse__create_buffer()");
 
-       b->yy_buf_size = size;
+  b->yy_buf_size = size;
 
-       /* yy_ch_buf has to be 2 characters longer than the size given because
-        * we need to put in 2 end-of-buffer characters.
-        */
-       b->yy_ch_buf = (char *) gras_ddt_parse_alloc(b->yy_buf_size + 2  );
-       if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
+  /* yy_ch_buf has to be 2 characters longer than the size given because
+   * we need to put in 2 end-of-buffer characters.
+   */
+  b->yy_ch_buf = (char *) gras_ddt_parse_alloc(b->yy_buf_size + 2);
+  if (!b->yy_ch_buf)
+    YY_FATAL_ERROR
+      ("out of dynamic memory in gras_ddt_parse__create_buffer()");
 
-       b->yy_is_our_buffer = 1;
+  b->yy_is_our_buffer = 1;
 
-       gras_ddt_parse__init_buffer(b,file );
+  gras_ddt_parse__init_buffer(b, file);
 
-       return b;
+  return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with gras_ddt_parse__create_buffer()
  * 
  */
-    void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE  b )
+void gras_ddt_parse__delete_buffer(YY_BUFFER_STATE b)
 {
-    
-       if ( ! b )
-               return;
 
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+  if (!b)
+    return;
+
+  if (b == YY_CURRENT_BUFFER)   /* Not sure if we should pop here. */
+    YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
-       if ( b->yy_is_our_buffer )
-               gras_ddt_parse_free((void *) b->yy_ch_buf  );
+  if (b->yy_is_our_buffer)
+    gras_ddt_parse_free((void *) b->yy_ch_buf);
 
-       gras_ddt_parse_free((void *) b  );
+  gras_ddt_parse_free((void *) b);
 }
 
-#if !defined(__cplusplus) && !defined(WIN32) 
-extern int isatty (int );
+#if !defined(__cplusplus) && !defined(WIN32)
+extern int isatty(int);
 #endif /* __cplusplus */
-    
+
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a gras_ddt_parse_restart() or at EOF.
  */
-    static void gras_ddt_parse__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
-
+static void gras_ddt_parse__init_buffer(YY_BUFFER_STATE b, FILE * file)
 {
-       int oerrno = errno;
-    
-       gras_ddt_parse__flush_buffer(b );
+  int oerrno = errno;
 
-       b->yy_input_file = file;
-       b->yy_fill_buffer = 1;
+  gras_ddt_parse__flush_buffer(b);
 
-    /* If b is the current buffer, then gras_ddt_parse__init_buffer was _probably_
-     * called from gras_ddt_parse_restart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
+  b->yy_input_file = file;
+  b->yy_fill_buffer = 1;
+
+  /* If b is the current buffer, then gras_ddt_parse__init_buffer was _probably_
+   * called from gras_ddt_parse_restart() or through yy_get_next_buffer.
+   * In that case, we don't want to reset the lineno or column.
+   */
+  if (b != YY_CURRENT_BUFFER) {
+    b->yy_bs_lineno = 1;
+    b->yy_bs_column = 0;
+  }
+
+  b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-    
-       errno = oerrno;
+  errno = oerrno;
 }
 
 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  * 
  */
-    void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE  b )
+void gras_ddt_parse__flush_buffer(YY_BUFFER_STATE b)
 {
-       if ( ! b )
-               return;
+  if (!b)
+    return;
 
-       b->yy_n_chars = 0;
+  b->yy_n_chars = 0;
 
-       /* We always need two end-of-buffer characters.  The first causes
-        * a transition to the end-of-buffer state.  The second causes
-        * a jam in that state.
-        */
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+  /* We always need two end-of-buffer characters.  The first causes
+   * a transition to the end-of-buffer state.  The second causes
+   * a jam in that state.
+   */
+  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
-       b->yy_buf_pos = &b->yy_ch_buf[0];
+  b->yy_buf_pos = &b->yy_ch_buf[0];
 
-       b->yy_at_bol = 1;
-       b->yy_buffer_status = YY_BUFFER_NEW;
+  b->yy_at_bol = 1;
+  b->yy_buffer_status = YY_BUFFER_NEW;
 
-       if ( b == YY_CURRENT_BUFFER )
-               gras_ddt_parse__load_buffer_state( );
+  if (b == YY_CURRENT_BUFFER)
+    gras_ddt_parse__load_buffer_state();
 }
 
 /** Pushes the new state onto the stack. The new state becomes
@@ -1620,96 +1479,98 @@ extern int isatty (int );
  *  @param new_buffer The new state.
  *  
  */
-void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
+void gras_ddt_parse_push_buffer_state(YY_BUFFER_STATE new_buffer)
 {
-       if (new_buffer == NULL)
-               return;
-
-       gras_ddt_parse_ensure_buffer_stack();
-
-       /* This block is copied from gras_ddt_parse__switch_to_buffer. */
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       /* Only push if top exists. Otherwise, replace top. */
-       if (YY_CURRENT_BUFFER)
-               (yy_buffer_stack_top)++;
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-       /* copied from gras_ddt_parse__switch_to_buffer. */
-       gras_ddt_parse__load_buffer_state( );
-       (yy_did_buffer_switch_on_eof) = 1;
+  if (new_buffer == NULL)
+    return;
+
+  gras_ddt_parse_ensure_buffer_stack();
+
+  /* This block is copied from gras_ddt_parse__switch_to_buffer. */
+  if (YY_CURRENT_BUFFER) {
+    /* Flush out information for old buffer. */
+    *(yy_c_buf_p) = (yy_hold_char);
+    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  /* Only push if top exists. Otherwise, replace top. */
+  if (YY_CURRENT_BUFFER)
+    (yy_buffer_stack_top)++;
+  YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+  /* copied from gras_ddt_parse__switch_to_buffer. */
+  gras_ddt_parse__load_buffer_state();
+  (yy_did_buffer_switch_on_eof) = 1;
 }
 
 /** Removes and deletes the top of the stack, if present.
  *  The next element becomes the new top.
  *  
  */
-void gras_ddt_parse_pop_buffer_state (void)
+void gras_ddt_parse_pop_buffer_state(void)
 {
-       if (!YY_CURRENT_BUFFER)
-               return;
+  if (!YY_CURRENT_BUFFER)
+    return;
 
-       gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
-       YY_CURRENT_BUFFER_LVALUE = NULL;
-       if ((yy_buffer_stack_top) > 0)
-               --(yy_buffer_stack_top);
+  gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER);
+  YY_CURRENT_BUFFER_LVALUE = NULL;
+  if ((yy_buffer_stack_top) > 0)
+    --(yy_buffer_stack_top);
 
-       if (YY_CURRENT_BUFFER) {
-               gras_ddt_parse__load_buffer_state( );
-               (yy_did_buffer_switch_on_eof) = 1;
-       }
+  if (YY_CURRENT_BUFFER) {
+    gras_ddt_parse__load_buffer_state();
+    (yy_did_buffer_switch_on_eof) = 1;
+  }
 }
 
 /* Allocates the stack if it does not exist.
  *  Guarantees space for at least one push.
  */
-static void gras_ddt_parse_ensure_buffer_stack (void)
+static void gras_ddt_parse_ensure_buffer_stack(void)
 {
-       int num_to_alloc;
-    
-       if (!(yy_buffer_stack)) {
+  int num_to_alloc;
 
-               /* First allocation is just for 2 elements, since we don't know if this
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an
-                * immediate realloc on the next call.
-         */
-               num_to_alloc = 1;
-               (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_alloc
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse_ensure_buffer_stack()" );
-                                                                 
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-                               
-               (yy_buffer_stack_max) = num_to_alloc;
-               (yy_buffer_stack_top) = 0;
-               return;
-       }
+  if (!(yy_buffer_stack)) {
+
+    /* First allocation is just for 2 elements, since we don't know if this
+     * scanner will even need a stack. We use 2 instead of 1 to avoid an
+     * immediate realloc on the next call.
+     */
+    num_to_alloc = 1;
+    (yy_buffer_stack) = (struct yy_buffer_state **) gras_ddt_parse_alloc
+      (num_to_alloc * sizeof(struct yy_buffer_state *)
+      );
+    if (!(yy_buffer_stack))
+      YY_FATAL_ERROR
+        ("out of dynamic memory in gras_ddt_parse_ensure_buffer_stack()");
+
+    memset((yy_buffer_stack), 0,
+           num_to_alloc * sizeof(struct yy_buffer_state *));
+
+    (yy_buffer_stack_max) = num_to_alloc;
+    (yy_buffer_stack_top) = 0;
+    return;
+  }
 
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
 
-               /* Increase the buffer to prepare for a possible push. */
-               int grow_size = 8 /* arbitrary grow size */;
+    /* Increase the buffer to prepare for a possible push. */
+    int grow_size = 8 /* arbitrary grow size */ ;
 
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;
-               (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_realloc
-                                                               ((yy_buffer_stack),
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse_ensure_buffer_stack()" );
+    num_to_alloc = (yy_buffer_stack_max) + grow_size;
+    (yy_buffer_stack) = (struct yy_buffer_state **) gras_ddt_parse_realloc
+      ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)
+      );
+    if (!(yy_buffer_stack))
+      YY_FATAL_ERROR
+        ("out of dynamic memory in gras_ddt_parse_ensure_buffer_stack()");
 
-               /* zero only the new slots.*/
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-               (yy_buffer_stack_max) = num_to_alloc;
-       }
+    /* zero only the new slots. */
+    memset((yy_buffer_stack) + (yy_buffer_stack_max), 0,
+           grow_size * sizeof(struct yy_buffer_state *));
+    (yy_buffer_stack_max) = num_to_alloc;
+  }
 }
 
 /** Setup the input buffer state to scan directly from a user-specified character buffer.
@@ -1718,33 +1579,33 @@ static void gras_ddt_parse_ensure_buffer_stack (void)
  * 
  * @return the newly allocated buffer state object. 
  */
-YY_BUFFER_STATE gras_ddt_parse__scan_buffer  (char * base, yy_size_t  size )
+YY_BUFFER_STATE gras_ddt_parse__scan_buffer(char *base, yy_size_t size)
 {
-       YY_BUFFER_STATE b;
-    
-       if ( size < 2 ||
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||
-            base[size-1] != YY_END_OF_BUFFER_CHAR )
-               /* They forgot to leave room for the EOB's. */
-               return 0;
-
-       b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_buffer()" );
-
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
-       b->yy_buf_pos = b->yy_ch_buf = base;
-       b->yy_is_our_buffer = 0;
-       b->yy_input_file = 0;
-       b->yy_n_chars = b->yy_buf_size;
-       b->yy_is_interactive = 0;
-       b->yy_at_bol = 1;
-       b->yy_fill_buffer = 0;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       gras_ddt_parse__switch_to_buffer(b  );
-
-       return b;
+  YY_BUFFER_STATE b;
+
+  if (size < 2 ||
+      base[size - 2] != YY_END_OF_BUFFER_CHAR ||
+      base[size - 1] != YY_END_OF_BUFFER_CHAR)
+    /* They forgot to leave room for the EOB's. */
+    return 0;
+
+  b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof(struct yy_buffer_state));
+  if (!b)
+    YY_FATAL_ERROR("out of dynamic memory in gras_ddt_parse__scan_buffer()");
+
+  b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
+  b->yy_buf_pos = b->yy_ch_buf = base;
+  b->yy_is_our_buffer = 0;
+  b->yy_input_file = 0;
+  b->yy_n_chars = b->yy_buf_size;
+  b->yy_is_interactive = 0;
+  b->yy_at_bol = 1;
+  b->yy_fill_buffer = 0;
+  b->yy_buffer_status = YY_BUFFER_NEW;
+
+  gras_ddt_parse__switch_to_buffer(b);
+
+  return b;
 }
 
 /** Setup the input buffer state to scan a string. The next call to gras_ddt_parse_lex() will
@@ -1755,10 +1616,10 @@ YY_BUFFER_STATE gras_ddt_parse__scan_buffer  (char * base, yy_size_t  size )
  * @note If you want to scan bytes that may contain NUL values, then use
  *       gras_ddt_parse__scan_bytes() instead.
  */
-YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yystr )
+YY_BUFFER_STATE gras_ddt_parse__scan_string(yyconst char *yystr)
 {
-    
-       return gras_ddt_parse__scan_bytes(yystr,strlen(yystr) );
+
+  return gras_ddt_parse__scan_bytes(yystr, strlen(yystr));
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to gras_ddt_parse_lex() will
@@ -1768,44 +1629,45 @@ YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yystr )
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE gras_ddt_parse__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE gras_ddt_parse__scan_bytes(yyconst char *yybytes,
+                                           int _yybytes_len)
 {
-       YY_BUFFER_STATE b;
-       char *buf;
-       yy_size_t n;
-       int i;
-    
-       /* Get memory for full buffer, including space for trailing EOB's. */
-       n = _yybytes_len + 2;
-       buf = (char *) gras_ddt_parse_alloc(n  );
-       if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_bytes()" );
-
-       for ( i = 0; i < _yybytes_len; ++i )
-               buf[i] = yybytes[i];
-
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-       b = gras_ddt_parse__scan_buffer(buf,n );
-       if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in gras_ddt_parse__scan_bytes()" );
-
-       /* It's okay to grow etc. this buffer, and we should throw it
-        * away when we're done.
-        */
-       b->yy_is_our_buffer = 1;
-
-       return b;
+  YY_BUFFER_STATE b;
+  char *buf;
+  yy_size_t n;
+  int i;
+
+  /* Get memory for full buffer, including space for trailing EOB's. */
+  n = _yybytes_len + 2;
+  buf = (char *) gras_ddt_parse_alloc(n);
+  if (!buf)
+    YY_FATAL_ERROR("out of dynamic memory in gras_ddt_parse__scan_bytes()");
+
+  for (i = 0; i < _yybytes_len; ++i)
+    buf[i] = yybytes[i];
+
+  buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
+
+  b = gras_ddt_parse__scan_buffer(buf, n);
+  if (!b)
+    YY_FATAL_ERROR("bad buffer in gras_ddt_parse__scan_bytes()");
+
+  /* It's okay to grow etc. this buffer, and we should throw it
+   * away when we're done.
+   */
+  b->yy_is_our_buffer = 1;
+
+  return b;
 }
 
 #ifndef YY_EXIT_FAILURE
 #define YY_EXIT_FAILURE 2
 #endif
 
-static void yy_fatal_error (yyconst char* msg )
+static void yy_fatal_error(yyconst char *msg)
 {
-       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
+  (void) fprintf(stderr, "%s\n", msg);
+  exit(YY_EXIT_FAILURE);
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -1830,53 +1692,53 @@ static void yy_fatal_error (yyconst char* msg )
 /** Get the current line number.
  * 
  */
-int gras_ddt_parse_get_lineno  (void)
+int gras_ddt_parse_get_lineno(void)
 {
-        
-    return gras_ddt_parse_lineno;
+
+  return gras_ddt_parse_lineno;
 }
 
 /** Get the input stream.
  * 
  */
-FILE *gras_ddt_parse_get_in  (void)
+FILE *gras_ddt_parse_get_in(void)
 {
-        return gras_ddt_parse_in;
+  return gras_ddt_parse_in;
 }
 
 /** Get the output stream.
  * 
  */
-FILE *gras_ddt_parse_get_out  (void)
+FILE *gras_ddt_parse_get_out(void)
 {
-        return gras_ddt_parse_out;
+  return gras_ddt_parse_out;
 }
 
 /** Get the length of the current token.
  * 
  */
-int gras_ddt_parse_get_leng  (void)
+int gras_ddt_parse_get_leng(void)
 {
-        return gras_ddt_parse_leng;
+  return gras_ddt_parse_leng;
 }
 
 /** Get the current token.
  * 
  */
 
-char *gras_ddt_parse_get_text  (void)
+char *gras_ddt_parse_get_text(void)
 {
-        return gras_ddt_parse_text;
+  return gras_ddt_parse_text;
 }
 
 /** Set the current line number.
  * @param line_number
  * 
  */
-void gras_ddt_parse_set_lineno (int  line_number )
+void gras_ddt_parse_set_lineno(int line_number)
 {
-    
-    gras_ddt_parse_lineno = line_number;
+
+  gras_ddt_parse_lineno = line_number;
 }
 
 /** Set the input stream. This does not discard the current
@@ -1885,74 +1747,74 @@ void gras_ddt_parse_set_lineno (int  line_number )
  * 
  * @see gras_ddt_parse__switch_to_buffer
  */
-void gras_ddt_parse_set_in (FILE *  in_str )
+void gras_ddt_parse_set_in(FILE * in_str)
 {
-        gras_ddt_parse_in = in_str ;
+  gras_ddt_parse_in = in_str;
 }
 
-void gras_ddt_parse_set_out (FILE *  out_str )
+void gras_ddt_parse_set_out(FILE * out_str)
 {
-        gras_ddt_parse_out = out_str ;
+  gras_ddt_parse_out = out_str;
 }
 
-int gras_ddt_parse_get_debug  (void)
+int gras_ddt_parse_get_debug(void)
 {
-        return gras_ddt_parse__flex_debug;
+  return gras_ddt_parse__flex_debug;
 }
 
-void gras_ddt_parse_set_debug (int  bdebug )
+void gras_ddt_parse_set_debug(int bdebug)
 {
-        gras_ddt_parse__flex_debug = bdebug ;
+  gras_ddt_parse__flex_debug = bdebug;
 }
 
-static int yy_init_globals (void)
+static int yy_init_globals(void)
 {
-        /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from gras_ddt_parse_lex_destroy(), so don't allocate here.
-     */
+  /* Initialization is the same as for the non-reentrant scanner.
+   * This function is called from gras_ddt_parse_lex_destroy(), so don't allocate here.
+   */
 
-    (yy_buffer_stack) = 0;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char *) 0;
-    (yy_init) = 0;
-    (yy_start) = 0;
+  (yy_buffer_stack) = 0;
+  (yy_buffer_stack_top) = 0;
+  (yy_buffer_stack_max) = 0;
+  (yy_c_buf_p) = (char *) 0;
+  (yy_init) = 0;
+  (yy_start) = 0;
 
 /* Defined in main.c */
 #ifdef YY_STDINIT
-    gras_ddt_parse_in = stdin;
-    gras_ddt_parse_out = stdout;
+  gras_ddt_parse_in = stdin;
+  gras_ddt_parse_out = stdout;
 #else
-    gras_ddt_parse_in = (FILE *) 0;
-    gras_ddt_parse_out = (FILE *) 0;
+  gras_ddt_parse_in = (FILE *) 0;
+  gras_ddt_parse_out = (FILE *) 0;
 #endif
 
-    /* For future reference: Set errno on error, since we are called by
-     * gras_ddt_parse_lex_init()
-     */
-    return 0;
+  /* For future reference: Set errno on error, since we are called by
+   * gras_ddt_parse_lex_init()
+   */
+  return 0;
 }
 
 /* gras_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
-int gras_ddt_parse_lex_destroy  (void)
+int gras_ddt_parse_lex_destroy(void)
 {
-    
-    /* Pop the buffer stack, destroying each element. */
-       while(YY_CURRENT_BUFFER){
-               gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER  );
-               YY_CURRENT_BUFFER_LVALUE = NULL;
-               gras_ddt_parse_pop_buffer_state();
-       }
 
-       /* Destroy the stack itself. */
-       gras_ddt_parse_free((yy_buffer_stack) );
-       (yy_buffer_stack) = NULL;
+  /* Pop the buffer stack, destroying each element. */
+  while (YY_CURRENT_BUFFER) {
+    gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER);
+    YY_CURRENT_BUFFER_LVALUE = NULL;
+    gras_ddt_parse_pop_buffer_state();
+  }
 
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * gras_ddt_parse_lex() is called, initialization will occur. */
-    yy_init_globals( );
+  /* Destroy the stack itself. */
+  gras_ddt_parse_free((yy_buffer_stack));
+  (yy_buffer_stack) = NULL;
 
-    return 0;
+  /* Reset the globals. This is important in a non-reentrant scanner so the next time
+   * gras_ddt_parse_lex() is called, initialization will occur. */
+  yy_init_globals();
+
+  return 0;
 }
 
 /*
@@ -1960,75 +1822,97 @@ int gras_ddt_parse_lex_destroy  (void)
  */
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+static void yy_flex_strncpy(char *s1, yyconst char *s2, int n)
 {
-       register int i;
-       for ( i = 0; i < n; ++i )
-               s1[i] = s2[i];
+  register int i;
+  for (i = 0; i < n; ++i)
+    s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
+static int yy_flex_strlen(yyconst char *s)
 {
-       register int n;
-       for ( n = 0; s[n]; ++n )
-               ;
+  register int n;
+  for (n = 0; s[n]; ++n);
 
-       return n;
+  return n;
 }
 #endif
 
-void *gras_ddt_parse_alloc (yy_size_t  size )
+void *gras_ddt_parse_alloc(yy_size_t size)
 {
-       return (void *) malloc( size );
+  return (void *) malloc(size);
 }
 
-void *gras_ddt_parse_realloc  (void * ptr, yy_size_t  size )
+void *gras_ddt_parse_realloc(void *ptr, yy_size_t size)
 {
-       /* The cast to (char *) in the following accommodates both
-        * implementations that use char* generic pointers, and those
-        * that use void* generic pointers.  It works with the latter
-        * because both ANSI C and C++ allow castless assignment from
-        * any pointer type to void*, and deal with argument conversions
-        * as though doing an assignment.
-        */
-       return (void *) realloc( (char *) ptr, size );
+  /* The cast to (char *) in the following accommodates both
+   * implementations that use char* generic pointers, and those
+   * that use void* generic pointers.  It works with the latter
+   * because both ANSI C and C++ allow castless assignment from
+   * any pointer type to void*, and deal with argument conversions
+   * as though doing an assignment.
+   */
+  return (void *) realloc((char *) ptr, size);
 }
 
-void gras_ddt_parse_free (void * ptr )
+void gras_ddt_parse_free(void *ptr)
 {
-       free( (char *) ptr );   /* see gras_ddt_parse_realloc() for (char *) cast */
+  free((char *) ptr);           /* see gras_ddt_parse_realloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
 
 /* {space}+                { return(TOKEN_SPACE);} */
 
-void gras_ddt_parse_dump(void) {
-  switch(gras_ddt_parse_tok_num) {
-  case GRAS_DDT_PARSE_TOKEN_LA      : {printf("TOKEN_LA ");break;}
-  case GRAS_DDT_PARSE_TOKEN_RA      : {printf("TOKEN_RA ");break;}
-  case GRAS_DDT_PARSE_TOKEN_WORD    : {printf("TOKEN_WORD ");break;}
-    /*  case GRAS_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}*/
-    /*  case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
-  case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
-  case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
-  default             : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
+void gras_ddt_parse_dump(void)
+{
+  switch (gras_ddt_parse_tok_num) {
+  case GRAS_DDT_PARSE_TOKEN_LA:{
+      printf("TOKEN_LA ");
+      break;
+    }
+  case GRAS_DDT_PARSE_TOKEN_RA:{
+      printf("TOKEN_RA ");
+      break;
+    }
+  case GRAS_DDT_PARSE_TOKEN_WORD:{
+      printf("TOKEN_WORD ");
+      break;
+    }
+    /*  case GRAS_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;} */
+    /*  case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;} */
+  case GRAS_DDT_PARSE_TOKEN_NEWLINE:{
+      printf("TOKEN_NEWLINE\n");
+      return;
+    }
+  case GRAS_DDT_PARSE_TOKEN_EMPTY:{
+      printf("TOKEN_EMPTY\n");
+      return;
+    }
+  default:{
+      printf("Unknown token %d\n", gras_ddt_parse_tok_num);
+      return;
+    }
   }
-  printf("-->%s<-- [line %d, pos %d]\n",gras_ddt_parse_text,gras_ddt_parse_line_pos,gras_ddt_parse_char_pos);
+  printf("-->%s<-- [line %d, pos %d]\n", gras_ddt_parse_text,
+         gras_ddt_parse_line_pos, gras_ddt_parse_char_pos);
   return;
 }
 
-int gras_ddt_parse_lex_n_dump(void) {
+int gras_ddt_parse_lex_n_dump(void)
+{
   gras_ddt_parse_tok_num = gras_ddt_parse_lex();
-  /*  gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);*/
-  return(gras_ddt_parse_tok_num);
+  /*  gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text); */
+  return (gras_ddt_parse_tok_num);
 }
 
-void  gras_ddt_parse_pointer_init(const char *file) {
-  gras_ddt_file_to_parse = fopen(file,"r");
-  gras_ddt_input_buffer = gras_ddt_parse__create_buffer(gras_ddt_file_to_parse,10 );
+void gras_ddt_parse_pointer_init(const char *file)
+{
+  gras_ddt_file_to_parse = fopen(file, "r");
+  gras_ddt_input_buffer =
+    gras_ddt_parse__create_buffer(gras_ddt_file_to_parse, 10);
   gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer);
 
   gras_ddt_parse_line_pos = 1;
@@ -2037,7 +1921,8 @@ void  gras_ddt_parse_pointer_init(const char *file) {
   gras_ddt_parse_tok_num = 0;
 }
 
-void  gras_ddt_parse_pointer_close(void) {
+void gras_ddt_parse_pointer_close(void)
+{
   gras_ddt_parse__delete_buffer(gras_ddt_input_buffer);
   fclose(gras_ddt_file_to_parse);
 
@@ -2046,8 +1931,9 @@ void  gras_ddt_parse_pointer_close(void) {
   gras_ddt_parse_tok_num = 0;
 }
 
-void  gras_ddt_parse_pointer_string_init(const char *string_to_parse) {
-  gras_ddt_input_buffer = gras_ddt_parse__scan_string (string_to_parse);
+void gras_ddt_parse_pointer_string_init(const char *string_to_parse)
+{
+  gras_ddt_input_buffer = gras_ddt_parse__scan_string(string_to_parse);
   definition = string_to_parse;
   gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer);
 
@@ -2056,7 +1942,8 @@ void  gras_ddt_parse_pointer_string_init(const char *string_to_parse) {
   gras_ddt_parse_tok_num = 0;
 }
 
-void  gras_ddt_parse_pointer_string_close(void) {
+void gras_ddt_parse_pointer_string_close(void)
+{
   gras_ddt_parse__delete_buffer(gras_ddt_input_buffer);
 
   gras_ddt_parse_line_pos = 1;
@@ -2064,10 +1951,9 @@ void  gras_ddt_parse_pointer_string_close(void) {
   gras_ddt_parse_tok_num = 0;
 
   if (0)
-    yyunput('\0',NULL); /* fake a use of this function to calm gcc down */
+    yyunput('\0', NULL);        /* fake a use of this function to calm gcc down */
 }
 
 /* Local variables:*/
 /* mode: c */
 /* End: */
-
index cfedb4f..4dd72ef 100644 (file)
 
 typedef enum {
   GRAS_DDT_PARSE_TOKEN_EMPTY = 0,
-  GRAS_DDT_PARSE_TOKEN_LA = 512, /* { 'A' for the french "accolade" since there is a name conflict in english (braket/brace) */
-  GRAS_DDT_PARSE_TOKEN_RA,       /* } */
-  GRAS_DDT_PARSE_TOKEN_LB,       /* [ */
-  GRAS_DDT_PARSE_TOKEN_RB,       /* ] */
-  GRAS_DDT_PARSE_TOKEN_LP,       /* ( */
-  GRAS_DDT_PARSE_TOKEN_RP,       /* ) */
+  GRAS_DDT_PARSE_TOKEN_LA = 512,        /* { 'A' for the french "accolade" since there is a name conflict in english (braket/brace) */
+  GRAS_DDT_PARSE_TOKEN_RA,      /* } */
+  GRAS_DDT_PARSE_TOKEN_LB,      /* [ */
+  GRAS_DDT_PARSE_TOKEN_RB,      /* ] */
+  GRAS_DDT_PARSE_TOKEN_LP,      /* ( */
+  GRAS_DDT_PARSE_TOKEN_RP,      /* ) */
   GRAS_DDT_PARSE_TOKEN_WORD,
   GRAS_DDT_PARSE_TOKEN_SPACE,
   GRAS_DDT_PARSE_TOKEN_COMMENT,
@@ -24,8 +24,8 @@ typedef enum {
   GRAS_DDT_PARSE_TOKEN_NEWLINE,
   GRAS_DDT_PARSE_TOKEN_STAR,
   GRAS_DDT_PARSE_TOKEN_SEMI_COLON,
-  GRAS_DDT_PARSE_TOKEN_COLON, /* impossible since the macro think that it's a arg separator. 
-                                But handle anyway for the *vicious* calling gras_ddt_parse manually */
+  GRAS_DDT_PARSE_TOKEN_COLON,   /* impossible since the macro think that it's a arg separator. 
+                                   But handle anyway for the *vicious* calling gras_ddt_parse manually */
   GRAS_DDT_PARSE_TOKEN_ERROR
 } gras_ddt_parse_token_t;
 
@@ -38,24 +38,24 @@ extern int gras_ddt_parse_tok_num;
 
 void gras_ddt_parse_dump(void);
 int gras_ddt_parse_lex_n_dump(void);
-void  gras_ddt_parse_pointer_init(const char *file);
-void  gras_ddt_parse_pointer_close(void);
-void  gras_ddt_parse_pointer_string_init(const char *string_to_parse);
-void  gras_ddt_parse_pointer_string_close(void);
+void gras_ddt_parse_pointer_init(const char *file);
+void gras_ddt_parse_pointer_close(void);
+void gras_ddt_parse_pointer_string_init(const char *string_to_parse);
+void gras_ddt_parse_pointer_string_close(void);
 
 /* prototypes of the functions offered by flex */
 int gras_ddt_parse_lex(void);
-int gras_ddt_parse_get_lineno  (void);
-FILE *gras_ddt_parse_get_in  (void);
-FILE *gras_ddt_parse_get_out  (void);
-int gras_ddt_parse_get_leng  (void);
-char *gras_ddt_parse_get_text  (void);
-void gras_ddt_parse_set_lineno (int  line_number );
-void gras_ddt_parse_set_in (FILE *  in_str );
-void gras_ddt_parse_set_out (FILE *  out_str );
-int gras_ddt_parse_get_debug  (void);
-void gras_ddt_parse_set_debug (int  bdebug );
-int gras_ddt_parse_lex_destroy  (void);
+int gras_ddt_parse_get_lineno(void);
+FILE *gras_ddt_parse_get_in(void);
+FILE *gras_ddt_parse_get_out(void);
+int gras_ddt_parse_get_leng(void);
+char *gras_ddt_parse_get_text(void);
+void gras_ddt_parse_set_lineno(int line_number);
+void gras_ddt_parse_set_in(FILE * in_str);
+void gras_ddt_parse_set_out(FILE * out_str);
+int gras_ddt_parse_get_debug(void);
+void gras_ddt_parse_set_debug(int bdebug);
+int gras_ddt_parse_lex_destroy(void);
 
 #define PARSE_ERROR_PRE do {
 #define PARSE_ERROR_POST xbt_abort();} while (0)
index 0c0c5ac..79bd73c 100644 (file)
@@ -16,8 +16,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_msg);
 
 
 char _GRAS_header[6];
-const char *e_gras_msg_kind_names[e_gras_msg_kind_count]=
-{"UNKNOWN","ONEWAY","RPC call","RPC answer","RPC error"};
+const char *e_gras_msg_kind_names[e_gras_msg_kind_count] =
+  { "UNKNOWN", "ONEWAY", "RPC call", "RPC answer", "RPC error" };
 
 
 /** \brief Waits for a message to come in over a given socket.
@@ -34,101 +34,104 @@ const char *e_gras_msg_kind_names[e_gras_msg_kind_count]=
  */
 
 void
-gras_msg_wait_ext_(double           timeout,
-               gras_msgtype_t   msgt_want,
-               gras_socket_t    expe_want,
-               gras_msg_filter_t filter,
-               void             *filter_ctx,
-
-               gras_msg_t       msg_got) {
-
-       s_gras_msg_t msg;
-       double start, now;
-       gras_msg_procdata_t pd=
-               (gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       unsigned int cpt;
-
-       xbt_assert0(msg_got,"msg_got is an output parameter");
-
-       start = gras_os_time();
-       VERB2("Waiting for message '%s' for %fs",msgt_want?msgt_want->name:"(any)", timeout);
-
-       xbt_dynar_foreach(pd->msg_waitqueue,cpt,msg){
-               if ( (   !msgt_want || (msg.type->code == msgt_want->code))
-                               && (!expe_want || (!strcmp( gras_socket_peer_name(msg.expe),
-                                               gras_socket_peer_name(expe_want))))
-                                               && (!filter || filter(&msg,filter_ctx))) {
-
-                       memcpy(msg_got,&msg,sizeof(s_gras_msg_t));
-                       xbt_dynar_cursor_rm(pd->msg_waitqueue, &cpt);
-                       VERB0("The waited message was queued");
-                       return;
-               }
-       }
-
-       xbt_dynar_foreach(pd->msg_queue,cpt,msg){
-               if ( (   !msgt_want || (msg.type->code == msgt_want->code))
-                               && (!expe_want || (!strcmp( gras_socket_peer_name(msg.expe),
-                                               gras_socket_peer_name(expe_want))))
-                                               && (!filter || filter(&msg,filter_ctx))) {
-
-                       memcpy(msg_got,&msg,sizeof(s_gras_msg_t));
-                       xbt_dynar_cursor_rm(pd->msg_queue, &cpt);
-                       VERB0("The waited message was queued");
-                       return;
-               }
-       }
-
-       while (1) {
-               int need_restart;
-               xbt_ex_t e;
-
-               restart_receive: /* Goto here when the receive of a message failed */
-               need_restart=0;
-               now=gras_os_time();
-               memset(&msg,sizeof(msg),0);
-
-               TRY {
-                       xbt_queue_shift_timed(pd->msg_received,&msg,timeout ? timeout - now + start : 0);
-               } CATCH(e) {
-                       if (e.category == system_error &&
-                                       !strncmp("Socket closed by remote side",e.msg,
-                                                       strlen("Socket closed by remote side"))) {
-                               xbt_ex_free(e);
-                               need_restart=1;
-                       }       else {
-                               RETHROW;
-                       }
-               }
-               if (need_restart)
-                       goto restart_receive;
-
-               DEBUG0("Got a message from the socket");
-
-               if ( (   !msgt_want || (msg.type->code == msgt_want->code))
-                               && (!expe_want || (!strcmp( gras_socket_peer_name(msg.expe),
-                                               gras_socket_peer_name(expe_want))))
-                                               && (!filter || filter(&msg,filter_ctx))) {
-
-                       memcpy(msg_got,&msg,sizeof(s_gras_msg_t));
-                       DEBUG0("Message matches expectations. Use it.");
-                       return;
-               }
-               DEBUG0("Message does not match expectations. Queue it.");
-
-               /* not expected msg type. Queue it for later */
-               xbt_dynar_push(pd->msg_queue,&msg);
-
-               now=gras_os_time();
-               if (now - start + 0.001 > timeout) {
-                       THROW1(timeout_error,  now-start+0.001-timeout,
-                                       "Timeout while waiting for msg '%s'",
-                                       msgt_want?msgt_want->name:"(any)");
-               }
-       }
-
-       THROW_IMPOSSIBLE;
+gras_msg_wait_ext_(double timeout,
+                   gras_msgtype_t msgt_want,
+                   gras_socket_t expe_want,
+                   gras_msg_filter_t filter,
+                   void *filter_ctx, gras_msg_t msg_got)
+{
+
+  s_gras_msg_t msg;
+  double start, now;
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  unsigned int cpt;
+
+  xbt_assert0(msg_got, "msg_got is an output parameter");
+
+  start = gras_os_time();
+  VERB2("Waiting for message '%s' for %fs",
+        msgt_want ? msgt_want->name : "(any)", timeout);
+
+  xbt_dynar_foreach(pd->msg_waitqueue, cpt, msg) {
+    if ((!msgt_want || (msg.type->code == msgt_want->code))
+        && (!expe_want || (!strcmp(gras_socket_peer_name(msg.expe),
+                                   gras_socket_peer_name(expe_want))))
+        && (!filter || filter(&msg, filter_ctx))) {
+
+      memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
+      xbt_dynar_cursor_rm(pd->msg_waitqueue, &cpt);
+      VERB0("The waited message was queued");
+      return;
+    }
+  }
+
+  xbt_dynar_foreach(pd->msg_queue, cpt, msg) {
+    if ((!msgt_want || (msg.type->code == msgt_want->code))
+        && (!expe_want || (!strcmp(gras_socket_peer_name(msg.expe),
+                                   gras_socket_peer_name(expe_want))))
+        && (!filter || filter(&msg, filter_ctx))) {
+
+      memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
+      xbt_dynar_cursor_rm(pd->msg_queue, &cpt);
+      VERB0("The waited message was queued");
+      return;
+    }
+  }
+
+  while (1) {
+    int need_restart;
+    xbt_ex_t e;
+
+  restart_receive:             /* Goto here when the receive of a message failed */
+    need_restart = 0;
+    now = gras_os_time();
+    memset(&msg, sizeof(msg), 0);
+
+    TRY {
+      xbt_queue_shift_timed(pd->msg_received, &msg,
+                            timeout ? timeout - now + start : 0);
+    }
+    CATCH(e) {
+      if (e.category == system_error &&
+          !strncmp("Socket closed by remote side", e.msg,
+                   strlen("Socket closed by remote side"))) {
+        xbt_ex_free(e);
+        need_restart = 1;
+      } else {
+        RETHROW;
+      }
+    }
+    if (need_restart)
+      goto restart_receive;
+
+    DEBUG0("Got a message from the socket");
+
+    if ((!msgt_want || (msg.type->code == msgt_want->code))
+        && (!expe_want || (!strcmp(gras_socket_peer_name(msg.expe),
+                                   gras_socket_peer_name(expe_want))))
+        && (!filter || filter(&msg, filter_ctx))) {
+
+      memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
+      DEBUG0("Message matches expectations. Use it.");
+      return;
+    }
+    DEBUG0("Message does not match expectations. Queue it.");
+
+    /* not expected msg type. Queue it for later */
+    xbt_dynar_push(pd->msg_queue, &msg);
+
+    now = gras_os_time();
+    if (now - start + 0.001 > timeout) {
+      THROW1(timeout_error, now - start + 0.001 - timeout,
+             "Timeout while waiting for msg '%s'",
+             msgt_want ? msgt_want->name : "(any)");
+    }
+  }
+
+  THROW_IMPOSSIBLE;
 }
+
 /** \brief Waits for a message to come in over a given socket.
  *
  * @param timeout: How long should we wait for this message.
@@ -141,44 +144,44 @@ gras_msg_wait_ext_(double           timeout,
  * and used by subsequent call to this function or gras_msg_handle().
  */
 void
-gras_msg_wait_(double           timeout,
-               gras_msgtype_t   msgt_want,
-               gras_socket_t   *expeditor,
-               void            *payload) {
-       s_gras_msg_t msg;
-
-       gras_msg_wait_ext_(timeout,
-                       msgt_want, NULL,      NULL, NULL,
-                       &msg);
-
-       if (msgt_want->ctn_type) {
-               xbt_assert1(payload,
-                               "Message type '%s' convey a payload you must accept",
-                               msgt_want->name);
-       } else {
-               xbt_assert1(!payload,
-                               "No payload was declared for message type '%s'",
-                               msgt_want->name);
-       }
-
-       if (payload) {
-               memcpy(payload,msg.payl,msg.payl_size);
-               free(msg.payl);
-       }
-
-       if (expeditor)
-               *expeditor = msg.expe;
+gras_msg_wait_(double timeout,
+               gras_msgtype_t msgt_want,
+               gras_socket_t * expeditor, void *payload)
+{
+  s_gras_msg_t msg;
+
+  gras_msg_wait_ext_(timeout, msgt_want, NULL, NULL, NULL, &msg);
+
+  if (msgt_want->ctn_type) {
+    xbt_assert1(payload,
+                "Message type '%s' convey a payload you must accept",
+                msgt_want->name);
+  } else {
+    xbt_assert1(!payload,
+                "No payload was declared for message type '%s'",
+                msgt_want->name);
+  }
+
+  if (payload) {
+    memcpy(payload, msg.payl, msg.payl_size);
+    free(msg.payl);
+  }
+
+  if (expeditor)
+    *expeditor = msg.expe;
 }
 
-static int gras_msg_wait_or_filter(gras_msg_t msg, void *ctx) {
-       xbt_dynar_t dyn=(xbt_dynar_t)ctx;
-       int res =  xbt_dynar_member(dyn,msg->type);
-       if (res)
-               VERB1("Got matching message (type=%s)",msg->type->name);
-       else
-               VERB0("Got message not matching our expectations");
-       return res;
+static int gras_msg_wait_or_filter(gras_msg_t msg, void *ctx)
+{
+  xbt_dynar_t dyn = (xbt_dynar_t) ctx;
+  int res = xbt_dynar_member(dyn, msg->type);
+  if (res)
+    VERB1("Got matching message (type=%s)", msg->type->name);
+  else
+    VERB0("Got message not matching our expectations");
+  return res;
 }
+
 /** \brief Waits for a message to come in over a given socket.
  *
  * @param timeout: How long should we wait for this message.
@@ -194,61 +197,57 @@ static int gras_msg_wait_or_filter(gras_msg_t msg, void *ctx) {
  *
  * If you are interested in the context, pass the address of a s_gras_msg_cb_ctx_t variable.
  */
-void gras_msg_wait_or(double         timeout,
-               xbt_dynar_t    msgt_want,
-               gras_msg_cb_ctx_t *ctx,
-               int           *msgt_got,
-               void          *payload) {
-       s_gras_msg_t msg;
-
-       VERB1("Wait %f seconds for several message types",timeout);
-       gras_msg_wait_ext_(timeout,
-                       NULL, NULL,
-                       &gras_msg_wait_or_filter, (void*)msgt_want,
-                       &msg);
-
-       if (msg.type->ctn_type) {
-               xbt_assert1(payload,
-                               "Message type '%s' convey a payload you must accept",
-                               msg.type->name);
-       } /* don't check the other side since some of the types may have a payload */
-
-       if (payload && msg.type->ctn_type) {
-               memcpy(payload,msg.payl,msg.payl_size);
-               free(msg.payl);
-       }
-
-       if (ctx)
-               *ctx=gras_msg_cb_ctx_new(msg.expe, msg.type, msg.ID,
-                               (msg.kind == e_gras_msg_kind_rpccall), 60);
-
-       if (msgt_got)
-               *msgt_got = xbt_dynar_search(msgt_want,msg.type);
+void gras_msg_wait_or(double timeout,
+                      xbt_dynar_t msgt_want,
+                      gras_msg_cb_ctx_t * ctx, int *msgt_got, void *payload)
+{
+  s_gras_msg_t msg;
+
+  VERB1("Wait %f seconds for several message types", timeout);
+  gras_msg_wait_ext_(timeout,
+                     NULL, NULL,
+                     &gras_msg_wait_or_filter, (void *) msgt_want, &msg);
+
+  if (msg.type->ctn_type) {
+    xbt_assert1(payload,
+                "Message type '%s' convey a payload you must accept",
+                msg.type->name);
+  }
+  /* don't check the other side since some of the types may have a payload */
+  if (payload && msg.type->ctn_type) {
+    memcpy(payload, msg.payl, msg.payl_size);
+    free(msg.payl);
+  }
+
+  if (ctx)
+    *ctx = gras_msg_cb_ctx_new(msg.expe, msg.type, msg.ID,
+                               (msg.kind == e_gras_msg_kind_rpccall), 60);
+
+  if (msgt_got)
+    *msgt_got = xbt_dynar_search(msgt_want, msg.type);
 }
 
 
 /** \brief Send the data pointed by \a payload as a message of type
  * \a msgtype to the peer \a sock */
-void
-gras_msg_send_(gras_socket_t   sock,
-               gras_msgtype_t  msgtype,
-               void           *payload) {
-
-       if (msgtype->ctn_type) {
-               xbt_assert1(payload,
-                               "Message type '%s' convey a payload you must provide",
-                               msgtype->name);
-       } else {
-               xbt_assert1(!payload,
-                               "No payload was declared for message type '%s'",
-                               msgtype->name);
-       }
-
-       DEBUG2("Send a oneway message of type '%s'. Payload=%p",
-                       msgtype->name,payload);
-       gras_msg_send_ext(sock, e_gras_msg_kind_oneway,0, msgtype, payload);
-       VERB2("Sent a oneway message of type '%s'. Payload=%p",
-                       msgtype->name,payload);
+void gras_msg_send_(gras_socket_t sock, gras_msgtype_t msgtype, void *payload)
+{
+
+  if (msgtype->ctn_type) {
+    xbt_assert1(payload,
+                "Message type '%s' convey a payload you must provide",
+                msgtype->name);
+  } else {
+    xbt_assert1(!payload,
+                "No payload was declared for message type '%s'",
+                msgtype->name);
+  }
+
+  DEBUG2("Send a oneway message of type '%s'. Payload=%p",
+         msgtype->name, payload);
+  gras_msg_send_ext(sock, e_gras_msg_kind_oneway, 0, msgtype, payload);
+  VERB2("Sent a oneway message of type '%s'. Payload=%p",
+        msgtype->name, payload);
 }
 
 /** @brief Handle all messages arriving within the given period
@@ -260,24 +259,25 @@ gras_msg_send_(gras_socket_t   sock,
  * to timeout second when no message arrives) while this function handles any
  * amount of messages, and lasts the given period in any case.
  */
-void
-gras_msg_handleall(double period) {
-       xbt_ex_t e;
-       double begin=gras_os_time();
-       double now;
-
-       do {
-               now=gras_os_time();
-               TRY{
-                       if (period - now + begin > 0)
-                               gras_msg_handle(period - now + begin);
-               } CATCH(e) {
-                       if (e.category != timeout_error)
-                               RETHROW0("Error while waiting for messages: %s");
-                       xbt_ex_free(e);
-               }
-               /* Epsilon to avoid numerical stability issues were the waited interval is so small that the global clock cannot notice the increment */
-       } while (period - now + begin > 0);
+void gras_msg_handleall(double period)
+{
+  xbt_ex_t e;
+  double begin = gras_os_time();
+  double now;
+
+  do {
+    now = gras_os_time();
+    TRY {
+      if (period - now + begin > 0)
+        gras_msg_handle(period - now + begin);
+    }
+    CATCH(e) {
+      if (e.category != timeout_error)
+        RETHROW0("Error while waiting for messages: %s");
+      xbt_ex_free(e);
+    }
+    /* Epsilon to avoid numerical stability issues were the waited interval is so small that the global clock cannot notice the increment */
+  } while (period - now + begin > 0);
 }
 
 /** @brief Handle an incomming message or timer (or wait up to \a timeOut seconds)
@@ -289,181 +289,194 @@ gras_msg_handleall(double period) {
  *
  * @sa gras_msg_handleall().
  */
-void
-gras_msg_handle(double timeOut) {
-
-       double          untiltimer;
-
-       unsigned int cpt;
-       int volatile ran_ok;
-
-       s_gras_msg_t    msg;
-
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       gras_cblist_t  *list=NULL;
-       gras_msg_cb_t       cb;
-       s_gras_msg_cb_ctx_t ctx;
-
-       int timerexpected, timeouted;
-       xbt_ex_t e;
-
-       VERB1("Handling message within the next %.2fs",timeOut);
-
-       untiltimer = gras_msg_timer_handle();
-       DEBUG1("Next timer in %f sec", untiltimer);
-       if (untiltimer == 0.0) {
-               /* A timer was already elapsed and handled */
-               return;
-       }
-       if (untiltimer != -1.0) {
-               timerexpected = 1;
-               timeOut = MIN(timeOut, untiltimer);
-       } else {
-               timerexpected = 0;
-       }
-
-       /* get a message (from the queue or from the net) */
-       timeouted = 0;
-       if (xbt_dynar_length(pd->msg_queue)) {
-               DEBUG0("Get a message from the queue");
-               xbt_dynar_shift(pd->msg_queue,&msg);
-       } else {
-               TRY {
-                       xbt_queue_shift_timed(pd->msg_received,&msg,timeOut);
-                       //      msg.expe = gras_trp_select(timeOut);
-               } CATCH(e) {
-                       if (e.category != timeout_error)
-                               RETHROW;
-                       DEBUG0("Damn. Timeout while getting a message from the queue");
-                       xbt_ex_free(e);
-                       timeouted = 1;
-               }
-       }
-
-       if (timeouted) {
-               if (timerexpected) {
-
-                       /* A timer elapsed before the arrival of any message even if we select()ed a bit */
-                       untiltimer = gras_msg_timer_handle();
-                       if (untiltimer == 0.0) {
-                               /* we served a timer, we're done */
-                               return;
-                       } else {
-                               xbt_assert1(untiltimer>0, "Negative timer (%f). I'm 'puzzeled'", untiltimer);
-                               WARN1("No timer elapsed, in contrary to expectations (next in %f sec)",
-                                               untiltimer);
-                               THROW1(timeout_error,0,
-                                               "No timer elapsed, in contrary to expectations (next in %f sec)",
-                                               untiltimer);
-                       }
-
-               } else {
-                       /* select timeouted, and no timer elapsed. Nothing to do */
-                       THROW1(timeout_error, 0, "No new message or timer (delay was %f)",
-                                       timeOut);
-               }
-
-       }
-
-       /* A message was already there or arrived in the meanwhile. handle it */
-       xbt_dynar_foreach(pd->cbl_list,cpt,list) {
-               if (list->id == msg.type->code) {
-                       break;
-               } else {
-                       list=NULL;
-               }
-       }
-       if (!list) {
-               INFO4("No callback for message '%s' (type:%s) from %s:%d. Queue it for later gras_msg_wait() use.",
-                               msg.type->name,e_gras_msg_kind_names[msg.kind],
-                               gras_socket_peer_name(msg.expe),gras_socket_peer_port(msg.expe));
-               xbt_dynar_push(pd->msg_waitqueue,&msg);
-               return; /* FIXME: maybe we should call ourselves again until the end of the timer or a proper msg is got */
-       }
-
-       ctx.expeditor = msg.expe;
-       ctx.ID = msg.ID;
-       ctx.msgtype = msg.type;
-       ctx.answer_due = (msg.kind == e_gras_msg_kind_rpccall);
-
-       switch (msg.kind) {
-       case e_gras_msg_kind_oneway:
-       case e_gras_msg_kind_rpccall:
-               ran_ok=0;
-               TRY {
-                       xbt_dynar_foreach(list->cbs,cpt,cb) {
-                               if (!ran_ok) {
-                                       DEBUG4("Use the callback #%d (@%p) for incomming msg '%s' (payload_size=%d)",
-                                                       cpt+1,cb,msg.type->name,msg.payl_size);
-                                       if (!(*cb)(&ctx,msg.payl)) {
-                                               /* cb handled the message */
-                                               free(msg.payl);
-                                               ran_ok = 1;
-                                       }
-                               }
-                       }
-               } CATCH(e) {
-                       free(msg.payl);
-                       if (msg.type->kind == e_gras_msg_kind_rpccall) {
-                               char *old_file=e.file;
-                               /* The callback raised an exception, propagate it on the network */
-                               if (!e.remote) {
-                                       /* Make sure we reduce the file name to its basename to avoid issues in tests */
-                                       char *new_file=strrchr(e.file,'/');
-                                       if (new_file)
-                                               e.file = new_file;
-                                       /* the exception is born on this machine */
-                                       e.host = (char*)gras_os_myname();
-                                       xbt_ex_setup_backtrace(&e);
-                               }
-                               INFO5("Propagate %s exception ('%s') from '%s' RPC cb back to %s:%d",
-                                               (e.remote ? "remote" : "local"),
-                                               e.msg,
-                                               msg.type->name,
-                                               gras_socket_peer_name(msg.expe),
-                                               gras_socket_peer_port(msg.expe));
-                               if (XBT_LOG_ISENABLED(gras_msg,xbt_log_priority_verbose))
-                                       xbt_ex_display(&e);
-                               gras_msg_send_ext(msg.expe, e_gras_msg_kind_rpcerror,
-                                               msg.ID, msg.type, &e);
-                               e.file=old_file;
-                               xbt_ex_free(e);
-                               ctx.answer_due = 0;
-                               ran_ok=1;
-                       } else {
-                               RETHROW4("Callback #%d (@%p) to message '%s' (payload size: %d) raised an exception: %s",
-                                               cpt+1,cb,msg.type->name,msg.payl_size);
-                       }
-               }
-
-               xbt_assert1(! ctx.answer_due,
-                               "Bug in user code: RPC callback to message '%s' didn't call gras_msg_rpcreturn",msg.type->name);
-               if (ctx.answer_due)
-                       CRITICAL1("BUGS BOTH IN USER CODE (RPC callback to message '%s' didn't call gras_msg_rpcreturn) "
-                                       "AND IN SIMGRID (process wasn't killed by an assert)",msg.type->name);
-               if (!ran_ok)
-                       THROW1(mismatch_error,0,
-                                       "Message '%s' refused by all registered callbacks (maybe your callback misses a 'return 0' at the end)", msg.type->name);
-               /* FIXME: gras_datadesc_free not implemented => leaking the payload */
-               break;
-
-
-       case e_gras_msg_kind_rpcanswer:
-               INFO3("Unexpected RPC answer discarded (type: %s; from:%s:%d)", msg.type->name,
-                               gras_socket_peer_name(msg.expe),gras_socket_peer_port(msg.expe));
-               WARN0("FIXME: gras_datadesc_free not implemented => leaking the payload");
-               return;
-
-       case e_gras_msg_kind_rpcerror:
-               INFO3("Unexpected RPC error discarded (type: %s; from:%s:%d)", msg.type->name,
-                               gras_socket_peer_name(msg.expe),gras_socket_peer_port(msg.expe));
-               WARN0("FIXME: gras_datadesc_free not implemented => leaking the payload");
-               return;
-
-       default:
-               THROW1(unknown_error,0,
-                               "Cannot handle messages of kind %d yet",msg.type->kind);
-       }
+void gras_msg_handle(double timeOut)
+{
+
+  double untiltimer;
+
+  unsigned int cpt;
+  int volatile ran_ok;
+
+  s_gras_msg_t msg;
+
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  gras_cblist_t *list = NULL;
+  gras_msg_cb_t cb;
+  s_gras_msg_cb_ctx_t ctx;
+
+  int timerexpected, timeouted;
+  xbt_ex_t e;
+
+  VERB1("Handling message within the next %.2fs", timeOut);
+
+  untiltimer = gras_msg_timer_handle();
+  DEBUG1("Next timer in %f sec", untiltimer);
+  if (untiltimer == 0.0) {
+    /* A timer was already elapsed and handled */
+    return;
+  }
+  if (untiltimer != -1.0) {
+    timerexpected = 1;
+    timeOut = MIN(timeOut, untiltimer);
+  } else {
+    timerexpected = 0;
+  }
+
+  /* get a message (from the queue or from the net) */
+  timeouted = 0;
+  if (xbt_dynar_length(pd->msg_queue)) {
+    DEBUG0("Get a message from the queue");
+    xbt_dynar_shift(pd->msg_queue, &msg);
+  } else {
+    TRY {
+      xbt_queue_shift_timed(pd->msg_received, &msg, timeOut);
+      //      msg.expe = gras_trp_select(timeOut);
+    }
+    CATCH(e) {
+      if (e.category != timeout_error)
+        RETHROW;
+      DEBUG0("Damn. Timeout while getting a message from the queue");
+      xbt_ex_free(e);
+      timeouted = 1;
+    }
+  }
+
+  if (timeouted) {
+    if (timerexpected) {
+
+      /* A timer elapsed before the arrival of any message even if we select()ed a bit */
+      untiltimer = gras_msg_timer_handle();
+      if (untiltimer == 0.0) {
+        /* we served a timer, we're done */
+        return;
+      } else {
+        xbt_assert1(untiltimer > 0, "Negative timer (%f). I'm 'puzzeled'",
+                    untiltimer);
+        WARN1
+          ("No timer elapsed, in contrary to expectations (next in %f sec)",
+           untiltimer);
+        THROW1(timeout_error, 0,
+               "No timer elapsed, in contrary to expectations (next in %f sec)",
+               untiltimer);
+      }
+
+    } else {
+      /* select timeouted, and no timer elapsed. Nothing to do */
+      THROW1(timeout_error, 0, "No new message or timer (delay was %f)",
+             timeOut);
+    }
+
+  }
+
+  /* A message was already there or arrived in the meanwhile. handle it */
+  xbt_dynar_foreach(pd->cbl_list, cpt, list) {
+    if (list->id == msg.type->code) {
+      break;
+    } else {
+      list = NULL;
+    }
+  }
+  if (!list) {
+    INFO4
+      ("No callback for message '%s' (type:%s) from %s:%d. Queue it for later gras_msg_wait() use.",
+       msg.type->name, e_gras_msg_kind_names[msg.kind],
+       gras_socket_peer_name(msg.expe), gras_socket_peer_port(msg.expe));
+    xbt_dynar_push(pd->msg_waitqueue, &msg);
+    return;                     /* FIXME: maybe we should call ourselves again until the end of the timer or a proper msg is got */
+  }
+
+  ctx.expeditor = msg.expe;
+  ctx.ID = msg.ID;
+  ctx.msgtype = msg.type;
+  ctx.answer_due = (msg.kind == e_gras_msg_kind_rpccall);
+
+  switch (msg.kind) {
+  case e_gras_msg_kind_oneway:
+  case e_gras_msg_kind_rpccall:
+    ran_ok = 0;
+    TRY {
+      xbt_dynar_foreach(list->cbs, cpt, cb) {
+        if (!ran_ok) {
+          DEBUG4
+            ("Use the callback #%d (@%p) for incomming msg '%s' (payload_size=%d)",
+             cpt + 1, cb, msg.type->name, msg.payl_size);
+          if (!(*cb) (&ctx, msg.payl)) {
+            /* cb handled the message */
+            free(msg.payl);
+            ran_ok = 1;
+          }
+        }
+      }
+    }
+    CATCH(e) {
+      free(msg.payl);
+      if (msg.type->kind == e_gras_msg_kind_rpccall) {
+        char *old_file = e.file;
+        /* The callback raised an exception, propagate it on the network */
+        if (!e.remote) {
+          /* Make sure we reduce the file name to its basename to avoid issues in tests */
+          char *new_file = strrchr(e.file, '/');
+          if (new_file)
+            e.file = new_file;
+          /* the exception is born on this machine */
+          e.host = (char *) gras_os_myname();
+          xbt_ex_setup_backtrace(&e);
+        }
+        INFO5("Propagate %s exception ('%s') from '%s' RPC cb back to %s:%d",
+              (e.remote ? "remote" : "local"),
+              e.msg,
+              msg.type->name,
+              gras_socket_peer_name(msg.expe),
+              gras_socket_peer_port(msg.expe));
+        if (XBT_LOG_ISENABLED(gras_msg, xbt_log_priority_verbose))
+          xbt_ex_display(&e);
+        gras_msg_send_ext(msg.expe, e_gras_msg_kind_rpcerror,
+                          msg.ID, msg.type, &e);
+        e.file = old_file;
+        xbt_ex_free(e);
+        ctx.answer_due = 0;
+        ran_ok = 1;
+      } else {
+        RETHROW4
+          ("Callback #%d (@%p) to message '%s' (payload size: %d) raised an exception: %s",
+           cpt + 1, cb, msg.type->name, msg.payl_size);
+      }
+    }
+
+    xbt_assert1(!ctx.answer_due,
+                "Bug in user code: RPC callback to message '%s' didn't call gras_msg_rpcreturn",
+                msg.type->name);
+    if (ctx.answer_due)
+      CRITICAL1
+        ("BUGS BOTH IN USER CODE (RPC callback to message '%s' didn't call gras_msg_rpcreturn) "
+         "AND IN SIMGRID (process wasn't killed by an assert)",
+         msg.type->name);
+    if (!ran_ok)
+      THROW1(mismatch_error, 0,
+             "Message '%s' refused by all registered callbacks (maybe your callback misses a 'return 0' at the end)",
+             msg.type->name);
+    /* FIXME: gras_datadesc_free not implemented => leaking the payload */
+    break;
+
+
+  case e_gras_msg_kind_rpcanswer:
+    INFO3("Unexpected RPC answer discarded (type: %s; from:%s:%d)",
+          msg.type->name, gras_socket_peer_name(msg.expe),
+          gras_socket_peer_port(msg.expe));
+    WARN0("FIXME: gras_datadesc_free not implemented => leaking the payload");
+    return;
+
+  case e_gras_msg_kind_rpcerror:
+    INFO3("Unexpected RPC error discarded (type: %s; from:%s:%d)",
+          msg.type->name, gras_socket_peer_name(msg.expe),
+          gras_socket_peer_port(msg.expe));
+    WARN0("FIXME: gras_datadesc_free not implemented => leaking the payload");
+    return;
+
+  default:
+    THROW1(unknown_error, 0,
+           "Cannot handle messages of kind %d yet", msg.type->kind);
+  }
 
 }
-
index 9acc235..3bf7c63 100644 (file)
@@ -9,7 +9,8 @@
 
 #include "gras/Msg/msg_private.h"
 #include "gras/Transport/transport_private.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_read,gras_msg,"Message reader thread");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_read, gras_msg,
+                                "Message reader thread");
 
 #include "xbt/ex.h"
 #include "xbt/queue.h"
@@ -18,121 +19,135 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_read,gras_msg,"Message reader thread");
 #include "gras/Transport/transport_interface.h" /* gras_select */
 
 typedef struct s_gras_msg_listener_ {
-       xbt_queue_t incomming_messages;
-       xbt_queue_t socks_to_close; /* let the listener close the sockets, since it may be selecting on them. Darwin don't like this trick */
-       gras_socket_t wakeup_sock_listener_side;
-       gras_socket_t wakeup_sock_master_side;
-       xbt_thread_t listener;
+  xbt_queue_t incomming_messages;
+  xbt_queue_t socks_to_close;   /* let the listener close the sockets, since it may be selecting on them. Darwin don't like this trick */
+  gras_socket_t wakeup_sock_listener_side;
+  gras_socket_t wakeup_sock_master_side;
+  xbt_thread_t listener;
 } s_gras_msg_listener_t;
 
-static void listener_function(void *p) {
-       gras_msg_listener_t me = (gras_msg_listener_t)p;
-       s_gras_msg_t msg;
-       xbt_ex_t e;
-       gras_msgtype_t msg_wakeup_listener_t = gras_msgtype_by_name("_wakeup_listener");
-       DEBUG0("I'm the listener");
-       while (1) {
-               DEBUG0("Selecting");
-               msg.expe = gras_trp_select(-1);
-               DEBUG0("Select returned something");
-               gras_msg_recv(msg.expe, &msg);
-               if (msg.type!=msg_wakeup_listener_t)
-                       xbt_queue_push(me->incomming_messages, &msg);
-               else  {
-                       char got = *(char*)msg.payl;
-                       if (got == '1') {
-                               VERB0("Asked to get awake");
-                               free(msg.payl);
-                       } else {
-                               VERB0("Asked to die");
-                               //        gras_socket_close(me->wakeup_sock_listener_side);
-                               free(msg.payl);
-                               return ;
-                       }
-               }
-               /* empty the list of sockets to trash */
-               TRY {
-                       while (1) {
-                               int sock;
-                               xbt_queue_shift_timed(me->socks_to_close,&sock,0);
-                               if(tcp_close(sock) < 0) {
-                                       WARN3("error while closing tcp socket %d: %d (%s)\n",
-                                                       sock, sock_errno, sock_errstr(sock_errno));
-                               }
-                       }
-               } CATCH(e) {
-                       if (e.category != timeout_error)
-                               RETHROW;
-                       xbt_ex_free(e);
-               }
-       }
+static void listener_function(void *p)
+{
+  gras_msg_listener_t me = (gras_msg_listener_t) p;
+  s_gras_msg_t msg;
+  xbt_ex_t e;
+  gras_msgtype_t msg_wakeup_listener_t =
+    gras_msgtype_by_name("_wakeup_listener");
+  DEBUG0("I'm the listener");
+  while (1) {
+    DEBUG0("Selecting");
+    msg.expe = gras_trp_select(-1);
+    DEBUG0("Select returned something");
+    gras_msg_recv(msg.expe, &msg);
+    if (msg.type != msg_wakeup_listener_t)
+      xbt_queue_push(me->incomming_messages, &msg);
+    else {
+      char got = *(char *) msg.payl;
+      if (got == '1') {
+        VERB0("Asked to get awake");
+        free(msg.payl);
+      } else {
+        VERB0("Asked to die");
+        //        gras_socket_close(me->wakeup_sock_listener_side);
+        free(msg.payl);
+        return;
+      }
+    }
+    /* empty the list of sockets to trash */
+    TRY {
+      while (1) {
+        int sock;
+        xbt_queue_shift_timed(me->socks_to_close, &sock, 0);
+        if (tcp_close(sock) < 0) {
+          WARN3("error while closing tcp socket %d: %d (%s)\n",
+                sock, sock_errno, sock_errstr(sock_errno));
+        }
+      }
+    }
+    CATCH(e) {
+      if (e.category != timeout_error)
+        RETHROW;
+      xbt_ex_free(e);
+    }
+  }
 }
 
-gras_msg_listener_t
-gras_msg_listener_launch(xbt_queue_t msg_exchange){
-       gras_msg_listener_t arg = xbt_new0(s_gras_msg_listener_t,1);
-       int my_port;
-
-       DEBUG0("Launch listener");
-       arg->incomming_messages = msg_exchange;
-       arg->socks_to_close = xbt_queue_new(0,sizeof(int));
-
-       /* get a free socket for the receiving part of the listener, taking care that it does not get saved as "myport" number */
-       my_port = ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport;
-       arg->wakeup_sock_listener_side=gras_socket_server_range(5000,6000,-1,0);
-       ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport = my_port;
-       /* Connect the other part of the socket */
-       arg->wakeup_sock_master_side=gras_socket_client(gras_os_myname(),gras_socket_my_port(arg->wakeup_sock_listener_side));
-
-       /* declare the message used to awake the listener from the master */
-       gras_msgtype_declare("_wakeup_listener",gras_datadesc_by_name("char"));
-
-       /* actually start the thread */
-       arg->listener =  xbt_thread_create("listener",listener_function,arg);
-       gras_os_sleep(0); /* TODO: useless? give the listener a chance to initialize even if the main is empty and we cancel it right afterward */
-       return arg;
+gras_msg_listener_t gras_msg_listener_launch(xbt_queue_t msg_exchange)
+{
+  gras_msg_listener_t arg = xbt_new0(s_gras_msg_listener_t, 1);
+  int my_port;
+
+  DEBUG0("Launch listener");
+  arg->incomming_messages = msg_exchange;
+  arg->socks_to_close = xbt_queue_new(0, sizeof(int));
+
+  /* get a free socket for the receiving part of the listener, taking care that it does not get saved as "myport" number */
+  my_port =
+    ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport;
+  arg->wakeup_sock_listener_side =
+    gras_socket_server_range(5000, 6000, -1, 0);
+  ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport =
+    my_port;
+  /* Connect the other part of the socket */
+  arg->wakeup_sock_master_side =
+    gras_socket_client(gras_os_myname(),
+                       gras_socket_my_port(arg->wakeup_sock_listener_side));
+
+  /* declare the message used to awake the listener from the master */
+  gras_msgtype_declare("_wakeup_listener", gras_datadesc_by_name("char"));
+
+  /* actually start the thread */
+  arg->listener = xbt_thread_create("listener", listener_function, arg);
+  gras_os_sleep(0);             /* TODO: useless? give the listener a chance to initialize even if the main is empty and we cancel it right afterward */
+  return arg;
 }
 
-#include "gras/Virtu/virtu_private.h" /* procdata_t content */
-void gras_msg_listener_shutdown(gras_msg_listener_t l) {
-       gras_procdata_t *pd = gras_procdata_get();
-       char kill = '0';
-       DEBUG0("Listener quit");
-
-
-       if (pd->listener)
-               gras_msg_send(pd->listener->wakeup_sock_master_side,"_wakeup_listener",&kill);
-
-       /* FIXME: thread_join is not implemented in SG (remove next conditional when fixed)
-        * But I guess it's not a big deal since we're terminating the thread mainly to
-        * make it free its OS locks on darwin.
-        * darwin is definitly different from the neat & nice SG world */
-       if (gras_if_RL())
-               xbt_thread_join(pd->listener->listener);
-
-       //  gras_socket_close(pd->listener->wakeup_sock_master_side); FIXME: uncommenting this leads to deadlock at terminaison
-       xbt_queue_free(&l->incomming_messages);
-       xbt_queue_free(&l->socks_to_close);
-       xbt_free(l);
+#include "gras/Virtu/virtu_private.h"   /* procdata_t content */
+void gras_msg_listener_shutdown(gras_msg_listener_t l)
+{
+  gras_procdata_t *pd = gras_procdata_get();
+  char kill = '0';
+  DEBUG0("Listener quit");
+
+
+  if (pd->listener)
+    gras_msg_send(pd->listener->wakeup_sock_master_side, "_wakeup_listener",
+                  &kill);
+
+  /* FIXME: thread_join is not implemented in SG (remove next conditional when fixed)
+   * But I guess it's not a big deal since we're terminating the thread mainly to
+   * make it free its OS locks on darwin.
+   * darwin is definitly different from the neat & nice SG world */
+  if (gras_if_RL())
+    xbt_thread_join(pd->listener->listener);
+
+  //  gras_socket_close(pd->listener->wakeup_sock_master_side); FIXME: uncommenting this leads to deadlock at terminaison
+  xbt_queue_free(&l->incomming_messages);
+  xbt_queue_free(&l->socks_to_close);
+  xbt_free(l);
 }
 
-void gras_msg_listener_awake(){
-       gras_procdata_t *pd;
-       char c = '1';
-
-       DEBUG0("Awaking the listener");
-       pd = gras_procdata_get();
-       if (pd->listener) {
-               gras_msg_send(pd->listener->wakeup_sock_master_side,"_wakeup_listener",&c);
-       }
+void gras_msg_listener_awake()
+{
+  gras_procdata_t *pd;
+  char c = '1';
+
+  DEBUG0("Awaking the listener");
+  pd = gras_procdata_get();
+  if (pd->listener) {
+    gras_msg_send(pd->listener->wakeup_sock_master_side, "_wakeup_listener",
+                  &c);
+  }
 }
-void  gras_msg_listener_close_socket(int sd) {
-       gras_procdata_t *pd = gras_procdata_get();
-       if (pd->listener) {
-               xbt_queue_push(pd->listener->socks_to_close,&sd);
-               gras_msg_listener_awake();
-       } else {
-               /* do it myself */
-               tcp_close(sd);
-       }
+
+void gras_msg_listener_close_socket(int sd)
+{
+  gras_procdata_t *pd = gras_procdata_get();
+  if (pd->listener) {
+    xbt_queue_push(pd->listener->socks_to_close, &sd);
+    gras_msg_listener_awake();
+  } else {
+    /* do it myself */
+    tcp_close(sd);
+  }
 }
index 580a299..63d259d 100644 (file)
@@ -19,78 +19,83 @@ extern xbt_set_t _gras_msgtype_set;
 /*
  * Creating procdata for this module
  */
-static void *gras_msg_procdata_new(void) {
-       gras_msg_procdata_t res = xbt_new(s_gras_msg_procdata_t,1);
-
-       res->name = xbt_strdup("gras_msg");
-       res->name_len = 0;
-       res->msg_queue     = xbt_dynar_new(sizeof(s_gras_msg_t),   NULL);
-       res->msg_waitqueue = xbt_dynar_new(sizeof(s_gras_msg_t),   NULL);
-       res->cbl_list      = xbt_dynar_new(sizeof(gras_cblist_t *),gras_cbl_free);
-       res->timers        = xbt_dynar_new(sizeof(s_gras_timer_t), NULL);
-       res->msg_to_receive_queue = xbt_fifo_new();
-       res->msg_to_receive_queue_meas = xbt_fifo_new();
-       res->msg_received = xbt_queue_new(0,sizeof(s_gras_msg_t));
-
-       return (void*)res;
+static void *gras_msg_procdata_new(void)
+{
+  gras_msg_procdata_t res = xbt_new(s_gras_msg_procdata_t, 1);
+
+  res->name = xbt_strdup("gras_msg");
+  res->name_len = 0;
+  res->msg_queue = xbt_dynar_new(sizeof(s_gras_msg_t), NULL);
+  res->msg_waitqueue = xbt_dynar_new(sizeof(s_gras_msg_t), NULL);
+  res->cbl_list = xbt_dynar_new(sizeof(gras_cblist_t *), gras_cbl_free);
+  res->timers = xbt_dynar_new(sizeof(s_gras_timer_t), NULL);
+  res->msg_to_receive_queue = xbt_fifo_new();
+  res->msg_to_receive_queue_meas = xbt_fifo_new();
+  res->msg_received = xbt_queue_new(0, sizeof(s_gras_msg_t));
+
+  return (void *) res;
 }
 
 /*
  * Freeing procdata for this module
  */
-static void gras_msg_procdata_free(void *data) {
-       gras_msg_procdata_t res = (gras_msg_procdata_t)data;
-
-       xbt_dynar_free(&( res->msg_queue ));
-       xbt_dynar_free(&( res->msg_waitqueue ));
-       xbt_dynar_free(&( res->cbl_list ));
-       xbt_dynar_free(&( res->timers ));
-       xbt_fifo_free( res->msg_to_receive_queue );
-       xbt_fifo_free( res->msg_to_receive_queue_meas );
-
-       free(res->name);
-       free(res);
+static void gras_msg_procdata_free(void *data)
+{
+  gras_msg_procdata_t res = (gras_msg_procdata_t) data;
+
+  xbt_dynar_free(&(res->msg_queue));
+  xbt_dynar_free(&(res->msg_waitqueue));
+  xbt_dynar_free(&(res->cbl_list));
+  xbt_dynar_free(&(res->timers));
+  xbt_fifo_free(res->msg_to_receive_queue);
+  xbt_fifo_free(res->msg_to_receive_queue_meas);
+
+  free(res->name);
+  free(res);
 }
 
 /*
  * Module registration
  */
 int gras_msg_libdata_id;
-void gras_msg_register() {
-       gras_msg_libdata_id = gras_procdata_add("gras_msg",gras_msg_procdata_new, gras_msg_procdata_free);
+void gras_msg_register()
+{
+  gras_msg_libdata_id =
+    gras_procdata_add("gras_msg", gras_msg_procdata_new,
+                      gras_msg_procdata_free);
 }
 
 /*
  * Initialize this submodule.
  */
-void gras_msg_init(void) {
-       /* only initialize once */
-       if (_gras_msgtype_set != NULL)
-               return;
+void gras_msg_init(void)
+{
+  /* only initialize once */
+  if (_gras_msgtype_set != NULL)
+    return;
 
-       VERB0("Initializing Msg");
+  VERB0("Initializing Msg");
 
-       _gras_msgtype_set = xbt_set_new();
+  _gras_msgtype_set = xbt_set_new();
 
-       memcpy(_GRAS_header,"GRAS", 4);
-       _GRAS_header[4]=GRAS_PROTOCOL_VERSION;
-       _GRAS_header[5]=(char)GRAS_THISARCH;
+  memcpy(_GRAS_header, "GRAS", 4);
+  _GRAS_header[4] = GRAS_PROTOCOL_VERSION;
+  _GRAS_header[5] = (char) GRAS_THISARCH;
 
-       gras_msg_ctx_mallocator =
-               xbt_mallocator_new(1000,
-                               gras_msg_ctx_mallocator_new_f,
-                               gras_msg_ctx_mallocator_free_f,
-                               gras_msg_ctx_mallocator_reset_f);
+  gras_msg_ctx_mallocator =
+    xbt_mallocator_new(1000,
+                       gras_msg_ctx_mallocator_new_f,
+                       gras_msg_ctx_mallocator_free_f,
+                       gras_msg_ctx_mallocator_reset_f);
 }
 
 /*
  * Finalize the msg module
  */
-void
-gras_msg_exit(void) {
-       VERB0("Exiting Msg");
-       xbt_set_free(&_gras_msgtype_set);
+void gras_msg_exit(void)
+{
+  VERB0("Exiting Msg");
+  xbt_set_free(&_gras_msgtype_set);
 
-       xbt_mallocator_free(gras_msg_ctx_mallocator);
+  xbt_mallocator_free(gras_msg_ctx_mallocator);
 }
-
index 824da04..430aa95 100644 (file)
@@ -13,7 +13,7 @@
 #include "gras/Virtu/virtu_interface.h"
 #include "gras/DataDesc/datadesc_interface.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg,gras,"High level messaging");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg, gras, "High level messaging");
 
 xbt_set_t _gras_msgtype_set = NULL;
 
@@ -24,28 +24,34 @@ xbt_set_t _gras_msgtype_set = NULL;
 
 
 /* Reclamed memory */
-void gras_msgtype_free(void *t) {
-       gras_msgtype_t msgtype=(gras_msgtype_t)t;
-       if (msgtype) {
-               free(msgtype->name);
-               free(msgtype);
-       }
+void gras_msgtype_free(void *t)
+{
+  gras_msgtype_t msgtype = (gras_msgtype_t) t;
+  if (msgtype) {
+    free(msgtype->name);
+    free(msgtype);
+  }
 }
+
 /**
  * Dump all declared message types (debugging purpose)
  */
-void gras_msgtype_dumpall(void) {
-       xbt_set_cursor_t cursor;
-       gras_msgtype_t msgtype=NULL;
-
-       INFO0("Dump of all registered messages:");
-       xbt_set_foreach(_gras_msgtype_set, cursor, msgtype) {
-               INFO6("  Message name: %s (v%d) %s; %s%s%s",
-                               msgtype->name, msgtype->version, e_gras_msg_kind_names[msgtype->kind],
-                               gras_datadesc_get_name(msgtype->ctn_type),
-                               (msgtype->kind==e_gras_msg_kind_rpccall ? " -> ":""),
-                               (msgtype->kind==e_gras_msg_kind_rpccall ? gras_datadesc_get_name(msgtype->answer_type) : ""));
-       }
+void gras_msgtype_dumpall(void)
+{
+  xbt_set_cursor_t cursor;
+  gras_msgtype_t msgtype = NULL;
+
+  INFO0("Dump of all registered messages:");
+  xbt_set_foreach(_gras_msgtype_set, cursor, msgtype) {
+    INFO6("  Message name: %s (v%d) %s; %s%s%s",
+          msgtype->name, msgtype->version,
+          e_gras_msg_kind_names[msgtype->kind],
+          gras_datadesc_get_name(msgtype->ctn_type),
+          (msgtype->kind == e_gras_msg_kind_rpccall ? " -> " : ""),
+          (msgtype->kind ==
+           e_gras_msg_kind_rpccall ?
+           gras_datadesc_get_name(msgtype->answer_type) : ""));
+  }
 }
 
 
@@ -55,72 +61,75 @@ void gras_msgtype_dumpall(void) {
  * Returns the versionned name of the message.
  *   It's a newly allocated string, make sure to free it.
  */
-static char *make_namev(const char *name, short int ver) {
-       if (!ver)
-               return xbt_strdup(name);
+static char *make_namev(const char *name, short int ver)
+{
+  if (!ver)
+    return xbt_strdup(name);
 
-       return bprintf("%s_v%d",name,ver);
+  return bprintf("%s_v%d", name, ver);
 }
 
 /* Internal function doing the crude work of registering messages */
 void
-gras_msgtype_declare_ext(const char           *name,
-               short int             version,
-               e_gras_msg_kind_t     kind,
-               gras_datadesc_type_t  payload_request,
-               gras_datadesc_type_t  payload_answer) {
-
-       gras_msgtype_t msgtype=NULL;
-       char *namev=make_namev(name,version);
-       volatile int found = 0;
-       xbt_ex_t e;
-
-       TRY {
-               msgtype = (gras_msgtype_t)xbt_set_get_by_name(_gras_msgtype_set,namev);
-               found = 1;
-       } CATCH(e) {
-               if (e.category != not_found_error) {
-                       xbt_free(namev);
-                       RETHROW;
-               }
-               xbt_ex_free(e);
-       }
-
-       if (found) {
-               VERB2("Re-register version %d of message '%s' (same kind & payload, ignored).",
-                               version, name);
-               xbt_assert3(msgtype->kind == kind,
-                               "Message %s re-registered as a %s (it was known as a %s)",
-                               namev,e_gras_msg_kind_names[kind],e_gras_msg_kind_names[msgtype->kind]);
-               xbt_assert3(!gras_datadesc_type_cmp(msgtype->ctn_type, payload_request),
-                               "Message %s re-registred with another payload (%s was %s)",
-                               namev,gras_datadesc_get_name(payload_request),
-                               gras_datadesc_get_name(msgtype->ctn_type));
-
-               xbt_assert3(!gras_datadesc_type_cmp(msgtype->answer_type, payload_answer),
-                               "Message %s re-registred with another answer payload (%s was %s)",
-                               namev,gras_datadesc_get_name(payload_answer),
-                               gras_datadesc_get_name(msgtype->answer_type));
-
-               xbt_free(namev);
-               return ; /* do really ignore it */
-       }
-
-       VERB4("Register version %d of message '%s' "
-                       "(payload: %s; answer payload: %s).",
-                       version, name, gras_datadesc_get_name(payload_request),
-                       gras_datadesc_get_name(payload_answer));
-
-       msgtype = xbt_new(s_gras_msgtype_t,1);
-       msgtype->name = namev;
-       msgtype->name_len = strlen(namev);
-       msgtype->version = version;
-       msgtype->kind = kind;
-       msgtype->ctn_type = payload_request;
-       msgtype->answer_type = payload_answer;
-
-       xbt_set_add(_gras_msgtype_set, (xbt_set_elm_t)msgtype,
-                       &gras_msgtype_free);
+gras_msgtype_declare_ext(const char *name,
+                         short int version,
+                         e_gras_msg_kind_t kind,
+                         gras_datadesc_type_t payload_request,
+                         gras_datadesc_type_t payload_answer)
+{
+
+  gras_msgtype_t msgtype = NULL;
+  char *namev = make_namev(name, version);
+  volatile int found = 0;
+  xbt_ex_t e;
+
+  TRY {
+    msgtype = (gras_msgtype_t) xbt_set_get_by_name(_gras_msgtype_set, namev);
+    found = 1;
+  } CATCH(e) {
+    if (e.category != not_found_error) {
+      xbt_free(namev);
+      RETHROW;
+    }
+    xbt_ex_free(e);
+  }
+
+  if (found) {
+    VERB2
+      ("Re-register version %d of message '%s' (same kind & payload, ignored).",
+       version, name);
+    xbt_assert3(msgtype->kind == kind,
+                "Message %s re-registered as a %s (it was known as a %s)",
+                namev, e_gras_msg_kind_names[kind],
+                e_gras_msg_kind_names[msgtype->kind]);
+    xbt_assert3(!gras_datadesc_type_cmp(msgtype->ctn_type, payload_request),
+                "Message %s re-registred with another payload (%s was %s)",
+                namev, gras_datadesc_get_name(payload_request),
+                gras_datadesc_get_name(msgtype->ctn_type));
+
+    xbt_assert3(!gras_datadesc_type_cmp(msgtype->answer_type, payload_answer),
+                "Message %s re-registred with another answer payload (%s was %s)",
+                namev, gras_datadesc_get_name(payload_answer),
+                gras_datadesc_get_name(msgtype->answer_type));
+
+    xbt_free(namev);
+    return;                     /* do really ignore it */
+  }
+
+  VERB4("Register version %d of message '%s' "
+        "(payload: %s; answer payload: %s).",
+        version, name, gras_datadesc_get_name(payload_request),
+        gras_datadesc_get_name(payload_answer));
+
+  msgtype = xbt_new(s_gras_msgtype_t, 1);
+  msgtype->name = namev;
+  msgtype->name_len = strlen(namev);
+  msgtype->version = version;
+  msgtype->kind = kind;
+  msgtype->ctn_type = payload_request;
+  msgtype->answer_type = payload_answer;
+
+  xbt_set_add(_gras_msgtype_set, (xbt_set_elm_t) msgtype, &gras_msgtype_free);
 }
 
 
@@ -129,9 +138,9 @@ gras_msgtype_declare_ext(const char           *name,
  * @param name: name as it should be used for logging messages (must be uniq)
  * @param payload: datadescription of the payload
  */
-void gras_msgtype_declare(const char           *name,
-               gras_datadesc_type_t  payload) {
-       gras_msgtype_declare_ext(name, 0, e_gras_msg_kind_oneway, payload, NULL);
+void gras_msgtype_declare(const char *name, gras_datadesc_type_t payload)
+{
+  gras_msgtype_declare_ext(name, 0, e_gras_msg_kind_oneway, payload, NULL);
 }
 
 
@@ -149,56 +158,61 @@ void gras_msgtype_declare(const char           *name,
  * differents for each of them.
  */
 void
-gras_msgtype_declare_v(const char           *name,
-               short int             version,
-               gras_datadesc_type_t  payload) {
+gras_msgtype_declare_v(const char *name,
+                       short int version, gras_datadesc_type_t payload)
+{
 
-       gras_msgtype_declare_ext(name, version,
-                       e_gras_msg_kind_oneway, payload, NULL);
+  gras_msgtype_declare_ext(name, version,
+                           e_gras_msg_kind_oneway, payload, NULL);
 }
 
 /** @brief retrieve an existing message type from its name (raises an exception if it does not exist). */
-gras_msgtype_t gras_msgtype_by_name (const char *name) {
-       return gras_msgtype_by_namev(name,0);
+gras_msgtype_t gras_msgtype_by_name(const char *name)
+{
+  return gras_msgtype_by_namev(name, 0);
 }
+
 /** @brief retrieve an existing message type from its name (or NULL if it does not exist). */
-gras_msgtype_t gras_msgtype_by_name_or_null (const char *name) {
-       xbt_ex_t e;
-       gras_msgtype_t res = NULL;
-
-       TRY {
-               res = gras_msgtype_by_namev(name,0);
-       } CATCH(e) {
-               res = NULL;
-               xbt_ex_free(e);
-       }
-       return res;
+gras_msgtype_t gras_msgtype_by_name_or_null(const char *name)
+{
+  xbt_ex_t e;
+  gras_msgtype_t res = NULL;
+
+  TRY {
+    res = gras_msgtype_by_namev(name, 0);
+  } CATCH(e) {
+    res = NULL;
+    xbt_ex_free(e);
+  }
+  return res;
 }
 
 /** @brief retrieve an existing message type from its name and version. */
-gras_msgtype_t gras_msgtype_by_namev(const char      *name,
-               short int        version) {
-       gras_msgtype_t res = NULL;
-       char *namev = make_namev(name,version);
-       volatile int found=0;
-       xbt_ex_t e;
-
-       TRY {
-               res = (gras_msgtype_t)xbt_set_get_by_name(_gras_msgtype_set, namev);
-               found=1;
-       } CATCH(e) {
-               xbt_ex_free(e);
-       }
-       if (!found)
-               THROW1(not_found_error,0,"No registred message of that name: %s",name);
-
-       free(namev);
-
-       return res;
+gras_msgtype_t gras_msgtype_by_namev(const char *name, short int version)
+{
+  gras_msgtype_t res = NULL;
+  char *namev = make_namev(name, version);
+  volatile int found = 0;
+  xbt_ex_t e;
+
+  TRY {
+    res = (gras_msgtype_t) xbt_set_get_by_name(_gras_msgtype_set, namev);
+    found = 1;
+  } CATCH(e) {
+    xbt_ex_free(e);
+  }
+  if (!found)
+    THROW1(not_found_error, 0, "No registred message of that name: %s", name);
+
+  free(namev);
+
+  return res;
 }
+
 /** @brief retrieve an existing message type from its name and version. */
-gras_msgtype_t gras_msgtype_by_id(int id) {
-       return (gras_msgtype_t)xbt_set_get_by_id(_gras_msgtype_set, id);
+gras_msgtype_t gras_msgtype_by_id(int id)
+{
+  return (gras_msgtype_t) xbt_set_get_by_id(_gras_msgtype_set, id);
 }
 
 
@@ -206,13 +220,13 @@ gras_msgtype_t gras_msgtype_by_id(int id) {
 /* ******************************************************************** */
 /*                        CALLBACKS                                     */
 /* ******************************************************************** */
-void
-gras_cbl_free(void *data){
-       gras_cblist_t *list=*(void**)data;
-       if (list) {
-               xbt_dynar_free(&( list->cbs ));
-               free(list);
-       }
+void gras_cbl_free(void *data)
+{
+  gras_cblist_t *list = *(void **) data;
+  if (list) {
+    xbt_dynar_free(&(list->cbs));
+    free(list);
+  }
 }
 
 /** \brief Bind the given callback to the given message type
@@ -222,94 +236,96 @@ gras_cbl_free(void *data){
  * if it returns a non-null value, the message will be passed to the
  * second one. And so on until one of the callbacks accepts the message.
  */
-void
-gras_cb_register_(gras_msgtype_t msgtype,
-               gras_msg_cb_t cb) {
-       gras_msg_procdata_t pd=
-               (gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       gras_cblist_t *list=NULL;
-       unsigned int cpt;
-
-       DEBUG2("Register %p as callback to '%s'",cb,msgtype->name);
-
-       /* search the list of cb for this message on this host (creating if NULL) */
-       xbt_dynar_foreach(pd->cbl_list,cpt,list) {
-               if (list->id == msgtype->code) {
-                       break;
-               } else {
-                       list=NULL;
-               }
-       }
-       if (!list) {
-               /* First cb? Create room */
-               list = xbt_new(gras_cblist_t,1);
-               list->id = msgtype->code;
-               list->cbs = xbt_dynar_new(sizeof(gras_msg_cb_t), NULL);
-               xbt_dynar_push(pd->cbl_list,&list);
-       }
-
-       /* Insert the new one into the set */
-       xbt_dynar_insert_at(list->cbs,0,&cb);
+void gras_cb_register_(gras_msgtype_t msgtype, gras_msg_cb_t cb)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  gras_cblist_t *list = NULL;
+  unsigned int cpt;
+
+  DEBUG2("Register %p as callback to '%s'", cb, msgtype->name);
+
+  /* search the list of cb for this message on this host (creating if NULL) */
+  xbt_dynar_foreach(pd->cbl_list, cpt, list) {
+    if (list->id == msgtype->code) {
+      break;
+    } else {
+      list = NULL;
+    }
+  }
+  if (!list) {
+    /* First cb? Create room */
+    list = xbt_new(gras_cblist_t, 1);
+    list->id = msgtype->code;
+    list->cbs = xbt_dynar_new(sizeof(gras_msg_cb_t), NULL);
+    xbt_dynar_push(pd->cbl_list, &list);
+  }
+
+  /* Insert the new one into the set */
+  xbt_dynar_insert_at(list->cbs, 0, &cb);
 }
 
 /** \brief Unbind the given callback from the given message type */
-void
-gras_cb_unregister_(gras_msgtype_t msgtype,
-               gras_msg_cb_t cb) {
-
-       gras_msg_procdata_t pd=
-               (gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       gras_cblist_t *list;
-       gras_msg_cb_t cb_cpt;
-       unsigned int cpt;
-       int found = 0;
-
-       /* search the list of cb for this message on this host */
-       xbt_dynar_foreach(pd->cbl_list,cpt,list) {
-               if (list->id == msgtype->code) {
-                       break;
-               } else {
-                       list=NULL;
-               }
-       }
-
-       /* Remove it from the set */
-       if (list) {
-               xbt_dynar_foreach(list->cbs,cpt,cb_cpt) {
-                       if (cb == cb_cpt) {
-                               xbt_dynar_cursor_rm(list->cbs, &cpt);
-                               found = 1;
-                       }
-               }
-       }
-       if (!found)
-               VERB1("Ignoring removal of unexisting callback to msg id %d",
-                               msgtype->code);
+void gras_cb_unregister_(gras_msgtype_t msgtype, gras_msg_cb_t cb)
+{
+
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  gras_cblist_t *list;
+  gras_msg_cb_t cb_cpt;
+  unsigned int cpt;
+  int found = 0;
+
+  /* search the list of cb for this message on this host */
+  xbt_dynar_foreach(pd->cbl_list, cpt, list) {
+    if (list->id == msgtype->code) {
+      break;
+    } else {
+      list = NULL;
+    }
+  }
+
+  /* Remove it from the set */
+  if (list) {
+    xbt_dynar_foreach(list->cbs, cpt, cb_cpt) {
+      if (cb == cb_cpt) {
+        xbt_dynar_cursor_rm(list->cbs, &cpt);
+        found = 1;
+      }
+    }
+  }
+  if (!found)
+    VERB1("Ignoring removal of unexisting callback to msg id %d",
+          msgtype->code);
 }
 
 /** \brief Retrieve the expeditor of the message */
-gras_socket_t gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx) {
-       return ctx->expeditor;
+gras_socket_t gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx)
+{
+  return ctx->expeditor;
 }
+
 /* \brief Creates a new message exchange context (user should never have to) */
 gras_msg_cb_ctx_t gras_msg_cb_ctx_new(gras_socket_t expe,
-               gras_msgtype_t msgtype,
-               unsigned long int ID,
-               int answer_due,
-               double timeout) {
-       gras_msg_cb_ctx_t res=xbt_new(s_gras_msg_cb_ctx_t,1);
-       res->expeditor = expe;
-       res->msgtype = msgtype;
-       res->ID = ID;
-       res->timeout = timeout;
-       res->answer_due = answer_due;
-
-       return res;
+                                      gras_msgtype_t msgtype,
+                                      unsigned long int ID,
+                                      int answer_due, double timeout)
+{
+  gras_msg_cb_ctx_t res = xbt_new(s_gras_msg_cb_ctx_t, 1);
+  res->expeditor = expe;
+  res->msgtype = msgtype;
+  res->ID = ID;
+  res->timeout = timeout;
+  res->answer_due = answer_due;
+
+  return res;
 }
+
 /* \brief Frees a message exchange context
  *
  * This function is mainly useful with \ref gras_msg_wait_or, ie seldom.
  */
-void gras_msg_cb_ctx_free(gras_msg_cb_ctx_t ctx) {
-       free(ctx);
+void gras_msg_cb_ctx_free(gras_msg_cb_ctx_t ctx)
+{
+  free(ctx);
 }
index 0922841..0bad57a 100644 (file)
  * FIXME: it could be cleaned up ?
  */
 typedef struct {
-       /* set headers */
-       unsigned int ID;
-       char        *name;
-       unsigned int name_len;
+  /* set headers */
+  unsigned int ID;
+  char *name;
+  unsigned int name_len;
 
-       /* queue storing the msgs got while msg_wait'ing for something else. Reuse them ASAP. */
-       xbt_dynar_t msg_queue; /* elm type: s_gras_msg_t */
+  /* queue storing the msgs got while msg_wait'ing for something else. Reuse them ASAP. */
+  xbt_dynar_t msg_queue;        /* elm type: s_gras_msg_t */
 
-       /* queue storing the msgs without callback got when handling. Feed them to wait() */
-       xbt_dynar_t msg_waitqueue; /* elm type: s_gras_msg_t */
+  /* queue storing the msgs without callback got when handling. Feed them to wait() */
+  xbt_dynar_t msg_waitqueue;    /* elm type: s_gras_msg_t */
 
-       /* registered callbacks for each message */
-       xbt_dynar_t cbl_list; /* elm type: gras_cblist_t */
+  /* registered callbacks for each message */
+  xbt_dynar_t cbl_list;         /* elm type: gras_cblist_t */
 
-       /* registered timers */
-       xbt_dynar_t timers; /* elm type: s_gras_timer_t */
+  /* registered timers */
+  xbt_dynar_t timers;           /* elm type: s_gras_timer_t */
 
-       /* queue storing the msgs that have to received and the process synchronization made (wait the surf action done) */
-       xbt_fifo_t msg_to_receive_queue; /* elm type: s_gras_msg_t */
-       xbt_fifo_t msg_to_receive_queue_meas; /* elm type: s_gras_msg_t */
-       xbt_queue_t msg_received;
+  /* queue storing the msgs that have to received and the process synchronization made (wait the surf action done) */
+  xbt_fifo_t msg_to_receive_queue;      /* elm type: s_gras_msg_t */
+  xbt_fifo_t msg_to_receive_queue_meas; /* elm type: s_gras_msg_t */
+  xbt_queue_t msg_received;
 
-} s_gras_msg_procdata_t,*gras_msg_procdata_t;
+} s_gras_msg_procdata_t, *gras_msg_procdata_t;
 
 
-void gras_msg_send_namev(gras_socket_t  sock,
-               const char    *namev,
-               void          *payload);
+void gras_msg_send_namev(gras_socket_t sock,
+                         const char *namev, void *payload);
 void gras_msg_listener_awake(void);
-void  gras_msg_listener_close_socket(int sd);
+void gras_msg_listener_close_socket(int sd);
 
 #define GRAS_PROTOCOL_VERSION '\1';
 
 
-#endif  /* GRAS_MSG_INTERFACE_H */
+#endif /* GRAS_MSG_INTERFACE_H */
index fca96b5..484bdd3 100644 (file)
@@ -37,11 +37,11 @@ extern const char *e_gras_msg_kind_names[e_gras_msg_kind_count];
 
 /* declare either regular messages or RPC or whatever */
 void
-gras_msgtype_declare_ext(const char           *name,
-               short int             version,
-               e_gras_msg_kind_t     kind,
-               gras_datadesc_type_t  payload_request,
-               gras_datadesc_type_t  payload_answer);
+gras_msgtype_declare_ext(const char *name,
+                         short int version,
+                         e_gras_msg_kind_t kind,
+                         gras_datadesc_type_t payload_request,
+                         gras_datadesc_type_t payload_answer);
 
 /**
  * gras_msgtype_t:
@@ -49,35 +49,32 @@ gras_msgtype_declare_ext(const char           *name,
  * Message type descriptor. There one of these for each registered version.
  */
 typedef struct s_gras_msgtype {
-       /* headers for the data set */
-       unsigned int   code;
-       char          *name;
-       unsigned int   name_len;
-
-       /* payload */
-       short int version;
-       e_gras_msg_kind_t kind;
-       gras_datadesc_type_t ctn_type;
-       gras_datadesc_type_t answer_type; /* only used for RPC */
+  /* headers for the data set */
+  unsigned int code;
+  char *name;
+  unsigned int name_len;
+
+  /* payload */
+  short int version;
+  e_gras_msg_kind_t kind;
+  gras_datadesc_type_t ctn_type;
+  gras_datadesc_type_t answer_type;     /* only used for RPC */
 } s_gras_msgtype_t;
 
-extern xbt_set_t _gras_msgtype_set; /* of gras_msgtype_t */
+extern xbt_set_t _gras_msgtype_set;     /* of gras_msgtype_t */
 void gras_msgtype_free(void *msgtype);
 
 
 /* functions to extract msg from socket or put it on wire (depend RL vs SG) */
-void gras_msg_recv(gras_socket_t   sock,
-               gras_msg_t      msg/*OUT*/);
-void gras_msg_send_ext(gras_socket_t   sock,
-               e_gras_msg_kind_t kind,
-               unsigned long int ID,
-               gras_msgtype_t  msgtype,
-               void           *payload);
+void gras_msg_recv(gras_socket_t sock, gras_msg_t msg /*OUT*/);
+void gras_msg_send_ext(gras_socket_t sock,
+                       e_gras_msg_kind_t kind,
+                       unsigned long int ID,
+                       gras_msgtype_t msgtype, void *payload);
 
 /* The thread in charge of receiving messages and queuing them */
 typedef struct s_gras_msg_listener_ *gras_msg_listener_t;
-gras_msg_listener_t
-gras_msg_listener_launch(xbt_queue_t msg_exchange);
+gras_msg_listener_t gras_msg_listener_launch(xbt_queue_t msg_exchange);
 /* The caller has the responsability to cleanup the queues himself */
 void gras_msg_listener_shutdown(gras_msg_listener_t);
 
@@ -87,12 +84,12 @@ void gras_msg_listener_shutdown(gras_msg_listener_t);
  * association between msg ID and cb list for a given process
  */
 struct s_gras_cblist {
-       long int id;
-       xbt_dynar_t cbs; /* of gras_msg_cb_t */
+  long int id;
+  xbt_dynar_t cbs;              /* of gras_msg_cb_t */
 };
 
 typedef struct s_gras_cblist gras_cblist_t;
-void gras_cbl_free(void *); /* used to free the memory at the end */
+void gras_cbl_free(void *);     /* used to free the memory at the end */
 void gras_cblist_free(void *cbl);
 
 /**
@@ -101,11 +98,11 @@ void gras_cblist_free(void *cbl);
  * Context associated to a given callback (to either regular message or RPC)
  */
 struct s_gras_msg_cb_ctx {
-       gras_socket_t expeditor;
-       gras_msgtype_t msgtype;
-       unsigned long int ID;
-       double timeout;
-       int answer_due; /* Whether the callback is expected to return a result (for sanity checks) */
+  gras_socket_t expeditor;
+  gras_msgtype_t msgtype;
+  unsigned long int ID;
+  double timeout;
+  int answer_due;               /* Whether the callback is expected to return a result (for sanity checks) */
 };
 typedef struct s_gras_msg_cb_ctx s_gras_msg_cb_ctx_t;
 
@@ -113,29 +110,28 @@ typedef struct s_gras_msg_cb_ctx s_gras_msg_cb_ctx_t;
  * * TIMER * *
  * ********* */
 typedef struct {
-       double expiry;
-       double period;
-       void_f_void_t action;
-       int repeat;
+  double expiry;
+  double period;
+  void_f_void_t action;
+  int repeat;
 } s_gras_timer_t, *gras_timer_t;
 
 /* returns 0 if it handled a timer, or the delay until next timer, or -1 if no armed timer */
 double gras_msg_timer_handle(void);
 
 gras_msg_cb_ctx_t gras_msg_cb_ctx_new(gras_socket_t expe,
-               gras_msgtype_t msgtype,
-               unsigned long int ID,
-               int answer_due,
-               double timeout);
+                                      gras_msgtype_t msgtype,
+                                      unsigned long int ID,
+                                      int answer_due, double timeout);
 
 
 
 /* We deploy a mallocator on the RPC contextes */
 #include "xbt/mallocator.h"
 extern xbt_mallocator_t gras_msg_ctx_mallocator;
-voidgras_msg_ctx_mallocator_new_f(void);
-void gras_msg_ctx_mallocator_free_f(voiddict);
-void gras_msg_ctx_mallocator_reset_f(voiddict);
+void *gras_msg_ctx_mallocator_new_f(void);
+void gras_msg_ctx_mallocator_free_f(void *dict);
+void gras_msg_ctx_mallocator_reset_f(void *dict);
 
 
-#endif  /* GRAS_MESSAGE_PRIVATE_H */
+#endif /* GRAS_MESSAGE_PRIVATE_H */
index 912b13a..143f6a1 100644 (file)
 XBT_LOG_EXTERNAL_CATEGORY(gras_msg);
 XBT_LOG_DEFAULT_CATEGORY(gras_msg);
 
-void gras_msg_send_ext(gras_socket_t   sock,
-               e_gras_msg_kind_t kind,
-               unsigned long int ID,
-               gras_msgtype_t  msgtype,
-               void           *payload) {
-
-       static gras_datadesc_type_t string_type=NULL;
-       static gras_datadesc_type_t ulong_type=NULL;
-       char c_kind=(char)kind;
-
-       xbt_assert0(msgtype,"Cannot send the NULL message");
-
-       if (!string_type) {
-               string_type = gras_datadesc_by_name("string");
-               xbt_assert(string_type);
-       }
-       if (!ulong_type) {
-               ulong_type = gras_datadesc_by_name("unsigned long int");
-               xbt_assert(ulong_type);
-       }
-
-       DEBUG3("send '%s' to %s:%d", msgtype->name,
-                       gras_socket_peer_name(sock),gras_socket_peer_port(sock));
-       gras_trp_send(sock, _GRAS_header, 6, 1 /* stable */);
-       gras_trp_send(sock, &c_kind,      1, 1 /* stable */);
-       switch (kind) {
-       case e_gras_msg_kind_oneway:
-               break;
-
-       case e_gras_msg_kind_rpccall:
-       case e_gras_msg_kind_rpcanswer:
-       case e_gras_msg_kind_rpcerror:
-               gras_datadesc_send(sock,ulong_type,&ID);
-               break;
-
-       default:
-               THROW1(unknown_error,0,"Unknown msg kind %d",kind);
-       }
-
-       gras_datadesc_send(sock, string_type,   &msgtype->name);
-       if (kind == e_gras_msg_kind_rpcerror) {
-               /* error on remote host, carfull, payload is an exception */
-               gras_datadesc_send(sock, gras_datadesc_by_name("ex_t"),payload);
-       } else if (kind == e_gras_msg_kind_rpcanswer) {
-               if (msgtype->answer_type)
-                       gras_datadesc_send(sock, msgtype->answer_type, payload);
-       }else {
-               /* regular message */
-               if (msgtype->ctn_type)
-                       gras_datadesc_send(sock, msgtype->ctn_type, payload);
-       }
-
-       gras_trp_flush(sock);
+void gras_msg_send_ext(gras_socket_t sock,
+                       e_gras_msg_kind_t kind,
+                       unsigned long int ID,
+                       gras_msgtype_t msgtype, void *payload)
+{
+
+  static gras_datadesc_type_t string_type = NULL;
+  static gras_datadesc_type_t ulong_type = NULL;
+  char c_kind = (char) kind;
+
+  xbt_assert0(msgtype, "Cannot send the NULL message");
+
+  if (!string_type) {
+    string_type = gras_datadesc_by_name("string");
+    xbt_assert(string_type);
+  }
+  if (!ulong_type) {
+    ulong_type = gras_datadesc_by_name("unsigned long int");
+    xbt_assert(ulong_type);
+  }
+
+  DEBUG3("send '%s' to %s:%d", msgtype->name,
+         gras_socket_peer_name(sock), gras_socket_peer_port(sock));
+  gras_trp_send(sock, _GRAS_header, 6, 1 /* stable */ );
+  gras_trp_send(sock, &c_kind, 1, 1 /* stable */ );
+  switch (kind) {
+  case e_gras_msg_kind_oneway:
+    break;
+
+  case e_gras_msg_kind_rpccall:
+  case e_gras_msg_kind_rpcanswer:
+  case e_gras_msg_kind_rpcerror:
+    gras_datadesc_send(sock, ulong_type, &ID);
+    break;
+
+  default:
+    THROW1(unknown_error, 0, "Unknown msg kind %d", kind);
+  }
+
+  gras_datadesc_send(sock, string_type, &msgtype->name);
+  if (kind == e_gras_msg_kind_rpcerror) {
+    /* error on remote host, carfull, payload is an exception */
+    gras_datadesc_send(sock, gras_datadesc_by_name("ex_t"), payload);
+  } else if (kind == e_gras_msg_kind_rpcanswer) {
+    if (msgtype->answer_type)
+      gras_datadesc_send(sock, msgtype->answer_type, payload);
+  else {
+    /* regular message */
+    if (msgtype->ctn_type)
+      gras_datadesc_send(sock, msgtype->ctn_type, payload);
+  }
+
+  gras_trp_flush(sock);
 }
 
 const char *hexa_str(unsigned char *data, int size, int downside);
@@ -77,113 +77,121 @@ const char *hexa_str(unsigned char *data, int size, int downside);
 /*
  * receive the next message on the given socket.
  */
-void
-gras_msg_recv(gras_socket_t    sock,
-               gras_msg_t       msg) {
-
-       xbt_ex_t e;
-       static gras_datadesc_type_t string_type=NULL;
-       static gras_datadesc_type_t ulong_type=NULL;
-       char header[6];
-       int cpt;
-       int r_arch;
-       char *msg_name=NULL;
-       char c_kind;
-
-       xbt_assert1(!gras_socket_is_meas(sock),
-                       "Asked to receive a message on the measurement socket %p", sock);
-       if (!string_type) {
-               string_type=gras_datadesc_by_name("string");
-               xbt_assert(string_type);
-       }
-       if (!ulong_type) {
-               ulong_type = gras_datadesc_by_name("unsigned long int");
-               xbt_assert(ulong_type);
-       }
-
-
-       TRY {
-               gras_trp_recv(sock, header, 6);
-               gras_trp_recv(sock, &c_kind, 1);
-               msg->kind=(e_gras_msg_kind_t)c_kind;
-       } CATCH(e) {
-               RETHROW0("Exception caught while trying to get the mesage header: %s");
-       }
-
-       for (cpt=0; cpt<4; cpt++)
-               if (header[cpt] != _GRAS_header[cpt])
-                       THROW2(mismatch_error,0,
-                                       "Incoming bytes do not look like a GRAS message (header='%s'  not '%.4s')",
-                                       hexa_str((unsigned char*)header,4,0),_GRAS_header);
-       if (header[4] != _GRAS_header[4])
-               THROW2(mismatch_error,0,"GRAS protocol mismatch (got %d, use %d)",
-                               (int)header[4], (int)_GRAS_header[4]);
-       r_arch = (int)header[5];
-
-       switch (msg->kind) {
-       case e_gras_msg_kind_oneway:
-               break;
-
-       case e_gras_msg_kind_rpccall:
-       case e_gras_msg_kind_rpcanswer:
-       case e_gras_msg_kind_rpcerror:
-               gras_datadesc_recv(sock,ulong_type,r_arch, &msg->ID);
-               break;
-
-       default:
-               THROW_IMPOSSIBLE;
-       }
-
-       gras_datadesc_recv(sock, string_type, r_arch, &msg_name);
-       DEBUG4("Handle an incoming message '%s' (%s) using protocol %d (remote is %s)",
-                       msg_name, e_gras_msg_kind_names[msg->kind], (int)header[4],gras_datadesc_arch_name(r_arch));
-
-       TRY {
-               msg->type = (gras_msgtype_t)xbt_set_get_by_name(_gras_msgtype_set,msg_name);
-       } CATCH(e) {
-               /* FIXME: Survive unknown messages */
-               if (e.category == not_found_error) {
-                       xbt_ex_free(e);
-                       THROW1(not_found_error,0, "Received an unknown message: %s (FIXME: should survive to these)", msg_name);
-               } else
-                       RETHROW1("Exception caught while retrieving the type associated to messages '%s' : %s",
-                                       msg_name);
-       }
-       free(msg_name);
-
-       if (msg->kind == e_gras_msg_kind_rpcerror) {
-               /* error on remote host. Carfull with that exception, eugene */
-               msg->payl_size=gras_datadesc_size(gras_datadesc_by_name("ex_t"));
-               msg->payl=xbt_malloc(msg->payl_size);
-               gras_datadesc_recv(sock, gras_datadesc_by_name("ex_t"), r_arch, msg->payl);
-
-       } else if  (msg->kind == e_gras_msg_kind_rpcanswer) {
-               /* answer to RPC */
-               if (msg->type->answer_type) {
-                       msg->payl_size=gras_datadesc_size(msg->type->answer_type);
-                       xbt_assert2(msg->payl_size > 0,
-                                       "%s %s",
-                                       "Dynamic array as payload is forbided for now (FIXME?).",
-                                       "Reference to dynamic array is allowed.");
-                       msg->payl = xbt_malloc(msg->payl_size);
-                       gras_datadesc_recv(sock, msg->type->answer_type, r_arch, msg->payl);
-               } else {
-                       msg->payl = NULL;
-                       msg->payl_size = 0;
-               }
-       } else {
-               /* regular message */
-               if (msg->type->ctn_type) {
-                       msg->payl_size=gras_datadesc_size(msg->type->ctn_type);
-                       xbt_assert2(msg->payl_size > 0,
-                                       "%s %s",
-                                       "Dynamic array as payload is forbided for now (FIXME?).",
-                                       "Reference to dynamic array is allowed.");
-                       msg->payl = xbt_malloc(msg->payl_size);
-                       gras_datadesc_recv(sock, msg->type->ctn_type, r_arch, msg->payl);
-               } else {
-                       msg->payl = NULL;
-                       msg->payl_size = 0;
-               }
-       }
+void gras_msg_recv(gras_socket_t sock, gras_msg_t msg)
+{
+
+  xbt_ex_t e;
+  static gras_datadesc_type_t string_type = NULL;
+  static gras_datadesc_type_t ulong_type = NULL;
+  char header[6];
+  int cpt;
+  int r_arch;
+  char *msg_name = NULL;
+  char c_kind;
+
+  xbt_assert1(!gras_socket_is_meas(sock),
+              "Asked to receive a message on the measurement socket %p",
+              sock);
+  if (!string_type) {
+    string_type = gras_datadesc_by_name("string");
+    xbt_assert(string_type);
+  }
+  if (!ulong_type) {
+    ulong_type = gras_datadesc_by_name("unsigned long int");
+    xbt_assert(ulong_type);
+  }
+
+
+  TRY {
+    gras_trp_recv(sock, header, 6);
+    gras_trp_recv(sock, &c_kind, 1);
+    msg->kind = (e_gras_msg_kind_t) c_kind;
+  }
+  CATCH(e) {
+    RETHROW0("Exception caught while trying to get the mesage header: %s");
+  }
+
+  for (cpt = 0; cpt < 4; cpt++)
+    if (header[cpt] != _GRAS_header[cpt])
+      THROW2(mismatch_error, 0,
+             "Incoming bytes do not look like a GRAS message (header='%s'  not '%.4s')",
+             hexa_str((unsigned char *) header, 4, 0), _GRAS_header);
+  if (header[4] != _GRAS_header[4])
+    THROW2(mismatch_error, 0, "GRAS protocol mismatch (got %d, use %d)",
+           (int) header[4], (int) _GRAS_header[4]);
+  r_arch = (int) header[5];
+
+  switch (msg->kind) {
+  case e_gras_msg_kind_oneway:
+    break;
+
+  case e_gras_msg_kind_rpccall:
+  case e_gras_msg_kind_rpcanswer:
+  case e_gras_msg_kind_rpcerror:
+    gras_datadesc_recv(sock, ulong_type, r_arch, &msg->ID);
+    break;
+
+  default:
+    THROW_IMPOSSIBLE;
+  }
+
+  gras_datadesc_recv(sock, string_type, r_arch, &msg_name);
+  DEBUG4
+    ("Handle an incoming message '%s' (%s) using protocol %d (remote is %s)",
+     msg_name, e_gras_msg_kind_names[msg->kind], (int) header[4],
+     gras_datadesc_arch_name(r_arch));
+
+  TRY {
+    msg->type =
+      (gras_msgtype_t) xbt_set_get_by_name(_gras_msgtype_set, msg_name);
+  } CATCH(e) {
+    /* FIXME: Survive unknown messages */
+    if (e.category == not_found_error) {
+      xbt_ex_free(e);
+      THROW1(not_found_error, 0,
+             "Received an unknown message: %s (FIXME: should survive to these)",
+             msg_name);
+    } else
+      RETHROW1
+        ("Exception caught while retrieving the type associated to messages '%s' : %s",
+         msg_name);
+  }
+  free(msg_name);
+
+  if (msg->kind == e_gras_msg_kind_rpcerror) {
+    /* error on remote host. Carfull with that exception, eugene */
+    msg->payl_size = gras_datadesc_size(gras_datadesc_by_name("ex_t"));
+    msg->payl = xbt_malloc(msg->payl_size);
+    gras_datadesc_recv(sock, gras_datadesc_by_name("ex_t"), r_arch,
+                       msg->payl);
+
+  } else if (msg->kind == e_gras_msg_kind_rpcanswer) {
+    /* answer to RPC */
+    if (msg->type->answer_type) {
+      msg->payl_size = gras_datadesc_size(msg->type->answer_type);
+      xbt_assert2(msg->payl_size > 0,
+                  "%s %s",
+                  "Dynamic array as payload is forbided for now (FIXME?).",
+                  "Reference to dynamic array is allowed.");
+      msg->payl = xbt_malloc(msg->payl_size);
+      gras_datadesc_recv(sock, msg->type->answer_type, r_arch, msg->payl);
+    } else {
+      msg->payl = NULL;
+      msg->payl_size = 0;
+    }
+  } else {
+    /* regular message */
+    if (msg->type->ctn_type) {
+      msg->payl_size = gras_datadesc_size(msg->type->ctn_type);
+      xbt_assert2(msg->payl_size > 0,
+                  "%s %s",
+                  "Dynamic array as payload is forbided for now (FIXME?).",
+                  "Reference to dynamic array is allowed.");
+      msg->payl = xbt_malloc(msg->payl_size);
+      gras_datadesc_recv(sock, msg->type->ctn_type, r_arch, msg->payl);
+    } else {
+      msg->payl = NULL;
+      msg->payl_size = 0;
+    }
+  }
 }
index 7d7ac05..8f59435 100644 (file)
@@ -12,7 +12,7 @@
 xbt_set_t _gras_rpctype_set = NULL;
 xbt_dynar_t _gras_rpc_cancelled = NULL;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_rpc,gras_msg,"RPC mecanism");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_rpc, gras_msg, "RPC mecanism");
 
 
 /** @brief declare a new versionned RPC type of the given name and payloads
@@ -25,13 +25,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_rpc,gras_msg,"RPC mecanism");
  * of messages.
  */
 void
-gras_msgtype_declare_rpc(const char           *name,
-               gras_datadesc_type_t  payload_request,
-               gras_datadesc_type_t  payload_answer) {
+gras_msgtype_declare_rpc(const char *name,
+                         gras_datadesc_type_t payload_request,
+                         gras_datadesc_type_t payload_answer)
+{
 
-       gras_msgtype_declare_ext(name, 0,
-                       e_gras_msg_kind_rpccall,
-                       payload_request, payload_answer);
+  gras_msgtype_declare_ext(name, 0,
+                           e_gras_msg_kind_rpccall,
+                           payload_request, payload_answer);
 
 }
 
@@ -51,163 +52,173 @@ gras_msgtype_declare_rpc(const char           *name,
  * message type, so you can register differents for each of them.
  */
 void
-gras_msgtype_declare_rpc_v(const char           *name,
-               short int             version,
-               gras_datadesc_type_t  payload_request,
-               gras_datadesc_type_t  payload_answer) {
+gras_msgtype_declare_rpc_v(const char *name,
+                           short int version,
+                           gras_datadesc_type_t payload_request,
+                           gras_datadesc_type_t payload_answer)
+{
 
-       gras_msgtype_declare_ext(name, version,
-                       e_gras_msg_kind_rpccall,
-                       payload_request, payload_answer);
+  gras_msgtype_declare_ext(name, version,
+                           e_gras_msg_kind_rpccall,
+                           payload_request, payload_answer);
 
 }
 
 static unsigned long int last_msg_ID = 0;
 
-static int msgfilter_rpcID(gras_msg_t msg, void* ctx) {
-       unsigned long int ID= *(unsigned long int*)ctx;
-       int res = msg->ID == ID &&
-       (msg->kind == e_gras_msg_kind_rpcanswer || msg->kind == e_gras_msg_kind_rpcerror);
-       unsigned int cursor;
-       gras_msg_cb_ctx_t rpc_ctx;
-
-
-       DEBUG5("Filter a message of ID %lu, type '%s' and kind '%s'. Waiting for ID=%lu. %s",
-                       msg->ID,msg->type->name,e_gras_msg_kind_names[msg->kind],ID,
-                       res?"take it": "reject");
-
-       if (res && !_gras_rpc_cancelled)
-               return res;
-
-       /* Check whether it is an old answer to a message we already canceled */
-       xbt_dynar_foreach(_gras_rpc_cancelled,cursor,rpc_ctx) {
-               if (msg->ID == rpc_ctx->ID && msg->kind==e_gras_msg_kind_rpcanswer) {
-                       VERB1("Got an answer to the already canceled (timeouted?) RPC %ld. Ignore it (leaking the payload!).",msg->ID);
-                       xbt_dynar_cursor_rm (_gras_rpc_cancelled, &cursor);
-                       return 1;
-               }
-       }
-
-       return res;
+static int msgfilter_rpcID(gras_msg_t msg, void *ctx)
+{
+  unsigned long int ID = *(unsigned long int *) ctx;
+  int res = msg->ID == ID &&
+    (msg->kind == e_gras_msg_kind_rpcanswer
+     || msg->kind == e_gras_msg_kind_rpcerror);
+  unsigned int cursor;
+  gras_msg_cb_ctx_t rpc_ctx;
+
+
+  DEBUG5
+    ("Filter a message of ID %lu, type '%s' and kind '%s'. Waiting for ID=%lu. %s",
+     msg->ID, msg->type->name, e_gras_msg_kind_names[msg->kind], ID,
+     res ? "take it" : "reject");
+
+  if (res && !_gras_rpc_cancelled)
+    return res;
+
+  /* Check whether it is an old answer to a message we already canceled */
+  xbt_dynar_foreach(_gras_rpc_cancelled, cursor, rpc_ctx) {
+    if (msg->ID == rpc_ctx->ID && msg->kind == e_gras_msg_kind_rpcanswer) {
+      VERB1
+        ("Got an answer to the already canceled (timeouted?) RPC %ld. Ignore it (leaking the payload!).",
+         msg->ID);
+      xbt_dynar_cursor_rm(_gras_rpc_cancelled, &cursor);
+      return 1;
+    }
+  }
+
+  return res;
 }
 
 /* Mallocator cruft */
 xbt_mallocator_t gras_msg_ctx_mallocator = NULL;
-void* gras_msg_ctx_mallocator_new_f(void) {
-       return xbt_new0(s_gras_msg_cb_ctx_t,1);
+void *gras_msg_ctx_mallocator_new_f(void)
+{
+  return xbt_new0(s_gras_msg_cb_ctx_t, 1);
 }
-void gras_msg_ctx_mallocator_free_f(void* ctx) {
-       xbt_free(ctx);
+
+void gras_msg_ctx_mallocator_free_f(void *ctx)
+{
+  xbt_free(ctx);
 }
-void gras_msg_ctx_mallocator_reset_f(void* ctx) {
-       memset(ctx, sizeof(s_gras_msg_cb_ctx_t),0);
+
+void gras_msg_ctx_mallocator_reset_f(void *ctx)
+{
+  memset(ctx, sizeof(s_gras_msg_cb_ctx_t), 0);
 }
 
 /** @brief Launch a RPC call, but do not block for the answer */
 gras_msg_cb_ctx_t
 gras_msg_rpc_async_call_(gras_socket_t server,
-               double timeOut,
-               gras_msgtype_t msgtype,
-               void *request) {
-       gras_msg_cb_ctx_t ctx = xbt_mallocator_get(gras_msg_ctx_mallocator);
-
-       if (msgtype->ctn_type) {
-               xbt_assert1(request,
-                               "RPC type '%s' convey a payload you must provide",
-                               msgtype->name);
-       } else {
-               xbt_assert1(!request,
-                               "No payload was declared for RPC type '%s'",
-                               msgtype->name);
-       }
-
-       ctx->ID = last_msg_ID++;
-       ctx->expeditor = server;
-       ctx->msgtype=msgtype;
-       ctx->timeout=timeOut;
-
-       VERB4("Send to %s:%d a RPC of type '%s' (ID=%lu)",
-                       gras_socket_peer_name(server),
-                       gras_socket_peer_port(server),
-                       msgtype->name,ctx->ID);
-
-       gras_msg_send_ext(server, e_gras_msg_kind_rpccall, ctx->ID, msgtype, request);
-
-       return ctx;
+                         double timeOut,
+                         gras_msgtype_t msgtype, void *request)
+{
+  gras_msg_cb_ctx_t ctx = xbt_mallocator_get(gras_msg_ctx_mallocator);
+
+  if (msgtype->ctn_type) {
+    xbt_assert1(request,
+                "RPC type '%s' convey a payload you must provide",
+                msgtype->name);
+  } else {
+    xbt_assert1(!request,
+                "No payload was declared for RPC type '%s'", msgtype->name);
+  }
+
+  ctx->ID = last_msg_ID++;
+  ctx->expeditor = server;
+  ctx->msgtype = msgtype;
+  ctx->timeout = timeOut;
+
+  VERB4("Send to %s:%d a RPC of type '%s' (ID=%lu)",
+        gras_socket_peer_name(server),
+        gras_socket_peer_port(server), msgtype->name, ctx->ID);
+
+  gras_msg_send_ext(server, e_gras_msg_kind_rpccall, ctx->ID, msgtype,
+                    request);
+
+  return ctx;
 }
 
 /** @brief Wait the answer of a RPC call previously launched asynchronously */
-void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx,
-               void *answer) {
-       xbt_ex_t e;
-       s_gras_msg_t received;
-
-       if (ctx->msgtype->answer_type) {
-               xbt_assert1(answer,
-                               "Answers to RPC '%s' convey a payload you must accept",
-                               ctx->msgtype->name);
-       } else {
-               xbt_assert1(!answer,
-                               "No payload was declared for answers to RPC '%s'",
-                               ctx->msgtype->name);
-       }
-
-       TRY {
-               /* The filter returns 1 when we eat an old RPC answer to something canceled */
-               do {
-                       gras_msg_wait_ext_(ctx->timeout,
-                                       ctx->msgtype, NULL, msgfilter_rpcID, &ctx->ID,
-                                       &received);
-               } while (received.ID != ctx->ID);
-
-       } CATCH(e) {
-               if (!_gras_rpc_cancelled)
-                       _gras_rpc_cancelled = xbt_dynar_new(sizeof(ctx),NULL);
-               xbt_dynar_push(_gras_rpc_cancelled,&ctx);
-               INFO5("canceled RPC %ld pushed onto the stack (%s from %s:%d) Reason: %s",
-                               ctx->ID,ctx->msgtype->name,
-                               gras_socket_peer_name(ctx->expeditor),gras_socket_peer_port(ctx->expeditor),
-                               e.msg);
-               RETHROW;
-       }
-
-       xbt_mallocator_release(gras_msg_ctx_mallocator, ctx);
-       if (received.kind == e_gras_msg_kind_rpcerror) {
-               xbt_ex_t e;
-               memcpy(&e,received.payl,received.payl_size);
-               free(received.payl);
-               VERB3("Raise a remote exception cat:%d comming from %s (%s)",
-                               e.category, e.host, e.msg);
-               __xbt_ex_ctx()->ctx_ex.msg      = e.msg;
-               __xbt_ex_ctx()->ctx_ex.category = e.category;
-               __xbt_ex_ctx()->ctx_ex.value    = e.value;
-               __xbt_ex_ctx()->ctx_ex.remote   = 1;
-               __xbt_ex_ctx()->ctx_ex.host     = e.host;
-               __xbt_ex_ctx()->ctx_ex.procname = e.procname;
-               __xbt_ex_ctx()->ctx_ex.pid      = e.pid;
-               __xbt_ex_ctx()->ctx_ex.file     = e.file;
-               __xbt_ex_ctx()->ctx_ex.line     = e.line;
-               __xbt_ex_ctx()->ctx_ex.func     = e.func;
-               __xbt_ex_ctx()->ctx_ex.used     = e.used;
-               __xbt_ex_ctx()->ctx_ex.bt_strings = e.bt_strings;
-               memset(&__xbt_ex_ctx()->ctx_ex.bt,0,
-                               sizeof(__xbt_ex_ctx()->ctx_ex.bt));
-               DO_THROW(__xbt_ex_ctx()->ctx_ex);
-       }
-       memcpy(answer,received.payl,received.payl_size);
-       free(received.payl);
+void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
+{
+  xbt_ex_t e;
+  s_gras_msg_t received;
+
+  if (ctx->msgtype->answer_type) {
+    xbt_assert1(answer,
+                "Answers to RPC '%s' convey a payload you must accept",
+                ctx->msgtype->name);
+  } else {
+    xbt_assert1(!answer,
+                "No payload was declared for answers to RPC '%s'",
+                ctx->msgtype->name);
+  }
+
+  TRY {
+    /* The filter returns 1 when we eat an old RPC answer to something canceled */
+    do {
+      gras_msg_wait_ext_(ctx->timeout,
+                         ctx->msgtype, NULL, msgfilter_rpcID, &ctx->ID,
+                         &received);
+    } while (received.ID != ctx->ID);
+
+  }
+  CATCH(e) {
+    if (!_gras_rpc_cancelled)
+      _gras_rpc_cancelled = xbt_dynar_new(sizeof(ctx), NULL);
+    xbt_dynar_push(_gras_rpc_cancelled, &ctx);
+    INFO5("canceled RPC %ld pushed onto the stack (%s from %s:%d) Reason: %s",
+          ctx->ID, ctx->msgtype->name,
+          gras_socket_peer_name(ctx->expeditor),
+          gras_socket_peer_port(ctx->expeditor), e.msg);
+    RETHROW;
+  }
+
+  xbt_mallocator_release(gras_msg_ctx_mallocator, ctx);
+  if (received.kind == e_gras_msg_kind_rpcerror) {
+    xbt_ex_t e;
+    memcpy(&e, received.payl, received.payl_size);
+    free(received.payl);
+    VERB3("Raise a remote exception cat:%d comming from %s (%s)",
+          e.category, e.host, e.msg);
+    __xbt_ex_ctx()->ctx_ex.msg = e.msg;
+    __xbt_ex_ctx()->ctx_ex.category = e.category;
+    __xbt_ex_ctx()->ctx_ex.value = e.value;
+    __xbt_ex_ctx()->ctx_ex.remote = 1;
+    __xbt_ex_ctx()->ctx_ex.host = e.host;
+    __xbt_ex_ctx()->ctx_ex.procname = e.procname;
+    __xbt_ex_ctx()->ctx_ex.pid = e.pid;
+    __xbt_ex_ctx()->ctx_ex.file = e.file;
+    __xbt_ex_ctx()->ctx_ex.line = e.line;
+    __xbt_ex_ctx()->ctx_ex.func = e.func;
+    __xbt_ex_ctx()->ctx_ex.used = e.used;
+    __xbt_ex_ctx()->ctx_ex.bt_strings = e.bt_strings;
+    memset(&__xbt_ex_ctx()->ctx_ex.bt, 0, sizeof(__xbt_ex_ctx()->ctx_ex.bt));
+    DO_THROW(__xbt_ex_ctx()->ctx_ex);
+  }
+  memcpy(answer, received.payl, received.payl_size);
+  free(received.payl);
 }
 
 /** @brief Conduct a RPC call */
 void gras_msg_rpccall_(gras_socket_t server,
-               double timeout,
-               gras_msgtype_t msgtype,
-               void *request, void *answer) {
+                       double timeout,
+                       gras_msgtype_t msgtype, void *request, void *answer)
+{
 
-       gras_msg_cb_ctx_t ctx;
+  gras_msg_cb_ctx_t ctx;
 
-       ctx = gras_msg_rpc_async_call_(server, timeout,msgtype,request);
-       gras_msg_rpc_async_wait(ctx, answer);
+  ctx = gras_msg_rpc_async_call_(server, timeout, msgtype, request);
+  gras_msg_rpc_async_wait(ctx, answer);
 }
 
 
@@ -217,15 +228,15 @@ void gras_msg_rpccall_(gras_socket_t server,
  * some cleanups before leaving.
  */
 
-void gras_msg_rpcreturn(double timeOut,gras_msg_cb_ctx_t ctx,void *answer) {
-       xbt_assert0(ctx->answer_due,
-                       "RPC return not allowed here. Either not a RPC message or already returned a result");
-       ctx->answer_due = 0;
-       DEBUG5("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)",
-                       ctx->msgtype->name,
-                       gras_socket_peer_name(ctx->expeditor),gras_socket_peer_port(ctx->expeditor),
-                       timeOut,answer);
-       gras_msg_send_ext(ctx->expeditor, e_gras_msg_kind_rpcanswer,
-                       ctx->ID, ctx->msgtype, answer);
+void gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx, void *answer)
+{
+  xbt_assert0(ctx->answer_due,
+              "RPC return not allowed here. Either not a RPC message or already returned a result");
+  ctx->answer_due = 0;
+  DEBUG5("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)",
+         ctx->msgtype->name,
+         gras_socket_peer_name(ctx->expeditor),
+         gras_socket_peer_port(ctx->expeditor), timeOut, answer);
+  gras_msg_send_ext(ctx->expeditor, e_gras_msg_kind_rpcanswer, ctx->ID,
+                    ctx->msgtype, answer);
 }
-
index 779fa96..1afb8aa 100644 (file)
 
 #include "gras/DataDesc/datadesc_interface.h"
 #include "gras/Transport/transport_interface.h" /* gras_trp_chunk_send/recv */
-#include "gras/Transport/transport_private.h" /* sock->data */
+#include "gras/Transport/transport_private.h"   /* sock->data */
 
 XBT_LOG_EXTERNAL_CATEGORY(gras_msg);
 XBT_LOG_DEFAULT_CATEGORY(gras_msg);
 
-typedef voidgras_trp_bufdata_;
-
-void gras_msg_send_ext(gras_socket_t   sock,
-               e_gras_msg_kind_t kind,
-               unsigned long int ID,
-               gras_msgtype_t  msgtype,
-               void           *payload) {
-
-       smx_action_t act; /* simix action */
-       gras_trp_sg_sock_data_t *sock_data;
-       gras_hostdata_t *hd;
-       gras_trp_procdata_t trp_remote_proc;
-       gras_msg_procdata_t msg_remote_proc;
-       gras_msg_t msg; /* message to send */
-       int whole_payload_size=0; /* msg->payload_size is used to memcpy the payload.
-                               This is used to report the load onto the simulator. It also counts the size of pointed stuff */
-
-       sock_data = (gras_trp_sg_sock_data_t *)sock->data;
-
-       hd = (gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
-
-       xbt_assert1(!gras_socket_is_meas(sock),
-                       "Asked to send a message on the measurement socket %p", sock);
-
-       /*initialize gras message */
-       msg = xbt_new(s_gras_msg_t,1);
-       msg->expe = sock;
-       msg->kind = kind;
-       msg->type = msgtype;
-       msg->ID = ID;
-       if (kind == e_gras_msg_kind_rpcerror) {
-               /* error on remote host, carfull, payload is an exception */
-               msg->payl_size=gras_datadesc_size(gras_datadesc_by_name("ex_t"));
-               msg->payl=xbt_malloc(msg->payl_size);
-               whole_payload_size = gras_datadesc_memcpy(gras_datadesc_by_name("ex_t"),
-                               payload,msg->payl);
-       } else if (kind == e_gras_msg_kind_rpcanswer) {
-               msg->payl_size=gras_datadesc_size(msgtype->answer_type);
-               if (msg->payl_size)
-                       msg->payl=xbt_malloc(msg->payl_size);
-               else
-                       msg->payl=NULL;
-
-               if (msgtype->answer_type)
-                       whole_payload_size = gras_datadesc_memcpy(msgtype->answer_type,
-                                       payload, msg->payl);
-       } else {
-               msg->payl_size=gras_datadesc_size(msgtype->ctn_type);
-               msg->payl=msg->payl_size?xbt_malloc(msg->payl_size):NULL;
-               if (msgtype->ctn_type)
-                       whole_payload_size = gras_datadesc_memcpy(msgtype->ctn_type,
-                                       payload, msg->payl);
-       }
-
-       /* put the selectable socket on the queue */
-       trp_remote_proc = (gras_trp_procdata_t)
-       gras_libdata_by_name_from_remote("gras_trp",sock_data->to_process);
-
-       xbt_queue_push(trp_remote_proc->msg_selectable_sockets,&sock);
-
-       /* put message on msg_queue */
-       msg_remote_proc = (gras_msg_procdata_t)
-       gras_libdata_by_name_from_remote("gras_msg",sock_data->to_process);
-       xbt_fifo_push(msg_remote_proc->msg_to_receive_queue,msg);
-
-       /* wait for the receiver */
-       SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
-
-       /* creates simix action and waits its ends, waits in the sender host
-     condition*/
-       act = SIMIX_action_communicate(SIMIX_host_self(),
-                       sock_data->to_host,msgtype->name,
-                       (double)whole_payload_size, -1);
-       SIMIX_register_action_to_condition(act,sock_data->cond);
-
-       VERB5("Sending to %s(%s) a message type '%s' kind '%s' ID %lu",
-                       SIMIX_host_get_name(sock_data->to_host),
-                       SIMIX_process_get_name(sock_data->to_process),
-                       msg->type->name,e_gras_msg_kind_names[msg->kind], msg->ID);
-
-       SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
-       SIMIX_unregister_action_to_condition(act,sock_data->cond);
-       /* error treatmeant (FIXME)*/
-
-       /* cleanup structures */
-       SIMIX_action_destroy(act);
-       SIMIX_mutex_unlock(sock_data->mutex);
-
-       VERB0("Message sent");
+typedef void *gras_trp_bufdata_;
+
+void gras_msg_send_ext(gras_socket_t sock,
+                       e_gras_msg_kind_t kind,
+                       unsigned long int ID,
+                       gras_msgtype_t msgtype, void *payload)
+{
+
+  smx_action_t act;             /* simix action */
+  gras_trp_sg_sock_data_t *sock_data;
+  gras_hostdata_t *hd;
+  gras_trp_procdata_t trp_remote_proc;
+  gras_msg_procdata_t msg_remote_proc;
+  gras_msg_t msg;               /* message to send */
+  int whole_payload_size = 0;   /* msg->payload_size is used to memcpy the payload.
+                                   This is used to report the load onto the simulator. It also counts the size of pointed stuff */
+
+  sock_data = (gras_trp_sg_sock_data_t *) sock->data;
+
+  hd = (gras_hostdata_t *) SIMIX_host_get_data(SIMIX_host_self());
+
+  xbt_assert1(!gras_socket_is_meas(sock),
+              "Asked to send a message on the measurement socket %p", sock);
+
+  /*initialize gras message */
+  msg = xbt_new(s_gras_msg_t, 1);
+  msg->expe = sock;
+  msg->kind = kind;
+  msg->type = msgtype;
+  msg->ID = ID;
+  if (kind == e_gras_msg_kind_rpcerror) {
+    /* error on remote host, carfull, payload is an exception */
+    msg->payl_size = gras_datadesc_size(gras_datadesc_by_name("ex_t"));
+    msg->payl = xbt_malloc(msg->payl_size);
+    whole_payload_size = gras_datadesc_memcpy(gras_datadesc_by_name("ex_t"),
+                                              payload, msg->payl);
+  } else if (kind == e_gras_msg_kind_rpcanswer) {
+    msg->payl_size = gras_datadesc_size(msgtype->answer_type);
+    if (msg->payl_size)
+      msg->payl = xbt_malloc(msg->payl_size);
+    else
+      msg->payl = NULL;
+
+    if (msgtype->answer_type)
+      whole_payload_size = gras_datadesc_memcpy(msgtype->answer_type,
+                                                payload, msg->payl);
+  } else {
+    msg->payl_size = gras_datadesc_size(msgtype->ctn_type);
+    msg->payl = msg->payl_size ? xbt_malloc(msg->payl_size) : NULL;
+    if (msgtype->ctn_type)
+      whole_payload_size = gras_datadesc_memcpy(msgtype->ctn_type,
+                                                payload, msg->payl);
+  }
+
+  /* put the selectable socket on the queue */
+  trp_remote_proc = (gras_trp_procdata_t)
+    gras_libdata_by_name_from_remote("gras_trp", sock_data->to_process);
+
+  xbt_queue_push(trp_remote_proc->msg_selectable_sockets, &sock);
+
+  /* put message on msg_queue */
+  msg_remote_proc = (gras_msg_procdata_t)
+    gras_libdata_by_name_from_remote("gras_msg", sock_data->to_process);
+  xbt_fifo_push(msg_remote_proc->msg_to_receive_queue, msg);
+
+  /* wait for the receiver */
+  SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
+
+  /* creates simix action and waits its ends, waits in the sender host
+     condition */
+  act = SIMIX_action_communicate(SIMIX_host_self(),
+                                 sock_data->to_host, msgtype->name,
+                                 (double) whole_payload_size, -1);
+  SIMIX_register_action_to_condition(act, sock_data->cond);
+
+  VERB5("Sending to %s(%s) a message type '%s' kind '%s' ID %lu",
+        SIMIX_host_get_name(sock_data->to_host),
+        SIMIX_process_get_name(sock_data->to_process),
+        msg->type->name, e_gras_msg_kind_names[msg->kind], msg->ID);
+
+  SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
+  SIMIX_unregister_action_to_condition(act, sock_data->cond);
+  /* error treatmeant (FIXME) */
+
+  /* cleanup structures */
+  SIMIX_action_destroy(act);
+  SIMIX_mutex_unlock(sock_data->mutex);
+
+  VERB0("Message sent");
 
 }
+
 /*
  * receive the next message on the given socket.
  */
-void
-gras_msg_recv(gras_socket_t    sock,
-               gras_msg_t       msg) {
-
-       gras_trp_sg_sock_data_t *sock_data;
-       gras_trp_sg_sock_data_t *remote_sock_data;
-       gras_hostdata_t *remote_hd;
-       gras_msg_t msg_got;
-       gras_msg_procdata_t msg_procdata =
-               (gras_msg_procdata_t)gras_libdata_by_name("gras_msg");
-
-       xbt_assert1(!gras_socket_is_meas(sock),
-                       "Asked to receive a message on the measurement socket %p", sock);
-
-       xbt_assert0(msg,"msg is an out parameter of gras_msg_recv...");
-
-       sock_data = (gras_trp_sg_sock_data_t *)sock->data;
-       remote_sock_data = ((gras_trp_sg_sock_data_t *)sock->data)->to_socket->data;
-       DEBUG3("Remote host %s, Remote Port: %d Local port %d",
-                       SIMIX_host_get_name(sock_data->to_host), sock->peer_port, sock->port);
-       remote_hd = (gras_hostdata_t *)SIMIX_host_get_data(sock_data->to_host);
-
-       if (xbt_fifo_size(msg_procdata->msg_to_receive_queue) == 0 ) {
-               THROW_IMPOSSIBLE;
-       }
-       DEBUG1("Size msg_to_receive buffer: %d",
-                       xbt_fifo_size(msg_procdata->msg_to_receive_queue));
-       msg_got = xbt_fifo_shift(msg_procdata->msg_to_receive_queue);
-
-       SIMIX_mutex_lock(remote_sock_data->mutex);
-       /* ok, I'm here, you can continuate the communication */
-       SIMIX_cond_signal(remote_sock_data->cond);
-
-       /* wait for communication end */
-       SIMIX_cond_wait(remote_sock_data->cond,remote_sock_data->mutex);
-
-       msg_got->expe= msg->expe;
-       memcpy(msg,msg_got,sizeof(s_gras_msg_t));
-       xbt_free(msg_got);
-       SIMIX_mutex_unlock(remote_sock_data->mutex);
-
-       VERB3("Received a message type '%s' kind '%s' ID %lu",// from %s",
-                       msg->type->name,
-                       e_gras_msg_kind_names[msg->kind],
-                       msg->ID);
+void gras_msg_recv(gras_socket_t sock, gras_msg_t msg)
+{
+
+  gras_trp_sg_sock_data_t *sock_data;
+  gras_trp_sg_sock_data_t *remote_sock_data;
+  gras_hostdata_t *remote_hd;
+  gras_msg_t msg_got;
+  gras_msg_procdata_t msg_procdata =
+    (gras_msg_procdata_t) gras_libdata_by_name("gras_msg");
+
+  xbt_assert1(!gras_socket_is_meas(sock),
+              "Asked to receive a message on the measurement socket %p",
+              sock);
+
+  xbt_assert0(msg, "msg is an out parameter of gras_msg_recv...");
+
+  sock_data = (gras_trp_sg_sock_data_t *) sock->data;
+  remote_sock_data =
+    ((gras_trp_sg_sock_data_t *) sock->data)->to_socket->data;
+  DEBUG3("Remote host %s, Remote Port: %d Local port %d",
+         SIMIX_host_get_name(sock_data->to_host), sock->peer_port,
+         sock->port);
+  remote_hd = (gras_hostdata_t *) SIMIX_host_get_data(sock_data->to_host);
+
+  if (xbt_fifo_size(msg_procdata->msg_to_receive_queue) == 0) {
+    THROW_IMPOSSIBLE;
+  }
+  DEBUG1("Size msg_to_receive buffer: %d",
+         xbt_fifo_size(msg_procdata->msg_to_receive_queue));
+  msg_got = xbt_fifo_shift(msg_procdata->msg_to_receive_queue);
+
+  SIMIX_mutex_lock(remote_sock_data->mutex);
+  /* ok, I'm here, you can continuate the communication */
+  SIMIX_cond_signal(remote_sock_data->cond);
+
+  /* wait for communication end */
+  SIMIX_cond_wait(remote_sock_data->cond, remote_sock_data->mutex);
+
+  msg_got->expe = msg->expe;
+  memcpy(msg, msg_got, sizeof(s_gras_msg_t));
+  xbt_free(msg_got);
+  SIMIX_mutex_unlock(remote_sock_data->mutex);
+
+  VERB3("Received a message type '%s' kind '%s' ID %lu",        // from %s",
+        msg->type->name, e_gras_msg_kind_names[msg->kind], msg->ID);
 }
index f68376f..2975778 100644 (file)
 #include "gras/Virtu/virtu_interface.h"
 
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_timer,gras,
-               "Delayed and repetitive actions");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_timer, gras,
+                                "Delayed and repetitive actions");
 
 /** @brief Request \a action to be called once in \a delay seconds */
-void gras_timer_delay(double delay, void_f_void_t action) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-
-       gras_timer_t timer = xbt_dynar_push_ptr(pd->timers);
-
-       VERB1("Register delayed action %p", action);
-       timer->period = delay;
-       timer->expiry = delay+gras_os_time();
-       timer->action = action;
-       timer->repeat = FALSE;
+void gras_timer_delay(double delay, void_f_void_t action)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+
+  gras_timer_t timer = xbt_dynar_push_ptr(pd->timers);
+
+  VERB1("Register delayed action %p", action);
+  timer->period = delay;
+  timer->expiry = delay + gras_os_time();
+  timer->action = action;
+  timer->repeat = FALSE;
 }
 
 /** @brief Request \a action to be called every \a interval seconds */
-void gras_timer_repeat(double interval, void_f_void_t action) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-
-       gras_timer_t timer = xbt_dynar_push_ptr(pd->timers);
-
-       VERB1("Register repetitive action %p", action);
-       timer->period = interval;
-       timer->expiry = interval+gras_os_time();
-       timer->action = action;
-       timer->repeat = TRUE;
+void gras_timer_repeat(double interval, void_f_void_t action)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+
+  gras_timer_t timer = xbt_dynar_push_ptr(pd->timers);
+
+  VERB1("Register repetitive action %p", action);
+  timer->period = interval;
+  timer->expiry = interval + gras_os_time();
+  timer->action = action;
+  timer->repeat = TRUE;
 }
 
 /** @brief Cancel a delayed task */
-void gras_timer_cancel_delay(double interval, void_f_void_t action) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       unsigned int cursor;
-       int found;
-       s_gras_timer_t timer;
-
-       found = FALSE;
-       xbt_dynar_foreach(pd->timers,cursor,timer){
-               if (timer.repeat == FALSE    &&
-                               timer.period == interval &&
-                               timer.action == action) {
-
-                       found = TRUE;
-                       xbt_dynar_cursor_rm(pd->timers, &cursor);
-               }
-       }
-
-       if (!found)
-               THROW2(mismatch_error,0,"Cannot remove the action %p delayed of %f second: not found",
-                               action,interval);
+void gras_timer_cancel_delay(double interval, void_f_void_t action)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  unsigned int cursor;
+  int found;
+  s_gras_timer_t timer;
+
+  found = FALSE;
+  xbt_dynar_foreach(pd->timers, cursor, timer) {
+    if (timer.repeat == FALSE &&
+        timer.period == interval && timer.action == action) {
+
+      found = TRUE;
+      xbt_dynar_cursor_rm(pd->timers, &cursor);
+    }
+  }
+
+  if (!found)
+    THROW2(mismatch_error, 0,
+           "Cannot remove the action %p delayed of %f second: not found",
+           action, interval);
 
 }
 
 /** @brief Cancel a repetitive task */
-void gras_timer_cancel_repeat(double interval, void_f_void_t action) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       unsigned int cursor;
-       int found;
-       s_gras_timer_t timer;
-
-       found = FALSE;
-       xbt_dynar_foreach(pd->timers,cursor,timer){
-               if (timer.repeat == TRUE     &&
-                               timer.period == interval &&
-                               timer.action == action) {
-
-                       found = TRUE;
-                       xbt_dynar_cursor_rm(pd->timers, &cursor);
-               }
-       }
-
-       if (!found)
-               THROW2(mismatch_error,0,"Cannot remove the action %p delayed of %f second: not found",
-                               action,interval);
+void gras_timer_cancel_repeat(double interval, void_f_void_t action)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  unsigned int cursor;
+  int found;
+  s_gras_timer_t timer;
+
+  found = FALSE;
+  xbt_dynar_foreach(pd->timers, cursor, timer) {
+    if (timer.repeat == TRUE &&
+        timer.period == interval && timer.action == action) {
+
+      found = TRUE;
+      xbt_dynar_cursor_rm(pd->timers, &cursor);
+    }
+  }
+
+  if (!found)
+    THROW2(mismatch_error, 0,
+           "Cannot remove the action %p delayed of %f second: not found",
+           action, interval);
 }
 
 /** @brief Cancel all delayed tasks */
-void gras_timer_cancel_delay_all(void) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       unsigned int cursor;
-       int found;
-       s_gras_timer_t timer;
-
-       found = FALSE;
-       xbt_dynar_foreach(pd->timers,cursor,timer){
-               if (timer.repeat   == FALSE) {
-
-                       found = TRUE;
-                       xbt_dynar_cursor_rm(pd->timers, &cursor);
-               }
-       }
-
-       if (!found)
-               THROW0(mismatch_error,0,"No delayed action to remove");
+void gras_timer_cancel_delay_all(void)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  unsigned int cursor;
+  int found;
+  s_gras_timer_t timer;
+
+  found = FALSE;
+  xbt_dynar_foreach(pd->timers, cursor, timer) {
+    if (timer.repeat == FALSE) {
+
+      found = TRUE;
+      xbt_dynar_cursor_rm(pd->timers, &cursor);
+    }
+  }
+
+  if (!found)
+    THROW0(mismatch_error, 0, "No delayed action to remove");
 
 }
 
 /** @brief Cancel all repetitive tasks */
-void gras_timer_cancel_repeat_all(void){
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       unsigned int cursor;
-       int found;
-       s_gras_timer_t timer;
-
-       found = FALSE;
-       xbt_dynar_foreach(pd->timers,cursor,timer){
-               if (timer.repeat   == FALSE) {
-
-                       found = TRUE;
-                       xbt_dynar_cursor_rm(pd->timers, &cursor);
-               }
-       }
-
-       if (!found)
-               THROW0(mismatch_error,0,"No repetitive action to remove");
+void gras_timer_cancel_repeat_all(void)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  unsigned int cursor;
+  int found;
+  s_gras_timer_t timer;
+
+  found = FALSE;
+  xbt_dynar_foreach(pd->timers, cursor, timer) {
+    if (timer.repeat == FALSE) {
+
+      found = TRUE;
+      xbt_dynar_cursor_rm(pd->timers, &cursor);
+    }
+  }
+
+  if (!found)
+    THROW0(mismatch_error, 0, "No repetitive action to remove");
 }
 
 /** @brief Cancel all delayed and repetitive tasks */
-void gras_timer_cancel_all(void) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       xbt_dynar_reset( pd->timers );
+void gras_timer_cancel_all(void)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  xbt_dynar_reset(pd->timers);
 }
 
 
 /* returns 0 if it handled a timer, or the delay until next timer, or -1 if no armed timer */
-double gras_msg_timer_handle(void) {
-       gras_msg_procdata_t pd=(gras_msg_procdata_t)gras_libdata_by_id(gras_msg_libdata_id);
-       unsigned int cursor;
-       gras_timer_t timer;
-       double now=gras_os_time();
-       double untilnext = -1.0;
-
-       for (cursor=0; cursor < xbt_dynar_length(pd->timers); cursor++) {
-               double untilthis;
-
-               timer = xbt_dynar_get_ptr (pd->timers, cursor);
-               untilthis = timer->expiry - now;
-
-               DEBUG2("Action %p expires in %f", timer->action, untilthis);
-
-               if (untilthis <= 0.0) {
-                       void_f_void_t action = timer->action;
-
-                       DEBUG5("[%.0f] Serve %s action %p (%f<%f)",gras_os_time(),
-                                       timer->repeat ? "repetitive" : "delayed", timer->action,
-                                                       timer->expiry, now);
-
-                       if (timer->repeat) {
-                               timer->expiry = now + timer->period;
-                               DEBUG4("[%.0f] Re-arm repetitive action %p for %f (period=%f)",
-                                               gras_os_time(),
-                                               timer->action, timer->expiry, timer->period);
-                       } else {
-                               DEBUG2("[%.0f] Remove %p now that it's done", gras_os_time(), timer->action);
-                               xbt_dynar_cursor_rm(pd->timers, &cursor);
-                       }
-                       (*action)();
-                       return 0.0;
-               } else if (untilthis < untilnext || untilnext == -1) {
-                       untilnext = untilthis;
-               }
-       }
-       return untilnext;
+double gras_msg_timer_handle(void)
+{
+  gras_msg_procdata_t pd =
+    (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id);
+  unsigned int cursor;
+  gras_timer_t timer;
+  double now = gras_os_time();
+  double untilnext = -1.0;
+
+  for (cursor = 0; cursor < xbt_dynar_length(pd->timers); cursor++) {
+    double untilthis;
+
+    timer = xbt_dynar_get_ptr(pd->timers, cursor);
+    untilthis = timer->expiry - now;
+
+    DEBUG2("Action %p expires in %f", timer->action, untilthis);
+
+    if (untilthis <= 0.0) {
+      void_f_void_t action = timer->action;
+
+      DEBUG5("[%.0f] Serve %s action %p (%f<%f)", gras_os_time(),
+             timer->repeat ? "repetitive" : "delayed", timer->action,
+             timer->expiry, now);
+
+      if (timer->repeat) {
+        timer->expiry = now + timer->period;
+        DEBUG4("[%.0f] Re-arm repetitive action %p for %f (period=%f)",
+               gras_os_time(), timer->action, timer->expiry, timer->period);
+      } else {
+        DEBUG2("[%.0f] Remove %p now that it's done", gras_os_time(),
+               timer->action);
+        xbt_dynar_cursor_rm(pd->timers, &cursor);
+      }
+      (*action) ();
+      return 0.0;
+    } else if (untilthis < untilnext || untilnext == -1) {
+      untilnext = untilthis;
+    }
+  }
+  return untilnext;
 }
index 77b1d79..395137f 100644 (file)
@@ -25,8 +25,10 @@ gras_socket_t _gras_lastly_selected_socket = NULL;
  *
  * if timeout>0 and no message there, wait at most that amount of time before giving up.
  */
-gras_socket_t gras_trp_select(double timeout) {
-  xbt_dynar_t sockets= ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->sockets;
+gras_socket_t gras_trp_select(double timeout)
+{
+  xbt_dynar_t sockets =
+    ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->sockets;
   int done = -1;
   double wakeup = gras_os_time() + timeout;
   double now = 0;
@@ -34,87 +36,89 @@ gras_socket_t gras_trp_select(double timeout) {
   /*  static int nextToService = 0; */
   struct timeval tout, *p_tout;
 
-  int max_fds=0; /* first arg of select: number of existing sockets */
+  int max_fds = 0;              /* first arg of select: number of existing sockets */
   /* but accept() of winsock returns sockets bigger than the limit, so don't bother 
      with this tiny optimisation on BillWare */
   fd_set FDS;
-  int ready; /* return of select: number of socket ready to be serviced */
-  static int fd_setsize=-1; /* FD_SETSIZE not always defined. Get this portably */
+  int ready;                    /* return of select: number of socket ready to be serviced */
+  static int fd_setsize = -1;   /* FD_SETSIZE not always defined. Get this portably */
 
-  gras_socket_t sock_iter; /* iterating over all sockets */
-  unsigned int cursor;     /* iterating over all sockets */
+  gras_socket_t sock_iter;      /* iterating over all sockets */
+  unsigned int cursor;          /* iterating over all sockets */
 
   /* Check whether there is more data to read from the socket we selected last time.
      This can happen with tcp buffered sockets since we try to get as much data as we can for them */
   if (_gras_lastly_selected_socket && _gras_lastly_selected_socket->moredata) {
-     VERB0("Returning _gras_lastly_selected_socket since there is more data on it");
-     return _gras_lastly_selected_socket;
+    VERB0
+      ("Returning _gras_lastly_selected_socket since there is more data on it");
+    return _gras_lastly_selected_socket;
   }
-  
+
   /* Compute FD_SETSIZE on need */
-  if (fd_setsize < 0) {        
+  if (fd_setsize < 0) {
 #ifdef HAVE_SYSCONF
-     fd_setsize = sysconf( _SC_OPEN_MAX );
+    fd_setsize = sysconf(_SC_OPEN_MAX);
 #else
-#  ifdef HAVE_GETDTABLESIZE 
-     fd_setsize = getdtablesize();
+#  ifdef HAVE_GETDTABLESIZE
+    fd_setsize = getdtablesize();
 #  else
-     fd_setsize = FD_SETSIZE;
+    fd_setsize = FD_SETSIZE;
 #  endif /* !USE_SYSCONF */
 #endif
   }
 
   while (done == -1) {
-    if (timeout > 0) { /* did we timeout already? */
+    if (timeout > 0) {          /* did we timeout already? */
       now = gras_os_time();
-      DEBUG2("wakeup=%f now=%f",wakeup, now);
+      DEBUG2("wakeup=%f now=%f", wakeup, now);
       if (now == -1 || now >= wakeup) {
-       /* didn't find anything; no need to update _gras_lastly_selected_socket since its moredata is 0 (or we would have returned it directly) */
-       THROW1(timeout_error,0,
-              "Timeout (%f) elapsed with selecting for incomming connexions",
-              timeout);
+        /* didn't find anything; no need to update _gras_lastly_selected_socket since its moredata is 0 (or we would have returned it directly) */
+        THROW1(timeout_error, 0,
+               "Timeout (%f) elapsed with selecting for incomming connexions",
+               timeout);
       }
     }
 
     /* construct the set of socket to ear from */
     FD_ZERO(&FDS);
     max_fds = -1;
-    xbt_dynar_foreach(sockets,cursor,sock_iter) {
+    xbt_dynar_foreach(sockets, cursor, sock_iter) {
       if (!sock_iter->valid)
-        continue;
-       
+        continue;
+
       if (sock_iter->incoming) {
-       DEBUG1("Considering socket %d for select",sock_iter->sd);
+        DEBUG1("Considering socket %d for select", sock_iter->sd);
 #ifndef HAVE_WINSOCK_H
-       if (max_fds < sock_iter->sd)
-         max_fds = sock_iter->sd;
+        if (max_fds < sock_iter->sd)
+          max_fds = sock_iter->sd;
 #else
-      max_fds = 0;
+        max_fds = 0;
 
 #endif
-       FD_SET(sock_iter->sd, &FDS);
+        FD_SET(sock_iter->sd, &FDS);
       } else {
-       DEBUG1("Not considering socket %d for select",sock_iter->sd);
+        DEBUG1("Not considering socket %d for select", sock_iter->sd);
       }
     }
-     
+
 
     if (max_fds == -1) {
-       if (timeout > 0) {
-         DEBUG1("No socket to select onto. Sleep %f sec instead.",timeout);
-         gras_os_sleep(timeout);
-         THROW1(timeout_error,0,"No socket to select onto. Sleep %f sec instead",timeout);
-       } else {
-         DEBUG0("No socket to select onto. Return directly.");
-         THROW0(timeout_error,0, "No socket to select onto. Return directly.");
-       }
+      if (timeout > 0) {
+        DEBUG1("No socket to select onto. Sleep %f sec instead.", timeout);
+        gras_os_sleep(timeout);
+        THROW1(timeout_error, 0,
+               "No socket to select onto. Sleep %f sec instead", timeout);
+      } else {
+        DEBUG0("No socket to select onto. Return directly.");
+        THROW0(timeout_error, 0,
+               "No socket to select onto. Return directly.");
+      }
     }
-
 #ifndef HAVE_WINSOCK_H
     /* we cannot have more than FD_SETSIZE sockets 
        ... but with WINSOCK which returns sockets higher than the limit (killing this optim) */
     if (++max_fds > fd_setsize && fd_setsize > 0) {
-      WARN1("too many open sockets (%d).",max_fds);
+      WARN1("too many open sockets (%d).", max_fds);
       done = 0;
       break;
     }
@@ -122,10 +126,11 @@ gras_socket_t gras_trp_select(double timeout) {
     max_fds = fd_setsize;
 #endif
 
-    if (timeout > 0) { 
+    if (timeout > 0) {
       /* set the timeout */
-      tout.tv_sec = (unsigned long)(wakeup - now);
-      tout.tv_usec = ((wakeup -now) - ((unsigned long)(wakeup - now))) * 1000000;
+      tout.tv_sec = (unsigned long) (wakeup - now);
+      tout.tv_usec =
+        ((wakeup - now) - ((unsigned long) (wakeup - now))) * 1000000;
       p_tout = &tout;
     } else if (timeout == 0) {
       /* polling only */
@@ -134,103 +139,104 @@ gras_socket_t gras_trp_select(double timeout) {
       p_tout = &tout;
       /* we just do one loop around */
       done = 0;
-    } else { 
+    } else {
       /* no timeout: good luck! */
       p_tout = NULL;
     }
-     
-    DEBUG2("Selecting over %d socket(s); timeout=%f", max_fds-1,timeout);
+
+    DEBUG2("Selecting over %d socket(s); timeout=%f", max_fds - 1, timeout);
     ready = select(max_fds, &FDS, NULL, NULL, p_tout);
     DEBUG1("select returned %d", ready);
     if (ready == -1) {
       switch (errno) {
-      case  EINTR: /* a signal we don't care about occured. we don't care */
-       /* if we cared, we would have set an handler */
-       continue;
-      case EINVAL: /* invalid value */
-       THROW3(system_error,EINVAL,"invalid select: nb fds: %d, timeout: %d.%d",
-              max_fds, (int)tout.tv_sec,(int) tout.tv_usec);
-      case ENOMEM: 
-       xbt_die("Malloc error during the select");
+      case EINTR:              /* a signal we don't care about occured. we don't care */
+        /* if we cared, we would have set an handler */
+        continue;
+      case EINVAL:             /* invalid value */
+        THROW3(system_error, EINVAL,
+               "invalid select: nb fds: %d, timeout: %d.%d", max_fds,
+               (int) tout.tv_sec, (int) tout.tv_usec);
+      case ENOMEM:
+        xbt_die("Malloc error during the select");
       default:
-       THROW2(system_error,errno,"Error during select: %s (%d)",
-              strerror(errno),errno);
+        THROW2(system_error, errno, "Error during select: %s (%d)",
+               strerror(errno), errno);
       }
       THROW_IMPOSSIBLE;
     } else if (ready == 0) {
-      continue;         /* this was a timeout */
+      continue;                 /* this was a timeout */
     }
 
-    xbt_dynar_foreach(sockets,cursor,sock_iter) {
-       if(!FD_ISSET(sock_iter->sd, &FDS)) { /* this socket is not ready */
-       continue;
-       }
-       
-       /* Got a socket to serve */
-       ready--;
-
-       if (   sock_iter->accepting
-          && sock_iter->plugin->socket_accept) { 
-        /* not a socket but an ear. accept on it and serve next socket */
-        gras_socket_t accepted=NULL;
-        
-        /* release mutex before accept; it will change the sockets dynar, so we have to break the foreach asap */
-        xbt_dynar_cursor_unlock(sockets);
-        accepted = (sock_iter->plugin->socket_accept)(sock_iter);
-
-        DEBUG2("accepted=%p,&accepted=%p",accepted,&accepted);
-        accepted->meas = sock_iter->meas;
-        break;
-
-       } else {
-        /* Make sure the socket is still alive by reading the first byte */
-        int recvd;
-
-        if (sock_iter->recvd) {
-           /* Socket wasn't used since last time! Don't bother checking whether it's still alive */
-           recvd = 1;
-        } else {
-           recvd = read(sock_iter->sd, &sock_iter->recvd_val, 1);
-        }
-         
-        if (recvd < 0) {
-          WARN2("socket %d failed: %s", sock_iter->sd, strerror(errno));
-          /* done with this socket; remove it and break the foreach since it will change the dynar */
-          xbt_dynar_cursor_unlock(sockets);
-          gras_socket_close(sock_iter);
-          break;
-        } else if (recvd == 0) {
-          /* Connection reset (=closed) by peer. */
-          DEBUG1("Connection %d reset by peer", sock_iter->sd);
-          sock_iter->valid=0; /* don't close it. User may keep references to it */
-        } else { 
-          /* Got a suited socket ! */
-          XBT_OUT;
-          sock_iter->recvd = 1;
-          DEBUG3("Filled little buffer (%c %x %d)", sock_iter->recvd_val, sock_iter->recvd_val, recvd);
-          _gras_lastly_selected_socket = sock_iter;
-          /* break sync dynar iteration */
-          xbt_dynar_cursor_unlock(sockets);
-          return sock_iter;
-        }
-       }
-
-       /* if we're here, the socket we found wasn't really ready to be served */
-       if (ready == 0) { /* exausted all sockets given by select. Request new ones */
-
-         xbt_dynar_cursor_unlock(sockets);
-         break; 
-       }
+    xbt_dynar_foreach(sockets, cursor, sock_iter) {
+      if (!FD_ISSET(sock_iter->sd, &FDS)) {     /* this socket is not ready */
+        continue;
+      }
+
+      /* Got a socket to serve */
+      ready--;
+
+      if (sock_iter->accepting && sock_iter->plugin->socket_accept) {
+        /* not a socket but an ear. accept on it and serve next socket */
+        gras_socket_t accepted = NULL;
+
+        /* release mutex before accept; it will change the sockets dynar, so we have to break the foreach asap */
+        xbt_dynar_cursor_unlock(sockets);
+        accepted = (sock_iter->plugin->socket_accept) (sock_iter);
+
+        DEBUG2("accepted=%p,&accepted=%p", accepted, &accepted);
+        accepted->meas = sock_iter->meas;
+        break;
+
+      } else {
+        /* Make sure the socket is still alive by reading the first byte */
+        int recvd;
+
+        if (sock_iter->recvd) {
+          /* Socket wasn't used since last time! Don't bother checking whether it's still alive */
+          recvd = 1;
+        } else {
+          recvd = read(sock_iter->sd, &sock_iter->recvd_val, 1);
+        }
+
+        if (recvd < 0) {
+          WARN2("socket %d failed: %s", sock_iter->sd, strerror(errno));
+          /* done with this socket; remove it and break the foreach since it will change the dynar */
+          xbt_dynar_cursor_unlock(sockets);
+          gras_socket_close(sock_iter);
+          break;
+        } else if (recvd == 0) {
+          /* Connection reset (=closed) by peer. */
+          DEBUG1("Connection %d reset by peer", sock_iter->sd);
+          sock_iter->valid = 0; /* don't close it. User may keep references to it */
+        } else {
+          /* Got a suited socket ! */
+          XBT_OUT;
+          sock_iter->recvd = 1;
+          DEBUG3("Filled little buffer (%c %x %d)", sock_iter->recvd_val,
+                 sock_iter->recvd_val, recvd);
+          _gras_lastly_selected_socket = sock_iter;
+          /* break sync dynar iteration */
+          xbt_dynar_cursor_unlock(sockets);
+          return sock_iter;
+        }
+      }
+
+      /* if we're here, the socket we found wasn't really ready to be served */
+      if (ready == 0) {         /* exausted all sockets given by select. Request new ones */
+
+        xbt_dynar_cursor_unlock(sockets);
+        break;
+      }
     }
 
   }
 
   /* No socket found. Maybe we had timeout=0 and nothing to do */
   DEBUG0("TIMEOUT");
-  THROW0(timeout_error,0,"Timeout");
+  THROW0(timeout_error, 0, "Timeout");
 }
 
-void gras_trp_sg_setup(gras_trp_plugin_t plug) {
-  THROW0(mismatch_error,0,"No SG transport on live platforms");
+void gras_trp_sg_setup(gras_trp_plugin_t plug)
+{
+  THROW0(mismatch_error, 0, "No SG transport on live platforms");
 }
-
index 96c2894..1084617 100644 (file)
@@ -27,49 +27,50 @@ gras_socket_t _gras_lastly_selected_socket = NULL;
  *
  * if timeout>0 and no message there, wait at most that amount of time before giving up.
  */
-gras_socket_t gras_trp_select(double timeout) {
+gras_socket_t gras_trp_select(double timeout)
+{
   gras_socket_t res;
-  gras_trp_procdata_t pd = 
+  gras_trp_procdata_t pd =
     (gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id);
   gras_trp_sg_sock_data_t *sockdata;
   gras_trp_plugin_t trp;
   gras_socket_t active_socket = NULL;
   gras_trp_sg_sock_data_t *active_socket_data;
-  gras_socket_t sock_iter; /* iterating over all sockets */
+  gras_socket_t sock_iter;      /* iterating over all sockets */
   unsigned int cursor;
 
   DEBUG3("select on %s@%s with timeout=%f",
-        SIMIX_process_get_name(SIMIX_process_self()),
-        SIMIX_host_get_name(SIMIX_host_self()),
-        timeout);
-   if (timeout>=0) {
-      xbt_queue_shift_timed(pd->msg_selectable_sockets,
-                           &active_socket, timeout);
-   } else {
-      xbt_queue_shift(pd->msg_selectable_sockets, &active_socket);
-   }
-   
+         SIMIX_process_get_name(SIMIX_process_self()),
+         SIMIX_host_get_name(SIMIX_host_self()), timeout);
+  if (timeout >= 0) {
+    xbt_queue_shift_timed(pd->msg_selectable_sockets,
+                          &active_socket, timeout);
+  } else {
+    xbt_queue_shift(pd->msg_selectable_sockets, &active_socket);
+  }
+
   if (active_socket == NULL) {
     DEBUG0("TIMEOUT");
-    THROW0(timeout_error,0,"Timeout");
+    THROW0(timeout_error, 0, "Timeout");
   }
-  active_socket_data = (gras_trp_sg_sock_data_t*)active_socket->data;
-  
+  active_socket_data = (gras_trp_sg_sock_data_t *) active_socket->data;
+
   /* Ok, got something. Open a socket back to the expeditor */
 
   /* Try to reuse an already openned socket to that expeditor */
-  DEBUG1("Open sockets size %lu",xbt_dynar_length(pd->sockets));
-  xbt_dynar_foreach(pd->sockets,cursor,sock_iter) {
+  DEBUG1("Open sockets size %lu", xbt_dynar_length(pd->sockets));
+  xbt_dynar_foreach(pd->sockets, cursor, sock_iter) {
     gras_trp_sg_sock_data_t *sock_data;
-    DEBUG1("Consider %p as outgoing socket to expeditor",sock_iter);
-    
+    DEBUG1("Consider %p as outgoing socket to expeditor", sock_iter);
+
     if (sock_iter->meas || !sock_iter->outgoing)
       continue;
-    sock_data = ((gras_trp_sg_sock_data_t*)sock_iter->data);
+    sock_data = ((gras_trp_sg_sock_data_t *) sock_iter->data);
 
-    if ( (sock_data->to_socket == active_socket) && 
-        (sock_data->to_host == SIMIX_process_get_host(active_socket_data->from_process)) ) {
-                       xbt_dynar_cursor_unlock(pd->sockets);   
+    if ((sock_data->to_socket == active_socket) &&
+        (sock_data->to_host ==
+         SIMIX_process_get_host(active_socket_data->from_process))) {
+      xbt_dynar_cursor_unlock(pd->sockets);
       return sock_iter;
     }
   }
@@ -79,34 +80,37 @@ gras_socket_t gras_trp_select(double timeout) {
 
   trp = gras_trp_plugin_get_by_name("sg");
 
-  gras_trp_socket_new(1,&res);
-  res->plugin   = trp;
+  gras_trp_socket_new(1, &res);
+  res->plugin = trp;
 
-  res->incoming  = 1;
-  res->outgoing  = 1;
+  res->incoming = 1;
+  res->outgoing = 1;
   res->accepting = 0;
-  res->sd        = -1;
+  res->sd = -1;
 
   res->port = -1;
 
   /* initialize the ports */
   //res->peer_port = active_socket->port;
   res->port = active_socket->peer_port;
-  
+
   /* create sockdata */
-  sockdata = xbt_new(gras_trp_sg_sock_data_t,1);
+  sockdata = xbt_new(gras_trp_sg_sock_data_t, 1);
   sockdata->from_process = SIMIX_process_self();
-  sockdata->to_process   = active_socket_data->from_process;
-       
-  res->peer_port = 
-    ((gras_trp_procdata_t)gras_libdata_by_name_from_remote("gras_trp",sockdata->to_process))->myport;
+  sockdata->to_process = active_socket_data->from_process;
+
+  res->peer_port = ((gras_trp_procdata_t)
+                    gras_libdata_by_name_from_remote("gras_trp",
+                                                     sockdata->
+                                                     to_process))->myport;
   sockdata->to_socket = active_socket;
   /*update the peer to_socket  variable */
   active_socket_data->to_socket = res;
   sockdata->cond = SIMIX_cond_init();
   sockdata->mutex = SIMIX_mutex_init();
 
-  sockdata->to_host = SIMIX_process_get_host(active_socket_data->from_process);
+  sockdata->to_host =
+    SIMIX_process_get_host(active_socket_data->from_process);
 
   res->data = sockdata;
   res->peer_name = strdup(SIMIX_host_get_name(sockdata->to_host));
@@ -114,19 +118,32 @@ gras_socket_t gras_trp_select(double timeout) {
   gras_trp_buf_init_sock(res);
 
   DEBUG4("Create socket to process:%s(Port %d) from process: %s(Port %d)",
-        SIMIX_process_get_name(sockdata->from_process),
-        res->peer_port,
-        SIMIX_process_get_name(sockdata->to_process), res->port);
+         SIMIX_process_get_name(sockdata->from_process),
+         res->peer_port,
+         SIMIX_process_get_name(sockdata->to_process), res->port);
 
   return res;
 }
 
-  
+
 /* dummy implementations of the functions used in RL mode */
 
-void gras_trp_tcp_setup(gras_trp_plugin_t plug) {  THROW0(mismatch_error,0,NULL); }
-void gras_trp_file_setup(gras_trp_plugin_t plug){  THROW0(mismatch_error,0,NULL); }
-void gras_trp_iov_setup(gras_trp_plugin_t plug) {  THROW0(mismatch_error,0,NULL); }
+void gras_trp_tcp_setup(gras_trp_plugin_t plug)
+{
+  THROW0(mismatch_error, 0, NULL);
+}
+
+void gras_trp_file_setup(gras_trp_plugin_t plug)
+{
+  THROW0(mismatch_error, 0, NULL);
+}
 
-gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock) { return sock;}
-   
+void gras_trp_iov_setup(gras_trp_plugin_t plug)
+{
+  THROW0(mismatch_error, 0, NULL);
+}
+
+gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock)
+{
+  return sock;
+}
index d292390..bb1b568 100644 (file)
@@ -10,7 +10,7 @@
 /***
  *** Options
  ***/
-int gras_opt_trp_nomoredata_on_close=0;
+int gras_opt_trp_nomoredata_on_close = 0;
 
 #include "xbt/ex.h"
 #include "xbt/peer.h"
@@ -18,22 +18,24 @@ int gras_opt_trp_nomoredata_on_close=0;
 #include "gras/Transport/transport_private.h"
 #include "gras/Msg/msg_interface.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp,gras,"Conveying bytes over the network");
-XBT_LOG_NEW_SUBCATEGORY(gras_trp_meas,gras_trp,"Conveying bytes over the network without formating for perf measurements");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp, gras,
+                                "Conveying bytes over the network");
+XBT_LOG_NEW_SUBCATEGORY(gras_trp_meas, gras_trp,
+                        "Conveying bytes over the network without formating for perf measurements");
 static short int _gras_trp_started = 0;
 
-static xbt_dict_t _gras_trp_plugins;      /* All registered plugins */
-static void gras_trp_plugin_free(void *p); /* free one of the plugins */
+static xbt_dict_t _gras_trp_plugins;    /* All registered plugins */
+static void gras_trp_plugin_free(void *p);      /* free one of the plugins */
 
-static void
-gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
+static void gras_trp_plugin_new(const char *name, gras_trp_setup_t setup)
+{
   xbt_ex_t e;
 
   gras_trp_plugin_t plug = xbt_new0(s_gras_trp_plugin_t, 1);
 
-  DEBUG1("Create plugin %s",name);
+  DEBUG1("Create plugin %s", name);
 
-  plug->name=xbt_strdup(name);
+  plug->name = xbt_strdup(name);
 
   TRY {
     setup(plug);
@@ -42,7 +44,7 @@ gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
       /* SG plugin raise mismatch when in RL mode (and vice versa) */
       free(plug->name);
       free(plug);
-      plug=NULL;
+      plug = NULL;
       xbt_ex_free(e);
     } else {
       RETHROW;
@@ -53,80 +55,83 @@ gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
     xbt_dict_set(_gras_trp_plugins, name, plug, gras_trp_plugin_free);
 }
 
-void gras_trp_init(void){
+void gras_trp_init(void)
+{
   if (!_gras_trp_started) {
-     /* make room for all plugins */
-     _gras_trp_plugins=xbt_dict_new();
+    /* make room for all plugins */
+    _gras_trp_plugins = xbt_dict_new();
 
 #ifdef HAVE_WINSOCK2_H
-     /* initialize the windows mechanism */
-     {
-       WORD wVersionRequested;
-       WSADATA wsaData;
-
-       wVersionRequested = MAKEWORD( 2, 0 );
-       xbt_assert0(WSAStartup( wVersionRequested, &wsaData ) == 0,
-                   "Cannot find a usable WinSock DLL");
-
-       /* Confirm that the WinSock DLL supports 2.0.*/
-       /* Note that if the DLL supports versions greater    */
-       /* than 2.0 in addition to 2.0, it will still return */
-       /* 2.0 in wVersion since that is the version we      */
-       /* requested.                                        */
-
-       xbt_assert0(LOBYTE( wsaData.wVersion ) == 2 &&
-                   HIBYTE( wsaData.wVersion ) == 0,
-                   "Cannot find a usable WinSock DLL");
-       INFO0("Found and initialized winsock2");
-     }       /* The WinSock DLL is acceptable. Proceed. */
+    /* initialize the windows mechanism */
+    {
+      WORD wVersionRequested;
+      WSADATA wsaData;
+
+      wVersionRequested = MAKEWORD(2, 0);
+      xbt_assert0(WSAStartup(wVersionRequested, &wsaData) == 0,
+                  "Cannot find a usable WinSock DLL");
+
+      /* Confirm that the WinSock DLL supports 2.0. */
+      /* Note that if the DLL supports versions greater    */
+      /* than 2.0 in addition to 2.0, it will still return */
+      /* 2.0 in wVersion since that is the version we      */
+      /* requested.                                        */
+
+      xbt_assert0(LOBYTE(wsaData.wVersion) == 2 &&
+                  HIBYTE(wsaData.wVersion) == 0,
+                  "Cannot find a usable WinSock DLL");
+      INFO0("Found and initialized winsock2");
+    }                           /* The WinSock DLL is acceptable. Proceed. */
 #elif HAVE_WINSOCK_H
-     {       WSADATA wsaData;
-       xbt_assert0(WSAStartup( 0x0101, &wsaData ) == 0,
-                   "Cannot find a usable WinSock DLL");
-       INFO0("Found and initialized winsock");
-     }
+    {
+      WSADATA wsaData;
+      xbt_assert0(WSAStartup(0x0101, &wsaData) == 0,
+                  "Cannot find a usable WinSock DLL");
+      INFO0("Found and initialized winsock");
+    }
 #endif
 
-     /* Add plugins */
-     gras_trp_plugin_new("file",gras_trp_file_setup);
-     gras_trp_plugin_new("sg",gras_trp_sg_setup);
-     gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
+    /* Add plugins */
+    gras_trp_plugin_new("file", gras_trp_file_setup);
+    gras_trp_plugin_new("sg", gras_trp_sg_setup);
+    gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
   }
 
   _gras_trp_started++;
 }
 
-void
-gras_trp_exit(void){
-   DEBUG1("gras_trp value %d",_gras_trp_started);
-   if (_gras_trp_started == 0) {
-      return;
-   }
+void gras_trp_exit(void)
+{
+  DEBUG1("gras_trp value %d", _gras_trp_started);
+  if (_gras_trp_started == 0) {
+    return;
+  }
 
-   if ( --_gras_trp_started == 0 ) {
+  if (--_gras_trp_started == 0) {
 #ifdef HAVE_WINSOCK_H
-      if ( WSACleanup() == SOCKET_ERROR ) {
-        if ( WSAGetLastError() == WSAEINPROGRESS ) {
-           WSACancelBlockingCall();
-           WSACleanup();
-        }
-       }
+    if (WSACleanup() == SOCKET_ERROR) {
+      if (WSAGetLastError() == WSAEINPROGRESS) {
+        WSACancelBlockingCall();
+        WSACleanup();
+      }
+    }
 #endif
 
-      /* Delete the plugins */
-      xbt_dict_free(&_gras_trp_plugins);
-   }
+    /* Delete the plugins */
+    xbt_dict_free(&_gras_trp_plugins);
+  }
 }
 
 
-void gras_trp_plugin_free(void *p) {
+void gras_trp_plugin_free(void *p)
+{
   gras_trp_plugin_t plug = p;
 
   if (plug) {
     if (plug->exit) {
       plug->exit(plug);
     } else if (plug->data) {
-      DEBUG1("Plugin %s lacks exit(). Free data anyway.",plug->name);
+      DEBUG1("Plugin %s lacks exit(). Free data anyway.", plug->name);
       free(plug->data);
     }
 
@@ -141,30 +146,30 @@ void gras_trp_plugin_free(void *p) {
  *
  * Malloc a new socket, and initialize it with defaults
  */
-void gras_trp_socket_new(int incoming,
-                        gras_socket_t *dst) {
+void gras_trp_socket_new(int incoming, gras_socket_t * dst)
+{
 
-  gras_socket_t sock=xbt_new0(s_gras_socket_t,1);
+  gras_socket_t sock = xbt_new0(s_gras_socket_t, 1);
 
-  VERB1("Create a new socket (%p)", (void*)sock);
+  VERB1("Create a new socket (%p)", (void *) sock);
 
   sock->plugin = NULL;
 
-  sock->incoming  = incoming ? 1:0;
-  sock->outgoing  = incoming ? 0:1;
-  sock->accepting = incoming ? 1:0;
+  sock->incoming = incoming ? 1 : 0;
+  sock->outgoing = incoming ? 0 : 1;
+  sock->accepting = incoming ? 1 : 0;
   sock->meas = 0;
   sock->recvd = 0;
   sock->valid = 1;
   sock->moredata = 0;
 
-  sock->sd     = -1;
-  sock->port      = -1;
+  sock->sd = -1;
+  sock->port = -1;
   sock->peer_port = -1;
   sock->peer_name = NULL;
   sock->peer_proc = NULL;
 
-  sock->data   = NULL;
+  sock->data = NULL;
   sock->bufdata = NULL;
 
   *dst = sock;
@@ -182,34 +187,31 @@ void gras_trp_socket_new(int incoming,
  */
 gras_socket_t
 gras_socket_server_ext(unsigned short port,
-
-                      unsigned long int buf_size,
-                      int measurement) {
+                       unsigned long int buf_size, int measurement)
+{
 
   xbt_ex_t e;
   gras_trp_plugin_t trp;
   gras_socket_t sock;
 
   DEBUG2("Create a server socket from plugin %s on port %d",
-        gras_if_RL() ? "tcp" : "sg",
-        port);
-  trp = gras_trp_plugin_get_by_name(gras_if_SG() ? "sg":"tcp");
+         gras_if_RL()? "tcp" : "sg", port);
+  trp = gras_trp_plugin_get_by_name(gras_if_SG()? "sg" : "tcp");
 
   /* defaults settings */
-  gras_trp_socket_new(1,&sock);
-  sock->plugin= trp;
-  sock->port=port;
-  sock->buf_size = buf_size>0 ? buf_size : 32*1024;
+  gras_trp_socket_new(1, &sock);
+  sock->plugin = trp;
+  sock->port = port;
+  sock->buf_size = buf_size > 0 ? buf_size : 32 * 1024;
   sock->meas = measurement;
 
   /* Call plugin socket creation function */
-  DEBUG1("Prepare socket with plugin (fct=%p)",trp->socket_server);
+  DEBUG1("Prepare socket with plugin (fct=%p)", trp->socket_server);
   TRY {
     trp->socket_server(trp, sock);
     DEBUG3("in=%c out=%c accept=%c",
-          sock->incoming?'y':'n',
-          sock->outgoing?'y':'n',
-          sock->accepting?'y':'n');
+           sock->incoming ? 'y' : 'n',
+           sock->outgoing ? 'y' : 'n', sock->accepting ? 'y' : 'n');
   } CATCH(e) {
 
     free(sock);
@@ -217,13 +219,15 @@ gras_socket_server_ext(unsigned short port,
   }
 
   if (!measurement)
-     ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport = port;
+    ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport =
+      port;
   xbt_dynar_push(((gras_trp_procdata_t)
-                 gras_libdata_by_id(gras_trp_libdata_id))->sockets,&sock);
+                  gras_libdata_by_id(gras_trp_libdata_id))->sockets, &sock);
 
   gras_msg_listener_awake();
   return sock;
 }
+
 /**
  * @brief Opens a server socket on any port in the given range
  *
@@ -236,18 +240,20 @@ gras_socket_server_ext(unsigned short port,
  */
 gras_socket_t
 gras_socket_server_range(unsigned short minport, unsigned short maxport,
-                        unsigned long int buf_size, int measurement) {
+                         unsigned long int buf_size, int measurement)
+{
 
   int port;
-  gras_socket_t res=NULL;
+  gras_socket_t res = NULL;
   xbt_ex_t e;
 
-  for (port=minport; port<maxport;port ++) {
+  for (port = minport; port < maxport; port++) {
     TRY {
-      res=gras_socket_server_ext(port,buf_size,measurement);
-    } CATCH(e) {
-      if (port==maxport)
-       RETHROW;
+      res = gras_socket_server_ext(port, buf_size, measurement);
+    }
+    CATCH(e) {
+      if (port == maxport)
+        RETHROW;
       xbt_ex_free(e);
     }
     if (res)
@@ -267,39 +273,37 @@ gras_socket_server_range(unsigned short minport, unsigned short maxport,
  */
 gras_socket_t
 gras_socket_client_ext(const char *host,
-                      unsigned short port,
-
-                      unsigned long int buf_size,
-                      int measurement) {
+                       unsigned short port,
+                       unsigned long int buf_size, int measurement)
+{
 
   xbt_ex_t e;
   gras_trp_plugin_t trp;
   gras_socket_t sock;
 
-  trp = gras_trp_plugin_get_by_name(gras_if_SG() ? "sg":"tcp");
+  trp = gras_trp_plugin_get_by_name(gras_if_SG()? "sg" : "tcp");
 
-  DEBUG1("Create a client socket from plugin %s",gras_if_RL() ? "tcp" : "sg");
+  DEBUG1("Create a client socket from plugin %s", gras_if_RL()? "tcp" : "sg");
   /* defaults settings */
-  gras_trp_socket_new(0,&sock);
-  sock->plugin= trp;
+  gras_trp_socket_new(0, &sock);
+  sock->plugin = trp;
   sock->peer_port = port;
-  sock->peer_name = (char*)strdup(host?host:"localhost");
-  sock->buf_size = buf_size>0 ? buf_size: 32*1024;
+  sock->peer_name = (char *) strdup(host ? host : "localhost");
+  sock->buf_size = buf_size > 0 ? buf_size : 32 * 1024;
   sock->meas = measurement;
 
   /* plugin-specific */
   TRY {
-    (*trp->socket_client)(trp, sock);
+    (*trp->socket_client) (trp, sock);
     DEBUG3("in=%c out=%c accept=%c",
-          sock->incoming?'y':'n',
-          sock->outgoing?'y':'n',
-          sock->accepting?'y':'n');
+           sock->incoming ? 'y' : 'n',
+           sock->outgoing ? 'y' : 'n', sock->accepting ? 'y' : 'n');
   } CATCH(e) {
-     free(sock);
-     RETHROW;
+    free(sock);
+    RETHROW;
   }
   xbt_dynar_push(((gras_trp_procdata_t)
-                 gras_libdata_by_id(gras_trp_libdata_id))->sockets,&sock);
+                  gras_libdata_by_id(gras_trp_libdata_id))->sockets, &sock);
   gras_msg_listener_awake();
   return sock;
 }
@@ -309,66 +313,70 @@ gras_socket_client_ext(const char *host,
  *
  * In real life, you'll get a TCP socket.
  */
-gras_socket_t
-gras_socket_server(unsigned short port) {
-   return gras_socket_server_ext(port,32*1024,0);
+gras_socket_t gras_socket_server(unsigned short port)
+{
+  return gras_socket_server_ext(port, 32 * 1024, 0);
 }
 
 /** @brief Opens a client socket to a remote host */
-gras_socket_t
-gras_socket_client(const char *host,
-                  unsigned short port) {
-   return gras_socket_client_ext(host,port,0,0);
+gras_socket_t gras_socket_client(const char *host, unsigned short port)
+{
+  return gras_socket_client_ext(host, port, 0, 0);
 }
 
 /** @brief Opens a client socket to a remote host specified as '\a host:\a port' */
-gras_socket_t
-gras_socket_client_from_string(const char *host) {
-   xbt_peer_t p = xbt_peer_from_string(host);
-   gras_socket_t res = gras_socket_client_ext(p->name,p->port,0,0);
-   xbt_peer_free(p);
-   return res;
+gras_socket_t gras_socket_client_from_string(const char *host)
+{
+  xbt_peer_t p = xbt_peer_from_string(host);
+  gras_socket_t res = gras_socket_client_ext(p->name, p->port, 0, 0);
+  xbt_peer_free(p);
+  return res;
 }
 
 /** \brief Close socket */
-void gras_socket_close(gras_socket_t sock) {
-  xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->sockets;
+void gras_socket_close(gras_socket_t sock)
+{
+  xbt_dynar_t sockets =
+    ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->sockets;
   gras_socket_t sock_iter = NULL;
   unsigned int cursor;
 
   XBT_IN;
-  VERB1("Close %p",sock);
+  VERB1("Close %p", sock);
   if (sock == _gras_lastly_selected_socket) {
-     xbt_assert0(!gras_opt_trp_nomoredata_on_close || !sock->moredata,
-                "Closing a socket having more data in buffer while the nomoredata_on_close option is activated");
+    xbt_assert0(!gras_opt_trp_nomoredata_on_close || !sock->moredata,
+                "Closing a socket having more data in buffer while the nomoredata_on_close option is activated");
 
-     if (sock->moredata)
-       CRITICAL0("Closing a socket having more data in buffer. Option nomoredata_on_close disabled, so continuing.");
-     _gras_lastly_selected_socket=NULL;
+    if (sock->moredata)
+      CRITICAL0
+        ("Closing a socket having more data in buffer. Option nomoredata_on_close disabled, so continuing.");
+    _gras_lastly_selected_socket = NULL;
   }
 
   /* FIXME: Issue an event when the socket is closed */
-       DEBUG1("sockets pointer before %p",sockets);
+  DEBUG1("sockets pointer before %p", sockets);
   if (sock) {
-       /* FIXME: Cannot get the dynar mutex, because it can be already locked */
-//             _xbt_dynar_foreach(sockets,cursor,sock_iter) {
-               for (cursor=0; cursor< xbt_dynar_length(sockets); cursor++)  {
-                       _xbt_dynar_cursor_get(sockets,&cursor,&sock_iter);
-                       if (sock == sock_iter) {
-                               DEBUG2("remove sock cursor %d dize %lu\n",cursor,xbt_dynar_length(sockets));
-                               xbt_dynar_cursor_rm(sockets,&cursor);
-                               if (sock->plugin->socket_close)
-                                       (* sock->plugin->socket_close)(sock);
-
-                               /* free the memory */
-                               if (sock->peer_name)
-                                       free(sock->peer_name);
-                               free(sock);
-                               XBT_OUT;
-                               return;
-                       }
+    /* FIXME: Cannot get the dynar mutex, because it can be already locked */
+//              _xbt_dynar_foreach(sockets,cursor,sock_iter) {
+    for (cursor = 0; cursor < xbt_dynar_length(sockets); cursor++) {
+      _xbt_dynar_cursor_get(sockets, &cursor, &sock_iter);
+      if (sock == sock_iter) {
+        DEBUG2("remove sock cursor %d dize %lu\n", cursor,
+               xbt_dynar_length(sockets));
+        xbt_dynar_cursor_rm(sockets, &cursor);
+        if (sock->plugin->socket_close)
+          (*sock->plugin->socket_close) (sock);
+
+        /* free the memory */
+        if (sock->peer_name)
+          free(sock->peer_name);
+        free(sock);
+        XBT_OUT;
+        return;
+      }
     }
-    WARN1("Ignoring request to free an unknown socket (%p). Execution stack:",sock);
+    WARN1("Ignoring request to free an unknown socket (%p). Execution stack:",
+          sock);
     xbt_backtrace_display_current();
   }
   XBT_OUT;
@@ -380,20 +388,21 @@ void gras_socket_close(gras_socket_t sock) {
  * Send a bunch of bytes from on socket
  * (stable if we know the storage will keep as is until the next trp_flush)
  */
-void
-gras_trp_send(gras_socket_t sd, char *data, long int size, int stable) {
-  xbt_assert0(sd->outgoing,"Socket not suited for data send");
-  (*sd->plugin->send)(sd,data,size,stable);
+void gras_trp_send(gras_socket_t sd, char *data, long int size, int stable)
+{
+  xbt_assert0(sd->outgoing, "Socket not suited for data send");
+  (*sd->plugin->send) (sd, data, size, stable);
 }
+
 /**
  * gras_trp_chunk_recv:
  *
  * Receive a bunch of bytes from a socket
  */
-void
-gras_trp_recv(gras_socket_t sd, char *data, long int size) {
-  xbt_assert0(sd->incoming,"Socket not suited for data receive");
-  (sd->plugin->recv)(sd,data,size);
+void gras_trp_recv(gras_socket_t sd, char *data, long int size)
+{
+  xbt_assert0(sd->incoming, "Socket not suited for data receive");
+  (sd->plugin->recv) (sd, data, size);
 }
 
 /**
@@ -401,36 +410,45 @@ gras_trp_recv(gras_socket_t sd, char *data, long int size) {
  *
  * Make sure all pending communications are done
  */
-void
-gras_trp_flush(gras_socket_t sd) {
+void gras_trp_flush(gras_socket_t sd)
+{
   if (sd->plugin->flush)
-    (sd->plugin->flush)(sd);
+    (sd->plugin->flush) (sd);
 }
 
-gras_trp_plugin_t
-gras_trp_plugin_get_by_name(const char *name){
-  return xbt_dict_get(_gras_trp_plugins,name);
+gras_trp_plugin_t gras_trp_plugin_get_by_name(const char *name)
+{
+  return xbt_dict_get(_gras_trp_plugins, name);
 }
 
-int gras_socket_my_port  (gras_socket_t sock) {
+int gras_socket_my_port(gras_socket_t sock)
+{
   return sock->port;
 }
-int   gras_socket_peer_port(gras_socket_t sock) {
+
+int gras_socket_peer_port(gras_socket_t sock)
+{
   return sock->peer_port;
 }
-char *gras_socket_peer_name(gras_socket_t sock) {
+
+char *gras_socket_peer_name(gras_socket_t sock)
+{
   return sock->peer_name;
 }
-char *gras_socket_peer_proc(gras_socket_t sock) {
+
+char *gras_socket_peer_proc(gras_socket_t sock)
+{
   return sock->peer_proc;
 }
 
-void gras_socket_peer_proc_set(gras_socket_t sock,char*peer_proc) {
+void gras_socket_peer_proc_set(gras_socket_t sock, char *peer_proc)
+{
   sock->peer_proc = peer_proc;
 }
 
 /** \brief Check if the provided socket is a measurement one (or a regular one) */
-int gras_socket_is_meas(gras_socket_t sock) {
+int gras_socket_is_meas(gras_socket_t sock)
+{
   return sock->meas;
 }
 
@@ -454,29 +472,33 @@ int gras_socket_is_meas(gras_socket_t sock) {
  *           bytes in a fat pipe.
  */
 void gras_socket_meas_send(gras_socket_t peer,
-                          unsigned int timeout,
-                          unsigned long int msg_size,
-                          unsigned long int msg_amount) {
-  char *chunk=NULL;
+                           unsigned int timeout,
+                           unsigned long int msg_size,
+                           unsigned long int msg_amount)
+{
+  char *chunk = NULL;
   unsigned long int sent_sofar;
 
   XBT_IN;
 
   if (gras_if_RL())
-    chunk=xbt_malloc0(msg_size);
-
-  xbt_assert0(peer->meas,"Asked to send measurement data on a regular socket");
-  xbt_assert0(peer->outgoing,"Socket not suited for data send (was created with gras_socket_server(), not gras_socket_client())");
+    chunk = xbt_malloc0(msg_size);
 
-  for (sent_sofar=0; sent_sofar < msg_amount; sent_sofar++) {
-     CDEBUG5(gras_trp_meas,"Sent %lu msgs of %lu (size of each: %ld) to %s:%d",
-            sent_sofar,msg_amount,msg_size,
-            gras_socket_peer_name(peer), gras_socket_peer_port(peer));
-     (*peer->plugin->raw_send)(peer,chunk,msg_size);
+  xbt_assert0(peer->meas,
+              "Asked to send measurement data on a regular socket");
+  xbt_assert0(peer->outgoing,
+              "Socket not suited for data send (was created with gras_socket_server(), not gras_socket_client())");
+
+  for (sent_sofar = 0; sent_sofar < msg_amount; sent_sofar++) {
+    CDEBUG5(gras_trp_meas,
+            "Sent %lu msgs of %lu (size of each: %ld) to %s:%d", sent_sofar,
+            msg_amount, msg_size, gras_socket_peer_name(peer),
+            gras_socket_peer_port(peer));
+    (*peer->plugin->raw_send) (peer, chunk, msg_size);
   }
-  CDEBUG5(gras_trp_meas,"Sent %lu msgs of %lu (size of each: %ld) to %s:%d",
-         sent_sofar,msg_amount,msg_size,
-         gras_socket_peer_name(peer), gras_socket_peer_port(peer));
+  CDEBUG5(gras_trp_meas, "Sent %lu msgs of %lu (size of each: %ld) to %s:%d",
+          sent_sofar, msg_amount, msg_size,
+          gras_socket_peer_name(peer), gras_socket_peer_port(peer));
 
   if (gras_if_RL())
     free(chunk);
@@ -495,11 +517,12 @@ void gras_socket_meas_send(gras_socket_t peer,
  *           bytes in a fat pipe.
  */
 void gras_socket_meas_recv(gras_socket_t peer,
-                          unsigned int timeout,
-                          unsigned long int msg_size,
-                          unsigned long int msg_amount){
+                           unsigned int timeout,
+                           unsigned long int msg_size,
+                           unsigned long int msg_amount)
+{
 
-  char *chunk=NULL;
+  char *chunk = NULL;
   unsigned long int got_sofar;
 
   XBT_IN;
@@ -508,18 +531,20 @@ void gras_socket_meas_recv(gras_socket_t peer,
     chunk = xbt_malloc(msg_size);
 
   xbt_assert0(peer->meas,
-             "Asked to receive measurement data on a regular socket");
-  xbt_assert0(peer->incoming,"Socket not suited for data receive");
-
-  for (got_sofar=0; got_sofar < msg_amount; got_sofar ++) {
-     CDEBUG5(gras_trp_meas,"Recvd %ld msgs of %lu (size of each: %ld) from %s:%d",
-            got_sofar,msg_amount,msg_size,
-            gras_socket_peer_name(peer), gras_socket_peer_port(peer));
-     (peer->plugin->raw_recv)(peer,chunk,msg_size);
+              "Asked to receive measurement data on a regular socket");
+  xbt_assert0(peer->incoming, "Socket not suited for data receive");
+
+  for (got_sofar = 0; got_sofar < msg_amount; got_sofar++) {
+    CDEBUG5(gras_trp_meas,
+            "Recvd %ld msgs of %lu (size of each: %ld) from %s:%d", got_sofar,
+            msg_amount, msg_size, gras_socket_peer_name(peer),
+            gras_socket_peer_port(peer));
+    (peer->plugin->raw_recv) (peer, chunk, msg_size);
   }
-  CDEBUG5(gras_trp_meas,"Recvd %ld msgs of %lu (size of each: %ld) from %s:%d",
-         got_sofar,msg_amount,msg_size,
-         gras_socket_peer_name(peer), gras_socket_peer_port(peer));
+  CDEBUG5(gras_trp_meas,
+          "Recvd %ld msgs of %lu (size of each: %ld) from %s:%d", got_sofar,
+          msg_amount, msg_size, gras_socket_peer_name(peer),
+          gras_socket_peer_port(peer));
 
   if (gras_if_RL())
     free(chunk);
@@ -538,21 +563,22 @@ void gras_socket_meas_recv(gras_socket_t peer,
  * done for regular sockets, but you usually want more control about
  * what's going on with measurement sockets.
  */
-gras_socket_t gras_socket_meas_accept(gras_socket_t peer){
+gras_socket_t gras_socket_meas_accept(gras_socket_t peer)
+{
   gras_socket_t res;
 
   xbt_assert0(peer->meas,
-             "No need to accept on non-measurement sockets (it's automatic)");
+              "No need to accept on non-measurement sockets (it's automatic)");
 
   if (!peer->accepting) {
     /* nothing to accept here (must be in SG) */
-    /* BUG: FIXME: this is BAD! it makes tricky to free the accepted socket*/
+    /* BUG: FIXME: this is BAD! it makes tricky to free the accepted socket */
     return peer;
   }
 
-  res = (peer->plugin->socket_accept)(peer);
+  res = (peer->plugin->socket_accept) (peer);
   res->meas = peer->meas;
-  CDEBUG1(gras_trp_meas,"meas_accepted onto %d",res->sd);
+  CDEBUG1(gras_trp_meas, "meas_accepted onto %d", res->sd);
 
   return res;
 }
@@ -561,53 +587,60 @@ gras_socket_t gras_socket_meas_accept(gras_socket_t peer){
 /*
  * Creating procdata for this module
  */
-static void *gras_trp_procdata_new(void) {
-   gras_trp_procdata_t res = xbt_new(s_gras_trp_procdata_t,1);
+static void *gras_trp_procdata_new(void)
+{
+  gras_trp_procdata_t res = xbt_new(s_gras_trp_procdata_t, 1);
 
-   res->name = xbt_strdup("gras_trp");
-   res->name_len = 0;
-   res->sockets = xbt_dynar_new_sync(sizeof(gras_socket_t*), NULL);
-   res->myport = 0;
+  res->name = xbt_strdup("gras_trp");
+  res->name_len = 0;
+  res->sockets = xbt_dynar_new_sync(sizeof(gras_socket_t *), NULL);
+  res->myport = 0;
 
-   return (void*)res;
+  return (void *) res;
 }
 
 /*
  * Freeing procdata for this module
  */
-static void gras_trp_procdata_free(void *data) {
-  gras_trp_procdata_t res = (gras_trp_procdata_t)data;
+static void gras_trp_procdata_free(void *data)
+{
+  gras_trp_procdata_t res = (gras_trp_procdata_t) data;
 
-  xbt_dynar_free(&( res->sockets ));
+  xbt_dynar_free(&(res->sockets));
   free(res->name);
   free(res);
 }
 
-void gras_trp_socketset_dump(const char *name) {
+void gras_trp_socketset_dump(const char *name)
+{
   gras_trp_procdata_t procdata =
-    (gras_trp_procdata_t)gras_libdata_by_id(gras_trp_libdata_id);
+    (gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id);
 
   unsigned int it;
   gras_socket_t s;
 
-  INFO1("** Dump the socket set %s",name);
+  INFO1("** Dump the socket set %s", name);
   xbt_dynar_foreach(procdata->sockets, it, s) {
     INFO4("  %p -> %s:%d %s",
-         s,gras_socket_peer_name(s),gras_socket_peer_port(s),
-         s->valid?"(valid)":"(peer dead)");
+          s, gras_socket_peer_name(s), gras_socket_peer_port(s),
+          s->valid ? "(valid)" : "(peer dead)");
   }
-  INFO1("** End of socket set %s",name);
+  INFO1("** End of socket set %s", name);
 }
 
 /*
  * Module registration
  */
 int gras_trp_libdata_id;
-void gras_trp_register() {
-   gras_trp_libdata_id = gras_procdata_add("gras_trp",gras_trp_procdata_new, gras_trp_procdata_free);
+void gras_trp_register()
+{
+  gras_trp_libdata_id =
+    gras_procdata_add("gras_trp", gras_trp_procdata_new,
+                      gras_trp_procdata_free);
 }
 
-int gras_os_myport(void)  {
-   return ((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport;
+int gras_os_myport(void)
+{
+  return ((gras_trp_procdata_t)
+          gras_libdata_by_id(gras_trp_libdata_id))->myport;
 }
-
index 281a9c1..6b84713 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef GRAS_TRP_INTERFACE_H
 #define GRAS_TRP_INTERFACE_H
 
-#include "portable.h" /* sometimes needed for fd_set */
+#include "portable.h"           /* sometimes needed for fd_set */
 #include "simix/simix.h"
 #include "xbt/queue.h"
 
@@ -26,7 +26,7 @@ extern int gras_opt_trp_nomoredata_on_close;
  ***/
 /* stable if we know the storage will keep as is until the next trp_flush */
 XBT_PUBLIC(void) gras_trp_send(gras_socket_t sd, char *data, long int size,
-                              int stable);
+                               int stable);
 XBT_PUBLIC(void) gras_trp_recv(gras_socket_t sd, char *data, long int size);
 XBT_PUBLIC(void) gras_trp_flush(gras_socket_t sd);
 
@@ -34,85 +34,79 @@ XBT_PUBLIC(void) gras_trp_flush(gras_socket_t sd);
 XBT_PUBLIC(gras_socket_t) gras_trp_select(double timeout);
 
 /* Set the peer process name (used by messaging layer) */
-XBT_PUBLIC(void) gras_socket_peer_proc_set(gras_socket_t sock,char*peer_proc);
+XBT_PUBLIC(void) gras_socket_peer_proc_set(gras_socket_t sock,
+                                           char *peer_proc);
 
 /***
  *** Plugin mechanism 
  ***/
 
 /* A plugin type */
-typedef struct gras_trp_plugin_ s_gras_trp_plugin_t, *gras_trp_plugin_t;
+     typedef struct gras_trp_plugin_ s_gras_trp_plugin_t, *gras_trp_plugin_t;
 
 /* A plugin type */
-struct gras_trp_plugin_ {
-  char          *name;
-  /* dst pointers are created and initialized with default values
-     before call to socket_client/server. 
-     Retrive the info you need from there. */
-  void (*socket_client)(gras_trp_plugin_t self,
-                       gras_socket_t    dst);
-  void (*socket_server)(gras_trp_plugin_t self,
-                       gras_socket_t    dst);
-   
-  gras_socket_t (*socket_accept)(gras_socket_t  from);
-   
-   
-   /* socket_close() is responsible of telling the OS that the socket is over,
-    but should not free the socket itself (beside the specific part) */
-  void (*socket_close)(gras_socket_t sd);
-    
-  /* send/recv may be buffered */
-  void (*send)(gras_socket_t sd,
-              const char *data,
-              unsigned long int size,
-              int stable /* storage will survive until flush*/);
-  int (*recv)(gras_socket_t sd,
-             char *data,
-             unsigned long int size);
-  /* raw_send/raw_recv is never buffered (use it for measurement stuff) */
-  void (*raw_send)(gras_socket_t sd,
-                  const char *data,
-                  unsigned long int size);
-  int (*raw_recv)(gras_socket_t sd,
-                 char *data,
-                 unsigned long int size);
-
-  /* flush has to make sure that the pending communications are achieved */
-  void (*flush)(gras_socket_t sd);
-
-  void *data; /* plugin-specific data */
-   /* exit is responsible for freeing data and telling to the OS that 
-      this plugin is gone */
-   /* exit=NULL, data gets brutally free()d by the generic interface. 
-      (ie exit function needed only when data contains pointers) */
-  void (*exit)(gras_trp_plugin_t);
-};
-
-XBT_PUBLIC(gras_trp_plugin_t) 
-gras_trp_plugin_get_by_name(const char *name);
+     struct gras_trp_plugin_ {
+       char *name;
+
+       /* dst pointers are created and initialized with default values
+          before call to socket_client/server. 
+          Retrive the info you need from there. */
+       void (*socket_client) (gras_trp_plugin_t self, gras_socket_t dst);
+       void (*socket_server) (gras_trp_plugin_t self, gras_socket_t dst);
+
+       gras_socket_t(*socket_accept) (gras_socket_t from);
+
+
+       /* socket_close() is responsible of telling the OS that the socket is over,
+          but should not free the socket itself (beside the specific part) */
+       void (*socket_close) (gras_socket_t sd);
+
+       /* send/recv may be buffered */
+       void (*send) (gras_socket_t sd,
+                     const char *data,
+                     unsigned long int size,
+                     int stable /* storage will survive until flush */ );
+       int (*recv) (gras_socket_t sd, char *data, unsigned long int size);
+       /* raw_send/raw_recv is never buffered (use it for measurement stuff) */
+       void (*raw_send) (gras_socket_t sd,
+                         const char *data, unsigned long int size);
+       int (*raw_recv) (gras_socket_t sd, char *data, unsigned long int size);
+
+       /* flush has to make sure that the pending communications are achieved */
+       void (*flush) (gras_socket_t sd);
+
+       void *data;              /* plugin-specific data */
+
+       /* exit is responsible for freeing data and telling to the OS that 
+          this plugin is gone */
+       /* exit=NULL, data gets brutally free()d by the generic interface. 
+          (ie exit function needed only when data contains pointers) */
+       void (*exit) (gras_trp_plugin_t);
+     };
+
+XBT_PUBLIC(gras_trp_plugin_t)
+  gras_trp_plugin_get_by_name(const char *name);
 
 /* Data of this module specific to each process
  * (used by sg_process.c to cleanup the SG channel cruft)
  */
-typedef struct {
-  /* set headers */
-  unsigned int ID;
-  char        *name;
-  unsigned int name_len;
-
-  int myport; /* Port on which I listen myself */
-   
-  xbt_dynar_t sockets; /* all sockets known to this process */
-
-  /* SG only elements. In RL, they are part of the OS ;) */
-   
-  /* List of sockets ready to be select()ed */
-  xbt_queue_t msg_selectable_sockets; /* regular sockets  */
-  xbt_queue_t meas_selectable_sockets;/* measurement ones */
-
-} s_gras_trp_procdata_t,*gras_trp_procdata_t;
+     typedef struct {
+       /* set headers */
+       unsigned int ID;
+       char *name;
+       unsigned int name_len;
+
+       int myport;              /* Port on which I listen myself */
+
+       xbt_dynar_t sockets;     /* all sockets known to this process */
+
+       /* SG only elements. In RL, they are part of the OS ;) */
+
+       /* List of sockets ready to be select()ed */
+       xbt_queue_t msg_selectable_sockets;      /* regular sockets  */
+       xbt_queue_t meas_selectable_sockets;     /* measurement ones */
+
+     } s_gras_trp_procdata_t, *gras_trp_procdata_t;
 
 /* Display the content of our socket set (debugging purpose) */
 XBT_PUBLIC(void) gras_trp_socketset_dump(const char *name);
index 79e8cfc..c8a13d0 100644 (file)
 #include "portable.h"
 #include "gras/Transport/transport_private.h"
 #include "xbt/ex.h"
-#include "gras/Msg/msg_interface.h" /* gras_msg_listener_awake */
+#include "gras/Msg/msg_interface.h"     /* gras_msg_listener_awake */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_file,gras_trp,
-       "Pseudo-transport to write to/read from a file");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_file, gras_trp,
+                                "Pseudo-transport to write to/read from a file");
 
 /***
  *** Prototypes
@@ -21,16 +21,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_file,gras_trp,
 void gras_trp_file_close(gras_socket_t sd);
 
 void gras_trp_file_chunk_send_raw(gras_socket_t sd,
-                                 const char *data,
-                                 unsigned long int size);
+                                  const char *data, unsigned long int size);
 void gras_trp_file_chunk_send(gras_socket_t sd,
-                             const char *data,
-                             unsigned long int size,
-                             int stable_ignored);
+                              const char *data,
+                              unsigned long int size, int stable_ignored);
 
 int gras_trp_file_chunk_recv(gras_socket_t sd,
-                            char *data,
-                            unsigned long int size);
+                             char *data, unsigned long int size);
 
 /***
  *** Specific plugin part
@@ -49,10 +46,10 @@ typedef struct {
 /***
  *** Code
  ***/
-void
-gras_trp_file_setup(gras_trp_plugin_t plug) {
+void gras_trp_file_setup(gras_trp_plugin_t plug)
+{
 
-  gras_trp_file_plug_data_t *file = xbt_new(gras_trp_file_plug_data_t,1);
+  gras_trp_file_plug_data_t *file = xbt_new(gras_trp_file_plug_data_t, 1);
 
   FD_ZERO(&(file->incoming_socks));
 
@@ -63,7 +60,7 @@ gras_trp_file_setup(gras_trp_plugin_t plug) {
 
   plug->raw_recv = plug->recv = gras_trp_file_chunk_recv;
 
-  plug->data         = (void*)file;
+  plug->data = (void *) file;
 }
 
 /**
@@ -73,38 +70,38 @@ gras_trp_file_setup(gras_trp_plugin_t plug) {
  *
  * This only possible in RL, and is mainly for debugging.
  */
-gras_socket_t
-gras_socket_client_from_file(const char*path) {
+gras_socket_t gras_socket_client_from_file(const char *path)
+{
   gras_socket_t res;
 
-  xbt_assert0(gras_if_RL(),
-              "Cannot use file as socket in the simulator");
+  xbt_assert0(gras_if_RL(), "Cannot use file as socket in the simulator");
 
-  gras_trp_socket_new(0,&res);
+  gras_trp_socket_new(0, &res);
 
-  res->plugin=gras_trp_plugin_get_by_name("file");
+  res->plugin = gras_trp_plugin_get_by_name("file");
 
   if (strcmp("-", path)) {
-    res->sd = open(path, O_TRUNC|O_WRONLY|O_CREAT | O_BINARY, S_IRUSR|S_IWUSR|S_IRGRP );
-
-    if ( res->sd < 0) {
-      THROW2(system_error,0,
-            "Cannot create a client socket from file %s: %s",
-            path, strerror(errno));
+    res->sd =
+      open(path, O_TRUNC | O_WRONLY | O_CREAT | O_BINARY,
+           S_IRUSR | S_IWUSR | S_IRGRP);
+
+    if (res->sd < 0) {
+      THROW2(system_error, 0,
+             "Cannot create a client socket from file %s: %s",
+             path, strerror(errno));
     }
   } else {
-    res->sd = 1; /* stdout */
+    res->sd = 1;                /* stdout */
   }
 
   DEBUG5("sock_client_from_file(%s): sd=%d in=%c out=%c accept=%c",
-        path,
-        res->sd,
-        res->incoming?'y':'n',
-        res->outgoing?'y':'n',
-        res->accepting?'y':'n');
+         path,
+         res->sd,
+         res->incoming ? 'y' : 'n',
+         res->outgoing ? 'y' : 'n', res->accepting ? 'y' : 'n');
 
   xbt_dynar_push(((gras_trp_procdata_t)
-                 gras_libdata_by_id(gras_trp_libdata_id))->sockets,&res);
+                  gras_libdata_by_id(gras_trp_libdata_id))->sockets, &res);
   return res;
 }
 
@@ -115,46 +112,47 @@ gras_socket_client_from_file(const char*path) {
  *
  * This only possible in RL, and is mainly for debugging.
  */
-gras_socket_t gras_socket_server_from_file(const char*path) {
+gras_socket_t gras_socket_server_from_file(const char *path)
+{
   gras_socket_t res;
 
-  xbt_assert0(gras_if_RL(),
-              "Cannot use file as socket in the simulator");
+  xbt_assert0(gras_if_RL(), "Cannot use file as socket in the simulator");
 
-  gras_trp_socket_new(1,&res);
+  gras_trp_socket_new(1, &res);
 
-  res->plugin=gras_trp_plugin_get_by_name("file");
+  res->plugin = gras_trp_plugin_get_by_name("file");
 
 
   if (strcmp("-", path)) {
     res->sd = open(path, O_RDONLY | O_BINARY);
 
-    if ( res->sd < 0) {
-      THROW2(system_error,0,
-            "Cannot create a server socket from file %s: %s",
-            path, strerror(errno));
+    if (res->sd < 0) {
+      THROW2(system_error, 0,
+             "Cannot create a server socket from file %s: %s",
+             path, strerror(errno));
     }
   } else {
-    res->sd = 0; /* stdin */
+    res->sd = 0;                /* stdin */
   }
 
   DEBUG4("sd=%d in=%c out=%c accept=%c",
-        res->sd,
-        res->incoming?'y':'n',
-        res->outgoing?'y':'n',
-        res->accepting?'y':'n');
+         res->sd,
+         res->incoming ? 'y' : 'n',
+         res->outgoing ? 'y' : 'n', res->accepting ? 'y' : 'n');
 
   xbt_dynar_push(((gras_trp_procdata_t)
-                 gras_libdata_by_id(gras_trp_libdata_id))->sockets,&res);
+                  gras_libdata_by_id(gras_trp_libdata_id))->sockets, &res);
   gras_msg_listener_awake();
   return res;
 }
 
-void gras_trp_file_close(gras_socket_t sock){
+void gras_trp_file_close(gras_socket_t sock)
+{
   gras_trp_file_plug_data_t *data;
 
-  if (!sock) return; /* close only once */
-  data=sock->plugin->data;
+  if (!sock)
+    return;                     /* close only once */
+  data = sock->plugin->data;
 
   if (sock->sd == 0) {
     DEBUG0("Do not close stdin");
@@ -167,9 +165,8 @@ void gras_trp_file_close(gras_socket_t sock){
     FD_CLR(sock->sd, &(data->incoming_socks));
 
     /* close the socket */
-    if(close(sock->sd) < 0) {
-      WARN2("error while closing file %d: %s",
-              sock->sd, strerror(errno));
+    if (close(sock->sd) < 0) {
+      WARN2("error while closing file %d: %s", sock->sd, strerror(errno));
     }
   }
 }
@@ -181,15 +178,16 @@ void gras_trp_file_close(gras_socket_t sock){
  */
 void
 gras_trp_file_chunk_send(gras_socket_t sock,
-                        const char *data,
-                        unsigned long int size,
-                        int stable_ignored) {
-  gras_trp_file_chunk_send_raw(sock,data,size);
+                         const char *data,
+                         unsigned long int size, int stable_ignored)
+{
+  gras_trp_file_chunk_send_raw(sock, data, size);
 }
+
 void
 gras_trp_file_chunk_send_raw(gras_socket_t sock,
-                            const char *data,
-                            unsigned long int size) {
+                             const char *data, unsigned long int size)
+{
 
   xbt_assert0(sock->outgoing, "Cannot write on client file socket");
   xbt_assert0(size >= 0, "Cannot send a negative amount of data");
@@ -197,23 +195,23 @@ gras_trp_file_chunk_send_raw(gras_socket_t sock,
   while (size) {
     int status = 0;
 
-    DEBUG3("write(%d, %p, %ld);", sock->sd, data, (long int)size);
-    status = write(sock->sd, data, (long int)size);
+    DEBUG3("write(%d, %p, %ld);", sock->sd, data, (long int) size);
+    status = write(sock->sd, data, (long int) size);
 
     if (status == -1) {
-      THROW4(system_error,0,"write(%d,%p,%d) failed: %s",
-            sock->sd, data, (int)size,
-            strerror(errno));
+      THROW4(system_error, 0, "write(%d,%p,%d) failed: %s",
+             sock->sd, data, (int) size, strerror(errno));
     }
 
     if (status) {
-      size  -= status;
-      data  += status;
+      size -= status;
+      data += status;
     } else {
-      THROW0(system_error,0,"file descriptor closed");
+      THROW0(system_error, 0, "file descriptor closed");
     }
   }
 }
+
 /**
  * gras_trp_file_chunk_recv:
  *
@@ -221,8 +219,8 @@ gras_trp_file_chunk_send_raw(gras_socket_t sock,
  */
 int
 gras_trp_file_chunk_recv(gras_socket_t sock,
-                        char *data,
-                        unsigned long int size) {
+                         char *data, unsigned long int size)
+{
 
   int got = 0;
 
@@ -231,31 +229,30 @@ gras_trp_file_chunk_recv(gras_socket_t sock,
   xbt_assert0(size >= 0, "Cannot receive a negative amount of data");
 
   if (sock->recvd) {
-     data[0] = sock->recvd_val;
-     sock->recvd = 0;
-     got++;
-     size--;
+    data[0] = sock->recvd_val;
+    sock->recvd = 0;
+    got++;
+    size--;
   }
 
   while (size) {
     int status = 0;
 
-    status = read(sock->sd, data+got, (long int)size);
-    DEBUG3("read(%d, %p, %ld);", sock->sd, data+got, size);
+    status = read(sock->sd, data + got, (long int) size);
+    DEBUG3("read(%d, %p, %ld);", sock->sd, data + got, size);
 
     if (status < 0) {
-      THROW4(system_error,0,"read(%d,%p,%d) failed: %s",
-            sock->sd, data+got, (int)size,
-            strerror(errno));
+      THROW4(system_error, 0, "read(%d,%p,%d) failed: %s",
+             sock->sd, data + got, (int) size, strerror(errno));
     }
 
     if (status) {
-      size    -= status;
-      got    += status;
+      size -= status;
+      got += status;
     } else {
-       THROW1(system_error,errno,"file descriptor closed after %d bytes",got);
+      THROW1(system_error, errno, "file descriptor closed after %d bytes",
+             got);
     }
   }
   return got;
 }
-
index 6dbb7c9..9ebfd79 100644 (file)
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "xbt/ex.h" 
+#include "xbt/ex.h"
 
 #include "gras/Msg/msg_private.h"
 #include "gras/Transport/transport_private.h"
 #include "gras/Virtu/virtu_sg.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_sg,gras_trp,"SimGrid pseudo-transport");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_sg, gras_trp,
+                                "SimGrid pseudo-transport");
 
 /***
  *** Prototypes 
  ***/
 
 /* retrieve the port record associated to a numerical port on an host */
-static void find_port(gras_hostdata_t *hd, int port, gras_sg_portrec_t *hpd);
+static void find_port(gras_hostdata_t * hd, int port,
+                      gras_sg_portrec_t * hpd);
 
 
 void gras_trp_sg_socket_client(gras_trp_plugin_t self,
-                              /* OUT */ gras_socket_t sock);
+                               /* OUT */ gras_socket_t sock);
 void gras_trp_sg_socket_server(gras_trp_plugin_t self,
-                              /* OUT */ gras_socket_t sock);
+                               /* OUT */ gras_socket_t sock);
 void gras_trp_sg_socket_close(gras_socket_t sd);
 
 void gras_trp_sg_chunk_send_raw(gras_socket_t sd,
-                               const char *data,
-                               unsigned long int size);
+                                const char *data, unsigned long int size);
 void gras_trp_sg_chunk_send(gras_socket_t sd,
-                           const char *data,
-                           unsigned long int size,
-                           int stable_ignored);
+                            const char *data,
+                            unsigned long int size, int stable_ignored);
 
 int gras_trp_sg_chunk_recv(gras_socket_t sd,
-                           char *data,
-                           unsigned long int size);
+                           char *data, unsigned long int size);
 
 /***
  *** Specific plugin part
  ***/
 typedef struct {
-  int placeholder; /* nothing plugin specific so far */
+  int placeholder;              /* nothing plugin specific so far */
 } gras_trp_sg_plug_data_t;
 
 
 /***
  *** Code
  ***/
-static void find_port(gras_hostdata_t *hd, int port,
-                     gras_sg_portrec_t *hpd) {
+static void find_port(gras_hostdata_t * hd, int port, gras_sg_portrec_t * hpd)
+{
   unsigned int cpt;
   gras_sg_portrec_t pr;
 
-  xbt_assert0(hd,"Please run gras_process_init on each process");
-  
+  xbt_assert0(hd, "Please run gras_process_init on each process");
+
   xbt_dynar_foreach(hd->ports, cpt, pr) {
     if (pr.port == port) {
-      memcpy(hpd,&pr,sizeof(gras_sg_portrec_t));
+      memcpy(hpd, &pr, sizeof(gras_sg_portrec_t));
       return;
     }
   }
-  THROW1(mismatch_error,0,"Unable to find any portrec for port #%d",port);
+  THROW1(mismatch_error, 0, "Unable to find any portrec for port #%d", port);
 }
 
 
-void
-gras_trp_sg_setup(gras_trp_plugin_t plug) {
+void gras_trp_sg_setup(gras_trp_plugin_t plug)
+{
 
-  gras_trp_sg_plug_data_t *data=xbt_new(gras_trp_sg_plug_data_t,1);
+  gras_trp_sg_plug_data_t *data = xbt_new(gras_trp_sg_plug_data_t, 1);
 
-  plug->data      = data; 
+  plug->data = data;
 
   plug->socket_client = gras_trp_sg_socket_client;
   plug->socket_server = gras_trp_sg_socket_server;
-  plug->socket_close  = gras_trp_sg_socket_close;
+  plug->socket_close = gras_trp_sg_socket_close;
 
   plug->raw_send = gras_trp_sg_chunk_send_raw;
   plug->send = gras_trp_sg_chunk_send;
   plug->raw_recv = plug->recv = gras_trp_sg_chunk_recv;
 
-  plug->flush         = NULL; /* nothing cached */
+  plug->flush = NULL;           /* nothing cached */
 }
 
 void gras_trp_sg_socket_client(gras_trp_plugin_t self,
-                              /* OUT */ gras_socket_t sock){
+                               /* OUT */ gras_socket_t sock)
+{
   xbt_ex_t e;
 
   smx_host_t peer;
@@ -101,75 +101,76 @@ void gras_trp_sg_socket_client(gras_trp_plugin_t self,
   gras_sg_portrec_t pr;
 
   /* make sure this socket will reach someone */
-  if (!(peer=SIMIX_host_get_by_name(sock->peer_name))) 
-    THROW1(mismatch_error,0,
-          "Can't connect to %s: no such host.\n",sock->peer_name);
-
-  if (!(hd=(gras_hostdata_t *)SIMIX_host_get_data(peer))) 
-    THROW1(mismatch_error,0,
-          "can't connect to %s: no process on this host",
-          sock->peer_name);
-  
+  if (!(peer = SIMIX_host_get_by_name(sock->peer_name)))
+    THROW1(mismatch_error, 0,
+           "Can't connect to %s: no such host.\n", sock->peer_name);
+
+  if (!(hd = (gras_hostdata_t *) SIMIX_host_get_data(peer)))
+    THROW1(mismatch_error, 0,
+           "can't connect to %s: no process on this host", sock->peer_name);
+
   TRY {
-    find_port(hd,sock->peer_port,&pr);
-  } CATCH(e) {
+    find_port(hd, sock->peer_port, &pr);
+  }
+  CATCH(e) {
     if (e.category == mismatch_error) {
       xbt_ex_free(e);
-      THROW2(mismatch_error,0,
-            "can't connect to %s:%d, no process listen on this port",
-            sock->peer_name,sock->peer_port);
-    } 
+      THROW2(mismatch_error, 0,
+             "can't connect to %s:%d, no process listen on this port",
+             sock->peer_name, sock->peer_port);
+    }
     RETHROW;
   }
 
   if (pr.meas && !sock->meas) {
-    THROW2(mismatch_error,0,
-          "can't connect to %s:%d in regular mode, the process listen "
-          "in measurement mode on this port",sock->peer_name,sock->peer_port);
+    THROW2(mismatch_error, 0,
+           "can't connect to %s:%d in regular mode, the process listen "
+           "in measurement mode on this port", sock->peer_name,
+           sock->peer_port);
   }
   if (!pr.meas && sock->meas) {
-    THROW2(mismatch_error,0,
-          "can't connect to %s:%d in measurement mode, the process listen "
-          "in regular mode on this port",sock->peer_name,sock->peer_port);
+    THROW2(mismatch_error, 0,
+           "can't connect to %s:%d in measurement mode, the process listen "
+           "in regular mode on this port", sock->peer_name, sock->peer_port);
   }
   /* create the socket */
-  data = xbt_new(gras_trp_sg_sock_data_t,1);
+  data = xbt_new(gras_trp_sg_sock_data_t, 1);
   data->from_process = SIMIX_process_self();
-  data->to_process   = pr.process;
-  data->to_host      = peer;
+  data->to_process = pr.process;
+  data->to_host = peer;
 
   /* initialize mutex and condition of the socket */
   data->mutex = SIMIX_mutex_init();
   data->cond = SIMIX_cond_init();
-  data->to_socket = pr.socket; 
+  data->to_socket = pr.socket;
 
   sock->data = data;
   sock->incoming = 1;
 
   DEBUG5("%s (PID %d) connects in %s mode to %s:%d",
-        SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid(),
-        sock->meas?"meas":"regular",
-        sock->peer_name,sock->peer_port);
+         SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid(),
+         sock->meas ? "meas" : "regular", sock->peer_name, sock->peer_port);
 }
 
-void gras_trp_sg_socket_server(gras_trp_plugin_t self,
-                              gras_socket_t sock){
+void gras_trp_sg_socket_server(gras_trp_plugin_t self, gras_socket_t sock)
+{
 
-  gras_hostdata_t *hd=(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
+  gras_hostdata_t *hd =
+    (gras_hostdata_t *) SIMIX_host_get_data(SIMIX_host_self());
   gras_sg_portrec_t pr;
   gras_trp_sg_sock_data_t *data;
   volatile int found;
-  
-  const char *host=SIMIX_host_get_name(SIMIX_host_self());
+
+  const char *host = SIMIX_host_get_name(SIMIX_host_self());
 
   xbt_ex_t e;
 
-  xbt_assert0(hd,"Please run gras_process_init on each process");
+  xbt_assert0(hd, "Please run gras_process_init on each process");
 
-  sock->accepting = 0; /* no such nuisance in SG */
+  sock->accepting = 0;          /* no such nuisance in SG */
   found = 0;
   TRY {
-    find_port(hd,sock->port,&pr);
+    find_port(hd, sock->port, &pr);
     found = 1;
   } CATCH(e) {
     if (e.category == mismatch_error)
@@ -177,49 +178,52 @@ void gras_trp_sg_socket_server(gras_trp_plugin_t self,
     else
       RETHROW;
   }
-   
-  if (found) 
-    THROW2(mismatch_error,0,
-          "can't listen on address %s:%d: port already in use.",
-          host,sock->port);
+
+  if (found)
+    THROW2(mismatch_error, 0,
+           "can't listen on address %s:%d: port already in use.",
+           host, sock->port);
 
   pr.port = sock->port;
   pr.meas = sock->meas;
   pr.socket = sock;
   pr.process = SIMIX_process_self();
-  xbt_dynar_push(hd->ports,&pr);
-  
+  xbt_dynar_push(hd->ports, &pr);
+
   /* Create the socket */
-  data = xbt_new(gras_trp_sg_sock_data_t,1);
-  data->from_process     = SIMIX_process_self();
-  data->to_process       = NULL;
-  data->to_host      = SIMIX_host_self();
-  
+  data = xbt_new(gras_trp_sg_sock_data_t, 1);
+  data->from_process = SIMIX_process_self();
+  data->to_process = NULL;
+  data->to_host = SIMIX_host_self();
+
   data->cond = SIMIX_cond_init();
   data->mutex = SIMIX_mutex_init();
 
   sock->data = data;
 
   VERB6("'%s' (%d) ears on %s:%d%s (%p)",
-       SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid(),
-       host,sock->port,sock->meas? " (mode meas)":"",sock);
+        SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid(),
+        host, sock->port, sock->meas ? " (mode meas)" : "", sock);
 
 }
 
-void gras_trp_sg_socket_close(gras_socket_t sock){
-  gras_hostdata_t *hd=(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
+void gras_trp_sg_socket_close(gras_socket_t sock)
+{
+  gras_hostdata_t *hd =
+    (gras_hostdata_t *) SIMIX_host_get_data(SIMIX_host_self());
   unsigned int cpt;
-  gras_sg_portrec_t pr; 
+  gras_sg_portrec_t pr;
+
+  XBT_IN1(" (sock=%p)", sock);
 
-  XBT_IN1(" (sock=%p)",sock);
-   
-  if (!sock) return;
+  if (!sock)
+    return;
 
-  xbt_assert0(hd,"Please run gras_process_init on each process");
+  xbt_assert0(hd, "Please run gras_process_init on each process");
 
   if (sock->data) {
-    SIMIX_cond_destroy(((gras_trp_sg_sock_data_t*)sock->data)->cond);
-    SIMIX_mutex_destroy(((gras_trp_sg_sock_data_t*)sock->data)->mutex);
+    SIMIX_cond_destroy(((gras_trp_sg_sock_data_t *) sock->data)->cond);
+    SIMIX_mutex_destroy(((gras_trp_sg_sock_data_t *) sock->data)->mutex);
     free(sock->data);
   }
 
@@ -228,15 +232,15 @@ void gras_trp_sg_socket_close(gras_socket_t sock){
     xbt_dynar_foreach(hd->ports, cpt, pr) {
       DEBUG2("Check pr %d of %lu", cpt, xbt_dynar_length(hd->ports));
       if (pr.port == sock->port) {
-       xbt_dynar_cursor_rm(hd->ports, &cpt);
-       XBT_OUT;
-       return;
+        xbt_dynar_cursor_rm(hd->ports, &cpt);
+        XBT_OUT;
+        return;
       }
     }
     WARN2("socket_close called on the unknown incoming socket %p (port=%d)",
-         sock,sock->port);
+          sock, sock->port);
   }
-  XBT_OUT;  
+  XBT_OUT;
 }
 
 typedef struct {
@@ -245,70 +249,70 @@ typedef struct {
 } sg_task_data_t;
 
 void gras_trp_sg_chunk_send(gras_socket_t sock,
-                           const char *data,
-                           unsigned long int size,
-                           int stable_ignored) {
-  gras_trp_sg_chunk_send_raw(sock,data,size);
+                            const char *data,
+                            unsigned long int size, int stable_ignored)
+{
+  gras_trp_sg_chunk_send_raw(sock, data, size);
 }
 
 void gras_trp_sg_chunk_send_raw(gras_socket_t sock,
-                               const char *data,
-                               unsigned long int size) {
+                                const char *data, unsigned long int size)
+{
   char name[256];
-  static unsigned int count=0;
+  static unsigned int count = 0;
 
-  smx_action_t act; /* simix action */
-  gras_trp_sg_sock_data_t *sock_data; 
+  smx_action_t act;             /* simix action */
+  gras_trp_sg_sock_data_t *sock_data;
   gras_trp_procdata_t trp_remote_proc;
   gras_msg_procdata_t msg_remote_proc;
-  gras_msg_t msg; /* message to send */
+  gras_msg_t msg;               /* message to send */
 
-  sock_data = (gras_trp_sg_sock_data_t *)sock->data;
+  sock_data = (gras_trp_sg_sock_data_t *) sock->data;
 
-  xbt_assert0(sock->meas, 
-           "SG chunk exchange shouldn't be used on non-measurement sockets");
+  xbt_assert0(sock->meas,
+              "SG chunk exchange shouldn't be used on non-measurement sockets");
 
   SIMIX_mutex_lock(sock_data->mutex);
-  sprintf(name,"Chunk[%d]",count++);
+  sprintf(name, "Chunk[%d]", count++);
   /*initialize gras message */
-  msg = xbt_new(s_gras_msg_t,1);
+  msg = xbt_new(s_gras_msg_t, 1);
   msg->expe = sock;
-  msg->payl_size=size;
+  msg->payl_size = size;
 
   if (data) {
-    msg->payl=(void*)xbt_malloc(size);
-    memcpy(msg->payl,data,size);
+    msg->payl = (void *) xbt_malloc(size);
+    memcpy(msg->payl, data, size);
   } else {
     msg->payl = NULL;
   }
-  
+
 
   /* put his socket on the selectable socket queue */
   trp_remote_proc = (gras_trp_procdata_t)
-    gras_libdata_by_name_from_remote("gras_trp",sock_data->to_process);
-  xbt_queue_push(trp_remote_proc->meas_selectable_sockets,&sock);      
+    gras_libdata_by_name_from_remote("gras_trp", sock_data->to_process);
+  xbt_queue_push(trp_remote_proc->meas_selectable_sockets, &sock);
 
   /* put message on msg_queue */
   msg_remote_proc = (gras_msg_procdata_t)
     gras_libdata_by_name_from_remote("gras_msg", sock_data->to_process);
 
-  xbt_fifo_push(msg_remote_proc->msg_to_receive_queue_meas,msg);
+  xbt_fifo_push(msg_remote_proc->msg_to_receive_queue_meas, msg);
 
   /* wait for the receiver */
-  SIMIX_cond_wait(sock_data->cond,sock_data->mutex);
-  
+  SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
+
   /* creates simix action and waits its ends, waits in the sender host
-     condition*/
+     condition */
   DEBUG5("send chunk %s from %s to  %s:%d (size=%ld)",
-        name, SIMIX_host_get_name(SIMIX_host_self()),
-        SIMIX_host_get_name(sock_data->to_host), sock->peer_port,size);
+         name, SIMIX_host_get_name(SIMIX_host_self()),
+         SIMIX_host_get_name(sock_data->to_host), sock->peer_port, size);
 
   act = SIMIX_action_communicate(SIMIX_host_self(), sock_data->to_host,
-                                name, size, -1);
-  SIMIX_register_action_to_condition(act,sock_data->cond);
-  SIMIX_cond_wait(sock_data->cond,sock_data->mutex);
-  SIMIX_unregister_action_to_condition(act,sock_data->cond);
-  /* error treatmeant (FIXME)*/
+                                 name, size, -1);
+  SIMIX_register_action_to_condition(act, sock_data->cond);
+  SIMIX_cond_wait(sock_data->cond, sock_data->mutex);
+  SIMIX_unregister_action_to_condition(act, sock_data->cond);
+  /* error treatmeant (FIXME) */
 
   /* cleanup structures */
   SIMIX_action_destroy(act);
@@ -317,53 +321,52 @@ void gras_trp_sg_chunk_send_raw(gras_socket_t sock,
 }
 
 int gras_trp_sg_chunk_recv(gras_socket_t sock,
-                          char *data,
-                          unsigned long int size){
-  gras_trp_sg_sock_data_t *sock_data; 
-  gras_trp_sg_sock_data_t *remote_sock_data; 
-  gras_socket_t remote_socket= NULL;
+                           char *data, unsigned long int size)
+{
+  gras_trp_sg_sock_data_t *sock_data;
+  gras_trp_sg_sock_data_t *remote_sock_data;
+  gras_socket_t remote_socket = NULL;
   gras_msg_t msg_got;
-  gras_msg_procdata_t msg_procdata = 
-    (gras_msg_procdata_t)gras_libdata_by_name("gras_msg");
+  gras_msg_procdata_t msg_procdata =
+    (gras_msg_procdata_t) gras_libdata_by_name("gras_msg");
   gras_trp_procdata_t trp_proc =
-    (gras_trp_procdata_t)gras_libdata_by_id(gras_trp_libdata_id);
+    (gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id);
 
-  xbt_assert0(sock->meas, 
-           "SG chunk exchange shouldn't be used on non-measurement sockets");
-       xbt_queue_shift_timed(trp_proc->meas_selectable_sockets,
-                                                                               &remote_socket, 60);
+  xbt_assert0(sock->meas,
+              "SG chunk exchange shouldn't be used on non-measurement sockets");
+  xbt_queue_shift_timed(trp_proc->meas_selectable_sockets,
+                        &remote_socket, 60);
 
-       if (remote_socket == NULL) {
-    THROW0(timeout_error,0,"Timeout");
-       }
+  if (remote_socket == NULL) {
+    THROW0(timeout_error, 0, "Timeout");
+  }
 
-       remote_sock_data = (gras_trp_sg_sock_data_t *)remote_socket->data;
+  remote_sock_data = (gras_trp_sg_sock_data_t *) remote_socket->data;
   msg_got = xbt_fifo_shift(msg_procdata->msg_to_receive_queue_meas);
-  
-  sock_data = (gras_trp_sg_sock_data_t *)sock->data;
+
+  sock_data = (gras_trp_sg_sock_data_t *) sock->data;
 
   /* ok, I'm here, you can continue the communication */
   SIMIX_cond_signal(remote_sock_data->cond);
 
   SIMIX_mutex_lock(remote_sock_data->mutex);
   /* wait for communication end */
-  SIMIX_cond_wait(remote_sock_data->cond,remote_sock_data->mutex);
+  SIMIX_cond_wait(remote_sock_data->cond, remote_sock_data->mutex);
 
   if (msg_got->payl_size != size)
-    THROW5(mismatch_error,0,
-          "Got %d bytes when %ld where expected (in %s->%s:%d)",
-          msg_got->payl_size, size,
-          SIMIX_host_get_name(sock_data->to_host),
-          SIMIX_host_get_name(SIMIX_host_self()), sock->peer_port);
-
-  if (data) 
-    memcpy(data,msg_got->payl,size);
-  
+    THROW5(mismatch_error, 0,
+           "Got %d bytes when %ld where expected (in %s->%s:%d)",
+           msg_got->payl_size, size,
+           SIMIX_host_get_name(sock_data->to_host),
+           SIMIX_host_get_name(SIMIX_host_self()), sock->peer_port);
+
+  if (data)
+    memcpy(data, msg_got->payl, size);
+
   if (msg_got->payl)
-    xbt_free(msg_got->payl);   
+    xbt_free(msg_got->payl);
 
   xbt_free(msg_got);
   SIMIX_mutex_unlock(remote_sock_data->mutex);
   return 0;
 }
-
index c16da0f..de76134 100644 (file)
@@ -8,28 +8,28 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdlib.h>
-#include <string.h>       /* memset */
+#include <string.h>             /* memset */
 
 #include "portable.h"
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/ex.h"
 #include "gras/Transport/transport_private.h"
-#include "gras/Msg/msg_interface.h" /* listener_close_socket */
+#include "gras/Msg/msg_interface.h"     /* listener_close_socket */
 
 /* FIXME maybe READV is sometime a good thing? */
 #undef HAVE_READV
 
 #ifdef HAVE_READV
 #include <sys/uio.h>
-#endif       
+#endif
 
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
 #endif
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_tcp,gras_trp,
-      "TCP buffered transport");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_tcp, gras_trp,
+                                "TCP buffered transport");
 
 /***
  *** Specific socket part
@@ -40,11 +40,11 @@ typedef enum { buffering_buf, buffering_iov } buffering_kind;
 typedef struct {
   int size;
   char *data;
-  int pos; /* for receive; not exchanged over the net */
+  int pos;                      /* for receive; not exchanged over the net */
 } gras_trp_buf_t;
 
 
-struct gras_trp_bufdata_{
+struct gras_trp_bufdata_ {
   int buffsize;
   gras_trp_buf_t in_buf;
   gras_trp_buf_t out_buf;
@@ -65,60 +65,66 @@ struct gras_trp_bufdata_{
 /* we exchange port number on client side on socket creation,
    so we need to be able to talk right now. */
 static XBT_INLINE void gras_trp_tcp_send(gras_socket_t sock, const char *data,
-                                    unsigned long int size);
+                                         unsigned long int size);
 static int gras_trp_tcp_recv(gras_socket_t sock, char *data,
-                            unsigned long int size);
+                             unsigned long int size);
 
 
 static int _gras_tcp_proto_number(void);
 
 static XBT_INLINE void gras_trp_sock_socket_client(gras_trp_plugin_t ignored,
-                                              gras_socket_t sock){
-  
+                                                   gras_socket_t sock)
+{
+
   struct sockaddr_in addr;
   struct hostent *he;
   struct in_addr *haddr;
-  int size = sock->buf_size; 
-  uint32_t myport = htonl(((gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id))->myport);
+  int size = sock->buf_size;
+  uint32_t myport = htonl(((gras_trp_procdata_t)
+                           gras_libdata_by_id(gras_trp_libdata_id))->myport);
 
-  sock->incoming = 1; /* TCP sockets are duplex'ed */
+  sock->incoming = 1;           /* TCP sockets are duplex'ed */
+
+  sock->sd = socket(AF_INET, SOCK_STREAM, 0);
 
-  sock->sd = socket (AF_INET, SOCK_STREAM, 0);
-  
   if (sock->sd < 0) {
-    THROW1(system_error,0, "Failed to create socket: %s", sock_errstr(sock_errno));
+    THROW1(system_error, 0, "Failed to create socket: %s",
+           sock_errstr(sock_errno));
   }
 
-  if (setsockopt(sock->sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size)) ||
-      setsockopt(sock->sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size))) {
-     VERB1("setsockopt failed, cannot set buffer size: %s",sock_errstr(sock_errno));
+  if (setsockopt
+      (sock->sd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size))
+      || setsockopt(sock->sd, SOL_SOCKET, SO_SNDBUF, (char *) &size,
+                    sizeof(size))) {
+    VERB1("setsockopt failed, cannot set buffer size: %s",
+          sock_errstr(sock_errno));
   }
-  
-  he = gethostbyname (sock->peer_name);
+
+  he = gethostbyname(sock->peer_name);
   if (he == NULL) {
-    THROW2(system_error,0, "Failed to lookup hostname %s: %s",
-          sock->peer_name, sock_errstr(sock_errno));
+    THROW2(system_error, 0, "Failed to lookup hostname %s: %s",
+           sock->peer_name, sock_errstr(sock_errno));
   }
-  
+
   haddr = ((struct in_addr *) (he->h_addr_list)[0]);
-  
+
   memset(&addr, 0, sizeof(struct sockaddr_in));
-  memcpy (&addr.sin_addr, haddr, sizeof(struct in_addr));
+  memcpy(&addr.sin_addr, haddr, sizeof(struct in_addr));
   addr.sin_family = AF_INET;
-  addr.sin_port = htons (sock->peer_port);
+  addr.sin_port = htons(sock->peer_port);
 
-  if (connect (sock->sd, (struct sockaddr*) &addr, sizeof (addr)) < 0) {
+  if (connect(sock->sd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
     tcp_close(sock->sd);
-    THROW3(system_error,0,
-          "Failed to connect socket to %s:%d (%s)",
-          sock->peer_name, sock->peer_port, sock_errstr(sock_errno));
+    THROW3(system_error, 0,
+           "Failed to connect socket to %s:%d (%s)",
+           sock->peer_name, sock->peer_port, sock_errstr(sock_errno));
   }
 
-  gras_trp_tcp_send(sock,(char*)&myport,sizeof(uint32_t));
+  gras_trp_tcp_send(sock, (char *) &myport, sizeof(uint32_t));
   DEBUG1("peerport sent to %d", sock->peer_port);
 
   VERB4("Connect to %s:%d (sd=%d, port %d here)",
-       sock->peer_name, sock->peer_port, sock->sd, sock->port);
+        sock->peer_name, sock->peer_port, sock->sd, sock->port);
 }
 
 /**
@@ -127,53 +133,56 @@ static XBT_INLINE void gras_trp_sock_socket_client(gras_trp_plugin_t ignored,
  * Open a socket used to receive messages.
  */
 static XBT_INLINE void gras_trp_sock_socket_server(gras_trp_plugin_t ignored,
-                                              gras_socket_t sock){
-  int size = sock->buf_size; 
+                                                   gras_socket_t sock)
+{
+  int size = sock->buf_size;
   int on = 1;
   struct sockaddr_in server;
 
-  sock->outgoing  = 1; /* TCP => duplex mode */
+  sock->outgoing = 1;           /* TCP => duplex mode */
 
-  server.sin_port = htons((u_short)sock->port);
+  server.sin_port = htons((u_short) sock->port);
   server.sin_addr.s_addr = INADDR_ANY;
   server.sin_family = AF_INET;
-  if((sock->sd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-    THROW1(system_error,0,"Socket allocation failed: %s", sock_errstr(sock_errno));
-
-  if (setsockopt(sock->sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)))
-     THROW1(system_error,0,
-           "setsockopt failed, cannot condition the socket: %s",
-           sock_errstr(sock_errno));
-   
-  if (   setsockopt(sock->sd, SOL_SOCKET, SO_RCVBUF,
-                   (char *)&size, sizeof(size)) 
-      || setsockopt(sock->sd, SOL_SOCKET, SO_SNDBUF, 
-                   (char *)&size, sizeof(size))) {
-     VERB1("setsockopt failed, cannot set buffer size: %s",
-          sock_errstr(sock_errno));
+  if ((sock->sd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+    THROW1(system_error, 0, "Socket allocation failed: %s",
+           sock_errstr(sock_errno));
+
+  if (setsockopt
+      (sock->sd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)))
+    THROW1(system_error, 0,
+           "setsockopt failed, cannot condition the socket: %s",
+           sock_errstr(sock_errno));
+
+  if (setsockopt(sock->sd, SOL_SOCKET, SO_RCVBUF,
+                 (char *) &size, sizeof(size))
+      || setsockopt(sock->sd, SOL_SOCKET, SO_SNDBUF,
+                    (char *) &size, sizeof(size))) {
+    VERB1("setsockopt failed, cannot set buffer size: %s",
+          sock_errstr(sock_errno));
   }
-       
-  if (bind(sock->sd, (struct sockaddr *)&server, sizeof(server)) == -1) {
+
+  if (bind(sock->sd, (struct sockaddr *) &server, sizeof(server)) == -1) {
     tcp_close(sock->sd);
-    THROW2(system_error,0,
-          "Cannot bind to port %d: %s",
-          sock->port, sock_errstr(sock_errno));
+    THROW2(system_error, 0,
+           "Cannot bind to port %d: %s", sock->port, sock_errstr(sock_errno));
   }
 
-  DEBUG2("Listen on port %d (sd=%d)",sock->port, sock->sd);
+  DEBUG2("Listen on port %d (sd=%d)", sock->port, sock->sd);
   if (listen(sock->sd, 5) < 0) {
     tcp_close(sock->sd);
-    THROW2(system_error,0,
-          "Cannot listen on port %d: %s",
-          sock->port,sock_errstr(sock_errno));
+    THROW2(system_error, 0,
+           "Cannot listen on port %d: %s",
+           sock->port, sock_errstr(sock_errno));
   }
 
-  VERB2("Openned a server socket on port %d (sd=%d)",sock->port,sock->sd);
+  VERB2("Openned a server socket on port %d (sd=%d)", sock->port, sock->sd);
 }
 
-static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock) {
+static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock)
+{
   gras_socket_t res;
-  
+
   struct sockaddr_in peer_in;
   socklen_t peer_in_len = sizeof(peer_in);
 
@@ -185,75 +194,82 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock) {
   socklen_t s = sizeof(int);
 
   uint32_t hisport;
-               
+
   XBT_IN;
-  gras_trp_socket_new(1,&res);
+  gras_trp_socket_new(1, &res);
 
-  sd = accept(sock->sd, (struct sockaddr *)&peer_in, &peer_in_len);
+  sd = accept(sock->sd, (struct sockaddr *) &peer_in, &peer_in_len);
   tmp_errno = sock_errno;
 
   if (sd == -1) {
     gras_socket_close(sock);
-    THROW1(system_error,0,
-          "Accept failed (%s). Droping server socket.", sock_errstr(tmp_errno));
+    THROW1(system_error, 0,
+           "Accept failed (%s). Droping server socket.",
+           sock_errstr(tmp_errno));
   }
-  
-  if (setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&i, s) 
-      || setsockopt(sd, _gras_tcp_proto_number(), TCP_NODELAY, (char *)&i, s))
-    THROW1(system_error,0,"setsockopt failed, cannot condition the socket: %s",
-          sock_errstr(tmp_errno));
+
+  if (setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &i, s)
+      || setsockopt(sd, _gras_tcp_proto_number(), TCP_NODELAY, (char *) &i,
+                    s))
+    THROW1(system_error, 0,
+           "setsockopt failed, cannot condition the socket: %s",
+           sock_errstr(tmp_errno));
 
   res->buf_size = sock->buf_size;
   size = sock->buf_size;
-  if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size))
-      || setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size)))
-    VERB1("setsockopt failed, cannot set buffer size: %s", sock_errstr(tmp_errno));
-     
-  res->plugin    = sock->plugin;
-  res->incoming  = sock->incoming;
-  res->outgoing  = sock->outgoing;
+  if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size))
+      || setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *) &size, sizeof(size)))
+    VERB1("setsockopt failed, cannot set buffer size: %s",
+          sock_errstr(tmp_errno));
+
+  res->plugin = sock->plugin;
+  res->incoming = sock->incoming;
+  res->outgoing = sock->outgoing;
   res->accepting = 0;
-  res->sd        = sd;
-  res->port      = -1;
+  res->sd = sd;
+  res->port = -1;
 
-  gras_trp_tcp_recv(res,(char*)&hisport,sizeof(hisport));
+  gras_trp_tcp_recv(res, (char *) &hisport, sizeof(hisport));
   res->peer_port = ntohl(hisport);
-  DEBUG1("peerport %d received",res->peer_port);
+  DEBUG1("peerport %d received", res->peer_port);
 
   /* FIXME: Lock to protect inet_ntoa */
-  if (((struct sockaddr *)&peer_in)->sa_family != AF_INET) {
-    res->peer_name = (char*)strdup("unknown");
+  if (((struct sockaddr *) &peer_in)->sa_family != AF_INET) {
+    res->peer_name = (char *) strdup("unknown");
   } else {
     struct in_addr addrAsInAddr;
     char *tmp;
-    
+
     addrAsInAddr.s_addr = peer_in.sin_addr.s_addr;
-    
+
     tmp = inet_ntoa(addrAsInAddr);
     if (tmp != NULL) {
-      res->peer_name = (char*)strdup(tmp);
+      res->peer_name = (char *) strdup(tmp);
     } else {
-      res->peer_name = (char*)strdup("unknown");
+      res->peer_name = (char *) strdup("unknown");
     }
   }
-  
-  VERB3("Accepted from %s:%d (sd=%d)", res->peer_name,res->peer_port,sd);
+
+  VERB3("Accepted from %s:%d (sd=%d)", res->peer_name, res->peer_port, sd);
   xbt_dynar_push(((gras_trp_procdata_t)
-                 gras_libdata_by_id(gras_trp_libdata_id))->sockets,&res);
-   
+                  gras_libdata_by_id(gras_trp_libdata_id))->sockets, &res);
+
   XBT_OUT;
   return res;
 }
 
-static void gras_trp_sock_socket_close(gras_socket_t sock){
-  
-  if (!sock) return; /* close only once */
+static void gras_trp_sock_socket_close(gras_socket_t sock)
+{
+
+  if (!sock)
+    return;                     /* close only once */
 
   VERB1("close tcp connection %d", sock->sd);
-   
+
   /* ask the listener to close the socket */
   gras_msg_listener_close_socket(sock->sd);
 }
+
 /************************************/
 /****[ end of SOCKET MANAGEMENT ]****/
 /************************************/
@@ -265,75 +281,77 @@ static void gras_trp_sock_socket_close(gras_socket_t sock){
 /* Temptation to merge this with file data exchange is great, 
    but doesn't work on BillWare (see tcp_write() in portable.h) */
 static XBT_INLINE void gras_trp_tcp_send(gras_socket_t sock,
-                                    const char *data,
-                                    unsigned long int size) {
-  
+                                         const char *data,
+                                         unsigned long int size)
+{
+
   while (size) {
     int status = 0;
-    
-    status = tcp_write(sock->sd, data, (size_t)size);
+
+    status = tcp_write(sock->sd, data, (size_t) size);
     DEBUG3("write(%d, %p, %ld);", sock->sd, data, size);
-    
+
     if (status < 0) {
 #ifdef EWOULDBLOCK
-       if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
+      if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
 #else
-       if (errno == EINTR || errno == EAGAIN)
+      if (errno == EINTR || errno == EAGAIN)
 #endif
-        continue;
-       
-      THROW4(system_error,0,"write(%d,%p,%ld) failed: %s",
-            sock->sd, data, size,
-            sock_errstr(sock_errno));
+        continue;
+
+      THROW4(system_error, 0, "write(%d,%p,%ld) failed: %s",
+             sock->sd, data, size, sock_errstr(sock_errno));
     }
-    
+
     if (status) {
-      size  -= status;
-      data  += status;
+      size -= status;
+      data += status;
     } else {
-      THROW1(system_error,0,"file descriptor closed (%s)",
+      THROW1(system_error, 0, "file descriptor closed (%s)",
              sock_errstr(sock_errno));
     }
   }
 }
-static XBT_INLINE int 
+
+static XBT_INLINE int
 gras_trp_tcp_recv_withbuffer(gras_socket_t sock,
-                                  char *data,
-                                  unsigned long int size,
-                                  unsigned long int bufsize) {
+                             char *data,
+                             unsigned long int size,
+                             unsigned long int bufsize)
+{
 
   int got = 0;
 
   if (sock->recvd) {
-     data[0] = sock->recvd_val;
-     sock->recvd = 0;
-     got++;
-     bufsize--;
-  }   
+    data[0] = sock->recvd_val;
+    sock->recvd = 0;
+    got++;
+    bufsize--;
+  }
 
-  while (size>got) {
+  while (size > got) {
     int status = 0;
-    
+
     DEBUG5("read(%d, %p, %ld) got %d so far (%s)",
-         sock->sd, data+got, bufsize, got,
-         hexa_str((unsigned char*)data,got,0));
-    status = tcp_read(sock->sd, data+got, (size_t)bufsize);
-    
+           sock->sd, data + got, bufsize, got,
+           hexa_str((unsigned char *) data, got, 0));
+    status = tcp_read(sock->sd, data + got, (size_t) bufsize);
+
     if (status < 0) {
-      THROW7(system_error,0,"read(%d,%p,%d) from %s:%d failed: %s; got %d so far",
-            sock->sd, data+got, (int)size,
-            gras_socket_peer_name(sock),gras_socket_peer_port(sock),
-            sock_errstr(sock_errno),
-            got);
+      THROW7(system_error, 0,
+             "read(%d,%p,%d) from %s:%d failed: %s; got %d so far", sock->sd,
+             data + got, (int) size, gras_socket_peer_name(sock),
+             gras_socket_peer_port(sock), sock_errstr(sock_errno), got);
     }
-    DEBUG2("Got %d more bytes (%s)",status,hexa_str((unsigned char*)data+got,status,0));
-    
+    DEBUG2("Got %d more bytes (%s)", status,
+           hexa_str((unsigned char *) data + got, status, 0));
+
     if (status) {
       bufsize -= status;
-      got     += status;
+      got += status;
     } else {
-      THROW1(system_error,errno,"Socket closed by remote side (got %d bytes before this)",
-            got);
+      THROW1(system_error, errno,
+             "Socket closed by remote side (got %d bytes before this)", got);
     }
   }
 
@@ -341,11 +359,12 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock,
 }
 
 static int gras_trp_tcp_recv(gras_socket_t sock,
-                                  char *data,
-                                  unsigned long int size) {
-  return gras_trp_tcp_recv_withbuffer(sock,data,size,size);
+                             char *data, unsigned long int size)
+{
+  return gras_trp_tcp_recv_withbuffer(sock, data, size, size);
 
 }
+
 /*******************************************/
 /****[ end of UNBUFFERED DATA EXCHANGE ]****/
 /*******************************************/
@@ -355,80 +374,82 @@ static int gras_trp_tcp_recv(gras_socket_t sock,
 /**********************************/
 
 /* Make sure the data is sent */
-static void
-gras_trp_bufiov_flush(gras_socket_t sock) {
+static void gras_trp_bufiov_flush(gras_socket_t sock)
+{
 #ifdef HAVE_READV
   xbt_dynar_t vect;
   int size;
 #endif
-  gras_trp_bufdata_t *data=sock->bufdata;
-  XBT_IN;    
-  
+  gras_trp_bufdata_t *data = sock->bufdata;
+  XBT_IN;
+
   DEBUG0("Flush");
   if (data->out == buffering_buf) {
-    if (XBT_LOG_ISENABLED(gras_trp_tcp,xbt_log_priority_debug))
+    if (XBT_LOG_ISENABLED(gras_trp_tcp, xbt_log_priority_debug))
       hexa_print("chunk to send ",
-                (unsigned char *) data->out_buf.data,data->out_buf.size);
-    if ((data->out_buf.size - data->out_buf.pos) != 0) { 
-      DEBUG3("Send the chunk (size=%d) to %s:%d",data->out_buf.size,
-            gras_socket_peer_name(sock),gras_socket_peer_port(sock));
+                 (unsigned char *) data->out_buf.data, data->out_buf.size);
+    if ((data->out_buf.size - data->out_buf.pos) != 0) {
+      DEBUG3("Send the chunk (size=%d) to %s:%d", data->out_buf.size,
+             gras_socket_peer_name(sock), gras_socket_peer_port(sock));
       gras_trp_tcp_send(sock, data->out_buf.data, data->out_buf.size);
-      VERB1("Chunk sent (size=%d)",data->out_buf.size);
+      VERB1("Chunk sent (size=%d)", data->out_buf.size);
       data->out_buf.size = 0;
     }
   }
-
 #ifdef HAVE_READV
   if (data->out == buffering_iov) {
     DEBUG0("Flush out iov");
     vect = sock->bufdata->out_buf_v;
     if ((size = xbt_dynar_length(vect))) {
-      DEBUG1("Flush %d chunks out of this socket",size);
-      writev(sock->sd,xbt_dynar_get_ptr(vect,0),size);
+      DEBUG1("Flush %d chunks out of this socket", size);
+      writev(sock->sd, xbt_dynar_get_ptr(vect, 0), size);
       xbt_dynar_reset(vect);
     }
-    data->out_buf.size = 0; /* reset the buffer containing non-stable data */
+    data->out_buf.size = 0;     /* reset the buffer containing non-stable data */
   }
 
   if (data->in == buffering_iov) {
     DEBUG0("Flush in iov");
     vect = sock->bufdata->in_buf_v;
     if ((size = xbt_dynar_length(vect))) {
-      DEBUG1("Get %d chunks from of this socket",size);
-      readv(sock->sd,xbt_dynar_get_ptr(vect,0),size);
+      DEBUG1("Get %d chunks from of this socket", size);
+      readv(sock->sd, xbt_dynar_get_ptr(vect, 0), size);
       xbt_dynar_reset(vect);
     }
   }
 #endif
 }
+
 static void
 gras_trp_buf_send(gras_socket_t sock,
-                 const char *chunk,
-                 unsigned long int size,
-                 int stable_ignored) {
+                  const char *chunk,
+                  unsigned long int size, int stable_ignored)
+{
 
-  gras_trp_bufdata_t *data=(gras_trp_bufdata_t*)sock->bufdata;
-  int chunk_pos=0;
+  gras_trp_bufdata_t *data = (gras_trp_bufdata_t *) sock->bufdata;
+  int chunk_pos = 0;
 
   XBT_IN;
 
   while (chunk_pos < size) {
     /* size of the chunk to receive in that shot */
-    long int thissize = min(size-chunk_pos,data->buffsize-data->out_buf.size);
+    long int thissize =
+      min(size - chunk_pos, data->buffsize - data->out_buf.size);
     DEBUG4("Set the chars %d..%ld into the buffer; size=%ld, ctn=(%s)",
-          (int)data->out_buf.size,
-          ((int)data->out_buf.size) + thissize -1,
-          size,
-          hexa_str((unsigned char*)chunk,thissize,0));
+           (int) data->out_buf.size,
+           ((int) data->out_buf.size) + thissize - 1, size,
+           hexa_str((unsigned char *) chunk, thissize, 0));
 
-    memcpy(data->out_buf.data + data->out_buf.size, chunk + chunk_pos, thissize);
+    memcpy(data->out_buf.data + data->out_buf.size, chunk + chunk_pos,
+           thissize);
 
     data->out_buf.size += thissize;
-    chunk_pos      += thissize;
+    chunk_pos += thissize;
     DEBUG4("New pos = %d; Still to send = %ld of %ld; ctn sofar=(%s)",
-          data->out_buf.size,size-chunk_pos,size,hexa_str((unsigned char*)chunk,chunk_pos,0));
+           data->out_buf.size, size - chunk_pos, size,
+           hexa_str((unsigned char *) chunk, chunk_pos, 0));
 
-    if (data->out_buf.size == data->buffsize) /* out of space. Flush it */
+    if (data->out_buf.size == data->buffsize)   /* out of space. Flush it */
       gras_trp_bufiov_flush(sock);
   }
 
@@ -436,46 +457,46 @@ gras_trp_buf_send(gras_socket_t sock,
 }
 
 static int
-gras_trp_buf_recv(gras_socket_t sock,
-                 char *chunk,
-                 unsigned long int size) {
+gras_trp_buf_recv(gras_socket_t sock, char *chunk, unsigned long int size)
+{
 
-  gras_trp_bufdata_t *data=sock->bufdata;
+  gras_trp_bufdata_t *data = sock->bufdata;
   long int chunk_pos = 0;
-   
+
   XBT_IN;
 
   while (chunk_pos < size) {
     /* size of the chunk to receive in that shot */
     long int thissize;
 
-    if (data->in_buf.size == data->in_buf.pos) { /* out of data. Get more */
+    if (data->in_buf.size == data->in_buf.pos) {        /* out of data. Get more */
 
       DEBUG2("Get more data (size=%d,bufsize=%d)",
-            (int)MIN(size-chunk_pos,data->buffsize),
-            (int)data->buffsize);
-
-       
-      data->in_buf.size = 
-       gras_trp_tcp_recv_withbuffer(sock, data->in_buf.data, 
-                                    MIN(size-chunk_pos,data->buffsize),
-                                    data->buffsize);
-       
-      data->in_buf.pos=0;
+             (int) MIN(size - chunk_pos, data->buffsize),
+             (int) data->buffsize);
+
+
+      data->in_buf.size =
+        gras_trp_tcp_recv_withbuffer(sock, data->in_buf.data,
+                                     MIN(size - chunk_pos, data->buffsize),
+                                     data->buffsize);
+
+      data->in_buf.pos = 0;
     }
-     
-    thissize = min(size-chunk_pos ,  data->in_buf.size - data->in_buf.pos);
-    memcpy(chunk+chunk_pos, data->in_buf.data + data->in_buf.pos, thissize);
+
+    thissize = min(size - chunk_pos, data->in_buf.size - data->in_buf.pos);
+    memcpy(chunk + chunk_pos, data->in_buf.data + data->in_buf.pos, thissize);
 
     data->in_buf.pos += thissize;
-    chunk_pos        += thissize;
+    chunk_pos += thissize;
     DEBUG4("New pos = %d; Still to receive = %ld of %ld. Ctn so far=(%s)",
-          data->in_buf.pos,size - chunk_pos,size,hexa_str((unsigned char*)chunk,chunk_pos,0));
+           data->in_buf.pos, size - chunk_pos, size,
+           hexa_str((unsigned char *) chunk, chunk_pos, 0));
   }
   /* indicate on need to the gras_select function that there is more to read on this socket so that it does not actually select */
   sock->moredata = (data->in_buf.size > data->in_buf.pos);
-  DEBUG1("There is %smore data",(sock->moredata?"":"no "));
-   
+  DEBUG1("There is %smore data", (sock->moredata ? "" : "no "));
+
   XBT_OUT;
   return chunk_pos;
 }
@@ -490,56 +511,55 @@ gras_trp_buf_recv(gras_socket_t sock,
 #ifdef HAVE_READV
 static void
 gras_trp_iov_send(gras_socket_t sock,
-                 const char *chunk,
-                 unsigned long int size,
-                 int stable) {
+                  const char *chunk, unsigned long int size, int stable)
+{
   struct iovec elm;
-  gras_trp_bufdata_t *data=(gras_trp_bufdata_t*)sock->bufdata;
-    
+  gras_trp_bufdata_t *data = (gras_trp_bufdata_t *) sock->bufdata;
+
 
   DEBUG1("Buffer one chunk to be sent later (%s)",
-       hexa_str((char*)chunk,size,0));
+         hexa_str((char *) chunk, size, 0));
 
-  elm.iov_len = (size_t)size;
+  elm.iov_len = (size_t) size;
 
   if (!stable) {
     /* data storage won't last until flush. Save it in a buffer if we can */
 
-    if (size > data->buffsize-data->out_buf.size) {
+    if (size > data->buffsize - data->out_buf.size) {
       /* buffer too small: 
-        flush the socket, using data in its actual storage */
-      elm.iov_base = (void*)chunk;
-      xbt_dynar_push(data->out_buf_v,&elm);
+         flush the socket, using data in its actual storage */
+      elm.iov_base = (void *) chunk;
+      xbt_dynar_push(data->out_buf_v, &elm);
 
-      gras_trp_bufiov_flush(sock);      
+      gras_trp_bufiov_flush(sock);
       return;
     } else {
       /* buffer big enough: 
-        copy data into it, and chain it for upcoming writev */
+         copy data into it, and chain it for upcoming writev */
       memcpy(data->out_buf.data + data->out_buf.size, chunk, size);
-      elm.iov_base = (void*)(data->out_buf.data + data->out_buf.size);
+      elm.iov_base = (void *) (data->out_buf.data + data->out_buf.size);
       data->out_buf.size += size;
 
-      xbt_dynar_push(data->out_buf_v,&elm);
+      xbt_dynar_push(data->out_buf_v, &elm);
     }
 
   } else {
     /* data storage stable. Chain it */
-    
-    elm.iov_base = (void*)chunk;
-    xbt_dynar_push(data->out_buf_v,&elm);
+
+    elm.iov_base = (void *) chunk;
+    xbt_dynar_push(data->out_buf_v, &elm);
   }
 }
+
 static int
-gras_trp_iov_recv(gras_socket_t sock,
-                 char *chunk,
-                 unsigned long int size) {
+gras_trp_iov_recv(gras_socket_t sock, char *chunk, unsigned long int size)
+{
   struct iovec elm;
 
   DEBUG0("Buffer one chunk to be received later");
-  elm.iov_base = (void*)chunk;
-  elm.iov_len = (size_t)size;
-  xbt_dynar_push(sock->bufdata->in_buf_v,&elm);
+  elm.iov_base = (void *) chunk;
+  elm.iov_len = (size_t) size;
+  xbt_dynar_push(sock->bufdata->in_buf_v, &elm);
 
   return size;
 }
@@ -553,38 +573,37 @@ gras_trp_iov_recv(gras_socket_t sock,
 /***
  *** Prototypes of BUFFERED
  ***/
-   
-void gras_trp_buf_socket_client(gras_trp_plugin_t self,
-                               gras_socket_t sock);
-void gras_trp_buf_socket_server(gras_trp_plugin_t self,
-                               gras_socket_t sock);
+
+void gras_trp_buf_socket_client(gras_trp_plugin_t self, gras_socket_t sock);
+void gras_trp_buf_socket_server(gras_trp_plugin_t self, gras_socket_t sock);
 gras_socket_t gras_trp_buf_socket_accept(gras_socket_t sock);
 
-void         gras_trp_buf_socket_close(gras_socket_t sd);
-  
+void gras_trp_buf_socket_close(gras_socket_t sd);
+
+
+gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock)
+{
+  gras_trp_bufdata_t *data = xbt_new(gras_trp_bufdata_t, 1);
+
+  data->buffsize = 100 * 1024;  /* 100k */
 
-gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock) {
-  gras_trp_bufdata_t *data=xbt_new(gras_trp_bufdata_t,1);
-  
-  data->buffsize = 100 * 1024 ; /* 100k */ 
+  data->in_buf.size = 0;
+  data->in_buf.data = xbt_malloc(data->buffsize);
+  data->in_buf.pos = 0;         /* useless, indeed, since size==pos */
 
-  data->in_buf.size  = 0;
-  data->in_buf.data  = xbt_malloc(data->buffsize);
-  data->in_buf.pos   = 0; /* useless, indeed, since size==pos */
-   
   data->out_buf.size = 0;
   data->out_buf.data = xbt_malloc(data->buffsize);
-  data->out_buf.pos  = data->out_buf.size;
+  data->out_buf.pos = data->out_buf.size;
 
 #ifdef HAVE_READV
   data->in_buf_v = data->out_buf_v = NULL;
-  data->in_buf_v=xbt_dynar_new(sizeof(struct iovec),NULL);
-  data->out_buf_v=xbt_dynar_new(sizeof(struct iovec),NULL);
+  data->in_buf_v = xbt_dynar_new(sizeof(struct iovec), NULL);
+  data->out_buf_v = xbt_dynar_new(sizeof(struct iovec), NULL);
   data->out = buffering_iov;
 #else
   data->out = buffering_buf;
 #endif
-   
+
   data->in = buffering_buf;
 
   sock->bufdata = data;
@@ -594,13 +613,13 @@ gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock) {
 /***
  *** Code
  ***/
-void
-gras_trp_tcp_setup(gras_trp_plugin_t plug) {
+void gras_trp_tcp_setup(gras_trp_plugin_t plug)
+{
 
   plug->socket_client = gras_trp_buf_socket_client;
   plug->socket_server = gras_trp_buf_socket_server;
   plug->socket_accept = gras_trp_buf_socket_accept;
-  plug->socket_close  = gras_trp_buf_socket_close;
+  plug->socket_close = gras_trp_buf_socket_close;
 
 #ifdef HAVE_READV
   plug->send = gras_trp_iov_send;
@@ -609,19 +628,20 @@ gras_trp_tcp_setup(gras_trp_plugin_t plug) {
 #endif
   plug->recv = gras_trp_buf_recv;
 
-  plug->raw_send    = gras_trp_tcp_send;
-  plug->raw_recv    = gras_trp_tcp_recv;
+  plug->raw_send = gras_trp_tcp_send;
+  plug->raw_recv = gras_trp_tcp_recv;
 
-  plug->flush         = gras_trp_bufiov_flush;
+  plug->flush = gras_trp_bufiov_flush;
 
   plug->data = NULL;
   plug->exit = NULL;
 }
 
 void gras_trp_buf_socket_client(gras_trp_plugin_t self,
-                               /* OUT */ gras_socket_t sock){
+                                /* OUT */ gras_socket_t sock)
+{
 
-  gras_trp_sock_socket_client(NULL,sock);
+  gras_trp_sock_socket_client(NULL, sock);
   gras_trp_buf_init_sock(sock);
 }
 
@@ -631,38 +651,41 @@ void gras_trp_buf_socket_client(gras_trp_plugin_t self,
  * Open a socket used to receive messages.
  */
 void gras_trp_buf_socket_server(gras_trp_plugin_t self,
-                               /* OUT */ gras_socket_t sock){
+                                /* OUT */ gras_socket_t sock)
+{
 
-  gras_trp_sock_socket_server(NULL,sock);
+  gras_trp_sock_socket_server(NULL, sock);
   gras_trp_buf_init_sock(sock);
 }
 
-gras_socket_t gras_trp_buf_socket_accept(gras_socket_t sock) {
+gras_socket_t gras_trp_buf_socket_accept(gras_socket_t sock)
+{
   return gras_trp_buf_init_sock(gras_trp_sock_socket_accept(sock));
 }
 
-void gras_trp_buf_socket_close(gras_socket_t sock){
-  gras_trp_bufdata_t *data=sock->bufdata;
+void gras_trp_buf_socket_close(gras_socket_t sock)
+{
+  gras_trp_bufdata_t *data = sock->bufdata;
 
-  if (data->in_buf.size!=data->in_buf.pos) {
-     WARN3("Socket closed, but %d bytes were unread (size=%d,pos=%d)",
-          data->in_buf.size - data->in_buf.pos,
-          data->in_buf.size, data->in_buf.pos);
+  if (data->in_buf.size != data->in_buf.pos) {
+    WARN3("Socket closed, but %d bytes were unread (size=%d,pos=%d)",
+          data->in_buf.size - data->in_buf.pos,
+          data->in_buf.size, data->in_buf.pos);
   }
   if (data->in_buf.data)
     free(data->in_buf.data);
-   
-  if (data->out_buf.size!=data->out_buf.pos) {
+
+  if (data->out_buf.size != data->out_buf.pos) {
     DEBUG2("Flush the socket before closing (in=%d,out=%d)",
-          data->in_buf.size, data->out_buf.size);
+           data->in_buf.size, data->out_buf.size);
     gras_trp_bufiov_flush(sock);
-  }   
+  }
   if (data->out_buf.data)
     free(data->out_buf.data);
 
 #ifdef HAVE_READV
   if (data->in_buf_v) {
-    if (xbt_dynar_length(data->in_buf_v)) 
+    if (xbt_dynar_length(data->in_buf_v))
       WARN0("Socket closed, but some bytes were unread");
     xbt_dynar_free(&data->in_buf_v);
   }
@@ -688,91 +711,93 @@ void gras_trp_buf_socket_close(gras_socket_t sock){
  *
  * getprotobyname() is not thread safe. We need to lock it.
  */
-static int _gras_tcp_proto_number(void) {
+static int _gras_tcp_proto_number(void)
+{
   struct protoent *fetchedEntry;
   static int returnValue = 0;
-  
-  if(returnValue == 0) {
+
+  if (returnValue == 0) {
     fetchedEntry = getprotobyname("tcp");
     xbt_assert0(fetchedEntry, "getprotobyname(tcp) gave NULL");
     returnValue = fetchedEntry->p_proto;
   }
-  
+
   return returnValue;
 }
 
 #ifdef HAVE_WINSOCK_H
 #define RETSTR( x ) case x: return #x
 
-const char *gras_wsa_err2string( int err ) {
-   switch( err ) {
-      RETSTR( WSAEINTR );
-      RETSTR( WSAEBADF );
-      RETSTR( WSAEACCES );
-      RETSTR( WSAEFAULT );
-      RETSTR( WSAEINVAL );
-      RETSTR( WSAEMFILE );
-      RETSTR( WSAEWOULDBLOCK );
-      RETSTR( WSAEINPROGRESS );
-      RETSTR( WSAEALREADY );
-      RETSTR( WSAENOTSOCK );
-      RETSTR( WSAEDESTADDRREQ );
-      RETSTR( WSAEMSGSIZE );
-      RETSTR( WSAEPROTOTYPE );
-      RETSTR( WSAENOPROTOOPT );
-      RETSTR( WSAEPROTONOSUPPORT );
-      RETSTR( WSAESOCKTNOSUPPORT );
-      RETSTR( WSAEOPNOTSUPP );
-      RETSTR( WSAEPFNOSUPPORT );
-      RETSTR( WSAEAFNOSUPPORT );
-      RETSTR( WSAEADDRINUSE );
-      RETSTR( WSAEADDRNOTAVAIL );
-      RETSTR( WSAENETDOWN );
-      RETSTR( WSAENETUNREACH );
-      RETSTR( WSAENETRESET );
-      RETSTR( WSAECONNABORTED );
-      RETSTR( WSAECONNRESET );
-      RETSTR( WSAENOBUFS );
-      RETSTR( WSAEISCONN );
-      RETSTR( WSAENOTCONN );
-      RETSTR( WSAESHUTDOWN );
-      RETSTR( WSAETOOMANYREFS );
-      RETSTR( WSAETIMEDOUT );
-      RETSTR( WSAECONNREFUSED );
-      RETSTR( WSAELOOP );
-      RETSTR( WSAENAMETOOLONG );
-      RETSTR( WSAEHOSTDOWN );
-      RETSTR( WSAEHOSTUNREACH );
-      RETSTR( WSAENOTEMPTY );
-      RETSTR( WSAEPROCLIM );
-      RETSTR( WSAEUSERS );
-      RETSTR( WSAEDQUOT );
-      RETSTR( WSAESTALE );
-      RETSTR( WSAEREMOTE );
-      RETSTR( WSASYSNOTREADY );
-      RETSTR( WSAVERNOTSUPPORTED );
-      RETSTR( WSANOTINITIALISED );
-      RETSTR( WSAEDISCON );
-      
+const char *gras_wsa_err2string(int err)
+{
+  switch (err) {
+    RETSTR(WSAEINTR);
+    RETSTR(WSAEBADF);
+    RETSTR(WSAEACCES);
+    RETSTR(WSAEFAULT);
+    RETSTR(WSAEINVAL);
+    RETSTR(WSAEMFILE);
+    RETSTR(WSAEWOULDBLOCK);
+    RETSTR(WSAEINPROGRESS);
+    RETSTR(WSAEALREADY);
+    RETSTR(WSAENOTSOCK);
+    RETSTR(WSAEDESTADDRREQ);
+    RETSTR(WSAEMSGSIZE);
+    RETSTR(WSAEPROTOTYPE);
+    RETSTR(WSAENOPROTOOPT);
+    RETSTR(WSAEPROTONOSUPPORT);
+    RETSTR(WSAESOCKTNOSUPPORT);
+    RETSTR(WSAEOPNOTSUPP);
+    RETSTR(WSAEPFNOSUPPORT);
+    RETSTR(WSAEAFNOSUPPORT);
+    RETSTR(WSAEADDRINUSE);
+    RETSTR(WSAEADDRNOTAVAIL);
+    RETSTR(WSAENETDOWN);
+    RETSTR(WSAENETUNREACH);
+    RETSTR(WSAENETRESET);
+    RETSTR(WSAECONNABORTED);
+    RETSTR(WSAECONNRESET);
+    RETSTR(WSAENOBUFS);
+    RETSTR(WSAEISCONN);
+    RETSTR(WSAENOTCONN);
+    RETSTR(WSAESHUTDOWN);
+    RETSTR(WSAETOOMANYREFS);
+    RETSTR(WSAETIMEDOUT);
+    RETSTR(WSAECONNREFUSED);
+    RETSTR(WSAELOOP);
+    RETSTR(WSAENAMETOOLONG);
+    RETSTR(WSAEHOSTDOWN);
+    RETSTR(WSAEHOSTUNREACH);
+    RETSTR(WSAENOTEMPTY);
+    RETSTR(WSAEPROCLIM);
+    RETSTR(WSAEUSERS);
+    RETSTR(WSAEDQUOT);
+    RETSTR(WSAESTALE);
+    RETSTR(WSAEREMOTE);
+    RETSTR(WSASYSNOTREADY);
+    RETSTR(WSAVERNOTSUPPORTED);
+    RETSTR(WSANOTINITIALISED);
+    RETSTR(WSAEDISCON);
+
 #ifdef HAVE_WINSOCK2
-      RETSTR( WSAENOMORE );
-      RETSTR( WSAECANCELLED );
-      RETSTR( WSAEINVALIDPROCTABLE );
-      RETSTR( WSAEINVALIDPROVIDER );
-      RETSTR( WSASYSCALLFAILURE );
-      RETSTR( WSASERVICE_NOT_FOUND );
-      RETSTR( WSATYPE_NOT_FOUND );
-      RETSTR( WSA_E_NO_MORE );
-      RETSTR( WSA_E_CANCELLED );
-      RETSTR( WSAEREFUSED );
-#endif /* HAVE_WINSOCK2        */
-
-      RETSTR( WSAHOST_NOT_FOUND );
-      RETSTR( WSATRY_AGAIN );
-      RETSTR( WSANO_RECOVERY );
-      RETSTR( WSANO_DATA );
-   }
-   return "unknown WSA error";
+    RETSTR(WSAENOMORE);
+    RETSTR(WSAECANCELLED);
+    RETSTR(WSAEINVALIDPROCTABLE);
+    RETSTR(WSAEINVALIDPROVIDER);
+    RETSTR(WSASYSCALLFAILURE);
+    RETSTR(WSASERVICE_NOT_FOUND);
+    RETSTR(WSATYPE_NOT_FOUND);
+    RETSTR(WSA_E_NO_MORE);
+    RETSTR(WSA_E_CANCELLED);
+    RETSTR(WSAEREFUSED);
+#endif /* HAVE_WINSOCK2 */
+
+    RETSTR(WSAHOST_NOT_FOUND);
+    RETSTR(WSATRY_AGAIN);
+    RETSTR(WSANO_RECOVERY);
+    RETSTR(WSANO_DATA);
+  }
+  return "unknown WSA error";
 }
 #endif /* HAVE_WINSOCK_H */
 
index 1a04218..2588813 100644 (file)
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
 
-#include "gras/emul.h"       /* gras_if_RL() */
+#include "gras/emul.h"          /* gras_if_RL() */
 
-#include "gras_modinter.h"   /* module init/exit */
-#include "gras/transport.h"  /* rest of module interface */
+#include "gras_modinter.h"      /* module init/exit */
+#include "gras/transport.h"     /* rest of module interface */
 
 #include "gras/Transport/transport_interface.h" /* semi-public API */
 #include "gras/Virtu/virtu_interface.h" /* libdata management */
@@ -51,46 +51,45 @@ extern gras_socket_t _gras_lastly_selected_socket;
  */
 typedef struct gras_trp_bufdata_ gras_trp_bufdata_t;
 
-typedef struct s_gras_socket  {
+typedef struct s_gras_socket {
   gras_trp_plugin_t plugin;
-    
-  int incoming :1; /* true if we can read from this sock */
-  int outgoing :1; /* true if we can write on this sock */
-  int accepting :1; /* true if master incoming sock in tcp */
-  int meas :1; /* true if this is an experiment socket instead of messaging */
-  int valid :1; /* false if a select returned that the peer quitted, forcing us to "close" the socket */
-  int moredata :1; /* TCP socket use a buffer and read operation get as much 
-                     data as possible. It is possible that several messages
-                     are received in one shoot, and select won't catch them 
-                     afterward again. 
-                     This boolean indicates that this is the case, so that we
-                     don't call select in that case.  Note that measurement
-                     sockets are not concerned since they use the TCP
-                     interface directly, with no buffer. */
-   
-  int recvd :1; /* true if the recvd_val field contains one byte of the stream (that we peek'ed to check the socket validity) */
-  char recvd_val; /* what we peeked from the socket, if any */
-   
-  unsigned long int buf_size; /* what to say to the OS. 
-                                Field here to remember it when accepting */
-   
-  int  sd; 
-  int  port; /* port on this side */
-  int  peer_port; /* port on the other side */
-  char *peer_name; /* hostname of the other side */
-  char *peer_proc; /* process on the other side */
-
-  void *data;    /* plugin specific data */
+
+  int incoming:1;               /* true if we can read from this sock */
+  int outgoing:1;               /* true if we can write on this sock */
+  int accepting:1;              /* true if master incoming sock in tcp */
+  int meas:1;                   /* true if this is an experiment socket instead of messaging */
+  int valid:1;                  /* false if a select returned that the peer quitted, forcing us to "close" the socket */
+  int moredata:1;               /* TCP socket use a buffer and read operation get as much 
+                                   data as possible. It is possible that several messages
+                                   are received in one shoot, and select won't catch them 
+                                   afterward again. 
+                                   This boolean indicates that this is the case, so that we
+                                   don't call select in that case.  Note that measurement
+                                   sockets are not concerned since they use the TCP
+                                   interface directly, with no buffer. */
+
+  int recvd:1;                  /* true if the recvd_val field contains one byte of the stream (that we peek'ed to check the socket validity) */
+  char recvd_val;               /* what we peeked from the socket, if any */
+
+  unsigned long int buf_size;   /* what to say to the OS. 
+                                   Field here to remember it when accepting */
+
+  int sd;
+  int port;                     /* port on this side */
+  int peer_port;                /* port on the other side */
+  char *peer_name;              /* hostname of the other side */
+  char *peer_proc;              /* process on the other side */
+
+  void *data;                   /* plugin specific data */
 
   /* buffer plugin specific data. Yeah, C is not OO, so I got to trick */
-  gras_trp_bufdata_t *bufdata; 
-}s_gras_socket_t;
-       
-void gras_trp_socket_new(int incomming,
-                        gras_socket_t *dst);
+  gras_trp_bufdata_t *bufdata;
+} s_gras_socket_t;
+
+void gras_trp_socket_new(int incomming, gras_socket_t * dst);
 
 /* The drivers */
-typedef void (*gras_trp_setup_t)(gras_trp_plugin_t dst);
+typedef void (*gras_trp_setup_t) (gras_trp_plugin_t dst);
 
 void gras_trp_tcp_setup(gras_trp_plugin_t plug);
 void gras_trp_iov_setup(gras_trp_plugin_t plug);
index a400d2d..cf916dd 100644 (file)
@@ -10,7 +10,8 @@
 #include "gras/module.h"
 #include "virtu_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_modules,gras,"Module and moddata handling");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_modules, gras,
+                                "Module and moddata handling");
 
 /* IMPLEMENTATION NOTE
 
@@ -68,24 +69,25 @@ typedef struct s_gras_module {
   XBT_SET_HEADERS;
 
   unsigned int datasize;
-  int refcount; /* Number of processes using this module */
+  int refcount;                 /* Number of processes using this module */
   /* FIXME: we should keep a count of references within a given process to
      allow modules initializing other modules while tracking dependencies
      properly and leave() only when needed. This would allow dynamic module
      loading/unloading */
 
-  int *p_id; /* where the module stores the libdata ID (a global somewhere), to tweak it on need */
-  void_f_void_t init_f;  /* First time the module is referenced. */
-  void_f_void_t exit_f;  /* When last process referencing it stops doing so. */
-  void_f_pvoid_t join_f;  /* Called by each process in initialization phase (init_f called once for all processes) */
-  void_f_pvoid_t leave_f; /* Called by each process in finalization phase. Should free moddata passed */
+  int *p_id;                    /* where the module stores the libdata ID (a global somewhere), to tweak it on need */
+  void_f_void_t init_f;         /* First time the module is referenced. */
+  void_f_void_t exit_f;         /* When last process referencing it stops doing so. */
+  void_f_pvoid_t join_f;        /* Called by each process in initialization phase (init_f called once for all processes) */
+  void_f_pvoid_t leave_f;       /* Called by each process in finalization phase. Should free moddata passed */
 } s_gras_module_t, *gras_module_t;
 
-static xbt_set_t _gras_modules = NULL; /* content: s_gras_module_t */
+static xbt_set_t _gras_modules = NULL;  /* content: s_gras_module_t */
 
-static void gras_module_freep(void *p) {
-   free( ((gras_module_t)p) ->name);
-   free(p);
+static void gras_module_freep(void *p)
+{
+  free(((gras_module_t) p)->name);
+  free(p);
 }
 
 
@@ -107,9 +109,10 @@ static void gras_module_freep(void *p) {
  */
 
 void gras_module_add(const char *name, unsigned int datasize, int *ID,
-                    void_f_void_t  init_f, void_f_void_t  exit_f,
-                    void_f_pvoid_t join_f, void_f_pvoid_t leave_f) {
-  gras_module_t mod=NULL;
+                     void_f_void_t init_f, void_f_void_t exit_f,
+                     void_f_pvoid_t join_f, void_f_pvoid_t leave_f)
+{
+  gras_module_t mod = NULL;
   xbt_ex_t e;
   volatile int found = 0;
 
@@ -117,9 +120,10 @@ void gras_module_add(const char *name, unsigned int datasize, int *ID,
     _gras_modules = xbt_set_new();
 
   TRY {
-    mod=(gras_module_t)xbt_set_get_by_name (_gras_modules,name);
+    mod = (gras_module_t) xbt_set_get_by_name(_gras_modules, name);
     found = 1;
-  } CATCH(e) {
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       RETHROW;
     xbt_ex_free(e);
@@ -127,23 +131,23 @@ void gras_module_add(const char *name, unsigned int datasize, int *ID,
 
   if (found) {
     xbt_assert1(mod->init_f == init_f,
-               "Module %s reregistered with a different init_f!", name);
+                "Module %s reregistered with a different init_f!", name);
     xbt_assert1(mod->exit_f == exit_f,
-               "Module %s reregistered with a different exit_f!", name);
+                "Module %s reregistered with a different exit_f!", name);
     xbt_assert1(mod->join_f == join_f,
-               "Module %s reregistered with a different join_f!", name);
+                "Module %s reregistered with a different join_f!", name);
     xbt_assert1(mod->leave_f == leave_f,
-               "Module %s reregistered with a different leave_f!", name);
+                "Module %s reregistered with a different leave_f!", name);
     xbt_assert1(mod->datasize == datasize,
-               "Module %s reregistered with a different datasize!", name);
+                "Module %s reregistered with a different datasize!", name);
     xbt_assert1(mod->p_id == ID,
-               "Module %s reregistered with a different p_id field!", name);
+                "Module %s reregistered with a different p_id field!", name);
 
-    DEBUG1("Module %s already registered. Ignoring re-registration",name);
+    DEBUG1("Module %s already registered. Ignoring re-registration", name);
     return;
   }
 
-  VERB1("Register module %s",name);
+  VERB1("Register module %s", name);
   mod = xbt_new(s_gras_module_t, 1);
   mod->name = xbt_strdup(name);
   mod->name_len = strlen(name);
@@ -158,91 +162,100 @@ void gras_module_add(const char *name, unsigned int datasize, int *ID,
 
   *mod->p_id = xbt_set_length(_gras_modules);
 
-  xbt_set_add(_gras_modules,(void*)mod,gras_module_freep);
+  xbt_set_add(_gras_modules, (void *) mod, gras_module_freep);
 }
 
 /* shutdown the module mechanism (world-wide cleanups) */
-void gras_moddata_exit(void) {
+void gras_moddata_exit(void)
+{
   xbt_set_free(&_gras_modules);
 }
 
 /* frees the moddata on this host (process-wide cleanups) */
-void gras_moddata_leave(void) {
-  gras_procdata_t *pd=gras_procdata_get();
+void gras_moddata_leave(void)
+{
+  gras_procdata_t *pd = gras_procdata_get();
 
   xbt_dynar_free(&pd->moddata);
 }
 
 /* Removes & frees a given moddata from the current host */
-static void moddata_freep(void *p) {
-  gras_procdata_t *pd=gras_procdata_get();
-  int id = xbt_dynar_search (pd->moddata, p);
-  gras_module_t mod = (gras_module_t)xbt_set_get_by_id(_gras_modules, id);
+static void moddata_freep(void *p)
+{
+  gras_procdata_t *pd = gras_procdata_get();
+  int id = xbt_dynar_search(pd->moddata, p);
+  gras_module_t mod = (gras_module_t) xbt_set_get_by_id(_gras_modules, id);
 
-  (*mod->leave_f)(gras_moddata_by_id(id));
+  (*mod->leave_f) (gras_moddata_by_id(id));
 }
 
-void gras_module_join(const char *name) {
+void gras_module_join(const char *name)
+{
   gras_procdata_t *pd;
   void *moddata;
-  gras_module_t mod = (gras_module_t)xbt_set_get_by_name(_gras_modules, name);
+  gras_module_t mod =
+    (gras_module_t) xbt_set_get_by_name(_gras_modules, name);
 
-  VERB2("Join to module %s (%p)",name,mod);
+  VERB2("Join to module %s (%p)", name, mod);
 
   /* NEW */
   if (mod->refcount == 0) {
-    VERB1("Init module %s",name);
+    VERB1("Init module %s", name);
     mod->name = xbt_strdup(name);
 
-    (*mod->init_f)();
+    (*mod->init_f) ();
   } else {
     DEBUG3("Module %s already inited. Refcount=%d ID=%d",
-         mod->name, mod->refcount,*(mod->p_id));
+           mod->name, mod->refcount, *(mod->p_id));
   }
   mod->refcount++;
 
   /* JOIN */
-  pd=gras_procdata_get();
+  pd = gras_procdata_get();
 
-  if (!pd->moddata) /* Damn. I must be the first module on this process. Scary ;)*/
-    pd->moddata   = xbt_dynar_new(sizeof(gras_module_t),&moddata_freep);
+  if (!pd->moddata)             /* Damn. I must be the first module on this process. Scary ;) */
+    pd->moddata = xbt_dynar_new(sizeof(gras_module_t), &moddata_freep);
 
   moddata = xbt_malloc(mod->datasize);
 
   xbt_dynar_set(pd->moddata, *(mod->p_id), &moddata);
 
-  (*mod->join_f)(moddata);
+  (*mod->join_f) (moddata);
 
-  DEBUG2("Module %s joined successfully (ID=%d)", name,*(mod->p_id));
+  DEBUG2("Module %s joined successfully (ID=%d)", name, *(mod->p_id));
 }
-void gras_module_leave(const char *name) {
+
+void gras_module_leave(const char *name)
+{
   void *moddata;
-  gras_module_t mod = (gras_module_t)xbt_set_get_by_name(_gras_modules, name);
+  gras_module_t mod =
+    (gras_module_t) xbt_set_get_by_name(_gras_modules, name);
 
-  VERB1("Leave module %s",name);
+  VERB1("Leave module %s", name);
 
   /* LEAVE */
-  moddata = gras_moddata_by_id( *(mod->p_id) );
-  (*mod->leave_f)(moddata);
+  moddata = gras_moddata_by_id(*(mod->p_id));
+  (*mod->leave_f) (moddata);
 
   /* EXIT */
   mod->refcount--;
   if (!mod->refcount) {
-    VERB1("Exit module %s",name);
+    VERB1("Exit module %s", name);
 
-    (*mod->exit_f)();
+    (*mod->exit_f) ();
 
     /* Don't remove the module for real, sets don't allow to
 
        free(mod->name);
        free(mod);
-    */
+     */
   }
 }
 
 
-void *gras_moddata_by_id(unsigned int ID) {
-  gras_procdata_t *pd=gras_procdata_get();
+void *gras_moddata_by_id(unsigned int ID)
+{
+  gras_procdata_t *pd = gras_procdata_get();
   void *p;
 
   xbt_dynar_get_cpy(pd->moddata, ID, &p);
index 385dfec..fea5400 100644 (file)
 
 #include "gras/Virtu/virtu_private.h"
 
-XBT_LOG_NEW_SUBCATEGORY(gras_virtu,gras,"Virtualization code");
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_virtu_process,gras_virtu,"Process manipulation code");
+XBT_LOG_NEW_SUBCATEGORY(gras_virtu, gras, "Virtualization code");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_virtu_process, gras_virtu,
+                                "Process manipulation code");
 
 /* Functions to handle gras_procdata_t->libdata cells*/
 typedef struct {
-   char *name;
-   pvoid_f_void_t constructor;
-   void_f_pvoid_t destructor;
+  char *name;
+  pvoid_f_void_t constructor;
+  void_f_pvoid_t destructor;
 } s_gras_procdata_fabric_t, *gras_procdata_fabric_t;
 
-static xbt_dynar_t _gras_procdata_fabrics = NULL; /* content: s_gras_procdata_fabric_t */
+static xbt_dynar_t _gras_procdata_fabrics = NULL;       /* content: s_gras_procdata_fabric_t */
 
-static void gras_procdata_fabric_free(void *fab) {
-   free( ((gras_procdata_fabric_t)fab)->name );
+static void gras_procdata_fabric_free(void *fab)
+{
+  free(((gras_procdata_fabric_t) fab)->name);
 }
 
 /** @brief declare the functions in charge of creating/destructing the procdata of a module
@@ -38,142 +40,155 @@ static void gras_procdata_fabric_free(void *fab) {
  *  This is intended to be called from the gras_<module>_register function.
  *  This returns the module ID you can use for gras_libdata_by_id()
  */
-int gras_procdata_add(const char *name, pvoid_f_void_t constructor,void_f_pvoid_t destructor) {
-   
-   gras_procdata_fabric_t fab;
-   
-   if (!_gras_procdata_fabrics) {
-      /* create the dynar if needed */
-      _gras_procdata_fabrics = xbt_dynar_new(sizeof(s_gras_procdata_fabric_t),
-                                            gras_procdata_fabric_free);
-   }
-   
-   fab=xbt_dynar_push_ptr(_gras_procdata_fabrics);
-   
-   fab->name        = xbt_strdup(name);
-   fab->constructor = constructor;
-   fab->destructor  = destructor;
-   
-   return xbt_dynar_length(_gras_procdata_fabrics)-1;
+int gras_procdata_add(const char *name, pvoid_f_void_t constructor,
+                      void_f_pvoid_t destructor)
+{
+
+  gras_procdata_fabric_t fab;
+
+  if (!_gras_procdata_fabrics) {
+    /* create the dynar if needed */
+    _gras_procdata_fabrics = xbt_dynar_new(sizeof(s_gras_procdata_fabric_t),
+                                           gras_procdata_fabric_free);
+  }
+
+  fab = xbt_dynar_push_ptr(_gras_procdata_fabrics);
+
+  fab->name = xbt_strdup(name);
+  fab->constructor = constructor;
+  fab->destructor = destructor;
+
+  return xbt_dynar_length(_gras_procdata_fabrics) - 1;
 }
 
 /* **************************************************************************
  * Process data
  * **************************************************************************/
-void *gras_userdata_get(void) {
-  gras_procdata_t *pd=gras_procdata_get();
+void *gras_userdata_get(void)
+{
+  gras_procdata_t *pd = gras_procdata_get();
   return pd->userdata;
 }
 
-void* gras_userdata_set(void *ud) {
-  gras_procdata_t *pd=gras_procdata_get();
+void *gras_userdata_set(void *ud)
+{
+  gras_procdata_t *pd = gras_procdata_get();
 
   pd->userdata = ud;
   return ud;
 }
 
-void *gras_libdata_by_name(const char *name) {
-  gras_procdata_t *pd=gras_procdata_get();
-  return gras_libdata_by_name_from_procdata(name,pd);
+void *gras_libdata_by_name(const char *name)
+{
+  gras_procdata_t *pd = gras_procdata_get();
+  return gras_libdata_by_name_from_procdata(name, pd);
 }
 
 /* this function is splitted from previous to allow SG to get libdata from remote hosts */
-void *gras_libdata_by_name_from_procdata(const char*name, gras_procdata_t* pd) {
-  void *res=NULL;
+void *gras_libdata_by_name_from_procdata(const char *name,
+                                         gras_procdata_t * pd)
+{
+  void *res = NULL;
   xbt_ex_t e;
   if (xbt_set_length(pd->libdata) < xbt_dynar_length(_gras_procdata_fabrics)) {
-     /* Damn, some new modules were added since procdata_init(). Amok? */
-     /* Get 'em all */
-     gras_procdata_init();     
+    /* Damn, some new modules were added since procdata_init(). Amok? */
+    /* Get 'em all */
+    gras_procdata_init();
   }
   TRY {
     res = xbt_set_get_by_name(pd->libdata, name);
-  } CATCH(e) {
-    RETHROW1("Cannot retrieve the libdata associated to %s: %s",name);
-  }   
+  }
+  CATCH(e) {
+    RETHROW1("Cannot retrieve the libdata associated to %s: %s", name);
+  }
   return res;
 }
 
-void *gras_libdata_by_id(int id) {
-  gras_procdata_t *pd=gras_procdata_get();
+void *gras_libdata_by_id(int id)
+{
+  gras_procdata_t *pd = gras_procdata_get();
   if (xbt_set_length(pd->libdata) < xbt_dynar_length(_gras_procdata_fabrics)) {
-     /* Damn, some new modules were added since procdata_init(). Amok? */
-     /* Get 'em all */
-     gras_procdata_init();     
+    /* Damn, some new modules were added since procdata_init(). Amok? */
+    /* Get 'em all */
+    gras_procdata_init();
   }
   return xbt_set_get_by_id(pd->libdata, id);
 }
 
 
-void
-gras_procdata_init() {
-  gras_procdata_t *pd=gras_procdata_get();
+void gras_procdata_init()
+{
+  gras_procdata_t *pd = gras_procdata_get();
   s_gras_procdata_fabric_t fab;
-   
+
   unsigned int cursor;
-   
+
   xbt_ex_t e;
   xbt_set_elm_t elem;
 
   if (!pd->libdata) {
-     pd->userdata  = NULL;
-     pd->libdata   = xbt_set_new();
+    pd->userdata = NULL;
+    pd->libdata = xbt_set_new();
   }
-  
-  xbt_dynar_foreach(_gras_procdata_fabrics,cursor,fab){ 
+
+  xbt_dynar_foreach(_gras_procdata_fabrics, cursor, fab) {
     volatile int found = 0;
-     
-    if (cursor+1 <= xbt_set_length(pd->libdata)) {
-       DEBUG2("Skip fabric %d: there is already %ld libdata",
-            cursor, xbt_set_length(pd->libdata));
-       continue; /* allow to recall this function to get recently added fabrics */
+
+    if (cursor + 1 <= xbt_set_length(pd->libdata)) {
+      DEBUG2("Skip fabric %d: there is already %ld libdata",
+             cursor, xbt_set_length(pd->libdata));
+      continue;                 /* allow to recall this function to get recently added fabrics */
     }
     DEBUG2("Go ahead for cursor %d, there is %ld libdata",
-         cursor,xbt_set_length(pd->libdata));
-     
-    xbt_assert1(fab.name,"Name of fabric #%d is NULL!",cursor);
-    DEBUG1("Create the procdata for %s",fab.name);
+           cursor, xbt_set_length(pd->libdata));
+
+    xbt_assert1(fab.name, "Name of fabric #%d is NULL!", cursor);
+    DEBUG1("Create the procdata for %s", fab.name);
     /* Check for our own errors */
     TRY {
       xbt_set_get_by_name(pd->libdata, fab.name);
       found = 1;
-    } CATCH(e) {
+    }
+    CATCH(e) {
       xbt_ex_free(e);
       found = 0;
     }
     if (found)
-      THROW1(unknown_error,0,"MayDay: two modules use '%s' as libdata name", fab.name);
-    
+      THROW1(unknown_error, 0, "MayDay: two modules use '%s' as libdata name",
+             fab.name);
+
     /* Add the data in place, after some more sanity checking */
-    elem = (*(fab.constructor))();
+    elem = (*(fab.constructor)) ();
     if (elem->name_len && elem->name_len != strlen(elem->name)) {
-       elem->name_len = strlen(elem->name);
-       WARN1("Module '%s' constructor is borken: it does not set elem->name_len",
-            fab.name);
+      elem->name_len = strlen(elem->name);
+      WARN1
+        ("Module '%s' constructor is borken: it does not set elem->name_len",
+         fab.name);
     }
     xbt_set_add(pd->libdata, elem, fab.destructor);
   }
 }
 
-void
-gras_procdata_exit() {
+void gras_procdata_exit()
+{
   int len;
-  gras_procdata_t *pd=gras_procdata_get();
+  gras_procdata_t *pd = gras_procdata_get();
+
+  xbt_set_free(&(pd->libdata));
 
-  xbt_set_free(&( pd->libdata ));
-  
   /* Remove procdata in reverse order wrt creation */
-  while ((len=xbt_dynar_length(_gras_procdata_fabrics))) {
-    xbt_dynar_remove_at(_gras_procdata_fabrics,len-1,NULL);
+  while ((len = xbt_dynar_length(_gras_procdata_fabrics))) {
+    xbt_dynar_remove_at(_gras_procdata_fabrics, len - 1, NULL);
   }
-  xbt_dynar_free( & _gras_procdata_fabrics );
+  xbt_dynar_free(&_gras_procdata_fabrics);
 }
 
 
-const char *gras_os_hostport() {
-   static char *res=NULL;
-   if (res)
-     free(res); /* my port may have changed */
-   res = bprintf("%s:%d",gras_os_myname(),gras_os_myport());
-   return (const char*)res;
+const char *gras_os_hostport()
+{
+  static char *res = NULL;
+  if (res)
+    free(res);                  /* my port may have changed */
+  res = bprintf("%s:%d", gras_os_myname(), gras_os_myport());
+  return (const char *) res;
 }
index 04e2f54..61f1867 100644 (file)
 /* A portable DNS resolver is a nightmare to do in a portable manner.
    keep it simple/stupid for now. */
 
-const char *gras_os_myname(void) {
+const char *gras_os_myname(void)
+{
   static char *myname = NULL;
+
   if (myname)
-    return (const char*) myname; 
+    return (const char *) myname;
+
   myname = xbt_new(char, 255);
-    
+
   if (gethostname(myname, 255) == -1) {
 #ifdef HAVE_SYS_SOCKET_H
-     /* gethostname() failed! Trying with localhost instead. 
+    /* gethostname() failed! Trying with localhost instead. 
        We first need to query the DNS to make sure localhost is resolved 
        See the note in nws/Portability/dnsutil.c about {end,set}hostent() */
     struct hostent *tmp;
     sethostent(0);
     tmp = gethostbyname("localhost");
     endhostent();
-       
+
     if (tmp) {
       strncat(myname, tmp->h_name, 255);
-    } else {       
+    } else {
       /* Erm. localhost cannot be resolved. There's something wrong in the user DNS setting */
       sprintf(myname, "(misconfigured host)");
     }
 #else
-      sprintf(myname, "(misconfigured windows host)");
-#endif     
+    sprintf(myname, "(misconfigured windows host)");
+#endif
   }
-   
+
   myname[254] = '\0';
+
   return myname;
 }
-
index 908268d..3a6f4d8 100644 (file)
 #include "gras/Virtu/virtu_rl.h"
 #include "gras_modinter.h"
 
-XBT_LOG_NEW_SUBCATEGORY(gras_virtu_emul,gras_virtu,"Emulation support");
+XBT_LOG_NEW_SUBCATEGORY(gras_virtu_emul, gras_virtu, "Emulation support");
 
 /*** Timing macros: nothing to do in RL. Actually do the job and shutup ***/
 
-void gras_emul_init(void)  {}
-void gras_emul_exit(void)  {}
+void gras_emul_init(void)
+{
+}
+
+void gras_emul_exit(void)
+{
+}
 
-int gras_bench_always_begin(const char *location,int line) {
+int gras_bench_always_begin(const char *location, int line)
+{
   return 0;
 }
 
-int gras_bench_always_end(void) {
+int gras_bench_always_end(void)
+{
   return 0;
 }
 
-int gras_bench_once_begin(const char *location,int line) {
+int gras_bench_once_begin(const char *location, int line)
+{
   return 1;
 }
 
-int gras_bench_once_end(void) {
+int gras_bench_once_end(void)
+{
   return 0;
 }
 
 /*** Conditional execution support ***/
 
-int gras_if_RL(void) {
-   return 1;
+int gras_if_RL(void)
+{
+  return 1;
 }
 
-int gras_if_SG(void) {
-   return 0;
+int gras_if_SG(void)
+{
+  return 0;
 }
index ad664c0..9e6ae8e 100644 (file)
@@ -7,7 +7,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_modinter.h" /* module initialization interface */
+#include "gras_modinter.h"      /* module initialization interface */
 #include "gras/Virtu/virtu_rl.h"
 #include "portable.h"
 
@@ -16,8 +16,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu_process);
 /* globals */
 static gras_procdata_t *_gras_procdata = NULL;
 XBT_EXPORT_NO_IMPORT(char const *) _gras_procname = NULL;
-static xbt_dict_t _process_properties = NULL;
-static xbt_dict_t _host_properties = NULL;
+     static xbt_dict_t _process_properties = NULL;
+     static xbt_dict_t _host_properties = NULL;
 
 # ifdef __APPLE__
 /* under darwin, the environment gets added to the process at startup time. So, it's not defined at library link time, forcing us to extra tricks */
@@ -25,47 +25,56 @@ static xbt_dict_t _host_properties = NULL;
 # define environ (*_NSGetEnviron())
 # else
  /* the environment, as specified by the opengroup, used to initialize the process properties */
- extern char **environ;
-# endif 
    extern char **environ;
+# endif
 
-void gras_process_init() {
+     void gras_process_init()
+{
   char **env_iter;
-  _gras_procdata=xbt_new0(gras_procdata_t,1);
+  _gras_procdata = xbt_new0(gras_procdata_t, 1);
   gras_procdata_init();
-   
+
   /* initialize the host & process properties */
   _host_properties = xbt_dict_new();
   _process_properties = xbt_dict_new();
   env_iter = environ;
   while (*env_iter) {
-     char *equal, *buf = xbt_strdup(*env_iter);
-     equal = strchr(buf, '=');
-     if (!equal) {
-       WARN1("The environment contains an entry without '=' char: %s (ignore it)",*env_iter);
-       continue;
-     }
-     *equal = '\0';
-     xbt_dict_set(_process_properties,buf,xbt_strdup(equal + 1),xbt_free_f);
-     free(buf);
-     env_iter++;
-  }   
+    char *equal, *buf = xbt_strdup(*env_iter);
+    equal = strchr(buf, '=');
+    if (!equal) {
+      WARN1
+        ("The environment contains an entry without '=' char: %s (ignore it)",
+         *env_iter);
+      continue;
+    }
+    *equal = '\0';
+    xbt_dict_set(_process_properties, buf, xbt_strdup(equal + 1), xbt_free_f);
+    free(buf);
+    env_iter++;
+  }
 }
-void gras_process_exit() {
+
+void gras_process_exit()
+{
   gras_procdata_exit();
   free(_gras_procdata);
   xbt_dict_free(&_process_properties);
 }
 
-const char *xbt_procname(void) {
-  if(_gras_procname) return _gras_procname;
-  else return "";
+const char *xbt_procname(void)
+{
+  if (_gras_procname)
+    return _gras_procname;
+  else
+    return "";
 }
 
-int gras_os_getpid(void) {
+int gras_os_getpid(void)
+{
 #ifdef _WIN32
-   return (long int) GetCurrentProcessId();
+  return (long int) GetCurrentProcessId();
 #else
-   return (long int) getpid();
+  return (long int) getpid();
 #endif
 }
 
@@ -73,31 +82,40 @@ int gras_os_getpid(void) {
  * Process data
  * **************************************************************************/
 
-gras_procdata_t *gras_procdata_get(void) {
-  xbt_assert0(_gras_procdata,"Run gras_process_init (ie, gras_init)!");
+gras_procdata_t *gras_procdata_get(void)
+{
+  xbt_assert0(_gras_procdata, "Run gras_process_init (ie, gras_init)!");
 
   return _gras_procdata;
 }
 
-void gras_agent_spawn(const char *name, void *data, 
-                     xbt_main_func_t code, int argc, char *argv[], xbt_dict_t properties) {
-   THROW_UNIMPLEMENTED;
+void gras_agent_spawn(const char *name, void *data,
+                      xbt_main_func_t code, int argc, char *argv[],
+                      xbt_dict_t properties)
+{
+  THROW_UNIMPLEMENTED;
 }
 
 /* **************************************************************************
  * Properties
  * **************************************************************************/
 
-const char* gras_process_property_value(const char* name) {
-   return xbt_dict_get_or_null(_process_properties,name);
+const char *gras_process_property_value(const char *name)
+{
+  return xbt_dict_get_or_null(_process_properties, name);
 }
-xbt_dict_t gras_process_properties(void) {
-   return _process_properties;
+
+xbt_dict_t gras_process_properties(void)
+{
+  return _process_properties;
 }
 
-const char* gras_os_host_property_value(const char* name) {
-   return xbt_dict_get_or_null(_host_properties,name);
+const char *gras_os_host_property_value(const char *name)
+{
+  return xbt_dict_get_or_null(_host_properties, name);
 }
-xbt_dict_t gras_os_host_properties(void) {
-   return _host_properties;
+
+xbt_dict_t gras_os_host_properties(void)
+{
+  return _host_properties;
 }
index 509b89d..c791b31 100644 (file)
 
 #include "gras/Virtu/virtu_sg.h"
 
-const char *gras_os_myname(void) {
+const char *gras_os_myname(void)
+{
   smx_process_t process = SIMIX_process_self();
   if ((process != NULL) && (process->simdata))
-   return SIMIX_host_get_name(SIMIX_host_self());
-  else 
+    return SIMIX_host_get_name(SIMIX_host_self());
+  else
     return "";
 }
index f485b8e..0544552 100644 (file)
@@ -7,37 +7,40 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <stdio.h> /* sprintf */
+#include <stdio.h>              /* sprintf */
 #include "gras/emul.h"
 #include "gras/Virtu/virtu_sg.h"
 #include "gras_modinter.h"
 
-#include "xbt/xbt_os_time.h" /* timers */
+#include "xbt/xbt_os_time.h"    /* timers */
 #include "xbt/dict.h"
 #include "xbt/ex.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_virtu_emul,gras_virtu,"Emulation support");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_virtu_emul, gras_virtu,
+                                "Emulation support");
 
 /*** Timing macros ***/
 static xbt_os_timer_t timer;
 static int benchmarking = 0;
 static xbt_dict_t benchmark_set = NULL;
-static double reference = .00000000523066250047108838; /* FIXME: we should benchmark host machine to set this; unit=s/flop */
+static double reference = .00000000523066250047108838;  /* FIXME: we should benchmark host machine to set this; unit=s/flop */
 static double duration = 0.0;
 
-static charlocbuf = NULL;
+static char *locbuf = NULL;
 static unsigned int locbufsize;
 
 void gras_emul_init(void)
 {
-  if(!benchmark_set) {
+  if (!benchmark_set) {
     benchmark_set = xbt_dict_new();
     timer = xbt_os_timer_new();
   }
 }
 
-void gras_emul_exit(void) {
-  if (locbuf) free(locbuf);
+void gras_emul_exit(void)
+{
+  if (locbuf)
+    free(locbuf);
   xbt_dict_free(&benchmark_set);
   xbt_os_timer_free(timer);
 }
@@ -49,72 +52,75 @@ static void store_in_dict(xbt_dict_t dict, const char *key, double value)
 
   ir = xbt_dict_get_or_null(dict, key);
   if (!ir) {
-    ir = xbt_new0(double,1);
+    ir = xbt_new0(double, 1);
     xbt_dict_set(dict, key, ir, xbt_free_f);
   }
   *ir = value;
 }
 
-static double get_from_dict(xbt_dict_t dict, const char *key) {
+static double get_from_dict(xbt_dict_t dict, const char *key)
+{
   double *ir = xbt_dict_get(dict, key);
 
   return *ir;
 }
 
-int gras_bench_always_begin(const char *location,int line)
+int gras_bench_always_begin(const char *location, int line)
 {
-  xbt_assert0(!benchmarking,"Already benchmarking");
+  xbt_assert0(!benchmarking, "Already benchmarking");
   benchmarking = 1;
 
   if (!timer)
-  xbt_os_timer_start(timer);
+    xbt_os_timer_start(timer);
   return 0;
 }
 
 int gras_bench_always_end(void)
 {
-       smx_action_t act;
-       smx_cond_t cond;
-       smx_mutex_t mutex;
+  smx_action_t act;
+  smx_cond_t cond;
+  smx_mutex_t mutex;
 
-  xbt_assert0(benchmarking,"Not benchmarking yet");
+  xbt_assert0(benchmarking, "Not benchmarking yet");
   benchmarking = 0;
   xbt_os_timer_stop(timer);
   duration = xbt_os_timer_elapsed(timer);
 
-       cond = SIMIX_cond_init();
-       mutex = SIMIX_mutex_init();
-       
-       SIMIX_mutex_lock(mutex);
-       act = SIMIX_action_execute(SIMIX_host_self(), "task", (duration)/reference);
-       
-       SIMIX_register_action_to_condition(act,cond);
-       SIMIX_cond_wait(cond, mutex);
-       SIMIX_unregister_action_to_condition(act,cond);
-       
-       SIMIX_action_destroy(act);
-       SIMIX_mutex_unlock(mutex);
-
-       SIMIX_cond_destroy(cond);
-       SIMIX_mutex_destroy(mutex);
+  cond = SIMIX_cond_init();
+  mutex = SIMIX_mutex_init();
+
+  SIMIX_mutex_lock(mutex);
+  act =
+    SIMIX_action_execute(SIMIX_host_self(), "task", (duration) / reference);
+
+  SIMIX_register_action_to_condition(act, cond);
+  SIMIX_cond_wait(cond, mutex);
+  SIMIX_unregister_action_to_condition(act, cond);
+
+  SIMIX_action_destroy(act);
+  SIMIX_mutex_unlock(mutex);
+
+  SIMIX_cond_destroy(cond);
+  SIMIX_mutex_destroy(mutex);
 
   return 0;
 }
 
-int gras_bench_once_begin(const char *location,int line) { 
+int gras_bench_once_begin(const char *location, int line)
+{
   double *ir = NULL;
-  xbt_assert0(!benchmarking,"Already benchmarking");
+  xbt_assert0(!benchmarking, "Already benchmarking");
   benchmarking = 1;
 
   if (!locbuf || locbufsize < strlen(location) + 64) {
-     locbufsize = strlen(location) + 64;
-     locbuf = xbt_realloc(locbuf,locbufsize);
+    locbufsize = strlen(location) + 64;
+    locbuf = xbt_realloc(locbuf, locbufsize);
   }
-  sprintf(locbuf,"%s:%d",location, line);
-   
+  sprintf(locbuf, "%s:%d", location, line);
+
   ir = xbt_dict_get_or_null(benchmark_set, locbuf);
-  if(!ir) {
-    DEBUG1("%s",locbuf); 
+  if (!ir) {
+    DEBUG1("%s", locbuf);
     duration = 1;
     xbt_os_timer_start(timer);
     return 1;
@@ -126,45 +132,48 @@ int gras_bench_once_begin(const char *location,int line) {
 
 int gras_bench_once_end(void)
 {
-       smx_action_t act;
-       smx_cond_t cond;
-       smx_mutex_t mutex;
+  smx_action_t act;
+  smx_cond_t cond;
+  smx_mutex_t mutex;
 
-  xbt_assert0(benchmarking,"Not benchmarking yet");
+  xbt_assert0(benchmarking, "Not benchmarking yet");
   benchmarking = 0;
-  if(duration>0) {
+  if (duration > 0) {
     xbt_os_timer_stop(timer);
     duration = xbt_os_timer_elapsed(timer);
     store_in_dict(benchmark_set, locbuf, duration);
   } else {
-    duration = get_from_dict(benchmark_set,locbuf);
+    duration = get_from_dict(benchmark_set, locbuf);
   }
-  DEBUG2("Simulate the run of a task of %f sec for %s",duration,locbuf);
-       cond = SIMIX_cond_init();
-       mutex = SIMIX_mutex_init();
-       
-       SIMIX_mutex_lock(mutex);
-       act = SIMIX_action_execute(SIMIX_host_self(), "task", (duration)/reference);
-       
-       SIMIX_register_action_to_condition(act,cond);
-       SIMIX_cond_wait(cond, mutex);
-       SIMIX_unregister_action_to_condition(act,cond);
-       
-       SIMIX_action_destroy(act);
-       SIMIX_mutex_unlock(mutex);
-
-       SIMIX_cond_destroy(cond);
-       SIMIX_mutex_destroy(mutex);
+  DEBUG2("Simulate the run of a task of %f sec for %s", duration, locbuf);
+  cond = SIMIX_cond_init();
+  mutex = SIMIX_mutex_init();
+
+  SIMIX_mutex_lock(mutex);
+  act =
+    SIMIX_action_execute(SIMIX_host_self(), "task", (duration) / reference);
+
+  SIMIX_register_action_to_condition(act, cond);
+  SIMIX_cond_wait(cond, mutex);
+  SIMIX_unregister_action_to_condition(act, cond);
+
+  SIMIX_action_destroy(act);
+  SIMIX_mutex_unlock(mutex);
+
+  SIMIX_cond_destroy(cond);
+  SIMIX_mutex_destroy(mutex);
   return 0;
 }
 
 
 /*** Conditional execution support ***/
 
-int gras_if_RL(void) {
-   return 0;
+int gras_if_RL(void)
+{
+  return 0;
 }
 
-int gras_if_SG(void) {
-   return 1;
+int gras_if_SG(void)
+{
+  return 1;
 }
index 392d11e..8514845 100644 (file)
@@ -9,9 +9,9 @@
 
 #include "xbt/ex.h"
 #include "xbt/dict.h"
-#include "gras_modinter.h" /* module initialization interface */
+#include "gras_modinter.h"      /* module initialization interface */
 #include "gras/Virtu/virtu_sg.h"
-#include "gras/Msg/msg_interface.h" /* For some checks at simulation end */
+#include "gras/Msg/msg_interface.h"     /* For some checks at simulation end */
 #include "gras/Transport/transport_interface.h" /* For some checks at simulation end */
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu_process);
@@ -19,94 +19,95 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu_process);
 static long int PID = 1;
 
 
-void gras_agent_spawn(const char *name, void *data, 
-                     xbt_main_func_t code, int argc, char *argv[], xbt_dict_t properties) {
-   
-   SIMIX_process_create(name, code,
-                       data,
-                       gras_os_myname(), 
-                       argc, argv, properties);
+void gras_agent_spawn(const char *name, void *data,
+                      xbt_main_func_t code, int argc, char *argv[],
+                      xbt_dict_t properties)
+{
+
+  SIMIX_process_create(name, code,
+                       data, gras_os_myname(), argc, argv, properties);
 }
 
 /* **************************************************************************
  * Process constructor/destructor (semi-public interface)
  * **************************************************************************/
 
-void
-gras_process_init() {
-  gras_hostdata_t *hd=(gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
-  gras_procdata_t *pd=xbt_new0(gras_procdata_t,1);
+void gras_process_init()
+{
+  gras_hostdata_t *hd =
+    (gras_hostdata_t *) SIMIX_host_get_data(SIMIX_host_self());
+  gras_procdata_t *pd = xbt_new0(gras_procdata_t, 1);
   gras_trp_procdata_t trp_pd;
 
-  SIMIX_process_set_data(SIMIX_process_self(),(void*)pd);
+  SIMIX_process_set_data(SIMIX_process_self(), (void *) pd);
 
 
   gras_procdata_init();
 
   if (!hd) {
     /* First process on this host */
-    hd=xbt_new(gras_hostdata_t,1);
+    hd = xbt_new(gras_hostdata_t, 1);
     hd->refcount = 1;
-    hd->ports = xbt_dynar_new(sizeof(gras_sg_portrec_t),NULL);
-               SIMIX_host_set_data(SIMIX_host_self(),(void*)hd);
+    hd->ports = xbt_dynar_new(sizeof(gras_sg_portrec_t), NULL);
+    SIMIX_host_set_data(SIMIX_host_self(), (void *) hd);
   } else {
     hd->refcount++;
   }
 
-  trp_pd = (gras_trp_procdata_t)gras_libdata_by_name("gras_trp");
+  trp_pd = (gras_trp_procdata_t) gras_libdata_by_name("gras_trp");
   pd->pid = PID++;
-  
-  if (SIMIX_process_self() != NULL ) {
+
+  if (SIMIX_process_self() != NULL) {
     pd->ppid = gras_os_getpid();
-  }
-  else pd->ppid = -1; 
-  
-  trp_pd->msg_selectable_sockets = xbt_queue_new(0,sizeof(gras_socket_t));
-  
-  trp_pd->meas_selectable_sockets = xbt_queue_new(0,sizeof(gras_socket_t));
-  
+  } else
+    pd->ppid = -1;
+
+  trp_pd->msg_selectable_sockets = xbt_queue_new(0, sizeof(gras_socket_t));
+
+  trp_pd->meas_selectable_sockets = xbt_queue_new(0, sizeof(gras_socket_t));
+
   VERB2("Creating process '%s' (%d)",
-       SIMIX_process_get_name(SIMIX_process_self()),
-       gras_os_getpid());
+        SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid());
 }
 
-void
-gras_process_exit() {
-       xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_name("gras_trp"))->sockets;
+void gras_process_exit()
+{
+  xbt_dynar_t sockets =
+    ((gras_trp_procdata_t) gras_libdata_by_name("gras_trp"))->sockets;
   gras_socket_t sock_iter;
   unsigned int cursor;
-  gras_hostdata_t *hd=
-    (gras_hostdata_t *)SIMIX_host_get_data(SIMIX_host_self());
-  gras_procdata_t *pd=
-    (gras_procdata_t*)SIMIX_process_get_data(SIMIX_process_self());
+  gras_hostdata_t *hd =
+    (gras_hostdata_t *) SIMIX_host_get_data(SIMIX_host_self());
+  gras_procdata_t *pd =
+    (gras_procdata_t *) SIMIX_process_get_data(SIMIX_process_self());
 
-  gras_msg_procdata_t msg_pd=
-    (gras_msg_procdata_t)gras_libdata_by_name("gras_msg");
-  gras_trp_procdata_t trp_pd=
-    (gras_trp_procdata_t)gras_libdata_by_name("gras_trp");
+  gras_msg_procdata_t msg_pd =
+    (gras_msg_procdata_t) gras_libdata_by_name("gras_msg");
+  gras_trp_procdata_t trp_pd =
+    (gras_trp_procdata_t) gras_libdata_by_name("gras_trp");
 
   xbt_queue_free(&trp_pd->msg_selectable_sockets);
 
   xbt_queue_free(&trp_pd->meas_selectable_sockets);
 
 
-  xbt_assert0(hd,"Run gras_process_init (ie, gras_init)!!");
+  xbt_assert0(hd, "Run gras_process_init (ie, gras_init)!!");
 
   VERB2("GRAS: Finalizing process '%s' (%d)",
-       SIMIX_process_get_name(SIMIX_process_self()),gras_os_getpid());
+        SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid());
 
   if (xbt_dynar_length(msg_pd->msg_queue))
     WARN1("process %d terminated, but some messages are still queued",
-         gras_os_getpid());
-  
+          gras_os_getpid());
+
   /* if each process has its sockets list, we need to close them when the
-          process finish */
-  xbt_dynar_foreach(sockets,cursor,sock_iter) {
+     process finish */
+  xbt_dynar_foreach(sockets, cursor, sock_iter) {
     VERB1("Closing the socket %p left open on exit. Maybe a socket leak?",
-         sock_iter);
+          sock_iter);
     gras_socket_close(sock_iter);
   }
-  if ( ! --(hd->refcount)) {
+  if (!--(hd->refcount)) {
     xbt_dynar_free(&hd->ports);
     free(hd);
   }
@@ -118,28 +119,34 @@ gras_process_exit() {
  * Process data (public interface)
  * **************************************************************************/
 
-gras_procdata_t *gras_procdata_get(void) {
-  gras_procdata_t *pd=
-    (gras_procdata_t *)SIMIX_process_get_data(SIMIX_process_self());
+gras_procdata_t *gras_procdata_get(void)
+{
+  gras_procdata_t *pd =
+    (gras_procdata_t *) SIMIX_process_get_data(SIMIX_process_self());
 
-  xbt_assert0(pd,"Run gras_process_init! (ie, gras_init)");
+  xbt_assert0(pd, "Run gras_process_init! (ie, gras_init)");
 
   return pd;
 }
-void *
-gras_libdata_by_name_from_remote(const char *name, smx_process_t p) {
-  gras_procdata_t *pd=
-    (gras_procdata_t *)SIMIX_process_get_data(p);
 
-  xbt_assert2(pd,"process '%s' on '%s' didn't run gras_process_init! (ie, gras_init)", 
-             SIMIX_process_get_name(p),SIMIX_host_get_name(SIMIX_process_get_host(p)));
-   
+void *gras_libdata_by_name_from_remote(const char *name, smx_process_t p)
+{
+  gras_procdata_t *pd = (gras_procdata_t *) SIMIX_process_get_data(p);
+
+  xbt_assert2(pd,
+              "process '%s' on '%s' didn't run gras_process_init! (ie, gras_init)",
+              SIMIX_process_get_name(p),
+              SIMIX_host_get_name(SIMIX_process_get_host(p)));
+
   return gras_libdata_by_name_from_procdata(name, pd);
-}   
+}
 
 /** @brief retrieve the value of a given process property (or NULL if not defined) */
-const char* gras_process_property_value(const char* name) {
- return xbt_dict_get_or_null(SIMIX_process_get_properties(SIMIX_process_self()), name);
+const char *gras_process_property_value(const char *name)
+{
+  return
+    xbt_dict_get_or_null(SIMIX_process_get_properties(SIMIX_process_self()),
+                         name);
 }
 
 /** @brief retrieve the process properties dictionnary
@@ -154,38 +161,46 @@ xbt_dict_t gras_process_properties(void)
  * OS virtualization function
  * **************************************************************************/
 
-const char* xbt_procname(void) {
+const char *xbt_procname(void)
+{
   const char *res = NULL;
   smx_process_t process = SIMIX_process_self();
   if ((process != NULL) && (process->simdata))
     res = SIMIX_process_get_name(process);
-  if (res) 
+  if (res)
     return res;
   else
     return "";
 }
 
-int gras_os_getpid(void) {
+int gras_os_getpid(void)
+{
 
   smx_process_t process = SIMIX_process_self();
-       
+
   if ((process != NULL) && (process->data))
-     return ((gras_procdata_t*)process->data)->pid;
+    return ((gras_procdata_t *) process->data)->pid;
   else
     return 0;
 }
 
 
 /** @brief retrieve the value of a given host property (or NULL if not defined) */
-const char* gras_os_host_property_value(const char* name) {
- return xbt_dict_get_or_null(SIMIX_host_get_properties(SIMIX_process_get_host(SIMIX_process_self())), name);
+const char *gras_os_host_property_value(const char *name)
+{
+  return
+    xbt_dict_get_or_null(SIMIX_host_get_properties
+                         (SIMIX_process_get_host(SIMIX_process_self())),
+                         name);
 }
 
 /** @brief retrieve the host properties dictionnary
  *  @warning it's the original one, not a copy. Don't mess with it
  */
-xbt_dict_t gras_os_host_properties(void) {
-  return SIMIX_host_get_properties(SIMIX_process_get_host(SIMIX_process_self()));
+xbt_dict_t gras_os_host_properties(void)
+{
+  return
+    SIMIX_host_get_properties(SIMIX_process_get_host(SIMIX_process_self()));
 }
 
 /* **************************************************************************
@@ -196,43 +211,48 @@ xbt_dict_t gras_os_host_properties(void) {
 XBT_LOG_EXTERNAL_CATEGORY(gras_trp);
 XBT_LOG_EXTERNAL_CATEGORY(gras_trp_sg);
 
-void gras_global_init(int *argc,char **argv) {
+void gras_global_init(int *argc, char **argv)
+{
   XBT_LOG_CONNECT(gras_trp_sg, gras_trp);
-  SIMIX_global_init(argc,argv);
+  SIMIX_global_init(argc, argv);
 }
 
-void gras_create_environment(const char *file) {
+void gras_create_environment(const char *file)
+{
   SIMIX_create_environment(file);
 }
-void gras_function_register(const char *name, xbt_main_func_t code) {
+
+void gras_function_register(const char *name, xbt_main_func_t code)
+{
   SIMIX_function_register(name, code);
 }
 
-void gras_main() {
+void gras_main()
+{
   smx_cond_t cond = NULL;
   smx_action_t action;
   xbt_fifo_t actions_done = xbt_fifo_new();
   xbt_fifo_t actions_failed = xbt_fifo_new();
-   
+
   /* Clean IO before the run */
   fflush(stdout);
   fflush(stderr);
   SIMIX_init();
 
   while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
-    while ( (action = xbt_fifo_pop(actions_failed)) ) {
-      DEBUG1("** %s failed **",action->name);
-      while ( (cond = xbt_fifo_pop(action->cond_list)) ) {
-       SIMIX_cond_broadcast(cond);
+    while ((action = xbt_fifo_pop(actions_failed))) {
+      DEBUG1("** %s failed **", action->name);
+      while ((cond = xbt_fifo_pop(action->cond_list))) {
+        SIMIX_cond_broadcast(cond);
       }
       /* action finished, destroy it */
-      //       SIMIX_action_destroy(action);
+      //        SIMIX_action_destroy(action);
     }
-    
-    while ( (action = xbt_fifo_pop(actions_done)) ) {
-      DEBUG1("** %s done **",action->name);
-      while ( (cond = xbt_fifo_pop(action->cond_list)) ) {
-       SIMIX_cond_broadcast(cond);
+
+    while ((action = xbt_fifo_pop(actions_done))) {
+      DEBUG1("** %s done **", action->name);
+      while ((cond = xbt_fifo_pop(action->cond_list))) {
+        SIMIX_cond_broadcast(cond);
       }
       /* action finished, destroy it */
       //SIMIX_action_destroy(action);
@@ -240,15 +260,15 @@ void gras_main() {
   }
   xbt_fifo_free(actions_failed);
   xbt_fifo_free(actions_done);
-  return;   
+  return;
 }
 
-void gras_launch_application(const char *file) {
-   SIMIX_launch_application(file);
+void gras_launch_application(const char *file)
+{
+  SIMIX_launch_application(file);
 }
 
-void gras_clean() {
-   SIMIX_clean();
+void gras_clean()
+{
+  SIMIX_clean();
 }
-
-
index a517ea4..e5fb7f2 100644 (file)
@@ -23,9 +23,9 @@
 SG_BEGIN_DECL()
 
 /* shutdown the module mechanism (world-wide cleanups) */
-void gras_moddata_exit(void);
+     void gras_moddata_exit(void);
 /* shutdown this process wrt module mecanism (process-wide cleanups) */
-void gras_moddata_leave(void);
+     void gras_moddata_leave(void);
 
 
 /* Perform the various intialisations needed by gras. Each process must run it */
@@ -39,11 +39,11 @@ XBT_PUBLIC(void) gras_process_exit(void);
 
 /* declare a new process specific data 
    (used by gras_<module>_register to make sure that gras_process_init will create it) */
-int gras_procdata_add(const char *name, pvoid_f_void_t creator,void_f_pvoid_t destructor);
+     int gras_procdata_add(const char *name, pvoid_f_void_t creator,
+                           void_f_pvoid_t destructor);
 
-void* gras_libdata_by_name(const char *name);
-void* gras_libdata_by_id(int id);
+     void *gras_libdata_by_name(const char *name);
+     void *gras_libdata_by_id(int id);
 
 SG_END_DECL()
-
-#endif  /* GRAS_VIRTU_INTERFACE_H */
+#endif /* GRAS_VIRTU_INTERFACE_H */
index d487f16..9162237 100644 (file)
@@ -28,20 +28,21 @@ typedef struct {
    * This is the old interface, and will disapear before 3.2
    */
   xbt_set_t libdata;
-   
+
   /* data specific to each process for each module. 
    * Registered with gras_module_add(), retrieved with gras_moddata_get() 
    * This is the new interface
    */
   xbt_dynar_t moddata;
-       
-  int pid; /* pid of process, only for SG */
-  int ppid; /* ppid of process, only for SG */
-   
+
+  int pid;                      /* pid of process, only for SG */
+  int ppid;                     /* ppid of process, only for SG */
+
   gras_msg_listener_t listener; /* the thread in charge of the incomming communication for this process */
 } gras_procdata_t;
 
 gras_procdata_t *gras_procdata_get(void);
-void *gras_libdata_by_name_from_procdata(const char *name, gras_procdata_t* pd);
-   
-#endif  /* GRAS_VIRTU_PRIVATE_H */
+void *gras_libdata_by_name_from_procdata(const char *name,
+                                         gras_procdata_t * pd);
+
+#endif /* GRAS_VIRTU_PRIVATE_H */
index dc654a8..51090f7 100644 (file)
 
 #include "gras/Virtu/virtu_private.h"
 #include "xbt/dynar.h"
-#include "simix/simix.h" /* SimGrid header */
+#include "simix/simix.h"        /* SimGrid header */
 #include "gras/Transport/transport_private.h"
 
 typedef struct {
-   int port;  /* list of ports used by a server socket */
-   int meas;   /* (boolean) the channel is for measurements or for messages */
-   smx_process_t process;
-   gras_socket_t socket;
+  int port;                     /* list of ports used by a server socket */
+  int meas;                     /* (boolean) the channel is for measurements or for messages */
+  smx_process_t process;
+  gras_socket_t socket;
 } gras_sg_portrec_t;
 
 /* Data for each host */
@@ -32,14 +32,14 @@ typedef struct {
 
 /* data for each socket (FIXME: find a better location for that)*/
 typedef struct {
-   smx_process_t from_process;
-   smx_process_t to_process;
-
-   smx_host_t to_host;   /* Who's on other side */
-   
-   smx_cond_t cond;
-   smx_mutex_t mutex;
-   gras_socket_t to_socket;
+  smx_process_t from_process;
+  smx_process_t to_process;
+
+  smx_host_t to_host;           /* Who's on other side */
+
+  smx_cond_t cond;
+  smx_mutex_t mutex;
+  gras_socket_t to_socket;
 } gras_trp_sg_sock_data_t;
 
 
index a49174a..f718ca1 100644 (file)
@@ -9,43 +9,46 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/log.h"
-#include "xbt/virtu.h" /* set the XBT virtualization to use GRAS */
-#include "xbt/module.h" /* xbt_init/exit */
-#include "xbt/xbt_os_time.h" /* xbt_os_time */
+#include "xbt/virtu.h"          /* set the XBT virtualization to use GRAS */
+#include "xbt/module.h"         /* xbt_init/exit */
+#include "xbt/xbt_os_time.h"    /* xbt_os_time */
 #include "xbt/synchro.h"
 
-#include "Virtu/virtu_interface.h" /* Module mechanism FIXME: deplace&rename */
+#include "Virtu/virtu_interface.h"      /* Module mechanism FIXME: deplace&rename */
 #include "Virtu/virtu_private.h"
-#include "gras_modinter.h"   /* module init/exit */
-#include "amok/amok_modinter.h"   /* module init/exit */
-#include "xbt_modinter.h"   /* module init/exit */
+#include "gras_modinter.h"      /* module init/exit */
+#include "amok/amok_modinter.h" /* module init/exit */
+#include "xbt_modinter.h"       /* module init/exit */
 
 #include "gras.h"
-#include "gras/process.h" /* FIXME: killme and put process_init in modinter */
+#include "gras/process.h"       /* FIXME: killme and put process_init in modinter */
 #include "gras/Msg/msg_private.h"
-#include "portable.h" /* hexa_*(); signalling stuff */
+#include "portable.h"           /* hexa_*(); signalling stuff */
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(gras,"All GRAS categories (cf. section \ref GRAS_API)");
+XBT_LOG_NEW_DEFAULT_CATEGORY(gras,
+                             "All GRAS categories (cf. section \ref GRAS_API)");
 static int gras_running_process = 0;
 #if defined(HAVE_SIGNAL) && defined(HAVE_SIGNAL_H)
-static void gras_sigusr_handler(int sig) {
-   INFO0("SIGUSR1 received. Display the backtrace");
-   xbt_backtrace_display_current();
+static void gras_sigusr_handler(int sig)
+{
+  INFO0("SIGUSR1 received. Display the backtrace");
+  xbt_backtrace_display_current();
 }
 
-static void gras_sigint_handler(int sig) {
-   static double lastone = 0;
-   if (lastone == 0 || xbt_os_time() - lastone > 5) {
-      if (gras_if_RL())
-         xbt_backtrace_display_current();
-      else
-         SIMIX_display_process_status();
-      fprintf(stderr,
-             "\nBacktrace displayed because Ctrl-C was pressed. Press again (within 5 sec) to abort the process.\n");
-      lastone = xbt_os_time();
-   } else {
-      exit(1);
-   }
+static void gras_sigint_handler(int sig)
+{
+  static double lastone = 0;
+  if (lastone == 0 || xbt_os_time() - lastone > 5) {
+    if (gras_if_RL())
+      xbt_backtrace_display_current();
+    else
+      SIMIX_display_process_status();
+    fprintf(stderr,
+            "\nBacktrace displayed because Ctrl-C was pressed. Press again (within 5 sec) to abort the process.\n");
+    lastone = xbt_os_time();
+  } else {
+    exit(1);
+  }
 }
 #endif
 
@@ -67,52 +70,53 @@ XBT_LOG_EXTERNAL_CATEGORY(gras_virtu);
 XBT_LOG_EXTERNAL_CATEGORY(gras_virtu_emul);
 XBT_LOG_EXTERNAL_CATEGORY(gras_virtu_process);
 
-void gras_init(int *argc,char **argv) {
+void gras_init(int *argc, char **argv)
+{
 
-       gras_procdata_t *pd;
-       gras_msg_procdata_t msg_pd;
+  gras_procdata_t *pd;
+  gras_msg_procdata_t msg_pd;
   VERB0("Initialize GRAS");
 
   xbt_getpid = gras_os_getpid;
   /* First initialize the XBT */
-  xbt_init(argc,argv);
+  xbt_init(argc, argv);
 
   /* module registrations:
    *    - declare process specific data we need (without creating them)
    */
   if (gras_running_process == 0) {
-     /* Connect our log channels: that must be done manually under windows */
-     XBT_LOG_CONNECT(gras_ddt, gras);
-       XBT_LOG_CONNECT(gras_ddt_cbps, gras_ddt);
-       XBT_LOG_CONNECT(gras_ddt_convert, gras_ddt);
-       XBT_LOG_CONNECT(gras_ddt_create, gras_ddt);
-       XBT_LOG_CONNECT(gras_ddt_exchange, gras_ddt);
-       XBT_LOG_CONNECT(gras_ddt_lexer, gras_ddt_parse);
-       XBT_LOG_CONNECT(gras_ddt_parse, gras_ddt);
+    /* Connect our log channels: that must be done manually under windows */
+    XBT_LOG_CONNECT(gras_ddt, gras);
+    XBT_LOG_CONNECT(gras_ddt_cbps, gras_ddt);
+    XBT_LOG_CONNECT(gras_ddt_convert, gras_ddt);
+    XBT_LOG_CONNECT(gras_ddt_create, gras_ddt);
+    XBT_LOG_CONNECT(gras_ddt_exchange, gras_ddt);
+    XBT_LOG_CONNECT(gras_ddt_lexer, gras_ddt_parse);
+    XBT_LOG_CONNECT(gras_ddt_parse, gras_ddt);
 
-     XBT_LOG_CONNECT(gras_modules, gras);
+    XBT_LOG_CONNECT(gras_modules, gras);
 
-     XBT_LOG_CONNECT(gras_msg, gras);
-       XBT_LOG_CONNECT(gras_msg_read, gras_msg);
-       XBT_LOG_CONNECT(gras_msg_rpc, gras_msg);
+    XBT_LOG_CONNECT(gras_msg, gras);
+    XBT_LOG_CONNECT(gras_msg_read, gras_msg);
+    XBT_LOG_CONNECT(gras_msg_rpc, gras_msg);
 
-     XBT_LOG_CONNECT(gras_timer, gras);
+    XBT_LOG_CONNECT(gras_timer, gras);
 
-     XBT_LOG_CONNECT(gras_trp, gras);
-       XBT_LOG_CONNECT(gras_trp_meas, gras_trp);
+    XBT_LOG_CONNECT(gras_trp, gras);
+    XBT_LOG_CONNECT(gras_trp_meas, gras_trp);
 
-     XBT_LOG_CONNECT(gras_virtu, gras);
-       XBT_LOG_CONNECT(gras_virtu_emul, gras_virtu);
-       XBT_LOG_CONNECT(gras_virtu_process, gras_virtu);
+    XBT_LOG_CONNECT(gras_virtu, gras);
+    XBT_LOG_CONNECT(gras_virtu_emul, gras_virtu);
+    XBT_LOG_CONNECT(gras_virtu_process, gras_virtu);
 
-     gras_trp_register();
-     gras_msg_register();
+    gras_trp_register();
+    gras_msg_register();
   }
 
   /*
    * Initialize the process specific stuff
    */
-  gras_process_init(); /* calls procdata_init, which creates process specific data for each module */
+  gras_process_init();          /* calls procdata_init, which creates process specific data for each module */
 
   /*
    * Initialize the global stuff if it's not the first process created
@@ -124,9 +128,9 @@ void gras_init(int *argc,char **argv) {
     gras_datadesc_init();
 #if defined(HAVE_SIGNAL) && defined(HAVE_SIGNAL_H)
 # ifdef SIGUSR1
-    signal(SIGUSR1,gras_sigusr_handler);
+    signal(SIGUSR1, gras_sigusr_handler);
 # endif
-    signal(SIGINT,gras_sigint_handler);
+    signal(SIGINT, gras_sigint_handler);
 #endif
   }
 
@@ -134,18 +138,19 @@ void gras_init(int *argc,char **argv) {
   amok_init();
 
   /* And finally, launch the listener thread */
-   pd = gras_procdata_get();
-   msg_pd = gras_libdata_by_name("gras_msg");
-   pd->listener = gras_msg_listener_launch(msg_pd->msg_received);
+  pd = gras_procdata_get();
+  msg_pd = gras_libdata_by_name("gras_msg");
+  pd->listener = gras_msg_listener_launch(msg_pd->msg_received);
 }
 
-void gras_exit(void) {
-       gras_procdata_t *pd;
+void gras_exit(void)
+{
+  gras_procdata_t *pd;
   INFO0("Exiting GRAS");
   amok_exit();
   gras_moddata_leave();
-       pd = gras_procdata_get();
-       gras_msg_listener_shutdown(pd->listener);
+  pd = gras_procdata_get();
+  gras_msg_listener_shutdown(pd->listener);
   gras_process_exit();
   if (--gras_running_process == 0) {
     gras_msg_exit();
@@ -157,47 +162,49 @@ void gras_exit(void) {
   xbt_exit();
 }
 
-const char *hexa_str(unsigned char *data, int size, int downside) {
-  static char*buff=NULL;
-  static int buffsize=0;
-  int i,pos=0;
-  int begin,increment;
+const char *hexa_str(unsigned char *data, int size, int downside)
+{
+  static char *buff = NULL;
+  static int buffsize = 0;
+  int i, pos = 0;
+  int begin, increment;
 
-  if (buffsize<5*(size+1)) {
+  if (buffsize < 5 * (size + 1)) {
     if (buff)
       free(buff);
-    buffsize=5*(size+1);
-    buff=xbt_malloc(buffsize);
+    buffsize = 5 * (size + 1);
+    buff = xbt_malloc(buffsize);
   }
 
 
   if (downside) {
-     begin=size-1;
-     increment=-1;
+    begin = size - 1;
+    increment = -1;
   } else {
-     begin=0;
-     increment=1;
+    begin = 0;
+    increment = 1;
   }
 
-  for (i=begin; 0<=i && i<size ; i+=increment)  {
-    if (data[i]<32 || data[i]>126)
-      sprintf(buff+pos,".");
+  for (i = begin; 0 <= i && i < size; i += increment) {
+    if (data[i] < 32 || data[i] > 126)
+      sprintf(buff + pos, ".");
     else
-      sprintf(buff+pos,"%c",data[i]);
+      sprintf(buff + pos, "%c", data[i]);
     while (buff[++pos]);
-   }
-  sprintf(buff+pos,"(");
+  }
+  sprintf(buff + pos, "(");
   while (buff[++pos]);
-  for (i=begin; 0<=i && i<size ; i+=increment)  {
-    sprintf(buff+pos,"%02x",data[i]);
+  for (i = begin; 0 <= i && i < size; i += increment) {
+    sprintf(buff + pos, "%02x", data[i]);
     while (buff[++pos]);
-   }
-  sprintf(buff+pos,")");
+  }
+  sprintf(buff + pos, ")");
   while (buff[++pos]);
-  buff[pos]='\0';
+  buff[pos] = '\0';
   return buff;
 }
-void hexa_print(const char*name, unsigned char *data, int size) {
-   printf("%s: %s\n", name,hexa_str(data,size,0));
-}
 
+void hexa_print(const char *name, unsigned char *data, int size)
+{
+  printf("%s: %s\n", name, hexa_str(data, size, 0));
+}
index 16ef4d9..05f1535 100644 (file)
@@ -18,12 +18,17 @@ XBT_LOG_EXTERNAL_CATEGORY(gras_trp);
 XBT_LOG_EXTERNAL_CATEGORY(gras_trp_file);
 XBT_LOG_EXTERNAL_CATEGORY(gras_trp_tcp);
 
-void xbt_context_mod_init(void) {
+void xbt_context_mod_init(void)
+{
   XBT_LOG_CONNECT(xbt_sync_rl, xbt);
   XBT_LOG_CONNECT(gras_trp_file, gras_trp);
   XBT_LOG_CONNECT(gras_trp_tcp, gras_trp);
 }
 
-void xbt_context_mod_exit(void) {}
+void xbt_context_mod_exit(void)
+{
+}
 
-void SIMIX_display_process_status(void) {}
+void SIMIX_display_process_status(void)
+{
+}
index 99e83a2..7ec311e 100644 (file)
@@ -9,11 +9,11 @@
 
 #ifndef GRAS_MODINTER_H
 #define GRAS_MODINTER_H
-#include <xbt/misc.h> /* XBT_PUBLIC */
+#include <xbt/misc.h>           /* XBT_PUBLIC */
 
 /* modules initialization functions */
 void gras_emul_init(void);
-void gras_emul_exit(void); 
+void gras_emul_exit(void);
 
 void gras_msg_register(void);
 void gras_msg_init(void);
index f87b6a8..3bfc99e 100644 (file)
@@ -17,15 +17,15 @@ SG_BEGIN_DECL()
 /* ******************************** Host ************************************ */
 /** @defgroup m_datatypes_management_details Details on SIMIX datatypes
     @ingroup  m_datatypes_management*/
-
-typedef struct s_smx_simdata_host *smx_simdata_host_t;
+     typedef struct s_smx_simdata_host *smx_simdata_host_t;
 /** @brief Host datatype 
     @ingroup m_datatypes_management_details */
-typedef struct s_smx_host {
-  char *name;                  /**< @brief host name if any */
-  smx_simdata_host_t simdata;  /**< @brief simulator data */
-  void *data;                  /**< @brief user data */
-} s_smx_host_t;
+     typedef struct s_smx_host {
+       char *name;              /**< @brief host name if any */
+       smx_simdata_host_t simdata;
+                                /**< @brief simulator data */
+       void *data;              /**< @brief user data */
+     } s_smx_host_t;
 /** @brief Host datatype  
     @ingroup m_datatypes_management
 
@@ -38,44 +38,45 @@ typedef struct s_smx_host {
 
     \see m_host_management
   @{ */
-typedef struct s_smx_host *smx_host_t;
+     typedef struct s_smx_host *smx_host_t;
 /** @} */
 
 
 /* ******************************** Syncro ************************************ */
 
-typedef struct s_smx_mutex *smx_mutex_t;
-typedef struct s_smx_cond *smx_cond_t;
+     typedef struct s_smx_mutex *smx_mutex_t;
+     typedef struct s_smx_cond *smx_cond_t;
 
 
 /********************************** Action *************************************/
-typedef struct s_smx_simdata_action *smx_simdata_action_t;
+     typedef struct s_smx_simdata_action *smx_simdata_action_t;
 /** @brief Action datatype 
     @ingroup m_datatypes_management_details */
-typedef struct s_smx_action {
-  char *name;                  /**< @brief action name if any */
-  smx_simdata_action_t simdata;        /**< @brief simulator data */
-       xbt_fifo_t cond_list;   /*< conditional variables that must be signaled when the action finish. */
-  void *data;                  /**< @brief user data */
-  int refcount;                        /**< @brief reference counter */
-} s_smx_action_t;
+     typedef struct s_smx_action {
+       char *name;              /**< @brief action name if any */
+       smx_simdata_action_t simdata;
+                                /**< @brief simulator data */
+       xbt_fifo_t cond_list;    /*< conditional variables that must be signaled when the action finish. */
+       void *data;              /**< @brief user data */
+       int refcount;            /**< @brief reference counter */
+     } s_smx_action_t;
 
-typedef struct s_smx_action *smx_action_t;
+     typedef struct s_smx_action *smx_action_t;
 
 
 /* ****************************** Process *********************************** */
-typedef struct s_smx_simdata_process *smx_simdata_process_t;
+     typedef struct s_smx_simdata_process *smx_simdata_process_t;
 /** @brief Process datatype 
     @ingroup m_datatypes_management_details @{ */
-typedef struct s_smx_process {
-
-   char *name;                 /**< @brief process name if any */
-   smx_simdata_process_t simdata;      /**< @brief simulator data */
-   s_xbt_swag_hookup_t process_hookup;
-   s_xbt_swag_hookup_t synchro_hookup;
-   s_xbt_swag_hookup_t host_proc_hookup;
-   void *data;                 /**< @brief user data */
-} s_smx_process_t;
+     typedef struct s_smx_process {
+
+       char *name;              /**< @brief process name if any */
+       smx_simdata_process_t simdata;   /**< @brief simulator data */
+       s_xbt_swag_hookup_t process_hookup;
+       s_xbt_swag_hookup_t synchro_hookup;
+       s_xbt_swag_hookup_t host_proc_hookup;
+       void *data;              /**< @brief user data */
+     } s_smx_process_t;
 /** @} */
 /** @brief Agent datatype  
     @ingroup m_datatypes_management 
@@ -84,7 +85,7 @@ typedef struct s_smx_process {
     data</em>, executing in a <em>location</em>.
     \see m_process_management
   @{ */
-typedef struct s_smx_process *smx_process_t;
+     typedef struct s_smx_process *smx_process_t;
 /** @} */
 
 SG_END_DECL()
index 60620ae..ae70ee3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: simix.h 5610 2008-06-12 09:38:58Z alegrand $        */
+/*     $Id$     */
 
 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
    All rights reserved.                                          */
@@ -23,7 +23,8 @@ SG_BEGIN_DECL()
 XBT_PUBLIC(void) SIMIX_config(const char *name, va_list pa);
 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
 XBT_PUBLIC(void) SIMIX_clean(void);
-XBT_PUBLIC(void) SIMIX_function_register(const char *name, xbt_main_func_t code);
+XBT_PUBLIC(void) SIMIX_function_register(const char *name,
+                                         xbt_main_func_t code);
 XBT_PUBLIC(void) SIMIX_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC(xbt_main_func_t) SIMIX_get_registered_function(const char *name);
 
@@ -31,10 +32,11 @@ XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
 
 XBT_PUBLIC(double) SIMIX_get_clock(void);
 XBT_PUBLIC(void) SIMIX_init(void);
-XBT_PUBLIC(double) SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed);
+XBT_PUBLIC(double) SIMIX_solve(xbt_fifo_t actions_done,
+                               xbt_fifo_t actions_failed);
 
 /* Timer functions */
-XBT_PUBLIC(void) SIMIX_timer_set (double date, void *function, void *arg);
+XBT_PUBLIC(void) SIMIX_timer_set(double date, void *function, void *arg);
 XBT_PUBLIC(int) SIMIX_timer_get(void **function, void **arg);
 
 /* only for tests */
@@ -48,21 +50,24 @@ XBT_PUBLIC(void) __SIMIX_main(void);
  * int argc, char **argv: parameters passed to code
  *
  * */
-typedef void *(*smx_creation_func_t)(/*name*/     const char *,
-                                    /*code*/     xbt_main_func_t, 
-                                    /*userdata*/ void *,
-                                    /*hostname*/ char *, 
-                                    /* argc */   int,
-                                    /* argv */   char **,
-                                     /* props */ xbt_dict_t);
-XBT_PUBLIC(void) SIMIX_function_register_process_create(smx_creation_func_t function);
-XBT_PUBLIC(void) SIMIX_function_register_process_kill(void_f_pvoid_t function);
-XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_f_pvoid_t function);
+     typedef void *(*smx_creation_func_t) ( /*name */ const char *,
+                                           /*code */ xbt_main_func_t,
+                                           /*userdata */ void *,
+                                           /*hostname */ char *,
+                                           /* argc */ int,
+                                           /* argv */ char **,
+                                           /* props */ xbt_dict_t);
+XBT_PUBLIC(void) SIMIX_function_register_process_create(smx_creation_func_t
+                                                        function);
+XBT_PUBLIC(void) SIMIX_function_register_process_kill(void_f_pvoid_t
+                                                      function);
+XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_f_pvoid_t
+                                                         function);
 
 /************************** Host handling ***********************************/
 
 XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
-XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
+XBT_PUBLIC(void *) SIMIX_host_get_data(smx_host_t host);
 
 XBT_PUBLIC(const char *) SIMIX_host_get_name(smx_host_t host);
 XBT_PUBLIC(void) SIMIX_process_set_name(smx_process_t process, char *name);
@@ -84,26 +89,30 @@ XBT_PUBLIC(int) SIMIX_host_get_state(smx_host_t host);
 
 /************************** Process handling *********************************/
 XBT_PUBLIC(smx_process_t) SIMIX_process_create(const char *name,
-                                              xbt_main_func_t code, void *data,
-                                              const char * hostname, int argc, char **argv, xbt_dict_t properties);
-
-XBT_PUBLIC(void) SIMIX_jprocess_create(const char *name, 
-                                      smx_host_t host,
-                                      void *data,
-                                      void *jprocess, void *jenv,
-                                      smx_process_t* res);
+                                               xbt_main_func_t code,
+                                               void *data,
+                                               const char *hostname, int argc,
+                                               char **argv,
+                                               xbt_dict_t properties);
+
+XBT_PUBLIC(void) SIMIX_jprocess_create(const char *name,
+                                       smx_host_t host,
+                                       void *data,
+                                       void *jprocess, void *jenv,
+                                       smx_process_t * res);
 
 XBT_PUBLIC(void) SIMIX_process_kill(smx_process_t process);
 XBT_PUBLIC(void) SIMIX_process_cleanup(void *arg);
 XBT_PUBLIC(void) SIMIX_process_killall(void);
-XBT_PUBLIC(void) SIMIX_process_change_host(smx_process_t process, char *source, char *dest);
+XBT_PUBLIC(void) SIMIX_process_change_host(smx_process_t process,
+                                           char *source, char *dest);
 
 //above layer
-XBT_PUBLIC(void*) SIMIX_process_get_data(smx_process_t process);
+XBT_PUBLIC(void *) SIMIX_process_get_data(smx_process_t process);
 XBT_PUBLIC(void) SIMIX_process_set_data(smx_process_t process, void *data);
 
 XBT_PUBLIC(smx_host_t) SIMIX_process_get_host(smx_process_t process);
-XBT_PUBLIC(const char *)SIMIX_process_get_name(smx_process_t process);
+XBT_PUBLIC(const char *) SIMIX_process_get_name(smx_process_t process);
 XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
 
 XBT_PUBLIC(void) SIMIX_process_suspend(smx_process_t process);
@@ -125,38 +134,46 @@ XBT_PUBLIC(void) SIMIX_mutex_destroy(smx_mutex_t mutex);
 /*****Conditional*****/
 XBT_PUBLIC(smx_cond_t) SIMIX_cond_init(void);
 XBT_PUBLIC(void) SIMIX_cond_signal(smx_cond_t cond);
-XBT_PUBLIC(void) SIMIX_cond_wait(smx_cond_t cond,smx_mutex_t mutex);
-XBT_PUBLIC(void) SIMIX_cond_wait_timeout(smx_cond_t cond,smx_mutex_t mutex, double max_duration);
+XBT_PUBLIC(void) SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
+XBT_PUBLIC(void) SIMIX_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex,
+                                         double max_duration);
 XBT_PUBLIC(void) SIMIX_cond_broadcast(smx_cond_t cond);
 XBT_PUBLIC(void) SIMIX_cond_destroy(smx_cond_t cond);
 XBT_PUBLIC(xbt_fifo_t) SIMIX_cond_get_actions(smx_cond_t cond);
 XBT_PUBLIC(void) SIMIX_cond_display_info(smx_cond_t cond);
 
 /************************** Action handling ************************************/
-XBT_PUBLIC(smx_action_t) SIMIX_action_communicate(smx_host_t sender,smx_host_t receiver, const char *name,
-                                                                                                                                                                                                       double size, double rate);
-XBT_PUBLIC(smx_action_t) SIMIX_action_execute(smx_host_t host, const char *name, double amount);
+XBT_PUBLIC(smx_action_t) SIMIX_action_communicate(smx_host_t sender,
+                                                  smx_host_t receiver,
+                                                  const char *name,
+                                                  double size, double rate);
+XBT_PUBLIC(smx_action_t) SIMIX_action_execute(smx_host_t host,
+                                              const char *name,
+                                              double amount);
 XBT_PUBLIC(smx_action_t) SIMIX_action_sleep(smx_host_t host, double amount);
 XBT_PUBLIC(void) SIMIX_action_cancel(smx_action_t action);
-XBT_PUBLIC(void) SIMIX_action_set_priority(smx_action_t action, double priority);
+XBT_PUBLIC(void) SIMIX_action_set_priority(smx_action_t action,
+                                           double priority);
 XBT_PUBLIC(void) SIMIX_action_destroy(smx_action_t action);
-XBT_PUBLIC(void) SIMIX_register_action_to_condition(smx_action_t action, smx_cond_t cond);
-XBT_PUBLIC(void) SIMIX_unregister_action_to_condition(smx_action_t action, smx_cond_t cond);
+XBT_PUBLIC(void) SIMIX_register_action_to_condition(smx_action_t action,
+                                                    smx_cond_t cond);
+XBT_PUBLIC(void) SIMIX_unregister_action_to_condition(smx_action_t action,
+                                                      smx_cond_t cond);
 XBT_PUBLIC(double) SIMIX_action_get_remains(smx_action_t action);
 
 XBT_PUBLIC(e_surf_action_state_t) SIMIX_action_get_state(smx_action_t action);
 
-XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(char * name, 
-                                                      int host_nb,      
-                                                      smx_host_t *host_list,
-                                                      double *computation_amount,
-                                                      double *communication_amount,
-                                                      double amount,
-                                                      double rate);
+XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(char *name,
+                                                       int host_nb,
+                                                       smx_host_t * host_list,
+                                                       double
+                                                       *computation_amount, double
+                                                       *communication_amount,
+                                                       double amount,
+                                                       double rate);
 
-void SIMIX_display_process_status(void);
+     void SIMIX_display_process_status(void);
 
 
 SG_END_DECL()
-
-#endif                          /* _SIMIX_SIMIX_H */
+#endif /* _SIMIX_SIMIX_H */
index 240ad93..2336943 100644 (file)
 #include "xbt/misc.h"
 
 #define MAXMIN_PRECISION 0.00001
-static XBT_INLINE void double_update(double *variable, double value) 
+static XBT_INLINE void double_update(double *variable, double value)
 {
   *variable -= value;
-  if(*variable< MAXMIN_PRECISION) *variable = 0.0;
+  if (*variable < MAXMIN_PRECISION)
+    *variable = 0.0;
 }
 
-static XBT_INLINE int double_positive(double value) 
+static XBT_INLINE int double_positive(double value)
 {
-  return (value>MAXMIN_PRECISION);
+  return (value > MAXMIN_PRECISION);
 }
 
 typedef struct lmm_element *lmm_element_t;
@@ -30,56 +31,61 @@ typedef struct lmm_system *lmm_system_t;
 
 XBT_PUBLIC(lmm_system_t) lmm_system_new(void);
 XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys);
-void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
+     void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var);
 
 XBT_PUBLIC(lmm_constraint_t) lmm_constraint_new(lmm_system_t sys, void *id,
-                                   double bound_value);
-void lmm_constraint_shared(lmm_constraint_t cnst);
-int lmm_constraint_is_shared(lmm_constraint_t cnst);
+                                                double bound_value);
+     void lmm_constraint_shared(lmm_constraint_t cnst);
+     int lmm_constraint_is_shared(lmm_constraint_t cnst);
 
-void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst);
+     void lmm_constraint_free(lmm_system_t sys, lmm_constraint_t cnst);
 
 XBT_PUBLIC(lmm_variable_t) lmm_variable_new(lmm_system_t sys, void *id,
-                               double weight_value,
-                               double bound, int number_of_constraints);
-void lmm_variable_free(lmm_system_t sys, lmm_variable_t var);
+                                            double weight_value,
+                                            double bound,
+                                            int number_of_constraints);
+     void lmm_variable_free(lmm_system_t sys, lmm_variable_t var);
 XBT_PUBLIC(double) lmm_variable_getvalue(lmm_variable_t var);
 XBT_PUBLIC(double) lmm_variable_getbound(lmm_variable_t var);
 
 XBT_PUBLIC(void) lmm_expand(lmm_system_t sys, lmm_constraint_t cnst,
-               lmm_variable_t var, double value);
-void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst,
-                   lmm_variable_t var, double value);
-void lmm_elem_set_value(lmm_system_t sys, lmm_constraint_t cnst,
-                       lmm_variable_t var, double value);
+                            lmm_variable_t var, double value);
+     void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst,
+                         lmm_variable_t var, double value);
+     void lmm_elem_set_value(lmm_system_t sys, lmm_constraint_t cnst,
+                             lmm_variable_t var, double value);
 
-lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys,
-                                      lmm_variable_t var, int num);
-int lmm_get_number_of_cnst_from_var(lmm_system_t sys, lmm_variable_t var);
-lmm_variable_t lmm_get_var_from_cnst(lmm_system_t sys,
-                                    lmm_constraint_t cnst,
-                                    lmm_element_t * elem);
+     lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys,
+                                            lmm_variable_t var, int num);
+     int lmm_get_number_of_cnst_from_var(lmm_system_t sys,
+                                         lmm_variable_t var);
+     lmm_variable_t lmm_get_var_from_cnst(lmm_system_t sys,
+                                          lmm_constraint_t cnst,
+                                          lmm_element_t * elem);
 
-lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys);
-lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys, lmm_constraint_t cnst);
+     lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys);
+     lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys,
+                                                     lmm_constraint_t cnst);
 
-void *lmm_constraint_id(lmm_constraint_t cnst);
-void *lmm_variable_id(lmm_variable_t var);
+     void *lmm_constraint_id(lmm_constraint_t cnst);
+     void *lmm_variable_id(lmm_variable_t var);
 
-void lmm_update(lmm_system_t sys, lmm_constraint_t cnst,
-               lmm_variable_t var, double value);
-void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
-                              double bound);
+     void lmm_update(lmm_system_t sys, lmm_constraint_t cnst,
+                     lmm_variable_t var, double value);
+     void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
+                                    double bound);
 
 
-XBT_PUBLIC(void) lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
-                               double weight);
-double lmm_get_variable_weight(lmm_variable_t var);
+XBT_PUBLIC(void) lmm_update_variable_weight(lmm_system_t sys,
+                                            lmm_variable_t var,
+                                            double weight);
+     double lmm_get_variable_weight(lmm_variable_t var);
 
-XBT_PUBLIC(void) lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst,
-                                double bound);
+XBT_PUBLIC(void) lmm_update_constraint_bound(lmm_system_t sys,
+                                             lmm_constraint_t cnst,
+                                             double bound);
 
-int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst);
+     int lmm_constraint_used(lmm_system_t sys, lmm_constraint_t cnst);
 
 
 XBT_PUBLIC(void) lmm_solve(lmm_system_t sys);
@@ -96,21 +102,28 @@ XBT_PUBLIC(void) bottleneck_solve(lmm_system_t sys);
  * using the lagrangian approach.
  */
 
-XBT_PUBLIC(void) lmm_set_default_protocol_function(double (* func_f)  (lmm_variable_t var, double x),
-                                      double (* func_fp) (lmm_variable_t var, double x),
-                                      double (* func_fpi)(lmm_variable_t var, double x));
-
-XBT_PUBLIC(double func_reno_f)  (lmm_variable_t var, double x);
+XBT_PUBLIC(void) lmm_set_default_protocol_function(double (*func_f)
+                                                    
+                                                   (lmm_variable_t var,
+                                                    double x),
+                                                   double (*func_fp)
+                                                   (lmm_variable_t var,
+                                                    double x),
+                                                   double (*func_fpi)
+                                                   (lmm_variable_t var,
+                                                    double x));
+
+XBT_PUBLIC(double func_reno_f) (lmm_variable_t var, double x);
 XBT_PUBLIC(double func_reno_fp) (lmm_variable_t var, double x);
-XBT_PUBLIC(double func_reno_fpi)(lmm_variable_t var, double x);
+XBT_PUBLIC(double func_reno_fpi) (lmm_variable_t var, double x);
 
-XBT_PUBLIC(double func_reno2_f)  (lmm_variable_t var, double x);
+XBT_PUBLIC(double func_reno2_f) (lmm_variable_t var, double x);
 XBT_PUBLIC(double func_reno2_fp) (lmm_variable_t var, double x);
-XBT_PUBLIC(double func_reno2_fpi)(lmm_variable_t var, double x);
+XBT_PUBLIC(double func_reno2_fpi) (lmm_variable_t var, double x);
 
-XBT_PUBLIC(double func_vegas_f)  (lmm_variable_t var, double x);
+XBT_PUBLIC(double func_vegas_f) (lmm_variable_t var, double x);
 XBT_PUBLIC(double func_vegas_fp) (lmm_variable_t var, double x);
-XBT_PUBLIC(double func_vegas_fpi)(lmm_variable_t var, double x);
+XBT_PUBLIC(double func_vegas_fpi) (lmm_variable_t var, double x);
 
 
-#endif                         /* _SURF_MAXMIN_H */
+#endif /* _SURF_MAXMIN_H */
index 7e0d495..a062c2b 100644 (file)
@@ -9,22 +9,21 @@
 
 SG_BEGIN_DECL()
 
-typedef enum {NONE, DRAND48, RAND} Generator;
+     typedef enum { NONE, DRAND48, RAND } Generator;
 
-typedef struct random_data_desc {
-  long int seed;
-  double max, min;
-  double mean, std; /* note: mean and standard deviation are normalized */
-  Generator generator;
-} s_random_data_t, *random_data_t;
+     typedef struct random_data_desc {
+       long int seed;
+       double max, min;
+       double mean, std;        /* note: mean and standard deviation are normalized */
+       Generator generator;
+     } s_random_data_t, *random_data_t;
 
 XBT_PUBLIC_DATA(xbt_dict_t) random_data_list;
 
 XBT_PUBLIC(double) random_generate(random_data_t random);
-XBT_PUBLIC(random_data_t) random_new(Generator generator, long int seed, 
-                                    double min, double max, double mean, 
-                                    double stdDeviation);
+XBT_PUBLIC(random_data_t) random_new(Generator generator, long int seed,
+                                     double min, double max, double mean,
+                                     double stdDeviation);
 
 SG_END_DECL()
-
-#endif                         /* _SURF_RMGR_H */
+#endif /* _SURF_RMGR_H */
index cdd5b2b..92b1c62 100644 (file)
@@ -19,7 +19,6 @@ SG_BEGIN_DECL()
 
 
 /* Actions and models are higly connected structures... */
-
 /** \brief Action datatype
  *  \ingroup SURF_actions
  *  
@@ -28,7 +27,7 @@ SG_BEGIN_DECL()
  *
  * \see e_surf_action_state_t
  */
-typedef struct surf_action *surf_action_t;
+     typedef struct surf_action *surf_action_t;
 
 /** \brief Model datatype
  *  \ingroup SURF_models
@@ -36,23 +35,22 @@ typedef struct surf_action *surf_action_t;
  *  Generic data structure for a model. The workstations,
  *  the CPUs and the network links are examples of models.
  */
-typedef struct surf_model *surf_model_t;
+     typedef struct surf_model *surf_model_t;
 
 /** \brief Resource model description
  */
-typedef struct surf_model_description {
-  const char *name;
-  surf_model_t model;
-  void (* model_init) (const char *filename);
-  void (* create_ws) (void);
-} s_surf_model_description_t, *surf_model_description_t;
+     typedef struct surf_model_description {
+       const char *name;
+       surf_model_t model;
+       void (*model_init) (const char *filename);
+       void (*create_ws) (void);
+     } s_surf_model_description_t, *surf_model_description_t;
 
-XBT_PUBLIC(void) update_model_description(s_surf_model_description_t *table,
-                                         const char* name, 
-                                         surf_model_t model
-                                         );
-XBT_PUBLIC(int) find_model_description(s_surf_model_description_t *table,
-                                      const char* name);
+XBT_PUBLIC(void) update_model_description(s_surf_model_description_t * table,
+                                          const char *name,
+                                          surf_model_t model);
+XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
+                                       const char *name);
 
 /** \brief Action structure
  * \ingroup SURF_actions
@@ -62,22 +60,22 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t *table,
  *  
  *  \see e_surf_action_state_t
  */
-typedef struct surf_action {
-  s_xbt_swag_hookup_t state_hookup;
-  xbt_swag_t state_set;
-  double cost;                 /**< cost        */
-  double priority;             /**< priority (1.0 by default) */
-  double max_duration;         /**< max_duration (may fluctuate until
+     typedef struct surf_action {
+       s_xbt_swag_hookup_t state_hookup;
+       xbt_swag_t state_set;
+       double cost;             /**< cost        */
+       double priority;         /**< priority (1.0 by default) */
+       double max_duration;     /**< max_duration (may fluctuate until
                                   the task is completed) */
-  double remains;              /**< How much of that cost remains to
+       double remains;          /**< How much of that cost remains to
                                 * be done in the currently running task */
-  double start;                        /**< start time  */
-  double finish;               /**< finish time : this is modified during the run
+       double start;            /**< start time  */
+       double finish;           /**< finish time : this is modified during the run
                                 * and fluctuates until the task is completed */
-  void *data;                  /**< for your convenience */
-  int refcount ;
-  surf_model_t model_type;
-} s_surf_action_t;
+       void *data;              /**< for your convenience */
+       int refcount;
+       surf_model_t model_type;
+     } s_surf_action_t;
 
 /** \brief Action states
  *  \ingroup SURF_actions
@@ -86,14 +84,15 @@ typedef struct surf_action {
  *
  *  \see surf_action_t, surf_action_state_t
  */
-typedef enum {
-  SURF_ACTION_READY = 0,       /**< Ready        */
-  SURF_ACTION_RUNNING,         /**< Running      */
-  SURF_ACTION_FAILED,          /**< Task Failure */
-  SURF_ACTION_DONE,            /**< Completed    */
-  SURF_ACTION_TO_FREE,                 /**< Action to free in next cleanup */
-  SURF_ACTION_NOT_IN_THE_SYSTEM        /**< Not in the system anymore. Why did you ask ? */
-} e_surf_action_state_t;
+     typedef enum {
+       SURF_ACTION_READY = 0,   /**< Ready        */
+       SURF_ACTION_RUNNING,     /**< Running      */
+       SURF_ACTION_FAILED,      /**< Task Failure */
+       SURF_ACTION_DONE,        /**< Completed    */
+       SURF_ACTION_TO_FREE,     /**< Action to free in next cleanup */
+       SURF_ACTION_NOT_IN_THE_SYSTEM
+                                /**< Not in the system anymore. Why did you ask ? */
+     } e_surf_action_state_t;
 
 /** \brief Action state sets
  *  \ingroup SURF_actions
@@ -103,12 +102,16 @@ typedef enum {
  *
  *  \see surf_action_t, e_surf_action_state_t
  */
-typedef struct surf_action_state {
-  xbt_swag_t ready_action_set;   /**< Actions in state SURF_ACTION_READY */
-  xbt_swag_t running_action_set; /**< Actions in state SURF_ACTION_RUNNING */
-  xbt_swag_t failed_action_set;  /**< Actions in state SURF_ACTION_FAILED */
-  xbt_swag_t done_action_set;    /**< Actions in state SURF_ACTION_DONE */
-} s_surf_action_state_t, *surf_action_state_t;
+     typedef struct surf_action_state {
+       xbt_swag_t ready_action_set;
+                                 /**< Actions in state SURF_ACTION_READY */
+       xbt_swag_t running_action_set;
+                                 /**< Actions in state SURF_ACTION_RUNNING */
+       xbt_swag_t failed_action_set;
+                                 /**< Actions in state SURF_ACTION_FAILED */
+       xbt_swag_t done_action_set;
+                                 /**< Actions in state SURF_ACTION_DONE */
+     } s_surf_action_state_t, *surf_action_state_t;
 
 /***************************/
 /* Generic model object */
@@ -119,34 +122,53 @@ typedef struct surf_action_state {
  *
  *  These functions are implemented by all models.
  */
-typedef struct surf_model_public {
-  s_surf_action_state_t states;        /**< Any living action on this model */
-  void *(*name_service) (const char *name); /**< Return a model given its name */
-  const char *(*get_resource_name) (void *resource_id); /**< Return the name of a resource */
-
-  e_surf_action_state_t(*action_get_state) (surf_action_t action); /**< Return the state of an action */
-  double (*action_get_start_time) (surf_action_t action); /**< Return the start time of an action */
-  double (*action_get_finish_time) (surf_action_t action); /**< Return the finish time of an action */
-  void (*action_use) (surf_action_t action); /**< Set an action used */
-  int  (*action_free) (surf_action_t action); /**< Free an action */
-  void (*action_cancel) (surf_action_t action); /**< Cancel a running action */
-  void (*action_recycle) (surf_action_t action); /**< Recycle an action */
-  void (*action_change_state) (surf_action_t action, /**< Change an action state*/
-                              e_surf_action_state_t state);
-  void (*action_set_data) (surf_action_t action, void *data); /**< Set the user data of an action */
-  void (*suspend) (surf_action_t action); /**< Suspend an action */
-  void (*resume) (surf_action_t action); /**< Resume a suspended action */
-  int (*is_suspended) (surf_action_t action); /**< Return whether an action is suspended */
-  void (*set_max_duration) (surf_action_t action, double duration); /**< Set the max duration of an action*/
-  void (*set_priority) (surf_action_t action, double priority); /**< Set the priority of an action */
-  xbt_dict_t (*get_properties) (void* resource_id); /**< Return the properties dictionary */
-  const char *name; /**< Name of this model */
-} s_surf_model_public_t, *surf_model_public_t;
+     typedef struct surf_model_public {
+       s_surf_action_state_t states;
+                                /**< Any living action on this model */
+       void *(*name_service) (const char *name);
+                                            /**< Return a model given its name */
+       const char *(*get_resource_name) (void *resource_id);
+                                                        /**< Return the name of a resource */
+
+       e_surf_action_state_t(*action_get_state) (surf_action_t action);
+                                                                   /**< Return the state of an action */
+       double (*action_get_start_time) (surf_action_t action);
+                                                          /**< Return the start time of an action */
+       double (*action_get_finish_time) (surf_action_t action);
+                                                           /**< Return the finish time of an action */
+       void (*action_use) (surf_action_t action);
+                                             /**< Set an action used */
+       int (*action_free) (surf_action_t action);
+                                              /**< Free an action */
+       void (*action_cancel) (surf_action_t action);
+                                                /**< Cancel a running action */
+       void (*action_recycle) (surf_action_t action);
+                                                 /**< Recycle an action */
+       void (*action_change_state) (surf_action_t action,
+                                                     /**< Change an action state*/
+                                    e_surf_action_state_t state);
+       void (*action_set_data) (surf_action_t action, void *data);
+                                                              /**< Set the user data of an action */
+       void (*suspend) (surf_action_t action);
+                                          /**< Suspend an action */
+       void (*resume) (surf_action_t action);
+                                         /**< Resume a suspended action */
+       int (*is_suspended) (surf_action_t action);
+                                              /**< Return whether an action is suspended */
+       void (*set_max_duration) (surf_action_t action, double duration);
+                                                                    /**< Set the max duration of an action*/
+       void (*set_priority) (surf_action_t action, double priority);
+                                                                /**< Set the priority of an action */
+       xbt_dict_t(*get_properties) (void *resource_id);
+                                                    /**< Return the properties dictionary */
+       const char *name;
+                    /**< Name of this model */
+     } s_surf_model_public_t, *surf_model_public_t;
 
 /** \brief Private data available on all models
  *  \ingroup SURF_models
  */
-typedef struct surf_model_private *surf_model_private_t;
+     typedef struct surf_model_private *surf_model_private_t;
 
 /** \brief Model datatype
  *  \ingroup SURF_models
@@ -154,10 +176,10 @@ typedef struct surf_model_private *surf_model_private_t;
  *  Generic data structure for a model. The workstations,
  *  the CPUs and the network links are examples of models.
  */
-typedef struct surf_model {
-  surf_model_private_t common_private;
-  surf_model_public_t common_public;
-} s_surf_model_t;
+     typedef struct surf_model {
+       surf_model_private_t common_private;
+       surf_model_public_t common_public;
+     } s_surf_model_t;
 
 /**************************************/
 /* Implementations of model object */
@@ -168,20 +190,20 @@ typedef struct surf_model {
  *
  * Additionnal functions specific to the timer model
  */
-typedef struct surf_timer_model_extension_public {
-  void (*set) (double date, void *function, void *arg);
-  int (*get)  (void **function, void **arg);
-} s_surf_timer_model_extension_public_t,
+     typedef struct surf_timer_model_extension_public {
+       void (*set) (double date, void *function, void *arg);
+       int (*get) (void **function, void **arg);
+     } s_surf_timer_model_extension_public_t,
   *surf_timer_model_extension_public_t;
 
 /** \brief Timer model
  *  \ingroup SURF_models
  */
-typedef struct surf_timer_model {
-  surf_model_private_t common_private;
-  surf_model_public_t common_public;
-  surf_timer_model_extension_public_t extension_public;
-} s_surf_timer_model_t, *surf_timer_model_t;
+     typedef struct surf_timer_model {
+       surf_model_private_t common_private;
+       surf_model_public_t common_public;
+       surf_timer_model_extension_public_t extension_public;
+     } s_surf_timer_model_t, *surf_timer_model_t;
 
 /** \brief The timer model
  *  \ingroup SURF_models
@@ -198,33 +220,33 @@ XBT_PUBLIC(void) surf_timer_model_init(const char *filename);
 /** \brief CPU state
  *  \ingroup SURF_models
  */
-typedef enum {
-  SURF_CPU_ON = 1,             /**< Up & ready        */
-  SURF_CPU_OFF = 0             /**< Down & broken     */
-} e_surf_cpu_state_t;
+     typedef enum {
+       SURF_CPU_ON = 1,         /**< Up & ready        */
+       SURF_CPU_OFF = 0         /**< Down & broken     */
+     } e_surf_cpu_state_t;
 
 /** \brief CPU model extension public
  *  \ingroup SURF_models
  *  
  *  Public functions specific to the CPU model.
  */
-typedef struct surf_cpu_model_extension_public {
-  surf_action_t(*execute) (void *cpu, double size);
-  surf_action_t(*sleep) (void *cpu, double duration);
-  e_surf_cpu_state_t(*get_state) (void *cpu);
-  double (*get_speed) (void *cpu, double load);
-  double (*get_available_speed) (void *cpu);
-} s_surf_cpu_model_extension_public_t,
-    *surf_cpu_model_extension_public_t;
+     typedef struct surf_cpu_model_extension_public {
+       surf_action_t(*execute) (void *cpu, double size);
+       surf_action_t(*sleep) (void *cpu, double duration);
+       e_surf_cpu_state_t(*get_state) (void *cpu);
+       double (*get_speed) (void *cpu, double load);
+       double (*get_available_speed) (void *cpu);
+     } s_surf_cpu_model_extension_public_t,
+  *surf_cpu_model_extension_public_t;
 
 /** \brief CPU model datatype
  *  \ingroup SURF_models
  */
-typedef struct surf_cpu_model {
-  surf_model_private_t common_private;
-  surf_model_public_t common_public;
-  surf_cpu_model_extension_public_t extension_public;
-} s_surf_cpu_model_t, *surf_cpu_model_t;
+     typedef struct surf_cpu_model {
+       surf_model_private_t common_private;
+       surf_model_public_t common_public;
+       surf_cpu_model_extension_public_t extension_public;
+     } s_surf_cpu_model_t, *surf_cpu_model_t;
 
 /** \brief The CPU model
  *  \ingroup SURF_models
@@ -253,26 +275,26 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
  *
  *  Public functions specific to the network model
  */
-typedef struct surf_network_model_extension_public {
-  surf_action_t(*communicate) (void *src, void *dst, double size,
-                              double max_rate);
-  const void** (*get_route) (void *src, void *dst);
-  int (*get_route_size) (void *src, void *dst);
-  const char* (*get_link_name) (const void *link);
-  double (*get_link_bandwidth) (const void *link);
-  double (*get_link_latency) (const void *link);
-  int (*link_shared) (const void *link);
-} s_surf_network_model_extension_public_t,
-    *surf_network_model_extension_public_t;
+     typedef struct surf_network_model_extension_public {
+       surf_action_t(*communicate) (void *src, void *dst, double size,
+                                    double max_rate);
+       const void **(*get_route) (void *src, void *dst);
+       int (*get_route_size) (void *src, void *dst);
+       const char *(*get_link_name) (const void *link);
+       double (*get_link_bandwidth) (const void *link);
+       double (*get_link_latency) (const void *link);
+       int (*link_shared) (const void *link);
+     } s_surf_network_model_extension_public_t,
+  *surf_network_model_extension_public_t;
 
 /** \brief Network model datatype
  *  \ingroup SURF_models
  */
-typedef struct surf_network_model {
-  surf_model_private_t common_private;
-  surf_model_public_t common_public;
-  surf_network_model_extension_public_t extension_public;
-} s_surf_network_model_t, *surf_network_model_t;
+     typedef struct surf_network_model {
+       surf_model_private_t common_private;
+       surf_model_public_t common_public;
+       surf_network_model_extension_public_t extension_public;
+     } s_surf_network_model_t, *surf_network_model_t;
 
 XBT_PUBLIC(void) create_workstations(void);
 
@@ -411,41 +433,40 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_network_model_description[];
  *
  *  Public functions specific to the workstation model.
  */
-typedef struct surf_workstation_model_extension_public {
-  surf_action_t(*execute) (void *workstation, double size);            /**< Execute a computation amount on a workstation
+     typedef struct surf_workstation_model_extension_public {
+       surf_action_t(*execute) (void *workstation, double size);       /**< Execute a computation amount on a workstation
                                                                        and create the corresponding action */
-  surf_action_t(*sleep) (void *workstation, double duration);          /**< Make a workstation sleep during a given duration */
-  e_surf_cpu_state_t(*get_state) (void *workstation);                  /**< Return the CPU state of a workstation */
-  double (*get_speed) (void *workstation, double load);                /**< Return the speed of a workstation */
-  double (*get_available_speed) (void *workstation);                   /**< Return tha available speed of a workstation */
-  surf_action_t(*communicate) (void *workstation_src,                  /**< Execute a communication amount between two workstations */
-                              void *workstation_dst, double size,
-                              double max_rate);
-
-  surf_action_t(*execute_parallel_task) (int workstation_nb,           /**< Execute a parallel task on several workstations */
-                                        void **workstation_list,
-                                        double *computation_amount,
-                                        double *communication_amount,
-                                        double amount,
-                                        double rate);
-  const void** (*get_route) (void *src, void *dst);                    /**< Return the network link list between two workstations */
-  int (*get_route_size) (void *src, void *dst);                        /**< Return the route size between two workstations */
-  const char* (*get_link_name) (const void *link);                     /**< Return the name of a network link */
-  double (*get_link_bandwidth) (const void *link);                     /**< Return the current bandwidth of a network link */
-  double (*get_link_latency) (const void *link);                       /**< Return the current latency of a network link */
-  int (*link_shared) (const void *link);
-} s_surf_workstation_model_extension_public_t,
-    *surf_workstation_model_extension_public_t;
+       surf_action_t(*sleep) (void *workstation, double duration);     /**< Make a workstation sleep during a given duration */
+       e_surf_cpu_state_t(*get_state) (void *workstation);             /**< Return the CPU state of a workstation */
+       double (*get_speed) (void *workstation, double load);           /**< Return the speed of a workstation */
+       double (*get_available_speed) (void *workstation);              /**< Return tha available speed of a workstation */
+         surf_action_t(*communicate) (void *workstation_src,           /**< Execute a communication amount between two workstations */
+                                      void *workstation_dst, double size,
+                                      double max_rate);
+
+         surf_action_t(*execute_parallel_task) (int workstation_nb,    /**< Execute a parallel task on several workstations */
+                                                void **workstation_list,
+                                                double *computation_amount,
+                                                double *communication_amount,
+                                                double amount, double rate);
+       const void **(*get_route) (void *src, void *dst);               /**< Return the network link list between two workstations */
+       int (*get_route_size) (void *src, void *dst);                   /**< Return the route size between two workstations */
+       const char *(*get_link_name) (const void *link);                /**< Return the name of a network link */
+       double (*get_link_bandwidth) (const void *link);                /**< Return the current bandwidth of a network link */
+       double (*get_link_latency) (const void *link);                  /**< Return the current latency of a network link */
+       int (*link_shared) (const void *link);
+     } s_surf_workstation_model_extension_public_t,
+  *surf_workstation_model_extension_public_t;
 
 /** \brief Workstation model datatype.
  *  \ingroup SURF_models
  *
  */
-typedef struct surf_workstation_model {
-  surf_model_private_t common_private;
-  surf_model_public_t common_public;
-  surf_workstation_model_extension_public_t extension_public;
-} s_surf_workstation_model_t, *surf_workstation_model_t;
+     typedef struct surf_workstation_model {
+       surf_model_private_t common_private;
+       surf_model_public_t common_public;
+       surf_workstation_model_extension_public_t extension_public;
+     } s_surf_workstation_model_t, *surf_workstation_model_t;
 
 /** \brief The workstation model
  *  \ingroup SURF_models
@@ -508,7 +529,8 @@ XBT_PUBLIC(void) surf_workstation_model_init_ptask_L07(const char *filename);
 /** \brief The list of all available workstation model models
  *  \ingroup SURF_models
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_workstation_model_description[];
+XBT_PUBLIC_DATA(s_surf_model_description_t)
+  surf_workstation_model_description[];
 
 /** \brief The network links
  *  \ingroup SURF_models
@@ -526,12 +548,12 @@ XBT_PUBLIC_DATA(xbt_dict_t) link_set;
  *
  *  \see link_set
  */
-XBT_PUBLIC_DATA(xbt_dict_t)  workstation_set;
-XBT_PUBLIC_DATA(xbt_dict_t)  cpu_set;
+XBT_PUBLIC_DATA(xbt_dict_t) workstation_set;
+XBT_PUBLIC_DATA(xbt_dict_t) cpu_set;
 /** \brief List of initialized models
  *  \ingroup SURF_models
  */
-XBT_PUBLIC_DATA(xbt_dynar_t)  model_list;
+XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
 
 /*******************************************/
 /*** SURF Globals **************************/
@@ -551,7 +573,7 @@ XBT_PUBLIC_DATA(xbt_dynar_t)  model_list;
  *  \see surf_timer_model_init(), surf_workstation_model_init_CLM03(),
  *  surf_workstation_model_init_KCCFLN05(), surf_workstation_model_init_compound(), surf_exit()
  */
-XBT_PUBLIC(void) surf_init(int *argc, char **argv);    /* initialize common structures */
+XBT_PUBLIC(void) surf_init(int *argc, char **argv);     /* initialize common structures */
 
 /** \brief Finish simulation initialization
  *  \ingroup SURF_simulation
@@ -577,7 +599,7 @@ XBT_PUBLIC(double) surf_solve(void);
  *
  *  Return the current time in millisecond.
  */
-XBT_PUBLIC(double)surf_get_clock(void);
+XBT_PUBLIC(double) surf_get_clock(void);
 
 /** \brief Exit SURF
  *  \ingroup SURF_simulation
@@ -589,16 +611,18 @@ XBT_PUBLIC(double)surf_get_clock(void);
 XBT_PUBLIC(void) surf_exit(void);
 
 /* Prototypes of the functions that handle the properties */
-XBT_PUBLIC_DATA(xbt_dict_t) current_property_set; /* the prop set for the currently parsed element (also used in SIMIX) */
+XBT_PUBLIC_DATA(xbt_dict_t) current_property_set;       /* the prop set for the currently parsed element (also used in SIMIX) */
 XBT_PUBLIC_DATA(void) parse_properties(void);
 
 /* surf parse file related (public because called from a test suite) */
-XBT_PUBLIC(void) parse_platform_file(const charfile);
+XBT_PUBLIC(void) parse_platform_file(const char *file);
 
 /* Stores the sets */
 XBT_PUBLIC_DATA(xbt_dict_t) set_list;
 
-XBT_PUBLIC_DATA(void) manage_route(xbt_dict_t route_table, const char* route_name, int action, int isMultiRoute);
+XBT_PUBLIC_DATA(void) manage_route(xbt_dict_t route_table,
+                                   const char *route_name, int action,
+                                   int isMultiRoute);
 XBT_PUBLIC_DATA(int) route_action;
 
 /* This is used by all models when creating the routing table while parsing */
@@ -615,9 +639,8 @@ XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
 XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
 
 
-XBT_PUBLIC_DATA(double) get_cpu_power(const charpower);
+XBT_PUBLIC_DATA(double) get_cpu_power(const char *power);
 
 
 SG_END_DECL()
-
-#endif                         /* _SURF_SURF_H */
+#endif /* _SURF_SURF_H */
index c1ec2a8..74193b4 100644 (file)
@@ -14,6 +14,6 @@
 #include "surf/surfxml_parse.h"
 #include "surf/trace_mgr.h"
 
-void surf_parse_get_trace(tmgr_trace_t *trace, const char *string);
+void surf_parse_get_trace(tmgr_trace_t * trace, const char *string);
 
 #endif
index 484631b..ca86deb 100644 (file)
@@ -21,22 +21,26 @@ XBT_PUBLIC(tmgr_history_t) tmgr_history_new(void);
 XBT_PUBLIC(void) tmgr_history_free(tmgr_history_t history);
 
 XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new(const char *filename);
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char* id, const char *input, double periodicity);
+XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
+                                                    const char *input,
+                                                    double periodicity);
 XBT_PUBLIC(tmgr_trace_t) tmgr_empty_trace_new(void);
 XBT_PUBLIC(void) tmgr_trace_free(tmgr_trace_t trace);
 
 XBT_PUBLIC(tmgr_trace_event_t) tmgr_history_add_trace(tmgr_history_t history,
-                                         tmgr_trace_t trace,
-                                         double start_time, unsigned int offset,
-                                         void *model);
+                                                      tmgr_trace_t trace,
+                                                      double start_time,
+                                                      unsigned int offset,
+                                                      void *model);
 
 /* Access functions */
 XBT_PUBLIC(double) tmgr_history_next_date(tmgr_history_t history);
-XBT_PUBLIC(tmgr_trace_event_t) tmgr_history_get_next_event_leq(tmgr_history_t history,
-                                                  double date,
-                                                  double *value,
-                                                  void **model);
+XBT_PUBLIC(tmgr_trace_event_t) tmgr_history_get_next_event_leq(tmgr_history_t
+                                                               history,
+                                                               double date,
+                                                               double *value,
+                                                               void **model);
 
 XBT_PUBLIC(void) tmgr_finalize(void);
 
-#endif                         /* _SURF_TMGR_H */
+#endif /* _SURF_TMGR_H */
index 9190d58..794ca39 100644 (file)
@@ -4,36 +4,18 @@
 #include "xbt/misc.h"                          /* XBT_PUBLIC(), SG_BEGIN_DECL() and SG_END_DECL() definitions  */\r
 #include "xbt/function_types.h"                /* function pointer types declarations                                                  */      \r
 #include "xbt_modinter.h"                      /* xbt_context_init() and xbt_context_exit() declarations               */\r
-\r
-SG_BEGIN_DECL()\r
-\r
-typedef struct s_xbt_context* xbt_context_t;\r
-\r
-XBT_PUBLIC(xbt_context_t) \r
-xbt_context_new(const char*name,xbt_main_func_t code,void_f_pvoid_t startup_func, void *startup_arg,void_f_pvoid_t cleanup_func, void *cleanup_arg,int argc, char *argv[]);\r
-\r
-XBT_PUBLIC(void) \r
-xbt_context_kill(xbt_context_t context);\r
-\r
-XBT_PUBLIC(void) \r
-xbt_context_start(xbt_context_t context);\r
-\r
-XBT_PUBLIC(void) \r
-xbt_context_yield(void);\r
-\r
-XBT_PUBLIC(void) \r
-xbt_context_schedule(xbt_context_t context);\r
-\r
-void \r
-xbt_context_empty_trash(void);\r
-\r
-void\r
-xbt_context_stop(int exit_code);\r
-\r
-void\r
-xbt_context_free(xbt_context_t context);\r
-\r
-\r
-SG_END_DECL()\r
-\r
-#endif /* !XBT_CONTEXT_H */\r
+     \rSG_BEGIN_DECL() \r \rtypedef struct s_xbt_context *xbt_context_t;
+\r\rXBT_PUBLIC(xbt_context_t) \r
+xbt_context_new(const char *name, xbt_main_func_t code,
+                void_f_pvoid_t startup_func, void *startup_arg,
+                void_f_pvoid_t cleanup_func, void *cleanup_arg, int argc,
+                char *argv[]);
+\r\rXBT_PUBLIC(void) \r xbt_context_kill(xbt_context_t context);
+\r\rXBT_PUBLIC(void) \r xbt_context_start(xbt_context_t context);
+\r\rXBT_PUBLIC(void) \r xbt_context_yield(void);
+\r\rXBT_PUBLIC(void) \r xbt_context_schedule(xbt_context_t context);
+     \r\rvoid \rxbt_context_empty_trash(void);
+     \r\rvoid \rxbt_context_stop(int exit_code);
+     \r\rvoid \rxbt_context_free(xbt_context_t context);
+\r\r\rSG_END_DECL() \r \r
+#endif  /* !XBT_CONTEXT_H */\r
index df71f2a..25339b5 100644 (file)
 
 #ifdef __cplusplus
 extern "C" {
-#endif /* defined(__cplusplus) */
+#endif                          /* defined(__cplusplus) */
 
 #define IMAGEAPI WINAPI
 #define DBHLPAPI IMAGEAPI
 
-typedef struct _LOADED_IMAGE
-{
-    PSTR                        ModuleName;
-    HANDLE                      hFile;
-    PUCHAR                      MappedAddress;
-    PIMAGE_NT_HEADERS           FileHeader;
-    PIMAGE_SECTION_HEADER       LastRvaSection;
-    ULONG                       NumberOfSections;
-    PIMAGE_SECTION_HEADER       Sections;
-    ULONG                       Characteristics;
-    BOOLEAN                     fSystemImage;
-    BOOLEAN                     fDOSImage;
-    BOOLEAN                     fReadOnly;
-    UCHAR                       Version;
-    LIST_ENTRY                  Links;
-    ULONG                       SizeOfImage;
-} LOADED_IMAGE, *PLOADED_IMAGE;
+  typedef struct _LOADED_IMAGE {
+    PSTR ModuleName;
+    HANDLE hFile;
+    PUCHAR MappedAddress;
+    PIMAGE_NT_HEADERS FileHeader;
+    PIMAGE_SECTION_HEADER LastRvaSection;
+    ULONG NumberOfSections;
+    PIMAGE_SECTION_HEADER Sections;
+    ULONG Characteristics;
+    BOOLEAN fSystemImage;
+    BOOLEAN fDOSImage;
+    BOOLEAN fReadOnly;
+    UCHAR Version;
+    LIST_ENTRY Links;
+    ULONG SizeOfImage;
+  } LOADED_IMAGE, *PLOADED_IMAGE;
 
 /*************************
  *    IMAGEHLP equiv     *
  *************************/
 
-typedef enum
-{
+  typedef enum {
     AddrMode1616,
     AddrMode1632,
     AddrModeReal,
     AddrModeFlat
-} ADDRESS_MODE;
-
-typedef struct _tagADDRESS
-{
-    DWORD                       Offset;
-    WORD                        Segment;
-    ADDRESS_MODE                Mode;
-} ADDRESS, *LPADDRESS;
-
-typedef struct _tagADDRESS64
-{
-    DWORD64                     Offset;
-    WORD                        Segment;
-    ADDRESS_MODE                Mode;
-} ADDRESS64, *LPADDRESS64;
+  } ADDRESS_MODE;
+
+  typedef struct _tagADDRESS {
+    DWORD Offset;
+    WORD Segment;
+    ADDRESS_MODE Mode;
+  } ADDRESS, *LPADDRESS;
+
+  typedef struct _tagADDRESS64 {
+    DWORD64 Offset;
+    WORD Segment;
+    ADDRESS_MODE Mode;
+  } ADDRESS64, *LPADDRESS64;
 
 #define SYMF_OMAP_GENERATED   0x00000001
 #define SYMF_OMAP_MODIFIED    0x00000002
@@ -90,8 +86,7 @@ typedef struct _tagADDRESS64
 #define SYMF_THUNK            0x00002000
 #define SYMF_TLSREL           0x00004000
 
-typedef enum 
-{
+  typedef enum {
     SymNone = 0,
     SymCoff,
     SymCv,
@@ -102,167 +97,154 @@ typedef enum
     SymDia,
     SymVirtual,
     NumSymTypes
-} SYM_TYPE;
-
-typedef struct _IMAGEHLP_SYMBOL
-{
-    DWORD                       SizeOfStruct;
-    DWORD                       Address;
-    DWORD                       Size;
-    DWORD                       Flags;
-    DWORD                       MaxNameLength;
-    CHAR                        Name[1];
-} IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
-
-typedef struct _IMAGEHLP_SYMBOL64
-{
-    DWORD                       SizeOfStruct;
-    DWORD64                     Address;
-    DWORD                       Size;
-    DWORD                       Flags;
-    DWORD                       MaxNameLength;
-    CHAR                        Name[1];
-} IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
-
-typedef struct _IMAGEHLP_SYMBOLW64
-{
-    DWORD                       SizeOfStruct;
-    DWORD64                     Address;
-    DWORD                       Size;
-    DWORD                       Flags;
-    DWORD                       MaxNameLength;
-    WCHAR                       Name[1];
-} IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64;
-
-typedef struct _IMAGEHLP_MODULE
-{
-    DWORD                       SizeOfStruct;
-    DWORD                       BaseOfImage;
-    DWORD                       ImageSize;
-    DWORD                       TimeDateStamp;
-    DWORD                       CheckSum;
-    DWORD                       NumSyms;
-    SYM_TYPE                    SymType;
-    CHAR                        ModuleName[32];
-    CHAR                        ImageName[256];
-    CHAR                        LoadedImageName[256];
-} IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
-
-typedef struct _IMAGEHLP_MODULEW
-{
-    DWORD                       SizeOfStruct;
-    DWORD                       BaseOfImage;
-    DWORD                       ImageSize;
-    DWORD                       TimeDateStamp;
-    DWORD                       CheckSum;
-    DWORD                       NumSyms;
-    SYM_TYPE                    SymType;
-    WCHAR                       ModuleName[32];
-    WCHAR                       ImageName[256];
-    WCHAR                       LoadedImageName[256];
-} IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
-
-typedef struct _IMAGEHLP_MODULE64
-{
-    DWORD                       SizeOfStruct;
-    DWORD64                     BaseOfImage;
-    DWORD                       ImageSize;
-    DWORD                       TimeDateStamp;
-    DWORD                       CheckSum;
-    DWORD                       NumSyms;
-    SYM_TYPE                    SymType;
-    CHAR                        ModuleName[32];
-    CHAR                        ImageName[256];
-    CHAR                        LoadedImageName[256];
-    CHAR                        LoadedPdbName[256];
-    DWORD                       CVSig;
-    CHAR                        CVData[MAX_PATH*3];
-    DWORD                       PdbSig;
-    GUID                        PdbSig70;
-    DWORD                       PdbAge;
-    BOOL                        PdbUnmatched;
-    BOOL                        DbgUnmatched;
-    BOOL                        LineNumbers;
-    BOOL                        GlobalSymbols;
-    BOOL                        TypeInfo;
-    BOOL                        SourceIndexed;
-    BOOL                        Publics;
-} IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
-
-typedef struct _IMAGEHLP_MODULEW64
-{
-    DWORD                       SizeOfStruct;
-    DWORD64                     BaseOfImage;
-    DWORD                       ImageSize;
-    DWORD                       TimeDateStamp;
-    DWORD                       CheckSum;
-    DWORD                       NumSyms;
-    SYM_TYPE                    SymType;
-    WCHAR                       ModuleName[32];
-    WCHAR                       ImageName[256];
-    WCHAR                       LoadedImageName[256];
-    WCHAR                       LoadedPdbName[256];
-    DWORD                       CVSig;
-    WCHAR                       CVData[MAX_PATH*3];
-    DWORD                       PdbSig;
-    GUID                        PdbSig70;
-    DWORD                       PdbAge;
-    BOOL                        PdbUnmatched;
-    BOOL                        DbgUnmatched;
-    BOOL                        LineNumbers;
-    BOOL                        GlobalSymbols;
-    BOOL                        TypeInfo;
-    BOOL                        SourceIndexed;
-    BOOL                        Publics;
-} IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
-
-typedef struct _IMAGEHLP_LINE
-{
-    DWORD                       SizeOfStruct;
-    PVOID                       Key;
-    DWORD                       LineNumber;
-    PCHAR                       FileName;
-    DWORD                       Address;
-} IMAGEHLP_LINE, *PIMAGEHLP_LINE;
-
-typedef struct _IMAGEHLP_LINEW
-{
-    DWORD                       SizeOfStruct;
-    PVOID                       Key;
-    DWORD                       LineNumber;
-    PWSTR                       FileName;
-    DWORD                       Address;
-} IMAGEHLP_LINEW, *PIMAGEHLP_LINEW;
-
-typedef struct _IMAGEHLP_LINE64
-{
-    DWORD                       SizeOfStruct;
-    PVOID                       Key;
-    DWORD                       LineNumber;
-    PCHAR                       FileName;
-    DWORD64                     Address;
-} IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
-
-typedef struct _IMAGEHLP_LINEW64
-{
-    DWORD                       SizeOfStruct;
-    PVOID                       Key;
-    DWORD                       LineNumber;
-    PWSTR                       FileName;
-    DWORD64                     Address;
-} IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
-
-typedef struct _SOURCEFILE
-{
-    DWORD64                     ModBase;
-    PCHAR                       FileName;
-} SOURCEFILE, *PSOURCEFILE;
-
-typedef struct _SOURCEFILEW
-{
-    DWORD64                     ModBase;
-    PWSTR                       FileName;
-} SOURCEFILEW, *PSOURCEFILEW;
+  } SYM_TYPE;
+
+  typedef struct _IMAGEHLP_SYMBOL {
+    DWORD SizeOfStruct;
+    DWORD Address;
+    DWORD Size;
+    DWORD Flags;
+    DWORD MaxNameLength;
+    CHAR Name[1];
+  } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
+
+  typedef struct _IMAGEHLP_SYMBOL64 {
+    DWORD SizeOfStruct;
+    DWORD64 Address;
+    DWORD Size;
+    DWORD Flags;
+    DWORD MaxNameLength;
+    CHAR Name[1];
+  } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
+
+  typedef struct _IMAGEHLP_SYMBOLW64 {
+    DWORD SizeOfStruct;
+    DWORD64 Address;
+    DWORD Size;
+    DWORD Flags;
+    DWORD MaxNameLength;
+    WCHAR Name[1];
+  } IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64;
+
+  typedef struct _IMAGEHLP_MODULE {
+    DWORD SizeOfStruct;
+    DWORD BaseOfImage;
+    DWORD ImageSize;
+    DWORD TimeDateStamp;
+    DWORD CheckSum;
+    DWORD NumSyms;
+    SYM_TYPE SymType;
+    CHAR ModuleName[32];
+    CHAR ImageName[256];
+    CHAR LoadedImageName[256];
+  } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
+
+  typedef struct _IMAGEHLP_MODULEW {
+    DWORD SizeOfStruct;
+    DWORD BaseOfImage;
+    DWORD ImageSize;
+    DWORD TimeDateStamp;
+    DWORD CheckSum;
+    DWORD NumSyms;
+    SYM_TYPE SymType;
+    WCHAR ModuleName[32];
+    WCHAR ImageName[256];
+    WCHAR LoadedImageName[256];
+  } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
+
+  typedef struct _IMAGEHLP_MODULE64 {
+    DWORD SizeOfStruct;
+    DWORD64 BaseOfImage;
+    DWORD ImageSize;
+    DWORD TimeDateStamp;
+    DWORD CheckSum;
+    DWORD NumSyms;
+    SYM_TYPE SymType;
+    CHAR ModuleName[32];
+    CHAR ImageName[256];
+    CHAR LoadedImageName[256];
+    CHAR LoadedPdbName[256];
+    DWORD CVSig;
+    CHAR CVData[MAX_PATH * 3];
+    DWORD PdbSig;
+    GUID PdbSig70;
+    DWORD PdbAge;
+    BOOL PdbUnmatched;
+    BOOL DbgUnmatched;
+    BOOL LineNumbers;
+    BOOL GlobalSymbols;
+    BOOL TypeInfo;
+    BOOL SourceIndexed;
+    BOOL Publics;
+  } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
+
+  typedef struct _IMAGEHLP_MODULEW64 {
+    DWORD SizeOfStruct;
+    DWORD64 BaseOfImage;
+    DWORD ImageSize;
+    DWORD TimeDateStamp;
+    DWORD CheckSum;
+    DWORD NumSyms;
+    SYM_TYPE SymType;
+    WCHAR ModuleName[32];
+    WCHAR ImageName[256];
+    WCHAR LoadedImageName[256];
+    WCHAR LoadedPdbName[256];
+    DWORD CVSig;
+    WCHAR CVData[MAX_PATH * 3];
+    DWORD PdbSig;
+    GUID PdbSig70;
+    DWORD PdbAge;
+    BOOL PdbUnmatched;
+    BOOL DbgUnmatched;
+    BOOL LineNumbers;
+    BOOL GlobalSymbols;
+    BOOL TypeInfo;
+    BOOL SourceIndexed;
+    BOOL Publics;
+  } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
+
+  typedef struct _IMAGEHLP_LINE {
+    DWORD SizeOfStruct;
+    PVOID Key;
+    DWORD LineNumber;
+    PCHAR FileName;
+    DWORD Address;
+  } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
+
+  typedef struct _IMAGEHLP_LINEW {
+    DWORD SizeOfStruct;
+    PVOID Key;
+    DWORD LineNumber;
+    PWSTR FileName;
+    DWORD Address;
+  } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW;
+
+  typedef struct _IMAGEHLP_LINE64 {
+    DWORD SizeOfStruct;
+    PVOID Key;
+    DWORD LineNumber;
+    PCHAR FileName;
+    DWORD64 Address;
+  } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
+
+  typedef struct _IMAGEHLP_LINEW64 {
+    DWORD SizeOfStruct;
+    PVOID Key;
+    DWORD LineNumber;
+    PWSTR FileName;
+    DWORD64 Address;
+  } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
+
+  typedef struct _SOURCEFILE {
+    DWORD64 ModBase;
+    PCHAR FileName;
+  } SOURCEFILE, *PSOURCEFILE;
+
+  typedef struct _SOURCEFILEW {
+    DWORD64 ModBase;
+    PWSTR FileName;
+  } SOURCEFILEW, *PSOURCEFILEW;
 
 #define CBA_DEFERRED_SYMBOL_LOAD_START          0x00000001
 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE       0x00000002
@@ -276,85 +258,77 @@ typedef struct _SOURCEFILEW
 #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL        0x00000020
 #define CBA_DEBUG_INFO                          0x10000000
 
-typedef struct _IMAGEHLP_CBA_READ_MEMORY
-{
-    DWORD64   addr;
-    PVOID     buf;
-    DWORD     bytes;
-    DWORD    *bytesread;
-} IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
+  typedef struct _IMAGEHLP_CBA_READ_MEMORY {
+    DWORD64 addr;
+    PVOID buf;
+    DWORD bytes;
+    DWORD *bytesread;
+  } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
 
-enum
-{
+  enum {
     sevInfo = 0,
     sevProblem,
     sevAttn,
     sevFatal,
     sevMax
-};
+  };
 
 #define EVENT_SRCSPEW_START 100
 #define EVENT_SRCSPEW       100
 #define EVENT_SRCSPEW_END   199
 
-typedef struct _IMAGEHLP_CBA_EVENT
-{
-    DWORD       severity;
-    DWORD       code;
-    PCHAR       desc;
-    PVOID       object;
-} IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
-
-typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
-{
-    DWORD                       SizeOfStruct;
-    DWORD                       BaseOfImage;
-    DWORD                       CheckSum;
-    DWORD                       TimeDateStamp;
-    CHAR                        FileName[MAX_PATH];
-    BOOLEAN                     Reparse;
-    HANDLE                      hFile;
-} IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
-
-typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
-{
-    DWORD                       SizeOfStruct;
-    DWORD64                     BaseOfImage;
-    DWORD                       CheckSum;
-    DWORD                       TimeDateStamp;
-    CHAR                        FileName[MAX_PATH];
-    BOOLEAN                     Reparse;
-    HANDLE                      hFile;
-    DWORD                       Flags;
-} IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
-
-typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
-{
-    DWORD                       SizeOfStruct;
-    DWORD64                     BaseOfImage;
-    DWORD                       CheckSum;
-    DWORD                       TimeDateStamp;
-    WCHAR                       FileName[MAX_PATH + 1];
-    BOOLEAN                     Reparse;
-    HANDLE                      hFile;
-    DWORD                       Flags;
-} IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
-
-typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
-{
-    DWORD                       SizeOfStruct;
-    DWORD                       NumberOfDups;
-    PIMAGEHLP_SYMBOL            Symbol;
-    DWORD                       SelectedSymbol;
-} IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
-
-typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
-{
-    DWORD                       SizeOfStruct;
-    DWORD                       NumberOfDups;
-    PIMAGEHLP_SYMBOL64          Symbol;
-    DWORD                       SelectedSymbol;
-} IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64;
+  typedef struct _IMAGEHLP_CBA_EVENT {
+    DWORD severity;
+    DWORD code;
+    PCHAR desc;
+    PVOID object;
+  } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
+
+  typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD {
+    DWORD SizeOfStruct;
+    DWORD BaseOfImage;
+    DWORD CheckSum;
+    DWORD TimeDateStamp;
+    CHAR FileName[MAX_PATH];
+    BOOLEAN Reparse;
+    HANDLE hFile;
+  } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
+
+  typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 {
+    DWORD SizeOfStruct;
+    DWORD64 BaseOfImage;
+    DWORD CheckSum;
+    DWORD TimeDateStamp;
+    CHAR FileName[MAX_PATH];
+    BOOLEAN Reparse;
+    HANDLE hFile;
+    DWORD Flags;
+  } IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
+
+  typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64 {
+    DWORD SizeOfStruct;
+    DWORD64 BaseOfImage;
+    DWORD CheckSum;
+    DWORD TimeDateStamp;
+    WCHAR FileName[MAX_PATH + 1];
+    BOOLEAN Reparse;
+    HANDLE hFile;
+    DWORD Flags;
+  } IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
+
+  typedef struct _IMAGEHLP_DUPLICATE_SYMBOL {
+    DWORD SizeOfStruct;
+    DWORD NumberOfDups;
+    PIMAGEHLP_SYMBOL Symbol;
+    DWORD SelectedSymbol;
+  } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
+
+  typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64 {
+    DWORD SizeOfStruct;
+    DWORD NumberOfDups;
+    PIMAGEHLP_SYMBOL64 Symbol;
+    DWORD SelectedSymbol;
+  } IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64;
 
 #define SYMOPT_CASE_INSENSITIVE         0x00000001
 #define SYMOPT_UNDNAME                  0x00000002
@@ -385,31 +359,29 @@ typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
 
 #define SYMOPT_DEBUG                    0x80000000
 
-typedef struct _IMAGEHLP_STACK_FRAME
-{
-    ULONG64     InstructionOffset;
-    ULONG64     ReturnOffset;
-    ULONG64     FrameOffset;
-    ULONG64     StackOffset;
-    ULONG64     BackingStoreOffset;
-    ULONG64     FuncTableEntry;
-    ULONG64     Params[4];
-    ULONG64     Reserved[5];
-    BOOL        Virtual;
-    ULONG       Reserved2;
-} IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
-
-typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
+  typedef struct _IMAGEHLP_STACK_FRAME {
+    ULONG64 InstructionOffset;
+    ULONG64 ReturnOffset;
+    ULONG64 FrameOffset;
+    ULONG64 StackOffset;
+    ULONG64 BackingStoreOffset;
+    ULONG64 FuncTableEntry;
+    ULONG64 Params[4];
+    ULONG64 Reserved[5];
+    BOOL Virtual;
+    ULONG Reserved2;
+  } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
+
+  typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
 
 #define DBHHEADER_DEBUGDIRS     0x1
-typedef struct _DBGHELP_MODLOAD_DATA
-{
-    DWORD               ssize;
-    DWORD               ssig;
-    PVOID               data;
-    DWORD               size;
-    DWORD               flags;
-} MODLOAD_DATA, *PMODLOAD_DATA;
+  typedef struct _DBGHELP_MODLOAD_DATA {
+    DWORD ssize;
+    DWORD ssig;
+    PVOID data;
+    DWORD size;
+    DWORD flags;
+  } MODLOAD_DATA, *PMODLOAD_DATA;
 
 /*************************
  *       MiniDUMP        *
@@ -418,363 +390,324 @@ typedef struct _DBGHELP_MODLOAD_DATA
 #include <pshpack4.h>
 /* DebugHelp */
 
-#define MINIDUMP_SIGNATURE 0x504D444D /* 'MDMP' */
+#define MINIDUMP_SIGNATURE 0x504D444D   /* 'MDMP' */
 #define MINIDUMP_VERSION   (42899)
 
-typedef DWORD   RVA;
-typedef ULONG64 RVA64;
-
-typedef enum _MINIDUMP_TYPE 
-{
-    MiniDumpNormal                              = 0x0000,
-    MiniDumpWithDataSegs                        = 0x0001,
-    MiniDumpWithFullMemory                      = 0x0002,
-    MiniDumpWithHandleData                      = 0x0004,
-    MiniDumpFilterMemory                        = 0x0008,
-    MiniDumpScanMemory                          = 0x0010,
-    MiniDumpWithUnloadedModules                 = 0x0020,
-    MiniDumpWithIndirectlyReferencedMemory      = 0x0040,
-    MiniDumpFilterModulePaths                   = 0x0080,
-    MiniDumpWithProcessThreadData               = 0x0100,
-    MiniDumpWithPrivateReadWriteMemory          = 0x0200,
-    MiniDumpWithoutOptionalData                 = 0x0400,
-    MiniDumpWithFullMemoryInfo                  = 0x0800,
-    MiniDumpWithThreadInfo                      = 0x1000,
-    MiniDumpWithCodeSegs                        = 0x2000
-} MINIDUMP_TYPE;
-
-typedef enum _MINIDUMP_CALLBACK_TYPE
-{
+  typedef DWORD RVA;
+  typedef ULONG64 RVA64;
+
+  typedef enum _MINIDUMP_TYPE {
+    MiniDumpNormal = 0x0000,
+    MiniDumpWithDataSegs = 0x0001,
+    MiniDumpWithFullMemory = 0x0002,
+    MiniDumpWithHandleData = 0x0004,
+    MiniDumpFilterMemory = 0x0008,
+    MiniDumpScanMemory = 0x0010,
+    MiniDumpWithUnloadedModules = 0x0020,
+    MiniDumpWithIndirectlyReferencedMemory = 0x0040,
+    MiniDumpFilterModulePaths = 0x0080,
+    MiniDumpWithProcessThreadData = 0x0100,
+    MiniDumpWithPrivateReadWriteMemory = 0x0200,
+    MiniDumpWithoutOptionalData = 0x0400,
+    MiniDumpWithFullMemoryInfo = 0x0800,
+    MiniDumpWithThreadInfo = 0x1000,
+    MiniDumpWithCodeSegs = 0x2000
+  } MINIDUMP_TYPE;
+
+  typedef enum _MINIDUMP_CALLBACK_TYPE {
     ModuleCallback,
     ThreadCallback,
     ThreadExCallback,
     IncludeThreadCallback,
     IncludeModuleCallback,
     MemoryCallback,
-} MINIDUMP_CALLBACK_TYPE;
-
-typedef struct _MINIDUMP_THREAD_CALLBACK
-{
-    ULONG                       ThreadId;
-    HANDLE                      ThreadHandle;
-    CONTEXT                     Context;
-    ULONG                       SizeOfContext;
-    ULONG64                     StackBase;
-    ULONG64                     StackEnd;
-} MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
-
-typedef struct _MINIDUMP_THREAD_EX_CALLBACK 
-{
-    ULONG                       ThreadId;
-    HANDLE                      ThreadHandle;
-    CONTEXT                     Context;
-    ULONG                       SizeOfContext;
-    ULONG64                     StackBase;
-    ULONG64                     StackEnd;
-    ULONG64                     BackingStoreBase;
-    ULONG64                     BackingStoreEnd;
-} MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
-
-typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
-{
+  } MINIDUMP_CALLBACK_TYPE;
+
+  typedef struct _MINIDUMP_THREAD_CALLBACK {
+    ULONG ThreadId;
+    HANDLE ThreadHandle;
+    CONTEXT Context;
+    ULONG SizeOfContext;
+    ULONG64 StackBase;
+    ULONG64 StackEnd;
+  } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
+
+  typedef struct _MINIDUMP_THREAD_EX_CALLBACK {
+    ULONG ThreadId;
+    HANDLE ThreadHandle;
+    CONTEXT Context;
+    ULONG SizeOfContext;
+    ULONG64 StackBase;
+    ULONG64 StackEnd;
+    ULONG64 BackingStoreBase;
+    ULONG64 BackingStoreEnd;
+  } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
+
+  typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK {
     ULONG ThreadId;
-} MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
-
-typedef enum _THREAD_WRITE_FLAGS 
-{
-    ThreadWriteThread            = 0x0001,
-    ThreadWriteStack             = 0x0002,
-    ThreadWriteContext           = 0x0004,
-    ThreadWriteBackingStore      = 0x0008,
+  } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
+
+  typedef enum _THREAD_WRITE_FLAGS {
+    ThreadWriteThread = 0x0001,
+    ThreadWriteStack = 0x0002,
+    ThreadWriteContext = 0x0004,
+    ThreadWriteBackingStore = 0x0008,
     ThreadWriteInstructionWindow = 0x0010,
-    ThreadWriteThreadData        = 0x0020,
-    ThreadWriteThreadInfo        = 0x0040
-} THREAD_WRITE_FLAGS;
-
-typedef struct _MINIDUMP_MODULE_CALLBACK 
-{
-    PWCHAR                      FullPath;
-    ULONG64                     BaseOfImage;
-    ULONG                       SizeOfImage;
-    ULONG                       CheckSum;
-    ULONG                       TimeDateStamp;
-    VS_FIXEDFILEINFO            VersionInfo;
-    PVOID                       CvRecord;
-    ULONG                       SizeOfCvRecord;
-    PVOID                       MiscRecord;
-    ULONG                       SizeOfMiscRecord;
-} MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
-
-typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK 
-{
+    ThreadWriteThreadData = 0x0020,
+    ThreadWriteThreadInfo = 0x0040
+  } THREAD_WRITE_FLAGS;
+
+  typedef struct _MINIDUMP_MODULE_CALLBACK {
+    PWCHAR FullPath;
     ULONG64 BaseOfImage;
-} MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
-
-typedef enum _MODULE_WRITE_FLAGS 
-{
-    ModuleWriteModule        = 0x0001,
-    ModuleWriteDataSeg       = 0x0002,
-    ModuleWriteMiscRecord    = 0x0004,
-    ModuleWriteCvRecord      = 0x0008,
+    ULONG SizeOfImage;
+    ULONG CheckSum;
+    ULONG TimeDateStamp;
+    VS_FIXEDFILEINFO VersionInfo;
+    PVOID CvRecord;
+    ULONG SizeOfCvRecord;
+    PVOID MiscRecord;
+    ULONG SizeOfMiscRecord;
+  } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
+
+  typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK {
+    ULONG64 BaseOfImage;
+  } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
+
+  typedef enum _MODULE_WRITE_FLAGS {
+    ModuleWriteModule = 0x0001,
+    ModuleWriteDataSeg = 0x0002,
+    ModuleWriteMiscRecord = 0x0004,
+    ModuleWriteCvRecord = 0x0008,
     ModuleReferencedByMemory = 0x0010,
-    ModuleWriteTlsData       = 0x0020,
-    ModuleWriteCodeSegs      = 0x0040,
-} MODULE_WRITE_FLAGS;
-
-typedef struct _MINIDUMP_CALLBACK_INPUT 
-{
-    ULONG                       ProcessId;
-    HANDLE                      ProcessHandle;
-    ULONG                       CallbackType;
-    union 
-    {
-        MINIDUMP_THREAD_CALLBACK        Thread;
-        MINIDUMP_THREAD_EX_CALLBACK     ThreadEx;
-        MINIDUMP_MODULE_CALLBACK        Module;
-        MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
-        MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
+    ModuleWriteTlsData = 0x0020,
+    ModuleWriteCodeSegs = 0x0040,
+  } MODULE_WRITE_FLAGS;
+
+  typedef struct _MINIDUMP_CALLBACK_INPUT {
+    ULONG ProcessId;
+    HANDLE ProcessHandle;
+    ULONG CallbackType;
+    union {
+      MINIDUMP_THREAD_CALLBACK Thread;
+      MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
+      MINIDUMP_MODULE_CALLBACK Module;
+      MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
+      MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
     } DUMMYUNIONNAME;
-} MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
-
-typedef struct _MINIDUMP_CALLBACK_OUTPUT
-{
-    union 
-    {
-        ULONG                           ModuleWriteFlags;
-        ULONG                           ThreadWriteFlags;
-        struct
-        {
-            ULONG64                     MemoryBase;
-            ULONG                       MemorySize;
-        } DUMMYSTRUCTNAME;
+  } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
+
+  typedef struct _MINIDUMP_CALLBACK_OUTPUT {
+    union {
+      ULONG ModuleWriteFlags;
+      ULONG ThreadWriteFlags;
+      struct {
+        ULONG64 MemoryBase;
+        ULONG MemorySize;
+      } DUMMYSTRUCTNAME;
     } DUMMYUNIONNAME;
-} MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
-
-typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID, const PMINIDUMP_CALLBACK_INPUT, PMINIDUMP_CALLBACK_OUTPUT);
-
-typedef struct _MINIDUMP_CALLBACK_INFORMATION 
-{
-    MINIDUMP_CALLBACK_ROUTINE   CallbackRoutine;
-    void*                       CallbackParam;
-} MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
-
-typedef struct _MINIDUMP_LOCATION_DESCRIPTOR 
-{
-    ULONG                       DataSize;
-    RVA                         Rva;
-} MINIDUMP_LOCATION_DESCRIPTOR;
-
-typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 
-{
-    ULONG64                     DataSize;
-    RVA64                       Rva;
-} MINIDUMP_LOCATION_DESCRIPTOR64;
-
-typedef struct _MINIDUMP_DIRECTORY 
-{
-    ULONG                       StreamType;
+  } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
+
+  typedef BOOL(WINAPI * MINIDUMP_CALLBACK_ROUTINE) (PVOID,
+                                                    const
+                                                    PMINIDUMP_CALLBACK_INPUT,
+                                                    PMINIDUMP_CALLBACK_OUTPUT);
+
+  typedef struct _MINIDUMP_CALLBACK_INFORMATION {
+    MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
+    void *CallbackParam;
+  } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
+
+  typedef struct _MINIDUMP_LOCATION_DESCRIPTOR {
+    ULONG DataSize;
+    RVA Rva;
+  } MINIDUMP_LOCATION_DESCRIPTOR;
+
+  typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 {
+    ULONG64 DataSize;
+    RVA64 Rva;
+  } MINIDUMP_LOCATION_DESCRIPTOR64;
+
+  typedef struct _MINIDUMP_DIRECTORY {
+    ULONG StreamType;
     MINIDUMP_LOCATION_DESCRIPTOR Location;
-} MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
-
-typedef struct _MINIDUMP_EXCEPTION
-{
-    ULONG                       ExceptionCode;
-    ULONG                       ExceptionFlags;
-    ULONG64                     ExceptionRecord;
-    ULONG64                     ExceptionAddress;
-    ULONG                       NumberParameters;
-    ULONG                        __unusedAlignment;
-    ULONG64                     ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
-} MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
-
-typedef struct _MINIDUMP_EXCEPTION_INFORMATION
-{
-    DWORD                       ThreadId;
-    PEXCEPTION_POINTERS         ExceptionPointers;
-    BOOL                        ClientPointers;
-} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
-
-typedef struct MINIDUMP_EXCEPTION_STREAM 
-{
-    ULONG                       ThreadId;
-    ULONG                       __alignment;
-    MINIDUMP_EXCEPTION          ExceptionRecord;
+  } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
+
+  typedef struct _MINIDUMP_EXCEPTION {
+    ULONG ExceptionCode;
+    ULONG ExceptionFlags;
+    ULONG64 ExceptionRecord;
+    ULONG64 ExceptionAddress;
+    ULONG NumberParameters;
+    ULONG __unusedAlignment;
+    ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+  } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
+
+  typedef struct _MINIDUMP_EXCEPTION_INFORMATION {
+    DWORD ThreadId;
+    PEXCEPTION_POINTERS ExceptionPointers;
+    BOOL ClientPointers;
+  } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
+
+  typedef struct MINIDUMP_EXCEPTION_STREAM {
+    ULONG ThreadId;
+    ULONG __alignment;
+    MINIDUMP_EXCEPTION ExceptionRecord;
     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
-} MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
-
-typedef struct _MINIDUMP_HEADER 
-{
-    DWORD                       Signature;
-    DWORD                       Version;
-    DWORD                       NumberOfStreams;
-    RVA                         StreamDirectoryRva;
-    DWORD                       CheckSum;
-    union 
-    {
-        DWORD                           Reserved;
-        DWORD                           TimeDateStamp;
+  } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
+
+  typedef struct _MINIDUMP_HEADER {
+    DWORD Signature;
+    DWORD Version;
+    DWORD NumberOfStreams;
+    RVA StreamDirectoryRva;
+    DWORD CheckSum;
+    union {
+      DWORD Reserved;
+      DWORD TimeDateStamp;
     } DUMMYUNIONNAME;
-    ULONG64                     Flags;
-} MINIDUMP_HEADER, *PMINIDUMP_HEADER;
+    ULONG64 Flags;
+  } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
 
-typedef struct _MINIDUMP_MEMORY_DESCRIPTOR 
-{
-    ULONG64                     StartOfMemoryRange;
+  typedef struct _MINIDUMP_MEMORY_DESCRIPTOR {
+    ULONG64 StartOfMemoryRange;
     MINIDUMP_LOCATION_DESCRIPTOR Memory;
-} MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
+  } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
 
-typedef struct _MINIDUMP_MEMORY_LIST
-{
-    ULONG                       NumberOfMemoryRanges;
-    MINIDUMP_MEMORY_DESCRIPTOR  MemoryRanges[1]; /* FIXME: 0-sized array not supported */
-} MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
+  typedef struct _MINIDUMP_MEMORY_LIST {
+    ULONG NumberOfMemoryRanges;
+    MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges[1]; /* FIXME: 0-sized array not supported */
+  } MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
 
 #define MINIDUMP_MISC1_PROCESS_ID       0x00000001
 #define MINIDUMP_MISC1_PROCESS_TIMES    0x00000002
 
-typedef struct _MINIDUMP_MISC_INFO
-{
-    ULONG                       SizeOfInfo;
-    ULONG                       Flags1;
-    ULONG                       ProcessId;
-    ULONG                       ProcessCreateTime;
-    ULONG                       ProcessUserTime;
-    ULONG                       ProcessKernelTime;
-} MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
-
-typedef struct _MINIDUMP_MODULE
-{
-    ULONG64                     BaseOfImage;
-    ULONG                       SizeOfImage;
-    ULONG                       CheckSum;
-    ULONG                       TimeDateStamp;
-    RVA                         ModuleNameRva;
-    VS_FIXEDFILEINFO            VersionInfo;
+  typedef struct _MINIDUMP_MISC_INFO {
+    ULONG SizeOfInfo;
+    ULONG Flags1;
+    ULONG ProcessId;
+    ULONG ProcessCreateTime;
+    ULONG ProcessUserTime;
+    ULONG ProcessKernelTime;
+  } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
+
+  typedef struct _MINIDUMP_MODULE {
+    ULONG64 BaseOfImage;
+    ULONG SizeOfImage;
+    ULONG CheckSum;
+    ULONG TimeDateStamp;
+    RVA ModuleNameRva;
+    VS_FIXEDFILEINFO VersionInfo;
     MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
     MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
-    ULONG64                     Reserved0;
-    ULONG64                     Reserved1;
-} MINIDUMP_MODULE, *PMINIDUMP_MODULE;
-
-typedef struct _MINIDUMP_MODULE_LIST 
-{
-    ULONG                       NumberOfModules;
-    MINIDUMP_MODULE             Modules[1]; /* FIXME: 0-sized array not supported */
-} MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
-
-typedef struct _MINIDUMP_STRING
-{
-    ULONG                       Length;
-    WCHAR                       Buffer[1]; /* FIXME: O-sized array not supported */
-} MINIDUMP_STRING, *PMINIDUMP_STRING;
-
-typedef struct _MINIDUMP_SYSTEM_INFO
-{
-    USHORT                      ProcessorArchitecture;
-    USHORT                      ProcessorLevel;
-    USHORT                      ProcessorRevision;
-    union
-    {
-        USHORT                          Reserved0;
-        struct
-        {
-            UCHAR                       NumberOfProcessors;
-            UCHAR                       ProductType;
-        } DUMMYSTRUCTNAME;
+    ULONG64 Reserved0;
+    ULONG64 Reserved1;
+  } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
+
+  typedef struct _MINIDUMP_MODULE_LIST {
+    ULONG NumberOfModules;
+    MINIDUMP_MODULE Modules[1]; /* FIXME: 0-sized array not supported */
+  } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
+
+  typedef struct _MINIDUMP_STRING {
+    ULONG Length;
+    WCHAR Buffer[1];            /* FIXME: O-sized array not supported */
+  } MINIDUMP_STRING, *PMINIDUMP_STRING;
+
+  typedef struct _MINIDUMP_SYSTEM_INFO {
+    USHORT ProcessorArchitecture;
+    USHORT ProcessorLevel;
+    USHORT ProcessorRevision;
+    union {
+      USHORT Reserved0;
+      struct {
+        UCHAR NumberOfProcessors;
+        UCHAR ProductType;
+      } DUMMYSTRUCTNAME;
     } DUMMYUNIONNAME;
 
-    ULONG                       MajorVersion;
-    ULONG                       MinorVersion;
-    ULONG                       BuildNumber;
-    ULONG                       PlatformId;
-
-    RVA                         CSDVersionRva;
-    union
-    {
-        ULONG                           Reserved1;
-        struct
-        {
-            USHORT                      SuiteMask;
-            USHORT                      Reserved2;
-        } DUMMYSTRUCTNAME;
+    ULONG MajorVersion;
+    ULONG MinorVersion;
+    ULONG BuildNumber;
+    ULONG PlatformId;
+
+    RVA CSDVersionRva;
+    union {
+      ULONG Reserved1;
+      struct {
+        USHORT SuiteMask;
+        USHORT Reserved2;
+      } DUMMYSTRUCTNAME;
     } DUMMYUNIONNAME1;
-    union _CPU_INFORMATION 
-    {
-        struct 
-        {
-            ULONG                       VendorId[3];
-            ULONG                       VersionInformation;
-            ULONG                       FeatureInformation;
-            ULONG                       AMDExtendedCpuFeatures;
-        } X86CpuInfo;
-        struct 
-        {
-            ULONG64                     ProcessorFeatures[2];
-        } OtherCpuInfo;
+    union _CPU_INFORMATION {
+      struct {
+        ULONG VendorId[3];
+        ULONG VersionInformation;
+        ULONG FeatureInformation;
+        ULONG AMDExtendedCpuFeatures;
+      } X86CpuInfo;
+      struct {
+        ULONG64 ProcessorFeatures[2];
+      } OtherCpuInfo;
     } Cpu;
 
-} MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
+  } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
 
-typedef struct _MINIDUMP_THREAD
-{
-    ULONG                       ThreadId;
-    ULONG                       SuspendCount;
-    ULONG                       PriorityClass;
-    ULONG                       Priority;
-    ULONG64                     Teb;
-    MINIDUMP_MEMORY_DESCRIPTOR  Stack;
+  typedef struct _MINIDUMP_THREAD {
+    ULONG ThreadId;
+    ULONG SuspendCount;
+    ULONG PriorityClass;
+    ULONG Priority;
+    ULONG64 Teb;
+    MINIDUMP_MEMORY_DESCRIPTOR Stack;
     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
-} MINIDUMP_THREAD, *PMINIDUMP_THREAD;
-
-typedef struct _MINIDUMP_THREAD_LIST
-{
-    ULONG                       NumberOfThreads;
-    MINIDUMP_THREAD             Threads[1]; /* FIXME: no support of 0 sized array */
-} MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
-
-typedef struct _MINIDUMP_USER_STREAM
-{
-    ULONG                       Type;
-    ULONG                       BufferSize;
-    void*                       Buffer;
-} MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
-
-typedef struct _MINIDUMP_USER_STREAM_INFORMATION
-{
-    ULONG                       UserStreamCount;
-    PMINIDUMP_USER_STREAM       UserStreamArray;
-} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
-
-typedef enum _MINIDUMP_STREAM_TYPE
-{
-    UnusedStream                = 0,
-    ReservedStream0             = 1,
-    ReservedStream1             = 2,
-    ThreadListStream            = 3,
-    ModuleListStream            = 4,
-    MemoryListStream            = 5,
-    ExceptionStream             = 6,
-    SystemInfoStream            = 7,
-    ThreadExListStream          = 8,
-    Memory64ListStream          = 9,
-    CommentStreamA              = 10,
-    CommentStreamW              = 11,
-    HandleDataStream            = 12,
-    FunctionTableStream         = 13,
-    UnloadedModuleListStream    = 14,
-    MiscInfoStream              = 15,
-    MemoryInfoListStream        = 16,
-    ThreadInfoListStream        = 17,
-
-    LastReservedStream          = 0xffff
-} MINIDUMP_STREAM_TYPE;
-
-BOOL WINAPI MiniDumpWriteDump(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
-                              const PMINIDUMP_EXCEPTION_INFORMATION,
-                              const PMINIDUMP_USER_STREAM_INFORMATION,
-                              const PMINIDUMP_CALLBACK_INFORMATION);
-BOOL WINAPI MiniDumpReadDumpStream(PVOID, ULONG, PMINIDUMP_DIRECTORY*, PVOID*,
-                                   ULONG*);
+  } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
+
+  typedef struct _MINIDUMP_THREAD_LIST {
+    ULONG NumberOfThreads;
+    MINIDUMP_THREAD Threads[1]; /* FIXME: no support of 0 sized array */
+  } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
+
+  typedef struct _MINIDUMP_USER_STREAM {
+    ULONG Type;
+    ULONG BufferSize;
+    void *Buffer;
+  } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
+
+  typedef struct _MINIDUMP_USER_STREAM_INFORMATION {
+    ULONG UserStreamCount;
+    PMINIDUMP_USER_STREAM UserStreamArray;
+  } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
+
+  typedef enum _MINIDUMP_STREAM_TYPE {
+    UnusedStream = 0,
+    ReservedStream0 = 1,
+    ReservedStream1 = 2,
+    ThreadListStream = 3,
+    ModuleListStream = 4,
+    MemoryListStream = 5,
+    ExceptionStream = 6,
+    SystemInfoStream = 7,
+    ThreadExListStream = 8,
+    Memory64ListStream = 9,
+    CommentStreamA = 10,
+    CommentStreamW = 11,
+    HandleDataStream = 12,
+    FunctionTableStream = 13,
+    UnloadedModuleListStream = 14,
+    MiscInfoStream = 15,
+    MemoryInfoListStream = 16,
+    ThreadInfoListStream = 17,
+
+    LastReservedStream = 0xffff
+  } MINIDUMP_STREAM_TYPE;
+
+  BOOL WINAPI MiniDumpWriteDump(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
+                                const PMINIDUMP_EXCEPTION_INFORMATION,
+                                const PMINIDUMP_USER_STREAM_INFORMATION,
+                                const PMINIDUMP_CALLBACK_INFORMATION);
+  BOOL WINAPI MiniDumpReadDumpStream(PVOID, ULONG, PMINIDUMP_DIRECTORY *,
+                                     PVOID *, ULONG *);
 
 #include <poppack.h>
 
@@ -786,32 +719,44 @@ BOOL WINAPI MiniDumpReadDumpStream(PVOID, ULONG, PMINIDUMP_DIRECTORY*, PVOID*,
 #define SLMFLAG_VIRTUAL         0x1
 #define SLMFLAG_NO_SYMBOLS      0x4
 
-typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR, ULONG, ULONG, PVOID);
-BOOL   WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
-typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
-BOOL   WINAPI EnumerateLoadedModules64(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
-typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PCWSTR, DWORD64, ULONG, PVOID);
-BOOL   WINAPI EnumerateLoadedModulesW64(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PCSTR, ULONG, PVOID);
-BOOL    WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PCSTR, DWORD64, PVOID);
-BOOL    WINAPI SymEnumerateModules64(HANDLE, PSYM_ENUMMODULES_CALLBACK64, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(PCWSTR, DWORD64, PVOID);
-BOOL    WINAPI SymEnumerateModulesW64(HANDLE, PSYM_ENUMMODULES_CALLBACKW64, PVOID);
-BOOL    WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
-BOOL    WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
-BOOL    WINAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
-BOOL    WINAPI SymGetModuleInfoW64(HANDLE, DWORD64, PIMAGEHLP_MODULEW64);
-DWORD   WINAPI SymGetModuleBase(HANDLE, DWORD);
-DWORD64 WINAPI SymGetModuleBase64(HANDLE, DWORD64);
-DWORD   WINAPI SymLoadModule(HANDLE, HANDLE, PCSTR, PCSTR, DWORD, DWORD);
-DWORD64 WINAPI SymLoadModule64(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD);
-DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD,
-                               PMODLOAD_DATA, DWORD);
-DWORD64 WINAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64, DWORD,
-                                PMODLOAD_DATA, DWORD);
-BOOL    WINAPI SymUnloadModule(HANDLE, DWORD);
-BOOL    WINAPI SymUnloadModule64(HANDLE, DWORD64);
+  typedef BOOL(CALLBACK * PENUMLOADED_MODULES_CALLBACK) (PSTR, ULONG, ULONG,
+                                                         PVOID);
+  BOOL WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK,
+                                     PVOID);
+  typedef BOOL(CALLBACK * PENUMLOADED_MODULES_CALLBACK64) (PCSTR, DWORD64,
+                                                           ULONG, PVOID);
+  BOOL WINAPI EnumerateLoadedModules64(HANDLE, PENUMLOADED_MODULES_CALLBACK64,
+                                       PVOID);
+  typedef BOOL(CALLBACK * PENUMLOADED_MODULES_CALLBACKW64) (PCWSTR, DWORD64,
+                                                            ULONG, PVOID);
+  BOOL WINAPI EnumerateLoadedModulesW64(HANDLE,
+                                        PENUMLOADED_MODULES_CALLBACKW64,
+                                        PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMMODULES_CALLBACK) (PCSTR, ULONG, PVOID);
+  BOOL WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMMODULES_CALLBACK64) (PCSTR, DWORD64,
+                                                        PVOID);
+  BOOL WINAPI SymEnumerateModules64(HANDLE, PSYM_ENUMMODULES_CALLBACK64,
+                                    PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMMODULES_CALLBACKW64) (PCWSTR, DWORD64,
+                                                         PVOID);
+  BOOL WINAPI SymEnumerateModulesW64(HANDLE, PSYM_ENUMMODULES_CALLBACKW64,
+                                     PVOID);
+  BOOL WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
+  BOOL WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
+  BOOL WINAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
+  BOOL WINAPI SymGetModuleInfoW64(HANDLE, DWORD64, PIMAGEHLP_MODULEW64);
+  DWORD WINAPI SymGetModuleBase(HANDLE, DWORD);
+  DWORD64 WINAPI SymGetModuleBase64(HANDLE, DWORD64);
+  DWORD WINAPI SymLoadModule(HANDLE, HANDLE, PCSTR, PCSTR, DWORD, DWORD);
+  DWORD64 WINAPI SymLoadModule64(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64,
+                                 DWORD);
+  DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD,
+                                 PMODLOAD_DATA, DWORD);
+  DWORD64 WINAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64,
+                                  DWORD, PMODLOAD_DATA, DWORD);
+  BOOL WINAPI SymUnloadModule(HANDLE, DWORD);
+  BOOL WINAPI SymUnloadModule64(HANDLE, DWORD64);
 
 /*************************
  *    Symbol Handling    *
@@ -819,10 +764,10 @@ BOOL    WINAPI SymUnloadModule64(HANDLE, DWORD64);
 
 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT          1
 #define IMAGEHLP_SYMBOL_INFO_REGISTER              SYMF_REGISTER        /*  0x08 */
-#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE           SYMF_REGREL          /*  0x10 */
+#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE           SYMF_REGREL  /*  0x10 */
 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE         SYMF_FRAMEREL        /*  0x20 */
 #define IMAGEHLP_SYMBOL_INFO_PARAMETER             SYMF_PARAMETER       /*  0x40 */
-#define IMAGEHLP_SYMBOL_INFO_LOCAL                 SYMF_LOCAL           /*  0x80 */
+#define IMAGEHLP_SYMBOL_INFO_LOCAL                 SYMF_LOCAL   /*  0x80 */
 #define IMAGEHLP_SYMBOL_INFO_CONSTANT              SYMF_CONSTANT        /* 0x100 */
 #define IMAGEHLP_SYMBOL_FUNCTION                   SYMF_FUNCTION        /* 0x800 */
 
@@ -843,46 +788,43 @@ BOOL    WINAPI SymUnloadModule64(HANDLE, DWORD64);
 
 #define MAX_SYM_NAME    2000
 
-typedef struct _SYMBOL_INFO
-{
-    ULONG       SizeOfStruct;
-    ULONG       TypeIndex;
-    ULONG64     Reserved[2];
-    ULONG       info;   /* sdk states info, while MSDN says it's Index... */
-    ULONG       Size;
-    ULONG64     ModBase;
-    ULONG       Flags;
-    ULONG64     Value;
-    ULONG64     Address;
-    ULONG       Register;
-    ULONG       Scope;
-    ULONG       Tag;
-    ULONG       NameLen;
-    ULONG       MaxNameLen;
-    CHAR        Name[1];
-} SYMBOL_INFO, *PSYMBOL_INFO;
-
-typedef struct _SYMBOL_INFOW
-{
-    ULONG       SizeOfStruct;
-    ULONG       TypeIndex;
-    ULONG64     Reserved[2];
-    ULONG       Index;
-    ULONG       Size;
-    ULONG64     ModBase;
-    ULONG       Flags;
-    ULONG64     Value;
-    ULONG64     Address;
-    ULONG       Register;
-    ULONG       Scope;
-    ULONG       Tag;
-    ULONG       NameLen;
-    ULONG       MaxNameLen;
-    WCHAR       Name[1];
-} SYMBOL_INFOW, *PSYMBOL_INFOW;
-
-typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO 
-{
+  typedef struct _SYMBOL_INFO {
+    ULONG SizeOfStruct;
+    ULONG TypeIndex;
+    ULONG64 Reserved[2];
+    ULONG info;                 /* sdk states info, while MSDN says it's Index... */
+    ULONG Size;
+    ULONG64 ModBase;
+    ULONG Flags;
+    ULONG64 Value;
+    ULONG64 Address;
+    ULONG Register;
+    ULONG Scope;
+    ULONG Tag;
+    ULONG NameLen;
+    ULONG MaxNameLen;
+    CHAR Name[1];
+  } SYMBOL_INFO, *PSYMBOL_INFO;
+
+  typedef struct _SYMBOL_INFOW {
+    ULONG SizeOfStruct;
+    ULONG TypeIndex;
+    ULONG64 Reserved[2];
+    ULONG Index;
+    ULONG Size;
+    ULONG64 ModBase;
+    ULONG Flags;
+    ULONG64 Value;
+    ULONG64 Address;
+    ULONG Register;
+    ULONG Scope;
+    ULONG Tag;
+    ULONG NameLen;
+    ULONG MaxNameLen;
+    WCHAR Name[1];
+  } SYMBOL_INFOW, *PSYMBOL_INFOW;
+
+  typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO {
     TI_GET_SYMTAG,
     TI_GET_SYMNAME,
     TI_GET_LENGTH,
@@ -910,38 +852,36 @@ typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
     TI_GET_UDTKIND,
     TI_IS_EQUIV_TO,
     TI_GET_CALLING_CONVENTION,
-} IMAGEHLP_SYMBOL_TYPE_INFO;
+  } IMAGEHLP_SYMBOL_TYPE_INFO;
 
 #define IMAGEHLP_GET_TYPE_INFO_UNCACHED            0x00000001
 #define IMAGEHLP_GET_TYPE_INFO_CHILDREN            0x00000002
-typedef struct _IMAGEHLP_GET_TYPE_INFO_PARAMS
-{
-    ULONG       SizeOfStruct;
-    ULONG       Flags;
-    ULONG       NumIds;
-    PULONG      TypeIds;
-    ULONG64     TagFilter;
-    ULONG       NumReqs;
-    IMAGEHLP_SYMBOL_TYPE_INFO* ReqKinds;
-    PULONG_PTR  ReqOffsets;
-    PULONG      ReqSizes;
-    ULONG_PTR   ReqStride;
-    ULONG_PTR   BufferSize;
-    PVOID       Buffer;
-    ULONG       EntriesMatched;
-    ULONG       EntriesFilled;
-    ULONG64     TagsFound;
-    ULONG64     AllReqsValid;
-    ULONG       NumReqsValid;
-    PULONG64    ReqsValid;
-} IMAGEHLP_GET_TYPE_INFO_PARAMS, *PIMAGEHLP_GET_TYPE_INFO_PARAMS;
-
-typedef struct _TI_FINDCHILDREN_PARAMS 
-{
+  typedef struct _IMAGEHLP_GET_TYPE_INFO_PARAMS {
+    ULONG SizeOfStruct;
+    ULONG Flags;
+    ULONG NumIds;
+    PULONG TypeIds;
+    ULONG64 TagFilter;
+    ULONG NumReqs;
+    IMAGEHLP_SYMBOL_TYPE_INFO *ReqKinds;
+    PULONG_PTR ReqOffsets;
+    PULONG ReqSizes;
+    ULONG_PTR ReqStride;
+    ULONG_PTR BufferSize;
+    PVOID Buffer;
+    ULONG EntriesMatched;
+    ULONG EntriesFilled;
+    ULONG64 TagsFound;
+    ULONG64 AllReqsValid;
+    ULONG NumReqsValid;
+    PULONG64 ReqsValid;
+  } IMAGEHLP_GET_TYPE_INFO_PARAMS, *PIMAGEHLP_GET_TYPE_INFO_PARAMS;
+
+  typedef struct _TI_FINDCHILDREN_PARAMS {
     ULONG Count;
     ULONG Start;
     ULONG ChildId[1];
-} TI_FINDCHILDREN_PARAMS;
+  } TI_FINDCHILDREN_PARAMS;
 
 #define UNDNAME_COMPLETE                 (0x0000)
 #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001)
@@ -965,183 +905,231 @@ typedef struct _TI_FINDCHILDREN_PARAMS
 #define SYMSEARCH_RECURSE               0x02
 #define SYMSEARCH_GLOBALSONLY           0x04
 
-BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
-BOOL WINAPI SymGetTypeInfoEx(HANDLE, DWORD64, PIMAGEHLP_GET_TYPE_INFO_PARAMS);
-typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW, ULONG, PVOID);
-BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
-BOOL WINAPI SymEnumTypesW(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
-BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
-BOOL WINAPI SymFromAddrW(HANDLE, DWORD64, DWORD64*, SYMBOL_INFOW*);
-BOOL WINAPI SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
-BOOL WINAPI SymFromTokenW(HANDLE, DWORD64, DWORD, PSYMBOL_INFOW);
-BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
-BOOL WINAPI SymFromNameW(HANDLE, PCWSTR, PSYMBOL_INFOW);
-BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
-BOOL WINAPI SymGetSymFromAddr64(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
-BOOL WINAPI SymGetSymFromName(HANDLE, PCSTR, PIMAGEHLP_SYMBOL);
-BOOL WINAPI SymGetSymFromName64(HANDLE, PCSTR, PIMAGEHLP_SYMBOL64);
-BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, PCSTR, PSYMBOL_INFO);
-BOOL WINAPI SymGetTypeFromNameW(HANDLE, ULONG64, PCWSTR, PSYMBOL_INFOW);
-BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
-BOOL WINAPI SymGetSymNext64(HANDLE, PIMAGEHLP_SYMBOL64);
-BOOL WINAPI SymGetSymNextW64(HANDLE, PIMAGEHLP_SYMBOLW64);
-BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
-BOOL WINAPI SymGetSymPrev64(HANDLE, PIMAGEHLP_SYMBOL64);
-BOOL WINAPI SymGetSymPrevW64(HANDLE, PIMAGEHLP_SYMBOLW64);
-BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK,
+  BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG,
+                             IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
+  BOOL WINAPI SymGetTypeInfoEx(HANDLE, DWORD64,
+                               PIMAGEHLP_GET_TYPE_INFO_PARAMS);
+  typedef BOOL(CALLBACK * PSYM_ENUMERATESYMBOLS_CALLBACK) (PSYMBOL_INFO,
+                                                           ULONG, PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMERATESYMBOLS_CALLBACKW) (PSYMBOL_INFOW,
+                                                            ULONG, PVOID);
+  BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK,
                            PVOID);
-BOOL WINAPI SymEnumSymbolsW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMERATESYMBOLS_CALLBACKW,
+  BOOL WINAPI SymEnumTypesW(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACKW,
                             PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PCSTR, DWORD, ULONG, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PCWSTR, DWORD, ULONG, PVOID);
-BOOL WINAPI SymEnumerateSymbols(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
-BOOL WINAPI SymEnumerateSymbolsW(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACKW, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PCWSTR, DWORD64, ULONG, PVOID);
-BOOL WINAPI SymEnumerateSymbols64(HANDLE, ULONG64, PSYM_ENUMSYMBOLS_CALLBACK64, PVOID);
-BOOL WINAPI SymEnumerateSymbolsW64(HANDLE, ULONG64, PSYM_ENUMSYMBOLS_CALLBACK64W, PVOID);
-BOOL WINAPI SymEnumSymbolsForAddr(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
-BOOL WINAPI SymEnumSymbolsForAddrW(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
-typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
-BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
-typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
-BOOL WINAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
-BOOL WINAPI SymRegisterCallbackW64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
-BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
-BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64, PSTR, DWORD);
-BOOL WINAPI SymMatchString(PCSTR, PCSTR, BOOL);
-BOOL WINAPI SymMatchStringA(PCSTR, PCSTR, BOOL);
-BOOL WINAPI SymMatchStringW(PCWSTR, PCWSTR, BOOL);
-BOOL WINAPI SymSearch(HANDLE, ULONG64, DWORD, DWORD, PCSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID, DWORD);
-BOOL WINAPI SymSearchW(HANDLE, ULONG64, DWORD, DWORD, PCWSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID, DWORD);
-DWORD WINAPI UnDecorateSymbolName(PCSTR, PSTR, DWORD, DWORD);
-DWORD WINAPI UnDecorateSymbolNameW(PCWSTR, PWSTR, DWORD, DWORD);
-BOOL WINAPI SymGetScope(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
-BOOL WINAPI SymGetScopeW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
-BOOL WINAPI SymFromIndex(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
-BOOL WINAPI SymFromIndexW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
-BOOL WINAPI SymAddSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD, DWORD);
-BOOL WINAPI SymAddSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD, DWORD);
-BOOL WINAPI SymDeleteSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD);
-BOOL WINAPI SymDeleteSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD);
+  BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64 *, SYMBOL_INFO *);
+  BOOL WINAPI SymFromAddrW(HANDLE, DWORD64, DWORD64 *, SYMBOL_INFOW *);
+  BOOL WINAPI SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
+  BOOL WINAPI SymFromTokenW(HANDLE, DWORD64, DWORD, PSYMBOL_INFOW);
+  BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
+  BOOL WINAPI SymFromNameW(HANDLE, PCWSTR, PSYMBOL_INFOW);
+  BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
+  BOOL WINAPI SymGetSymFromAddr64(HANDLE, DWORD64, PDWORD64,
+                                  PIMAGEHLP_SYMBOL64);
+  BOOL WINAPI SymGetSymFromName(HANDLE, PCSTR, PIMAGEHLP_SYMBOL);
+  BOOL WINAPI SymGetSymFromName64(HANDLE, PCSTR, PIMAGEHLP_SYMBOL64);
+  BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, PCSTR, PSYMBOL_INFO);
+  BOOL WINAPI SymGetTypeFromNameW(HANDLE, ULONG64, PCWSTR, PSYMBOL_INFOW);
+  BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
+  BOOL WINAPI SymGetSymNext64(HANDLE, PIMAGEHLP_SYMBOL64);
+  BOOL WINAPI SymGetSymNextW64(HANDLE, PIMAGEHLP_SYMBOLW64);
+  BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
+  BOOL WINAPI SymGetSymPrev64(HANDLE, PIMAGEHLP_SYMBOL64);
+  BOOL WINAPI SymGetSymPrevW64(HANDLE, PIMAGEHLP_SYMBOLW64);
+  BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR,
+                             PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
+  BOOL WINAPI SymEnumSymbolsW(HANDLE, ULONG64, PCWSTR,
+                              PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMSYMBOLS_CALLBACK) (PCSTR, DWORD, ULONG,
+                                                      PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMSYMBOLS_CALLBACKW) (PCWSTR, DWORD, ULONG,
+                                                       PVOID);
+  BOOL WINAPI SymEnumerateSymbols(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACK,
+                                  PVOID);
+  BOOL WINAPI SymEnumerateSymbolsW(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACKW,
+                                   PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMSYMBOLS_CALLBACK64) (PCSTR, DWORD64, ULONG,
+                                                        PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMSYMBOLS_CALLBACK64W) (PCWSTR, DWORD64,
+                                                         ULONG, PVOID);
+  BOOL WINAPI SymEnumerateSymbols64(HANDLE, ULONG64,
+                                    PSYM_ENUMSYMBOLS_CALLBACK64, PVOID);
+  BOOL WINAPI SymEnumerateSymbolsW64(HANDLE, ULONG64,
+                                     PSYM_ENUMSYMBOLS_CALLBACK64W, PVOID);
+  BOOL WINAPI SymEnumSymbolsForAddr(HANDLE, DWORD64,
+                                    PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
+  BOOL WINAPI SymEnumSymbolsForAddrW(HANDLE, DWORD64,
+                                     PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
+  typedef BOOL(CALLBACK * PSYMBOL_REGISTERED_CALLBACK) (HANDLE, ULONG, PVOID,
+                                                        PVOID);
+  BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
+  typedef BOOL(CALLBACK * PSYMBOL_REGISTERED_CALLBACK64) (HANDLE, ULONG,
+                                                          ULONG64, ULONG64);
+  BOOL WINAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64,
+                                    ULONG64);
+  BOOL WINAPI SymRegisterCallbackW64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64,
+                                     ULONG64);
+  BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
+  BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64, PSTR, DWORD);
+  BOOL WINAPI SymMatchString(PCSTR, PCSTR, BOOL);
+  BOOL WINAPI SymMatchStringA(PCSTR, PCSTR, BOOL);
+  BOOL WINAPI SymMatchStringW(PCWSTR, PCWSTR, BOOL);
+  BOOL WINAPI SymSearch(HANDLE, ULONG64, DWORD, DWORD, PCSTR, DWORD64,
+                        PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID, DWORD);
+  BOOL WINAPI SymSearchW(HANDLE, ULONG64, DWORD, DWORD, PCWSTR, DWORD64,
+                         PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID, DWORD);
+  DWORD WINAPI UnDecorateSymbolName(PCSTR, PSTR, DWORD, DWORD);
+  DWORD WINAPI UnDecorateSymbolNameW(PCWSTR, PWSTR, DWORD, DWORD);
+  BOOL WINAPI SymGetScope(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
+  BOOL WINAPI SymGetScopeW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
+  BOOL WINAPI SymFromIndex(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
+  BOOL WINAPI SymFromIndexW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
+  BOOL WINAPI SymAddSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD, DWORD);
+  BOOL WINAPI SymAddSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD, DWORD);
+  BOOL WINAPI SymDeleteSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD);
+  BOOL WINAPI SymDeleteSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD);
 
 /*************************
  *      Source Files     *
  *************************/
-typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(PSOURCEFILE, PVOID);
-typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACKW)(PSOURCEFILEW, PVOID);
-
-BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, PCSTR, PSYM_ENUMSOURCEFILES_CALLBACK,
-                               PVOID);
-BOOL WINAPI SymEnumSourceFilesW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMSOURCEFILES_CALLBACKW, PVOID);
-BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
-BOOL WINAPI SymGetLineFromAddrW(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINEW);
-BOOL WINAPI SymGetLineFromAddr64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
-BOOL WINAPI SymGetLineFromAddrW64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
-BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
-BOOL WINAPI SymGetLinePrevW(HANDLE, PIMAGEHLP_LINEW);
-BOOL WINAPI SymGetLinePrev64(HANDLE, PIMAGEHLP_LINE64);
-BOOL WINAPI SymGetLinePrevW64(HANDLE, PIMAGEHLP_LINEW64);
-BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
-BOOL WINAPI SymGetLineNextW(HANDLE, PIMAGEHLP_LINEW);
-BOOL WINAPI SymGetLineNext64(HANDLE, PIMAGEHLP_LINE64);
-BOOL WINAPI SymGetLineNextW64(HANDLE, PIMAGEHLP_LINEW64);
-BOOL WINAPI SymGetLineFromName(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE);
-BOOL WINAPI SymGetLineFromName64(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE64);
-BOOL WINAPI SymGetLineFromNameW64(HANDLE, PCWSTR, PCWSTR, DWORD, PLONG, PIMAGEHLP_LINEW64);
-ULONG WINAPI SymGetFileLineOffsets64(HANDLE, PCSTR, PCSTR, PDWORD64, ULONG);
-BOOL WINAPI SymGetSourceFile(HANDLE, ULONG64, PCSTR, PCSTR, PSTR, DWORD);
-BOOL WINAPI SymGetSourceFileW(HANDLE, ULONG64, PCWSTR, PCWSTR, PWSTR, DWORD);
-BOOL WINAPI SymGetSourceFileToken(HANDLE, ULONG64, PCSTR, PVOID*, DWORD*);
-BOOL WINAPI SymGetSourceFileTokenW(HANDLE, ULONG64, PCWSTR, PVOID*, DWORD*);
-BOOL WINAPI SymGetSourceFileFromToken(HANDLE, PVOID, PCSTR, PSTR, DWORD);
-BOOL WINAPI SymGetSourceFileFromTokenW(HANDLE, PVOID, PCWSTR, PWSTR, DWORD);
-BOOL WINAPI SymGetSourceVarFromToken(HANDLE, PVOID, PCSTR, PCSTR, PSTR, DWORD);
-BOOL WINAPI SymGetSourceVarFromTokenW(HANDLE, PVOID, PCWSTR, PCWSTR, PWSTR, DWORD);
-
-typedef struct _SRCCODEINFO
-{
-    DWORD       SizeOfStruct;
-    PVOID       Key;
-    DWORD64     ModBase;
-    CHAR        Obj[MAX_PATH+1];
-    CHAR        FileName[MAX_PATH+1];
-    DWORD       LineNumber;
-    DWORD64     Address;
-} SRCCODEINFO, *PSRCCODEINFO;
-
-typedef struct _SRCCODEINFOW
-{
-    DWORD       SizeOfStruct;
-    PVOID       Key;
-    DWORD64     ModBase;
-    WCHAR       Obj[MAX_PATH+1];
-    WCHAR       FileName[MAX_PATH+1];
-    DWORD       LineNumber;
-    DWORD64     Address;
-} SRCCODEINFOW, *PSRCCODEINFOW;
-
-typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO, PVOID);
-typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACKW)(PSRCCODEINFOW, PVOID);
-BOOL WINAPI SymEnumLines(HANDLE, ULONG64, PCSTR, PCSTR, PSYM_ENUMLINES_CALLBACK, PVOID);
-BOOL WINAPI SymEnumLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, PSYM_ENUMLINES_CALLBACKW, PVOID);
-BOOL WINAPI SymEnumSourceLines(HANDLE, ULONG64, PCSTR, PCSTR, DWORD, DWORD, PSYM_ENUMLINES_CALLBACK, PVOID);
-BOOL WINAPI SymEnumSourceLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, DWORD, DWORD, PSYM_ENUMLINES_CALLBACKW, PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMSOURCEFILES_CALLBACK) (PSOURCEFILE, PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMSOURCEFILES_CALLBACKW) (PSOURCEFILEW,
+                                                           PVOID);
+
+  BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, PCSTR,
+                                 PSYM_ENUMSOURCEFILES_CALLBACK, PVOID);
+  BOOL WINAPI SymEnumSourceFilesW(HANDLE, ULONG64, PCWSTR,
+                                  PSYM_ENUMSOURCEFILES_CALLBACKW, PVOID);
+  BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
+  BOOL WINAPI SymGetLineFromAddrW(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINEW);
+  BOOL WINAPI SymGetLineFromAddr64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
+  BOOL WINAPI SymGetLineFromAddrW64(HANDLE, DWORD64, PDWORD,
+                                    PIMAGEHLP_LINEW64);
+  BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
+  BOOL WINAPI SymGetLinePrevW(HANDLE, PIMAGEHLP_LINEW);
+  BOOL WINAPI SymGetLinePrev64(HANDLE, PIMAGEHLP_LINE64);
+  BOOL WINAPI SymGetLinePrevW64(HANDLE, PIMAGEHLP_LINEW64);
+  BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
+  BOOL WINAPI SymGetLineNextW(HANDLE, PIMAGEHLP_LINEW);
+  BOOL WINAPI SymGetLineNext64(HANDLE, PIMAGEHLP_LINE64);
+  BOOL WINAPI SymGetLineNextW64(HANDLE, PIMAGEHLP_LINEW64);
+  BOOL WINAPI SymGetLineFromName(HANDLE, PCSTR, PCSTR, DWORD, PLONG,
+                                 PIMAGEHLP_LINE);
+  BOOL WINAPI SymGetLineFromName64(HANDLE, PCSTR, PCSTR, DWORD, PLONG,
+                                   PIMAGEHLP_LINE64);
+  BOOL WINAPI SymGetLineFromNameW64(HANDLE, PCWSTR, PCWSTR, DWORD, PLONG,
+                                    PIMAGEHLP_LINEW64);
+  ULONG WINAPI SymGetFileLineOffsets64(HANDLE, PCSTR, PCSTR, PDWORD64, ULONG);
+  BOOL WINAPI SymGetSourceFile(HANDLE, ULONG64, PCSTR, PCSTR, PSTR, DWORD);
+  BOOL WINAPI SymGetSourceFileW(HANDLE, ULONG64, PCWSTR, PCWSTR, PWSTR,
+                                DWORD);
+  BOOL WINAPI SymGetSourceFileToken(HANDLE, ULONG64, PCSTR, PVOID *, DWORD *);
+  BOOL WINAPI SymGetSourceFileTokenW(HANDLE, ULONG64, PCWSTR, PVOID *,
+                                     DWORD *);
+  BOOL WINAPI SymGetSourceFileFromToken(HANDLE, PVOID, PCSTR, PSTR, DWORD);
+  BOOL WINAPI SymGetSourceFileFromTokenW(HANDLE, PVOID, PCWSTR, PWSTR, DWORD);
+  BOOL WINAPI SymGetSourceVarFromToken(HANDLE, PVOID, PCSTR, PCSTR, PSTR,
+                                       DWORD);
+  BOOL WINAPI SymGetSourceVarFromTokenW(HANDLE, PVOID, PCWSTR, PCWSTR, PWSTR,
+                                        DWORD);
+
+  typedef struct _SRCCODEINFO {
+    DWORD SizeOfStruct;
+    PVOID Key;
+    DWORD64 ModBase;
+    CHAR Obj[MAX_PATH + 1];
+    CHAR FileName[MAX_PATH + 1];
+    DWORD LineNumber;
+    DWORD64 Address;
+  } SRCCODEINFO, *PSRCCODEINFO;
+
+  typedef struct _SRCCODEINFOW {
+    DWORD SizeOfStruct;
+    PVOID Key;
+    DWORD64 ModBase;
+    WCHAR Obj[MAX_PATH + 1];
+    WCHAR FileName[MAX_PATH + 1];
+    DWORD LineNumber;
+    DWORD64 Address;
+  } SRCCODEINFOW, *PSRCCODEINFOW;
+
+  typedef BOOL(CALLBACK * PSYM_ENUMLINES_CALLBACK) (PSRCCODEINFO, PVOID);
+  typedef BOOL(CALLBACK * PSYM_ENUMLINES_CALLBACKW) (PSRCCODEINFOW, PVOID);
+  BOOL WINAPI SymEnumLines(HANDLE, ULONG64, PCSTR, PCSTR,
+                           PSYM_ENUMLINES_CALLBACK, PVOID);
+  BOOL WINAPI SymEnumLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR,
+                            PSYM_ENUMLINES_CALLBACKW, PVOID);
+  BOOL WINAPI SymEnumSourceLines(HANDLE, ULONG64, PCSTR, PCSTR, DWORD, DWORD,
+                                 PSYM_ENUMLINES_CALLBACK, PVOID);
+  BOOL WINAPI SymEnumSourceLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, DWORD,
+                                  DWORD, PSYM_ENUMLINES_CALLBACKW, PVOID);
 
 /*************************
  * File & image handling *
  *************************/
-BOOL WINAPI SymInitialize(HANDLE, PCSTR, BOOL);
-BOOL WINAPI SymInitializeW(HANDLE, PCWSTR, BOOL);
-BOOL WINAPI SymCleanup(HANDLE);
-
-HANDLE WINAPI FindDebugInfoFile(PCSTR, PCSTR, PSTR);
-typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PCSTR, PVOID);
-typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
-HANDLE WINAPI FindDebugInfoFileEx(PCSTR, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
-HANDLE WINAPI FindDebugInfoFileExW(PCWSTR, PCWSTR, PWSTR, PFIND_DEBUG_FILE_CALLBACKW, PVOID);
-HANDLE WINAPI SymFindDebugInfoFile(HANDLE, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
-HANDLE WINAPI SymFindDebugInfoFileW(HANDLE, PCWSTR, PWSTR, PFIND_DEBUG_FILE_CALLBACKW, PVOID);
-typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PCSTR, PVOID);
-typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACKW)(PCWSTR, PVOID);
-BOOL WINAPI FindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
-                           PSTR, PFINDFILEINPATHCALLBACK, PVOID);
-BOOL WINAPI SymFindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
-                              PSTR, PFINDFILEINPATHCALLBACK, PVOID);
-BOOL WINAPI SymFindFileInPathW(HANDLE, PCWSTR, PCWSTR, PVOID, DWORD, DWORD, DWORD,
-                              PWSTR, PFINDFILEINPATHCALLBACKW, PVOID);
-HANDLE WINAPI FindExecutableImage(PCSTR, PCSTR, PSTR);
-typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PCSTR, PVOID);
-typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
-HANDLE WINAPI FindExecutableImageEx(PCSTR, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
-HANDLE WINAPI FindExecutableImageExW(PCWSTR, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
-HANDLE WINAPI SymFindExecutableImage(HANDLE, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
-HANDLE WINAPI SymFindExecutableImageW(HANDLE, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
-PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
-PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
-                                         PIMAGE_SECTION_HEADER *);
-PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
-PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
-PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
-BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
-BOOL WINAPI SymGetSearchPathW(HANDLE, PWSTR, DWORD);
-BOOL WINAPI SymSetSearchPath(HANDLE, PCSTR);
-BOOL WINAPI SymSetSearchPathW(HANDLE, PCWSTR);
-DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
-BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
-BOOL WINAPI SearchTreeForFile(PCSTR, PCSTR, PSTR);
-BOOL WINAPI SearchTreeForFileW(PCWSTR, PCWSTR, PWSTR);
-typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(PCSTR, PVOID);
-typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACKW)(PCWSTR, PVOID);
-BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, PSTR, PENUMDIRTREE_CALLBACK, PVOID);
-BOOL WINAPI EnumDirTreeW(HANDLE, PCWSTR, PCWSTR, PWSTR, PENUMDIRTREE_CALLBACKW, PVOID);
-BOOL WINAPI SymMatchFileName(PCSTR, PCSTR, PSTR*, PSTR*);
-BOOL WINAPI SymMatchFileNameW(PCWSTR, PCWSTR, PWSTR*, PWSTR*);
-PCHAR WINAPI SymSetHomeDirectory(HANDLE, PCSTR);
-PWSTR WINAPI SymSetHomeDirectoryW(HANDLE, PCWSTR);
-PCHAR WINAPI SymGetHomeDirectory(DWORD, PSTR, size_t);
-PWSTR WINAPI SymGetHomeDirectoryW(DWORD, PWSTR, size_t);
+  BOOL WINAPI SymInitialize(HANDLE, PCSTR, BOOL);
+  BOOL WINAPI SymInitializeW(HANDLE, PCWSTR, BOOL);
+  BOOL WINAPI SymCleanup(HANDLE);
+
+  HANDLE WINAPI FindDebugInfoFile(PCSTR, PCSTR, PSTR);
+  typedef BOOL(CALLBACK * PFIND_DEBUG_FILE_CALLBACK) (HANDLE, PCSTR, PVOID);
+  typedef BOOL(CALLBACK * PFIND_DEBUG_FILE_CALLBACKW) (HANDLE, PCWSTR, PVOID);
+  HANDLE WINAPI FindDebugInfoFileEx(PCSTR, PCSTR, PSTR,
+                                    PFIND_DEBUG_FILE_CALLBACK, PVOID);
+  HANDLE WINAPI FindDebugInfoFileExW(PCWSTR, PCWSTR, PWSTR,
+                                     PFIND_DEBUG_FILE_CALLBACKW, PVOID);
+  HANDLE WINAPI SymFindDebugInfoFile(HANDLE, PCSTR, PSTR,
+                                     PFIND_DEBUG_FILE_CALLBACK, PVOID);
+  HANDLE WINAPI SymFindDebugInfoFileW(HANDLE, PCWSTR, PWSTR,
+                                      PFIND_DEBUG_FILE_CALLBACKW, PVOID);
+  typedef BOOL(CALLBACK * PFINDFILEINPATHCALLBACK) (PCSTR, PVOID);
+  typedef BOOL(CALLBACK * PFINDFILEINPATHCALLBACKW) (PCWSTR, PVOID);
+  BOOL WINAPI FindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
+                             PSTR, PFINDFILEINPATHCALLBACK, PVOID);
+  BOOL WINAPI SymFindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD,
+                                DWORD, PSTR, PFINDFILEINPATHCALLBACK, PVOID);
+  BOOL WINAPI SymFindFileInPathW(HANDLE, PCWSTR, PCWSTR, PVOID, DWORD, DWORD,
+                                 DWORD, PWSTR, PFINDFILEINPATHCALLBACKW,
+                                 PVOID);
+  HANDLE WINAPI FindExecutableImage(PCSTR, PCSTR, PSTR);
+  typedef BOOL(CALLBACK * PFIND_EXE_FILE_CALLBACK) (HANDLE, PCSTR, PVOID);
+  typedef BOOL(CALLBACK * PFIND_EXE_FILE_CALLBACKW) (HANDLE, PCWSTR, PVOID);
+  HANDLE WINAPI FindExecutableImageEx(PCSTR, PCSTR, PSTR,
+                                      PFIND_EXE_FILE_CALLBACK, PVOID);
+  HANDLE WINAPI FindExecutableImageExW(PCWSTR, PCWSTR, PWSTR,
+                                       PFIND_EXE_FILE_CALLBACKW, PVOID);
+  HANDLE WINAPI SymFindExecutableImage(HANDLE, PCSTR, PSTR,
+                                       PFIND_EXE_FILE_CALLBACK, PVOID);
+  HANDLE WINAPI SymFindExecutableImageW(HANDLE, PCWSTR, PWSTR,
+                                        PFIND_EXE_FILE_CALLBACKW, PVOID);
+  PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
+  PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
+                                           PIMAGE_SECTION_HEADER *);
+  PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
+  PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID,
+                                                 ULONG);
+  PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG,
+                            PIMAGE_SECTION_HEADER *);
+  BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
+  BOOL WINAPI SymGetSearchPathW(HANDLE, PWSTR, DWORD);
+  BOOL WINAPI SymSetSearchPath(HANDLE, PCSTR);
+  BOOL WINAPI SymSetSearchPathW(HANDLE, PCWSTR);
+  DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
+  BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
+  BOOL WINAPI SearchTreeForFile(PCSTR, PCSTR, PSTR);
+  BOOL WINAPI SearchTreeForFileW(PCWSTR, PCWSTR, PWSTR);
+  typedef BOOL(CALLBACK * PENUMDIRTREE_CALLBACK) (PCSTR, PVOID);
+  typedef BOOL(CALLBACK * PENUMDIRTREE_CALLBACKW) (PCWSTR, PVOID);
+  BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, PSTR, PENUMDIRTREE_CALLBACK,
+                          PVOID);
+  BOOL WINAPI EnumDirTreeW(HANDLE, PCWSTR, PCWSTR, PWSTR,
+                           PENUMDIRTREE_CALLBACKW, PVOID);
+  BOOL WINAPI SymMatchFileName(PCSTR, PCSTR, PSTR *, PSTR *);
+  BOOL WINAPI SymMatchFileNameW(PCWSTR, PCWSTR, PWSTR *, PWSTR *);
+  PCHAR WINAPI SymSetHomeDirectory(HANDLE, PCSTR);
+  PWSTR WINAPI SymSetHomeDirectoryW(HANDLE, PCWSTR);
+  PCHAR WINAPI SymGetHomeDirectory(DWORD, PSTR, size_t);
+  PWSTR WINAPI SymGetHomeDirectoryW(DWORD, PWSTR, size_t);
 #define hdBase  0
 #define hdSym   1
 #define hdSrc   2
@@ -1150,97 +1138,100 @@ PWSTR WINAPI SymGetHomeDirectoryW(DWORD, PWSTR, size_t);
 /*************************
  *   Context management  *
  *************************/
-BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
+  BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
 
 
 /*************************
  *    Stack management   *
  *************************/
 
-typedef struct _KDHELP
-{
-    DWORD       Thread;
-    DWORD       ThCallbackStack;
-    DWORD       NextCallback;
-    DWORD       FramePointer;
-    DWORD       KiCallUserMode;
-    DWORD       KeUserCallbackDispatcher;
-    DWORD       SystemRangeStart;
-} KDHELP, *PKDHELP;
-
-typedef struct _KDHELP64
-{
-    DWORD64     Thread;
-    DWORD       ThCallbackStack;
-    DWORD       ThCallbackBStore;
-    DWORD       NextCallback;
-    DWORD       FramePointer;
-    DWORD64     KiCallUserMode;
-    DWORD64     KeUserCallbackDispatcher;
-    DWORD64     SystemRangeStart;
-    DWORD64     Reserved[8];
-} KDHELP64, *PKDHELP64;
-
-typedef struct _STACKFRAME
-{
-    ADDRESS     AddrPC;
-    ADDRESS     AddrReturn;
-    ADDRESS     AddrFrame;
-    ADDRESS     AddrStack;
-    PVOID       FuncTableEntry;
-    DWORD       Params[4];
-    BOOL        Far;
-    BOOL        Virtual;
-    DWORD       Reserved[3];
-    KDHELP      KdHelp;
-    ADDRESS     AddrBStore;
-} STACKFRAME, *LPSTACKFRAME;
-
-typedef struct _STACKFRAME64
-{
-    ADDRESS64   AddrPC;
-    ADDRESS64   AddrReturn;
-    ADDRESS64   AddrFrame;
-    ADDRESS64   AddrStack;
-    ADDRESS64   AddrBStore;
-    PVOID       FuncTableEntry;
-    DWORD64     Params[4];
-    BOOL        Far;
-    BOOL        Virtual;
-    DWORD64     Reserved[3];
-    KDHELP64    KdHelp;
-} STACKFRAME64, *LPSTACKFRAME64;
-
-typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)
+  typedef struct _KDHELP {
+    DWORD Thread;
+    DWORD ThCallbackStack;
+    DWORD NextCallback;
+    DWORD FramePointer;
+    DWORD KiCallUserMode;
+    DWORD KeUserCallbackDispatcher;
+    DWORD SystemRangeStart;
+  } KDHELP, *PKDHELP;
+
+  typedef struct _KDHELP64 {
+    DWORD64 Thread;
+    DWORD ThCallbackStack;
+    DWORD ThCallbackBStore;
+    DWORD NextCallback;
+    DWORD FramePointer;
+    DWORD64 KiCallUserMode;
+    DWORD64 KeUserCallbackDispatcher;
+    DWORD64 SystemRangeStart;
+    DWORD64 Reserved[8];
+  } KDHELP64, *PKDHELP64;
+
+  typedef struct _STACKFRAME {
+    ADDRESS AddrPC;
+    ADDRESS AddrReturn;
+    ADDRESS AddrFrame;
+    ADDRESS AddrStack;
+    PVOID FuncTableEntry;
+    DWORD Params[4];
+    BOOL Far;
+    BOOL Virtual;
+    DWORD Reserved[3];
+    KDHELP KdHelp;
+    ADDRESS AddrBStore;
+  } STACKFRAME, *LPSTACKFRAME;
+
+  typedef struct _STACKFRAME64 {
+    ADDRESS64 AddrPC;
+    ADDRESS64 AddrReturn;
+    ADDRESS64 AddrFrame;
+    ADDRESS64 AddrStack;
+    ADDRESS64 AddrBStore;
+    PVOID FuncTableEntry;
+    DWORD64 Params[4];
+    BOOL Far;
+    BOOL Virtual;
+    DWORD64 Reserved[3];
+    KDHELP64 KdHelp;
+  } STACKFRAME64, *LPSTACKFRAME64;
+
+  typedef BOOL(CALLBACK * PREAD_PROCESS_MEMORY_ROUTINE)
     (HANDLE, DWORD, PVOID, DWORD, PDWORD);
-typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
-typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
-typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
-BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID,
-                      PREAD_PROCESS_MEMORY_ROUTINE,
-                      PFUNCTION_TABLE_ACCESS_ROUTINE,
-                      PGET_MODULE_BASE_ROUTINE,
-                      PTRANSLATE_ADDRESS_ROUTINE);
-
-typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE64)
+  typedef PVOID(CALLBACK * PFUNCTION_TABLE_ACCESS_ROUTINE) (HANDLE, DWORD);
+  typedef DWORD(CALLBACK * PGET_MODULE_BASE_ROUTINE) (HANDLE, DWORD);
+  typedef DWORD(CALLBACK * PTRANSLATE_ADDRESS_ROUTINE) (HANDLE, HANDLE,
+                                                        LPADDRESS);
+  BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID,
+                        PREAD_PROCESS_MEMORY_ROUTINE,
+                        PFUNCTION_TABLE_ACCESS_ROUTINE,
+                        PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
+
+  typedef BOOL(CALLBACK * PREAD_PROCESS_MEMORY_ROUTINE64)
     (HANDLE, DWORD64, PVOID, DWORD, PDWORD);
-typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE, DWORD64);
-typedef DWORD64 (CALLBACK *PGET_MODULE_BASE_ROUTINE64)(HANDLE, DWORD64);
-typedef DWORD64 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE, HANDLE, LPADDRESS64);
-BOOL WINAPI StackWalk64(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID,
-                        PREAD_PROCESS_MEMORY_ROUTINE64,
-                        PFUNCTION_TABLE_ACCESS_ROUTINE64,
-                        PGET_MODULE_BASE_ROUTINE64,
-                        PTRANSLATE_ADDRESS_ROUTINE64);
-
-PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
-PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
-
-typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE, DWORD, PVOID);
-typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE, ULONG64, ULONG64);
-
-BOOL WINAPI SymRegisterFunctionEntryCallback(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK, PVOID);
-BOOL WINAPI SymRegisterFunctionEntryCallback64(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK64, ULONG64);
+  typedef PVOID(CALLBACK * PFUNCTION_TABLE_ACCESS_ROUTINE64) (HANDLE,
+                                                              DWORD64);
+  typedef DWORD64(CALLBACK * PGET_MODULE_BASE_ROUTINE64) (HANDLE, DWORD64);
+  typedef DWORD64(CALLBACK * PTRANSLATE_ADDRESS_ROUTINE64) (HANDLE, HANDLE,
+                                                            LPADDRESS64);
+  BOOL WINAPI StackWalk64(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID,
+                          PREAD_PROCESS_MEMORY_ROUTINE64,
+                          PFUNCTION_TABLE_ACCESS_ROUTINE64,
+                          PGET_MODULE_BASE_ROUTINE64,
+                          PTRANSLATE_ADDRESS_ROUTINE64);
+
+  PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
+  PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
+
+  typedef PVOID(CALLBACK * PSYMBOL_FUNCENTRY_CALLBACK) (HANDLE, DWORD, PVOID);
+  typedef PVOID(CALLBACK * PSYMBOL_FUNCENTRY_CALLBACK64) (HANDLE, ULONG64,
+                                                          ULONG64);
+
+  BOOL WINAPI SymRegisterFunctionEntryCallback(HANDLE,
+                                               PSYMBOL_FUNCENTRY_CALLBACK,
+                                               PVOID);
+  BOOL WINAPI SymRegisterFunctionEntryCallback64(HANDLE,
+                                                 PSYMBOL_FUNCENTRY_CALLBACK64,
+                                                 ULONG64);
 
 /*************************
  * Version, global stuff *
@@ -1248,77 +1239,80 @@ BOOL WINAPI SymRegisterFunctionEntryCallback64(HANDLE, PSYMBOL_FUNCENTRY_CALLBAC
 
 #define API_VERSION_NUMBER 9
 
-typedef struct API_VERSION
-{
-    USHORT  MajorVersion;
-    USHORT  MinorVersion;
-    USHORT  Revision;
-    USHORT  Reserved;
-} API_VERSION, *LPAPI_VERSION;
-
-LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
-LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
-
-typedef struct _IMAGE_DEBUG_INFORMATION
-{
-    LIST_ENTRY                  List;
-    DWORD                       ReservedSize;
-    PVOID                       ReservedMappedBase;
-    USHORT                      ReservedMachine;
-    USHORT                      ReservedCharacteristics;
-    DWORD                       ReservedCheckSum;
-    DWORD                       ImageBase;
-    DWORD                       SizeOfImage;
-    DWORD                       ReservedNumberOfSections;
-    PIMAGE_SECTION_HEADER       ReservedSections;
-    DWORD                       ReservedExportedNamesSize;
-    PSTR                        ReservedExportedNames;
-    DWORD                       ReservedNumberOfFunctionTableEntries;
-    PIMAGE_FUNCTION_ENTRY       ReservedFunctionTableEntries;
-    DWORD                       ReservedLowestFunctionStartingAddress;
-    DWORD                       ReservedHighestFunctionEndingAddress;
-    DWORD                       ReservedNumberOfFpoTableEntries;
-    PFPO_DATA                   ReservedFpoTableEntries;
-    DWORD                       SizeOfCoffSymbols;
-    PIMAGE_COFF_SYMBOLS_HEADER  CoffSymbols;
-    DWORD                       ReservedSizeOfCodeViewSymbols;
-    PVOID                       ReservedCodeViewSymbols;
-    PSTR                        ImageFilePath;
-    PSTR                        ImageFileName;
-    PSTR                        ReservedDebugFilePath;
-    DWORD                       ReservedTimeDateStamp;
-    BOOL                        ReservedRomImage;
-    PIMAGE_DEBUG_DIRECTORY      ReservedDebugDirectory;
-    DWORD                       ReservedNumberOfDebugDirectories;
-    DWORD                       ReservedOriginalFunctionTableBaseAddress;
-    DWORD                       Reserved[ 2 ];
-} IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
-
-
-PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PCSTR, PCSTR, ULONG);
-
-BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
-
-DWORD   WINAPI  SymGetOptions(void);
-DWORD   WINAPI  SymSetOptions(DWORD);
-
-BOOL WINAPI SymSetParentWindow(HWND);
+  typedef struct API_VERSION {
+    USHORT MajorVersion;
+    USHORT MinorVersion;
+    USHORT Revision;
+    USHORT Reserved;
+  } API_VERSION, *LPAPI_VERSION;
+
+  LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
+  LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
+
+  typedef struct _IMAGE_DEBUG_INFORMATION {
+    LIST_ENTRY List;
+    DWORD ReservedSize;
+    PVOID ReservedMappedBase;
+    USHORT ReservedMachine;
+    USHORT ReservedCharacteristics;
+    DWORD ReservedCheckSum;
+    DWORD ImageBase;
+    DWORD SizeOfImage;
+    DWORD ReservedNumberOfSections;
+    PIMAGE_SECTION_HEADER ReservedSections;
+    DWORD ReservedExportedNamesSize;
+    PSTR ReservedExportedNames;
+    DWORD ReservedNumberOfFunctionTableEntries;
+    PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries;
+    DWORD ReservedLowestFunctionStartingAddress;
+    DWORD ReservedHighestFunctionEndingAddress;
+    DWORD ReservedNumberOfFpoTableEntries;
+    PFPO_DATA ReservedFpoTableEntries;
+    DWORD SizeOfCoffSymbols;
+    PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols;
+    DWORD ReservedSizeOfCodeViewSymbols;
+    PVOID ReservedCodeViewSymbols;
+    PSTR ImageFilePath;
+    PSTR ImageFileName;
+    PSTR ReservedDebugFilePath;
+    DWORD ReservedTimeDateStamp;
+    BOOL ReservedRomImage;
+    PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory;
+    DWORD ReservedNumberOfDebugDirectories;
+    DWORD ReservedOriginalFunctionTableBaseAddress;
+    DWORD Reserved[2];
+  } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
+
+
+  PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PCSTR, PCSTR,
+                                                      ULONG);
+
+  BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
+
+  DWORD WINAPI SymGetOptions(void);
+  DWORD WINAPI SymSetOptions(DWORD);
+
+  BOOL WINAPI SymSetParentWindow(HWND);
 
 /*************************
  * Version, global stuff *
  *************************/
 
-typedef BOOL     (WINAPI* PSYMBOLSERVERPROC)(PCSTR, PCSTR, PVOID, DWORD, DWORD, PSTR);
-typedef BOOL     (WINAPI* PSYMBOLSERVERPROCA)(PCSTR, PCSTR, PVOID, DWORD, DWORD, PSTR);
-typedef BOOL     (WINAPI* PSYMBOLSERVERPROCW)(PCWSTR, PCWSTR, PVOID, DWORD, DWORD, PWSTR);
-typedef BOOL     (WINAPI* PSYMBOLSERVEROPENPROC)(void);
-typedef BOOL     (WINAPI* PSYMBOLSERVERCLOSEPROC)(void);
-typedef BOOL     (WINAPI* PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR, ULONG64);
-typedef BOOL     (CALLBACK* PSYMBOLSERVERCALLBACKPROC)(UINT_PTR, ULONG64, ULONG64);
-typedef UINT_PTR (WINAPI* PSYMBOLSERVERGETOPTIONSPROC)(void);
-typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROC)(PCSTR);
-typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROCA)(PCSTR);
-typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROCW)(PCWSTR);
+  typedef BOOL(WINAPI * PSYMBOLSERVERPROC) (PCSTR, PCSTR, PVOID, DWORD, DWORD,
+                                            PSTR);
+  typedef BOOL(WINAPI * PSYMBOLSERVERPROCA) (PCSTR, PCSTR, PVOID, DWORD,
+                                             DWORD, PSTR);
+  typedef BOOL(WINAPI * PSYMBOLSERVERPROCW) (PCWSTR, PCWSTR, PVOID, DWORD,
+                                             DWORD, PWSTR);
+  typedef BOOL(WINAPI * PSYMBOLSERVEROPENPROC) (void);
+  typedef BOOL(WINAPI * PSYMBOLSERVERCLOSEPROC) (void);
+  typedef BOOL(WINAPI * PSYMBOLSERVERSETOPTIONSPROC) (UINT_PTR, ULONG64);
+  typedef BOOL(CALLBACK * PSYMBOLSERVERCALLBACKPROC) (UINT_PTR, ULONG64,
+                                                      ULONG64);
+  typedef UINT_PTR(WINAPI * PSYMBOLSERVERGETOPTIONSPROC) (void);
+  typedef BOOL(WINAPI * PSYMBOLSERVERPINGPROC) (PCSTR);
+  typedef BOOL(WINAPI * PSYMBOLSERVERPINGPROCA) (PCSTR);
+  typedef BOOL(WINAPI * PSYMBOLSERVERPINGPROCW) (PCWSTR);
 
 #define SSRVOPT_CALLBACK            0x0001
 #define SSRVOPT_DWORD               0x0002
@@ -1341,7 +1335,6 @@ typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROCW)(PCWSTR);
 #define SSRVACTION_EVENT        3
 
 #ifdef __cplusplus
-} /* extern "C" */
-#endif /* defined(__cplusplus) */
-
-#endif  /* __WINE_DBGHELP_H */
+}                               /* extern "C" */
+#endif                          /* defined(__cplusplus) */
+#endif                          /* __WINE_DBGHELP_H */
index 6931538..fc62d0d 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef _XBT_OS_THREAD_H
 #define _XBT_OS_THREAD_H
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/function_types.h"
 
 SG_BEGIN_DECL()
@@ -24,58 +24,58 @@ SG_BEGIN_DECL()
  * 
  *  @{
  */
-
   /** \brief Thread data type (opaque structure) */
-  typedef struct xbt_os_thread_       *xbt_os_thread_t;
-
-  XBT_PUBLIC(xbt_os_thread_t) xbt_os_thread_create(const char *name,pvoid_f_pvoid_t start_routine,void* param);
-  XBT_PUBLIC(void) xbt_os_thread_exit(int *retcode);
-  XBT_PUBLIC(xbt_os_thread_t) xbt_os_thread_self(void);
-  XBT_PUBLIC(const char*) xbt_os_thread_self_name(void);
-  XBT_PUBLIC(const char*) xbt_os_thread_name(xbt_os_thread_t);
+     typedef struct xbt_os_thread_ *xbt_os_thread_t;
+
+XBT_PUBLIC(xbt_os_thread_t) xbt_os_thread_create(const char *name,
+                                                 pvoid_f_pvoid_t
+                                                 start_routine, void *param);
+XBT_PUBLIC(void) xbt_os_thread_exit(int *retcode);
+XBT_PUBLIC(xbt_os_thread_t) xbt_os_thread_self(void);
+XBT_PUBLIC(const char *) xbt_os_thread_self_name(void);
+XBT_PUBLIC(const char *) xbt_os_thread_name(xbt_os_thread_t);
   /* xbt_os_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
-  XBT_PUBLIC(void) xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return);
-  XBT_PUBLIC(void) xbt_os_thread_yield(void);
-  XBT_PUBLIC(void) xbt_os_thread_cancel(xbt_os_thread_t thread);
-  XBT_PUBLIC(void*) xbt_os_thread_getparam(void);
+XBT_PUBLIC(void) xbt_os_thread_join(xbt_os_thread_t thread,
+                                    void **thread_return);
+XBT_PUBLIC(void) xbt_os_thread_yield(void);
+XBT_PUBLIC(void) xbt_os_thread_cancel(xbt_os_thread_t thread);
+XBT_PUBLIC(void *) xbt_os_thread_getparam(void);
 
 
   /** \brief Thread mutex data type (opaque structure) */
-  typedef struct xbt_os_mutex_ *xbt_os_mutex_t;
+     typedef struct xbt_os_mutex_ *xbt_os_mutex_t;
 
-  XBT_PUBLIC(xbt_os_mutex_t) xbt_os_mutex_init(void);
-  XBT_PUBLIC(void)           xbt_os_mutex_acquire(xbt_os_mutex_t mutex);
-  XBT_PUBLIC(void)                      xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay);         
-  XBT_PUBLIC(void)           xbt_os_mutex_release(xbt_os_mutex_t mutex);
-  XBT_PUBLIC(void)           xbt_os_mutex_destroy(xbt_os_mutex_t mutex);
+XBT_PUBLIC(xbt_os_mutex_t) xbt_os_mutex_init(void);
+XBT_PUBLIC(void) xbt_os_mutex_acquire(xbt_os_mutex_t mutex);
+XBT_PUBLIC(void) xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex,
+                                           double delay);
+XBT_PUBLIC(void) xbt_os_mutex_release(xbt_os_mutex_t mutex);
+XBT_PUBLIC(void) xbt_os_mutex_destroy(xbt_os_mutex_t mutex);
 
 
   /** \brief Thread condition data type (opaque structure) */
-  typedef struct xbt_os_cond_  *xbt_os_cond_t;
-
-  XBT_PUBLIC(xbt_os_cond_t) xbt_os_cond_init(void);
-  XBT_PUBLIC(void)          xbt_os_cond_wait(xbt_os_cond_t cond,
-                                            xbt_os_mutex_t mutex);
-  XBT_PUBLIC(void)          xbt_os_cond_timedwait(xbt_os_cond_t cond,
-                                                 xbt_os_mutex_t mutex,
-                                                 double delay);
-  XBT_PUBLIC(void)          xbt_os_cond_signal(xbt_os_cond_t cond);
-  XBT_PUBLIC(void)          xbt_os_cond_broadcast(xbt_os_cond_t cond);
-  XBT_PUBLIC(void)          xbt_os_cond_destroy(xbt_os_cond_t cond);
-  
+     typedef struct xbt_os_cond_ *xbt_os_cond_t;
+
+XBT_PUBLIC(xbt_os_cond_t) xbt_os_cond_init(void);
+XBT_PUBLIC(void) xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex);
+XBT_PUBLIC(void) xbt_os_cond_timedwait(xbt_os_cond_t cond,
+                                       xbt_os_mutex_t mutex, double delay);
+XBT_PUBLIC(void) xbt_os_cond_signal(xbt_os_cond_t cond);
+XBT_PUBLIC(void) xbt_os_cond_broadcast(xbt_os_cond_t cond);
+XBT_PUBLIC(void) xbt_os_cond_destroy(xbt_os_cond_t cond);
+
    /** \brief Semaphore data type (opaque structure) */
-  typedef struct xbt_os_sem_* xbt_os_sem_t;
+     typedef struct xbt_os_sem_ *xbt_os_sem_t;
+
+XBT_PUBLIC(xbt_os_sem_t) xbt_os_sem_init(unsigned int value);
+XBT_PUBLIC(void) xbt_os_sem_acquire(xbt_os_sem_t sem);
+XBT_PUBLIC(void) xbt_os_sem_timedacquire(xbt_os_sem_t sem, double timeout);
+XBT_PUBLIC(void) xbt_os_sem_release(xbt_os_sem_t sem);
+XBT_PUBLIC(void) xbt_os_sem_destroy(xbt_os_sem_t sem);
+XBT_PUBLIC(void) xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue);
 
-  XBT_PUBLIC(xbt_os_sem_t) xbt_os_sem_init(unsigned int value);
-  XBT_PUBLIC(void) xbt_os_sem_acquire(xbt_os_sem_t sem);
-  XBT_PUBLIC(void) xbt_os_sem_timedacquire(xbt_os_sem_t sem,double timeout);
-  XBT_PUBLIC(void) xbt_os_sem_release(xbt_os_sem_t sem);
-  XBT_PUBLIC(void) xbt_os_sem_destroy(xbt_os_sem_t sem);
-  XBT_PUBLIC(void) xbt_os_sem_get_value(xbt_os_sem_t sem, int* svalue);
 
 /** @} */
 
 SG_END_DECL()
-
 #endif /* _XBT_OS_THREAD_H */
index 031bd0e..3c8c2c9 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef _XBT_PORTABILITY_H
 #define _XBT_PORTABILITY_H
 
-#include <xbt/misc.h> /* XBT_PUBLIC */
+#include <xbt/misc.h>           /* XBT_PUBLIC */
 
 /** @brief get time in seconds 
 
 XBT_PUBLIC(double) xbt_os_time(void);
 XBT_PUBLIC(void) xbt_os_sleep(double sec);
 
-typedef struct s_xbt_os_timer *xbt_os_timer_t;
+     typedef struct s_xbt_os_timer *xbt_os_timer_t;
 XBT_PUBLIC(xbt_os_timer_t) xbt_os_timer_new(void);
-XBT_PUBLIC(void)   xbt_os_timer_free(xbt_os_timer_t timer);
-XBT_PUBLIC(void)   xbt_os_timer_start(xbt_os_timer_t timer);
-XBT_PUBLIC(void)   xbt_os_timer_stop(xbt_os_timer_t timer);
+XBT_PUBLIC(void) xbt_os_timer_free(xbt_os_timer_t timer);
+XBT_PUBLIC(void) xbt_os_timer_start(xbt_os_timer_t timer);
+XBT_PUBLIC(void) xbt_os_timer_stop(xbt_os_timer_t timer);
 XBT_PUBLIC(double) xbt_os_timer_elapsed(xbt_os_timer_t timer);
 
 #endif
index 908c9c1..f16f2c7 100644 (file)
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
-static JavaVM * __java_vm = NULL;
+static JavaVM *__java_vm = NULL;
 
-static jobject
-native_to_java_process(m_process_t process);
+static jobject native_to_java_process(m_process_t process);
 
-JavaVM *
-get_java_VM(void) {
-       return __java_vm;
+JavaVM *get_java_VM(void)
+{
+  return __java_vm;
 }
 
-JNIEnv *
-get_current_thread_env(void) {
-       JNIEnv *env;
+JNIEnv *get_current_thread_env(void)
+{
+  JNIEnv *env;
 
-    (*__java_vm)->AttachCurrentThread(__java_vm, (void **)&env, NULL);
+  (*__java_vm)->AttachCurrentThread(__java_vm, (void **) &env, NULL);
 
-        return env;
+  return env;
 }
 
-static jobject
-native_to_java_process(m_process_t process)
+static jobject native_to_java_process(m_process_t process)
 {
-       return ((xbt_ctx_java_t)(process->simdata->s_process->simdata->context))->jprocess;     
+  return ((xbt_ctx_java_t)
+          (process->simdata->s_process->simdata->context))->jprocess;
 }
 
 
@@ -61,271 +60,299 @@ native_to_java_process(m_process_t process)
  * The MSG process connected functions implementation.                                 
  */
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processCreate(JNIEnv* env, jclass cls, jobject jprocess_arg, jobject jhost) {
-  jobject jprocess;            /* the global reference to the java process instance    */
-  jstring jname;               /* the name of the java process instance                */
-  const char* name;            /* the C name of the process                            */
-  m_process_t process;         /* the native process to create                         */
-  char alias[MAX_ALIAS_NAME + 1] = {0};
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processCreate(JNIEnv * env, jclass cls,
+                                         jobject jprocess_arg, jobject jhost)
+{
+  jobject jprocess;             /* the global reference to the java process instance    */
+  jstring jname;                /* the name of the java process instance                */
+  const char *name;             /* the C name of the process                            */
+  m_process_t process;          /* the native process to create                         */
+  char alias[MAX_ALIAS_NAME + 1] = { 0 };
   msg_mailbox_t mailbox;
 
-  DEBUG4("Java_simgrid_msg_MsgNative_processCreate(env=%p,cls=%p,jproc=%p,jhost=%p)",
-        env,cls,jprocess_arg,jhost);
+  DEBUG4
+    ("Java_simgrid_msg_MsgNative_processCreate(env=%p,cls=%p,jproc=%p,jhost=%p)",
+     env, cls, jprocess_arg, jhost);
   /* get the name of the java process */
-  jname = jprocess_get_name(jprocess_arg,env);
+  jname = jprocess_get_name(jprocess_arg, env);
 
   if (!jname) {
-    jxbt_throw_null(env,xbt_strdup("Internal error: Process name cannot be NULL"));
+    jxbt_throw_null(env,
+                    xbt_strdup
+                    ("Internal error: Process name cannot be NULL"));
     return;
   }
-       
+
   /* allocate the data of the simulation */
-  process = xbt_new0(s_m_process_t,1);
-  process->simdata = xbt_new0(s_simdata_process_t,1);
-    
+  process = xbt_new0(s_m_process_t, 1);
+  process->simdata = xbt_new0(s_simdata_process_t, 1);
+
   /* create a global java process instance */
-  jprocess = jprocess_new_global_ref(jprocess_arg,env);
+  jprocess = jprocess_new_global_ref(jprocess_arg, env);
 
-  if(!jprocess) {
+  if (!jprocess) {
     free(process->simdata);
     free(process);
     jxbt_throw_jni(env, "Can't get a global ref to the java process");
     return;
   }
-       
+
   /* bind the java process instance to the native process */
-  jprocess_bind(jprocess,process,env);
-       
+  jprocess_bind(jprocess, process, env);
+
   /* build the C name of the process */
   name = (*env)->GetStringUTFChars(env, jname, 0);
   process->name = xbt_strdup(name);
   (*env)->ReleaseStringUTFChars(env, jname, name);
-       
-  process->simdata->m_host = jhost_get_native(env,jhost);
 
+  process->simdata->m_host = jhost_get_native(env, jhost);
 
-  if( ! (process->simdata->m_host) ) { /* not binded */
+
+  if (!(process->simdata->m_host)) {    /* not binded */
     free(process->simdata);
     free(process->data);
     free(process);
-    jxbt_throw_notbound(env,"host",jhost);
+    jxbt_throw_notbound(env, "host", jhost);
     return;
   }
   process->simdata->PID = msg_global->PID++;
-    
+
   /* create a new context */
-  DEBUG8("fill in process %s/%s (pid=%d) %p (sd=%p, host=%p, host->sd=%p); env=%p",
-        process->name,process->simdata->m_host->name,
-        process->simdata->PID,process,
-        process->simdata, process->simdata->m_host, process->simdata->m_host->simdata,
-        env);
-  
+  DEBUG8
+    ("fill in process %s/%s (pid=%d) %p (sd=%p, host=%p, host->sd=%p); env=%p",
+     process->name, process->simdata->m_host->name, process->simdata->PID,
+     process, process->simdata, process->simdata->m_host,
+     process->simdata->m_host->simdata, env);
+
   SIMIX_jprocess_create(process->name,
-                       process->simdata->m_host->simdata->smx_host, 
-                       /*data*/ (void*)process,
-                       jprocess,
-                       env,
-                       &process->simdata->s_process);
+                        process->simdata->m_host->simdata->smx_host,
+                        /*data */ (void *) process,
+                        jprocess, env, &process->simdata->s_process);
+
 
-  
-  DEBUG1("context created (s_process=%p)",process->simdata->s_process);
+  DEBUG1("context created (s_process=%p)", process->simdata->s_process);
 
 
-  if (SIMIX_process_self()) { /* someone created me */
+  if (SIMIX_process_self()) {   /* someone created me */
     process->simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data);
   } else {
     process->simdata->PPID = -1;
   }
-    
+
   process->simdata->last_errno = MSG_OK;
-    
+
   /* add the process to the list of the processes of the simulation */
   xbt_fifo_unshift(msg_global->process_list, process);
 
-  sprintf(alias,"%s:%s",(process->simdata->m_host->simdata->smx_host)->name,process->name);
-  
+  sprintf(alias, "%s:%s", (process->simdata->m_host->simdata->smx_host)->name,
+          process->name);
+
   mailbox = MSG_mailbox_new(alias);
-  MSG_mailbox_set_hostname(mailbox, process->simdata->m_host->simdata->smx_host->name);
+  MSG_mailbox_set_hostname(mailbox,
+                           process->simdata->m_host->simdata->smx_host->name);
+
 
-       
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processSuspend(JNIEnv* env, jclass cls, jobject jprocess) {
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processSuspend(JNIEnv * env, jclass cls,
+                                          jobject jprocess)
+{
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if(!process) { 
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
-       
+
   /* try to suspend the process */
-  if(MSG_OK != MSG_process_suspend(process)) 
+  if (MSG_OK != MSG_process_suspend(process))
     jxbt_throw_native(env, xbt_strdup("MSG_process_suspend() failed"));
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processResume(JNIEnv* env, jclass cls, jobject jprocess) {
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processResume(JNIEnv * env, jclass cls,
+                                         jobject jprocess)
+{
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if(!process) { 
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
-       
+
   /* try to resume the process */
-  if(MSG_OK != MSG_process_resume(process))
+  if (MSG_OK != MSG_process_resume(process))
     jxbt_throw_native(env, xbt_strdup("MSG_process_resume() failed"));
 }
 
-JNIEXPORT jboolean JNICALL 
-Java_simgrid_msg_MsgNative_processIsSuspended(JNIEnv* env, jclass cls, jobject jprocess) {
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+JNIEXPORT jboolean JNICALL
+Java_simgrid_msg_MsgNative_processIsSuspended(JNIEnv * env, jclass cls,
+                                              jobject jprocess)
+{
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if(!process) { 
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return 0;
   }
 
   /* true is the process is suspended, false otherwise */
-  return (jboolean)MSG_process_is_suspended(process);
+  return (jboolean) MSG_process_is_suspended(process);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processKill(JNIEnv* env, jclass cls, jobject jprocess) {
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processKill(JNIEnv * env, jclass cls,
+                                       jobject jprocess)
+{
   /* get the native instances from the java ones */
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if(!process) { 
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
 
   /* delete the global reference */
-  jprocess_delete_global_ref(native_to_java_process(process),env);
-       
+  jprocess_delete_global_ref(native_to_java_process(process), env);
+
   /* kill the native process (this wrapper is call by the destructor of the java 
    * process instance)
    */
   MSG_process_kill(process);
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_processGetHost(JNIEnv* env, jclass cls, jobject jprocess) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_processGetHost(JNIEnv * env, jclass cls,
+                                          jobject jprocess)
+{
   /* get the native instances from the java ones */
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+  m_process_t process = jprocess_to_native_process(jprocess, env);
   m_host_t host;
-       
-  if(!process) { 
-    jxbt_throw_notbound(env,"process",jprocess);
+
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return NULL;
   }
 
   host = MSG_process_get_host(process);
-       
-  if(!host->data) {
+
+  if (!host->data) {
     jxbt_throw_native(env, xbt_strdup("MSG_process_get_host() failed"));
     return NULL;
   }
 
   /* return the global reference to the java host instance */
-  return (jobject)host->data;
-       
+  return (jobject) host->data;
+
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_processFromPID(JNIEnv* env, jclass cls, jint PID) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_processFromPID(JNIEnv * env, jclass cls, jint PID)
+{
   m_process_t process = MSG_process_from_PID(PID);
 
-  if(!process) {
-    jxbt_throw_process_not_found(env, bprintf("PID = %d",PID));
+  if (!process) {
+    jxbt_throw_process_not_found(env, bprintf("PID = %d", PID));
     return NULL;
   }
 
-  if(!native_to_java_process(process)) {
+  if (!native_to_java_process(process)) {
     jxbt_throw_native(env, xbt_strdup("SIMIX_process_get_jprocess() failed"));
     return NULL;
   }
 
-  return (jobject)(native_to_java_process(process));
+  return (jobject) (native_to_java_process(process));
 }
 
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_processGetPID(JNIEnv* env, jclass cls, jobject jprocess) {
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_processGetPID(JNIEnv * env, jclass cls,
+                                         jobject jprocess)
+{
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if(!process) { 
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return 0;
   }
 
-  return (jint)MSG_process_get_PID(process);   
+  return (jint) MSG_process_get_PID(process);
 }
 
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_processGetPPID(JNIEnv* env, jclass cls, jobject jprocess) {
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_processGetPPID(JNIEnv * env, jclass cls,
+                                          jobject jprocess)
+{
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if(!process) {
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return 0;
   }
 
-  return (jint)MSG_process_get_PPID(process);
+  return (jint) MSG_process_get_PPID(process);
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_processSelf(JNIEnv* env, jclass cls) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_processSelf(JNIEnv * env, jclass cls)
+{
   m_process_t process = MSG_process_self();
   jobject jprocess;
 
-  if(!process) {
+  if (!process) {
     jxbt_throw_native(env, xbt_strdup("MSG_process_self() failed"));
     return NULL;
   }
 
   jprocess = native_to_java_process(process);
 
-  if(!jprocess)
+  if (!jprocess)
     jxbt_throw_native(env, xbt_strdup("SIMIX_process_get_jprocess() failed"));
-  
+
   return jprocess;
 }
 
 
 JNIEXPORT jint JNICALL
-Java_simgrid_msg_MsgNative_processSelfPID(JNIEnv* env, jclass cls) {
-  return (jint)MSG_process_self_PID();
+Java_simgrid_msg_MsgNative_processSelfPID(JNIEnv * env, jclass cls)
+{
+  return (jint) MSG_process_self_PID();
 }
 
 
 JNIEXPORT jint JNICALL
-Java_simgrid_msg_MsgNative_processSelfPPID(JNIEnv* env, jclass cls) {
-  return (jint)MSG_process_self_PPID();
+Java_simgrid_msg_MsgNative_processSelfPPID(JNIEnv * env, jclass cls)
+{
+  return (jint) MSG_process_self_PPID();
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processChangeHost(JNIEnv* env, jclass cls, jobject jhost){
-  m_host_t host = jhost_get_native(env,jhost);
-       
-  if(!host) {
-    jxbt_throw_notbound(env,"host",jhost);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processChangeHost(JNIEnv * env, jclass cls,
+                                             jobject jhost)
+{
+  m_host_t host = jhost_get_native(env, jhost);
+
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return;
   }
 
   /* try to change the host of the process */
-  if(MSG_OK != MSG_process_change_host(host))
+  if (MSG_OK != MSG_process_change_host(host))
     jxbt_throw_native(env, xbt_strdup("MSG_process_change_host() failed"));
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processWaitFor(JNIEnv* env, jclass cls,jdouble seconds) {
-  if(MSG_OK != MSG_process_sleep((double)seconds))
-    jxbt_throw_native(env, 
-                      bprintf("MSG_process_change_host(%f) failed", (double)seconds));
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processWaitFor(JNIEnv * env, jclass cls,
+                                          jdouble seconds)
+{
+  if (MSG_OK != MSG_process_sleep((double) seconds))
+    jxbt_throw_native(env,
+                      bprintf("MSG_process_change_host(%f) failed",
+                              (double) seconds));
 }
 
 
@@ -333,143 +360,155 @@ Java_simgrid_msg_MsgNative_processWaitFor(JNIEnv* env, jclass cls,jdouble second
  * The MSG host connected functions implementation.                                    *
  ***************************************************************************************/
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_hostGetByName(JNIEnv* env, jclass cls, jstring jname) {
-  m_host_t host;               /* native host                                          */
-  jobject jhost;               /* global reference to the java host instance returned  */
-       
-  /* get the C string from the java string*/
-  const char* name = (*env)->GetStringUTFChars(env, jname, 0);
-       
-  /* get the host by name      (the hosts are created during the grid resolution) */
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_hostGetByName(JNIEnv * env, jclass cls,
+                                         jstring jname)
+{
+  m_host_t host;                /* native host                                          */
+  jobject jhost;                /* global reference to the java host instance returned  */
+
+  /* get the C string from the java string */
+  const char *name = (*env)->GetStringUTFChars(env, jname, 0);
+
+  /* get the host by name       (the hosts are created during the grid resolution) */
   host = MSG_get_host_by_name(name);
-  DEBUG2("MSG gave %p as native host (simdata=%p)",host,host->simdata);
-       
-  (*env)->ReleaseStringUTFChars(env, jname, name); 
+  DEBUG2("MSG gave %p as native host (simdata=%p)", host, host->simdata);
+
+  (*env)->ReleaseStringUTFChars(env, jname, name);
 
-  if(!host) {/* invalid name */
-    jxbt_throw_host_not_found(env,name);
+  if (!host) {                  /* invalid name */
+    jxbt_throw_host_not_found(env, name);
     return NULL;
   }
 
-  if(!host->data) { /* native host not associated yet with java host */
-               
+  if (!host->data) {            /* native host not associated yet with java host */
+
     /* instanciate a new java host */
     jhost = jhost_new_instance(env);
 
-    if(!jhost) {
-      jxbt_throw_jni(env,"java host instantiation failed");
+    if (!jhost) {
+      jxbt_throw_jni(env, "java host instantiation failed");
       return NULL;
     }
-               
+
     /* get a global reference to the newly created host */
-    jhost = jhost_ref(env,jhost);
+    jhost = jhost_ref(env, jhost);
 
-    if(!jhost) {
-      jxbt_throw_jni(env,"new global ref allocation failed");
+    if (!jhost) {
+      jxbt_throw_jni(env, "new global ref allocation failed");
       return NULL;
     }
-               
+
     /* bind the java host and the native host */
-    jhost_bind(jhost,host,env);
-               
+    jhost_bind(jhost, host, env);
+
     /* the native host data field is set with the global reference to the 
      * java host returned by this function 
      */
-    host->data = (void*)jhost;
+    host->data = (void *) jhost;
   }
 
   /* return the global reference to the java host instance */
-  return (jobject)host->data;                  
+  return (jobject) host->data;
 }
 
-JNIEXPORT jstring JNICALL 
-Java_simgrid_msg_MsgNative_hostGetName(JNIEnv* env, jclass cls, jobject jhost) {
-  m_host_t host = jhost_get_native(env,jhost);
+JNIEXPORT jstring JNICALL
+Java_simgrid_msg_MsgNative_hostGetName(JNIEnv * env, jclass cls,
+                                       jobject jhost)
+{
+  m_host_t host = jhost_get_native(env, jhost);
 
-  if(!host) {
-    jxbt_throw_notbound(env,"host",jhost);
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return NULL;
   }
 
-  return (*env)->NewStringUTF(env,host->name);
+  return (*env)->NewStringUTF(env, host->name);
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_hostGetNumber(JNIEnv* env, jclass cls) {
-  return (jint)MSG_get_host_number();
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_hostGetNumber(JNIEnv * env, jclass cls)
+{
+  return (jint) MSG_get_host_number();
 }
 
 JNIEXPORT jobject JNICALL
-Java_simgrid_msg_MsgNative_hostSelf(JNIEnv* env, jclass cls) {
+Java_simgrid_msg_MsgNative_hostSelf(JNIEnv * env, jclass cls)
+{
   jobject jhost;
-       
+
   m_host_t host = MSG_host_self();
-       
-  if(!host->data) {
+
+  if (!host->data) {
     /* the native host not yet associated with the java host instance */
-    
+
     /* instanciate a new java host instance */
     jhost = jhost_new_instance(env);
-    
-    if(!jhost) {
-      jxbt_throw_jni(env,"java host instantiation failed");
+
+    if (!jhost) {
+      jxbt_throw_jni(env, "java host instantiation failed");
       return NULL;
     }
-    
+
     /* get a global reference to the newly created host */
-    jhost = jhost_ref(env,jhost);
-    
-    if(!jhost) {
-      jxbt_throw_jni(env,"global ref allocation failed");
+    jhost = jhost_ref(env, jhost);
+
+    if (!jhost) {
+      jxbt_throw_jni(env, "global ref allocation failed");
       return NULL;
     }
 
     /* Bind & store it */
-    jhost_bind(jhost,host,env);
-    host->data = (void*)jhost;
+    jhost_bind(jhost, host, env);
+    host->data = (void *) jhost;
   } else {
-    jhost = (jobject)host->data;
+    jhost = (jobject) host->data;
   }
-       
+
   return jhost;
 }
 
-JNIEXPORT jdouble JNICALL 
-Java_simgrid_msg_MsgNative_hostGetSpeed(JNIEnv* env, jclass cls, jobject jhost) {
-  m_host_t host = jhost_get_native(env,jhost);
+JNIEXPORT jdouble JNICALL
+Java_simgrid_msg_MsgNative_hostGetSpeed(JNIEnv * env, jclass cls,
+                                        jobject jhost)
+{
+  m_host_t host = jhost_get_native(env, jhost);
 
-  if(!host) {
-    jxbt_throw_notbound(env,"host",jhost);
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return -1;
   }
-  
-  return (jdouble)MSG_get_host_speed(host);    
+
+  return (jdouble) MSG_get_host_speed(host);
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_hostGetLoad(JNIEnv* env, jclass cls, jobject jhost) {
-  m_host_t host = jhost_get_native(env,jhost);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_hostGetLoad(JNIEnv * env, jclass cls,
+                                       jobject jhost)
+{
+  m_host_t host = jhost_get_native(env, jhost);
 
-  if(!host) {
-    jxbt_throw_notbound(env,"host",jhost);
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return -1;
   }
 
-  return (jint)MSG_get_host_msgload(host);     
+  return (jint) MSG_get_host_msgload(host);
 }
 
 
-JNIEXPORT jboolean JNICALL 
-Java_simgrid_msg_MsgNative_hostIsAvail(JNIEnv* env, jclass cls, jobject jhost) {
-  m_host_t host = jhost_get_native(env,jhost);
-  
-  if(!host) {
-    jxbt_throw_notbound(env,"host",jhost);
+JNIEXPORT jboolean JNICALL
+Java_simgrid_msg_MsgNative_hostIsAvail(JNIEnv * env, jclass cls,
+                                       jobject jhost)
+{
+  m_host_t host = jhost_get_native(env, jhost);
+
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return 0;
   }
 
-  return (jboolean)MSG_host_is_avail(host);
+  return (jboolean) MSG_host_is_avail(host);
 }
 
 
@@ -477,58 +516,69 @@ Java_simgrid_msg_MsgNative_hostIsAvail(JNIEnv* env, jclass cls, jobject jhost) {
  * The MSG task connected functions implementation.                                    *
  ***************************************************************************************/
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskCreate(JNIEnv* env, jclass cls, jobject jtask, jstring jname, 
-                               jdouble jcomputeDuration, jdouble jmessageSize) {
-  m_task_t task;       /* the native task to create                            */
-  const char* name;    /* the name of the task                                 */
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskCreate(JNIEnv * env, jclass cls, jobject jtask,
+                                      jstring jname, jdouble jcomputeDuration,
+                                      jdouble jmessageSize)
+{
+  m_task_t task;                /* the native task to create                            */
+  const char *name;             /* the name of the task                                 */
 
-  if(jcomputeDuration < 0) {
-    jxbt_throw_illegal(env,bprintf("Task ComputeDuration (%f) cannot be negative",
-                                   (double)jcomputeDuration));
+  if (jcomputeDuration < 0) {
+    jxbt_throw_illegal(env,
+                       bprintf("Task ComputeDuration (%f) cannot be negative",
+                               (double) jcomputeDuration));
     return;
   }
 
-  if(jmessageSize < 0) {
-    jxbt_throw_illegal(env,bprintf("Task MessageSize (%f) cannot be negative",
-                                   (double)jmessageSize));
+  if (jmessageSize < 0) {
+    jxbt_throw_illegal(env,
+                       bprintf("Task MessageSize (%f) cannot be negative",
+                               (double) jmessageSize));
     return;
   }
 
-  if(!jname) {
-    jxbt_throw_null(env,xbt_strdup("Task name cannot be null"));
+  if (!jname) {
+    jxbt_throw_null(env, xbt_strdup("Task name cannot be null"));
     return;
   }
-       
-  /* get the C string from the java string*/
+
+  /* get the C string from the java string */
   name = (*env)->GetStringUTFChars(env, jname, 0);
-       
+
   /* create the task */
-  task = MSG_task_create(name,(double)jcomputeDuration,(double)jmessageSize,NULL);
-       
-  (*env)->ReleaseStringUTFChars(env, jname, name); 
-       
+  task =
+    MSG_task_create(name, (double) jcomputeDuration, (double) jmessageSize,
+                    NULL);
+
+  (*env)->ReleaseStringUTFChars(env, jname, name);
+
   /* bind & store the task */
-  jtask_bind(jtask,task,env);
+  jtask_bind(jtask, task, env);
 
-  /* allocate a new global reference to the java task instance */      
-  task->data = (void*)jtask_new_global_ref(jtask,env);
+  /* allocate a new global reference to the java task instance */
+  task->data = (void *) jtask_new_global_ref(jtask, env);
 
-  if ( ! task->data )
-    jxbt_throw_jni(env,"global ref allocation failed");
+  if (!task->data)
+    jxbt_throw_jni(env, "global ref allocation failed");
 
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv* env, jclass cls, jobject jtask, jstring jname, 
-                                        jobjectArray jhosts,jdoubleArray jcomputeDurations_arg, jdoubleArray jmessageSizes_arg) {
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv * env, jclass cls,
+                                               jobject jtask, jstring jname,
+                                               jobjectArray jhosts,
+                                               jdoubleArray
+                                               jcomputeDurations_arg,
+                                               jdoubleArray jmessageSizes_arg)
+{
 
-  m_task_t task;       /* the native parallel task to create           */
-  const char* name;    /* the name of the task                         */
+  m_task_t task;                /* the native parallel task to create           */
+  const char *name;             /* the name of the task                         */
   int host_count;
-  m_host_thosts;
-  doublecomputeDurations;
-  doublemessageSizes;
+  m_host_t *hosts;
+  double *computeDurations;
+  double *messageSizes;
   jdouble *jcomputeDurations;
   jdouble *jmessageSizes;
 
@@ -537,183 +587,208 @@ Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv* env, jclass cls, jobject
 
 
   if (!jcomputeDurations_arg) {
-    jxbt_throw_null(env,xbt_strdup("Parallel task compute durations cannot be null"));
+    jxbt_throw_null(env,
+                    xbt_strdup
+                    ("Parallel task compute durations cannot be null"));
     return;
   }
 
-  if(!jmessageSizes_arg){
-    jxbt_throw_null(env,xbt_strdup("Parallel task message sizes cannot be null"));
+  if (!jmessageSizes_arg) {
+    jxbt_throw_null(env,
+                    xbt_strdup("Parallel task message sizes cannot be null"));
     return;
   }
 
-  if(!jname) {
-    jxbt_throw_null(env,xbt_strdup("Parallel task name cannot be null"));
+  if (!jname) {
+    jxbt_throw_null(env, xbt_strdup("Parallel task name cannot be null"));
     return;
   }
 
-  host_count = (int)(*env)->GetArrayLength(env,jhosts);
-       
+  host_count = (int) (*env)->GetArrayLength(env, jhosts);
 
-  hosts = xbt_new0(m_host_t,host_count);
-  computeDurations = xbt_new0(double,host_count);
-  messageSizes = xbt_new0(double,host_count*host_count);
 
-  jcomputeDurations = (*env)->GetDoubleArrayElements(env,jcomputeDurations_arg, 0);
-  jmessageSizes = (*env)->GetDoubleArrayElements(env,jmessageSizes_arg, 0);
+  hosts = xbt_new0(m_host_t, host_count);
+  computeDurations = xbt_new0(double, host_count);
+  messageSizes = xbt_new0(double, host_count * host_count);
 
-  for(index = 0; index < host_count; index++) {
-    jhost = (*env)->GetObjectArrayElement(env,jhosts,index);
-    hosts[index] = jhost_get_native(env,jhost);
+  jcomputeDurations =
+    (*env)->GetDoubleArrayElements(env, jcomputeDurations_arg, 0);
+  jmessageSizes = (*env)->GetDoubleArrayElements(env, jmessageSizes_arg, 0);
+
+  for (index = 0; index < host_count; index++) {
+    jhost = (*env)->GetObjectArrayElement(env, jhosts, index);
+    hosts[index] = jhost_get_native(env, jhost);
     computeDurations[index] = jcomputeDurations[index];
   }
-  for(index = 0; index < host_count*host_count; index++) {
+  for (index = 0; index < host_count * host_count; index++) {
     messageSizes[index] = jmessageSizes[index];
-  }   
-   
-  (*env)->ReleaseDoubleArrayElements(env,jcomputeDurations_arg,jcomputeDurations,0);
-  (*env)->ReleaseDoubleArrayElements(env,jmessageSizes_arg,jmessageSizes,0);
+  }
 
-       
-  /* get the C string from the java string*/
+  (*env)->ReleaseDoubleArrayElements(env, jcomputeDurations_arg,
+                                     jcomputeDurations, 0);
+  (*env)->ReleaseDoubleArrayElements(env, jmessageSizes_arg, jmessageSizes,
+                                     0);
+
+
+  /* get the C string from the java string */
   name = (*env)->GetStringUTFChars(env, jname, 0);
-       
-  task = MSG_parallel_task_create(name,host_count,hosts,computeDurations,messageSizes,NULL);
 
-  (*env)->ReleaseStringUTFChars(env, jname, name); 
-       
+  task =
+    MSG_parallel_task_create(name, host_count, hosts, computeDurations,
+                             messageSizes, NULL);
+
+  (*env)->ReleaseStringUTFChars(env, jname, name);
+
   /* associate the java task object and the native task */
-  jtask_bind(jtask,task,env);
+  jtask_bind(jtask, task, env);
 
-  task->data = (void*)jtask;
+  task->data = (void *) jtask;
 
-  if (! task->data )
-    jxbt_throw_jni(env,"global ref allocation failed");
+  if (!task->data)
+    jxbt_throw_jni(env, "global ref allocation failed");
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_taskGetSender(JNIEnv* env , jclass cls , jobject jtask) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_taskGetSender(JNIEnv * env, jclass cls,
+                                         jobject jtask)
+{
   m_process_t process;
-       
-  m_task_t task = jtask_to_native_task(jtask,env);
-       
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+
+  m_task_t task = jtask_to_native_task(jtask, env);
+
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return NULL;
   }
-       
+
   process = MSG_task_get_sender(task);
-  return (jobject)native_to_java_process(process);
+  return (jobject) native_to_java_process(process);
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_taskGetSource(JNIEnv* env , jclass cls, jobject jtask) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_taskGetSource(JNIEnv * env, jclass cls,
+                                         jobject jtask)
+{
   m_host_t host;
-  m_task_t task = jtask_to_native_task(jtask,env);
+  m_task_t task = jtask_to_native_task(jtask, env);
 
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return NULL;
   }
-       
+
   host = MSG_task_get_source(task);
 
-  if(! host->data) {
+  if (!host->data) {
     jxbt_throw_native(env, xbt_strdup("MSG_task_get_source() failed"));
     return NULL;
   }
-       
-  return (jobject)host->data;  
+
+  return (jobject) host->data;
 }
 
 
-JNIEXPORT jstring JNICALL 
-Java_simgrid_msg_MsgNative_taskGetName(JNIEnv* env, jclass cls, jobject jtask) {
-  m_task_t task = jtask_to_native_task(jtask,env);
+JNIEXPORT jstring JNICALL
+Java_simgrid_msg_MsgNative_taskGetName(JNIEnv * env, jclass cls,
+                                       jobject jtask)
+{
+  m_task_t task = jtask_to_native_task(jtask, env);
 
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return NULL;
   }
 
-  return (*env)->NewStringUTF(env,task->name);         
+  return (*env)->NewStringUTF(env, task->name);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskCancel(JNIEnv* env, jclass cls, jobject jtask) {
-  m_task_t ptask = jtask_to_native_task(jtask,env);
-  if(!ptask){
-    jxbt_throw_notbound(env,"task",jtask);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskCancel(JNIEnv * env, jclass cls, jobject jtask)
+{
+  m_task_t ptask = jtask_to_native_task(jtask, env);
+
+  if (!ptask) {
+    jxbt_throw_notbound(env, "task", jtask);
     return;
   }
-       
-  if(MSG_OK != MSG_task_cancel(ptask))
+
+  if (MSG_OK != MSG_task_cancel(ptask))
     jxbt_throw_native(env, xbt_strdup("MSG_task_cancel() failed"));
 }
 
-JNIEXPORT jdouble JNICALL 
-Java_simgrid_msg_MsgNative_taskGetComputeDuration(JNIEnv* env, jclass cls, jobject jtask) {
-  m_task_t ptask = jtask_to_native_task(jtask,env);
+JNIEXPORT jdouble JNICALL
+Java_simgrid_msg_MsgNative_taskGetComputeDuration(JNIEnv * env, jclass cls,
+                                                  jobject jtask)
+{
+  m_task_t ptask = jtask_to_native_task(jtask, env);
 
-  if(!ptask){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!ptask) {
+    jxbt_throw_notbound(env, "task", jtask);
     return -1;
   }
-  return (jdouble)MSG_task_get_compute_duration(ptask);
+  return (jdouble) MSG_task_get_compute_duration(ptask);
 }
 
-JNIEXPORT jdouble JNICALL 
-Java_simgrid_msg_MsgNative_taskGetRemainingDuration(JNIEnv* env, jclass cls, jobject jtask) {
-  m_task_t ptask = jtask_to_native_task(jtask,env);
+JNIEXPORT jdouble JNICALL
+Java_simgrid_msg_MsgNative_taskGetRemainingDuration(JNIEnv * env, jclass cls,
+                                                    jobject jtask)
+{
+  m_task_t ptask = jtask_to_native_task(jtask, env);
 
-  if(!ptask){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!ptask) {
+    jxbt_throw_notbound(env, "task", jtask);
     return -1;
   }
-  return (jdouble)MSG_task_get_remaining_computation(ptask);
+  return (jdouble) MSG_task_get_remaining_computation(ptask);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskSetPriority(JNIEnv* env, jclass cls, jobject jtask, jdouble priority) {
-  m_task_t task = jtask_to_native_task(jtask,env);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskSetPriority(JNIEnv * env, jclass cls,
+                                           jobject jtask, jdouble priority)
+{
+  m_task_t task = jtask_to_native_task(jtask, env);
 
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return;
   }
-  MSG_task_set_priority(task,(double)priority);
+  MSG_task_set_priority(task, (double) priority);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskDestroy(JNIEnv* env, jclass cls, jobject jtask_arg) {
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskDestroy(JNIEnv * env, jclass cls,
+                                       jobject jtask_arg)
+{
 
   /* get the native task */
-  m_task_t task = jtask_to_native_task(jtask_arg,env);
+  m_task_t task = jtask_to_native_task(jtask_arg, env);
   jobject jtask;
 
-  if(!task){
-    jxbt_throw_notbound(env,"task",task);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", task);
     return;
   }
-  jtask = (jobject)task->data;
+  jtask = (jobject) task->data;
 
-  if(MSG_OK != MSG_task_destroy(task))
+  if (MSG_OK != MSG_task_destroy(task))
     jxbt_throw_native(env, xbt_strdup("MSG_task_destroy() failed"));
 
   /* delete the global reference to the java task object */
-  jtask_delete_global_ref(jtask,env);
+  jtask_delete_global_ref(jtask, env);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskExecute(JNIEnv* env, jclass cls, jobject jtask) {
-  m_task_t task = jtask_to_native_task(jtask,env);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskExecute(JNIEnv * env, jclass cls,
+                                       jobject jtask)
+{
+  m_task_t task = jtask_to_native_task(jtask, env);
 
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return;
   }
 
-  if(MSG_OK != MSG_task_execute(task))
+  if (MSG_OK != MSG_task_execute(task))
     jxbt_throw_native(env, xbt_strdup("MSG_task_execute() failed"));
 }
 
@@ -721,54 +796,62 @@ Java_simgrid_msg_MsgNative_taskExecute(JNIEnv* env, jclass cls, jobject jtask) {
  * The Task reception functions                                                        *
  ***************************************************************************************/
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_taskGet(JNIEnv* env, jclass cls, 
-                            jint chan_id, jdouble jtimeout, jobject jhost) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_taskGet(JNIEnv * env, jclass cls,
+                                   jint chan_id, jdouble jtimeout,
+                                   jobject jhost)
+{
   m_task_t task = NULL;
   m_host_t host = NULL;
-       
+
   if (jhost) {
-     host = jhost_get_native(env,jhost);
-     if(!host){
-       jxbt_throw_notbound(env,"host",jhost);
-       return NULL;
-     }  
-  }   
-   
-  if (MSG_OK != MSG_task_get_ext(&task,(int)chan_id,(double)jtimeout,host)) {
+    host = jhost_get_native(env, jhost);
+    if (!host) {
+      jxbt_throw_notbound(env, "host", jhost);
+      return NULL;
+    }
+  }
+
+  if (MSG_OK !=
+      MSG_task_get_ext(&task, (int) chan_id, (double) jtimeout, host)) {
     jxbt_throw_native(env, xbt_strdup("MSG_task_get_ext() failed"));
     return NULL;
   }
-       
-  return (jobject)task->data;
+
+  return (jobject) task->data;
 }
 
 
-JNIEXPORT jboolean JNICALL 
-Java_simgrid_msg_MsgNative_taskProbe(JNIEnv* env, jclass cls, jint chan_id) {
-  return (jboolean)MSG_task_Iprobe(chan_id);
+JNIEXPORT jboolean JNICALL
+Java_simgrid_msg_MsgNative_taskProbe(JNIEnv * env, jclass cls, jint chan_id)
+{
+  return (jboolean) MSG_task_Iprobe(chan_id);
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_taskGetCommunicatingProcess(JNIEnv* env, jclass cls, jint chan_id) {
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_taskGetCommunicatingProcess(JNIEnv * env,
+                                                       jclass cls,
+                                                       jint chan_id)
+{
   int pid = MSG_task_probe_from(chan_id);
-  if (pid>=0) 
-     return Java_simgrid_msg_MsgNative_processFromPID(env,cls,(jint)pid);
-  
+  if (pid >= 0)
+    return Java_simgrid_msg_MsgNative_processFromPID(env, cls, (jint) pid);
+
   return NULL;
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_taskProbeHost(JNIEnv* env, jclass cls, 
-                                  jobject jhost, jint chan_id) {
-  m_host_t host = jhost_get_native(env,jhost);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_taskProbeHost(JNIEnv * env, jclass cls,
+                                         jobject jhost, jint chan_id)
+{
+  m_host_t host = jhost_get_native(env, jhost);
 
-  if(!host){
-    jxbt_throw_notbound(env,"host",jhost);
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return -1;
   }
 
-  return (jint)MSG_task_probe_from_host(chan_id,host);
+  return (jint) MSG_task_probe_from_host(chan_id, host);
 }
 
 
@@ -777,174 +860,192 @@ Java_simgrid_msg_MsgNative_taskProbeHost(JNIEnv* env, jclass cls,
  ***************************************************************************************/
 
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_hostPut(JNIEnv* env, jclass cls, 
-                            jobject jhost, jint chan_id, jobject jtask, 
-                            jdouble jtimeout) {
-  m_task_t task = jtask_to_native_task(jtask,env);
-  m_host_t host = jhost_get_native(env,jhost);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_hostPut(JNIEnv * env, jclass cls,
+                                   jobject jhost, jint chan_id, jobject jtask,
+                                   jdouble jtimeout)
+{
+  m_task_t task = jtask_to_native_task(jtask, env);
+  m_host_t host = jhost_get_native(env, jhost);
 
-  if(!host){
-    jxbt_throw_notbound(env,"host",jhost);
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return;
   }
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return;
   }
-   
-  if(MSG_OK != MSG_task_put_with_timeout(task,host,(int)chan_id,(double)jtimeout))
+
+  if (MSG_OK !=
+      MSG_task_put_with_timeout(task, host, (int) chan_id, (double) jtimeout))
     jxbt_throw_native(env, xbt_strdup("MSG_task_put_with_timeout() failed"));
 }
 
 
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_hostPutBounded(JNIEnv* env, jclass cls, 
-                                   jobject jhost, jint chan_id, jobject jtask, 
-                                   jdouble jmaxRate) {
-  m_task_t task = jtask_to_native_task(jtask,env);
-  m_host_t host = jhost_get_native(env,jhost);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_hostPutBounded(JNIEnv * env, jclass cls,
+                                          jobject jhost, jint chan_id,
+                                          jobject jtask, jdouble jmaxRate)
+{
+  m_task_t task = jtask_to_native_task(jtask, env);
+  m_host_t host = jhost_get_native(env, jhost);
 
-  if(!host){
-    jxbt_throw_notbound(env,"host",jhost);
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return;
   }
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return;
   }
-        
-  if(MSG_OK != MSG_task_put_bounded(task,host,(int)chan_id,(double)jmaxRate))
+
+  if (MSG_OK !=
+      MSG_task_put_bounded(task, host, (int) chan_id, (double) jmaxRate))
     jxbt_throw_native(env, xbt_strdup("MSG_task_put_bounded() failed"));
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_Msg_getErrCode(JNIEnv* env, jclass cls) {
-  return (jint)MSG_get_errno();
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_Msg_getErrCode(JNIEnv * env, jclass cls)
+{
+  return (jint) MSG_get_errno();
 }
 
-JNIEXPORT jdouble JNICALL 
-Java_simgrid_msg_Msg_getClock(JNIEnv* env, jclass cls) {
-  return (jdouble)MSG_get_clock();
+JNIEXPORT jdouble JNICALL
+Java_simgrid_msg_Msg_getClock(JNIEnv * env, jclass cls)
+{
+  return (jdouble) MSG_get_clock();
 }
 
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_init(JNIEnv* env, jclass cls, jobjectArray jargs) {
-       
-  char** argv = NULL;
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs)
+{
+
+  char **argv = NULL;
   int index;
   int argc = 0;
   jstring jval;
-  const chartmp;
-       
-  if(jargs)
-    argc = (int)(*env)->GetArrayLength(env,jargs);
+  const char *tmp;
+
+  if (jargs)
+    argc = (int) (*env)->GetArrayLength(env, jargs);
 
   argc++;
-       
-  argv = xbt_new0(char*, argc);
-        
+
+  argv = xbt_new0(char *, argc);
+
   argv[0] = strdup("java");
-       
-  for(index = 0; index < argc -1; index++) {
-    jval = (jstring)(*env)->GetObjectArrayElement(env,jargs,index);
-    
+
+  for (index = 0; index < argc - 1; index++) {
+    jval = (jstring) (*env)->GetObjectArrayElement(env, jargs, index);
+
     tmp = (*env)->GetStringUTFChars(env, jval, 0);
-    
-    argv[index +1] = strdup(tmp);
 
-    (*env)->ReleaseStringUTFChars(env, jval, tmp); 
+    argv[index + 1] = strdup(tmp);
+
+    (*env)->ReleaseStringUTFChars(env, jval, tmp);
   }
-       
-  MSG_global_init(&argc,argv);
-  MSG_set_channel_number(10); /* FIXME: this should not be fixed statically */
 
-  for(index = 0; index < argc; index++)
+  MSG_global_init(&argc, argv);
+  MSG_set_channel_number(10);   /* FIXME: this should not be fixed statically */
+
+  for (index = 0; index < argc; index++)
     free(argv[index]);
-       
+
   free(argv);
 
(*env)->GetJavaVM(env,&__java_vm);
-       
 (*env)->GetJavaVM(env, &__java_vm);
+
 }
 
 JNIEXPORT void JNICALL
-JNICALL Java_simgrid_msg_Msg_run(JNIEnv* env, jclass cls) {
+  JNICALL Java_simgrid_msg_Msg_run(JNIEnv * env, jclass cls)
+{
   xbt_fifo_item_t item = NULL;
   m_host_t host = NULL;
   jobject jhost;
 
   /* Run everything */
-  if(MSG_OK != MSG_main())
-         jxbt_throw_native(env, xbt_strdup("MSG_main() failed"));
-       
-  DEBUG0("MSG_main finished. Bail out before cleanup since there is a bug in this part.");
-  
+  if (MSG_OK != MSG_main())
+    jxbt_throw_native(env, xbt_strdup("MSG_main() failed"));
+
+  DEBUG0
+    ("MSG_main finished. Bail out before cleanup since there is a bug in this part.");
+
   DEBUG0("Clean java world");
   /* Cleanup java hosts */
-  xbt_fifo_foreach(msg_global->host,item,host,m_host_t) {
-    jhost = (jobject)host->data;
-       
-    if(jhost)
-      jhost_unref(env,jhost);
+  xbt_fifo_foreach(msg_global->host, item, host, m_host_t) {
+    jhost = (jobject) host->data;
+
+    if (jhost)
+      jhost_unref(env, jhost);
   }
-       
+
   DEBUG0("Clean native world");
   /* cleanup native stuff */
-  if(MSG_OK != MSG_clean())
+  if (MSG_OK != MSG_clean())
     jxbt_throw_native(env, xbt_strdup("MSG_main() failed"));
 
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_processKillAll(JNIEnv* env, jclass cls, jint jresetPID) {
-  return (jint)MSG_process_killall((int)jresetPID);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_processKillAll(JNIEnv * env, jclass cls,
+                                          jint jresetPID)
+{
+  return (jint) MSG_process_killall((int) jresetPID);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_createEnvironment(JNIEnv* env, jclass cls,jstring jplatformFile) {
-       
-  const char* platformFile = (*env)->GetStringUTFChars(env, jplatformFile, 0);
-       
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls,
+                                       jstring jplatformFile)
+{
+
+  const char *platformFile = (*env)->GetStringUTFChars(env, jplatformFile, 0);
+
   MSG_create_environment(platformFile);
-       
-  (*env)->ReleaseStringUTFChars(env, jplatformFile, platformFile); 
+
+  (*env)->ReleaseStringUTFChars(env, jplatformFile, platformFile);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processExit(JNIEnv* env, jclass cls, jobject jprocess) {
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processExit(JNIEnv * env, jclass cls,
+                                       jobject jprocess)
+{
 
-  m_process_t process = jprocess_to_native_process(jprocess,env);
+  m_process_t process = jprocess_to_native_process(jprocess, env);
 
-  if (!process){
-    jxbt_throw_notbound(env,"process",jprocess);
+  if (!process) {
+    jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
 
   xbt_context_stop(0);
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_pajeOutput(JNIEnv* env, jclass cls, jstring jpajeFile) {
-  const char*pajeFile = (*env)->GetStringUTFChars(env, jpajeFile, 0);
-       
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_pajeOutput(JNIEnv * env, jclass cls, jstring jpajeFile)
+{
+  const char *pajeFile = (*env)->GetStringUTFChars(env, jpajeFile, 0);
+
   MSG_paje_output(pajeFile);
-       
-  (*env)->ReleaseStringUTFChars(env, jpajeFile, pajeFile); 
+
+  (*env)->ReleaseStringUTFChars(env, jpajeFile, pajeFile);
 }
 
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_info(JNIEnv * env, jclass cls, jstring js) {
-  const char* s = (*env)->GetStringUTFChars(env,js,0);
-  INFO1("%s",s);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_info(JNIEnv * env, jclass cls, jstring js)
+{
+  const char *s = (*env)->GetStringUTFChars(env, js, 0);
+  INFO1("%s", s);
   (*env)->ReleaseStringUTFChars(env, js, s);
 }
 
 JNIEXPORT jobjectArray JNICALL
-Java_simgrid_msg_MsgNative_allHosts(JNIEnv * env, jclass cls_arg) {
+Java_simgrid_msg_MsgNative_allHosts(JNIEnv * env, jclass cls_arg)
+{
   int index;
   jobjectArray jtable;
   jobject jhost;
@@ -952,32 +1053,32 @@ Java_simgrid_msg_MsgNative_allHosts(JNIEnv * env, jclass cls_arg) {
   m_host_t host;
 
   int count = xbt_fifo_size(msg_global->host);
-  m_host_t* table = (m_host_t *)xbt_fifo_to_array(msg_global->host);
-       
-  jclass cls = jxbt_get_class(env,"simgrid/msg/Host");
-       
-  if(!cls){
+  m_host_t *table = (m_host_t *) xbt_fifo_to_array(msg_global->host);
+
+  jclass cls = jxbt_get_class(env, "simgrid/msg/Host");
+
+  if (!cls) {
     return NULL;
   }
 
-  jtable = (*env)->NewObjectArray(env,(jsize)count,cls,NULL);
-       
-  if(!jtable) {
-    jxbt_throw_jni(env,"Hosts table allocation failed");
+  jtable = (*env)->NewObjectArray(env, (jsize) count, cls, NULL);
+
+  if (!jtable) {
+    jxbt_throw_jni(env, "Hosts table allocation failed");
     return NULL;
   }
-       
-  for(index = 0; index < count; index++) {
+
+  for (index = 0; index < count; index++) {
     host = table[index];
-    jhost = (jobject)(host->data);
-    
-    if(!jhost) {
-      jname = (*env)->NewStringUTF(env,host->name);
-      
-      jhost = Java_simgrid_msg_MsgNative_hostGetByName(env,cls_arg,jname);
+    jhost = (jobject) (host->data);
+
+    if (!jhost) {
+      jname = (*env)->NewStringUTF(env, host->name);
+
+      jhost = Java_simgrid_msg_MsgNative_hostGetByName(env, cls_arg, jname);
       /* FIXME: leak of jname ? */
     }
-    
+
     (*env)->SetObjectArrayElement(env, jtable, index, jhost);
   }
 
@@ -985,188 +1086,204 @@ Java_simgrid_msg_MsgNative_allHosts(JNIEnv * env, jclass cls_arg) {
 }
 
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_selectContextFactory(JNIEnv * env, jclass class,jstring jname)
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_selectContextFactory(JNIEnv * env, jclass class,
+                                                jstring jname)
 {
-   char *errmsg = NULL;
-   xbt_ex_t e;
-       
-   /* get the C string from the java string*/
-   const char* name = (*env)->GetStringUTFChars(env, jname, 0);
-
-   TRY {
-      xbt_context_select_factory(name);
-   } CATCH(e) {
-      errmsg = xbt_strdup(e.msg);
-      xbt_ex_free(e);
-   }
-   
-   (*env)->ReleaseStringUTFChars(env, jname, name);
-       
-   if(errmsg) {
-      char *thrown = bprintf("xbt_select_context_factory() failed: %s",errmsg);
-      free(errmsg);
-      jxbt_throw_native(env, thrown);
-   }   
+  char *errmsg = NULL;
+  xbt_ex_t e;
+
+  /* get the C string from the java string */
+  const char *name = (*env)->GetStringUTFChars(env, jname, 0);
+
+  TRY {
+    xbt_context_select_factory(name);
+  } CATCH(e) {
+    errmsg = xbt_strdup(e.msg);
+    xbt_ex_free(e);
+  }
+
+  (*env)->ReleaseStringUTFChars(env, jname, name);
+
+  if (errmsg) {
+    char *thrown = bprintf("xbt_select_context_factory() failed: %s", errmsg);
+    free(errmsg);
+    jxbt_throw_native(env, thrown);
+  }
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskSend(JNIEnv* env, jclass cls, 
-                            jstring jalias, jobject jtask, 
-                            jdouble jtimeout) {
-       
-       MSG_error_t rv;
-       const char* alias = (*env)->GetStringUTFChars(env, jalias, 0);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskSend(JNIEnv * env, jclass cls,
+                                    jstring jalias, jobject jtask,
+                                    jdouble jtimeout)
+{
+
+  MSG_error_t rv;
+  const char *alias = (*env)->GetStringUTFChars(env, jalias, 0);
+
+  m_task_t task = jtask_to_native_task(jtask, env);
 
-       m_task_t task = jtask_to_native_task(jtask,env);
 
-       
-       if(!task){
-               (*env)->ReleaseStringUTFChars(env, jalias, alias);
-               jxbt_throw_notbound(env,"task",jtask);
-               return;
-       }
+  if (!task) {
+    (*env)->ReleaseStringUTFChars(env, jalias, alias);
+    jxbt_throw_notbound(env, "task", jtask);
+    return;
+  }
 
-       rv = MSG_task_send_with_timeout(task,alias,(double)jtimeout);
+  rv = MSG_task_send_with_timeout(task, alias, (double) jtimeout);
 
-       (*env)->ReleaseStringUTFChars(env, jalias, alias);
+  (*env)->ReleaseStringUTFChars(env, jalias, alias);
 
-       if(MSG_OK != rv)
-               jxbt_throw_native(env, xbt_strdup("MSG_task_send_with_timeout() failed"));
+  if (MSG_OK != rv)
+    jxbt_throw_native(env, xbt_strdup("MSG_task_send_with_timeout() failed"));
 
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv* env, jclass cls, 
-                                   jstring jalias, jobject jtask, 
-                                   jdouble jmaxRate) {
-  m_task_t task = jtask_to_native_task(jtask,env);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv * env, jclass cls,
+                                           jstring jalias, jobject jtask,
+                                           jdouble jmaxRate)
+{
+  m_task_t task = jtask_to_native_task(jtask, env);
   MSG_error_t rv;
-  const charalias;
+  const char *alias;
 
-  if(!task){
-    jxbt_throw_notbound(env,"task",jtask);
+  if (!task) {
+    jxbt_throw_notbound(env, "task", jtask);
     return;
   }
-  
+
   alias = (*env)->GetStringUTFChars(env, jalias, 0);
-       
-  rv = MSG_task_send_bounded(task,alias,(double)jmaxRate);
-  
+
+  rv = MSG_task_send_bounded(task, alias, (double) jmaxRate);
+
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
-   
-  if(MSG_OK != rv)
+
+  if (MSG_OK != rv)
     jxbt_throw_native(env, xbt_strdup("MSG_task_send_bounded() failed"));
 }
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_taskReceive(JNIEnv* env, jclass cls, 
-                            jstring jalias, jdouble jtimeout, jobject jhost) {
-       MSG_error_t rv;
-       m_task_t task = NULL;
-       m_host_t host = NULL;
-       const char* alias;
-
-       if (jhost) {
-               host = jhost_get_native(env,jhost);
-               
-               if(!host){
-                       jxbt_throw_notbound(env,"host",jhost);
-                       return NULL;
-               }  
-       } 
-
-       alias = (*env)->GetStringUTFChars(env, jalias, 0);
-
-       rv = MSG_task_receive_ext(&task,alias,(double)jtimeout,host);   
-
-       (*env)->ReleaseStringUTFChars(env, jalias, alias);
-       
-       if (MSG_OK != rv) 
-       {
-               jxbt_throw_native(env, xbt_strdup("MSG_task_receive_ext() failed"));
-               return NULL;
-       }
-
-       return (jobject)task->data;
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_taskReceive(JNIEnv * env, jclass cls,
+                                       jstring jalias, jdouble jtimeout,
+                                       jobject jhost)
+{
+  MSG_error_t rv;
+  m_task_t task = NULL;
+  m_host_t host = NULL;
+  const char *alias;
+
+  if (jhost) {
+    host = jhost_get_native(env, jhost);
+
+    if (!host) {
+      jxbt_throw_notbound(env, "host", jhost);
+      return NULL;
+    }
+  }
+
+  alias = (*env)->GetStringUTFChars(env, jalias, 0);
+
+  rv = MSG_task_receive_ext(&task, alias, (double) jtimeout, host);
+
+  (*env)->ReleaseStringUTFChars(env, jalias, alias);
+
+  if (MSG_OK != rv) {
+    jxbt_throw_native(env, xbt_strdup("MSG_task_receive_ext() failed"));
+    return NULL;
+  }
+
+  return (jobject) task->data;
 }
 
-JNIEXPORT jboolean JNICALL 
-Java_simgrid_msg_MsgNative_taskListen(JNIEnv* env, jclass cls, jstring jalias) {
-       
-  const char* alias;
+JNIEXPORT jboolean JNICALL
+Java_simgrid_msg_MsgNative_taskListen(JNIEnv * env, jclass cls,
+                                      jstring jalias)
+{
+
+  const char *alias;
   int rv;
-  
+
   alias = (*env)->GetStringUTFChars(env, jalias, 0);
-  
+
   rv = MSG_task_listen(alias);
-  
+
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
-  
-  return (jboolean)rv;
+
+  return (jboolean) rv;
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv* env, jclass cls, jstring jalias, jobject jhost) {
-  
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv * env, jclass cls,
+                                              jstring jalias, jobject jhost)
+{
+
   int rv;
-  const char* alias;
-  
-  m_host_t host = jhost_get_native(env,jhost);
+  const char *alias;
 
-  if(!host){
-    jxbt_throw_notbound(env,"host",jhost);
+  m_host_t host = jhost_get_native(env, jhost);
+
+  if (!host) {
+    jxbt_throw_notbound(env, "host", jhost);
     return -1;
   }
-  
+
   alias = (*env)->GetStringUTFChars(env, jalias, 0);
 
-  rv = MSG_task_listen_from_host(alias,host);
-  
+  rv = MSG_task_listen_from_host(alias, host);
+
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
-  
-  return (jint)rv;
+
+  return (jint) rv;
 }
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv* env, jclass cls, jstring jalias) {
-  
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv * env, jclass cls,
+                                          jstring jalias)
+{
+
   int rv;
-  const charalias = (*env)->GetStringUTFChars(env, jalias, 0);
+  const char *alias = (*env)->GetStringUTFChars(env, jalias, 0);
 
   rv = MSG_task_listen_from(alias);
-  
+
   (*env)->ReleaseStringUTFChars(env, jalias, alias);
-  
-  return (jint)rv;
+
+  return (jint) rv;
 }
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_deployApplication(JNIEnv* env, jclass cls,jstring jdeploymentFile) {
-       
-       const char* deploymentFile = (*env)->GetStringUTFChars(env, jdeploymentFile, 0);
-       
-       surf_parse_reset_parser();
-       
-       surfxml_add_callback(STag_surfxml_process_cb_list, japplication_handler_on_begin_process);
-       
-       surfxml_add_callback(ETag_surfxml_argument_cb_list, japplication_handler_on_process_arg);
-       
-       surfxml_add_callback(STag_surfxml_prop_cb_list, japplication_handler_on_property);
-       
-       surfxml_add_callback(ETag_surfxml_process_cb_list, japplication_handler_on_end_process);
-
-       surf_parse_open(deploymentFile);
-       
-       japplication_handler_on_start_document();
-       
-       if(surf_parse())
-               jxbt_throw_native(env, xbt_strdup("surf_parse() failed"));
-       
-       surf_parse_close();
-       
-       japplication_handler_on_end_document();
-       
-  (*env)->ReleaseStringUTFChars(env, jdeploymentFile, deploymentFile); 
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls,
+                                       jstring jdeploymentFile)
+{
+
+  const char *deploymentFile =
+    (*env)->GetStringUTFChars(env, jdeploymentFile, 0);
+
+  surf_parse_reset_parser();
+
+  surfxml_add_callback(STag_surfxml_process_cb_list,
+                       japplication_handler_on_begin_process);
+
+  surfxml_add_callback(ETag_surfxml_argument_cb_list,
+                       japplication_handler_on_process_arg);
+
+  surfxml_add_callback(STag_surfxml_prop_cb_list,
+                       japplication_handler_on_property);
+
+  surfxml_add_callback(ETag_surfxml_process_cb_list,
+                       japplication_handler_on_end_process);
+
+  surf_parse_open(deploymentFile);
+
+  japplication_handler_on_start_document();
+
+  if (surf_parse())
+    jxbt_throw_native(env, xbt_strdup("surf_parse() failed"));
+
+  surf_parse_close();
+
+  japplication_handler_on_end_document();
+
+  (*env)->ReleaseStringUTFChars(env, jdeploymentFile, deploymentFile);
 }
-  
index 5d80fc0..a135716 100644 (file)
 
 #include <jni.h>
 
-JavaVM *
-get_java_VM(void);
+JavaVM *get_java_VM(void);
 
-JNIEnv *
-get_current_thread_env(void);
+JNIEnv *get_current_thread_env(void);
 
 /*
  * Class               simgrid_msg_Msg
  * Method              processCreate
  * Signature   (Lsimgrid/msg/Process;Lsimgrid/msg/Host;)V
  */
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processCreate(JNIEnv* env,jclass cls,jobject jprocess,jobject jhost);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processCreate(JNIEnv * env, jclass cls,
+                                         jobject jprocess, jobject jhost);
 
 
 
@@ -36,8 +35,9 @@ Java_simgrid_msg_MsgNative_processCreate(JNIEnv* env,jclass cls,jobject jprocess
  * Method              processSuspend
  * Signature   (Lsimgrid/msg/Process;)V
  */
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_processSuspend(JNIEnv* env, jclass cls, jobject jprocess);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_processSuspend(JNIEnv * env, jclass cls,
+                                          jobject jprocess);
 
 /*
  * Class               simgrid_msg_Msg
@@ -175,8 +175,9 @@ JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_hostSelf
 JNIEXPORT jdouble JNICALL Java_simgrid_msg_MsgNative_hostGetSpeed
   (JNIEnv *, jclass, jobject);
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_hostGetLoad(JNIEnv* env, jclass cls, jobject jhost);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_hostGetLoad(JNIEnv * env, jclass cls,
+                                       jobject jhost);
 
 /*
  * Class               simgrid_msg_Msg
@@ -194,8 +195,10 @@ JNIEXPORT jboolean JNICALL Java_simgrid_msg_MsgNative_hostIsAvail
 JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskCreate
   (JNIEnv *, jclass, jobject, jstring, jdouble, jdouble);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv*, jclass, jobject, jstring, jobjectArray,jdoubleArray, jdoubleArray);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_parallel_taskCreate(JNIEnv *, jclass, jobject,
+                                               jstring, jobjectArray,
+                                               jdoubleArray, jdoubleArray);
 
 /*
  * Class               simgrid_msg_Msg
@@ -277,8 +280,8 @@ JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_taskExecute
 JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_taskGet
   (JNIEnv *, jclass, jint, jdouble, jobject);
 
-JNIEXPORT jobject JNICALL 
-Java_simgrid_msg_MsgNative_taskReceive
+JNIEXPORT jobject JNICALL
+  Java_simgrid_msg_MsgNative_taskReceive
   (JNIEnv *, jclass, jstring, jdouble, jobject);
 
 /*
@@ -294,8 +297,9 @@ JNIEXPORT jboolean JNICALL Java_simgrid_msg_MsgNative_taskProbe
  * Method              taskGetCommunicatingProcess
  * Signature   (I)Lsimgrid/msg/Process;
  */
-JNIEXPORT jobject JNICALL Java_simgrid_msg_MsgNative_taskGetCommunicatingProcess
-  (JNIEnv *, jclass, jint);
+JNIEXPORT jobject JNICALL
+Java_simgrid_msg_MsgNative_taskGetCommunicatingProcess(JNIEnv *, jclass,
+                                                       jint);
 
 /*
  * Class               simgrid_msg_Msg
@@ -313,8 +317,8 @@ JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_taskProbeHost
 JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_hostPut
   (JNIEnv *, jclass, jobject, jint, jobject, jdouble);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskSend
+JNIEXPORT void JNICALL
+  Java_simgrid_msg_MsgNative_taskSend
   (JNIEnv *, jclass, jstring, jobject, jdouble);
 
 /*
@@ -330,22 +334,20 @@ JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_hostPutBounded
  * Method              getErrCode
  * Signature   ()I
  */
-JNIEXPORT jint JNICALL Java_simgrid_msg_Msg_getErrCode
-  (JNIEnv *, jclass);
+JNIEXPORT jint JNICALL Java_simgrid_msg_Msg_getErrCode(JNIEnv *, jclass);
 
 /*
  * Class               simgrid_msg_Msg
  * Method              getClock
  * Signature   ()D
  */
-JNIEXPORT jdouble JNICALL Java_simgrid_msg_Msg_getClock
-  (JNIEnv *, jclass);
+JNIEXPORT jdouble JNICALL Java_simgrid_msg_Msg_getClock(JNIEnv *, jclass);
 
 JNIEXPORT void JNICALL
-JNICALL Java_simgrid_msg_Msg_run(JNIEnv* env, jclass cls);
+  JNICALL Java_simgrid_msg_Msg_run(JNIEnv * env, jclass cls);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_init(JNIEnv* env, jclass cls, jobjectArray jargs);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs);
 
 /*
  * Class               simgrid_msg_Msg
@@ -363,34 +365,37 @@ JNIEXPORT jint JNICALL Java_simgrid_msg_MsgNative_processKillAll
 JNIEXPORT void JNICALL Java_simgrid_msg_MsgNative_processExit
   (JNIEnv *, jclass, jobject);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_pajeOutput(JNIEnv* env, jclass cls, jstring jpajeFile);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_pajeOutput(JNIEnv * env, jclass cls, jstring jpajeFile);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_info(JNIEnv * , jclass , jstring );
+JNIEXPORT void JNICALL Java_simgrid_msg_Msg_info(JNIEnv *, jclass, jstring);
 
 JNIEXPORT jobjectArray JNICALL
-Java_simgrid_msg_MsgNative_allHosts(JNIEnv * , jclass );
+Java_simgrid_msg_MsgNative_allHosts(JNIEnv *, jclass);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_createEnvironment(JNIEnv* env, jclass cls,jstring jplatformFile);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls,
+                                       jstring jplatformFile);
 
-JNIEXPORT void JNICALL 
+JNIEXPORT void JNICALL
 Java_simgrid_msg_MsgNative_selectContextFactory(JNIEnv *, jclass, jstring);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv*, jclass, jstring, jobject, jdouble);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_MsgNative_taskSendBounded(JNIEnv *, jclass, jstring, jobject,
+                                           jdouble);
 
-JNIEXPORT jboolean JNICALL 
-Java_simgrid_msg_MsgNative_taskListen(JNIEnv*, jclass, jstring);
+JNIEXPORT jboolean JNICALL
+Java_simgrid_msg_MsgNative_taskListen(JNIEnv *, jclass, jstring);
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv*, jclass, jstring, jobject);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv *, jclass, jstring,
+                                              jobject);
 
-JNIEXPORT jint JNICALL 
-Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv*, jclass, jstring);
+JNIEXPORT jint JNICALL
+Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv *, jclass, jstring);
 
-JNIEXPORT void JNICALL 
-Java_simgrid_msg_Msg_deployApplication(JNIEnv* env, jclass cls,jstring jdeploymentFile);
+JNIEXPORT void JNICALL
+Java_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls,
+                                       jstring jdeploymentFile);
 
-#endif /* !MSG4JAVA_H */ 
+#endif /* !MSG4JAVA_H */
index c2c2105..d9f4de7 100644 (file)
 #include "jmsg_application_handler.h"\r
 \r
 #include "jmsg.h"\r
-\r
+  \r
 #include "surf/surfxml_parse.h"\r
 #include "jxbt_utilities.h"\r
+\r\r\r\rvoid \rjapplication_handler_on_start_document(void) \r
+{
+  \rjclass cls;
+  \rJNIEnv * env = get_current_thread_env();
+  \r\rjmethodID id =
+    jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler",
+                            "onStartDocument", "()V");
+  \r\rif (!id || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler")))
+    \rreturn;
+  \r\r(*env)->CallStaticVoidMethod(env, cls, id);
+\r}
+
+\r\rvoid \rjapplication_handler_on_end_document(void) \r
+{
+  \rjclass cls;
+  \rJNIEnv * env = get_current_thread_env();
+  \r\rjmethodID id =
+    jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler",
+                            "onEndDocument", "()V");
+  \r\rif (!id || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler")))
+    \rreturn;
+  \r\r(*env)->CallStaticVoidMethod(env, cls, id);
+\r}
+
+\r\rvoid \rjapplication_handler_on_begin_process(void) \r
+{
+  \rjstring jhostName;
+  \rjstring jfunction;
+  \rjclass cls;
+  \rJNIEnv * env = get_current_thread_env();
+  \r\rjmethodID id =
+    jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler",
+                            "onBeginProcess",
+                            "(Ljava/lang/String;Ljava/lang/String;)V");
+  \r\rif (!id || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler")))
+    \rreturn;
+  \r\rjhostName = (jstring) (*env)->NewStringUTF(env, A_surfxml_process_host);
+  \rjfunction =
+    (jstring) (*env)->NewStringUTF(env, A_surfxml_process_function);
+  \r\r(*env)->CallStaticVoidMethod(env, cls, id, jhostName, jfunction);
+\r}
+
+\r\rvoid \rjapplication_handler_on_process_arg(void) \r
+{
+  \rjstring jarg;
+  \rjclass cls;
+  \rJNIEnv * env = get_current_thread_env();
+  \r\rjmethodID id =
+    jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler",
+                            "onProcessArg", "(Ljava/lang/String;)V");
+  \r\rif (!id || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler")))
+    \rreturn;
+  \r\rjarg = (jstring) (*env)->NewStringUTF(env, A_surfxml_argument_value);
+  \r\r(*env)->CallStaticVoidMethod(env, cls, id, jarg);
+\r}
+
+\r\rvoid \rjapplication_handler_on_property(void) \r
+{
+  \rjstring jid;
+  \rjstring jvalue;
+  \rjclass cls;
+  \rJNIEnv * env = get_current_thread_env();
+  \r\rjmethodID id =
+    jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler",
+                            "onProperty",
+                            "(Ljava/lang/String;Ljava/lang/String;)V");
+  \r\rif (!id || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler")))
+    \rreturn;
+  \r\rjid = (jstring) (*env)->NewStringUTF(env, A_surfxml_prop_id);
+  \rjvalue = (jstring) (*env)->NewStringUTF(env, A_surfxml_prop_value);
+  \r\r(*env)->CallStaticVoidMethod(env, cls, id, jid, jvalue);
+\r}
+
+\r\rvoid \rjapplication_handler_on_end_process(void) \r
+{
+  \rJNIEnv * env = get_current_thread_env();
+  \rjclass cls;
+  \rjmethodID id =
+    jxbt_get_static_smethod(env, "simgrid/msg/ApplicationHandler",
+                            "onEndProcess", "()V");
+  \r\rif (!id || !(cls = jxbt_get_class(env, "simgrid/msg/ApplicationHandler")))
+    \rreturn;
+  \r\r(*env)->CallStaticVoidMethod(env, cls, id);
+\r}
+
 \r
-\r
-\r
-\r
-void\r
-japplication_handler_on_start_document(void)\r
-{\r
-       jclass cls;\r
-       JNIEnv * env = get_current_thread_env();\r
-       \r
-       jmethodID id = jxbt_get_static_smethod(env,"simgrid/msg/ApplicationHandler","onStartDocument", "()V") ;\r
-       \r
-       if(!id || !(cls = jxbt_get_class(env , "simgrid/msg/ApplicationHandler")))\r
-               return;\r
-       \r
-       (*env)->CallStaticVoidMethod(env, cls, id);             \r
-}\r
-\r
-void\r
-japplication_handler_on_end_document(void)\r
-{\r
-       jclass cls;\r
-       JNIEnv * env = get_current_thread_env();\r
-       \r
-       jmethodID id = jxbt_get_static_smethod(env,"simgrid/msg/ApplicationHandler","onEndDocument", "()V") ;\r
-       \r
-       if(!id || !(cls = jxbt_get_class(env , "simgrid/msg/ApplicationHandler")))\r
-               return;\r
-       \r
-       (*env)->CallStaticVoidMethod(env, cls, id);             \r
-}\r
-\r
-void\r
-japplication_handler_on_begin_process(void)\r
-{\r
-       jstring jhostName;\r
-       jstring jfunction;\r
-       jclass cls;\r
-       JNIEnv * env = get_current_thread_env();\r
-       \r
-       jmethodID id = jxbt_get_static_smethod(env,"simgrid/msg/ApplicationHandler","onBeginProcess", "(Ljava/lang/String;Ljava/lang/String;)V") ;\r
-       \r
-       if(!id || !(cls = jxbt_get_class(env , "simgrid/msg/ApplicationHandler")))\r
-               return;\r
-               \r
-       jhostName = (jstring)(*env)->NewStringUTF(env, A_surfxml_process_host);\r
-       jfunction = (jstring)(*env)->NewStringUTF(env, A_surfxml_process_function);\r
-       \r
-       (*env)->CallStaticVoidMethod(env, cls, id, jhostName, jfunction);               \r
-}\r
-\r
-void\r
-japplication_handler_on_process_arg(void)\r
-{\r
-       jstring jarg;\r
-       jclass cls;\r
-       JNIEnv * env = get_current_thread_env();\r
-       \r
-       jmethodID id = jxbt_get_static_smethod(env,"simgrid/msg/ApplicationHandler","onProcessArg", "(Ljava/lang/String;)V") ;\r
-       \r
-       if(!id || !(cls = jxbt_get_class(env , "simgrid/msg/ApplicationHandler")))\r
-               return;\r
-               \r
-       jarg = (jstring)(*env)->NewStringUTF(env, A_surfxml_argument_value);\r
-       \r
-       (*env)->CallStaticVoidMethod(env, cls, id, jarg);               \r
-}\r
-\r
-void\r
-japplication_handler_on_property(void)\r
-{\r
-       jstring jid;\r
-       jstring jvalue;\r
-       jclass cls;\r
-       JNIEnv * env = get_current_thread_env();\r
-       \r
-       jmethodID id = jxbt_get_static_smethod(env,"simgrid/msg/ApplicationHandler","onProperty", "(Ljava/lang/String;Ljava/lang/String;)V") ;\r
-       \r
-       if(!id || !(cls = jxbt_get_class(env , "simgrid/msg/ApplicationHandler")))\r
-               return;\r
-               \r
-       jid = (jstring)(*env)->NewStringUTF(env, A_surfxml_prop_id);\r
-       jvalue = (jstring)(*env)->NewStringUTF(env, A_surfxml_prop_value);\r
-       \r
-       (*env)->CallStaticVoidMethod(env, cls, id, jid, jvalue);                        \r
-}\r
-\r
-void\r
-japplication_handler_on_end_process(void)\r
-{\r
-       JNIEnv * env = get_current_thread_env();\r
-       jclass cls;\r
-       jmethodID id = jxbt_get_static_smethod(env,"simgrid/msg/ApplicationHandler","onEndProcess", "()V") ;\r
-       \r
-       if(!id || !(cls = jxbt_get_class(env , "simgrid/msg/ApplicationHandler")))\r
-               return;\r
-               \r
-       (*env)->CallStaticVoidMethod(env, cls, id);                             \r
-}\r
index ec63a5e..fb577c4 100644 (file)
@@ -8,20 +8,18 @@
  *\r
  * This contains the declarations of the functions in relation with the java\r
  * host instance.\r
- */\r
\r
+ */  \r
+  \r
 #ifndef MSG_JAPPLICATION_HANDLER_H\r
 #define MSG_JAPPLICATION_HANDLER_H\r
-\r
+  \r
 #include <jni.h>\r
 #include "msg/msg.h"\r
-\r
-void japplication_handler_on_start_document(void);\r
-void japplication_handler_on_end_document(void);\r
-void japplication_handler_on_begin_process(void);\r
-void japplication_handler_on_process_arg(void);\r
-void japplication_handler_on_property(void);\r
-void japplication_handler_on_end_process(void);\r
-\r
-\r
-#endif /* !MSG_JAPPLICATION_HANDLER_H */\r
+\rvoid japplication_handler_on_start_document(void);
+\rvoid japplication_handler_on_end_document(void);
+\rvoid japplication_handler_on_begin_process(void);
+\rvoid japplication_handler_on_process_arg(void);
+\rvoid japplication_handler_on_property(void);
+\rvoid japplication_handler_on_end_process(void);
+\r\r\r
+#endif  /* !MSG_JAPPLICATION_HANDLER_H */\r
index 9288a93..4b3d34c 100644 (file)
@@ -9,16 +9,17 @@
  * This contains the implementation of the functions in relation with the java
  * channel instance. 
  */
+
 #include "jmsg_channel.h"
 #include "jmsg.h"
 #include "jxbt_utilities.h"
 
-jint jchannel_get_id(jobject jchannel,JNIEnv* env) {
-  jmethodID id  = jxbt_get_smethod(env, "simgrid/msg/Channel", "getId", "()I");
-       
-  if(!id)
+jint jchannel_get_id(jobject jchannel, JNIEnv * env)
+{
+  jmethodID id = jxbt_get_smethod(env, "simgrid/msg/Channel", "getId", "()I");
+
+  if (!id)
     return -1;
-       
-  return (*env)->CallIntMethod(env,jchannel, id);              
+
+  return (*env)->CallIntMethod(env, jchannel, id);
 }
index c378f0a..f6aa094 100644 (file)
@@ -23,7 +23,6 @@
  *
  * @return                             The id of the channel.
  */
-jint
-jchannel_get_id(jobject jchannel,JNIEnv* env);
+jint jchannel_get_id(jobject jchannel, JNIEnv * env);
 
 #endif /* !MSG_JCHANNEL_H */
index 1e76788..e73e86b 100644 (file)
@@ -9,78 +9,84 @@
  * This contains the implementation of the functions in relation with the java
  * host instance. 
  */
+
 #include "xbt/str.h"
 #include "jmsg.h"
 #include "jmsg_host.h"
 #include "jxbt_utilities.h"
 
-jobject jhost_new_instance(JNIEnv* env) {
-       
-  jclass cls = jxbt_get_class(env,"simgrid/msg/Host"); 
-  jmethodID constructor = jxbt_get_jmethod(env,cls,"<init>", "()V");
-       
-  if(!constructor) 
+jobject jhost_new_instance(JNIEnv * env)
+{
+
+  jclass cls = jxbt_get_class(env, "simgrid/msg/Host");
+  jmethodID constructor = jxbt_get_jmethod(env, cls, "<init>", "()V");
+
+  if (!constructor)
     return NULL;
-       
-  return (*env)->NewObject(env,cls,constructor);
+
+  return (*env)->NewObject(env, cls, constructor);
 }
 
-jobject jhost_ref(JNIEnv* env,jobject jhost) {
-  return (*env)->NewGlobalRef(env,jhost);
+jobject jhost_ref(JNIEnv * env, jobject jhost)
+{
+  return (*env)->NewGlobalRef(env, jhost);
 }
 
-void jhost_unref(JNIEnv* env,jobject jhost) {
-  (*env)->DeleteGlobalRef(env,jhost);
+void jhost_unref(JNIEnv * env, jobject jhost)
+{
+  (*env)->DeleteGlobalRef(env, jhost);
 }
 
-void jhost_bind(jobject jhost,m_host_t host,JNIEnv* env) {
-  jfieldID id  = jxbt_get_sfield(env,"simgrid/msg/Host","bind", "J");
+void jhost_bind(jobject jhost, m_host_t host, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Host", "bind", "J");
 
   if (!id)
     return;
-       
-  (*env)->SetLongField(env,jhost,id,(jlong)(long)(host));
+
+  (*env)->SetLongField(env, jhost, id, (jlong) (long) (host));
 }
 
-m_host_t jhost_get_native(JNIEnv* env, jobject jhost) {
-  jfieldID id  = jxbt_get_sfield(env,"simgrid/msg/Host","bind", "J");
+m_host_t jhost_get_native(JNIEnv * env, jobject jhost)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Host", "bind", "J");
 
-  if(!id)
+  if (!id)
     return NULL;
 
-  return (m_host_t)(long)(*env)->GetLongField(env,jhost,id);
+  return (m_host_t) (long) (*env)->GetLongField(env, jhost, id);
 }
 
-const char*  jhost_get_name(jobject jhost,JNIEnv* env) {
-  m_host_t host = jhost_get_native(env,jhost);
-  return (const char*)host->name;              
+const char *jhost_get_name(jobject jhost, JNIEnv * env)
+{
+  m_host_t host = jhost_get_native(env, jhost);
+  return (const char *) host->name;
 }
 
-void jhost_set_name(jobject jhost,jstring jname,JNIEnv* env) {
-  const char* name;
-  m_host_t host = jhost_get_native(env,jhost);
+void jhost_set_name(jobject jhost, jstring jname, JNIEnv * env)
+{
+  const char *name;
+  m_host_t host = jhost_get_native(env, jhost);
 
   name = (*env)->GetStringUTFChars(env, jname, 0);
-       
-  if(host->name)
+
+  if (host->name)
     free(host->name);
-       
+
   host->name = xbt_strdup(name);
-  (*env)->ReleaseStringUTFChars(env, jname, name);     
+  (*env)->ReleaseStringUTFChars(env, jname, name);
 }
 
-jboolean jhost_is_valid(jobject jhost,JNIEnv* env) {
-  jfieldID id  = jxbt_get_sfield(env,"simgrid/msg/Host","bind", "J");
+jboolean jhost_is_valid(jobject jhost, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Host", "bind", "J");
 
-  if(!id)
+  if (!id)
     return 0;
 
-  if ((*env)->GetLongField(env,jhost,id)) {
+  if ((*env)->GetLongField(env, jhost, id)) {
     return JNI_TRUE;
   } else {
     return JNI_FALSE;
   }
 }
-
-
index a41a834..4a3b308 100644 (file)
@@ -9,7 +9,7 @@
  * This contains the declarations of the functions in relation with the java
  * host instance.
  */
+
 #ifndef MSG_JHOST_H
 #define MSG_JHOST_H
 
@@ -28,8 +28,7 @@
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException.
  */
-jobject
-jhost_new_instance(JNIEnv* env);
+jobject jhost_new_instance(JNIEnv * env);
 
 /**
  * This function returns a global reference to the  java host instance 
@@ -41,14 +40,14 @@ jhost_new_instance(JNIEnv* env);
  * @return                             The global reference to the original java host 
  *                                             instance.
  */
-jobject jhost_ref(JNIEnv* env,jobject jhost);
+jobject jhost_ref(JNIEnv * env, jobject jhost);
 /**
  * This function delete a global reference to a java host instance.
  *
  * @param                              The global refernce to delete.
  * @param env                  The environment of the current thread
  */
-void jhost_unref(JNIEnv* env, jobject jhost);
+void jhost_unref(JNIEnv * env, jobject jhost);
 
 /**
  * This function associated a native host to a java host instance.
@@ -61,9 +60,8 @@ void jhost_unref(JNIEnv* env, jobject jhost);
  *                                             the ClassNotFoundException. If the field bind of 
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchFieldException.  
- */            
-void
-jhost_bind(jobject jhost,m_host_t host,JNIEnv* env);
+ */
+void jhost_bind(jobject jhost, m_host_t host, JNIEnv * env);
 
 /**
  * This function returns a native host from a java host instance.
@@ -79,8 +77,7 @@ jhost_bind(jobject jhost,m_host_t host,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchFieldException.  
  */
-m_host_t
-jhost_get_native(JNIEnv* env,jobject jhost);
+m_host_t jhost_get_native(JNIEnv * env, jobject jhost);
 
 /**
  * This function returns the name of a MSG host.
@@ -90,8 +87,7 @@ jhost_get_native(JNIEnv* env,jobject jhost);
  *
  * @return                             The name of the host.
  */
-const char* 
-jhost_get_name(jobject jhost,JNIEnv* env);
+const char *jhost_get_name(jobject jhost, JNIEnv * env);
 
 
 /**
@@ -101,8 +97,7 @@ jhost_get_name(jobject jhost,JNIEnv* env);
  * @param jname                        The new name of the host.
  * @param env                  The environment of the current thread
  */
-void
-jhost_set_name(jobject jhost,jstring jname,JNIEnv* env);
+void jhost_set_name(jobject jhost, jstring jname, JNIEnv * env);
 
 /**
  * This function tests if a java host instance is valid.
@@ -114,8 +109,6 @@ jhost_set_name(jobject jhost,jstring jname,JNIEnv* env);
  * @return                             If the java host is valid the function returns true.
  *                                             Otherwise the function returns false.
  */
-jboolean
-jhost_is_valid(jobject jhost,JNIEnv* env);
+jboolean jhost_is_valid(jobject jhost, JNIEnv * env);
 
 #endif /*!MSG_JHOST_H */
-
index 2fb7ecf..60c3464 100644 (file)
@@ -9,7 +9,7 @@
  * This contains the implementation of the functions in relation with the java
  * process instance. 
  */
+
 #include "jmsg_process.h"
 #include "jmsg.h"
 #include "jxbt_utilities.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
-jobject
-jprocess_new_global_ref(jobject jprocess,JNIEnv* env) {
-  return (*env)->NewGlobalRef(env,jprocess);
+jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env)
+{
+  return (*env)->NewGlobalRef(env, jprocess);
 }
 
-void
-jprocess_delete_global_ref(jobject jprocess,JNIEnv* env) {
-  (*env)->DeleteGlobalRef(env,jprocess);
+void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env)
+{
+  (*env)->DeleteGlobalRef(env, jprocess);
 }
 
-jboolean
-jprocess_is_alive(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","isAlive", "()Z");
-       
-  if(!id)
+jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "isAlive", "()Z");
+
+  if (!id)
     return 0;
 
-  return (*env)->CallBooleanMethod(env,jprocess,id);
+  return (*env)->CallBooleanMethod(env, jprocess, id);
 }
 
-void
-jprocess_join(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","join", "()V");
-       
-  if(!id)
+void jprocess_join(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id = jxbt_get_smethod(env, "simgrid/msg/Process", "join", "()V");
+
+  if (!id)
     return;
-               
-  (*env)->CallVoidMethod(env,jprocess, id);
+
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
-void 
-jprocess_exit(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","interrupt", "()V");
-       
-  if(!id)
+void jprocess_exit(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "interrupt", "()V");
+
+  if (!id)
     return;
-       
-  (*env)->CallVoidMethod(env,jprocess, id);
+
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
-void 
-jprocess_yield(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","switchProcess", "()V");
-    
-  if(!id)
+void jprocess_yield(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "switchProcess", "()V");
+
+  if (!id)
     return;
-       
-  (*env)->CallVoidMethod(env,jprocess,id);
+
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
-void
-jprocess_lock_mutex(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","lockMutex", "()V");
-    
-  if(!id)
+void jprocess_lock_mutex(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "lockMutex", "()V");
+
+  if (!id)
     return;
-       
-  (*env)->CallVoidMethod(env,jprocess,id);
+
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
-void
-jprocess_unlock_mutex(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","unlockMutex", "()V");
-    
-  if(!id)
+void jprocess_unlock_mutex(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "unlockMutex", "()V");
+
+  if (!id)
     return;
 
-  (*env)->CallVoidMethod(env,jprocess,id);
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
 
-void
-jprocess_signal_cond(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","signalCond", "()V");
-    
-  if(!id)
+void jprocess_signal_cond(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "signalCond", "()V");
+
+  if (!id)
     return;
 
-  (*env)->CallVoidMethod(env,jprocess,id);
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
-void
-jprocess_wait_cond(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","waitCond", "()V");
-    
-  if(!id)
+void jprocess_wait_cond(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id =
+    jxbt_get_smethod(env, "simgrid/msg/Process", "waitCond", "()V");
+
+  if (!id)
     return;
 
-  (*env)->CallVoidMethod(env,jprocess,id);
+  (*env)->CallVoidMethod(env, jprocess, id);
 }
 
 
-void
-jprocess_start(jobject jprocess,JNIEnv* env) {
-  jmethodID id = jxbt_get_smethod(env,"simgrid/msg/Process","start", "()V");
+void jprocess_start(jobject jprocess, JNIEnv * env)
+{
+  jmethodID id = jxbt_get_smethod(env, "simgrid/msg/Process", "start", "()V");
 
-  if(!id)
+  if (!id)
     return;
 
-  DEBUG2("jprocess_start(jproc=%p,env=%p)",jprocess,env);
-  (*env)->CallVoidMethod(env,jprocess,id);
+  DEBUG2("jprocess_start(jproc=%p,env=%p)", jprocess, env);
+  (*env)->CallVoidMethod(env, jprocess, id);
   DEBUG0("jprocess started");
 }
 
-m_process_t
-jprocess_to_native_process(jobject jprocess,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Process","bind", "J");
-    
-  if(!id)
+m_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "bind", "J");
+
+  if (!id)
     return NULL;
 
-  return (m_process_t)(long)(*env)->GetLongField(env,jprocess,id);
+  return (m_process_t) (long) (*env)->GetLongField(env, jprocess, id);
 }
 
-void
-jprocess_bind(jobject jprocess,m_process_t process,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Process","bind", "J");
-    
-  if(!id)
+void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "bind", "J");
+
+  if (!id)
     return;
 
-  (*env)->SetLongField(env,jprocess,id,(jlong)(long)(process));
+  (*env)->SetLongField(env, jprocess, id, (jlong) (long) (process));
 }
 
-jlong
-jprocess_get_id(jobject jprocess,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Process","id", "J");
-    
-  if(!id)
+jlong jprocess_get_id(jobject jprocess, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "id", "J");
+
+  if (!id)
     return 0;
 
-  return (*env)->GetLongField(env,jprocess,id);
+  return (*env)->GetLongField(env, jprocess, id);
 }
 
-jstring
-jprocess_get_name(jobject jprocess,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Process","name", "Ljava/lang/String;");
+jstring jprocess_get_name(jobject jprocess, JNIEnv * env)
+{
+  jfieldID id =
+    jxbt_get_sfield(env, "simgrid/msg/Process", "name", "Ljava/lang/String;");
   jobject jname;
-       
-  if(!id)
+
+  if (!id)
     return NULL;
-    
-  jname = (jstring)(*env)->GetObjectField(env,jprocess,id);
 
-  return (*env)->NewGlobalRef(env,jname);
-       
+  jname = (jstring) (*env)->GetObjectField(env, jprocess, id);
+
+  return (*env)->NewGlobalRef(env, jname);
+
 }
 
-jboolean
-jprocess_is_valid(jobject jprocess,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Process","bind", "J");
-    
-  if(!id)
+jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Process", "bind", "J");
+
+  if (!id)
     return JNI_FALSE;
 
-  return (*env)->GetLongField(env,jprocess,id) ? JNI_TRUE : JNI_FALSE; 
+  return (*env)->GetLongField(env, jprocess, id) ? JNI_TRUE : JNI_FALSE;
 }
 
-void
-jprocess_schedule(xbt_context_t context) {
-       JNIEnv * env;
-       jmethodID id;
-       
-       env = get_current_thread_env();
+void jprocess_schedule(xbt_context_t context)
+{
+  JNIEnv *env;
+  jmethodID id;
+
+  env = get_current_thread_env();
+
+  id = jxbt_get_smethod(env, "simgrid/msg/Process", "schedule", "()V");
 
-       id = jxbt_get_smethod(env,"simgrid/msg/Process","schedule", "()V");
-       
-       if(!id)
-               return;
-       
-       (*env)->CallVoidMethod(env,((xbt_ctx_java_t)context)->jprocess,id);
+  if (!id)
+    return;
+
+  (*env)->CallVoidMethod(env, ((xbt_ctx_java_t) context)->jprocess, id);
 }
 
 
 
-void
-jprocess_unschedule(xbt_context_t context) {
-       JNIEnv * env;
-       jmethodID id;
+void jprocess_unschedule(xbt_context_t context)
+{
+  JNIEnv *env;
+  jmethodID id;
 
-       env = get_current_thread_env();
+  env = get_current_thread_env();
 
-       
-       id = jxbt_get_smethod(env,"simgrid/msg/Process","unschedule", "()V");
-       
-       if(!id)
-               return;
-       
-       (*env)->CallVoidMethod(env,((xbt_ctx_java_t)context)->jprocess,id);
-}
 
+  id = jxbt_get_smethod(env, "simgrid/msg/Process", "unschedule", "()V");
+
+  if (!id)
+    return;
+
+  (*env)->CallVoidMethod(env, ((xbt_ctx_java_t) context)->jprocess, id);
+}
index 85bb943..fda48a0 100644 (file)
@@ -9,7 +9,7 @@
  * This contains the declarations of the functions in relation with the java
  * process instance.
  */
+
 #ifndef MSG_JPROCESS_H
 #define MSG_JPROCESS_H
 
@@ -26,9 +26,8 @@
  *
  * @return                             The global reference to the original java process 
  *                                             instance.
- */                            
-jobject
-jprocess_new_global_ref(jobject jprocess,JNIEnv* env);
+ */
+jobject jprocess_new_global_ref(jobject jprocess, JNIEnv * env);
 
 /**
  * This function delete a global reference to a java process instance.
@@ -40,8 +39,7 @@ jprocess_new_global_ref(jobject jprocess,JNIEnv* env);
  * @see                                        jprocess_join()
  * @see                                        jprocess_exit()
  */
-void
-jprocess_delete_global_ref(jobject jprocess,JNIEnv* env);
+void jprocess_delete_global_ref(jobject jprocess, JNIEnv * env);
 
 /**
  *
@@ -59,9 +57,8 @@ jprocess_delete_global_ref(jobject jprocess,JNIEnv* env);
  *
  * @return                             If the java process is alive the function returns
  *                                             true. Otherwise the function returns false.
- */ 
-jboolean
-jprocess_is_alive(jobject jprocess,JNIEnv* env);
+ */
+jboolean jprocess_is_alive(jobject jprocess, JNIEnv * env);
 
 /**
  * This function waits for a java process to terminate.
@@ -75,8 +72,7 @@ jprocess_is_alive(jobject jprocess,JNIEnv* env);
  *                                             NotSuchMethodException. 
  *
  */
-void
-jprocess_join(jobject jprocess,JNIEnv* env);
+void jprocess_join(jobject jprocess, JNIEnv * env);
 
 /**
  * This function starts the specified java process.
@@ -89,8 +85,7 @@ jprocess_join(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException. 
  */
-void
-jprocess_start(jobject jprocess,JNIEnv* env);
+void jprocess_start(jobject jprocess, JNIEnv * env);
 
 /**
  * This function forces the java process to stop.
@@ -103,8 +98,7 @@ jprocess_start(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException. 
  */
-void 
-jprocess_exit(jobject jprocess,JNIEnv* env);
+void jprocess_exit(jobject jprocess, JNIEnv * env);
 
 /**
  * This function associated a native process to a java process instance.
@@ -117,9 +111,8 @@ jprocess_exit(jobject jprocess,JNIEnv* env);
  *                                             the ClassNotFoundException. If the field bind of 
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchFieldException.  
- */            
-void
-jprocess_bind(jobject jprocess,m_process_t process,JNIEnv* env);
+ */
+void jprocess_bind(jobject jprocess, m_process_t process, JNIEnv * env);
 
 /**
  * This function returns a native process from a java process instance.
@@ -135,8 +128,7 @@ jprocess_bind(jobject jprocess,m_process_t process,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchFieldException.  
  */
-m_process_t
-jprocess_to_native_process(jobject jprocess,JNIEnv* env);
+m_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env);
 
 /**
  * This function gets the id of the specified java process.
@@ -151,8 +143,7 @@ jprocess_to_native_process(jobject jprocess,JNIEnv* env);
  *
  * @return                             The id of the specified java process.
  */
-jlong
-jprocess_get_id(jobject jprocess,JNIEnv* env);
+jlong jprocess_get_id(jobject jprocess, JNIEnv * env);
 
 /**
  * This function tests if a java process instance is valid.
@@ -165,8 +156,7 @@ jprocess_get_id(jobject jprocess,JNIEnv* env);
  * @return                             If the java process is valid the function returns true.
  *                                             Otherwise the function returns false.
  */
-jboolean
-jprocess_is_valid(jobject jprocess,JNIEnv* env);
+jboolean jprocess_is_valid(jobject jprocess, JNIEnv * env);
 
 /**
  * This function gets the name of the specified java process.
@@ -181,8 +171,7 @@ jprocess_is_valid(jobject jprocess,JNIEnv* env);
  *
  * @return                             The name of the specified java process.
  */
-jstring
-jprocess_get_name(jobject jprocess,JNIEnv* env);
+jstring jprocess_get_name(jobject jprocess, JNIEnv * env);
 
 /**
  * This function yields the specified java process.
@@ -195,8 +184,7 @@ jprocess_get_name(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException.
  */
-void 
-jprocess_yield(jobject jprocess,JNIEnv* env);
+void jprocess_yield(jobject jprocess, JNIEnv * env);
 
 /**
  * This function locks the mutex of the specified java process.
@@ -209,8 +197,7 @@ jprocess_yield(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException.
  */
-void
-jprocess_lock_mutex(jobject jprocess,JNIEnv* env);
+void jprocess_lock_mutex(jobject jprocess, JNIEnv * env);
 
 /**
  * This function unlocks the mutex of the specified java process.
@@ -223,8 +210,7 @@ jprocess_lock_mutex(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException.
  */
-void
-jprocess_unlock_mutex(jobject jprocess,JNIEnv* env);
+void jprocess_unlock_mutex(jobject jprocess, JNIEnv * env);
 
 /**
  * This function signals the condition of the mutex of the specified java process.
@@ -237,8 +223,7 @@ jprocess_unlock_mutex(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException.
  */
-void
-jprocess_signal_cond(jobject jprocess,JNIEnv* env);
+void jprocess_signal_cond(jobject jprocess, JNIEnv * env);
 
 /**
  * This function waits the condition of the mutex of the specified java process.
@@ -251,14 +236,11 @@ jprocess_signal_cond(jobject jprocess,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchMethodException.
  */
-void
-jprocess_wait_cond(jobject jprocess,JNIEnv* env);
+void jprocess_wait_cond(jobject jprocess, JNIEnv * env);
 
-void
-jprocess_schedule(xbt_context_t context);
+void jprocess_schedule(xbt_context_t context);
 
-void
-jprocess_unschedule(xbt_context_t context);
+void jprocess_unschedule(xbt_context_t context);
 
 
 #endif /* !MSG_JPROCESS_H */
index 21efd57..af5ae1e 100644 (file)
@@ -9,47 +9,47 @@
  * This contains the implementation of the functions in relation with the java
  * task instance. 
  */
+
 #include "jmsg.h"
 #include "jmsg_task.h"
 #include "jxbt_utilities.h"
 
-jobject
-jtask_new_global_ref(jobject jtask,JNIEnv* env) {
-  return (*env)->NewGlobalRef(env,jtask); 
+jobject jtask_new_global_ref(jobject jtask, JNIEnv * env)
+{
+  return (*env)->NewGlobalRef(env, jtask);
 }
 
-void
-jtask_delete_global_ref(jobject jtask,JNIEnv* env) {
-  (*env)->DeleteGlobalRef(env,jtask);
+void jtask_delete_global_ref(jobject jtask, JNIEnv * env)
+{
+  (*env)->DeleteGlobalRef(env, jtask);
 }
 
-void
-jtask_bind(jobject jtask,m_task_t task,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Task","bind", "J");
-    
-  if(!id)
+void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J");
+
+  if (!id)
     return;
 
-  (*env)->SetLongField(env,jtask,id,(jlong)(long)(task));       
+  (*env)->SetLongField(env, jtask, id, (jlong) (long) (task));
 }
 
-m_task_t
-jtask_to_native_task(jobject jtask,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Task","bind", "J");
-    
-  if(!id)
+m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J");
+
+  if (!id)
     return NULL;
-    
-  return (m_task_t)(long)(*env)->GetLongField(env,jtask,id);   
+
+  return (m_task_t) (long) (*env)->GetLongField(env, jtask, id);
 }
 
-jboolean
-jtask_is_valid(jobject jtask,JNIEnv* env) {
-  jfieldID id = jxbt_get_sfield(env,"simgrid/msg/Task","bind", "J");
-    
-  if(!id)
+jboolean jtask_is_valid(jobject jtask, JNIEnv * env)
+{
+  jfieldID id = jxbt_get_sfield(env, "simgrid/msg/Task", "bind", "J");
+
+  if (!id)
     return JNI_FALSE;
-    
-  return (*env)->GetLongField(env,jtask,id) ? JNI_TRUE : JNI_FALSE;
+
+  return (*env)->GetLongField(env, jtask, id) ? JNI_TRUE : JNI_FALSE;
 }
index 64aa3c9..9e9e0dc 100644 (file)
@@ -25,9 +25,8 @@
  *
  * @return                             The global reference to the original java task 
  *                                             instance.
- */                    
-jobject
-jtask_new_global_ref(jobject jtask,JNIEnv* env);
+ */
+jobject jtask_new_global_ref(jobject jtask, JNIEnv * env);
 
 /**
  * This function delete a global reference to a java task instance.
@@ -35,8 +34,7 @@ jtask_new_global_ref(jobject jtask,JNIEnv* env);
  * @param                              The global refernce to delete.
  * @param env                  The environment of the current thread.
  */
-void
-jtask_delete_global_ref(jobject jtask,JNIEnv* env);
+void jtask_delete_global_ref(jobject jtask, JNIEnv * env);
 
 /**
  * This function associated a native task to a java task instance.
@@ -49,9 +47,8 @@ jtask_delete_global_ref(jobject jtask,JNIEnv* env);
  *                                             the ClassNotFoundException. If the field bind of 
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchFieldException.  
- */            
-void
-jtask_bind(jobject jtask,m_task_t task,JNIEnv* env);
+ */
+void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env);
 
 /**
  * This function returns a native task from a java task instance.
@@ -67,8 +64,7 @@ jtask_bind(jobject jtask,m_task_t task,JNIEnv* env);
  *                                             this class is not found the function throws the exception 
  *                                             NotSuchFieldException.  
  */
-m_task_t
-jtask_to_native_task(jobject jtask,JNIEnv* env);
+m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env);
 
 /**
  * This function tests if a java task instance is valid.
@@ -81,7 +77,6 @@ jtask_to_native_task(jobject jtask,JNIEnv* env);
  * @return                             If the java task is valid the function returns true.
  *                                             Otherwise the function returns false.
  */
-jboolean
-jtask_is_valid(jobject jtask,JNIEnv* env);
+jboolean jtask_is_valid(jobject jtask, JNIEnv * env);
 
 #endif /* !MSG_JTASK_H */
index 97d41be..0a4ea4b 100644 (file)
@@ -10,7 +10,7 @@
  *
  */
 
-#include <stdlib.h> /* abort */
+#include <stdlib.h>             /* abort */
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/str.h"
 /* JNI GETTERS */
 /* *********** */
 
-jclass jxbt_get_class(JNIEnv* env, const char*name) {
+jclass jxbt_get_class(JNIEnv * env, const char *name)
+{
   jclass cls = (*env)->FindClass(env, name);
-       
-  if(!cls) {
-    char *m=bprintf("Class %s not found",name);
+
+  if (!cls) {
+    char *m = bprintf("Class %s not found", name);
     jxbt_throw_jni(env, m);
     free(m);
     return NULL;
@@ -33,25 +34,29 @@ jclass jxbt_get_class(JNIEnv* env, const char*name) {
   return cls;
 }
 
-jmethodID jxbt_get_jmethod(JNIEnv* env, jclass cls, 
-                          const char *name,const char *signature) {
+jmethodID jxbt_get_jmethod(JNIEnv * env, jclass cls,
+                           const char *name, const char *signature)
+{
   jmethodID id;
 
   if (!cls)
     return 0;
-  id = (*env)->GetMethodID(env, cls, name,signature);
-       
-  if(!id) {
+  id = (*env)->GetMethodID(env, cls, name, signature);
+
+  if (!id) {
 
-    jmethodID tostr_id = (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
-    jstring jclassname = (jstring) (*env)->CallObjectMethod(env, cls, tostr_id, NULL);
+    jmethodID tostr_id =
+      (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
+    jstring jclassname =
+      (jstring) (*env)->CallObjectMethod(env, cls, tostr_id, NULL);
     const char *classname = (*env)->GetStringUTFChars(env, jclassname, 0);
 
-    char *m=bprintf("Cannot find method %s(%s) in %s", name, signature ,classname);
+    char *m =
+      bprintf("Cannot find method %s(%s) in %s", name, signature, classname);
 
-    (*env)->ReleaseStringUTFChars(env, jclassname, classname);         
+    (*env)->ReleaseStringUTFChars(env, jclassname, classname);
 
-    jxbt_throw_jni(env,m);
+    jxbt_throw_jni(env, m);
 
     free(m);
     return 0;
@@ -60,25 +65,30 @@ jmethodID jxbt_get_jmethod(JNIEnv* env, jclass cls,
   return id;
 }
 
-jmethodID jxbt_get_static_jmethod(JNIEnv* env, jclass cls, 
-                          const char *name,const char *signature) {
+jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls,
+                                  const char *name, const char *signature)
+{
   jmethodID id;
 
   if (!cls)
     return 0;
-  id = (*env)->GetStaticMethodID(env, cls, name,signature);
-       
-  if(!id) {
+  id = (*env)->GetStaticMethodID(env, cls, name, signature);
 
-    jmethodID tostr_id = (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
-    jstring jclassname = (jstring) (*env)->CallObjectMethod(env, cls, tostr_id, NULL);
+  if (!id) {
+
+    jmethodID tostr_id =
+      (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
+    jstring jclassname =
+      (jstring) (*env)->CallObjectMethod(env, cls, tostr_id, NULL);
     const char *classname = (*env)->GetStringUTFChars(env, jclassname, 0);
 
-    char *m=bprintf("Cannot find static method %s(%s) in %s", name, signature ,classname);
+    char *m =
+      bprintf("Cannot find static method %s(%s) in %s", name, signature,
+              classname);
 
-    (*env)->ReleaseStringUTFChars(env, jclassname, classname);         
+    (*env)->ReleaseStringUTFChars(env, jclassname, classname);
 
-    jxbt_throw_jni(env,m);
+    jxbt_throw_jni(env, m);
 
     free(m);
     return 0;
@@ -87,23 +97,26 @@ jmethodID jxbt_get_static_jmethod(JNIEnv* env, jclass cls,
   return id;
 }
 
-jmethodID jxbt_get_static_smethod(JNIEnv* env, const char *classname, 
-                         const char *name,const char *signature) { 
-  
-       jclass cls;
+jmethodID jxbt_get_static_smethod(JNIEnv * env, const char *classname,
+                                  const char *name, const char *signature)
+{
 
-       jmethodID id;
-       cls = jxbt_get_class(env,classname);
+  jclass cls;
+
+  jmethodID id;
+  cls = jxbt_get_class(env, classname);
 
   if (!cls)
     return 0;
 
-  id = (*env)->GetStaticMethodID(env, cls, name,signature);
-       
-  if(!id) {
-    char *m=bprintf("Cannot find static method %s(%s) in %s", name, signature,classname);
+  id = (*env)->GetStaticMethodID(env, cls, name, signature);
+
+  if (!id) {
+    char *m =
+      bprintf("Cannot find static method %s(%s) in %s", name, signature,
+              classname);
 
-    jxbt_throw_jni(env,m);
+    jxbt_throw_jni(env, m);
 
     free(m);
     return 0;
@@ -111,23 +124,25 @@ jmethodID jxbt_get_static_smethod(JNIEnv* env, const char *classname,
   return id;
 }
 
-jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname, 
-                         const char *name,const char *signature) { 
-  
-       jclass cls;
+jmethodID jxbt_get_smethod(JNIEnv * env, const char *classname,
+                           const char *name, const char *signature)
+{
 
-       jmethodID id;
-       cls = jxbt_get_class(env,classname);
+  jclass cls;
+
+  jmethodID id;
+  cls = jxbt_get_class(env, classname);
 
   if (!cls)
     return 0;
 
-  id = (*env)->GetMethodID(env, cls, name,signature);
-       
-  if(!id) {
-    char *m=bprintf("Cannot find method %s(%s) in %s", name, signature,classname);
+  id = (*env)->GetMethodID(env, cls, name, signature);
 
-    jxbt_throw_jni(env,m);
+  if (!id) {
+    char *m =
+      bprintf("Cannot find method %s(%s) in %s", name, signature, classname);
+
+    jxbt_throw_jni(env, m);
 
     free(m);
     return 0;
@@ -135,24 +150,28 @@ jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname,
   return id;
 }
 
-jfieldID jxbt_get_jfield(JNIEnv* env, jclass cls, 
-                        const char *name, const char *signature) {
+jfieldID jxbt_get_jfield(JNIEnv * env, jclass cls,
+                         const char *name, const char *signature)
+{
   jfieldID id;
 
   if (!cls)
     return 0;
 
   id = (*env)->GetFieldID(env, cls, name, signature);
-       
-  if(!id) {
-    jmethodID getname_id = (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
-    jstring jclassname = (jstring) (*env)->CallObjectMethod(env,cls, getname_id, NULL);
+
+  if (!id) {
+    jmethodID getname_id =
+      (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String;");
+    jstring jclassname =
+      (jstring) (*env)->CallObjectMethod(env, cls, getname_id, NULL);
     const char *classname = (*env)->GetStringUTFChars(env, jclassname, 0);
-    char *m=bprintf("Cannot find field %s %s in %s",signature, name, classname);
+    char *m =
+      bprintf("Cannot find field %s %s in %s", signature, name, classname);
 
-    (*env)->ReleaseStringUTFChars(env, jclassname, classname);         
+    (*env)->ReleaseStringUTFChars(env, jclassname, classname);
 
-    jxbt_throw_jni(env,m);
+    jxbt_throw_jni(env, m);
 
     free(m);
     return 0;
@@ -161,20 +180,22 @@ jfieldID jxbt_get_jfield(JNIEnv* env, jclass cls,
   return id;
 }
 
-jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname, 
-                       const char *name, const char *signature) {
-  jclass cls = jxbt_get_class(env,classname);
+jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname,
+                         const char *name, const char *signature)
+{
+  jclass cls = jxbt_get_class(env, classname);
   jfieldID id;
 
   if (!cls)
     return 0;
 
   id = (*env)->GetFieldID(env, cls, name, signature);
-       
-  if(!id) {
-    char *m=bprintf("Cannot find field %s %s in %s",signature, name, classname);
 
-    jxbt_throw_jni(env,m);
+  if (!id) {
+    char *m =
+      bprintf("Cannot find field %s %s in %s", signature, name, classname);
+
+    jxbt_throw_jni(env, m);
 
     free(m);
     return 0;
@@ -186,51 +207,62 @@ jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname,
 /* ***************** */
 /* EXCEPTION RAISING */
 /* ***************** */
-static void jxbt_throw_by_name(JNIEnv* env,const char* name, char *msg) {
-   jclass cls = (*env)->FindClass(env, name);
+static void jxbt_throw_by_name(JNIEnv * env, const char *name, char *msg)
+{
+  jclass cls = (*env)->FindClass(env, name);
 
-   xbt_assert2(cls,"%s (Plus severe error: class %s not found)\n",
-              msg,name);
+  xbt_assert2(cls, "%s (Plus severe error: class %s not found)\n", msg, name);
 
-   (*env)->ThrowNew(env,cls,msg);
+  (*env)->ThrowNew(env, cls, msg);
 
-   free(msg);
+  free(msg);
 }
 
 
 /* Errors in MSG */
-void jxbt_throw_jni(JNIEnv* env,const char* msg) {
+void jxbt_throw_jni(JNIEnv * env, const char *msg)
+{
   jxbt_throw_by_name(env,
-                    "simgrid/msg/JniException",
-                    bprintf("Internal or JNI error: %s",msg));
+                     "simgrid/msg/JniException",
+                     bprintf("Internal or JNI error: %s", msg));
 }
-void jxbt_throw_notbound(JNIEnv* env,const char* kind, void *pointer) {
+
+void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer)
+{
   jxbt_throw_by_name(env,
-                    "simgrid/msg/JniException",
-                    bprintf("Internal error: %s %p not bound",kind, pointer));
+                     "simgrid/msg/JniException",
+                     bprintf("Internal error: %s %p not bound", kind,
+                             pointer));
 }
 
-void jxbt_throw_native(JNIEnv* env,char* msg) {
+void jxbt_throw_native(JNIEnv * env, char *msg)
+{
   jxbt_throw_by_name(env, "simgrid/msg/NativeException", msg);
 }
 
 /* *** */
-void jxbt_throw_null(JNIEnv* env, char* msg) {
+void jxbt_throw_null(JNIEnv * env, char *msg)
+{
   jxbt_throw_by_name(env, "java/lang/NullPointerException", msg);
 }
 
 
 /* Errors on user side */
-void jxbt_throw_illegal(JNIEnv* env, char* msg) {
+void jxbt_throw_illegal(JNIEnv * env, char *msg)
+{
   jxbt_throw_by_name(env, "java/lang/IllegalArgumentException", msg);
 }
-void jxbt_throw_host_not_found(JNIEnv* env, const char *invalid_name) {
+
+void jxbt_throw_host_not_found(JNIEnv * env, const char *invalid_name)
+{
   jxbt_throw_by_name(env,
-                    "simgrid/msg/HostNotFoundException",
-                    bprintf("No such host: %s",invalid_name));
+                     "simgrid/msg/HostNotFoundException",
+                     bprintf("No such host: %s", invalid_name));
 }
-void jxbt_throw_process_not_found(JNIEnv* env, const char *invalid_name) {
+
+void jxbt_throw_process_not_found(JNIEnv * env, const char *invalid_name)
+{
   jxbt_throw_by_name(env,
-                    "simgrid/msg/ProcessNotFoundException",
-                    bprintf("No such process: %s",invalid_name));
+                     "simgrid/msg/ProcessNotFoundException",
+                     bprintf("No such process: %s", invalid_name));
 }
index 570645b..78ddb4b 100644 (file)
 /* *********** */
 
 /* Search a class and throw an exception if not found */
-jclass jxbt_get_class(JNIEnv* env, const char*name);
+jclass jxbt_get_class(JNIEnv * env, const char *name);
 
 /* Search a method in a class and throw an exception if not found
    (it's ok to to pass a NULL class: it's a noop) */
-jmethodID jxbt_get_jmethod(JNIEnv* env, jclass class, 
-                          const char *name,const char *signature);
-                          
+jmethodID jxbt_get_jmethod(JNIEnv * env, jclass class,
+                           const char *name, const char *signature);
+
 /* Like the jxbt_get_class() but get a static method */
-jmethodID jxbt_get_static_jmethod(JNIEnv* env, jclass cls, 
-                          const char *name,const char *signature);
+jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls,
+                                  const char *name, const char *signature);
 
 /* Search a field in a class and throw an exception if not found
    (it's ok to to pass a NULL class: it's a noop) */
-jfieldID jxbt_get_jfield(JNIEnv* env, jclass class, 
-                        const char *name, const char *signature);
+jfieldID jxbt_get_jfield(JNIEnv * env, jclass class,
+                         const char *name, const char *signature);
 
 
 /* Search a method in a class and throw an exception if not found
    (it's ok to to pass a NULL class: it's a noop) */
-jmethodID jxbt_get_smethod(JNIEnv* env, const char *classname, 
-                         const char *name,const char *signature);
+jmethodID jxbt_get_smethod(JNIEnv * env, const char *classname,
+                           const char *name, const char *signature);
 
 /* Like the jxbt_get_smethod() but get a static method */
-jmethodID jxbt_get_static_smethod(JNIEnv* env, const char *classname, 
-                         const char *name,const char *signature);
+jmethodID jxbt_get_static_smethod(JNIEnv * env, const char *classname,
+                                  const char *name, const char *signature);
 
 /* Search a field in a class and throw an exception if not found
    (it's ok to to pass a NULL class: it's a noop) */
-jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname, 
-                       const char *name, const char *signature);
+jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname,
+                         const char *name, const char *signature);
 
 
 /* ***************** */
@@ -59,21 +59,21 @@ jfieldID jxbt_get_sfield(JNIEnv* env, const char *classname,
 
 
 /** Thrown on internal error of this layer, or on problem with JNI */
-void jxbt_throw_jni(JNIEnv* env, const char* msg);
+void jxbt_throw_jni(JNIEnv * env, const char *msg);
 /** Thrown when using an object not bound to a native one where it should, or reverse (kinda JNI issue) */
-void jxbt_throw_notbound(JNIEnv* env,const char* kind,void *pointer);
+void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer);
 
 /** Thrown on error in native MSG code */
-void jxbt_throw_native(JNIEnv* env, char *msg);
+void jxbt_throw_native(JNIEnv * env, char *msg);
 
 /** Thrown if NULL gets used */
-void jxbt_throw_null(JNIEnv* env,char *msg);
+void jxbt_throw_null(JNIEnv * env, char *msg);
 
 /** Thrown on illegal arguments */
-void jxbt_throw_illegal(JNIEnv* env,char *msg);
+void jxbt_throw_illegal(JNIEnv * env, char *msg);
 /** Thrown when looking for an host from name does not lead to anything */
-void jxbt_throw_host_not_found(JNIEnv* env, const char *invalid_name);
+void jxbt_throw_host_not_found(JNIEnv * env, const char *invalid_name);
 /** Thrown when looking for an host from name does not lead to anything */
-void jxbt_throw_process_not_found(JNIEnv* env, const char *invalid_name);
+void jxbt_throw_process_not_found(JNIEnv * env, const char *invalid_name);
 
 #endif /* ! JXBT_UTILITY_H */
index 7c310f4..aa70f94 100644 (file)
@@ -31,7 +31,7 @@ void MSG_launch_application(const char *file)
 {
 
   xbt_assert0(msg_global,
-             "MSG_global_init_args has to be called before MSG_launch_application.");
+              "MSG_global_init_args has to be called before MSG_launch_application.");
 
   SIMIX_launch_application(file);
 
index 924e277..b5837e6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: environment.c 5354 2008-04-30 08:55:54Z mquinson $      */
+/*     $Id$      */
 
 /* Copyright (c) 2002-2007 Arnaud Legrand.                                  */
 /* Copyright (c) 2007 Bruno Donassolo.                                      */
@@ -67,7 +67,7 @@ void MSG_create_environment(const char *file)
   SIMIX_create_environment(file);
 
   /* Initialize MSG hosts */
-  xbt_dict_foreach(SIMIX_host_get_dict(),c,name,h) {
+  xbt_dict_foreach(SIMIX_host_get_dict(), c, name, h) {
     __MSG_host_create(h, NULL);
   }
   return;
index 75caaaf..d5de0ca 100644 (file)
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/virtu.h"
-#include "xbt/ex.h"            /* ex_backtrace_display */
+#include "xbt/ex.h"             /* ex_backtrace_display */
 #include "mailbox.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg,
-                               "Logging specific to MSG (kernel)");
+                                "Logging specific to MSG (kernel)");
 
 MSG_Global_t msg_global = NULL;
 
@@ -68,11 +68,11 @@ void MSG_global_init(int *argc, char **argv)
     msg_global->PID = 1;
     msg_global->sent_msg = 0;
 
-       /* initialization of the mailbox module */
-       MSG_mailbox_mod_init();
+    /* initialization of the mailbox module */
+    MSG_mailbox_mod_init();
 
-       /* initialization of the action module */
-       _MSG_action_init();
+    /* initialization of the action module */
+    _MSG_action_init();
 
     SIMIX_function_register_process_create(_MSG_process_create_from_SIMIX);
     SIMIX_function_register_process_cleanup(__MSG_process_cleanup);
@@ -117,8 +117,8 @@ void MSG_paje_output(const char *filename)
 MSG_error_t MSG_set_channel_number(int number)
 {
   xbt_assert0((msg_global)
-             && (msg_global->max_channel == 0),
-             "Channel number already set!");
+              && (msg_global->max_channel == 0),
+              "Channel number already set!");
 
   msg_global->max_channel = number;
 
@@ -135,8 +135,8 @@ MSG_error_t MSG_set_channel_number(int number)
 int MSG_get_channel_number(void)
 {
   xbt_assert0((msg_global)
-             && (msg_global->max_channel != 0),
-             "Channel number not set yet!");
+              && (msg_global->max_channel != 0),
+              "Channel number not set yet!");
 
   return msg_global->max_channel;
 }
@@ -166,7 +166,7 @@ MSG_error_t MSG_main(void)
 
       DEBUG1("** %s failed **", smx_action->name);
       while ((cond = xbt_fifo_pop(smx_action->cond_list))) {
-       SIMIX_cond_broadcast(cond);
+        SIMIX_cond_broadcast(cond);
       }
     }
 
@@ -174,7 +174,7 @@ MSG_error_t MSG_main(void)
 
       DEBUG1("** %s done **", smx_action->name);
       while ((cond = xbt_fifo_pop(smx_action->cond_list))) {
-       SIMIX_cond_broadcast(cond);
+        SIMIX_cond_broadcast(cond);
       }
     }
   }
@@ -251,6 +251,7 @@ double MSG_get_clock(void)
   return SIMIX_get_clock();
 }
 
-unsigned long int MSG_get_sent_msg() {
+unsigned long int MSG_get_sent_msg()
+{
   return msg_global->sent_msg;
 }
index ba0d5be..cee89a4 100644 (file)
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg,
-                               "Logging specific to MSG (gos)");
+                                "Logging specific to MSG (gos)");
 
 /** \ingroup msg_gos_functions
  *
  * \brief Return the last value returned by a MSG function (except
  * MSG_get_errno...).
  */
-MSG_error_t
-MSG_get_errno(void)
+MSG_error_t MSG_get_errno(void)
 {
-       return PROCESS_GET_ERRNO();
+  return PROCESS_GET_ERRNO();
 }
 
 /** \ingroup msg_gos_functions
@@ -37,61 +36,59 @@ MSG_get_errno(void)
  * \return #MSG_FATAL if \a task is not properly initialized and
  * #MSG_OK otherwise.
  */
-MSG_error_t
-MSG_task_execute(m_task_t task)
+MSG_error_t MSG_task_execute(m_task_t task)
 {
-       simdata_task_t simdata = NULL;
-       m_process_t self = MSG_process_self();
-       e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
-       CHECK_HOST();
-
-       simdata = task->simdata;
-       xbt_assert0((!simdata->compute) && (task->simdata->refcount  == 1),"This task is executed somewhere else. Go fix your code!");
-
-       DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
-
-       simdata->refcount ++;
-       SIMIX_mutex_lock(simdata->mutex);
-       simdata->compute = SIMIX_action_execute(SIMIX_host_self(), task->name, simdata->computation_amount);
-       SIMIX_action_set_priority(simdata->compute, simdata->priority);
-
-       self->simdata->waiting_task = task;
-       SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
-       do {
-         SIMIX_cond_wait(simdata->cond, simdata->mutex);
-         state = SIMIX_action_get_state(simdata->compute);
-       } while(state==SURF_ACTION_READY || state==SURF_ACTION_RUNNING);
-       SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
-       self->simdata->waiting_task = NULL;
-
-       SIMIX_mutex_unlock(simdata->mutex);
-       simdata->refcount --;
-
-       if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE)
-       {
-               /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
-               SIMIX_action_destroy(task->simdata->compute);
-               simdata->computation_amount = 0.0;
-               simdata->comm = NULL;
-               simdata->compute = NULL;
-               MSG_RETURN(MSG_OK);
-       }
-       else if(SIMIX_host_get_state(SIMIX_host_self()) == 0)
-       {
-               /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
-               SIMIX_action_destroy(task->simdata->compute);
-               simdata->comm = NULL;
-               simdata->compute = NULL;
-               MSG_RETURN(MSG_HOST_FAILURE);
-       }
-       else
-       {
-               /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
-               SIMIX_action_destroy(task->simdata->compute);
-               simdata->comm = NULL;
-               simdata->compute = NULL;
-               MSG_RETURN(MSG_TASK_CANCELLED);
-       }
+  simdata_task_t simdata = NULL;
+  m_process_t self = MSG_process_self();
+  e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
+  CHECK_HOST();
+
+  simdata = task->simdata;
+  xbt_assert0((!simdata->compute)
+              && (task->simdata->refcount == 1),
+              "This task is executed somewhere else. Go fix your code!");
+
+  DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
+
+  simdata->refcount++;
+  SIMIX_mutex_lock(simdata->mutex);
+  simdata->compute =
+    SIMIX_action_execute(SIMIX_host_self(), task->name,
+                         simdata->computation_amount);
+  SIMIX_action_set_priority(simdata->compute, simdata->priority);
+
+  self->simdata->waiting_task = task;
+  SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
+  do {
+    SIMIX_cond_wait(simdata->cond, simdata->mutex);
+    state = SIMIX_action_get_state(simdata->compute);
+  } while (state == SURF_ACTION_READY || state == SURF_ACTION_RUNNING);
+  SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
+  self->simdata->waiting_task = NULL;
+
+  SIMIX_mutex_unlock(simdata->mutex);
+  simdata->refcount--;
+
+  if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE) {
+    /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+    SIMIX_action_destroy(task->simdata->compute);
+    simdata->computation_amount = 0.0;
+    simdata->comm = NULL;
+    simdata->compute = NULL;
+    MSG_RETURN(MSG_OK);
+  } else if (SIMIX_host_get_state(SIMIX_host_self()) == 0) {
+    /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+    SIMIX_action_destroy(task->simdata->compute);
+    simdata->comm = NULL;
+    simdata->compute = NULL;
+    MSG_RETURN(MSG_HOST_FAILURE);
+  } else {
+    /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+    SIMIX_action_destroy(task->simdata->compute);
+    simdata->comm = NULL;
+    simdata->compute = NULL;
+    MSG_RETURN(MSG_TASK_CANCELLED);
+  }
 }
 
 /** \ingroup m_task_management
@@ -114,102 +111,103 @@ MSG_task_execute(m_task_t task)
  * \return The new corresponding object.
  */
 m_task_t
-MSG_parallel_task_create(const char *name,int host_nb, const m_host_t * host_list, double *computation_amount, double *communication_amount, void *data)
+MSG_parallel_task_create(const char *name, int host_nb,
+                         const m_host_t * host_list,
+                         double *computation_amount,
+                         double *communication_amount, void *data)
 {
-       int i;
-       simdata_task_t simdata = xbt_new0(s_simdata_task_t, 1);
-       m_task_t task = xbt_new0(s_m_task_t, 1);
-       task->simdata = simdata;
-
-       /* Task structure */
-       task->name = xbt_strdup(name);
-       task->data = data;
-
-       /* Simulator Data */
-       simdata->computation_amount = 0;
-       simdata->message_size = 0;
-       simdata->cond = SIMIX_cond_init();
-       simdata->mutex = SIMIX_mutex_init();
-       simdata->compute = NULL;
-       simdata->comm = NULL;
-       simdata->rate = -1.0;
-       simdata->refcount  = 1;
-       simdata->sender = NULL;
-       simdata->receiver = NULL;
-       simdata->source = NULL;
-
-       simdata->host_nb = host_nb;
-       simdata->host_list = xbt_new0(smx_host_t, host_nb);
-       simdata->comp_amount = computation_amount;
-       simdata->comm_amount = communication_amount;
-
-       for (i = 0; i < host_nb; i++)
-               simdata->host_list[i] = host_list[i]->simdata->smx_host;
-
-       return task;
+  int i;
+  simdata_task_t simdata = xbt_new0(s_simdata_task_t, 1);
+  m_task_t task = xbt_new0(s_m_task_t, 1);
+  task->simdata = simdata;
+
+  /* Task structure */
+  task->name = xbt_strdup(name);
+  task->data = data;
+
+  /* Simulator Data */
+  simdata->computation_amount = 0;
+  simdata->message_size = 0;
+  simdata->cond = SIMIX_cond_init();
+  simdata->mutex = SIMIX_mutex_init();
+  simdata->compute = NULL;
+  simdata->comm = NULL;
+  simdata->rate = -1.0;
+  simdata->refcount = 1;
+  simdata->sender = NULL;
+  simdata->receiver = NULL;
+  simdata->source = NULL;
+
+  simdata->host_nb = host_nb;
+  simdata->host_list = xbt_new0(smx_host_t, host_nb);
+  simdata->comp_amount = computation_amount;
+  simdata->comm_amount = communication_amount;
+
+  for (i = 0; i < host_nb; i++)
+    simdata->host_list[i] = host_list[i]->simdata->smx_host;
+
+  return task;
 }
 
-MSG_error_t
-MSG_parallel_task_execute(m_task_t task)
+MSG_error_t MSG_parallel_task_execute(m_task_t task)
 {
-       simdata_task_t simdata = NULL;
-       m_process_t self = MSG_process_self();
-       e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
-       CHECK_HOST();
-
-       simdata = task->simdata;
-
-       xbt_assert0((!simdata->compute) && (task->simdata->refcount  == 1),"This task is executed somewhere else. Go fix your code!");
-
-       xbt_assert0(simdata->host_nb,"This is not a parallel task. Go to hell.");
-
-       DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
-
-       simdata->refcount ++;
-
-       SIMIX_mutex_lock(simdata->mutex);
-       simdata->compute =
-       SIMIX_action_parallel_execute(task->name, simdata->host_nb, simdata->host_list, simdata->comp_amount, simdata->comm_amount, 1.0, -1.0);
-
-       self->simdata->waiting_task = task;
-       SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
-       do {
-         SIMIX_cond_wait(simdata->cond, simdata->mutex);
-         state = SIMIX_action_get_state(task->simdata->compute);
-       } while(state==SURF_ACTION_READY || state==SURF_ACTION_RUNNING);
-
-       SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
-       self->simdata->waiting_task = NULL;
-
-
-       SIMIX_mutex_unlock(simdata->mutex);
-       simdata->refcount --;
-
-       if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE)
-       {
-               /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
-               SIMIX_action_destroy(task->simdata->compute);
-               simdata->computation_amount = 0.0;
-               simdata->comm = NULL;
-               simdata->compute = NULL;
-               MSG_RETURN(MSG_OK);
-       }
-       else if(SIMIX_host_get_state(SIMIX_host_self()) == 0)
-       {
-               /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
-               SIMIX_action_destroy(task->simdata->compute);
-               simdata->comm = NULL;
-               simdata->compute = NULL;
-               MSG_RETURN(MSG_HOST_FAILURE);
-       }
-       else
-       {
-               /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
-               SIMIX_action_destroy(task->simdata->compute);
-               simdata->comm = NULL;
-               simdata->compute = NULL;
-               MSG_RETURN(MSG_TASK_CANCELLED);
-       }
+  simdata_task_t simdata = NULL;
+  m_process_t self = MSG_process_self();
+  e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
+  CHECK_HOST();
+
+  simdata = task->simdata;
+
+  xbt_assert0((!simdata->compute)
+              && (task->simdata->refcount == 1),
+              "This task is executed somewhere else. Go fix your code!");
+
+  xbt_assert0(simdata->host_nb, "This is not a parallel task. Go to hell.");
+
+  DEBUG1("Computing on %s", MSG_process_self()->simdata->m_host->name);
+
+  simdata->refcount++;
+
+  SIMIX_mutex_lock(simdata->mutex);
+  simdata->compute =
+    SIMIX_action_parallel_execute(task->name, simdata->host_nb,
+                                  simdata->host_list, simdata->comp_amount,
+                                  simdata->comm_amount, 1.0, -1.0);
+
+  self->simdata->waiting_task = task;
+  SIMIX_register_action_to_condition(simdata->compute, simdata->cond);
+  do {
+    SIMIX_cond_wait(simdata->cond, simdata->mutex);
+    state = SIMIX_action_get_state(task->simdata->compute);
+  } while (state == SURF_ACTION_READY || state == SURF_ACTION_RUNNING);
+
+  SIMIX_unregister_action_to_condition(simdata->compute, simdata->cond);
+  self->simdata->waiting_task = NULL;
+
+
+  SIMIX_mutex_unlock(simdata->mutex);
+  simdata->refcount--;
+
+  if (SIMIX_action_get_state(task->simdata->compute) == SURF_ACTION_DONE) {
+    /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+    SIMIX_action_destroy(task->simdata->compute);
+    simdata->computation_amount = 0.0;
+    simdata->comm = NULL;
+    simdata->compute = NULL;
+    MSG_RETURN(MSG_OK);
+  } else if (SIMIX_host_get_state(SIMIX_host_self()) == 0) {
+    /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+    SIMIX_action_destroy(task->simdata->compute);
+    simdata->comm = NULL;
+    simdata->compute = NULL;
+    MSG_RETURN(MSG_HOST_FAILURE);
+  } else {
+    /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+    SIMIX_action_destroy(task->simdata->compute);
+    simdata->comm = NULL;
+    simdata->compute = NULL;
+    MSG_RETURN(MSG_TASK_CANCELLED);
+  }
 
 }
 
@@ -221,63 +219,59 @@ MSG_parallel_task_execute(m_task_t task)
  *
  * \param nb_sec a number of second
  */
-MSG_error_t
-MSG_process_sleep(double nb_sec)
+MSG_error_t MSG_process_sleep(double nb_sec)
 {
-       smx_action_t act_sleep;
-       m_process_t proc = MSG_process_self();
-       e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
-       smx_mutex_t mutex;
-       smx_cond_t cond;
-
-       /* create action to sleep */
-       act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc->simdata->s_process), nb_sec);
-
-       mutex = SIMIX_mutex_init();
-       SIMIX_mutex_lock(mutex);
-
-       /* create conditional and register action to it */
-       cond = SIMIX_cond_init();
-
-       SIMIX_register_action_to_condition(act_sleep, cond);
-       do {
-         SIMIX_cond_wait(cond, mutex);
-         state = SIMIX_action_get_state(act_sleep);
-       } while(state==SURF_ACTION_READY || state==SURF_ACTION_RUNNING);
-       SIMIX_unregister_action_to_condition(act_sleep, cond);
-       SIMIX_mutex_unlock(mutex);
-
-       /* remove variables */
-       SIMIX_cond_destroy(cond);
-       SIMIX_mutex_destroy(mutex);
-
-       if (SIMIX_action_get_state(act_sleep) == SURF_ACTION_DONE)
-       {
-               if (SIMIX_host_get_state(SIMIX_host_self()) == SURF_CPU_OFF)
-               {
-                       SIMIX_action_destroy(act_sleep);
-                       MSG_RETURN(MSG_HOST_FAILURE);
-               }
-       }
-       else
-       {
-               SIMIX_action_destroy(act_sleep);
-               MSG_RETURN(MSG_HOST_FAILURE);
-       }
-
-       SIMIX_action_destroy(act_sleep);
-       MSG_RETURN(MSG_OK);
+  smx_action_t act_sleep;
+  m_process_t proc = MSG_process_self();
+  e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
+  smx_mutex_t mutex;
+  smx_cond_t cond;
+
+  /* create action to sleep */
+  act_sleep =
+    SIMIX_action_sleep(SIMIX_process_get_host(proc->simdata->s_process),
+                       nb_sec);
+
+  mutex = SIMIX_mutex_init();
+  SIMIX_mutex_lock(mutex);
+
+  /* create conditional and register action to it */
+  cond = SIMIX_cond_init();
+
+  SIMIX_register_action_to_condition(act_sleep, cond);
+  do {
+    SIMIX_cond_wait(cond, mutex);
+    state = SIMIX_action_get_state(act_sleep);
+  } while (state == SURF_ACTION_READY || state == SURF_ACTION_RUNNING);
+  SIMIX_unregister_action_to_condition(act_sleep, cond);
+  SIMIX_mutex_unlock(mutex);
+
+  /* remove variables */
+  SIMIX_cond_destroy(cond);
+  SIMIX_mutex_destroy(mutex);
+
+  if (SIMIX_action_get_state(act_sleep) == SURF_ACTION_DONE) {
+    if (SIMIX_host_get_state(SIMIX_host_self()) == SURF_CPU_OFF) {
+      SIMIX_action_destroy(act_sleep);
+      MSG_RETURN(MSG_HOST_FAILURE);
+    }
+  } else {
+    SIMIX_action_destroy(act_sleep);
+    MSG_RETURN(MSG_HOST_FAILURE);
+  }
+
+  SIMIX_action_destroy(act_sleep);
+  MSG_RETURN(MSG_OK);
 }
 
 /** \ingroup msg_gos_functions
  * \brief Return the number of MSG tasks currently running on
  * the host of the current running process.
  */
-static int
-MSG_get_msgload(void)
+static int MSG_get_msgload(void)
 {
-       xbt_die("not implemented yet");
-       return 0;
+  xbt_die("not implemented yet");
+  return 0;
 }
 
 
@@ -300,7 +294,7 @@ MSG_get_msgload(void)
 MSG_error_t
 MSG_task_get_from_host(m_task_t * task, m_channel_t channel, m_host_t host)
 {
-       return MSG_task_get_ext(task, channel, -1, host);
+  return MSG_task_get_ext(task, channel, -1, host);
 }
 
 /** \ingroup msg_gos_functions
@@ -317,10 +311,9 @@ MSG_task_get_from_host(m_task_t * task, m_channel_t channel, m_host_t host)
  * \return #MSG_FATAL if \a task is equal to \c NULL, #MSG_WARNING
  * if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
  */
-MSG_error_t
-MSG_task_get(m_task_t * task, m_channel_t channel)
+MSG_error_t MSG_task_get(m_task_t * task, m_channel_t channel)
 {
-       return MSG_task_get_with_timeout(task, channel, -1);
+  return MSG_task_get_with_timeout(task, channel, -1);
 }
 
 /** \ingroup msg_gos_functions
@@ -342,7 +335,8 @@ MSG_task_get(m_task_t * task, m_channel_t channel)
    if \a *task is not equal to \c NULL, and #MSG_OK otherwise.
  */
 MSG_error_t
-MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel, double max_duration)
+MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel,
+                          double max_duration)
 {
   return MSG_task_get_ext(task, channel, max_duration, NULL);
 }
@@ -353,35 +347,42 @@ MSG_task_get_with_timeout(m_task_t * task, m_channel_t channel, double max_durat
  */
 
 MSG_error_t
-MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout,m_host_t host)
+MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout,
+                 m_host_t host)
 {
-       xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d",channel);
+  xbt_assert1((channel >= 0)
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
 
-       return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_channel(MSG_host_self(), channel), task, host, timeout);
+  return
+    MSG_mailbox_get_task_ext(MSG_mailbox_get_by_channel
+                             (MSG_host_self(), channel), task, host, timeout);
 }
 
 MSG_error_t
-MSG_task_receive_from_host(m_task_t * task, const charalias, m_host_t host)
+MSG_task_receive_from_host(m_task_t * task, const char *alias, m_host_t host)
 {
-       return MSG_task_receive_ext(task, alias, -1, host);
+  return MSG_task_receive_ext(task, alias, -1, host);
 }
 
-MSG_error_t
-MSG_task_receive(m_task_t * task, const char* alias)
+MSG_error_t MSG_task_receive(m_task_t * task, const char *alias)
 {
-       return MSG_task_receive_with_timeout(task, alias, -1);
+  return MSG_task_receive_with_timeout(task, alias, -1);
 }
 
 MSG_error_t
-MSG_task_receive_with_timeout(m_task_t * task, const char* alias, double timeout)
+MSG_task_receive_with_timeout(m_task_t * task, const char *alias,
+                              double timeout)
 {
-       return MSG_task_receive_ext(task, alias, timeout, NULL);
+  return MSG_task_receive_ext(task, alias, timeout, NULL);
 }
 
 MSG_error_t
-MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t host)
+MSG_task_receive_ext(m_task_t * task, const char *alias, double timeout,
+                     m_host_t host)
 {
-       return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, host, timeout);
+  return MSG_mailbox_get_task_ext(MSG_mailbox_get_by_alias(alias), task, host,
+                                  timeout);
 }
 
 
@@ -411,10 +412,9 @@ MSG_task_receive_ext(m_task_t* task, const char* alias, double timeout, m_host_t
  * #MSG_TRANSFER_FAILURE if the transfer could not be properly done
  * (network failure, dest failure)
  */
-MSG_error_t
-MSG_task_put(m_task_t task, m_host_t dest, m_channel_t channel)
+MSG_error_t MSG_task_put(m_task_t task, m_host_t dest, m_channel_t channel)
 {
-       return MSG_task_put_with_timeout(task, dest, channel, -1.0);
+  return MSG_task_put_with_timeout(task, dest, channel, -1.0);
 }
 
 /** \ingroup msg_gos_functions
@@ -424,10 +424,11 @@ MSG_task_put(m_task_t task, m_host_t dest, m_channel_t channel)
  * \sa MSG_task_put
  */
 MSG_error_t
-MSG_task_put_bounded(m_task_t task, m_host_t dest, m_channel_t channel, double maxrate)
+MSG_task_put_bounded(m_task_t task, m_host_t dest, m_channel_t channel,
+                     double maxrate)
 {
-       task->simdata->rate = maxrate;
-       return MSG_task_put(task, dest, channel);
+  task->simdata->rate = maxrate;
+  return MSG_task_put(task, dest, channel);
 }
 
 /** \ingroup msg_gos_functions \brief Put a task on a channel of an
@@ -460,40 +461,44 @@ MSG_task_put_bounded(m_task_t task, m_host_t dest, m_channel_t channel, double m
    (network failure, dest failure, timeout...)
  */
 MSG_error_t
-MSG_task_put_with_timeout(m_task_t task, m_host_t dest, m_channel_t channel, double timeout)
+MSG_task_put_with_timeout(m_task_t task, m_host_t dest, m_channel_t channel,
+                          double timeout)
 {
-       xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
+  xbt_assert1((channel >= 0)
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
 
-       return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_channel(dest, channel), task, timeout);
+  return
+    MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_channel(dest, channel),
+                                 task, timeout);
 }
 
-MSG_error_t
-MSG_task_send(m_task_t task,const char* alias)
+MSG_error_t MSG_task_send(m_task_t task, const char *alias)
 {
-       return MSG_task_send_with_timeout(task, alias, -1);
+  return MSG_task_send_with_timeout(task, alias, -1);
 }
 
 
 MSG_error_t
-MSG_task_send_bounded(m_task_t task, const charalias, double maxrate)
+MSG_task_send_bounded(m_task_t task, const char *alias, double maxrate)
 {
-       task->simdata->rate = maxrate;
-       return MSG_task_send(task, alias);
+  task->simdata->rate = maxrate;
+  return MSG_task_send(task, alias);
 }
 
 
 MSG_error_t
-MSG_task_send_with_timeout(m_task_t task, const charalias, double timeout)
+MSG_task_send_with_timeout(m_task_t task, const char *alias, double timeout)
 {
-       return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_alias(alias), task, timeout);
+  return MSG_mailbox_put_with_timeout(MSG_mailbox_get_by_alias(alias), task,
+                                      timeout);
 }
 
-int
-MSG_task_listen(const char* alias)
+int MSG_task_listen(const char *alias)
 {
-       CHECK_HOST();
+  CHECK_HOST();
 
-       return !MSG_mailbox_is_empty(MSG_mailbox_get_by_alias(alias));
+  return !MSG_mailbox_is_empty(MSG_mailbox_get_by_alias(alias));
 }
 
 /** \ingroup msg_gos_functions
@@ -505,14 +510,17 @@ MSG_task_listen(const char* alias)
    number of channels fixed with MSG_set_channel_number().
  * \return 1 if there is a pending communication and 0 otherwise
  */
-int
-MSG_task_Iprobe(m_channel_t channel)
+int MSG_task_Iprobe(m_channel_t channel)
 {
-  xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
+  xbt_assert1((channel >= 0)
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
 
   CHECK_HOST();
 
-  return !MSG_mailbox_is_empty(MSG_mailbox_get_by_channel(MSG_host_self(), channel));
+  return
+    !MSG_mailbox_is_empty(MSG_mailbox_get_by_channel
+                          (MSG_host_self(), channel));
 }
 
 /** \ingroup msg_gos_functions
@@ -528,23 +536,28 @@ MSG_task_Iprobe(m_channel_t channel)
  * \return the number of tasks waiting to be received on \a channel
    and sent by \a host.
  */
-int
-MSG_task_probe_from_host(int channel, m_host_t host)
+int MSG_task_probe_from_host(int channel, m_host_t host)
 {
-       xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
+  xbt_assert1((channel >= 0)
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
 
-       CHECK_HOST();
+  CHECK_HOST();
 
-       return MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_channel(MSG_host_self(), channel),host);
+  return
+    MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_channel
+                                             (MSG_host_self(), channel),
+                                             host);
 
 }
 
-int
-MSG_task_listen_from_host(const char* alias, m_host_t host)
+int MSG_task_listen_from_host(const char *alias, m_host_t host)
 {
-       CHECK_HOST();
+  CHECK_HOST();
 
-       return MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_alias(alias),host);
+  return
+    MSG_mailbox_get_count_host_waiting_tasks(MSG_mailbox_get_by_alias(alias),
+                                             host);
 }
 
 /** \ingroup msg_gos_functions
@@ -556,32 +569,35 @@ MSG_task_listen_from_host(const char* alias, m_host_t host)
    number of channels fixed with MSG_set_channel_number().
  * \return -1 if there is no pending communication and the PID of the process who sent it otherwise
  */
-int
-MSG_task_probe_from(m_channel_t channel)
+int MSG_task_probe_from(m_channel_t channel)
 {
-       m_task_t task;
+  m_task_t task;
 
-       CHECK_HOST();
+  CHECK_HOST();
 
-       xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel);
+  xbt_assert1((channel >= 0)
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
 
-       if(NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_channel(MSG_host_self(), channel))))
-               return -1;
+  if (NULL ==
+      (task =
+       MSG_mailbox_get_head(MSG_mailbox_get_by_channel
+                            (MSG_host_self(), channel))))
+    return -1;
 
-       return MSG_process_get_PID(task->simdata->sender);
+  return MSG_process_get_PID(task->simdata->sender);
 }
 
-int
-MSG_task_listen_from(const char* alias)
+int MSG_task_listen_from(const char *alias)
 {
-       m_task_t task;
+  m_task_t task;
 
-       CHECK_HOST();
+  CHECK_HOST();
 
-       if(NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_alias(alias))))
-               return -1;
+  if (NULL == (task = MSG_mailbox_get_head(MSG_mailbox_get_by_alias(alias))))
+    return -1;
 
-       return MSG_process_get_PID(task->simdata->sender);
+  return MSG_process_get_PID(task->simdata->sender);
 }
 
 /** \ingroup msg_gos_functions
@@ -602,171 +618,145 @@ MSG_task_listen_from(const char* alias)
    and #MSG_OK otherwise.
  */
 MSG_error_t
-MSG_channel_select_from(m_channel_t channel,double timeout, int *PID)
+MSG_channel_select_from(m_channel_t channel, double timeout, int *PID)
 {
-       m_host_t h = NULL;
-       simdata_host_t h_simdata = NULL;
-       m_task_t t;
-       int first_time = 1;
-       smx_cond_t cond;
-       msg_mailbox_t mailbox;
-
-       xbt_assert1((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d",channel);
-
-       if(PID)
-       {
-               *PID = -1;
-       }
-
-       if (timeout == 0.0)
-       {
-               *PID = MSG_task_probe_from(channel);
-               MSG_RETURN(MSG_OK);
-       }
-       else
-       {
-               CHECK_HOST();
-               h = MSG_host_self();
-               h_simdata = h->simdata;
-
-               mailbox = MSG_mailbox_get_by_channel(MSG_host_self(), channel);
-
-               while(MSG_mailbox_is_empty(mailbox))
-               {
-                       if(timeout > 0)
-                       {
-                               if (!first_time)
-                               {
-                                       MSG_RETURN(MSG_OK);
-                               }
-                       }
-
-                       SIMIX_mutex_lock(h_simdata->mutex);
-
-                       xbt_assert1(!MSG_mailbox_get_cond(mailbox),"A process is already blocked on this channel %d",channel);
-
-                       cond = SIMIX_cond_init();
-
-                       MSG_mailbox_set_cond(mailbox, cond);
-
-                       if (timeout > 0)
-                       {
-                               SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
-                       }
-                       else
-                       {
-                               SIMIX_cond_wait(cond, h_simdata->mutex);
-                       }
-
-                       SIMIX_cond_destroy(cond);
-                       SIMIX_mutex_unlock(h_simdata->mutex);
-
-                       if (SIMIX_host_get_state(h_simdata->smx_host) == 0)
-                       {
-                               MSG_RETURN(MSG_HOST_FAILURE);
-                       }
-
-                       MSG_mailbox_set_cond(mailbox,NULL);
-                       first_time = 0;
-               }
-
-               if(NULL == (t = MSG_mailbox_get_head(mailbox)))
-                       MSG_RETURN(MSG_OK);
-
-
-               if (PID)
-               {
-                       *PID = MSG_process_get_PID(t->simdata->sender);
-               }
-
-               MSG_RETURN(MSG_OK);
-       }
+  m_host_t h = NULL;
+  simdata_host_t h_simdata = NULL;
+  m_task_t t;
+  int first_time = 1;
+  smx_cond_t cond;
+  msg_mailbox_t mailbox;
+
+  xbt_assert1((channel >= 0)
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
+
+  if (PID) {
+    *PID = -1;
+  }
+
+  if (timeout == 0.0) {
+    *PID = MSG_task_probe_from(channel);
+    MSG_RETURN(MSG_OK);
+  } else {
+    CHECK_HOST();
+    h = MSG_host_self();
+    h_simdata = h->simdata;
+
+    mailbox = MSG_mailbox_get_by_channel(MSG_host_self(), channel);
+
+    while (MSG_mailbox_is_empty(mailbox)) {
+      if (timeout > 0) {
+        if (!first_time) {
+          MSG_RETURN(MSG_OK);
+        }
+      }
+
+      SIMIX_mutex_lock(h_simdata->mutex);
+
+      xbt_assert1(!MSG_mailbox_get_cond(mailbox),
+                  "A process is already blocked on this channel %d", channel);
+
+      cond = SIMIX_cond_init();
+
+      MSG_mailbox_set_cond(mailbox, cond);
+
+      if (timeout > 0) {
+        SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
+      } else {
+        SIMIX_cond_wait(cond, h_simdata->mutex);
+      }
+
+      SIMIX_cond_destroy(cond);
+      SIMIX_mutex_unlock(h_simdata->mutex);
+
+      if (SIMIX_host_get_state(h_simdata->smx_host) == 0) {
+        MSG_RETURN(MSG_HOST_FAILURE);
+      }
+
+      MSG_mailbox_set_cond(mailbox, NULL);
+      first_time = 0;
+    }
+
+    if (NULL == (t = MSG_mailbox_get_head(mailbox)))
+      MSG_RETURN(MSG_OK);
+
+
+    if (PID) {
+      *PID = MSG_process_get_PID(t->simdata->sender);
+    }
+
+    MSG_RETURN(MSG_OK);
+  }
 }
 
 
-MSG_error_t
-MSG_alias_select_from(const char* alias, double timeout, int* PID)
+MSG_error_t MSG_alias_select_from(const char *alias, double timeout, int *PID)
 {
-       m_host_t h = NULL;
-       simdata_host_t h_simdata = NULL;
-       m_task_t t;
-       int first_time = 1;
-       smx_cond_t cond;
-       msg_mailbox_t mailbox;
-
-       if (PID)
-       {
-               *PID = -1;
-       }
-
-       if(timeout == 0.0)
-       {
-               *PID = MSG_task_listen_from(alias);
-               MSG_RETURN(MSG_OK);
-       }
-       else
-       {
-               CHECK_HOST();
-               h = MSG_host_self();
-               h_simdata = h->simdata;
-
-               DEBUG2("Probing on alias %s (%s)", alias, h->name);
-
-               mailbox = MSG_mailbox_get_by_alias(alias);
-
-               while(MSG_mailbox_is_empty(mailbox))
-               {
-                       if(timeout > 0)
-                       {
-                               if (!first_time)
-                               {
-                                       MSG_RETURN(MSG_OK);
-                               }
-                       }
-
-                       SIMIX_mutex_lock(h_simdata->mutex);
-
-                       xbt_assert1(!MSG_mailbox_get_cond(mailbox),"A process is already blocked on this alias %s",alias);
-
-                       cond = SIMIX_cond_init();
-
-                       MSG_mailbox_set_cond(mailbox, cond);
-
-                       if (timeout > 0)
-                       {
-                               SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
-                       }
-                       else
-                       {
-                               SIMIX_cond_wait(cond, h_simdata->mutex);
-                       }
-
-                       SIMIX_cond_destroy(cond);
-                       SIMIX_mutex_unlock(h_simdata->mutex);
-
-                       if (SIMIX_host_get_state(h_simdata->smx_host) == 0)
-                       {
-                               MSG_RETURN(MSG_HOST_FAILURE);
-                       }
-
-                       MSG_mailbox_set_cond(mailbox,NULL);
-                       first_time = 0;
-               }
-
-               if(NULL == (t = MSG_mailbox_get_head(mailbox)))
-                       MSG_RETURN(MSG_OK);
-
-
-               if (PID)
-               {
-                       *PID = MSG_process_get_PID(t->simdata->sender);
-               }
-
-               MSG_RETURN(MSG_OK);
-       }
-}
+  m_host_t h = NULL;
+  simdata_host_t h_simdata = NULL;
+  m_task_t t;
+  int first_time = 1;
+  smx_cond_t cond;
+  msg_mailbox_t mailbox;
+
+  if (PID) {
+    *PID = -1;
+  }
 
+  if (timeout == 0.0) {
+    *PID = MSG_task_listen_from(alias);
+    MSG_RETURN(MSG_OK);
+  } else {
+    CHECK_HOST();
+    h = MSG_host_self();
+    h_simdata = h->simdata;
 
+    DEBUG2("Probing on alias %s (%s)", alias, h->name);
 
+    mailbox = MSG_mailbox_get_by_alias(alias);
 
+    while (MSG_mailbox_is_empty(mailbox)) {
+      if (timeout > 0) {
+        if (!first_time) {
+          MSG_RETURN(MSG_OK);
+        }
+      }
 
+      SIMIX_mutex_lock(h_simdata->mutex);
+
+      xbt_assert1(!MSG_mailbox_get_cond(mailbox),
+                  "A process is already blocked on this alias %s", alias);
+
+      cond = SIMIX_cond_init();
+
+      MSG_mailbox_set_cond(mailbox, cond);
+
+      if (timeout > 0) {
+        SIMIX_cond_wait_timeout(cond, h_simdata->mutex, timeout);
+      } else {
+        SIMIX_cond_wait(cond, h_simdata->mutex);
+      }
+
+      SIMIX_cond_destroy(cond);
+      SIMIX_mutex_unlock(h_simdata->mutex);
+
+      if (SIMIX_host_get_state(h_simdata->smx_host) == 0) {
+        MSG_RETURN(MSG_HOST_FAILURE);
+      }
+
+      MSG_mailbox_set_cond(mailbox, NULL);
+      first_time = 0;
+    }
+
+    if (NULL == (t = MSG_mailbox_get_head(mailbox)))
+      MSG_RETURN(MSG_OK);
+
+
+    if (PID) {
+      *PID = MSG_process_get_PID(t->simdata->sender);
+    }
+
+    MSG_RETURN(MSG_OK);
+  }
+}
index af47296..f5d3057 100644 (file)
 /********************************* Host **************************************/
 m_host_t __MSG_host_create(smx_host_t workstation, void *data)
 {
-       const char *name;
-       simdata_host_t simdata = xbt_new0(s_simdata_host_t, 1);
-       m_host_t host = xbt_new0(s_m_host_t, 1);
-       int i;
-       
-       char alias[MAX_ALIAS_NAME +1] = {0}; /* buffer used to build the key of the mailbox */
-       
-       name = SIMIX_host_get_name(workstation);
-       /* Host structure */
-       host->name = xbt_strdup(name);
-       host->simdata = simdata;
-       host->data = data;
-       
-       simdata->smx_host = workstation;
-
-       if (msg_global->max_channel>0)   
-               simdata->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel);
-       
-       for (i = 0; i < msg_global->max_channel; i++)
-       {
-               sprintf(alias,"%s:%d",name,i);
-               
-               /* the key of the mailbox (in this case) is build from the name of the host and the channel number */
-               simdata->mailboxes[i] = MSG_mailbox_create(alias);
-               MSG_mailbox_set_hostname(simdata->mailboxes[i],name);
-               memset(alias,0,MAX_ALIAS_NAME +1);
-       }
-       
-       simdata->mutex = SIMIX_mutex_init();
-       SIMIX_host_set_data(workstation, host);
-       
-       /* Update global variables */
-       xbt_fifo_unshift(msg_global->host, host);
-       
-       return host;
+  const char *name;
+  simdata_host_t simdata = xbt_new0(s_simdata_host_t, 1);
+  m_host_t host = xbt_new0(s_m_host_t, 1);
+  int i;
+
+  char alias[MAX_ALIAS_NAME + 1] = { 0 };       /* buffer used to build the key of the mailbox */
+
+  name = SIMIX_host_get_name(workstation);
+  /* Host structure */
+  host->name = xbt_strdup(name);
+  host->simdata = simdata;
+  host->data = data;
+
+  simdata->smx_host = workstation;
+
+  if (msg_global->max_channel > 0)
+    simdata->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel);
+
+  for (i = 0; i < msg_global->max_channel; i++) {
+    sprintf(alias, "%s:%d", name, i);
+
+    /* the key of the mailbox (in this case) is build from the name of the host and the channel number */
+    simdata->mailboxes[i] = MSG_mailbox_create(alias);
+    MSG_mailbox_set_hostname(simdata->mailboxes[i], name);
+    memset(alias, 0, MAX_ALIAS_NAME + 1);
+  }
+
+  simdata->mutex = SIMIX_mutex_init();
+  SIMIX_host_set_data(workstation, host);
+
+  /* Update global variables */
+  xbt_fifo_unshift(msg_global->host, host);
+
+  return host;
 }
 
 /** \ingroup m_host_management
@@ -113,7 +112,7 @@ const char *MSG_host_get_name(m_host_t host)
 {
 
   xbt_assert0((host != NULL)
-             && (host->simdata != NULL), "Invalid parameters");
+              && (host->simdata != NULL), "Invalid parameters");
 
   /* Return data */
   return (host->name);
@@ -135,32 +134,31 @@ m_host_t MSG_host_self(void)
  */
 void __MSG_host_destroy(m_host_t host)
 {
-       simdata_host_t simdata = NULL;
-       int i = 0;
-       char alias[MAX_ALIAS_NAME +1] = {0}; /* buffer used to build the key of the mailbox */
-       
-       xbt_assert0((host != NULL), "Invalid parameters");
-       
-       /* Clean Simulator data */
-       /* SIMIX host will be cleaned when MSG_clean calls SIMIX_clean */
-       simdata = (host)->simdata;
-       
-       for (i = 0; i < msg_global->max_channel; i++)
-       {
-               sprintf(alias,"%s:%d",host->name,i);
-               MSG_mailbox_free((void*)(simdata->mailboxes[i]));
-               memset(alias,0,MAX_ALIAS_NAME +1);
-       }
-       
-       if (msg_global->max_channel>0)   
-               free(simdata->mailboxes);
-       SIMIX_mutex_destroy(simdata->mutex);
-       free(simdata);
-       
-       /* Clean host structure */
-       free(host->name);
-       free(host);
-       
+  simdata_host_t simdata = NULL;
+  int i = 0;
+  char alias[MAX_ALIAS_NAME + 1] = { 0 };       /* buffer used to build the key of the mailbox */
+
+  xbt_assert0((host != NULL), "Invalid parameters");
+
+  /* Clean Simulator data */
+  /* SIMIX host will be cleaned when MSG_clean calls SIMIX_clean */
+  simdata = (host)->simdata;
+
+  for (i = 0; i < msg_global->max_channel; i++) {
+    sprintf(alias, "%s:%d", host->name, i);
+    MSG_mailbox_free((void *) (simdata->mailboxes[i]));
+    memset(alias, 0, MAX_ALIAS_NAME + 1);
+  }
+
+  if (msg_global->max_channel > 0)
+    free(simdata->mailboxes);
+  SIMIX_mutex_destroy(simdata->mutex);
+  free(simdata);
+
+  /* Clean host structure */
+  free(host->name);
+  free(host);
+
 
 }
 
@@ -210,7 +208,7 @@ double MSG_get_host_speed(m_host_t h)
  * \param name a property name
  * \return value of a property (or NULL if property not set)
  */
-const char* MSG_host_get_property_value(m_host_t host, const char* name)
+const char *MSG_host_get_property_value(m_host_t host, const char *name)
 {
   return xbt_dict_get_or_null(MSG_host_get_properties(host), name);
 }
index 3b1b316..7664a19 100644 (file)
@@ -13,7 +13,7 @@
 #include "../simix/private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg,
-                               "Logging specific to MSG (process)");
+                                "Logging specific to MSG (process)");
 
 /** \defgroup m_process_management Management Functions of Agents
  *  \brief This section describes the agent structure of MSG
@@ -47,12 +47,13 @@ void __MSG_process_cleanup(void *arg)
 
 /* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */
 void *_MSG_process_create_from_SIMIX(const char *name,
-                                    xbt_main_func_t code, void *data,
-                                    char *hostname, int argc, char **argv, xbt_dict_t properties)
+                                     xbt_main_func_t code, void *data,
+                                     char *hostname, int argc, char **argv,
+                                     xbt_dict_t properties)
 {
   m_host_t host = MSG_get_host_by_name(hostname);
   return (void *) MSG_process_create_with_environment(name, code, data, host,
-                                                     argc, argv,properties);
+                                                      argc, argv, properties);
 }
 
 /** \ingroup m_process_management
@@ -63,11 +64,11 @@ void *_MSG_process_create_from_SIMIX(const char *name,
  * \sa MSG_process_create_with_arguments
  */
 m_process_t MSG_process_create(const char *name,
-                              xbt_main_func_t code, void *data,
-                              m_host_t host)
+                               xbt_main_func_t code, void *data,
+                               m_host_t host)
 {
   return MSG_process_create_with_environment(name, code, data, host, -1,
-                                            NULL,NULL);
+                                             NULL, NULL);
 }
 
 /** \ingroup m_process_management
@@ -96,12 +97,12 @@ m_process_t MSG_process_create(const char *name,
  */
 
 m_process_t MSG_process_create_with_arguments(const char *name,
-                                             xbt_main_func_t code,
-                                             void *data, m_host_t host,
-                                             int argc, char **argv)
+                                              xbt_main_func_t code,
+                                              void *data, m_host_t host,
+                                              int argc, char **argv)
 {
   return MSG_process_create_with_environment(name, code, data, host,
-                                            argc,argv,NULL);
+                                             argc, argv, NULL);
 }
 
 /** \ingroup m_process_management
@@ -130,9 +131,10 @@ m_process_t MSG_process_create_with_arguments(const char *name,
  * \return The new corresponding object.
  */
 m_process_t MSG_process_create_with_environment(const char *name,
-                                             xbt_main_func_t code,
-                                             void *data, m_host_t host,
-                                             int argc, char **argv, xbt_dict_t properties)
+                                                xbt_main_func_t code,
+                                                void *data, m_host_t host,
+                                                int argc, char **argv,
+                                                xbt_dict_t properties)
 {
   simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1);
   m_process_t process = xbt_new0(s_m_process_t, 1);
@@ -145,8 +147,8 @@ m_process_t MSG_process_create_with_environment(const char *name,
   simdata->argc = argc;
   simdata->argv = argv;
   simdata->s_process = SIMIX_process_create(name, code,
-                                           (void *) process, host->name,
-                                           argc, argv, properties);
+                                            (void *) process, host->name,
+                                            argc, argv, properties);
 
   if (SIMIX_process_self()) {
     simdata->PPID = MSG_process_get_PID(SIMIX_process_self()->data);
@@ -182,7 +184,7 @@ void MSG_process_kill(m_process_t process)
   simdata_process_t p_simdata = process->simdata;
 
   DEBUG3("Killing %s(%d) on %s",
-        process->name, p_simdata->PID, p_simdata->m_host->name);
+         process->name, p_simdata->PID, p_simdata->m_host->name);
 
   if (p_simdata->waiting_task) {
     DEBUG1("Canceling waiting task %s", p_simdata->waiting_task->name);
@@ -210,7 +212,8 @@ MSG_error_t MSG_process_change_host(m_host_t host)
   m_process_t process = MSG_process_self();
   m_host_t now = process->simdata->m_host;
   process->simdata->m_host = host;
-  SIMIX_process_change_host(process->simdata->s_process, now->name, host->name);
+  SIMIX_process_change_host(process->simdata->s_process, now->name,
+                            host->name);
   return MSG_OK;
 }
 
@@ -253,7 +256,7 @@ MSG_error_t MSG_process_set_data(m_process_t process, void *data)
 m_host_t MSG_process_get_host(m_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
 
   return (((simdata_process_t) process->simdata)->m_host);
 }
@@ -304,7 +307,7 @@ int MSG_process_get_PID(m_process_t process)
 int MSG_process_get_PPID(m_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
 
   return (((simdata_process_t) process->simdata)->PPID);
 }
@@ -317,8 +320,9 @@ int MSG_process_get_PPID(m_process_t process)
  */
 const char *MSG_process_get_name(m_process_t process)
 {
-         xbt_assert0(process, "Invalid parameter: process is NULL");
-         xbt_assert0(process->simdata, "Invalid parameter: process->simdata is NULL");
+  xbt_assert0(process, "Invalid parameter: process is NULL");
+  xbt_assert0(process->simdata,
+              "Invalid parameter: process->simdata is NULL");
 
   return (process->name);
 }
@@ -330,7 +334,8 @@ const char *MSG_process_get_name(m_process_t process)
  * \param name a property name
  * \return value of a property (or NULL if the property is not set)
  */
-const char* MSG_process_get_property_value(m_process_t process, const char* name)
+const char *MSG_process_get_property_value(m_process_t process,
+                                           const char *name)
 {
   return xbt_dict_get_or_null(MSG_process_get_properties(process), name);
 }
@@ -342,9 +347,10 @@ const char* MSG_process_get_property_value(m_process_t process, const char* name
  */
 xbt_dict_t MSG_process_get_properties(m_process_t process)
 {
-   xbt_assert0((process != NULL), "Invalid parameters");
+  xbt_assert0((process != NULL), "Invalid parameters");
 
-  return (SIMIX_process_get_properties(((simdata_process_t)process->simdata)->s_process));
+  return (SIMIX_process_get_properties
+          (((simdata_process_t) process->simdata)->s_process));
 
 }
 
@@ -394,7 +400,7 @@ m_process_t MSG_process_self(void)
 MSG_error_t MSG_process_suspend(m_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
   CHECK_HOST();
 
   SIMIX_process_suspend(process->simdata->s_process);
@@ -411,7 +417,7 @@ MSG_error_t MSG_process_resume(m_process_t process)
 {
 
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
   CHECK_HOST();
 
   SIMIX_process_resume(process->simdata->s_process);
@@ -427,6 +433,6 @@ MSG_error_t MSG_process_resume(m_process_t process)
 int MSG_process_is_suspended(m_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
   return SIMIX_process_is_suspended(process->simdata->s_process);
 }
index bceaa98..e7c00fd 100644 (file)
@@ -10,12 +10,12 @@ SG_BEGIN_DECL()
 /*
  * Initialization of the mailbox module.
  */
-void MSG_mailbox_mod_init(void);
+     void MSG_mailbox_mod_init(void);
 
 /*
  * Terminaison of the mailbox module.
  */
-void MSG_mailbox_mod_exit(void);
+     void MSG_mailbox_mod_exit(void);
 
 
 /*! \brief MSG_mailbox_new - create a new mailbox.
@@ -28,7 +28,7 @@ void MSG_mailbox_mod_exit(void);
  * \return             The newly created mailbox.
  */
 XBT_PUBLIC(msg_mailbox_t)
-MSG_mailbox_new(const char *alias);
+  MSG_mailbox_new(const char *alias);
 
 /*! \brief MSG_mailbox_create - create a new mailbox.
  *
@@ -41,8 +41,7 @@ MSG_mailbox_new(const char *alias);
  *
  * \return             The newly created mailbox.
  */
-msg_mailbox_t
-MSG_mailbox_create(const char *alias);
+     msg_mailbox_t MSG_mailbox_create(const char *alias);
 
 /* \brief MSG_mailbox_free - release a mailbox from the memory.
  *
@@ -53,8 +52,7 @@ MSG_mailbox_create(const char *alias);
  *
  * \see                        MSG_mailbox_destroy.
  */
-void
-MSG_mailbox_free(void *mailbox);
+     void MSG_mailbox_free(void *mailbox);
 
 /* \brief MSG_mailbox_get_by_alias - get a mailbox from its alias.
  *
@@ -68,7 +66,7 @@ MSG_mailbox_free(void *mailbox);
  *             or a new mailbox if the key does not match.
  */
 XBT_PUBLIC(msg_mailbox_t)
-MSG_mailbox_get_by_alias(const char *alias);
+  MSG_mailbox_get_by_alias(const char *alias);
 
 /* \brief MSG_mailbox_get_by_channel - get a mailbox of the specified host from its channel.
  *
@@ -84,7 +82,7 @@ MSG_mailbox_get_by_alias(const char *alias);
  *
  */
 XBT_PUBLIC(msg_mailbox_t)
-MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
+  MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
 
 /*! \brief MSG_mailbox_get_alias - get the alias associated with the mailbox.
  *
@@ -95,8 +93,7 @@ MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel);
  *
  * \return     The alias of the mailbox specified by the parameter mailbox.
  */
-XBT_PUBLIC(const char *)
-MSG_mailbox_get_alias(msg_mailbox_t mailbox);
+XBT_PUBLIC(const char *) MSG_mailbox_get_alias(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_get_cond - get the simix condition of a mailbox.
  *
@@ -108,7 +105,7 @@ MSG_mailbox_get_alias(msg_mailbox_t mailbox);
  * \return The simix condition of the mailbox specified by the parameter mailbox.
  */
 XBT_PUBLIC(smx_cond_t)
-MSG_mailbox_get_cond(msg_mailbox_t mailbox);
+  MSG_mailbox_get_cond(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_set_cond - set the simix condition of a mailbox.
  *
@@ -119,8 +116,7 @@ MSG_mailbox_get_cond(msg_mailbox_t mailbox);
  * \param cond         The new simix condition of the mailbox.
  *
  */
-XBT_PUBLIC(void)
-MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
+XBT_PUBLIC(void) MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
 
 /*! \brief MSG_mailbox_get_hostname - get the name of the host owned a mailbox.
  *
@@ -131,8 +127,7 @@ MSG_mailbox_set_cond(msg_mailbox_t mailbox, smx_cond_t cond);
  *
  * \return The name of the host owned the mailbox specified by the parameter mailbox.
  */
-XBT_PUBLIC(const char *)
-MSG_mailbox_get_hostname(msg_mailbox_t mailbox);
+XBT_PUBLIC(const char *) MSG_mailbox_get_hostname(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_set_hostname - set the name of the host owned a mailbox.
  *
@@ -157,8 +152,7 @@ MSG_mailbox_set_hostname(msg_mailbox_t mailbox, const char *hostname);
  * \return     The function returns 1 if the mailbox is empty. Otherwise the function
  *             returns 0.
  */
-XBT_PUBLIC(int)
-MSG_mailbox_is_empty(msg_mailbox_t mailbox);
+XBT_PUBLIC(int) MSG_mailbox_is_empty(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_remove - remove a task from a mailbox.
  *
@@ -167,8 +161,7 @@ MSG_mailbox_is_empty(msg_mailbox_t mailbox);
  * \param mailbox      The mailbox concerned by this operation.
  * \param task         The task to remove from the mailbox.
  */
-XBT_PUBLIC(void)
-MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
+XBT_PUBLIC(void) MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
 
 /*! \brief MSG_mailbox_get_head - get the task at the head of a mailbox.
  *
@@ -181,7 +174,7 @@ MSG_mailbox_remove(msg_mailbox_t mailbox, m_task_t task);
  * \return             The task at the head of the mailbox.
  */
 XBT_PUBLIC(m_task_t)
-MSG_mailbox_get_head(msg_mailbox_t mailbox);
+  MSG_mailbox_get_head(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_pop_head - get the task at the head of a mailbox
  * and remove it from it.
@@ -194,7 +187,7 @@ MSG_mailbox_get_head(msg_mailbox_t mailbox);
  * \return             The task at the head of the mailbox.
  */
 XBT_PUBLIC(m_task_t)
-MSG_mailbox_pop_head(msg_mailbox_t mailbox);
+  MSG_mailbox_pop_head(msg_mailbox_t mailbox);
 
 /*! \brief MSG_mailbox_get_first_host_task - get the first msg task
  * of a specified mailbox, sended by a process of a specified host.
@@ -208,7 +201,7 @@ MSG_mailbox_pop_head(msg_mailbox_t mailbox);
  *                     on the host specified by the parameter host.
  */
 XBT_PUBLIC(m_task_t)
-MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
+  MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
 
 /*! \brief MSG_mailbox_get_count_host_waiting_tasks - Return the number of tasks
    waiting to be received in a mailbox and sent by a host.
@@ -223,9 +216,8 @@ MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host);
  */
 XBT_PUBLIC(int)
 MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
-                                        m_host_t host);
+                                         m_host_t host);
 
 
 SG_END_DECL()
-
-#endif                         /* !SMX_MAILBOX_H */
+#endif /* !SMX_MAILBOX_H */
index f2b1e81..8d1785c 100644 (file)
@@ -22,36 +22,42 @@ static xbt_dynar_t action_list;
  * \param name the reference name of the action.
  * \param code the function; prototype given by the type: void...(xbt_dynar_t action)
  */
-void MSG_action_register(const char*action_name, msg_action_fun function) {
-       xbt_dict_set(action_funs,action_name,function,NULL);
+void MSG_action_register(const char *action_name, msg_action_fun function)
+{
+  xbt_dict_set(action_funs, action_name, function, NULL);
 }
+
 /** \ingroup msg_actions
  * \brief Unregisters a function, which handled a kind of action
  *
  * \param name the reference name of the action.
  */
-void MSG_action_unregister(const char*action_name) {
-       xbt_dict_remove(action_funs,action_name);
+void MSG_action_unregister(const char *action_name)
+{
+  xbt_dict_remove(action_funs, action_name);
 }
 
-static int MSG_action_runner(int argc, char* argv[]) {
-       xbt_dynar_t evt;
-       unsigned int cursor;
+static int MSG_action_runner(int argc, char *argv[])
+{
+  xbt_dynar_t evt;
+  unsigned int cursor;
 
-       xbt_dynar_foreach(action_list,cursor,evt) {
-               if (!strcmp(xbt_dynar_get_as(evt,0,char*),argv[0])) {
-                       msg_action_fun function = xbt_dict_get(action_funs,xbt_dynar_get_as(evt,1,char*));
-                       (*function)(evt);
-               }
-       }
+  xbt_dynar_foreach(action_list, cursor, evt) {
+    if (!strcmp(xbt_dynar_get_as(evt, 0, char *), argv[0])) {
+      msg_action_fun function =
+        xbt_dict_get(action_funs, xbt_dynar_get_as(evt, 1, char *));
+      (*function) (evt);
+    }
+  }
 
-       return 0;
+  return 0;
 }
 
-void _MSG_action_init() {
-       action_funs = xbt_dict_new();
-       action_list = xbt_dynar_new(sizeof(xbt_dynar_t),xbt_dynar_free_voidp);
-       MSG_function_register_default(MSG_action_runner);
+void _MSG_action_init()
+{
+  action_funs = xbt_dict_new();
+  action_list = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
+  MSG_function_register_default(MSG_action_runner);
 }
 
 /** \ingroup msg_actions
@@ -59,37 +65,38 @@ void _MSG_action_init() {
  *
  *  Load a trace file containing actions, and execute them.
  */
-MSG_error_t MSG_action_trace_run(char*path) {
-       MSG_error_t res;
-
-    FILE * fp;
-    char * line = NULL;
-    size_t len = 0;
-    ssize_t read;
-
-    xbt_dynar_t evt;
-
-    fp = fopen(path, "r");
-    xbt_assert2(fp != NULL,"Cannot open %s: %s",path,strerror(errno));
-
-    while ((read = getline(&line, &len, fp)) != -1) {
-       char *comment = strchr(line,'#');
-       if (comment!=NULL)
-               *comment='\0';
-       xbt_str_trim(line,NULL);
-       if (line[0]=='\0')
-               continue;
-       evt = xbt_str_split_quoted(line);
-       xbt_dynar_push(action_list,&evt);
-    }
-
-    if (line)
-        free(line);
-    fclose(fp);
-
-       res = MSG_main();
-       xbt_dynar_free(&action_list);
-       action_list = xbt_dynar_new(sizeof(xbt_dynar_t),xbt_dynar_free_voidp);
-
-       return res;
+MSG_error_t MSG_action_trace_run(char *path)
+{
+  MSG_error_t res;
+
+  FILE *fp;
+  char *line = NULL;
+  size_t len = 0;
+  ssize_t read;
+
+  xbt_dynar_t evt;
+
+  fp = fopen(path, "r");
+  xbt_assert2(fp != NULL, "Cannot open %s: %s", path, strerror(errno));
+
+  while ((read = getline(&line, &len, fp)) != -1) {
+    char *comment = strchr(line, '#');
+    if (comment != NULL)
+      *comment = '\0';
+    xbt_str_trim(line, NULL);
+    if (line[0] == '\0')
+      continue;
+    evt = xbt_str_split_quoted(line);
+    xbt_dynar_push(action_list, &evt);
+  }
+
+  if (line)
+    free(line);
+  fclose(fp);
+
+  res = MSG_main();
+  xbt_dynar_free(&action_list);
+  action_list = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp);
+
+  return res;
 }
index ab2a14c..77afd4c 100644 (file)
@@ -33,12 +33,12 @@ void MSG_config(const char *name, ...)
 
   if (!msg_global) {
     fprintf(stderr,
-           "ERROR: Please call MSG_init() before using MSG_config()\n");
+            "ERROR: Please call MSG_init() before using MSG_config()\n");
     abort();
   }
 
 
-  
+
   /*  xbt_cfg_dump("msg_cfg_set","",_msg_cfg_set); */
   va_start(pa, name);
 
index 1b75fd6..1f1954d 100644 (file)
@@ -2,7 +2,7 @@
 #include "msg/private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg,
-                               "Logging specific to MSG (mailbox)");
+                                "Logging specific to MSG (mailbox)");
 
 static xbt_dict_t msg_mailboxes = NULL;
 
@@ -82,14 +82,13 @@ m_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox)
 }
 
 
-m_task_t
-MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host)
+m_task_t MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host)
 {
   m_task_t task = NULL;
   xbt_fifo_item_t item = NULL;
 
   xbt_fifo_foreach(mailbox->tasks, item, task, m_task_t)
-      if (task->simdata->source == host) {
+    if (task->simdata->source == host) {
     xbt_fifo_remove_item(mailbox->tasks, item);
     return task;
   }
@@ -98,8 +97,7 @@ MSG_mailbox_get_first_host_task(msg_mailbox_t mailbox, m_host_t host)
 }
 
 int
-MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox,
-                                        m_host_t host)
+MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox, m_host_t host)
 {
   m_task_t task = NULL;
   xbt_fifo_item_t item = NULL;
@@ -146,20 +144,19 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
   return mailbox;
 }
 
-msg_mailbox_t
-MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel)
+msg_mailbox_t MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel)
 {
   xbt_assert0((host != NULL), "Invalid host");
   xbt_assert1((channel >= 0)
-             && (channel < msg_global->max_channel), "Invalid channel %d",
-             channel);
+              && (channel < msg_global->max_channel), "Invalid channel %d",
+              channel);
 
   return host->simdata->mailboxes[(size_t) channel];
 }
 
 MSG_error_t
 MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
-                        m_host_t host, double timeout)
+                         m_host_t host, double timeout)
 {
   m_process_t process = MSG_process_self();
   m_task_t t = NULL;
@@ -168,7 +165,7 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
   simdata_host_t h_simdata = NULL;
   double start_time = SIMIX_get_clock();
 
-  smx_cond_t cond = NULL;      //conditional wait if the task isn't on the channel yet
+  smx_cond_t cond = NULL;       //conditional wait if the task isn't on the channel yet
 
   CHECK_HOST();
 
@@ -177,7 +174,7 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
 
   if (*task)
     CRITICAL0
-       ("MSG_task_get() was asked to write in a non empty task struct.");
+      ("MSG_task_get() was asked to write in a non empty task struct.");
 
   /* Get the task */
   h = MSG_host_self();
@@ -187,7 +184,7 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
 
   if (MSG_mailbox_get_cond(mailbox)) {
     CRITICAL1("A process is already blocked on the channel %s",
-             MSG_mailbox_get_alias(mailbox));
+              MSG_mailbox_get_alias(mailbox));
     SIMIX_cond_display_info(MSG_mailbox_get_cond(mailbox));
     xbt_die("Go fix your code!");
   }
@@ -196,30 +193,30 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
     /* if the mailbox is empty (has no task */
     if (!MSG_mailbox_is_empty(mailbox)) {
       if (!host) {
-       /* pop the head of the mailbox */
-       t = MSG_mailbox_pop_head(mailbox);
-       break;
+        /* pop the head of the mailbox */
+        t = MSG_mailbox_pop_head(mailbox);
+        break;
       } else {
-       /* get the first task of the host */
-       if ((t = MSG_mailbox_get_first_host_task(mailbox, host)))
-         break;
+        /* get the first task of the host */
+        if ((t = MSG_mailbox_get_first_host_task(mailbox, host)))
+          break;
       }
     }
 
-    if ((timeout > 0) && (SIMIX_get_clock()-start_time>=timeout)) {
+    if ((timeout > 0) && (SIMIX_get_clock() - start_time >= timeout)) {
       SIMIX_mutex_unlock(h->simdata->mutex);
       MSG_mailbox_set_cond(mailbox, NULL);
       SIMIX_cond_destroy(cond);
       MSG_RETURN(MSG_TRANSFER_FAILURE);
     }
 
-    if(!cond) {
+    if (!cond) {
       cond = SIMIX_cond_init();
       MSG_mailbox_set_cond(mailbox, cond);
     }
 
     if (timeout > 0)
-      SIMIX_cond_wait_timeout(cond, h->simdata->mutex, timeout-start_time);
+      SIMIX_cond_wait_timeout(cond, h->simdata->mutex, timeout - start_time);
     else
       SIMIX_cond_wait(MSG_mailbox_get_cond(mailbox), h->simdata->mutex);
 
@@ -250,11 +247,11 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
   /* Transfer */
   /* create SIMIX action to the communication */
   t_simdata->comm =
-      SIMIX_action_communicate(t_simdata->sender->simdata->m_host->
-                              simdata->smx_host,
-                              process->simdata->m_host->simdata->smx_host,
-                              t->name, t_simdata->message_size,
-                              t_simdata->rate);
+    SIMIX_action_communicate(t_simdata->sender->simdata->m_host->simdata->
+                             smx_host,
+                             process->simdata->m_host->simdata->smx_host,
+                             t->name, t_simdata->message_size,
+                             t_simdata->rate);
 
   /* This is a hack. We know that both the receiver and the sender will
      need to look at the content of t_simdata->comm. And it needs to be
@@ -299,34 +296,34 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task,
       SIMIX_action_destroy(t_simdata->comm);
       t_simdata->comm = NULL;
     } else {
-      t_simdata->comm->refcount --;
+      t_simdata->comm->refcount--;
     }
-    t_simdata->refcount --;
+    t_simdata->refcount--;
     MSG_RETURN(MSG_OK);
   } else if (SIMIX_host_get_state(h_simdata->smx_host) == 0) {
     if (t_simdata->comm->refcount == 1) {
       SIMIX_action_destroy(t_simdata->comm);
       t_simdata->comm = NULL;
     } else {
-      t_simdata->comm->refcount --;
+      t_simdata->comm->refcount--;
     }
-    t_simdata->refcount --;
+    t_simdata->refcount--;
     MSG_RETURN(MSG_HOST_FAILURE);
   } else {
-    if (t_simdata->comm->refcount ==) {
+    if (t_simdata->comm->refcount == 1) {
       SIMIX_action_destroy(t_simdata->comm);
       t_simdata->comm = NULL;
     } else {
-      t_simdata->comm->refcount --;
+      t_simdata->comm->refcount--;
     }
-    t_simdata->refcount --;
+    t_simdata->refcount--;
     MSG_RETURN(MSG_TRANSFER_FAILURE);
   }
 }
 
 MSG_error_t
 MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
-                            double timeout)
+                             double timeout)
 {
   m_process_t process = MSG_process_self();
   const char *hostname;
@@ -341,12 +338,12 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
   t_simdata->sender = process;
   t_simdata->source = MSG_process_get_host(process);
 
-  xbt_assert0(t_simdata->refcount  == 1,
-             "This task is still being used somewhere else. You cannot send it now. Go fix your code!");
+  xbt_assert0(t_simdata->refcount == 1,
+              "This task is still being used somewhere else. You cannot send it now. Go fix your code!");
 
   t_simdata->comm = NULL;
 
-  t_simdata->refcount ++;
+  t_simdata->refcount++;
   local_host = ((simdata_process_t) process->simdata)->m_host;
   msg_global->sent_msg++;
 
@@ -360,8 +357,8 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
 
 
   DEBUG4("Trying to send a task (%g kB) from %s to %s on the channel %s",
-                 t_simdata->message_size / 1000, local_host->name,
-                 remote_host->name, MSG_mailbox_get_alias(mailbox));
+         t_simdata->message_size / 1000, local_host->name,
+         remote_host->name, MSG_mailbox_get_alias(mailbox));
 
   SIMIX_mutex_lock(remote_host->simdata->mutex);
 
@@ -388,44 +385,43 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
     TRY {
       /*verify if the action that ends is the correct. Call the wait_timeout with the new time. If the timeout occurs, an exception is raised */
       while (1) {
-       time_elapsed = SIMIX_get_clock() - time;
-       SIMIX_cond_wait_timeout(t_simdata->cond, t_simdata->mutex,
-                               timeout - time_elapsed);
-
-       if ((t_simdata->comm != NULL)
-           && (SIMIX_action_get_state(t_simdata->comm) !=
-               SURF_ACTION_RUNNING))
-         break;
+        time_elapsed = SIMIX_get_clock() - time;
+        SIMIX_cond_wait_timeout(t_simdata->cond, t_simdata->mutex,
+                                timeout - time_elapsed);
+
+        if ((t_simdata->comm != NULL)
+            && (SIMIX_action_get_state(t_simdata->comm) !=
+                SURF_ACTION_RUNNING))
+          break;
       }
     }
     CATCH(e) {
       if (e.category == timeout_error) {
-       xbt_ex_free(e);
-       /* verify if the timeout happened and the communication didn't started yet */
-       if (t_simdata->comm == NULL) {
-         process->simdata->waiting_task = NULL;
+        xbt_ex_free(e);
+        /* verify if the timeout happened and the communication didn't started yet */
+        if (t_simdata->comm == NULL) {
+          process->simdata->waiting_task = NULL;
 
-         /* remove the task from the mailbox */
-         MSG_mailbox_remove(mailbox, task);
+          /* remove the task from the mailbox */
+          MSG_mailbox_remove(mailbox, task);
 
-         if (t_simdata->receiver && t_simdata->receiver->simdata) { /* receiver still around */
-           t_simdata->receiver->simdata->waiting_task = NULL;
-         }
+          if (t_simdata->receiver && t_simdata->receiver->simdata) {    /* receiver still around */
+            t_simdata->receiver->simdata->waiting_task = NULL;
+          }
 
-         SIMIX_mutex_unlock(t_simdata->mutex);
-         MSG_RETURN(MSG_TRANSFER_FAILURE);
-       }
+          SIMIX_mutex_unlock(t_simdata->mutex);
+          MSG_RETURN(MSG_TRANSFER_FAILURE);
+        }
       } else {
-       RETHROW;
+        RETHROW;
       }
     }
   } else {
     while (1) {
       SIMIX_cond_wait(t_simdata->cond, t_simdata->mutex);
 
-      if (SIMIX_action_get_state(t_simdata->comm) !=
-         SURF_ACTION_RUNNING)
-       break;
+      if (SIMIX_action_get_state(t_simdata->comm) != SURF_ACTION_RUNNING)
+        break;
     }
   }
 
@@ -443,7 +439,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
       SIMIX_action_destroy(t_simdata->comm);
       t_simdata->comm = NULL;
     } else {
-      t_simdata->comm->refcount --;
+      t_simdata->comm->refcount--;
     }
     MSG_RETURN(MSG_OK);
   } else if (SIMIX_host_get_state(local_host->simdata->smx_host) == 0) {
@@ -451,7 +447,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
       SIMIX_action_destroy(t_simdata->comm);
       t_simdata->comm = NULL;
     } else {
-      t_simdata->comm->refcount --;
+      t_simdata->comm->refcount--;
     }
     MSG_RETURN(MSG_HOST_FAILURE);
   } else {
@@ -459,7 +455,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
       SIMIX_action_destroy(t_simdata->comm);
       t_simdata->comm = NULL;
     } else {
-      t_simdata->comm->refcount --;
+      t_simdata->comm->refcount--;
     }
     MSG_RETURN(MSG_TRANSFER_FAILURE);
   }
index 562b6b0..0760077 100644 (file)
 SG_BEGIN_DECL()
 
 /**************** datatypes **********************************/
-
 /* this structure represents a mailbox */
-typedef struct s_msg_mailbox
-{
-       char* alias;                                            /* the key of the mailbox in the global dictionary                      */
-       xbt_fifo_t tasks;                                       /* the list of the tasks in the mailbox                                         */
-       smx_cond_t cond;                                        /* the condition on the mailbox                                                         */
-       char* hostname;                                         /* the name of the host containing the mailbox                          */
-}s_msg_mailbox_t;
-
-typedef struct simdata_host
-{
-       smx_host_t smx_host;                            /* SURF modeling                                                                */
-       struct s_msg_mailbox** mailboxes;       /* mailboxes to store msg tasks of of the host  */
-       smx_mutex_t mutex;                                      /* mutex to access the host                                     */
-}s_simdata_host_t;
+     typedef struct s_msg_mailbox {
+       char *alias;             /* the key of the mailbox in the global dictionary                      */
+       xbt_fifo_t tasks;        /* the list of the tasks in the mailbox                                         */
+       smx_cond_t cond;         /* the condition on the mailbox                                                         */
+       char *hostname;          /* the name of the host containing the mailbox                          */
+     } s_msg_mailbox_t;
+
+     typedef struct simdata_host {
+       smx_host_t smx_host;     /* SURF modeling                                                                */
+       struct s_msg_mailbox **mailboxes;        /* mailboxes to store msg tasks of of the host  */
+       smx_mutex_t mutex;       /* mutex to access the host                                     */
+     } s_simdata_host_t;
 
 /********************************* Task **************************************/
 
-typedef struct simdata_task {
-  smx_action_t compute;        /* SURF modeling of computation  */
-  smx_action_t comm;           /* SURF modeling of communication  */
-  double message_size;         /* Data size  */
-  double computation_amount;   /* Computation size  */
-       smx_cond_t cond;
-       smx_mutex_t mutex;                              /* Task mutex */
-  m_process_t sender;
-  m_process_t receiver;
-  m_host_t source;
-  double priority;
-  double rate;
-  int refcount ;
+     typedef struct simdata_task {
+       smx_action_t compute;    /* SURF modeling of computation  */
+       smx_action_t comm;       /* SURF modeling of communication  */
+       double message_size;     /* Data size  */
+       double computation_amount;       /* Computation size  */
+       smx_cond_t cond;
+       smx_mutex_t mutex;       /* Task mutex */
+       m_process_t sender;
+       m_process_t receiver;
+       m_host_t source;
+       double priority;
+       double rate;
+       int refcount;
   /*******  Parallel Tasks Only !!!! *******/
-  int host_nb;
-  smx_host_t *host_list;
-  double *comp_amount;
-  double *comm_amount;
-} s_simdata_task_t;
+       int host_nb;
+       smx_host_t *host_list;
+       double *comp_amount;
+       double *comm_amount;
+     } s_simdata_task_t;
 
 /******************************* Process *************************************/
 
-typedef struct simdata_process {
-  m_host_t m_host;              /* the host on which the process is running */
-  smx_process_t s_process;
-  int PID;                     /* used for debugging purposes */
-  int PPID;                    /* The parent PID */
-  m_host_t put_host;           /* used for debugging purposes */
-  m_channel_t put_channel;     /* used for debugging purposes */
-  m_task_t waiting_task;
-  int argc;                     /* arguments number if any */
-  char **argv;                  /* arguments table if any */
-  MSG_error_t last_errno;       /* the last value returned by a MSG_function */
-} s_simdata_process_t;
-
-typedef struct process_arg {
-  const char *name;
-  xbt_main_func_t code;
-  void *data;
-  m_host_t m_host;
-  int argc;
-  char **argv;
-  double kill_time;
-} s_process_arg_t, *process_arg_t;
+     typedef struct simdata_process {
+       m_host_t m_host;         /* the host on which the process is running */
+       smx_process_t s_process;
+       int PID;                 /* used for debugging purposes */
+       int PPID;                /* The parent PID */
+       m_host_t put_host;       /* used for debugging purposes */
+       m_channel_t put_channel; /* used for debugging purposes */
+       m_task_t waiting_task;
+       int argc;                /* arguments number if any */
+       char **argv;             /* arguments table if any */
+       MSG_error_t last_errno;  /* the last value returned by a MSG_function */
+     } s_simdata_process_t;
+
+     typedef struct process_arg {
+       const char *name;
+       xbt_main_func_t code;
+       void *data;
+       m_host_t m_host;
+       int argc;
+       char **argv;
+       double kill_time;
+     } s_process_arg_t, *process_arg_t;
 
 /************************** Global variables ********************************/
-typedef struct MSG_Global {
-  xbt_fifo_t host;
-  xbt_fifo_t process_list;
-  int max_channel;
-  int PID;
-  int session;
-  unsigned long int sent_msg; /* Total amount of messages sent during the simulation */
-} s_MSG_Global_t, *MSG_Global_t;
+     typedef struct MSG_Global {
+       xbt_fifo_t host;
+       xbt_fifo_t process_list;
+       int max_channel;
+       int PID;
+       int session;
+       unsigned long int sent_msg;      /* Total amount of messages sent during the simulation */
+     } s_MSG_Global_t, *MSG_Global_t;
 
 /*extern MSG_Global_t msg_global;*/
 XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
@@ -112,19 +109,20 @@ XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
 #define CHECK_HOST()  xbt_assert1(SIMIX_host_get_state(SIMIX_host_self())==1,\
                                   "Host failed, you cannot call this function. (state=%d)",SIMIX_host_get_state(SIMIX_host_self()))
 
-m_host_t __MSG_host_create(smx_host_t workstation, void *data);
+     m_host_t __MSG_host_create(smx_host_t workstation, void *data);
 
-void __MSG_host_destroy(m_host_t host);
+     void __MSG_host_destroy(m_host_t host);
 
-void __MSG_display_process_status(void);
+     void __MSG_display_process_status(void);
 
-void __MSG_process_cleanup(void *arg);
-void *_MSG_process_create_from_SIMIX(const char *name,
-                                    xbt_main_func_t code, void *data,
-                                    char * hostname, int argc, char **argv, xbt_dict_t properties);
-void _MSG_process_kill_from_SIMIX(void *p);
+     void __MSG_process_cleanup(void *arg);
+     void *_MSG_process_create_from_SIMIX(const char *name,
+                                          xbt_main_func_t code, void *data,
+                                          char *hostname, int argc,
+                                          char **argv, xbt_dict_t properties);
+     void _MSG_process_kill_from_SIMIX(void *p);
 
-void _MSG_action_init(void);
+     void _MSG_action_init(void);
 
 SG_END_DECL()
 #endif
index 0d6cd42..60082dc 100644 (file)
@@ -47,7 +47,7 @@
  * \return The new corresponding object.
  */
 m_task_t MSG_task_create(const char *name, double compute_duration,
-                        double message_size, void *data)
+                         double message_size, void *data)
 {
   m_task_t task = xbt_new(s_m_task_t, 1);
   simdata_task_t simdata = xbt_new(s_simdata_task_t, 1);
@@ -61,7 +61,7 @@ m_task_t MSG_task_create(const char *name, double compute_duration,
   simdata->message_size = message_size;
   simdata->rate = -1.0;
   simdata->priority = 1.0;
-  simdata->refcount  = 1;
+  simdata->refcount = 1;
   simdata->sender = NULL;
   simdata->receiver = NULL;
   simdata->cond = SIMIX_cond_init();
@@ -135,8 +135,8 @@ MSG_error_t MSG_task_destroy(m_task_t task)
   xbt_assert0((task != NULL), "Invalid parameter");
 
   /* why? if somebody is using, then you can't free! ok... but will return MSG_OK? when this task will be destroyed? isn't the user code wrong? */
-  task->simdata->refcount --;
-  if (task->simdata->refcount  > 0)
+  task->simdata->refcount--;
+  if (task->simdata->refcount > 0)
     return MSG_OK;
 
   if (task->name)
@@ -191,7 +191,7 @@ MSG_error_t MSG_task_cancel(m_task_t task)
 double MSG_task_get_compute_duration(m_task_t task)
 {
   xbt_assert0((task != NULL)
-             && (task->simdata != NULL), "Invalid parameter");
+              && (task->simdata != NULL), "Invalid parameter");
 
   return task->simdata->computation_amount;
 }
@@ -203,7 +203,7 @@ double MSG_task_get_compute_duration(m_task_t task)
 double MSG_task_get_remaining_computation(m_task_t task)
 {
   xbt_assert0((task != NULL)
-             && (task->simdata != NULL), "Invalid parameter");
+              && (task->simdata != NULL), "Invalid parameter");
 
   if (task->simdata->compute) {
     return SIMIX_action_get_remains(task->simdata->compute);
@@ -221,7 +221,7 @@ double MSG_task_get_remaining_computation(m_task_t task)
 double MSG_task_get_remaining_communication(m_task_t task)
 {
   xbt_assert0((task != NULL)
-             && (task->simdata != NULL), "Invalid parameter");
+              && (task->simdata != NULL), "Invalid parameter");
 
   return SIMIX_action_get_remains(task->simdata->comm);
 }
@@ -233,7 +233,7 @@ double MSG_task_get_remaining_communication(m_task_t task)
 double MSG_task_get_data_size(m_task_t task)
 {
   xbt_assert0((task != NULL)
-             && (task->simdata != NULL), "Invalid parameter");
+              && (task->simdata != NULL), "Invalid parameter");
 
   return task->simdata->message_size;
 }
@@ -249,10 +249,10 @@ double MSG_task_get_data_size(m_task_t task)
 void MSG_task_set_priority(m_task_t task, double priority)
 {
   xbt_assert0((task != NULL)
-             && (task->simdata != NULL), "Invalid parameter");
+              && (task->simdata != NULL), "Invalid parameter");
 
   task->simdata->priority = 1 / priority;
   if (task->simdata->compute)
     SIMIX_action_set_priority(task->simdata->compute,
-                             task->simdata->priority);
+                              task->simdata->priority);
 }
index aef3db0..669bd2b 100644 (file)
@@ -14,7 +14,7 @@
 #include "xbt/misc.h"
 /* 
  * win32 or win64 (__WIN32 is defined for win32 and win64 applications, __TOS_WIN__ is defined by xlC).        
-*/ 
+*/
 #ifdef _WIN32
 # include "win32/config.h"
 # include <windows.h>
 
 #ifdef HAVE_SYS_SOCKET_H
 #  include <sys/socket.h>
-#  include <netinet/in.h>   /* sometimes required for #include <arpa/inet.h> */
-#  include <netinet/tcp.h>  /* TCP_NODELAY */
-#  include <netdb.h>        /* getprotobyname() */
-#  include <arpa/inet.h>    /* inet_ntoa() */
-#  include <sys/types.h>    /* sometimes required for fd_set */
+#  include <netinet/in.h>       /* sometimes required for #include <arpa/inet.h> */
+#  include <netinet/tcp.h>      /* TCP_NODELAY */
+#  include <netdb.h>            /* getprotobyname() */
+#  include <arpa/inet.h>        /* inet_ntoa() */
+#  include <sys/types.h>        /* sometimes required for fd_set */
 # endif
 
 
 #if defined(HAVE_SNPRINTF)
 #include <stdio.h>
 #else
-   XBT_PUBLIC(int) snprintf(char *, size_t, const char *, /*args*/ ...);
-   XBT_PUBLIC(int) vsnprintf(char *, size_t, const char *, va_list);
+XBT_PUBLIC(int) snprintf(char *, size_t, const char *, /*args */ ...);
+XBT_PUBLIC(int) vsnprintf(char *, size_t, const char *, va_list);
 #endif
 
 
 /* use internal functions when OS provided ones are borken */
 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
-extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
-extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
+     extern int portable_snprintf(char *str, size_t str_m, const char *fmt,
+                                  /*args */ ...);
+     extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt,
+                                   va_list ap);
 #define snprintf  portable_snprintf
 #define vsnprintf portable_vsnprintf
 #endif
 
 /* prototype of GNU functions  */
 #if (defined(__GNUC__) && !defined(__cplusplus))
-extern int asprintf  (char **ptr, const char *fmt, /*args*/ ...);
-extern int vasprintf (char **ptr, const char *fmt, va_list ap);
+     extern int asprintf(char **ptr, const char *fmt, /*args */ ...);
+     extern int vasprintf(char **ptr, const char *fmt, va_list ap);
 #endif
 
-extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...);
-extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
+     extern int asnprintf(char **ptr, size_t str_m, const char *fmt,    /*args */
+                          ...);
+     extern int vasnprintf(char **ptr, size_t str_m, const char *fmt,
+                           va_list ap);
 
 /*
  * That's needed to protect solaris's printf from ever seing NULL associated to a %s format
@@ -155,7 +159,7 @@ extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
 /****
  **** Some debugging functions. Can't we find a better place for this??
  ****/
-void hexa_print(const char*name, unsigned char *data, int size);
-const char *hexa_str(unsigned char *data, int size, int downside);
+     void hexa_print(const char *name, unsigned char *data, int size);
+     const char *hexa_str(unsigned char *data, int size, int downside);
 
 #endif /* GRAS_PORTABLE_H */
index 1e69f43..a40e51c 100644 (file)
 /* Global variables */
 
 typedef struct SD_global {
-  xbt_dict_t workstations; /* workstation dictionary */
-  int workstation_count; /* number of workstations */
-  SD_workstation_t *workstation_list; /* array of workstations, created only if
-                                        necessary in SD_workstation_get_list */
-
-  xbt_dict_t links; /* links */
-  int link_count; /* number of links */
-  SD_link_t *link_list; /* array of links, created only if
-                          necessary in SD_link_get_list */
-  SD_link_t *recyclable_route; /* array returned by SD_route_get_list
-                                 and mallocated only once */
-
-  int watch_point_reached; /* has a task just reached a watch point? */
-  
+  xbt_dict_t workstations;      /* workstation dictionary */
+  int workstation_count;        /* number of workstations */
+  SD_workstation_t *workstation_list;   /* array of workstations, created only if
+                                           necessary in SD_workstation_get_list */
+
+  xbt_dict_t links;             /* links */
+  int link_count;               /* number of links */
+  SD_link_t *link_list;         /* array of links, created only if
+                                   necessary in SD_link_get_list */
+  SD_link_t *recyclable_route;  /* array returned by SD_route_get_list
+                                   and mallocated only once */
+
+  int watch_point_reached;      /* has a task just reached a watch point? */
+
   /* task state sets */
   xbt_swag_t not_scheduled_task_set;
   xbt_swag_t scheduled_task_set;
@@ -45,19 +45,19 @@ extern SD_global_t sd_global;
 
 /* Link */
 typedef struct SD_link {
-  void *surf_link; /* surf object */
-  void *data; /* user data */
-  e_SD_link_sharing_policy_t sharing_policy; 
+  void *surf_link;              /* surf object */
+  void *data;                   /* user data */
+  e_SD_link_sharing_policy_t sharing_policy;
 } s_SD_link_t;
 
 /* Workstation */
 typedef struct SD_workstation {
-  void *surf_workstation; /* surf object */
-  void *data; /* user data */
+  void *surf_workstation;       /* surf object */
+  void *data;                   /* user data */
   e_SD_workstation_access_mode_t access_mode;
 
-  xbt_fifo_t task_fifo; /* only used in sequential mode */
-  SD_task_t current_task; /* only used in sequential mode */
+  xbt_fifo_t task_fifo;         /* only used in sequential mode */
+  SD_task_t current_task;       /* only used in sequential mode */
 } s_SD_workstation_t;
 
 /* Task */
@@ -65,7 +65,7 @@ typedef struct SD_task {
   s_xbt_swag_hookup_t state_hookup;
   xbt_swag_t state_set;
   e_SD_task_state_t state;
-  void *data; /* user data */
+  void *data;                   /* user data */
   char *name;
   double amount;
   double remains;
@@ -74,8 +74,8 @@ typedef struct SD_task {
   surf_action_t surf_action;
   unsigned short watch_points;
 
-  int fifo_checked; /* used by SD_task_just_done to make sure we evaluate
-                      the task only once */
+  int fifo_checked;             /* used by SD_task_just_done to make sure we evaluate
+                                   the task only once */
 
   /* dependencies */
   xbt_dynar_t tasks_before;
@@ -83,7 +83,7 @@ typedef struct SD_task {
 
   /* scheduling parameters (only exist in state SD_SCHEDULED) */
   int workstation_nb;
-  SD_workstation_t *workstation_list; /* surf workstations */
+  SD_workstation_t *workstation_list;   /* surf workstations */
   double *computation_amount;
   double *communication_amount;
   double rate;
@@ -115,39 +115,46 @@ void __SD_task_just_done(SD_task_t task);
 /* Functions to test if the task is in a given state. */
 
 /* Returns whether the given task is scheduled or ready. */
-static XBT_INLINE int __SD_task_is_scheduled_or_ready(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_scheduled_or_ready(SD_task_t task)
+{
   return task->state_set == sd_global->scheduled_task_set ||
     task->state_set == sd_global->ready_task_set;
 }
 
 /* Returns whether the state of the given task is SD_NOT_SCHEDULED. */
-static XBT_INLINE int __SD_task_is_not_scheduled(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_not_scheduled(SD_task_t task)
+{
   return task->state_set == sd_global->not_scheduled_task_set;
 }
 
 /* Returns whether the state of the given task is SD_SCHEDULED. */
-static XBT_INLINE int __SD_task_is_scheduled(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_scheduled(SD_task_t task)
+{
   return task->state_set == sd_global->scheduled_task_set;
 }
 
 /* Returns whether the state of the given task is SD_READY. */
-static XBT_INLINE int __SD_task_is_ready(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_ready(SD_task_t task)
+{
   return task->state_set == sd_global->ready_task_set;
 }
 
 /* Returns whether the state of the given task is SD_IN_FIFO. */
-static XBT_INLINE int __SD_task_is_in_fifo(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_in_fifo(SD_task_t task)
+{
   return task->state_set == sd_global->in_fifo_task_set;
 }
 
 /* Returns whether the state of the given task is SD_READY or SD_IN_FIFO. */
-static XBT_INLINE int __SD_task_is_ready_or_in_fifo(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_ready_or_in_fifo(SD_task_t task)
+{
   return task->state_set == sd_global->ready_task_set ||
     task->state_set == sd_global->in_fifo_task_set;
 }
 
 /* Returns whether the state of the given task is SD_RUNNING. */
-static XBT_INLINE int __SD_task_is_running(SD_task_t task) {
+static XBT_INLINE int __SD_task_is_running(SD_task_t task)
+{
   return task->state_set == sd_global->running_task_set;
 }
 
index 2341fc0..a2caf4b 100644 (file)
@@ -7,9 +7,9 @@
 #include "xbt/str.h"
 #include "xbt/config.h"
 
-XBT_LOG_NEW_CATEGORY(sd,"Logging specific to SimDag");
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_kernel,sd,
-                               "Logging specific to SimDag (kernel)");
+XBT_LOG_NEW_CATEGORY(sd, "Logging specific to SimDag");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_kernel, sd,
+                                "Logging specific to SimDag (kernel)");
 
 SD_global_t sd_global = NULL;
 
@@ -21,9 +21,9 @@ SD_global_t sd_global = NULL;
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-static int _sd_init_status = 0;        /* 0: beginning of time; 
-                                  1: pre-inited (cfg_set created); 
-                                  2: inited (running) */
+static int _sd_init_status = 0; /* 0: beginning of time; 
+                                   1: pre-inited (cfg_set created); 
+                                   2: inited (running) */
 static xbt_cfg_t _sd_cfg_set = NULL;
 
 /* callback of the workstation_model variable */
@@ -32,7 +32,7 @@ static void _sd_cfg_cb__workstation_model(const char *name, int pos)
   char *val;
 
   xbt_assert0(_sd_init_status < 2,
-             "Cannot change the model after the initialization");
+              "Cannot change the model after the initialization");
 
   val = xbt_cfg_get_string(_sd_cfg_set, name);
   find_model_description(surf_workstation_model_description, val);
@@ -44,7 +44,7 @@ static void _sd_cfg_cb__cpu_model(const char *name, int pos)
   char *val;
 
   xbt_assert0(_sd_init_status < 2,
-             "Cannot change the model after the initialization");
+              "Cannot change the model after the initialization");
 
   val = xbt_cfg_get_string(_sd_cfg_set, name);
   find_model_description(surf_cpu_model_description, val);
@@ -56,7 +56,7 @@ static void _sd_cfg_cb__network_model(const char *name, int pos)
   char *val;
 
   xbt_assert0(_sd_init_status < 2,
-             "Cannot change the model after the initialization");
+              "Cannot change the model after the initialization");
 
   val = xbt_cfg_get_string(_sd_cfg_set, name);
   find_model_description(surf_network_model_description, val);
@@ -71,26 +71,26 @@ static void sd_config_init(void)
 {
 
   if (_sd_init_status)
-    return;                    /* Already inited, nothing to do */
+    return;                     /* Already inited, nothing to do */
 
   /* Connect our log channels: that must be done manually under windows */
   XBT_LOG_CONNECT(sd_kernel, sd);
   XBT_LOG_CONNECT(sd_task, sd);
   XBT_LOG_CONNECT(sd_workstation, sd);
-   
+
   _sd_init_status = 1;
   _sd_cfg_set = xbt_cfg_new();
 
   xbt_cfg_register(_sd_cfg_set,
-                  "workstation_model", xbt_cfgelm_string, 1, 1,
-                  &_sd_cfg_cb__workstation_model, NULL);
+                   "workstation_model", xbt_cfgelm_string, 1, 1,
+                   &_sd_cfg_cb__workstation_model, NULL);
 
   xbt_cfg_register(_sd_cfg_set,
-                  "cpu_model", xbt_cfgelm_string, 1, 1,
-                  &_sd_cfg_cb__cpu_model, NULL);
+                   "cpu_model", xbt_cfgelm_string, 1, 1,
+                   &_sd_cfg_cb__cpu_model, NULL);
   xbt_cfg_register(_sd_cfg_set,
-                  "network_model", xbt_cfgelm_string, 1, 1,
-                  &_sd_cfg_cb__network_model, NULL);
+                   "network_model", xbt_cfgelm_string, 1, 1,
+                   &_sd_cfg_cb__network_model, NULL);
 
   xbt_cfg_set_string(_sd_cfg_set, "workstation_model", "ptask_L07");
 }
@@ -99,7 +99,7 @@ static void sd_config_finalize(void)
 {
 
   if (!_sd_init_status)
-    return;                    /* Not initialized yet. Nothing to do */
+    return;                     /* Not initialized yet. Nothing to do */
 
   xbt_cfg_free(&_sd_cfg_set);
   _sd_init_status = 0;
@@ -138,7 +138,7 @@ static void sd_cfg_control_set(const char *control_string)
   /* split the string, and remove empty entries */
   set_strings = xbt_str_split_quoted(control_string);
 
-  if (xbt_dynar_length(set_strings) == 0) {    /* vicious user! */
+  if (xbt_dynar_length(set_strings) == 0) {     /* vicious user! */
     xbt_dynar_free(&set_strings);
     return;
   }
@@ -157,9 +157,9 @@ static void sd_cfg_control_set(const char *control_string)
     value++;
 
     xbt_assert1(strlen(name) != 0, "Invalid name for configuration: '%s'",
-               name);
+                name);
     xbt_assert1(strlen(value) != 0,
-               "Invalid value for configuration: '%s'", value);
+                "Invalid value for configuration: '%s'", value);
     INFO2("setting '%s' to '%s'", name, value);
 
     __sd_config_helper(name, value);
@@ -184,12 +184,12 @@ static void sd_cfg_init(int *argc, char **argv)
       /*remove this from argv */
 
       for (j = i + 1; j < *argc; j++) {
-       argv[j - 1] = argv[j];
+        argv[j - 1] = argv[j];
       }
 
       argv[j - 1] = NULL;
       (*argc)--;
-      i--;                     /* compensate effect of next loop incrementation */
+      i--;                      /* compensate effect of next loop incrementation */
     }
   }
 }
@@ -204,11 +204,12 @@ static void sd_cfg_init(int *argc, char **argv)
  * \param argv argument list
  * \see SD_create_environment(), SD_exit()
  */
-void SD_init(int *argc, char **argv) {
+void SD_init(int *argc, char **argv)
+{
 
   s_SD_task_t task;
-  
-  xbt_assert0( !SD_INITIALISED() , "SD_init() already called");
+
+  xbt_assert0(!SD_INITIALISED(), "SD_init() already called");
 
   sd_global = xbt_new(s_SD_global_t, 1);
   sd_global->workstations = xbt_dict_new();
@@ -220,13 +221,20 @@ void SD_init(int *argc, char **argv) {
   sd_global->recyclable_route = NULL;
   sd_global->watch_point_reached = 0;
 
-  sd_global->not_scheduled_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-  sd_global->scheduled_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-  sd_global->ready_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-  sd_global->in_fifo_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-  sd_global->running_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-  sd_global->done_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-  sd_global->failed_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->not_scheduled_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->scheduled_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->ready_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->in_fifo_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->running_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->done_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
+  sd_global->failed_task_set =
+    xbt_swag_new(xbt_swag_offset(task, state_hookup));
   sd_global->task_number = 0;
 
   surf_init(argc, argv);
@@ -245,10 +253,11 @@ void SD_init(int *argc, char **argv) {
  * That being said, this function is still precious if you want to compare a bunch of
  * heuristics on the same platforms.
  */
-void SD_application_reinit(void) {
-   
+void SD_application_reinit(void)
+{
+
   s_SD_task_t task;
-   
+
   if (SD_INITIALISED()) {
     DEBUG0("Recreating the swags...");
     xbt_swag_free(sd_global->not_scheduled_task_set);
@@ -259,13 +268,20 @@ void SD_application_reinit(void) {
     xbt_swag_free(sd_global->done_task_set);
     xbt_swag_free(sd_global->failed_task_set);
 
-    sd_global->not_scheduled_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-    sd_global->scheduled_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-    sd_global->ready_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-    sd_global->in_fifo_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-    sd_global->running_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-    sd_global->done_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
-    sd_global->failed_task_set = xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->not_scheduled_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->scheduled_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->ready_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->in_fifo_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->running_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->done_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
+    sd_global->failed_task_set =
+      xbt_swag_new(xbt_swag_offset(task, state_hookup));
     sd_global->task_number = 0;
   } else {
     WARN0("SD_application_reinit called before initialization of SimDag");
@@ -292,7 +308,8 @@ void SD_application_reinit(void) {
  *
  *     \include small_platform.xml
  */
-void SD_create_environment(const char *platform_file) {
+void SD_create_environment(const char *platform_file)
+{
   xbt_dict_cursor_t cursor = NULL;
   char *name = NULL;
   void *surf_workstation = NULL;
@@ -308,12 +325,12 @@ void SD_create_environment(const char *platform_file) {
   surf_timer_model_init(platform_file);
 
   workstation_model_name =
-      xbt_cfg_get_string(_sd_cfg_set, "workstation_model");
+    xbt_cfg_get_string(_sd_cfg_set, "workstation_model");
 
   DEBUG1("Model : %s", workstation_model_name);
   workstation_id =
-      find_model_description(surf_workstation_model_description,
-                            workstation_model_name);
+    find_model_description(surf_workstation_model_description,
+                           workstation_model_name);
   if (!strcmp(workstation_model_name, "compound")) {
     xbt_ex_t e;
     char *network_model_name = NULL;
@@ -325,42 +342,40 @@ void SD_create_environment(const char *platform_file) {
       cpu_model_name = xbt_cfg_get_string(_sd_cfg_set, "cpu_model");
     } CATCH(e) {
       if (e.category == bound_error) {
-       xbt_assert0(0,
-                   "Set a cpu model to use with the 'compound' workstation model");
-       xbt_ex_free(e);
+        xbt_assert0(0,
+                    "Set a cpu model to use with the 'compound' workstation model");
+        xbt_ex_free(e);
       } else {
-       RETHROW;
+        RETHROW;
       }
     }
 
     TRY {
-      network_model_name =
-         xbt_cfg_get_string(_sd_cfg_set, "network_model");
+      network_model_name = xbt_cfg_get_string(_sd_cfg_set, "network_model");
     }
     CATCH(e) {
       if (e.category == bound_error) {
-       xbt_assert0(0,
-                   "Set a network model to use with the 'compound' workstation model");
-       xbt_ex_free(e);
+        xbt_assert0(0,
+                    "Set a network model to use with the 'compound' workstation model");
+        xbt_ex_free(e);
       } else {
-       RETHROW;
+        RETHROW;
       }
     }
 
     network_id =
-       find_model_description(surf_network_model_description,
-                              network_model_name);
+      find_model_description(surf_network_model_description,
+                             network_model_name);
     cpu_id =
-       find_model_description(surf_cpu_model_description,
-                              cpu_model_name);
+      find_model_description(surf_cpu_model_description, cpu_model_name);
 
     surf_cpu_model_description[cpu_id].model_init(platform_file);
     surf_network_model_description[network_id].model_init(platform_file);
   }
 
   DEBUG0("Call workstation_model_init");
-  surf_workstation_model_description[workstation_id].
-      model_init(platform_file);
+  surf_workstation_model_description[workstation_id].model_init
+    (platform_file);
 
   parse_platform_file(platform_file);
 
@@ -375,7 +390,8 @@ void SD_create_environment(const char *platform_file) {
     __SD_link_create(surf_link, NULL);
   }
 
-  DEBUG2("Workstation number: %d, link number: %d", SD_workstation_get_number(), SD_link_get_number());
+  DEBUG2("Workstation number: %d, link number: %d",
+         SD_workstation_get_number(), SD_link_get_number());
 }
 
 /**
@@ -390,15 +406,15 @@ void SD_create_environment(const char *platform_file) {
  * \return a NULL-terminated array of \ref SD_task_t whose state has changed.
  * \see SD_task_schedule(), SD_task_watch()
  */
-SD_task_tSD_simulate(double how_long)
+SD_task_t *SD_simulate(double how_long)
 {
-  double total_time = 0.0; /* we stop the simulation when total_time >= how_long */
+  double total_time = 0.0;      /* we stop the simulation when total_time >= how_long */
   double elapsed_time = 0.0;
   SD_task_t task, task_safe, dst;
   SD_dependency_t dependency;
   surf_action_t action;
-  SD_task_t *res=NULL;
-  xbt_dynar_t changed_tasks = xbt_dynar_new (sizeof(SD_task_t), NULL);
+  SD_task_t *res = NULL;
+  xbt_dynar_t changed_tasks = xbt_dynar_new(sizeof(SD_task_t), NULL);
   unsigned int iter;
   static int first_time = 1;
 
@@ -407,29 +423,28 @@ SD_task_t* SD_simulate(double how_long)
   INFO0("Starting simulation...");
 
   if (first_time) {
-    surf_presolve(); /* Takes traces into account */
+    surf_presolve();            /* Takes traces into account */
     first_time = 0;
   }
 
-  if(how_long>0) {
-    surf_timer_model->extension_public->set(surf_get_clock()+how_long,
-                                              NULL,NULL);
+  if (how_long > 0) {
+    surf_timer_model->extension_public->set(surf_get_clock() + how_long,
+                                            NULL, NULL);
   }
   sd_global->watch_point_reached = 0;
 
   /* explore the ready tasks */
   xbt_swag_foreach_safe(task, task_safe, sd_global->ready_task_set) {
     INFO1("Executing task '%s'", SD_task_get_name(task));
-    if(__SD_task_try_to_run(task) && 
-       !xbt_dynar_member(changed_tasks,&task))
-      xbt_dynar_push (changed_tasks, &task);
+    if (__SD_task_try_to_run(task) && !xbt_dynar_member(changed_tasks, &task))
+      xbt_dynar_push(changed_tasks, &task);
   }
 
   /* main loop */
   elapsed_time = 0.0;
   while (elapsed_time >= 0.0 &&
-        (how_long < 0.0 || total_time < how_long) &&
-        !sd_global->watch_point_reached) {
+         (how_long < 0.0 || total_time < how_long) &&
+         !sd_global->watch_point_reached) {
     surf_model_t model = NULL;
     /* dumb variables */
     void *fun = NULL;
@@ -445,60 +460,65 @@ SD_task_t* SD_simulate(double how_long)
 
     /* let's see which tasks are done */
     xbt_dynar_foreach(model_list, iter, model) {
-      while ((action = xbt_swag_extract(model->common_public->
-                                       states.done_action_set))) {
-       task = action->data;
-       INFO1("Task '%s' done", SD_task_get_name(task));
-       DEBUG0("Calling __SD_task_just_done");
-       __SD_task_just_done(task);
-       DEBUG1("__SD_task_just_done called on task '%s'", SD_task_get_name(task));
-       
-       /* the state has changed */
-       if(!xbt_dynar_member(changed_tasks,&task))
-         xbt_dynar_push (changed_tasks, &task);
-
-       /* remove the dependencies after this task */
-       while (xbt_dynar_length(task->tasks_after) > 0) {
-         xbt_dynar_get_cpy(task->tasks_after, 0, &dependency);
-         dst = dependency->dst;
-         SD_task_dependency_remove(task, dst);
-         
-         /* is dst ready now? */
-         if (__SD_task_is_ready(dst) && !sd_global->watch_point_reached) {
-           INFO1("Executing task '%s'", SD_task_get_name(dst));
-           if (__SD_task_try_to_run(dst) &&
-               !xbt_dynar_member(changed_tasks,&task))
-             xbt_dynar_push(changed_tasks, &task);
-         }
-       }
+      while ((action =
+              xbt_swag_extract(model->common_public->states.
+                               done_action_set))) {
+        task = action->data;
+        INFO1("Task '%s' done", SD_task_get_name(task));
+        DEBUG0("Calling __SD_task_just_done");
+        __SD_task_just_done(task);
+        DEBUG1("__SD_task_just_done called on task '%s'",
+               SD_task_get_name(task));
+
+        /* the state has changed */
+        if (!xbt_dynar_member(changed_tasks, &task))
+          xbt_dynar_push(changed_tasks, &task);
+
+        /* remove the dependencies after this task */
+        while (xbt_dynar_length(task->tasks_after) > 0) {
+          xbt_dynar_get_cpy(task->tasks_after, 0, &dependency);
+          dst = dependency->dst;
+          SD_task_dependency_remove(task, dst);
+
+          /* is dst ready now? */
+          if (__SD_task_is_ready(dst) && !sd_global->watch_point_reached) {
+            INFO1("Executing task '%s'", SD_task_get_name(dst));
+            if (__SD_task_try_to_run(dst) &&
+                !xbt_dynar_member(changed_tasks, &task))
+              xbt_dynar_push(changed_tasks, &task);
+          }
+        }
       }
 
       /* let's see which tasks have just failed */
-      while ((action = xbt_swag_extract(model->common_public->states.failed_action_set))) {
-       task = action->data;
-       INFO1("Task '%s' failed", SD_task_get_name(task));
-       __SD_task_set_state(task, SD_FAILED);
-       surf_workstation_model->common_public->action_free(action);
-       task->surf_action = NULL;
-       
-       if(!xbt_dynar_member(changed_tasks,&task))
-         xbt_dynar_push (changed_tasks, &task);
+      while ((action =
+              xbt_swag_extract(model->common_public->states.
+                               failed_action_set))) {
+        task = action->data;
+        INFO1("Task '%s' failed", SD_task_get_name(task));
+        __SD_task_set_state(task, SD_FAILED);
+        surf_workstation_model->common_public->action_free(action);
+        task->surf_action = NULL;
+
+        if (!xbt_dynar_member(changed_tasks, &task))
+          xbt_dynar_push(changed_tasks, &task);
       }
     }
 
-    while (surf_timer_model->extension_public->get(&fun,(void*)&arg)) {
+    while (surf_timer_model->extension_public->get(&fun, (void *) &arg)) {
     }
   }
 
-  res = xbt_new0(SD_task_t,(xbt_dynar_length(changed_tasks)+1));
+  res = xbt_new0(SD_task_t, (xbt_dynar_length(changed_tasks) + 1));
 
-  xbt_dynar_foreach(changed_tasks,iter,task) {
-    res[iter]=task;
+  xbt_dynar_foreach(changed_tasks, iter, task) {
+    res[iter] = task;
   }
   xbt_dynar_free(&changed_tasks);
 
   INFO0("Simulation finished");
-  DEBUG3("elapsed_time = %f, total_time = %f, watch_point_reached = %d", elapsed_time, total_time, sd_global->watch_point_reached);
+  DEBUG3("elapsed_time = %f, total_time = %f, watch_point_reached = %d",
+         elapsed_time, total_time, sd_global->watch_point_reached);
   DEBUG1("current time = %f", surf_get_clock());
 
   return res;
@@ -509,7 +529,8 @@ SD_task_t* SD_simulate(double how_long)
  *
  * \return the current clock, in second
  */
-double SD_get_clock(void) {
+double SD_get_clock(void)
+{
   SD_CHECK_INIT_DONE();
 
   return surf_get_clock();
@@ -523,7 +544,8 @@ double SD_get_clock(void) {
  *
  * \see SD_init(), SD_task_destroy()
  */
-void SD_exit(void) {
+void SD_exit(void)
+{
   if (SD_INITIALISED()) {
     DEBUG0("Destroying workstation and link dictionaries...");
     xbt_dict_free(&sd_global->workstations);
@@ -553,8 +575,7 @@ void SD_exit(void) {
 
     DEBUG0("Exiting Surf...");
     surf_exit();
-  }
-  else {
+  } else {
     WARN0("SD_exit() called, but SimDag is not running");
     /* we cannot use exceptions here because xbt is not running! */
   }
index 07e0fa8..e01a100 100644 (file)
@@ -6,7 +6,8 @@
 
 /* Creates a link and registers it in SD.
  */
-SD_link_t __SD_link_create(void *surf_link, void *data) {
+SD_link_t __SD_link_create(void *surf_link, void *data)
+{
 
   SD_link_t link;
   const char *name;
@@ -16,18 +17,19 @@ SD_link_t __SD_link_create(void *surf_link, void *data) {
 
   link = xbt_new(s_SD_link_t, 1);
   link->surf_link = surf_link;
-  link->data = data; /* user data */
-  if(surf_workstation_model->extension_public->link_shared(surf_link))
-    link->sharing_policy=SD_LINK_SHARED;
+  link->data = data;            /* user data */
+  if (surf_workstation_model->extension_public->link_shared(surf_link))
+    link->sharing_policy = SD_LINK_SHARED;
   else
-    link->sharing_policy=SD_LINK_FATPIPE;
+    link->sharing_policy = SD_LINK_FATPIPE;
 
   name = SD_link_get_name(link);
-  xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the link to the dictionary */
+  xbt_dict_set(sd_global->links, name, link, __SD_link_destroy);        /* add the link to the dictionary */
   sd_global->link_count++;
 
   return link;
 }
+
 /**
  * \brief Returns the link list
  *
@@ -36,19 +38,20 @@ SD_link_t __SD_link_create(void *surf_link, void *data) {
  * \return an array of \ref SD_link_t containing all links
  * \see SD_link_get_number()
  */
-const SD_link_t*  SD_link_get_list(void) {
+const SD_link_t *SD_link_get_list(void)
+{
 
   xbt_dict_cursor_t cursor;
   char *key;
   void *data;
   int i;
-  
+
   SD_CHECK_INIT_DONE();
   xbt_assert0(SD_link_get_number() > 0, "There is no link!");
 
-  if (sd_global->link_list == NULL) { /* this is the first time the function is called */
+  if (sd_global->link_list == NULL) {   /* this is the first time the function is called */
     sd_global->link_list = xbt_new(SD_link_t, sd_global->link_count);
-  
+
     i = 0;
     xbt_dict_foreach(sd_global->links, cursor, key, data) {
       sd_global->link_list[i++] = (SD_link_t) data;
@@ -63,7 +66,8 @@ const SD_link_t*  SD_link_get_list(void) {
  * \return the number of existing links
  * \see SD_link_get_list()
  */
-int SD_link_get_number(void) {
+int SD_link_get_number(void)
+{
   SD_CHECK_INIT_DONE();
   return sd_global->link_count;
 }
@@ -75,7 +79,8 @@ int SD_link_get_number(void) {
  * \return the user data associated with this link (can be \c NULL)
  * \see SD_link_set_data()
  */
-void* SD_link_get_data(SD_link_t link) {
+void *SD_link_get_data(SD_link_t link)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
   return link->data;
@@ -91,7 +96,8 @@ void* SD_link_get_data(SD_link_t link) {
  * \param data the new data you want to associate with this link
  * \see SD_link_get_data()
  */
-void SD_link_set_data(SD_link_t link, void *data) {
+void SD_link_set_data(SD_link_t link, void *data)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
   link->data = data;
@@ -103,10 +109,12 @@ void SD_link_set_data(SD_link_t link, void *data) {
  * \param link a link
  * \return the name of this link (cannot be \c NULL)
  */
-const char* SD_link_get_name(SD_link_t link) {
+const char *SD_link_get_name(SD_link_t link)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
-  return surf_workstation_model->extension_public->get_link_name(link->surf_link);
+  return surf_workstation_model->extension_public->get_link_name(link->
+                                                                 surf_link);
 }
 
 /**
@@ -115,10 +123,12 @@ const char* SD_link_get_name(SD_link_t link) {
  * \param link a link
  * \return the current bandwidth of this link, in bytes per second
  */
-double SD_link_get_current_bandwidth(SD_link_t link) {
+double SD_link_get_current_bandwidth(SD_link_t link)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
-  return surf_workstation_model->extension_public->get_link_bandwidth(link->surf_link);
+  return surf_workstation_model->extension_public->get_link_bandwidth(link->
+                                                                      surf_link);
 }
 
 /**
@@ -128,7 +138,7 @@ double SD_link_get_current_bandwidth(SD_link_t link) {
  * \param name a property name
  * \return value of a property (or NULL if property not set)
  */
-const char* SD_link_get_property_value(SD_link_t link, const char* name)
+const char *SD_link_get_property_value(SD_link_t link, const char *name)
 {
   return xbt_dict_get_or_null(SD_link_get_properties(link), name);
 }
@@ -144,7 +154,8 @@ xbt_dict_t SD_link_get_properties(SD_link_t link)
   SD_CHECK_INIT_DONE();
   xbt_assert0((link != NULL), "Invalid parameters");
 
-  return (surf_workstation_model->common_public->get_properties(link->surf_link));
+  return (surf_workstation_model->common_public->
+          get_properties(link->surf_link));
 
 }
 
@@ -154,10 +165,12 @@ xbt_dict_t SD_link_get_properties(SD_link_t link)
  * \param link a link
  * \return the current latency of this link, in seconds
  */
-double SD_link_get_current_latency(SD_link_t link) {
+double SD_link_get_current_latency(SD_link_t link)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
-  return surf_workstation_model->extension_public->get_link_latency(link->surf_link);
+  return surf_workstation_model->extension_public->get_link_latency(link->
+                                                                    surf_link);
 }
 
 /**
@@ -168,19 +181,20 @@ double SD_link_get_current_latency(SD_link_t link) {
  * SD_LINK_SHARED or SD_LINK_FATPIPE
  *
  */
-e_SD_link_sharing_policy_t SD_link_get_sharing_policy (SD_link_t link) {
+e_SD_link_sharing_policy_t SD_link_get_sharing_policy(SD_link_t link)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
   return link->sharing_policy;
 }
 
+
 /* Destroys a link.
  */
-void __SD_link_destroy(void *link) {
+void __SD_link_destroy(void *link)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(link != NULL, "Invalid parameter");
   /* link->surf_link is freed by surf_exit and link->data is freed by the user */
   xbt_free(link);
 }
-
index 26a4e3c..501f2a4 100644 (file)
@@ -3,8 +3,8 @@
 #include "xbt/sysdep.h"
 #include "xbt/dynar.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_task,sd,
-                               "Logging specific to SimDag (task)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_task, sd,
+                                "Logging specific to SimDag (task)");
 
 static void __SD_task_remove_dependencies(SD_task_t task);
 static void __SD_task_destroy_scheduling_data(SD_task_t task);
@@ -18,7 +18,8 @@ static void __SD_task_destroy_scheduling_data(SD_task_t task);
  * \return the new task
  * \see SD_task_destroy()
  */
-SD_task_t SD_task_create(const char *name, void *data, double amount) {
+SD_task_t SD_task_create(const char *name, void *data, double amount)
+{
 
   SD_task_t task;
   SD_CHECK_INIT_DONE();
@@ -26,7 +27,7 @@ SD_task_t SD_task_create(const char *name, void *data, double amount) {
   task = xbt_new(s_SD_task_t, 1);
 
   /* general information */
-  task->data = data; /* user data */
+  task->data = data;            /* user data */
   if (name != NULL)
     task->name = xbt_strdup(name);
   else
@@ -68,7 +69,8 @@ SD_task_t SD_task_create(const char *name, void *data, double amount) {
  * \return the user data associated with this task (can be \c NULL)
  * \see SD_task_set_data()
  */
-void* SD_task_get_data(SD_task_t task) {
+void *SD_task_get_data(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   return task->data;
@@ -84,7 +86,8 @@ void* SD_task_get_data(SD_task_t task) {
  * \param data the new data you want to associate with this task
  * \see SD_task_get_data()
  */
-void SD_task_set_data(SD_task_t task, void *data) {
+void SD_task_set_data(SD_task_t task, void *data)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   task->data = data;
@@ -98,7 +101,8 @@ void SD_task_set_data(SD_task_t task, void *data) {
  * #SD_NOT_SCHEDULED, #SD_SCHEDULED, #SD_READY, #SD_RUNNING, #SD_DONE or #SD_FAILED
  * \see e_SD_task_state_t
  */
-e_SD_task_state_t SD_task_get_state(SD_task_t task) {
+e_SD_task_state_t SD_task_get_state(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   return task->state;
@@ -106,7 +110,8 @@ e_SD_task_state_t SD_task_get_state(SD_task_t task) {
 
 /* Changes the state of a task. Updates the swags and the flag sd_global->watch_point_reached.
  */
-void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) {
+void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state)
+{
   xbt_swag_remove(task, task->state_set);
   switch (new_state) {
   case SD_NOT_SCHEDULED:
@@ -123,13 +128,15 @@ void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) {
     break;
   case SD_RUNNING:
     task->state_set = sd_global->running_task_set;
-    task->start_time = surf_workstation_model->common_public->
-      action_get_start_time(task->surf_action);
+    task->start_time =
+      surf_workstation_model->common_public->action_get_start_time(task->
+                                                                   surf_action);
     break;
   case SD_DONE:
     task->state_set = sd_global->done_task_set;
-    task->finish_time = surf_workstation_model->common_public->
-      action_get_finish_time(task->surf_action);
+    task->finish_time =
+      surf_workstation_model->common_public->action_get_finish_time(task->
+                                                                    surf_action);
     task->remains = 0;
     break;
   case SD_FAILED:
@@ -144,7 +151,7 @@ void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) {
   if (task->watch_points & new_state) {
     INFO1("Watch point reached with task '%s'!", SD_task_get_name(task));
     sd_global->watch_point_reached = 1;
-    SD_task_unwatch(task, new_state); /* remove the watch point */
+    SD_task_unwatch(task, new_state);   /* remove the watch point */
   }
 }
 
@@ -154,7 +161,8 @@ void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) {
  * \param task a task
  * \return the name of this task (can be \c NULL)
  */
-const char* SD_task_get_name(SD_task_t task) {
+const char *SD_task_get_name(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   return task->name;
@@ -167,7 +175,8 @@ const char* SD_task_get_name(SD_task_t task) {
  * \return the total amount of this task
  * \see SD_task_get_remaining_amount()
  */
-double SD_task_get_amount(SD_task_t task) {
+double SD_task_get_amount(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   return task->amount;
@@ -180,7 +189,8 @@ double SD_task_get_amount(SD_task_t task) {
  * \return the remaining amount of this task
  * \see SD_task_get_amount()
  */
-double SD_task_get_remaining_amount(SD_task_t task) {
+double SD_task_get_remaining_amount(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
 
@@ -191,13 +201,15 @@ double SD_task_get_remaining_amount(SD_task_t task) {
 }
 
 /* temporary function for debbuging */
-static void __SD_print_dependencies(SD_task_t task) {
+static void __SD_print_dependencies(SD_task_t task)
+{
   xbt_dynar_t dynar;
   int length;
   int i;
   SD_dependency_t dependency;
 
-  INFO1("The following tasks must be executed before %s:", SD_task_get_name(task));
+  INFO1("The following tasks must be executed before %s:",
+        SD_task_get_name(task));
   dynar = task->tasks_before;
   length = xbt_dynar_length(dynar);
 
@@ -207,7 +219,8 @@ static void __SD_print_dependencies(SD_task_t task) {
     INFO1(" %s", SD_task_get_name(dependency->src));
   }
 
-  INFO1("The following tasks must be executed after %s:", SD_task_get_name(task));
+  INFO1("The following tasks must be executed after %s:",
+        SD_task_get_name(task));
 
   dynar = task->tasks_after;
   length = xbt_dynar_length(dynar);
@@ -220,7 +233,8 @@ static void __SD_print_dependencies(SD_task_t task) {
 
 /* Destroys a dependency between two tasks.
  */
-static void __SD_task_dependency_destroy(void *dependency) {
+static void __SD_task_dependency_destroy(void *dependency)
+{
   if (((SD_dependency_t) dependency)->name != NULL)
     xbt_free(((SD_dependency_t) dependency)->name);
   xbt_free(dependency);
@@ -238,7 +252,9 @@ static void __SD_task_dependency_destroy(void *dependency) {
  * \param dst the task you want to make depend on \a src
  * \see SD_task_dependency_remove()
  */
-void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst) {
+void SD_task_dependency_add(const char *name, void *data, SD_task_t src,
+                            SD_task_t dst)
+{
   xbt_dynar_t dynar;
   int length;
   int found = 0;
@@ -253,26 +269,36 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task
 
 
 
-  if (src == dst) 
-    THROW1(arg_error, 0, "Cannot add a dependency between task '%s' and itself",
-          SD_task_get_name(src));
+  if (src == dst)
+    THROW1(arg_error, 0,
+           "Cannot add a dependency between task '%s' and itself",
+           SD_task_get_name(src));
 
-  if (!__SD_task_is_not_scheduled(src) && !__SD_task_is_scheduled_or_ready(src))
-    THROW1(arg_error, 0, "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULED or SD_READY", SD_task_get_name(src));
+  if (!__SD_task_is_not_scheduled(src)
+      && !__SD_task_is_scheduled_or_ready(src))
+    THROW1(arg_error, 0,
+           "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULED or SD_READY",
+           SD_task_get_name(src));
 
-  if (!__SD_task_is_not_scheduled(dst) && !__SD_task_is_scheduled_or_ready(dst))
-    THROW1(arg_error, 0, "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULED or SD_READY", SD_task_get_name(dst));
+  if (!__SD_task_is_not_scheduled(dst)
+      && !__SD_task_is_scheduled_or_ready(dst))
+    THROW1(arg_error, 0,
+           "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULED or SD_READY",
+           SD_task_get_name(dst));
 
-  DEBUG2("SD_task_dependency_add: src = %s, dst = %s", SD_task_get_name(src), SD_task_get_name(dst));
+  DEBUG2("SD_task_dependency_add: src = %s, dst = %s", SD_task_get_name(src),
+         SD_task_get_name(dst));
   for (i = 0; i < length && !found; i++) {
     xbt_dynar_get_cpy(dynar, i, &dependency);
     found = (dependency->dst == dst);
-    DEBUG2("Dependency %d: dependency->dst = %s", i, SD_task_get_name(dependency->dst));
+    DEBUG2("Dependency %d: dependency->dst = %s", i,
+           SD_task_get_name(dependency->dst));
   }
 
   if (found)
-    THROW2(arg_error, 0, "A dependency already exists between task '%s' and task '%s'",
-          SD_task_get_name(src), SD_task_get_name(dst));
+    THROW2(arg_error, 0,
+           "A dependency already exists between task '%s' and task '%s'",
+           SD_task_get_name(src), SD_task_get_name(dst));
 
   dependency = xbt_new(s_SD_dependency_t, 1);
 
@@ -292,12 +318,13 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task
   /* if the task was ready, then dst->tasks_before is not empty anymore,
      so we must go back to state SD_SCHEDULED */
   if (__SD_task_is_ready(dst)) {
-    DEBUG1("SD_task_dependency_add: %s was ready and becomes scheduled!", SD_task_get_name(dst));
+    DEBUG1("SD_task_dependency_add: %s was ready and becomes scheduled!",
+           SD_task_get_name(dst));
     __SD_task_set_state(dst, SD_SCHEDULED);
   }
 
   /*  __SD_print_dependencies(src);
-      __SD_print_dependencies(dst); */
+     __SD_print_dependencies(dst); */
 }
 
 /**
@@ -306,7 +333,8 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task
  * \param src a task
  * \param dst a task depending on \a src
  */
-int SD_task_dependency_exists(SD_task_t src, SD_task_t dst) {
+int SD_task_dependency_exists(SD_task_t src, SD_task_t dst)
+{
   xbt_dynar_t dynar;
   int length;
   int i;
@@ -320,7 +348,8 @@ int SD_task_dependency_exists(SD_task_t src, SD_task_t dst) {
 
   for (i = 0; i < length; i++) {
     xbt_dynar_get_cpy(dynar, i, &dependency);
-    if (dependency->dst == dst) return 1;
+    if (dependency->dst == dst)
+      return 1;
   }
   return 0;
 }
@@ -332,7 +361,8 @@ int SD_task_dependency_exists(SD_task_t src, SD_task_t dst) {
  * \param dst a task depending on \a src
  * \see SD_task_dependency_add()
  */
-void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) {
+void SD_task_dependency_remove(SD_task_t src, SD_task_t dst)
+{
 
   xbt_dynar_t dynar;
   int length;
@@ -356,14 +386,15 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) {
   }
   if (!found)
     THROW4(arg_error, 0,
-          "No dependency found between task '%s' and '%s': task '%s' is not a successor of task '%s'",
-          SD_task_get_name(src), SD_task_get_name(dst), SD_task_get_name(dst), SD_task_get_name(src));
+           "No dependency found between task '%s' and '%s': task '%s' is not a successor of task '%s'",
+           SD_task_get_name(src), SD_task_get_name(dst),
+           SD_task_get_name(dst), SD_task_get_name(src));
 
   /* remove the dependency from dst->tasks_before */
   dynar = dst->tasks_before;
   length = xbt_dynar_length(dynar);
   found = 0;
-  
+
   for (i = 0; i < length && !found; i++) {
     xbt_dynar_get_cpy(dynar, i, &dependency);
     if (dependency->src == src) {
@@ -373,15 +404,17 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) {
     }
   }
   /* should never happen... */
-  xbt_assert4(found, "SimDag error: task '%s' is a successor of '%s' but task '%s' is not a predecessor of task '%s'",
-             SD_task_get_name(dst), SD_task_get_name(src), SD_task_get_name(src), SD_task_get_name(dst));
+  xbt_assert4(found,
+              "SimDag error: task '%s' is a successor of '%s' but task '%s' is not a predecessor of task '%s'",
+              SD_task_get_name(dst), SD_task_get_name(src),
+              SD_task_get_name(src), SD_task_get_name(dst));
 
   /* if the task was scheduled and dst->tasks_before is empty now, we can make it ready */
   if (xbt_dynar_length(dst->tasks_before) == 0 && __SD_task_is_scheduled(dst))
     __SD_task_set_state(dst, SD_READY);
 
   /*  __SD_print_dependencies(src); 
-      __SD_print_dependencies(dst);*/
+     __SD_print_dependencies(dst); */
 }
 
 /**
@@ -392,7 +425,8 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) {
  * \return the user data associated with this dependency (can be \c NULL)
  * \see SD_task_dependency_add()
  */
-void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst) {
+void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst)
+{
 
   xbt_dynar_t dynar;
   int length;
@@ -412,17 +446,22 @@ void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst) {
     found = (dependency->dst == dst);
   }
   if (!found)
-    THROW2(arg_error, 0, "No dependency found between task '%s' and '%s'", SD_task_get_name(src), SD_task_get_name(dst));
+    THROW2(arg_error, 0, "No dependency found between task '%s' and '%s'",
+           SD_task_get_name(src), SD_task_get_name(dst));
   return dependency->data;
 }
 
 /* temporary function for debugging */
-static void __SD_print_watch_points(SD_task_t task) {
-  static const int state_masks[] = {SD_SCHEDULED, SD_RUNNING, SD_READY, SD_DONE, SD_FAILED};
-  static const char* state_names[] = {"scheduled", "running", "ready", "done", "failed"};
+static void __SD_print_watch_points(SD_task_t task)
+{
+  static const int state_masks[] =
+    { SD_SCHEDULED, SD_RUNNING, SD_READY, SD_DONE, SD_FAILED };
+  static const char *state_names[] =
+    { "scheduled", "running", "ready", "done", "failed" };
   int i;
 
-  INFO2("Task '%s' watch points (%x): ", SD_task_get_name(task), task->watch_points);
+  INFO2("Task '%s' watch points (%x): ", SD_task_get_name(task),
+        task->watch_points);
 
 
   for (i = 0; i < 5; i++) {
@@ -443,15 +482,17 @@ static void __SD_print_watch_points(SD_task_t task) {
  * (cannot be #SD_NOT_SCHEDULED)
  * \see SD_task_unwatch()
  */
-void SD_task_watch(SD_task_t task, e_SD_task_state_t state) {
+void SD_task_watch(SD_task_t task, e_SD_task_state_t state)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
 
   if (state & SD_NOT_SCHEDULED)
-    THROW0(arg_error, 0, "Cannot add a watch point for state SD_NOT_SCHEDULED");
+    THROW0(arg_error, 0,
+           "Cannot add a watch point for state SD_NOT_SCHEDULED");
 
   task->watch_points = task->watch_points | state;
-  /*  __SD_print_watch_points(task);*/
+  /*  __SD_print_watch_points(task); */
 }
 
 /**
@@ -461,14 +502,15 @@ void SD_task_watch(SD_task_t task, e_SD_task_state_t state) {
  * \param state the \ref e_SD_task_state_t "state" you no longer want to watch
  * \see SD_task_watch()
  */
-void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state) {
+void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   xbt_assert0(state != SD_NOT_SCHEDULED,
-             "SimDag error: Cannot have a watch point for state SD_NOT_SCHEDULED");
-  
+              "SimDag error: Cannot have a watch point for state SD_NOT_SCHEDULED");
+
   task->watch_points = task->watch_points & ~state;
-  /*  __SD_print_watch_points(task);*/
+  /*  __SD_print_watch_points(task); */
 }
 
 /**
@@ -486,26 +528,33 @@ void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state) {
  * \see SD_schedule()
  */
 double SD_task_get_execution_time(SD_task_t task,
-                                 int workstation_nb,
-                                 const SD_workstation_t *workstation_list,
-                                 const double *computation_amount,
-                                 const double *communication_amount,
-                                 double rate) {
+                                  int workstation_nb,
+                                  const SD_workstation_t * workstation_list,
+                                  const double *computation_amount,
+                                  const double *communication_amount,
+                                  double rate)
+{
   double time, max_time = 0.0;
   int i, j;
   SD_CHECK_INIT_DONE();
-  xbt_assert0(task != NULL && workstation_nb > 0 && workstation_list != NULL &&
-             computation_amount != NULL && communication_amount != NULL,
-             "Invalid parameter");
+  xbt_assert0(task != NULL && workstation_nb > 0 && workstation_list != NULL
+              && computation_amount != NULL
+              && communication_amount != NULL, "Invalid parameter");
 
   /* the task execution time is the maximum execution time of the parallel tasks */
 
   for (i = 0; i < workstation_nb; i++) {
-    time = SD_workstation_get_computation_time(workstation_list[i], computation_amount[i]);
-    
+    time =
+      SD_workstation_get_computation_time(workstation_list[i],
+                                          computation_amount[i]);
+
     for (j = 0; j < workstation_nb; j++) {
-      time += SD_route_get_communication_time(workstation_list[i], workstation_list[j],
-                                             communication_amount[i * workstation_nb + j]);
+      time +=
+        SD_route_get_communication_time(workstation_list[i],
+                                        workstation_list[j],
+                                        communication_amount[i *
+                                                             workstation_nb +
+                                                             j]);
     }
 
     if (time > max_time) {
@@ -531,30 +580,36 @@ double SD_task_get_execution_time(SD_task_t task,
  * \see SD_task_unschedule()
  */
 void SD_task_schedule(SD_task_t task, int workstation_nb,
-                    const SD_workstation_t *workstation_list, const double *computation_amount,
-                    const double *communication_amount, double rate) {
+                      const SD_workstation_t * workstation_list,
+                      const double *computation_amount,
+                      const double *communication_amount, double rate)
+{
 
   int communication_nb;
-  
+
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
   xbt_assert0(workstation_nb > 0, "workstation_nb must be positive");
 
   if (!__SD_task_is_not_scheduled(task))
-    THROW1(arg_error, 0, "Task '%s' has already been scheduled", SD_task_get_name(task));
+    THROW1(arg_error, 0, "Task '%s' has already been scheduled",
+           SD_task_get_name(task));
 
   task->workstation_nb = workstation_nb;
   task->rate = rate;
 
   task->computation_amount = xbt_new(double, workstation_nb);
-  memcpy(task->computation_amount, computation_amount, sizeof(double) * workstation_nb);
+  memcpy(task->computation_amount, computation_amount,
+         sizeof(double) * workstation_nb);
 
   communication_nb = workstation_nb * workstation_nb;
   task->communication_amount = xbt_new(double, communication_nb);
-  memcpy(task->communication_amount, communication_amount, sizeof(double) * communication_nb);
+  memcpy(task->communication_amount, communication_amount,
+         sizeof(double) * communication_nb);
 
   task->workstation_list = xbt_new(SD_workstation_t, workstation_nb);
-  memcpy(task->workstation_list, workstation_list, sizeof(SD_workstation_t) * workstation_nb);
+  memcpy(task->workstation_list, workstation_list,
+         sizeof(SD_workstation_t) * workstation_nb);
 
   /* update the task state */
   if (xbt_dynar_length(task->tasks_before) == 0)
@@ -573,7 +628,8 @@ void SD_task_schedule(SD_task_t task, int workstation_nb,
  * \param task the task you want to unschedule
  * \see SD_task_schedule()
  */
-void SD_task_unschedule(SD_task_t task) {
+void SD_task_unschedule(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
 
@@ -581,13 +637,14 @@ void SD_task_unschedule(SD_task_t task) {
       task->state_set != sd_global->ready_task_set &&
       task->state_set != sd_global->running_task_set &&
       task->state_set != sd_global->failed_task_set)
-    THROW1(arg_error, 0, "Task %s: the state must be SD_SCHEDULED, SD_READY, SD_RUNNING or SD_FAILED",
-          SD_task_get_name(task));
+    THROW1(arg_error, 0,
+           "Task %s: the state must be SD_SCHEDULED, SD_READY, SD_RUNNING or SD_FAILED",
+           SD_task_get_name(task));
 
-  if (__SD_task_is_scheduled_or_ready(task)) /* if the task is scheduled or ready */
+  if (__SD_task_is_scheduled_or_ready(task))    /* if the task is scheduled or ready */
     __SD_task_destroy_scheduling_data(task);
 
-  if (__SD_task_is_running(task)) /* the task should become SD_FAILED */
+  if (__SD_task_is_running(task))       /* the task should become SD_FAILED */
     surf_workstation_model->common_public->action_cancel(task->surf_action);
   else
     __SD_task_set_state(task, SD_NOT_SCHEDULED);
@@ -597,10 +654,13 @@ void SD_task_unschedule(SD_task_t task) {
 
 /* Destroys the data memorised by SD_task_schedule. Task state must be SD_SCHEDULED or SD_READY.
  */
-static void __SD_task_destroy_scheduling_data(SD_task_t task) {
+static void __SD_task_destroy_scheduling_data(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   if (!__SD_task_is_scheduled_or_ready(task) && !__SD_task_is_in_fifo(task))
-    THROW1(arg_error, 0, "Task '%s' must be SD_SCHEDULED, SD_READY or SD_IN_FIFO", SD_task_get_name(task));
+    THROW1(arg_error, 0,
+           "Task '%s' must be SD_SCHEDULED, SD_READY or SD_IN_FIFO",
+           SD_task_get_name(task));
 
   xbt_free(task->computation_amount);
   xbt_free(task->communication_amount);
@@ -610,16 +670,19 @@ static void __SD_task_destroy_scheduling_data(SD_task_t task) {
  * doesn't have to wait in fifos. Otherwise, it is called by __SD_task_just_done when
  * the task gets out of its fifos.
  */
-void __SD_task_really_run(SD_task_t task) {
+void __SD_task_really_run(SD_task_t task)
+{
 
   int i;
   void **surf_workstations;
 
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
-  xbt_assert2(__SD_task_is_ready_or_in_fifo(task), "Task '%s' is not ready or in a fifo! Task state: %d",
-          SD_task_get_name(task), SD_task_get_state(task));
-  xbt_assert1(task->workstation_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task));
+  xbt_assert2(__SD_task_is_ready_or_in_fifo(task),
+              "Task '%s' is not ready or in a fifo! Task state: %d",
+              SD_task_get_name(task), SD_task_get_state(task));
+  xbt_assert1(task->workstation_list != NULL,
+              "Task '%s': workstation_list is NULL!", SD_task_get_name(task));
 
 
 
@@ -627,80 +690,94 @@ void __SD_task_really_run(SD_task_t task) {
 
   /* set this task as current task for the workstations in sequential mode */
   for (i = 0; i < task->workstation_nb; i++) {
-    if (SD_workstation_get_access_mode(task->workstation_list[i]) == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
+    if (SD_workstation_get_access_mode(task->workstation_list[i]) ==
+        SD_WORKSTATION_SEQUENTIAL_ACCESS) {
       task->workstation_list[i]->current_task = task;
-      xbt_assert0(__SD_workstation_is_busy(task->workstation_list[i]), "The workstation should be busy now");
+      xbt_assert0(__SD_workstation_is_busy(task->workstation_list[i]),
+                  "The workstation should be busy now");
     }
   }
-  
-  DEBUG1("Task '%s' set as current task for its workstations", SD_task_get_name(task));
+
+  DEBUG1("Task '%s' set as current task for its workstations",
+         SD_task_get_name(task));
 
   /* start the task */
 
   /* we have to create a Surf workstation array instead of the SimDag workstation array */
-  surf_workstations = xbt_new(void*, task->workstation_nb);
+  surf_workstations = xbt_new(void *, task->workstation_nb);
 
   for (i = 0; i < task->workstation_nb; i++) {
     surf_workstations[i] = task->workstation_list[i]->surf_workstation;
   }
-  
+
   task->surf_action = NULL;
-  if((task->workstation_nb==1) &&
-     (task->communication_amount[0]==0.0)) {
-    task->surf_action = surf_workstation_model->extension_public->
-      execute(surf_workstations[0], task->computation_amount[0]);
-  } else if((task->workstation_nb==1) &&
-           (task->computation_amount[0]==0.0)) {
-    task->surf_action = surf_workstation_model->extension_public->
-      communicate(surf_workstations[0], surf_workstations[0],
-                 task->communication_amount[0],task->rate);
-  } else if((task->workstation_nb==2) &&
-           (task->computation_amount[0]==0.0)&&
-           (task->computation_amount[1]==0.0)) {
-    int nb=0;
-    double value=0.0;
-    
-    for (i = 0; i < task->workstation_nb*task->workstation_nb; i++) {
-      if(task->communication_amount[i]>0.0) {
-       nb++;
-       value = task->communication_amount[i];
+  if ((task->workstation_nb == 1) && (task->communication_amount[0] == 0.0)) {
+    task->surf_action =
+      surf_workstation_model->extension_public->execute(surf_workstations[0],
+                                                        task->
+                                                        computation_amount
+                                                        [0]);
+  } else if ((task->workstation_nb == 1)
+             && (task->computation_amount[0] == 0.0)) {
+    task->surf_action =
+      surf_workstation_model->
+      extension_public->communicate(surf_workstations[0],
+                                    surf_workstations[0],
+                                    task->communication_amount[0],
+                                    task->rate);
+  } else if ((task->workstation_nb == 2)
+             && (task->computation_amount[0] == 0.0)
+             && (task->computation_amount[1] == 0.0)) {
+    int nb = 0;
+    double value = 0.0;
+
+    for (i = 0; i < task->workstation_nb * task->workstation_nb; i++) {
+      if (task->communication_amount[i] > 0.0) {
+        nb++;
+        value = task->communication_amount[i];
       }
     }
-    if(nb==1) {
-      task->surf_action = surf_workstation_model->extension_public->
-       communicate(surf_workstations[0], surf_workstations[1],
-                   value, task->rate);
+    if (nb == 1) {
+      task->surf_action =
+        surf_workstation_model->
+        extension_public->communicate(surf_workstations[0],
+                                      surf_workstations[1], value,
+                                      task->rate);
     }
   }
-  if(!task->surf_action) {
+  if (!task->surf_action) {
     double *computation_amount = xbt_new(double, task->workstation_nb);
-    double *communication_amount = xbt_new(double, task->workstation_nb * 
-                                          task->workstation_nb);
-
-    memcpy(computation_amount, task->computation_amount, sizeof(double) * 
-          task->workstation_nb);
-    memcpy(communication_amount, task->communication_amount, 
-          sizeof(double) * task->workstation_nb * task->workstation_nb);
-
-    task->surf_action = surf_workstation_model->extension_public->
-      execute_parallel_task(task->workstation_nb,
-                           surf_workstations,
-                           computation_amount,
-                           communication_amount,
-                           task->amount,
-                           task->rate);
+    double *communication_amount = xbt_new(double, task->workstation_nb *
+                                           task->workstation_nb);
+
+    memcpy(computation_amount, task->computation_amount, sizeof(double) *
+           task->workstation_nb);
+    memcpy(communication_amount, task->communication_amount,
+           sizeof(double) * task->workstation_nb * task->workstation_nb);
+
+    task->surf_action =
+      surf_workstation_model->extension_public->execute_parallel_task(task->
+                                                                      workstation_nb,
+                                                                      surf_workstations,
+                                                                      computation_amount,
+                                                                      communication_amount,
+                                                                      task->
+                                                                      amount,
+                                                                      task->
+                                                                      rate);
   } else {
     xbt_free(surf_workstations);
   }
 
-  surf_workstation_model->common_public->action_set_data(task->surf_action, task);
+  surf_workstation_model->common_public->action_set_data(task->surf_action,
+                                                         task);
 
-  DEBUG1("surf_action = %p",  task->surf_action);
+  DEBUG1("surf_action = %p", task->surf_action);
 
-  __SD_task_destroy_scheduling_data(task); /* now the scheduling data are not useful anymore */
+  __SD_task_destroy_scheduling_data(task);      /* now the scheduling data are not useful anymore */
   __SD_task_set_state(task, SD_RUNNING);
   xbt_assert2(__SD_task_is_running(task), "Bad state of task '%s': %d",
-             SD_task_get_name(task), SD_task_get_state(task));
+              SD_task_get_name(task), SD_task_get_state(task));
 
 }
 
@@ -710,7 +787,8 @@ void __SD_task_really_run(SD_task_t task) {
  * the task doesn't start.
  * Returns whether the task has started.
  */
-int __SD_task_try_to_run(SD_task_t task) {
+int __SD_task_try_to_run(SD_task_t task)
+{
 
   int can_start = 1;
   int i;
@@ -718,8 +796,9 @@ int __SD_task_try_to_run(SD_task_t task) {
 
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
-  xbt_assert2(__SD_task_is_ready(task), "Task '%s' is not ready! Task state: %d",
-          SD_task_get_name(task), SD_task_get_state(task));
+  xbt_assert2(__SD_task_is_ready(task),
+              "Task '%s' is not ready! Task state: %d",
+              SD_task_get_name(task), SD_task_get_state(task));
 
 
   for (i = 0; i < task->workstation_nb; i++) {
@@ -727,22 +806,21 @@ int __SD_task_try_to_run(SD_task_t task) {
   }
 
   DEBUG2("Task '%s' can start: %d", SD_task_get_name(task), can_start);
-  
-  if (!can_start) { /* if the task cannot start and is not in the fifos yet*/
+
+  if (!can_start) {             /* if the task cannot start and is not in the fifos yet */
     for (i = 0; i < task->workstation_nb; i++) {
       workstation = task->workstation_list[i];
       if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
-       DEBUG2("Pushing task '%s' in the fifo of workstation '%s'", SD_task_get_name(task),
-              SD_workstation_get_name(workstation));
-       xbt_fifo_push(workstation->task_fifo, task);
+        DEBUG2("Pushing task '%s' in the fifo of workstation '%s'",
+               SD_task_get_name(task), SD_workstation_get_name(workstation));
+        xbt_fifo_push(workstation->task_fifo, task);
       }
     }
     __SD_task_set_state(task, SD_IN_FIFO);
     xbt_assert2(__SD_task_is_in_fifo(task), "Bad state of task '%s': %d",
-               SD_task_get_name(task), SD_task_get_state(task));
+                SD_task_get_name(task), SD_task_get_state(task));
     DEBUG1("Task '%s' state is now SD_IN_FIFO", SD_task_get_name(task));
-  }
-  else {
+  } else {
     __SD_task_really_run(task);
   }
 
@@ -753,8 +831,9 @@ int __SD_task_try_to_run(SD_task_t task) {
  * It updates task->state and task->action and executes if necessary the tasks
  * which were waiting in fifos for the end of `task'
  */
-void __SD_task_just_done(SD_task_t task) {
-   int i, j;
+void __SD_task_just_done(SD_task_t task)
+{
+  int i, j;
   SD_workstation_t workstation;
 
   SD_task_t candidate;
@@ -765,8 +844,11 @@ void __SD_task_just_done(SD_task_t task) {
 
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
-  xbt_assert1(__SD_task_is_running(task), "The task must be running! Task state: %d", SD_task_get_state(task));
-  xbt_assert1(task->workstation_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task));
+  xbt_assert1(__SD_task_is_running(task),
+              "The task must be running! Task state: %d",
+              SD_task_get_state(task));
+  xbt_assert1(task->workstation_list != NULL,
+              "Task '%s': workstation_list is NULL!", SD_task_get_name(task));
 
 
   candidates = xbt_new(SD_task_t, 8);
@@ -781,43 +863,52 @@ void __SD_task_just_done(SD_task_t task) {
      maybe we can execute the next task of the fifo for each workstation */
   for (i = 0; i < task->workstation_nb; i++) {
     workstation = task->workstation_list[i];
-    DEBUG2("Workstation '%s': access_mode = %d", SD_workstation_get_name(workstation), workstation->access_mode);
+    DEBUG2("Workstation '%s': access_mode = %d",
+           SD_workstation_get_name(workstation), workstation->access_mode);
     if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
-      xbt_assert1(workstation->task_fifo != NULL, "Workstation '%s' has sequential access but no fifo!",
-                 SD_workstation_get_name(workstation));
-      xbt_assert2(workstation->current_task = task, "Workstation '%s': current task should be '%s'",
-                 SD_workstation_get_name(workstation), SD_task_get_name(task));
+      xbt_assert1(workstation->task_fifo != NULL,
+                  "Workstation '%s' has sequential access but no fifo!",
+                  SD_workstation_get_name(workstation));
+      xbt_assert2(workstation->current_task =
+                  task, "Workstation '%s': current task should be '%s'",
+                  SD_workstation_get_name(workstation),
+                  SD_task_get_name(task));
 
       /* the task is over so we can release the workstation */
       workstation->current_task = NULL;
 
       DEBUG0("Getting candidate in fifo");
-      candidate = xbt_fifo_get_item_content(xbt_fifo_get_first_item(workstation->task_fifo));
+      candidate =
+        xbt_fifo_get_item_content(xbt_fifo_get_first_item
+                                  (workstation->task_fifo));
 
       if (candidate != NULL) {
-       DEBUG1("Candidate: '%s'", SD_task_get_name(candidate));
-       xbt_assert2(__SD_task_is_in_fifo(candidate), "Bad state of candidate '%s': %d",
-                   SD_task_get_name(candidate), SD_task_get_state(candidate));
+        DEBUG1("Candidate: '%s'", SD_task_get_name(candidate));
+        xbt_assert2(__SD_task_is_in_fifo(candidate),
+                    "Bad state of candidate '%s': %d",
+                    SD_task_get_name(candidate),
+                    SD_task_get_state(candidate));
       }
 
       DEBUG1("Candidate in fifo: %p", candidate);
 
       /* if there was a task waiting for my place */
       if (candidate != NULL) {
-       /* Unfortunately, we are not sure yet that we can execute the task now,
-          because the task can be waiting more deeply in some other workstation's fifos...
-          So we memorize all candidate tasks, and then we will check for each candidate
-          whether or not all its workstations are available. */
-
-       /* realloc if necessary */
-       if (candidate_nb == candidate_capacity) {
-         candidate_capacity *= 2;
-         candidates = xbt_realloc(candidates, sizeof(SD_task_t) * candidate_capacity);
-       }
-
-       /* register the candidate */
-       candidates[candidate_nb++] = candidate;
-       candidate->fifo_checked = 0;
+        /* Unfortunately, we are not sure yet that we can execute the task now,
+           because the task can be waiting more deeply in some other workstation's fifos...
+           So we memorize all candidate tasks, and then we will check for each candidate
+           whether or not all its workstations are available. */
+
+        /* realloc if necessary */
+        if (candidate_nb == candidate_capacity) {
+          candidate_capacity *= 2;
+          candidates =
+            xbt_realloc(candidates, sizeof(SD_task_t) * candidate_capacity);
+        }
+
+        /* register the candidate */
+        candidates[candidate_nb++] = candidate;
+        candidate->fifo_checked = 0;
       }
     }
   }
@@ -829,56 +920,67 @@ void __SD_task_just_done(SD_task_t task) {
     candidate = candidates[i];
 
     if (candidate->fifo_checked) {
-      continue; /* we have already evaluated that task*/
+      continue;                 /* we have already evaluated that task */
     }
 
-    xbt_assert2(__SD_task_is_in_fifo(candidate), "Bad state of candidate '%s': %d",
-               SD_task_get_name(candidate), SD_task_get_state(candidate));
+    xbt_assert2(__SD_task_is_in_fifo(candidate),
+                "Bad state of candidate '%s': %d",
+                SD_task_get_name(candidate), SD_task_get_state(candidate));
 
     for (j = 0; j < candidate->workstation_nb && can_start; j++) {
       workstation = candidate->workstation_list[j];
 
       /* I can start on this workstation if the workstation is shared
-        or if I am the first task in the fifo */
+         or if I am the first task in the fifo */
       can_start = workstation->access_mode == SD_WORKSTATION_SHARED_ACCESS ||
-       candidate == xbt_fifo_get_item_content(xbt_fifo_get_first_item(workstation->task_fifo));
+        candidate ==
+        xbt_fifo_get_item_content(xbt_fifo_get_first_item
+                                  (workstation->task_fifo));
     }
 
-    DEBUG2("Candidate '%s' can start: %d", SD_task_get_name(candidate), can_start);
+    DEBUG2("Candidate '%s' can start: %d", SD_task_get_name(candidate),
+           can_start);
 
     /* now we are sure that I can start! */
     if (can_start) {
       for (j = 0; j < candidate->workstation_nb && can_start; j++) {
-       workstation = candidate->workstation_list[j];
-
-       /* update the fifo */
-       if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
-         candidate = xbt_fifo_shift(workstation->task_fifo); /* the return value is stored just for debugging */
-         DEBUG1("Head of the fifo: '%s'", (candidate != NULL) ? SD_task_get_name(candidate) : "NULL");
-         xbt_assert0(candidate == candidates[i], "Error in __SD_task_just_done: bad first task in the fifo");
-       }
-      } /* for each workstation */
-      
+        workstation = candidate->workstation_list[j];
+
+        /* update the fifo */
+        if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
+          candidate = xbt_fifo_shift(workstation->task_fifo);   /* the return value is stored just for debugging */
+          DEBUG1("Head of the fifo: '%s'",
+                 (candidate != NULL) ? SD_task_get_name(candidate) : "NULL");
+          xbt_assert0(candidate == candidates[i],
+                      "Error in __SD_task_just_done: bad first task in the fifo");
+        }
+      }                         /* for each workstation */
+
       /* finally execute the task */
-      DEBUG2("Task '%s' state: %d", SD_task_get_name(candidate), SD_task_get_state(candidate));
+      DEBUG2("Task '%s' state: %d", SD_task_get_name(candidate),
+             SD_task_get_state(candidate));
       __SD_task_really_run(candidate);
-      
-      DEBUG4("Calling __SD_task_is_running: task '%s', state set: %p, running_task_set: %p, is running: %d",
-            SD_task_get_name(candidate), candidate->state_set, sd_global->running_task_set, __SD_task_is_running(candidate));
-      xbt_assert2(__SD_task_is_running(candidate), "Bad state of task '%s': %d",
-                 SD_task_get_name(candidate), SD_task_get_state(candidate));
+
+      DEBUG4
+        ("Calling __SD_task_is_running: task '%s', state set: %p, running_task_set: %p, is running: %d",
+         SD_task_get_name(candidate), candidate->state_set,
+         sd_global->running_task_set, __SD_task_is_running(candidate));
+      xbt_assert2(__SD_task_is_running(candidate),
+                  "Bad state of task '%s': %d", SD_task_get_name(candidate),
+                  SD_task_get_state(candidate));
       DEBUG0("Okay, the task is running.");
 
-    } /* can start */
+    }                           /* can start */
     candidate->fifo_checked = 1;
-  } /* for each candidate */ 
-  
+  }                             /* for each candidate */
+
   xbt_free(candidates);
 }
 
 /* Remove all dependencies associated with a task. This function is called when the task is destroyed.
  */
-static void __SD_task_remove_dependencies(SD_task_t task) {
+static void __SD_task_remove_dependencies(SD_task_t task)
+{
   /* we must destroy the dependencies carefuly (with SD_dependency_remove)
      because each one is stored twice */
   SD_dependency_t dependency;
@@ -901,12 +1003,14 @@ static void __SD_task_remove_dependencies(SD_task_t task) {
  * \param task: a task
  * \return the start time of this task
  */
-double SD_task_get_start_time(SD_task_t task) {
+double SD_task_get_start_time(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
-  if(task->surf_action)
-    return surf_workstation_model->common_public->action_get_start_time(task->surf_action);
-  else 
+  if (task->surf_action)
+    return surf_workstation_model->common_public->action_get_start_time(task->
+                                                                        surf_action);
+  else
     return task->start_time;
 }
 
@@ -921,13 +1025,15 @@ double SD_task_get_start_time(SD_task_t task) {
  * \param task: a task
  * \return the start time of this task
  */
-double SD_task_get_finish_time(SD_task_t task) {
+double SD_task_get_finish_time(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
 
-  if(task->surf_action) /* should never happen as actions are destroyed right after their completion */
-    return surf_workstation_model->common_public->action_get_finish_time(task->surf_action);
-  else 
+  if (task->surf_action)        /* should never happen as actions are destroyed right after their completion */
+    return surf_workstation_model->common_public->
+      action_get_finish_time(task->surf_action);
+  else
     return task->finish_time;
 }
 
@@ -939,7 +1045,8 @@ double SD_task_get_finish_time(SD_task_t task) {
  * \param task the task you want to destroy
  * \see SD_task_create()
  */
-void SD_task_destroy(SD_task_t task) {
+void SD_task_destroy(SD_task_t task)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(task != NULL, "Invalid parameter");
 
index af29f84..7d0f26e 100644 (file)
@@ -5,11 +5,12 @@
 #include "surf/surf.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_workstation, sd,
-                               "Logging specific to SimDag (workstation)");
+                                "Logging specific to SimDag (workstation)");
 
 /* Creates a workstation and registers it in SD.
  */
-SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) {
+SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data)
+{
 
   SD_workstation_t workstation;
   const char *name;
@@ -18,13 +19,13 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) {
 
   workstation = xbt_new(s_SD_workstation_t, 1);
   workstation->surf_workstation = surf_workstation;
-  workstation->data = data; /* user data */
-  workstation->access_mode = SD_WORKSTATION_SHARED_ACCESS; /* default mode is shared */
+  workstation->data = data;     /* user data */
+  workstation->access_mode = SD_WORKSTATION_SHARED_ACCESS;      /* default mode is shared */
   workstation->task_fifo = NULL;
   workstation->current_task = NULL;
-  
+
   name = SD_workstation_get_name(workstation);
-  xbt_dict_set(sd_global->workstations, name, workstation, __SD_workstation_destroy); /* add the workstation to the dictionary */
+  xbt_dict_set(sd_global->workstations, name, workstation, __SD_workstation_destroy);   /* add the workstation to the dictionary */
   sd_global->workstation_count++;
 
   return workstation;
@@ -38,7 +39,8 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) {
  * \param name workstation name
  * \return the workstation, or \c NULL if there is no such workstation
  */
-SD_workstation_t SD_workstation_get_by_name(const char *name) {
+SD_workstation_t SD_workstation_get_by_name(const char *name)
+{
   SD_CHECK_INIT_DONE();
 
   xbt_assert0(name != NULL, "Invalid parameter");
@@ -54,7 +56,8 @@ SD_workstation_t SD_workstation_get_by_name(const char *name) {
  * \return an array of \ref SD_workstation_t containing all workstations
  * \see SD_workstation_get_number()
  */
-const SD_workstation_t* SD_workstation_get_list(void) {
+const SD_workstation_t *SD_workstation_get_list(void)
+{
 
   xbt_dict_cursor_t cursor;
   char *key;
@@ -66,9 +69,10 @@ const SD_workstation_t* SD_workstation_get_list(void) {
 
 
 
-  if (sd_global->workstation_list == NULL) { /* this is the first time the function is called */
-    sd_global->workstation_list = xbt_new(SD_workstation_t, sd_global->workstation_count);
-  
+  if (sd_global->workstation_list == NULL) {    /* this is the first time the function is called */
+    sd_global->workstation_list =
+      xbt_new(SD_workstation_t, sd_global->workstation_count);
+
     i = 0;
     xbt_dict_foreach(sd_global->workstations, cursor, key, data) {
       sd_global->workstation_list[i++] = (SD_workstation_t) data;
@@ -83,7 +87,8 @@ const SD_workstation_t* SD_workstation_get_list(void) {
  * \return the number of existing workstations
  * \see SD_workstation_get_list()
  */
-int SD_workstation_get_number(void) {
+int SD_workstation_get_number(void)
+{
   SD_CHECK_INIT_DONE();
   return sd_global->workstation_count;
 }
@@ -95,7 +100,8 @@ int SD_workstation_get_number(void) {
  * \return the user data associated with this workstation (can be \c NULL)
  * \see SD_workstation_set_data()
  */
-void* SD_workstation_get_data(SD_workstation_t workstation) {
+void *SD_workstation_get_data(SD_workstation_t workstation)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   return workstation->data;
@@ -111,7 +117,8 @@ void* SD_workstation_get_data(SD_workstation_t workstation) {
  * \param data the new data you want to associate with this workstation
  * \see SD_workstation_get_data()
  */
-void SD_workstation_set_data(SD_workstation_t workstation, void *data) {
+void SD_workstation_set_data(SD_workstation_t workstation, void *data)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   workstation->data = data;
@@ -123,10 +130,12 @@ void SD_workstation_set_data(SD_workstation_t workstation, void *data) {
  * \param workstation a workstation
  * \return the name of this workstation (cannot be \c NULL)
  */
-const char* SD_workstation_get_name(SD_workstation_t workstation) {
+const char *SD_workstation_get_name(SD_workstation_t workstation)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
-  return surf_workstation_model->common_public->get_resource_name(workstation->surf_workstation);
+  return surf_workstation_model->common_public->
+    get_resource_name(workstation->surf_workstation);
 }
 
 /**
@@ -136,7 +145,8 @@ const char* SD_workstation_get_name(SD_workstation_t workstation) {
  * \param name a property name
  * \return value of a property (or NULL if property not set)
  */
-const char* SD_workstation_get_property_value(SD_workstation_t ws, const char* name)
+const char *SD_workstation_get_property_value(SD_workstation_t ws,
+                                              const char *name)
 {
   return xbt_dict_get_or_null(SD_workstation_get_properties(ws), name);
 }
@@ -153,7 +163,8 @@ xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation)
   SD_CHECK_INIT_DONE();
   xbt_assert0((workstation != NULL), "Invalid parameters");
 
-  return (surf_workstation_model->common_public->get_properties(workstation->surf_workstation));
+  return (surf_workstation_model->common_public->
+          get_properties(workstation->surf_workstation));
 
 }
 
@@ -168,14 +179,15 @@ xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation)
  * \return a new array of \ref SD_link_t representating the route between these two workstations
  * \see SD_route_get_size(), SD_link_t
  */
-const SD_link_t* SD_route_get_list(SD_workstation_t src, SD_workstation_t dst) {
+const SD_link_t *SD_route_get_list(SD_workstation_t src, SD_workstation_t dst)
+{
   void *surf_src;
   void *surf_dst;
   const void **surf_route;
   int route_size;
   const char *link_name;
   int i;
-  
+
   SD_CHECK_INIT_DONE();
 
   if (sd_global->recyclable_route == NULL) {
@@ -186,13 +198,18 @@ const SD_link_t* SD_route_get_list(SD_workstation_t src, SD_workstation_t dst) {
   surf_src = src->surf_workstation;
   surf_dst = dst->surf_workstation;
 
-  surf_route = surf_workstation_model->extension_public->get_route(surf_src, surf_dst);
-  route_size = surf_workstation_model->extension_public->get_route_size(surf_src, surf_dst);
+  surf_route =
+    surf_workstation_model->extension_public->get_route(surf_src, surf_dst);
+  route_size =
+    surf_workstation_model->extension_public->get_route_size(surf_src,
+                                                             surf_dst);
 
 
   for (i = 0; i < route_size; i++) {
-    link_name = surf_workstation_model->extension_public->get_link_name(surf_route[i]);
-    sd_global->recyclable_route[i] = xbt_dict_get(sd_global->links, link_name);
+    link_name =
+      surf_workstation_model->extension_public->get_link_name(surf_route[i]);
+    sd_global->recyclable_route[i] =
+      xbt_dict_get(sd_global->links, link_name);
   }
 
   return sd_global->recyclable_route;
@@ -206,10 +223,13 @@ const SD_link_t* SD_route_get_list(SD_workstation_t src, SD_workstation_t dst) {
  * \return the number of links on the route between these two workstations
  * \see SD_route_get_list()
  */
-int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst) {
+int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst)
+{
   SD_CHECK_INIT_DONE();
-  return surf_workstation_model->extension_public->
-    get_route_size(src->surf_workstation, dst->surf_workstation);
+  return surf_workstation_model->extension_public->get_route_size(src->
+                                                                  surf_workstation,
+                                                                  dst->
+                                                                  surf_workstation);
 }
 
 /**
@@ -219,10 +239,13 @@ int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst) {
  * \return the total power of this workstation
  * \see SD_workstation_get_available_power()
  */
-double SD_workstation_get_power(SD_workstation_t workstation) {
+double SD_workstation_get_power(SD_workstation_t workstation)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
-  return surf_workstation_model->extension_public->get_speed(workstation->surf_workstation, 1.0);
+  return surf_workstation_model->extension_public->get_speed(workstation->
+                                                             surf_workstation,
+                                                             1.0);
 }
 
 /**
@@ -232,10 +255,12 @@ double SD_workstation_get_power(SD_workstation_t workstation) {
  * \return the proportion of power currently available in this workstation (normally a number between 0 and 1)
  * \see SD_workstation_get_power()
  */
-double SD_workstation_get_available_power(SD_workstation_t workstation) {
+double SD_workstation_get_available_power(SD_workstation_t workstation)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
-  return surf_workstation_model->extension_public->get_available_speed(workstation->surf_workstation);
+  return surf_workstation_model->extension_public->
+    get_available_speed(workstation->surf_workstation);
 }
 
 /**
@@ -245,10 +270,13 @@ double SD_workstation_get_available_power(SD_workstation_t workstation) {
  * \param computation_amount the computation amount you want to evaluate (in flops)
  * \return an approximative astimated computation time for the given computation amount on this workstation (in seconds)
  */
-double SD_workstation_get_computation_time(SD_workstation_t workstation, double computation_amount) {
+double SD_workstation_get_computation_time(SD_workstation_t workstation,
+                                           double computation_amount)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
-  xbt_assert0(computation_amount >= 0, "computation_amount must be greater than or equal to zero");
+  xbt_assert0(computation_amount >= 0,
+              "computation_amount must be greater than or equal to zero");
   return computation_amount / SD_workstation_get_power(workstation);
 }
 
@@ -261,11 +289,13 @@ double SD_workstation_get_computation_time(SD_workstation_t workstation, double
  * \return the latency of the route between the two workstations (in seconds)
  * \see SD_route_get_current_bandwidth()
  */
-double SD_route_get_current_latency(SD_workstation_t src, SD_workstation_t dst) {
+double SD_route_get_current_latency(SD_workstation_t src,
+                                    SD_workstation_t dst)
+{
 
   const SD_link_t *links;
   int nb_links;
-  double latency ;
+  double latency;
   int i;
 
   SD_CHECK_INIT_DONE();
@@ -273,7 +303,7 @@ double SD_route_get_current_latency(SD_workstation_t src, SD_workstation_t dst)
   links = SD_route_get_list(src, dst);
   nb_links = SD_route_get_size(src, dst);
   latency = 0.0;
-  
+
   for (i = 0; i < nb_links; i++) {
     latency += SD_link_get_current_latency(links[i]);
   }
@@ -290,7 +320,9 @@ double SD_route_get_current_latency(SD_workstation_t src, SD_workstation_t dst)
  * \return the bandwidth of the route between the two workstations (in bytes/second)
  * \see SD_route_get_current_latency()
  */
-double SD_route_get_current_bandwidth(SD_workstation_t src, SD_workstation_t dst) {
+double SD_route_get_current_bandwidth(SD_workstation_t src,
+                                      SD_workstation_t dst)
+{
 
   const SD_link_t *links;
   int nb_links;
@@ -305,7 +337,7 @@ double SD_route_get_current_bandwidth(SD_workstation_t src, SD_workstation_t dst
   nb_links = SD_route_get_size(src, dst);
   bandwidth = min_bandwidth = -1.0;
 
-  
+
   for (i = 0; i < nb_links; i++) {
     bandwidth = SD_link_get_current_bandwidth(links[i]);
     if (bandwidth < min_bandwidth || min_bandwidth == -1.0)
@@ -325,8 +357,10 @@ double SD_route_get_current_bandwidth(SD_workstation_t src, SD_workstation_t dst
  * \return an approximative astimated computation time for the given communication amount
  * between the workstations (in seconds)
  */
-double SD_route_get_communication_time(SD_workstation_t src, SD_workstation_t dst,
-                                                  double communication_amount) {
+double SD_route_get_communication_time(SD_workstation_t src,
+                                       SD_workstation_t dst,
+                                       double communication_amount)
+{
 
 
   /* total time = latency + transmission time of the slowest link
@@ -340,10 +374,11 @@ double SD_route_get_communication_time(SD_workstation_t src, SD_workstation_t ds
 
   SD_CHECK_INIT_DONE();
   xbt_assert0(src != NULL && dst != NULL, "Invalid parameter");
-  xbt_assert0(communication_amount >= 0, "communication_amount must be greater than or equal to zero");
+  xbt_assert0(communication_amount >= 0,
+              "communication_amount must be greater than or equal to zero");
+
 
 
-  
   if (communication_amount == 0.0)
     return 0.0;
 
@@ -371,7 +406,9 @@ double SD_route_get_communication_time(SD_workstation_t src, SD_workstation_t ds
  *
  * \see SD_workstation_set_access_mode(), e_SD_workstation_access_mode_t
  */
- e_SD_workstation_access_mode_t SD_workstation_get_access_mode(SD_workstation_t workstation) {
+e_SD_workstation_access_mode_t SD_workstation_get_access_mode(SD_workstation_t
+                                                              workstation)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
   return workstation->access_mode;
@@ -392,12 +429,15 @@ double SD_route_get_communication_time(SD_workstation_t src, SD_workstation_t ds
  *
  * \see SD_workstation_get_access_mode(), e_SD_workstation_access_mode_t
  */
-void SD_workstation_set_access_mode(SD_workstation_t workstation, e_SD_workstation_access_mode_t access_mode) {
+void SD_workstation_set_access_mode(SD_workstation_t workstation,
+                                    e_SD_workstation_access_mode_t
+                                    access_mode)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
 
   if (access_mode == workstation->access_mode) {
-    return; // nothing is changed
+    return;                     // nothing is changed
   }
 
   workstation->access_mode = access_mode;
@@ -405,43 +445,48 @@ void SD_workstation_set_access_mode(SD_workstation_t workstation, e_SD_workstati
   if (access_mode == SD_WORKSTATION_SHARED_ACCESS) {
     xbt_fifo_free(workstation->task_fifo);
     workstation->task_fifo = NULL;
-  }
-  else {
+  } else {
     workstation->task_fifo = xbt_fifo_new();
   }
 }
 
 /* Returns whether a task can start now on a workstation.
- *//*
-int __SD_workstation_can_start(SD_workstation_t workstation, SD_task_t task) {
-  SD_CHECK_INIT_DONE();
-  xbt_assert0(workstation != NULL && task != NULL, "Invalid parameter");
                     *//*
+               int __SD_workstation_can_start(SD_workstation_t workstation, SD_task_t task) {
+               SD_CHECK_INIT_DONE();
+               xbt_assert0(workstation != NULL && task != NULL, "Invalid parameter");
 
-  return !__SD_workstation_is_busy(workstation) &&
-    (xbt_fifo_size(workstation->task_fifo) == 0) || xbt_fifo_get_first_item(workstation->task_fifo) == task);
-}
-*/
+               return !__SD_workstation_is_busy(workstation) &&
+               (xbt_fifo_size(workstation->task_fifo) == 0) || xbt_fifo_get_first_item(workstation->task_fifo) == task);
+               }
+             */
 
 /* Returns whether a workstation is busy. A workstation is busy is it is
  * in sequential mode and a task is running on it or the fifo is not empty.
  */
-int __SD_workstation_is_busy(SD_workstation_t workstation) {
+int __SD_workstation_is_busy(SD_workstation_t workstation)
+{
   SD_CHECK_INIT_DONE();
   xbt_assert0(workstation != NULL, "Invalid parameter");
-  
-  DEBUG4("Workstation '%s' access mode: '%s', current task: %s, fifo size: %d",
-        SD_workstation_get_name(workstation),
-        (workstation->access_mode==SD_WORKSTATION_SHARED_ACCESS)?"SHARED":"FIFO",
-        (workstation->current_task ? SD_task_get_name(workstation->current_task) : "none"),
-        (workstation->task_fifo ? xbt_fifo_size(workstation->task_fifo) : 0));
+
+  DEBUG4
+    ("Workstation '%s' access mode: '%s', current task: %s, fifo size: %d",
+     SD_workstation_get_name(workstation),
+     (workstation->access_mode ==
+      SD_WORKSTATION_SHARED_ACCESS) ? "SHARED" : "FIFO",
+     (workstation->current_task ? SD_task_get_name(workstation->current_task)
+      : "none"),
+     (workstation->task_fifo ? xbt_fifo_size(workstation->task_fifo) : 0));
 
   return workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS &&
-    (workstation->current_task != NULL || xbt_fifo_size(workstation->task_fifo) > 0);
+    (workstation->current_task != NULL
+     || xbt_fifo_size(workstation->task_fifo) > 0);
 }
 
 /* Destroys a workstation.
  */
-void __SD_workstation_destroy(void *workstation) {
+void __SD_workstation_destroy(void *workstation)
+{
 
   SD_workstation_t w;
 
index 4a7dd72..655815b 100644 (file)
@@ -25,7 +25,7 @@
 /********************************** Host ************************************/
 
 typedef struct s_smx_simdata_host {
-  void *host;                  /* SURF modeling */
+  void *host;                   /* SURF modeling */
   xbt_swag_t process_list;
 } s_smx_simdata_host_t;
 
@@ -48,14 +48,14 @@ extern SIMIX_Global_t simix_global;
 /******************************* Process *************************************/
 
 typedef struct s_smx_simdata_process {
-  smx_host_t smx_host;         /* the host on which the process is running */
-  xbt_context_t context;       /* the context that executes the scheduler fonction */
+  smx_host_t smx_host;          /* the host on which the process is running */
+  xbt_context_t context;        /* the context that executes the scheduler fonction */
   int blocked;
   int suspended;
-  smx_mutex_t mutex;           /* mutex on which the process is blocked  */
-  smx_cond_t cond;             /* cond on which the process is blocked  */
-  int argc;                    /* arguments number if any */
-  char **argv;                 /* arguments table if any */
+  smx_mutex_t mutex;            /* mutex on which the process is blocked  */
+  smx_cond_t cond;              /* cond on which the process is blocked  */
+  int argc;                     /* arguments number if any */
+  char **argv;                  /* arguments table if any */
   xbt_dict_t properties;
 } s_smx_simdata_process_t;
 
@@ -75,8 +75,8 @@ typedef struct s_smx_process_arg {
 typedef struct s_smx_mutex {
 
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_mutex */
-  xbt_swag_t sleeping;         /* list of sleeping process */
-  int refcount ;
+  xbt_swag_t sleeping;          /* list of sleeping process */
+  int refcount;
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_mutex */
 
 } s_smx_mutex_t;
@@ -84,9 +84,9 @@ typedef struct s_smx_mutex {
 typedef struct s_smx_cond {
 
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_cond */
-  xbt_swag_t sleeping;         /* list of sleeping process */
+  xbt_swag_t sleeping;          /* list of sleeping process */
   smx_mutex_t mutex;
-  xbt_fifo_t actions;          /* list of actions */
+  xbt_fifo_t actions;           /* list of actions */
   /* KEEP IT IN SYNC WITH src/xbt_sg_thread.c::struct s_xbt_cond */
 
 } s_smx_cond_t;
@@ -94,7 +94,7 @@ typedef struct s_smx_cond {
 /********************************* Action **************************************/
 
 typedef struct s_smx_simdata_action {
-  surf_action_t surf_action;   /* SURF modeling of computation  */
+  surf_action_t surf_action;    /* SURF modeling of computation  */
 
   smx_host_t source;
 
@@ -104,11 +104,11 @@ typedef struct s_smx_simdata_action {
 
 /******************************* Configuration support **********************************/
 
-void simix_config_init(void);  /* create the config set, call this before use! */
-void simix_config_finalize(void);      /* destroy the config set, call this at cleanup. */
-extern int _simix_init_status; /* 0: beginning of time; 
-                                  1: pre-inited (cfg_set created); 
-                                  2: inited (running) */
+void simix_config_init(void);   /* create the config set, call this before use! */
+void simix_config_finalize(void);       /* destroy the config set, call this at cleanup. */
+extern int _simix_init_status;  /* 0: beginning of time; 
+                                   1: pre-inited (cfg_set created); 
+                                   2: inited (running) */
 extern xbt_cfg_t _simix_cfg_set;
 
 
@@ -117,8 +117,8 @@ extern xbt_cfg_t _simix_cfg_set;
                                   "Host failed, you cannot call this function.")
 
 smx_host_t __SIMIX_host_create(const char *name, void *workstation,
-                              void *data);
-void __SIMIX_host_destroy(voidhost);
+                               void *data);
+void __SIMIX_host_destroy(void *host);
 
 void __SIMIX_cond_wait(smx_cond_t cond);
 
index f3c318f..3be2dd5 100644 (file)
@@ -11,7 +11,7 @@
 #include "xbt/ex.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_action, simix,
-                               "Logging specific to SIMIX (action)");
+                                "Logging specific to SIMIX (action)");
 
 /************************************* Actions *********************************/
 /** \brief Creates a new SIMIX action to communicate two hosts.
@@ -25,23 +25,22 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_action, simix,
  *     \return A new SIMIX action
  * */
 smx_action_t SIMIX_action_communicate(smx_host_t sender,
-                                     smx_host_t receiver, const char *name,
-                                     double size, double rate)
+                                      smx_host_t receiver, const char *name,
+                                      double size, double rate)
 {
-        smx_action_t act;
-        smx_simdata_action_t simdata;
+  smx_action_t act;
+  smx_simdata_action_t simdata;
 
   /* check if the host is active */
-  if (surf_workstation_model->extension_public->
-      get_state(sender->simdata->host) != SURF_CPU_ON) {
-    THROW1(network_error, 0,
-          "Host %s failed, you cannot call this function", sender->name);
+  if (surf_workstation_model->
+      extension_public->get_state(sender->simdata->host) != SURF_CPU_ON) {
+    THROW1(network_error, 0, "Host %s failed, you cannot call this function",
+           sender->name);
   }
-  if (surf_workstation_model->extension_public->
-      get_state(receiver->simdata->host) != SURF_CPU_ON) {
-    THROW1(network_error, 0,
-          "Host %s failed, you cannot call this function",
-          receiver->name);
+  if (surf_workstation_model->
+      extension_public->get_state(receiver->simdata->host) != SURF_CPU_ON) {
+    THROW1(network_error, 0, "Host %s failed, you cannot call this function",
+           receiver->name);
   }
 
   /* alloc structures */
@@ -55,12 +54,13 @@ smx_action_t SIMIX_action_communicate(smx_host_t sender,
   simdata->source = sender;
 
 
-  simdata->surf_action = surf_workstation_model->extension_public->
-      communicate(sender->simdata->host,
-                 receiver->simdata->host, size, rate);
-  surf_workstation_model->common_public->action_set_data(simdata->
-                                                           surf_action,
-                                                           act);
+  simdata->surf_action =
+    surf_workstation_model->extension_public->communicate(sender->simdata->
+                                                          host,
+                                                          receiver->simdata->
+                                                          host, size, rate);
+  surf_workstation_model->common_public->action_set_data(simdata->surf_action,
+                                                         act);
 
   DEBUG1("Create communicate action %p", act);
   return act;
@@ -75,16 +75,16 @@ smx_action_t SIMIX_action_communicate(smx_host_t sender,
  *     \return A new SIMIX action
  * */
 smx_action_t SIMIX_action_execute(smx_host_t host, const char *name,
-                                 double amount)
+                                  double amount)
 {
-        smx_action_t act;
-        smx_simdata_action_t simdata;
+  smx_action_t act;
+  smx_simdata_action_t simdata;
 
   /* check if the host is active */
-  if (surf_workstation_model->extension_public->
-      get_state(host->simdata->host) != SURF_CPU_ON) {
+  if (surf_workstation_model->
+      extension_public->get_state(host->simdata->host) != SURF_CPU_ON) {
     THROW1(host_error, 0, "Host %s failed, you cannot call this function",
-          host->name);
+           host->name);
   }
 
   /* alloc structures */
@@ -98,12 +98,12 @@ smx_action_t SIMIX_action_execute(smx_host_t host, const char *name,
   act->name = xbt_strdup(name);
 
   /* set communication */
-  simdata->surf_action = surf_workstation_model->extension_public->
-      execute(host->simdata->host, amount);
+  simdata->surf_action =
+    surf_workstation_model->extension_public->execute(host->simdata->host,
+                                                      amount);
 
-  surf_workstation_model->common_public->action_set_data(simdata->
-                                                           surf_action,
-                                                           act);
+  surf_workstation_model->common_public->action_set_data(simdata->surf_action,
+                                                         act);
 
   DEBUG1("Create execute action %p", act);
   return act;
@@ -123,10 +123,10 @@ smx_action_t SIMIX_action_sleep(smx_host_t host, double duration)
   smx_action_t act;
 
   /* check if the host is active */
-  if (surf_workstation_model->extension_public->
-      get_state(host->simdata->host) != SURF_CPU_ON) {
+  if (surf_workstation_model->
+      extension_public->get_state(host->simdata->host) != SURF_CPU_ON) {
     THROW1(host_error, 0, "Host %s failed, you cannot call this function",
-          host->name);
+           host->name);
   }
 
   /* alloc structures */
@@ -139,12 +139,12 @@ smx_action_t SIMIX_action_sleep(smx_host_t host, double duration)
   simdata->source = host;
   act->name = xbt_strdup(name);
 
-  simdata->surf_action = surf_workstation_model->extension_public->
-      sleep(host->simdata->host, duration);
+  simdata->surf_action =
+    surf_workstation_model->extension_public->sleep(host->simdata->host,
+                                                    duration);
 
-  surf_workstation_model->common_public->action_set_data(simdata->
-                                                           surf_action,
-                                                           act);
+  surf_workstation_model->common_public->action_set_data(simdata->surf_action,
+                                                         act);
 
   DEBUG1("Create sleep action %p", act);
   return act;
@@ -163,8 +163,7 @@ void SIMIX_action_cancel(smx_action_t action)
   DEBUG1("Cancel action %p", action);
   if (action->simdata->surf_action) {
     surf_workstation_model->common_public->action_cancel(action->
-                                                           simdata->
-                                                           surf_action);
+                                                         simdata->surf_action);
   }
   return;
 }
@@ -179,10 +178,10 @@ void SIMIX_action_cancel(smx_action_t action)
 void SIMIX_action_set_priority(smx_action_t action, double priority)
 {
   xbt_assert0((action != NULL)
-             && (action->simdata != NULL), "Invalid parameter");
+              && (action->simdata != NULL), "Invalid parameter");
 
-  surf_workstation_model->common_public->
-      set_priority(action->simdata->surf_action, priority);
+  surf_workstation_model->common_public->set_priority(action->simdata->
+                                                      surf_action, priority);
   return;
 }
 
@@ -197,8 +196,8 @@ void SIMIX_action_destroy(smx_action_t action)
   xbt_assert0((action != NULL), "Invalid parameter");
 
   xbt_assert1((xbt_fifo_size(action->cond_list) == 0),
-             "Conditional list not empty %d. There is a problem. Cannot destroy it now!",
-             xbt_fifo_size(action->cond_list));
+              "Conditional list not empty %d. There is a problem. Cannot destroy it now!",
+              xbt_fifo_size(action->cond_list));
 
   DEBUG1("Destroy action %p", action);
   if (action->name)
@@ -207,8 +206,8 @@ void SIMIX_action_destroy(smx_action_t action)
   xbt_fifo_free(action->cond_list);
 
   if (action->simdata->surf_action)
-    action->simdata->surf_action->model_type->common_public->
-       action_free(action->simdata->surf_action);
+    action->simdata->surf_action->model_type->
+      common_public->action_free(action->simdata->surf_action);
 
   xbt_free(action->simdata);
   xbt_free(action);
@@ -222,8 +221,7 @@ void SIMIX_action_destroy(smx_action_t action)
  *     \param action SIMIX action
  *     \param cond SIMIX cond
  */
-void SIMIX_register_action_to_condition(smx_action_t action,
-                                       smx_cond_t cond)
+void SIMIX_register_action_to_condition(smx_action_t action, smx_cond_t cond)
 {
   xbt_assert0((action != NULL) && (cond != NULL), "Invalid parameters");
 
@@ -245,7 +243,7 @@ void SIMIX_register_action_to_condition(smx_action_t action,
  *     \param cond SIMIX cond
  */
 void SIMIX_unregister_action_to_condition(smx_action_t action,
-                                         smx_cond_t cond)
+                                          smx_cond_t cond)
 {
   xbt_assert0((action != NULL) && (cond != NULL), "Invalid parameters");
 
@@ -270,10 +268,10 @@ double SIMIX_action_get_remains(smx_action_t action)
 }
 
 smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb,
-                                          smx_host_t *host_list,
-                                          double *computation_amount,
-                                          double *communication_amount,
-                                          double amount, double rate)
+                                           smx_host_t * host_list,
+                                           double *computation_amount,
+                                           double *communication_amount,
+                                           double amount, double rate)
 {
   void **workstation_list = NULL;
   smx_simdata_action_t simdata;
@@ -291,19 +289,20 @@ smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb,
 
   /* set action */
 
-  workstation_list = xbt_new0(void *,host_nb);
+  workstation_list = xbt_new0(void *, host_nb);
   for (i = 0; i < host_nb; i++)
     workstation_list[i] = host_list[i]->simdata->host;
 
   simdata->surf_action =
-      surf_workstation_model->extension_public->
-      execute_parallel_task(host_nb, workstation_list,
-                           computation_amount, communication_amount,
-                           amount, rate);
+    surf_workstation_model->extension_public->execute_parallel_task(host_nb,
+                                                                    workstation_list,
+                                                                    computation_amount,
+                                                                    communication_amount,
+                                                                    amount,
+                                                                    rate);
 
-  surf_workstation_model->common_public->action_set_data(simdata->
-                                                        surf_action,
-                                                        act);
+  surf_workstation_model->common_public->action_set_data(simdata->surf_action,
+                                                         act);
 
   return act;
 }
@@ -311,8 +310,9 @@ smx_action_t SIMIX_action_parallel_execute(char *name, int host_nb,
 e_surf_action_state_t SIMIX_action_get_state(smx_action_t action)
 {
   xbt_assert0((action != NULL), "Invalid parameter");
-  return surf_workstation_model->common_public->
-      action_get_state(action->simdata->surf_action);
+  return surf_workstation_model->common_public->action_get_state(action->
+                                                                 simdata->
+                                                                 surf_action);
 
 }
 
@@ -323,7 +323,7 @@ void __SIMIX_cond_display_actions(smx_cond_t cond)
 
   DEBUG1("Actions for condition %p", cond);
   xbt_fifo_foreach(cond->actions, item, action, smx_action_t)
-      DEBUG1("\t %p", action);
+    DEBUG1("\t %p", action);
 }
 
 void __SIMIX_action_display_conditions(smx_action_t action)
@@ -333,5 +333,5 @@ void __SIMIX_action_display_conditions(smx_action_t action)
 
   DEBUG1("Conditions for action %p", action);
   xbt_fifo_foreach(action->cond_list, item, cond, smx_cond_t)
-      DEBUG1("\t %p", cond);
+    DEBUG1("\t %p", cond);
 }
index 83252ab..bb727bc 100644 (file)
@@ -10,9 +10,9 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 
-int _simix_init_status = 0;    /* 0: beginning of time; 
-                                  1: pre-inited (cfg_set created); 
-                                  2: inited (running) */
+int _simix_init_status = 0;     /* 0: beginning of time; 
+                                   1: pre-inited (cfg_set created); 
+                                   2: inited (running) */
 xbt_cfg_t _simix_cfg_set = NULL;
 
 /* callback of the workstation_model variable */
@@ -21,12 +21,12 @@ static void _simix_cfg_cb__workstation_model(const char *name, int pos)
   char *val;
 
   xbt_assert0(_simix_init_status < 2,
-             "Cannot change the model after the initialization");
+              "Cannot change the model after the initialization");
 
   val = xbt_cfg_get_string(_simix_cfg_set, name);
   /* New Module missing */
 
-  find_model_description(surf_workstation_model_description,val);
+  find_model_description(surf_workstation_model_description, val);
 }
 
 /* callback of the cpu_model variable */
@@ -35,7 +35,7 @@ static void _simix_cfg_cb__cpu_model(const char *name, int pos)
   char *val;
 
   xbt_assert0(_simix_init_status < 2,
-             "Cannot change the model after the initialization");
+              "Cannot change the model after the initialization");
 
   val = xbt_cfg_get_string(_simix_cfg_set, name);
   /* New Module missing */
@@ -48,7 +48,7 @@ static void _simix_cfg_cb__network_model(const char *name, int pos)
   char *val;
 
   xbt_assert0(_simix_init_status < 2,
-             "Cannot change the model after the initialization");
+              "Cannot change the model after the initialization");
 
   val = xbt_cfg_get_string(_simix_cfg_set, name);
   /* New Module missing */
@@ -69,7 +69,7 @@ void simix_config_init(void)
 {
 
   if (_simix_init_status)
-    return;                    /* Already inited, nothing to do */
+    return;                     /* Already inited, nothing to do */
 
   /* Connect our log channels: that must be done manually under windows */
   XBT_LOG_CONNECT(simix_action, simix);
@@ -79,20 +79,20 @@ void simix_config_init(void)
   XBT_LOG_CONNECT(simix_kernel, simix);
   XBT_LOG_CONNECT(simix_process, simix);
   XBT_LOG_CONNECT(simix_synchro, simix);
-  
+
   _simix_init_status = 1;
   _simix_cfg_set = xbt_cfg_new();
 
   xbt_cfg_register(_simix_cfg_set,
-                  "workstation_model", xbt_cfgelm_string, 1, 1,
-                  &_simix_cfg_cb__workstation_model, NULL);
+                   "workstation_model", xbt_cfgelm_string, 1, 1,
+                   &_simix_cfg_cb__workstation_model, NULL);
 
   xbt_cfg_register(_simix_cfg_set,
-                  "cpu_model", xbt_cfgelm_string, 1, 1,
-                  &_simix_cfg_cb__cpu_model, NULL);
+                   "cpu_model", xbt_cfgelm_string, 1, 1,
+                   &_simix_cfg_cb__cpu_model, NULL);
   xbt_cfg_register(_simix_cfg_set,
-                  "network_model", xbt_cfgelm_string, 1, 1,
-                  &_simix_cfg_cb__network_model, NULL);
+                   "network_model", xbt_cfgelm_string, 1, 1,
+                   &_simix_cfg_cb__network_model, NULL);
 
   xbt_cfg_set_string(_simix_cfg_set, "workstation_model", "CLM03");
 }
@@ -101,7 +101,7 @@ void simix_config_finalize(void)
 {
 
   if (!_simix_init_status)
-    return;                    /* Not initialized yet. Nothing to do */
+    return;                     /* Not initialized yet. Nothing to do */
 
   xbt_cfg_free(&_simix_cfg_set);
   _simix_init_status = 0;
index 95b393d..41d777f 100644 (file)
@@ -14,7 +14,7 @@
 #include "surf/surfxml_parse_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_deployment, simix,
-                               "Logging specific to SIMIX (deployment)");
+                                "Logging specific to SIMIX (deployment)");
 static int parse_argc = -1;
 static char **parse_argv = NULL;
 static xbt_main_func_t parse_code = NULL;
@@ -26,10 +26,10 @@ static void parse_process_init(void)
 {
   parse_host = xbt_strdup(A_surfxml_process_host);
   xbt_assert1(SIMIX_host_get_by_name(parse_host),
-             "Host '%s' unknown", parse_host);
+              "Host '%s' unknown", parse_host);
   parse_code = SIMIX_get_registered_function(A_surfxml_process_function);
   xbt_assert1(parse_code, "Function '%s' unknown",
-             A_surfxml_process_function);
+              A_surfxml_process_function);
   parse_argc = 0;
   parse_argv = NULL;
   parse_argc++;
@@ -64,16 +64,14 @@ static void parse_process_finalize(void)
     arg->properties = current_property_set;
 
     DEBUG3("Process %s(%s) will be started at time %f", arg->name,
-          arg->hostname, start_time);
+           arg->hostname, start_time);
     if (simix_global->create_process_function)
-      surf_timer_model->extension_public->set(start_time,
-                                                (void *) simix_global->
-                                                create_process_function,
-                                                arg);
+      surf_timer_model->extension_public->set(start_time, (void *)
+                                              simix_global->create_process_function,
+                                              arg);
     else
       surf_timer_model->extension_public->set(start_time, (void *)
-                                                &SIMIX_process_create,
-                                                arg);
+                                              &SIMIX_process_create, arg);
 
   }
   if ((start_time < 0) || (start_time == SIMIX_get_clock())) {
@@ -81,24 +79,24 @@ static void parse_process_finalize(void)
 
     if (simix_global->create_process_function)
       process =
-        (*simix_global->create_process_function)(parse_argv[0], parse_code,
-                                               NULL, parse_host,
-                                               parse_argc, parse_argv, /*the props*/ current_property_set);
+        (*simix_global->create_process_function) (parse_argv[0], parse_code,
+                                                  NULL, parse_host,
+                                                  parse_argc, parse_argv,
+                                                  /*the props */
+                                                  current_property_set);
     else
-      process =
-         SIMIX_process_create(parse_argv[0], parse_code, NULL, parse_host,
-                              parse_argc, parse_argv, /*the props*/ current_property_set);
+      process = SIMIX_process_create(parse_argv[0], parse_code, NULL, parse_host, parse_argc, parse_argv,       /*the props */
+                                     current_property_set);
 
     if (kill_time > SIMIX_get_clock()) {
       if (simix_global->kill_process_function)
-       surf_timer_model->extension_public->set(start_time,
-                                                  (void *) simix_global->
-                                                  kill_process_function,
-                                                  arg);
+        surf_timer_model->extension_public->set(start_time, (void *)
+                                                simix_global->kill_process_function,
+                                                arg);
       else
-       surf_timer_model->extension_public->set(kill_time, (void *)
-                                                  &SIMIX_process_kill,
-                                                  (void *) process);
+        surf_timer_model->extension_public->set(kill_time, (void *)
+                                                &SIMIX_process_kill,
+                                                (void *) process);
     }
     xbt_free(parse_host);
   }
@@ -121,7 +119,7 @@ static void parse_process_finalize(void)
 void SIMIX_launch_application(const char *file)
 {
   xbt_assert0(simix_global,
-             "SIMIX_global_init has to be called before SIMIX_launch_application.");
+              "SIMIX_global_init has to be called before SIMIX_launch_application.");
   surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_process_cb_list, parse_process_init);
   surfxml_add_callback(ETag_surfxml_argument_cb_list, parse_argument);
@@ -144,7 +142,7 @@ void SIMIX_launch_application(const char *file)
 void SIMIX_function_register(const char *name, xbt_main_func_t code)
 {
   xbt_assert0(simix_global,
-             "SIMIX_global_init has to be called before SIMIX_function_register.");
+              "SIMIX_global_init has to be called before SIMIX_function_register.");
 
   xbt_dict_set(simix_global->registered_functions, name, code, NULL);
 }
@@ -159,7 +157,7 @@ static xbt_main_func_t default_function = NULL;
 void SIMIX_function_register_default(xbt_main_func_t code)
 {
   xbt_assert0(simix_global,
-             "SIMIX_global_init has to be called before SIMIX_function_register.");
+              "SIMIX_global_init has to be called before SIMIX_function_register.");
 
   default_function = code;
 }
@@ -175,8 +173,9 @@ void SIMIX_function_register_default(xbt_main_func_t code)
 xbt_main_func_t SIMIX_get_registered_function(const char *name)
 {
   xbt_assert0(simix_global,
-             "SIMIX_global_init has to be called before SIMIX_get_registered_function.");
+              "SIMIX_global_init has to be called before SIMIX_get_registered_function.");
 
-  xbt_main_func_t res = xbt_dict_get_or_null(simix_global->registered_functions, name);
+  xbt_main_func_t res =
+    xbt_dict_get_or_null(simix_global->registered_functions, name);
   return res ? res : default_function;
 }
index 953e021..507967e 100644 (file)
@@ -12,7 +12,7 @@
 #include "xbt/xbt_os_time.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix,
-                               "Logging specific to SIMIX (environment)");
+                                "Logging specific to SIMIX (environment)");
 
 /********************************* SIMIX **************************************/
 
@@ -40,17 +40,17 @@ void SIMIX_create_environment(const char *file)
   int workstation_id = -1;
   double start, end;
 
-  simix_config_init();         /* make sure that our configuration set is created */
+  simix_config_init();          /* make sure that our configuration set is created */
   surf_timer_model_init(file);
 
   /* which model do you want today? */
   workstation_model_name =
-      xbt_cfg_get_string(_simix_cfg_set, "workstation_model");
+    xbt_cfg_get_string(_simix_cfg_set, "workstation_model");
 
   DEBUG1("Model : %s", workstation_model_name);
   workstation_id =
-      find_model_description(surf_workstation_model_description,
-                            workstation_model_name);
+    find_model_description(surf_workstation_model_description,
+                           workstation_model_name);
   if (!strcmp(workstation_model_name, "compound")) {
     xbt_ex_t e;
     char *network_model_name = NULL;
@@ -62,42 +62,40 @@ void SIMIX_create_environment(const char *file)
       cpu_model_name = xbt_cfg_get_string(_simix_cfg_set, "cpu_model");
     } CATCH(e) {
       if (e.category == bound_error) {
-       xbt_assert0(0,
-                   "Set a cpu model to use with the 'compound' workstation model");
-       xbt_ex_free(e);
+        xbt_assert0(0,
+                    "Set a cpu model to use with the 'compound' workstation model");
+        xbt_ex_free(e);
       } else {
-       RETHROW;
+        RETHROW;
       }
     }
 
     TRY {
       network_model_name =
-         xbt_cfg_get_string(_simix_cfg_set, "network_model");
+        xbt_cfg_get_string(_simix_cfg_set, "network_model");
     }
     CATCH(e) {
       if (e.category == bound_error) {
-       xbt_assert0(0,
-                   "Set a network model to use with the 'compound' workstation model");
-       xbt_ex_free(e);
+        xbt_assert0(0,
+                    "Set a network model to use with the 'compound' workstation model");
+        xbt_ex_free(e);
       } else {
-       RETHROW;
+        RETHROW;
       }
     }
 
     network_id =
-       find_model_description(surf_network_model_description,
-                              network_model_name);
+      find_model_description(surf_network_model_description,
+                             network_model_name);
     cpu_id =
-       find_model_description(surf_cpu_model_description,
-                              cpu_model_name);
+      find_model_description(surf_cpu_model_description, cpu_model_name);
 
     surf_cpu_model_description[cpu_id].model_init(file);
     surf_network_model_description[network_id].model_init(file);
 
 
-  } 
-  surf_workstation_model_description[workstation_id].
-    model_init(file);
+  }
+  surf_workstation_model_description[workstation_id].model_init(file);
 
   start = xbt_os_time();
   parse_platform_file(file);
@@ -105,9 +103,9 @@ void SIMIX_create_environment(const char *file)
   if (surf_workstation_model_description[workstation_id].create_ws != NULL)
     surf_workstation_model_description[workstation_id].create_ws();
   end = xbt_os_time();
-  DEBUG1("PARSE TIME: %lg", (end-start));
+  DEBUG1("PARSE TIME: %lg", (end - start));
 
-  _simix_init_status = 2;      /* inited; don't change settings now */
+  _simix_init_status = 2;       /* inited; don't change settings now */
 
   xbt_dict_foreach(workstation_set, cursor, name, workstation) {
     __SIMIX_host_create(name, workstation, NULL);
index cf43c42..72126a7 100644 (file)
@@ -10,9 +10,9 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
-#include "xbt/ex.h"            /* ex_backtrace_display */
+#include "xbt/ex.h"             /* ex_backtrace_display */
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix,
-                               "Logging specific to SIMIX (kernel)");
+                                "Logging specific to SIMIX (kernel)");
 
 SIMIX_Global_t simix_global = NULL;
 
@@ -41,7 +41,7 @@ static void simix_cfg_control_set(const char *control_string)
   /* split the string, and remove empty entries */
   set_strings = xbt_str_split_quoted(control_string);
 
-  if (xbt_dynar_length(set_strings) == 0) {    /* vicious user! */
+  if (xbt_dynar_length(set_strings) == 0) {     /* vicious user! */
     xbt_dynar_free(&set_strings);
     return;
   }
@@ -60,9 +60,9 @@ static void simix_cfg_control_set(const char *control_string)
     value++;
 
     xbt_assert1(strlen(name) != 0, "Invalid name for configuration: '%s'",
-               name);
+                name);
     xbt_assert1(strlen(value) != 0,
-               "Invalid value for configuration: '%s'", value);
+                "Invalid value for configuration: '%s'", value);
     INFO2("setting '%s' to '%s'", name, value);
 
     __simix_config_helper(name, value);
@@ -87,12 +87,12 @@ static void simix_cfg_init(int *argc, char **argv)
       /*remove this from argv */
 
       for (j = i + 1; j < *argc; j++) {
-       argv[j - 1] = argv[j];
+        argv[j - 1] = argv[j];
       }
 
       argv[j - 1] = NULL;
       (*argc)--;
-      i--;                     /* compensate effect of next loop incrementation */
+      i--;                      /* compensate effect of next loop incrementation */
     }
   }
 }
@@ -119,16 +119,16 @@ void SIMIX_global_init(int *argc, char **argv)
   s_smx_process_t proc;
 
   if (!simix_global) {
-    surf_init(argc, argv);     /* Initialize some common structures. Warning, it sets simix_global=NULL */
+    surf_init(argc, argv);      /* Initialize some common structures. Warning, it sets simix_global=NULL */
     simix_cfg_init(argc, argv);
 
     simix_global = xbt_new0(s_SIMIX_Global_t, 1);
 
     simix_global->host = xbt_dict_new();
     simix_global->process_to_run =
-       xbt_swag_new(xbt_swag_offset(proc, synchro_hookup));
+      xbt_swag_new(xbt_swag_offset(proc, synchro_hookup));
     simix_global->process_list =
-       xbt_swag_new(xbt_swag_offset(proc, process_hookup));
+      xbt_swag_new(xbt_swag_offset(proc, process_hookup));
     simix_global->current_process = NULL;
     simix_global->registered_functions = xbt_dict_new();
 
@@ -149,44 +149,50 @@ void SIMIX_display_process_status(void)
   smx_action_t act;
   int nbprocess = xbt_swag_size(simix_global->process_list);
 
-  INFO1("%d processes are still running, waiting for something.",
-       nbprocess);
+  INFO1("%d processes are still running, waiting for something.", nbprocess);
   /*  List the process and their state */
   INFO0
-      ("Legend of the following listing: \"<process> on <host>: <status>.\"");
+    ("Legend of the following listing: \"<process> on <host>: <status>.\"");
   xbt_swag_foreach(process, simix_global->process_list) {
     smx_simdata_process_t p_simdata =
-       (smx_simdata_process_t) process->simdata;
+      (smx_simdata_process_t) process->simdata;
     // simdata_host_t h_simdata=(simdata_host_t)p_simdata->host->simdata;
     char *who, *who2;
 
     asprintf(&who, "%s on %s: %s",
-            process->name,
-            p_simdata->smx_host->name,
-            (process->simdata->blocked) ? "[BLOCKED] "
-            : ((process->simdata->suspended) ? "[SUSPENDED] " : ""));
+             process->name,
+             p_simdata->smx_host->name,
+             (process->simdata->blocked) ? "[BLOCKED] "
+             : ((process->simdata->suspended) ? "[SUSPENDED] " : ""));
 
     if (p_simdata->mutex) {
-               who2 = bprintf("%s Blocked on mutex %p", who, (XBT_LOG_ISENABLED(simix_kernel,xbt_log_priority_verbose))?p_simdata->mutex:(void*)0xdead);
+      who2 =
+        bprintf("%s Blocked on mutex %p", who,
+                (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_verbose)) ?
+                p_simdata->mutex : (void *) 0xdead);
       free(who);
       who = who2;
     } else if (p_simdata->cond) {
       who2 =
-         bprintf
-         ("%s Blocked on condition %p; Waiting for the following actions:",
-          who, (XBT_LOG_ISENABLED(simix_kernel,xbt_log_priority_verbose))?p_simdata->cond:(void*)0xdead);
+        bprintf
+        ("%s Blocked on condition %p; Waiting for the following actions:",
+         who,
+         (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_verbose)) ?
+         p_simdata->cond : (void *) 0xdead);
       free(who);
       who = who2;
       xbt_fifo_foreach(p_simdata->cond->actions, item, act, smx_action_t) {
-                 who2 = bprintf("%s '%s'(%p)", who, act->name,(XBT_LOG_ISENABLED(simix_kernel,xbt_log_priority_verbose))?act:(void*)0xdead);
-       free(who);
-       who = who2;
+        who2 =
+          bprintf("%s '%s'(%p)", who, act->name,
+                  (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_verbose))
+                  ? act : (void *) 0xdead);
+        free(who);
+        who = who2;
       }
     } else {
       who2 =
-         bprintf
-         ("%s Blocked in an unknown status (please report this bug)",
-          who);
+        bprintf
+        ("%s Blocked in an unknown status (please report this bug)", who);
       free(who);
       who = who2;
     }
@@ -222,13 +228,13 @@ void __SIMIX_main(void)
 
       DEBUG1("** %s failed **", smx_action->name);
       xbt_fifo_foreach(smx_action->cond_list, _cursor, cond, smx_cond_t) {
-       xbt_swag_foreach(process, cond->sleeping) {
-         DEBUG2("\t preparing to wake up %s on %s",
-                process->name, process->simdata->smx_host->name);
-       }
-       SIMIX_cond_broadcast(cond);
-       /* remove conditional from action */
-       SIMIX_unregister_action_to_condition(smx_action, cond);
+        xbt_swag_foreach(process, cond->sleeping) {
+          DEBUG2("\t preparing to wake up %s on %s",
+                 process->name, process->simdata->smx_host->name);
+        }
+        SIMIX_cond_broadcast(cond);
+        /* remove conditional from action */
+        SIMIX_unregister_action_to_condition(smx_action, cond);
       }
     }
 
@@ -237,13 +243,13 @@ void __SIMIX_main(void)
 
       DEBUG1("** %s done **", smx_action->name);
       xbt_fifo_foreach(smx_action->cond_list, _cursor, cond, smx_cond_t) {
-       xbt_swag_foreach(process, cond->sleeping) {
-         DEBUG2("\t preparing to wake up %s on %s",
-                process->name, process->simdata->smx_host->name);
-       }
-       SIMIX_cond_broadcast(cond);
-       /* remove conditional from action */
-       SIMIX_unregister_action_to_condition(smx_action, cond);
+        xbt_swag_foreach(process, cond->sleeping) {
+          DEBUG2("\t preparing to wake up %s on %s",
+                 process->name, process->simdata->smx_host->name);
+        }
+        SIMIX_cond_broadcast(cond);
+        /* remove conditional from action */
+        SIMIX_unregister_action_to_condition(smx_action, cond);
       }
     }
   }
@@ -315,8 +321,9 @@ double SIMIX_get_clock(void)
  *
  *      Must be called before the first call to SIMIX_solve()
  */
-void SIMIX_init(void) {
-    surf_presolve();
+void SIMIX_init(void)
+{
+  surf_presolve();
 }
 
 /**
@@ -342,7 +349,7 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed)
 
   while ((process = xbt_swag_extract(simix_global->process_to_run))) {
     DEBUG2("Scheduling %s on %s",
-          process->name, process->simdata->smx_host->name);
+           process->name, process->simdata->smx_host->name);
     simix_global->current_process = process;
     xbt_context_schedule(process->simdata->context);
     /*       fflush(NULL); */
@@ -359,10 +366,9 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed)
 
     xbt_dynar_foreach(model_list, iter, model) {
       if (xbt_swag_size(model->common_public->states.failed_action_set)
-         || xbt_swag_size(model->common_public->states.
-                          done_action_set)) {
-       state_modifications = 1;
-        break;
+          || xbt_swag_size(model->common_public->states.done_action_set)) {
+        state_modifications = 1;
+        break;
       }
     }
 
@@ -375,44 +381,44 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed)
     while (surf_timer_model->extension_public->get(&fun, (void *) &arg)) {
       DEBUG2("got %p %p", fun, arg);
       if (fun == SIMIX_process_create) {
-       smx_process_arg_t args = arg;
-       DEBUG2("Launching %s on %s", args->name, args->hostname);
-       process = SIMIX_process_create(args->name, args->code,
-                                      args->data, args->hostname,
-                                      args->argc, args->argv, args->properties);
-       if (args->kill_time > SIMIX_get_clock()) {
-         surf_timer_model->extension_public->set(args->kill_time,
-                                                    (void *)
-                                                    &SIMIX_process_kill,
-                                                    (void *) process);
-       }
-       xbt_free(args);
+        smx_process_arg_t args = arg;
+        DEBUG2("Launching %s on %s", args->name, args->hostname);
+        process = SIMIX_process_create(args->name, args->code,
+                                       args->data, args->hostname,
+                                       args->argc, args->argv,
+                                       args->properties);
+        if (args->kill_time > SIMIX_get_clock()) {
+          surf_timer_model->extension_public->set(args->kill_time, (void *)
+                                                  &SIMIX_process_kill,
+                                                  (void *) process);
+        }
+        xbt_free(args);
       }
       if (fun == SIMIX_process_kill) {
-       process = arg;
-       DEBUG2("Killing %s on %s", process->name,
-              process->simdata->smx_host->name);
-       SIMIX_process_kill(process);
+        process = arg;
+        DEBUG2("Killing %s on %s", process->name,
+               process->simdata->smx_host->name);
+        SIMIX_process_kill(process);
       }
     }
 
     /* Wake up all process waiting for the action finish */
     xbt_dynar_foreach(model_list, iter, model) {
       while ((action =
-             xbt_swag_extract(model->common_public->states.
-                              failed_action_set))) {
-       smx_action = action->data;
-       if (smx_action) {
-         xbt_fifo_unshift(actions_failed, smx_action);
-       }
+              xbt_swag_extract(model->common_public->
+                               states.failed_action_set))) {
+        smx_action = action->data;
+        if (smx_action) {
+          xbt_fifo_unshift(actions_failed, smx_action);
+        }
       }
       while ((action =
-             xbt_swag_extract(model->common_public->states.
-                              done_action_set))) {
-       smx_action = action->data;
-       if (smx_action) {
-         xbt_fifo_unshift(actions_done, smx_action);
-       }
+              xbt_swag_extract(model->common_public->
+                               states.done_action_set))) {
+        smx_action = action->data;
+        if (smx_action) {
+          xbt_fifo_unshift(actions_done, smx_action);
+        }
       }
     }
   }
@@ -425,9 +431,9 @@ double SIMIX_solve(xbt_fifo_t actions_done, xbt_fifo_t actions_failed)
       INFO0("Oops ! Deadlock or code not perfectly clean.");
       SIMIX_display_process_status();
       if (XBT_LOG_ISENABLED(simix, xbt_log_priority_debug) ||
-         XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_debug)) {
-       DEBUG0("Aborting!");
-       xbt_abort();
+          XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_debug)) {
+        DEBUG0("Aborting!");
+        xbt_abort();
       }
       INFO0("Return a Warning.");
     }
@@ -464,7 +470,7 @@ int SIMIX_timer_get(void **function, void **arg)
 void SIMIX_function_register_process_create(smx_creation_func_t function)
 {
   xbt_assert0((simix_global->create_process_function == NULL),
-             "Data already set");
+              "Data already set");
 
   simix_global->create_process_function = function;
 }
@@ -479,7 +485,7 @@ void SIMIX_function_register_process_create(smx_creation_func_t function)
 void SIMIX_function_register_process_kill(void_f_pvoid_t function)
 {
   xbt_assert0((simix_global->kill_process_function == NULL),
-             "Data already set");
+              "Data already set");
 
   simix_global->kill_process_function = function;
 }
index 57ea0d6..9df094f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: smx_host.c 4895 2007-10-27 07:34:39Z mquinson $     */
+/*     $Id$     */
 
 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donassolo.
    All rights reserved.                                          */
 #include "xbt/dict.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
-                               "Logging specific to SIMIX (hosts)");
+                                "Logging specific to SIMIX (hosts)");
 
 /********************************* Host **************************************/
 smx_host_t __SIMIX_host_create(const char *name,
-                              void *workstation, void *data)
+                               void *workstation, void *data)
 {
   smx_simdata_host_t simdata = xbt_new0(s_smx_simdata_host_t, 1);
   smx_host_t host = xbt_new0(s_smx_host_t, 1);
@@ -30,10 +30,10 @@ smx_host_t __SIMIX_host_create(const char *name,
   simdata->host = workstation;
 
   simdata->process_list =
-      xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
+    xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
   /* Update global variables */
 
-  xbt_dict_set(simix_global->host,host->name, host,&__SIMIX_host_destroy);
+  xbt_dict_set(simix_global->host, host->name, host, &__SIMIX_host_destroy);
 
   return host;
 }
@@ -81,7 +81,7 @@ const char *SIMIX_host_get_name(smx_host_t host)
 {
 
   xbt_assert0((host != NULL)
-             && (host->simdata != NULL), "Invalid parameters");
+              && (host->simdata != NULL), "Invalid parameters");
 
   /* Return data */
   return (host->name);
@@ -103,9 +103,9 @@ smx_host_t SIMIX_host_self(void)
  * MSG_host_destroy is just  a front_end that also removes it from 
  * msg_global->host
  */
-void __SIMIX_host_destroy(voidh)
+void __SIMIX_host_destroy(void *h)
 {
-  smx_host_t host = (smx_host_t)h;
+  smx_host_t host = (smx_host_t) h;
   smx_simdata_host_t simdata = NULL;
 
   xbt_assert0((host != NULL), "Invalid parameters");
@@ -116,7 +116,7 @@ void __SIMIX_host_destroy(void* h)
 
   if (xbt_swag_size(simdata->process_list) != 0) {
     char *msg =
-       bprintf("Shutting down host %s, but it's not empty:", host->name);
+      bprintf("Shutting down host %s, but it's not empty:", host->name);
     char *tmp;
     smx_process_t process = NULL;
 
@@ -155,17 +155,18 @@ int SIMIX_host_get_number(void)
  *
  * \return List of all hosts (in a newly allocated table)
  */
-smx_host_t* SIMIX_host_get_table(void) {
-   smx_host_t *res = xbt_new(smx_host_t,xbt_dict_size(simix_global->host));
-   smx_host_t h;
-   xbt_dict_cursor_t c;
-   char *name;
-   int i=0;
-   
-   xbt_dict_foreach(simix_global->host,c,name,h)
-     res[i++] = h;
-   
-   return res;
+smx_host_t *SIMIX_host_get_table(void)
+{
+  smx_host_t *res = xbt_new(smx_host_t, xbt_dict_size(simix_global->host));
+  smx_host_t h;
+  xbt_dict_cursor_t c;
+  char *name;
+  int i = 0;
+
+  xbt_dict_foreach(simix_global->host, c, name, h)
+    res[i++] = h;
+
+  return res;
 }
 
 /**
@@ -173,8 +174,9 @@ smx_host_t* SIMIX_host_get_table(void) {
  *
  * \return List of all hosts (as a #xbt_dict_t)
  */
-xbt_dict_t SIMIX_host_get_dict(void) {
-   return simix_global->host;
+xbt_dict_t SIMIX_host_get_dict(void)
+{
+  return simix_global->host;
 }
 
 /**
@@ -188,8 +190,8 @@ double SIMIX_host_get_speed(smx_host_t host)
 {
   xbt_assert0((host != NULL), "Invalid parameters");
 
-  return (surf_workstation_model->
-         extension_public->get_speed(host->simdata->host, 1.0));
+  return (surf_workstation_model->extension_public->
+          get_speed(host->simdata->host, 1.0));
 }
 
 /**
@@ -202,8 +204,8 @@ double SIMIX_host_get_available_speed(smx_host_t host)
 {
   xbt_assert0((host != NULL), "Invalid parameters");
 
-  return (surf_workstation_model->
-         extension_public->get_available_speed(host->simdata->host));
+  return (surf_workstation_model->extension_public->
+          get_available_speed(host->simdata->host));
 }
 
 /**
@@ -216,8 +218,7 @@ double SIMIX_host_get_available_speed(smx_host_t host)
 smx_host_t SIMIX_host_get_by_name(const char *name)
 {
   xbt_assert0(((simix_global != NULL)
-              && (simix_global->host != NULL)),
-             "Environment not set yet");
+               && (simix_global->host != NULL)), "Environment not set yet");
 
   return xbt_dict_get_or_null(simix_global->host, name);
 }
@@ -232,8 +233,8 @@ xbt_dict_t SIMIX_host_get_properties(smx_host_t host)
 {
   xbt_assert0((host != NULL), "Invalid parameters");
 
-  return (surf_workstation_model->
-         common_public->get_properties(host->simdata->host));
+  return (surf_workstation_model->common_public->
+          get_properties(host->simdata->host));
 
 }
 
@@ -249,7 +250,7 @@ int SIMIX_host_get_state(smx_host_t host)
 {
   xbt_assert0((host != NULL), "Invalid parameters");
 
-  return (surf_workstation_model->
-         extension_public->get_state(host->simdata->host));
+  return (surf_workstation_model->extension_public->
+          get_state(host->simdata->host));
 
 }
index a1abece..eb7799f 100644 (file)
@@ -12,7 +12,7 @@
 #include "msg/mailbox.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix,
-                               "Logging specific to SIMIX (process)");
+                                "Logging specific to SIMIX (process)");
 
 /******************************** Process ************************************/
 /**
@@ -29,8 +29,8 @@ void SIMIX_process_cleanup(void *arg)
   xbt_swag_remove(arg, simix_global->process_list);
   xbt_swag_remove(arg, simix_global->process_to_run);
   xbt_swag_remove(arg,
-                 ((smx_process_t) arg)->simdata->smx_host->simdata->
-                 process_list);
+                  ((smx_process_t) arg)->simdata->smx_host->
+                  simdata->process_list);
   free(((smx_process_t) arg)->name);
   ((smx_process_t) arg)->name = NULL;
 
@@ -54,17 +54,17 @@ void SIMIX_process_cleanup(void *arg)
  * \return The new corresponding object.
  */
 smx_process_t SIMIX_process_create(const char *name,
-                                  xbt_main_func_t code, void *data,
-                                  const char *hostname, int argc,
-                                  char **argv, xbt_dict_t properties)
+                                   xbt_main_func_t code, void *data,
+                                   const char *hostname, int argc,
+                                   char **argv, xbt_dict_t properties)
 {
   smx_simdata_process_t simdata = xbt_new0(s_smx_simdata_process_t, 1);
   smx_process_t process = xbt_new0(s_smx_process_t, 1);
   smx_process_t self = NULL;
   smx_host_t host = SIMIX_host_get_by_name(hostname);
   /*char alias[MAX_ALIAS_NAME + 1] = {0};
-  msg_mailbox_t mailbox;*/
-       
+     msg_mailbox_t mailbox; */
+
   xbt_assert0(((code != NULL) && (host != NULL)), "Invalid parameters");
   /* Simulator Data */
 
@@ -73,17 +73,16 @@ smx_process_t SIMIX_process_create(const char *name,
   simdata->cond = NULL;
   simdata->argc = argc;
   simdata->argv = argv;
-  simdata->context = xbt_context_new(name,code, NULL, NULL,
-                                    simix_global->
-                                    cleanup_process_function, process,
-                                    simdata->argc, simdata->argv);
+  simdata->context = xbt_context_new(name, code, NULL, NULL,
+                                     simix_global->cleanup_process_function,
+                                     process, simdata->argc, simdata->argv);
 
   /* Process structure */
   process->name = xbt_strdup(name);
   process->simdata = simdata;
   process->data = data;
 
-  /* Add properties*/
+  /* Add properties */
   simdata->properties = properties;
 
   xbt_swag_insert(process, host->simdata->process_list);
@@ -96,14 +95,15 @@ smx_process_t SIMIX_process_create(const char *name,
   xbt_swag_insert(process, simix_global->process_list);
   DEBUG2("Inserting %s(%s) in the to_run list", process->name, host->name);
   xbt_swag_insert(process, simix_global->process_to_run);
-  
+
   /*sprintf(alias,"%s:%s",hostname,process->name);
 
-       mailbox = MSG_mailbox_new(alias);
-       MSG_mailbox_set_hostname(mailbox, hostname);*/
+     mailbox = MSG_mailbox_new(alias);
+     MSG_mailbox_set_hostname(mailbox, hostname); */
 
   return process;
 }
+
 /** 
  * \brief Creates and runs a new #smx_process_t hosting a JAVA thread
  *
@@ -111,8 +111,8 @@ smx_process_t SIMIX_process_create(const char *name,
  * a context with no code, which leads to segfaults in plain libsimgrid 
  */
 void SIMIX_jprocess_create(const char *name, smx_host_t host,
-                          void *data,
-                          void *jprocess, void *jenv, smx_process_t * res)
+                           void *data,
+                           void *jprocess, void *jenv, smx_process_t * res)
 {
   smx_simdata_process_t simdata = xbt_new0(s_smx_simdata_process_t, 1);
   smx_process_t process = xbt_new0(s_smx_process_t, 1);
@@ -134,7 +134,7 @@ void SIMIX_jprocess_create(const char *name, smx_host_t host,
 
 
   DEBUG5("jprocess_create(name=%s,host=%p,data=%p,jproc=%p,jenv=%p)",
-        name, host, data, jprocess, jenv);
+         name, host, data, jprocess, jenv);
   xbt_assert0(host, "Invalid parameters");
   /* Simulator Data */
   simdata->smx_host = host;
@@ -143,12 +143,12 @@ void SIMIX_jprocess_create(const char *name, smx_host_t host,
   simdata->argc = 0;
   simdata->argv = NULL;
 
-  simdata->context = xbt_context_new(name,NULL, NULL, jprocess,
-                                    simix_global->
-                                    cleanup_process_function, process,
-                                    /* argc/argv */ 0, NULL);
-       
+
+  simdata->context = xbt_context_new(name, NULL, NULL, jprocess,
+                                     simix_global->cleanup_process_function,
+                                     process,
+                                     /* argc/argv */ 0, NULL);
+
   /* Process structure */
   process->name = xbt_strdup(name);
   process->simdata = simdata;
@@ -158,9 +158,9 @@ void SIMIX_jprocess_create(const char *name, smx_host_t host,
 
   /* fix current_process, about which xbt_context_start mocks around */
   self = simix_global->current_process;
+
   xbt_context_start(process->simdata->context);
+
   simix_global->current_process = self;
 
   xbt_swag_insert(process, simix_global->process_list);
@@ -181,7 +181,7 @@ void SIMIX_process_kill(smx_process_t process)
   smx_simdata_process_t p_simdata = process->simdata;
 
   DEBUG2("Killing process %s on %s", process->name,
-        p_simdata->smx_host->name);
+         p_simdata->smx_host->name);
 
   /* Cleanup if we were waiting for something */
   if (p_simdata->mutex)
@@ -242,7 +242,7 @@ void SIMIX_process_set_data(smx_process_t process, void *data)
 smx_host_t SIMIX_process_get_host(smx_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
 
   return (process->simdata->smx_host);
 }
@@ -257,7 +257,7 @@ smx_host_t SIMIX_process_get_host(smx_process_t process)
 const char *SIMIX_process_get_name(smx_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
 
   return (process->name);
 }
@@ -272,7 +272,7 @@ const char *SIMIX_process_get_name(smx_process_t process)
 void SIMIX_process_set_name(smx_process_t process, char *name)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
 
   process->name = name;
 }
@@ -329,8 +329,8 @@ void SIMIX_process_suspend(smx_process_t process)
       simdata->suspended = 1;
       c = simdata->cond;
       xbt_fifo_foreach(c->actions, i, act, smx_action_t) {
-       surf_workstation_model->common_public->suspend(act->simdata->
-                                                         surf_action);
+        surf_workstation_model->common_public->suspend(act->
+                                                       simdata->surf_action);
       }
     } else {
       simdata->suspended = 1;
@@ -344,7 +344,8 @@ void SIMIX_process_suspend(smx_process_t process)
 
     cond = SIMIX_cond_init();
     dummy = SIMIX_action_execute(SIMIX_process_get_host(process), name, 0);
-    surf_workstation_model->common_public->suspend(dummy->simdata->surf_action);
+    surf_workstation_model->common_public->suspend(dummy->simdata->
+                                                   surf_action);
     SIMIX_register_action_to_condition(dummy, cond);
     __SIMIX_cond_wait(cond);
     SIMIX_unregister_action_to_condition(dummy, cond);
@@ -365,7 +366,7 @@ void SIMIX_process_resume(smx_process_t process)
   smx_simdata_process_t simdata = NULL;
 
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
   SIMIX_CHECK_HOST();
 
   if (process == SIMIX_process_self()) {
@@ -375,18 +376,19 @@ void SIMIX_process_resume(smx_process_t process)
   simdata = process->simdata;
   if (simdata->mutex) {
     DEBUG0("Resume process blocked on a mutex");
-    simdata->suspended = 0;    /* He'll wake up by itself */
+    simdata->suspended = 0;     /* He'll wake up by itself */
     return;
   } else if (simdata->cond) {
     /* temporaries variables */
     smx_cond_t c;
     xbt_fifo_item_t i;
     smx_action_t act;
-       DEBUG0("Resume process blocked on a conditional");
+    DEBUG0("Resume process blocked on a conditional");
     simdata->suspended = 0;
     c = simdata->cond;
     xbt_fifo_foreach(c->actions, i, act, smx_action_t) {
-      surf_workstation_model->common_public->resume(act->simdata->surf_action);
+      surf_workstation_model->common_public->resume(act->simdata->
+                                                    surf_action);
     }
     SIMIX_cond_signal(c);
     return;
@@ -402,12 +404,13 @@ void SIMIX_process_resume(smx_process_t process)
  *
  * This function changes the value of the host on which \a process is running.
  */
-void SIMIX_process_change_host(smx_process_t process, char *source, char *dest)
+void SIMIX_process_change_host(smx_process_t process, char *source,
+                               char *dest)
 {
   smx_simdata_process_t p_simdata = process->simdata;
   smx_host_t h1 = SIMIX_host_get_by_name(source);
   smx_host_t h2 = SIMIX_host_get_by_name(dest);
-  p_simdata->smx_host =  h2;
+  p_simdata->smx_host = h2;
   xbt_swag_remove(process, h1->simdata->process_list);
   xbt_swag_insert(process, h2->simdata->process_list);
 }
@@ -422,9 +425,7 @@ void SIMIX_process_change_host(smx_process_t process, char *source, char *dest)
 int SIMIX_process_is_suspended(smx_process_t process)
 {
   xbt_assert0(((process != NULL)
-              && (process->simdata)), "Invalid parameters");
+               && (process->simdata)), "Invalid parameters");
 
   return (process->simdata->suspended);
 }
-
-
index 42d057b..92ac1a0 100644 (file)
@@ -11,7 +11,7 @@
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_synchro, simix,
-                               "Logging specific to SIMIX (synchronization)");
+                                "Logging specific to SIMIX (synchronization)");
 
 
 /****************************** Synchronization *******************************/
@@ -27,9 +27,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_synchro, simix,
 smx_mutex_t SIMIX_mutex_init()
 {
   smx_mutex_t m = xbt_new0(s_smx_mutex_t, 1);
-  s_smx_process_t p;           /* useful to initialize sleeping swag */
+  s_smx_process_t p;            /* useful to initialize sleeping swag */
   /* structures initialization */
-  m->refcount  = 0;
+  m->refcount = 0;
   m->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup));
   return m;
 }
@@ -46,7 +46,7 @@ void SIMIX_mutex_lock(smx_mutex_t mutex)
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
 
-  if (mutex->refcount ) {
+  if (mutex->refcount) {
     /* somebody using the mutex, block */
     xbt_swag_insert(self, mutex->sleeping);
     self->simdata->mutex = mutex;
@@ -59,10 +59,10 @@ void SIMIX_mutex_lock(smx_mutex_t mutex)
       xbt_context_yield();
     }
 
-    mutex->refcount  = 1;
+    mutex->refcount = 1;
   } else {
     /* mutex free */
-    mutex->refcount  = 1;
+    mutex->refcount = 1;
   }
   return;
 }
@@ -78,10 +78,10 @@ int SIMIX_mutex_trylock(smx_mutex_t mutex)
 {
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
-  if (mutex->refcount )
+  if (mutex->refcount)
     return 0;
   else {
-    mutex->refcount  = 1;
+    mutex->refcount = 1;
     return 1;
   }
 }
@@ -94,17 +94,17 @@ int SIMIX_mutex_trylock(smx_mutex_t mutex)
  */
 void SIMIX_mutex_unlock(smx_mutex_t mutex)
 {
-  smx_process_t p;             /*process to wake up */
+  smx_process_t p;              /*process to wake up */
 
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
   if (xbt_swag_size(mutex->sleeping) > 0) {
     p = xbt_swag_extract(mutex->sleeping);
-    mutex->refcount  = 0;
+    mutex->refcount = 0;
     xbt_swag_insert(p, simix_global->process_to_run);
   } else {
     /* nobody to wake up */
-    mutex->refcount  = 0;
+    mutex->refcount = 0;
   }
   return;
 }
@@ -153,10 +153,10 @@ smx_cond_t SIMIX_cond_init()
  */
 void SIMIX_cond_signal(smx_cond_t cond)
 {
-       smx_process_t proc = NULL;
+  smx_process_t proc = NULL;
   DEBUG1("Signal condition %p", cond);
   xbt_assert0((cond != NULL), "Invalid parameters");
+
 
   if (xbt_swag_size(cond->sleeping) >= 1) {
     proc = xbt_swag_extract(cond->sleeping);
@@ -184,11 +184,11 @@ void SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
   SIMIX_mutex_unlock(mutex);
   /* always create an action null in case there is a host failure */
 /*   if (xbt_fifo_size(cond->actions) == 0) { */
-    act_sleep = SIMIX_action_sleep(SIMIX_host_self(), -1);
-    SIMIX_register_action_to_condition(act_sleep, cond);
-    __SIMIX_cond_wait(cond);
-    SIMIX_unregister_action_to_condition(act_sleep, cond);
-    SIMIX_action_destroy(act_sleep);
+  act_sleep = SIMIX_action_sleep(SIMIX_host_self(), -1);
+  SIMIX_register_action_to_condition(act_sleep, cond);
+  __SIMIX_cond_wait(cond);
+  SIMIX_unregister_action_to_condition(act_sleep, cond);
+  SIMIX_action_destroy(act_sleep);
 /*   } else { */
 /*     __SIMIX_cond_wait(cond); */
 /*   } */
@@ -231,9 +231,9 @@ void __SIMIX_cond_wait(smx_cond_t cond)
  * \param max_duration Timeout time
  */
 void SIMIX_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex,
-                            double max_duration)
+                             double max_duration)
 {
-  
+
   smx_action_t act_sleep;
   xbt_assert0((mutex != NULL), "Invalid parameters");
 
@@ -273,7 +273,7 @@ void SIMIX_cond_broadcast(smx_cond_t cond)
   smx_process_t proc = NULL;
   smx_process_t proc_next = NULL;
 
-   xbt_assert0((cond != NULL), "Invalid parameters");
+  xbt_assert0((cond != NULL), "Invalid parameters");
 
   DEBUG1("Broadcast condition %p", cond);
   xbt_swag_foreach_safe(proc, proc_next, cond->sleeping) {
@@ -300,7 +300,7 @@ void SIMIX_cond_destroy(smx_cond_t cond)
     smx_action_t action = NULL;
 
     xbt_assert0(xbt_swag_size(cond->sleeping) == 0,
-               "Cannot destroy conditional since someone is still using it");
+                "Cannot destroy conditional since someone is still using it");
     xbt_swag_free(cond->sleeping);
 
     DEBUG1("%d actions registered", xbt_fifo_size(cond->actions));
@@ -324,8 +324,9 @@ void SIMIX_cond_display_info(smx_cond_t cond)
     smx_process_t process = NULL;
 
     INFO0("Blocked process on this condition:");
-    xbt_swag_foreach(process,cond->sleeping) {
-      INFO2("\t %s running on host %s",process->name,process->simdata->smx_host->name);
+    xbt_swag_foreach(process, cond->sleeping) {
+      INFO2("\t %s running on host %s", process->name,
+            process->simdata->smx_host->name);
     }
   }
 }
index 69d63f5..1b214f3 100644 (file)
 
 // smpi mpi communicator
 typedef struct smpi_mpi_communicator_t {
-       int            size;
-       int            barrier_count;
-       smx_mutex_t    barrier_mutex;
-       smx_cond_t     barrier_cond;
+  int size;
+  int barrier_count;
+  smx_mutex_t barrier_mutex;
+  smx_cond_t barrier_cond;
 
-       int           *rank_to_index_map;
-       int           *index_to_rank_map;
+  int *rank_to_index_map;
+  int *index_to_rank_map;
 
 } s_smpi_mpi_communicator_t;
 
@@ -31,101 +31,101 @@ typedef struct smpi_mpi_datatype_t {
 
 // smpi mpi request
 typedef struct smpi_mpi_request_t {
-       smpi_mpi_communicator_t comm;
-       int src;
-       int dst;
-       int tag;
+  smpi_mpi_communicator_t comm;
+  int src;
+  int dst;
+  int tag;
 
-       void *buf;
-       int count;
-       smpi_mpi_datatype_t datatype;
+  void *buf;
+  int count;
+  smpi_mpi_datatype_t datatype;
 
-       short int completed :1;
+  short int completed:1;
 
-       smx_mutex_t mutex;
-       smx_cond_t  cond;
+  smx_mutex_t mutex;
+  smx_cond_t cond;
 
-       void *data;
-       int forward;
+  void *data;
+  int forward;
 
 } s_smpi_mpi_request_t;
 
 // smpi mpi op
 typedef struct smpi_mpi_op_t {
-  void (*func)(void *a, void *b, int *length, MPI_Datatype *datatype);
+  void (*func) (void *a, void *b, int *length, MPI_Datatype * datatype);
 } s_smpi_mpi_op_t;
 
 // smpi received message
 typedef struct smpi_received_message_t {
-       smpi_mpi_communicator_t comm;
-       int src;
-       int tag;
+  smpi_mpi_communicator_t comm;
+  int src;
+  int tag;
 
-       void *buf;
+  void *buf;
 
-       void *data;
-       int forward;
+  void *data;
+  int forward;
 
 } s_smpi_received_message_t;
 typedef struct smpi_received_message_t *smpi_received_message_t;
 
 typedef struct smpi_do_once_duration_node_t {
-       char *file;
-       int line;
-       double duration;
-       struct smpi_do_once_duration_node_t *next;
+  char *file;
+  int line;
+  double duration;
+  struct smpi_do_once_duration_node_t *next;
 } s_smpi_do_once_duration_node_t;
 typedef struct smpi_do_once_duration_node_t *smpi_do_once_duration_node_t;
 
 typedef struct smpi_global_t {
 
-       // config vars
-       double            reference_speed;
+  // config vars
+  double reference_speed;
 
-       // state vars
-       int               root_ready:1;
-       int               ready_process_count;
-       smx_mutex_t       start_stop_mutex;
-       smx_cond_t        start_stop_cond;
+  // state vars
+  int root_ready:1;
+  int ready_process_count;
+  smx_mutex_t start_stop_mutex;
+  smx_cond_t start_stop_cond;
 
-       smx_host_t       *hosts;
-       int               host_count;
-       xbt_mallocator_t  request_mallocator;
-       xbt_mallocator_t  message_mallocator;
+  smx_host_t *hosts;
+  int host_count;
+  xbt_mallocator_t request_mallocator;
+  xbt_mallocator_t message_mallocator;
 
-       // FIXME: request queues should be moved to host data...
-       xbt_fifo_t       *pending_send_request_queues;
-       smx_mutex_t      *pending_send_request_queues_mutexes;
+  // FIXME: request queues should be moved to host data...
+  xbt_fifo_t *pending_send_request_queues;
+  smx_mutex_t *pending_send_request_queues_mutexes;
 
-       xbt_fifo_t       *pending_recv_request_queues;
-       smx_mutex_t      *pending_recv_request_queues_mutexes;
+  xbt_fifo_t *pending_recv_request_queues;
+  smx_mutex_t *pending_recv_request_queues_mutexes;
 
-       xbt_fifo_t       *received_message_queues;
-       smx_mutex_t      *received_message_queues_mutexes;
+  xbt_fifo_t *received_message_queues;
+  smx_mutex_t *received_message_queues_mutexes;
 
-       smx_process_t    *sender_processes;
-       smx_process_t    *receiver_processes;
+  smx_process_t *sender_processes;
+  smx_process_t *receiver_processes;
 
-       int               running_hosts_count;
-       smx_mutex_t       running_hosts_count_mutex;
+  int running_hosts_count;
+  smx_mutex_t running_hosts_count_mutex;
 
-       xbt_os_timer_t    timer;
-       smx_mutex_t       timer_mutex;
-       smx_cond_t        timer_cond;
+  xbt_os_timer_t timer;
+  smx_mutex_t timer_mutex;
+  smx_cond_t timer_cond;
 
-       // keeps track of previous times
-       smpi_do_once_duration_node_t do_once_duration_nodes;
-       smx_mutex_t do_once_mutex;
-       double *do_once_duration;
+  // keeps track of previous times
+  smpi_do_once_duration_node_t do_once_duration_nodes;
+  smx_mutex_t do_once_mutex;
+  double *do_once_duration;
 
 } s_smpi_global_t;
 typedef struct smpi_global_t *smpi_global_t;
 extern smpi_global_t smpi_global;
 
 typedef struct smpi_host_data_t {
-       int index;
-       smx_mutex_t mutex;
-       smx_cond_t cond;
+  int index;
+  smx_mutex_t mutex;
+  smx_cond_t cond;
 } s_smpi_host_data_t;
 typedef struct smpi_host_data_t *smpi_host_data_t;
 
@@ -137,7 +137,7 @@ int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm);
 int smpi_mpi_barrier(smpi_mpi_communicator_t comm);
 int smpi_mpi_isend(smpi_mpi_request_t request);
 int smpi_mpi_irecv(smpi_mpi_request_t request);
-int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t *status);
+int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t * status);
 
 void smpi_execute(double duration);
 void smpi_start_timer(void);
@@ -153,7 +153,9 @@ smx_mutex_t smpi_host_mutex(void);
 smx_cond_t smpi_host_cond(void);
 int smpi_run_simulation(int *argc, char **argv);
 int smpi_create_request(void *buf, int count, smpi_mpi_datatype_t datatype,
-       int src, int dst, int tag, smpi_mpi_communicator_t comm, smpi_mpi_request_t *request);
+                        int src, int dst, int tag,
+                        smpi_mpi_communicator_t comm,
+                        smpi_mpi_request_t * request);
 
 int smpi_sender(int argc, char **argv);
 
index 6ebefe4..98992b9 100644 (file)
@@ -1,6 +1,7 @@
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi, "Logging specific to SMPI (base)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi,
+                                "Logging specific to SMPI (base)");
 XBT_LOG_EXTERNAL_CATEGORY(smpi_base);
 XBT_LOG_EXTERNAL_CATEGORY(smpi_bench);
 XBT_LOG_EXTERNAL_CATEGORY(smpi_kernel);
@@ -11,250 +12,259 @@ XBT_LOG_EXTERNAL_CATEGORY(smpi_util);
 
 smpi_mpi_global_t smpi_mpi_global = NULL;
 
-void smpi_mpi_land_func(void *a, void *b, int *length, MPI_Datatype *datatype);
+void smpi_mpi_land_func(void *a, void *b, int *length,
+                        MPI_Datatype * datatype);
 
-void smpi_mpi_land_func(void *a, void *b, int *length, MPI_Datatype *datatype)
+void smpi_mpi_land_func(void *a, void *b, int *length,
+                        MPI_Datatype * datatype)
 {
-       int i;
-       if (*datatype == smpi_mpi_global->mpi_int) {
-               int *x = a, *y = b;
-               for (i = 0; i < *length; i++) {
-                       y[i] = x[i] && y[i];
-               }
-       }
+  int i;
+  if (*datatype == smpi_mpi_global->mpi_int) {
+    int *x = a, *y = b;
+    for (i = 0; i < *length; i++) {
+      y[i] = x[i] && y[i];
+    }
+  }
 }
 
-void smpi_mpi_sum_func(void *a, void *b, int *length, MPI_Datatype *datatype);
+void smpi_mpi_sum_func(void *a, void *b, int *length,
+                       MPI_Datatype * datatype);
 
-void smpi_mpi_sum_func(void *a, void *b, int *length, MPI_Datatype *datatype)
+void smpi_mpi_sum_func(void *a, void *b, int *length, MPI_Datatype * datatype)
 {
-       int i;
-       if (*datatype == smpi_mpi_global->mpi_int) {
-               int *x = a, *y = b;
-               for (i = 0; i < *length; i++) {
-                       y[i] = x[i] + y[i];
-               }
-       }
+  int i;
+  if (*datatype == smpi_mpi_global->mpi_int) {
+    int *x = a, *y = b;
+    for (i = 0; i < *length; i++) {
+      y[i] = x[i] + y[i];
+    }
+  }
 }
 
 int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm)
 {
-       return comm->index_to_rank_map[smpi_host_index()];
+  return comm->index_to_rank_map[smpi_host_index()];
 }
 
 void smpi_mpi_init()
 {
-       smx_host_t host;
-       smx_host_t *hosts;
-       int host_count;
-       int i;
-       smpi_host_data_t hdata;
-
-       SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
-       smpi_global->running_hosts_count++;
-       SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
-
-       // initialize some local variables
-       host       = SIMIX_host_self();
-       hosts      = SIMIX_host_get_table();
-       host_count = SIMIX_host_get_number();
-
-       hdata      = xbt_new(s_smpi_host_data_t, 1);
-
-       for (i = 0; i < host_count && host != hosts[i]; i ++);
-
-       hdata->index = i;
-       hdata->mutex = SIMIX_mutex_init();
-       hdata->cond  = SIMIX_cond_init();
-
-       SIMIX_host_set_data(host, hdata);
-
-       // node 0 sets the globals
-       if (0 == i) {
-
-               smpi_global->hosts                              = hosts;
-               smpi_global->host_count                         = host_count;
-
-               smpi_mpi_global                                 = xbt_new(s_smpi_mpi_global_t, 1);
-
-               // global communicator
-               smpi_mpi_global->mpi_comm_world                 = xbt_new(s_smpi_mpi_communicator_t, 1);
-               smpi_mpi_global->mpi_comm_world->size           = host_count;
-               smpi_mpi_global->mpi_comm_world->barrier_count  = 0;
-               smpi_mpi_global->mpi_comm_world->barrier_mutex  = SIMIX_mutex_init();
-               smpi_mpi_global->mpi_comm_world->barrier_cond   = SIMIX_cond_init();
-               smpi_mpi_global->mpi_comm_world->rank_to_index_map = xbt_new(int, host_count);
-               smpi_mpi_global->mpi_comm_world->index_to_rank_map = xbt_new(int, host_count);
-               for (i = 0; i < host_count; i++) {
-                       smpi_mpi_global->mpi_comm_world->rank_to_index_map[i] = i;
-                       smpi_mpi_global->mpi_comm_world->index_to_rank_map[i] = i;
-               }
-
-               // mpi datatypes
-               smpi_mpi_global->mpi_byte                       = xbt_new(s_smpi_mpi_datatype_t, 1);
-               smpi_mpi_global->mpi_byte->size                 = (size_t)1;
-               smpi_mpi_global->mpi_int                        = xbt_new(s_smpi_mpi_datatype_t, 1);
-               smpi_mpi_global->mpi_int->size                  = sizeof(int);
-               smpi_mpi_global->mpi_double                     = xbt_new(s_smpi_mpi_datatype_t, 1);
-               smpi_mpi_global->mpi_double->size               = sizeof(double);
-
-               // mpi operations
-               smpi_mpi_global->mpi_land                       = xbt_new(s_smpi_mpi_op_t, 1);
-               smpi_mpi_global->mpi_land->func                 = smpi_mpi_land_func;
-               smpi_mpi_global->mpi_sum                        = xbt_new(s_smpi_mpi_op_t, 1);
-               smpi_mpi_global->mpi_sum->func                  = smpi_mpi_sum_func;
-
-               // signal all nodes to perform initialization
-               SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-               smpi_global->root_ready = 1;
-               SIMIX_cond_broadcast(smpi_global->start_stop_cond);
-               SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
-       } else {
-
-               // make sure root is done before own initialization
-               SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-               while (!smpi_global->root_ready) {
-                       SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
-               }
-               SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
-       }
-
-       // wait for all nodes to signal initializatin complete
-       SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-       smpi_global->ready_process_count++;
-       if (smpi_global->ready_process_count >= 3 * host_count) {
-               SIMIX_cond_broadcast(smpi_global->start_stop_cond);
-       }
-       while (smpi_global->ready_process_count < 3 * host_count) {
-               SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
-       }
-       SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
-       return;
+  smx_host_t host;
+  smx_host_t *hosts;
+  int host_count;
+  int i;
+  smpi_host_data_t hdata;
+
+  SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
+  smpi_global->running_hosts_count++;
+  SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
+
+  // initialize some local variables
+  host = SIMIX_host_self();
+  hosts = SIMIX_host_get_table();
+  host_count = SIMIX_host_get_number();
+
+  hdata = xbt_new(s_smpi_host_data_t, 1);
+
+  for (i = 0; i < host_count && host != hosts[i]; i++);
+
+  hdata->index = i;
+  hdata->mutex = SIMIX_mutex_init();
+  hdata->cond = SIMIX_cond_init();
+
+  SIMIX_host_set_data(host, hdata);
+
+  // node 0 sets the globals
+  if (0 == i) {
+
+    smpi_global->hosts = hosts;
+    smpi_global->host_count = host_count;
+
+    smpi_mpi_global = xbt_new(s_smpi_mpi_global_t, 1);
+
+    // global communicator
+    smpi_mpi_global->mpi_comm_world = xbt_new(s_smpi_mpi_communicator_t, 1);
+    smpi_mpi_global->mpi_comm_world->size = host_count;
+    smpi_mpi_global->mpi_comm_world->barrier_count = 0;
+    smpi_mpi_global->mpi_comm_world->barrier_mutex = SIMIX_mutex_init();
+    smpi_mpi_global->mpi_comm_world->barrier_cond = SIMIX_cond_init();
+    smpi_mpi_global->mpi_comm_world->rank_to_index_map =
+      xbt_new(int, host_count);
+    smpi_mpi_global->mpi_comm_world->index_to_rank_map =
+      xbt_new(int, host_count);
+    for (i = 0; i < host_count; i++) {
+      smpi_mpi_global->mpi_comm_world->rank_to_index_map[i] = i;
+      smpi_mpi_global->mpi_comm_world->index_to_rank_map[i] = i;
+    }
+
+    // mpi datatypes
+    smpi_mpi_global->mpi_byte = xbt_new(s_smpi_mpi_datatype_t, 1);
+    smpi_mpi_global->mpi_byte->size = (size_t) 1;
+    smpi_mpi_global->mpi_int = xbt_new(s_smpi_mpi_datatype_t, 1);
+    smpi_mpi_global->mpi_int->size = sizeof(int);
+    smpi_mpi_global->mpi_double = xbt_new(s_smpi_mpi_datatype_t, 1);
+    smpi_mpi_global->mpi_double->size = sizeof(double);
+
+    // mpi operations
+    smpi_mpi_global->mpi_land = xbt_new(s_smpi_mpi_op_t, 1);
+    smpi_mpi_global->mpi_land->func = smpi_mpi_land_func;
+    smpi_mpi_global->mpi_sum = xbt_new(s_smpi_mpi_op_t, 1);
+    smpi_mpi_global->mpi_sum->func = smpi_mpi_sum_func;
+
+    // signal all nodes to perform initialization
+    SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+    smpi_global->root_ready = 1;
+    SIMIX_cond_broadcast(smpi_global->start_stop_cond);
+    SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+
+  } else {
+
+    // make sure root is done before own initialization
+    SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+    while (!smpi_global->root_ready) {
+      SIMIX_cond_wait(smpi_global->start_stop_cond,
+                      smpi_global->start_stop_mutex);
+    }
+    SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+
+  }
+
+  // wait for all nodes to signal initializatin complete
+  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+  smpi_global->ready_process_count++;
+  if (smpi_global->ready_process_count >= 3 * host_count) {
+    SIMIX_cond_broadcast(smpi_global->start_stop_cond);
+  }
+  while (smpi_global->ready_process_count < 3 * host_count) {
+    SIMIX_cond_wait(smpi_global->start_stop_cond,
+                    smpi_global->start_stop_mutex);
+  }
+  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+
+  return;
 }
 
 void smpi_mpi_finalize()
 {
-       int i;
+  int i;
 
-       SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
-       i = --smpi_global->running_hosts_count;
-       SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
+  SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
+  i = --smpi_global->running_hosts_count;
+  SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
 
-       SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-       smpi_global->ready_process_count--;
-       SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+  smpi_global->ready_process_count--;
+  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
 
-       SIMIX_mutex_destroy(smpi_host_mutex());
-       SIMIX_cond_destroy(smpi_host_cond());
+  SIMIX_mutex_destroy(smpi_host_mutex());
+  SIMIX_cond_destroy(smpi_host_cond());
 
-       if (0 >= i) {
+  if (0 >= i) {
 
-               // wake up senders/receivers
-               for (i = 0; i < smpi_global->host_count; i++) {
-                       if (SIMIX_process_is_suspended(smpi_global->sender_processes[i])) {
-                               SIMIX_process_resume(smpi_global->sender_processes[i]);
-                       }
-                       if (SIMIX_process_is_suspended(smpi_global->receiver_processes[i])) {
-                               SIMIX_process_resume(smpi_global->receiver_processes[i]);
-                       }
-               }
+    // wake up senders/receivers
+    for (i = 0; i < smpi_global->host_count; i++) {
+      if (SIMIX_process_is_suspended(smpi_global->sender_processes[i])) {
+        SIMIX_process_resume(smpi_global->sender_processes[i]);
+      }
+      if (SIMIX_process_is_suspended(smpi_global->receiver_processes[i])) {
+        SIMIX_process_resume(smpi_global->receiver_processes[i]);
+      }
+    }
 
-               SIMIX_mutex_destroy(smpi_mpi_global->mpi_comm_world->barrier_mutex);
-               SIMIX_cond_destroy(smpi_mpi_global->mpi_comm_world->barrier_cond);
-               xbt_free(smpi_mpi_global->mpi_comm_world);
+    SIMIX_mutex_destroy(smpi_mpi_global->mpi_comm_world->barrier_mutex);
+    SIMIX_cond_destroy(smpi_mpi_global->mpi_comm_world->barrier_cond);
+    xbt_free(smpi_mpi_global->mpi_comm_world);
 
-               xbt_free(smpi_mpi_global->mpi_byte);
-               xbt_free(smpi_mpi_global->mpi_int);
-               xbt_free(smpi_mpi_global->mpi_double);
+    xbt_free(smpi_mpi_global->mpi_byte);
+    xbt_free(smpi_mpi_global->mpi_int);
+    xbt_free(smpi_mpi_global->mpi_double);
 
-               xbt_free(smpi_mpi_global->mpi_land);
-               xbt_free(smpi_mpi_global->mpi_sum);
+    xbt_free(smpi_mpi_global->mpi_land);
+    xbt_free(smpi_mpi_global->mpi_sum);
 
-               xbt_free(smpi_mpi_global);
+    xbt_free(smpi_mpi_global);
 
-       }
+  }
 
 }
 
 int smpi_mpi_barrier(smpi_mpi_communicator_t comm)
 {
 
-       SIMIX_mutex_lock(comm->barrier_mutex);
-       ++comm->barrier_count;
-       if (comm->barrier_count > comm->size) { // only happens on second barrier...
-               comm->barrier_count = 0;
-       } else if (comm->barrier_count == comm->size) {
-               SIMIX_cond_broadcast(comm->barrier_cond);
-       }
-       while (comm->barrier_count < comm->size) {
-               SIMIX_cond_wait(comm->barrier_cond, comm->barrier_mutex);
-       }
-       SIMIX_mutex_unlock(comm->barrier_mutex);
-
-       return MPI_SUCCESS;
+  SIMIX_mutex_lock(comm->barrier_mutex);
+  ++comm->barrier_count;
+  if (comm->barrier_count > comm->size) {       // only happens on second barrier...
+    comm->barrier_count = 0;
+  } else if (comm->barrier_count == comm->size) {
+    SIMIX_cond_broadcast(comm->barrier_cond);
+  }
+  while (comm->barrier_count < comm->size) {
+    SIMIX_cond_wait(comm->barrier_cond, comm->barrier_mutex);
+  }
+  SIMIX_mutex_unlock(comm->barrier_mutex);
+
+  return MPI_SUCCESS;
 }
 
 int smpi_mpi_isend(smpi_mpi_request_t request)
 {
-       int retval = MPI_SUCCESS;
-       int index  = smpi_host_index();
-
-       if (NULL == request) {
-               retval = MPI_ERR_INTERN;
-       } else {
-               SIMIX_mutex_lock(smpi_global->pending_send_request_queues_mutexes[index]);
-               xbt_fifo_push(smpi_global->pending_send_request_queues[index], request);
-               SIMIX_mutex_unlock(smpi_global->pending_send_request_queues_mutexes[index]);
-
-               if (SIMIX_process_is_suspended(smpi_global->sender_processes[index])) {
-                       SIMIX_process_resume(smpi_global->sender_processes[index]);
-               }
-       }
-
-       return retval;
+  int retval = MPI_SUCCESS;
+  int index = smpi_host_index();
+
+  if (NULL == request) {
+    retval = MPI_ERR_INTERN;
+  } else {
+    SIMIX_mutex_lock(smpi_global->pending_send_request_queues_mutexes[index]);
+    xbt_fifo_push(smpi_global->pending_send_request_queues[index], request);
+    SIMIX_mutex_unlock(smpi_global->pending_send_request_queues_mutexes
+                       [index]);
+
+    if (SIMIX_process_is_suspended(smpi_global->sender_processes[index])) {
+      SIMIX_process_resume(smpi_global->sender_processes[index]);
+    }
+  }
+
+  return retval;
 }
 
 int smpi_mpi_irecv(smpi_mpi_request_t request)
 {
-       int retval = MPI_SUCCESS;
-       int index = smpi_host_index();
-
-       if (NULL == request) {
-               retval = MPI_ERR_INTERN;
-       } else {
-               SIMIX_mutex_lock(smpi_global->pending_recv_request_queues_mutexes[index]);
-               xbt_fifo_push(smpi_global->pending_recv_request_queues[index], request);
-               SIMIX_mutex_unlock(smpi_global->pending_recv_request_queues_mutexes[index]);
-
-               if (SIMIX_process_is_suspended(smpi_global->receiver_processes[index])) {
-                       SIMIX_process_resume(smpi_global->receiver_processes[index]);
-               }
-       }
-
-       return retval;
+  int retval = MPI_SUCCESS;
+  int index = smpi_host_index();
+
+  if (NULL == request) {
+    retval = MPI_ERR_INTERN;
+  } else {
+    SIMIX_mutex_lock(smpi_global->pending_recv_request_queues_mutexes[index]);
+    xbt_fifo_push(smpi_global->pending_recv_request_queues[index], request);
+    SIMIX_mutex_unlock(smpi_global->pending_recv_request_queues_mutexes
+                       [index]);
+
+    if (SIMIX_process_is_suspended(smpi_global->receiver_processes[index])) {
+      SIMIX_process_resume(smpi_global->receiver_processes[index]);
+    }
+  }
+
+  return retval;
 }
 
-int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t *status)
+int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t * status)
 {
-       int retval = MPI_SUCCESS;
-
-       if (NULL == request) {
-               retval = MPI_ERR_INTERN;
-       } else {
-               SIMIX_mutex_lock(request->mutex);
-               while (!request->completed) {
-                       SIMIX_cond_wait(request->cond, request->mutex);
-               }
-               if (NULL != status) {
-                       status->MPI_SOURCE = request->src;
-                       status->MPI_TAG    = request->tag;
-                       status->MPI_ERROR  = MPI_SUCCESS;
-               }
-               SIMIX_mutex_unlock(request->mutex);
-       }
-
-       return retval;
+  int retval = MPI_SUCCESS;
+
+  if (NULL == request) {
+    retval = MPI_ERR_INTERN;
+  } else {
+    SIMIX_mutex_lock(request->mutex);
+    while (!request->completed) {
+      SIMIX_cond_wait(request->cond, request->mutex);
+    }
+    if (NULL != status) {
+      status->MPI_SOURCE = request->src;
+      status->MPI_TAG = request->tag;
+      status->MPI_ERROR = MPI_SUCCESS;
+    }
+    SIMIX_mutex_unlock(request->mutex);
+  }
+
+  return retval;
 }
index 7fab85e..ec81226 100644 (file)
 #include "private.h"
 #include <string.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi, "Logging specific to SMPI (benchmarking)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi,
+                                "Logging specific to SMPI (benchmarking)");
 
-void smpi_execute(double duration) {
-        smx_host_t host = SIMIX_host_self();
-       smx_mutex_t mutex = smpi_host_mutex();
-       smx_cond_t cond = smpi_host_cond();
-        smx_action_t action;
-       e_surf_action_state_t state;
+void smpi_execute(double duration)
+{
+  smx_host_t host = SIMIX_host_self();
+  smx_mutex_t mutex = smpi_host_mutex();
+  smx_cond_t cond = smpi_host_cond();
+  smx_action_t action;
+  e_surf_action_state_t state;
 
-       SIMIX_mutex_lock(mutex);
+  SIMIX_mutex_lock(mutex);
 
-       action = SIMIX_action_execute(host, "execute", duration * SMPI_DEFAULT_SPEED);
+  action =
+    SIMIX_action_execute(host, "execute", duration * SMPI_DEFAULT_SPEED);
 
-        SIMIX_register_action_to_condition(action, cond);
-       for (
-               state =  SIMIX_action_get_state(action);
-               state == SURF_ACTION_READY ||
-               state == SURF_ACTION_RUNNING;
-               state =  SIMIX_action_get_state(action)
-       ) {
-               SIMIX_cond_wait(cond, mutex);
-       }
-        SIMIX_unregister_action_to_condition(action, cond);
-        SIMIX_action_destroy(action);
+  SIMIX_register_action_to_condition(action, cond);
+  for (state = SIMIX_action_get_state(action);
+       state == SURF_ACTION_READY ||
+       state == SURF_ACTION_RUNNING; state = SIMIX_action_get_state(action)
+    ) {
+    SIMIX_cond_wait(cond, mutex);
+  }
+  SIMIX_unregister_action_to_condition(action, cond);
+  SIMIX_action_destroy(action);
 
-        SIMIX_mutex_unlock(mutex);
+  SIMIX_mutex_unlock(mutex);
 
-       return;
+  return;
 }
 
 void smpi_start_timer()
 {
-       SIMIX_mutex_lock(smpi_global->timer_mutex);
-       xbt_os_timer_start(smpi_global->timer);
+  SIMIX_mutex_lock(smpi_global->timer_mutex);
+  xbt_os_timer_start(smpi_global->timer);
 }
 
 double smpi_stop_timer()
 {
-       double duration;
-       xbt_os_timer_stop(smpi_global->timer);
-       duration = xbt_os_timer_elapsed(smpi_global->timer);
-       SIMIX_mutex_unlock(smpi_global->timer_mutex);
-       return duration;
+  double duration;
+  xbt_os_timer_stop(smpi_global->timer);
+  duration = xbt_os_timer_elapsed(smpi_global->timer);
+  SIMIX_mutex_unlock(smpi_global->timer_mutex);
+  return duration;
 }
 
 void smpi_bench_begin()
 {
-       smpi_start_timer();
+  smpi_start_timer();
 }
 
 void smpi_bench_end()
 {
-       smpi_execute(smpi_stop_timer());
+  smpi_execute(smpi_stop_timer());
 }
 
-void smpi_do_once_1(const char *file, int line) {
-       smpi_do_once_duration_node_t curr, prev;
-       smpi_bench_end();
-       SIMIX_mutex_lock(smpi_global->do_once_mutex);
-       prev = NULL;
-       for(curr = smpi_global->do_once_duration_nodes;
-               NULL != curr && (strcmp(curr->file, file) || curr->line != line);
-               curr = curr->next) {
-               prev = curr;
-       }
-       if (NULL == curr) {
-               curr = xbt_new(s_smpi_do_once_duration_node_t, 1);
-               curr->file     = xbt_strdup(file);
-               curr->line     = line;
-               curr->duration = -1;
-               curr->next     = NULL;
-               if (NULL == prev) {
-                       smpi_global->do_once_duration_nodes = curr;
-               } else {
-                       prev->next = curr;
-               }
-       }
-       smpi_global->do_once_duration = &curr->duration;
+void smpi_do_once_1(const char *file, int line)
+{
+  smpi_do_once_duration_node_t curr, prev;
+  smpi_bench_end();
+  SIMIX_mutex_lock(smpi_global->do_once_mutex);
+  prev = NULL;
+  for (curr = smpi_global->do_once_duration_nodes;
+       NULL != curr && (strcmp(curr->file, file) || curr->line != line);
+       curr = curr->next) {
+    prev = curr;
+  }
+  if (NULL == curr) {
+    curr = xbt_new(s_smpi_do_once_duration_node_t, 1);
+    curr->file = xbt_strdup(file);
+    curr->line = line;
+    curr->duration = -1;
+    curr->next = NULL;
+    if (NULL == prev) {
+      smpi_global->do_once_duration_nodes = curr;
+    } else {
+      prev->next = curr;
+    }
+  }
+  smpi_global->do_once_duration = &curr->duration;
 }
 
-int smpi_do_once_2() {
-       double duration = *(smpi_global->do_once_duration);
-       if (0 > duration) {
-               smpi_start_timer();
-               return 1;
-       }
-       SIMIX_mutex_unlock(smpi_global->do_once_mutex);
-       smpi_execute(duration);
-       smpi_bench_begin();
-       return 0;
+int smpi_do_once_2()
+{
+  double duration = *(smpi_global->do_once_duration);
+  if (0 > duration) {
+    smpi_start_timer();
+    return 1;
+  }
+  SIMIX_mutex_unlock(smpi_global->do_once_mutex);
+  smpi_execute(duration);
+  smpi_bench_begin();
+  return 0;
 }
 
-void smpi_do_once_3() {
-       *(smpi_global->do_once_duration) = smpi_stop_timer();
+void smpi_do_once_3()
+{
+  *(smpi_global->do_once_duration) = smpi_stop_timer();
 }
index 1221b7c..710353d 100644 (file)
@@ -4,24 +4,25 @@
 
 XBT_LOG_NEW_CATEGORY(smpi, "All SMPI categories");
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi,
+                                "Logging specific to SMPI (kernel)");
 
-smpi_global_t     smpi_global     = NULL;
+smpi_global_t smpi_global = NULL;
 
 void *smpi_request_new(void);
 
 void *smpi_request_new()
 {
-       smpi_mpi_request_t request = xbt_new(s_smpi_mpi_request_t, 1);
+  smpi_mpi_request_t request = xbt_new(s_smpi_mpi_request_t, 1);
 
-       request->buf       = NULL;
-       request->completed = 0;
-       request->mutex     = SIMIX_mutex_init();
-       request->cond      = SIMIX_cond_init();
-       request->data      = NULL;
-       request->forward   = 0;
+  request->buf = NULL;
+  request->completed = 0;
+  request->mutex = SIMIX_mutex_init();
+  request->cond = SIMIX_cond_init();
+  request->data = NULL;
+  request->forward = 0;
 
-       return request;
+  return request;
 }
 
 void smpi_request_free(void *pointer);
@@ -29,27 +30,27 @@ void smpi_request_free(void *pointer);
 void smpi_request_free(void *pointer)
 {
 
-       smpi_mpi_request_t request = pointer;
+  smpi_mpi_request_t request = pointer;
 
-       SIMIX_cond_destroy(request->cond);
-       SIMIX_mutex_destroy(request->mutex);
-       xbt_free(request);
+  SIMIX_cond_destroy(request->cond);
+  SIMIX_mutex_destroy(request->mutex);
+  xbt_free(request);
 
-       return;
+  return;
 }
 
 void smpi_request_reset(void *pointer);
 
 void smpi_request_reset(void *pointer)
 {
-       smpi_mpi_request_t request = pointer;
+  smpi_mpi_request_t request = pointer;
 
-       request->buf       = NULL;
-       request->completed = 0;
-       request->data      = NULL;
-       request->forward   = 0;
+  request->buf = NULL;
+  request->completed = 0;
+  request->data = NULL;
+  request->forward = 0;
 
-       return;
+  return;
 }
 
 
@@ -57,276 +58,282 @@ void *smpi_message_new(void);
 
 void *smpi_message_new()
 {
-       smpi_received_message_t message = xbt_new(s_smpi_received_message_t, 1);
-       message->buf = NULL;
-       return message;
+  smpi_received_message_t message = xbt_new(s_smpi_received_message_t, 1);
+  message->buf = NULL;
+  return message;
 }
 
 void smpi_message_free(void *pointer);
 
 void smpi_message_free(void *pointer)
 {
-       xbt_free(pointer);
-       return;
+  xbt_free(pointer);
+  return;
 }
 
 void smpi_message_reset(void *pointer);
 
 void smpi_message_reset(void *pointer)
 {
-       smpi_received_message_t message = pointer;
-       message->buf = NULL;
-       return;
+  smpi_received_message_t message = pointer;
+  message->buf = NULL;
+  return;
 }
 
 int smpi_create_request(void *buf, int count, smpi_mpi_datatype_t datatype,
-       int src, int dst, int tag, smpi_mpi_communicator_t comm, smpi_mpi_request_t *requestptr)
+                        int src, int dst, int tag,
+                        smpi_mpi_communicator_t comm,
+                        smpi_mpi_request_t * requestptr)
 {
-       int retval = MPI_SUCCESS;
-
-       smpi_mpi_request_t request = NULL;
-
-       // parameter checking prob belongs in smpi_mpi, but this is less repeat code
-       if (NULL == buf) {
-               retval = MPI_ERR_INTERN;
-       } else if (0 > count) {
-               retval = MPI_ERR_COUNT;
-       } else if (NULL == datatype) {
-               retval = MPI_ERR_TYPE;
-       } else if (MPI_ANY_SOURCE != src && (0 > src || comm->size <= src)) {
-               retval = MPI_ERR_RANK;
-       } else if (0 > dst || comm->size <= dst) {
-               retval = MPI_ERR_RANK;
-       } else if (MPI_ANY_TAG != tag && 0 > tag) {
-               retval = MPI_ERR_TAG;
-       } else if (NULL == comm) {
-               retval = MPI_ERR_COMM;
-       } else if (NULL == requestptr) {
-               retval = MPI_ERR_ARG;
-       } else {
-               request           = xbt_mallocator_get(smpi_global->request_mallocator);
-               request->comm     = comm;
-               request->src      = src;
-               request->dst      = dst;
-               request->tag      = tag;
-               request->buf      = buf;
-               request->datatype = datatype;
-               request->count    = count;
-
-               *requestptr       = request;
-       }
-       return retval;
+  int retval = MPI_SUCCESS;
+
+  smpi_mpi_request_t request = NULL;
+
+  // parameter checking prob belongs in smpi_mpi, but this is less repeat code
+  if (NULL == buf) {
+    retval = MPI_ERR_INTERN;
+  } else if (0 > count) {
+    retval = MPI_ERR_COUNT;
+  } else if (NULL == datatype) {
+    retval = MPI_ERR_TYPE;
+  } else if (MPI_ANY_SOURCE != src && (0 > src || comm->size <= src)) {
+    retval = MPI_ERR_RANK;
+  } else if (0 > dst || comm->size <= dst) {
+    retval = MPI_ERR_RANK;
+  } else if (MPI_ANY_TAG != tag && 0 > tag) {
+    retval = MPI_ERR_TAG;
+  } else if (NULL == comm) {
+    retval = MPI_ERR_COMM;
+  } else if (NULL == requestptr) {
+    retval = MPI_ERR_ARG;
+  } else {
+    request = xbt_mallocator_get(smpi_global->request_mallocator);
+    request->comm = comm;
+    request->src = src;
+    request->dst = dst;
+    request->tag = tag;
+    request->buf = buf;
+    request->datatype = datatype;
+    request->count = count;
+
+    *requestptr = request;
+  }
+  return retval;
 }
 
 void smpi_global_init()
 {
-       int i;
+  int i;
 
-       int size = SIMIX_host_get_number();
+  int size = SIMIX_host_get_number();
 
-       /* Connect our log channels: that must be done manually under windows */
+  /* Connect our log channels: that must be done manually under windows */
 #ifdef XBT_LOG_CONNECT
-       XBT_LOG_CONNECT(smpi_base, smpi);
-       XBT_LOG_CONNECT(smpi_bench, smpi);
-       XBT_LOG_CONNECT(smpi_kernel, smpi);
-       XBT_LOG_CONNECT(smpi_mpi, smpi);
-       XBT_LOG_CONNECT(smpi_receiver, smpi);
-       XBT_LOG_CONNECT(smpi_sender, smpi);
-       XBT_LOG_CONNECT(smpi_util, smpi);
+  XBT_LOG_CONNECT(smpi_base, smpi);
+  XBT_LOG_CONNECT(smpi_bench, smpi);
+  XBT_LOG_CONNECT(smpi_kernel, smpi);
+  XBT_LOG_CONNECT(smpi_mpi, smpi);
+  XBT_LOG_CONNECT(smpi_receiver, smpi);
+  XBT_LOG_CONNECT(smpi_sender, smpi);
+  XBT_LOG_CONNECT(smpi_util, smpi);
 #endif
 
-       smpi_global                                      = xbt_new(s_smpi_global_t, 1);
-       // config variable
-       smpi_global->reference_speed                     = SMPI_DEFAULT_SPEED;
-
-       smpi_global->root_ready                          = 0;
-       smpi_global->ready_process_count                 = 0;
-
-       // start/stop
-       smpi_global->start_stop_mutex                    = SIMIX_mutex_init();
-       smpi_global->start_stop_cond                     = SIMIX_cond_init();
-
-       // host info blank until sim starts
-       // FIXME: is this okay?
-       smpi_global->hosts                               = NULL;
-       smpi_global->host_count                          = 0;
-
-       // running hosts
-       smpi_global->running_hosts_count_mutex           = SIMIX_mutex_init();
-        smpi_global->running_hosts_count                 = 0;
-
-       // mallocators
-       smpi_global->request_mallocator                  = xbt_mallocator_new(SMPI_REQUEST_MALLOCATOR_SIZE,
-                                                            smpi_request_new, smpi_request_free, smpi_request_reset);
-       smpi_global->message_mallocator                  = xbt_mallocator_new(SMPI_MESSAGE_MALLOCATOR_SIZE,
-                                                            smpi_message_new, smpi_message_free, smpi_message_reset);
-
-       // queues
-       smpi_global->pending_send_request_queues         = xbt_new(xbt_fifo_t,  size);
-       smpi_global->pending_send_request_queues_mutexes = xbt_new(smx_mutex_t, size);
-       smpi_global->pending_recv_request_queues         = xbt_new(xbt_fifo_t,  size);
-       smpi_global->pending_recv_request_queues_mutexes = xbt_new(smx_mutex_t, size);
-       smpi_global->received_message_queues             = xbt_new(xbt_fifo_t,  size);
-       smpi_global->received_message_queues_mutexes     = xbt_new(smx_mutex_t, size);
-
-       // sender/receiver processes
-       smpi_global->sender_processes                    = xbt_new(smx_process_t, size);
-       smpi_global->receiver_processes                  = xbt_new(smx_process_t, size);
-
-       // timers
-       smpi_global->timer                               = xbt_os_timer_new();
-       smpi_global->timer_mutex                         = SIMIX_mutex_init();
-       smpi_global->timer_cond                          = SIMIX_cond_init();
-
-       smpi_global->do_once_duration_nodes              = NULL;
-       smpi_global->do_once_duration                    = NULL;
-       smpi_global->do_once_mutex                       = SIMIX_mutex_init();
-
-       for (i = 0; i < size; i++) {
-               smpi_global->pending_send_request_queues[i]         = xbt_fifo_new();
-               smpi_global->pending_send_request_queues_mutexes[i] = SIMIX_mutex_init();
-               smpi_global->pending_recv_request_queues[i]         = xbt_fifo_new();
-               smpi_global->pending_recv_request_queues_mutexes[i] = SIMIX_mutex_init();
-               smpi_global->received_message_queues[i]             = xbt_fifo_new();
-               smpi_global->received_message_queues_mutexes[i]     = SIMIX_mutex_init();
-       }
+  smpi_global = xbt_new(s_smpi_global_t, 1);
+  // config variable
+  smpi_global->reference_speed = SMPI_DEFAULT_SPEED;
+
+  smpi_global->root_ready = 0;
+  smpi_global->ready_process_count = 0;
+
+  // start/stop
+  smpi_global->start_stop_mutex = SIMIX_mutex_init();
+  smpi_global->start_stop_cond = SIMIX_cond_init();
+
+  // host info blank until sim starts
+  // FIXME: is this okay?
+  smpi_global->hosts = NULL;
+  smpi_global->host_count = 0;
+
+  // running hosts
+  smpi_global->running_hosts_count_mutex = SIMIX_mutex_init();
+  smpi_global->running_hosts_count = 0;
+
+  // mallocators
+  smpi_global->request_mallocator =
+    xbt_mallocator_new(SMPI_REQUEST_MALLOCATOR_SIZE, smpi_request_new,
+                       smpi_request_free, smpi_request_reset);
+  smpi_global->message_mallocator =
+    xbt_mallocator_new(SMPI_MESSAGE_MALLOCATOR_SIZE, smpi_message_new,
+                       smpi_message_free, smpi_message_reset);
+
+  // queues
+  smpi_global->pending_send_request_queues = xbt_new(xbt_fifo_t, size);
+  smpi_global->pending_send_request_queues_mutexes =
+    xbt_new(smx_mutex_t, size);
+  smpi_global->pending_recv_request_queues = xbt_new(xbt_fifo_t, size);
+  smpi_global->pending_recv_request_queues_mutexes =
+    xbt_new(smx_mutex_t, size);
+  smpi_global->received_message_queues = xbt_new(xbt_fifo_t, size);
+  smpi_global->received_message_queues_mutexes = xbt_new(smx_mutex_t, size);
+
+  // sender/receiver processes
+  smpi_global->sender_processes = xbt_new(smx_process_t, size);
+  smpi_global->receiver_processes = xbt_new(smx_process_t, size);
+
+  // timers
+  smpi_global->timer = xbt_os_timer_new();
+  smpi_global->timer_mutex = SIMIX_mutex_init();
+  smpi_global->timer_cond = SIMIX_cond_init();
+
+  smpi_global->do_once_duration_nodes = NULL;
+  smpi_global->do_once_duration = NULL;
+  smpi_global->do_once_mutex = SIMIX_mutex_init();
+
+  for (i = 0; i < size; i++) {
+    smpi_global->pending_send_request_queues[i] = xbt_fifo_new();
+    smpi_global->pending_send_request_queues_mutexes[i] = SIMIX_mutex_init();
+    smpi_global->pending_recv_request_queues[i] = xbt_fifo_new();
+    smpi_global->pending_recv_request_queues_mutexes[i] = SIMIX_mutex_init();
+    smpi_global->received_message_queues[i] = xbt_fifo_new();
+    smpi_global->received_message_queues_mutexes[i] = SIMIX_mutex_init();
+  }
 
 }
 
 void smpi_global_destroy()
 {
-       int i;
+  int i;
 
-       int size = SIMIX_host_get_number();
+  int size = SIMIX_host_get_number();
 
-       smpi_do_once_duration_node_t curr, next;
+  smpi_do_once_duration_node_t curr, next;
 
-       // start/stop
-       SIMIX_mutex_destroy(smpi_global->start_stop_mutex);
-       SIMIX_cond_destroy(smpi_global->start_stop_cond);
+  // start/stop
+  SIMIX_mutex_destroy(smpi_global->start_stop_mutex);
+  SIMIX_cond_destroy(smpi_global->start_stop_cond);
 
-       // processes
-       xbt_free(smpi_global->sender_processes);
-       xbt_free(smpi_global->receiver_processes);
+  // processes
+  xbt_free(smpi_global->sender_processes);
+  xbt_free(smpi_global->receiver_processes);
 
-       // running hosts
-       SIMIX_mutex_destroy(smpi_global->running_hosts_count_mutex);
+  // running hosts
+  SIMIX_mutex_destroy(smpi_global->running_hosts_count_mutex);
 
-       // mallocators
-       xbt_mallocator_free(smpi_global->request_mallocator);
-       xbt_mallocator_free(smpi_global->message_mallocator);
+  // mallocators
+  xbt_mallocator_free(smpi_global->request_mallocator);
+  xbt_mallocator_free(smpi_global->message_mallocator);
 
-       xbt_os_timer_free(smpi_global->timer);
-       SIMIX_mutex_destroy(smpi_global->timer_mutex);
-       SIMIX_cond_destroy(smpi_global->timer_cond);
+  xbt_os_timer_free(smpi_global->timer);
+  SIMIX_mutex_destroy(smpi_global->timer_mutex);
+  SIMIX_cond_destroy(smpi_global->timer_cond);
 
-       for(curr = smpi_global->do_once_duration_nodes; NULL != curr; curr = next) {
-               next = curr->next;
-               xbt_free(curr->file);
-               xbt_free(curr);
-       }
+  for (curr = smpi_global->do_once_duration_nodes; NULL != curr; curr = next) {
+    next = curr->next;
+    xbt_free(curr->file);
+    xbt_free(curr);
+  }
 
-       SIMIX_mutex_destroy(smpi_global->do_once_mutex);
+  SIMIX_mutex_destroy(smpi_global->do_once_mutex);
 
-       for(i = 0; i < size; i++) {
-               xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
-               SIMIX_mutex_destroy(smpi_global->pending_send_request_queues_mutexes[i]);
-               xbt_fifo_free(smpi_global->pending_recv_request_queues[i]);
-               SIMIX_mutex_destroy(smpi_global->pending_recv_request_queues_mutexes[i]);
-               xbt_fifo_free(smpi_global->received_message_queues[i]);
-               SIMIX_mutex_destroy(smpi_global->received_message_queues_mutexes[i]);
-       }
+  for (i = 0; i < size; i++) {
+    xbt_fifo_free(smpi_global->pending_send_request_queues[i]);
+    SIMIX_mutex_destroy(smpi_global->pending_send_request_queues_mutexes[i]);
+    xbt_fifo_free(smpi_global->pending_recv_request_queues[i]);
+    SIMIX_mutex_destroy(smpi_global->pending_recv_request_queues_mutexes[i]);
+    xbt_fifo_free(smpi_global->received_message_queues[i]);
+    SIMIX_mutex_destroy(smpi_global->received_message_queues_mutexes[i]);
+  }
 
-       xbt_free(smpi_global->pending_send_request_queues);
-       xbt_free(smpi_global->pending_send_request_queues_mutexes);
-       xbt_free(smpi_global->pending_recv_request_queues);
-       xbt_free(smpi_global->pending_recv_request_queues_mutexes);
-       xbt_free(smpi_global->received_message_queues);
-       xbt_free(smpi_global->received_message_queues_mutexes);
+  xbt_free(smpi_global->pending_send_request_queues);
+  xbt_free(smpi_global->pending_send_request_queues_mutexes);
+  xbt_free(smpi_global->pending_recv_request_queues);
+  xbt_free(smpi_global->pending_recv_request_queues_mutexes);
+  xbt_free(smpi_global->received_message_queues);
+  xbt_free(smpi_global->received_message_queues_mutexes);
 
-       xbt_free(smpi_global);
+  xbt_free(smpi_global);
 
-       smpi_global = NULL;
+  smpi_global = NULL;
 }
 
 int smpi_host_index()
 {
-       smx_host_t host = SIMIX_host_self();
-       smpi_host_data_t hdata = (smpi_host_data_t)SIMIX_host_get_data(host);
-       return hdata->index;
+  smx_host_t host = SIMIX_host_self();
+  smpi_host_data_t hdata = (smpi_host_data_t) SIMIX_host_get_data(host);
+  return hdata->index;
 }
 
 smx_mutex_t smpi_host_mutex()
 {
-       smx_host_t host = SIMIX_host_self();
-       smpi_host_data_t hdata = (smpi_host_data_t)SIMIX_host_get_data(host);
-       return hdata->mutex;
+  smx_host_t host = SIMIX_host_self();
+  smpi_host_data_t hdata = (smpi_host_data_t) SIMIX_host_get_data(host);
+  return hdata->mutex;
 }
 
 smx_cond_t smpi_host_cond()
 {
-       smx_host_t host = SIMIX_host_self();
-       smpi_host_data_t hdata = (smpi_host_data_t)SIMIX_host_get_data(host);
-       return hdata->cond;
+  smx_host_t host = SIMIX_host_self();
+  smpi_host_data_t hdata = (smpi_host_data_t) SIMIX_host_get_data(host);
+  return hdata->cond;
 }
 
 int smpi_run_simulation(int *argc, char **argv)
 {
-       smx_cond_t   cond           = NULL;
-       smx_action_t action         = NULL;
+  smx_cond_t cond = NULL;
+  smx_action_t action = NULL;
 
-       xbt_fifo_t   actions_failed = xbt_fifo_new();
-       xbt_fifo_t   actions_done   = xbt_fifo_new();
+  xbt_fifo_t actions_failed = xbt_fifo_new();
+  xbt_fifo_t actions_done = xbt_fifo_new();
 
-       srand(SMPI_RAND_SEED);
+  srand(SMPI_RAND_SEED);
 
-       SIMIX_global_init(argc, argv);
+  SIMIX_global_init(argc, argv);
 
-       SIMIX_function_register("smpi_simulated_main", smpi_simulated_main);
-       SIMIX_function_register("smpi_sender",         smpi_sender);
-       SIMIX_function_register("smpi_receiver",       smpi_receiver);
+  SIMIX_function_register("smpi_simulated_main", smpi_simulated_main);
+  SIMIX_function_register("smpi_sender", smpi_sender);
+  SIMIX_function_register("smpi_receiver", smpi_receiver);
 
-       // FIXME: ought to verify these files...
-       SIMIX_create_environment(argv[1]);
+  // FIXME: ought to verify these files...
+  SIMIX_create_environment(argv[1]);
 
-       // must initialize globals between creating environment and launching app....
-       smpi_global_init();
+  // must initialize globals between creating environment and launching app....
+  smpi_global_init();
 
-       SIMIX_launch_application(argv[2]);
+  SIMIX_launch_application(argv[2]);
 
-       /* Prepare to display some more info when dying on Ctrl-C pressing */
-       // FIXME: doesn't work
-       //signal(SIGINT, inthandler);
+  /* Prepare to display some more info when dying on Ctrl-C pressing */
+  // FIXME: doesn't work
+  //signal(SIGINT, inthandler);
 
-       /* Clean IO before the run */
-       fflush(stdout);
-       fflush(stderr);
-        SIMIX_init();
+  /* Clean IO before the run */
+  fflush(stdout);
+  fflush(stderr);
+  SIMIX_init();
 
-       while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
-               while ((action = xbt_fifo_pop(actions_failed))) {
-                       DEBUG1("** %s failed **", action->name);
-                       while((cond = xbt_fifo_pop(action->cond_list))) {
-                               SIMIX_cond_broadcast(cond);
-                       }
-               }
-               while((action = xbt_fifo_pop(actions_done))) {
-                       DEBUG1("** %s done **",action->name);
-                       while((cond = xbt_fifo_pop(action->cond_list))) {
-                               SIMIX_cond_broadcast(cond);
-                       }
-               }
-       }
+  while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
+    while ((action = xbt_fifo_pop(actions_failed))) {
+      DEBUG1("** %s failed **", action->name);
+      while ((cond = xbt_fifo_pop(action->cond_list))) {
+        SIMIX_cond_broadcast(cond);
+      }
+    }
+    while ((action = xbt_fifo_pop(actions_done))) {
+      DEBUG1("** %s done **", action->name);
+      while ((cond = xbt_fifo_pop(action->cond_list))) {
+        SIMIX_cond_broadcast(cond);
+      }
+    }
+  }
 
-       // FIXME: cleanup incomplete
-       xbt_fifo_free(actions_failed);
-       xbt_fifo_free(actions_done);
+  // FIXME: cleanup incomplete
+  xbt_fifo_free(actions_failed);
+  xbt_fifo_free(actions_done);
 
-       INFO1("simulation time %g", SIMIX_get_clock());
+  INFO1("simulation time %g", SIMIX_get_clock());
 
-       smpi_global_destroy();
+  smpi_global_destroy();
 
-       SIMIX_clean();
+  SIMIX_clean();
 
-       return 0;
+  return 0;
 }
index 88a693e..fd643e4 100644 (file)
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI (mpi)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
+                                "Logging specific to SMPI (mpi)");
 
 int SMPI_MPI_Init(int *argc, char ***argv)
 {
-       smpi_mpi_init();
-       smpi_bench_begin();
-       return MPI_SUCCESS;
+  smpi_mpi_init();
+  smpi_bench_begin();
+  return MPI_SUCCESS;
 }
 
 int SMPI_MPI_Finalize()
 {
-       smpi_bench_end();
-       smpi_mpi_finalize();
-       return MPI_SUCCESS;
+  smpi_bench_end();
+  smpi_mpi_finalize();
+  return MPI_SUCCESS;
 }
 
 // right now this just exits the current node, should send abort signal to all
 // hosts in the communicator;
 int SMPI_MPI_Abort(MPI_Comm comm, int errorcode)
 {
-       smpi_exit(errorcode);
-       return 0;
+  smpi_exit(errorcode);
+  return 0;
 }
 
 int SMPI_MPI_Comm_size(MPI_Comm comm, int *size)
 {
-       int retval = MPI_SUCCESS;
+  int retval = MPI_SUCCESS;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       if (NULL == comm) {
-               retval = MPI_ERR_COMM;
-       } else if (NULL == size) {
-               retval = MPI_ERR_ARG;
-       } else {
-               *size = comm->size;
-       }
+  if (NULL == comm) {
+    retval = MPI_ERR_COMM;
+  } else if (NULL == size) {
+    retval = MPI_ERR_ARG;
+  } else {
+    *size = comm->size;
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 int SMPI_MPI_Comm_rank(MPI_Comm comm, int *rank)
 {
-       int retval = MPI_SUCCESS;
+  int retval = MPI_SUCCESS;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       if (NULL == comm) {
-               retval = MPI_ERR_COMM;
-       } else if (NULL == rank) {
-               retval = MPI_ERR_ARG;
-       } else {
-               *rank = smpi_mpi_comm_rank(comm);
-       }
+  if (NULL == comm) {
+    retval = MPI_ERR_COMM;
+  } else if (NULL == rank) {
+    retval = MPI_ERR_ARG;
+  } else {
+    *rank = smpi_mpi_comm_rank(comm);
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
-int SMPI_MPI_Type_size(MPI_Datatype datatype, size_t *size)
+int SMPI_MPI_Type_size(MPI_Datatype datatype, size_t * size)
 {
-       int retval = MPI_SUCCESS;
+  int retval = MPI_SUCCESS;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       if (NULL == datatype) {
-               retval = MPI_ERR_TYPE;
-       } else if (NULL == size) {
-               retval = MPI_ERR_ARG;
-       } else {
-               *size = datatype->size;
-       }
+  if (NULL == datatype) {
+    retval = MPI_ERR_TYPE;
+  } else if (NULL == size) {
+    retval = MPI_ERR_ARG;
+  } else {
+    *size = datatype->size;
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 int SMPI_MPI_Barrier(MPI_Comm comm)
 {
-       int retval = MPI_SUCCESS;
+  int retval = MPI_SUCCESS;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       if (NULL == comm) {
-               retval = MPI_ERR_COMM;
-       } else {
-               retval = smpi_mpi_barrier(comm);
-       }
+  if (NULL == comm) {
+    retval = MPI_ERR_COMM;
+  } else {
+    retval = smpi_mpi_barrier(comm);
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 int SMPI_MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
-    int tag, MPI_Comm comm, MPI_Request *request)
+                   int tag, MPI_Comm comm, MPI_Request * request)
 {
-       int retval = MPI_SUCCESS;
+  int retval = MPI_SUCCESS;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       retval = smpi_create_request(buf, count, datatype, src, 0, tag, comm,
-        request);
-       if (NULL != *request && MPI_SUCCESS == retval) {
-               retval = smpi_mpi_irecv(*request);
-       }
+  retval = smpi_create_request(buf, count, datatype, src, 0, tag, comm,
+                               request);
+  if (NULL != *request && MPI_SUCCESS == retval) {
+    retval = smpi_mpi_irecv(*request);
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 int SMPI_MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src,
-    int tag, MPI_Comm comm, MPI_Status *status)
+                  int tag, MPI_Comm comm, MPI_Status * status)
 {
-       int retval = MPI_SUCCESS;
-       smpi_mpi_request_t request;
+  int retval = MPI_SUCCESS;
+  smpi_mpi_request_t request;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       retval = smpi_create_request(buf, count, datatype, src, 0, tag, comm,
-        &request);
-       if (NULL != request && MPI_SUCCESS == retval) {
-               retval = smpi_mpi_irecv(request);
-               if (MPI_SUCCESS == retval) {
-                       retval = smpi_mpi_wait(request, status);
-               }
-               xbt_mallocator_release(smpi_global->request_mallocator, request);
-       }
+  retval = smpi_create_request(buf, count, datatype, src, 0, tag, comm,
+                               &request);
+  if (NULL != request && MPI_SUCCESS == retval) {
+    retval = smpi_mpi_irecv(request);
+    if (MPI_SUCCESS == retval) {
+      retval = smpi_mpi_wait(request, status);
+    }
+    xbt_mallocator_release(smpi_global->request_mallocator, request);
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 int SMPI_MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
-    int tag, MPI_Comm comm, MPI_Request *request)
+                   int tag, MPI_Comm comm, MPI_Request * request)
 {
-       int retval = MPI_SUCCESS;
+  int retval = MPI_SUCCESS;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       retval = smpi_create_request(buf, count, datatype, 0, dst, tag, comm,
-        request);
-       if (NULL != *request && MPI_SUCCESS == retval) {
-               retval = smpi_mpi_isend(*request);
-       }
+  retval = smpi_create_request(buf, count, datatype, 0, dst, tag, comm,
+                               request);
+  if (NULL != *request && MPI_SUCCESS == retval) {
+    retval = smpi_mpi_isend(*request);
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 int SMPI_MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst,
-    int tag, MPI_Comm comm)
+                  int tag, MPI_Comm comm)
 {
-       int retval = MPI_SUCCESS;
-       smpi_mpi_request_t request;
+  int retval = MPI_SUCCESS;
+  smpi_mpi_request_t request;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       retval = smpi_create_request(buf, count, datatype, 0, dst, tag, comm,
-        &request);
-       if (NULL != request && MPI_SUCCESS == retval) {
-               retval = smpi_mpi_isend(request);
-               if (MPI_SUCCESS == retval) {
-                       smpi_mpi_wait(request, MPI_STATUS_IGNORE);
-               }
-               xbt_mallocator_release(smpi_global->request_mallocator, request);
-       }
+  retval = smpi_create_request(buf, count, datatype, 0, dst, tag, comm,
+                               &request);
+  if (NULL != request && MPI_SUCCESS == retval) {
+    retval = smpi_mpi_isend(request);
+    if (MPI_SUCCESS == retval) {
+      smpi_mpi_wait(request, MPI_STATUS_IGNORE);
+    }
+    xbt_mallocator_release(smpi_global->request_mallocator, request);
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
-int SMPI_MPI_Wait(MPI_Request *request, MPI_Status *status) {
-       return smpi_mpi_wait(*request, status);
+int SMPI_MPI_Wait(MPI_Request * request, MPI_Status * status)
+{
+  return smpi_mpi_wait(*request, status);
 }
 
 int SMPI_MPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root,
-    MPI_Comm comm)
+                   MPI_Comm comm)
 {
 
-       int retval = MPI_SUCCESS;
-       int rank;
-       smpi_mpi_request_t request;
+  int retval = MPI_SUCCESS;
+  int rank;
+  smpi_mpi_request_t request;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       rank = smpi_mpi_comm_rank(comm);
+  rank = smpi_mpi_comm_rank(comm);
 
-       if (rank == root) {
-               retval = smpi_create_request(buf, count, datatype, root,
-            (root + 1) % comm->size, 0, comm, &request);
-               request->forward = comm->size - 1;
-               smpi_mpi_isend(request);
-       } else {
-               retval = smpi_create_request(buf, count, datatype, MPI_ANY_SOURCE, rank,
-            0, comm, &request);
-               smpi_mpi_irecv(request);
-       }
+  if (rank == root) {
+    retval = smpi_create_request(buf, count, datatype, root,
+                                 (root + 1) % comm->size, 0, comm, &request);
+    request->forward = comm->size - 1;
+    smpi_mpi_isend(request);
+  } else {
+    retval = smpi_create_request(buf, count, datatype, MPI_ANY_SOURCE, rank,
+                                 0, comm, &request);
+    smpi_mpi_irecv(request);
+  }
 
-       smpi_mpi_wait(request, MPI_STATUS_IGNORE);
-       xbt_mallocator_release(smpi_global->request_mallocator, request);
+  smpi_mpi_wait(request, MPI_STATUS_IGNORE);
+  xbt_mallocator_release(smpi_global->request_mallocator, request);
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
 
 // used by comm_split to sort ranks based on key values
 int smpi_compare_rankkeys(const void *a, const void *b);
-int smpi_compare_rankkeys(const void *a, const void *b) {
-    int *x = (int *)a;
-    int *y = (int *)b;
-
-    if (x[1] < y[1]) return -1;
+int smpi_compare_rankkeys(const void *a, const void *b)
+{
+  int *x = (int *) a;
+  int *y = (int *) b;
 
-    if (x[1] == y[1]) {
-        if (x[0] < y[0]) return -1;
-        if (x[0] == y[0]) return 0;
-        return 1;
-    }
+  if (x[1] < y[1])
+    return -1;
 
+  if (x[1] == y[1]) {
+    if (x[0] < y[0])
+      return -1;
+    if (x[0] == y[0])
+      return 0;
     return 1;
+  }
+
+  return 1;
 }
 
-int SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out)
+int SMPI_MPI_Comm_split(MPI_Comm comm, int color, int key,
+                        MPI_Comm * comm_out)
 {
-       int retval = MPI_SUCCESS;
-
-       int index, rank;
-       smpi_mpi_request_t request;
-       int colorkey[2];
-       smpi_mpi_status_t status;
-
-       smpi_bench_end();
-
-       // FIXME: need to test parameters
-
-       index = smpi_host_index();
-       rank  = comm->index_to_rank_map[index];
-
-    // default output
-    comm_out = NULL;
-
-    // root node does most of the real work
-       if (0 == rank) {
-               int colormap[comm->size];
-        int keymap[comm->size];
-        int rankkeymap[comm->size * 2];
-               int i, j;
-               smpi_mpi_communicator_t tempcomm = NULL;
-               int count;
-               int indextmp;
-
-               colormap[0] = color;
-        keymap[0]   = key;
-
-               // FIXME: use scatter/gather or similar instead of individual comms
-               for (i = 1; i < comm->size; i++) {
-                       retval = smpi_create_request(colorkey, 2, MPI_INT, MPI_ANY_SOURCE,
-                    rank, MPI_ANY_TAG, comm, &request);
-                       smpi_mpi_irecv(request);
-                       smpi_mpi_wait(request, &status);
-                       colormap[status.MPI_SOURCE] = colorkey[0];
-                       keymap[status.MPI_SOURCE]   = colorkey[1];
-                       xbt_mallocator_release(smpi_global->request_mallocator, request);
-               }
-
-               for (i = 0; i < comm->size; i++) {
-                       if (MPI_UNDEFINED == colormap[i]) {
-                               continue;
-                       }
-
-            // make a list of nodes with current color and sort by keys
-                       count = 0;
-                       for (j = i; j < comm->size; j++) {
-                               if(colormap[i] == colormap[j]) {
-                                       colormap[j] = MPI_UNDEFINED;
-                                       rankkeymap[count * 2]     = j;
-                                       rankkeymap[count * 2 + 1] = keymap[j];
-                                       count++;
-                               }
-                       }
-            qsort(rankkeymap, count, sizeof(int) * 2,
-                &smpi_compare_rankkeys);
-
-            // new communicator
-                       tempcomm                    = xbt_new(s_smpi_mpi_communicator_t, 1);
-                       tempcomm->barrier_count     = 0;
-                       tempcomm->size              = count;
-                       tempcomm->barrier_mutex     = SIMIX_mutex_init();
-                       tempcomm->barrier_cond      = SIMIX_cond_init();
-                       tempcomm->rank_to_index_map = xbt_new(int, count);
-                       tempcomm->index_to_rank_map = xbt_new(int, smpi_global->host_count);
-                       for (j = 0; j < smpi_global->host_count; j++) {
-                               tempcomm->index_to_rank_map[j] = -1;
-                       }
-                       for (j = 0; j < count; j++) {
-                               indextmp = comm->rank_to_index_map[rankkeymap[j*2]];
-                               tempcomm->rank_to_index_map[j]        = indextmp;
-                               tempcomm->index_to_rank_map[indextmp] = j;
-                       }
-                       for (j = 0; j < count; j++) {
-                               if (rankkeymap[j*2]) {
-                                       retval = smpi_create_request(&j, 1, MPI_INT, 0,
-                        rankkeymap[j*2], 0, comm, &request);
-                                       request->data = tempcomm;
-                                       smpi_mpi_isend(request);
-                                       smpi_mpi_wait(request, &status);
-                                       xbt_mallocator_release(smpi_global->request_mallocator,
-                        request);
-                               } else {
-                                       *comm_out = tempcomm;
-                               }
-                       }
-               }
-       } else {
-               colorkey[0] = color;
-               colorkey[1] = key;
-               retval = smpi_create_request(colorkey, 2, MPI_INT, rank, 0, 0, comm,
-            &request);
-               smpi_mpi_isend(request);
-               smpi_mpi_wait(request, &status);
-               xbt_mallocator_release(smpi_global->request_mallocator, request);
-        if (MPI_UNDEFINED != color) {
-                   retval = smpi_create_request(colorkey, 1, MPI_INT, 0, rank, 0, comm,
-                &request);
-                   smpi_mpi_irecv(request);
-                   smpi_mpi_wait(request, &status);
-                   *comm_out = request->data;
+  int retval = MPI_SUCCESS;
+
+  int index, rank;
+  smpi_mpi_request_t request;
+  int colorkey[2];
+  smpi_mpi_status_t status;
+
+  smpi_bench_end();
+
+  // FIXME: need to test parameters
+
+  index = smpi_host_index();
+  rank = comm->index_to_rank_map[index];
+
+  // default output
+  comm_out = NULL;
+
+  // root node does most of the real work
+  if (0 == rank) {
+    int colormap[comm->size];
+    int keymap[comm->size];
+    int rankkeymap[comm->size * 2];
+    int i, j;
+    smpi_mpi_communicator_t tempcomm = NULL;
+    int count;
+    int indextmp;
+
+    colormap[0] = color;
+    keymap[0] = key;
+
+    // FIXME: use scatter/gather or similar instead of individual comms
+    for (i = 1; i < comm->size; i++) {
+      retval = smpi_create_request(colorkey, 2, MPI_INT, MPI_ANY_SOURCE,
+                                   rank, MPI_ANY_TAG, comm, &request);
+      smpi_mpi_irecv(request);
+      smpi_mpi_wait(request, &status);
+      colormap[status.MPI_SOURCE] = colorkey[0];
+      keymap[status.MPI_SOURCE] = colorkey[1];
+      xbt_mallocator_release(smpi_global->request_mallocator, request);
+    }
+
+    for (i = 0; i < comm->size; i++) {
+      if (MPI_UNDEFINED == colormap[i]) {
+        continue;
+      }
+      // make a list of nodes with current color and sort by keys
+      count = 0;
+      for (j = i; j < comm->size; j++) {
+        if (colormap[i] == colormap[j]) {
+          colormap[j] = MPI_UNDEFINED;
+          rankkeymap[count * 2] = j;
+          rankkeymap[count * 2 + 1] = keymap[j];
+          count++;
         }
-       }
+      }
+      qsort(rankkeymap, count, sizeof(int) * 2, &smpi_compare_rankkeys);
+
+      // new communicator
+      tempcomm = xbt_new(s_smpi_mpi_communicator_t, 1);
+      tempcomm->barrier_count = 0;
+      tempcomm->size = count;
+      tempcomm->barrier_mutex = SIMIX_mutex_init();
+      tempcomm->barrier_cond = SIMIX_cond_init();
+      tempcomm->rank_to_index_map = xbt_new(int, count);
+      tempcomm->index_to_rank_map = xbt_new(int, smpi_global->host_count);
+      for (j = 0; j < smpi_global->host_count; j++) {
+        tempcomm->index_to_rank_map[j] = -1;
+      }
+      for (j = 0; j < count; j++) {
+        indextmp = comm->rank_to_index_map[rankkeymap[j * 2]];
+        tempcomm->rank_to_index_map[j] = indextmp;
+        tempcomm->index_to_rank_map[indextmp] = j;
+      }
+      for (j = 0; j < count; j++) {
+        if (rankkeymap[j * 2]) {
+          retval = smpi_create_request(&j, 1, MPI_INT, 0,
+                                       rankkeymap[j * 2], 0, comm, &request);
+          request->data = tempcomm;
+          smpi_mpi_isend(request);
+          smpi_mpi_wait(request, &status);
+          xbt_mallocator_release(smpi_global->request_mallocator, request);
+        } else {
+          *comm_out = tempcomm;
+        }
+      }
+    }
+  } else {
+    colorkey[0] = color;
+    colorkey[1] = key;
+    retval = smpi_create_request(colorkey, 2, MPI_INT, rank, 0, 0, comm,
+                                 &request);
+    smpi_mpi_isend(request);
+    smpi_mpi_wait(request, &status);
+    xbt_mallocator_release(smpi_global->request_mallocator, request);
+    if (MPI_UNDEFINED != color) {
+      retval = smpi_create_request(colorkey, 1, MPI_INT, 0, rank, 0, comm,
+                                   &request);
+      smpi_mpi_irecv(request);
+      smpi_mpi_wait(request, &status);
+      *comm_out = request->data;
+    }
+  }
 
-       smpi_bench_begin();
+  smpi_bench_begin();
 
-       return retval;
+  return retval;
 }
index 4f21418..365dad5 100644 (file)
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_receiver, smpi, "Logging specific to SMPI (receiver)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_receiver, smpi,
+                                "Logging specific to SMPI (receiver)");
 
 int smpi_receiver(int argc, char **argv)
 {
-       smx_process_t self;
-       int index;
-
-       xbt_fifo_t request_queue;
-       smx_mutex_t request_queue_mutex;
-       xbt_fifo_t message_queue;
-       smx_mutex_t message_queue_mutex;
-
-       int running_hosts_count;
-
-       smpi_mpi_request_t request;
-       smpi_received_message_t message;
-
-       xbt_fifo_item_t request_item;
-       xbt_fifo_item_t message_item;
-
-       self = SIMIX_process_self();
-
-       // make sure root is done before own initialization
-       SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-       while (!smpi_global->root_ready) {
-               SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
-       }
-       SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
-       index = smpi_host_index();
-
-       request_queue       = smpi_global->pending_recv_request_queues[index];
-       request_queue_mutex = smpi_global->pending_recv_request_queues_mutexes[index];
-       message_queue       = smpi_global->received_message_queues[index];
-       message_queue_mutex = smpi_global->received_message_queues_mutexes[index];
-
-       smpi_global->receiver_processes[index] = self;
-
-       // wait for all nodes to signal initializatin complete
-       SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-       smpi_global->ready_process_count++;
-       if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) {
-               SIMIX_cond_broadcast(smpi_global->start_stop_cond);
-       }
-       while (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
-               SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
-       }
-       SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
-
-       do {
-
-               // FIXME: better algorithm, maybe some kind of balanced tree? or a heap?
-
-               // FIXME: not the best way to request multiple locks...
-               SIMIX_mutex_lock(request_queue_mutex);
-               SIMIX_mutex_lock(message_queue_mutex);
-               for (request_item = xbt_fifo_get_first_item(request_queue);
-                       NULL != request_item;
-                       request_item = xbt_fifo_get_next_item(request_item)) {
-                       request = xbt_fifo_get_item_content(request_item);
-                       for (message_item = xbt_fifo_get_first_item(message_queue);
-                               NULL != message_item;
-                               message_item = xbt_fifo_get_next_item(message_item)) {
-                               message = xbt_fifo_get_item_content(message_item);
-                               if (
-                                       request->comm == message->comm &&
-                                       (MPI_ANY_SOURCE == request->src || request->src == message->src) &&
-                                       (MPI_ANY_TAG == request->tag || request->tag == message->tag)) {
-                                       xbt_fifo_remove_item(request_queue, request_item);
-                                       xbt_fifo_free_item(request_item);
-                                       xbt_fifo_remove_item(message_queue, message_item);
-                                       xbt_fifo_free_item(message_item);
-                                       goto stopsearch;
-                               }
-                       }
-               }
-
-               request = NULL;
-               message = NULL;
-
-stopsearch:
-               SIMIX_mutex_unlock(message_queue_mutex);
-               SIMIX_mutex_unlock(request_queue_mutex);
-
-               if (NULL == request || NULL == message) {
-                       SIMIX_process_suspend(self);
-               } else {
-
-                       SIMIX_mutex_lock(request->mutex);
-                       memcpy(request->buf, message->buf, request->datatype->size * request->count);
-                       request->src = message->src;
-                       request->data = message->data;
-                       request->forward = message->forward;
-
-                       if (0 == request->forward) {
-                               request->completed = 1;
-                               SIMIX_cond_broadcast(request->cond);
-                       } else {
-                               request->src = request->comm->index_to_rank_map[index];
-                               request->dst = (request->src + 1) % request->comm->size;
-                               smpi_mpi_isend(request);
-                       }
-
-                       SIMIX_mutex_unlock(request->mutex);
-
-                       xbt_free(message->buf);
-                       xbt_mallocator_release(smpi_global->message_mallocator, message);
-
-               }
-
-               SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
-               running_hosts_count = smpi_global->running_hosts_count;
-               SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
-
-       } while (0 < running_hosts_count);
-
-       return 0;
+  smx_process_t self;
+  int index;
+
+  xbt_fifo_t request_queue;
+  smx_mutex_t request_queue_mutex;
+  xbt_fifo_t message_queue;
+  smx_mutex_t message_queue_mutex;
+
+  int running_hosts_count;
+
+  smpi_mpi_request_t request;
+  smpi_received_message_t message;
+
+  xbt_fifo_item_t request_item;
+  xbt_fifo_item_t message_item;
+
+  self = SIMIX_process_self();
+
+  // make sure root is done before own initialization
+  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+  while (!smpi_global->root_ready) {
+    SIMIX_cond_wait(smpi_global->start_stop_cond,
+                    smpi_global->start_stop_mutex);
+  }
+  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+
+  index = smpi_host_index();
+
+  request_queue = smpi_global->pending_recv_request_queues[index];
+  request_queue_mutex =
+    smpi_global->pending_recv_request_queues_mutexes[index];
+  message_queue = smpi_global->received_message_queues[index];
+  message_queue_mutex = smpi_global->received_message_queues_mutexes[index];
+
+  smpi_global->receiver_processes[index] = self;
+
+  // wait for all nodes to signal initializatin complete
+  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+  smpi_global->ready_process_count++;
+  if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) {
+    SIMIX_cond_broadcast(smpi_global->start_stop_cond);
+  }
+  while (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
+    SIMIX_cond_wait(smpi_global->start_stop_cond,
+                    smpi_global->start_stop_mutex);
+  }
+  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+
+  do {
+
+    // FIXME: better algorithm, maybe some kind of balanced tree? or a heap?
+
+    // FIXME: not the best way to request multiple locks...
+    SIMIX_mutex_lock(request_queue_mutex);
+    SIMIX_mutex_lock(message_queue_mutex);
+    for (request_item = xbt_fifo_get_first_item(request_queue);
+         NULL != request_item;
+         request_item = xbt_fifo_get_next_item(request_item)) {
+      request = xbt_fifo_get_item_content(request_item);
+      for (message_item = xbt_fifo_get_first_item(message_queue);
+           NULL != message_item;
+           message_item = xbt_fifo_get_next_item(message_item)) {
+        message = xbt_fifo_get_item_content(message_item);
+        if (request->comm == message->comm &&
+            (MPI_ANY_SOURCE == request->src || request->src == message->src)
+            && (MPI_ANY_TAG == request->tag || request->tag == message->tag)) {
+          xbt_fifo_remove_item(request_queue, request_item);
+          xbt_fifo_free_item(request_item);
+          xbt_fifo_remove_item(message_queue, message_item);
+          xbt_fifo_free_item(message_item);
+          goto stopsearch;
+        }
+      }
+    }
+
+    request = NULL;
+    message = NULL;
+
+  stopsearch:
+    SIMIX_mutex_unlock(message_queue_mutex);
+    SIMIX_mutex_unlock(request_queue_mutex);
+
+    if (NULL == request || NULL == message) {
+      SIMIX_process_suspend(self);
+    } else {
+
+      SIMIX_mutex_lock(request->mutex);
+      memcpy(request->buf, message->buf,
+             request->datatype->size * request->count);
+      request->src = message->src;
+      request->data = message->data;
+      request->forward = message->forward;
+
+      if (0 == request->forward) {
+        request->completed = 1;
+        SIMIX_cond_broadcast(request->cond);
+      } else {
+        request->src = request->comm->index_to_rank_map[index];
+        request->dst = (request->src + 1) % request->comm->size;
+        smpi_mpi_isend(request);
+      }
+
+      SIMIX_mutex_unlock(request->mutex);
+
+      xbt_free(message->buf);
+      xbt_mallocator_release(smpi_global->message_mallocator, message);
+
+    }
+
+    SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
+    running_hosts_count = smpi_global->running_hosts_count;
+    SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
+
+  } while (0 < running_hosts_count);
+
+  return 0;
 }
index 26f5125..76b43e8 100644 (file)
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_sender, smpi, "Logging specific to SMPI (sender)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_sender, smpi,
+                                "Logging specific to SMPI (sender)");
 
 int smpi_sender(int argc, char **argv)
 {
-       smx_process_t self;
-       smx_host_t shost;
+  smx_process_t self;
+  smx_host_t shost;
 
-       int index;
+  int index;
 
-       xbt_fifo_t request_queue;
-       smx_mutex_t request_queue_mutex;
+  xbt_fifo_t request_queue;
+  smx_mutex_t request_queue_mutex;
 
-       int running_hosts_count;
+  int running_hosts_count;
 
-       smpi_mpi_request_t request;
+  smpi_mpi_request_t request;
 
-       smx_host_t dhost;
+  smx_host_t dhost;
 
-       smx_action_t action;
+  smx_action_t action;
 
-       e_surf_action_state_t state;
+  e_surf_action_state_t state;
 
-       smpi_received_message_t message;
+  smpi_received_message_t message;
 
-       int dindex;
+  int dindex;
 
-       smx_process_t receiver_process;
+  smx_process_t receiver_process;
 
-       self  = SIMIX_process_self();
-       shost = SIMIX_host_self();
+  self = SIMIX_process_self();
+  shost = SIMIX_host_self();
 
-       // make sure root is done before own initialization
-       SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-       while (!smpi_global->root_ready) {
-               SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
-       }
-       SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+  // make sure root is done before own initialization
+  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+  while (!smpi_global->root_ready) {
+    SIMIX_cond_wait(smpi_global->start_stop_cond,
+                    smpi_global->start_stop_mutex);
+  }
+  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
 
-       index = smpi_host_index();
+  index = smpi_host_index();
 
-       request_queue       = smpi_global->pending_send_request_queues[index];
-       request_queue_mutex = smpi_global->pending_send_request_queues_mutexes[index];
+  request_queue = smpi_global->pending_send_request_queues[index];
+  request_queue_mutex =
+    smpi_global->pending_send_request_queues_mutexes[index];
 
-       smpi_global->sender_processes[index] = self;
+  smpi_global->sender_processes[index] = self;
 
-       // wait for all nodes to signal initializatin complete
-       SIMIX_mutex_lock(smpi_global->start_stop_mutex);
-       smpi_global->ready_process_count++;
-       if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) {
-               SIMIX_cond_broadcast(smpi_global->start_stop_cond);
-       }
-       while (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
-               SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
-       }
-       SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
+  // wait for all nodes to signal initializatin complete
+  SIMIX_mutex_lock(smpi_global->start_stop_mutex);
+  smpi_global->ready_process_count++;
+  if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) {
+    SIMIX_cond_broadcast(smpi_global->start_stop_cond);
+  }
+  while (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
+    SIMIX_cond_wait(smpi_global->start_stop_cond,
+                    smpi_global->start_stop_mutex);
+  }
+  SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
 
-       do {
+  do {
 
-               SIMIX_mutex_lock(request_queue_mutex);
-               request = xbt_fifo_shift(request_queue);
-               SIMIX_mutex_unlock(request_queue_mutex);
+    SIMIX_mutex_lock(request_queue_mutex);
+    request = xbt_fifo_shift(request_queue);
+    SIMIX_mutex_unlock(request_queue_mutex);
 
-               if (NULL == request) {
-                       SIMIX_process_suspend(self);
-               } else {
+    if (NULL == request) {
+      SIMIX_process_suspend(self);
+    } else {
 
-                       message          = xbt_mallocator_get(smpi_global->message_mallocator);
+      message = xbt_mallocator_get(smpi_global->message_mallocator);
 
-                       SIMIX_mutex_lock(request->mutex);
+      SIMIX_mutex_lock(request->mutex);
 
-                       message->comm    = request->comm;
-                       message->src     = request->comm->index_to_rank_map[index];
-                       message->tag     = request->tag;
-                       message->data    = request->data;
-                       message->buf     = xbt_malloc(request->datatype->size * request->count);
-                       memcpy(message->buf, request->buf, request->datatype->size * request->count);
+      message->comm = request->comm;
+      message->src = request->comm->index_to_rank_map[index];
+      message->tag = request->tag;
+      message->data = request->data;
+      message->buf = xbt_malloc(request->datatype->size * request->count);
+      memcpy(message->buf, request->buf,
+             request->datatype->size * request->count);
 
-                       dindex = request->comm->rank_to_index_map[request->dst];
-                       dhost  = smpi_global->hosts[dindex];
+      dindex = request->comm->rank_to_index_map[request->dst];
+      dhost = smpi_global->hosts[dindex];
 
-                       message->forward = (request->forward - 1) / 2;
-                       request->forward = request->forward / 2;
+      message->forward = (request->forward - 1) / 2;
+      request->forward = request->forward / 2;
 
-                       if (0 < request->forward) {
-                               request->dst = (request->dst + message->forward + 1) % request->comm->size;
-                               SIMIX_mutex_lock(request_queue_mutex);
-                               xbt_fifo_push(request_queue, request);
-                               SIMIX_mutex_unlock(request_queue_mutex);
-                       } else {
-                               request->completed = 1;
-                       }
+      if (0 < request->forward) {
+        request->dst =
+          (request->dst + message->forward + 1) % request->comm->size;
+        SIMIX_mutex_lock(request_queue_mutex);
+        xbt_fifo_push(request_queue, request);
+        SIMIX_mutex_unlock(request_queue_mutex);
+      } else {
+        request->completed = 1;
+      }
 
-                       action = SIMIX_action_communicate(shost, dhost, "communication", request->datatype->size * request->count, -1.0);
+      action =
+        SIMIX_action_communicate(shost, dhost, "communication",
+                                 request->datatype->size * request->count,
+                                 -1.0);
 
-                       SIMIX_register_action_to_condition(action, request->cond);
+      SIMIX_register_action_to_condition(action, request->cond);
 
-                       for (
-                               state  = SIMIX_action_get_state(action);
-                               state == SURF_ACTION_READY ||
-                               state == SURF_ACTION_RUNNING;
-                               state  = SIMIX_action_get_state(action)
-                       ) {
-                               SIMIX_cond_wait(request->cond, request->mutex);
-                       }
+      for (state = SIMIX_action_get_state(action);
+           state == SURF_ACTION_READY ||
+           state == SURF_ACTION_RUNNING;
+           state = SIMIX_action_get_state(action)
+        ) {
+        SIMIX_cond_wait(request->cond, request->mutex);
+      }
 
-                       SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
-                       xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
-                       SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes[dindex]);
+      SIMIX_mutex_lock(smpi_global->received_message_queues_mutexes[dindex]);
+      xbt_fifo_push(smpi_global->received_message_queues[dindex], message);
+      SIMIX_mutex_unlock(smpi_global->received_message_queues_mutexes
+                         [dindex]);
 
-                       SIMIX_unregister_action_to_condition(action, request->cond);
-                       SIMIX_action_destroy(action);
+      SIMIX_unregister_action_to_condition(action, request->cond);
+      SIMIX_action_destroy(action);
 
-                       SIMIX_mutex_unlock(request->mutex);
+      SIMIX_mutex_unlock(request->mutex);
 
-                       // wake up receiver if necessary
-                       receiver_process = smpi_global->receiver_processes[dindex];
-                       if (SIMIX_process_is_suspended(receiver_process)) {
-                               SIMIX_process_resume(receiver_process);
-                       }
-
-               }
-
-               SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
-               running_hosts_count = smpi_global->running_hosts_count;
-               SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
-
-       } while (0 < running_hosts_count);
-
-       return 0;
+      // wake up receiver if necessary
+      receiver_process = smpi_global->receiver_processes[dindex];
+      if (SIMIX_process_is_suspended(receiver_process)) {
+        SIMIX_process_resume(receiver_process);
+      }
+
+    }
+
+    SIMIX_mutex_lock(smpi_global->running_hosts_count_mutex);
+    running_hosts_count = smpi_global->running_hosts_count;
+    SIMIX_mutex_unlock(smpi_global->running_hosts_count_mutex);
+
+  } while (0 < running_hosts_count);
+
+  return 0;
 }
index 596c294..c5bc013 100644 (file)
@@ -1,65 +1,64 @@
 #include "private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_util, smpi, "Logging specific to SMPI (utilities)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_util, smpi,
+                                "Logging specific to SMPI (utilities)");
 
 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz)
 {
-       double now;
-       int retval;
-       smpi_bench_end();
-       retval = 0;
-       if (NULL == tv) {
-               retval = -1;
-       } else {
-               now = SIMIX_get_clock();
-               tv->tv_sec  = now;
-               tv->tv_usec = ((now - (double)tv->tv_sec) * 1000000.0);
-       }
-       smpi_bench_begin();
-       return retval;
+  double now;
+  int retval;
+  smpi_bench_end();
+  retval = 0;
+  if (NULL == tv) {
+    retval = -1;
+  } else {
+    now = SIMIX_get_clock();
+    tv->tv_sec = now;
+    tv->tv_usec = ((now - (double) tv->tv_sec) * 1000000.0);
+  }
+  smpi_bench_begin();
+  return retval;
 }
 
 unsigned int smpi_sleep(unsigned int seconds)
 {
-       smx_host_t host;
-       smx_mutex_t mutex;
-       smx_cond_t cond;
-       smx_action_t action;
-       e_surf_action_state_t state;
+  smx_host_t host;
+  smx_mutex_t mutex;
+  smx_cond_t cond;
+  smx_action_t action;
+  e_surf_action_state_t state;
 
-       smpi_bench_end();
+  smpi_bench_end();
 
-       host  = SIMIX_host_self();
-       mutex = smpi_host_mutex();
-       cond  = smpi_host_cond();
+  host = SIMIX_host_self();
+  mutex = smpi_host_mutex();
+  cond = smpi_host_cond();
 
-       SIMIX_mutex_lock(mutex);
+  SIMIX_mutex_lock(mutex);
 
-       // FIXME: explicit conversion to double?
-       action = SIMIX_action_sleep(host, seconds);
+  // FIXME: explicit conversion to double?
+  action = SIMIX_action_sleep(host, seconds);
 
-       SIMIX_register_action_to_condition(action, cond);
-       for (
-               state =  SIMIX_action_get_state(action);
-               state == SURF_ACTION_READY ||
-               state == SURF_ACTION_RUNNING;
-               state =  SIMIX_action_get_state(action)
-       ) {
-               SIMIX_cond_wait(cond, mutex);
-       }
-       SIMIX_unregister_action_to_condition(action, cond);
-       SIMIX_action_destroy(action);
+  SIMIX_register_action_to_condition(action, cond);
+  for (state = SIMIX_action_get_state(action);
+       state == SURF_ACTION_READY ||
+       state == SURF_ACTION_RUNNING; state = SIMIX_action_get_state(action)
+    ) {
+    SIMIX_cond_wait(cond, mutex);
+  }
+  SIMIX_unregister_action_to_condition(action, cond);
+  SIMIX_action_destroy(action);
 
-       SIMIX_mutex_unlock(mutex);
+  SIMIX_mutex_unlock(mutex);
 
-       smpi_bench_begin();
-       return 0;
+  smpi_bench_begin();
+  return 0;
 }
 
 void smpi_exit(int status)
 {
-       smpi_bench_end();
-       smpi_mpi_finalize();
-       SIMIX_process_kill(SIMIX_process_self());
-       return;
+  smpi_bench_end();
+  smpi_mpi_finalize();
+  SIMIX_process_kill(SIMIX_process_self());
+  return;
 }
index 3814631..2e44f44 100644 (file)
@@ -8,7 +8,7 @@
 #include "cpu_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
-                               "Logging specific to the SURF CPU module");
+                                "Logging specific to the SURF CPU module");
 
 surf_cpu_model_t surf_cpu_model = NULL;
 lmm_system_t cpu_maxmin_system = NULL;
@@ -19,21 +19,21 @@ static xbt_swag_t running_action_set_that_does_not_need_being_checked = NULL;
 static void cpu_free(void *cpu)
 {
   free(((cpu_Cas01_t) cpu)->name);
-  xbt_dict_free(&(((cpu_Cas01_t)cpu)->properties));
+  xbt_dict_free(&(((cpu_Cas01_t) cpu)->properties));
   free(cpu);
 }
 
 static cpu_Cas01_t cpu_new(char *name, double power_scale,
-                          double power_initial,
-                          tmgr_trace_t power_trace,
-                          e_surf_cpu_state_t state_initial,
-                          tmgr_trace_t state_trace,
-                          xbt_dict_t cpu_properties)
+                           double power_initial,
+                           tmgr_trace_t power_trace,
+                           e_surf_cpu_state_t state_initial,
+                           tmgr_trace_t state_trace,
+                           xbt_dict_t cpu_properties)
 {
   cpu_Cas01_t cpu = xbt_new0(s_cpu_Cas01_t, 1);
   xbt_assert1(!xbt_dict_get_or_null(cpu_set, name),
-             "Host '%s' declared several times in the platform file",name);
-   
+              "Host '%s' declared several times in the platform file", name);
+
   cpu->model = (surf_model_t) surf_cpu_model;
   cpu->name = name;
   cpu->power_scale = power_scale;
@@ -41,18 +41,18 @@ static cpu_Cas01_t cpu_new(char *name, double power_scale,
   cpu->power_current = power_initial;
   if (power_trace)
     cpu->power_event =
-       tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
+      tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
 
   cpu->state_current = state_initial;
   if (state_trace)
     cpu->state_event =
-       tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
+      tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
 
   cpu->constraint =
-      lmm_constraint_new(cpu_maxmin_system, cpu,
-                        cpu->power_current * cpu->power_scale);
+    lmm_constraint_new(cpu_maxmin_system, cpu,
+                       cpu->power_current * cpu->power_scale);
 
-  /*add the property set*/
+  /*add the property set */
   cpu->properties = cpu_properties;
 
   current_property_set = cpu_properties;
@@ -76,50 +76,52 @@ static void parse_cpu_init(void)
   surf_parse_get_trace(&power_trace, A_surfxml_host_availability_file);
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
-             (A_surfxml_host_state == A_surfxml_host_state_OFF),
-             "Invalid state");
+              (A_surfxml_host_state == A_surfxml_host_state_OFF),
+              "Invalid state");
   if (A_surfxml_host_state == A_surfxml_host_state_ON)
     state_initial = SURF_CPU_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
     state_initial = SURF_CPU_OFF;
-  surf_parse_get_trace(&state_trace, A_surfxml_host_state_file); 
+  surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
 
   current_property_set = xbt_dict_new();
-  cpu_new(xbt_strdup(A_surfxml_host_id), power_scale, power_initial, power_trace, state_initial,
-         state_trace,  current_property_set);
+  cpu_new(xbt_strdup(A_surfxml_host_id), power_scale, power_initial,
+          power_trace, state_initial, state_trace, current_property_set);
 
 }
 
-static void add_traces_cpu(void) {
-   xbt_dict_cursor_t cursor=NULL;
-   char *trace_name,*elm;
-
-   static int called = 0;
-   
-   if (called) return;
-   called = 1;
-
-   
-   /* connect all traces relative to hosts */
-   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      cpu_Cas01_t host = xbt_dict_get_or_null(cpu_set, elm);
-      
-      xbt_assert1(host, "Host %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); 
-   }
-
-   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      cpu_Cas01_t host = xbt_dict_get_or_null(cpu_set, elm);
-      
-      xbt_assert1(host, "Host %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); 
-   }
+static void add_traces_cpu(void)
+{
+  xbt_dict_cursor_t cursor = NULL;
+  char *trace_name, *elm;
+
+  static int called = 0;
+
+  if (called)
+    return;
+  called = 1;
+
+
+  /* connect all traces relative to hosts */
+  xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    cpu_Cas01_t host = xbt_dict_get_or_null(cpu_set, elm);
+
+    xbt_assert1(host, "Host %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host);
+  }
+
+  xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    cpu_Cas01_t host = xbt_dict_get_or_null(cpu_set, elm);
+
+    xbt_assert1(host, "Host %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host);
+  }
 }
 
 static void define_callbacks(const char *file)
@@ -141,17 +143,17 @@ static const char *get_resource_name(void *resource_id)
 static int resource_used(void *resource_id)
 {
   return lmm_constraint_used(cpu_maxmin_system,
-                            ((cpu_Cas01_t) resource_id)->constraint);
+                             ((cpu_Cas01_t) resource_id)->constraint);
 }
 
 static int action_free(surf_action_t action)
 {
-  action->refcount --;
-  if (!action->refcount ) {
+  action->refcount--;
+  if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_cpu_Cas01_t) action)->variable)
       lmm_variable_free(cpu_maxmin_system,
-                       ((surf_action_cpu_Cas01_t) action)->variable);
+                        ((surf_action_cpu_Cas01_t) action)->variable);
     free(action);
     return 1;
   }
@@ -160,7 +162,7 @@ static int action_free(surf_action_t action)
 
 static void action_use(surf_action_t action)
 {
-  action->refcount ++;
+  action->refcount++;
 }
 
 static void action_cancel(surf_action_t action)
@@ -175,7 +177,7 @@ static void action_recycle(surf_action_t action)
 }
 
 static void action_change_state(surf_action_t action,
-                               e_surf_action_state_t state)
+                                e_surf_action_state_t state)
 {
 /*   if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
 /*     if(((surf_action_cpu_Cas01_t)action)->variable) { */
@@ -190,10 +192,10 @@ static void action_change_state(surf_action_t action,
 static double share_resources(double now)
 {
   s_surf_action_cpu_Cas01_t action;
-  return generic_maxmin_share_resources(surf_cpu_model->common_public->
-                                       states.running_action_set,
-                                       xbt_swag_offset(action, variable),
-                                       cpu_maxmin_system, lmm_solve);
+  return generic_maxmin_share_resources(surf_cpu_model->common_public->states.
+                                        running_action_set,
+                                        xbt_swag_offset(action, variable),
+                                        cpu_maxmin_system, lmm_solve);
 }
 
 static void update_actions_state(double now, double delta)
@@ -201,7 +203,7 @@ static void update_actions_state(double now, double delta)
   surf_action_cpu_Cas01_t action = NULL;
   surf_action_cpu_Cas01_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_cpu_model->common_public->states.running_action_set;
+    surf_cpu_model->common_public->states.running_action_set;
   /* FIXME: UNUSED
      xbt_swag_t failed_actions =
      surf_cpu_model->common_public->states.failed_action_set;
@@ -209,15 +211,15 @@ static void update_actions_state(double now, double delta)
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
     double_update(&(action->generic_action.remains),
-                 lmm_variable_getvalue(action->variable) * delta);
+                  lmm_variable_getvalue(action->variable) * delta);
     if (action->generic_action.max_duration != NO_MAX_DURATION)
       double_update(&(action->generic_action.max_duration), delta);
     if ((action->generic_action.remains <= 0) &&
-       (lmm_get_variable_weight(action->variable) > 0)) {
+        (lmm_get_variable_weight(action->variable) > 0)) {
       action->generic_action.finish = surf_get_clock();
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     } else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
-              (action->generic_action.max_duration <= 0)) {
+               (action->generic_action.max_duration <= 0)) {
       action->generic_action.finish = surf_get_clock();
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     }
@@ -227,15 +229,15 @@ static void update_actions_state(double now, double delta)
 }
 
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double date)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double date)
 {
   cpu_Cas01_t cpu = id;
 
   if (event_type == cpu->power_event) {
     cpu->power_current = value;
     lmm_update_constraint_bound(cpu_maxmin_system, cpu->constraint,
-                               cpu->power_current * cpu->power_scale);
+                                cpu->power_current * cpu->power_scale);
   } else if (event_type == cpu->state_event) {
     if (value > 0)
       cpu->state_current = SURF_CPU_ON;
@@ -246,15 +248,15 @@ static void update_resource_state(void *id,
 
       cpu->state_current = SURF_CPU_OFF;
 
-      while((var = lmm_get_var_from_cnst(cpu_maxmin_system,cnst,&elem))) {
-       surf_action_t action = lmm_variable_id(var) ;
+      while ((var = lmm_get_var_from_cnst(cpu_maxmin_system, cnst, &elem))) {
+        surf_action_t action = lmm_variable_id(var);
 
-       if(surf_action_get_state(action)==SURF_ACTION_RUNNING ||
-          surf_action_get_state(action)==SURF_ACTION_READY || 
-          surf_action_get_state(action)==SURF_ACTION_NOT_IN_THE_SYSTEM) {
-         action->finish = date;
-         action_change_state( action, SURF_ACTION_FAILED);
-       }
+        if (surf_action_get_state(action) == SURF_ACTION_RUNNING ||
+            surf_action_get_state(action) == SURF_ACTION_READY ||
+            surf_action_get_state(action) == SURF_ACTION_NOT_IN_THE_SYSTEM) {
+          action->finish = date;
+          action_change_state(action, SURF_ACTION_FAILED);
+        }
       }
     }
   } else {
@@ -273,30 +275,29 @@ static surf_action_t execute(void *cpu, double size)
   XBT_IN2("(%s,%g)", CPU->name, size);
   action = xbt_new0(s_surf_action_cpu_Cas01_t, 1);
 
-  action->generic_action.refcount  = 1;
+  action->generic_action.refcount = 1;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.priority = 1.0;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
-  action->generic_action.model_type =
-      (surf_model_t) surf_cpu_model;
-  action->suspended = 0;       /* Should be useless because of the 
-                                  calloc but it seems to help valgrind... */
+  action->generic_action.model_type = (surf_model_t) surf_cpu_model;
+  action->suspended = 0;        /* Should be useless because of the 
+                                   calloc but it seems to help valgrind... */
 
   if (CPU->state_current == SURF_CPU_ON)
     action->generic_action.state_set =
-       surf_cpu_model->common_public->states.running_action_set;
+      surf_cpu_model->common_public->states.running_action_set;
   else
     action->generic_action.state_set =
-       surf_cpu_model->common_public->states.failed_action_set;
+      surf_cpu_model->common_public->states.failed_action_set;
 
   xbt_swag_insert(action, action->generic_action.state_set);
 
   action->variable = lmm_variable_new(cpu_maxmin_system, action,
-                                     action->generic_action.priority,
-                                     -1.0, 1);
+                                      action->generic_action.priority,
+                                      -1.0, 1);
   lmm_expand(cpu_maxmin_system, CPU->constraint, action->variable, 1.0);
   XBT_OUT;
   return (surf_action_t) action;
@@ -306,19 +307,20 @@ static surf_action_t action_sleep(void *cpu, double duration)
 {
   surf_action_cpu_Cas01_t action = NULL;
 
-  if (duration>0)
-     duration=MAX(duration,MAXMIN_PRECISION);
+  if (duration > 0)
+    duration = MAX(duration, MAXMIN_PRECISION);
 
   XBT_IN2("(%s,%g)", ((cpu_Cas01_t) cpu)->name, duration);
   action = (surf_action_cpu_Cas01_t) execute(cpu, 1.0);
   action->generic_action.max_duration = duration;
   action->suspended = 2;
-  if(duration == NO_MAX_DURATION) {
+  if (duration == NO_MAX_DURATION) {
     /* Move to the *end* of the corresponding action set. This convention
        is used to speed up update_resource_state  */
-    xbt_swag_remove(action, ((surf_action_t)action)->state_set);
-    ((surf_action_t)action)->state_set =running_action_set_that_does_not_need_being_checked;
-    xbt_swag_insert(action, ((surf_action_t)action)->state_set);
+    xbt_swag_remove(action, ((surf_action_t) action)->state_set);
+    ((surf_action_t) action)->state_set =
+      running_action_set_that_does_not_need_being_checked;
+    xbt_swag_insert(action, ((surf_action_t) action)->state_set);
   }
 
   lmm_update_variable_weight(cpu_maxmin_system, action->variable, 0.0);
@@ -331,8 +333,8 @@ static void action_suspend(surf_action_t action)
   XBT_IN1("(%p)", action);
   if (((surf_action_cpu_Cas01_t) action)->suspended != 2) {
     lmm_update_variable_weight(cpu_maxmin_system,
-                              ((surf_action_cpu_Cas01_t) action)->
-                              variable, 0.0);
+                               ((surf_action_cpu_Cas01_t) action)->variable,
+                               0.0);
     ((surf_action_cpu_Cas01_t) action)->suspended = 1;
   }
   XBT_OUT;
@@ -343,8 +345,8 @@ static void action_resume(surf_action_t action)
   XBT_IN1("(%p)", action);
   if (((surf_action_cpu_Cas01_t) action)->suspended != 2) {
     lmm_update_variable_weight(cpu_maxmin_system,
-                              ((surf_action_cpu_Cas01_t) action)->
-                              variable, action->priority);
+                               ((surf_action_cpu_Cas01_t) action)->variable,
+                               action->priority);
     ((surf_action_cpu_Cas01_t) action)->suspended = 0;
   }
   XBT_OUT;
@@ -366,7 +368,9 @@ static void action_set_priority(surf_action_t action, double priority)
 {
   XBT_IN2("(%p,%g)", action, priority);
   action->priority = priority;
-  lmm_update_variable_weight(cpu_maxmin_system, ((surf_action_cpu_Cas01_t) action)->variable, priority);
+  lmm_update_variable_weight(cpu_maxmin_system,
+                             ((surf_action_cpu_Cas01_t) action)->variable,
+                             priority);
 
   XBT_OUT;
 }
@@ -389,7 +393,7 @@ static double get_available_speed(void *cpu)
 
 static xbt_dict_t get_properties(void *cpu)
 {
- return ((cpu_Cas01_t) cpu)->properties;
 return ((cpu_Cas01_t) cpu)->properties;
 }
 
 static void finalize(void)
@@ -398,10 +402,8 @@ static void finalize(void)
   lmm_system_free(cpu_maxmin_system);
   cpu_maxmin_system = NULL;
   xbt_swag_free(surf_cpu_model->common_public->states.ready_action_set);
-  xbt_swag_free(surf_cpu_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_cpu_model->common_public->states.
-               failed_action_set);
+  xbt_swag_free(surf_cpu_model->common_public->states.running_action_set);
+  xbt_swag_free(surf_cpu_model->common_public->states.failed_action_set);
   xbt_swag_free(surf_cpu_model->common_public->states.done_action_set);
   xbt_swag_free(running_action_set_that_does_not_need_being_checked);
   running_action_set_that_does_not_need_being_checked = NULL;
@@ -419,68 +421,64 @@ static void surf_cpu_model_init_internal(void)
 
   surf_cpu_model = xbt_new0(s_surf_cpu_model_t, 1);
 
-  surf_cpu_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
+  surf_cpu_model->common_private = xbt_new0(s_surf_model_private_t, 1);
   surf_cpu_model->common_public = xbt_new0(s_surf_model_public_t, 1);
 
   surf_cpu_model->extension_public =
-      xbt_new0(s_surf_cpu_model_extension_public_t, 1);
+    xbt_new0(s_surf_cpu_model_extension_public_t, 1);
 
   surf_cpu_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_cpu_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_cpu_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_cpu_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   running_action_set_that_does_not_need_being_checked =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_cpu_model->common_public->name_service = name_service;
   surf_cpu_model->common_public->get_resource_name = get_resource_name;
-  surf_cpu_model->common_public->action_get_state =
-      surf_action_get_state;
+  surf_cpu_model->common_public->action_get_state = surf_action_get_state;
   surf_cpu_model->common_public->action_get_start_time =
-      surf_action_get_start_time;
+    surf_action_get_start_time;
   surf_cpu_model->common_public->action_get_finish_time =
-      surf_action_get_finish_time;
+    surf_action_get_finish_time;
   surf_cpu_model->common_public->action_free = action_free;
   surf_cpu_model->common_public->action_use = action_use;
   surf_cpu_model->common_public->action_cancel = action_cancel;
   surf_cpu_model->common_public->action_recycle = action_recycle;
-  surf_cpu_model->common_public->action_change_state =
-      action_change_state;
+  surf_cpu_model->common_public->action_change_state = action_change_state;
   surf_cpu_model->common_public->action_set_data = surf_action_set_data;
   surf_cpu_model->common_public->name = "CPU";
 
   surf_cpu_model->common_private->resource_used = resource_used;
   surf_cpu_model->common_private->share_resources = share_resources;
-  surf_cpu_model->common_private->update_actions_state =
-      update_actions_state;
+  surf_cpu_model->common_private->update_actions_state = update_actions_state;
   surf_cpu_model->common_private->update_resource_state =
-      update_resource_state;
+    update_resource_state;
   surf_cpu_model->common_private->finalize = finalize;
 
   surf_cpu_model->common_public->suspend = action_suspend;
   surf_cpu_model->common_public->resume = action_resume;
   surf_cpu_model->common_public->is_suspended = action_is_suspended;
-  surf_cpu_model->common_public->set_max_duration =
-      action_set_max_duration;
+  surf_cpu_model->common_public->set_max_duration = action_set_max_duration;
   surf_cpu_model->common_public->set_priority = action_set_priority;
   surf_cpu_model->extension_public->execute = execute;
   surf_cpu_model->extension_public->sleep = action_sleep;
 
   surf_cpu_model->extension_public->get_state = get_state;
   surf_cpu_model->extension_public->get_speed = get_speed;
-  surf_cpu_model->extension_public->get_available_speed =
-      get_available_speed;
-  /*manage the properties of the cpu*/
+  surf_cpu_model->extension_public->get_available_speed = get_available_speed;
+  /*manage the properties of the cpu */
   surf_cpu_model->common_public->get_properties = get_properties;
 
-  if(!cpu_set) cpu_set = xbt_dict_new();
-  if (!cpu_maxmin_system) cpu_maxmin_system = lmm_system_new();
+  if (!cpu_set)
+    cpu_set = xbt_dict_new();
+  if (!cpu_maxmin_system)
+    cpu_maxmin_system = lmm_system_new();
 }
 
 /*********************************************************************/
index 63017a4..b81db85 100644 (file)
 typedef struct surf_action_cpu_Cas01 {
   s_surf_action_t generic_action;
   lmm_variable_t variable;
-  int suspended;  
+  int suspended;
 } s_surf_action_cpu_Cas01_t, *surf_action_cpu_Cas01_t;
 
 typedef struct cpu_Cas01 {
-  surf_model_t model;  /* Any such object, added in a trace
-                                  should start by this field!!! */
+  surf_model_t model;           /* Any such object, added in a trace
+                                   should start by this field!!! */
   char *name;
   double power_scale;
   double power_current;
@@ -27,10 +27,10 @@ typedef struct cpu_Cas01 {
   e_surf_cpu_state_t state_current;
   tmgr_trace_event_t state_event;
   lmm_constraint_t constraint;
-  /*Handles the properties that can be added to cpu's*/
+  /*Handles the properties that can be added to cpu's */
   xbt_dict_t properties;
 } s_cpu_Cas01_t, *cpu_Cas01_t;
 
 extern xbt_dict_t cpu_set;
 
-#endif                         /* _SURF_CPU_PRIVATE_H */
+#endif /* _SURF_CPU_PRIVATE_H */
index fafcbd2..47c070b 100644 (file)
@@ -38,26 +38,28 @@ void bottleneck_solve(lmm_system_t sys)
 
   /* Init */
   xbt_swag_init(&(cnst_to_update),
-               xbt_swag_offset(s_cnst, saturated_constraint_set_hookup));
+                xbt_swag_offset(s_cnst, saturated_constraint_set_hookup));
 
   var_list = &(sys->variable_set);
   DEBUG1("Variable set : %d", xbt_swag_size(var_list));
   xbt_swag_foreach(var, var_list) {
     int nb = 0;
     var->value = 0.0;
-    DEBUG1("Handling variable %p",var);
+    DEBUG1("Handling variable %p", var);
     xbt_swag_insert(var, &(sys->saturated_variable_set));
     for (i = 0; i < var->cnsts_number; i++) {
       if (var->cnsts[i].value == 0.0)
-       nb++;
+        nb++;
     }
     if ((nb == var->cnsts_number) && (var->weight > 0.0)) {
-      DEBUG1("Err, finally, there is no need to take care of variable %p",var);
+      DEBUG1("Err, finally, there is no need to take care of variable %p",
+             var);
       xbt_swag_remove(var, &(sys->saturated_variable_set));
       var->value = 1.0;
     }
     if (var->weight <= 0.0) {
-      DEBUG1("Err, finally, there is no need to take care of variable %p",var);
+      DEBUG1("Err, finally, there is no need to take care of variable %p",
+             var);
       xbt_swag_remove(var, &(sys->saturated_variable_set));
     }
   }
@@ -85,7 +87,7 @@ void bottleneck_solve(lmm_system_t sys)
       lmm_print(sys);
     }
     DEBUG1("******* Constraints to process: %d *******",
-          xbt_swag_size(cnst_list));
+           xbt_swag_size(cnst_list));
     min_usage = -1;
     xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) {
       int nb = 0;
@@ -93,40 +95,38 @@ void bottleneck_solve(lmm_system_t sys)
       elem_list = &(cnst->element_set);
       cnst->usage = 0.0;
       xbt_swag_foreach(elem, elem_list) {
-       if (elem->variable->weight <= 0)
-         break;
-       if ((elem->value > 0) &&
-           xbt_swag_belongs(elem->variable, var_list))
-         nb++;
+        if (elem->variable->weight <= 0)
+          break;
+        if ((elem->value > 0) && xbt_swag_belongs(elem->variable, var_list))
+          nb++;
       }
       DEBUG1("\tThere are %d variables", nb);
       if (nb > 0 && !cnst->shared)
-       nb = 1;
+        nb = 1;
       if (!nb) {
-       cnst->remaining = 0.0;
-       cnst->usage = cnst->remaining;
-       xbt_swag_remove(cnst, cnst_list);
-       continue;
+        cnst->remaining = 0.0;
+        cnst->usage = cnst->remaining;
+        xbt_swag_remove(cnst, cnst_list);
+        continue;
       }
       cnst->usage = cnst->remaining / nb;
       DEBUG3("\tConstraint Usage %p : %f with %d variables", cnst,
-            cnst->usage, nb);
+             cnst->usage, nb);
     }
 
     xbt_swag_foreach_safe(var, var_next, var_list) {
-      double min_inc = var->cnsts[0].constraint->usage /
-         var->cnsts[0].value;
+      double min_inc = var->cnsts[0].constraint->usage / var->cnsts[0].value;
       for (i = 1; i < var->cnsts_number; i++) {
-       lmm_element_t elm = &var->cnsts[i];
-       min_inc = MIN(min_inc, elm->constraint->usage / elm->value);
+        lmm_element_t elm = &var->cnsts[i];
+        min_inc = MIN(min_inc, elm->constraint->usage / elm->value);
       }
       if (var->bound > 0)
-       min_inc = MIN(min_inc, var->bound - var->value);
+        min_inc = MIN(min_inc, var->bound - var->value);
       var->mu = min_inc;
       DEBUG2("Updating variable %p maximum increment: %g", var, var->mu);
       var->value += var->mu;
       if (var->value == var->bound) {
-       xbt_swag_remove(var, var_list);
+        xbt_swag_remove(var, var_list);
       }
     }
 
@@ -134,41 +134,39 @@ void bottleneck_solve(lmm_system_t sys)
       DEBUG1("Updating cnst %p ", cnst);
       elem_list = &(cnst->element_set);
       xbt_swag_foreach(elem, elem_list) {
-       if (elem->variable->weight <= 0)
-         break;
-       if (cnst->shared) {
-         DEBUG4("\tUpdate constraint %p (%g) with variable %p by %g",
-                cnst, cnst->remaining, elem->variable,
-                elem->variable->mu);
-         double_update(&(cnst->remaining),
-                       elem->value * elem->variable->mu);
-       } else {
-         DEBUG4
-             ("\tNon-Shared variable. Update constraint usage of %p (%g) with variable %p by %g",
-              cnst, cnst->usage, elem->variable, elem->variable->mu);
-         cnst->usage = MIN(cnst->usage, elem->value * elem->variable->mu);
-       }
+        if (elem->variable->weight <= 0)
+          break;
+        if (cnst->shared) {
+          DEBUG4("\tUpdate constraint %p (%g) with variable %p by %g",
+                 cnst, cnst->remaining, elem->variable, elem->variable->mu);
+          double_update(&(cnst->remaining), elem->value * elem->variable->mu);
+        } else {
+          DEBUG4
+            ("\tNon-Shared variable. Update constraint usage of %p (%g) with variable %p by %g",
+             cnst, cnst->usage, elem->variable, elem->variable->mu);
+          cnst->usage = MIN(cnst->usage, elem->value * elem->variable->mu);
+        }
       }
       if (!cnst->shared) {
-       DEBUG3("\tUpdate constraint %p (%g) by %g",
-              cnst, cnst->remaining, cnst->usage);
+        DEBUG3("\tUpdate constraint %p (%g) by %g",
+               cnst, cnst->remaining, cnst->usage);
 
-       double_update(&(cnst->remaining), cnst->usage);
+        double_update(&(cnst->remaining), cnst->usage);
       }
 
       DEBUG2("\tRemaining for %p : %g", cnst, cnst->remaining);
       if (cnst->remaining == 0.0) {
-       DEBUG1("\tGet rid of constraint %p", cnst);
-
-       xbt_swag_remove(cnst, cnst_list);
-       xbt_swag_foreach(elem, elem_list) {
-         if (elem->variable->weight <= 0)
-           break;
-         if (elem->value > 0) {
-           DEBUG1("\t\tGet rid of variable %p", elem->variable);
-           xbt_swag_remove(elem->variable, var_list);
-         }
-       }
+        DEBUG1("\tGet rid of constraint %p", cnst);
+
+        xbt_swag_remove(cnst, cnst_list);
+        xbt_swag_foreach(elem, elem_list) {
+          if (elem->variable->weight <= 0)
+            break;
+          if (elem->value > 0) {
+            DEBUG1("\t\tGet rid of variable %p", elem->variable);
+            xbt_swag_remove(elem->variable, var_list);
+          }
+        }
       }
     }
   } while (xbt_swag_size(var_list));
index c1955ff..8ab44e2 100644 (file)
 #ifdef __cplusplus
 extern "C" {
 #endif
-  
+
   int gtnets_initialize();
   int gtnets_add_link(int id, double bandwidth, double latency);
-  int gtnets_add_route(int src, int dst, intlinks, int nlink);
+  int gtnets_add_route(int src, int dst, int *links, int nlink);
   int gtnets_add_router(int id);
   int gtnets_add_onehop_route(int src, int dst, int link);
-  int gtnets_create_flow(int src, int dst, long datasize, voidmetadata);
+  int gtnets_create_flow(int src, int dst, long datasize, void *metadata);
   double gtnets_get_time_to_next_flow_completion();
-  int gtnets_run_until_next_flow_completion(void*** metadata, int* number_of_flows);
+  int gtnets_run_until_next_flow_completion(void ***metadata,
+                                            int *number_of_flows);
   double gtnets_get_flow_rx(void *metadata);
 
   void gtnets_print_topology(void);
@@ -30,7 +31,4 @@ extern "C" {
 #ifdef __cplusplus
 }
 #endif
-
 #endif
-
-
index 2b870a1..15faec7 100644 (file)
 #include <map>
 
 //GTNetS include files
-#include "simulator.h"      // Definitions for the Simulator Object
-#include "node.h"           // Definitions for the Node Object
-#include "linkp2p.h"        // Definitions for point-to-point link objects
-#include "ratetimeparse.h"  // Definitions for Rate and Time objects
-#include "application-tcpserver.h" // Definitions for TCPServer application
-#include "application-tcpsend.h"   // Definitions for TCP Sending application
-#include "tcp-tahoe.h"      // Definitions for TCP Tahoe
+#include "simulator.h"          // Definitions for the Simulator Object
+#include "node.h"               // Definitions for the Node Object
+#include "linkp2p.h"            // Definitions for point-to-point link objects
+#include "ratetimeparse.h"      // Definitions for Rate and Time objects
+#include "application-tcpserver.h"      // Definitions for TCPServer application
+#include "application-tcpsend.h"        // Definitions for TCP Sending application
+#include "tcp-tahoe.h"          // Definitions for TCP Tahoe
 #include "tcp-reno.h"
 #include "tcp-newreno.h"
 #include "event.h"
@@ -35,14 +35,14 @@ class GTSim {
 public:
   GTSim();
   ~GTSim();
-public:   
+public:
   int add_link(int id, double bandwidth, double latency);
   int add_onehop_route(int src, int dst, int link);
-  int add_route(int src, int dst, intlinks, int nlink);
+  int add_route(int src, int dst, int *links, int nlink);
   int add_router(int id);
-  int create_flow(int src, int dst, long datasize, voidmetadata);
+  int create_flow(int src, int dst, long datasize, void *metadata);
   double get_time_to_next_flow_completion();
-  int run_until_next_flow_completion(void*** metadata, int* number_of_flows);
+  int run_until_next_flow_completion(void ***metadata, int *number_of_flows);
   int run(double deltat);
   // returns the total received by the TCPServer peer of the given action
   double gtnets_get_flow_rx(void *metadata);
@@ -54,25 +54,23 @@ private:
 
   bool node_include(int);
   bool link_include(int);
-  Simulatorsim_;
-  GTNETS_Topologytopo_;
-  RoutingManualrm_;
+  Simulator *sim_;
+  GTNETS_Topology *topo_;
+  RoutingManual *rm_;
   int nnode_;
   int is_topology_;
   int nflow_;
 
-  map<int, TCPServer*> gtnets_servers_;
-  map<int, TCPSend*>   gtnets_clients_;
-  map<int, Linkp2p*>   gtnets_links_;
-  map<int, Node*>      gtnets_nodes_;
+    map < int, TCPServer * >gtnets_servers_;
+    map < int, TCPSend * >gtnets_clients_;
+    map < int, Linkp2p * >gtnets_links_;
+    map < int, Node * >gtnets_nodes_;
   //added by pedro in order to get statistics
-  map<void*, int>      gtnets_action_to_flow_;
+    map < void *, int >gtnets_action_to_flow_;
 
-  map<int, void*>      gtnets_metadata_;
+    map < int, void *>gtnets_metadata_;
 };
 
 #endif /* __cplusplus */
 
 #endif
-
-
index b233d7e..f3a2bcc 100644 (file)
@@ -18,47 +18,51 @@ using namespace std;
 
 class GTNETS_Link;
 
-class GTNETS_Node{
+class GTNETS_Node {
 
- public:
+public:
   GTNETS_Node(int);
-  GTNETS_Node(const GTNETS_Node& node);
-  ~GTNETS_Node();
+    GTNETS_Node(const GTNETS_Node & node);
+   ~GTNETS_Node();
 
   int add_host(int);
   int add_router(int);
-  int id(){return ID_;};
+  int id() {
+    return ID_;
+  };
   bool is_router();
   bool include(int);
   void print_hosts();
 
- private:
+private:
   int ID_;
   int is_router_;
-  set<int> hosts_; //simgrid hosts
+  set < int >hosts_;            //simgrid hosts
 };
 
-class GTNETS_Link{
+class GTNETS_Link {
 
- public:
+public:
   GTNETS_Link();
   GTNETS_Link(int id);
-  GTNETS_Link(const GTNETS_Link&);
-  ~GTNETS_Link();
+    GTNETS_Link(const GTNETS_Link &);
+   ~GTNETS_Link();
 
-  GTNETS_Nodesrc_node();
-  GTNETS_Nodedst_node();
+  GTNETS_Node *src_node();
+  GTNETS_Node *dst_node();
   int peer_node(int);
-  int id(){return ID_;};
+  int id() {
+    return ID_;
+  };
   void print_link_status();
-  int add_src(GTNETS_Node*);
-  int add_dst(GTNETS_Node*);
+  int add_src(GTNETS_Node *);
+  int add_dst(GTNETS_Node *);
   bool route_exists();
 
- private:
+private:
   int ID_;
-  GTNETS_Nodesrc_node_;
-  GTNETS_Nodedst_node_;
+  GTNETS_Node *src_node_;
+  GTNETS_Node *dst_node_;
 
 };
 
@@ -66,8 +70,8 @@ class GTNETS_Link{
 // 1. add links
 // 2. add routers
 // 3. add onehop links
-class GTNETS_Topology{
- public:
+class GTNETS_Topology {
+public:
   GTNETS_Topology();
   ~GTNETS_Topology();
 
@@ -76,23 +80,23 @@ class GTNETS_Topology{
   int add_link(int id);
   int add_router(int id);
   int add_onehop_route(int src, int dst, int link);
-  
+
   int nodeid_from_hostid(int);
   int link_size();
   int node_size();
   void print_topology();
-  const vector<GTNETS_Node*>& nodes();
-  const map<int, GTNETS_Link*>& links();
-  
- private:
+  const vector < GTNETS_Node * >&nodes();
+  const map < int, GTNETS_Link * >&links();
+
+private:
 
   int nodeID_;
-  map<int, GTNETS_Link*> links_;
-  vector<GTNETS_Node*> nodes_;
+    map < int, GTNETS_Link * >links_;
+    vector < GTNETS_Node * >nodes_;
 
-  map<int, int> hosts_; //hostid->nodeid
+    map < int, int >hosts_;     //hostid->nodeid
 
-  set<int> routers_;
+    set < int >routers_;
 };
 
 #endif
index a9a1535..24f308e 100644 (file)
@@ -17,9 +17,9 @@
 #endif
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_lagrange, surf,
-                               "Logging specific to SURF (lagrange)");
+                                "Logging specific to SURF (lagrange)");
 XBT_LOG_NEW_SUBCATEGORY(surf_lagrange_dichotomy, surf_lagrange,
-                       "Logging specific to SURF (lagrange dichotomy)");
+                        "Logging specific to SURF (lagrange dichotomy)");
 
 #define SHOW_EXPR(expr) CDEBUG1(surf_lagrange,#expr " = %g",expr);
 
@@ -34,14 +34,14 @@ double (*func_fpi_def) (lmm_variable_t, double);
 void lagrange_solve(lmm_system_t sys);
 //computes the value of the dichotomy using a initial values, init, with a specific variable or constraint
 static double dichotomy(double init, double diff(double, void *),
-                       void *var_cnst, double min_error);
+                        void *var_cnst, double min_error);
 //computes the value of the differential of variable param_var applied to mu  
 static double partial_diff_mu(double mu, void *param_var);
 //computes the value of the differential of constraint param_cnst applied to lambda  
 static double partial_diff_lambda(double lambda, void *param_cnst);
 
 static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list,
-                           int warn)
+                            int warn)
 {
   xbt_swag_t elem_list = NULL;
   lmm_element_t elem = NULL;
@@ -56,20 +56,20 @@ static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list,
     xbt_swag_foreach(elem, elem_list) {
       var = elem->variable;
       if (var->weight <= 0)
-       continue;
+        continue;
       tmp += var->value;
     }
 
     if (double_positive(tmp - cnst->bound)) {
       if (warn)
-       WARN3
-           ("The link (%p) is over-used. Expected less than %f and got %f",
-            cnst, cnst->bound, tmp);
+        WARN3
+          ("The link (%p) is over-used. Expected less than %f and got %f",
+           cnst, cnst->bound, tmp);
       return 0;
     }
     DEBUG3
-       ("Checking feasability for constraint (%p): sat = %f, lambda = %f ",
-        cnst, tmp - cnst->bound, cnst->lambda);
+      ("Checking feasability for constraint (%p): sat = %f, lambda = %f ",
+       cnst, tmp - cnst->bound, cnst->lambda);
   }
 
   xbt_swag_foreach(var, var_list) {
@@ -78,13 +78,13 @@ static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list,
     if (var->bound < 0)
       continue;
     DEBUG3("Checking feasability for variable (%p): sat = %f mu = %f", var,
-          var->value - var->bound, var->mu);
+           var->value - var->bound, var->mu);
 
     if (double_positive(var->value - var->bound)) {
       if (warn)
-       WARN3
-           ("The variable (%p) is too large. Expected less than %f and got %f",
-            var, var->bound, var->value);
+        WARN3
+          ("The variable (%p) is too large. Expected less than %f and got %f",
+           var, var->bound, var->value);
       return 0;
     }
   }
@@ -101,7 +101,8 @@ static double new_value(lmm_variable_t var)
   }
   if (var->bound > 0)
     tmp += var->mu;
-  DEBUG3("\t Working on var (%p). cost = %e; Weight = %e", var, tmp, var->weight);
+  DEBUG3("\t Working on var (%p). cost = %e; Weight = %e", var, tmp,
+         var->weight);
   //uses the partial differential inverse function
   return var->func_fpi(var, tmp);
 }
@@ -144,14 +145,14 @@ static double dual_objective(xbt_swag_t var_list, xbt_swag_t cnst_list)
     DEBUG2("var %p : sigma_i = %1.20f", var, sigma_i);
 
     obj += var->func_f(var, var->func_fpi(var, sigma_i)) -
-       sigma_i * var->func_fpi(var, sigma_i);
+      sigma_i * var->func_fpi(var, sigma_i);
 
     if (var->bound > 0)
       obj += var->mu * var->bound;
   }
 
   xbt_swag_foreach(cnst, cnst_list)
-      obj += cnst->lambda * cnst->bound;
+    obj += cnst->lambda * cnst->bound;
 
   return obj;
 }
@@ -186,10 +187,9 @@ void lagrange_solve(lmm_system_t sys)
 
   DEBUG0("Iterative method configuration snapshot =====>");
   DEBUG1("#### Maximum number of iterations       : %d", max_iterations);
-  DEBUG1("#### Minimum error tolerated            : %e",
-        epsilon_min_error);
+  DEBUG1("#### Minimum error tolerated            : %e", epsilon_min_error);
   DEBUG1("#### Minimum error tolerated (dichotomy) : %e",
-        dichotomy_min_error);
+         dichotomy_min_error);
 
   if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
     lmm_print(sys);
@@ -221,22 +221,24 @@ void lagrange_solve(lmm_system_t sys)
     else {
       int nb = 0;
       if (var->bound < 0.0) {
-       DEBUG1("#### NOTE var(%d) is a boundless variable", i);
-       var->mu = -1.0;
-       var->value = new_value(var);
+        DEBUG1("#### NOTE var(%d) is a boundless variable", i);
+        var->mu = -1.0;
+        var->value = new_value(var);
       } else {
-       var->mu = 1.0;
-       var->new_mu = 2.0;
-       var->value = new_value(var);
+        var->mu = 1.0;
+        var->new_mu = 2.0;
+        var->value = new_value(var);
       }
       DEBUG2("#### var(%p) ->weight :  %e", var, var->weight);
       DEBUG2("#### var(%p) ->mu :  %e", var, var->mu);
       DEBUG2("#### var(%p) ->weight: %e", var, var->weight);
       DEBUG2("#### var(%p) ->bound: %e", var, var->bound);
       for (i = 0; i < var->cnsts_number; i++) {
-       if(var->cnsts[i].value==0.0) nb++;
+        if (var->cnsts[i].value == 0.0)
+          nb++;
       }
-      if(nb==var->cnsts_number) var->value = 1.0;
+      if (nb == var->cnsts_number)
+        var->value = 1.0;
     }
   }
 
@@ -249,7 +251,7 @@ void lagrange_solve(lmm_system_t sys)
    * While doesn't reach a minimun error or a number maximum of iterations.
    */
   while (overall_modification > epsilon_min_error
-        && iteration < max_iterations) {
+         && iteration < max_iterations) {
 /*     int dual_updated=0; */
 
     iteration++;
@@ -261,22 +263,22 @@ void lagrange_solve(lmm_system_t sys)
      */
     xbt_swag_foreach(var, var_list) {
       if (!var->weight)
-       break;
+        break;
       if (var->bound >= 0) {
-       DEBUG1("Working on var (%p)", var);
-       var->new_mu = new_mu(var);
+        DEBUG1("Working on var (%p)", var);
+        var->new_mu = new_mu(var);
 /*     dual_updated += (fabs(var->new_mu-var->mu)>dichotomy_min_error); */
 /*     DEBUG2("dual_updated (%d) : %1.20f",dual_updated,fabs(var->new_mu-var->mu)); */
-       DEBUG3("Updating mu : var->mu (%p) : %1.20f -> %1.20f", var,
-              var->mu, var->new_mu);
-       var->mu = var->new_mu;
-
-       new_obj = dual_objective(var_list, cnst_list);
-       DEBUG3("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
-              obj - new_obj);
-       xbt_assert1(obj - new_obj >= -epsilon_min_error,
-                   "Our gradient sucks! (%1.20f)", obj - new_obj);
-       obj = new_obj;
+        DEBUG3("Updating mu : var->mu (%p) : %1.20f -> %1.20f", var,
+               var->mu, var->new_mu);
+        var->mu = var->new_mu;
+
+        new_obj = dual_objective(var_list, cnst_list);
+        DEBUG3("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
+               obj - new_obj);
+        xbt_assert1(obj - new_obj >= -epsilon_min_error,
+                    "Our gradient sucks! (%1.20f)", obj - new_obj);
+        obj = new_obj;
       }
     }
 
@@ -286,19 +288,19 @@ void lagrange_solve(lmm_system_t sys)
     xbt_swag_foreach(cnst, cnst_list) {
       DEBUG1("Working on cnst (%p)", cnst);
       cnst->new_lambda =
-         dichotomy(cnst->lambda, partial_diff_lambda, cnst,
-                   dichotomy_min_error);
+        dichotomy(cnst->lambda, partial_diff_lambda, cnst,
+                  dichotomy_min_error);
 /*       dual_updated += (fabs(cnst->new_lambda-cnst->lambda)>dichotomy_min_error); */
 /*       DEBUG2("dual_updated (%d) : %1.20f",dual_updated,fabs(cnst->new_lambda-cnst->lambda)); */
       DEBUG3("Updating lambda : cnst->lambda (%p) : %1.20f -> %1.20f",
-            cnst, cnst->lambda, cnst->new_lambda);
+             cnst, cnst->lambda, cnst->new_lambda);
       cnst->lambda = cnst->new_lambda;
 
       new_obj = dual_objective(var_list, cnst_list);
       DEBUG3("Improvement for Objective (%g -> %g) : %g", obj, new_obj,
-            obj - new_obj);
+             obj - new_obj);
       xbt_assert1(obj - new_obj >= -epsilon_min_error,
-                 "Our gradient sucks! (%1.20f)", obj - new_obj);
+                  "Our gradient sucks! (%1.20f)", obj - new_obj);
       obj = new_obj;
     }
 
@@ -310,16 +312,16 @@ void lagrange_solve(lmm_system_t sys)
     overall_modification = 0;
     xbt_swag_foreach(var, var_list) {
       if (var->weight <= 0)
-       var->value = 0.0;
+        var->value = 0.0;
       else {
-       tmp = new_value(var);
+        tmp = new_value(var);
 
-       overall_modification =
-           MAX(overall_modification, fabs(var->value - tmp));
+        overall_modification =
+          MAX(overall_modification, fabs(var->value - tmp));
 
-       var->value = tmp;
-       DEBUG3("New value of var (%p)  = %e, overall_modification = %e",
-              var, var->value, overall_modification);
+        var->value = tmp;
+        DEBUG3("New value of var (%p)  = %e, overall_modification = %e",
+               var, var->value, overall_modification);
       }
     }
 
@@ -327,7 +329,7 @@ void lagrange_solve(lmm_system_t sys)
     if (!__check_feasible(cnst_list, var_list, 0))
       overall_modification = 1.0;
     DEBUG2("Iteration %d: overall_modification : %f", iteration,
-          overall_modification);
+           overall_modification);
 /*     if(!dual_updated) { */
 /*       WARN1("Could not improve the convergence at iteration %d. Drop it!",iteration); */
 /*       break; */
@@ -341,8 +343,8 @@ void lagrange_solve(lmm_system_t sys)
   }
   if (iteration >= max_iterations) {
     DEBUG1
-       ("Method reach %d iterations, which is the maximum number of iterations allowed.",
-        iteration);
+      ("Method reach %d iterations, which is the maximum number of iterations allowed.",
+       iteration);
   }
 /*   INFO1("Method converged after %d iterations", iteration); */
 
@@ -364,7 +366,7 @@ void lagrange_solve(lmm_system_t sys)
  * @return a double correponding to the result of the dichotomyal process
  */
 static double dichotomy(double init, double diff(double, void *),
-                       void *var_cnst, double min_error)
+                        void *var_cnst, double min_error)
 {
   double min, max;
   double overall_error;
@@ -393,57 +395,56 @@ static double dichotomy(double init, double diff(double, void *),
 
   while (overall_error > min_error) {
     CDEBUG4(surf_lagrange_dichotomy,
-           "[min, max] = [%1.20f, %1.20f] || diffmin, diffmax = %1.20f, %1.20f",
-           min, max, min_diff, max_diff);
+            "[min, max] = [%1.20f, %1.20f] || diffmin, diffmax = %1.20f, %1.20f",
+            min, max, min_diff, max_diff);
 
     if (min_diff > 0 && max_diff > 0) {
       if (min == max) {
-       CDEBUG0(surf_lagrange_dichotomy, "Decreasing min");
-       min = min / 2.0;
-       min_diff = diff(min, var_cnst);
+        CDEBUG0(surf_lagrange_dichotomy, "Decreasing min");
+        min = min / 2.0;
+        min_diff = diff(min, var_cnst);
       } else {
-       CDEBUG0(surf_lagrange_dichotomy, "Decreasing max");
-       max = min;
-       max_diff = min_diff;
+        CDEBUG0(surf_lagrange_dichotomy, "Decreasing max");
+        max = min;
+        max_diff = min_diff;
       }
     } else if (min_diff < 0 && max_diff < 0) {
       if (min == max) {
-       CDEBUG0(surf_lagrange_dichotomy, "Increasing max");
-       max = max * 2.0;
-       max_diff = diff(max, var_cnst);
+        CDEBUG0(surf_lagrange_dichotomy, "Increasing max");
+        max = max * 2.0;
+        max_diff = diff(max, var_cnst);
       } else {
-       CDEBUG0(surf_lagrange_dichotomy, "Increasing min");
-       min = max;
-       min_diff = max_diff;
+        CDEBUG0(surf_lagrange_dichotomy, "Increasing min");
+        min = max;
+        min_diff = max_diff;
       }
     } else if (min_diff < 0 && max_diff > 0) {
       middle = (max + min) / 2.0;
-      CDEBUG1(surf_lagrange_dichotomy, "Trying (max+min)/2 : %1.20f",
-             middle);
+      CDEBUG1(surf_lagrange_dichotomy, "Trying (max+min)/2 : %1.20f", middle);
 
       if ((min == middle) || (max == middle)) {
-       CWARN4(surf_lagrange_dichotomy,
-              "Cannot improve the convergence! min=max=middle=%1.20f, diff = %1.20f."
-              " Reaching the 'double' limits. Maybe scaling your function would help ([%1.20f,%1.20f]).",
-              min, max - min, min_diff, max_diff);
-       break;
+        CWARN4(surf_lagrange_dichotomy,
+               "Cannot improve the convergence! min=max=middle=%1.20f, diff = %1.20f."
+               " Reaching the 'double' limits. Maybe scaling your function would help ([%1.20f,%1.20f]).",
+               min, max - min, min_diff, max_diff);
+        break;
       }
       middle_diff = diff(middle, var_cnst);
 
       if (middle_diff < 0) {
-       CDEBUG0(surf_lagrange_dichotomy, "Increasing min");
-       min = middle;
-       overall_error = max_diff - middle_diff;
-       min_diff = middle_diff;
+        CDEBUG0(surf_lagrange_dichotomy, "Increasing min");
+        min = middle;
+        overall_error = max_diff - middle_diff;
+        min_diff = middle_diff;
 /*     SHOW_EXPR(overall_error); */
       } else if (middle_diff > 0) {
-       CDEBUG0(surf_lagrange_dichotomy, "Decreasing max");
-       max = middle;
-       overall_error = max_diff - middle_diff;
-       max_diff = middle_diff;
+        CDEBUG0(surf_lagrange_dichotomy, "Decreasing max");
+        max = middle;
+        overall_error = max_diff - middle_diff;
+        max_diff = middle_diff;
 /*     SHOW_EXPR(overall_error); */
       } else {
-       overall_error = 0;
+        overall_error = 0;
 /*     SHOW_EXPR(overall_error); */
       }
     } else if (min_diff == 0) {
@@ -456,12 +457,12 @@ static double dichotomy(double init, double diff(double, void *),
 /*       SHOW_EXPR(overall_error); */
     } else if (min_diff > 0 && max_diff < 0) {
       CWARN0(surf_lagrange_dichotomy,
-            "The impossible happened, partial_diff(min) > 0 && partial_diff(max) < 0");
+             "The impossible happened, partial_diff(min) > 0 && partial_diff(max) < 0");
       abort();
     } else {
       CWARN2(surf_lagrange_dichotomy,
-            "diffmin (%1.20f) or diffmax (%1.20f) are something I don't know, taking no action.",
-            min_diff, max_diff);
+             "diffmin (%1.20f) or diffmax (%1.20f) are something I don't know, taking no action.",
+             min_diff, max_diff);
       abort();
     }
   }
@@ -492,8 +493,7 @@ static double partial_diff_lambda(double lambda, void *param_cnst)
     if (var->weight <= 0)
       continue;
 
-    CDEBUG1(surf_lagrange_dichotomy, "Computing sigma_i for var (%p)",
-           var);
+    CDEBUG1(surf_lagrange_dichotomy, "Computing sigma_i for var (%p)", var);
     // Initialize the summation variable
     sigma_i = 0.0;
 
@@ -516,8 +516,8 @@ static double partial_diff_lambda(double lambda, void *param_cnst)
   diff += cnst->bound;
 
   CDEBUG3(surf_lagrange_dichotomy,
-         "d D/d lambda for cnst (%p) at %1.20f = %1.20f", cnst, lambda,
-         diff);
+          "d D/d lambda for cnst (%p) at %1.20f = %1.20f", cnst, lambda,
+          diff);
   XBT_OUT;
   return diff;
 }
@@ -529,13 +529,15 @@ static double partial_diff_lambda(double lambda, void *param_cnst)
  *  Set default functions to the ones passed as parameters. This is a polimorfism in C pure, enjoy the roots of programming.
  *
  */
-void
-lmm_set_default_protocol_function(double (*func_f)
-                                 (lmm_variable_t var, double x),
-                                 double (*func_fp) (lmm_variable_t var,
-                                                    double x),
-                                 double (*func_fpi) (lmm_variable_t var,
-                                                     double x))
+void lmm_set_default_protocol_function(double (*func_f)
+
+
+                                        
+                                       (lmm_variable_t var, double x),
+                                       double (*func_fp) (lmm_variable_t var,
+                                                          double x),
+                                       double (*func_fpi) (lmm_variable_t var,
+                                                           double x))
 {
   func_f_def = func_f;
   func_fp_def = func_fp;
@@ -585,7 +587,7 @@ double func_reno_f(lmm_variable_t var, double x)
   xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!");
 
   return RENO_SCALING * sqrt(3.0 / 2.0) / var->weight * atan(sqrt(3.0 / 2.0) *
-                                                        var->weight * x);
+                                                             var->weight * x);
 }
 
 double func_reno_fp(lmm_variable_t var, double x)
@@ -601,8 +603,8 @@ double func_reno_fpi(lmm_variable_t var, double x)
   xbt_assert0(x > 0.0, "Don't call me with stupid values!");
 
   res_fpi =
-      1.0 / (var->weight * var->weight * (x / RENO_SCALING)) -
-      2.0 / (3.0 * var->weight * var->weight);
+    1.0 / (var->weight * var->weight * (x / RENO_SCALING)) -
+    2.0 / (3.0 * var->weight * var->weight);
   if (res_fpi <= 0.0)
     return 0.0;
 /*   xbt_assert0(res_fpi>0.0,"Don't call me with stupid values!"); */
@@ -619,12 +621,15 @@ double func_reno_fpi(lmm_variable_t var, double x)
 double func_reno2_f(lmm_variable_t var, double x)
 {
   xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!");
-  return RENO2_SCALING * (1.0/var->weight) * log((x*var->weight)/(2.0*x*var->weight+3.0));
+  return RENO2_SCALING * (1.0 / var->weight) * log((x * var->weight) /
+                                                   (2.0 * x * var->weight +
+                                                    3.0));
 }
 
 double func_reno2_fp(lmm_variable_t var, double x)
 {
-  return RENO2_SCALING * 3.0/(var->weight*x*(2.0*var->weight*x+3.0));
+  return RENO2_SCALING * 3.0 / (var->weight * x *
+                                (2.0 * var->weight * x + 3.0));
 }
 
 double func_reno2_fpi(lmm_variable_t var, double x)
@@ -633,12 +638,12 @@ double func_reno2_fpi(lmm_variable_t var, double x)
   double tmp;
 
   xbt_assert0(x > 0.0, "Don't call me with stupid values!");
-  tmp= x*var->weight*var->weight;
-  res_fpi= tmp*(9.0*x+24.0);
-  
+  tmp = x * var->weight * var->weight;
+  res_fpi = tmp * (9.0 * x + 24.0);
+
   if (res_fpi <= 0.0)
     return 0.0;
 
-  res_fpi = RENO2_SCALING * (-3.0*tmp + sqrt(res_fpi))/(4.0*tmp);
+  res_fpi = RENO2_SCALING * (-3.0 * tmp + sqrt(res_fpi)) / (4.0 * tmp);
   return res_fpi;
 }
index 37c7f5e..26a77b1 100644 (file)
 #include "xbt/mallocator.h"
 #include "maxmin_private.h"
 #include <stdlib.h>
-#include <stdio.h> /* sprintf */
+#include <stdio.h>              /* sprintf */
 #include <math.h>
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf,
-                               "Logging specific to SURF (maxmin)");
+                                "Logging specific to SURF (maxmin)");
 
 static void *lmm_variable_mallocator_new_f(void);
 static void lmm_variable_mallocator_free_f(void *var);
@@ -30,22 +30,22 @@ lmm_system_t lmm_system_new(void)
 
   l->modified = 0;
   xbt_swag_init(&(l->variable_set),
-               xbt_swag_offset(var, variable_set_hookup));
+                xbt_swag_offset(var, variable_set_hookup));
   xbt_swag_init(&(l->constraint_set),
-               xbt_swag_offset(cnst, constraint_set_hookup));
+                xbt_swag_offset(cnst, constraint_set_hookup));
 
   xbt_swag_init(&(l->active_constraint_set),
-               xbt_swag_offset(cnst, active_constraint_set_hookup));
+                xbt_swag_offset(cnst, active_constraint_set_hookup));
 
   xbt_swag_init(&(l->saturated_variable_set),
-               xbt_swag_offset(var, saturated_variable_set_hookup));
+                xbt_swag_offset(var, saturated_variable_set_hookup));
   xbt_swag_init(&(l->saturated_constraint_set),
-               xbt_swag_offset(cnst, saturated_constraint_set_hookup));
+                xbt_swag_offset(cnst, saturated_constraint_set_hookup));
 
   l->variable_mallocator = xbt_mallocator_new(64,
-                                             lmm_variable_mallocator_new_f,
-                                             lmm_variable_mallocator_free_f,
-                                             lmm_variable_mallocator_reset_f);
+                                              lmm_variable_mallocator_new_f,
+                                              lmm_variable_mallocator_free_f,
+                                              lmm_variable_mallocator_reset_f);
 
   return l;
 }
@@ -101,7 +101,7 @@ static void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst)
 }
 
 lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id,
-                                   double bound_value)
+                                    double bound_value)
 {
   lmm_constraint_t cnst = NULL;
   s_lmm_element_t elem;
@@ -109,9 +109,9 @@ lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id,
   cnst = xbt_new0(s_lmm_constraint_t, 1);
   cnst->id = id;
   xbt_swag_init(&(cnst->element_set),
-               xbt_swag_offset(elem, element_set_hookup));
+                xbt_swag_offset(elem, element_set_hookup));
   xbt_swag_init(&(cnst->active_element_set),
-               xbt_swag_offset(elem, active_element_set_hookup));
+                xbt_swag_offset(elem, active_element_set_hookup));
 
   cnst->bound = bound_value;
   cnst->usage = 0;
@@ -154,14 +154,14 @@ static void lmm_variable_mallocator_reset_f(void *var)
 }
 
 lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id,
-                               double weight,
-                               double bound, int number_of_constraints)
+                                double weight,
+                                double bound, int number_of_constraints)
 {
   lmm_variable_t var = NULL;
   int i;
 
   XBT_IN5("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)",
-         sys, id, weight, bound, number_of_constraints);
+          sys, id, weight, bound, number_of_constraints);
 
   var = xbt_mallocator_get(sys->variable_mallocator);
   var->id = id;
@@ -178,8 +178,8 @@ lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id,
     var->cnsts[i].value = 0.0;
   }
   var->cnsts_size = number_of_constraints;
-  var->cnsts_number = 0;       /* Should be useless because of the 
-                                  calloc but it seems to help valgrind... */
+  var->cnsts_number = 0;        /* Should be useless because of the 
+                                   calloc but it seems to help valgrind... */
   var->weight = weight;
   var->bound = bound;
   var->value = 0.0;
@@ -214,7 +214,7 @@ double lmm_variable_getbound(lmm_variable_t var)
 }
 
 void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst,
-               lmm_variable_t var, double value)
+                lmm_variable_t var, double value)
 {
   lmm_element_t elem = NULL;
 
@@ -237,7 +237,7 @@ void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst,
 }
 
 void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst,
-                   lmm_variable_t var, double value)
+                    lmm_variable_t var, double value)
 {
   int i;
   sys->modified = 1;
@@ -247,14 +247,16 @@ void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst,
       break;
 
   if (i < var->cnsts_number) {
-    if(cnst->shared) var->cnsts[i].value += value;
-    else var->cnsts[i].value = MAX(var->cnsts[i].value,value);
-  }  else
+    if (cnst->shared)
+      var->cnsts[i].value += value;
+    else
+      var->cnsts[i].value = MAX(var->cnsts[i].value, value);
+  } else
     lmm_expand(sys, cnst, var, value);
 }
 
 void lmm_elem_set_value(lmm_system_t sys, lmm_constraint_t cnst,
-                       lmm_variable_t var, double value)
+                        lmm_variable_t var, double value)
 {
   int i;
 
@@ -270,7 +272,7 @@ void lmm_elem_set_value(lmm_system_t sys, lmm_constraint_t cnst,
 }
 
 lmm_constraint_t lmm_get_cnst_from_var(lmm_system_t sys,
-                                      lmm_variable_t var, int num)
+                                       lmm_variable_t var, int num)
 {
   if (num < var->cnsts_number)
     return (var->cnsts[num].constraint);
@@ -284,16 +286,16 @@ int lmm_get_number_of_cnst_from_var(lmm_system_t sys, lmm_variable_t var)
 }
 
 lmm_variable_t lmm_get_var_from_cnst(lmm_system_t sys,
-                                    lmm_constraint_t cnst,
-                                    lmm_element_t * elem)
+                                     lmm_constraint_t cnst,
+                                     lmm_element_t * elem)
 {
   if (!(*elem))
     *elem = xbt_swag_getFirst(&(cnst->element_set));
   else
     *elem = xbt_swag_getNext(*elem, cnst->element_set.offset);
-  if(*elem)
+  if (*elem)
     return (*elem)->variable;
-  else 
+  else
     return NULL;
 }
 
@@ -308,8 +310,8 @@ void *lmm_variable_id(lmm_variable_t var)
 }
 
 static void saturated_constraint_set_update(lmm_system_t sys,
-                                           lmm_constraint_t cnst,
-                                           double *min_usage)
+                                            lmm_constraint_t cnst,
+                                            double *min_usage)
 {
   lmm_constraint_t useless_cnst = NULL;
 
@@ -325,10 +327,10 @@ static void saturated_constraint_set_update(lmm_system_t sys,
   if ((*min_usage < 0) || (*min_usage > cnst->remaining / cnst->usage)) {
     *min_usage = cnst->remaining / cnst->usage;
     LOG3(xbt_log_priority_trace,
-        "min_usage=%f (cnst->remaining=%f, cnst->usage=%f)", *min_usage,
-        cnst->remaining, cnst->usage);
+         "min_usage=%f (cnst->remaining=%f, cnst->usage=%f)", *min_usage,
+         cnst->remaining, cnst->usage);
     while ((useless_cnst =
-           xbt_swag_getFirst(&(sys->saturated_constraint_set))))
+            xbt_swag_getFirst(&(sys->saturated_constraint_set))))
       xbt_swag_remove(useless_cnst, &(sys->saturated_constraint_set));
 
     xbt_swag_insert(cnst, &(sys->saturated_constraint_set));
@@ -350,9 +352,9 @@ static void saturated_variable_set_update(lmm_system_t sys)
     elem_list = &(cnst->active_element_set);
     xbt_swag_foreach(elem, elem_list) {
       if (elem->variable->weight <= 0)
-       break;
+        break;
       if ((elem->value > 0))
-       xbt_swag_insert(elem->variable, &(sys->saturated_variable_set));
+        xbt_swag_insert(elem->variable, &(sys->saturated_variable_set));
     }
     xbt_swag_remove(cnst, cnst_list);
   }
@@ -374,17 +376,17 @@ void lmm_print(lmm_system_t sys)
   var_list = &(sys->variable_set);
   sprintf(print_buf, "MAX-MIN ( ");
   trace_buf =
-      xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
+    xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
   strcat(trace_buf, print_buf);
   xbt_swag_foreach(var, var_list) {
     sprintf(print_buf, "'%p'(%f) ", var, var->weight);
     trace_buf =
-       xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
+      xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
     strcat(trace_buf, print_buf);
   }
   sprintf(print_buf, ")");
   trace_buf =
-      xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
+    xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
   strcat(trace_buf, print_buf);
   DEBUG1("%s", trace_buf);
   trace_buf[0] = '\000';
@@ -397,34 +399,32 @@ void lmm_print(lmm_system_t sys)
     elem_list = &(cnst->element_set);
     sprintf(print_buf, "\t");
     trace_buf =
-       xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
+      xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
     strcat(trace_buf, print_buf);
     xbt_swag_foreach(elem, elem_list) {
       sprintf(print_buf, "%f.'%p'(%f) + ", elem->value,
-             elem->variable, elem->variable->value);
+              elem->variable, elem->variable->value);
       trace_buf =
-         xbt_realloc(trace_buf,
-                     strlen(trace_buf) + strlen(print_buf) + 1);
+        xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
       strcat(trace_buf, print_buf);
       sum += elem->value * elem->variable->value;
     }
     sprintf(print_buf, "0 <= %f ('%p')", cnst->bound, cnst);
     trace_buf =
-       xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
+      xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
     strcat(trace_buf, print_buf);
 
     if (!cnst->shared) {
       sprintf(print_buf, " [MAX-Constraint]");
       trace_buf =
-         xbt_realloc(trace_buf,
-                     strlen(trace_buf) + strlen(print_buf) + 1);
+        xbt_realloc(trace_buf, strlen(trace_buf) + strlen(print_buf) + 1);
       strcat(trace_buf, print_buf);
     }
     DEBUG1("%s", trace_buf);
     trace_buf[0] = '\000';
     xbt_assert3(!double_positive(sum - cnst->bound),
-               "Incorrect value (%f is not smaller than %f): %g",
-               sum, cnst->bound, sum - cnst->bound);    
+                "Incorrect value (%f is not smaller than %f): %g",
+                sum, cnst->bound, sum - cnst->bound);
   }
 
   DEBUG0("Variables");
@@ -432,10 +432,10 @@ void lmm_print(lmm_system_t sys)
   xbt_swag_foreach(var, var_list) {
     if (var->bound > 0) {
       DEBUG4("'%p'(%f) : %f (<=%f)", var, var->weight, var->value,
-            var->bound);
+             var->bound);
       xbt_assert2(!double_positive(var->value - var->bound),
-                 "Incorrect value (%f is not smaller than %f",
-                 var->value, var->bound);
+                  "Incorrect value (%f is not smaller than %f",
+                  var->value, var->bound);
     } else
       DEBUG3("'%p'(%f) : %f", var, var->weight, var->value);
   }
@@ -461,14 +461,16 @@ void lmm_solve(lmm_system_t sys)
   var_list = &(sys->variable_set);
   DEBUG1("Variable set : %d", xbt_swag_size(var_list));
   xbt_swag_foreach(var, var_list) {
-    int nb=0;
+    int nb = 0;
     int i;
-    if(var->weight<=0.0) break;
+    if (var->weight <= 0.0)
+      break;
     var->value = 0.0;
     for (i = 0; i < var->cnsts_number; i++) {
-      if(var->cnsts[i].value==0.0) nb++;
+      if (var->cnsts[i].value == 0.0)
+        nb++;
     }
-    if((nb==var->cnsts_number) && (var->weight>0.0))
+    if ((nb == var->cnsts_number) && (var->weight > 0.0))
       var->value = 1.0;
   }
 
@@ -485,14 +487,14 @@ void lmm_solve(lmm_system_t sys)
     cnst->usage = 0.0;
     xbt_swag_foreach(elem, elem_list) {
       if (elem->variable->weight <= 0)
-       break;
+        break;
       if ((elem->value > 0)) {
-       if (cnst->shared)
-         cnst->usage += elem->value / elem->variable->weight;
-       else if (cnst->usage < elem->value / elem->variable->weight)
-         cnst->usage = elem->value / elem->variable->weight;
-       DEBUG2("Constraint Usage %p : %f", cnst, cnst->usage);
-       make_elem_active(elem);
+        if (cnst->shared)
+          cnst->usage += elem->value / elem->variable->weight;
+        else if (cnst->usage < elem->value / elem->variable->weight)
+          cnst->usage = elem->value / elem->variable->weight;
+        DEBUG2("Constraint Usage %p : %f", cnst, cnst->usage);
+        make_elem_active(elem);
       }
     }
     /* Saturated constraints update */
@@ -507,19 +509,19 @@ void lmm_solve(lmm_system_t sys)
     var_list = &(sys->saturated_variable_set);
 
     xbt_swag_foreach(var, var_list) {
-      if(var->weight<=0.0) DIE_IMPOSSIBLE;
+      if (var->weight <= 0.0)
+        DIE_IMPOSSIBLE;
       /* First check if some of these variables have reach their upper
          bound and update min_usage accordingly. */
       DEBUG5
-         ("var=%p, var->bound=%f, var->weight=%f, min_usage=%f, var->bound*var->weight=%f",
-          var, var->bound, var->weight, min_usage,
-          var->bound * var->weight);
+        ("var=%p, var->bound=%f, var->weight=%f, min_usage=%f, var->bound*var->weight=%f",
+         var, var->bound, var->weight, min_usage, var->bound * var->weight);
       if ((var->bound > 0) && (var->bound * var->weight < min_usage)) {
-       if(min_bound<0)
-         min_bound = var->bound;
-       else
-         min_bound = MIN(min_bound,var->bound);
-       DEBUG1("Updated min_bound=%f", min_bound);
+        if (min_bound < 0)
+          min_bound = var->bound;
+        else
+          min_bound = MIN(min_bound, var->bound);
+        DEBUG1("Updated min_bound=%f", min_bound);
       }
     }
 
@@ -527,45 +529,45 @@ void lmm_solve(lmm_system_t sys)
     while ((var = xbt_swag_getFirst(var_list))) {
       int i;
 
-      if(min_bound<0) {
-       var->value = min_usage / var->weight;
+      if (min_bound < 0) {
+        var->value = min_usage / var->weight;
       } else {
-       if(min_bound == var->bound)
-         var->value = var->bound;
-       else {
-         xbt_swag_remove(var, var_list);
-         continue;
-       }
+        if (min_bound == var->bound)
+          var->value = var->bound;
+        else {
+          xbt_swag_remove(var, var_list);
+          continue;
+        }
       }
       DEBUG5("Min usage: %f, Var(%p)->weight: %f, Var(%p)->value: %f ",
-            min_usage, var, var->weight, var, var->value);
+             min_usage, var, var->weight, var, var->value);
 
 
       /* Update usage */
 
       for (i = 0; i < var->cnsts_number; i++) {
-       elem = &var->cnsts[i];
-       cnst = elem->constraint;
-       if (cnst->shared) {
-         double_update(&(cnst->remaining), elem->value * var->value);
-         double_update(&(cnst->usage), elem->value / var->weight);
-         make_elem_inactive(elem);
-       } else {                /* FIXME one day: We recompute usage.... :( */
-         cnst->usage = 0.0;
-         make_elem_inactive(elem);
-         xbt_swag_foreach(elem, elem_list) {
-           if (elem->variable->weight <= 0)
-             break;
-           if (elem->variable->value > 0)
-             break;
-           if ((elem->value > 0)) {
-             if (cnst->usage < elem->value / elem->variable->weight)
-               cnst->usage = elem->value / elem->variable->weight;
-             DEBUG2("Constraint Usage %p : %f", cnst, cnst->usage);
-             make_elem_active(elem);
-           }
-         }
-       }
+        elem = &var->cnsts[i];
+        cnst = elem->constraint;
+        if (cnst->shared) {
+          double_update(&(cnst->remaining), elem->value * var->value);
+          double_update(&(cnst->usage), elem->value / var->weight);
+          make_elem_inactive(elem);
+        } else {                /* FIXME one day: We recompute usage.... :( */
+          cnst->usage = 0.0;
+          make_elem_inactive(elem);
+          xbt_swag_foreach(elem, elem_list) {
+            if (elem->variable->weight <= 0)
+              break;
+            if (elem->variable->value > 0)
+              break;
+            if ((elem->value > 0)) {
+              if (cnst->usage < elem->value / elem->variable->weight)
+                cnst->usage = elem->value / elem->variable->weight;
+              DEBUG2("Constraint Usage %p : %f", cnst, cnst->usage);
+              make_elem_active(elem);
+            }
+          }
+        }
       }
       xbt_swag_remove(var, var_list);
     }
@@ -590,7 +592,7 @@ void lmm_solve(lmm_system_t sys)
 /* Not a O(1) function */
 
 void lmm_update(lmm_system_t sys, lmm_constraint_t cnst,
-               lmm_variable_t var, double value)
+                lmm_variable_t var, double value)
 {
   int i;
 
@@ -615,7 +617,7 @@ void lmm_update(lmm_system_t sys, lmm_constraint_t cnst,
  *
  */
 void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
-                              double bound)
+                               double bound)
 {
   sys->modified = 1;
   var->bound = bound;
@@ -623,12 +625,13 @@ void lmm_update_variable_bound(lmm_system_t sys, lmm_variable_t var,
 
 
 void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
-                               double weight)
+                                double weight)
 {
   int i;
   lmm_element_t elem;
 
-  if(weight==var->weight) return;
+  if (weight == var->weight)
+    return;
   XBT_IN3("(sys=%p, var=%p, weight=%f)", sys, var, weight);
   sys->modified = 1;
   var->weight = weight;
@@ -646,7 +649,7 @@ void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var,
     else
       xbt_swag_insert_at_tail(elem, &(elem->constraint->element_set));
   }
-  if(!weight)
+  if (!weight)
     var->value = 0.0;
 
   XBT_OUT;
@@ -658,7 +661,7 @@ double lmm_get_variable_weight(lmm_variable_t var)
 }
 
 void lmm_update_constraint_bound(lmm_system_t sys, lmm_constraint_t cnst,
-                                double bound)
+                                 double bound)
 {
   sys->modified = 1;
   cnst->bound = bound;
@@ -675,7 +678,7 @@ lmm_constraint_t lmm_get_first_active_constraint(lmm_system_t sys)
 }
 
 lmm_constraint_t lmm_get_next_active_constraint(lmm_system_t sys,
-                                               lmm_constraint_t cnst)
+                                                lmm_constraint_t cnst)
 {
   return xbt_swag_getNext(cnst, (sys->active_constraint_set).offset);
 }
index 0049b7f..307519c 100644 (file)
@@ -30,8 +30,8 @@ typedef struct lmm_constraint {
   s_xbt_swag_hookup_t active_constraint_set_hookup;
   s_xbt_swag_hookup_t saturated_constraint_set_hookup;
 
-  s_xbt_swag_t element_set;    /* a list of lmm_mat_element_t */
-  s_xbt_swag_t active_element_set;     /* a list of lmm_mat_element_t */
+  s_xbt_swag_t element_set;     /* a list of lmm_mat_element_t */
+  s_xbt_swag_t active_element_set;      /* a list of lmm_mat_element_t */
   double bound;
   double lambda;
   double new_lambda;
@@ -53,25 +53,25 @@ typedef struct lmm_variable {
   double bound;
   double value;
   void *id;
-  int index; /* FOR SDP ONLY */
+  int index;                    /* FOR SDP ONLY */
   /* \begin{For Lagrange only} */
   double mu;
   double new_mu;
-  double (* func_f)  (struct lmm_variable *var, double x);  /* (f)    */
-  double (* func_fp)  (struct lmm_variable *var, double x);  /* (f')    */
-  double (* func_fpi)  (struct lmm_variable *var, double x);  /* (f')^{-1}    */
+  double (*func_f) (struct lmm_variable * var, double x);       /* (f)    */
+  double (*func_fp) (struct lmm_variable * var, double x);      /* (f')    */
+  double (*func_fpi) (struct lmm_variable * var, double x);     /* (f')^{-1}    */
   /* \end{For Lagrange only} */
 } s_lmm_variable_t;
 
 typedef struct lmm_system {
   int modified;
-  s_xbt_swag_t variable_set;   /* a list of lmm_variable_t */
-  s_xbt_swag_t constraint_set; /* a list of lmm_constraint_t */
+  s_xbt_swag_t variable_set;    /* a list of lmm_variable_t */
+  s_xbt_swag_t constraint_set;  /* a list of lmm_constraint_t */
 
-  s_xbt_swag_t active_constraint_set;  /* a list of lmm_constraint_t */
+  s_xbt_swag_t active_constraint_set;   /* a list of lmm_constraint_t */
 
-  s_xbt_swag_t saturated_variable_set; /* a list of lmm_variable_t */
-  s_xbt_swag_t saturated_constraint_set;       /* a list of lmm_constraint_t_t */
+  s_xbt_swag_t saturated_variable_set;  /* a list of lmm_variable_t */
+  s_xbt_swag_t saturated_constraint_set;        /* a list of lmm_constraint_t_t */
 
   xbt_mallocator_t variable_mallocator;
 } s_lmm_system_t;
@@ -92,8 +92,8 @@ static void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst);
 
 void lmm_print(lmm_system_t sys);
 
-extern double (* func_f_def )  (lmm_variable_t , double);
-extern double (* func_fp_def ) (lmm_variable_t , double);
-extern double (* func_fpi_def )(lmm_variable_t , double);
+extern double (*func_f_def) (lmm_variable_t, double);
+extern double (*func_fp_def) (lmm_variable_t, double);
+extern double (*func_fpi_def) (lmm_variable_t, double);
 
-#endif                         /* _SURF_MAXMIN_PRIVATE_H */
+#endif /* _SURF_MAXMIN_PRIVATE_H */
index aa60e98..1b960b7 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt/str.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
-                               "Logging specific to the SURF network module");
+                                "Logging specific to the SURF network module");
 
 surf_network_model_t surf_network_model = NULL;
 static lmm_system_t network_maxmin_system = NULL;
@@ -18,9 +18,9 @@ static void (*network_solve) (lmm_system_t) = NULL;
 xbt_dict_t link_set = NULL;
 xbt_dict_t network_card_set = NULL;
 
-double latency_factor = 1.0; /* default value */
-double bandwidth_factor = 1.0; /* default value */
-double weight_S_parameter = 0.0; /* default value */
+double latency_factor = 1.0;    /* default value */
+double bandwidth_factor = 1.0;  /* default value */
+double weight_S_parameter = 0.0;        /* default value */
 
 int card_number = 0;
 int host_number = 0;
@@ -30,51 +30,52 @@ static link_CM02_t loopback = NULL;
 
 static void create_routing_table(void)
 {
-  routing_table =
-      xbt_new0(link_CM02_t *, /*card_number * card_number */ host_number * host_number);
-  routing_table_size = xbt_new0(int, /*card_number * card_number*/ host_number * host_number);
+  routing_table = xbt_new0(link_CM02_t *,       /*card_number * card_number */
+                           host_number * host_number);
+  routing_table_size =
+    xbt_new0(int, /*card_number * card_number */ host_number * host_number);
 }
 
 static void link_free(void *nw_link)
 {
   free(((link_CM02_t) nw_link)->name);
-  xbt_dict_free(&(((link_CM02_t)nw_link)->properties));
+  xbt_dict_free(&(((link_CM02_t) nw_link)->properties));
   free(nw_link);
 }
 
 static link_CM02_t link_new(char *name,
-                           double bw_initial,
-                           tmgr_trace_t bw_trace,
-                           double lat_initial,
-                           tmgr_trace_t lat_trace,
-                           e_surf_link_state_t
-                           state_initial,
-                           tmgr_trace_t state_trace,
-                           e_surf_link_sharing_policy_t
-                           policy, xbt_dict_t properties)
+                            double bw_initial,
+                            tmgr_trace_t bw_trace,
+                            double lat_initial,
+                            tmgr_trace_t lat_trace,
+                            e_surf_link_state_t
+                            state_initial,
+                            tmgr_trace_t state_trace,
+                            e_surf_link_sharing_policy_t
+                            policy, xbt_dict_t properties)
 {
   link_CM02_t nw_link = xbt_new0(s_link_CM02_t, 1);
-  xbt_assert1(!xbt_dict_get_or_null(link_set, name), 
-             "Link '%s' declared several times in the platform file.", name);   
+  xbt_assert1(!xbt_dict_get_or_null(link_set, name),
+              "Link '%s' declared several times in the platform file.", name);
 
   nw_link->model = (surf_model_t) surf_network_model;
   nw_link->name = name;
   nw_link->bw_current = bw_initial;
   if (bw_trace)
     nw_link->bw_event =
-       tmgr_history_add_trace(history, bw_trace, 0.0, 0, nw_link);
+      tmgr_history_add_trace(history, bw_trace, 0.0, 0, nw_link);
   nw_link->lat_current = lat_initial;
   if (lat_trace)
     nw_link->lat_event =
-       tmgr_history_add_trace(history, lat_trace, 0.0, 0, nw_link);
+      tmgr_history_add_trace(history, lat_trace, 0.0, 0, nw_link);
   nw_link->state_current = state_initial;
   if (state_trace)
     nw_link->state_event =
-       tmgr_history_add_trace(history, state_trace, 0.0, 0, nw_link);
+      tmgr_history_add_trace(history, state_trace, 0.0, 0, nw_link);
 
   nw_link->constraint =
-      lmm_constraint_new(network_maxmin_system, nw_link,
-                        bandwidth_factor*nw_link->bw_current);
+    lmm_constraint_new(network_maxmin_system, nw_link,
+                       bandwidth_factor * nw_link->bw_current);
 
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(nw_link->constraint);
@@ -97,7 +98,7 @@ static void network_card_free(void *nw_card)
 static int network_card_new(const char *card_name)
 {
   network_card_CM02_t card =
-      xbt_dict_get_or_null(network_card_set, card_name);
+    xbt_dict_get_or_null(network_card_set, card_name);
 
   if (!card) {
     card = xbt_new0(s_network_card_CM02_t, 1);
@@ -109,11 +110,11 @@ static int network_card_new(const char *card_name)
 }
 
 static void route_new(int src_id, int dst_id,
-                     link_CM02_t * link_list, int nb_link)
+                      link_CM02_t * link_list, int nb_link)
 {
   ROUTE_SIZE(src_id, dst_id) = nb_link;
   ROUTE(src_id, dst_id) = link_list =
-      xbt_realloc(link_list, sizeof(link_CM02_t) * nb_link);
+    xbt_realloc(link_list, sizeof(link_CM02_t) * nb_link);
 }
 
 static void parse_link_init(void)
@@ -133,28 +134,25 @@ static void parse_link_init(void)
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
   surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
 
-  xbt_assert0((A_surfxml_link_state ==
-              A_surfxml_link_state_ON)
-             || (A_surfxml_link_state ==
-                 A_surfxml_link_state_OFF), "Invalid state");
+  xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
+              || (A_surfxml_link_state ==
+                  A_surfxml_link_state_OFF), "Invalid state");
   if (A_surfxml_link_state == A_surfxml_link_state_ON)
     state_initial_link = SURF_LINK_ON;
-  else if (A_surfxml_link_state ==
-          A_surfxml_link_state_OFF)
+  else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
     state_initial_link = SURF_LINK_OFF;
 
-  if (A_surfxml_link_sharing_policy ==
-      A_surfxml_link_sharing_policy_SHARED)
+  if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
     policy_initial_link = SURF_LINK_SHARED;
   else if (A_surfxml_link_sharing_policy ==
-          A_surfxml_link_sharing_policy_FATPIPE)
+           A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
   surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
 
   link_new(name_link, bw_initial, bw_trace,
-                  lat_initial, lat_trace, state_initial_link, state_trace,
-                  policy_initial_link, xbt_dict_new());
+           lat_initial, lat_trace, state_initial_link, state_trace,
+           policy_initial_link, xbt_dict_new());
 
 }
 
@@ -172,9 +170,9 @@ static void parse_route_set_route(void)
 {
   char *name;
   if (src_id != -1 && dst_id != -1) {
-    name = bprintf("%x#%x",src_id, dst_id);
+    name = bprintf("%x#%x", src_id, dst_id);
     manage_route(route_table, name, route_action, 0);
-    free(name);    
+    free(name);
   }
 }
 
@@ -185,10 +183,9 @@ static void add_loopback(void)
   for (i = 0; i < host_number; i++)
     if (!ROUTE_SIZE(i, i)) {
       if (!loopback)
-       loopback = link_new(xbt_strdup("__MSG_loopback__"),
-                                   498000000, NULL, 0.000015, NULL,
-                                   SURF_LINK_ON, NULL,
-                                   SURF_LINK_FATPIPE,NULL);
+        loopback = link_new(xbt_strdup("__MSG_loopback__"),
+                            498000000, NULL, 0.000015, NULL,
+                            SURF_LINK_ON, NULL, SURF_LINK_FATPIPE, NULL);
       ROUTE_SIZE(i, i) = 1;
       ROUTE(i, i) = xbt_new0(link_CM02_t, 1);
       ROUTE(i, i)[0] = loopback;
@@ -199,85 +196,94 @@ static void add_route(void)
 {
   xbt_ex_t e;
   int nb_link = 0;
-  unsigned int cpt = 0;    
+  unsigned int cpt = 0;
   int link_list_capacity = 0;
   link_CM02_t *link_list = NULL;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data, *end;
+  char *key, *data, *end;
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
-  if (routing_table == NULL) create_routing_table();
+  if (routing_table == NULL)
+    create_routing_table();
 
   xbt_dict_foreach(route_table, cursor, key, data) {
-         char* link = NULL;
+    char *link = NULL;
     nb_link = 0;
-    links = (xbt_dynar_t)data;
+    links = (xbt_dynar_t) data;
     keys = xbt_str_split_str(key, sep);
 
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(link_CM02_t, link_list_capacity);
 
-    src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
-    dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
     xbt_dynar_free(&keys);
-    xbt_dynar_foreach (links, cpt, link) {
+
+    xbt_dynar_foreach(links, cpt, link) {
       TRY {
-       link_list[nb_link++] = xbt_dict_get(link_set, link);
+        link_list[nb_link++] = xbt_dict_get(link_set, link);
       }
       CATCH(e) {
         RETHROW1("Link %s not found (dict raised this exception: %s)", link);
-      }     
+      }
     }
     route_new(src_id, dst_id, link_list, nb_link);
-   }
+  }
 }
 
 static void count_hosts(void)
 {
-   host_number++;
-}
-
-
-static void add_traces(void) {
-   xbt_dict_cursor_t cursor=NULL;
-   char *trace_name,*elm;
-   
-   static int called = 0;
-   if (called) return;
-   called = 1;
-
-   /* connect all traces relative to network */
-   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
-      
-      xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", trace_name,elm);
-      xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name,elm);
-      
-      link->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
-   }
-
-   xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
-      
-      xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", trace_name,elm);
-      xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name,elm);
-      
-      link->bw_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
-   }
-   
-   xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
-      
-      xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", trace_name,elm);
-      xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name,elm);
-      
-      link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
-   }
+  host_number++;
+}
+
+
+static void add_traces(void)
+{
+  xbt_dict_cursor_t cursor = NULL;
+  char *trace_name, *elm;
+
+  static int called = 0;
+  if (called)
+    return;
+  called = 1;
+
+  /* connect all traces relative to network */
+  xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
+
+    xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
+                trace_name, elm);
+    xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined",
+                trace_name, elm);
+
+    link->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
+  }
+
+  xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
+
+    xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
+                trace_name, elm);
+    xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined",
+                trace_name, elm);
+
+    link->bw_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
+  }
+
+  xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    link_CM02_t link = xbt_dict_get_or_null(link_set, elm);
+
+    xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined",
+                trace_name, elm);
+    xbt_assert2(trace, "Cannot connect trace %s to link %s: trace undefined",
+                trace_name, elm);
+
+    link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
+  }
 }
 
 static void define_callbacks(const char *file)
@@ -285,7 +291,8 @@ static void define_callbacks(const char *file)
   /* Figuring out the network links */
   surfxml_add_callback(STag_surfxml_host_cb_list, &count_hosts);
   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
+  surfxml_add_callback(STag_surfxml_route_cb_list,
+                       &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
@@ -306,18 +313,17 @@ static const char *get_resource_name(void *resource_id)
 static int resource_used(void *resource_id)
 {
   return lmm_constraint_used(network_maxmin_system,
-                            ((link_CM02_t) resource_id)->
-                            constraint);
+                             ((link_CM02_t) resource_id)->constraint);
 }
 
 static int action_free(surf_action_t action)
 {
-  action->refcount --;
-  if (!action->refcount ) {
+  action->refcount--;
+  if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_network_CM02_t) action)->variable)
       lmm_variable_free(network_maxmin_system,
-                       ((surf_action_network_CM02_t) action)->variable);
+                        ((surf_action_network_CM02_t) action)->variable);
     free(action);
     return 1;
   }
@@ -326,7 +332,7 @@ static int action_free(surf_action_t action)
 
 static void action_use(surf_action_t action)
 {
-  action->refcount ++;
+  action->refcount++;
 }
 
 static void action_cancel(surf_action_t action)
@@ -340,7 +346,7 @@ static void action_recycle(surf_action_t action)
 }
 
 static void action_change_state(surf_action_t action,
-                               e_surf_action_state_t state)
+                                e_surf_action_state_t state)
 {
 /*   if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
 /*     if(((surf_action_network_CM02_t)action)->variable) { */
@@ -357,23 +363,22 @@ static double share_resources(double now)
   s_surf_action_network_CM02_t s_action;
   surf_action_network_CM02_t action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->common_public->states.running_action_set;
+    surf_network_model->common_public->states.running_action_set;
   double min;
 
   min = generic_maxmin_share_resources(running_actions,
-                                      xbt_swag_offset(s_action,
-                                                      variable),
-                                      network_maxmin_system,
-                                      network_solve);
+                                       xbt_swag_offset(s_action,
+                                                       variable),
+                                       network_maxmin_system, network_solve);
 
 #define VARIABLE(action) (*((lmm_variable_t*)(((char *) (action)) + xbt_swag_offset(s_action, variable)  )))
-  
+
   xbt_swag_foreach(action, running_actions) {
     if (action->latency > 0) {
       if (min < 0)
-       min = action->latency;
+        min = action->latency;
       else if (action->latency < min)
-       min = action->latency;
+        min = action->latency;
     }
   }
 
@@ -386,7 +391,7 @@ static void update_actions_state(double now, double delta)
   surf_action_network_CM02_t action = NULL;
   surf_action_network_CM02_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->common_public->states.running_action_set;
+    surf_network_model->common_public->states.running_action_set;
   /*
      xbt_swag_t failed_actions =
      surf_network_model->common_public->states.failed_action_set;
@@ -396,27 +401,27 @@ static void update_actions_state(double now, double delta)
     deltap = delta;
     if (action->latency > 0) {
       if (action->latency > deltap) {
-       double_update(&(action->latency), deltap);
-       deltap = 0.0;
+        double_update(&(action->latency), deltap);
+        deltap = 0.0;
       } else {
-       double_update(&(deltap), action->latency);
-       action->latency = 0.0;
+        double_update(&(deltap), action->latency);
+        action->latency = 0.0;
       }
       if ((action->latency == 0.0) && !(action->suspended))
-       lmm_update_variable_weight(network_maxmin_system, action->variable,
-                                  action->weight);
+        lmm_update_variable_weight(network_maxmin_system, action->variable,
+                                   action->weight);
     }
     double_update(&(action->generic_action.remains),
-                 lmm_variable_getvalue(action->variable) * deltap);
+                  lmm_variable_getvalue(action->variable) * deltap);
     if (action->generic_action.max_duration != NO_MAX_DURATION)
       double_update(&(action->generic_action.max_duration), delta);
 
     if ((action->generic_action.remains <= 0) &&
-       (lmm_get_variable_weight(action->variable) > 0)) {
+        (lmm_get_variable_weight(action->variable) > 0)) {
       action->generic_action.finish = surf_get_clock();
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     } else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
-              (action->generic_action.max_duration <= 0)) {
+               (action->generic_action.max_duration <= 0)) {
       action->generic_action.finish = surf_get_clock();
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     }
@@ -426,8 +431,8 @@ static void update_actions_state(double now, double delta)
 }
 
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double date)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double date)
 {
   link_CM02_t nw_link = id;
   /*   printf("[" "%lg" "] Asking to update network card \"%s\" with value " */
@@ -435,22 +440,23 @@ static void update_resource_state(void *id,
   /*     value, event_type); */
 
   if (event_type == nw_link->bw_event) {
-    double delta = weight_S_parameter/value - weight_S_parameter/nw_link->bw_current;
+    double delta =
+      weight_S_parameter / value - weight_S_parameter / nw_link->bw_current;
     lmm_variable_t var = NULL;
     lmm_element_t elem = NULL;
     surf_action_network_CM02_t action = NULL;
 
     nw_link->bw_current = value;
     lmm_update_constraint_bound(network_maxmin_system, nw_link->constraint,
-                               bandwidth_factor*nw_link->bw_current);
-    if(weight_S_parameter>0) {
-      while ((var= lmm_get_var_from_cnst
-             (network_maxmin_system, nw_link->constraint, &elem))) {
-       action = lmm_variable_id(var);
-       action->weight += delta;
-       if (!(action->suspended))
-         lmm_update_variable_weight(network_maxmin_system, action->variable,
-                                    action->weight);
+                                bandwidth_factor * nw_link->bw_current);
+    if (weight_S_parameter > 0) {
+      while ((var = lmm_get_var_from_cnst
+              (network_maxmin_system, nw_link->constraint, &elem))) {
+        action = lmm_variable_id(var);
+        action->weight += delta;
+        if (!(action->suspended))
+          lmm_update_variable_weight(network_maxmin_system, action->variable,
+                                     action->weight);
       }
     }
   } else if (event_type == nw_link->lat_event) {
@@ -460,25 +466,23 @@ static void update_resource_state(void *id,
     surf_action_network_CM02_t action = NULL;
 
     nw_link->lat_current = value;
-    while ((var= lmm_get_var_from_cnst
-          (network_maxmin_system, nw_link->constraint, &elem))) {
+    while ((var = lmm_get_var_from_cnst
+            (network_maxmin_system, nw_link->constraint, &elem))) {
       action = lmm_variable_id(var);
       action->lat_current += delta;
       action->weight += delta;
       if (action->rate < 0)
-       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                                 SG_TCP_CTE_GAMMA / (2.0 *
-                                                     action->
-                                                     lat_current));
+        lmm_update_variable_bound(network_maxmin_system, action->variable,
+                                  SG_TCP_CTE_GAMMA / (2.0 *
+                                                      action->lat_current));
       else
-       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                                 min(action->rate,
-                                     SG_TCP_CTE_GAMMA / (2.0 *
-                                                         action->
-                                                         lat_current)));
+        lmm_update_variable_bound(network_maxmin_system, action->variable,
+                                  min(action->rate,
+                                      SG_TCP_CTE_GAMMA / (2.0 *
+                                                          action->lat_current)));
       if (!(action->suspended))
-       lmm_update_variable_weight(network_maxmin_system, action->variable,
-                                  action->weight);
+        lmm_update_variable_weight(network_maxmin_system, action->variable,
+                                   action->weight);
 
     }
   } else if (event_type == nw_link->state_event) {
@@ -490,15 +494,15 @@ static void update_resource_state(void *id,
       lmm_element_t elem = NULL;
 
       nw_link->state_current = SURF_LINK_OFF;
-      while ((var= lmm_get_var_from_cnst
-             (network_maxmin_system, cnst, &elem))) {
-       surf_action_t action = lmm_variable_id(var) ;
-
-       if(surf_action_get_state(action)==SURF_ACTION_RUNNING ||
-          surf_action_get_state(action)==SURF_ACTION_READY) {
-         action->finish = date;
-         action_change_state( action, SURF_ACTION_FAILED);
-       }
+      while ((var = lmm_get_var_from_cnst
+              (network_maxmin_system, cnst, &elem))) {
+        surf_action_t action = lmm_variable_id(var);
+
+        if (surf_action_get_state(action) == SURF_ACTION_RUNNING ||
+            surf_action_get_state(action) == SURF_ACTION_READY) {
+          action->finish = date;
+          action_change_state(action, SURF_ACTION_FAILED);
+        }
       }
     }
   } else {
@@ -510,7 +514,7 @@ static void update_resource_state(void *id,
 }
 
 static surf_action_t communicate(void *src, void *dst, double size,
-                                double rate)
+                                 double rate)
 {
   surf_action_network_CM02_t action = NULL;
   /* LARGE PLATFORMS HACK:
@@ -528,30 +532,29 @@ static surf_action_t communicate(void *src, void *dst, double size,
   /* LARGE PLATFORMS HACK:
      assert on total_route_size */
   xbt_assert2(route_size,
-             "You're trying to send data from %s to %s but there is no connexion between these two cards.",
-             card_src->name, card_dst->name);
+              "You're trying to send data from %s to %s but there is no connexion between these two cards.",
+              card_src->name, card_dst->name);
 
   action = xbt_new0(s_surf_action_network_CM02_t, 1);
 
-  action->generic_action.refcount  = 1;
+  action->generic_action.refcount = 1;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
-  action->generic_action.model_type =
-      (surf_model_t) surf_network_model;
-  action->suspended = 0;       /* Should be useless because of the 
-                                  calloc but it seems to help valgrind... */
+  action->generic_action.model_type = (surf_model_t) surf_network_model;
+  action->suspended = 0;        /* Should be useless because of the 
+                                   calloc but it seems to help valgrind... */
   action->generic_action.state_set =
-      surf_network_model->common_public->states.running_action_set;
-  for (i = 0; i < route_size; i++) 
-    if(route[i]->state_current == SURF_LINK_OFF) {
+    surf_network_model->common_public->states.running_action_set;
+  for (i = 0; i < route_size; i++)
+    if (route[i]->state_current == SURF_LINK_OFF) {
       action->generic_action.state_set =
-       surf_network_model->common_public->states.failed_action_set;
+        surf_network_model->common_public->states.failed_action_set;
       break;
     }
-  
+
   xbt_swag_insert(action, action->generic_action.state_set);
   action->rate = rate;
 
@@ -559,7 +562,8 @@ static surf_action_t communicate(void *src, void *dst, double size,
   action->weight = 0.0;
   for (i = 0; i < route_size; i++) {
     action->latency += route[i]->lat_current;
-    action->weight += route[i]->lat_current + weight_S_parameter/route[i]->bw_current;
+    action->weight +=
+      route[i]->lat_current + weight_S_parameter / route[i]->bw_current;
   }
   /* LARGE PLATFORMS HACK:
      Add src->link and dst->link latencies */
@@ -567,39 +571,36 @@ static surf_action_t communicate(void *src, void *dst, double size,
   action->latency *= latency_factor;
 
   /* LARGE PLATFORMS HACK:
-     lmm_variable_new(..., total_route_size)*/
+     lmm_variable_new(..., total_route_size) */
   if (action->latency > 0)
     action->variable =
-       lmm_variable_new(network_maxmin_system, action, 0.0, -1.0,
-                        route_size);
+      lmm_variable_new(network_maxmin_system, action, 0.0, -1.0, route_size);
   else
     action->variable =
-       lmm_variable_new(network_maxmin_system, action, 1.0, -1.0,
-                        route_size);
+      lmm_variable_new(network_maxmin_system, action, 1.0, -1.0, route_size);
 
   if (action->rate < 0) {
     if (action->lat_current > 0)
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                               SG_TCP_CTE_GAMMA / (2.0 *
-                                                   action->lat_current));
+                                SG_TCP_CTE_GAMMA / (2.0 *
+                                                    action->lat_current));
     else
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                               -1.0);
+                                -1.0);
   } else {
     if (action->lat_current > 0)
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                               min(action->rate,
-                                   SG_TCP_CTE_GAMMA / (2.0 *
-                                                       action->
-                                                       lat_current)));
+                                min(action->rate,
+                                    SG_TCP_CTE_GAMMA / (2.0 *
+                                                        action->lat_current)));
     else
       lmm_update_variable_bound(network_maxmin_system, action->variable,
-                               action->rate);
+                                action->rate);
   }
 
   for (i = 0; i < route_size; i++)
     lmm_expand(network_maxmin_system, route[i]->constraint,
-              action->variable, 1.0);
+               action->variable, 1.0);
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 
@@ -645,25 +646,24 @@ static int link_shared(const void *link)
 
 static xbt_dict_t get_properties(void *link)
 {
- return ((link_CM02_t) link)->properties;
 return ((link_CM02_t) link)->properties;
 }
 
 static void action_suspend(surf_action_t action)
 {
   ((surf_action_network_CM02_t) action)->suspended = 1;
   lmm_update_variable_weight(network_maxmin_system,
-                            ((surf_action_network_CM02_t) action)->
-                            variable, 0.0);
+                             ((surf_action_network_CM02_t) action)->variable,
+                             0.0);
 }
 
 static void action_resume(surf_action_t action)
 {
   if (((surf_action_network_CM02_t) action)->suspended) {
     lmm_update_variable_weight(network_maxmin_system,
-                              ((surf_action_network_CM02_t) action)->
-                              variable,
-                              ((surf_action_network_CM02_t) action)->
-                              weight);
+                               ((surf_action_network_CM02_t)
+                                action)->variable,
+                               ((surf_action_network_CM02_t) action)->weight);
     ((surf_action_network_CM02_t) action)->suspended = 0;
   }
 }
@@ -684,14 +684,10 @@ static void finalize(void)
 
   xbt_dict_free(&network_card_set);
   xbt_dict_free(&link_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               ready_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               failed_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               done_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.ready_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.running_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.failed_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.done_action_set);
   free(surf_network_model->common_public);
   free(surf_network_model->common_private);
   free(surf_network_model->extension_public);
@@ -718,67 +714,59 @@ static void surf_network_model_init_internal(void)
 
   surf_network_model = xbt_new0(s_surf_network_model_t, 1);
 
-  surf_network_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
-  surf_network_model->common_public =
-      xbt_new0(s_surf_model_public_t, 1);
+  surf_network_model->common_private = xbt_new0(s_surf_model_private_t, 1);
+  surf_network_model->common_public = xbt_new0(s_surf_model_public_t, 1);
   surf_network_model->extension_public =
-      xbt_new0(s_surf_network_model_extension_public_t, 1);
+    xbt_new0(s_surf_network_model_extension_public_t, 1);
 
   surf_network_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_network_model->common_public->name_service = name_service;
-  surf_network_model->common_public->get_resource_name =
-      get_resource_name;
-  surf_network_model->common_public->action_get_state =
-      surf_action_get_state;
+  surf_network_model->common_public->get_resource_name = get_resource_name;
+  surf_network_model->common_public->action_get_state = surf_action_get_state;
   surf_network_model->common_public->action_get_start_time =
-      surf_action_get_start_time;
+    surf_action_get_start_time;
   surf_network_model->common_public->action_get_finish_time =
-      surf_action_get_finish_time;
+    surf_action_get_finish_time;
   surf_network_model->common_public->action_free = action_free;
   surf_network_model->common_public->action_use = action_use;
   surf_network_model->common_public->action_cancel = action_cancel;
   surf_network_model->common_public->action_recycle = action_recycle;
   surf_network_model->common_public->action_change_state =
-      action_change_state;
-  surf_network_model->common_public->action_set_data =
-      surf_action_set_data;
+    action_change_state;
+  surf_network_model->common_public->action_set_data = surf_action_set_data;
   surf_network_model->common_public->name = "network";
 
   surf_network_model->common_private->resource_used = resource_used;
   surf_network_model->common_private->share_resources = share_resources;
   surf_network_model->common_private->update_actions_state =
-      update_actions_state;
+    update_actions_state;
   surf_network_model->common_private->update_resource_state =
-      update_resource_state;
+    update_resource_state;
   surf_network_model->common_private->finalize = finalize;
 
   surf_network_model->common_public->suspend = action_suspend;
   surf_network_model->common_public->resume = action_resume;
   surf_network_model->common_public->is_suspended = action_is_suspended;
-  surf_cpu_model->common_public->set_max_duration =
-      action_set_max_duration;
+  surf_cpu_model->common_public->set_max_duration = action_set_max_duration;
 
   surf_network_model->extension_public->communicate = communicate;
   surf_network_model->extension_public->get_route = get_route;
   surf_network_model->extension_public->get_route_size = get_route_size;
   surf_network_model->extension_public->get_link_name = get_link_name;
   surf_network_model->extension_public->get_link_bandwidth =
-      get_link_bandwidth;
-  surf_network_model->extension_public->get_link_latency =
-      get_link_latency;
-  surf_network_model->extension_public->link_shared =
-      link_shared;
+    get_link_bandwidth;
+  surf_network_model->extension_public->get_link_latency = get_link_latency;
+  surf_network_model->extension_public->link_shared = link_shared;
 
-  surf_network_model->common_public->get_properties =  get_properties;
+  surf_network_model->common_public->get_properties = get_properties;
 
   link_set = xbt_dict_new();
   network_card_set = xbt_dict_new();
@@ -805,8 +793,7 @@ void surf_network_model_init_LegrandVelho(const char *filename)
   weight_S_parameter = 8775;
 
   update_model_description(surf_network_model_description,
-                          "LegrandVelho",
-                          (surf_model_t) surf_network_model);
+                           "LegrandVelho", (surf_model_t) surf_network_model);
 }
 
 /***************************************************************************/
@@ -831,8 +818,7 @@ void surf_network_model_init_CM02(const char *filename)
   network_solve = lmm_solve;
 
   update_model_description(surf_network_model_description,
-                          "CM02",
-                          (surf_model_t) surf_network_model);
+                           "CM02", (surf_model_t) surf_network_model);
 }
 
 void surf_network_model_init_Reno(const char *filename)
@@ -843,8 +829,7 @@ void surf_network_model_init_Reno(const char *filename)
   define_callbacks(filename);
 
   xbt_dynar_push(model_list, &surf_network_model);
-  lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
-                                   func_reno_fpi);
+  lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
   network_solve = lagrange_solve;
 
   latency_factor = 10.4;
@@ -852,8 +837,7 @@ void surf_network_model_init_Reno(const char *filename)
   weight_S_parameter = 8775;
 
   update_model_description(surf_network_model_description,
-                          "Reno",
-                          (surf_model_t) surf_network_model);
+                           "Reno", (surf_model_t) surf_network_model);
 }
 
 
@@ -866,7 +850,7 @@ void surf_network_model_init_Reno2(const char *filename)
 
   xbt_dynar_push(model_list, &surf_network_model);
   lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp,
-                                   func_reno2_fpi);
+                                    func_reno2_fpi);
   network_solve = lagrange_solve;
 
   latency_factor = 10.4;
@@ -874,8 +858,7 @@ void surf_network_model_init_Reno2(const char *filename)
   weight_S_parameter = 8775;
 
   update_model_description(surf_network_model_description,
-                          "Reno2",
-                          (surf_model_t) surf_network_model);
+                           "Reno2", (surf_model_t) surf_network_model);
 }
 
 void surf_network_model_init_Vegas(const char *filename)
@@ -887,7 +870,7 @@ void surf_network_model_init_Vegas(const char *filename)
 
   xbt_dynar_push(model_list, &surf_network_model);
   lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
-                                   func_vegas_fpi);
+                                    func_vegas_fpi);
   network_solve = lagrange_solve;
 
   latency_factor = 10.4;
@@ -895,12 +878,11 @@ void surf_network_model_init_Vegas(const char *filename)
   weight_S_parameter = 8775;
 
   update_model_description(surf_network_model_description,
-                          "Vegas",
-                          (surf_model_t) surf_network_model);
+                           "Vegas", (surf_model_t) surf_network_model);
 }
 
 #ifdef HAVE_SDP
- void surf_network_model_init_SDP(const char *filename)
+void surf_network_model_init_SDP(const char *filename)
 {
   if (surf_network_model)
     return;
@@ -911,7 +893,6 @@ void surf_network_model_init_Vegas(const char *filename)
   network_solve = sdp_solve;
 
   update_model_description(surf_network_model_description,
-                          "SDP",
-                          (surf_model_t) surf_network_model);
+                           "SDP", (surf_model_t) surf_network_model);
 }
 #endif
index 6e26f2e..2bfb882 100644 (file)
@@ -13,4 +13,4 @@
 extern xbt_dict_t network_card_set;
 
 
-#endif                         /* _SURF_NETWORK_COMMON_H */
+#endif /* _SURF_NETWORK_COMMON_H */
index 1f06f33..1561796 100644 (file)
@@ -40,7 +40,7 @@ static void network_card_free(void *nw_card)
 static int network_card_new(const char *card_name)
 {
   network_card_Constant_t card =
-      xbt_dict_get_or_null(network_card_set, card_name);
+    xbt_dict_get_or_null(network_card_set, card_name);
 
   if (!card) {
     card = xbt_new0(s_network_card_Constant_t, 1);
@@ -65,22 +65,23 @@ static void parse_route_set_route(void)
 {
   char *name;
   if (src_id != -1 && dst_id != -1) {
-    name = bprintf("%x#%x",src_id, dst_id);
+    name = bprintf("%x#%x", src_id, dst_id);
     manage_route(route_table, name, route_action, 0);
-    free(name);    
+    free(name);
   }
 }
 
 static void count_hosts(void)
 {
-   host_number++;
+  host_number++;
 }
 
 static void define_callbacks(const char *file)
 {
   /* Figuring out the network links */
   surfxml_add_callback(STag_surfxml_host_cb_list, &count_hosts);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
+  surfxml_add_callback(STag_surfxml_route_cb_list,
+                       &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
 }
 
@@ -102,8 +103,8 @@ static int resource_used(void *resource_id)
 
 static int action_free(surf_action_t action)
 {
-  action->refcount --;
-  if (!action->refcount ) {
+  action->refcount--;
+  if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
     free(action);
     return 1;
@@ -113,7 +114,7 @@ static int action_free(surf_action_t action)
 
 static void action_use(surf_action_t action)
 {
-  action->refcount ++;
+  action->refcount++;
 }
 
 static void action_cancel(surf_action_t action)
@@ -127,7 +128,7 @@ static void action_recycle(surf_action_t action)
 }
 
 static void action_change_state(surf_action_t action,
-                               e_surf_action_state_t state)
+                                e_surf_action_state_t state)
 {
   surf_action_change_state(action, state);
   return;
@@ -137,15 +138,15 @@ static double share_resources(double now)
 {
   surf_action_network_Constant_t action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->common_public->states.running_action_set;
+    surf_network_model->common_public->states.running_action_set;
   double min = -1.0;
 
   xbt_swag_foreach(action, running_actions) {
     if (action->latency > 0) {
       if (min < 0)
-       min = action->latency;
+        min = action->latency;
       else if (action->latency < min)
-       min = action->latency;
+        min = action->latency;
     }
   }
 
@@ -157,18 +158,18 @@ static void update_actions_state(double now, double delta)
   surf_action_network_Constant_t action = NULL;
   surf_action_network_Constant_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->common_public->states.running_action_set;
+    surf_network_model->common_public->states.running_action_set;
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
     if (action->latency > 0) {
       if (action->latency > delta) {
-       double_update(&(action->latency), delta);
+        double_update(&(action->latency), delta);
       } else {
-       action->latency = 0.0;
+        action->latency = 0.0;
       }
     }
     double_update(&(action->generic_action.remains),
-                 action->generic_action.cost * delta/action->lat_init);
+                  action->generic_action.cost * delta / action->lat_init);
     if (action->generic_action.max_duration != NO_MAX_DURATION)
       double_update(&(action->generic_action.max_duration), delta);
 
@@ -176,24 +177,24 @@ static void update_actions_state(double now, double delta)
       action->generic_action.finish = surf_get_clock();
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     } else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
-              (action->generic_action.max_duration <= 0)) {
+               (action->generic_action.max_duration <= 0)) {
       action->generic_action.finish = surf_get_clock();
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
-    } 
+    }
   }
 
   return;
 }
 
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double time)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double time)
 {
   DIE_IMPOSSIBLE;
 }
 
 static surf_action_t communicate(void *src, void *dst, double size,
-                                double rate)
+                                 double rate)
 {
   surf_action_network_Constant_t action = NULL;
   network_card_Constant_t card_src = src;
@@ -203,20 +204,19 @@ static surf_action_t communicate(void *src, void *dst, double size,
 
   action = xbt_new0(s_surf_action_network_Constant_t, 1);
 
-  action->generic_action.refcount  = 1;
+  action->generic_action.refcount = 1;
   action->generic_action.cost = size;
   action->generic_action.remains = size;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
-  action->generic_action.model_type =
-      (surf_model_t) surf_network_model;
+  action->generic_action.model_type = (surf_model_t) surf_network_model;
   action->suspended = 0;
 
   action->latency = random_generate(random_latency);
   action->lat_init = action->latency;
 
-  if(action->latency<=0.0)
+  if (action->latency <= 0.0)
     action->generic_action.state_set =
       surf_network_model->common_public->states.done_action_set;
   else
@@ -293,14 +293,10 @@ static void action_set_max_duration(surf_action_t action, double duration)
 static void finalize(void)
 {
   xbt_dict_free(&network_card_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               ready_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               failed_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               done_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.ready_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.running_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.failed_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.done_action_set);
   free(surf_network_model->common_public);
   free(surf_network_model->common_private);
   free(surf_network_model->extension_public);
@@ -317,71 +313,63 @@ static void surf_network_model_init_internal(void)
 
   surf_network_model = xbt_new0(s_surf_network_model_t, 1);
 
-  surf_network_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
-  surf_network_model->common_public =
-      xbt_new0(s_surf_model_public_t, 1);
+  surf_network_model->common_private = xbt_new0(s_surf_model_private_t, 1);
+  surf_network_model->common_public = xbt_new0(s_surf_model_public_t, 1);
   surf_network_model->extension_public =
-      xbt_new0(s_surf_network_model_extension_public_t, 1);
+    xbt_new0(s_surf_network_model_extension_public_t, 1);
 
   surf_network_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_network_model->common_public->name_service = name_service;
-  surf_network_model->common_public->get_resource_name =
-      get_resource_name;
-  surf_network_model->common_public->action_get_state =
-      surf_action_get_state;
+  surf_network_model->common_public->get_resource_name = get_resource_name;
+  surf_network_model->common_public->action_get_state = surf_action_get_state;
   surf_network_model->common_public->action_get_start_time =
-      surf_action_get_start_time;
+    surf_action_get_start_time;
   surf_network_model->common_public->action_get_finish_time =
-      surf_action_get_finish_time;
+    surf_action_get_finish_time;
   surf_network_model->common_public->action_free = action_free;
   surf_network_model->common_public->action_use = action_use;
   surf_network_model->common_public->action_cancel = action_cancel;
   surf_network_model->common_public->action_recycle = action_recycle;
   surf_network_model->common_public->action_change_state =
-      action_change_state;
-  surf_network_model->common_public->action_set_data =
-      surf_action_set_data;
+    action_change_state;
+  surf_network_model->common_public->action_set_data = surf_action_set_data;
   surf_network_model->common_public->name = "network";
 
   surf_network_model->common_private->resource_used = resource_used;
   surf_network_model->common_private->share_resources = share_resources;
   surf_network_model->common_private->update_actions_state =
-      update_actions_state;
+    update_actions_state;
   surf_network_model->common_private->update_resource_state =
-      update_resource_state;
+    update_resource_state;
   surf_network_model->common_private->finalize = finalize;
 
   surf_network_model->common_public->suspend = action_suspend;
   surf_network_model->common_public->resume = action_resume;
   surf_network_model->common_public->is_suspended = action_is_suspended;
-  surf_cpu_model->common_public->set_max_duration =
-      action_set_max_duration;
+  surf_cpu_model->common_public->set_max_duration = action_set_max_duration;
 
   surf_network_model->extension_public->communicate = communicate;
   surf_network_model->extension_public->get_route = get_route;
   surf_network_model->extension_public->get_route_size = get_route_size;
   surf_network_model->extension_public->get_link_name = get_link_name;
   surf_network_model->extension_public->get_link_bandwidth =
-      get_link_bandwidth;
-  surf_network_model->extension_public->get_link_latency =
-      get_link_latency;
-  surf_network_model->extension_public->link_shared =
-      link_shared;
+    get_link_bandwidth;
+  surf_network_model->extension_public->get_link_latency = get_link_latency;
+  surf_network_model->extension_public->link_shared = link_shared;
 
-  surf_network_model->common_public->get_properties =  get_properties;
+  surf_network_model->common_public->get_properties = get_properties;
 
   network_card_set = xbt_dict_new();
 
-  if(!random_latency) 
+  if (!random_latency)
     random_latency = random_new(RAND, 100, 0.0, 1.0, .125, .034);
 }
 
@@ -395,6 +383,5 @@ void surf_network_model_init_Constant(const char *filename)
   xbt_dynar_push(model_list, &surf_network_model);
 
   update_model_description(surf_network_model_description,
-                          "Constant",
-                          (surf_model_t) surf_network_model);
+                           "Constant", (surf_model_t) surf_network_model);
 }
index 59a344a..6fc36a3 100644 (file)
 #include "xbt/str.h"
 
 
-static   double time_to_next_flow_completion=-1;
+static double time_to_next_flow_completion = -1;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf,
-                               "Logging specific to the SURF network module");
+                                "Logging specific to the SURF network module");
 
 /** QUESTIONS for GTNetS integration
  **   1. Check that we did the right thing with name_service and get_resource_name
@@ -32,7 +32,7 @@ static int dst_id = -1;
 static void link_free(void *nw_link)
 {
   free(((network_link_GTNETS_t) nw_link)->name);
-  xbt_dict_free(&(((network_link_GTNETS_t)nw_link)->properties));
+  xbt_dict_free(&(((network_link_GTNETS_t) nw_link)->properties));
   free(nw_link);
 }
 
@@ -101,10 +101,9 @@ static int network_card_new(const char *name)
 {
   static int card_count = -1;
 
-  XBT_IN1("(%s)",name);
+  XBT_IN1("(%s)", name);
   /* KF: Check that we haven't seen the network card before */
-  network_card_GTNETS_t card =
-      xbt_dict_get_or_null(network_card_set, name);
+  network_card_GTNETS_t card = xbt_dict_get_or_null(network_card_set, name);
 
   if (!card) {
     /* KF: Increment the card counter for GTNetS */
@@ -116,20 +115,21 @@ static int network_card_new(const char *name)
     card->id = card_count;
     xbt_dict_set(network_card_set, name, card, network_card_free);
   }
-  
-  LOG1(xbt_log_priority_trace, "   return %d",card->id);
+
+  LOG1(xbt_log_priority_trace, "   return %d", card->id);
   XBT_OUT;
   /* KF: just return the GTNetS ID as the SURF ID */
   return card->id;
 }
 
 /* Instantiate a new route: MODIFY BY KF */
-static void route_new(int src_id, int dst_id, network_link_GTNETS_t *links, int nb_link)
+static void route_new(int src_id, int dst_id, network_link_GTNETS_t * links,
+                      int nb_link)
 {
   int i;
   int *gtnets_links;
   XBT_IN4("(src_id=%d, dst_id=%d, links=%p, nb_link=%d)",
-         src_id,dst_id,links,nb_link);
+          src_id, dst_id, links, nb_link);
 
   /* KF: Build the list of gtnets link IDs */
   gtnets_links = (int *) calloc(nb_link, sizeof(int));
@@ -145,7 +145,8 @@ static void route_new(int src_id, int dst_id, network_link_GTNETS_t *links, int
 }
 
 /* Instantiate a new route: MODIFY BY KF */
-static void route_onehop_new(int src_id, int dst_id, network_link_GTNETS_t *links, int nb_link)
+static void route_onehop_new(int src_id, int dst_id,
+                             network_link_GTNETS_t * links, int nb_link)
 {
   int linkid;
 
@@ -180,7 +181,7 @@ static void parse_link_init(void)
   tmgr_trace_t bw_trace;
   tmgr_trace_t state_trace;
   tmgr_trace_t lat_trace;
-  
+
   surf_parse_get_trace(&bw_trace, A_surfxml_link_bandwidth_file);
   surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
   surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
@@ -220,20 +221,20 @@ static void parse_route_set_route(void)
 {
   char *name;
   if (src_id != -1 && dst_id != -1) {
-    name = bprintf("%x#%x",src_id, dst_id);
+    name = bprintf("%x#%x", src_id, dst_id);
     manage_route(route_table, name, route_action, 0);
-    free(name);    
+    free(name);
   }
 }
 
 static void add_route()
 {
   xbt_ex_t e;
-  unsigned int cpt = 0;    
+  unsigned int cpt = 0;
   int link_list_capacity = 0;
   int nb_link = 0;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data, *end;
+  char *key, *data, *end;
   const char *sep = "#";
   xbt_dynar_t links, keys;
   static network_link_GTNETS_t *link_list = NULL;
@@ -243,52 +244,52 @@ static void add_route()
   xbt_dict_foreach(route_table, cursor, key, data) {
     char *link = NULL;
     nb_link = 0;
-    links = (xbt_dynar_t)data;
+    links = (xbt_dynar_t) data;
     keys = xbt_str_split_str(key, sep);
 
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(network_link_GTNETS_t, link_list_capacity);
 
-    src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
-    dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
     xbt_dynar_free(&keys);
 
-    xbt_dynar_foreach (links, cpt, link) {
+    xbt_dynar_foreach(links, cpt, link) {
       TRY {
         link_list[nb_link++] = xbt_dict_get(link_set, link);
       }
       CATCH(e) {
         RETHROW1("Link %s not found (dict raised this exception: %s)", link);
-      }     
+      }
     }
     if (nb_link == 1)
       route_onehop_new(src_id, dst_id, link_list, nb_link);
-   }
+  }
 
   xbt_dict_foreach(route_table, cursor, key, data) {
     char *link = NULL;
     nb_link = 0;
-    links = (xbt_dynar_t)data;
+    links = (xbt_dynar_t) data;
     keys = xbt_str_split_str(key, sep);
 
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(network_link_GTNETS_t, link_list_capacity);
 
-    src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
-    dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
     xbt_dynar_free(&keys);
 
-    xbt_dynar_foreach (links, cpt, link) {
+    xbt_dynar_foreach(links, cpt, link) {
       TRY {
         link_list[nb_link++] = xbt_dict_get(link_set, link);
       }
       CATCH(e) {
         RETHROW1("Link %s not found (dict raised this exception: %s)", link);
-      }     
+      }
     }
     if (nb_link >= 1)
       route_new(src_id, dst_id, link_list, nb_link);
-   }
+  }
 
   xbt_dict_free(&route_table);
   gtnets_print_topology();
@@ -298,11 +299,12 @@ static void add_route()
 /* Main XML parsing */
 static void define_callbacks(const char *file)
 {
-  surfxml_add_callback(STag_surfxml_router_cb_list,   &parse_route_set_routers);
-  surfxml_add_callback(STag_surfxml_link_cb_list,     &parse_link_init);
-  surfxml_add_callback(STag_surfxml_route_cb_list,    &parse_route_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_cb_list,      &parse_route_set_route);
-  surfxml_add_callback(ETag_surfxml_platform_cb_list,   &add_route);
+  surfxml_add_callback(STag_surfxml_router_cb_list, &parse_route_set_routers);
+  surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
+  surfxml_add_callback(STag_surfxml_route_cb_list,
+                       &parse_route_set_endpoints);
+  surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
+  surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
 }
 
 static void *name_service(const char *name)
@@ -324,7 +326,7 @@ static xbt_dict_t get_properties(void *link)
 /* We do not care about this: only used for traces */
 static int resource_used(void *resource_id)
 {
-  return 0;                    /* We don't care */
+  return 0;                     /* We don't care */
 }
 
 static int action_free(surf_action_t action)
@@ -357,7 +359,7 @@ static void action_recycle(surf_action_t action)
 }
 
 static void action_change_state(surf_action_t action,
-                               e_surf_action_state_t state)
+                                e_surf_action_state_t state)
 {
 /*   if((state==SURF_ACTION_DONE) || (state==SURF_ACTION_FAILED)) */
 /*     if(((surf_action_network_GTNETS_t)action)->variable) { */
@@ -373,14 +375,16 @@ static void action_change_state(surf_action_t action,
 /* share_resources() */
 static double share_resources(double now)
 {
-  xbt_swag_t running_actions = surf_network_model->common_public->states.running_action_set;
+  xbt_swag_t running_actions =
+    surf_network_model->common_public->states.running_action_set;
 
   //get the first relevant value from the running_actions list
   if (!xbt_swag_size(running_actions))
     return -1.0;
 
-  xbt_assert0(time_to_next_flow_completion, "Time to next flow completion not initialized!\n");
-  
+  xbt_assert0(time_to_next_flow_completion,
+              "Time to next flow completion not initialized!\n");
+
   time_to_next_flow_completion = gtnets_get_time_to_next_flow_completion();
 
   return time_to_next_flow_completion;
@@ -398,7 +402,7 @@ static void update_actions_state(double now, double delta)
   surf_action_network_GTNETS_t action = NULL;
   //  surf_action_network_GTNETS_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->common_public->states.running_action_set;
+    surf_network_model->common_public->states.running_action_set;
 
   /* If there are no renning flows, just return */
   if (time_to_next_flow_completion < 0.0) {
@@ -406,7 +410,7 @@ static void update_actions_state(double now, double delta)
   }
 
   /*KF: if delta == time_to_next_flow_completion, too. */
-  if (time_to_next_flow_completion <= delta) { /* run until the first flow completes */
+  if (time_to_next_flow_completion <= delta) {  /* run until the first flow completes */
     void **metadata;
     int i, num_flows;
 
@@ -414,36 +418,38 @@ static void update_actions_state(double now, double delta)
 
     if (gtnets_run_until_next_flow_completion(&metadata, &num_flows)) {
       xbt_assert0(0,
-                 "Cannot run GTNetS simulation until next flow completion");
+                  "Cannot run GTNetS simulation until next flow completion");
     }
     if (num_flows < 1) {
       xbt_assert0(0,
-                 "GTNetS simulation couldn't find a flow that would complete");
+                  "GTNetS simulation couldn't find a flow that would complete");
     }
 
     xbt_swag_foreach(action, running_actions) {
-      DEBUG2("Action (%p) remains old value: %f", action, action->generic_action.remains);
+      DEBUG2("Action (%p) remains old value: %f", action,
+             action->generic_action.remains);
       double remain = gtnets_get_flow_rx(action);
       DEBUG1("Remain value returned by GTNetS : %f", remain);
       //need to trust this remain value
-      if(remain == 0){
-       action->generic_action.remains=0;
-      }else {
-       action->generic_action.remains=action->generic_action.cost-remain;
+      if (remain == 0) {
+        action->generic_action.remains = 0;
+      } else {
+        action->generic_action.remains = action->generic_action.cost - remain;
       }
-      DEBUG2("Action (%p) remains new value: %f", action, action->generic_action.remains);
+      DEBUG2("Action (%p) remains new value: %f", action,
+             action->generic_action.remains);
     }
 
     for (i = 0; i < num_flows; i++) {
-      action =  (surf_action_network_GTNETS_t) (metadata[i]);
-      
+      action = (surf_action_network_GTNETS_t) (metadata[i]);
+
       action->generic_action.finish = now + time_to_next_flow_completion;
       action_change_state((surf_action_t) action, SURF_ACTION_DONE);
-      DEBUG1("----> Action (%p) just terminated",action);
+      DEBUG1("----> Action (%p) just terminated", action);
     }
 
 
-  } else {                     /* run for a given number of seconds */
+  } else {                      /* run for a given number of seconds */
     if (gtnets_run(delta)) {
       xbt_assert0(0, "Cannot run GTNetS simulation");
     }
@@ -454,8 +460,8 @@ static void update_actions_state(double now, double delta)
 
 /* UNUSED HERE: no traces */
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double date)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double date)
 {
   xbt_assert0(0, "Cannot update model state for GTNetS simulation");
   return;
@@ -463,7 +469,7 @@ static void update_resource_state(void *id,
 
 /* KF: Rate not supported */
 static surf_action_t communicate(void *src, void *dst, double size,
-                                double rate)
+                                 double rate)
 {
   surf_action_network_GTNETS_t action = NULL;
   network_card_GTNETS_t card_src = src;
@@ -486,11 +492,10 @@ static surf_action_t communicate(void *src, void *dst, double size,
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
-  action->generic_action.model_type =
-      (surf_model_t) surf_network_model;
+  action->generic_action.model_type = (surf_model_t) surf_network_model;
 
   action->generic_action.state_set =
-      surf_network_model->common_public->states.running_action_set;
+    surf_network_model->common_public->states.running_action_set;
 
   xbt_swag_insert(action, action->generic_action.state_set);
 
@@ -498,7 +503,7 @@ static surf_action_t communicate(void *src, void *dst, double size,
   if (gtnets_create_flow(card_src->id, card_dst->id, size, (void *) action)
       < 0) {
     xbt_assert2(0, "Not route between host %s and host %s", card_src->name,
-               card_dst->name);
+                card_dst->name);
   }
 
   return (surf_action_t) action;
@@ -508,14 +513,14 @@ static surf_action_t communicate(void *src, void *dst, double size,
 static void action_suspend(surf_action_t action)
 {
   xbt_assert0(0,
-             "action_suspend() not supported for the GTNets network model");
+              "action_suspend() not supported for the GTNets network model");
 }
 
 /* Resume a flow() */
 static void action_resume(surf_action_t action)
 {
   xbt_assert0(0,
-             "action_resume() not supported for the GTNets network model");
+              "action_resume() not supported for the GTNets network model");
 }
 
 /* Test whether a flow is suspended */
@@ -531,14 +536,10 @@ static void finalize(void)
 #endif
   xbt_dict_free(&network_card_set);
   xbt_dict_free(&link_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               ready_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               failed_action_set);
-  xbt_swag_free(surf_network_model->common_public->states.
-               done_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.ready_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.running_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.failed_action_set);
+  xbt_swag_free(surf_network_model->common_public->states.done_action_set);
   free(surf_network_model->common_public);
   free(surf_network_model->common_private);
   free(surf_network_model->extension_public);
@@ -555,42 +556,38 @@ static void surf_network_model_init_internal(void)
 
   surf_network_model = xbt_new0(s_surf_network_model_t, 1);
 
-  surf_network_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
-  surf_network_model->common_public =
-      xbt_new0(s_surf_model_public_t, 1);
+  surf_network_model->common_private = xbt_new0(s_surf_model_private_t, 1);
+  surf_network_model->common_public = xbt_new0(s_surf_model_public_t, 1);
   surf_network_model->extension_public =
-      xbt_new0(s_surf_network_model_extension_public_t, 1);
+    xbt_new0(s_surf_network_model_extension_public_t, 1);
 
   surf_network_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_network_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_network_model->common_public->name_service = name_service;
-  surf_network_model->common_public->get_resource_name =
-      get_resource_name;
-  surf_network_model->common_public->action_get_state =
-      surf_action_get_state;
+  surf_network_model->common_public->get_resource_name = get_resource_name;
+  surf_network_model->common_public->action_get_state = surf_action_get_state;
   surf_network_model->common_public->action_use = action_use;
   surf_network_model->common_public->action_free = action_free;
   surf_network_model->common_public->action_cancel = action_cancel;
   surf_network_model->common_public->action_recycle = action_recycle;
   surf_network_model->common_public->action_change_state =
-      action_change_state;
-  surf_network_model->common_public->action_set_data =
-      surf_action_set_data;
+    action_change_state;
+  surf_network_model->common_public->action_set_data = surf_action_set_data;
   surf_network_model->common_public->name = "network";
 
   surf_network_model->common_private->resource_used = resource_used;
   surf_network_model->common_private->share_resources = share_resources;
   surf_network_model->common_private->update_actions_state =
-      update_actions_state;
-  surf_network_model->common_private->update_resource_state = update_resource_state;
+    update_actions_state;
+  surf_network_model->common_private->update_resource_state =
+    update_resource_state;
   surf_network_model->common_private->finalize = finalize;
 
   surf_network_model->common_public->suspend = action_suspend;
@@ -599,8 +596,8 @@ static void surf_network_model_init_internal(void)
 
   surf_network_model->extension_public->communicate = communicate;
 
-  /*for the props of the link*/
-  surf_network_model->common_public->get_properties =  get_properties;
+  /*for the props of the link */
+  surf_network_model->common_public->get_properties = get_properties;
 
   link_set = xbt_dict_new();
   network_card_set = xbt_dict_new();
@@ -621,7 +618,6 @@ void surf_network_model_init_GTNETS(const char *filename)
   xbt_dynar_push(model_list, &surf_network_model);
 
   update_model_description(surf_network_model_description,
-                          "GTNets",
-                          (surf_model_t) surf_network_model);
+                           "GTNets", (surf_model_t) surf_network_model);
 }
 #endif
index 96fd252..6f76717 100644 (file)
 #include "xbt/dict.h"
 
 typedef struct network_link_GTNETS {
-  surf_model_t model;  /* Any such object, added in a trace
-                                  should start by this field!!! */
+  surf_model_t model;           /* Any such object, added in a trace
+                                   should start by this field!!! */
   /* Using this object with the public part of
      model does not make sense */
   char *name;
   double bw_current;
   double lat_current;
   int id;
-  /*holds the properties associated witht the link*/
+  /*holds the properties associated witht the link */
   xbt_dict_t properties;
 } s_network_link_GTNETS_t, *network_link_GTNETS_t;
 
@@ -28,7 +28,7 @@ typedef struct network_link_GTNETS {
 typedef struct network_card_GTNETS {
   char *name;
   int id;
-  /*holds the properties associated witht the card*/
+  /*holds the properties associated witht the card */
   xbt_dict_t properties;
 } s_network_card_GTNETS_t, *network_card_GTNETS_t;
 
@@ -46,6 +46,4 @@ typedef struct surf_action_network_GTNETS {
 extern xbt_dict_t network_card_set;
 
 
-#endif                         /* _SURF_NETWORK_PRIVATE_H */
-
-
+#endif /* _SURF_NETWORK_PRIVATE_H */
index b22d08a..cccfd92 100644 (file)
@@ -13,8 +13,8 @@
 #include "xbt/dict.h"
 
 typedef struct network_link_CM02 {
-  surf_model_t model;  /* Any such object, added in a trace
-                                  should start by this field!!! */
+  surf_model_t model;           /* Any such object, added in a trace
+                                   should start by this field!!! */
   xbt_dict_t properties;
   /* Using this object with the public part of
      model does not make sense */
@@ -53,4 +53,4 @@ extern int *routing_table_size;
 #define ROUTE(i,j) routing_table[(i)+(j)*host_number]
 #define ROUTE_SIZE(i,j) routing_table_size[(i)+(j)*host_number]
 
-#endif                         /* _SURF_NETWORK_PRIVATE_H */
+#endif /* _SURF_NETWORK_PRIVATE_H */
index 18aa3ac..f22b26b 100644 (file)
@@ -8,176 +8,167 @@ static unsigned int _seed = 2147483647;
 typedef unsigned __int64 uint64_t;
 typedef unsigned int uint32_t;
 
-struct drand48_data
-{
-       unsigned short int __x[3];  /* Current state.  */
-       unsigned short int __old_x[3]; /* Old state.  */
-       unsigned short int __c;     /* Additive const. in congruential formula.  */
-       unsigned short int __init;  /* Flag for initializing.  */
-       unsigned long long int __a; /* Factor in congruential formula.  */
+struct drand48_data {
+  unsigned short int __x[3];    /* Current state.  */
+  unsigned short int __old_x[3];        /* Old state.  */
+  unsigned short int __c;       /* Additive const. in congruential formula.  */
+  unsigned short int __init;    /* Flag for initializing.  */
+  unsigned long long int __a;   /* Factor in congruential formula.  */
 };
 
-static struct drand48_data __libc_drand48_data = {0};
-
-union ieee754_double
-  {
-       double d;
-
-       /* This is the IEEE 754 double-precision format.  */
-       struct
-       {
-               /* Together these comprise the mantissa.  */
-               unsigned int mantissa1:32;
-               unsigned int mantissa0:20;
-               unsigned int exponent:11;
-               unsigned int negative:1;
-               /* Little endian.  */
-       } ieee;
-
-       /* This format makes it easier to see if a NaN is a signalling NaN.  */
-       struct
-       {
-               /* Together these comprise the mantissa.  */
-               unsigned int mantissa1:32;
-               unsigned int mantissa0:19;
-               unsigned int quiet_nan:1;
-               unsigned int exponent:11;
-               unsigned int negative:1;
-
-       } ieee_nan;
+static struct drand48_data __libc_drand48_data = { 0 };
+
+union ieee754_double {
+  double d;
+
+  /* This is the IEEE 754 double-precision format.  */
+  struct {
+    /* Together these comprise the mantissa.  */
+    unsigned int mantissa1:32;
+    unsigned int mantissa0:20;
+    unsigned int exponent:11;
+    unsigned int negative:1;
+    /* Little endian.  */
+  } ieee;
+
+  /* This format makes it easier to see if a NaN is a signalling NaN.  */
+  struct {
+    /* Together these comprise the mantissa.  */
+    unsigned int mantissa1:32;
+    unsigned int mantissa0:19;
+    unsigned int quiet_nan:1;
+    unsigned int exponent:11;
+    unsigned int negative:1;
+
+  } ieee_nan;
 };
 
-#define IEEE754_DOUBLE_BIAS    0x3ff                                   /* Added to exponent.  */
+#define IEEE754_DOUBLE_BIAS    0x3ff   /* Added to exponent.  */
 
-double
-drand48 (void);
+double drand48(void);
 
 int
-_drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer);
+_drand48_iterate(unsigned short int xsubi[3], struct drand48_data *buffer);
 
 int
-_erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result);
+_erand48_r(unsigned short int xsubi[3], struct drand48_data *buffer,
+           double *result);
 
 
 int
-_erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result)
+_erand48_r(unsigned short int xsubi[3], struct drand48_data *buffer,
+           double *result)
 {
-       union ieee754_double temp;
+  union ieee754_double temp;
 
-       /* Compute next state.  */
-       if (_drand48_iterate(xsubi, buffer) < 0)
-               return -1;
+  /* Compute next state.  */
+  if (_drand48_iterate(xsubi, buffer) < 0)
+    return -1;
 
-       /* Construct a positive double with the 48 random bits distributed over
-       its fractional part so the resulting FP number is [0.0,1.0).  */
+  /* Construct a positive double with the 48 random bits distributed over
+     its fractional part so the resulting FP number is [0.0,1.0).  */
 
-       temp.ieee.negative = 0;
-       temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
-       temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
-       temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);
+  temp.ieee.negative = 0;
+  temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
+  temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
+  temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);
 
-       /* Please note the lower 4 bits of mantissa1 are always 0.  */
-       *result = temp.d - 1.0;
+  /* Please note the lower 4 bits of mantissa1 are always 0.  */
+  *result = temp.d - 1.0;
 
-       return 0;
+  return 0;
 }
 
-int
-_drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer)
+int _drand48_iterate(unsigned short int xsubi[3], struct drand48_data *buffer)
 {
-       uint64_t X;
-       uint64_t result;
+  uint64_t X;
+  uint64_t result;
 
-       /* Initialize buffer, if not yet done.  */
+  /* Initialize buffer, if not yet done.  */
 
-       if(buffer->__init == 0)
-       {
-               buffer->__a = 0x5deece66dull;
-               buffer->__c = 0xb;
-               buffer->__init = 1;
-       }
+  if (buffer->__init == 0) {
+    buffer->__a = 0x5deece66dull;
+    buffer->__c = 0xb;
+    buffer->__init = 1;
+  }
 
-       /* Do the real work.  We choose a data type which contains at least
-       48 bits.  Because we compute the modulus it does not care how
-       many bits really are computed.  */
+  /* Do the real work.  We choose a data type which contains at least
+     48 bits.  Because we compute the modulus it does not care how
+     many bits really are computed.  */
 
-       X = (uint64_t) xsubi[2] << 32 | (uint32_t) xsubi[1] << 16 | xsubi[0];
+  X = (uint64_t) xsubi[2] << 32 | (uint32_t) xsubi[1] << 16 | xsubi[0];
 
-       result = X * buffer->__a + buffer->__c;
+  result = X * buffer->__a + buffer->__c;
 
 
-       xsubi[0] = result & 0xffff;
-       xsubi[1] = (result >> 16) & 0xffff;
-       xsubi[2] = (result >> 32) & 0xffff;
+  xsubi[0] = result & 0xffff;
+  xsubi[1] = (result >> 16) & 0xffff;
+  xsubi[2] = (result >> 32) & 0xffff;
 
-       return 0;
+  return 0;
 }
 
 
-double
-_drand48 (void)
+double _drand48(void)
 {
-       double result;
+  double result;
 
-       (void) _erand48_r (__libc_drand48_data.__x, &__libc_drand48_data, &result);
+  (void) _erand48_r(__libc_drand48_data.__x, &__libc_drand48_data, &result);
 
-        return result;
- }
+  return result;
+}
 
-void
-_srand(unsigned int seed)
+void _srand(unsigned int seed)
 {
-       _seed = seed;
+  _seed = seed;
 }
 
-int
-_rand(void)
+int _rand(void)
 {
-       const long a = 16807;
-       const long m = 2147483647;
-       const long q = 127773; /* (m/a) */
-       const long r = 2836; /* (m%a) */
+  const long a = 16807;
+  const long m = 2147483647;
+  const long q = 127773;        /* (m/a) */
+  const long r = 2836;          /* (m%a) */
 
-       long lo, k, s;
+  long lo, k, s;
 
-       s = (long)_seed;
+  s = (long) _seed;
 
-       k = (long)(s/q);
+  k = (long) (s / q);
 
-       lo = (s - q * k);
+  lo = (s - q * k);
 
-       s = a * lo -r * k;
+  s = a * lo - r * k;
 
-       if(s <= 0)
-               s += m;
+  if (s <= 0)
+    s += m;
 
-       _seed = (int)(s & RAND_MAX);
+  _seed = (int) (s & RAND_MAX);
 
-       return _seed;
+  return _seed;
 }
 
-int
-_rand_r(unsigned int* pseed)
+int _rand_r(unsigned int *pseed)
 {
-       const long a = 16807;
-       const long m = 2147483647;
-       const long q = 127773;                  /* (m/a) */
-       const long r = 2836;                    /* (m%a) */
+  const long a = 16807;
+  const long m = 2147483647;
+  const long q = 127773;        /* (m/a) */
+  const long r = 2836;          /* (m%a) */
 
-       long lo, k, s;
+  long lo, k, s;
 
-       s = (long)*pseed;
+  s = (long) *pseed;
 
-       k = (long)(s/q);
+  k = (long) (s / q);
 
-       lo = (s - q * k);
+  lo = (s - q * k);
 
-       s = a * lo -r * k;
+  s = a * lo - r * k;
 
-       if(s <= 0)
-               s += m;
+  if (s <= 0)
+    s += m;
 
-       return (int)(s & RAND_MAX);
+  return (int) (s & RAND_MAX);
 
 }
 
@@ -187,50 +178,60 @@ _rand_r(unsigned int* pseed)
 
 #endif
 
-static double custom_random(Generator generator, long int *seed){
-   switch(generator) {
-
-    case DRAND48:
-      return drand48();
-    case RAND:
-      return (double)rand_r((unsigned int*)seed)/RAND_MAX;
-    default:
-      return drand48();
-   }
+static double custom_random(Generator generator, long int *seed)
+{
+  switch (generator) {
+
+  case DRAND48:
+    return drand48();
+  case RAND:
+    return (double) rand_r((unsigned int *) seed) / RAND_MAX;
+  default:
+    return drand48();
+  }
 }
 
 /* Generate numbers between min and max with a given mean and standard deviation */
-double random_generate(random_data_t random) {
+double random_generate(random_data_t random)
+{
   double a, b;
   double alpha, beta, gamma;
   double U1, U2, V, W, X;
 
-  if (random == NULL) return 0.0f;
+  if (random == NULL)
+    return 0.0f;
 
   if (random->std == 0)
-     return random->mean * (random->max - random->min) + random->min;
+    return random->mean * (random->max - random->min) + random->min;
 
-  a = random->mean * ( random->mean * (1 - random->mean) / (random->std*random->std) - 1 );
-  b = (1 - random->mean) * ( random->mean * (1 - random->mean) / (random->std*random->std) - 1 );
+  a =
+    random->mean * (random->mean * (1 - random->mean) /
+                    (random->std * random->std) - 1);
+  b =
+    (1 -
+     random->mean) * (random->mean * (1 -
+                                      random->mean) / (random->std *
+                                                       random->std) - 1);
 
   alpha = a + b;
   if (a <= 1. || b <= 1.)
-    beta = ((1./a)>(1./b))?(1./a):(1./b);
+    beta = ((1. / a) > (1. / b)) ? (1. / a) : (1. / b);
   else
-    beta = sqrt ((alpha-2.) / (2.*a*b - alpha));
-  gamma = a + 1./beta;
+    beta = sqrt((alpha - 2.) / (2. * a * b - alpha));
+  gamma = a + 1. / beta;
 
   do {
     /* Random generation for the Beta distribution based on
      *   R. C. H. Cheng (1978). Generating beta variates with nonintegral shape parameters. _Communications of the ACM_, *21*, 317-322.
      *   It is good for speed because it does not call math functions many times and respect the 4 given constraints
      */
-    U1 = custom_random(random->generator,&(random->seed));
-    U2 = custom_random(random->generator,&(random->seed));
+    U1 = custom_random(random->generator, &(random->seed));
+    U2 = custom_random(random->generator, &(random->seed));
 
-    V = beta * log(U1/(1-U1));
+    V = beta * log(U1 / (1 - U1));
     W = a * exp(V);
-  } while (alpha * log(alpha/(b + W)) + gamma*V - log(4) < log(U1*U1*U2));
+  } while (alpha * log(alpha / (b + W)) + gamma * V - log(4) <
+           log(U1 * U1 * U2));
 
   X = W / (b + W);
 
@@ -238,8 +239,8 @@ double random_generate(random_data_t random) {
 }
 
 random_data_t random_new(Generator generator, long int seed,
-                        double min, double max,
-                        double mean, double std){
+                         double min, double max, double mean, double std)
+{
   random_data_t random = xbt_new0(s_random_data_t, 1);
 
   random->generator = generator;
@@ -249,18 +250,19 @@ random_data_t random_new(Generator generator, long int seed,
 
   /* Check user stupidities */
   if (max < min)
-     THROW2(arg_error,0,"random->max < random->min (%f < %f)",max, min);
+    THROW2(arg_error, 0, "random->max < random->min (%f < %f)", max, min);
   if (mean < min)
-     THROW2(arg_error,0,"random->mean < random->min (%f < %f)",mean, min);
+    THROW2(arg_error, 0, "random->mean < random->min (%f < %f)", mean, min);
   if (mean > max)
-     THROW2(arg_error,0,"random->mean > random->max (%f > %f)",mean, max);
+    THROW2(arg_error, 0, "random->mean > random->max (%f > %f)", mean, max);
 
   /* normalize the mean and standard deviation before storing */
   random->mean = (mean - min) / (max - min);
   random->std = std / (max - min);
 
-  if (random->mean * (1-random->mean) < random->std*random->std)
-     THROW2(arg_error,0,"Invalid mean and standard deviation (%f and %f)",random->mean, random->std);
+  if (random->mean * (1 - random->mean) < random->std * random->std)
+    THROW2(arg_error, 0, "Invalid mean and standard deviation (%f and %f)",
+           random->mean, random->std);
 
   return random;
 }
index 1fd92f8..ed543c6 100644 (file)
 #include <declarations.h>
 
 
-static void create_cross_link(struct constraintmatrix *myconstraints,
-                             int k);
+static void create_cross_link(struct constraintmatrix *myconstraints, int k);
 
 static void addentry(struct constraintmatrix *constraints,
-                    struct blockmatrix *, int matno, int blkno,
-                    int indexi, int indexj, double ent, int blocksize);
+                     struct blockmatrix *, int matno, int blkno,
+                     int indexi, int indexj, double ent, int blocksize);
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_sdp, surf,
-                               "Logging specific to SURF (sdp)");
-XBT_LOG_NEW_SUBCATEGORY(surf_sdp_out, surf,
-                       "Logging specific to SURF (sdp)");
+                                "Logging specific to SURF (sdp)");
+XBT_LOG_NEW_SUBCATEGORY(surf_sdp_out, surf, "Logging specific to SURF (sdp)");
 /*
 ########################################################################
 ######################## Simple Proportionnal fairness #################
@@ -118,7 +116,7 @@ XBT_LOG_NEW_SUBCATEGORY(surf_sdp_out, surf,
 
 #define get_y(a,b) (pow(2,a)+b-1)
 
-void sdp_solve (lmm_system_t sys)
+void sdp_solve(lmm_system_t sys)
 {
 
   /*
@@ -242,8 +240,8 @@ void sdp_solve (lmm_system_t sys)
    * The total number of constraints.
    */
   nb_cnsts =
-      nb_cnsts_capacity + nb_cnsts_struct + nb_cnsts_positivy +
-      nb_cnsts_latency;
+    nb_cnsts_capacity + nb_cnsts_struct + nb_cnsts_positivy +
+    nb_cnsts_latency;
   CDEBUG1(surf_sdp_out, "Number of constraints = %d", nb_cnsts);
   DEBUG1("Number of constraints in the SDP program : %d", nb_cnsts);
 
@@ -256,10 +254,10 @@ void sdp_solve (lmm_system_t sys)
 
   C.nblocks = nb_cnsts;
   C.blocks =
-      (struct blockrec *) calloc((C.nblocks + 1), sizeof(struct blockrec));
+    (struct blockrec *) calloc((C.nblocks + 1), sizeof(struct blockrec));
   constraints =
-      (struct constraintmatrix *) calloc((nb_var + 1),
-                                        sizeof(struct constraintmatrix));
+    (struct constraintmatrix *) calloc((nb_var + 1),
+                                       sizeof(struct constraintmatrix));
 
   for (i = 1; i <= nb_var; i++) {
     constraints[i].blocks = NULL;
@@ -295,7 +293,7 @@ void sdp_solve (lmm_system_t sys)
     C.blocks[block_num].blockcategory = MATRIX;
     C.blocks[block_num].blocksize = block_size;
     C.blocks[block_num].data.mat =
-       (double *) calloc(block_size * block_size, sizeof(double));
+      (double *) calloc(block_size * block_size, sizeof(double));
 
     block_num++;
   }
@@ -329,22 +327,22 @@ void sdp_solve (lmm_system_t sys)
       matno = get_y(k, 2 * i - 1);
       CDEBUG2(surf_sdp_out, "%d %d 1 1 1", matno, block_num);
       addentry(constraints, &C, matno, block_num, 1, 1, 1.0,
-              C.blocks[block_num].blocksize);
+               C.blocks[block_num].blocksize);
 
       matno = get_y(k, 2 * i);
       CDEBUG2(surf_sdp_out, "%d %d 2 2 1", matno, block_num);
       addentry(constraints, &C, matno, block_num, 2, 2, 1.0,
-              C.blocks[block_num].blocksize);
+               C.blocks[block_num].blocksize);
 
       matno = get_y(k - 1, i);
       CDEBUG2(surf_sdp_out, "%d %d 1 2 1", matno, block_num);
       addentry(constraints, &C, matno, block_num, 1, 2, 1.0,
-              C.blocks[block_num].blocksize);
+               C.blocks[block_num].blocksize);
 
       matno = get_y(k - 1, i);
       CDEBUG2(surf_sdp_out, "%d %d 2 1 1", matno, block_num);
       addentry(constraints, &C, matno, block_num, 2, 1, 1.0,
-              C.blocks[block_num].blocksize);
+               C.blocks[block_num].blocksize);
 
       isdiag[block_num] = 0;
       block_num++;
@@ -359,17 +357,16 @@ void sdp_solve (lmm_system_t sys)
 
     CDEBUG2(surf_sdp_out, "0 %d 1 1 %f", block_num, -(cnst->bound));
     addentry(constraints, &C, 0, block_num, 1, 1, -(cnst->bound),
-            C.blocks[block_num].blocksize);
+             C.blocks[block_num].blocksize);
 
     elem_list = &(cnst->element_set);
     xbt_swag_foreach(elem, elem_list) {
       if (elem->variable->weight <= 0)
-       break;
+        break;
       matno = get_y(K, elem->variable->index);
-      CDEBUG3(surf_sdp_out, "%d %d 1 1 %f", matno, block_num,
-             -(elem->value));
+      CDEBUG3(surf_sdp_out, "%d %d 1 1 %f", matno, block_num, -(elem->value));
       addentry(constraints, &C, matno, block_num, 1, 1, -(elem->value),
-              C.blocks[block_num].blocksize);
+               C.blocks[block_num].blocksize);
 
     }
     block_num++;
@@ -383,7 +380,7 @@ void sdp_solve (lmm_system_t sys)
     matno = get_y(K, i);
     CDEBUG2(surf_sdp_out, "%d %d 1 1 1", matno, block_num);
     addentry(constraints, &C, matno, block_num, 1, 1, 1.0,
-            C.blocks[block_num].blocksize);
+             C.blocks[block_num].blocksize);
     block_num++;
   }
   /*
@@ -395,7 +392,7 @@ void sdp_solve (lmm_system_t sys)
       matno = get_y(K, var->index);
       CDEBUG3(surf_sdp_out, "%d %d 1 1 %f", matno, block_num, var->bound);
       addentry(constraints, &C, matno, block_num, 1, 1, var->bound,
-              C.blocks[block_num].blocksize);
+               C.blocks[block_num].blocksize);
     }
   }
 
@@ -405,7 +402,7 @@ void sdp_solve (lmm_system_t sys)
    */
   for (i = 1; i <= nb_cnsts; i++) {
     if ((C.blocks[i].blockcategory != DIAG) &&
-       (isdiag[i] == 1) && (C.blocks[i].blocksize > 1)) {
+        (isdiag[i] == 1) && (C.blocks[i].blocksize > 1)) {
       /*
        * We have a hidden diagonal block!
        */
@@ -413,7 +410,7 @@ void sdp_solve (lmm_system_t sys)
       blocksz = C.blocks[i].blocksize;
       tempdiag = (double *) calloc((blocksz + 1), sizeof(double));
       for (j = 1; j <= blocksz; j++)
-       tempdiag[j] = C.blocks[i].data.mat[ijtok(j, j, blocksz)];
+        tempdiag[j] = C.blocks[i].data.mat[ijtok(j, j, blocksz)];
       free(C.blocks[i].data.mat);
       C.blocks[i].data.vec = tempdiag;
       C.blocks[i].blockcategory = DIAG;
@@ -432,14 +429,14 @@ void sdp_solve (lmm_system_t sys)
        * First, set issparse.
        */
       if (((p->numentries) > 0.25 * (p->blocksize))
-         && ((p->numentries) > 15)) {
-       p->issparse = 0;
+          && ((p->numentries) > 15)) {
+        p->issparse = 0;
       } else {
-       p->issparse = 1;
+        p->issparse = 1;
       };
 
       if (C.blocks[p->blocknum].blockcategory == DIAG)
-       p->issparse = 1;
+        p->issparse = 1;
 
       /*
        * Setup the cross links.
@@ -481,8 +478,8 @@ void sdp_solve (lmm_system_t sys)
   stdout_sav = stdout;
   stdout = fopen("/dev/null", "w");
   ret =
-      easy_sdp(total_block_size, nb_var, C, a, constraints, 0.0, &X, &y,
-              &Z, &pobj, &dobj);
+    easy_sdp(total_block_size, nb_var, C, a, constraints, 0.0, &X, &y,
+             &Z, &pobj, &dobj);
   fclose(stdout);
   stdout = stdout_sav;
 
@@ -498,7 +495,7 @@ void sdp_solve (lmm_system_t sys)
 
   case 3:
     DEBUG0
-       ("Partial SUCCESS A solution has been found, but full accuracy was not achieved. One or more of primal infeasibility, dual infeasibility, or relative duality gap are larger than their tolerances, but by a factor of less than 1000.");
+      ("Partial SUCCESS A solution has been found, but full accuracy was not achieved. One or more of primal infeasibility, dual infeasibility, or relative duality gap are larger than their tolerances, but by a factor of less than 1000.");
     break;
 
   case 4:
@@ -524,7 +521,7 @@ void sdp_solve (lmm_system_t sys)
     elem_list = &(cnst->element_set);
     xbt_swag_foreach(elem, elem_list) {
       if (elem->variable->weight <= 0)
-       break;
+        break;
 
       i = (int) get_y(K, elem->variable->index);
       elem->variable->value = y[i];
@@ -572,30 +569,30 @@ void create_cross_link(struct constraintmatrix *myconstraints, int k)
     p = myconstraints[i].blocks;
     while (p != NULL) {
       if (p->nextbyblock == NULL) {
-       blk = p->blocknum;
-
-       /*
-        * link in the remaining blocks.
-        */
-       for (j = i + 1; j <= k; j++) {
-         q = myconstraints[j].blocks;
-
-         while (q != NULL) {
-           if (q->blocknum == p->blocknum) {
-             if (p->nextbyblock == NULL) {
-               p->nextbyblock = q;
-               q->nextbyblock = NULL;
-               prev = q;
-             } else {
-               prev->nextbyblock = q;
-               q->nextbyblock = NULL;
-               prev = q;
-             }
-             break;
-           }
-           q = q->next;
-         }
-       }
+        blk = p->blocknum;
+
+        /*
+         * link in the remaining blocks.
+         */
+        for (j = i + 1; j <= k; j++) {
+          q = myconstraints[j].blocks;
+
+          while (q != NULL) {
+            if (q->blocknum == p->blocknum) {
+              if (p->nextbyblock == NULL) {
+                p->nextbyblock = q;
+                q->nextbyblock = NULL;
+                prev = q;
+              } else {
+                prev->nextbyblock = q;
+                q->nextbyblock = NULL;
+                prev = q;
+              }
+              break;
+            }
+            q = q->next;
+          }
+        }
       }
       p = p->next;
     }
@@ -606,9 +603,9 @@ void create_cross_link(struct constraintmatrix *myconstraints, int k)
 
 
 void addentry(struct constraintmatrix *constraints,
-             struct blockmatrix *C,
-             int matno,
-             int blkno, int indexi, int indexj, double ent, int blocksize)
+              struct blockmatrix *C,
+              int matno,
+              int blkno, int indexi, int indexj, double ent, int blocksize)
 {
   struct sparseblock *p;
   struct sparseblock *p_sav;
@@ -645,29 +642,29 @@ void addentry(struct constraintmatrix *constraints,
        * in the chain.
        */
       while (p != NULL) {
-       if (p->blocknum == blkno) {
-         /*
-          * Found the right block.
-          */
-         p->constraintnum = matno;
-         p->blocknum = blkno;
-         p->numentries = p->numentries + 1;
-
-         p->entries =
-             realloc(p->entries, (p->numentries + 1) * sizeof(double));
-         p->iindices =
-             realloc(p->iindices, (p->numentries + 1) * sizeof(int));
-         p->jindices =
-             realloc(p->jindices, (p->numentries + 1) * sizeof(int));
-
-         p->entries[p->numentries] = ent;
-         p->iindices[p->numentries] = indexi;
-         p->jindices[p->numentries] = indexj;
-
-         return;
-       }
-       p_sav = p;
-       p = p->next;
+        if (p->blocknum == blkno) {
+          /*
+           * Found the right block.
+           */
+          p->constraintnum = matno;
+          p->blocknum = blkno;
+          p->numentries = p->numentries + 1;
+
+          p->entries =
+            realloc(p->entries, (p->numentries + 1) * sizeof(double));
+          p->iindices =
+            realloc(p->iindices, (p->numentries + 1) * sizeof(int));
+          p->jindices =
+            realloc(p->jindices, (p->numentries + 1) * sizeof(int));
+
+          p->entries[p->numentries] = ent;
+          p->iindices[p->numentries] = indexi;
+          p->jindices[p->numentries] = indexj;
+
+          return;
+        }
+        p_sav = p;
+        p = p->next;
       }
 
       /*
@@ -699,10 +696,10 @@ void addentry(struct constraintmatrix *constraints,
     if (ent != 0.0) {
       int blksz = C->blocks[blkno].blocksize;
       if (C->blocks[blkno].blockcategory == DIAG) {
-       C->blocks[blkno].data.vec[indexi] = ent;
+        C->blocks[blkno].data.vec[indexi] = ent;
       } else {
-       C->blocks[blkno].data.mat[ijtok(indexi, indexj, blksz)] = ent;
-       C->blocks[blkno].data.mat[ijtok(indexj, indexi, blksz)] = ent;
+        C->blocks[blkno].data.mat[ijtok(indexi, indexj, blksz)] = ent;
+        C->blocks[blkno].data.mat[ijtok(indexj, indexi, blksz)] = ent;
       };
     };
 
index a346ea7..7c41712 100644 (file)
@@ -71,7 +71,7 @@ typedef uint32_t flex_uint32_t;
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
+typedef unsigned char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -113,15 +113,15 @@ typedef unsigned int flex_uint32_t;
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
-#else  /* ! __cplusplus */
+#else /* ! __cplusplus */
 
 /* C99 requires __STDC__ to be defined as 1. */
 #if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
 #define yyconst const
@@ -189,14 +189,14 @@ extern FILE *surf_parse_in, *surf_parse_out;
      *       a 5% performance hit in a non-surf_parse_lineno scanner, because yy_act is
      *       normally declared as a register variable-- so it is not worth it.
      */
-    #define  YY_LESS_LINENO(n) \
+#define  YY_LESS_LINENO(n) \
             do { \
                 int yyl;\
                 for ( yyl = n; yyl < surf_parse_leng; ++yyl )\
                     if ( surf_parse_text[yyl] == '\n' )\
                         --surf_parse_lineno;\
             }while(0)
-    
+
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
        do \
@@ -220,73 +220,72 @@ typedef size_t yy_size_t;
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-       {
-       FILE *yy_input_file;
-
-       char *yy_ch_buf;                /* input buffer */
-       char *yy_buf_pos;               /* current position in input buffer */
-
-       /* Size of input buffer in bytes, not including room for EOB
-        * characters.
-        */
-       yy_size_t yy_buf_size;
-
-       /* Number of characters read into yy_ch_buf, not including EOB
-        * characters.
-        */
-       int yy_n_chars;
-
-       /* Whether we "own" the buffer - i.e., we know we created it,
-        * and can realloc() it to grow it, and should free() it to
-        * delete it.
-        */
-       int yy_is_our_buffer;
-
-       /* Whether this is an "interactive" input source; if so, and
-        * if we're using stdio for input, then we want to use getc()
-        * instead of fread(), to make sure we stop fetching input after
-        * each newline.
-        */
-       int yy_is_interactive;
-
-       /* Whether we're considered to be at the beginning of a line.
-        * If so, '^' rules will be active on the next match, otherwise
-        * not.
-        */
-       int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-       /* Whether to try to fill the input buffer when we reach the
-        * end of it.
-        */
-       int yy_fill_buffer;
-
-       int yy_buffer_status;
+struct yy_buffer_state {
+  FILE *yy_input_file;
+
+  char *yy_ch_buf;              /* input buffer */
+  char *yy_buf_pos;             /* current position in input buffer */
+
+  /* Size of input buffer in bytes, not including room for EOB
+   * characters.
+   */
+  yy_size_t yy_buf_size;
+
+  /* Number of characters read into yy_ch_buf, not including EOB
+   * characters.
+   */
+  int yy_n_chars;
+
+  /* Whether we "own" the buffer - i.e., we know we created it,
+   * and can realloc() it to grow it, and should free() it to
+   * delete it.
+   */
+  int yy_is_our_buffer;
+
+  /* Whether this is an "interactive" input source; if so, and
+   * if we're using stdio for input, then we want to use getc()
+   * instead of fread(), to make sure we stop fetching input after
+   * each newline.
+   */
+  int yy_is_interactive;
+
+  /* Whether we're considered to be at the beginning of a line.
+   * If so, '^' rules will be active on the next match, otherwise
+   * not.
+   */
+  int yy_at_bol;
+
+  int yy_bs_lineno;   /**< The line count. */
+  int yy_bs_column;   /**< The column count. */
+
+  /* Whether to try to fill the input buffer when we reach the
+   * end of it.
+   */
+  int yy_fill_buffer;
+
+  int yy_buffer_status;
 
 #define YY_BUFFER_NEW 0
 #define YY_BUFFER_NORMAL 1
-       /* When an EOF's been seen but there's still some text to process
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-        * shouldn't try reading from the input source any more.  We might
-        * still have a bunch of tokens to match, though, because of
-        * possible backing-up.
-        *
-        * When we actually see the EOF, we change the status to "new"
-        * (via surf_parse_restart()), so that the user can continue scanning by
-        * just pointing surf_parse_in at a new input file.
-        */
+  /* When an EOF's been seen but there's still some text to process
+   * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+   * shouldn't try reading from the input source any more.  We might
+   * still have a bunch of tokens to match, though, because of
+   * possible backing-up.
+   *
+   * When we actually see the EOF, we change the status to "new"
+   * (via surf_parse_restart()), so that the user can continue scanning by
+   * just pointing surf_parse_in at a new input file.
+   */
 #define YY_BUFFER_EOF_PENDING 2
 
-       };
+};
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
 /* Stack of input buffers. */
 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+static YY_BUFFER_STATE *yy_buffer_stack = 0;  /**< Stack as an array. */
 
 /* We provide macros for accessing buffer states in case in the
  * future we want to put the buffer states in a more general
@@ -305,40 +304,40 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
 /* yy_hold_char holds the character lost when surf_parse_text is formed. */
 static char yy_hold_char;
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */
+static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 int surf_parse_leng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0;                /* whether we need to initialize */
-static int yy_start = 0;       /* start state number */
+static int yy_init = 0;         /* whether we need to initialize */
+static int yy_start = 0;        /* start state number */
 
 /* Flag which is used to allow surf_parse_wrap()'s to do buffer switches
  * instead of setting up a fresh surf_parse_in.  A bit of a hack ...
  */
 static int yy_did_buffer_switch_on_eof;
 
-void surf_parse_restart (FILE *input_file  );
-void surf_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
-YY_BUFFER_STATE surf_parse__create_buffer (FILE *file,int size  );
-void surf_parse__delete_buffer (YY_BUFFER_STATE b  );
-void surf_parse__flush_buffer (YY_BUFFER_STATE b  );
-void surf_parse_push_buffer_state (YY_BUFFER_STATE new_buffer  );
-void surf_parse_pop_buffer_state (void );
+void surf_parse_restart(FILE * input_file);
+void surf_parse__switch_to_buffer(YY_BUFFER_STATE new_buffer);
+YY_BUFFER_STATE surf_parse__create_buffer(FILE * file, int size);
+void surf_parse__delete_buffer(YY_BUFFER_STATE b);
+void surf_parse__flush_buffer(YY_BUFFER_STATE b);
+void surf_parse_push_buffer_state(YY_BUFFER_STATE new_buffer);
+void surf_parse_pop_buffer_state(void);
 
-static void surf_parse_ensure_buffer_stack (void );
-static void surf_parse__load_buffer_state (void );
-static void surf_parse__init_buffer (YY_BUFFER_STATE b,FILE *file  );
+static void surf_parse_ensure_buffer_stack(void);
+static void surf_parse__load_buffer_state(void);
+static void surf_parse__init_buffer(YY_BUFFER_STATE b, FILE * file);
 
 #define YY_FLUSH_BUFFER surf_parse__flush_buffer(YY_CURRENT_BUFFER )
 
-YY_BUFFER_STATE surf_parse__scan_buffer (char *base,yy_size_t size  );
-YY_BUFFER_STATE surf_parse__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE surf_parse__scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE surf_parse__scan_buffer(char *base, yy_size_t size);
+YY_BUFFER_STATE surf_parse__scan_string(yyconst char *yy_str);
+YY_BUFFER_STATE surf_parse__scan_bytes(yyconst char *bytes, int len);
 
-void *surf_parse_alloc (yy_size_t  );
-void *surf_parse_realloc (void *,yy_size_t  );
-void surf_parse_free (void *  );
+void *surf_parse_alloc(yy_size_t);
+void *surf_parse_realloc(void *, yy_size_t);
+void surf_parse_free(void *);
 
 #define yy_new_buffer surf_parse__create_buffer
 
@@ -382,10 +381,10 @@ int surf_parse_lineno = 1;
 extern char *surf_parse_text;
 #define yytext_ptr surf_parse_text
 
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[]  );
+static yy_state_type yy_get_previous_state(void);
+static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
+static int yy_get_next_buffer(void);
+static void yy_fatal_error(yyconst char msg[]);
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up surf_parse_text.
@@ -401,2390 +400,2382 @@ static void yy_fatal_error (yyconst char msg[]  );
 #define YY_END_OF_BUFFER 352
 /* This struct is not used in this scanner,
    but its presence is necessary. */
-struct yy_trans_info
-       {
-       flex_int32_t yy_verify;
-       flex_int32_t yy_nxt;
-       };
-static yyconst flex_int16_t yy_accept[2023] =
-    {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  352,  350,   15,   10,   10,   15,   15,  330,
-       10,  330,    5,    6,    5,    8,    9,    8,  346,  338,
-      339,  347,  344,  347,  345,  349,  338,  339,  349,  350,
-       26,   10,   26,   26,   26,   24,   26,   26,   30,   10,
-       30,   30,  350,  350,   30,   37,   10,   37,   37,   37,
-       35,   37,   41,   10,   41,   52,   10,   52,   52,   52,
-
-       50,   52,   52,   52,  347,  346,   74,   10,   74,   74,
-       74,   72,   74,   74,   74,   74,   78,   10,   78,  350,
-       78,   97,   10,   97,   97,   97,   95,   97,   97,   97,
-      101,   10,  101,  114,   10,  114,  114,  114,  112,  114,
-      114,  114,  114,  118,   10,  118,  125,   10,  125,  125,
-      125,  123,  125,  350,  350,  129,   10,  129,  156,   10,
-      156,  156,  156,  154,  156,  156,  156,  156,  156,  160,
-       10,  160,  160,  169,   10,  169,  169,  169,  167,  169,
-      169,  173,   10,  173,  196,   10,  196,  196,  196,  194,
-      196,  196,  196,  196,  196,  196,  200,   10,  200,  207,
-
-       10,  207,  207,  207,  205,  207,  211,   10,  211,  236,
-       10,  236,  236,  236,  234,  236,  236,  236,  236,  240,
-       10,  240,  240,  259,   10,  259,  259,  259,  257,  259,
-      259,  259,  350,  263,   10,  263,  263,  286,   10,  286,
-      286,  286,  284,  286,  286,  286,  286,  290,   10,  290,
-      290,  297,   10,  297,  297,  297,  295,  297,  301,   10,
-      301,  314,   10,  314,  314,  314,  312,  314,  314,  314,
-      314,  318,   10,  318,  350,  318,  325,   10,  325,  325,
-      325,  323,  325,  329,   10,  329,   10,    0,    2,    2,
-        0,    4,    7,  341,  340,    0,    0,    0,    0,    0,
-
-        0,    0,   25,   27,   27,   27,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,   36,
-       38,   38,    0,   51,   53,   53,   53,   53,    0,    0,
-        0,   73,   75,   75,   75,   75,   75,   75,   75,    0,
-        0,   96,   98,   98,   98,   98,    0,  113,  115,  115,
-      115,  115,  115,    0,  124,  126,  126,    0,  155,  157,
-      157,  157,  157,  157,  157,  157,    0,  168,  170,  170,
-      170,    0,  195,  197,  197,  197,  197,  197,  197,  197,
-      197,  197,    0,  206,  208,  208,    0,  235,  237,  237,
-
-      237,  237,  237,  237,    0,  258,  260,  260,  260,  260,
-      260,    0,    0,  285,  287,  287,  287,  287,  287,    0,
-      296,  298,  298,    0,  313,  315,  315,  315,  315,  315,
-        0,    0,  324,  326,  326,    0,    0,    0,    0,    0,
-        3,    0,    0,    0,    0,    0,    0,    0,  348,    0,
-       27,   27,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,   38,
-        0,    0,   53,    0,    0,   53,    0,    0,    0,  343,
-       75,    0,    0,   75,   75,   75,   75,    0,    0,    0,
-
-       98,   98,   98,    0,    0,    0,    0,  115,  115,  115,
-        0,    0,  126,    0,    0,  157,    0,    0,  157,  157,
-      157,  157,    0,    0,    0,    0,  170,    0,    0,  197,
-        0,    0,    0,    0,  197,  197,  197,  197,  197,    0,
-        0,    0,    0,    0,    0,  237,    0,    0,  237,  237,
-      237,    0,    0,  260,  260,  260,  260,    0,    0,    0,
-      287,  287,  287,  287,    0,    0,    0,    0,    0,    0,
-      315,  315,  315,  315,    0,    0,    0,  326,    0,    0,
-        0,   14,    1,    0,    0,  336,    0,    0,    0,  333,
-      332,    0,    0,   27,   27,    0,    0,   29,    0,    0,
-
-        0,    0,    0,    0,    0,    0,    0,    0,    0,  103,
-        0,    0,    0,    0,    0,    0,    0,  102,    0,    0,
-        0,    0,    0,    0,   38,    0,    0,   40,    0,   53,
-        0,   45,   44,   53,    0,    0,    0,   55,    0,   75,
-        0,   59,   58,    0,    0,   75,    0,    0,   75,    0,
-        0,   77,    0,    0,   98,   98,   98,    0,    0,  100,
-        0,    0,  105,  104,  115,  115,  115,    0,    0,  117,
-        0,  126,    0,    0,  128,    0,  157,    0,  133,  132,
-      157,  157,  157,  157,    0,    0,  159,    0,    0,  164,
-      163,  170,    0,    0,  172,    0,  197,  197,    0,  187,
-
-      186,    0,  177,  176,    0,    0,  197,  197,  197,  197,
-        0,    0,  199,    0,    0,  204,  203,    0,    0,  210,
-        0,  237,    0,  215,  214,  237,  237,  237,    0,    0,
-      239,    0,  260,    0,    0,    0,    0,  260,    0,    0,
-        0,  262,    0,  287,    0,    0,  287,    0,    0,    0,
-        0,  289,    0,    0,  294,  293,    0,    0,  300,    0,
-      315,  315,  315,  315,    0,    0,  317,    0,    0,  326,
-        0,    0,  328,    0,    0,    0,  337,  331,    0,    0,
-        0,   27,   27,    0,    0,    0,    0,  131,    0,  213,
-        0,    0,  161,    0,    0,  103,    0,    0,    0,  130,
-
-      212,    0,    0,  102,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,   53,    0,    0,   75,    0,
-       63,   62,    0,    0,    0,   61,   60,   75,    0,  162,
-       98,    0,    0,   98,    0,  115,  115,  115,    0,  126,
-        0,  157,  157,  157,  157,  157,    0,  170,    0,  197,
-      197,    0,  189,  188,  197,  197,  197,  197,    0,    0,
-      237,  237,  237,  237,    0,  260,    0,  246,  245,    0,
-      244,  243,  260,  212,    0,  287,    0,  269,  268,  287,
-        0,  267,  266,    0,    0,  315,    0,    0,  315,  315,
-        0,    0,  326,    0,    0,    0,    0,   12,    0,  334,
-
-      335,    0,   27,   27,    0,    0,    0,    0,  131,    0,
-      213,    0,    0,    0,  161,    0,  265,   43,    0,    0,
-      130,  212,    0,  265,   42,    0,  264,    0,  264,   42,
-        0,   34,   33,    0,    0,   47,   46,   53,    0,    0,
-       75,    0,   65,   64,   75,    0,  162,   98,    0,    0,
-        0,    0,    0,    0,  115,  115,  115,    0,  116,  126,
-        0,  157,  157,  157,    0,    0,    0,    0,  157,    0,
-        0,    0,    0,    0,    0,  197,    0,    0,  197,  197,
-      197,    0,    0,  237,  237,  237,    0,    0,  237,    0,
-      260,  260,    0,    0,  287,  287,    0,    0,  315,    0,
-
-      305,  304,  315,  315,    0,    0,    0,    0,    0,    0,
-        0,    0,   11,    0,   27,   27,   27,    0,    0,    0,
-        0,    0,    0,    0,    0,   57,  265,    0,  202,   43,
-        0,    0,    0,   56,  201,   42,    0,  264,    0,    0,
-        0,    0,   53,    0,    0,   75,   75,    0,   98,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,   92,   91,
-        0,    0,    0,  115,    0,    0,    0,    0,    0,  157,
-      157,  157,    0,  135,  134,    0,    0,    0,  157,    0,
-      158,    0,  166,  165,    0,  171,    0,  191,  190,    0,
-        0,    0,  185,  184,    0,    0,  197,    0,    0,    0,
-
-        0,  237,  237,  237,    0,    0,    0,  237,    0,  238,
-        0,    0,  260,    0,    0,    0,    0,  287,    0,    0,
-      315,  315,  315,    0,    0,    0,  322,  321,    0,    0,
-        0,    0,    0,    0,    0,   27,   27,    0,    0,  175,
-      120,   32,    0,    0,  303,   57,    0,  202,    0,  174,
-      119,   56,  201,  302,    0,   31,    0,    0,   53,    0,
-        0,   54,   75,   75,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,  107,
-      106,    0,    0,    0,  109,  108,    0,  122,  121,    0,
-      157,  157,  157,    0,    0,  157,    0,  193,  192,    0,
-
-      179,  178,    0,    0,    0,  181,  180,    0,    0,  237,
-        0,    0,  237,  237,    0,    0,  237,    0,    0,    0,
-      260,    0,    0,    0,    0,    0,  287,    0,  288,    0,
-      315,  315,  315,    0,    0,    0,    0,    0,    0,   17,
-        0,   19,   18,   27,   27,    0,  319,  175,  120,   32,
-      291,   16,  303,    0,    0,  174,  119,  302,    0,   31,
-        0,    0,   53,  342,   75,   75,    0,   76,    0,   94,
-       93,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  111,  110,    0,  157,  157,  157,    0,
-        0,    0,    0,  157,    0,  183,  182,    0,    0,  209,
-
-      237,    0,  221,  220,  237,  237,    0,    0,    0,    0,
-      237,    0,    0,    0,    0,  260,  292,    0,    0,    0,
-        0,    0,  287,    0,    0,    0,  315,  315,    0,  320,
-        0,    0,    0,    0,   17,   27,   27,    0,  319,  291,
-       16,    0,    0,    0,    0,    0,   39,   53,    0,    0,
-       75,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  127,  157,  157,  157,    0,  141,    0,
-      140,  157,    0,  198,    0,    0,  237,  237,  237,    0,
-      225,    0,  224,  237,    0,    0,    0,    0,    0,    0,
-        0,    0,  292,    0,    0,    0,    0,    0,    0,    0,
-
-      287,    0,    0,  307,  306,    0,    0,  315,    0,  316,
-      320,    0,    0,    0,    0,    0,    0,   27,    0,   28,
-        0,    0,    0,    0,   53,    0,    0,    0,   75,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      157,  157,  157,  143,  142,    0,    0,    0,  217,  216,
-      237,  237,  237,  227,  226,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  287,  287,    0,  299,    0,  311,  310,
-        0,    0,    0,  327,    0,    0,    0,    0,   21,   20,
-        0,    0,  242,    0,  241,    0,    0,    0,    0,    0,
-
-        0,    0,   75,    0,    0,    0,    0,   84,    0,    0,
-        0,    0,   83,    0,  157,  157,  157,    0,  145,  144,
-      237,  237,  237,    0,  229,  228,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,  287,  287,    0,  309,  308,    0,    0,
-        0,    0,   23,   22,  242,    0,  241,    0,    0,   49,
-       48,    0,    0,    0,    0,   75,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  157,  157,  157,
-      237,    0,    0,  237,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-
-        0,  287,  287,    0,    0,    0,    0,   80,   79,    0,
-        0,    0,    0,    0,    0,    0,    0,   90,    0,    0,
-        0,   89,    0,    0,    0,  137,  136,  157,  157,  157,
-      157,  237,    0,  223,  222,  237,    0,    0,    0,    0,
-        0,    0,  256,    0,  255,    0,    0,  261,    0,    0,
-        0,    0,    0,    0,    0,    0,  287,    0,    0,  287,
-        0,    0,    0,    0,    0,    0,   80,   79,    0,    0,
-        0,    0,    0,   67,   66,    0,    0,    0,    0,    0,
-        0,    0,  157,  157,  157,  157,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,  254,  253,    0,    0,
-
-        0,    0,    0,    0,    0,  273,  272,  287,    0,  271,
-      270,  287,    0,    0,    0,    0,    0,    0,    0,   71,
-        0,   70,   88,    0,    0,   87,    0,    0,    0,   99,
-      157,  157,  157,  157,    0,  219,  218,    0,    0,    0,
-        0,    0,  250,    0,    0,  249,    0,    0,  281,    0,
-        0,  280,  287,  287,    0,    0,    0,   12,    0,   12,
-        0,    0,    0,   82,   86,   81,   85,  157,  157,  157,
-      157,    0,    0,    0,    0,  252,  248,  251,  247,  283,
-      279,  282,  278,  287,  287,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,  157,    0,
-
-        0,    0,    0,    0,    0,  287,  287,    0,    0,   69,
-       68,    0,  139,  138,    0,  149,  148,    0,  147,  146,
-      157,    0,  153,  152,    0,    0,    0,    0,  287,  287,
-        0,   11,  157,    0,    0,    0,    0,  287,  287,    0,
-      157,    0,    0,    0,    0,  287,  287,    0,  157,    0,
-        0,    0,    0,  287,  287,    0,    0,    0,    0,  231,
-        0,  230,  287,  287,    0,    0,  151,  150,  233,  232,
-      287,  287,    0,  287,  287,    0,  287,  287,    0,    0,
-      287,  287,    0,    0,  287,  287,    0,    0,  287,  287,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,  277,
-
-      276,    0,  275,  274,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       13,    0
-    } ;
-
-static yyconst flex_int32_t yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    2,    4,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    5,    6,    7,    1,    1,    8,    9,    1,
-        1,    1,    1,    1,   10,   11,   12,   13,   13,   13,
-       13,   14,   13,   13,   13,   15,   13,   16,   17,   18,
-       19,   20,   21,    1,   22,   23,   24,   25,   26,   27,
-       28,   29,   30,   28,   31,   32,   33,   34,   35,   36,
-       28,   37,   38,   39,   28,   40,   41,   28,   42,   28,
-       43,    1,   44,    1,   45,    1,   46,   47,   48,   49,
-
-       50,   51,   52,   53,   54,   28,   55,   56,   57,   58,
-       59,   60,   61,   62,   63,   64,   65,   66,   67,   68,
-       69,   28,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst flex_int32_t yy_meta[70] =
-    {   0,
-        1,    2,    2,    2,    1,    1,    1,    1,    1,    3,
-        3,    1,    4,    4,    4,    5,    6,    1,    7,    8,
-        1,    9,    9,    9,    9,    9,    9,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    1,    1,    5,    9,    9,    9,    9,    9,
-        9,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5
-    } ;
-
-static yyconst flex_int16_t yy_base[2256] =
-    {   0,
-        0,    0,    0,    3,    6,    9,   12,   29,   16,   19,
-       14,   17,   33,   36,   49,   55,   45,   61,   66,   72,
-      105,  173,   75,   78,   83,  125,  128,  132,  135,  138,
-      193,  196,  200,  203,  206,  224,  242,  293,  262,  265,
-      344,  404,  271,  273,  464,  527,  269,  316,  320,  323,
-      364,  367,  371,  374,  590,  654,  424,  427,  718,  781,
-      431,  434,  844,  907,  484,  487,  491,  494,  497,  547,
-      970, 1033,  550,  554,  557,  560,  610,  613,  617,  620,
-     1096, 1162,  623,  674, 1228,    0,  677,  681, 1297, 1351,
-      684,  687, 1405, 1468,  738,  741,  745,  748,  751,  801,
-
-      804,  808, 1531, 1594,  811,  814,  864,  867,  871,  874,
-      877,  927, 1657, 1720,  930,  934,  937,  940,  990,  993,
-      997, 1000, 1783, 1837, 1003, 1053, 1891, 1954, 1056, 1060,
-     1063, 1066, 1116, 1119, 1123, 1126, 2017, 2083, 1129, 1182,
-        0,    0, 5066, 7094, 7094,   95,  100,   29,   41, 7094,
-      155,   51, 7094, 7094, 5055, 7094, 7094, 5043, 7094, 5058,
-     5042, 1141, 7094, 7094, 7094, 7094, 5036, 5032, 4990,  210,
-     7094,  158, 5012,    0,  142, 7094, 4977, 4969, 7094,  162,
-     2145, 2205,  160, 5007,  176, 7094,  165, 4998,    0,  149,
-     7094, 4961, 7094,  230,  378, 7094,  326, 4994,    0,  208,
-
-     7094, 4958, 4949, 4947,  379, 4950, 7094,  329, 4972,    0,
-      214, 7094, 4938, 4937,  238, 4915, 7094,  377,   11,   31,
-     4965, 7094,  399, 4948,    0,  435, 7094, 4907, 4905, 4888,
-     7094,  457,  441, 7094,  520, 4922,    0,  436, 7094, 4892,
-     4870, 4871, 4851, 7094,  583,  498, 7094,  640, 4894,    0,
-      499, 7094, 4862,  513, 4840, 7094,  644, 4879, 7094,  647,
-     4870,    0,  562, 7094, 4802,   34, 4821, 4797, 4788, 7094,
-      704,  177, 4838, 7094,  708, 4827,    0,  568, 7094, 4793,
-     4783, 7094,  711,  752, 7094,  772, 4808,    0,  631, 7094,
-      211, 4777, 4775,   93, 4773, 4753, 7094,  834,  818, 7094,
-
-      894, 4796,    0,  632, 7094, 4753, 7094,  897,  881, 7094,
-      901, 4781,    0,  695, 7094, 4739, 4735, 4736,   80, 7094,
-      957,  360, 4765, 7094,  960, 4755,    0,  696, 7094, 4726,
-     4709,   26,  304, 7094,  963,  330, 4746, 7094, 1149, 4726,
-        0,  885, 7094, 4694, 4675, 4679, 4673, 7094, 1152,  499,
-     4721, 7094, 1155, 4705,    0,  948, 7094, 4672, 7094, 1186,
-     1005, 7094, 1192, 4696,    0, 1004, 7094, 4650, 4654, 4655,
-     4643, 7094, 1205, 1100, 4694, 4691, 7094, 1208, 4678,    0,
-     1007, 7094, 4650, 7094, 1211, 1068, 1215,  429, 4627, 7094,
-     4683, 4665, 7094, 7094, 7094, 1306,  283, 4614, 4612, 4607,
-
-     4647, 4609, 7094,    0, 4598, 4601, 4586, 4583, 4584, 4580,
-     4574, 4570, 4573,    4,  166, 4567, 4554, 4558, 4546, 4545,
-     4541,  404, 4544, 4530,   38,  467, 4530,  712, 4523, 7094,
-        0, 4526, 4527, 7094,    0, 4523, 1320, 4516,  533, 4512,
-     4555, 7094,    0, 4514, 1323, 4486, 4507, 4493, 4497, 4477,
-       89, 7094,    0, 4488, 4462, 4473, 4453, 7094,    0, 1326,
-     4459, 4459, 4455, 4435, 7094,    0, 4429, 4441, 7094,    0,
-     4444, 1329, 4422, 4400, 4400, 4419, 4407, 7094,    0, 1373,
-     4398, 4393, 7094,    0, 4406, 1377, 1380, 4375, 4371, 4386,
-     4372, 4366, 4367, 7094,    0, 1383, 4348, 7094,    0, 4351,
-
-     1425, 4340, 4357, 4355, 4340, 7094,    0, 4327, 4326, 4340,
-     4326, 4323, 4308, 7094,    0, 4305, 4289, 4291, 4298, 4283,
-     7094,    0, 1428, 4287, 7094,    0, 4277, 4271, 4272, 4280,
-     4264, 4261, 7094,    0, 4265, 4267, 4286, 4295,  807, 4246,
-     7094, 1207,    0, 4229, 4229, 4269, 4268, 4224, 7094, 4231,
-     4213, 4213, 1431, 1434, 4218, 4203, 4205, 4201, 4215, 4194,
-     4202, 4187, 4187, 4178, 4170, 4186, 4165, 4167, 4164, 4155,
-     4154, 4145, 4145, 4157, 4143, 4135, 4141, 4122, 4139, 4128,
-     1437, 1489, 4127, 1494, 1497, 4108, 4137, 1551, 1556, 7094,
-     4106, 1559, 1514, 1562, 4097, 1565, 4108, 1619, 1627, 4090,
-
-     4091, 4097, 4083, 1622, 1630, 1677, 1583, 4079, 4065, 4067,
-     1682, 1695, 4068, 1685, 1740, 4058, 1691, 1642, 4059, 4062,
-     4056, 4037, 1745, 1748, 1751, 1710, 4035, 1755, 1808,  583,
-     1811, 1814, 1857, 1860, 1869, 4032, 4030, 4025, 4021, 1911,
-     1920, 1914, 1880, 1917, 1923, 4022, 1926, 1975, 4014, 3994,
-     3987, 1983, 1986, 3996, 1989, 1992, 3981, 3977, 2039, 2046,
-     3979, 1997, 3983, 2043, 2049, 2052, 2061, 2072, 2104, 2110,
-     3976, 3952, 3959, 3943, 2113, 2116, 3952, 3927, 2119, 2138,
-     3970, 7094, 7094,  315, 3922, 7094, 3934, 3933, 3878, 7094,
-     7094, 3872, 3870, 3879, 3868, 2141, 2149, 7094, 2168, 3865,
-
-     3859, 3871, 3849, 3854, 3849, 3830,  261, 3839, 3819, 1223,
-     3834, 3802, 3814, 3798, 3796, 3801, 3784, 1332, 3795,  384,
-     3777, 3784, 3774, 3788, 2144, 2172, 2177, 7094, 2182, 2209,
-     2216, 7094, 7094, 2229, 3810, 2232, 2235, 7094, 2240, 3756,
-     2268, 7094, 7094, 2243, 2276, 2287, 2290, 2293, 3767, 2301,
-     2308, 7094, 2311,  432, 3761, 2314, 3760, 2320, 2323, 7094,
-     2332, 2335, 7094, 7094, 3754, 3751, 3743, 2343, 2346, 7094,
-     2351, 3739, 2354, 2357, 7094, 2377, 3735, 2380, 7094, 7094,
-     3728, 3721, 3717, 3727, 2388, 2391, 7094, 2396, 2400, 7094,
-     7094, 3722, 2410, 2415, 7094, 2418, 3702, 3717, 2422, 7094,
-
-     7094, 2438, 7094, 7094, 2430, 2448, 3700, 3698, 3703, 3695,
-     2458, 2461, 7094, 2464, 2467, 7094, 7094, 2483, 2486, 7094,
-     2489, 3673, 2492, 7094, 7094, 3679, 3672, 3662, 2508, 2511,
-     7094, 2514, 3611, 2517, 2521, 2536, 2539, 3618, 3612, 2547,
-     2554, 7094, 2557, 3602, 2560, 2567, 3607, 2578, 2581, 2589,
-     2592, 7094, 2596, 2599, 7094, 7094, 2611, 2615, 7094, 2621,
-     3590, 2624, 3607, 3576, 2630, 2634, 7094, 2642, 3573, 3586,
-     2645, 2649, 7094, 2653,  726, 2656, 7094, 7094, 3618, 3616,
-     3569, 3560, 3587, 2664, 3545, 3528, 3544, 1386, 3520, 2152,
-     3533, 3532, 1460, 3512, 3519, 1463, 3518, 3502, 3518, 1523,
-
-     2678, 3504, 3511, 1526, 3497, 3496, 3494, 3478, 3491, 3490,
-     2668, 2686, 2694, 2700, 2704, 3489, 3504, 2713, 3479, 2718,
-     7094, 7094, 2727, 2732, 2745, 7094, 7094, 3473, 2740, 1650,
-     3457, 2753, 2760, 2771, 2774, 3446, 3466, 3439, 2777, 3457,
-     2780, 3458, 3452, 3436, 2783, 2789, 2801, 2807, 2811, 2814,
-     2821, 2833, 7094, 7094, 2825, 2843, 2847, 2850, 2853, 2856,
-     3442, 3447, 3431, 2876, 2879, 3430, 2885, 7094, 7094, 2894,
-     7094, 7094, 3418, 2903, 2906, 3419, 2921, 7094, 7094, 3412,
-     2929, 7094, 7094, 2937, 2940, 3420, 2910, 2943, 3401, 3418,
-     2951, 3402, 2959, 2962,  181, 3437, 2965, 7094, 3436, 7094,
-
-     7094, 3395, 3388,  518, 2970, 3395, 3393, 3394, 1705, 3391,
-     1769, 3387, 3375, 3365, 1774, 3370, 2973, 2977, 3375, 3365,
-     1777, 1829, 3354, 2984, 2994, 3347, 3000, 3358, 3003, 3009,
-     3020, 7094, 7094, 3030, 3034, 7094, 7094, 3351, 3362, 3049,
-     3328, 3052, 7094, 7094, 3325, 3064, 1832, 3325, 3068, 1059,
-     1113, 3045, 3076, 3084, 3087, 3090, 3094, 3098, 7094, 3108,
-     3112, 3337, 3333, 3317, 3117, 3122, 3135, 3138, 3328, 3146,
-     3149, 3153, 3161, 3167, 3170, 3180, 3185, 3188, 3198, 3203,
-     3206, 3209, 3212, 3328, 3307, 3321, 3216, 3224, 3321, 3234,
-     3237, 3241, 3322, 3244, 3247, 3265, 3268, 3273, 3310, 3276,
-
-     7094, 7094, 3313, 3302, 3288, 3306, 3293, 3296, 3311, 1422,
-      612,  568, 7094, 3279, 3317, 3320, 3323, 3326, 3282, 3275,
-     3282, 3267, 3252, 3249, 3246, 1875, 1945, 3250, 1948, 2010,
-     3258, 3242, 3248, 3330, 3341, 3345, 3224, 3348, 3229, 3233,
-     3233, 3351, 3226, 3243, 3355, 3204, 3207, 3358, 3361, 3236,
-     3222,  260, 3220, 3231, 3217,  421, 3207, 3384, 7094, 7094,
-     3392, 3395, 3400, 3414, 3417, 3420, 3428, 3435, 3446, 3180,
-     3169, 3172, 3449, 7094, 7094, 3458, 3188, 3186, 3149, 3466,
-     7094, 3469, 7094, 7094, 3477, 7094, 3481, 7094, 7094, 3489,
-     3496, 3507, 7094, 7094, 3515, 3518, 3526, 3529, 3533, 3547,
-
-     3550, 3134, 3553, 3151, 3556, 3160, 3158, 3131, 3571, 7094,
-     3574, 3577, 3585, 3116, 3597, 3592, 3612, 3603, 3606, 3621,
-     3120, 3120, 3121, 3625, 3109, 3628, 7094, 7094, 3640,  808,
-     1330,  747, 3104, 3644, 3647, 3655, 3662, 3669, 3096, 3673,
-     3676, 3680, 3087, 3086, 3683, 3689, 3070, 3692, 3074, 3695,
-     3698, 3701, 3704, 3707, 3065, 3712, 3070, 3715, 3068, 3074,
-     3718, 7094, 3046, 3061, 3721, 3726, 3730, 3071, 3065, 3044,
-     3047, 3035, 3041, 3035, 3024, 3026, 3018, 3740, 3744, 7094,
-     7094, 3752, 3755, 3764, 7094, 7094, 3772, 7094, 7094, 3780,
-     3001, 2995, 2985,  669,  743, 2986, 3783, 7094, 7094, 3792,
-
-     7094, 7094, 3800, 3803, 3811, 7094, 7094, 3819, 3822, 2988,
-     3825, 3828, 2988, 2970,  806,  857, 2972, 3843,  358,  361,
-     3851, 2962, 3854, 3857,  658,  785, 3865, 3869, 7094, 3873,
-     3876, 2968, 2960, 3883, 2950, 3894, 3888,  927, 1009, 3898,
-     3903, 7094, 7094, 3913, 3916, 3922, 3925, 3936, 3941, 3945,
-     3951, 3954, 3957, 2953, 2950, 3960, 3963, 3967, 2938, 3970,
-     2934, 3973, 2927, 7094, 3979, 2920, 3982, 7094, 3985, 7094,
-     7094, 2958, 2920, 2932, 2925, 2925, 2925, 2909, 2911, 2905,
-     2902, 3993, 3997, 7094, 7094, 4005, 2868, 2859, 2848, 2865,
-     2878, 2850, 2865, 2818, 4008, 7094, 7094, 4016, 4019, 7094,
-
-     4024, 4028, 7094, 7094, 2810, 2784, 2761, 2746, 2713, 2723,
-     2624,   81,  919,  466,  985, 4038, 4042, 4045,  474, 1048,
-      477, 1057, 4051, 4056, 4059, 4071, 4064,  527, 4082, 4085,
-     4088, 4091,  748,  840, 4095, 4101, 4113, 4119, 4122, 4125,
-     4131,  518,  548,  565,  624, 4134, 7094,  665, 4138, 4141,
-      706,  738,  786,  838,  838,  886,  894,  901,  915,  912,
-      931, 4156, 4162, 7094,  934,  971,  965, 1025, 7094, 1023,
-     7094, 4165, 4168, 7094, 4171, 4177,  998, 1005, 1019, 1080,
-     7094, 1115, 7094, 4189, 1109, 1100, 1117, 1135, 1140, 1165,
-     4192, 4195, 4203, 4213, 1166, 1160, 1173, 1175, 1165, 1178,
-
-     4216, 4219, 4222, 7094, 7094, 4234, 4238, 4247, 4252, 7094,
-     4255, 4258, 1293, 1347, 1384, 4271, 4278, 4289, 4292, 7094,
-     1169, 1287, 1284, 1293, 4295, 4298, 1366, 1470, 1285, 1316,
-     1325, 1349, 1371, 1391, 1368, 1378, 1397, 1423, 1437, 4307,
-     1381, 1403, 1403, 7094, 7094, 4313, 4316, 4327, 7094, 7094,
-     1402, 1410, 1430, 7094, 7094, 4335, 4338, 1457, 1463, 1468,
-     1468, 1469, 1474, 4346, 1548, 1549, 4354, 1477, 1480, 1485,
-     1519, 1518, 1534, 4357, 4360, 4364, 7094, 4369, 7094, 7094,
-     4378, 4383, 4391, 7094, 1573, 1552, 1559, 4396, 7094, 7094,
-     4404, 4410, 4422, 1525, 4425, 1540, 4428, 4431, 1579, 1598,
-
-     1590, 1606, 1577, 1611, 1601, 1607, 1615, 7094, 1631, 1642,
-     1641, 1650, 7094, 4439, 4442, 1646, 1659, 4446, 7094, 7094,
-     1661, 4454, 1670, 4460, 7094, 7094, 1699, 1710, 1730, 1724,
-     1726, 1741, 1747, 1779, 1771, 1782, 4468, 1772, 1783, 1795,
-     1785, 1788, 1799, 4472, 4475, 4493, 7094, 7094, 1916, 1833,
-     4481, 4501, 7094, 7094, 4478, 1765, 4509, 1801, 4512, 7094,
-     7094, 1845, 1834, 1852, 1841, 4522, 1848, 1868, 1901, 1910,
-     1899, 1917, 1932, 1931, 4525, 4528, 4531, 1919, 1995, 1921,
-     1952, 4540, 4546, 1935, 1980, 1989, 1999, 2009, 2018, 2033,
-     2062, 2032, 2062, 2035, 4554, 2047, 2053, 2048, 2069, 2083,
-
-     2076, 4558, 4561, 2108, 4564, 4567, 4587, 4595, 4598, 2091,
-     2104, 2097, 2107, 4606, 4609, 2105, 2105, 7094, 2107, 2109,
-     2130, 7094, 2132, 4617, 4620, 7094, 7094, 2111, 2117, 2123,
-     2131, 4628, 4632, 7094, 7094, 4640, 2157, 2149, 2162, 2164,
-     2156, 2169, 7094, 2189, 7094, 2194, 4646, 7094, 2179, 2172,
-     2190, 2191, 2187, 2198, 4649, 4652, 4660, 4667, 4671, 4680,
-     2204, 4685, 4688, 4708, 4747, 4791, 4698, 4716, 2202, 2223,
-     2215, 2232, 4720, 7094, 7094, 2243, 2218, 2222, 2248, 2232,
-     2234, 4737, 2217, 2227, 2218, 2217, 4741, 4728, 4759, 4767,
-     2257, 2259, 2281, 2272, 2275, 2292, 7094, 7094, 2281, 2283,
-
-     2313, 2294, 2304, 2321, 4777, 7094, 7094, 4785, 4811, 7094,
-     7094, 4803, 2345, 4821, 2356, 2355, 4857, 4901, 2318, 7094,
-     2328, 7094, 7094, 2345, 2361, 7094, 2359, 2361, 4829, 7094,
-     2322, 2307, 2336, 2337, 4834, 7094, 7094, 4842, 2410, 2418,
-     2382, 2390, 7094, 2392, 2396, 7094, 2404, 2417, 7094, 2418,
-     2420, 7094, 4851, 4869, 2423, 2452, 2454, 2430, 2488, 2437,
-     4877, 2438, 2440, 7094, 7094, 7094, 7094, 4880, 4892, 4921,
-     4924, 2457, 2453, 2461, 2470, 7094, 7094, 7094, 7094, 7094,
-     7094, 7094, 7094, 4927, 4932, 4935, 2494, 2481, 2495, 4945,
-     2499, 2498, 4950, 4883, 4954, 4958, 4968, 4972, 2460, 4980,
-
-     4987, 2487, 2510, 2494, 2513, 4998, 5001, 5004, 2517, 7094,
-     7094, 5007, 7094, 7094, 5019, 7094, 7094, 5027, 7094, 7094,
-     2494, 5035, 7094, 7094, 2510, 2510, 2516, 2516, 5045, 5048,
-     2546, 7094, 2517, 2538, 2549, 2548, 2560, 5051, 5054, 2569,
-     2538, 2570, 2585, 2575, 2595, 5057, 5075, 2601, 5078, 2603,
-     2624, 2613, 2633, 5081, 5084, 2665, 5087, 5110, 2657, 7094,
-     2655, 7094, 5118, 5121, 2666, 5139, 7094, 7094, 7094, 7094,
-     5147, 5150, 5153, 5156, 5159, 5168, 5182, 5187, 2655, 2663,
-     5194, 5201, 2658, 2691, 5205, 5208, 2680, 2738, 5212, 5226,
-     2673, 2719, 5231, 5237, 5253, 5256, 2703, 2739, 5264, 7094,
-
-     7094, 5273, 7094, 7094, 2778, 2787, 2747, 2750, 2850, 2852,
-     2799, 2818, 2689, 2748, 2855, 2866, 2800, 2881, 5281, 5284,
-     7094, 7094, 5304, 5313, 5322, 5331, 5340, 5349, 5358, 5367,
-     5376, 5385, 5394, 5403, 5412, 5421, 5430, 5439, 5448, 5457,
-     5466, 5475, 5484, 5493, 5502, 5511, 5520, 5529, 5538, 5547,
-     5556, 5565, 5574, 5583, 5592, 5601, 5610, 5619, 5628, 5637,
-     5646, 5653, 5660, 5667, 5674, 5681, 5688, 5695, 5702, 5709,
-     5716, 5723, 5730, 5737, 5744, 5751, 5758, 5765, 5774, 5779,
-     5784, 5789, 5794, 5799, 5804, 5809, 5814, 5819, 5826, 5831,
-     5838, 5843, 5850, 5855, 5862, 5867, 5874, 5879, 5886, 5891,
-
-     5898, 5903, 5910, 5915, 5924, 5930, 5937, 5945, 5952, 5960,
-     5967, 5975, 5982, 5990, 5997, 6005, 6012, 6020, 6027, 6035,
-     6042, 6050, 6057, 6065, 6072, 6080, 6088, 6095, 6103, 6110,
-     6118, 6125, 6133, 6141, 6148, 6156, 6163, 6171, 6180, 6186,
-     6193, 6201, 6209, 6217, 6225, 6233, 6240, 6248, 6255, 6263,
-     6270, 6278, 6285, 6293, 6300, 6308, 6315, 6323, 6330, 6338,
-     6346, 6353, 6361, 6368, 6376, 6383, 6391, 6399, 6406, 6414,
-     6421, 6429, 6438, 6447, 6454, 6462, 6470, 6477, 6485, 6492,
-     6500, 6507, 6515, 6522, 6530, 6537, 6545, 6552, 6560, 6568,
-     6576, 6584, 6592, 6600, 6607, 6615, 6622, 6630, 6637, 6645,
-
-     6653, 6660, 6668, 6676, 6684, 6693, 6702, 6709, 6717, 6725,
-     6732, 6740, 6747, 6755, 6762, 6770, 6778, 6786, 6794, 6801,
-     6809, 6817, 6825, 6833, 6841, 6848, 6856, 6864, 6872, 6880,
-     6888, 6896, 6903, 6911, 6919, 6928, 6937, 6945, 6953, 6961,
-     6968, 6976, 6983, 6991, 6999, 7007, 7015, 7023, 7030, 7039,
-     7048, 7057, 7066, 7075, 7084
-    } ;
-
-static yyconst flex_int16_t yy_def[2256] =
-    {   0,
-     2023, 2023, 2024, 2024, 2024, 2024, 2025, 2025, 2026, 2026,
-     2027, 2027, 2028, 2028, 2028, 2028, 2029, 2029, 2023, 2023,
-     2030, 2030, 2031, 2031, 2031, 2031, 2023, 2023, 2031, 2031,
-     2023, 2023, 2031, 2031, 2031, 2031, 2032, 2032, 2033, 2033,
-     2034, 2034, 2028, 2028, 2035, 2035, 2036, 2036, 2023, 2023,
-     2036, 2036, 2036, 2036, 2037, 2037, 2038, 2038, 2039, 2039,
-     2040, 2040, 2041, 2041, 2023, 2023, 2023, 2023, 2042, 2042,
-     2043, 2043, 2044, 2044, 2023, 2023, 2044, 2044, 2044, 2044,
-     2045, 2045, 2046, 2046, 2022,   85, 2047, 2047, 2048, 2048,
-     2049, 2049, 2050, 2050, 2051, 2051, 2023, 2023, 2051, 2051,
-
-     2051, 2051, 2052, 2052, 2023, 2023, 2023, 2023, 2053, 2053,
-     2053, 2053, 2054, 2054, 2055, 2055, 2023, 2023, 2055, 2055,
-     2055, 2055, 2056, 2056, 2057, 2057, 2058, 2058, 2059, 2059,
-     2023, 2023, 2059, 2059, 2059, 2059, 2060, 2060, 2061, 2061,
-     2023, 2023, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2062, 2022, 2022, 2062, 2062, 2022, 2022,
-     2022, 2022,  181,  182,  182, 2022, 2022, 2022, 2063, 2022,
-     2022, 2063, 2022, 2022, 2022, 2022, 2022, 2022, 2064, 2022,
-
-     2022, 2064, 2064, 2064, 2022, 2022, 2022, 2022, 2022, 2065,
-     2022, 2022, 2065, 2065, 2065, 2065, 2022, 2022,  185,  185,
-      185, 2022, 2022, 2022, 2066, 2022, 2022, 2066, 2066, 2066,
-     2022, 2022, 2022, 2022, 2022, 2022, 2067, 2022, 2022, 2067,
-     2067, 2067, 2067, 2022, 2022, 2022, 2022, 2022, 2022, 2068,
-     2022, 2022, 2068,  185,  254, 2022, 2022,  185, 2022, 2022,
-     2022, 2069, 2022, 2022, 2069, 2069, 2069, 2069, 2069, 2022,
-     2022,  185,  185, 2022, 2022, 2022, 2070, 2022, 2022, 2070,
-     2070, 2022, 2022, 2022, 2022, 2022, 2022, 2071, 2022, 2022,
-     2071, 2071, 2071, 2071, 2071, 2071, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2072, 2022, 2022, 2072, 2022, 2022, 2022, 2022,
-     2022, 2022, 2073, 2022, 2022, 2073, 2073, 2073, 2073, 2022,
-     2022,  185,  185, 2022, 2022, 2022, 2074, 2022, 2022, 2074,
-     2074, 2074,  185, 2022, 2022,  185,  185, 2022, 2022, 2022,
-     2075, 2022, 2022, 2075, 2075, 2075, 2075, 2022, 2022,  185,
-      185, 2022, 2022, 2022, 2076, 2022, 2022, 2076, 2022, 2022,
-     2022, 2022, 2022, 2022, 2077, 2022, 2022, 2077, 2077, 2077,
-     2077, 2022, 2022,  185,  374,  185, 2022, 2022, 2022, 2078,
-     2022, 2022, 2078, 2022, 2022, 2022, 2022, 2079, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2062, 2062, 2062, 2080, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2063, 2063, 2081, 2022, 2064, 2064, 2064, 2064, 2022, 2082,
-     2022, 2022, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2083,
-     2022, 2022, 2066, 2066, 2066, 2066, 2084, 2022, 2067, 2067,
-     2067, 2067, 2067, 2085, 2022, 2068, 2068, 2086, 2022, 2069,
-     2069, 2069, 2069, 2069, 2069, 2069, 2087, 2022, 2070, 2070,
-     2070, 2088, 2022, 2089, 2089, 2089, 2089, 2089, 2089, 2089,
-     2089, 2089, 2090, 2022, 2091, 2091, 2092, 2022, 2093, 2093,
-
-     2093, 2093, 2093, 2093, 2094, 2022, 2095, 2095, 2095, 2095,
-     2095, 2022, 2096, 2022, 2097, 2097, 2097, 2097, 2097, 2098,
-     2022, 2099, 2099, 2100, 2022, 2101, 2101, 2101, 2101, 2101,
-     2102, 2022, 2022, 2103, 2103, 2104, 2105, 2022, 2105, 2022,
-     2022, 2022, 2106, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2107, 2107, 2108, 2108, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2109,
-     2110, 2110, 2111, 2022, 2022, 2111, 2022, 2112, 2112, 2022,
-     2113, 2022, 2022, 2113, 2113, 2113, 2113, 2114, 2114, 2022,
-
-     2115, 2115, 2115, 2116, 2116, 2022, 2022, 2117, 2117, 2117,
-     2118, 2118, 2119, 2120, 2120, 2121, 2022, 2022, 2121, 2121,
-     2121, 2121, 2122, 2122, 2022, 2022, 2123, 2124, 2124, 2125,
-     2022, 2022, 2022, 2022, 2125, 2125, 2125, 2125, 2125, 2126,
-     2126, 2022, 2022, 2127, 2127, 2128, 2022, 2022, 2128, 2128,
-     2128, 2129, 2129, 2130, 2130, 2130, 2130, 2022, 2131, 2131,
-     2132, 2132, 2132, 2132, 2133, 2133, 2022, 2022, 2134, 2134,
-     2135, 2135, 2135, 2135, 2136, 2136, 2022, 2137, 2138, 2138,
-     2139, 2022, 2022, 2139, 2022, 2022, 2140, 2022, 2022, 2022,
-     2022, 2022, 2022, 2141, 2141, 2022, 2142, 2022, 2142, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2143, 2022, 2144, 2022, 2144, 2145,
-     2022, 2022, 2022, 2145, 2022, 2022, 2146, 2022, 2146, 2147,
-     2022, 2022, 2022, 2022, 2022, 2147, 2022, 2022, 2147, 2022,
-     2148, 2022, 2148, 2022, 2149, 2149, 2149, 2022, 2150, 2022,
-     2150, 2022, 2022, 2022, 2151, 2151, 2151, 2022, 2152, 2022,
-     2152, 2153, 2022, 2154, 2022, 2154, 2155, 2022, 2022, 2022,
-     2155, 2155, 2155, 2155, 2022, 2156, 2022, 2156, 2022, 2022,
-     2022, 2157, 2022, 2158, 2022, 2158, 2159, 2159, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2159, 2159, 2159, 2159,
-     2022, 2160, 2022, 2160, 2022, 2022, 2022, 2022, 2161, 2022,
-     2161, 2162, 2022, 2022, 2022, 2162, 2162, 2162, 2022, 2163,
-     2022, 2163, 2164, 2022, 2022, 2022, 2022, 2164, 2022, 2022,
-     2165, 2022, 2165, 2166, 2022, 2022, 2166, 2022, 2022, 2022,
-     2167, 2022, 2167, 2022, 2022, 2022, 2022, 2168, 2022, 2168,
-     2169, 2169, 2169, 2169, 2022, 2170, 2022, 2170, 2022, 2171,
-     2022, 2172, 2022, 2172, 2173, 2174, 2022, 2022, 2022, 2022,
-     2022, 2175, 2175, 2176, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2177, 2022, 2022, 2178, 2022, 2179, 2180, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2180, 2181, 2022,
-     2182, 2022, 2022, 2182, 2183, 2184, 2184, 2184, 2185, 2186,
-     2187, 2188, 2188, 2188, 2188, 2188, 2189, 2190, 2191, 2192,
-     2192, 2022, 2022, 2022, 2192, 2192, 2192, 2192, 2193, 2194,
-     2195, 2195, 2195, 2195, 2196, 2197, 2022, 2022, 2022, 2022,
-     2022, 2022, 2197, 2022, 2198, 2199, 2022, 2022, 2022, 2199,
-     2022, 2022, 2022, 2200, 2201, 2202, 2022, 2022, 2202, 2202,
-     2203, 2022, 2204, 2205, 2206, 2207, 2207, 2022, 2207, 2022,
-
-     2022, 2022, 2208, 2208, 2209, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2210, 2022, 2022, 2022, 2211, 2022, 2212,
-     2213, 2022, 2022, 2022, 2213, 2214, 2022, 2215, 2022, 2022,
-     2022, 2022, 2022, 2216, 2217, 2217, 2217, 2022, 2022, 2218,
-     2219, 2220, 2220, 2220, 2022, 2022, 2022, 2022, 2220, 2221,
-     2022, 2022, 2222, 2022, 2022, 2223, 2022, 2022, 2223, 2223,
-     2223, 2224, 2225, 2226, 2226, 2226, 2022, 2022, 2226, 2227,
-     2228, 2228, 2022, 2229, 2230, 2230, 2231, 2232, 2233, 2022,
-
-     2022, 2022, 2233, 2233, 2234, 2022, 2022, 2022, 2235, 2236,
-     2237, 2237, 2022, 2022, 2238, 2238, 2238, 2239, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2240, 2241, 2022, 2242, 2243, 2243, 2244, 2245, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2246, 2022, 2022, 2247, 2022, 2022, 2022, 2022, 2248, 2249,
-     2249, 2249, 2022, 2022, 2022, 2022, 2022, 2022, 2249, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2223, 2022, 2022, 2224,
-
-     2225, 2226, 2226, 2226, 2022, 2022, 2022, 2226, 2022, 2022,
-     2022, 2022, 2228, 2022, 2229, 2022, 2022, 2230, 2231, 2232,
-     2233, 2233, 2233, 2234, 2022, 2022, 2022, 2022, 2235, 2236,
-     2237, 2237, 2022, 2022, 2022, 2238, 2238, 2239, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2240, 2241, 2022,
-     2022, 2022, 2243, 2243, 2244, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2246, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2248,
-     2249, 2249, 2249, 2022, 2022, 2249, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2224, 2225, 2226,
-     2022, 2022, 2226, 2226, 2022, 2022, 2226, 2022, 2022, 2022,
-     2228, 2022, 2229, 2022, 2022, 2022, 2230, 2022, 2022, 2232,
-     2233, 2233, 2233, 2234, 2022, 2235, 2236, 2237, 2237, 2022,
-     2022, 2022, 2022, 2238, 2238, 2239, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2240, 2241, 2022, 2243, 2243, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2246, 2022, 2022, 2022, 2248, 2249, 2249, 2249, 2022,
-     2022, 2022, 2022, 2249, 2022, 2022, 2022, 2224, 2022, 2022,
-
-     2226, 2022, 2022, 2022, 2226, 2226, 2022, 2022, 2022, 2022,
-     2226, 2022, 2022, 2022, 2022, 2228, 2022, 2229, 2022, 2022,
-     2022, 2022, 2230, 2232, 2022, 2022, 2233, 2233, 2234, 2022,
-     2235, 2236, 2237, 2237, 2022, 2238, 2238, 2239, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2241, 2022, 2022,
-     2243, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2246, 2022, 2022, 2249, 2249, 2249, 2022, 2022, 2022,
-     2022, 2249, 2022, 2022, 2022, 2022, 2226, 2226, 2226, 2022,
-     2022, 2022, 2022, 2226, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2229, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2230, 2232, 2022, 2022, 2022, 2022, 2022, 2233, 2022, 2022,
-     2022, 2235, 2236, 2237, 2237, 2022, 2022, 2238, 2022, 2022,
-     2022, 2022, 2022, 2022, 2241, 2022, 2022, 2022, 2243, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2246,
-     2249, 2249, 2249, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2226, 2226, 2226, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2229, 2022, 2022, 2022,
-     2022, 2022, 2022, 2230, 2230, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2236, 2237, 2237, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2243, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2246, 2249, 2249, 2249, 2022, 2022, 2022,
-     2226, 2226, 2226, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2229, 2022, 2022, 2022,
-     2022, 2022, 2022, 2230, 2230, 2022, 2022, 2022, 2236, 2237,
-     2237, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2243, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2246, 2022, 2022, 2249, 2249, 2249,
-     2226, 2022, 2022, 2226, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2229, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2230, 2230, 2236, 2237, 2237, 2237, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2246, 2022, 2022, 2022, 2249, 2249, 2249,
-     2249, 2226, 2022, 2022, 2022, 2226, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2230, 2022, 2022, 2230,
-     2236, 2237, 2237, 2237, 2250, 2251, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2246, 2249, 2249, 2249, 2249, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2230, 2022, 2022,
-     2022, 2230, 2236, 2237, 2252, 2253, 2250, 2251, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2249, 2249, 2249, 2249, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2230, 2230, 2236, 2252, 2237, 2254, 2253, 2255,
-     2237, 2022, 2022, 2022, 2022, 2022, 2022, 2249, 2249, 2249,
-     2249, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2230, 2230, 2236, 2254, 2022, 2255, 2237,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2249, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2230, 2230, 2236, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2249, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2230, 2230,
-     2236, 2022, 2249, 2022, 2022, 2022, 2022, 2230, 2230, 2236,
-     2249, 2022, 2022, 2022, 2022, 2230, 2230, 2236, 2249, 2022,
-     2022, 2022, 2022, 2230, 2230, 2236, 2022, 2022, 2022, 2022,
-     2022, 2022, 2230, 2230, 2236, 2022, 2022, 2022, 2022, 2022,
-     2230, 2230, 2236, 2230, 2230, 2236, 2230, 2230, 2236, 2236,
-     2230, 2230, 2236, 2236, 2230, 2230, 2236, 2236, 2230, 2230,
-     2236, 2236, 2022, 2022, 2022, 2022, 2236, 2236, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2236, 2236, 2236, 2236, 2236, 2236,
-     2236, 2236, 2236, 2236, 2236, 2236, 2236, 2236, 2236, 2236,
-     2022,    0, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022
-    } ;
-
-static yyconst flex_int16_t yy_nxt[7164] =
-    {   0,
-     2022,  146,  147,  146,  146,  147,  146,  146,  147,  146,
-      146,  147,  146,  151,  147,  151,  157,  148,  154,  157,
-      148,  154,  450,  149, 2022,  155,  149, 2022,  155,  152,
-      151,  147,  151,  388,  158,  160,  161,  158,  160,  161,
-      162,  163, 2022,  162,  163,  388,  152,  167,  168,  389,
-      164,  160,  161,  164,  165,  391,  162,  160,  161,  561,
-      165,  390,  162,  167,  168,  562,  164,  147,  147,  147,
-      451,  390,  164,  147,  147,  147,  180,  147,  180,  180,
-      147,  180,  472,  170,  180,  147,  180,  510,  169,  170,
-      451,  473,  181,  561,  511,  181,  387,  387,  387,  575,
-
-      182,  387,  387,  387,  169,  171,  172,  147,  172,  171,
-      171,  171,  171,  171,  171,  171,  173,  171,  171,  171,
-     1485,  171,  175,  171,  176,  171,  180,  147,  180,  147,
-      147,  147,  503,  147,  147,  147,  180,  147,  180,  180,
-      147,  180,  182,  504,  561,  183,  391,  171,  171,  183,
-      600,  489,  181,  391,  490,  181,  387,  387,  387,  387,
-      387,  387,  390,  387,  387,  387,  387,  387,  387,  390,
-      177, 2022,  178,  171,  172,  147,  172,  171,  171,  171,
-      171,  171,  171,  171,  173,  171,  171,  171,  477,  171,
-      175,  171,  176,  171,  147,  147,  147,  147,  147,  147,
-
-      682,  180,  147,  180,  180,  147,  180,  180,  147,  180,
-      184,  563,  391,  184,  391,  171,  171,  182,  391,  425,
-      182,  426, 1110,  185,  564,  180,  147,  180,  390,  427,
-      390,  387,  387,  387,  390,  425,  451,  428,  177,  429,
-      178,  185,  186,  187,  147,  187,  186,  186,  186,  186,
-      186,  186,  186,  188,  186,  186,  186,  485,  186,  190,
-      186,  191,  186,  194,  147,  194,  194,  147,  194,  402,
-      218,  147,  218,  160,  161,  160,  161,  486,  162,  195,
-      162, 1270,  195,  446,  186,  186,  219,  447,  205, 1271,
-      205,  448,  192,  186,  187,  147,  187,  186,  186,  186,
-
-      186,  186,  186,  186,  188,  186,  186,  186,  892,  186,
-      190,  186,  191,  186,  206, 2022,  206,  218,  147,  218,
-      893,  147,  147,  147,  147,  147,  147,  387,  387,  387,
-      387,  387,  387,  219,  682,  186,  186,  220,  875,  544,
-      220,  513,  545,  192,  196,  197,  147,  197,  196,  196,
-      196,  196,  196,  196,  196,  198,  196,  196,  196,  512,
-      196,  200,  196,  201,  196,  218,  147,  218,  218,  147,
-      218,  505,  218,  147,  218,  218,  147,  218,  387,  387,
-      387,  219,  391,  439,  219,  512,  196,  196,  221,  433,
-      440,  221, 1412, 1413,  202, 1414, 1415,  203,  390,  390,
-
-      387,  387,  387,  204,  196,  197,  147,  197,  196,  196,
-      196,  196,  196,  196,  196,  198,  196,  196,  196,  451,
-      196,  200,  196,  201,  196,  232,  147,  232,  232,  147,
-      232,  906,  245,  147,  245,  245,  147,  245,  538,  391,
-      391,  233, 1275,  893,  233,  391,  196,  196,  246,  571,
-     1276,  246,  457,  539,  202,  390,  390,  203,  387,  387,
-      387,  390,  572,  204,  207,  208,  147,  208,  207,  207,
-      207,  207,  207,  207,  207,  209,  207,  207,  207,  906,
-      207,  211,  207,  212,  207,  147,  147,  147,  147,  147,
-      147,  930,  147,  147,  147,  147,  147,  147,  257,  147,
-
-      257,  254,  391,  391,  254, 1488,  207,  207,  255,  464,
-      520,  255,  563, 1495,  258,  213, 1498,  214,  390,  390,
-      215,  387,  387,  387, 2022,  576,  216,  207,  208,  147,
-      208,  207,  207,  207,  207,  207,  207,  207,  209,  207,
-      207,  207,  538,  207,  211,  207,  212,  207,  257,  147,
-      257,  271,  147,  271,  512,  271,  147,  271,  147,  147,
-      147,  147,  147,  147,  258,  411,  391,  272,  413,  207,
-      207,  272,  391, 1116,  220,  587, 1508,  220,  213, 1117,
-      214, 1521,  390,  215,  387,  387,  387,  998,  390,  216,
-      222,  223,  147,  223,  222,  222,  222,  222,  222,  222,
-
-      222,  224,  222,  222,  222, 1522,  222,  226,  222,  227,
-      222,  271,  147,  271,  271,  147,  271, 1232,  271,  147,
-      271,  271,  147,  271,  283,  147,  283,  272, 1523,  797,
-      272,  998,  222,  222,  273,  391,  391,  273,  798,  228,
-      284,  387,  387,  387,  229,  387,  387,  387,  387,  387,
-      387,  390,  390,  230,  222,  223,  147,  223,  222,  222,
-      222,  222,  222,  222,  222,  224,  222,  222,  222, 1231,
-      222,  226,  222,  227,  222,  283,  147,  283,  298,  147,
-      298, 1524,  298,  147,  298,  308,  147,  308,  308,  147,
-      308,  284, 1419, 1420,  299, 1390,  222,  222,  299,  391,
-
-      391,  309, 1391,  228,  309,  387,  387,  387,  229,  387,
-      387,  387,  387,  387,  387,  390,  390,  230,  234,  235,
-      147,  235,  234,  234,  234,  234,  234,  234,  234,  236,
-      234,  234,  234, 1525,  234,  238,  234,  239,  234,  321,
-      147,  321,  321,  147,  321,  682,  147,  147,  147,  147,
-      147,  147,  321,  147,  321,  322,  391,  571,  322, 1529,
-      234,  234,  220,  482,  995,  220,  998,  998,  322, 1392,
-      578,  240,  390,  387,  387,  387, 1393,  241, 1530,  242,
-      243,  234,  235,  147,  235,  234,  234,  234,  234,  234,
-      234,  234,  236,  234,  234,  234, 1514,  234,  238,  234,
-
-      239,  234,  321,  147,  321,  321,  147,  321, 1339,  321,
-      147,  321,  147,  147,  147,  147,  147,  147,  322, 1421,
-     1422,  323,  391,  234,  234,  323,  682,  682,  333,  493,
-     1531,  333, 1407, 1337,  240,  387,  387,  387,  390, 1408,
-      241,  684,  242,  243,  247,  248,  147,  248,  247,  247,
-      247,  247,  247,  247,  247,  249,  247,  247,  247,  998,
-      247,  251,  247,  252,  247,  147,  147,  147,  147,  147,
-      147, 1532,  335,  147,  335,  335,  147,  335,  335,  147,
-      335,  333, 1533, 1409,  333,  391,  247,  247,  336,  391,
-     1410,  336,  497, 1515,  337,  387,  387,  387,  387,  387,
-
-      387,  390,  387,  387,  387,  390,  253,  247,  248,  147,
-      248,  247,  247,  247,  247,  247,  247,  247,  249,  247,
-      247,  247, 1534,  247,  251,  247,  252,  247,  335,  147,
-      335,  349,  147,  349, 1535,  349,  147,  349,  147,  147,
-      147,  147,  147,  147,  337, 1536,  998,  350, 1537,  247,
-      247,  350,  391, 1486,  333, 1487, 1538,  333,  387,  387,
-      387,  387,  387,  387,  387,  387,  387, 1539,  390,  253,
-      259,  260,  147,  260,  259,  259,  259,  259,  259,  259,
-      259,  261,  259,  259,  259, 1433,  259,  263,  259,  264,
-      259,  349,  147,  349,  349,  147,  349, 1541,  349,  147,
-
-      349,  349,  147,  349,  360,  147,  360,  350,  391,  391,
-      350,  391,  259,  259,  351,  265,  524,  351, 1542, 1489,
-      361, 1490, 1543,  266,  390,  390,  267,  390,  998,  268,
-     1544, 1545,  269,  259,  260,  147,  260,  259,  259,  259,
-      259,  259,  259,  259,  261,  259,  259,  259, 1551,  259,
-      263,  259,  264,  259,  360,  147,  360,  373,  147,  373,
-     1552,  373,  147,  373,  147,  147,  147,  147,  147,  147,
-      361, 1434,  391,  374, 1553,  259,  259,  374,  265,  536,
-      375, 1150, 1496,  375, 1497, 1554,  266, 1151,  390,  267,
-     1152, 1499,  268, 1500, 1153,  269,  274,  275,  147,  275,
-
-      274,  274,  274,  274,  274,  274,  274,  276,  274,  274,
-      274,  531,  274,  278,  274,  279,  274,  373,  147,  373,
-      373,  147,  373, 1555,  373,  147,  373,  373,  147,  373,
-      385,  147,  385,  374, 1558, 1154,  374, 1559,  274,  274,
-      376, 1155, 1560,  376, 1156,  532,  386,  396, 1157,  280,
-      387,  387,  387,  387,  387,  387,  387,  387,  387,  451,
-     1561,  281,  274,  275,  147,  275,  274,  274,  274,  274,
-      274,  274,  274,  276,  274,  274,  274, 1562,  274,  278,
-      274,  279,  274,  385,  147,  385,  397,  387,  387,  387,
-     1563, 1568,  398,  387,  387,  387,  399, 1569, 1570,  386,
-
-     1571,  400, 1572, 1573,  274,  274,  387,  387,  387,  387,
-      387,  387,  387,  387,  387,  280,  387,  387,  387,  542,
-      542,  542, 1593,  686,  896,  896,  896,  281,  285,  286,
-      147,  286,  285,  285,  285,  285,  285,  285,  285,  287,
-      285,  285,  285,  288,  285,  289,  285,  290,  285,  288,
-      288,  288,  288,  288,  288,  288,  288,  288,  288,  288,
-      288,  288,  288,  288,  288,  288,  288,  288,  288,  288,
-      285,  285,  288,  288,  291,  288,  288,  288,  288,  288,
-      288,  292,  288,  293,  288,  288,  288,  294,  288,  295,
-      296,  288,  288,  288,  288,  288,  288,  300,  301,  147,
-
-      301,  300,  300,  300,  300,  300,  300,  300,  302,  300,
-      300,  300,  682,  300,  304,  300,  305,  300,  542,  542,
-      542,  584,  584,  584,  592,  592,  592,  606,  606,  606,
-      617,  617,  617,  904,  904,  904, 1594, 1595,  585,  300,
-      300,  593, 1596, 1603,  607, 1604, 1605,  618, 1585,  998,
-      306,  300,  301,  147,  301,  300,  300,  300,  300,  300,
-      300,  300,  302,  300,  300,  300,  998,  300,  304,  300,
-      305,  300, 1606,  543,  625,  625,  625, 1338,  631,  631,
-      631,  633,  633,  633,  642,  642,  642, 1009, 1009, 1009,
-     1599,  626, 1607,  300,  300,  632, 1608, 1609,  634, 1610,
-
-     1586,  643, 1600,  998,  306,  310,  311,  147,  311,  310,
-      310,  310,  310,  310,  310,  310,  312,  310,  310,  310,
-     1611,  310,  314,  310,  315,  310,  647,  647,  647,  667,
-      667,  667,  696,  696,  696,  696,  696,  696,  726,  726,
-      726,  682, 1587,  648, 1612, 1613,  668,  310,  310, 1615,
-      698,  316, 1616,  698, 1617, 1621,  728, 1230,  317, 1622,
-      318, 1015, 1015, 1015,  896,  896,  896,  319,  310,  311,
-      147,  311,  310,  310,  310,  310,  310,  310,  310,  312,
-      310,  310,  310, 1623,  310,  314,  310,  315,  310,  699,
-      726,  726,  726, 1627, 1601,  584,  584,  584,  731,  731,
-
-      731, 1628,  732, 1629, 1630,  733, 1602, 1631,  728, 1632,
-      310,  310,  585, 1638,  316,  741,  741,  741, 1639,  742,
-     1640,  317,  743,  318, 1021, 1021, 1021,  904,  904,  904,
-      319,  324,  325,  147,  325,  324,  324,  324,  324,  324,
-      324,  324,  326,  324,  324,  324,  729,  324,  328,  324,
-      329,  324,  736,  736,  736, 1641, 1642,  736,  736,  736,
-      592,  592,  592,  744,  744,  744,  747,  747,  747, 1643,
-      738,  998, 1656,  324,  324,  738,  330,  593,  998,  331,
-      745, 1633, 1635,  748,  762,  762,  762, 1658,  763, 1634,
-     1636,  764,  682,  332,  324,  325,  147,  325,  324,  324,
-
-      324,  324,  324,  324,  324,  326,  324,  324,  324, 1650,
-      324,  328,  324,  329,  324, 1662, 1651,  739, 1649, 1663,
-      750,  750,  750,  758,  758,  758, 1664, 1665,  750,  750,
-      750,  758,  758,  758, 1666, 1667,  324,  324,  752,  330,
-     1668,  760,  331,  778,  778,  778,  752,  779, 1669,  760,
-      780, 1047, 1047, 1047, 1670, 1671,  332,  338,  339,  147,
-      339,  338,  338,  338,  338,  338,  338,  338,  340,  338,
-      338,  338,  753,  338,  342,  338,  343,  338,  606,  606,
-      606, 1672, 1673,  768,  768,  768,  773,  773,  773, 1674,
-     1679,  761,  617,  617,  617,  607,  768,  768,  768,  338,
-
-      338,  770,  344, 1680,  775,  345, 1009, 1009, 1009,  618,
-      346,  789,  789,  789,  770,  790, 1681, 1684,  791,  347,
-      338,  339,  147,  339,  338,  338,  338,  338,  338,  338,
-      338,  340,  338,  338,  338, 1685,  338,  342,  338,  343,
-      338,  773,  773,  773,  771, 1686,  785,  785,  785,  785,
-      785,  785,  625,  625,  625, 1687,  793,  793,  793,  775,
-     1688, 1689,  338,  338,  787,  344, 1690,  787,  345,  626,
-     1011, 1011, 1011,  346,  795, 1015, 1015, 1015, 1021, 1021,
-     1021, 1691,  347,  352,  353,  147,  353,  352,  352,  352,
-      352,  352,  352,  352,  354,  352,  352,  352,  776,  352,
-
-      356,  352,  357,  352, 1692, 1693,  788, 1694, 1696,  793,
-      793,  793,  631,  631,  631,  799,  799,  799, 1697,  800,
-     1698, 1699,  801, 1700, 1701,  352,  352,  795, 1708,  632,
-     1022, 1022, 1022, 1047, 1047, 1047,  358,  352,  353,  147,
-      353,  352,  352,  352,  352,  352,  352,  352,  354,  352,
-      352,  352,  998,  352,  356,  352,  357,  352,  633,  633,
-      633,  802,  802,  802, 1709,  803, 1710, 1711,  804,  796,
-      805,  805,  805, 1712, 1713,  634, 1246, 1246, 1246,  352,
-      352,  815,  815,  815, 1705,  816, 1716,  806,  817, 1717,
-      358,  362,  363,  147,  363,  362,  362,  362,  362,  362,
-
-      362,  362,  364,  362,  362,  362, 1718,  362,  366,  362,
-      367,  362,  811,  811,  811,  642,  642,  642,  818,  818,
-      818,  811,  811,  811,  818,  818,  818,  647,  647,  647,
-      813, 1719,  643,  362,  362,  682,  820, 1720, 1721,  813,
-     1722,  368,  820,  369,  648,  370, 1127, 1127, 1127, 1248,
-     1248, 1248, 1723,  371,  362,  363,  147,  363,  362,  362,
-      362,  362,  362,  362,  362,  364,  362,  362,  362, 1728,
-      362,  366,  362,  367,  362,  814,  823,  823,  823, 1704,
-      824,  821, 1731,  825,  829,  829,  829,  829,  829,  829,
-      834,  834,  834,  836,  836,  836,  362,  362,  845,  845,
-
-      845, 1732,  831, 1736,  368,  831,  369,  835,  370, 1737,
-      837, 1130, 1130, 1130, 1738,  846,  371,  377,  378,  147,
-      378,  377,  377,  377,  377,  377,  377,  377,  379,  377,
-      377,  377, 1739,  377,  381,  377,  382,  377, 1740,  832,
-      840,  840,  840, 1741,  848,  848,  848,  840,  840,  840,
-      850,  850,  850,  850,  850,  850, 1729, 1730,  842,  377,
-      377,  849,  667,  667,  667,  842, 1742, 1743,  852, 1744,
-     1745,  852, 1746,  854,  854,  854, 1749,  855, 1750,  668,
-      856, 1751,  383,  377,  378,  147,  378,  377,  377,  377,
-      377,  377,  377,  377,  379,  377,  377,  377, 1752,  377,
-
-      381,  377,  382,  377,  843,  857,  857,  857, 1753, 1754,
-      853,  857,  857,  857,  865,  865,  865,  865,  865,  865,
-      871,  871,  871,  859, 1769,  377,  377,  682, 1770,  859,
-     1771, 1772,  867, 1776, 1777,  867, 1778, 1779,  873,  871,
-      871,  871,  696,  696,  696,  911,  911,  911,  383,  391,
-      696,  696,  696, 1011, 1011, 1011,  407,  873, 1761, 1780,
-      698, 1781,  912,  860, 1783,  390, 1784, 1012,  698,  696,
-      696,  696, 1785,  726,  726,  726, 1786,  868,  726,  726,
-      726, 1791, 1792,  726,  726,  726, 1793,  698, 1794, 1795,
-      408,  728,  409, 1796, 1797,  410,  728,  411,  412,  874,
-
-      413,  728, 1798, 1799,  414, 1800,  415,  416,  417,  391,
-      914,  914,  914,  884, 1801, 1802,  407,  731,  731,  731,
-     1803,  732, 1804,  682,  733,  390, 1819,  915, 1820,  913,
-     2022, 2022, 2022,  736,  736,  736,  736,  736,  736, 1821,
-     1822,  736,  736,  736,  744,  744,  744, 2022, 1823, 1824,
-      408,  738,  418, 1825,  738,  419, 1826,  420,  412,  738,
-      421,  745, 1813, 1827,  414, 1828,  422,  423,  424,  741,
-      741,  741, 1831,  742, 1832, 1833,  743,  920,  920,  920,
-     1834,  921, 1841, 1842,  922,  918, 1843,  916,  923,  923,
-      923,  747,  747,  747,  925,  925,  925, 1844,  926, 1845,
-
-     1846,  927,  750,  750,  750,  924, 1847, 1848,  748,  750,
-      750,  750,  750,  750,  750,  932,  932,  932, 1849, 1850,
-      752,  758,  758,  758,  758,  758,  758,  752, 1851, 1852,
-      752, 1862,  933,  758,  758,  758,  762,  762,  762,  760,
-      763, 1863,  760,  764,  768,  768,  768,  768,  768,  768,
-     1864,  760,  768,  768,  768,  773,  773,  773,  773,  773,
-      773, 1857,  770, 1857,  682,  770, 1865, 1866,  929, 1867,
-      770, 1868, 1869,  775, 1860, 1858,  775,  935,  773,  773,
-      773,  778,  778,  778, 1870,  779, 1871, 1876,  780,  785,
-      785,  785,  785,  785,  785, 1877,  775,  785,  785,  785,
-
-     1878,  789,  789,  789, 1879,  790, 1855,  787,  791, 1880,
-      787,  793,  793,  793,  939,  787,  793,  793,  793,  793,
-      793,  793, 1881,  799,  799,  799, 1882,  800, 1883,  795,
-      801,  805,  805,  805,  795, 1888, 1872,  795,  941,  802,
-      802,  802,  682,  803, 1874, 1888,  804, 1873,  806,  952,
-      952,  952, 1891,  953, 1892, 1875,  954, 1857,  947,  811,
-      811,  811,  811,  811,  811,  811,  811,  811,  815,  815,
-      815, 1858,  816,  998,  999,  817,  949,  813, 1902, 1886,
-      813, 1903, 1904,  813,  818,  818,  818,  818,  818,  818,
-      818,  818,  818,  823,  823,  823, 1857,  824, 1905, 1888,
-
-      825, 1909,  820, 1888, 1910,  820, 1911, 1860,  820,  829,
-      829,  829,  829,  829,  829,  829,  829,  829,  834,  834,
-      834, 1921,  967,  967,  967, 1925,  968,  831,  959,  969,
-      831, 1926, 1927,  831, 1928,  835, 1932,  836,  836,  836,
-      970,  970,  970, 1933,  971, 1934, 1935,  972,  840,  840,
-      840, 1936, 1937,  960,  837,  840,  840,  840,  840,  840,
-      840,  845,  845,  845, 1941,  682,  842, 1942,  977,  977,
-      977,  965,  978,  842, 1943,  979,  842, 1944,  846,  848,
-      848,  848,  981,  981,  981, 1945,  982, 1940,  682,  983,
-      850,  850,  850,  850,  850,  850,  849,  850,  850,  850,
-
-      854,  854,  854, 1949,  855, 1950, 1948,  856,  852, 1951,
-     1952,  852,  857,  857,  857,  852,  857,  857,  857, 1953,
-      682,  975,  857,  857,  857,  987,  987,  987, 1959, 1960,
-      859,  865,  865,  865,  859,  865,  865,  865, 1961, 1956,
-      859, 1962,  988,  865,  865,  865,  871,  871,  871,  867,
-      871,  871,  871,  867,  871,  871,  871,  997,  997,  997,
-      984,  867, 1969, 1970,  873,  696,  696,  696,  873,  911,
-      911,  911,  873, 1484,  682,  998,  999,  682,  985, 1022,
-     1022, 1022,  682,  698,  682,  682,  912, 1031, 1031, 1031,
-     1965, 1032,  682, 1012, 1033,  726,  726,  726, 1973,  682,
-
-      991,  914,  914,  914,  994, 1035, 1035, 1035,  682, 1036,
-      682, 1987, 1037,  728,  736,  736,  736, 1983,  915,  920,
-      920,  920,  682,  921, 1997, 1984,  922, 1005,  923,  923,
-      923, 1483,  738, 1042, 1042, 1042, 1991, 1043,  682, 1482,
-     1044,  750,  750,  750, 1988,  924,  925,  925,  925, 1034,
-      926, 1481, 2015,  927,  932,  932,  932,  682,  682,  752,
-     1040, 1049, 1049, 1049, 2005, 1050,  682,  682, 1051,  682,
-     1998,  933, 1052, 1052, 1052,  758,  758,  758, 1058, 1058,
-     1058,  773,  773,  773, 1065, 1065, 1065, 1480, 1046, 1053,
-     1067, 1067, 1067,  760, 1992, 2009, 1059,  682, 2010,  775,
-
-     2006, 1066,  785,  785,  785, 2019,  682, 1068, 1071, 1071,
-     1071, 2016,  793,  793,  793, 1074, 1074, 1074,  682,  682,
-      787, 1054, 2022, 2022, 2022, 1072, 1077, 1077, 1077, 1061,
-      795, 2007, 1075, 1069,  952,  952,  952,  682,  953, 2022,
-     2008,  954, 1479, 1078, 2022, 2022, 2022, 2013, 2022, 2022,
-     2022, 2022, 2022, 2022,  811,  811,  811,  818,  818,  818,
-     2011, 2022, 2012, 1478, 1070, 2022, 2014, 1472, 2022,  682,
-     1073,  682,  813, 1471,  682,  820, 1470, 1087, 1087, 1087,
-      829,  829,  829, 1469, 1076,  682,  967,  967,  967, 2019,
-      968, 1468, 1080,  969, 1088,  970,  970,  970,  831,  971,
-
-      682, 1467,  972, 2017, 1022, 1022, 1022,  840,  840,  840,
-     1079,  987,  987,  987, 2018, 1082, 1466, 1081, 1093, 1083,
-     1089, 1465,  977,  977,  977,  842,  978, 1461,  988,  979,
-      981,  981,  981, 1090,  982, 1460, 1459,  983,  850,  850,
-      850,  857,  857,  857, 1100, 1100, 1100, 1458, 1101, 1457,
-     1456, 1102,  865,  865,  865, 1455,  852, 1454, 1453,  859,
-     1107, 1107, 1107,  871,  871,  871,  997,  997,  997, 1094,
-      867,  696,  696,  696, 1127, 1127, 1127, 1108, 1130, 1130,
-     1130,  873, 1452, 1451,  998, 1127, 1127, 1127, 1128,  698,
-     1448, 1445, 1131, 1444, 1098, 1136, 1136, 1136, 1105, 1128,
-
-     1097, 1138, 1138, 1138, 1138, 1138, 1138, 1443, 1442, 1131,
-     1136, 1136, 1136, 1430, 1111, 1139, 1428, 1427, 1139, 1417,
-     1118, 1031, 1031, 1031, 1141, 1032, 1109, 1411, 1033, 1406,
-     1112,  726,  726,  726, 1129, 1035, 1035, 1035, 1405, 1036,
-     1401, 1394, 1037, 1389, 1388, 1135, 1052, 1052, 1052,  728,
-      736,  736,  736, 1042, 1042, 1042, 1387, 1043, 1381, 1380,
-     1044, 1129, 1379, 1053, 1135,  750,  750,  750,  738, 1049,
-     1049, 1049, 1378, 1050, 1377, 1376, 1051, 1158, 1158, 1158,
-     1375, 1159, 1374,  752, 1160,  758,  758,  758, 1162, 1162,
-     1162, 2022, 2022, 2022, 1142, 1165, 1165, 1165, 1145, 1058,
-
-     1058, 1058, 1373,  760, 1372, 1163, 1366, 1365, 2022, 1167,
-     1167, 1167, 1166,  773,  773,  773, 1364, 1059, 1065, 1065,
-     1065, 1363, 1148, 1173, 1173, 1173, 1168, 1174, 1361, 1359,
-     1175,  775, 1355, 1161, 1354, 1066, 1067, 1067, 1067, 1176,
-     1176, 1176, 1352, 1177, 1351, 1164, 1178, 1180, 1180, 1180,
-     1071, 1071, 1071, 1068, 1182, 1182, 1182, 1169, 1183, 1347,
-     1340, 1184, 1185, 1185, 1185, 1181, 1335, 1072, 1074, 1074,
-     1074, 1187, 1187, 1187, 1333, 1188, 1332, 1331, 1189, 1322,
-     1186, 1190, 1190, 1190, 1317, 1075, 1077, 1077, 1077, 1192,
-     1192, 1192, 1316, 1193, 1315, 1314, 1194, 1310, 1191, 1195,
-
-     1195, 1195, 1296, 1078, 2022, 2022, 2022, 1198, 1198, 1198,
-      811,  811,  811,  818,  818,  818, 1196, 1087, 1087, 1087,
-     1295, 2022, 1294, 1293, 1199, 1205, 1205, 1205,  813, 1206,
-     1292,  820, 1207, 1291, 1088, 1209, 1209, 1209, 1211, 1211,
-     1211, 1277, 2022, 2022, 2022,  840,  840,  840, 1216, 1216,
-     1216, 1274, 1273, 1210, 1272, 1212, 1269, 1268, 1197, 2022,
-     1264, 1201, 1263,  842, 1260, 1217, 2022, 2022, 2022,  850,
-      850,  850, 1200, 1259,  857,  857,  857, 1100, 1100, 1100,
-     1257, 1101, 1256, 2022, 1102, 1255, 1254,  852, 1220,  865,
-      865,  865,  859, 1215, 1107, 1107, 1107, 1226, 1226, 1226,
-
-     1251, 1227, 1213, 1250, 1228, 1249, 1247,  867, 1245, 1218,
-     1244, 1108,  871,  871,  871, 1243, 1242, 1219, 1234, 1234,
-     1234, 2022, 2022, 2022, 2022, 2022, 2022,  696,  696,  696,
-      873, 1252, 1252, 1252, 1241, 1235, 1240, 1224, 2022, 1239,
-     1233, 2022, 1253, 1253, 1253,  698, 1136, 1136, 1136, 1138,
-     1138, 1138,  726,  726,  726, 1225, 1261, 1261, 1261,  750,
-      750,  750, 1266, 1266, 1266, 1223, 1222, 1229, 1221, 1214,
-      728, 1208, 1204, 1236, 1262, 1203, 1202,  752, 1179, 1267,
-     1172, 1237, 1171, 1170, 1238, 1158, 1158, 1158, 1149, 1159,
-     1147, 1146, 1160,  758,  758,  758, 1162, 1162, 1162, 1258,
-
-     1144, 1279, 1279, 1279, 1143, 1280, 1140, 1278, 1281, 1137,
-     1134,  760, 1133, 1163, 1265, 1282, 1282, 1282, 1165, 1165,
-     1165, 1284, 1284, 1284, 1132, 1285, 1126, 1125, 1286, 1167,
-     1167, 1167, 1283, 1124, 1123, 1166, 1287, 1287, 1287, 1122,
-     1288, 1121, 1120, 1289, 1119, 1115, 1168,  773,  773,  773,
-     1173, 1173, 1173, 1114, 1174, 1113,  998, 1175, 1106, 1176,
-     1176, 1176, 1104, 1177, 1103,  775, 1178, 1180, 1180, 1180,
-     1182, 1182, 1182, 1099, 1183, 1096, 1095, 1184, 1185, 1185,
-     1185, 1092, 1187, 1187, 1187, 1181, 1188, 1091, 1086, 1189,
-     1190, 1190, 1190, 1290, 1085, 1084, 1186, 1297, 1297, 1297,
-
-     1064, 1298, 1063, 1062, 1299, 1060, 1057, 1191, 1192, 1192,
-     1192, 1056, 1193, 1055, 1048, 1194, 1195, 1195, 1195, 1300,
-     1300, 1300, 1045, 1301, 1041, 1039, 1302, 1303, 1303, 1303,
-     1198, 1198, 1198, 1196, 1305, 1305, 1305, 1038, 1306, 1030,
-     1029, 1307, 1028, 1027, 1304, 1026, 1025, 1199,  811,  811,
-      811,  818,  818,  818, 1311, 1311, 1311, 1205, 1205, 1205,
-     1024, 1206, 1023, 1020, 1207, 1019,  813, 1018, 1017,  820,
-     1016, 1312, 1209, 1209, 1209, 1211, 1211, 1211, 1318, 1318,
-     1318, 1014, 1319, 1013, 1010, 1320, 2022, 2022, 2022, 1008,
-     1210, 1007, 1212, 1216, 1216, 1216, 1308, 1313,  840,  840,
-
-      840, 1006, 1004, 2022, 2022, 2022, 2022, 1328, 1328, 1328,
-     1217, 1309, 1323, 1324, 1324, 1324,  842, 1325, 1003, 1002,
-     1326, 2022,  857,  857,  857, 1329,  865,  865,  865, 1226,
-     1226, 1226, 1001, 1227, 1000,  993, 1228,  992, 1321,  990,
-      859,  871,  871,  871,  867, 1234, 1234, 1234, 1341, 1341,
-     1341,  989, 1342,  986,  980, 1343, 2022, 2022, 2022,  873,
-      976, 1327, 1235, 2022, 2022, 2022,  974,  973, 1330,  966,
-      696,  696,  696, 2022, 1348, 1348, 1348, 1349, 1349, 1349,
-     2022, 1350, 1350, 1350, 1353, 1353, 1353, 1334,  698, 1336,
-     1246, 1246, 1246, 1248, 1248, 1248, 1356, 1356, 1356, 1357,
-
-     1357, 1357, 1252, 1252, 1252, 1253, 1253, 1253, 1358, 1358,
-     1358,  964, 1344, 1360, 1360, 1360,  726,  726,  726, 1261,
-     1261, 1261, 1367, 1367, 1367,  963, 1345, 1266, 1266, 1266,
-     1346, 1369, 1369, 1369,  728, 1370,  962, 1262, 1371,  961,
-     1368,  758,  758,  758, 1267, 1279, 1279, 1279,  958, 1280,
-      957,  956, 1281, 1282, 1282, 1282, 1383, 1383, 1383,  760,
-     1384,  955,  951, 1385, 1362, 1284, 1284, 1284,  950, 1285,
-     1283,  948, 1286, 1287, 1287, 1287,  946, 1288,  945,  944,
-     1289,  773,  773,  773, 1297, 1297, 1297, 1382, 1298,  943,
-      942, 1299,  940, 1300, 1300, 1300,  938, 1301,  937,  775,
-
-     1302, 1303, 1303, 1303, 1395, 1395, 1395,  936, 1396,  934,
-      931, 1397, 1305, 1305, 1305,  928, 1306,  919, 1304, 1307,
-      811,  811,  811, 1399, 1399, 1399, 1311, 1311, 1311, 1402,
-     1402, 1402, 1386, 1403,  917,  910, 1404,  909,  813,  908,
-      907, 1400,  905, 1312, 1318, 1318, 1318,  903, 1319,  902,
-      901, 1320, 2022, 2022, 2022,  840,  840,  840, 1324, 1324,
-     1324,  900, 1325,  899,  898, 1326, 2022, 2022, 2022, 2022,
-     1328, 1328, 1328,  842,  857,  857,  857, 1425, 1425, 1425,
-     1398,  897,  895, 2022,  865,  865,  865,  894, 1329, 1432,
-     1432, 1432,  859,  891, 1426,  871,  871,  871, 1416, 1435,
-
-     1435, 1435,  867,  890, 1341, 1341, 1341,  682, 1342,  889,
-     1418, 1343,  888,  873, 2022, 2022, 2022, 2022, 2022, 2022,
-      887,  886, 1423,  696,  696,  696, 1439, 1439, 1439,  885,
-      883, 2022,  882,  881, 2022,  880, 1424, 1348, 1348, 1348,
-      879,  698, 1349, 1349, 1349, 1429, 1350, 1350, 1350,  878,
-      877, 1431, 1440, 1440, 1440, 1441, 1441, 1441, 1353, 1353,
-     1353, 1356, 1356, 1356, 1357, 1357, 1357, 1436, 1358, 1358,
-     1358, 1360, 1360, 1360, 1446, 1446, 1446,  876, 1438, 1437,
-     1449, 1449, 1449, 1367, 1367, 1367, 1369, 1369, 1369,  682,
-     1370,  870, 1447, 1371,  758,  758,  758, 1450, 1383, 1383,
-
-     1383, 1368, 1384,  869,  864, 1385, 1463, 1463, 1463, 1395,
-     1395, 1395,  760, 1396,  863,  862, 1397, 1473, 1473, 1473,
-     1399, 1399, 1399,  861, 1464, 1475, 1475, 1475,  847, 1402,
-     1402, 1402,  844, 1403,  839, 1474, 1404,  838, 1400, 1491,
-     1491, 1491, 1476, 1493, 1493, 1493,  840,  840,  840,  833,
-      828, 1462, 2022, 2022, 2022,  827, 1492,  857,  857,  857,
-     1425, 1425, 1425,  826,  842, 1506, 1506, 1506, 1477, 2022,
-      822,  810, 1503, 1503, 1503,  859, 1504, 1426,  809, 1505,
-      808,  807, 1507, 1509, 1509, 1509, 1511, 1511, 1511,  871,
-      871,  871, 1432, 1432, 1432, 1501, 1435, 1435, 1435,  792,
-
-      784, 1510, 1516, 1516, 1516,  783,  782,  873,  781, 1494,
-      682,  777,  772, 1502, 2022, 2022, 2022,  767,  766, 1517,
-     1519, 1519, 1519, 1439, 1439, 1439, 1440, 1440, 1440,  765,
-      757, 2022, 1441, 1441, 1441, 1446, 1446, 1446, 1520, 1449,
-     1449, 1449, 1526, 1526, 1526,  756, 1527,  755,  754, 1528,
-     1513, 1512,  749, 1447,  746,  740, 1450,  758,  758,  758,
-      735,  734, 1518, 1463, 1463, 1463, 1546, 1546, 1546, 1473,
-     1473, 1473, 1475, 1475, 1475,  760,  730,  725, 1548, 1548,
-     1548, 1464, 1549, 1547,  724, 1550,  723, 1474,  722, 1476,
-     1556, 1556, 1556, 1491, 1491, 1491, 1564, 1564, 1564,  721,
-
-     1565,  720,  719, 1566, 1493, 1493, 1493, 1557,  718,  717,
-     1492,  716,  715, 1540,  840,  840,  840, 2022, 2022, 2022,
-     1576, 1576, 1576, 1503, 1503, 1503,  714, 1504,  713,  712,
-     1505,  711,  842,  710, 2022, 1506, 1506, 1506, 1577, 1578,
-     1578, 1578,  709, 1579,  708,  707, 1580,  706, 1581, 1581,
-     1581,  705, 1507, 1509, 1509, 1509, 1511, 1511, 1511, 1583,
-     1583, 1583,  704,  703, 1574, 1582,  702,  701, 1567,  700,
-      695, 1510, 1516, 1516, 1516,  694,  693, 1584, 1575, 1588,
-     1588, 1588,  692, 1589,  691,  690, 1590,  689,  688, 1517,
-     1591, 1591, 1591, 1519, 1519, 1519, 1597, 1597, 1597, 1526,
-
-     1526, 1526,  685, 1527,  683,  682, 1528, 1592,  758,  758,
-      758, 1520,  680, 1598, 1546, 1546, 1546, 1618, 1618, 1618,
-      678, 1619,  677,  676, 1620,  674,  760,  673, 1548, 1548,
-     1548, 1547, 1549,  672,  671, 1550, 1556, 1556, 1556, 1624,
-     1624, 1624,  670, 1625,  666,  664, 1626, 1564, 1564, 1564,
-      663, 1565,  662, 1557, 1566,  840,  840,  840, 2022, 2022,
-     2022, 2022, 2022, 2022, 1614, 1576, 1576, 1576,  661,  660,
-     1578, 1578, 1578,  842, 1579, 2022,  658, 1580, 2022, 1581,
-     1581, 1581,  657, 1577, 1646, 1646, 1646,  656, 1647,  655,
-      654, 1648, 1583, 1583, 1583,  653, 1582, 1588, 1588, 1588,
-
-      651, 1589,  650,  649, 1590, 1591, 1591, 1591,  646,  645,
-     1584, 1652, 1652, 1652,  641, 1653,  639, 1637, 1654, 1644,
-      638, 1645, 1592, 1655, 1655, 1655, 1657, 1657, 1657, 1597,
-     1597, 1597, 1659, 1659, 1659,  637, 1660,  636,  635, 1661,
-      758,  758,  758, 1676, 1676, 1676, 1598, 1618, 1618, 1618,
-      630, 1619,  629,  627, 1620, 1682, 1682, 1682,  760,  624,
-     1677, 1624, 1624, 1624,  622, 1625,  621,  620, 1626,  840,
-      840,  840, 1683, 2022, 2022, 2022, 2022, 2022, 2022, 1655,
-     1655, 1655, 1706, 1706, 1706,  619, 1678,  842, 1675,  616,
-     2022,  615,  613, 2022, 1646, 1646, 1646,  612, 1647, 1707,
-
-      998, 1648, 1652, 1652, 1652,  610, 1653,  609,  608, 1654,
-     1657, 1657, 1657, 1659, 1659, 1659,  605, 1660,  603,  602,
-     1661, 1695, 1703, 1714, 1714, 1714,  758,  758,  758, 1676,
-     1676, 1676, 1725, 1725, 1725, 1702, 1726,  601,  599, 1727,
-     1715, 1682, 1682, 1682,  760,  597, 1677, 1733, 1733, 1733,
-      596, 1734,  595,  594, 1735, 1747, 1747, 1747, 1683, 1755,
-     1755, 1755, 1758, 1758, 1758, 1762, 1762, 1762, 1706, 1706,
-     1706,  591, 1724, 1748,  590,  589, 1756,  586,  583, 1759,
-      582,  580, 1763,  998,  579, 1707,  998,  577, 1764, 1764,
-     1764,  574, 1765,  573,  570, 1766, 1767, 1767, 1767, 1768,
-
-     1768, 1768, 1757,  569,  568, 1760,  998, 1714, 1714, 1714,
-     1773, 1773, 1773,  567, 1774,  566,  565, 1775,  758,  758,
-      758, 1725, 1725, 1725, 1715, 1726,  560,  559, 1727, 1787,
-     1787, 1787,  558, 1733, 1733, 1733,  760, 1734,  557,  556,
-     1735, 1789, 1789, 1789,  555,  554, 1788, 1747, 1747, 1747,
-     1755, 1755, 1755, 1805, 1805, 1805,  552, 1806, 1790,  551,
-     1807, 2022, 2022, 2022,  550, 1748,  549, 1756, 1758, 1758,
-     1758,  548, 1809, 1809, 1809,  547, 1810,  546, 2022, 1811,
-     1782, 2022, 2022, 2022,  541, 1759, 1762, 1762, 1762, 1814,
-     1814, 1814,  538, 1815,  540,  535, 1816,  533, 2022, 1767,
-
-     1767, 1767,  531, 1763,  998, 2022,  530,  998,  529, 1764,
-     1764, 1764,  528, 1765,  527,  525, 1766, 1768, 1768, 1768,
-      523, 1773, 1773, 1773,  521, 1774, 1808,  998, 1775, 1835,
-     1835, 1835,  520, 1836,  519,  518, 1837,  517, 1829, 1829,
-     1829,  516, 1787, 1787, 1787,  514, 1812,  996,  996,  996,
-      996,  996,  996,  996,  996,  996, 1830,  513,  996, 1788,
-     1789, 1789, 1789,  996,  996,  996,  998,  996, 1838, 1838,
-     1838,  509, 1839,  508,  506, 1840,  505, 1790, 1805, 1805,
-     1805,  502, 1806,  501,  500, 1807, 2022, 2022, 2022,  996,
-      996,  996,  996,  996,  996,  996,  996,  996,  996,  996,
-
-      498,  496,  996, 2022, 2022, 2022, 2022,  996,  996,  996,
-      998,  996, 1809, 1809, 1809,  494, 1810,  492,  491, 1811,
-      488, 2022, 1814, 1814, 1814,  487, 1815,  483,  481, 1816,
-     1829, 1829, 1829,  996,  996, 1835, 1835, 1835, 1853, 1836,
-      998,  480, 1837, 1838, 1838, 1838,  478, 1839, 1830,  477,
-     1840,  476, 2022, 2022, 2022,  475, 1854,  996,  996,  996,
-      996,  996, 1861,  996,  996,  996,  474,  471,  996, 2022,
-     2022, 2022, 2022,  996,  996,  996,  998,  996, 1890, 1890,
-     1890, 1893, 1893, 1893, 1912, 1912, 1912, 2022, 1913,  469,
-      468, 1914,  420, 1895, 1895, 1895,  998,  999, 1894,  996,
-
-      996,  996,  996,  996,  996,  996,  996,  996,  996, 1861,
-     1896,  467,  996,  465, 1884,  463,  462,  996,  996,  996,
-      998,  996, 1897, 1897, 1897, 1900, 1900, 1900, 2022, 2022,
-     2022,  461, 1885, 2022, 2022, 2022, 1908, 1908, 1908, 1898,
-      460,  458, 1901,  996,  996, 2022, 1890, 1890, 1890,  456,
-     2022, 1893, 1893, 1893,  682, 1895, 1895, 1895,  455, 1915,
-     1915, 1915,  454, 1916,  998, 1899, 1917,  452, 1894, 1897,
-     1897, 1897, 1896, 1918, 1918, 1918,  450, 1919,  449, 1906,
-     1920, 1900, 1900, 1900, 1907,  445, 1898,  444, 1922, 1922,
-     1922,  442, 1923,  441, 1111, 1924,  438,  437, 1901, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 1908, 1908, 1908, 1912, 1912,
-     1912,  436, 1913,  434,  432, 1914, 2022,  430, 2022, 2022,
-     1915, 1915, 1915,  682, 1916,  406,  405, 1917, 1918, 1918,
-     1918,  403, 1919,  401,  395, 1920, 1922, 1922, 1922,  394,
-     1923, 1931, 1929, 1924,  395, 1930, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022,  394,  393, 2022,  392, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 1957,
-     1957, 1957, 2022, 2022, 2022, 2022, 2022, 2022, 1957, 1957,
-     1957, 2022, 2022, 2022, 2022, 2022, 1958, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 1938, 2022, 1958, 1939, 2022, 2022, 1954,
-     2022, 1966, 1966, 1966, 1946, 1967, 2022, 1947, 1968, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 1955, 2022, 2022,
-     1963, 2022, 2022, 1964, 2022, 2022, 2022, 2022, 2022, 2022,
-     1966, 1966, 1966, 2022, 1967, 2022, 2022, 1968, 2022, 2022,
-     2022, 2022, 2022, 2022, 1976, 1976, 1976, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 1976,
-     1976, 1976,  682, 1979, 2022, 2022, 1980, 2022, 2022, 1971,
-     2022, 2022, 1972, 2022, 2022, 2022, 2022,  682, 2022, 2022,
-     2022, 1974, 2022, 2022, 1975, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 1993, 1993, 1993, 2022, 2022, 1977, 2022,
-     1978, 2022, 2022, 2022, 2022, 2022, 2022, 1995, 1995, 1995,
-     1994, 1981, 1993, 1993, 1993, 2022, 1982, 2022, 1999, 1999,
-     1999, 2022, 2000, 2022, 1996, 2001, 2022, 2022, 1986, 1994,
-     2022, 1985, 2022, 1989, 1995, 1995, 1995, 2002, 2002, 2002,
-     2022, 2003, 2022, 2022, 2004, 1999, 1999, 1999, 2022, 2000,
-     2022, 1996, 2001, 1990, 2002, 2002, 2002, 2022, 2003, 2022,
-     2022, 2004, 2020, 2020, 2020, 2020, 2020, 2020, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2021, 2022, 2022, 2021,  144,  144,  144,  144,  144,  144,
-      144,  144,  144,  145,  145,  145,  145,  145,  145,  145,
-      145,  145,  150,  150,  150,  150,  150,  150,  150,  150,
-      150,  153,  153,  153,  153,  153,  153,  153,  153,  153,
-      156,  156,  156,  156,  156,  156,  156,  156,  156,  159,
-      159,  159,  159,  159,  159,  159,  159,  159,  166,  166,
-      166,  166,  166,  166,  166,  166,  166,  174,  174,  174,
-      174,  174,  174,  174,  174,  174,  179,  179,  179,  179,
-      179,  179,  179,  179,  179,  189,  189,  189,  189,  189,
-      189,  189,  189,  189,  193,  193,  193,  193,  193,  193,
-
-      193,  193,  193,  199,  199,  199,  199,  199,  199,  199,
-      199,  199,  210,  210,  210,  210,  210,  210,  210,  210,
-      210,  217,  217,  217,  217,  217,  217,  217,  217,  217,
-      225,  225,  225,  225,  225,  225,  225,  225,  225,  231,
-      231,  231,  231,  231,  231,  231,  231,  231,  237,  237,
-      237,  237,  237,  237,  237,  237,  237,  244,  244,  244,
-      244,  244,  244,  244,  244,  244,  250,  250,  250,  250,
-      250,  250,  250,  250,  250,  256,  256,  256,  256,  256,
-      256,  256,  256,  256,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  270,  270,  270,  270,  270,  270,  270,
-
-      270,  270,  277,  277,  277,  277,  277,  277,  277,  277,
-      277,  282,  282,  282,  282,  282,  282,  282,  282,  282,
-      297,  297,  297,  297,  297,  297,  297,  297,  297,  303,
-      303,  303,  303,  303,  303,  303,  303,  303,  307,  307,
-      307,  307,  307,  307,  307,  307,  307,  313,  313,  313,
-      313,  313,  313,  313,  313,  313,  320,  320,  320,  320,
-      320,  320,  320,  320,  320,  327,  327,  327,  327,  327,
-      327,  327,  327,  327,  334,  334,  334,  334,  334,  334,
-      334,  334,  334,  341,  341,  341,  341,  341,  341,  341,
-      341,  341,  348,  348,  348,  348,  348,  348,  348,  348,
-
-      348,  355,  355,  355,  355,  355,  355,  355,  355,  355,
-      359,  359,  359,  359,  359,  359,  359,  359,  359,  365,
-      365,  365,  365,  365,  365,  365,  365,  365,  372,  372,
-      372,  372,  372,  372,  372,  372,  372,  380,  380,  380,
-      380,  380,  380,  380,  380,  380,  384,  384,  384,  384,
-      384,  384,  384,  384,  384,  404,  404,  404, 2022, 2022,
-     2022,  404,  431,  431,  431, 2022, 2022, 2022,  431,  435,
-      435,  435, 2022, 2022, 2022,  435,  443,  443,  443, 2022,
-     2022, 2022,  443,  453,  453,  453, 2022, 2022, 2022,  453,
-      459,  459,  459, 2022, 2022, 2022,  459,  466,  466,  466,
-
-     2022, 2022, 2022,  466,  470,  470,  470, 2022, 2022, 2022,
-      470,  479,  479,  479, 2022, 2022, 2022,  479,  484,  484,
-      484, 2022, 2022, 2022,  484,  495,  495,  495, 2022, 2022,
-     2022,  495,  499,  499,  499, 2022, 2022, 2022,  499,  507,
-      507,  507, 2022, 2022, 2022,  507,  515,  515,  515, 2022,
-     2022, 2022,  515,  522,  522,  522, 2022, 2022, 2022,  522,
-      526,  526,  526, 2022, 2022, 2022,  526,  534,  534,  534,
-     2022, 2022, 2022,  534,  537,  537,  537,  537,  537,  537,
-      537, 2022,  537,  553, 2022, 2022, 2022,  553,  581, 2022,
-     2022, 2022,  581,  588, 2022, 2022, 2022,  588,  598, 2022,
-
-     2022, 2022,  598,  604, 2022, 2022, 2022,  604,  611, 2022,
-     2022, 2022,  611,  614, 2022, 2022, 2022,  614,  623, 2022,
-     2022, 2022,  623,  628, 2022, 2022, 2022,  628,  484,  484,
-      484, 2022, 2022, 2022,  484,  640, 2022, 2022, 2022,  640,
-      495,  495,  495, 2022, 2022, 2022,  495,  644, 2022, 2022,
-     2022,  644,  499,  499,  499, 2022, 2022, 2022,  499,  652,
-     2022, 2022, 2022,  652,  507,  507,  507, 2022, 2022, 2022,
-      507,  659, 2022, 2022, 2022,  659,  515,  515,  515, 2022,
-     2022, 2022,  515,  665, 2022, 2022, 2022,  665,  522,  522,
-      522, 2022, 2022, 2022,  522,  669, 2022, 2022, 2022,  669,
-
-      526,  526,  526, 2022, 2022, 2022,  526,  675, 2022, 2022,
-     2022,  675,  534,  534,  534, 2022, 2022, 2022,  534,  679,
-     2022, 2022, 2022,  679,  681,  681,  681,  681,  681,  681,
-      681,  681,  681,  687, 2022, 2022, 2022, 2022,  687,  404,
-      404,  404, 2022, 2022, 2022,  404,  697,  697,  697,  697,
-     2022, 2022,  697,  697,  431,  431,  431, 2022, 2022, 2022,
-      431,  727,  727,  727,  727, 2022, 2022,  727,  727,  435,
-      435,  435, 2022, 2022, 2022,  435,  737,  737,  737,  737,
-     2022, 2022,  737,  737,  443,  443,  443, 2022, 2022, 2022,
-      443,  751,  751,  751,  751, 2022, 2022,  751,  751,  453,
-
-      453,  453, 2022, 2022, 2022,  453,  759,  759,  759,  759,
-     2022, 2022,  759,  759,  459,  459,  459, 2022, 2022, 2022,
-      459,  769,  769,  769,  769, 2022, 2022,  769,  769,  466,
-      466,  466, 2022, 2022, 2022,  466,  774,  774,  774,  774,
-     2022, 2022,  774,  774,  470,  470,  470, 2022, 2022, 2022,
-      470,  786,  786,  786,  786, 2022, 2022,  786,  786,  479,
-      479,  479, 2022, 2022, 2022,  479,  794,  794,  794,  794,
-     2022, 2022,  794,  794,  484,  484,  484, 2022, 2022, 2022,
-      484,  812,  812,  812,  812, 2022, 2022,  812,  812,  819,
-      819,  819,  819, 2022, 2022,  819,  819,  499,  499,  499,
-
-     2022, 2022, 2022,  499,  830,  830,  830,  830, 2022, 2022,
-      830,  830,  507,  507,  507, 2022, 2022, 2022,  507,  841,
-      841,  841,  841, 2022, 2022,  841,  841,  515,  515,  515,
-     2022, 2022, 2022,  515,  851,  851,  851,  851, 2022, 2022,
-      851,  851,  858,  858,  858,  858, 2022, 2022,  858,  858,
-      526,  526,  526, 2022, 2022, 2022,  526,  866,  866,  866,
-      866, 2022, 2022,  866,  866,  534,  534,  534, 2022, 2022,
-     2022,  534,  872,  872,  872,  872, 2022, 2022,  872,  872,
-      681,  681,  681,  681,  681,  681,  681,  681,  681,  687,
-     2022,  687, 2022, 2022,  687,  404,  404,  404, 2022, 2022,
-
-     2022,  404,  697,  697,  697,  697, 2022, 2022,  697,  697,
-      431,  431,  431,  431, 2022,  431, 2022,  431,  727,  727,
-      727,  727, 2022, 2022,  727,  727,  435,  435,  435,  435,
-     2022,  435, 2022,  435,  737,  737,  737,  737, 2022, 2022,
-      737,  737,  443,  443,  443, 2022, 2022, 2022,  443,  751,
-      751,  751,  751, 2022, 2022,  751,  751,  453,  453,  453,
-     2022, 2022, 2022,  453,  759,  759,  759,  759, 2022, 2022,
-      759,  759,  459,  459,  459, 2022, 2022, 2022,  459,  769,
-      769,  769,  769, 2022, 2022,  769,  769,  466,  466,  466,
-     2022, 2022, 2022,  466,  774,  774,  774,  774, 2022, 2022,
-
-      774,  774,  470,  470,  470, 2022, 2022, 2022,  470,  786,
-      786,  786,  786, 2022, 2022,  786,  786,  479,  479,  479,
-     2022, 2022, 2022,  479,  794,  794,  794,  794, 2022, 2022,
-      794,  794,  484,  484,  484, 2022, 2022, 2022,  484,  812,
-      812,  812,  812, 2022, 2022,  812,  812,  819,  819,  819,
-      819, 2022, 2022,  819,  819,  499,  499,  499, 2022, 2022,
-     2022,  499,  830,  830,  830,  830, 2022, 2022,  830,  830,
-      507,  507,  507, 2022, 2022, 2022,  507,  841,  841,  841,
-      841, 2022, 2022,  841,  841,  515,  515,  515, 2022, 2022,
-     2022,  515,  851,  851,  851,  851, 2022, 2022,  851,  851,
-
-      858,  858,  858,  858, 2022, 2022,  858,  858,  526,  526,
-      526, 2022, 2022, 2022,  526,  866,  866,  866,  866, 2022,
-     2022,  866,  866,  534,  534,  534, 2022, 2022, 2022,  534,
-      872,  872,  872,  872, 2022, 2022,  872,  872,  681,  681,
-      681,  681,  681,  681,  681,  681,  681,  996,  996,  996,
-      996,  996,  996,  996,  996,  996,  404,  404,  404, 2022,
-     2022, 2022,  404,  697,  697,  697,  697, 2022, 2022,  697,
-      697,  727,  727,  727,  727, 2022, 2022,  727,  727,  435,
-      435,  435, 2022, 2022, 2022,  435,  737,  737,  737,  737,
-     2022, 2022,  737,  737,  443,  443,  443, 2022, 2022, 2022,
-
-      443,  751,  751,  751,  751, 2022, 2022,  751,  751,  453,
-      453,  453, 2022, 2022, 2022,  453,  759,  759,  759,  759,
-     2022, 2022,  759,  759,  459,  459,  459, 2022, 2022, 2022,
-      459,  769,  769,  769,  769, 2022, 2022,  769,  769,  466,
-      466,  466, 2022, 2022, 2022,  466,  774,  774,  774,  774,
-     2022, 2022,  774,  774,  470,  470,  470, 2022, 2022, 2022,
-      470,  786,  786,  786,  786, 2022, 2022,  786,  786,  479,
-      479,  479,  479, 2022,  479, 2022,  479,  794,  794,  794,
-      794, 2022, 2022,  794,  794,  484,  484,  484,  484, 2022,
-      484, 2022,  484,  812,  812,  812,  812, 2022, 2022,  812,
-
-      812,  819,  819,  819,  819, 2022, 2022,  819,  819,  499,
-      499,  499, 2022, 2022, 2022,  499,  830,  830,  830,  830,
-     2022, 2022,  830,  830,  507,  507,  507, 2022, 2022, 2022,
-      507,  841,  841,  841,  841, 2022, 2022,  841,  841,  515,
-      515,  515, 2022, 2022, 2022,  515,  851,  851,  851,  851,
-     2022, 2022,  851,  851,  858,  858,  858,  858, 2022, 2022,
-      858,  858,  526,  526,  526, 2022, 2022, 2022,  526,  866,
-      866,  866,  866, 2022, 2022,  866,  866,  534,  534,  534,
-      534, 2022,  534, 2022,  534,  872,  872,  872,  872, 2022,
-     2022,  872,  872,  681,  681,  681,  681,  681,  681,  681,
-
-      681,  681,  996,  996,  996,  996,  996,  996,  996,  996,
-      996,  404,  404,  404, 2022, 2022, 2022,  404,  697,  697,
-      697,  697, 2022, 2022,  697,  697,  727,  727,  727,  727,
-     2022, 2022,  727,  727,  435,  435,  435, 2022, 2022, 2022,
-      435,  737,  737,  737,  737, 2022, 2022,  737,  737,  443,
-      443,  443, 2022, 2022, 2022,  443,  751,  751,  751,  751,
-     2022, 2022,  751,  751,  453,  453,  453, 2022, 2022, 2022,
-      453,  759,  759,  759,  759, 2022, 2022,  759,  759,  459,
-      459,  459,  459, 2022,  459, 2022,  459,  466,  466,  466,
-      466, 2022,  466, 2022,  466,  774,  774,  774,  774, 2022,
-
-     2022,  774,  774,  470,  470,  470, 2022, 2022, 2022,  470,
-      786,  786,  786,  786, 2022, 2022,  786,  786,  794,  794,
-      794,  794, 2022, 2022,  794,  794,  484,  484,  484,  484,
-     2022,  484, 2022,  484,  812,  812,  812,  812, 2022, 2022,
-      812,  812,  819,  819,  819,  819, 2022, 2022,  819,  819,
-      499,  499,  499, 2022, 2022, 2022,  499,  830,  830,  830,
-      830, 2022, 2022,  830,  830,  507,  507,  507,  507, 2022,
-      507, 2022,  507,  841,  841,  841,  841, 2022, 2022,  841,
-      841,  515,  515,  515,  515, 2022,  515, 2022,  515,  851,
-      851,  851,  851, 2022, 2022,  851,  851,  858,  858,  858,
-
-      858, 2022, 2022,  858,  858,  526,  526,  526, 2022, 2022,
-     2022,  526,  866,  866,  866,  866, 2022, 2022,  866,  866,
-      872,  872,  872,  872, 2022, 2022,  872,  872,  681,  681,
-      681,  681,  681,  681,  681,  681,  681,  996,  996,  996,
-      996,  996,  996,  996,  996,  996,  404,  404,  404,  404,
-     2022,  404, 2022,  404,  697,  697,  697,  697, 2022, 2022,
-      697,  697,  727,  727,  727,  727, 2022, 2022,  727,  727,
-      435,  435,  435, 2022, 2022, 2022,  435,  737,  737,  737,
-      737, 2022, 2022,  737,  737,  443,  443,  443, 2022, 2022,
-     2022,  443,  751,  751,  751,  751, 2022, 2022,  751,  751,
-
-      453,  453,  453,  453, 2022,  453, 2022,  453,  759,  759,
-      759,  759, 2022, 2022,  759,  759,  459,  459,  459,  459,
-     2022,  459, 2022,  459,  774,  774,  774,  774, 2022, 2022,
-      774,  774,  470,  470,  470, 2022, 2022, 2022,  470, 1817,
-     1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1818, 1818,
-     1818, 1818, 1818, 1818, 1818, 1818, 1818, 1856, 1856, 1856,
-     1856, 1856, 1856, 1856, 1856, 1856, 1859, 1859, 1859, 1859,
-     1859, 1859, 1859, 1859, 1859, 1887, 1887, 1887, 1887, 1887,
-     1887, 1887, 1887, 1887, 1889, 1889, 1889, 1889, 1889, 1889,
-     1889, 1889, 1889,  143, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022
-    } ;
-
-static yyconst flex_int16_t yy_chk[7164] =
-    {   0,
-        0,    3,    3,    3,    4,    4,    4,    5,    5,    5,
-        6,    6,    6,    7,    7,    7,   11,    3,    9,   12,
-        4,   10,  219,    5,    0,    9,    6,    0,   10,    7,
-        8,    8,    8,  148,   11,   13,   13,   12,   14,   14,
-       13,   13,  220,   14,   14,  149,    8,   17,   17,  148,
-       13,   15,   15,   14,   15,  152,   15,   16,   16,  414,
-       16,  149,   16,   18,   18,  414,   15,   19,   19,   19,
-      219,  152,   16,   20,   20,   20,   23,   23,   23,   24,
-       24,   24,  266,   19,   25,   25,   25,  332,   17,   20,
-      220,  266,   23,  425,  332,   24,  146,  146,  146,  425,
-
-       25,  147,  147,  147,   18,   21,   21,   21,   21,   21,
-       21,   21,   21,   21,   21,   21,   21,   21,   21,   21,
-     1412,   21,   21,   21,   21,   21,   26,   26,   26,   27,
-       27,   27,  319,   28,   28,   28,   29,   29,   29,   30,
-       30,   30,   26,  319,  451,   27,  175,   21,   21,   28,
-      451,  294,   29,  190,  294,   30,  151,  151,  151,  172,
-      172,  172,  175,  180,  180,  180,  187,  187,  187,  190,
-       21,  183,   21,   22,   22,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   22,  272,   22,
-       22,   22,   22,   22,   31,   31,   31,   32,   32,   32,
-
-      995,   33,   33,   33,   34,   34,   34,   35,   35,   35,
-       31,  415,  200,   32,  170,   22,   22,   33,  211,  183,
-       34,  183,  995,   35,  415,   36,   36,   36,  200,  185,
-      170,  194,  194,  194,  211,  185,  272,  185,   22,  185,
-       22,   36,   37,   37,   37,   37,   37,   37,   37,   37,
-       37,   37,   37,   37,   37,   37,   37,  291,   37,   37,
-       37,   37,   37,   39,   39,   39,   40,   40,   40,  170,
-       47,   47,   47,   43,   43,   44,   44,  291,   43,   39,
-       44, 1152,   40,  215,   37,   37,   47,  215,   43, 1152,
-       44,  215,   37,   38,   38,   38,   38,   38,   38,   38,
-
-       38,   38,   38,   38,   38,   38,   38,   38,  707,   38,
-       38,   38,   38,   38,   43,  333,   44,   48,   48,   48,
-      707,   49,   49,   49,   50,   50,   50,  197,  197,  197,
-      208,  208,  208,   48,  684,   38,   38,   49,  684,  397,
-       50,  336,  397,   38,   41,   41,   41,   41,   41,   41,
-       41,   41,   41,   41,   41,   41,   41,   41,   41,  333,
-       41,   41,   41,   41,   41,   51,   51,   51,   52,   52,
-       52,  322,   53,   53,   53,   54,   54,   54,  218,  218,
-      218,   51,  195,  205,   52,  336,   41,   41,   53,  195,
-      205,   54, 1319, 1319,   41, 1320, 1320,   41,  195,  205,
-
-      223,  223,  223,   41,   42,   42,   42,   42,   42,   42,
-       42,   42,   42,   42,   42,   42,   42,   42,   42,  322,
-       42,   42,   42,   42,   42,   57,   57,   57,   58,   58,
-       58,  720,   61,   61,   61,   62,   62,   62,  388,  226,
-      238,   57, 1156,  720,   58,  233,   42,   42,   61,  422,
-     1156,   62,  233,  388,   42,  226,  238,   42,  232,  232,
-      232,  233,  422,   42,   45,   45,   45,   45,   45,   45,
-       45,   45,   45,   45,   45,   45,   45,   45,   45,  754,
-       45,   45,   45,   45,   45,   65,   65,   65,   66,   66,
-       66,  754,   67,   67,   67,   68,   68,   68,   69,   69,
-
-       69,   65,  246,  251,   66, 1414,   45,   45,   67,  246,
-      350,   68,  426, 1419,   69,   45, 1421,   45,  246,  251,
-       45,  235,  235,  235,  254,  426,   45,   46,   46,   46,
-       46,   46,   46,   46,   46,   46,   46,   46,   46,   46,
-       46,   46,  439,   46,   46,   46,   46,   46,   70,   70,
-       70,   73,   73,   73,  350,   74,   74,   74,   75,   75,
-       75,   76,   76,   76,   70,  254,  263,   73,  254,   46,
-       46,   74,  278, 1004,   75,  439, 1428,   76,   46, 1004,
-       46, 1442,  263,   46,  245,  245,  245, 1112,  278,   46,
-       55,   55,   55,   55,   55,   55,   55,   55,   55,   55,
-
-       55,   55,   55,   55,   55, 1443,   55,   55,   55,   55,
-       55,   77,   77,   77,   78,   78,   78, 1112,   79,   79,
-       79,   80,   80,   80,   83,   83,   83,   77, 1444,  630,
-       78, 1111,   55,   55,   79,  289,  304,   80,  630,   55,
-       83,  248,  248,  248,   55,  257,  257,  257,  260,  260,
-      260,  289,  304,   55,   56,   56,   56,   56,   56,   56,
-       56,   56,   56,   56,   56,   56,   56,   56,   56, 1111,
-       56,   56,   56,   56,   56,   84,   84,   84,   87,   87,
-       87, 1445,   88,   88,   88,   91,   91,   91,   92,   92,
-       92,   84, 1325, 1325,   87, 1294,   56,   56,   88,  314,
-
-      328,   91, 1294,   56,   92,  271,  271,  271,   56,  275,
-      275,  275,  283,  283,  283,  314,  328,   56,   59,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,   59,   59,
-       59,   59,   59, 1448,   59,   59,   59,   59,   59,   95,
-       95,   95,   96,   96,   96,  875,   97,   97,   97,   98,
-       98,   98,   99,   99,   99,   95,  284,  428,   96, 1451,
-       59,   59,   97,  284,  875,   98, 1232, 1433,   99, 1295,
-      428,   59,  284,  286,  286,  286, 1295,   59, 1452,   59,
-       59,   60,   60,   60,   60,   60,   60,   60,   60,   60,
-       60,   60,   60,   60,   60,   60, 1433,   60,   60,   60,
-
-       60,   60,  100,  100,  100,  101,  101,  101, 1232,  102,
-      102,  102,  105,  105,  105,  106,  106,  106,  100, 1326,
-     1326,  101,  299,   60,   60,  102,  539, 1230,  105,  299,
-     1453,  106, 1315, 1230,   60,  298,  298,  298,  299, 1315,
-       60,  539,   60,   60,   63,   63,   63,   63,   63,   63,
-       63,   63,   63,   63,   63,   63,   63,   63,   63, 1434,
-       63,   63,   63,   63,   63,  107,  107,  107,  108,  108,
-      108, 1454,  109,  109,  109,  110,  110,  110,  111,  111,
-      111,  107, 1455, 1316,  108,  309,   63,   63,  109,  342,
-     1316,  110,  309, 1434,  111,  301,  301,  301,  308,  308,
-
-      308,  309,  311,  311,  311,  342,   63,   64,   64,   64,
-       64,   64,   64,   64,   64,   64,   64,   64,   64,   64,
-       64,   64, 1456,   64,   64,   64,   64,   64,  112,  112,
-      112,  115,  115,  115, 1457,  116,  116,  116,  117,  117,
-      117,  118,  118,  118,  112, 1458, 1338,  115, 1459,   64,
-       64,  116,  356, 1413,  117, 1413, 1460,  118,  321,  321,
-      321,  325,  325,  325,  335,  335,  335, 1461,  356,   64,
-       71,   71,   71,   71,   71,   71,   71,   71,   71,   71,
-       71,   71,   71,   71,   71, 1338,   71,   71,   71,   71,
-       71,  119,  119,  119,  120,  120,  120, 1465,  121,  121,
-
-      121,  122,  122,  122,  125,  125,  125,  119,  366,  361,
-      120,  381,   71,   71,  121,   71,  361,  122, 1466, 1415,
-      125, 1415, 1467,   71,  366,  361,   71,  381, 1339,   71,
-     1468, 1470,   71,   72,   72,   72,   72,   72,   72,   72,
-       72,   72,   72,   72,   72,   72,   72,   72, 1477,   72,
-       72,   72,   72,   72,  126,  126,  126,  129,  129,  129,
-     1478,  130,  130,  130,  131,  131,  131,  132,  132,  132,
-      126, 1339,  386,  129, 1479,   72,   72,  130,   72,  386,
-      131, 1050, 1420,  132, 1420, 1480,   72, 1050,  386,   72,
-     1050, 1422,   72, 1422, 1050,   72,   81,   81,   81,   81,
-
-       81,   81,   81,   81,   81,   81,   81,   81,   81,   81,
-       81,  374,   81,   81,   81,   81,   81,  133,  133,  133,
-      134,  134,  134, 1482,  135,  135,  135,  136,  136,  136,
-      139,  139,  139,  133, 1485, 1051,  134, 1486,   81,   81,
-      135, 1051, 1487,  136, 1051,  374,  139,  162, 1051,   81,
-      339,  339,  339,  349,  349,  349,  353,  353,  353,  374,
-     1488,   81,   82,   82,   82,   82,   82,   82,   82,   82,
-       82,   82,   82,   82,   82,   82,   82, 1489,   82,   82,
-       82,   82,   82,  140,  140,  140,  162,  360,  360,  360,
-     1490, 1495,  162,  363,  363,  363,  162, 1496, 1497,  140,
-
-     1498,  162, 1499, 1500,   82,   82,  373,  373,  373,  378,
-      378,  378,  385,  385,  385,   82,  387,  387,  387,  542,
-      542,  542, 1521,  542,  710,  710,  710,   82,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
-       85,   85,   85,   85,   85,   85,   85,   89,   89,   89,
-
-       89,   89,   89,   89,   89,   89,   89,   89,   89,   89,
-       89,   89, 1513,   89,   89,   89,   89,   89,  396,  396,
-      396,  437,  437,  437,  445,  445,  445,  460,  460,  460,
-      472,  472,  472,  718,  718,  718, 1522, 1523,  437,   89,
-       89,  445, 1524, 1529,  460, 1530, 1531,  472, 1513, 1231,
-       89,   90,   90,   90,   90,   90,   90,   90,   90,   90,
-       90,   90,   90,   90,   90,   90, 1514,   90,   90,   90,
-       90,   90, 1532,  396,  480,  480,  480, 1231,  486,  486,
-      486,  487,  487,  487,  496,  496,  496,  888,  888,  888,
-     1527,  480, 1533,   90,   90,  486, 1534, 1535,  487, 1536,
-
-     1514,  496, 1527, 1515,   90,   93,   93,   93,   93,   93,
-       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
-     1537,   93,   93,   93,   93,   93,  501,  501,  501,  523,
-      523,  523,  553,  553,  553,  554,  554,  554,  581,  581,
-      581, 1110, 1515,  501, 1538, 1539,  523,   93,   93, 1541,
-      553,   93, 1542,  554, 1543, 1551,  581, 1110,   93, 1552,
-       93,  893,  893,  893,  896,  896,  896,   93,   94,   94,
-       94,   94,   94,   94,   94,   94,   94,   94,   94,   94,
-       94,   94,   94, 1553,   94,   94,   94,   94,   94,  554,
-      582,  582,  582, 1558, 1528,  584,  584,  584,  585,  585,
-
-      585, 1559,  585, 1560, 1561,  585, 1528, 1562,  582, 1563,
-       94,   94,  584, 1568,   94,  593,  593,  593, 1569,  593,
-     1570,   94,  593,   94,  900,  900,  900,  904,  904,  904,
-       94,  103,  103,  103,  103,  103,  103,  103,  103,  103,
-      103,  103,  103,  103,  103,  103,  582,  103,  103,  103,
-      103,  103,  588,  588,  588, 1571, 1572,  589,  589,  589,
-      592,  592,  592,  594,  594,  594,  596,  596,  596, 1573,
-      588, 1586, 1594,  103,  103,  589,  103,  592, 1587,  103,
-      594, 1565, 1566,  596,  607,  607,  607, 1596,  607, 1565,
-     1566,  607, 1585,  103,  104,  104,  104,  104,  104,  104,
-
-      104,  104,  104,  104,  104,  104,  104,  104,  104, 1586,
-      104,  104,  104,  104,  104, 1599, 1587,  589, 1585, 1600,
-      598,  598,  598,  604,  604,  604, 1601, 1602,  599,  599,
-      599,  605,  605,  605, 1603, 1604,  104,  104,  598,  104,
-     1605,  604,  104,  618,  618,  618,  599,  618, 1606,  605,
-      618,  930,  930,  930, 1607, 1609,  104,  113,  113,  113,
-      113,  113,  113,  113,  113,  113,  113,  113,  113,  113,
-      113,  113,  599,  113,  113,  113,  113,  113,  606,  606,
-      606, 1610, 1611,  611,  611,  611,  614,  614,  614, 1612,
-     1616,  605,  617,  617,  617,  606,  612,  612,  612,  113,
-
-      113,  611,  113, 1617,  614,  113, 1009, 1009, 1009,  617,
-      113,  626,  626,  626,  612,  626, 1621, 1623,  626,  113,
-      114,  114,  114,  114,  114,  114,  114,  114,  114,  114,
-      114,  114,  114,  114,  114, 1627,  114,  114,  114,  114,
-      114,  615,  615,  615,  612, 1628,  623,  623,  623,  624,
-      624,  624,  625,  625,  625, 1629,  628,  628,  628,  615,
-     1630, 1631,  114,  114,  623,  114, 1632,  624,  114,  625,
-     1011, 1011, 1011,  114,  628, 1015, 1015, 1015, 1021, 1021,
-     1021, 1633,  114,  123,  123,  123,  123,  123,  123,  123,
-      123,  123,  123,  123,  123,  123,  123,  123,  615,  123,
-
-      123,  123,  123,  123, 1634, 1635,  624, 1636, 1638,  629,
-      629,  629,  631,  631,  631,  632,  632,  632, 1639,  632,
-     1640, 1641,  632, 1642, 1643,  123,  123,  629, 1656,  631,
-     1022, 1022, 1022, 1047, 1047, 1047,  123,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124, 1650,  124,  124,  124,  124,  124,  633,  633,
-      633,  634,  634,  634, 1658,  634, 1662, 1663,  634,  629,
-      635,  635,  635, 1664, 1665,  633, 1126, 1126, 1126,  124,
-      124,  643,  643,  643, 1650,  643, 1667,  635,  643, 1668,
-      124,  127,  127,  127,  127,  127,  127,  127,  127,  127,
-
-      127,  127,  127,  127,  127,  127, 1669,  127,  127,  127,
-      127,  127,  640,  640,  640,  642,  642,  642,  644,  644,
-      644,  641,  641,  641,  645,  645,  645,  647,  647,  647,
-      640, 1670,  642,  127,  127, 1649,  644, 1671, 1672,  641,
-     1673,  127,  645,  127,  647,  127, 1127, 1127, 1127, 1129,
-     1129, 1129, 1674,  127,  128,  128,  128,  128,  128,  128,
-      128,  128,  128,  128,  128,  128,  128,  128,  128, 1678,
-      128,  128,  128,  128,  128,  641,  648,  648,  648, 1649,
-      648,  645, 1680,  648,  652,  652,  652,  653,  653,  653,
-      655,  655,  655,  656,  656,  656,  128,  128,  662,  662,
-
-      662, 1681,  652, 1684,  128,  653,  128,  655,  128, 1685,
-      656, 1130, 1130, 1130, 1686,  662,  128,  137,  137,  137,
-      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
-      137,  137, 1687,  137,  137,  137,  137,  137, 1688,  653,
-      659,  659,  659, 1689,  664,  664,  664,  660,  660,  660,
-      665,  665,  665,  666,  666,  666, 1679, 1679,  659,  137,
-      137,  664,  667,  667,  667,  660, 1690, 1691,  665, 1692,
-     1693,  666, 1694,  668,  668,  668, 1696,  668, 1697,  667,
-      668, 1698,  137,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  138, 1699,  138,
-
-      138,  138,  138,  138,  660,  669,  669,  669, 1700, 1701,
-      666,  670,  670,  670,  675,  675,  675,  676,  676,  676,
-      679,  679,  679,  669, 1710,  138,  138, 1704, 1711,  670,
-     1712, 1713,  675, 1716, 1717,  676, 1719, 1720,  679,  680,
-      680,  680,  696,  696,  696,  725,  725,  725,  138,  181,
-      697,  697,  697,  890,  890,  890,  181,  680, 1704, 1721,
-      696, 1723,  725,  670, 1728,  181, 1729,  890,  697,  699,
-      699,  699, 1730,  726,  726,  726, 1731,  676,  727,  727,
-      727, 1737, 1738,  729,  729,  729, 1739,  699, 1740, 1741,
-      181,  726,  181, 1742, 1744,  181,  727,  181,  181,  680,
-
-      181,  729, 1746, 1749,  181, 1750,  181,  181,  181,  182,
-      730,  730,  730,  699, 1751, 1752,  182,  731,  731,  731,
-     1753,  731, 1754, 1761,  731,  182, 1769,  730, 1770,  729,
-      734,  734,  734,  736,  736,  736,  737,  737,  737, 1771,
-     1772,  739,  739,  739,  744,  744,  744,  734, 1776, 1777,
-      182,  736,  182, 1778,  737,  182, 1779,  182,  182,  739,
-      182,  744, 1761, 1780,  182, 1781,  182,  182,  182,  741,
-      741,  741, 1783,  741, 1784, 1785,  741,  745,  745,  745,
-     1786,  745, 1791, 1792,  745,  739, 1793,  734,  746,  746,
-      746,  747,  747,  747,  748,  748,  748, 1794,  748, 1795,
-
-     1796,  748,  750,  750,  750,  746, 1799, 1800,  747,  751,
-      751,  751,  753,  753,  753,  756,  756,  756, 1801, 1802,
-      750,  758,  758,  758,  759,  759,  759,  751, 1803, 1804,
-      753, 1819,  756,  761,  761,  761,  762,  762,  762,  758,
-      762, 1821,  759,  762,  768,  768,  768,  769,  769,  769,
-     1824,  761,  771,  771,  771,  773,  773,  773,  774,  774,
-      774, 1815,  768, 1816, 1813,  769, 1825, 1827,  753, 1828,
-      771, 1831, 1832,  773, 1816, 1815,  774,  761,  776,  776,
-      776,  778,  778,  778, 1833,  778, 1834, 1841,  778,  785,
-      785,  785,  786,  786,  786, 1842,  776,  788,  788,  788,
-
-     1844,  789,  789,  789, 1845,  789, 1813,  785,  789, 1847,
-      786,  793,  793,  793,  771,  788,  794,  794,  794,  796,
-      796,  796, 1848,  799,  799,  799, 1850,  799, 1851,  793,
-      799,  805,  805,  805,  794, 1858, 1839,  796,  776,  802,
-      802,  802, 1855,  802, 1840, 1860,  802, 1839,  805,  806,
-      806,  806, 1862,  806, 1863, 1840,  806, 1856,  788,  811,
-      811,  811,  812,  812,  812,  814,  814,  814,  815,  815,
-      815, 1856,  815, 1857, 1857,  815,  796,  811, 1872, 1855,
-      812, 1873, 1874,  814,  818,  818,  818,  819,  819,  819,
-      821,  821,  821,  823,  823,  823, 1859,  823, 1875, 1887,
-
-      823, 1888,  818, 1889, 1891,  819, 1892, 1859,  821,  829,
-      829,  829,  830,  830,  830,  832,  832,  832,  834,  834,
-      834, 1899,  835,  835,  835, 1902,  835,  829,  814,  835,
-      830, 1903, 1904,  832, 1905,  834, 1909,  836,  836,  836,
-      837,  837,  837, 1921,  837, 1925, 1926,  837,  840,  840,
-      840, 1927, 1928,  821,  836,  841,  841,  841,  843,  843,
-      843,  845,  845,  845, 1933, 1931,  840, 1934,  846,  846,
-      846,  832,  846,  841, 1935,  846,  843, 1936,  845,  848,
-      848,  848,  849,  849,  849, 1937,  849, 1931, 1940,  849,
-      850,  850,  850,  851,  851,  851,  848,  853,  853,  853,
-
-      854,  854,  854, 1941,  854, 1942, 1940,  854,  850, 1943,
-     1944,  851,  857,  857,  857,  853,  858,  858,  858, 1945,
-     1948,  843,  860,  860,  860,  862,  862,  862, 1950, 1951,
-      857,  865,  865,  865,  858,  866,  866,  866, 1952, 1948,
-      860, 1953,  862,  868,  868,  868,  871,  871,  871,  865,
-      872,  872,  872,  866,  874,  874,  874,  876,  876,  876,
-      853,  868, 1959, 1961,  871,  884,  884,  884,  872,  911,
-      911,  911,  874, 1411, 1979,  876,  876, 1983,  860,  901,
-      901,  901, 1980,  884, 1956, 1965,  911,  912,  912,  912,
-     1956,  912, 1991,  901,  912,  913,  913,  913, 1965, 1987,
-
-      868,  914,  914,  914,  874,  915,  915,  915, 2013,  915,
-     1984, 1983,  915,  913,  918,  918,  918, 1979,  914,  920,
-      920,  920, 1997,  920, 1991, 1980,  920,  884,  923,  923,
-      923, 1410,  918,  924,  924,  924, 1987,  924, 1992, 1409,
-      924,  929,  929,  929, 1984,  923,  925,  925,  925,  913,
-      925, 1408, 2013,  925,  932,  932,  932, 1988, 1998,  929,
-      918,  933,  933,  933, 1997,  933, 2007, 2014,  933, 2008,
-     1992,  932,  934,  934,  934,  935,  935,  935,  939,  939,
-      939,  941,  941,  941,  945,  945,  945, 1407,  929,  934,
-      946,  946,  946,  935, 1988, 2007,  939, 2005, 2008,  941,
-
-     1998,  945,  947,  947,  947, 2017, 2006,  946,  948,  948,
-      948, 2014,  949,  949,  949,  950,  950,  950, 2011, 2017,
-      947,  935,  951,  951,  951,  948,  955,  955,  955,  941,
-      949, 2005,  950,  946,  952,  952,  952, 2012,  952,  951,
-     2006,  952, 1406,  955,  956,  956,  956, 2011,  957,  957,
-      957,  958,  958,  958,  959,  959,  959,  960,  960,  960,
-     2009,  956, 2010, 1405,  947,  957, 2012, 1394,  958, 2009,
-      949, 2010,  959, 1393, 2015,  960, 1392,  964,  964,  964,
-      965,  965,  965, 1391,  951, 2016,  967,  967,  967, 2018,
-      967, 1390,  957,  967,  964,  970,  970,  970,  965,  970,
-
-     2018, 1389,  970, 2015,  974,  974,  974,  975,  975,  975,
-      956,  987,  987,  987, 2016,  959, 1388,  958,  974,  960,
-      964, 1387,  977,  977,  977,  975,  977, 1381,  987,  977,
-      981,  981,  981,  965,  981, 1380, 1379,  981,  984,  984,
-      984,  985,  985,  985,  988,  988,  988, 1378,  988, 1377,
-     1376,  988,  991,  991,  991, 1375,  984, 1374, 1373,  985,
-      993,  993,  993,  994,  994,  994,  997,  997,  997,  975,
-      991, 1005, 1005, 1005, 1017, 1017, 1017,  993, 1018, 1018,
-     1018,  994, 1372, 1366,  997, 1024, 1024, 1024, 1017, 1005,
-     1363, 1361, 1018, 1359,  985, 1025, 1025, 1025,  991, 1024,
-
-      984, 1027, 1027, 1027, 1029, 1029, 1029, 1355, 1354, 1025,
-     1030, 1030, 1030, 1335,  997, 1027, 1333, 1332, 1029, 1322,
-     1005, 1031, 1031, 1031, 1030, 1031,  994, 1317, 1031, 1314,
-      997, 1034, 1034, 1034, 1017, 1035, 1035, 1035, 1313, 1035,
-     1310, 1296, 1035, 1293, 1292, 1024, 1052, 1052, 1052, 1034,
-     1040, 1040, 1040, 1042, 1042, 1042, 1291, 1042, 1277, 1276,
-     1042, 1027, 1275, 1052, 1029, 1046, 1046, 1046, 1040, 1049,
-     1049, 1049, 1274, 1049, 1273, 1272, 1049, 1053, 1053, 1053,
-     1271, 1053, 1270, 1046, 1053, 1054, 1054, 1054, 1055, 1055,
-     1055, 1056, 1056, 1056, 1034, 1057, 1057, 1057, 1040, 1058,
-
-     1058, 1058, 1269, 1054, 1268, 1055, 1264, 1263, 1056, 1060,
-     1060, 1060, 1057, 1061, 1061, 1061, 1260, 1058, 1065, 1065,
-     1065, 1259, 1046, 1066, 1066, 1066, 1060, 1066, 1257, 1255,
-     1066, 1061, 1249, 1054, 1247, 1065, 1067, 1067, 1067, 1068,
-     1068, 1068, 1244, 1068, 1243, 1056, 1068, 1070, 1070, 1070,
-     1071, 1071, 1071, 1067, 1072, 1072, 1072, 1061, 1072, 1239,
-     1233, 1072, 1073, 1073, 1073, 1070, 1225, 1071, 1074, 1074,
-     1074, 1075, 1075, 1075, 1223, 1075, 1222, 1221, 1075, 1214,
-     1073, 1076, 1076, 1076, 1208, 1074, 1077, 1077, 1077, 1078,
-     1078, 1078, 1207, 1078, 1206, 1204, 1078, 1202, 1076, 1079,
-
-     1079, 1079, 1179, 1077, 1080, 1080, 1080, 1081, 1081, 1081,
-     1082, 1082, 1082, 1083, 1083, 1083, 1079, 1087, 1087, 1087,
-     1178, 1080, 1177, 1172, 1081, 1088, 1088, 1088, 1082, 1088,
-     1171, 1083, 1088, 1170, 1087, 1090, 1090, 1090, 1091, 1091,
-     1091, 1157, 1092, 1092, 1092, 1094, 1094, 1094, 1095, 1095,
-     1095, 1155, 1154, 1090, 1153, 1091, 1151, 1150, 1080, 1092,
-     1147, 1083, 1146, 1094, 1144, 1095, 1096, 1096, 1096, 1097,
-     1097, 1097, 1082, 1143, 1098, 1098, 1098, 1100, 1100, 1100,
-     1141, 1100, 1140, 1096, 1100, 1139, 1137, 1097, 1098, 1105,
-     1105, 1105, 1098, 1094, 1107, 1107, 1107, 1108, 1108, 1108,
-
-     1133, 1108, 1092, 1132, 1108, 1131, 1128, 1105, 1125, 1096,
-     1124, 1107, 1109, 1109, 1109, 1123, 1122, 1097, 1115, 1115,
-     1115, 1116, 1116, 1116, 1117, 1117, 1117, 1118, 1118, 1118,
-     1109, 1134, 1134, 1134, 1121, 1115, 1120, 1105, 1116, 1119,
-     1114, 1117, 1135, 1135, 1135, 1118, 1136, 1136, 1136, 1138,
-     1138, 1138, 1142, 1142, 1142, 1106, 1145, 1145, 1145, 1148,
-     1148, 1148, 1149, 1149, 1149, 1104, 1103, 1109, 1099, 1093,
-     1142, 1089, 1086, 1116, 1145, 1085, 1084, 1148, 1069, 1149,
-     1064, 1117, 1063, 1062, 1118, 1158, 1158, 1158, 1048, 1158,
-     1045, 1041, 1158, 1161, 1161, 1161, 1162, 1162, 1162, 1142,
-
-     1039, 1163, 1163, 1163, 1038, 1163, 1028, 1161, 1163, 1026,
-     1023, 1161, 1020, 1162, 1148, 1164, 1164, 1164, 1165, 1165,
-     1165, 1166, 1166, 1166, 1019, 1166, 1016, 1014, 1166, 1167,
-     1167, 1167, 1164, 1013, 1012, 1165, 1168, 1168, 1168, 1010,
-     1168, 1008, 1007, 1168, 1006, 1003, 1167, 1169, 1169, 1169,
-     1173, 1173, 1173, 1002, 1173,  999,  996, 1173,  992, 1176,
-     1176, 1176,  990, 1176,  989, 1169, 1176, 1180, 1180, 1180,
-     1182, 1182, 1182,  986, 1182,  980,  976, 1182, 1185, 1185,
-     1185,  973, 1187, 1187, 1187, 1180, 1187,  966,  963, 1187,
-     1190, 1190, 1190, 1169,  962,  961, 1185, 1191, 1191, 1191,
-
-      944, 1191,  943,  942, 1191,  940,  938, 1190, 1192, 1192,
-     1192,  937, 1192,  936,  931, 1192, 1195, 1195, 1195, 1196,
-     1196, 1196,  928, 1196,  919,  917, 1196, 1197, 1197, 1197,
-     1198, 1198, 1198, 1195, 1199, 1199, 1199,  916, 1199,  910,
-      909, 1199,  908,  907, 1197,  906,  905, 1198, 1200, 1200,
-     1200, 1201, 1201, 1201, 1203, 1203, 1203, 1205, 1205, 1205,
-      903, 1205,  902,  899, 1205,  898, 1200,  897,  895, 1201,
-      894, 1203, 1209, 1209, 1209, 1211, 1211, 1211, 1212, 1212,
-     1212,  892, 1212,  891,  889, 1212, 1213, 1213, 1213,  887,
-     1209,  886, 1211, 1216, 1216, 1216, 1200, 1203, 1215, 1215,
-
-     1215,  885,  883, 1213, 1218, 1218, 1218, 1219, 1219, 1219,
-     1216, 1201, 1215, 1217, 1217, 1217, 1215, 1217,  882,  881,
-     1217, 1218, 1220, 1220, 1220, 1219, 1224, 1224, 1224, 1226,
-     1226, 1226,  880, 1226,  879,  870, 1226,  869, 1213,  864,
-     1220, 1229, 1229, 1229, 1224, 1234, 1234, 1234, 1235, 1235,
-     1235,  863, 1235,  861,  847, 1235, 1236, 1236, 1236, 1229,
-      844, 1218, 1234, 1237, 1237, 1237,  839,  838, 1220,  833,
-     1238, 1238, 1238, 1236, 1240, 1240, 1240, 1241, 1241, 1241,
-     1237, 1242, 1242, 1242, 1245, 1245, 1245, 1224, 1238, 1229,
-     1246, 1246, 1246, 1248, 1248, 1248, 1250, 1250, 1250, 1251,
-
-     1251, 1251, 1252, 1252, 1252, 1253, 1253, 1253, 1254, 1254,
-     1254,  828, 1236, 1256, 1256, 1256, 1258, 1258, 1258, 1261,
-     1261, 1261, 1265, 1265, 1265,  827, 1237, 1266, 1266, 1266,
-     1238, 1267, 1267, 1267, 1258, 1267,  826, 1261, 1267,  822,
-     1265, 1278, 1278, 1278, 1266, 1279, 1279, 1279,  810, 1279,
-      809,  808, 1279, 1282, 1282, 1282, 1283, 1283, 1283, 1278,
-     1283,  807,  798, 1283, 1258, 1284, 1284, 1284,  797, 1284,
-     1282,  792, 1284, 1287, 1287, 1287,  784, 1287,  783,  782,
-     1287, 1290, 1290, 1290, 1297, 1297, 1297, 1278, 1297,  781,
-      777, 1297,  772, 1300, 1300, 1300,  767, 1300,  766, 1290,
-
-     1300, 1303, 1303, 1303, 1304, 1304, 1304,  765, 1304,  757,
-      755, 1304, 1305, 1305, 1305,  749, 1305,  740, 1303, 1305,
-     1308, 1308, 1308, 1309, 1309, 1309, 1311, 1311, 1311, 1312,
-     1312, 1312, 1290, 1312,  735,  724, 1312,  723, 1308,  722,
-      721, 1309,  719, 1311, 1318, 1318, 1318,  717, 1318,  716,
-      715, 1318, 1321, 1321, 1321, 1323, 1323, 1323, 1324, 1324,
-     1324,  714, 1324,  713,  712, 1324, 1327, 1327, 1327, 1321,
-     1328, 1328, 1328, 1323, 1330, 1330, 1330, 1331, 1331, 1331,
-     1308,  711,  709, 1327, 1334, 1334, 1334,  708, 1328, 1337,
-     1337, 1337, 1330,  706, 1331, 1336, 1336, 1336, 1321, 1340,
-
-     1340, 1340, 1334,  705, 1341, 1341, 1341, 1337, 1341,  704,
-     1323, 1341,  703, 1336, 1344, 1344, 1344, 1345, 1345, 1345,
-      702,  701, 1327, 1346, 1346, 1346, 1347, 1347, 1347,  700,
-      695, 1344,  694,  693, 1345,  692, 1330, 1348, 1348, 1348,
-      689, 1346, 1349, 1349, 1349, 1334, 1350, 1350, 1350,  688,
-      687, 1336, 1351, 1351, 1351, 1352, 1352, 1352, 1353, 1353,
-     1353, 1356, 1356, 1356, 1357, 1357, 1357, 1344, 1358, 1358,
-     1358, 1360, 1360, 1360, 1362, 1362, 1362,  685, 1346, 1345,
-     1365, 1365, 1365, 1367, 1367, 1367, 1369, 1369, 1369,  681,
-     1369,  678, 1362, 1369, 1382, 1382, 1382, 1365, 1383, 1383,
-
-     1383, 1367, 1383,  677,  674, 1383, 1386, 1386, 1386, 1395,
-     1395, 1395, 1382, 1395,  673,  672, 1395, 1398, 1398, 1398,
-     1399, 1399, 1399,  671, 1386, 1401, 1401, 1401,  663, 1402,
-     1402, 1402,  661, 1402,  658, 1398, 1402,  657, 1399, 1416,
-     1416, 1416, 1401, 1417, 1417, 1417, 1418, 1418, 1418,  654,
-      651, 1382, 1423, 1423, 1423,  650, 1416, 1424, 1424, 1424,
-     1425, 1425, 1425,  649, 1418, 1427, 1427, 1427, 1401, 1423,
-      646,  639, 1426, 1426, 1426, 1424, 1426, 1425,  638, 1426,
-      637,  636, 1427, 1429, 1429, 1429, 1430, 1430, 1430, 1431,
-     1431, 1431, 1432, 1432, 1432, 1423, 1435, 1435, 1435,  627,
-
-      622, 1429, 1436, 1436, 1436,  621,  620, 1431,  619, 1418,
-     1432,  616,  613, 1424, 1437, 1437, 1437,  610,  609, 1436,
-     1438, 1438, 1438, 1439, 1439, 1439, 1440, 1440, 1440,  608,
-      603, 1437, 1441, 1441, 1441, 1446, 1446, 1446, 1438, 1449,
-     1449, 1449, 1450, 1450, 1450,  602, 1450,  601,  600, 1450,
-     1432, 1431,  597, 1446,  595,  591, 1449, 1462, 1462, 1462,
-      587,  586, 1437, 1463, 1463, 1463, 1472, 1472, 1472, 1473,
-     1473, 1473, 1475, 1475, 1475, 1462,  583,  580, 1476, 1476,
-     1476, 1463, 1476, 1472,  579, 1476,  578, 1473,  577, 1475,
-     1484, 1484, 1484, 1491, 1491, 1491, 1492, 1492, 1492,  576,
-
-     1492,  575,  574, 1492, 1493, 1493, 1493, 1484,  573,  572,
-     1491,  571,  570, 1462, 1494, 1494, 1494, 1501, 1501, 1501,
-     1502, 1502, 1502, 1503, 1503, 1503,  569, 1503,  568,  567,
-     1503,  566, 1494,  565, 1501, 1506, 1506, 1506, 1502, 1507,
-     1507, 1507,  564, 1507,  563,  562, 1507,  561, 1508, 1508,
-     1508,  560, 1506, 1509, 1509, 1509, 1511, 1511, 1511, 1512,
-     1512, 1512,  559,  558, 1501, 1508,  557,  556, 1494,  555,
-      552, 1509, 1516, 1516, 1516,  551,  550, 1512, 1501, 1517,
-     1517, 1517,  548, 1517,  547,  546, 1517,  545,  544, 1516,
-     1518, 1518, 1518, 1519, 1519, 1519, 1525, 1525, 1525, 1526,
-
-     1526, 1526,  540, 1526,  538,  537, 1526, 1518, 1540, 1540,
-     1540, 1519,  536, 1525, 1546, 1546, 1546, 1547, 1547, 1547,
-      535, 1547,  532,  531, 1547,  530, 1540,  529, 1548, 1548,
-     1548, 1546, 1548,  528,  527, 1548, 1556, 1556, 1556, 1557,
-     1557, 1557,  524, 1557,  520,  519, 1557, 1564, 1564, 1564,
-      518, 1564,  517, 1556, 1564, 1567, 1567, 1567, 1574, 1574,
-     1574, 1575, 1575, 1575, 1540, 1576, 1576, 1576,  516,  513,
-     1578, 1578, 1578, 1567, 1578, 1574,  512, 1578, 1575, 1581,
-     1581, 1581,  511, 1576, 1582, 1582, 1582,  510, 1582,  509,
-      508, 1582, 1583, 1583, 1583,  505, 1581, 1588, 1588, 1588,
-
-      504, 1588,  503,  502, 1588, 1591, 1591, 1591,  500,  497,
-     1583, 1592, 1592, 1592,  493, 1592,  492, 1567, 1592, 1574,
-      491, 1575, 1591, 1593, 1593, 1593, 1595, 1595, 1595, 1597,
-     1597, 1597, 1598, 1598, 1598,  490, 1598,  489,  488, 1598,
-     1614, 1614, 1614, 1615, 1615, 1615, 1597, 1618, 1618, 1618,
-      485, 1618,  482,  481, 1618, 1622, 1622, 1622, 1614,  477,
-     1615, 1624, 1624, 1624,  476, 1624,  475,  474, 1624, 1637,
-     1637, 1637, 1622, 1644, 1644, 1644, 1645, 1645, 1645, 1655,
-     1655, 1655, 1651, 1651, 1651,  473, 1615, 1637, 1614,  471,
-     1644,  468,  467, 1645, 1646, 1646, 1646,  464, 1646, 1651,
-
-     1651, 1646, 1652, 1652, 1652,  463, 1652,  462,  461, 1652,
-     1657, 1657, 1657, 1659, 1659, 1659,  457, 1659,  456,  455,
-     1659, 1637, 1645, 1666, 1666, 1666, 1675, 1675, 1675, 1676,
-     1676, 1676, 1677, 1677, 1677, 1644, 1677,  454,  450, 1677,
-     1666, 1682, 1682, 1682, 1675,  449, 1676, 1683, 1683, 1683,
-      448, 1683,  447,  446, 1683, 1695, 1695, 1695, 1682, 1702,
-     1702, 1702, 1703, 1703, 1703, 1705, 1705, 1705, 1706, 1706,
-     1706,  444, 1675, 1695,  441,  440, 1702,  438,  436, 1703,
-      433,  432, 1705, 1705,  429, 1706, 1706,  427, 1707, 1707,
-     1707,  424, 1707,  423,  421, 1707, 1708, 1708, 1708, 1709,
-
-     1709, 1709, 1702,  420,  419, 1703, 1707, 1714, 1714, 1714,
-     1715, 1715, 1715,  418, 1715,  417,  416, 1715, 1724, 1724,
-     1724, 1725, 1725, 1725, 1714, 1725,  413,  412, 1725, 1732,
-     1732, 1732,  411, 1733, 1733, 1733, 1724, 1733,  410,  409,
-     1733, 1736, 1736, 1736,  408,  407, 1732, 1747, 1747, 1747,
-     1755, 1755, 1755, 1756, 1756, 1756,  406, 1756, 1736,  405,
-     1756, 1757, 1757, 1757,  402, 1747,  401, 1755, 1758, 1758,
-     1758,  400, 1759, 1759, 1759,  399, 1759,  398, 1757, 1759,
-     1724, 1760, 1760, 1760,  392, 1758, 1762, 1762, 1762, 1763,
-     1763, 1763,  391, 1763,  389,  383, 1763,  379, 1760, 1767,
-
-     1767, 1767,  376, 1762, 1762,  375,  371, 1763,  370, 1764,
-     1764, 1764,  369, 1764,  368,  364, 1764, 1768, 1768, 1768,
-      358, 1773, 1773, 1773,  354, 1773, 1757, 1764, 1773, 1788,
-     1788, 1788,  351, 1788,  347,  346, 1788,  345, 1782, 1782,
-     1782,  344, 1787, 1787, 1787,  340, 1760, 1765, 1765, 1765,
-     1765, 1765, 1765, 1765, 1765, 1765, 1782,  337, 1765, 1787,
-     1789, 1789, 1789, 1765, 1765, 1765, 1765, 1765, 1790, 1790,
-     1790,  331, 1790,  330,  326, 1790,  323, 1789, 1805, 1805,
-     1805,  318, 1805,  317,  316, 1805, 1808, 1808, 1808, 1765,
-     1765, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
-
-      312,  306, 1766, 1808, 1812, 1812, 1812, 1766, 1766, 1766,
-     1766, 1766, 1809, 1809, 1809,  302, 1809,  296,  295, 1809,
-      293, 1812, 1814, 1814, 1814,  292, 1814,  287,  281, 1814,
-     1829, 1829, 1829, 1766, 1766, 1835, 1835, 1835, 1808, 1835,
-     1814,  280, 1835, 1838, 1838, 1838,  276, 1838, 1829,  273,
-     1838,  269, 1853, 1853, 1853,  268, 1812, 1817, 1817, 1817,
-     1817, 1817, 1817, 1817, 1817, 1817,  267,  265, 1817, 1853,
-     1854, 1854, 1854, 1817, 1817, 1817, 1817, 1817, 1861, 1861,
-     1861, 1868, 1868, 1868, 1894, 1894, 1894, 1854, 1894,  261,
-      258, 1894,  255, 1869, 1869, 1869, 1861, 1861, 1868, 1817,
-
-     1817, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
-     1869,  253, 1818,  249, 1853,  243,  242, 1818, 1818, 1818,
-     1818, 1818, 1870, 1870, 1870, 1871, 1871, 1871, 1884, 1884,
-     1884,  241, 1854, 1885, 1885, 1885, 1886, 1886, 1886, 1870,
-      240,  236, 1871, 1818, 1818, 1884, 1890, 1890, 1890,  230,
-     1885, 1893, 1893, 1893, 1886, 1895, 1895, 1895,  229, 1896,
-     1896, 1896,  228, 1896, 1890, 1870, 1896,  224, 1893, 1897,
-     1897, 1897, 1895, 1898, 1898, 1898,  221, 1898,  216, 1884,
-     1898, 1900, 1900, 1900, 1885,  214, 1897,  213, 1901, 1901,
-     1901,  209, 1901,  206, 1890, 1901,  204,  203, 1900, 1906,
-
-     1906, 1906, 1907, 1907, 1907, 1908, 1908, 1908, 1912, 1912,
-     1912,  202, 1912,  198,  192, 1912, 1906,  188,  184, 1907,
-     1915, 1915, 1915, 1908, 1915,  178,  177, 1915, 1918, 1918,
-     1918,  173, 1918,  169,  168, 1918, 1922, 1922, 1922,  167,
-     1922, 1908, 1906, 1922,  161, 1907, 1929, 1929, 1929, 1930,
-     1930, 1930, 1938, 1938, 1938, 1939, 1939, 1939, 1946, 1946,
-     1946,  160,  158, 1929,  155,  143, 1930,    0,    0, 1938,
-        0,    0, 1939,    0,    0, 1946, 1947, 1947, 1947, 1949,
-     1949, 1949, 1954, 1954, 1954, 1955, 1955, 1955, 1957, 1957,
-     1957,    0,    0, 1947,    0,    0, 1949,    0,    0, 1954,
-
-        0,    0, 1955, 1929,    0, 1957, 1930,    0,    0, 1946,
-        0, 1958, 1958, 1958, 1938, 1958,    0, 1939, 1958, 1963,
-     1963, 1963, 1964, 1964, 1964,    0,    0, 1947,    0,    0,
-     1954,    0,    0, 1955,    0,    0, 1963,    0,    0, 1964,
-     1966, 1966, 1966,    0, 1966,    0,    0, 1966, 1971, 1971,
-     1971, 1972, 1972, 1972, 1973, 1973, 1973, 1974, 1974, 1974,
-     1975, 1975, 1975,    0,    0, 1971,    0,    0, 1972, 1976,
-     1976, 1976, 1973, 1976, 1974,    0, 1976, 1975,    0, 1963,
-        0,    0, 1964, 1977, 1977, 1977,    0, 1976, 1978, 1978,
-     1978, 1971,    0,    0, 1972, 1981, 1981, 1981,    0,    0,
-
-     1977,    0, 1982, 1982, 1982, 1978, 1985, 1985, 1985, 1986,
-     1986, 1986, 1981, 1989, 1989, 1989,    0,    0, 1974, 1982,
-     1975,    0,    0, 1985,    0,    0, 1986, 1990, 1990, 1990,
-     1989, 1977, 1993, 1993, 1993,    0, 1978,    0, 1994, 1994,
-     1994,    0, 1994,    0, 1990, 1994,    0,    0, 1982, 1993,
-        0, 1981,    0, 1985, 1995, 1995, 1995, 1996, 1996, 1996,
-        0, 1996,    0,    0, 1996, 1999, 1999, 1999,    0, 1999,
-        0, 1995, 1999, 1986, 2002, 2002, 2002,    0, 2002,    0,
-        0, 2002, 2019, 2019, 2019, 2020, 2020, 2020,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-
-     2019,    0,    0, 2020, 2023, 2023, 2023, 2023, 2023, 2023,
-     2023, 2023, 2023, 2024, 2024, 2024, 2024, 2024, 2024, 2024,
-     2024, 2024, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025,
-     2025, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026,
-     2027, 2027, 2027, 2027, 2027, 2027, 2027, 2027, 2027, 2028,
-     2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2029, 2029,
-     2029, 2029, 2029, 2029, 2029, 2029, 2029, 2030, 2030, 2030,
-     2030, 2030, 2030, 2030, 2030, 2030, 2031, 2031, 2031, 2031,
-     2031, 2031, 2031, 2031, 2031, 2032, 2032, 2032, 2032, 2032,
-     2032, 2032, 2032, 2032, 2033, 2033, 2033, 2033, 2033, 2033,
-
-     2033, 2033, 2033, 2034, 2034, 2034, 2034, 2034, 2034, 2034,
-     2034, 2034, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035,
-     2035, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036,
-     2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2038,
-     2038, 2038, 2038, 2038, 2038, 2038, 2038, 2038, 2039, 2039,
-     2039, 2039, 2039, 2039, 2039, 2039, 2039, 2040, 2040, 2040,
-     2040, 2040, 2040, 2040, 2040, 2040, 2041, 2041, 2041, 2041,
-     2041, 2041, 2041, 2041, 2041, 2042, 2042, 2042, 2042, 2042,
-     2042, 2042, 2042, 2042, 2043, 2043, 2043, 2043, 2043, 2043,
-     2043, 2043, 2043, 2044, 2044, 2044, 2044, 2044, 2044, 2044,
-
-     2044, 2044, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045,
-     2045, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046,
-     2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2048,
-     2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2049, 2049,
-     2049, 2049, 2049, 2049, 2049, 2049, 2049, 2050, 2050, 2050,
-     2050, 2050, 2050, 2050, 2050, 2050, 2051, 2051, 2051, 2051,
-     2051, 2051, 2051, 2051, 2051, 2052, 2052, 2052, 2052, 2052,
-     2052, 2052, 2052, 2052, 2053, 2053, 2053, 2053, 2053, 2053,
-     2053, 2053, 2053, 2054, 2054, 2054, 2054, 2054, 2054, 2054,
-     2054, 2054, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055,
-
-     2055, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056,
-     2057, 2057, 2057, 2057, 2057, 2057, 2057, 2057, 2057, 2058,
-     2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2059, 2059,
-     2059, 2059, 2059, 2059, 2059, 2059, 2059, 2060, 2060, 2060,
-     2060, 2060, 2060, 2060, 2060, 2060, 2061, 2061, 2061, 2061,
-     2061, 2061, 2061, 2061, 2061, 2062, 2062, 2062,    0,    0,
-        0, 2062, 2063, 2063, 2063,    0,    0,    0, 2063, 2064,
-     2064, 2064,    0,    0,    0, 2064, 2065, 2065, 2065,    0,
-        0,    0, 2065, 2066, 2066, 2066,    0,    0,    0, 2066,
-     2067, 2067, 2067,    0,    0,    0, 2067, 2068, 2068, 2068,
-
-        0,    0,    0, 2068, 2069, 2069, 2069,    0,    0,    0,
-     2069, 2070, 2070, 2070,    0,    0,    0, 2070, 2071, 2071,
-     2071,    0,    0,    0, 2071, 2072, 2072, 2072,    0,    0,
-        0, 2072, 2073, 2073, 2073,    0,    0,    0, 2073, 2074,
-     2074, 2074,    0,    0,    0, 2074, 2075, 2075, 2075,    0,
-        0,    0, 2075, 2076, 2076, 2076,    0,    0,    0, 2076,
-     2077, 2077, 2077,    0,    0,    0, 2077, 2078, 2078, 2078,
-        0,    0,    0, 2078, 2079, 2079, 2079, 2079, 2079, 2079,
-     2079,    0, 2079, 2080,    0,    0,    0, 2080, 2081,    0,
-        0,    0, 2081, 2082,    0,    0,    0, 2082, 2083,    0,
-
-        0,    0, 2083, 2084,    0,    0,    0, 2084, 2085,    0,
-        0,    0, 2085, 2086,    0,    0,    0, 2086, 2087,    0,
-        0,    0, 2087, 2088,    0,    0,    0, 2088, 2089, 2089,
-     2089,    0,    0,    0, 2089, 2090,    0,    0,    0, 2090,
-     2091, 2091, 2091,    0,    0,    0, 2091, 2092,    0,    0,
-        0, 2092, 2093, 2093, 2093,    0,    0,    0, 2093, 2094,
-        0,    0,    0, 2094, 2095, 2095, 2095,    0,    0,    0,
-     2095, 2096,    0,    0,    0, 2096, 2097, 2097, 2097,    0,
-        0,    0, 2097, 2098,    0,    0,    0, 2098, 2099, 2099,
-     2099,    0,    0,    0, 2099, 2100,    0,    0,    0, 2100,
-
-     2101, 2101, 2101,    0,    0,    0, 2101, 2102,    0,    0,
-        0, 2102, 2103, 2103, 2103,    0,    0,    0, 2103, 2104,
-        0,    0,    0, 2104, 2105, 2105, 2105, 2105, 2105, 2105,
-     2105, 2105, 2105, 2106,    0,    0,    0,    0, 2106, 2107,
-     2107, 2107,    0,    0,    0, 2107, 2108, 2108, 2108, 2108,
-        0,    0, 2108, 2108, 2109, 2109, 2109,    0,    0,    0,
-     2109, 2110, 2110, 2110, 2110,    0,    0, 2110, 2110, 2111,
-     2111, 2111,    0,    0,    0, 2111, 2112, 2112, 2112, 2112,
-        0,    0, 2112, 2112, 2113, 2113, 2113,    0,    0,    0,
-     2113, 2114, 2114, 2114, 2114,    0,    0, 2114, 2114, 2115,
-
-     2115, 2115,    0,    0,    0, 2115, 2116, 2116, 2116, 2116,
-        0,    0, 2116, 2116, 2117, 2117, 2117,    0,    0,    0,
-     2117, 2118, 2118, 2118, 2118,    0,    0, 2118, 2118, 2119,
-     2119, 2119,    0,    0,    0, 2119, 2120, 2120, 2120, 2120,
-        0,    0, 2120, 2120, 2121, 2121, 2121,    0,    0,    0,
-     2121, 2122, 2122, 2122, 2122,    0,    0, 2122, 2122, 2123,
-     2123, 2123,    0,    0,    0, 2123, 2124, 2124, 2124, 2124,
-        0,    0, 2124, 2124, 2125, 2125, 2125,    0,    0,    0,
-     2125, 2126, 2126, 2126, 2126,    0,    0, 2126, 2126, 2127,
-     2127, 2127, 2127,    0,    0, 2127, 2127, 2128, 2128, 2128,
-
-        0,    0,    0, 2128, 2129, 2129, 2129, 2129,    0,    0,
-     2129, 2129, 2130, 2130, 2130,    0,    0,    0, 2130, 2131,
-     2131, 2131, 2131,    0,    0, 2131, 2131, 2132, 2132, 2132,
-        0,    0,    0, 2132, 2133, 2133, 2133, 2133,    0,    0,
-     2133, 2133, 2134, 2134, 2134, 2134,    0,    0, 2134, 2134,
-     2135, 2135, 2135,    0,    0,    0, 2135, 2136, 2136, 2136,
-     2136,    0,    0, 2136, 2136, 2137, 2137, 2137,    0,    0,
-        0, 2137, 2138, 2138, 2138, 2138,    0,    0, 2138, 2138,
-     2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2140,
-        0, 2140,    0,    0, 2140, 2141, 2141, 2141,    0,    0,
-
-        0, 2141, 2142, 2142, 2142, 2142,    0,    0, 2142, 2142,
-     2143, 2143, 2143, 2143,    0, 2143,    0, 2143, 2144, 2144,
-     2144, 2144,    0,    0, 2144, 2144, 2145, 2145, 2145, 2145,
-        0, 2145,    0, 2145, 2146, 2146, 2146, 2146,    0,    0,
-     2146, 2146, 2147, 2147, 2147,    0,    0,    0, 2147, 2148,
-     2148, 2148, 2148,    0,    0, 2148, 2148, 2149, 2149, 2149,
-        0,    0,    0, 2149, 2150, 2150, 2150, 2150,    0,    0,
-     2150, 2150, 2151, 2151, 2151,    0,    0,    0, 2151, 2152,
-     2152, 2152, 2152,    0,    0, 2152, 2152, 2153, 2153, 2153,
-        0,    0,    0, 2153, 2154, 2154, 2154, 2154,    0,    0,
-
-     2154, 2154, 2155, 2155, 2155,    0,    0,    0, 2155, 2156,
-     2156, 2156, 2156,    0,    0, 2156, 2156, 2157, 2157, 2157,
-        0,    0,    0, 2157, 2158, 2158, 2158, 2158,    0,    0,
-     2158, 2158, 2159, 2159, 2159,    0,    0,    0, 2159, 2160,
-     2160, 2160, 2160,    0,    0, 2160, 2160, 2161, 2161, 2161,
-     2161,    0,    0, 2161, 2161, 2162, 2162, 2162,    0,    0,
-        0, 2162, 2163, 2163, 2163, 2163,    0,    0, 2163, 2163,
-     2164, 2164, 2164,    0,    0,    0, 2164, 2165, 2165, 2165,
-     2165,    0,    0, 2165, 2165, 2166, 2166, 2166,    0,    0,
-        0, 2166, 2167, 2167, 2167, 2167,    0,    0, 2167, 2167,
-
-     2168, 2168, 2168, 2168,    0,    0, 2168, 2168, 2169, 2169,
-     2169,    0,    0,    0, 2169, 2170, 2170, 2170, 2170,    0,
-        0, 2170, 2170, 2171, 2171, 2171,    0,    0,    0, 2171,
-     2172, 2172, 2172, 2172,    0,    0, 2172, 2172, 2173, 2173,
-     2173, 2173, 2173, 2173, 2173, 2173, 2173, 2174, 2174, 2174,
-     2174, 2174, 2174, 2174, 2174, 2174, 2175, 2175, 2175,    0,
-        0,    0, 2175, 2176, 2176, 2176, 2176,    0,    0, 2176,
-     2176, 2177, 2177, 2177, 2177,    0,    0, 2177, 2177, 2178,
-     2178, 2178,    0,    0,    0, 2178, 2179, 2179, 2179, 2179,
-        0,    0, 2179, 2179, 2180, 2180, 2180,    0,    0,    0,
-
-     2180, 2181, 2181, 2181, 2181,    0,    0, 2181, 2181, 2182,
-     2182, 2182,    0,    0,    0, 2182, 2183, 2183, 2183, 2183,
-        0,    0, 2183, 2183, 2184, 2184, 2184,    0,    0,    0,
-     2184, 2185, 2185, 2185, 2185,    0,    0, 2185, 2185, 2186,
-     2186, 2186,    0,    0,    0, 2186, 2187, 2187, 2187, 2187,
-        0,    0, 2187, 2187, 2188, 2188, 2188,    0,    0,    0,
-     2188, 2189, 2189, 2189, 2189,    0,    0, 2189, 2189, 2190,
-     2190, 2190, 2190,    0, 2190,    0, 2190, 2191, 2191, 2191,
-     2191,    0,    0, 2191, 2191, 2192, 2192, 2192, 2192,    0,
-     2192,    0, 2192, 2193, 2193, 2193, 2193,    0,    0, 2193,
-
-     2193, 2194, 2194, 2194, 2194,    0,    0, 2194, 2194, 2195,
-     2195, 2195,    0,    0,    0, 2195, 2196, 2196, 2196, 2196,
-        0,    0, 2196, 2196, 2197, 2197, 2197,    0,    0,    0,
-     2197, 2198, 2198, 2198, 2198,    0,    0, 2198, 2198, 2199,
-     2199, 2199,    0,    0,    0, 2199, 2200, 2200, 2200, 2200,
-        0,    0, 2200, 2200, 2201, 2201, 2201, 2201,    0,    0,
-     2201, 2201, 2202, 2202, 2202,    0,    0,    0, 2202, 2203,
-     2203, 2203, 2203,    0,    0, 2203, 2203, 2204, 2204, 2204,
-     2204,    0, 2204,    0, 2204, 2205, 2205, 2205, 2205,    0,
-        0, 2205, 2205, 2206, 2206, 2206, 2206, 2206, 2206, 2206,
-
-     2206, 2206, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207,
-     2207, 2208, 2208, 2208,    0,    0,    0, 2208, 2209, 2209,
-     2209, 2209,    0,    0, 2209, 2209, 2210, 2210, 2210, 2210,
-        0,    0, 2210, 2210, 2211, 2211, 2211,    0,    0,    0,
-     2211, 2212, 2212, 2212, 2212,    0,    0, 2212, 2212, 2213,
-     2213, 2213,    0,    0,    0, 2213, 2214, 2214, 2214, 2214,
-        0,    0, 2214, 2214, 2215, 2215, 2215,    0,    0,    0,
-     2215, 2216, 2216, 2216, 2216,    0,    0, 2216, 2216, 2217,
-     2217, 2217, 2217,    0, 2217,    0, 2217, 2218, 2218, 2218,
-     2218,    0, 2218,    0, 2218, 2219, 2219, 2219, 2219,    0,
-
-        0, 2219, 2219, 2220, 2220, 2220,    0,    0,    0, 2220,
-     2221, 2221, 2221, 2221,    0,    0, 2221, 2221, 2222, 2222,
-     2222, 2222,    0,    0, 2222, 2222, 2223, 2223, 2223, 2223,
-        0, 2223,    0, 2223, 2224, 2224, 2224, 2224,    0,    0,
-     2224, 2224, 2225, 2225, 2225, 2225,    0,    0, 2225, 2225,
-     2226, 2226, 2226,    0,    0,    0, 2226, 2227, 2227, 2227,
-     2227,    0,    0, 2227, 2227, 2228, 2228, 2228, 2228,    0,
-     2228,    0, 2228, 2229, 2229, 2229, 2229,    0,    0, 2229,
-     2229, 2230, 2230, 2230, 2230,    0, 2230,    0, 2230, 2231,
-     2231, 2231, 2231,    0,    0, 2231, 2231, 2232, 2232, 2232,
-
-     2232,    0,    0, 2232, 2232, 2233, 2233, 2233,    0,    0,
-        0, 2233, 2234, 2234, 2234, 2234,    0,    0, 2234, 2234,
-     2235, 2235, 2235, 2235,    0,    0, 2235, 2235, 2236, 2236,
-     2236, 2236, 2236, 2236, 2236, 2236, 2236, 2237, 2237, 2237,
-     2237, 2237, 2237, 2237, 2237, 2237, 2238, 2238, 2238, 2238,
-        0, 2238,    0, 2238, 2239, 2239, 2239, 2239,    0,    0,
-     2239, 2239, 2240, 2240, 2240, 2240,    0,    0, 2240, 2240,
-     2241, 2241, 2241,    0,    0,    0, 2241, 2242, 2242, 2242,
-     2242,    0,    0, 2242, 2242, 2243, 2243, 2243,    0,    0,
-        0, 2243, 2244, 2244, 2244, 2244,    0,    0, 2244, 2244,
-
-     2245, 2245, 2245, 2245,    0, 2245,    0, 2245, 2246, 2246,
-     2246, 2246,    0,    0, 2246, 2246, 2247, 2247, 2247, 2247,
-        0, 2247,    0, 2247, 2248, 2248, 2248, 2248,    0,    0,
-     2248, 2248, 2249, 2249, 2249,    0,    0,    0, 2249, 2250,
-     2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2251, 2251,
-     2251, 2251, 2251, 2251, 2251, 2251, 2251, 2252, 2252, 2252,
-     2252, 2252, 2252, 2252, 2252, 2252, 2253, 2253, 2253, 2253,
-     2253, 2253, 2253, 2253, 2253, 2254, 2254, 2254, 2254, 2254,
-     2254, 2254, 2254, 2254, 2255, 2255, 2255, 2255, 2255, 2255,
-     2255, 2255, 2255, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
-     2022, 2022, 2022
-    } ;
+struct yy_trans_info {
+  flex_int32_t yy_verify;
+  flex_int32_t yy_nxt;
+};
+static yyconst flex_int16_t yy_accept[2023] = { 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 352, 350, 15, 10, 10, 15, 15, 330,
+  10, 330, 5, 6, 5, 8, 9, 8, 346, 338,
+  339, 347, 344, 347, 345, 349, 338, 339, 349, 350,
+  26, 10, 26, 26, 26, 24, 26, 26, 30, 10,
+  30, 30, 350, 350, 30, 37, 10, 37, 37, 37,
+  35, 37, 41, 10, 41, 52, 10, 52, 52, 52,
+
+  50, 52, 52, 52, 347, 346, 74, 10, 74, 74,
+  74, 72, 74, 74, 74, 74, 78, 10, 78, 350,
+  78, 97, 10, 97, 97, 97, 95, 97, 97, 97,
+  101, 10, 101, 114, 10, 114, 114, 114, 112, 114,
+  114, 114, 114, 118, 10, 118, 125, 10, 125, 125,
+  125, 123, 125, 350, 350, 129, 10, 129, 156, 10,
+  156, 156, 156, 154, 156, 156, 156, 156, 156, 160,
+  10, 160, 160, 169, 10, 169, 169, 169, 167, 169,
+  169, 173, 10, 173, 196, 10, 196, 196, 196, 194,
+  196, 196, 196, 196, 196, 196, 200, 10, 200, 207,
+
+  10, 207, 207, 207, 205, 207, 211, 10, 211, 236,
+  10, 236, 236, 236, 234, 236, 236, 236, 236, 240,
+  10, 240, 240, 259, 10, 259, 259, 259, 257, 259,
+  259, 259, 350, 263, 10, 263, 263, 286, 10, 286,
+  286, 286, 284, 286, 286, 286, 286, 290, 10, 290,
+  290, 297, 10, 297, 297, 297, 295, 297, 301, 10,
+  301, 314, 10, 314, 314, 314, 312, 314, 314, 314,
+  314, 318, 10, 318, 350, 318, 325, 10, 325, 325,
+  325, 323, 325, 329, 10, 329, 10, 0, 2, 2,
+  0, 4, 7, 341, 340, 0, 0, 0, 0, 0,
+
+  0, 0, 25, 27, 27, 27, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 36,
+  38, 38, 0, 51, 53, 53, 53, 53, 0, 0,
+  0, 73, 75, 75, 75, 75, 75, 75, 75, 0,
+  0, 96, 98, 98, 98, 98, 0, 113, 115, 115,
+  115, 115, 115, 0, 124, 126, 126, 0, 155, 157,
+  157, 157, 157, 157, 157, 157, 0, 168, 170, 170,
+  170, 0, 195, 197, 197, 197, 197, 197, 197, 197,
+  197, 197, 0, 206, 208, 208, 0, 235, 237, 237,
+
+  237, 237, 237, 237, 0, 258, 260, 260, 260, 260,
+  260, 0, 0, 285, 287, 287, 287, 287, 287, 0,
+  296, 298, 298, 0, 313, 315, 315, 315, 315, 315,
+  0, 0, 324, 326, 326, 0, 0, 0, 0, 0,
+  3, 0, 0, 0, 0, 0, 0, 0, 348, 0,
+  27, 27, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 38,
+  0, 0, 53, 0, 0, 53, 0, 0, 0, 343,
+  75, 0, 0, 75, 75, 75, 75, 0, 0, 0,
+
+  98, 98, 98, 0, 0, 0, 0, 115, 115, 115,
+  0, 0, 126, 0, 0, 157, 0, 0, 157, 157,
+  157, 157, 0, 0, 0, 0, 170, 0, 0, 197,
+  0, 0, 0, 0, 197, 197, 197, 197, 197, 0,
+  0, 0, 0, 0, 0, 237, 0, 0, 237, 237,
+  237, 0, 0, 260, 260, 260, 260, 0, 0, 0,
+  287, 287, 287, 287, 0, 0, 0, 0, 0, 0,
+  315, 315, 315, 315, 0, 0, 0, 326, 0, 0,
+  0, 14, 1, 0, 0, 336, 0, 0, 0, 333,
+  332, 0, 0, 27, 27, 0, 0, 29, 0, 0,
+
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 103,
+  0, 0, 0, 0, 0, 0, 0, 102, 0, 0,
+  0, 0, 0, 0, 38, 0, 0, 40, 0, 53,
+  0, 45, 44, 53, 0, 0, 0, 55, 0, 75,
+  0, 59, 58, 0, 0, 75, 0, 0, 75, 0,
+  0, 77, 0, 0, 98, 98, 98, 0, 0, 100,
+  0, 0, 105, 104, 115, 115, 115, 0, 0, 117,
+  0, 126, 0, 0, 128, 0, 157, 0, 133, 132,
+  157, 157, 157, 157, 0, 0, 159, 0, 0, 164,
+  163, 170, 0, 0, 172, 0, 197, 197, 0, 187,
+
+  186, 0, 177, 176, 0, 0, 197, 197, 197, 197,
+  0, 0, 199, 0, 0, 204, 203, 0, 0, 210,
+  0, 237, 0, 215, 214, 237, 237, 237, 0, 0,
+  239, 0, 260, 0, 0, 0, 0, 260, 0, 0,
+  0, 262, 0, 287, 0, 0, 287, 0, 0, 0,
+  0, 289, 0, 0, 294, 293, 0, 0, 300, 0,
+  315, 315, 315, 315, 0, 0, 317, 0, 0, 326,
+  0, 0, 328, 0, 0, 0, 337, 331, 0, 0,
+  0, 27, 27, 0, 0, 0, 0, 131, 0, 213,
+  0, 0, 161, 0, 0, 103, 0, 0, 0, 130,
+
+  212, 0, 0, 102, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 53, 0, 0, 75, 0,
+  63, 62, 0, 0, 0, 61, 60, 75, 0, 162,
+  98, 0, 0, 98, 0, 115, 115, 115, 0, 126,
+  0, 157, 157, 157, 157, 157, 0, 170, 0, 197,
+  197, 0, 189, 188, 197, 197, 197, 197, 0, 0,
+  237, 237, 237, 237, 0, 260, 0, 246, 245, 0,
+  244, 243, 260, 212, 0, 287, 0, 269, 268, 287,
+  0, 267, 266, 0, 0, 315, 0, 0, 315, 315,
+  0, 0, 326, 0, 0, 0, 0, 12, 0, 334,
+
+  335, 0, 27, 27, 0, 0, 0, 0, 131, 0,
+  213, 0, 0, 0, 161, 0, 265, 43, 0, 0,
+  130, 212, 0, 265, 42, 0, 264, 0, 264, 42,
+  0, 34, 33, 0, 0, 47, 46, 53, 0, 0,
+  75, 0, 65, 64, 75, 0, 162, 98, 0, 0,
+  0, 0, 0, 0, 115, 115, 115, 0, 116, 126,
+  0, 157, 157, 157, 0, 0, 0, 0, 157, 0,
+  0, 0, 0, 0, 0, 197, 0, 0, 197, 197,
+  197, 0, 0, 237, 237, 237, 0, 0, 237, 0,
+  260, 260, 0, 0, 287, 287, 0, 0, 315, 0,
+
+  305, 304, 315, 315, 0, 0, 0, 0, 0, 0,
+  0, 0, 11, 0, 27, 27, 27, 0, 0, 0,
+  0, 0, 0, 0, 0, 57, 265, 0, 202, 43,
+  0, 0, 0, 56, 201, 42, 0, 264, 0, 0,
+  0, 0, 53, 0, 0, 75, 75, 0, 98, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 92, 91,
+  0, 0, 0, 115, 0, 0, 0, 0, 0, 157,
+  157, 157, 0, 135, 134, 0, 0, 0, 157, 0,
+  158, 0, 166, 165, 0, 171, 0, 191, 190, 0,
+  0, 0, 185, 184, 0, 0, 197, 0, 0, 0,
+
+  0, 237, 237, 237, 0, 0, 0, 237, 0, 238,
+  0, 0, 260, 0, 0, 0, 0, 287, 0, 0,
+  315, 315, 315, 0, 0, 0, 322, 321, 0, 0,
+  0, 0, 0, 0, 0, 27, 27, 0, 0, 175,
+  120, 32, 0, 0, 303, 57, 0, 202, 0, 174,
+  119, 56, 201, 302, 0, 31, 0, 0, 53, 0,
+  0, 54, 75, 75, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 107,
+  106, 0, 0, 0, 109, 108, 0, 122, 121, 0,
+  157, 157, 157, 0, 0, 157, 0, 193, 192, 0,
+
+  179, 178, 0, 0, 0, 181, 180, 0, 0, 237,
+  0, 0, 237, 237, 0, 0, 237, 0, 0, 0,
+  260, 0, 0, 0, 0, 0, 287, 0, 288, 0,
+  315, 315, 315, 0, 0, 0, 0, 0, 0, 17,
+  0, 19, 18, 27, 27, 0, 319, 175, 120, 32,
+  291, 16, 303, 0, 0, 174, 119, 302, 0, 31,
+  0, 0, 53, 342, 75, 75, 0, 76, 0, 94,
+  93, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 111, 110, 0, 157, 157, 157, 0,
+  0, 0, 0, 157, 0, 183, 182, 0, 0, 209,
+
+  237, 0, 221, 220, 237, 237, 0, 0, 0, 0,
+  237, 0, 0, 0, 0, 260, 292, 0, 0, 0,
+  0, 0, 287, 0, 0, 0, 315, 315, 0, 320,
+  0, 0, 0, 0, 17, 27, 27, 0, 319, 291,
+  16, 0, 0, 0, 0, 0, 39, 53, 0, 0,
+  75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 127, 157, 157, 157, 0, 141, 0,
+  140, 157, 0, 198, 0, 0, 237, 237, 237, 0,
+  225, 0, 224, 237, 0, 0, 0, 0, 0, 0,
+  0, 0, 292, 0, 0, 0, 0, 0, 0, 0,
+
+  287, 0, 0, 307, 306, 0, 0, 315, 0, 316,
+  320, 0, 0, 0, 0, 0, 0, 27, 0, 28,
+  0, 0, 0, 0, 53, 0, 0, 0, 75, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  157, 157, 157, 143, 142, 0, 0, 0, 217, 216,
+  237, 237, 237, 227, 226, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 287, 287, 0, 299, 0, 311, 310,
+  0, 0, 0, 327, 0, 0, 0, 0, 21, 20,
+  0, 0, 242, 0, 241, 0, 0, 0, 0, 0,
+
+  0, 0, 75, 0, 0, 0, 0, 84, 0, 0,
+  0, 0, 83, 0, 157, 157, 157, 0, 145, 144,
+  237, 237, 237, 0, 229, 228, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 287, 287, 0, 309, 308, 0, 0,
+  0, 0, 23, 22, 242, 0, 241, 0, 0, 49,
+  48, 0, 0, 0, 0, 75, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 157, 157, 157,
+  237, 0, 0, 237, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+  0, 287, 287, 0, 0, 0, 0, 80, 79, 0,
+  0, 0, 0, 0, 0, 0, 0, 90, 0, 0,
+  0, 89, 0, 0, 0, 137, 136, 157, 157, 157,
+  157, 237, 0, 223, 222, 237, 0, 0, 0, 0,
+  0, 0, 256, 0, 255, 0, 0, 261, 0, 0,
+  0, 0, 0, 0, 0, 0, 287, 0, 0, 287,
+  0, 0, 0, 0, 0, 0, 80, 79, 0, 0,
+  0, 0, 0, 67, 66, 0, 0, 0, 0, 0,
+  0, 0, 157, 157, 157, 157, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 254, 253, 0, 0,
+
+  0, 0, 0, 0, 0, 273, 272, 287, 0, 271,
+  270, 287, 0, 0, 0, 0, 0, 0, 0, 71,
+  0, 70, 88, 0, 0, 87, 0, 0, 0, 99,
+  157, 157, 157, 157, 0, 219, 218, 0, 0, 0,
+  0, 0, 250, 0, 0, 249, 0, 0, 281, 0,
+  0, 280, 287, 287, 0, 0, 0, 12, 0, 12,
+  0, 0, 0, 82, 86, 81, 85, 157, 157, 157,
+  157, 0, 0, 0, 0, 252, 248, 251, 247, 283,
+  279, 282, 278, 287, 287, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 157, 0,
+
+  0, 0, 0, 0, 0, 287, 287, 0, 0, 69,
+  68, 0, 139, 138, 0, 149, 148, 0, 147, 146,
+  157, 0, 153, 152, 0, 0, 0, 0, 287, 287,
+  0, 11, 157, 0, 0, 0, 0, 287, 287, 0,
+  157, 0, 0, 0, 0, 287, 287, 0, 157, 0,
+  0, 0, 0, 287, 287, 0, 0, 0, 0, 231,
+  0, 230, 287, 287, 0, 0, 151, 150, 233, 232,
+  287, 287, 0, 287, 287, 0, 287, 287, 0, 0,
+  287, 287, 0, 0, 287, 287, 0, 0, 287, 287,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 277,
+
+  276, 0, 275, 274, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  13, 0
+};
+
+static yyconst flex_int32_t yy_ec[256] = { 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+  1, 2, 4, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
+  1, 1, 1, 1, 10, 11, 12, 13, 13, 13,
+  13, 14, 13, 13, 13, 15, 13, 16, 17, 18,
+  19, 20, 21, 1, 22, 23, 24, 25, 26, 27,
+  28, 29, 30, 28, 31, 32, 33, 34, 35, 36,
+  28, 37, 38, 39, 28, 40, 41, 28, 42, 28,
+  43, 1, 44, 1, 45, 1, 46, 47, 48, 49,
+
+  50, 51, 52, 53, 54, 28, 55, 56, 57, 58,
+  59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+  69, 28, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1
+};
+
+static yyconst flex_int32_t yy_meta[70] = { 0,
+  1, 2, 2, 2, 1, 1, 1, 1, 1, 3,
+  3, 1, 4, 4, 4, 5, 6, 1, 7, 8,
+  1, 9, 9, 9, 9, 9, 9, 5, 5, 5,
+  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+  5, 5, 1, 1, 5, 9, 9, 9, 9, 9,
+  9, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+  5, 5, 5, 5, 5, 5, 5, 5, 5
+};
+
+static yyconst flex_int16_t yy_base[2256] = { 0,
+  0, 0, 0, 3, 6, 9, 12, 29, 16, 19,
+  14, 17, 33, 36, 49, 55, 45, 61, 66, 72,
+  105, 173, 75, 78, 83, 125, 128, 132, 135, 138,
+  193, 196, 200, 203, 206, 224, 242, 293, 262, 265,
+  344, 404, 271, 273, 464, 527, 269, 316, 320, 323,
+  364, 367, 371, 374, 590, 654, 424, 427, 718, 781,
+  431, 434, 844, 907, 484, 487, 491, 494, 497, 547,
+  970, 1033, 550, 554, 557, 560, 610, 613, 617, 620,
+  1096, 1162, 623, 674, 1228, 0, 677, 681, 1297, 1351,
+  684, 687, 1405, 1468, 738, 741, 745, 748, 751, 801,
+
+  804, 808, 1531, 1594, 811, 814, 864, 867, 871, 874,
+  877, 927, 1657, 1720, 930, 934, 937, 940, 990, 993,
+  997, 1000, 1783, 1837, 1003, 1053, 1891, 1954, 1056, 1060,
+  1063, 1066, 1116, 1119, 1123, 1126, 2017, 2083, 1129, 1182,
+  0, 0, 5066, 7094, 7094, 95, 100, 29, 41, 7094,
+  155, 51, 7094, 7094, 5055, 7094, 7094, 5043, 7094, 5058,
+  5042, 1141, 7094, 7094, 7094, 7094, 5036, 5032, 4990, 210,
+  7094, 158, 5012, 0, 142, 7094, 4977, 4969, 7094, 162,
+  2145, 2205, 160, 5007, 176, 7094, 165, 4998, 0, 149,
+  7094, 4961, 7094, 230, 378, 7094, 326, 4994, 0, 208,
+
+  7094, 4958, 4949, 4947, 379, 4950, 7094, 329, 4972, 0,
+  214, 7094, 4938, 4937, 238, 4915, 7094, 377, 11, 31,
+  4965, 7094, 399, 4948, 0, 435, 7094, 4907, 4905, 4888,
+  7094, 457, 441, 7094, 520, 4922, 0, 436, 7094, 4892,
+  4870, 4871, 4851, 7094, 583, 498, 7094, 640, 4894, 0,
+  499, 7094, 4862, 513, 4840, 7094, 644, 4879, 7094, 647,
+  4870, 0, 562, 7094, 4802, 34, 4821, 4797, 4788, 7094,
+  704, 177, 4838, 7094, 708, 4827, 0, 568, 7094, 4793,
+  4783, 7094, 711, 752, 7094, 772, 4808, 0, 631, 7094,
+  211, 4777, 4775, 93, 4773, 4753, 7094, 834, 818, 7094,
+
+  894, 4796, 0, 632, 7094, 4753, 7094, 897, 881, 7094,
+  901, 4781, 0, 695, 7094, 4739, 4735, 4736, 80, 7094,
+  957, 360, 4765, 7094, 960, 4755, 0, 696, 7094, 4726,
+  4709, 26, 304, 7094, 963, 330, 4746, 7094, 1149, 4726,
+  0, 885, 7094, 4694, 4675, 4679, 4673, 7094, 1152, 499,
+  4721, 7094, 1155, 4705, 0, 948, 7094, 4672, 7094, 1186,
+  1005, 7094, 1192, 4696, 0, 1004, 7094, 4650, 4654, 4655,
+  4643, 7094, 1205, 1100, 4694, 4691, 7094, 1208, 4678, 0,
+  1007, 7094, 4650, 7094, 1211, 1068, 1215, 429, 4627, 7094,
+  4683, 4665, 7094, 7094, 7094, 1306, 283, 4614, 4612, 4607,
+
+  4647, 4609, 7094, 0, 4598, 4601, 4586, 4583, 4584, 4580,
+  4574, 4570, 4573, 4, 166, 4567, 4554, 4558, 4546, 4545,
+  4541, 404, 4544, 4530, 38, 467, 4530, 712, 4523, 7094,
+  0, 4526, 4527, 7094, 0, 4523, 1320, 4516, 533, 4512,
+  4555, 7094, 0, 4514, 1323, 4486, 4507, 4493, 4497, 4477,
+  89, 7094, 0, 4488, 4462, 4473, 4453, 7094, 0, 1326,
+  4459, 4459, 4455, 4435, 7094, 0, 4429, 4441, 7094, 0,
+  4444, 1329, 4422, 4400, 4400, 4419, 4407, 7094, 0, 1373,
+  4398, 4393, 7094, 0, 4406, 1377, 1380, 4375, 4371, 4386,
+  4372, 4366, 4367, 7094, 0, 1383, 4348, 7094, 0, 4351,
+
+  1425, 4340, 4357, 4355, 4340, 7094, 0, 4327, 4326, 4340,
+  4326, 4323, 4308, 7094, 0, 4305, 4289, 4291, 4298, 4283,
+  7094, 0, 1428, 4287, 7094, 0, 4277, 4271, 4272, 4280,
+  4264, 4261, 7094, 0, 4265, 4267, 4286, 4295, 807, 4246,
+  7094, 1207, 0, 4229, 4229, 4269, 4268, 4224, 7094, 4231,
+  4213, 4213, 1431, 1434, 4218, 4203, 4205, 4201, 4215, 4194,
+  4202, 4187, 4187, 4178, 4170, 4186, 4165, 4167, 4164, 4155,
+  4154, 4145, 4145, 4157, 4143, 4135, 4141, 4122, 4139, 4128,
+  1437, 1489, 4127, 1494, 1497, 4108, 4137, 1551, 1556, 7094,
+  4106, 1559, 1514, 1562, 4097, 1565, 4108, 1619, 1627, 4090,
+
+  4091, 4097, 4083, 1622, 1630, 1677, 1583, 4079, 4065, 4067,
+  1682, 1695, 4068, 1685, 1740, 4058, 1691, 1642, 4059, 4062,
+  4056, 4037, 1745, 1748, 1751, 1710, 4035, 1755, 1808, 583,
+  1811, 1814, 1857, 1860, 1869, 4032, 4030, 4025, 4021, 1911,
+  1920, 1914, 1880, 1917, 1923, 4022, 1926, 1975, 4014, 3994,
+  3987, 1983, 1986, 3996, 1989, 1992, 3981, 3977, 2039, 2046,
+  3979, 1997, 3983, 2043, 2049, 2052, 2061, 2072, 2104, 2110,
+  3976, 3952, 3959, 3943, 2113, 2116, 3952, 3927, 2119, 2138,
+  3970, 7094, 7094, 315, 3922, 7094, 3934, 3933, 3878, 7094,
+  7094, 3872, 3870, 3879, 3868, 2141, 2149, 7094, 2168, 3865,
+
+  3859, 3871, 3849, 3854, 3849, 3830, 261, 3839, 3819, 1223,
+  3834, 3802, 3814, 3798, 3796, 3801, 3784, 1332, 3795, 384,
+  3777, 3784, 3774, 3788, 2144, 2172, 2177, 7094, 2182, 2209,
+  2216, 7094, 7094, 2229, 3810, 2232, 2235, 7094, 2240, 3756,
+  2268, 7094, 7094, 2243, 2276, 2287, 2290, 2293, 3767, 2301,
+  2308, 7094, 2311, 432, 3761, 2314, 3760, 2320, 2323, 7094,
+  2332, 2335, 7094, 7094, 3754, 3751, 3743, 2343, 2346, 7094,
+  2351, 3739, 2354, 2357, 7094, 2377, 3735, 2380, 7094, 7094,
+  3728, 3721, 3717, 3727, 2388, 2391, 7094, 2396, 2400, 7094,
+  7094, 3722, 2410, 2415, 7094, 2418, 3702, 3717, 2422, 7094,
+
+  7094, 2438, 7094, 7094, 2430, 2448, 3700, 3698, 3703, 3695,
+  2458, 2461, 7094, 2464, 2467, 7094, 7094, 2483, 2486, 7094,
+  2489, 3673, 2492, 7094, 7094, 3679, 3672, 3662, 2508, 2511,
+  7094, 2514, 3611, 2517, 2521, 2536, 2539, 3618, 3612, 2547,
+  2554, 7094, 2557, 3602, 2560, 2567, 3607, 2578, 2581, 2589,
+  2592, 7094, 2596, 2599, 7094, 7094, 2611, 2615, 7094, 2621,
+  3590, 2624, 3607, 3576, 2630, 2634, 7094, 2642, 3573, 3586,
+  2645, 2649, 7094, 2653, 726, 2656, 7094, 7094, 3618, 3616,
+  3569, 3560, 3587, 2664, 3545, 3528, 3544, 1386, 3520, 2152,
+  3533, 3532, 1460, 3512, 3519, 1463, 3518, 3502, 3518, 1523,
+
+  2678, 3504, 3511, 1526, 3497, 3496, 3494, 3478, 3491, 3490,
+  2668, 2686, 2694, 2700, 2704, 3489, 3504, 2713, 3479, 2718,
+  7094, 7094, 2727, 2732, 2745, 7094, 7094, 3473, 2740, 1650,
+  3457, 2753, 2760, 2771, 2774, 3446, 3466, 3439, 2777, 3457,
+  2780, 3458, 3452, 3436, 2783, 2789, 2801, 2807, 2811, 2814,
+  2821, 2833, 7094, 7094, 2825, 2843, 2847, 2850, 2853, 2856,
+  3442, 3447, 3431, 2876, 2879, 3430, 2885, 7094, 7094, 2894,
+  7094, 7094, 3418, 2903, 2906, 3419, 2921, 7094, 7094, 3412,
+  2929, 7094, 7094, 2937, 2940, 3420, 2910, 2943, 3401, 3418,
+  2951, 3402, 2959, 2962, 181, 3437, 2965, 7094, 3436, 7094,
+
+  7094, 3395, 3388, 518, 2970, 3395, 3393, 3394, 1705, 3391,
+  1769, 3387, 3375, 3365, 1774, 3370, 2973, 2977, 3375, 3365,
+  1777, 1829, 3354, 2984, 2994, 3347, 3000, 3358, 3003, 3009,
+  3020, 7094, 7094, 3030, 3034, 7094, 7094, 3351, 3362, 3049,
+  3328, 3052, 7094, 7094, 3325, 3064, 1832, 3325, 3068, 1059,
+  1113, 3045, 3076, 3084, 3087, 3090, 3094, 3098, 7094, 3108,
+  3112, 3337, 3333, 3317, 3117, 3122, 3135, 3138, 3328, 3146,
+  3149, 3153, 3161, 3167, 3170, 3180, 3185, 3188, 3198, 3203,
+  3206, 3209, 3212, 3328, 3307, 3321, 3216, 3224, 3321, 3234,
+  3237, 3241, 3322, 3244, 3247, 3265, 3268, 3273, 3310, 3276,
+
+  7094, 7094, 3313, 3302, 3288, 3306, 3293, 3296, 3311, 1422,
+  612, 568, 7094, 3279, 3317, 3320, 3323, 3326, 3282, 3275,
+  3282, 3267, 3252, 3249, 3246, 1875, 1945, 3250, 1948, 2010,
+  3258, 3242, 3248, 3330, 3341, 3345, 3224, 3348, 3229, 3233,
+  3233, 3351, 3226, 3243, 3355, 3204, 3207, 3358, 3361, 3236,
+  3222, 260, 3220, 3231, 3217, 421, 3207, 3384, 7094, 7094,
+  3392, 3395, 3400, 3414, 3417, 3420, 3428, 3435, 3446, 3180,
+  3169, 3172, 3449, 7094, 7094, 3458, 3188, 3186, 3149, 3466,
+  7094, 3469, 7094, 7094, 3477, 7094, 3481, 7094, 7094, 3489,
+  3496, 3507, 7094, 7094, 3515, 3518, 3526, 3529, 3533, 3547,
+
+  3550, 3134, 3553, 3151, 3556, 3160, 3158, 3131, 3571, 7094,
+  3574, 3577, 3585, 3116, 3597, 3592, 3612, 3603, 3606, 3621,
+  3120, 3120, 3121, 3625, 3109, 3628, 7094, 7094, 3640, 808,
+  1330, 747, 3104, 3644, 3647, 3655, 3662, 3669, 3096, 3673,
+  3676, 3680, 3087, 3086, 3683, 3689, 3070, 3692, 3074, 3695,
+  3698, 3701, 3704, 3707, 3065, 3712, 3070, 3715, 3068, 3074,
+  3718, 7094, 3046, 3061, 3721, 3726, 3730, 3071, 3065, 3044,
+  3047, 3035, 3041, 3035, 3024, 3026, 3018, 3740, 3744, 7094,
+  7094, 3752, 3755, 3764, 7094, 7094, 3772, 7094, 7094, 3780,
+  3001, 2995, 2985, 669, 743, 2986, 3783, 7094, 7094, 3792,
+
+  7094, 7094, 3800, 3803, 3811, 7094, 7094, 3819, 3822, 2988,
+  3825, 3828, 2988, 2970, 806, 857, 2972, 3843, 358, 361,
+  3851, 2962, 3854, 3857, 658, 785, 3865, 3869, 7094, 3873,
+  3876, 2968, 2960, 3883, 2950, 3894, 3888, 927, 1009, 3898,
+  3903, 7094, 7094, 3913, 3916, 3922, 3925, 3936, 3941, 3945,
+  3951, 3954, 3957, 2953, 2950, 3960, 3963, 3967, 2938, 3970,
+  2934, 3973, 2927, 7094, 3979, 2920, 3982, 7094, 3985, 7094,
+  7094, 2958, 2920, 2932, 2925, 2925, 2925, 2909, 2911, 2905,
+  2902, 3993, 3997, 7094, 7094, 4005, 2868, 2859, 2848, 2865,
+  2878, 2850, 2865, 2818, 4008, 7094, 7094, 4016, 4019, 7094,
+
+  4024, 4028, 7094, 7094, 2810, 2784, 2761, 2746, 2713, 2723,
+  2624, 81, 919, 466, 985, 4038, 4042, 4045, 474, 1048,
+  477, 1057, 4051, 4056, 4059, 4071, 4064, 527, 4082, 4085,
+  4088, 4091, 748, 840, 4095, 4101, 4113, 4119, 4122, 4125,
+  4131, 518, 548, 565, 624, 4134, 7094, 665, 4138, 4141,
+  706, 738, 786, 838, 838, 886, 894, 901, 915, 912,
+  931, 4156, 4162, 7094, 934, 971, 965, 1025, 7094, 1023,
+  7094, 4165, 4168, 7094, 4171, 4177, 998, 1005, 1019, 1080,
+  7094, 1115, 7094, 4189, 1109, 1100, 1117, 1135, 1140, 1165,
+  4192, 4195, 4203, 4213, 1166, 1160, 1173, 1175, 1165, 1178,
+
+  4216, 4219, 4222, 7094, 7094, 4234, 4238, 4247, 4252, 7094,
+  4255, 4258, 1293, 1347, 1384, 4271, 4278, 4289, 4292, 7094,
+  1169, 1287, 1284, 1293, 4295, 4298, 1366, 1470, 1285, 1316,
+  1325, 1349, 1371, 1391, 1368, 1378, 1397, 1423, 1437, 4307,
+  1381, 1403, 1403, 7094, 7094, 4313, 4316, 4327, 7094, 7094,
+  1402, 1410, 1430, 7094, 7094, 4335, 4338, 1457, 1463, 1468,
+  1468, 1469, 1474, 4346, 1548, 1549, 4354, 1477, 1480, 1485,
+  1519, 1518, 1534, 4357, 4360, 4364, 7094, 4369, 7094, 7094,
+  4378, 4383, 4391, 7094, 1573, 1552, 1559, 4396, 7094, 7094,
+  4404, 4410, 4422, 1525, 4425, 1540, 4428, 4431, 1579, 1598,
+
+  1590, 1606, 1577, 1611, 1601, 1607, 1615, 7094, 1631, 1642,
+  1641, 1650, 7094, 4439, 4442, 1646, 1659, 4446, 7094, 7094,
+  1661, 4454, 1670, 4460, 7094, 7094, 1699, 1710, 1730, 1724,
+  1726, 1741, 1747, 1779, 1771, 1782, 4468, 1772, 1783, 1795,
+  1785, 1788, 1799, 4472, 4475, 4493, 7094, 7094, 1916, 1833,
+  4481, 4501, 7094, 7094, 4478, 1765, 4509, 1801, 4512, 7094,
+  7094, 1845, 1834, 1852, 1841, 4522, 1848, 1868, 1901, 1910,
+  1899, 1917, 1932, 1931, 4525, 4528, 4531, 1919, 1995, 1921,
+  1952, 4540, 4546, 1935, 1980, 1989, 1999, 2009, 2018, 2033,
+  2062, 2032, 2062, 2035, 4554, 2047, 2053, 2048, 2069, 2083,
+
+  2076, 4558, 4561, 2108, 4564, 4567, 4587, 4595, 4598, 2091,
+  2104, 2097, 2107, 4606, 4609, 2105, 2105, 7094, 2107, 2109,
+  2130, 7094, 2132, 4617, 4620, 7094, 7094, 2111, 2117, 2123,
+  2131, 4628, 4632, 7094, 7094, 4640, 2157, 2149, 2162, 2164,
+  2156, 2169, 7094, 2189, 7094, 2194, 4646, 7094, 2179, 2172,
+  2190, 2191, 2187, 2198, 4649, 4652, 4660, 4667, 4671, 4680,
+  2204, 4685, 4688, 4708, 4747, 4791, 4698, 4716, 2202, 2223,
+  2215, 2232, 4720, 7094, 7094, 2243, 2218, 2222, 2248, 2232,
+  2234, 4737, 2217, 2227, 2218, 2217, 4741, 4728, 4759, 4767,
+  2257, 2259, 2281, 2272, 2275, 2292, 7094, 7094, 2281, 2283,
+
+  2313, 2294, 2304, 2321, 4777, 7094, 7094, 4785, 4811, 7094,
+  7094, 4803, 2345, 4821, 2356, 2355, 4857, 4901, 2318, 7094,
+  2328, 7094, 7094, 2345, 2361, 7094, 2359, 2361, 4829, 7094,
+  2322, 2307, 2336, 2337, 4834, 7094, 7094, 4842, 2410, 2418,
+  2382, 2390, 7094, 2392, 2396, 7094, 2404, 2417, 7094, 2418,
+  2420, 7094, 4851, 4869, 2423, 2452, 2454, 2430, 2488, 2437,
+  4877, 2438, 2440, 7094, 7094, 7094, 7094, 4880, 4892, 4921,
+  4924, 2457, 2453, 2461, 2470, 7094, 7094, 7094, 7094, 7094,
+  7094, 7094, 7094, 4927, 4932, 4935, 2494, 2481, 2495, 4945,
+  2499, 2498, 4950, 4883, 4954, 4958, 4968, 4972, 2460, 4980,
+
+  4987, 2487, 2510, 2494, 2513, 4998, 5001, 5004, 2517, 7094,
+  7094, 5007, 7094, 7094, 5019, 7094, 7094, 5027, 7094, 7094,
+  2494, 5035, 7094, 7094, 2510, 2510, 2516, 2516, 5045, 5048,
+  2546, 7094, 2517, 2538, 2549, 2548, 2560, 5051, 5054, 2569,
+  2538, 2570, 2585, 2575, 2595, 5057, 5075, 2601, 5078, 2603,
+  2624, 2613, 2633, 5081, 5084, 2665, 5087, 5110, 2657, 7094,
+  2655, 7094, 5118, 5121, 2666, 5139, 7094, 7094, 7094, 7094,
+  5147, 5150, 5153, 5156, 5159, 5168, 5182, 5187, 2655, 2663,
+  5194, 5201, 2658, 2691, 5205, 5208, 2680, 2738, 5212, 5226,
+  2673, 2719, 5231, 5237, 5253, 5256, 2703, 2739, 5264, 7094,
+
+  7094, 5273, 7094, 7094, 2778, 2787, 2747, 2750, 2850, 2852,
+  2799, 2818, 2689, 2748, 2855, 2866, 2800, 2881, 5281, 5284,
+  7094, 7094, 5304, 5313, 5322, 5331, 5340, 5349, 5358, 5367,
+  5376, 5385, 5394, 5403, 5412, 5421, 5430, 5439, 5448, 5457,
+  5466, 5475, 5484, 5493, 5502, 5511, 5520, 5529, 5538, 5547,
+  5556, 5565, 5574, 5583, 5592, 5601, 5610, 5619, 5628, 5637,
+  5646, 5653, 5660, 5667, 5674, 5681, 5688, 5695, 5702, 5709,
+  5716, 5723, 5730, 5737, 5744, 5751, 5758, 5765, 5774, 5779,
+  5784, 5789, 5794, 5799, 5804, 5809, 5814, 5819, 5826, 5831,
+  5838, 5843, 5850, 5855, 5862, 5867, 5874, 5879, 5886, 5891,
+
+  5898, 5903, 5910, 5915, 5924, 5930, 5937, 5945, 5952, 5960,
+  5967, 5975, 5982, 5990, 5997, 6005, 6012, 6020, 6027, 6035,
+  6042, 6050, 6057, 6065, 6072, 6080, 6088, 6095, 6103, 6110,
+  6118, 6125, 6133, 6141, 6148, 6156, 6163, 6171, 6180, 6186,
+  6193, 6201, 6209, 6217, 6225, 6233, 6240, 6248, 6255, 6263,
+  6270, 6278, 6285, 6293, 6300, 6308, 6315, 6323, 6330, 6338,
+  6346, 6353, 6361, 6368, 6376, 6383, 6391, 6399, 6406, 6414,
+  6421, 6429, 6438, 6447, 6454, 6462, 6470, 6477, 6485, 6492,
+  6500, 6507, 6515, 6522, 6530, 6537, 6545, 6552, 6560, 6568,
+  6576, 6584, 6592, 6600, 6607, 6615, 6622, 6630, 6637, 6645,
+
+  6653, 6660, 6668, 6676, 6684, 6693, 6702, 6709, 6717, 6725,
+  6732, 6740, 6747, 6755, 6762, 6770, 6778, 6786, 6794, 6801,
+  6809, 6817, 6825, 6833, 6841, 6848, 6856, 6864, 6872, 6880,
+  6888, 6896, 6903, 6911, 6919, 6928, 6937, 6945, 6953, 6961,
+  6968, 6976, 6983, 6991, 6999, 7007, 7015, 7023, 7030, 7039,
+  7048, 7057, 7066, 7075, 7084
+};
+
+static yyconst flex_int16_t yy_def[2256] = { 0,
+  2023, 2023, 2024, 2024, 2024, 2024, 2025, 2025, 2026, 2026,
+  2027, 2027, 2028, 2028, 2028, 2028, 2029, 2029, 2023, 2023,
+  2030, 2030, 2031, 2031, 2031, 2031, 2023, 2023, 2031, 2031,
+  2023, 2023, 2031, 2031, 2031, 2031, 2032, 2032, 2033, 2033,
+  2034, 2034, 2028, 2028, 2035, 2035, 2036, 2036, 2023, 2023,
+  2036, 2036, 2036, 2036, 2037, 2037, 2038, 2038, 2039, 2039,
+  2040, 2040, 2041, 2041, 2023, 2023, 2023, 2023, 2042, 2042,
+  2043, 2043, 2044, 2044, 2023, 2023, 2044, 2044, 2044, 2044,
+  2045, 2045, 2046, 2046, 2022, 85, 2047, 2047, 2048, 2048,
+  2049, 2049, 2050, 2050, 2051, 2051, 2023, 2023, 2051, 2051,
+
+  2051, 2051, 2052, 2052, 2023, 2023, 2023, 2023, 2053, 2053,
+  2053, 2053, 2054, 2054, 2055, 2055, 2023, 2023, 2055, 2055,
+  2055, 2055, 2056, 2056, 2057, 2057, 2058, 2058, 2059, 2059,
+  2023, 2023, 2059, 2059, 2059, 2059, 2060, 2060, 2061, 2061,
+  2023, 2023, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2062, 2022, 2022, 2062, 2062, 2022, 2022,
+  2022, 2022, 181, 182, 182, 2022, 2022, 2022, 2063, 2022,
+  2022, 2063, 2022, 2022, 2022, 2022, 2022, 2022, 2064, 2022,
+
+  2022, 2064, 2064, 2064, 2022, 2022, 2022, 2022, 2022, 2065,
+  2022, 2022, 2065, 2065, 2065, 2065, 2022, 2022, 185, 185,
+  185, 2022, 2022, 2022, 2066, 2022, 2022, 2066, 2066, 2066,
+  2022, 2022, 2022, 2022, 2022, 2022, 2067, 2022, 2022, 2067,
+  2067, 2067, 2067, 2022, 2022, 2022, 2022, 2022, 2022, 2068,
+  2022, 2022, 2068, 185, 254, 2022, 2022, 185, 2022, 2022,
+  2022, 2069, 2022, 2022, 2069, 2069, 2069, 2069, 2069, 2022,
+  2022, 185, 185, 2022, 2022, 2022, 2070, 2022, 2022, 2070,
+  2070, 2022, 2022, 2022, 2022, 2022, 2022, 2071, 2022, 2022,
+  2071, 2071, 2071, 2071, 2071, 2071, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2072, 2022, 2022, 2072, 2022, 2022, 2022, 2022,
+  2022, 2022, 2073, 2022, 2022, 2073, 2073, 2073, 2073, 2022,
+  2022, 185, 185, 2022, 2022, 2022, 2074, 2022, 2022, 2074,
+  2074, 2074, 185, 2022, 2022, 185, 185, 2022, 2022, 2022,
+  2075, 2022, 2022, 2075, 2075, 2075, 2075, 2022, 2022, 185,
+  185, 2022, 2022, 2022, 2076, 2022, 2022, 2076, 2022, 2022,
+  2022, 2022, 2022, 2022, 2077, 2022, 2022, 2077, 2077, 2077,
+  2077, 2022, 2022, 185, 374, 185, 2022, 2022, 2022, 2078,
+  2022, 2022, 2078, 2022, 2022, 2022, 2022, 2079, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2062, 2062, 2062, 2080, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2063, 2063, 2081, 2022, 2064, 2064, 2064, 2064, 2022, 2082,
+  2022, 2022, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2083,
+  2022, 2022, 2066, 2066, 2066, 2066, 2084, 2022, 2067, 2067,
+  2067, 2067, 2067, 2085, 2022, 2068, 2068, 2086, 2022, 2069,
+  2069, 2069, 2069, 2069, 2069, 2069, 2087, 2022, 2070, 2070,
+  2070, 2088, 2022, 2089, 2089, 2089, 2089, 2089, 2089, 2089,
+  2089, 2089, 2090, 2022, 2091, 2091, 2092, 2022, 2093, 2093,
+
+  2093, 2093, 2093, 2093, 2094, 2022, 2095, 2095, 2095, 2095,
+  2095, 2022, 2096, 2022, 2097, 2097, 2097, 2097, 2097, 2098,
+  2022, 2099, 2099, 2100, 2022, 2101, 2101, 2101, 2101, 2101,
+  2102, 2022, 2022, 2103, 2103, 2104, 2105, 2022, 2105, 2022,
+  2022, 2022, 2106, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2107, 2107, 2108, 2108, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2109,
+  2110, 2110, 2111, 2022, 2022, 2111, 2022, 2112, 2112, 2022,
+  2113, 2022, 2022, 2113, 2113, 2113, 2113, 2114, 2114, 2022,
+
+  2115, 2115, 2115, 2116, 2116, 2022, 2022, 2117, 2117, 2117,
+  2118, 2118, 2119, 2120, 2120, 2121, 2022, 2022, 2121, 2121,
+  2121, 2121, 2122, 2122, 2022, 2022, 2123, 2124, 2124, 2125,
+  2022, 2022, 2022, 2022, 2125, 2125, 2125, 2125, 2125, 2126,
+  2126, 2022, 2022, 2127, 2127, 2128, 2022, 2022, 2128, 2128,
+  2128, 2129, 2129, 2130, 2130, 2130, 2130, 2022, 2131, 2131,
+  2132, 2132, 2132, 2132, 2133, 2133, 2022, 2022, 2134, 2134,
+  2135, 2135, 2135, 2135, 2136, 2136, 2022, 2137, 2138, 2138,
+  2139, 2022, 2022, 2139, 2022, 2022, 2140, 2022, 2022, 2022,
+  2022, 2022, 2022, 2141, 2141, 2022, 2142, 2022, 2142, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2143, 2022, 2144, 2022, 2144, 2145,
+  2022, 2022, 2022, 2145, 2022, 2022, 2146, 2022, 2146, 2147,
+  2022, 2022, 2022, 2022, 2022, 2147, 2022, 2022, 2147, 2022,
+  2148, 2022, 2148, 2022, 2149, 2149, 2149, 2022, 2150, 2022,
+  2150, 2022, 2022, 2022, 2151, 2151, 2151, 2022, 2152, 2022,
+  2152, 2153, 2022, 2154, 2022, 2154, 2155, 2022, 2022, 2022,
+  2155, 2155, 2155, 2155, 2022, 2156, 2022, 2156, 2022, 2022,
+  2022, 2157, 2022, 2158, 2022, 2158, 2159, 2159, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2159, 2159, 2159, 2159,
+  2022, 2160, 2022, 2160, 2022, 2022, 2022, 2022, 2161, 2022,
+  2161, 2162, 2022, 2022, 2022, 2162, 2162, 2162, 2022, 2163,
+  2022, 2163, 2164, 2022, 2022, 2022, 2022, 2164, 2022, 2022,
+  2165, 2022, 2165, 2166, 2022, 2022, 2166, 2022, 2022, 2022,
+  2167, 2022, 2167, 2022, 2022, 2022, 2022, 2168, 2022, 2168,
+  2169, 2169, 2169, 2169, 2022, 2170, 2022, 2170, 2022, 2171,
+  2022, 2172, 2022, 2172, 2173, 2174, 2022, 2022, 2022, 2022,
+  2022, 2175, 2175, 2176, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2177, 2022, 2022, 2178, 2022, 2179, 2180, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2180, 2181, 2022,
+  2182, 2022, 2022, 2182, 2183, 2184, 2184, 2184, 2185, 2186,
+  2187, 2188, 2188, 2188, 2188, 2188, 2189, 2190, 2191, 2192,
+  2192, 2022, 2022, 2022, 2192, 2192, 2192, 2192, 2193, 2194,
+  2195, 2195, 2195, 2195, 2196, 2197, 2022, 2022, 2022, 2022,
+  2022, 2022, 2197, 2022, 2198, 2199, 2022, 2022, 2022, 2199,
+  2022, 2022, 2022, 2200, 2201, 2202, 2022, 2022, 2202, 2202,
+  2203, 2022, 2204, 2205, 2206, 2207, 2207, 2022, 2207, 2022,
+
+  2022, 2022, 2208, 2208, 2209, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2210, 2022, 2022, 2022, 2211, 2022, 2212,
+  2213, 2022, 2022, 2022, 2213, 2214, 2022, 2215, 2022, 2022,
+  2022, 2022, 2022, 2216, 2217, 2217, 2217, 2022, 2022, 2218,
+  2219, 2220, 2220, 2220, 2022, 2022, 2022, 2022, 2220, 2221,
+  2022, 2022, 2222, 2022, 2022, 2223, 2022, 2022, 2223, 2223,
+  2223, 2224, 2225, 2226, 2226, 2226, 2022, 2022, 2226, 2227,
+  2228, 2228, 2022, 2229, 2230, 2230, 2231, 2232, 2233, 2022,
+
+  2022, 2022, 2233, 2233, 2234, 2022, 2022, 2022, 2235, 2236,
+  2237, 2237, 2022, 2022, 2238, 2238, 2238, 2239, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2240, 2241, 2022, 2242, 2243, 2243, 2244, 2245, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2246, 2022, 2022, 2247, 2022, 2022, 2022, 2022, 2248, 2249,
+  2249, 2249, 2022, 2022, 2022, 2022, 2022, 2022, 2249, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2223, 2022, 2022, 2224,
+
+  2225, 2226, 2226, 2226, 2022, 2022, 2022, 2226, 2022, 2022,
+  2022, 2022, 2228, 2022, 2229, 2022, 2022, 2230, 2231, 2232,
+  2233, 2233, 2233, 2234, 2022, 2022, 2022, 2022, 2235, 2236,
+  2237, 2237, 2022, 2022, 2022, 2238, 2238, 2239, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2240, 2241, 2022,
+  2022, 2022, 2243, 2243, 2244, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2246, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2248,
+  2249, 2249, 2249, 2022, 2022, 2249, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2224, 2225, 2226,
+  2022, 2022, 2226, 2226, 2022, 2022, 2226, 2022, 2022, 2022,
+  2228, 2022, 2229, 2022, 2022, 2022, 2230, 2022, 2022, 2232,
+  2233, 2233, 2233, 2234, 2022, 2235, 2236, 2237, 2237, 2022,
+  2022, 2022, 2022, 2238, 2238, 2239, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2240, 2241, 2022, 2243, 2243, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2246, 2022, 2022, 2022, 2248, 2249, 2249, 2249, 2022,
+  2022, 2022, 2022, 2249, 2022, 2022, 2022, 2224, 2022, 2022,
+
+  2226, 2022, 2022, 2022, 2226, 2226, 2022, 2022, 2022, 2022,
+  2226, 2022, 2022, 2022, 2022, 2228, 2022, 2229, 2022, 2022,
+  2022, 2022, 2230, 2232, 2022, 2022, 2233, 2233, 2234, 2022,
+  2235, 2236, 2237, 2237, 2022, 2238, 2238, 2239, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2241, 2022, 2022,
+  2243, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2246, 2022, 2022, 2249, 2249, 2249, 2022, 2022, 2022,
+  2022, 2249, 2022, 2022, 2022, 2022, 2226, 2226, 2226, 2022,
+  2022, 2022, 2022, 2226, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2229, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2230, 2232, 2022, 2022, 2022, 2022, 2022, 2233, 2022, 2022,
+  2022, 2235, 2236, 2237, 2237, 2022, 2022, 2238, 2022, 2022,
+  2022, 2022, 2022, 2022, 2241, 2022, 2022, 2022, 2243, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2246,
+  2249, 2249, 2249, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2226, 2226, 2226, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2229, 2022, 2022, 2022,
+  2022, 2022, 2022, 2230, 2230, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2236, 2237, 2237, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2243, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2246, 2249, 2249, 2249, 2022, 2022, 2022,
+  2226, 2226, 2226, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2229, 2022, 2022, 2022,
+  2022, 2022, 2022, 2230, 2230, 2022, 2022, 2022, 2236, 2237,
+  2237, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2243, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2246, 2022, 2022, 2249, 2249, 2249,
+  2226, 2022, 2022, 2226, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2229, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2230, 2230, 2236, 2237, 2237, 2237, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2246, 2022, 2022, 2022, 2249, 2249, 2249,
+  2249, 2226, 2022, 2022, 2022, 2226, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2230, 2022, 2022, 2230,
+  2236, 2237, 2237, 2237, 2250, 2251, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2246, 2249, 2249, 2249, 2249, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2230, 2022, 2022,
+  2022, 2230, 2236, 2237, 2252, 2253, 2250, 2251, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2249, 2249, 2249, 2249, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2230, 2230, 2236, 2252, 2237, 2254, 2253, 2255,
+  2237, 2022, 2022, 2022, 2022, 2022, 2022, 2249, 2249, 2249,
+  2249, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2230, 2230, 2236, 2254, 2022, 2255, 2237,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2249, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2230, 2230, 2236, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2249, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2230, 2230,
+  2236, 2022, 2249, 2022, 2022, 2022, 2022, 2230, 2230, 2236,
+  2249, 2022, 2022, 2022, 2022, 2230, 2230, 2236, 2249, 2022,
+  2022, 2022, 2022, 2230, 2230, 2236, 2022, 2022, 2022, 2022,
+  2022, 2022, 2230, 2230, 2236, 2022, 2022, 2022, 2022, 2022,
+  2230, 2230, 2236, 2230, 2230, 2236, 2230, 2230, 2236, 2236,
+  2230, 2230, 2236, 2236, 2230, 2230, 2236, 2236, 2230, 2230,
+  2236, 2236, 2022, 2022, 2022, 2022, 2236, 2236, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2236, 2236, 2236, 2236, 2236, 2236,
+  2236, 2236, 2236, 2236, 2236, 2236, 2236, 2236, 2236, 2236,
+  2022, 0, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022
+};
+
+static yyconst flex_int16_t yy_nxt[7164] = { 0,
+  2022, 146, 147, 146, 146, 147, 146, 146, 147, 146,
+  146, 147, 146, 151, 147, 151, 157, 148, 154, 157,
+  148, 154, 450, 149, 2022, 155, 149, 2022, 155, 152,
+  151, 147, 151, 388, 158, 160, 161, 158, 160, 161,
+  162, 163, 2022, 162, 163, 388, 152, 167, 168, 389,
+  164, 160, 161, 164, 165, 391, 162, 160, 161, 561,
+  165, 390, 162, 167, 168, 562, 164, 147, 147, 147,
+  451, 390, 164, 147, 147, 147, 180, 147, 180, 180,
+  147, 180, 472, 170, 180, 147, 180, 510, 169, 170,
+  451, 473, 181, 561, 511, 181, 387, 387, 387, 575,
+
+  182, 387, 387, 387, 169, 171, 172, 147, 172, 171,
+  171, 171, 171, 171, 171, 171, 173, 171, 171, 171,
+  1485, 171, 175, 171, 176, 171, 180, 147, 180, 147,
+  147, 147, 503, 147, 147, 147, 180, 147, 180, 180,
+  147, 180, 182, 504, 561, 183, 391, 171, 171, 183,
+  600, 489, 181, 391, 490, 181, 387, 387, 387, 387,
+  387, 387, 390, 387, 387, 387, 387, 387, 387, 390,
+  177, 2022, 178, 171, 172, 147, 172, 171, 171, 171,
+  171, 171, 171, 171, 173, 171, 171, 171, 477, 171,
+  175, 171, 176, 171, 147, 147, 147, 147, 147, 147,
+
+  682, 180, 147, 180, 180, 147, 180, 180, 147, 180,
+  184, 563, 391, 184, 391, 171, 171, 182, 391, 425,
+  182, 426, 1110, 185, 564, 180, 147, 180, 390, 427,
+  390, 387, 387, 387, 390, 425, 451, 428, 177, 429,
+  178, 185, 186, 187, 147, 187, 186, 186, 186, 186,
+  186, 186, 186, 188, 186, 186, 186, 485, 186, 190,
+  186, 191, 186, 194, 147, 194, 194, 147, 194, 402,
+  218, 147, 218, 160, 161, 160, 161, 486, 162, 195,
+  162, 1270, 195, 446, 186, 186, 219, 447, 205, 1271,
+  205, 448, 192, 186, 187, 147, 187, 186, 186, 186,
+
+  186, 186, 186, 186, 188, 186, 186, 186, 892, 186,
+  190, 186, 191, 186, 206, 2022, 206, 218, 147, 218,
+  893, 147, 147, 147, 147, 147, 147, 387, 387, 387,
+  387, 387, 387, 219, 682, 186, 186, 220, 875, 544,
+  220, 513, 545, 192, 196, 197, 147, 197, 196, 196,
+  196, 196, 196, 196, 196, 198, 196, 196, 196, 512,
+  196, 200, 196, 201, 196, 218, 147, 218, 218, 147,
+  218, 505, 218, 147, 218, 218, 147, 218, 387, 387,
+  387, 219, 391, 439, 219, 512, 196, 196, 221, 433,
+  440, 221, 1412, 1413, 202, 1414, 1415, 203, 390, 390,
+
+  387, 387, 387, 204, 196, 197, 147, 197, 196, 196,
+  196, 196, 196, 196, 196, 198, 196, 196, 196, 451,
+  196, 200, 196, 201, 196, 232, 147, 232, 232, 147,
+  232, 906, 245, 147, 245, 245, 147, 245, 538, 391,
+  391, 233, 1275, 893, 233, 391, 196, 196, 246, 571,
+  1276, 246, 457, 539, 202, 390, 390, 203, 387, 387,
+  387, 390, 572, 204, 207, 208, 147, 208, 207, 207,
+  207, 207, 207, 207, 207, 209, 207, 207, 207, 906,
+  207, 211, 207, 212, 207, 147, 147, 147, 147, 147,
+  147, 930, 147, 147, 147, 147, 147, 147, 257, 147,
+
+  257, 254, 391, 391, 254, 1488, 207, 207, 255, 464,
+  520, 255, 563, 1495, 258, 213, 1498, 214, 390, 390,
+  215, 387, 387, 387, 2022, 576, 216, 207, 208, 147,
+  208, 207, 207, 207, 207, 207, 207, 207, 209, 207,
+  207, 207, 538, 207, 211, 207, 212, 207, 257, 147,
+  257, 271, 147, 271, 512, 271, 147, 271, 147, 147,
+  147, 147, 147, 147, 258, 411, 391, 272, 413, 207,
+  207, 272, 391, 1116, 220, 587, 1508, 220, 213, 1117,
+  214, 1521, 390, 215, 387, 387, 387, 998, 390, 216,
+  222, 223, 147, 223, 222, 222, 222, 222, 222, 222,
+
+  222, 224, 222, 222, 222, 1522, 222, 226, 222, 227,
+  222, 271, 147, 271, 271, 147, 271, 1232, 271, 147,
+  271, 271, 147, 271, 283, 147, 283, 272, 1523, 797,
+  272, 998, 222, 222, 273, 391, 391, 273, 798, 228,
+  284, 387, 387, 387, 229, 387, 387, 387, 387, 387,
+  387, 390, 390, 230, 222, 223, 147, 223, 222, 222,
+  222, 222, 222, 222, 222, 224, 222, 222, 222, 1231,
+  222, 226, 222, 227, 222, 283, 147, 283, 298, 147,
+  298, 1524, 298, 147, 298, 308, 147, 308, 308, 147,
+  308, 284, 1419, 1420, 299, 1390, 222, 222, 299, 391,
+
+  391, 309, 1391, 228, 309, 387, 387, 387, 229, 387,
+  387, 387, 387, 387, 387, 390, 390, 230, 234, 235,
+  147, 235, 234, 234, 234, 234, 234, 234, 234, 236,
+  234, 234, 234, 1525, 234, 238, 234, 239, 234, 321,
+  147, 321, 321, 147, 321, 682, 147, 147, 147, 147,
+  147, 147, 321, 147, 321, 322, 391, 571, 322, 1529,
+  234, 234, 220, 482, 995, 220, 998, 998, 322, 1392,
+  578, 240, 390, 387, 387, 387, 1393, 241, 1530, 242,
+  243, 234, 235, 147, 235, 234, 234, 234, 234, 234,
+  234, 234, 236, 234, 234, 234, 1514, 234, 238, 234,
+
+  239, 234, 321, 147, 321, 321, 147, 321, 1339, 321,
+  147, 321, 147, 147, 147, 147, 147, 147, 322, 1421,
+  1422, 323, 391, 234, 234, 323, 682, 682, 333, 493,
+  1531, 333, 1407, 1337, 240, 387, 387, 387, 390, 1408,
+  241, 684, 242, 243, 247, 248, 147, 248, 247, 247,
+  247, 247, 247, 247, 247, 249, 247, 247, 247, 998,
+  247, 251, 247, 252, 247, 147, 147, 147, 147, 147,
+  147, 1532, 335, 147, 335, 335, 147, 335, 335, 147,
+  335, 333, 1533, 1409, 333, 391, 247, 247, 336, 391,
+  1410, 336, 497, 1515, 337, 387, 387, 387, 387, 387,
+
+  387, 390, 387, 387, 387, 390, 253, 247, 248, 147,
+  248, 247, 247, 247, 247, 247, 247, 247, 249, 247,
+  247, 247, 1534, 247, 251, 247, 252, 247, 335, 147,
+  335, 349, 147, 349, 1535, 349, 147, 349, 147, 147,
+  147, 147, 147, 147, 337, 1536, 998, 350, 1537, 247,
+  247, 350, 391, 1486, 333, 1487, 1538, 333, 387, 387,
+  387, 387, 387, 387, 387, 387, 387, 1539, 390, 253,
+  259, 260, 147, 260, 259, 259, 259, 259, 259, 259,
+  259, 261, 259, 259, 259, 1433, 259, 263, 259, 264,
+  259, 349, 147, 349, 349, 147, 349, 1541, 349, 147,
+
+  349, 349, 147, 349, 360, 147, 360, 350, 391, 391,
+  350, 391, 259, 259, 351, 265, 524, 351, 1542, 1489,
+  361, 1490, 1543, 266, 390, 390, 267, 390, 998, 268,
+  1544, 1545, 269, 259, 260, 147, 260, 259, 259, 259,
+  259, 259, 259, 259, 261, 259, 259, 259, 1551, 259,
+  263, 259, 264, 259, 360, 147, 360, 373, 147, 373,
+  1552, 373, 147, 373, 147, 147, 147, 147, 147, 147,
+  361, 1434, 391, 374, 1553, 259, 259, 374, 265, 536,
+  375, 1150, 1496, 375, 1497, 1554, 266, 1151, 390, 267,
+  1152, 1499, 268, 1500, 1153, 269, 274, 275, 147, 275,
+
+  274, 274, 274, 274, 274, 274, 274, 276, 274, 274,
+  274, 531, 274, 278, 274, 279, 274, 373, 147, 373,
+  373, 147, 373, 1555, 373, 147, 373, 373, 147, 373,
+  385, 147, 385, 374, 1558, 1154, 374, 1559, 274, 274,
+  376, 1155, 1560, 376, 1156, 532, 386, 396, 1157, 280,
+  387, 387, 387, 387, 387, 387, 387, 387, 387, 451,
+  1561, 281, 274, 275, 147, 275, 274, 274, 274, 274,
+  274, 274, 274, 276, 274, 274, 274, 1562, 274, 278,
+  274, 279, 274, 385, 147, 385, 397, 387, 387, 387,
+  1563, 1568, 398, 387, 387, 387, 399, 1569, 1570, 386,
+
+  1571, 400, 1572, 1573, 274, 274, 387, 387, 387, 387,
+  387, 387, 387, 387, 387, 280, 387, 387, 387, 542,
+  542, 542, 1593, 686, 896, 896, 896, 281, 285, 286,
+  147, 286, 285, 285, 285, 285, 285, 285, 285, 287,
+  285, 285, 285, 288, 285, 289, 285, 290, 285, 288,
+  288, 288, 288, 288, 288, 288, 288, 288, 288, 288,
+  288, 288, 288, 288, 288, 288, 288, 288, 288, 288,
+  285, 285, 288, 288, 291, 288, 288, 288, 288, 288,
+  288, 292, 288, 293, 288, 288, 288, 294, 288, 295,
+  296, 288, 288, 288, 288, 288, 288, 300, 301, 147,
+
+  301, 300, 300, 300, 300, 300, 300, 300, 302, 300,
+  300, 300, 682, 300, 304, 300, 305, 300, 542, 542,
+  542, 584, 584, 584, 592, 592, 592, 606, 606, 606,
+  617, 617, 617, 904, 904, 904, 1594, 1595, 585, 300,
+  300, 593, 1596, 1603, 607, 1604, 1605, 618, 1585, 998,
+  306, 300, 301, 147, 301, 300, 300, 300, 300, 300,
+  300, 300, 302, 300, 300, 300, 998, 300, 304, 300,
+  305, 300, 1606, 543, 625, 625, 625, 1338, 631, 631,
+  631, 633, 633, 633, 642, 642, 642, 1009, 1009, 1009,
+  1599, 626, 1607, 300, 300, 632, 1608, 1609, 634, 1610,
+
+  1586, 643, 1600, 998, 306, 310, 311, 147, 311, 310,
+  310, 310, 310, 310, 310, 310, 312, 310, 310, 310,
+  1611, 310, 314, 310, 315, 310, 647, 647, 647, 667,
+  667, 667, 696, 696, 696, 696, 696, 696, 726, 726,
+  726, 682, 1587, 648, 1612, 1613, 668, 310, 310, 1615,
+  698, 316, 1616, 698, 1617, 1621, 728, 1230, 317, 1622,
+  318, 1015, 1015, 1015, 896, 896, 896, 319, 310, 311,
+  147, 311, 310, 310, 310, 310, 310, 310, 310, 312,
+  310, 310, 310, 1623, 310, 314, 310, 315, 310, 699,
+  726, 726, 726, 1627, 1601, 584, 584, 584, 731, 731,
+
+  731, 1628, 732, 1629, 1630, 733, 1602, 1631, 728, 1632,
+  310, 310, 585, 1638, 316, 741, 741, 741, 1639, 742,
+  1640, 317, 743, 318, 1021, 1021, 1021, 904, 904, 904,
+  319, 324, 325, 147, 325, 324, 324, 324, 324, 324,
+  324, 324, 326, 324, 324, 324, 729, 324, 328, 324,
+  329, 324, 736, 736, 736, 1641, 1642, 736, 736, 736,
+  592, 592, 592, 744, 744, 744, 747, 747, 747, 1643,
+  738, 998, 1656, 324, 324, 738, 330, 593, 998, 331,
+  745, 1633, 1635, 748, 762, 762, 762, 1658, 763, 1634,
+  1636, 764, 682, 332, 324, 325, 147, 325, 324, 324,
+
+  324, 324, 324, 324, 324, 326, 324, 324, 324, 1650,
+  324, 328, 324, 329, 324, 1662, 1651, 739, 1649, 1663,
+  750, 750, 750, 758, 758, 758, 1664, 1665, 750, 750,
+  750, 758, 758, 758, 1666, 1667, 324, 324, 752, 330,
+  1668, 760, 331, 778, 778, 778, 752, 779, 1669, 760,
+  780, 1047, 1047, 1047, 1670, 1671, 332, 338, 339, 147,
+  339, 338, 338, 338, 338, 338, 338, 338, 340, 338,
+  338, 338, 753, 338, 342, 338, 343, 338, 606, 606,
+  606, 1672, 1673, 768, 768, 768, 773, 773, 773, 1674,
+  1679, 761, 617, 617, 617, 607, 768, 768, 768, 338,
+
+  338, 770, 344, 1680, 775, 345, 1009, 1009, 1009, 618,
+  346, 789, 789, 789, 770, 790, 1681, 1684, 791, 347,
+  338, 339, 147, 339, 338, 338, 338, 338, 338, 338,
+  338, 340, 338, 338, 338, 1685, 338, 342, 338, 343,
+  338, 773, 773, 773, 771, 1686, 785, 785, 785, 785,
+  785, 785, 625, 625, 625, 1687, 793, 793, 793, 775,
+  1688, 1689, 338, 338, 787, 344, 1690, 787, 345, 626,
+  1011, 1011, 1011, 346, 795, 1015, 1015, 1015, 1021, 1021,
+  1021, 1691, 347, 352, 353, 147, 353, 352, 352, 352,
+  352, 352, 352, 352, 354, 352, 352, 352, 776, 352,
+
+  356, 352, 357, 352, 1692, 1693, 788, 1694, 1696, 793,
+  793, 793, 631, 631, 631, 799, 799, 799, 1697, 800,
+  1698, 1699, 801, 1700, 1701, 352, 352, 795, 1708, 632,
+  1022, 1022, 1022, 1047, 1047, 1047, 358, 352, 353, 147,
+  353, 352, 352, 352, 352, 352, 352, 352, 354, 352,
+  352, 352, 998, 352, 356, 352, 357, 352, 633, 633,
+  633, 802, 802, 802, 1709, 803, 1710, 1711, 804, 796,
+  805, 805, 805, 1712, 1713, 634, 1246, 1246, 1246, 352,
+  352, 815, 815, 815, 1705, 816, 1716, 806, 817, 1717,
+  358, 362, 363, 147, 363, 362, 362, 362, 362, 362,
+
+  362, 362, 364, 362, 362, 362, 1718, 362, 366, 362,
+  367, 362, 811, 811, 811, 642, 642, 642, 818, 818,
+  818, 811, 811, 811, 818, 818, 818, 647, 647, 647,
+  813, 1719, 643, 362, 362, 682, 820, 1720, 1721, 813,
+  1722, 368, 820, 369, 648, 370, 1127, 1127, 1127, 1248,
+  1248, 1248, 1723, 371, 362, 363, 147, 363, 362, 362,
+  362, 362, 362, 362, 362, 364, 362, 362, 362, 1728,
+  362, 366, 362, 367, 362, 814, 823, 823, 823, 1704,
+  824, 821, 1731, 825, 829, 829, 829, 829, 829, 829,
+  834, 834, 834, 836, 836, 836, 362, 362, 845, 845,
+
+  845, 1732, 831, 1736, 368, 831, 369, 835, 370, 1737,
+  837, 1130, 1130, 1130, 1738, 846, 371, 377, 378, 147,
+  378, 377, 377, 377, 377, 377, 377, 377, 379, 377,
+  377, 377, 1739, 377, 381, 377, 382, 377, 1740, 832,
+  840, 840, 840, 1741, 848, 848, 848, 840, 840, 840,
+  850, 850, 850, 850, 850, 850, 1729, 1730, 842, 377,
+  377, 849, 667, 667, 667, 842, 1742, 1743, 852, 1744,
+  1745, 852, 1746, 854, 854, 854, 1749, 855, 1750, 668,
+  856, 1751, 383, 377, 378, 147, 378, 377, 377, 377,
+  377, 377, 377, 377, 379, 377, 377, 377, 1752, 377,
+
+  381, 377, 382, 377, 843, 857, 857, 857, 1753, 1754,
+  853, 857, 857, 857, 865, 865, 865, 865, 865, 865,
+  871, 871, 871, 859, 1769, 377, 377, 682, 1770, 859,
+  1771, 1772, 867, 1776, 1777, 867, 1778, 1779, 873, 871,
+  871, 871, 696, 696, 696, 911, 911, 911, 383, 391,
+  696, 696, 696, 1011, 1011, 1011, 407, 873, 1761, 1780,
+  698, 1781, 912, 860, 1783, 390, 1784, 1012, 698, 696,
+  696, 696, 1785, 726, 726, 726, 1786, 868, 726, 726,
+  726, 1791, 1792, 726, 726, 726, 1793, 698, 1794, 1795,
+  408, 728, 409, 1796, 1797, 410, 728, 411, 412, 874,
+
+  413, 728, 1798, 1799, 414, 1800, 415, 416, 417, 391,
+  914, 914, 914, 884, 1801, 1802, 407, 731, 731, 731,
+  1803, 732, 1804, 682, 733, 390, 1819, 915, 1820, 913,
+  2022, 2022, 2022, 736, 736, 736, 736, 736, 736, 1821,
+  1822, 736, 736, 736, 744, 744, 744, 2022, 1823, 1824,
+  408, 738, 418, 1825, 738, 419, 1826, 420, 412, 738,
+  421, 745, 1813, 1827, 414, 1828, 422, 423, 424, 741,
+  741, 741, 1831, 742, 1832, 1833, 743, 920, 920, 920,
+  1834, 921, 1841, 1842, 922, 918, 1843, 916, 923, 923,
+  923, 747, 747, 747, 925, 925, 925, 1844, 926, 1845,
+
+  1846, 927, 750, 750, 750, 924, 1847, 1848, 748, 750,
+  750, 750, 750, 750, 750, 932, 932, 932, 1849, 1850,
+  752, 758, 758, 758, 758, 758, 758, 752, 1851, 1852,
+  752, 1862, 933, 758, 758, 758, 762, 762, 762, 760,
+  763, 1863, 760, 764, 768, 768, 768, 768, 768, 768,
+  1864, 760, 768, 768, 768, 773, 773, 773, 773, 773,
+  773, 1857, 770, 1857, 682, 770, 1865, 1866, 929, 1867,
+  770, 1868, 1869, 775, 1860, 1858, 775, 935, 773, 773,
+  773, 778, 778, 778, 1870, 779, 1871, 1876, 780, 785,
+  785, 785, 785, 785, 785, 1877, 775, 785, 785, 785,
+
+  1878, 789, 789, 789, 1879, 790, 1855, 787, 791, 1880,
+  787, 793, 793, 793, 939, 787, 793, 793, 793, 793,
+  793, 793, 1881, 799, 799, 799, 1882, 800, 1883, 795,
+  801, 805, 805, 805, 795, 1888, 1872, 795, 941, 802,
+  802, 802, 682, 803, 1874, 1888, 804, 1873, 806, 952,
+  952, 952, 1891, 953, 1892, 1875, 954, 1857, 947, 811,
+  811, 811, 811, 811, 811, 811, 811, 811, 815, 815,
+  815, 1858, 816, 998, 999, 817, 949, 813, 1902, 1886,
+  813, 1903, 1904, 813, 818, 818, 818, 818, 818, 818,
+  818, 818, 818, 823, 823, 823, 1857, 824, 1905, 1888,
+
+  825, 1909, 820, 1888, 1910, 820, 1911, 1860, 820, 829,
+  829, 829, 829, 829, 829, 829, 829, 829, 834, 834,
+  834, 1921, 967, 967, 967, 1925, 968, 831, 959, 969,
+  831, 1926, 1927, 831, 1928, 835, 1932, 836, 836, 836,
+  970, 970, 970, 1933, 971, 1934, 1935, 972, 840, 840,
+  840, 1936, 1937, 960, 837, 840, 840, 840, 840, 840,
+  840, 845, 845, 845, 1941, 682, 842, 1942, 977, 977,
+  977, 965, 978, 842, 1943, 979, 842, 1944, 846, 848,
+  848, 848, 981, 981, 981, 1945, 982, 1940, 682, 983,
+  850, 850, 850, 850, 850, 850, 849, 850, 850, 850,
+
+  854, 854, 854, 1949, 855, 1950, 1948, 856, 852, 1951,
+  1952, 852, 857, 857, 857, 852, 857, 857, 857, 1953,
+  682, 975, 857, 857, 857, 987, 987, 987, 1959, 1960,
+  859, 865, 865, 865, 859, 865, 865, 865, 1961, 1956,
+  859, 1962, 988, 865, 865, 865, 871, 871, 871, 867,
+  871, 871, 871, 867, 871, 871, 871, 997, 997, 997,
+  984, 867, 1969, 1970, 873, 696, 696, 696, 873, 911,
+  911, 911, 873, 1484, 682, 998, 999, 682, 985, 1022,
+  1022, 1022, 682, 698, 682, 682, 912, 1031, 1031, 1031,
+  1965, 1032, 682, 1012, 1033, 726, 726, 726, 1973, 682,
+
+  991, 914, 914, 914, 994, 1035, 1035, 1035, 682, 1036,
+  682, 1987, 1037, 728, 736, 736, 736, 1983, 915, 920,
+  920, 920, 682, 921, 1997, 1984, 922, 1005, 923, 923,
+  923, 1483, 738, 1042, 1042, 1042, 1991, 1043, 682, 1482,
+  1044, 750, 750, 750, 1988, 924, 925, 925, 925, 1034,
+  926, 1481, 2015, 927, 932, 932, 932, 682, 682, 752,
+  1040, 1049, 1049, 1049, 2005, 1050, 682, 682, 1051, 682,
+  1998, 933, 1052, 1052, 1052, 758, 758, 758, 1058, 1058,
+  1058, 773, 773, 773, 1065, 1065, 1065, 1480, 1046, 1053,
+  1067, 1067, 1067, 760, 1992, 2009, 1059, 682, 2010, 775,
+
+  2006, 1066, 785, 785, 785, 2019, 682, 1068, 1071, 1071,
+  1071, 2016, 793, 793, 793, 1074, 1074, 1074, 682, 682,
+  787, 1054, 2022, 2022, 2022, 1072, 1077, 1077, 1077, 1061,
+  795, 2007, 1075, 1069, 952, 952, 952, 682, 953, 2022,
+  2008, 954, 1479, 1078, 2022, 2022, 2022, 2013, 2022, 2022,
+  2022, 2022, 2022, 2022, 811, 811, 811, 818, 818, 818,
+  2011, 2022, 2012, 1478, 1070, 2022, 2014, 1472, 2022, 682,
+  1073, 682, 813, 1471, 682, 820, 1470, 1087, 1087, 1087,
+  829, 829, 829, 1469, 1076, 682, 967, 967, 967, 2019,
+  968, 1468, 1080, 969, 1088, 970, 970, 970, 831, 971,
+
+  682, 1467, 972, 2017, 1022, 1022, 1022, 840, 840, 840,
+  1079, 987, 987, 987, 2018, 1082, 1466, 1081, 1093, 1083,
+  1089, 1465, 977, 977, 977, 842, 978, 1461, 988, 979,
+  981, 981, 981, 1090, 982, 1460, 1459, 983, 850, 850,
+  850, 857, 857, 857, 1100, 1100, 1100, 1458, 1101, 1457,
+  1456, 1102, 865, 865, 865, 1455, 852, 1454, 1453, 859,
+  1107, 1107, 1107, 871, 871, 871, 997, 997, 997, 1094,
+  867, 696, 696, 696, 1127, 1127, 1127, 1108, 1130, 1130,
+  1130, 873, 1452, 1451, 998, 1127, 1127, 1127, 1128, 698,
+  1448, 1445, 1131, 1444, 1098, 1136, 1136, 1136, 1105, 1128,
+
+  1097, 1138, 1138, 1138, 1138, 1138, 1138, 1443, 1442, 1131,
+  1136, 1136, 1136, 1430, 1111, 1139, 1428, 1427, 1139, 1417,
+  1118, 1031, 1031, 1031, 1141, 1032, 1109, 1411, 1033, 1406,
+  1112, 726, 726, 726, 1129, 1035, 1035, 1035, 1405, 1036,
+  1401, 1394, 1037, 1389, 1388, 1135, 1052, 1052, 1052, 728,
+  736, 736, 736, 1042, 1042, 1042, 1387, 1043, 1381, 1380,
+  1044, 1129, 1379, 1053, 1135, 750, 750, 750, 738, 1049,
+  1049, 1049, 1378, 1050, 1377, 1376, 1051, 1158, 1158, 1158,
+  1375, 1159, 1374, 752, 1160, 758, 758, 758, 1162, 1162,
+  1162, 2022, 2022, 2022, 1142, 1165, 1165, 1165, 1145, 1058,
+
+  1058, 1058, 1373, 760, 1372, 1163, 1366, 1365, 2022, 1167,
+  1167, 1167, 1166, 773, 773, 773, 1364, 1059, 1065, 1065,
+  1065, 1363, 1148, 1173, 1173, 1173, 1168, 1174, 1361, 1359,
+  1175, 775, 1355, 1161, 1354, 1066, 1067, 1067, 1067, 1176,
+  1176, 1176, 1352, 1177, 1351, 1164, 1178, 1180, 1180, 1180,
+  1071, 1071, 1071, 1068, 1182, 1182, 1182, 1169, 1183, 1347,
+  1340, 1184, 1185, 1185, 1185, 1181, 1335, 1072, 1074, 1074,
+  1074, 1187, 1187, 1187, 1333, 1188, 1332, 1331, 1189, 1322,
+  1186, 1190, 1190, 1190, 1317, 1075, 1077, 1077, 1077, 1192,
+  1192, 1192, 1316, 1193, 1315, 1314, 1194, 1310, 1191, 1195,
+
+  1195, 1195, 1296, 1078, 2022, 2022, 2022, 1198, 1198, 1198,
+  811, 811, 811, 818, 818, 818, 1196, 1087, 1087, 1087,
+  1295, 2022, 1294, 1293, 1199, 1205, 1205, 1205, 813, 1206,
+  1292, 820, 1207, 1291, 1088, 1209, 1209, 1209, 1211, 1211,
+  1211, 1277, 2022, 2022, 2022, 840, 840, 840, 1216, 1216,
+  1216, 1274, 1273, 1210, 1272, 1212, 1269, 1268, 1197, 2022,
+  1264, 1201, 1263, 842, 1260, 1217, 2022, 2022, 2022, 850,
+  850, 850, 1200, 1259, 857, 857, 857, 1100, 1100, 1100,
+  1257, 1101, 1256, 2022, 1102, 1255, 1254, 852, 1220, 865,
+  865, 865, 859, 1215, 1107, 1107, 1107, 1226, 1226, 1226,
+
+  1251, 1227, 1213, 1250, 1228, 1249, 1247, 867, 1245, 1218,
+  1244, 1108, 871, 871, 871, 1243, 1242, 1219, 1234, 1234,
+  1234, 2022, 2022, 2022, 2022, 2022, 2022, 696, 696, 696,
+  873, 1252, 1252, 1252, 1241, 1235, 1240, 1224, 2022, 1239,
+  1233, 2022, 1253, 1253, 1253, 698, 1136, 1136, 1136, 1138,
+  1138, 1138, 726, 726, 726, 1225, 1261, 1261, 1261, 750,
+  750, 750, 1266, 1266, 1266, 1223, 1222, 1229, 1221, 1214,
+  728, 1208, 1204, 1236, 1262, 1203, 1202, 752, 1179, 1267,
+  1172, 1237, 1171, 1170, 1238, 1158, 1158, 1158, 1149, 1159,
+  1147, 1146, 1160, 758, 758, 758, 1162, 1162, 1162, 1258,
+
+  1144, 1279, 1279, 1279, 1143, 1280, 1140, 1278, 1281, 1137,
+  1134, 760, 1133, 1163, 1265, 1282, 1282, 1282, 1165, 1165,
+  1165, 1284, 1284, 1284, 1132, 1285, 1126, 1125, 1286, 1167,
+  1167, 1167, 1283, 1124, 1123, 1166, 1287, 1287, 1287, 1122,
+  1288, 1121, 1120, 1289, 1119, 1115, 1168, 773, 773, 773,
+  1173, 1173, 1173, 1114, 1174, 1113, 998, 1175, 1106, 1176,
+  1176, 1176, 1104, 1177, 1103, 775, 1178, 1180, 1180, 1180,
+  1182, 1182, 1182, 1099, 1183, 1096, 1095, 1184, 1185, 1185,
+  1185, 1092, 1187, 1187, 1187, 1181, 1188, 1091, 1086, 1189,
+  1190, 1190, 1190, 1290, 1085, 1084, 1186, 1297, 1297, 1297,
+
+  1064, 1298, 1063, 1062, 1299, 1060, 1057, 1191, 1192, 1192,
+  1192, 1056, 1193, 1055, 1048, 1194, 1195, 1195, 1195, 1300,
+  1300, 1300, 1045, 1301, 1041, 1039, 1302, 1303, 1303, 1303,
+  1198, 1198, 1198, 1196, 1305, 1305, 1305, 1038, 1306, 1030,
+  1029, 1307, 1028, 1027, 1304, 1026, 1025, 1199, 811, 811,
+  811, 818, 818, 818, 1311, 1311, 1311, 1205, 1205, 1205,
+  1024, 1206, 1023, 1020, 1207, 1019, 813, 1018, 1017, 820,
+  1016, 1312, 1209, 1209, 1209, 1211, 1211, 1211, 1318, 1318,
+  1318, 1014, 1319, 1013, 1010, 1320, 2022, 2022, 2022, 1008,
+  1210, 1007, 1212, 1216, 1216, 1216, 1308, 1313, 840, 840,
+
+  840, 1006, 1004, 2022, 2022, 2022, 2022, 1328, 1328, 1328,
+  1217, 1309, 1323, 1324, 1324, 1324, 842, 1325, 1003, 1002,
+  1326, 2022, 857, 857, 857, 1329, 865, 865, 865, 1226,
+  1226, 1226, 1001, 1227, 1000, 993, 1228, 992, 1321, 990,
+  859, 871, 871, 871, 867, 1234, 1234, 1234, 1341, 1341,
+  1341, 989, 1342, 986, 980, 1343, 2022, 2022, 2022, 873,
+  976, 1327, 1235, 2022, 2022, 2022, 974, 973, 1330, 966,
+  696, 696, 696, 2022, 1348, 1348, 1348, 1349, 1349, 1349,
+  2022, 1350, 1350, 1350, 1353, 1353, 1353, 1334, 698, 1336,
+  1246, 1246, 1246, 1248, 1248, 1248, 1356, 1356, 1356, 1357,
+
+  1357, 1357, 1252, 1252, 1252, 1253, 1253, 1253, 1358, 1358,
+  1358, 964, 1344, 1360, 1360, 1360, 726, 726, 726, 1261,
+  1261, 1261, 1367, 1367, 1367, 963, 1345, 1266, 1266, 1266,
+  1346, 1369, 1369, 1369, 728, 1370, 962, 1262, 1371, 961,
+  1368, 758, 758, 758, 1267, 1279, 1279, 1279, 958, 1280,
+  957, 956, 1281, 1282, 1282, 1282, 1383, 1383, 1383, 760,
+  1384, 955, 951, 1385, 1362, 1284, 1284, 1284, 950, 1285,
+  1283, 948, 1286, 1287, 1287, 1287, 946, 1288, 945, 944,
+  1289, 773, 773, 773, 1297, 1297, 1297, 1382, 1298, 943,
+  942, 1299, 940, 1300, 1300, 1300, 938, 1301, 937, 775,
+
+  1302, 1303, 1303, 1303, 1395, 1395, 1395, 936, 1396, 934,
+  931, 1397, 1305, 1305, 1305, 928, 1306, 919, 1304, 1307,
+  811, 811, 811, 1399, 1399, 1399, 1311, 1311, 1311, 1402,
+  1402, 1402, 1386, 1403, 917, 910, 1404, 909, 813, 908,
+  907, 1400, 905, 1312, 1318, 1318, 1318, 903, 1319, 902,
+  901, 1320, 2022, 2022, 2022, 840, 840, 840, 1324, 1324,
+  1324, 900, 1325, 899, 898, 1326, 2022, 2022, 2022, 2022,
+  1328, 1328, 1328, 842, 857, 857, 857, 1425, 1425, 1425,
+  1398, 897, 895, 2022, 865, 865, 865, 894, 1329, 1432,
+  1432, 1432, 859, 891, 1426, 871, 871, 871, 1416, 1435,
+
+  1435, 1435, 867, 890, 1341, 1341, 1341, 682, 1342, 889,
+  1418, 1343, 888, 873, 2022, 2022, 2022, 2022, 2022, 2022,
+  887, 886, 1423, 696, 696, 696, 1439, 1439, 1439, 885,
+  883, 2022, 882, 881, 2022, 880, 1424, 1348, 1348, 1348,
+  879, 698, 1349, 1349, 1349, 1429, 1350, 1350, 1350, 878,
+  877, 1431, 1440, 1440, 1440, 1441, 1441, 1441, 1353, 1353,
+  1353, 1356, 1356, 1356, 1357, 1357, 1357, 1436, 1358, 1358,
+  1358, 1360, 1360, 1360, 1446, 1446, 1446, 876, 1438, 1437,
+  1449, 1449, 1449, 1367, 1367, 1367, 1369, 1369, 1369, 682,
+  1370, 870, 1447, 1371, 758, 758, 758, 1450, 1383, 1383,
+
+  1383, 1368, 1384, 869, 864, 1385, 1463, 1463, 1463, 1395,
+  1395, 1395, 760, 1396, 863, 862, 1397, 1473, 1473, 1473,
+  1399, 1399, 1399, 861, 1464, 1475, 1475, 1475, 847, 1402,
+  1402, 1402, 844, 1403, 839, 1474, 1404, 838, 1400, 1491,
+  1491, 1491, 1476, 1493, 1493, 1493, 840, 840, 840, 833,
+  828, 1462, 2022, 2022, 2022, 827, 1492, 857, 857, 857,
+  1425, 1425, 1425, 826, 842, 1506, 1506, 1506, 1477, 2022,
+  822, 810, 1503, 1503, 1503, 859, 1504, 1426, 809, 1505,
+  808, 807, 1507, 1509, 1509, 1509, 1511, 1511, 1511, 871,
+  871, 871, 1432, 1432, 1432, 1501, 1435, 1435, 1435, 792,
+
+  784, 1510, 1516, 1516, 1516, 783, 782, 873, 781, 1494,
+  682, 777, 772, 1502, 2022, 2022, 2022, 767, 766, 1517,
+  1519, 1519, 1519, 1439, 1439, 1439, 1440, 1440, 1440, 765,
+  757, 2022, 1441, 1441, 1441, 1446, 1446, 1446, 1520, 1449,
+  1449, 1449, 1526, 1526, 1526, 756, 1527, 755, 754, 1528,
+  1513, 1512, 749, 1447, 746, 740, 1450, 758, 758, 758,
+  735, 734, 1518, 1463, 1463, 1463, 1546, 1546, 1546, 1473,
+  1473, 1473, 1475, 1475, 1475, 760, 730, 725, 1548, 1548,
+  1548, 1464, 1549, 1547, 724, 1550, 723, 1474, 722, 1476,
+  1556, 1556, 1556, 1491, 1491, 1491, 1564, 1564, 1564, 721,
+
+  1565, 720, 719, 1566, 1493, 1493, 1493, 1557, 718, 717,
+  1492, 716, 715, 1540, 840, 840, 840, 2022, 2022, 2022,
+  1576, 1576, 1576, 1503, 1503, 1503, 714, 1504, 713, 712,
+  1505, 711, 842, 710, 2022, 1506, 1506, 1506, 1577, 1578,
+  1578, 1578, 709, 1579, 708, 707, 1580, 706, 1581, 1581,
+  1581, 705, 1507, 1509, 1509, 1509, 1511, 1511, 1511, 1583,
+  1583, 1583, 704, 703, 1574, 1582, 702, 701, 1567, 700,
+  695, 1510, 1516, 1516, 1516, 694, 693, 1584, 1575, 1588,
+  1588, 1588, 692, 1589, 691, 690, 1590, 689, 688, 1517,
+  1591, 1591, 1591, 1519, 1519, 1519, 1597, 1597, 1597, 1526,
+
+  1526, 1526, 685, 1527, 683, 682, 1528, 1592, 758, 758,
+  758, 1520, 680, 1598, 1546, 1546, 1546, 1618, 1618, 1618,
+  678, 1619, 677, 676, 1620, 674, 760, 673, 1548, 1548,
+  1548, 1547, 1549, 672, 671, 1550, 1556, 1556, 1556, 1624,
+  1624, 1624, 670, 1625, 666, 664, 1626, 1564, 1564, 1564,
+  663, 1565, 662, 1557, 1566, 840, 840, 840, 2022, 2022,
+  2022, 2022, 2022, 2022, 1614, 1576, 1576, 1576, 661, 660,
+  1578, 1578, 1578, 842, 1579, 2022, 658, 1580, 2022, 1581,
+  1581, 1581, 657, 1577, 1646, 1646, 1646, 656, 1647, 655,
+  654, 1648, 1583, 1583, 1583, 653, 1582, 1588, 1588, 1588,
+
+  651, 1589, 650, 649, 1590, 1591, 1591, 1591, 646, 645,
+  1584, 1652, 1652, 1652, 641, 1653, 639, 1637, 1654, 1644,
+  638, 1645, 1592, 1655, 1655, 1655, 1657, 1657, 1657, 1597,
+  1597, 1597, 1659, 1659, 1659, 637, 1660, 636, 635, 1661,
+  758, 758, 758, 1676, 1676, 1676, 1598, 1618, 1618, 1618,
+  630, 1619, 629, 627, 1620, 1682, 1682, 1682, 760, 624,
+  1677, 1624, 1624, 1624, 622, 1625, 621, 620, 1626, 840,
+  840, 840, 1683, 2022, 2022, 2022, 2022, 2022, 2022, 1655,
+  1655, 1655, 1706, 1706, 1706, 619, 1678, 842, 1675, 616,
+  2022, 615, 613, 2022, 1646, 1646, 1646, 612, 1647, 1707,
+
+  998, 1648, 1652, 1652, 1652, 610, 1653, 609, 608, 1654,
+  1657, 1657, 1657, 1659, 1659, 1659, 605, 1660, 603, 602,
+  1661, 1695, 1703, 1714, 1714, 1714, 758, 758, 758, 1676,
+  1676, 1676, 1725, 1725, 1725, 1702, 1726, 601, 599, 1727,
+  1715, 1682, 1682, 1682, 760, 597, 1677, 1733, 1733, 1733,
+  596, 1734, 595, 594, 1735, 1747, 1747, 1747, 1683, 1755,
+  1755, 1755, 1758, 1758, 1758, 1762, 1762, 1762, 1706, 1706,
+  1706, 591, 1724, 1748, 590, 589, 1756, 586, 583, 1759,
+  582, 580, 1763, 998, 579, 1707, 998, 577, 1764, 1764,
+  1764, 574, 1765, 573, 570, 1766, 1767, 1767, 1767, 1768,
+
+  1768, 1768, 1757, 569, 568, 1760, 998, 1714, 1714, 1714,
+  1773, 1773, 1773, 567, 1774, 566, 565, 1775, 758, 758,
+  758, 1725, 1725, 1725, 1715, 1726, 560, 559, 1727, 1787,
+  1787, 1787, 558, 1733, 1733, 1733, 760, 1734, 557, 556,
+  1735, 1789, 1789, 1789, 555, 554, 1788, 1747, 1747, 1747,
+  1755, 1755, 1755, 1805, 1805, 1805, 552, 1806, 1790, 551,
+  1807, 2022, 2022, 2022, 550, 1748, 549, 1756, 1758, 1758,
+  1758, 548, 1809, 1809, 1809, 547, 1810, 546, 2022, 1811,
+  1782, 2022, 2022, 2022, 541, 1759, 1762, 1762, 1762, 1814,
+  1814, 1814, 538, 1815, 540, 535, 1816, 533, 2022, 1767,
+
+  1767, 1767, 531, 1763, 998, 2022, 530, 998, 529, 1764,
+  1764, 1764, 528, 1765, 527, 525, 1766, 1768, 1768, 1768,
+  523, 1773, 1773, 1773, 521, 1774, 1808, 998, 1775, 1835,
+  1835, 1835, 520, 1836, 519, 518, 1837, 517, 1829, 1829,
+  1829, 516, 1787, 1787, 1787, 514, 1812, 996, 996, 996,
+  996, 996, 996, 996, 996, 996, 1830, 513, 996, 1788,
+  1789, 1789, 1789, 996, 996, 996, 998, 996, 1838, 1838,
+  1838, 509, 1839, 508, 506, 1840, 505, 1790, 1805, 1805,
+  1805, 502, 1806, 501, 500, 1807, 2022, 2022, 2022, 996,
+  996, 996, 996, 996, 996, 996, 996, 996, 996, 996,
+
+  498, 496, 996, 2022, 2022, 2022, 2022, 996, 996, 996,
+  998, 996, 1809, 1809, 1809, 494, 1810, 492, 491, 1811,
+  488, 2022, 1814, 1814, 1814, 487, 1815, 483, 481, 1816,
+  1829, 1829, 1829, 996, 996, 1835, 1835, 1835, 1853, 1836,
+  998, 480, 1837, 1838, 1838, 1838, 478, 1839, 1830, 477,
+  1840, 476, 2022, 2022, 2022, 475, 1854, 996, 996, 996,
+  996, 996, 1861, 996, 996, 996, 474, 471, 996, 2022,
+  2022, 2022, 2022, 996, 996, 996, 998, 996, 1890, 1890,
+  1890, 1893, 1893, 1893, 1912, 1912, 1912, 2022, 1913, 469,
+  468, 1914, 420, 1895, 1895, 1895, 998, 999, 1894, 996,
+
+  996, 996, 996, 996, 996, 996, 996, 996, 996, 1861,
+  1896, 467, 996, 465, 1884, 463, 462, 996, 996, 996,
+  998, 996, 1897, 1897, 1897, 1900, 1900, 1900, 2022, 2022,
+  2022, 461, 1885, 2022, 2022, 2022, 1908, 1908, 1908, 1898,
+  460, 458, 1901, 996, 996, 2022, 1890, 1890, 1890, 456,
+  2022, 1893, 1893, 1893, 682, 1895, 1895, 1895, 455, 1915,
+  1915, 1915, 454, 1916, 998, 1899, 1917, 452, 1894, 1897,
+  1897, 1897, 1896, 1918, 1918, 1918, 450, 1919, 449, 1906,
+  1920, 1900, 1900, 1900, 1907, 445, 1898, 444, 1922, 1922,
+  1922, 442, 1923, 441, 1111, 1924, 438, 437, 1901, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 1908, 1908, 1908, 1912, 1912,
+  1912, 436, 1913, 434, 432, 1914, 2022, 430, 2022, 2022,
+  1915, 1915, 1915, 682, 1916, 406, 405, 1917, 1918, 1918,
+  1918, 403, 1919, 401, 395, 1920, 1922, 1922, 1922, 394,
+  1923, 1931, 1929, 1924, 395, 1930, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 394, 393, 2022, 392, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 1957,
+  1957, 1957, 2022, 2022, 2022, 2022, 2022, 2022, 1957, 1957,
+  1957, 2022, 2022, 2022, 2022, 2022, 1958, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 1938, 2022, 1958, 1939, 2022, 2022, 1954,
+  2022, 1966, 1966, 1966, 1946, 1967, 2022, 1947, 1968, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 1955, 2022, 2022,
+  1963, 2022, 2022, 1964, 2022, 2022, 2022, 2022, 2022, 2022,
+  1966, 1966, 1966, 2022, 1967, 2022, 2022, 1968, 2022, 2022,
+  2022, 2022, 2022, 2022, 1976, 1976, 1976, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 1976,
+  1976, 1976, 682, 1979, 2022, 2022, 1980, 2022, 2022, 1971,
+  2022, 2022, 1972, 2022, 2022, 2022, 2022, 682, 2022, 2022,
+  2022, 1974, 2022, 2022, 1975, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 1993, 1993, 1993, 2022, 2022, 1977, 2022,
+  1978, 2022, 2022, 2022, 2022, 2022, 2022, 1995, 1995, 1995,
+  1994, 1981, 1993, 1993, 1993, 2022, 1982, 2022, 1999, 1999,
+  1999, 2022, 2000, 2022, 1996, 2001, 2022, 2022, 1986, 1994,
+  2022, 1985, 2022, 1989, 1995, 1995, 1995, 2002, 2002, 2002,
+  2022, 2003, 2022, 2022, 2004, 1999, 1999, 1999, 2022, 2000,
+  2022, 1996, 2001, 1990, 2002, 2002, 2002, 2022, 2003, 2022,
+  2022, 2004, 2020, 2020, 2020, 2020, 2020, 2020, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2021, 2022, 2022, 2021, 144, 144, 144, 144, 144, 144,
+  144, 144, 144, 145, 145, 145, 145, 145, 145, 145,
+  145, 145, 150, 150, 150, 150, 150, 150, 150, 150,
+  150, 153, 153, 153, 153, 153, 153, 153, 153, 153,
+  156, 156, 156, 156, 156, 156, 156, 156, 156, 159,
+  159, 159, 159, 159, 159, 159, 159, 159, 166, 166,
+  166, 166, 166, 166, 166, 166, 166, 174, 174, 174,
+  174, 174, 174, 174, 174, 174, 179, 179, 179, 179,
+  179, 179, 179, 179, 179, 189, 189, 189, 189, 189,
+  189, 189, 189, 189, 193, 193, 193, 193, 193, 193,
+
+  193, 193, 193, 199, 199, 199, 199, 199, 199, 199,
+  199, 199, 210, 210, 210, 210, 210, 210, 210, 210,
+  210, 217, 217, 217, 217, 217, 217, 217, 217, 217,
+  225, 225, 225, 225, 225, 225, 225, 225, 225, 231,
+  231, 231, 231, 231, 231, 231, 231, 231, 237, 237,
+  237, 237, 237, 237, 237, 237, 237, 244, 244, 244,
+  244, 244, 244, 244, 244, 244, 250, 250, 250, 250,
+  250, 250, 250, 250, 250, 256, 256, 256, 256, 256,
+  256, 256, 256, 256, 262, 262, 262, 262, 262, 262,
+  262, 262, 262, 270, 270, 270, 270, 270, 270, 270,
+
+  270, 270, 277, 277, 277, 277, 277, 277, 277, 277,
+  277, 282, 282, 282, 282, 282, 282, 282, 282, 282,
+  297, 297, 297, 297, 297, 297, 297, 297, 297, 303,
+  303, 303, 303, 303, 303, 303, 303, 303, 307, 307,
+  307, 307, 307, 307, 307, 307, 307, 313, 313, 313,
+  313, 313, 313, 313, 313, 313, 320, 320, 320, 320,
+  320, 320, 320, 320, 320, 327, 327, 327, 327, 327,
+  327, 327, 327, 327, 334, 334, 334, 334, 334, 334,
+  334, 334, 334, 341, 341, 341, 341, 341, 341, 341,
+  341, 341, 348, 348, 348, 348, 348, 348, 348, 348,
+
+  348, 355, 355, 355, 355, 355, 355, 355, 355, 355,
+  359, 359, 359, 359, 359, 359, 359, 359, 359, 365,
+  365, 365, 365, 365, 365, 365, 365, 365, 372, 372,
+  372, 372, 372, 372, 372, 372, 372, 380, 380, 380,
+  380, 380, 380, 380, 380, 380, 384, 384, 384, 384,
+  384, 384, 384, 384, 384, 404, 404, 404, 2022, 2022,
+  2022, 404, 431, 431, 431, 2022, 2022, 2022, 431, 435,
+  435, 435, 2022, 2022, 2022, 435, 443, 443, 443, 2022,
+  2022, 2022, 443, 453, 453, 453, 2022, 2022, 2022, 453,
+  459, 459, 459, 2022, 2022, 2022, 459, 466, 466, 466,
+
+  2022, 2022, 2022, 466, 470, 470, 470, 2022, 2022, 2022,
+  470, 479, 479, 479, 2022, 2022, 2022, 479, 484, 484,
+  484, 2022, 2022, 2022, 484, 495, 495, 495, 2022, 2022,
+  2022, 495, 499, 499, 499, 2022, 2022, 2022, 499, 507,
+  507, 507, 2022, 2022, 2022, 507, 515, 515, 515, 2022,
+  2022, 2022, 515, 522, 522, 522, 2022, 2022, 2022, 522,
+  526, 526, 526, 2022, 2022, 2022, 526, 534, 534, 534,
+  2022, 2022, 2022, 534, 537, 537, 537, 537, 537, 537,
+  537, 2022, 537, 553, 2022, 2022, 2022, 553, 581, 2022,
+  2022, 2022, 581, 588, 2022, 2022, 2022, 588, 598, 2022,
+
+  2022, 2022, 598, 604, 2022, 2022, 2022, 604, 611, 2022,
+  2022, 2022, 611, 614, 2022, 2022, 2022, 614, 623, 2022,
+  2022, 2022, 623, 628, 2022, 2022, 2022, 628, 484, 484,
+  484, 2022, 2022, 2022, 484, 640, 2022, 2022, 2022, 640,
+  495, 495, 495, 2022, 2022, 2022, 495, 644, 2022, 2022,
+  2022, 644, 499, 499, 499, 2022, 2022, 2022, 499, 652,
+  2022, 2022, 2022, 652, 507, 507, 507, 2022, 2022, 2022,
+  507, 659, 2022, 2022, 2022, 659, 515, 515, 515, 2022,
+  2022, 2022, 515, 665, 2022, 2022, 2022, 665, 522, 522,
+  522, 2022, 2022, 2022, 522, 669, 2022, 2022, 2022, 669,
+
+  526, 526, 526, 2022, 2022, 2022, 526, 675, 2022, 2022,
+  2022, 675, 534, 534, 534, 2022, 2022, 2022, 534, 679,
+  2022, 2022, 2022, 679, 681, 681, 681, 681, 681, 681,
+  681, 681, 681, 687, 2022, 2022, 2022, 2022, 687, 404,
+  404, 404, 2022, 2022, 2022, 404, 697, 697, 697, 697,
+  2022, 2022, 697, 697, 431, 431, 431, 2022, 2022, 2022,
+  431, 727, 727, 727, 727, 2022, 2022, 727, 727, 435,
+  435, 435, 2022, 2022, 2022, 435, 737, 737, 737, 737,
+  2022, 2022, 737, 737, 443, 443, 443, 2022, 2022, 2022,
+  443, 751, 751, 751, 751, 2022, 2022, 751, 751, 453,
+
+  453, 453, 2022, 2022, 2022, 453, 759, 759, 759, 759,
+  2022, 2022, 759, 759, 459, 459, 459, 2022, 2022, 2022,
+  459, 769, 769, 769, 769, 2022, 2022, 769, 769, 466,
+  466, 466, 2022, 2022, 2022, 466, 774, 774, 774, 774,
+  2022, 2022, 774, 774, 470, 470, 470, 2022, 2022, 2022,
+  470, 786, 786, 786, 786, 2022, 2022, 786, 786, 479,
+  479, 479, 2022, 2022, 2022, 479, 794, 794, 794, 794,
+  2022, 2022, 794, 794, 484, 484, 484, 2022, 2022, 2022,
+  484, 812, 812, 812, 812, 2022, 2022, 812, 812, 819,
+  819, 819, 819, 2022, 2022, 819, 819, 499, 499, 499,
+
+  2022, 2022, 2022, 499, 830, 830, 830, 830, 2022, 2022,
+  830, 830, 507, 507, 507, 2022, 2022, 2022, 507, 841,
+  841, 841, 841, 2022, 2022, 841, 841, 515, 515, 515,
+  2022, 2022, 2022, 515, 851, 851, 851, 851, 2022, 2022,
+  851, 851, 858, 858, 858, 858, 2022, 2022, 858, 858,
+  526, 526, 526, 2022, 2022, 2022, 526, 866, 866, 866,
+  866, 2022, 2022, 866, 866, 534, 534, 534, 2022, 2022,
+  2022, 534, 872, 872, 872, 872, 2022, 2022, 872, 872,
+  681, 681, 681, 681, 681, 681, 681, 681, 681, 687,
+  2022, 687, 2022, 2022, 687, 404, 404, 404, 2022, 2022,
+
+  2022, 404, 697, 697, 697, 697, 2022, 2022, 697, 697,
+  431, 431, 431, 431, 2022, 431, 2022, 431, 727, 727,
+  727, 727, 2022, 2022, 727, 727, 435, 435, 435, 435,
+  2022, 435, 2022, 435, 737, 737, 737, 737, 2022, 2022,
+  737, 737, 443, 443, 443, 2022, 2022, 2022, 443, 751,
+  751, 751, 751, 2022, 2022, 751, 751, 453, 453, 453,
+  2022, 2022, 2022, 453, 759, 759, 759, 759, 2022, 2022,
+  759, 759, 459, 459, 459, 2022, 2022, 2022, 459, 769,
+  769, 769, 769, 2022, 2022, 769, 769, 466, 466, 466,
+  2022, 2022, 2022, 466, 774, 774, 774, 774, 2022, 2022,
+
+  774, 774, 470, 470, 470, 2022, 2022, 2022, 470, 786,
+  786, 786, 786, 2022, 2022, 786, 786, 479, 479, 479,
+  2022, 2022, 2022, 479, 794, 794, 794, 794, 2022, 2022,
+  794, 794, 484, 484, 484, 2022, 2022, 2022, 484, 812,
+  812, 812, 812, 2022, 2022, 812, 812, 819, 819, 819,
+  819, 2022, 2022, 819, 819, 499, 499, 499, 2022, 2022,
+  2022, 499, 830, 830, 830, 830, 2022, 2022, 830, 830,
+  507, 507, 507, 2022, 2022, 2022, 507, 841, 841, 841,
+  841, 2022, 2022, 841, 841, 515, 515, 515, 2022, 2022,
+  2022, 515, 851, 851, 851, 851, 2022, 2022, 851, 851,
+
+  858, 858, 858, 858, 2022, 2022, 858, 858, 526, 526,
+  526, 2022, 2022, 2022, 526, 866, 866, 866, 866, 2022,
+  2022, 866, 866, 534, 534, 534, 2022, 2022, 2022, 534,
+  872, 872, 872, 872, 2022, 2022, 872, 872, 681, 681,
+  681, 681, 681, 681, 681, 681, 681, 996, 996, 996,
+  996, 996, 996, 996, 996, 996, 404, 404, 404, 2022,
+  2022, 2022, 404, 697, 697, 697, 697, 2022, 2022, 697,
+  697, 727, 727, 727, 727, 2022, 2022, 727, 727, 435,
+  435, 435, 2022, 2022, 2022, 435, 737, 737, 737, 737,
+  2022, 2022, 737, 737, 443, 443, 443, 2022, 2022, 2022,
+
+  443, 751, 751, 751, 751, 2022, 2022, 751, 751, 453,
+  453, 453, 2022, 2022, 2022, 453, 759, 759, 759, 759,
+  2022, 2022, 759, 759, 459, 459, 459, 2022, 2022, 2022,
+  459, 769, 769, 769, 769, 2022, 2022, 769, 769, 466,
+  466, 466, 2022, 2022, 2022, 466, 774, 774, 774, 774,
+  2022, 2022, 774, 774, 470, 470, 470, 2022, 2022, 2022,
+  470, 786, 786, 786, 786, 2022, 2022, 786, 786, 479,
+  479, 479, 479, 2022, 479, 2022, 479, 794, 794, 794,
+  794, 2022, 2022, 794, 794, 484, 484, 484, 484, 2022,
+  484, 2022, 484, 812, 812, 812, 812, 2022, 2022, 812,
+
+  812, 819, 819, 819, 819, 2022, 2022, 819, 819, 499,
+  499, 499, 2022, 2022, 2022, 499, 830, 830, 830, 830,
+  2022, 2022, 830, 830, 507, 507, 507, 2022, 2022, 2022,
+  507, 841, 841, 841, 841, 2022, 2022, 841, 841, 515,
+  515, 515, 2022, 2022, 2022, 515, 851, 851, 851, 851,
+  2022, 2022, 851, 851, 858, 858, 858, 858, 2022, 2022,
+  858, 858, 526, 526, 526, 2022, 2022, 2022, 526, 866,
+  866, 866, 866, 2022, 2022, 866, 866, 534, 534, 534,
+  534, 2022, 534, 2022, 534, 872, 872, 872, 872, 2022,
+  2022, 872, 872, 681, 681, 681, 681, 681, 681, 681,
+
+  681, 681, 996, 996, 996, 996, 996, 996, 996, 996,
+  996, 404, 404, 404, 2022, 2022, 2022, 404, 697, 697,
+  697, 697, 2022, 2022, 697, 697, 727, 727, 727, 727,
+  2022, 2022, 727, 727, 435, 435, 435, 2022, 2022, 2022,
+  435, 737, 737, 737, 737, 2022, 2022, 737, 737, 443,
+  443, 443, 2022, 2022, 2022, 443, 751, 751, 751, 751,
+  2022, 2022, 751, 751, 453, 453, 453, 2022, 2022, 2022,
+  453, 759, 759, 759, 759, 2022, 2022, 759, 759, 459,
+  459, 459, 459, 2022, 459, 2022, 459, 466, 466, 466,
+  466, 2022, 466, 2022, 466, 774, 774, 774, 774, 2022,
+
+  2022, 774, 774, 470, 470, 470, 2022, 2022, 2022, 470,
+  786, 786, 786, 786, 2022, 2022, 786, 786, 794, 794,
+  794, 794, 2022, 2022, 794, 794, 484, 484, 484, 484,
+  2022, 484, 2022, 484, 812, 812, 812, 812, 2022, 2022,
+  812, 812, 819, 819, 819, 819, 2022, 2022, 819, 819,
+  499, 499, 499, 2022, 2022, 2022, 499, 830, 830, 830,
+  830, 2022, 2022, 830, 830, 507, 507, 507, 507, 2022,
+  507, 2022, 507, 841, 841, 841, 841, 2022, 2022, 841,
+  841, 515, 515, 515, 515, 2022, 515, 2022, 515, 851,
+  851, 851, 851, 2022, 2022, 851, 851, 858, 858, 858,
+
+  858, 2022, 2022, 858, 858, 526, 526, 526, 2022, 2022,
+  2022, 526, 866, 866, 866, 866, 2022, 2022, 866, 866,
+  872, 872, 872, 872, 2022, 2022, 872, 872, 681, 681,
+  681, 681, 681, 681, 681, 681, 681, 996, 996, 996,
+  996, 996, 996, 996, 996, 996, 404, 404, 404, 404,
+  2022, 404, 2022, 404, 697, 697, 697, 697, 2022, 2022,
+  697, 697, 727, 727, 727, 727, 2022, 2022, 727, 727,
+  435, 435, 435, 2022, 2022, 2022, 435, 737, 737, 737,
+  737, 2022, 2022, 737, 737, 443, 443, 443, 2022, 2022,
+  2022, 443, 751, 751, 751, 751, 2022, 2022, 751, 751,
+
+  453, 453, 453, 453, 2022, 453, 2022, 453, 759, 759,
+  759, 759, 2022, 2022, 759, 759, 459, 459, 459, 459,
+  2022, 459, 2022, 459, 774, 774, 774, 774, 2022, 2022,
+  774, 774, 470, 470, 470, 2022, 2022, 2022, 470, 1817,
+  1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1818, 1818,
+  1818, 1818, 1818, 1818, 1818, 1818, 1818, 1856, 1856, 1856,
+  1856, 1856, 1856, 1856, 1856, 1856, 1859, 1859, 1859, 1859,
+  1859, 1859, 1859, 1859, 1859, 1887, 1887, 1887, 1887, 1887,
+  1887, 1887, 1887, 1887, 1889, 1889, 1889, 1889, 1889, 1889,
+  1889, 1889, 1889, 143, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022
+};
+
+static yyconst flex_int16_t yy_chk[7164] = { 0,
+  0, 3, 3, 3, 4, 4, 4, 5, 5, 5,
+  6, 6, 6, 7, 7, 7, 11, 3, 9, 12,
+  4, 10, 219, 5, 0, 9, 6, 0, 10, 7,
+  8, 8, 8, 148, 11, 13, 13, 12, 14, 14,
+  13, 13, 220, 14, 14, 149, 8, 17, 17, 148,
+  13, 15, 15, 14, 15, 152, 15, 16, 16, 414,
+  16, 149, 16, 18, 18, 414, 15, 19, 19, 19,
+  219, 152, 16, 20, 20, 20, 23, 23, 23, 24,
+  24, 24, 266, 19, 25, 25, 25, 332, 17, 20,
+  220, 266, 23, 425, 332, 24, 146, 146, 146, 425,
+
+  25, 147, 147, 147, 18, 21, 21, 21, 21, 21,
+  21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+  1412, 21, 21, 21, 21, 21, 26, 26, 26, 27,
+  27, 27, 319, 28, 28, 28, 29, 29, 29, 30,
+  30, 30, 26, 319, 451, 27, 175, 21, 21, 28,
+  451, 294, 29, 190, 294, 30, 151, 151, 151, 172,
+  172, 172, 175, 180, 180, 180, 187, 187, 187, 190,
+  21, 183, 21, 22, 22, 22, 22, 22, 22, 22,
+  22, 22, 22, 22, 22, 22, 22, 22, 272, 22,
+  22, 22, 22, 22, 31, 31, 31, 32, 32, 32,
+
+  995, 33, 33, 33, 34, 34, 34, 35, 35, 35,
+  31, 415, 200, 32, 170, 22, 22, 33, 211, 183,
+  34, 183, 995, 35, 415, 36, 36, 36, 200, 185,
+  170, 194, 194, 194, 211, 185, 272, 185, 22, 185,
+  22, 36, 37, 37, 37, 37, 37, 37, 37, 37,
+  37, 37, 37, 37, 37, 37, 37, 291, 37, 37,
+  37, 37, 37, 39, 39, 39, 40, 40, 40, 170,
+  47, 47, 47, 43, 43, 44, 44, 291, 43, 39,
+  44, 1152, 40, 215, 37, 37, 47, 215, 43, 1152,
+  44, 215, 37, 38, 38, 38, 38, 38, 38, 38,
+
+  38, 38, 38, 38, 38, 38, 38, 38, 707, 38,
+  38, 38, 38, 38, 43, 333, 44, 48, 48, 48,
+  707, 49, 49, 49, 50, 50, 50, 197, 197, 197,
+  208, 208, 208, 48, 684, 38, 38, 49, 684, 397,
+  50, 336, 397, 38, 41, 41, 41, 41, 41, 41,
+  41, 41, 41, 41, 41, 41, 41, 41, 41, 333,
+  41, 41, 41, 41, 41, 51, 51, 51, 52, 52,
+  52, 322, 53, 53, 53, 54, 54, 54, 218, 218,
+  218, 51, 195, 205, 52, 336, 41, 41, 53, 195,
+  205, 54, 1319, 1319, 41, 1320, 1320, 41, 195, 205,
+
+  223, 223, 223, 41, 42, 42, 42, 42, 42, 42,
+  42, 42, 42, 42, 42, 42, 42, 42, 42, 322,
+  42, 42, 42, 42, 42, 57, 57, 57, 58, 58,
+  58, 720, 61, 61, 61, 62, 62, 62, 388, 226,
+  238, 57, 1156, 720, 58, 233, 42, 42, 61, 422,
+  1156, 62, 233, 388, 42, 226, 238, 42, 232, 232,
+  232, 233, 422, 42, 45, 45, 45, 45, 45, 45,
+  45, 45, 45, 45, 45, 45, 45, 45, 45, 754,
+  45, 45, 45, 45, 45, 65, 65, 65, 66, 66,
+  66, 754, 67, 67, 67, 68, 68, 68, 69, 69,
+
+  69, 65, 246, 251, 66, 1414, 45, 45, 67, 246,
+  350, 68, 426, 1419, 69, 45, 1421, 45, 246, 251,
+  45, 235, 235, 235, 254, 426, 45, 46, 46, 46,
+  46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+  46, 46, 439, 46, 46, 46, 46, 46, 70, 70,
+  70, 73, 73, 73, 350, 74, 74, 74, 75, 75,
+  75, 76, 76, 76, 70, 254, 263, 73, 254, 46,
+  46, 74, 278, 1004, 75, 439, 1428, 76, 46, 1004,
+  46, 1442, 263, 46, 245, 245, 245, 1112, 278, 46,
+  55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+
+  55, 55, 55, 55, 55, 1443, 55, 55, 55, 55,
+  55, 77, 77, 77, 78, 78, 78, 1112, 79, 79,
+  79, 80, 80, 80, 83, 83, 83, 77, 1444, 630,
+  78, 1111, 55, 55, 79, 289, 304, 80, 630, 55,
+  83, 248, 248, 248, 55, 257, 257, 257, 260, 260,
+  260, 289, 304, 55, 56, 56, 56, 56, 56, 56,
+  56, 56, 56, 56, 56, 56, 56, 56, 56, 1111,
+  56, 56, 56, 56, 56, 84, 84, 84, 87, 87,
+  87, 1445, 88, 88, 88, 91, 91, 91, 92, 92,
+  92, 84, 1325, 1325, 87, 1294, 56, 56, 88, 314,
+
+  328, 91, 1294, 56, 92, 271, 271, 271, 56, 275,
+  275, 275, 283, 283, 283, 314, 328, 56, 59, 59,
+  59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+  59, 59, 59, 1448, 59, 59, 59, 59, 59, 95,
+  95, 95, 96, 96, 96, 875, 97, 97, 97, 98,
+  98, 98, 99, 99, 99, 95, 284, 428, 96, 1451,
+  59, 59, 97, 284, 875, 98, 1232, 1433, 99, 1295,
+  428, 59, 284, 286, 286, 286, 1295, 59, 1452, 59,
+  59, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+  60, 60, 60, 60, 60, 60, 1433, 60, 60, 60,
+
+  60, 60, 100, 100, 100, 101, 101, 101, 1232, 102,
+  102, 102, 105, 105, 105, 106, 106, 106, 100, 1326,
+  1326, 101, 299, 60, 60, 102, 539, 1230, 105, 299,
+  1453, 106, 1315, 1230, 60, 298, 298, 298, 299, 1315,
+  60, 539, 60, 60, 63, 63, 63, 63, 63, 63,
+  63, 63, 63, 63, 63, 63, 63, 63, 63, 1434,
+  63, 63, 63, 63, 63, 107, 107, 107, 108, 108,
+  108, 1454, 109, 109, 109, 110, 110, 110, 111, 111,
+  111, 107, 1455, 1316, 108, 309, 63, 63, 109, 342,
+  1316, 110, 309, 1434, 111, 301, 301, 301, 308, 308,
+
+  308, 309, 311, 311, 311, 342, 63, 64, 64, 64,
+  64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+  64, 64, 1456, 64, 64, 64, 64, 64, 112, 112,
+  112, 115, 115, 115, 1457, 116, 116, 116, 117, 117,
+  117, 118, 118, 118, 112, 1458, 1338, 115, 1459, 64,
+  64, 116, 356, 1413, 117, 1413, 1460, 118, 321, 321,
+  321, 325, 325, 325, 335, 335, 335, 1461, 356, 64,
+  71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+  71, 71, 71, 71, 71, 1338, 71, 71, 71, 71,
+  71, 119, 119, 119, 120, 120, 120, 1465, 121, 121,
+
+  121, 122, 122, 122, 125, 125, 125, 119, 366, 361,
+  120, 381, 71, 71, 121, 71, 361, 122, 1466, 1415,
+  125, 1415, 1467, 71, 366, 361, 71, 381, 1339, 71,
+  1468, 1470, 71, 72, 72, 72, 72, 72, 72, 72,
+  72, 72, 72, 72, 72, 72, 72, 72, 1477, 72,
+  72, 72, 72, 72, 126, 126, 126, 129, 129, 129,
+  1478, 130, 130, 130, 131, 131, 131, 132, 132, 132,
+  126, 1339, 386, 129, 1479, 72, 72, 130, 72, 386,
+  131, 1050, 1420, 132, 1420, 1480, 72, 1050, 386, 72,
+  1050, 1422, 72, 1422, 1050, 72, 81, 81, 81, 81,
+
+  81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
+  81, 374, 81, 81, 81, 81, 81, 133, 133, 133,
+  134, 134, 134, 1482, 135, 135, 135, 136, 136, 136,
+  139, 139, 139, 133, 1485, 1051, 134, 1486, 81, 81,
+  135, 1051, 1487, 136, 1051, 374, 139, 162, 1051, 81,
+  339, 339, 339, 349, 349, 349, 353, 353, 353, 374,
+  1488, 81, 82, 82, 82, 82, 82, 82, 82, 82,
+  82, 82, 82, 82, 82, 82, 82, 1489, 82, 82,
+  82, 82, 82, 140, 140, 140, 162, 360, 360, 360,
+  1490, 1495, 162, 363, 363, 363, 162, 1496, 1497, 140,
+
+  1498, 162, 1499, 1500, 82, 82, 373, 373, 373, 378,
+  378, 378, 385, 385, 385, 82, 387, 387, 387, 542,
+  542, 542, 1521, 542, 710, 710, 710, 82, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+  85, 85, 85, 85, 85, 85, 85, 89, 89, 89,
+
+  89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+  89, 89, 1513, 89, 89, 89, 89, 89, 396, 396,
+  396, 437, 437, 437, 445, 445, 445, 460, 460, 460,
+  472, 472, 472, 718, 718, 718, 1522, 1523, 437, 89,
+  89, 445, 1524, 1529, 460, 1530, 1531, 472, 1513, 1231,
+  89, 90, 90, 90, 90, 90, 90, 90, 90, 90,
+  90, 90, 90, 90, 90, 90, 1514, 90, 90, 90,
+  90, 90, 1532, 396, 480, 480, 480, 1231, 486, 486,
+  486, 487, 487, 487, 496, 496, 496, 888, 888, 888,
+  1527, 480, 1533, 90, 90, 486, 1534, 1535, 487, 1536,
+
+  1514, 496, 1527, 1515, 90, 93, 93, 93, 93, 93,
+  93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+  1537, 93, 93, 93, 93, 93, 501, 501, 501, 523,
+  523, 523, 553, 553, 553, 554, 554, 554, 581, 581,
+  581, 1110, 1515, 501, 1538, 1539, 523, 93, 93, 1541,
+  553, 93, 1542, 554, 1543, 1551, 581, 1110, 93, 1552,
+  93, 893, 893, 893, 896, 896, 896, 93, 94, 94,
+  94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+  94, 94, 94, 1553, 94, 94, 94, 94, 94, 554,
+  582, 582, 582, 1558, 1528, 584, 584, 584, 585, 585,
+
+  585, 1559, 585, 1560, 1561, 585, 1528, 1562, 582, 1563,
+  94, 94, 584, 1568, 94, 593, 593, 593, 1569, 593,
+  1570, 94, 593, 94, 900, 900, 900, 904, 904, 904,
+  94, 103, 103, 103, 103, 103, 103, 103, 103, 103,
+  103, 103, 103, 103, 103, 103, 582, 103, 103, 103,
+  103, 103, 588, 588, 588, 1571, 1572, 589, 589, 589,
+  592, 592, 592, 594, 594, 594, 596, 596, 596, 1573,
+  588, 1586, 1594, 103, 103, 589, 103, 592, 1587, 103,
+  594, 1565, 1566, 596, 607, 607, 607, 1596, 607, 1565,
+  1566, 607, 1585, 103, 104, 104, 104, 104, 104, 104,
+
+  104, 104, 104, 104, 104, 104, 104, 104, 104, 1586,
+  104, 104, 104, 104, 104, 1599, 1587, 589, 1585, 1600,
+  598, 598, 598, 604, 604, 604, 1601, 1602, 599, 599,
+  599, 605, 605, 605, 1603, 1604, 104, 104, 598, 104,
+  1605, 604, 104, 618, 618, 618, 599, 618, 1606, 605,
+  618, 930, 930, 930, 1607, 1609, 104, 113, 113, 113,
+  113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+  113, 113, 599, 113, 113, 113, 113, 113, 606, 606,
+  606, 1610, 1611, 611, 611, 611, 614, 614, 614, 1612,
+  1616, 605, 617, 617, 617, 606, 612, 612, 612, 113,
+
+  113, 611, 113, 1617, 614, 113, 1009, 1009, 1009, 617,
+  113, 626, 626, 626, 612, 626, 1621, 1623, 626, 113,
+  114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+  114, 114, 114, 114, 114, 1627, 114, 114, 114, 114,
+  114, 615, 615, 615, 612, 1628, 623, 623, 623, 624,
+  624, 624, 625, 625, 625, 1629, 628, 628, 628, 615,
+  1630, 1631, 114, 114, 623, 114, 1632, 624, 114, 625,
+  1011, 1011, 1011, 114, 628, 1015, 1015, 1015, 1021, 1021,
+  1021, 1633, 114, 123, 123, 123, 123, 123, 123, 123,
+  123, 123, 123, 123, 123, 123, 123, 123, 615, 123,
+
+  123, 123, 123, 123, 1634, 1635, 624, 1636, 1638, 629,
+  629, 629, 631, 631, 631, 632, 632, 632, 1639, 632,
+  1640, 1641, 632, 1642, 1643, 123, 123, 629, 1656, 631,
+  1022, 1022, 1022, 1047, 1047, 1047, 123, 124, 124, 124,
+  124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+  124, 124, 1650, 124, 124, 124, 124, 124, 633, 633,
+  633, 634, 634, 634, 1658, 634, 1662, 1663, 634, 629,
+  635, 635, 635, 1664, 1665, 633, 1126, 1126, 1126, 124,
+  124, 643, 643, 643, 1650, 643, 1667, 635, 643, 1668,
+  124, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+
+  127, 127, 127, 127, 127, 127, 1669, 127, 127, 127,
+  127, 127, 640, 640, 640, 642, 642, 642, 644, 644,
+  644, 641, 641, 641, 645, 645, 645, 647, 647, 647,
+  640, 1670, 642, 127, 127, 1649, 644, 1671, 1672, 641,
+  1673, 127, 645, 127, 647, 127, 1127, 1127, 1127, 1129,
+  1129, 1129, 1674, 127, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128, 128, 1678,
+  128, 128, 128, 128, 128, 641, 648, 648, 648, 1649,
+  648, 645, 1680, 648, 652, 652, 652, 653, 653, 653,
+  655, 655, 655, 656, 656, 656, 128, 128, 662, 662,
+
+  662, 1681, 652, 1684, 128, 653, 128, 655, 128, 1685,
+  656, 1130, 1130, 1130, 1686, 662, 128, 137, 137, 137,
+  137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
+  137, 137, 1687, 137, 137, 137, 137, 137, 1688, 653,
+  659, 659, 659, 1689, 664, 664, 664, 660, 660, 660,
+  665, 665, 665, 666, 666, 666, 1679, 1679, 659, 137,
+  137, 664, 667, 667, 667, 660, 1690, 1691, 665, 1692,
+  1693, 666, 1694, 668, 668, 668, 1696, 668, 1697, 667,
+  668, 1698, 137, 138, 138, 138, 138, 138, 138, 138,
+  138, 138, 138, 138, 138, 138, 138, 138, 1699, 138,
+
+  138, 138, 138, 138, 660, 669, 669, 669, 1700, 1701,
+  666, 670, 670, 670, 675, 675, 675, 676, 676, 676,
+  679, 679, 679, 669, 1710, 138, 138, 1704, 1711, 670,
+  1712, 1713, 675, 1716, 1717, 676, 1719, 1720, 679, 680,
+  680, 680, 696, 696, 696, 725, 725, 725, 138, 181,
+  697, 697, 697, 890, 890, 890, 181, 680, 1704, 1721,
+  696, 1723, 725, 670, 1728, 181, 1729, 890, 697, 699,
+  699, 699, 1730, 726, 726, 726, 1731, 676, 727, 727,
+  727, 1737, 1738, 729, 729, 729, 1739, 699, 1740, 1741,
+  181, 726, 181, 1742, 1744, 181, 727, 181, 181, 680,
+
+  181, 729, 1746, 1749, 181, 1750, 181, 181, 181, 182,
+  730, 730, 730, 699, 1751, 1752, 182, 731, 731, 731,
+  1753, 731, 1754, 1761, 731, 182, 1769, 730, 1770, 729,
+  734, 734, 734, 736, 736, 736, 737, 737, 737, 1771,
+  1772, 739, 739, 739, 744, 744, 744, 734, 1776, 1777,
+  182, 736, 182, 1778, 737, 182, 1779, 182, 182, 739,
+  182, 744, 1761, 1780, 182, 1781, 182, 182, 182, 741,
+  741, 741, 1783, 741, 1784, 1785, 741, 745, 745, 745,
+  1786, 745, 1791, 1792, 745, 739, 1793, 734, 746, 746,
+  746, 747, 747, 747, 748, 748, 748, 1794, 748, 1795,
+
+  1796, 748, 750, 750, 750, 746, 1799, 1800, 747, 751,
+  751, 751, 753, 753, 753, 756, 756, 756, 1801, 1802,
+  750, 758, 758, 758, 759, 759, 759, 751, 1803, 1804,
+  753, 1819, 756, 761, 761, 761, 762, 762, 762, 758,
+  762, 1821, 759, 762, 768, 768, 768, 769, 769, 769,
+  1824, 761, 771, 771, 771, 773, 773, 773, 774, 774,
+  774, 1815, 768, 1816, 1813, 769, 1825, 1827, 753, 1828,
+  771, 1831, 1832, 773, 1816, 1815, 774, 761, 776, 776,
+  776, 778, 778, 778, 1833, 778, 1834, 1841, 778, 785,
+  785, 785, 786, 786, 786, 1842, 776, 788, 788, 788,
+
+  1844, 789, 789, 789, 1845, 789, 1813, 785, 789, 1847,
+  786, 793, 793, 793, 771, 788, 794, 794, 794, 796,
+  796, 796, 1848, 799, 799, 799, 1850, 799, 1851, 793,
+  799, 805, 805, 805, 794, 1858, 1839, 796, 776, 802,
+  802, 802, 1855, 802, 1840, 1860, 802, 1839, 805, 806,
+  806, 806, 1862, 806, 1863, 1840, 806, 1856, 788, 811,
+  811, 811, 812, 812, 812, 814, 814, 814, 815, 815,
+  815, 1856, 815, 1857, 1857, 815, 796, 811, 1872, 1855,
+  812, 1873, 1874, 814, 818, 818, 818, 819, 819, 819,
+  821, 821, 821, 823, 823, 823, 1859, 823, 1875, 1887,
+
+  823, 1888, 818, 1889, 1891, 819, 1892, 1859, 821, 829,
+  829, 829, 830, 830, 830, 832, 832, 832, 834, 834,
+  834, 1899, 835, 835, 835, 1902, 835, 829, 814, 835,
+  830, 1903, 1904, 832, 1905, 834, 1909, 836, 836, 836,
+  837, 837, 837, 1921, 837, 1925, 1926, 837, 840, 840,
+  840, 1927, 1928, 821, 836, 841, 841, 841, 843, 843,
+  843, 845, 845, 845, 1933, 1931, 840, 1934, 846, 846,
+  846, 832, 846, 841, 1935, 846, 843, 1936, 845, 848,
+  848, 848, 849, 849, 849, 1937, 849, 1931, 1940, 849,
+  850, 850, 850, 851, 851, 851, 848, 853, 853, 853,
+
+  854, 854, 854, 1941, 854, 1942, 1940, 854, 850, 1943,
+  1944, 851, 857, 857, 857, 853, 858, 858, 858, 1945,
+  1948, 843, 860, 860, 860, 862, 862, 862, 1950, 1951,
+  857, 865, 865, 865, 858, 866, 866, 866, 1952, 1948,
+  860, 1953, 862, 868, 868, 868, 871, 871, 871, 865,
+  872, 872, 872, 866, 874, 874, 874, 876, 876, 876,
+  853, 868, 1959, 1961, 871, 884, 884, 884, 872, 911,
+  911, 911, 874, 1411, 1979, 876, 876, 1983, 860, 901,
+  901, 901, 1980, 884, 1956, 1965, 911, 912, 912, 912,
+  1956, 912, 1991, 901, 912, 913, 913, 913, 1965, 1987,
+
+  868, 914, 914, 914, 874, 915, 915, 915, 2013, 915,
+  1984, 1983, 915, 913, 918, 918, 918, 1979, 914, 920,
+  920, 920, 1997, 920, 1991, 1980, 920, 884, 923, 923,
+  923, 1410, 918, 924, 924, 924, 1987, 924, 1992, 1409,
+  924, 929, 929, 929, 1984, 923, 925, 925, 925, 913,
+  925, 1408, 2013, 925, 932, 932, 932, 1988, 1998, 929,
+  918, 933, 933, 933, 1997, 933, 2007, 2014, 933, 2008,
+  1992, 932, 934, 934, 934, 935, 935, 935, 939, 939,
+  939, 941, 941, 941, 945, 945, 945, 1407, 929, 934,
+  946, 946, 946, 935, 1988, 2007, 939, 2005, 2008, 941,
+
+  1998, 945, 947, 947, 947, 2017, 2006, 946, 948, 948,
+  948, 2014, 949, 949, 949, 950, 950, 950, 2011, 2017,
+  947, 935, 951, 951, 951, 948, 955, 955, 955, 941,
+  949, 2005, 950, 946, 952, 952, 952, 2012, 952, 951,
+  2006, 952, 1406, 955, 956, 956, 956, 2011, 957, 957,
+  957, 958, 958, 958, 959, 959, 959, 960, 960, 960,
+  2009, 956, 2010, 1405, 947, 957, 2012, 1394, 958, 2009,
+  949, 2010, 959, 1393, 2015, 960, 1392, 964, 964, 964,
+  965, 965, 965, 1391, 951, 2016, 967, 967, 967, 2018,
+  967, 1390, 957, 967, 964, 970, 970, 970, 965, 970,
+
+  2018, 1389, 970, 2015, 974, 974, 974, 975, 975, 975,
+  956, 987, 987, 987, 2016, 959, 1388, 958, 974, 960,
+  964, 1387, 977, 977, 977, 975, 977, 1381, 987, 977,
+  981, 981, 981, 965, 981, 1380, 1379, 981, 984, 984,
+  984, 985, 985, 985, 988, 988, 988, 1378, 988, 1377,
+  1376, 988, 991, 991, 991, 1375, 984, 1374, 1373, 985,
+  993, 993, 993, 994, 994, 994, 997, 997, 997, 975,
+  991, 1005, 1005, 1005, 1017, 1017, 1017, 993, 1018, 1018,
+  1018, 994, 1372, 1366, 997, 1024, 1024, 1024, 1017, 1005,
+  1363, 1361, 1018, 1359, 985, 1025, 1025, 1025, 991, 1024,
+
+  984, 1027, 1027, 1027, 1029, 1029, 1029, 1355, 1354, 1025,
+  1030, 1030, 1030, 1335, 997, 1027, 1333, 1332, 1029, 1322,
+  1005, 1031, 1031, 1031, 1030, 1031, 994, 1317, 1031, 1314,
+  997, 1034, 1034, 1034, 1017, 1035, 1035, 1035, 1313, 1035,
+  1310, 1296, 1035, 1293, 1292, 1024, 1052, 1052, 1052, 1034,
+  1040, 1040, 1040, 1042, 1042, 1042, 1291, 1042, 1277, 1276,
+  1042, 1027, 1275, 1052, 1029, 1046, 1046, 1046, 1040, 1049,
+  1049, 1049, 1274, 1049, 1273, 1272, 1049, 1053, 1053, 1053,
+  1271, 1053, 1270, 1046, 1053, 1054, 1054, 1054, 1055, 1055,
+  1055, 1056, 1056, 1056, 1034, 1057, 1057, 1057, 1040, 1058,
+
+  1058, 1058, 1269, 1054, 1268, 1055, 1264, 1263, 1056, 1060,
+  1060, 1060, 1057, 1061, 1061, 1061, 1260, 1058, 1065, 1065,
+  1065, 1259, 1046, 1066, 1066, 1066, 1060, 1066, 1257, 1255,
+  1066, 1061, 1249, 1054, 1247, 1065, 1067, 1067, 1067, 1068,
+  1068, 1068, 1244, 1068, 1243, 1056, 1068, 1070, 1070, 1070,
+  1071, 1071, 1071, 1067, 1072, 1072, 1072, 1061, 1072, 1239,
+  1233, 1072, 1073, 1073, 1073, 1070, 1225, 1071, 1074, 1074,
+  1074, 1075, 1075, 1075, 1223, 1075, 1222, 1221, 1075, 1214,
+  1073, 1076, 1076, 1076, 1208, 1074, 1077, 1077, 1077, 1078,
+  1078, 1078, 1207, 1078, 1206, 1204, 1078, 1202, 1076, 1079,
+
+  1079, 1079, 1179, 1077, 1080, 1080, 1080, 1081, 1081, 1081,
+  1082, 1082, 1082, 1083, 1083, 1083, 1079, 1087, 1087, 1087,
+  1178, 1080, 1177, 1172, 1081, 1088, 1088, 1088, 1082, 1088,
+  1171, 1083, 1088, 1170, 1087, 1090, 1090, 1090, 1091, 1091,
+  1091, 1157, 1092, 1092, 1092, 1094, 1094, 1094, 1095, 1095,
+  1095, 1155, 1154, 1090, 1153, 1091, 1151, 1150, 1080, 1092,
+  1147, 1083, 1146, 1094, 1144, 1095, 1096, 1096, 1096, 1097,
+  1097, 1097, 1082, 1143, 1098, 1098, 1098, 1100, 1100, 1100,
+  1141, 1100, 1140, 1096, 1100, 1139, 1137, 1097, 1098, 1105,
+  1105, 1105, 1098, 1094, 1107, 1107, 1107, 1108, 1108, 1108,
+
+  1133, 1108, 1092, 1132, 1108, 1131, 1128, 1105, 1125, 1096,
+  1124, 1107, 1109, 1109, 1109, 1123, 1122, 1097, 1115, 1115,
+  1115, 1116, 1116, 1116, 1117, 1117, 1117, 1118, 1118, 1118,
+  1109, 1134, 1134, 1134, 1121, 1115, 1120, 1105, 1116, 1119,
+  1114, 1117, 1135, 1135, 1135, 1118, 1136, 1136, 1136, 1138,
+  1138, 1138, 1142, 1142, 1142, 1106, 1145, 1145, 1145, 1148,
+  1148, 1148, 1149, 1149, 1149, 1104, 1103, 1109, 1099, 1093,
+  1142, 1089, 1086, 1116, 1145, 1085, 1084, 1148, 1069, 1149,
+  1064, 1117, 1063, 1062, 1118, 1158, 1158, 1158, 1048, 1158,
+  1045, 1041, 1158, 1161, 1161, 1161, 1162, 1162, 1162, 1142,
+
+  1039, 1163, 1163, 1163, 1038, 1163, 1028, 1161, 1163, 1026,
+  1023, 1161, 1020, 1162, 1148, 1164, 1164, 1164, 1165, 1165,
+  1165, 1166, 1166, 1166, 1019, 1166, 1016, 1014, 1166, 1167,
+  1167, 1167, 1164, 1013, 1012, 1165, 1168, 1168, 1168, 1010,
+  1168, 1008, 1007, 1168, 1006, 1003, 1167, 1169, 1169, 1169,
+  1173, 1173, 1173, 1002, 1173, 999, 996, 1173, 992, 1176,
+  1176, 1176, 990, 1176, 989, 1169, 1176, 1180, 1180, 1180,
+  1182, 1182, 1182, 986, 1182, 980, 976, 1182, 1185, 1185,
+  1185, 973, 1187, 1187, 1187, 1180, 1187, 966, 963, 1187,
+  1190, 1190, 1190, 1169, 962, 961, 1185, 1191, 1191, 1191,
+
+  944, 1191, 943, 942, 1191, 940, 938, 1190, 1192, 1192,
+  1192, 937, 1192, 936, 931, 1192, 1195, 1195, 1195, 1196,
+  1196, 1196, 928, 1196, 919, 917, 1196, 1197, 1197, 1197,
+  1198, 1198, 1198, 1195, 1199, 1199, 1199, 916, 1199, 910,
+  909, 1199, 908, 907, 1197, 906, 905, 1198, 1200, 1200,
+  1200, 1201, 1201, 1201, 1203, 1203, 1203, 1205, 1205, 1205,
+  903, 1205, 902, 899, 1205, 898, 1200, 897, 895, 1201,
+  894, 1203, 1209, 1209, 1209, 1211, 1211, 1211, 1212, 1212,
+  1212, 892, 1212, 891, 889, 1212, 1213, 1213, 1213, 887,
+  1209, 886, 1211, 1216, 1216, 1216, 1200, 1203, 1215, 1215,
+
+  1215, 885, 883, 1213, 1218, 1218, 1218, 1219, 1219, 1219,
+  1216, 1201, 1215, 1217, 1217, 1217, 1215, 1217, 882, 881,
+  1217, 1218, 1220, 1220, 1220, 1219, 1224, 1224, 1224, 1226,
+  1226, 1226, 880, 1226, 879, 870, 1226, 869, 1213, 864,
+  1220, 1229, 1229, 1229, 1224, 1234, 1234, 1234, 1235, 1235,
+  1235, 863, 1235, 861, 847, 1235, 1236, 1236, 1236, 1229,
+  844, 1218, 1234, 1237, 1237, 1237, 839, 838, 1220, 833,
+  1238, 1238, 1238, 1236, 1240, 1240, 1240, 1241, 1241, 1241,
+  1237, 1242, 1242, 1242, 1245, 1245, 1245, 1224, 1238, 1229,
+  1246, 1246, 1246, 1248, 1248, 1248, 1250, 1250, 1250, 1251,
+
+  1251, 1251, 1252, 1252, 1252, 1253, 1253, 1253, 1254, 1254,
+  1254, 828, 1236, 1256, 1256, 1256, 1258, 1258, 1258, 1261,
+  1261, 1261, 1265, 1265, 1265, 827, 1237, 1266, 1266, 1266,
+  1238, 1267, 1267, 1267, 1258, 1267, 826, 1261, 1267, 822,
+  1265, 1278, 1278, 1278, 1266, 1279, 1279, 1279, 810, 1279,
+  809, 808, 1279, 1282, 1282, 1282, 1283, 1283, 1283, 1278,
+  1283, 807, 798, 1283, 1258, 1284, 1284, 1284, 797, 1284,
+  1282, 792, 1284, 1287, 1287, 1287, 784, 1287, 783, 782,
+  1287, 1290, 1290, 1290, 1297, 1297, 1297, 1278, 1297, 781,
+  777, 1297, 772, 1300, 1300, 1300, 767, 1300, 766, 1290,
+
+  1300, 1303, 1303, 1303, 1304, 1304, 1304, 765, 1304, 757,
+  755, 1304, 1305, 1305, 1305, 749, 1305, 740, 1303, 1305,
+  1308, 1308, 1308, 1309, 1309, 1309, 1311, 1311, 1311, 1312,
+  1312, 1312, 1290, 1312, 735, 724, 1312, 723, 1308, 722,
+  721, 1309, 719, 1311, 1318, 1318, 1318, 717, 1318, 716,
+  715, 1318, 1321, 1321, 1321, 1323, 1323, 1323, 1324, 1324,
+  1324, 714, 1324, 713, 712, 1324, 1327, 1327, 1327, 1321,
+  1328, 1328, 1328, 1323, 1330, 1330, 1330, 1331, 1331, 1331,
+  1308, 711, 709, 1327, 1334, 1334, 1334, 708, 1328, 1337,
+  1337, 1337, 1330, 706, 1331, 1336, 1336, 1336, 1321, 1340,
+
+  1340, 1340, 1334, 705, 1341, 1341, 1341, 1337, 1341, 704,
+  1323, 1341, 703, 1336, 1344, 1344, 1344, 1345, 1345, 1345,
+  702, 701, 1327, 1346, 1346, 1346, 1347, 1347, 1347, 700,
+  695, 1344, 694, 693, 1345, 692, 1330, 1348, 1348, 1348,
+  689, 1346, 1349, 1349, 1349, 1334, 1350, 1350, 1350, 688,
+  687, 1336, 1351, 1351, 1351, 1352, 1352, 1352, 1353, 1353,
+  1353, 1356, 1356, 1356, 1357, 1357, 1357, 1344, 1358, 1358,
+  1358, 1360, 1360, 1360, 1362, 1362, 1362, 685, 1346, 1345,
+  1365, 1365, 1365, 1367, 1367, 1367, 1369, 1369, 1369, 681,
+  1369, 678, 1362, 1369, 1382, 1382, 1382, 1365, 1383, 1383,
+
+  1383, 1367, 1383, 677, 674, 1383, 1386, 1386, 1386, 1395,
+  1395, 1395, 1382, 1395, 673, 672, 1395, 1398, 1398, 1398,
+  1399, 1399, 1399, 671, 1386, 1401, 1401, 1401, 663, 1402,
+  1402, 1402, 661, 1402, 658, 1398, 1402, 657, 1399, 1416,
+  1416, 1416, 1401, 1417, 1417, 1417, 1418, 1418, 1418, 654,
+  651, 1382, 1423, 1423, 1423, 650, 1416, 1424, 1424, 1424,
+  1425, 1425, 1425, 649, 1418, 1427, 1427, 1427, 1401, 1423,
+  646, 639, 1426, 1426, 1426, 1424, 1426, 1425, 638, 1426,
+  637, 636, 1427, 1429, 1429, 1429, 1430, 1430, 1430, 1431,
+  1431, 1431, 1432, 1432, 1432, 1423, 1435, 1435, 1435, 627,
+
+  622, 1429, 1436, 1436, 1436, 621, 620, 1431, 619, 1418,
+  1432, 616, 613, 1424, 1437, 1437, 1437, 610, 609, 1436,
+  1438, 1438, 1438, 1439, 1439, 1439, 1440, 1440, 1440, 608,
+  603, 1437, 1441, 1441, 1441, 1446, 1446, 1446, 1438, 1449,
+  1449, 1449, 1450, 1450, 1450, 602, 1450, 601, 600, 1450,
+  1432, 1431, 597, 1446, 595, 591, 1449, 1462, 1462, 1462,
+  587, 586, 1437, 1463, 1463, 1463, 1472, 1472, 1472, 1473,
+  1473, 1473, 1475, 1475, 1475, 1462, 583, 580, 1476, 1476,
+  1476, 1463, 1476, 1472, 579, 1476, 578, 1473, 577, 1475,
+  1484, 1484, 1484, 1491, 1491, 1491, 1492, 1492, 1492, 576,
+
+  1492, 575, 574, 1492, 1493, 1493, 1493, 1484, 573, 572,
+  1491, 571, 570, 1462, 1494, 1494, 1494, 1501, 1501, 1501,
+  1502, 1502, 1502, 1503, 1503, 1503, 569, 1503, 568, 567,
+  1503, 566, 1494, 565, 1501, 1506, 1506, 1506, 1502, 1507,
+  1507, 1507, 564, 1507, 563, 562, 1507, 561, 1508, 1508,
+  1508, 560, 1506, 1509, 1509, 1509, 1511, 1511, 1511, 1512,
+  1512, 1512, 559, 558, 1501, 1508, 557, 556, 1494, 555,
+  552, 1509, 1516, 1516, 1516, 551, 550, 1512, 1501, 1517,
+  1517, 1517, 548, 1517, 547, 546, 1517, 545, 544, 1516,
+  1518, 1518, 1518, 1519, 1519, 1519, 1525, 1525, 1525, 1526,
+
+  1526, 1526, 540, 1526, 538, 537, 1526, 1518, 1540, 1540,
+  1540, 1519, 536, 1525, 1546, 1546, 1546, 1547, 1547, 1547,
+  535, 1547, 532, 531, 1547, 530, 1540, 529, 1548, 1548,
+  1548, 1546, 1548, 528, 527, 1548, 1556, 1556, 1556, 1557,
+  1557, 1557, 524, 1557, 520, 519, 1557, 1564, 1564, 1564,
+  518, 1564, 517, 1556, 1564, 1567, 1567, 1567, 1574, 1574,
+  1574, 1575, 1575, 1575, 1540, 1576, 1576, 1576, 516, 513,
+  1578, 1578, 1578, 1567, 1578, 1574, 512, 1578, 1575, 1581,
+  1581, 1581, 511, 1576, 1582, 1582, 1582, 510, 1582, 509,
+  508, 1582, 1583, 1583, 1583, 505, 1581, 1588, 1588, 1588,
+
+  504, 1588, 503, 502, 1588, 1591, 1591, 1591, 500, 497,
+  1583, 1592, 1592, 1592, 493, 1592, 492, 1567, 1592, 1574,
+  491, 1575, 1591, 1593, 1593, 1593, 1595, 1595, 1595, 1597,
+  1597, 1597, 1598, 1598, 1598, 490, 1598, 489, 488, 1598,
+  1614, 1614, 1614, 1615, 1615, 1615, 1597, 1618, 1618, 1618,
+  485, 1618, 482, 481, 1618, 1622, 1622, 1622, 1614, 477,
+  1615, 1624, 1624, 1624, 476, 1624, 475, 474, 1624, 1637,
+  1637, 1637, 1622, 1644, 1644, 1644, 1645, 1645, 1645, 1655,
+  1655, 1655, 1651, 1651, 1651, 473, 1615, 1637, 1614, 471,
+  1644, 468, 467, 1645, 1646, 1646, 1646, 464, 1646, 1651,
+
+  1651, 1646, 1652, 1652, 1652, 463, 1652, 462, 461, 1652,
+  1657, 1657, 1657, 1659, 1659, 1659, 457, 1659, 456, 455,
+  1659, 1637, 1645, 1666, 1666, 1666, 1675, 1675, 1675, 1676,
+  1676, 1676, 1677, 1677, 1677, 1644, 1677, 454, 450, 1677,
+  1666, 1682, 1682, 1682, 1675, 449, 1676, 1683, 1683, 1683,
+  448, 1683, 447, 446, 1683, 1695, 1695, 1695, 1682, 1702,
+  1702, 1702, 1703, 1703, 1703, 1705, 1705, 1705, 1706, 1706,
+  1706, 444, 1675, 1695, 441, 440, 1702, 438, 436, 1703,
+  433, 432, 1705, 1705, 429, 1706, 1706, 427, 1707, 1707,
+  1707, 424, 1707, 423, 421, 1707, 1708, 1708, 1708, 1709,
+
+  1709, 1709, 1702, 420, 419, 1703, 1707, 1714, 1714, 1714,
+  1715, 1715, 1715, 418, 1715, 417, 416, 1715, 1724, 1724,
+  1724, 1725, 1725, 1725, 1714, 1725, 413, 412, 1725, 1732,
+  1732, 1732, 411, 1733, 1733, 1733, 1724, 1733, 410, 409,
+  1733, 1736, 1736, 1736, 408, 407, 1732, 1747, 1747, 1747,
+  1755, 1755, 1755, 1756, 1756, 1756, 406, 1756, 1736, 405,
+  1756, 1757, 1757, 1757, 402, 1747, 401, 1755, 1758, 1758,
+  1758, 400, 1759, 1759, 1759, 399, 1759, 398, 1757, 1759,
+  1724, 1760, 1760, 1760, 392, 1758, 1762, 1762, 1762, 1763,
+  1763, 1763, 391, 1763, 389, 383, 1763, 379, 1760, 1767,
+
+  1767, 1767, 376, 1762, 1762, 375, 371, 1763, 370, 1764,
+  1764, 1764, 369, 1764, 368, 364, 1764, 1768, 1768, 1768,
+  358, 1773, 1773, 1773, 354, 1773, 1757, 1764, 1773, 1788,
+  1788, 1788, 351, 1788, 347, 346, 1788, 345, 1782, 1782,
+  1782, 344, 1787, 1787, 1787, 340, 1760, 1765, 1765, 1765,
+  1765, 1765, 1765, 1765, 1765, 1765, 1782, 337, 1765, 1787,
+  1789, 1789, 1789, 1765, 1765, 1765, 1765, 1765, 1790, 1790,
+  1790, 331, 1790, 330, 326, 1790, 323, 1789, 1805, 1805,
+  1805, 318, 1805, 317, 316, 1805, 1808, 1808, 1808, 1765,
+  1765, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766,
+
+  312, 306, 1766, 1808, 1812, 1812, 1812, 1766, 1766, 1766,
+  1766, 1766, 1809, 1809, 1809, 302, 1809, 296, 295, 1809,
+  293, 1812, 1814, 1814, 1814, 292, 1814, 287, 281, 1814,
+  1829, 1829, 1829, 1766, 1766, 1835, 1835, 1835, 1808, 1835,
+  1814, 280, 1835, 1838, 1838, 1838, 276, 1838, 1829, 273,
+  1838, 269, 1853, 1853, 1853, 268, 1812, 1817, 1817, 1817,
+  1817, 1817, 1817, 1817, 1817, 1817, 267, 265, 1817, 1853,
+  1854, 1854, 1854, 1817, 1817, 1817, 1817, 1817, 1861, 1861,
+  1861, 1868, 1868, 1868, 1894, 1894, 1894, 1854, 1894, 261,
+  258, 1894, 255, 1869, 1869, 1869, 1861, 1861, 1868, 1817,
+
+  1817, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
+  1869, 253, 1818, 249, 1853, 243, 242, 1818, 1818, 1818,
+  1818, 1818, 1870, 1870, 1870, 1871, 1871, 1871, 1884, 1884,
+  1884, 241, 1854, 1885, 1885, 1885, 1886, 1886, 1886, 1870,
+  240, 236, 1871, 1818, 1818, 1884, 1890, 1890, 1890, 230,
+  1885, 1893, 1893, 1893, 1886, 1895, 1895, 1895, 229, 1896,
+  1896, 1896, 228, 1896, 1890, 1870, 1896, 224, 1893, 1897,
+  1897, 1897, 1895, 1898, 1898, 1898, 221, 1898, 216, 1884,
+  1898, 1900, 1900, 1900, 1885, 214, 1897, 213, 1901, 1901,
+  1901, 209, 1901, 206, 1890, 1901, 204, 203, 1900, 1906,
+
+  1906, 1906, 1907, 1907, 1907, 1908, 1908, 1908, 1912, 1912,
+  1912, 202, 1912, 198, 192, 1912, 1906, 188, 184, 1907,
+  1915, 1915, 1915, 1908, 1915, 178, 177, 1915, 1918, 1918,
+  1918, 173, 1918, 169, 168, 1918, 1922, 1922, 1922, 167,
+  1922, 1908, 1906, 1922, 161, 1907, 1929, 1929, 1929, 1930,
+  1930, 1930, 1938, 1938, 1938, 1939, 1939, 1939, 1946, 1946,
+  1946, 160, 158, 1929, 155, 143, 1930, 0, 0, 1938,
+  0, 0, 1939, 0, 0, 1946, 1947, 1947, 1947, 1949,
+  1949, 1949, 1954, 1954, 1954, 1955, 1955, 1955, 1957, 1957,
+  1957, 0, 0, 1947, 0, 0, 1949, 0, 0, 1954,
+
+  0, 0, 1955, 1929, 0, 1957, 1930, 0, 0, 1946,
+  0, 1958, 1958, 1958, 1938, 1958, 0, 1939, 1958, 1963,
+  1963, 1963, 1964, 1964, 1964, 0, 0, 1947, 0, 0,
+  1954, 0, 0, 1955, 0, 0, 1963, 0, 0, 1964,
+  1966, 1966, 1966, 0, 1966, 0, 0, 1966, 1971, 1971,
+  1971, 1972, 1972, 1972, 1973, 1973, 1973, 1974, 1974, 1974,
+  1975, 1975, 1975, 0, 0, 1971, 0, 0, 1972, 1976,
+  1976, 1976, 1973, 1976, 1974, 0, 1976, 1975, 0, 1963,
+  0, 0, 1964, 1977, 1977, 1977, 0, 1976, 1978, 1978,
+  1978, 1971, 0, 0, 1972, 1981, 1981, 1981, 0, 0,
+
+  1977, 0, 1982, 1982, 1982, 1978, 1985, 1985, 1985, 1986,
+  1986, 1986, 1981, 1989, 1989, 1989, 0, 0, 1974, 1982,
+  1975, 0, 0, 1985, 0, 0, 1986, 1990, 1990, 1990,
+  1989, 1977, 1993, 1993, 1993, 0, 1978, 0, 1994, 1994,
+  1994, 0, 1994, 0, 1990, 1994, 0, 0, 1982, 1993,
+  0, 1981, 0, 1985, 1995, 1995, 1995, 1996, 1996, 1996,
+  0, 1996, 0, 0, 1996, 1999, 1999, 1999, 0, 1999,
+  0, 1995, 1999, 1986, 2002, 2002, 2002, 0, 2002, 0,
+  0, 2002, 2019, 2019, 2019, 2020, 2020, 2020, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+  2019, 0, 0, 2020, 2023, 2023, 2023, 2023, 2023, 2023,
+  2023, 2023, 2023, 2024, 2024, 2024, 2024, 2024, 2024, 2024,
+  2024, 2024, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025,
+  2025, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026,
+  2027, 2027, 2027, 2027, 2027, 2027, 2027, 2027, 2027, 2028,
+  2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2029, 2029,
+  2029, 2029, 2029, 2029, 2029, 2029, 2029, 2030, 2030, 2030,
+  2030, 2030, 2030, 2030, 2030, 2030, 2031, 2031, 2031, 2031,
+  2031, 2031, 2031, 2031, 2031, 2032, 2032, 2032, 2032, 2032,
+  2032, 2032, 2032, 2032, 2033, 2033, 2033, 2033, 2033, 2033,
+
+  2033, 2033, 2033, 2034, 2034, 2034, 2034, 2034, 2034, 2034,
+  2034, 2034, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035,
+  2035, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036,
+  2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2038,
+  2038, 2038, 2038, 2038, 2038, 2038, 2038, 2038, 2039, 2039,
+  2039, 2039, 2039, 2039, 2039, 2039, 2039, 2040, 2040, 2040,
+  2040, 2040, 2040, 2040, 2040, 2040, 2041, 2041, 2041, 2041,
+  2041, 2041, 2041, 2041, 2041, 2042, 2042, 2042, 2042, 2042,
+  2042, 2042, 2042, 2042, 2043, 2043, 2043, 2043, 2043, 2043,
+  2043, 2043, 2043, 2044, 2044, 2044, 2044, 2044, 2044, 2044,
+
+  2044, 2044, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045,
+  2045, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046,
+  2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2048,
+  2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2049, 2049,
+  2049, 2049, 2049, 2049, 2049, 2049, 2049, 2050, 2050, 2050,
+  2050, 2050, 2050, 2050, 2050, 2050, 2051, 2051, 2051, 2051,
+  2051, 2051, 2051, 2051, 2051, 2052, 2052, 2052, 2052, 2052,
+  2052, 2052, 2052, 2052, 2053, 2053, 2053, 2053, 2053, 2053,
+  2053, 2053, 2053, 2054, 2054, 2054, 2054, 2054, 2054, 2054,
+  2054, 2054, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055,
+
+  2055, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056,
+  2057, 2057, 2057, 2057, 2057, 2057, 2057, 2057, 2057, 2058,
+  2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2059, 2059,
+  2059, 2059, 2059, 2059, 2059, 2059, 2059, 2060, 2060, 2060,
+  2060, 2060, 2060, 2060, 2060, 2060, 2061, 2061, 2061, 2061,
+  2061, 2061, 2061, 2061, 2061, 2062, 2062, 2062, 0, 0,
+  0, 2062, 2063, 2063, 2063, 0, 0, 0, 2063, 2064,
+  2064, 2064, 0, 0, 0, 2064, 2065, 2065, 2065, 0,
+  0, 0, 2065, 2066, 2066, 2066, 0, 0, 0, 2066,
+  2067, 2067, 2067, 0, 0, 0, 2067, 2068, 2068, 2068,
+
+  0, 0, 0, 2068, 2069, 2069, 2069, 0, 0, 0,
+  2069, 2070, 2070, 2070, 0, 0, 0, 2070, 2071, 2071,
+  2071, 0, 0, 0, 2071, 2072, 2072, 2072, 0, 0,
+  0, 2072, 2073, 2073, 2073, 0, 0, 0, 2073, 2074,
+  2074, 2074, 0, 0, 0, 2074, 2075, 2075, 2075, 0,
+  0, 0, 2075, 2076, 2076, 2076, 0, 0, 0, 2076,
+  2077, 2077, 2077, 0, 0, 0, 2077, 2078, 2078, 2078,
+  0, 0, 0, 2078, 2079, 2079, 2079, 2079, 2079, 2079,
+  2079, 0, 2079, 2080, 0, 0, 0, 2080, 2081, 0,
+  0, 0, 2081, 2082, 0, 0, 0, 2082, 2083, 0,
+
+  0, 0, 2083, 2084, 0, 0, 0, 2084, 2085, 0,
+  0, 0, 2085, 2086, 0, 0, 0, 2086, 2087, 0,
+  0, 0, 2087, 2088, 0, 0, 0, 2088, 2089, 2089,
+  2089, 0, 0, 0, 2089, 2090, 0, 0, 0, 2090,
+  2091, 2091, 2091, 0, 0, 0, 2091, 2092, 0, 0,
+  0, 2092, 2093, 2093, 2093, 0, 0, 0, 2093, 2094,
+  0, 0, 0, 2094, 2095, 2095, 2095, 0, 0, 0,
+  2095, 2096, 0, 0, 0, 2096, 2097, 2097, 2097, 0,
+  0, 0, 2097, 2098, 0, 0, 0, 2098, 2099, 2099,
+  2099, 0, 0, 0, 2099, 2100, 0, 0, 0, 2100,
+
+  2101, 2101, 2101, 0, 0, 0, 2101, 2102, 0, 0,
+  0, 2102, 2103, 2103, 2103, 0, 0, 0, 2103, 2104,
+  0, 0, 0, 2104, 2105, 2105, 2105, 2105, 2105, 2105,
+  2105, 2105, 2105, 2106, 0, 0, 0, 0, 2106, 2107,
+  2107, 2107, 0, 0, 0, 2107, 2108, 2108, 2108, 2108,
+  0, 0, 2108, 2108, 2109, 2109, 2109, 0, 0, 0,
+  2109, 2110, 2110, 2110, 2110, 0, 0, 2110, 2110, 2111,
+  2111, 2111, 0, 0, 0, 2111, 2112, 2112, 2112, 2112,
+  0, 0, 2112, 2112, 2113, 2113, 2113, 0, 0, 0,
+  2113, 2114, 2114, 2114, 2114, 0, 0, 2114, 2114, 2115,
+
+  2115, 2115, 0, 0, 0, 2115, 2116, 2116, 2116, 2116,
+  0, 0, 2116, 2116, 2117, 2117, 2117, 0, 0, 0,
+  2117, 2118, 2118, 2118, 2118, 0, 0, 2118, 2118, 2119,
+  2119, 2119, 0, 0, 0, 2119, 2120, 2120, 2120, 2120,
+  0, 0, 2120, 2120, 2121, 2121, 2121, 0, 0, 0,
+  2121, 2122, 2122, 2122, 2122, 0, 0, 2122, 2122, 2123,
+  2123, 2123, 0, 0, 0, 2123, 2124, 2124, 2124, 2124,
+  0, 0, 2124, 2124, 2125, 2125, 2125, 0, 0, 0,
+  2125, 2126, 2126, 2126, 2126, 0, 0, 2126, 2126, 2127,
+  2127, 2127, 2127, 0, 0, 2127, 2127, 2128, 2128, 2128,
+
+  0, 0, 0, 2128, 2129, 2129, 2129, 2129, 0, 0,
+  2129, 2129, 2130, 2130, 2130, 0, 0, 0, 2130, 2131,
+  2131, 2131, 2131, 0, 0, 2131, 2131, 2132, 2132, 2132,
+  0, 0, 0, 2132, 2133, 2133, 2133, 2133, 0, 0,
+  2133, 2133, 2134, 2134, 2134, 2134, 0, 0, 2134, 2134,
+  2135, 2135, 2135, 0, 0, 0, 2135, 2136, 2136, 2136,
+  2136, 0, 0, 2136, 2136, 2137, 2137, 2137, 0, 0,
+  0, 2137, 2138, 2138, 2138, 2138, 0, 0, 2138, 2138,
+  2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2140,
+  0, 2140, 0, 0, 2140, 2141, 2141, 2141, 0, 0,
+
+  0, 2141, 2142, 2142, 2142, 2142, 0, 0, 2142, 2142,
+  2143, 2143, 2143, 2143, 0, 2143, 0, 2143, 2144, 2144,
+  2144, 2144, 0, 0, 2144, 2144, 2145, 2145, 2145, 2145,
+  0, 2145, 0, 2145, 2146, 2146, 2146, 2146, 0, 0,
+  2146, 2146, 2147, 2147, 2147, 0, 0, 0, 2147, 2148,
+  2148, 2148, 2148, 0, 0, 2148, 2148, 2149, 2149, 2149,
+  0, 0, 0, 2149, 2150, 2150, 2150, 2150, 0, 0,
+  2150, 2150, 2151, 2151, 2151, 0, 0, 0, 2151, 2152,
+  2152, 2152, 2152, 0, 0, 2152, 2152, 2153, 2153, 2153,
+  0, 0, 0, 2153, 2154, 2154, 2154, 2154, 0, 0,
+
+  2154, 2154, 2155, 2155, 2155, 0, 0, 0, 2155, 2156,
+  2156, 2156, 2156, 0, 0, 2156, 2156, 2157, 2157, 2157,
+  0, 0, 0, 2157, 2158, 2158, 2158, 2158, 0, 0,
+  2158, 2158, 2159, 2159, 2159, 0, 0, 0, 2159, 2160,
+  2160, 2160, 2160, 0, 0, 2160, 2160, 2161, 2161, 2161,
+  2161, 0, 0, 2161, 2161, 2162, 2162, 2162, 0, 0,
+  0, 2162, 2163, 2163, 2163, 2163, 0, 0, 2163, 2163,
+  2164, 2164, 2164, 0, 0, 0, 2164, 2165, 2165, 2165,
+  2165, 0, 0, 2165, 2165, 2166, 2166, 2166, 0, 0,
+  0, 2166, 2167, 2167, 2167, 2167, 0, 0, 2167, 2167,
+
+  2168, 2168, 2168, 2168, 0, 0, 2168, 2168, 2169, 2169,
+  2169, 0, 0, 0, 2169, 2170, 2170, 2170, 2170, 0,
+  0, 2170, 2170, 2171, 2171, 2171, 0, 0, 0, 2171,
+  2172, 2172, 2172, 2172, 0, 0, 2172, 2172, 2173, 2173,
+  2173, 2173, 2173, 2173, 2173, 2173, 2173, 2174, 2174, 2174,
+  2174, 2174, 2174, 2174, 2174, 2174, 2175, 2175, 2175, 0,
+  0, 0, 2175, 2176, 2176, 2176, 2176, 0, 0, 2176,
+  2176, 2177, 2177, 2177, 2177, 0, 0, 2177, 2177, 2178,
+  2178, 2178, 0, 0, 0, 2178, 2179, 2179, 2179, 2179,
+  0, 0, 2179, 2179, 2180, 2180, 2180, 0, 0, 0,
+
+  2180, 2181, 2181, 2181, 2181, 0, 0, 2181, 2181, 2182,
+  2182, 2182, 0, 0, 0, 2182, 2183, 2183, 2183, 2183,
+  0, 0, 2183, 2183, 2184, 2184, 2184, 0, 0, 0,
+  2184, 2185, 2185, 2185, 2185, 0, 0, 2185, 2185, 2186,
+  2186, 2186, 0, 0, 0, 2186, 2187, 2187, 2187, 2187,
+  0, 0, 2187, 2187, 2188, 2188, 2188, 0, 0, 0,
+  2188, 2189, 2189, 2189, 2189, 0, 0, 2189, 2189, 2190,
+  2190, 2190, 2190, 0, 2190, 0, 2190, 2191, 2191, 2191,
+  2191, 0, 0, 2191, 2191, 2192, 2192, 2192, 2192, 0,
+  2192, 0, 2192, 2193, 2193, 2193, 2193, 0, 0, 2193,
+
+  2193, 2194, 2194, 2194, 2194, 0, 0, 2194, 2194, 2195,
+  2195, 2195, 0, 0, 0, 2195, 2196, 2196, 2196, 2196,
+  0, 0, 2196, 2196, 2197, 2197, 2197, 0, 0, 0,
+  2197, 2198, 2198, 2198, 2198, 0, 0, 2198, 2198, 2199,
+  2199, 2199, 0, 0, 0, 2199, 2200, 2200, 2200, 2200,
+  0, 0, 2200, 2200, 2201, 2201, 2201, 2201, 0, 0,
+  2201, 2201, 2202, 2202, 2202, 0, 0, 0, 2202, 2203,
+  2203, 2203, 2203, 0, 0, 2203, 2203, 2204, 2204, 2204,
+  2204, 0, 2204, 0, 2204, 2205, 2205, 2205, 2205, 0,
+  0, 2205, 2205, 2206, 2206, 2206, 2206, 2206, 2206, 2206,
+
+  2206, 2206, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207,
+  2207, 2208, 2208, 2208, 0, 0, 0, 2208, 2209, 2209,
+  2209, 2209, 0, 0, 2209, 2209, 2210, 2210, 2210, 2210,
+  0, 0, 2210, 2210, 2211, 2211, 2211, 0, 0, 0,
+  2211, 2212, 2212, 2212, 2212, 0, 0, 2212, 2212, 2213,
+  2213, 2213, 0, 0, 0, 2213, 2214, 2214, 2214, 2214,
+  0, 0, 2214, 2214, 2215, 2215, 2215, 0, 0, 0,
+  2215, 2216, 2216, 2216, 2216, 0, 0, 2216, 2216, 2217,
+  2217, 2217, 2217, 0, 2217, 0, 2217, 2218, 2218, 2218,
+  2218, 0, 2218, 0, 2218, 2219, 2219, 2219, 2219, 0,
+
+  0, 2219, 2219, 2220, 2220, 2220, 0, 0, 0, 2220,
+  2221, 2221, 2221, 2221, 0, 0, 2221, 2221, 2222, 2222,
+  2222, 2222, 0, 0, 2222, 2222, 2223, 2223, 2223, 2223,
+  0, 2223, 0, 2223, 2224, 2224, 2224, 2224, 0, 0,
+  2224, 2224, 2225, 2225, 2225, 2225, 0, 0, 2225, 2225,
+  2226, 2226, 2226, 0, 0, 0, 2226, 2227, 2227, 2227,
+  2227, 0, 0, 2227, 2227, 2228, 2228, 2228, 2228, 0,
+  2228, 0, 2228, 2229, 2229, 2229, 2229, 0, 0, 2229,
+  2229, 2230, 2230, 2230, 2230, 0, 2230, 0, 2230, 2231,
+  2231, 2231, 2231, 0, 0, 2231, 2231, 2232, 2232, 2232,
+
+  2232, 0, 0, 2232, 2232, 2233, 2233, 2233, 0, 0,
+  0, 2233, 2234, 2234, 2234, 2234, 0, 0, 2234, 2234,
+  2235, 2235, 2235, 2235, 0, 0, 2235, 2235, 2236, 2236,
+  2236, 2236, 2236, 2236, 2236, 2236, 2236, 2237, 2237, 2237,
+  2237, 2237, 2237, 2237, 2237, 2237, 2238, 2238, 2238, 2238,
+  0, 2238, 0, 2238, 2239, 2239, 2239, 2239, 0, 0,
+  2239, 2239, 2240, 2240, 2240, 2240, 0, 0, 2240, 2240,
+  2241, 2241, 2241, 0, 0, 0, 2241, 2242, 2242, 2242,
+  2242, 0, 0, 2242, 2242, 2243, 2243, 2243, 0, 0,
+  0, 2243, 2244, 2244, 2244, 2244, 0, 0, 2244, 2244,
+
+  2245, 2245, 2245, 2245, 0, 2245, 0, 2245, 2246, 2246,
+  2246, 2246, 0, 0, 2246, 2246, 2247, 2247, 2247, 2247,
+  0, 2247, 0, 2247, 2248, 2248, 2248, 2248, 0, 0,
+  2248, 2248, 2249, 2249, 2249, 0, 0, 0, 2249, 2250,
+  2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2251, 2251,
+  2251, 2251, 2251, 2251, 2251, 2251, 2251, 2252, 2252, 2252,
+  2252, 2252, 2252, 2252, 2252, 2252, 2253, 2253, 2253, 2253,
+  2253, 2253, 2253, 2253, 2253, 2254, 2254, 2254, 2254, 2254,
+  2254, 2254, 2254, 2254, 2255, 2255, 2255, 2255, 2255, 2255,
+  2255, 2255, 2255, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022,
+  2022, 2022, 2022
+};
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[352] =
-    {   0,
-0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 
-    1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 
-    1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 
-    1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 
-    1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 
-    0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 
-    0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 
-    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 
-    0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 
-    1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 
-    1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 
-    1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,     };
+static yyconst flex_int32_t yy_rule_can_match_eol[352] = { 0,
+  0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
+  1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+  1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+  1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1,
+  1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1,
+  0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1,
+  0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1,
+  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+  0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+  1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1,
+  1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+  1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+};
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -2849,18 +2840,18 @@ char *surf_parse_text;
 
 /* Version strings. */
 const char rcs_surfxml_flexml_skeleton[] =
- "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
 "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
 const char rcs_surfxml_flexml[] =
- "$" "Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp $";
 "$" "Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp $";
 
 /* ANSI headers. */
-#include <stdlib.h> /* for realloc() -- needed here when using flex 2.5.4 */
+#include <stdlib.h>             /* for realloc() -- needed here when using flex 2.5.4 */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 #include <stdarg.h>
 #include <ctype.h>
-     
+
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
 # ifndef __STRICT_ANSI__
 #  include <io.h>
@@ -2869,7 +2860,7 @@ const char rcs_surfxml_flexml[] =
 #else
 # include <unistd.h>
 #endif
-     
+
 #ifndef FLEXML_INDEXSTACKSIZE
 #define FLEXML_INDEXSTACKSIZE 1000
 #endif
@@ -2972,11 +2963,13 @@ AT_surfxml_trace_periodicity AX_surfxml_trace_periodicity;
 #define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity)
 AT_surfxml_foreach_set_id AX_surfxml_foreach_set_id;
 #define A_surfxml_foreach_set_id (surfxml_bufferstack + AX_surfxml_foreach_set_id)
-AT_surfxml_route_impact_on_dst_with_other_send AX_surfxml_route_impact_on_dst_with_other_send;
+AT_surfxml_route_impact_on_dst_with_other_send
+  AX_surfxml_route_impact_on_dst_with_other_send;
 #define A_surfxml_route_impact_on_dst_with_other_send (surfxml_bufferstack + AX_surfxml_route_impact_on_dst_with_other_send)
 AT_surfxml_prop_value AX_surfxml_prop_value;
 #define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value)
-AT_surfxml_route_impact_on_src_with_other_recv AX_surfxml_route_impact_on_src_with_other_recv;
+AT_surfxml_route_impact_on_src_with_other_recv
+  AX_surfxml_route_impact_on_src_with_other_recv;
 #define A_surfxml_route_impact_on_src_with_other_recv (surfxml_bufferstack + AX_surfxml_route_impact_on_src_with_other_recv)
 AT_surfxml_link_state_file AX_surfxml_link_state_file;
 #define A_surfxml_link_state_file (surfxml_bufferstack + AX_surfxml_link_state_file)
@@ -3028,9 +3021,9 @@ AT_surfxml_platform_version AX_surfxml_platform_version;
 # define ENTER(state)  debug_enter(state,#state)
 # define LEAVE         debug_leave()
 # define SET(state)    debug_set(state,#state)
-  static void debug_enter(int, const char*);
-  static void debug_leave(void);
-  static void debug_set(int, const char*);
+static void debug_enter(int, const char *);
+static void debug_leave(void);
+static void debug_set(int, const char *);
 #else
 # define ENTER(state)  (yy_push_state(state))
 # define LEAVE         (yy_pop_state())
@@ -3038,21 +3031,22 @@ AT_surfxml_platform_version AX_surfxml_platform_version;
 #endif
 
 /* Generic actions. */
-#define SKIP   /*skip*/
+#define SKIP                    /*skip */
 #define SUCCEED        CLEANUP; return 0
 
 #define FAIL   return fail
-static int fail(const char*, ...);
+static int fail(const char *, ...);
 
-enum {flexml_max_err_msg_size = 512};
+enum { flexml_max_err_msg_size = 512 };
 static char flexml_err_msg[flexml_max_err_msg_size];
-const char * surfxml_parse_err_msg()
+const char *surfxml_parse_err_msg()
 {
-    return flexml_err_msg;
+  return flexml_err_msg;
 }
+
 static void reset_surfxml_parse_err_msg()
 {
-    flexml_err_msg[0] = '\0';
+  flexml_err_msg[0] = '\0';
 }
 
 /* Cleanup */
@@ -3077,39 +3071,44 @@ static int inext = 1;
 /* after this is called, there are at least 2 slots left in the stack */
 static int ck_blimit()
 {
-     if (bnext >= blimit) {
-        blimit += FLEXML_BUFFERSTACKSIZE + 2;
-        {
-            char *temp = (char *) realloc(surfxml_bufferstack, blimit);
-            assert(temp);
-            surfxml_bufferstack = temp;
-        }
-     }
-     return 0;
+  if (bnext >= blimit) {
+    blimit += FLEXML_BUFFERSTACKSIZE + 2;
+    {
+      char *temp = (char *) realloc(surfxml_bufferstack, blimit);
+      assert(temp);
+      surfxml_bufferstack = temp;
+    }
+  }
+  return 0;
 }
 
 /* after this is called, there are at least 2 slots left in the stack */
 static int ck_ilimit()
 {
-     if (inext >= ilimit) {
-        ilimit += FLEXML_INDEXSTACKSIZE + 2;
-        {
-            int *temp = (int *) realloc(indexstack, ilimit);
-            assert(temp);
-            indexstack = temp;
-        }
-     }
-     return 0;
+  if (inext >= ilimit) {
+    ilimit += FLEXML_INDEXSTACKSIZE + 2;
+    {
+      int *temp = (int *) realloc(indexstack, ilimit);
+      assert(temp);
+      indexstack = temp;
+    }
+  }
+  return 0;
 }
 
 #ifdef FLEXML_NEED_BUFFERLIT
-static void surfxml_bufferliteral(char c, int* pp, const char* text)
+static void surfxml_bufferliteral(char c, int *pp, const char *text)
 {
-  const char *s = (c ? strchr(text,c) : text-1), *e = strrchr(text,c);
-  assert(s <= e); BUFFERSET(*pp);
-  while (++s<e) {
-    if (isspace(*s) && c) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
-    else BUFFERPUTC(*s);
+  const char *s = (c ? strchr(text, c) : text - 1), *e = strrchr(text, c);
+  assert(s <= e);
+  BUFFERSET(*pp);
+  while (++s < e) {
+    if (isspace(*s) && c) {
+      BUFFERPUTC(' ');
+      while (isspace(*s))
+        ++s;
+    } else
+      BUFFERPUTC(*s);
   }
   BUFFERDONE;
 }
@@ -3117,16 +3116,16 @@ static void surfxml_bufferliteral(char c, int* pp, const char* text)
 
 static void pushbuffer(int p)
 {
-    ck_ilimit();
-    indexstack[inext++] = p;
-    indexstack[inext++] = bnext;    
+  ck_ilimit();
+  indexstack[inext++] = p;
+  indexstack[inext++] = bnext;
 }
 
 static int popbuffer(void)
 {
-    assert(inext >= 2);
-    bnext = indexstack[--inext];
-    return indexstack[--inext];
+  assert(inext >= 2);
+  bnext = indexstack[--inext];
+  return indexstack[--inext];
 }
 
 /* General internal entities are `unput' back onto the input stream... */
@@ -3158,7 +3157,7 @@ static int popbuffer(void)
  */
 
 /* State names. */
-const char* *surfxml_statenames=NULL;
+const char **surfxml_statenames = NULL;
 
 #define INITIAL 0
 #define PROLOG 1
@@ -3251,36 +3250,36 @@ const char* *surfxml_statenames=NULL;
 #define YY_EXTRA_TYPE void *
 #endif
 
-static int yy_init_globals (void );
+static int yy_init_globals(void);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int surf_parse_lex_destroy (void );
+int surf_parse_lex_destroy(void);
 
-int surf_parse_get_debug (void );
+int surf_parse_get_debug(void);
 
-void surf_parse_set_debug (int debug_flag  );
+void surf_parse_set_debug(int debug_flag);
 
-YY_EXTRA_TYPE surf_parse_get_extra (void );
+YY_EXTRA_TYPE surf_parse_get_extra(void);
 
-void surf_parse_set_extra (YY_EXTRA_TYPE user_defined  );
+void surf_parse_set_extra(YY_EXTRA_TYPE user_defined);
 
-FILE *surf_parse_get_in (void );
+FILE *surf_parse_get_in(void);
 
-void surf_parse_set_in  (FILE * in_str  );
+void surf_parse_set_in(FILE * in_str);
 
-FILE *surf_parse_get_out (void );
+FILE *surf_parse_get_out(void);
 
-void surf_parse_set_out  (FILE * out_str  );
+void surf_parse_set_out(FILE * out_str);
 
-int surf_parse_get_leng (void );
+int surf_parse_get_leng(void);
 
-char *surf_parse_get_text (void );
+char *surf_parse_get_text(void);
 
-int surf_parse_get_lineno (void );
+int surf_parse_get_lineno(void);
 
-void surf_parse_set_lineno (int line_number  );
+void surf_parse_set_lineno(int line_number);
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -3288,38 +3287,38 @@ void surf_parse_set_lineno (int line_number  );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int surf_parse_wrap (void );
+extern "C" int surf_parse_wrap(void);
 #else
-extern int surf_parse_wrap (void );
+extern int surf_parse_wrap(void);
 #endif
 #endif
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
+static void yy_flex_strncpy(char *, yyconst char *, int);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
+static int yy_flex_strlen(yyconst char *);
 #endif
 
 #ifndef YY_NO_INPUT
 
 #ifdef __cplusplus
-static int yyinput (void );
+static int yyinput(void);
 #else
-static int input (void );
+static int input(void);
 #endif
 
 #endif
 
-        static int yy_start_stack_ptr = 0;
-        static int yy_start_stack_depth = 0;
-        static int *yy_start_stack = NULL;
-    
-    static void yy_push_state (int new_state );
-    
-    static void yy_pop_state (void );
-    
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = NULL;
+
+static void yy_push_state(int new_state);
+
+static void yy_pop_state(void);
+
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
 #define YY_READ_BUF_SIZE 8192
@@ -3395,7 +3394,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int surf_parse_lex (void);
+extern int surf_parse_lex(void);
 
 #define YY_DECL int surf_parse_lex (void)
 #endif /* !YY_DECL */
@@ -3417,29 +3416,28 @@ extern int surf_parse_lex (void);
 
 /** The main scanner function which does all the work.
  */
-YY_DECL
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp, *yy_bp;
-       register int yy_act;
-    
- /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
- SET(PROLOG);
- reset_surfxml_parse_err_msg();
- surfxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
- assert(surfxml_bufferstack);
- #ifdef FLEX_DEBUG
- {
-     int i;
-     for (i = 0; i < blimit; i++) {
-         surfxml_bufferstack[i] = '\377';
-     }
- }
- #endif
- surfxml_bufferstack[0] = '\0';
- indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
- assert(indexstack);
- indexstack[0] = 0;
+YY_DECL {
+  register yy_state_type yy_current_state;
+  register char *yy_cp, *yy_bp;
+  register int yy_act;
+
+  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
+  SET(PROLOG);
+  reset_surfxml_parse_err_msg();
+  surfxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
+  assert(surfxml_bufferstack);
+#ifdef FLEX_DEBUG
+  {
+    int i;
+    for (i = 0; i < blimit; i++) {
+      surfxml_bufferstack[i] = '\377';
+    }
+  }
+#endif
+  surfxml_bufferstack[0] = '\0';
+  indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
+  assert(indexstack);
+  indexstack[0] = 0;
 
   /* FleXML_init */
   bnext = inext = 1;
@@ -3458,2524 +3456,2293 @@ YY_DECL
   surfxml_bufferliteral('\0', &bnext, "0.0");
   surfxml_bufferliteral('\0', &bnext, "-1.0");
   surfxml_bufferliteral('\0', &bnext, "-1.0");
-  if(!surfxml_statenames) {surfxml_statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
-  surfxml_statenames[PROLOG] = NULL;
-  surfxml_statenames[DOCTYPE] = NULL;
-  surfxml_statenames[EPILOG] = NULL;
-  surfxml_statenames[INCOMMENT] = NULL;
-  surfxml_statenames[INPI] = NULL;
-  surfxml_statenames[VALUE1] = NULL;
-  surfxml_statenames[VALUE2] = NULL;
-  surfxml_statenames[CDATA] = NULL;
-  surfxml_statenames[ROOT_surfxml_platform] = NULL;
-  surfxml_statenames[AL_surfxml_platform] = NULL;
-  surfxml_statenames[S_surfxml_platform] = "platform";
-  surfxml_statenames[S_surfxml_platform_1] = "platform";
-  surfxml_statenames[S_surfxml_platform_2] = "platform";
-  surfxml_statenames[S_surfxml_platform_3] = "platform";
-  surfxml_statenames[S_surfxml_platform_4] = "platform";
-  surfxml_statenames[S_surfxml_platform_5] = "platform";
-  surfxml_statenames[E_surfxml_platform] = "platform";
-  surfxml_statenames[AL_surfxml_include] = NULL;
-  surfxml_statenames[E_surfxml_include] = "include";
-  surfxml_statenames[AL_surfxml_trace] = NULL;
-  surfxml_statenames[IN_trace] = "trace";
-  surfxml_statenames[AL_surfxml_random] = NULL;
-  surfxml_statenames[S_surfxml_random] = "random";
-  surfxml_statenames[S_surfxml_random_1] = "random";
-  surfxml_statenames[S_surfxml_random_2] = "random";
-  surfxml_statenames[E_surfxml_random] = "random";
-  surfxml_statenames[AL_surfxml_trace_c_connect] = NULL;
-  surfxml_statenames[E_surfxml_trace_c_connect] = "trace:connect";
-  surfxml_statenames[AL_surfxml_set] = NULL;
-  surfxml_statenames[E_surfxml_set] = "set";
-  surfxml_statenames[AL_surfxml_foreach] = NULL;
-  surfxml_statenames[S_surfxml_foreach] = "foreach";
-  surfxml_statenames[S_surfxml_foreach_1] = "foreach";
-  surfxml_statenames[E_surfxml_foreach] = "foreach";
-  surfxml_statenames[AL_surfxml_host] = NULL;
-  surfxml_statenames[S_surfxml_host] = "host";
-  surfxml_statenames[S_surfxml_host_1] = "host";
-  surfxml_statenames[S_surfxml_host_2] = "host";
-  surfxml_statenames[E_surfxml_host] = "host";
-  surfxml_statenames[AL_surfxml_prop] = NULL;
-  surfxml_statenames[E_surfxml_prop] = "prop";
-  surfxml_statenames[AL_surfxml_cluster] = NULL;
-  surfxml_statenames[E_surfxml_cluster] = "cluster";
-  surfxml_statenames[AL_surfxml_router] = NULL;
-  surfxml_statenames[E_surfxml_router] = "router";
-  surfxml_statenames[AL_surfxml_link] = NULL;
-  surfxml_statenames[S_surfxml_link] = "link";
-  surfxml_statenames[S_surfxml_link_1] = "link";
-  surfxml_statenames[S_surfxml_link_2] = "link";
-  surfxml_statenames[E_surfxml_link] = "link";
-  surfxml_statenames[AL_surfxml_route_c_multi] = NULL;
-  surfxml_statenames[S_surfxml_route_c_multi] = "route:multi";
-  surfxml_statenames[S_surfxml_route_c_multi_1] = "route:multi";
-  surfxml_statenames[S_surfxml_route_c_multi_2] = "route:multi";
-  surfxml_statenames[E_surfxml_route_c_multi] = "route:multi";
-  surfxml_statenames[AL_surfxml_route] = NULL;
-  surfxml_statenames[S_surfxml_route] = "route";
-  surfxml_statenames[S_surfxml_route_1] = "route";
-  surfxml_statenames[S_surfxml_route_2] = "route";
-  surfxml_statenames[E_surfxml_route] = "route";
-  surfxml_statenames[AL_surfxml_link_c_ctn] = NULL;
-  surfxml_statenames[E_surfxml_link_c_ctn] = "link:ctn";
-  surfxml_statenames[AL_surfxml_process] = NULL;
-  surfxml_statenames[S_surfxml_process] = "process";
-  surfxml_statenames[S_surfxml_process_1] = "process";
-  surfxml_statenames[S_surfxml_process_2] = "process";
-  surfxml_statenames[E_surfxml_process] = "process";
-  surfxml_statenames[AL_surfxml_argument] = NULL;
-  surfxml_statenames[E_surfxml_argument] = "argument";
+  if (!surfxml_statenames) {
+    surfxml_statenames = (const char **) calloc(IMPOSSIBLE, sizeof(char *));
+    surfxml_statenames[PROLOG] = NULL;
+    surfxml_statenames[DOCTYPE] = NULL;
+    surfxml_statenames[EPILOG] = NULL;
+    surfxml_statenames[INCOMMENT] = NULL;
+    surfxml_statenames[INPI] = NULL;
+    surfxml_statenames[VALUE1] = NULL;
+    surfxml_statenames[VALUE2] = NULL;
+    surfxml_statenames[CDATA] = NULL;
+    surfxml_statenames[ROOT_surfxml_platform] = NULL;
+    surfxml_statenames[AL_surfxml_platform] = NULL;
+    surfxml_statenames[S_surfxml_platform] = "platform";
+    surfxml_statenames[S_surfxml_platform_1] = "platform";
+    surfxml_statenames[S_surfxml_platform_2] = "platform";
+    surfxml_statenames[S_surfxml_platform_3] = "platform";
+    surfxml_statenames[S_surfxml_platform_4] = "platform";
+    surfxml_statenames[S_surfxml_platform_5] = "platform";
+    surfxml_statenames[E_surfxml_platform] = "platform";
+    surfxml_statenames[AL_surfxml_include] = NULL;
+    surfxml_statenames[E_surfxml_include] = "include";
+    surfxml_statenames[AL_surfxml_trace] = NULL;
+    surfxml_statenames[IN_trace] = "trace";
+    surfxml_statenames[AL_surfxml_random] = NULL;
+    surfxml_statenames[S_surfxml_random] = "random";
+    surfxml_statenames[S_surfxml_random_1] = "random";
+    surfxml_statenames[S_surfxml_random_2] = "random";
+    surfxml_statenames[E_surfxml_random] = "random";
+    surfxml_statenames[AL_surfxml_trace_c_connect] = NULL;
+    surfxml_statenames[E_surfxml_trace_c_connect] = "trace:connect";
+    surfxml_statenames[AL_surfxml_set] = NULL;
+    surfxml_statenames[E_surfxml_set] = "set";
+    surfxml_statenames[AL_surfxml_foreach] = NULL;
+    surfxml_statenames[S_surfxml_foreach] = "foreach";
+    surfxml_statenames[S_surfxml_foreach_1] = "foreach";
+    surfxml_statenames[E_surfxml_foreach] = "foreach";
+    surfxml_statenames[AL_surfxml_host] = NULL;
+    surfxml_statenames[S_surfxml_host] = "host";
+    surfxml_statenames[S_surfxml_host_1] = "host";
+    surfxml_statenames[S_surfxml_host_2] = "host";
+    surfxml_statenames[E_surfxml_host] = "host";
+    surfxml_statenames[AL_surfxml_prop] = NULL;
+    surfxml_statenames[E_surfxml_prop] = "prop";
+    surfxml_statenames[AL_surfxml_cluster] = NULL;
+    surfxml_statenames[E_surfxml_cluster] = "cluster";
+    surfxml_statenames[AL_surfxml_router] = NULL;
+    surfxml_statenames[E_surfxml_router] = "router";
+    surfxml_statenames[AL_surfxml_link] = NULL;
+    surfxml_statenames[S_surfxml_link] = "link";
+    surfxml_statenames[S_surfxml_link_1] = "link";
+    surfxml_statenames[S_surfxml_link_2] = "link";
+    surfxml_statenames[E_surfxml_link] = "link";
+    surfxml_statenames[AL_surfxml_route_c_multi] = NULL;
+    surfxml_statenames[S_surfxml_route_c_multi] = "route:multi";
+    surfxml_statenames[S_surfxml_route_c_multi_1] = "route:multi";
+    surfxml_statenames[S_surfxml_route_c_multi_2] = "route:multi";
+    surfxml_statenames[E_surfxml_route_c_multi] = "route:multi";
+    surfxml_statenames[AL_surfxml_route] = NULL;
+    surfxml_statenames[S_surfxml_route] = "route";
+    surfxml_statenames[S_surfxml_route_1] = "route";
+    surfxml_statenames[S_surfxml_route_2] = "route";
+    surfxml_statenames[E_surfxml_route] = "route";
+    surfxml_statenames[AL_surfxml_link_c_ctn] = NULL;
+    surfxml_statenames[E_surfxml_link_c_ctn] = "link:ctn";
+    surfxml_statenames[AL_surfxml_process] = NULL;
+    surfxml_statenames[S_surfxml_process] = "process";
+    surfxml_statenames[S_surfxml_process_1] = "process";
+    surfxml_statenames[S_surfxml_process_2] = "process";
+    surfxml_statenames[E_surfxml_process] = "process";
+    surfxml_statenames[AL_surfxml_argument] = NULL;
+    surfxml_statenames[E_surfxml_argument] = "argument";
   }
 
- /* COMMENTS and PIs: handled uniformly for efficiency. */
 /* COMMENTS and PIs: handled uniformly for efficiency. */
 
-       if ( !(yy_init) )
-               {
-               (yy_init) = 1;
+  if (!(yy_init)) {
+    (yy_init) = 1;
 
 #ifdef YY_USER_INIT
-               YY_USER_INIT;
+    YY_USER_INIT;
 #endif
 
-               if ( ! (yy_start) )
-                       (yy_start) = 1; /* first start state */
-
-               if ( ! surf_parse_in )
-                       surf_parse_in = stdin;
-
-               if ( ! surf_parse_out )
-                       surf_parse_out = stdout;
-
-               if ( ! YY_CURRENT_BUFFER ) {
-                       surf_parse_ensure_buffer_stack ();
-                       YY_CURRENT_BUFFER_LVALUE =
-                               surf_parse__create_buffer(surf_parse_in,YY_BUF_SIZE );
-               }
-
-               surf_parse__load_buffer_state( );
-               }
-
-       while ( 1 )             /* loops until end-of-file is reached */
-               {
-               yy_cp = (yy_c_buf_p);
-
-               /* Support of surf_parse_text. */
-               *yy_cp = (yy_hold_char);
-
-               /* yy_bp points to the position in yy_ch_buf of the start of
-                * the current run.
-                */
-               yy_bp = yy_cp;
-
-               yy_current_state = (yy_start);
-yy_match:
-               do
-                       {
-                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
-                       if ( yy_accept[yy_current_state] )
-                               {
-                               (yy_last_accepting_state) = yy_current_state;
-                               (yy_last_accepting_cpos) = yy_cp;
-                               }
-                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                               {
-                               yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 2023 )
-                                       yy_c = yy_meta[(unsigned int) yy_c];
-                               }
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-                       ++yy_cp;
-                       }
-               while ( yy_base[yy_current_state] != 7094 );
-
-yy_find_action:
-               yy_act = yy_accept[yy_current_state];
-               if ( yy_act == 0 )
-                       { /* have to back up */
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       yy_act = yy_accept[yy_current_state];
-                       }
-
-               YY_DO_BEFORE_ACTION;
-
-               if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
-                       {
-                       int yyl;
-                       for ( yyl = 0; yyl < surf_parse_leng; ++yyl )
-                               if ( surf_parse_text[yyl] == '\n' )
-                                          
-    surf_parse_lineno++;
-;
-                       }
-
-do_action:     /* This label is used only to access EOF actions. */
-
-               switch ( yy_act )
-       { /* beginning of action switch */
-                       case 0: /* must back up */
-                       /* undo the effects of YY_DO_BEFORE_ACTION */
-                       *yy_cp = (yy_hold_char);
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-ENTER(INCOMMENT);
-       YY_BREAK
-case 2:
-YY_RULE_SETUP
-ENTER(INPI);
-       YY_BREAK
-
-case 3:
-YY_RULE_SETUP
-LEAVE;
-       YY_BREAK
-case 4:
-case 5:
-case 6:
+    if (!(yy_start))
+      (yy_start) = 1;           /* first start state */
+
+    if (!surf_parse_in)
+      surf_parse_in = stdin;
+
+    if (!surf_parse_out)
+      surf_parse_out = stdout;
+
+    if (!YY_CURRENT_BUFFER) {
+      surf_parse_ensure_buffer_stack();
+      YY_CURRENT_BUFFER_LVALUE =
+        surf_parse__create_buffer(surf_parse_in, YY_BUF_SIZE);
+    }
+
+    surf_parse__load_buffer_state();
+  }
+
+  while (1) {                   /* loops until end-of-file is reached */
+    yy_cp = (yy_c_buf_p);
+
+    /* Support of surf_parse_text. */
+    *yy_cp = (yy_hold_char);
+
+    /* yy_bp points to the position in yy_ch_buf of the start of
+     * the current run.
+     */
+    yy_bp = yy_cp;
+
+    yy_current_state = (yy_start);
+  yy_match:
+    do {
+      register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+      if (yy_accept[yy_current_state]) {
+        (yy_last_accepting_state) = yy_current_state;
+        (yy_last_accepting_cpos) = yy_cp;
+      }
+      while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+        yy_current_state = (int) yy_def[yy_current_state];
+        if (yy_current_state >= 2023)
+          yy_c = yy_meta[(unsigned int) yy_c];
+      }
+      yy_current_state =
+        yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+      ++yy_cp;
+    }
+    while (yy_base[yy_current_state] != 7094);
+
+  yy_find_action:
+    yy_act = yy_accept[yy_current_state];
+    if (yy_act == 0) {          /* have to back up */
+      yy_cp = (yy_last_accepting_cpos);
+      yy_current_state = (yy_last_accepting_state);
+      yy_act = yy_accept[yy_current_state];
+    }
+
+    YY_DO_BEFORE_ACTION;
+
+    if (yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]) {
+      int yyl;
+      for (yyl = 0; yyl < surf_parse_leng; ++yyl)
+        if (surf_parse_text[yyl] == '\n')
+
+          surf_parse_lineno++;
+      ;
+    }
+
+  do_action:                   /* This label is used only to access EOF actions. */
+
+    switch (yy_act) {           /* beginning of action switch */
+    case 0:                    /* must back up */
+      /* undo the effects of YY_DO_BEFORE_ACTION */
+      *yy_cp = (yy_hold_char);
+      yy_cp = (yy_last_accepting_cpos);
+      yy_current_state = (yy_last_accepting_state);
+      goto yy_find_action;
+
+    case 1:
+      YY_RULE_SETUP ENTER(INCOMMENT);
+      YY_BREAK case 2:YY_RULE_SETUP ENTER(INPI);
+      YY_BREAK case 3:YY_RULE_SETUP LEAVE;
+      YY_BREAK case 4:case 5:case 6:
 /* rule 6 can match eol */
-YY_RULE_SETUP
-SKIP;
-       YY_BREAK
-case YY_STATE_EOF(INCOMMENT):
-FAIL("EOF in comment.");
-       YY_BREAK
-
-case 7:
-YY_RULE_SETUP
-LEAVE;
-       YY_BREAK
-case 8:
-case 9:
+        YY_RULE_SETUP SKIP;
+      YY_BREAK case YY_STATE_EOF(INCOMMENT):FAIL("EOF in comment.");
+      YY_BREAK case 7:YY_RULE_SETUP LEAVE;
+      YY_BREAK case 8:case 9:
 /* rule 9 can match eol */
-YY_RULE_SETUP
-SKIP;
-       YY_BREAK
-case YY_STATE_EOF(INPI):
-FAIL("EOF in PI (processing instruction).");
-       YY_BREAK
-
+        YY_RULE_SETUP SKIP;
+      YY_BREAK case
+        YY_STATE_EOF(INPI):FAIL("EOF in PI (processing instruction).");
+      YY_BREAK
 /* SPACES: skipped uniformly */
-case 10:
+    case 10:
 /* rule 10 can match eol */
-YY_RULE_SETUP
-SKIP;
-       YY_BREAK
+      YY_RULE_SETUP SKIP;
+      YY_BREAK
 /* PROLOG: determine root element and process it. */
-
-case 11:
+    case 11:
 /* rule 11 can match eol */
-YY_RULE_SETUP
-SET(DOCTYPE); 
-       YY_BREAK
-case 12:
+      YY_RULE_SETUP SET(DOCTYPE);
+      YY_BREAK case 12:
 /* rule 12 can match eol */
-YY_RULE_SETUP
-FAIL("Bad declaration %s.",surf_parse_text);
-       YY_BREAK
-
-case 13:
+        YY_RULE_SETUP FAIL("Bad declaration %s.", surf_parse_text);
+      YY_BREAK case 13:
 /* rule 13 can match eol */
-YY_RULE_SETUP
-SET(ROOT_surfxml_platform);
-       YY_BREAK
-case 14:
+        YY_RULE_SETUP SET(ROOT_surfxml_platform);
+      YY_BREAK case 14:
 /* rule 14 can match eol */
-YY_RULE_SETUP
-FAIL("Bad declaration %s.",surf_parse_text);
-       YY_BREAK
-case 15:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in prolog.", surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(PROLOG):
-case YY_STATE_EOF(DOCTYPE):
-FAIL("EOF in prolog.");
-       YY_BREAK
-
+        YY_RULE_SETUP FAIL("Bad declaration %s.", surf_parse_text);
+      YY_BREAK case 15:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in prolog.", surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(PROLOG):case
+        YY_STATE_EOF(DOCTYPE):FAIL("EOF in prolog.");
+      YY_BREAK
 /* RULES DERIVED FROM DTD. */
 /* <!-- Small DTD for SURF based tools. -->  */
-case 16:
+    case 16:
 /* rule 16 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <platform> is not allowed here.");
-       YY_BREAK
-case 17:
+      YY_RULE_SETUP FAIL("Starting tag <platform> is not allowed here.");
+      YY_BREAK case 17:
 /* rule 17 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_platform_version = 1;
-  AX_surfxml_platform_xmlns_c_link = 5;
-  AX_surfxml_platform_xmlns_c_route = 37;
-  ENTER(AL_surfxml_platform); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 18:
+        YY_RULE_SETUP {
+        AX_surfxml_platform_version = 1;
+        AX_surfxml_platform_xmlns_c_link = 5;
+        AX_surfxml_platform_xmlns_c_route = 37;
+        ENTER(AL_surfxml_platform);
+        pushbuffer(0);
+      } YY_BREAK case 18:
 /* rule 18 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_version);
-       YY_BREAK
-case 19:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_platform_version);
+      YY_BREAK case 19:
 /* rule 19 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_version);
-       YY_BREAK
-case 20:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_platform_version);
+      YY_BREAK case 20:
 /* rule 20 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_xmlns_c_link);
-       YY_BREAK
-case 21:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_platform_xmlns_c_link);
+      YY_BREAK case 21:
 /* rule 21 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_xmlns_c_link);
-       YY_BREAK
-case 22:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_platform_xmlns_c_link);
+      YY_BREAK case 22:
 /* rule 22 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_platform_xmlns_c_route);
-       YY_BREAK
-case 23:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_platform_xmlns_c_route);
+      YY_BREAK case 23:
 /* rule 23 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_platform_xmlns_c_route);
-       YY_BREAK
-case 24:
-YY_RULE_SETUP
-{
-  LEAVE; STag_surfxml_platform();surfxml_pcdata_ix = 0; ENTER(S_surfxml_platform);
- }
-       YY_BREAK
-case 25:
-YY_RULE_SETUP
-{
-  LEAVE; STag_surfxml_platform(); surfxml_pcdata_ix = 0; ETag_surfxml_platform(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case ROOT_surfxml_platform: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 26:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of platform element.", surf_parse_text[0]);
-       YY_BREAK
-case 27:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `platform' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_platform):
-FAIL("EOF in attribute list of `platform' element.");
-       YY_BREAK
-
-case 28:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_platform_xmlns_c_route);
+      YY_BREAK case 24:YY_RULE_SETUP {
+        LEAVE;
+        STag_surfxml_platform();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_platform);
+      } YY_BREAK case 25:YY_RULE_SETUP {
+        LEAVE;
+        STag_surfxml_platform();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_platform();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case ROOT_surfxml_platform:
+          SET(EPILOG);
+          break;
+      }} YY_BREAK case 26:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of platform element.",
+         surf_parse_text[0]);
+      YY_BREAK case 27:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `platform' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_platform):FAIL
+        ("EOF in attribute list of `platform' element.");
+      YY_BREAK case 28:
 /* rule 28 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_platform();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case ROOT_surfxml_platform: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 29:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_platform();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case ROOT_surfxml_platform:
+          SET(EPILOG);
+          break;
+      }} YY_BREAK case 29:
 /* rule 29 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</platform>' expected.",surf_parse_text);
-       YY_BREAK
-case 30:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</platform>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_platform_5):
-case YY_STATE_EOF(S_surfxml_platform_1):
-case YY_STATE_EOF(S_surfxml_platform_3):
-case YY_STATE_EOF(S_surfxml_platform):
-case YY_STATE_EOF(E_surfxml_platform):
-FAIL("Premature EOF: `</platform>' expected.");
-       YY_BREAK
-
-case 31:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</platform>' expected.",
+             surf_parse_text);
+      YY_BREAK case 30:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</platform>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_platform_5):case
+        YY_STATE_EOF(S_surfxml_platform_1):case
+        YY_STATE_EOF(S_surfxml_platform_3):case
+        YY_STATE_EOF(S_surfxml_platform):case
+        YY_STATE_EOF(E_surfxml_platform):FAIL
+        ("Premature EOF: `</platform>' expected.");
+      YY_BREAK case 31:
 /* rule 31 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <include> is not allowed here.");
-       YY_BREAK
-case 32:
+        YY_RULE_SETUP FAIL("Starting tag <include> is not allowed here.");
+      YY_BREAK case 32:
 /* rule 32 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_include_file = 0;
-  ENTER(AL_surfxml_include); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 33:
+        YY_RULE_SETUP {
+        AX_surfxml_include_file = 0;
+        ENTER(AL_surfxml_include);
+        pushbuffer(0);
+      } YY_BREAK case 33:
 /* rule 33 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_include_file);
-       YY_BREAK
-case 34:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_include_file);
+      YY_BREAK case 34:
 /* rule 34 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_include_file);
-       YY_BREAK
-case 35:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
-  LEAVE; STag_surfxml_include();surfxml_pcdata_ix = 0; ENTER(E_surfxml_include);
- }
-       YY_BREAK
-case 36:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element.");
-  LEAVE; STag_surfxml_include(); surfxml_pcdata_ix = 0; ETag_surfxml_include(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-   case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 37:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of include element.", surf_parse_text[0]);
-       YY_BREAK
-case 38:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `include' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_include):
-FAIL("EOF in attribute list of `include' element.");
-       YY_BREAK
-
-case 39:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_include_file);
+      YY_BREAK case 35:YY_RULE_SETUP {
+        if (!AX_surfxml_include_file)
+          FAIL("Required attribute `file' not set for `include' element.");
+        LEAVE;
+        STag_surfxml_include();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_include);
+      } YY_BREAK case 36:YY_RULE_SETUP {
+        if (!AX_surfxml_include_file)
+          FAIL("Required attribute `file' not set for `include' element.");
+        LEAVE;
+        STag_surfxml_include();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_include();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+          case S_surfxml_platform_2:SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 37:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of include element.",
+         surf_parse_text[0]);
+      YY_BREAK case 38:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `include' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_include):FAIL
+        ("EOF in attribute list of `include' element.");
+      YY_BREAK case 39:
 /* rule 39 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_include();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-   case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 40:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_include();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+          case S_surfxml_platform_2:SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 40:
 /* rule 40 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</include>' expected.",surf_parse_text);
-       YY_BREAK
-case 41:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</include>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_include):
-FAIL("Premature EOF: `</include>' expected.");
-       YY_BREAK
-
-case 42:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</include>' expected.",
+             surf_parse_text);
+      YY_BREAK case 41:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</include>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_include):FAIL
+        ("Premature EOF: `</include>' expected.");
+      YY_BREAK case 42:
 /* rule 42 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <trace> is not allowed here.");
-       YY_BREAK
-case 43:
+        YY_RULE_SETUP FAIL("Starting tag <trace> is not allowed here.");
+      YY_BREAK case 43:
 /* rule 43 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_trace_id = 0;
-  AX_surfxml_trace_file = 0;
-  AX_surfxml_trace_periodicity = 0;
-  ENTER(AL_surfxml_trace); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 44:
+        YY_RULE_SETUP {
+        AX_surfxml_trace_id = 0;
+        AX_surfxml_trace_file = 0;
+        AX_surfxml_trace_periodicity = 0;
+        ENTER(AL_surfxml_trace);
+        pushbuffer(0);
+      } YY_BREAK case 44:
 /* rule 44 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_id);
-       YY_BREAK
-case 45:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_trace_id);
+      YY_BREAK case 45:
 /* rule 45 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_id);
-       YY_BREAK
-case 46:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_trace_id);
+      YY_BREAK case 46:
 /* rule 46 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_file);
-       YY_BREAK
-case 47:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_trace_file);
+      YY_BREAK case 47:
 /* rule 47 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_file);
-       YY_BREAK
-case 48:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_trace_file);
+      YY_BREAK case 48:
 /* rule 48 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_periodicity);
-       YY_BREAK
-case 49:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_trace_periodicity);
+      YY_BREAK case 49:
 /* rule 49 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_periodicity);
-       YY_BREAK
-case 50:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_trace_id) FAIL("Required attribute `id' not set for `trace' element.");
-  if (!AX_surfxml_trace_periodicity) FAIL("Required attribute `periodicity' not set for `trace' element.");
-  LEAVE; STag_surfxml_trace();pushbuffer(surfxml_pcdata_ix); BUFFERSET(surfxml_pcdata_ix);; ENTER(IN_trace);
- }
-       YY_BREAK
-case 51:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_trace_id) FAIL("Required attribute `id' not set for `trace' element.");
-  if (!AX_surfxml_trace_periodicity) FAIL("Required attribute `periodicity' not set for `trace' element.");
-  LEAVE; STag_surfxml_trace(); surfxml_pcdata_ix = 0; ETag_surfxml_trace(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 52:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of trace element.", surf_parse_text[0]);
-       YY_BREAK
-case 53:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `trace' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_trace):
-FAIL("EOF in attribute list of `trace' element.");
-       YY_BREAK
-
-case 54:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_trace_periodicity);
+      YY_BREAK case 50:YY_RULE_SETUP {
+        if (!AX_surfxml_trace_id)
+          FAIL("Required attribute `id' not set for `trace' element.");
+        if (!AX_surfxml_trace_periodicity)
+          FAIL
+            ("Required attribute `periodicity' not set for `trace' element.");
+        LEAVE;
+        STag_surfxml_trace();
+        pushbuffer(surfxml_pcdata_ix);
+        BUFFERSET(surfxml_pcdata_ix);;
+        ENTER(IN_trace);
+      } YY_BREAK case 51:YY_RULE_SETUP {
+        if (!AX_surfxml_trace_id)
+          FAIL("Required attribute `id' not set for `trace' element.");
+        if (!AX_surfxml_trace_periodicity)
+          FAIL
+            ("Required attribute `periodicity' not set for `trace' element.");
+        LEAVE;
+        STag_surfxml_trace();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_trace();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 52:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of trace element.",
+             surf_parse_text[0]);
+      YY_BREAK case 53:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `trace' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_trace):FAIL
+        ("EOF in attribute list of `trace' element.");
+      YY_BREAK case 54:
 /* rule 54 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  BUFFERDONE;
-  ETag_surfxml_trace();
-  surfxml_pcdata_ix = popbuffer();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 55:
+        YY_RULE_SETUP {
+        LEAVE;
+        BUFFERDONE;
+        ETag_surfxml_trace();
+        surfxml_pcdata_ix = popbuffer();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 55:
 /* rule 55 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</trace>' expected.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(IN_trace):
-FAIL("Premature EOF: `</trace>' expected.");
-       YY_BREAK
-
-case 56:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</trace>' expected.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(IN_trace):FAIL("Premature EOF: `</trace>' expected.");
+      YY_BREAK case 56:
 /* rule 56 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <random> is not allowed here.");
-       YY_BREAK
-case 57:
+        YY_RULE_SETUP FAIL("Starting tag <random> is not allowed here.");
+      YY_BREAK case 57:
 /* rule 57 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_random_id = 0;
-  AX_surfxml_random_min = 0;
-  AX_surfxml_random_max = 0;
-  AX_surfxml_random_mean = 0;
-  AX_surfxml_random_std_deviation = 0;
-  AX_surfxml_random_generator = A_surfxml_random_generator_DRAND48;
-  ENTER(AL_surfxml_random); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 58:
+        YY_RULE_SETUP {
+        AX_surfxml_random_id = 0;
+        AX_surfxml_random_min = 0;
+        AX_surfxml_random_max = 0;
+        AX_surfxml_random_mean = 0;
+        AX_surfxml_random_std_deviation = 0;
+        AX_surfxml_random_generator = A_surfxml_random_generator_DRAND48;
+        ENTER(AL_surfxml_random);
+        pushbuffer(0);
+      } YY_BREAK case 58:
 /* rule 58 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_random_id);
-       YY_BREAK
-case 59:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_random_id);
+      YY_BREAK case 59:
 /* rule 59 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_random_id);
-       YY_BREAK
-case 60:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_random_id);
+      YY_BREAK case 60:
 /* rule 60 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_random_min);
-       YY_BREAK
-case 61:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_random_min);
+      YY_BREAK case 61:
 /* rule 61 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_random_min);
-       YY_BREAK
-case 62:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_random_min);
+      YY_BREAK case 62:
 /* rule 62 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_random_max);
-       YY_BREAK
-case 63:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_random_max);
+      YY_BREAK case 63:
 /* rule 63 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_random_max);
-       YY_BREAK
-case 64:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_random_max);
+      YY_BREAK case 64:
 /* rule 64 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_random_mean);
-       YY_BREAK
-case 65:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_random_mean);
+      YY_BREAK case 65:
 /* rule 65 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_random_mean);
-       YY_BREAK
-case 66:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_random_mean);
+      YY_BREAK case 66:
 /* rule 66 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_random_std_deviation);
-       YY_BREAK
-case 67:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_random_std_deviation);
+      YY_BREAK case 67:
 /* rule 67 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_random_std_deviation);
-       YY_BREAK
-case 68:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_random_std_deviation);
+      YY_BREAK case 68:
 /* rule 68 can match eol */
-case 69:
+      case 69:
 /* rule 69 can match eol */
-YY_RULE_SETUP
-A_surfxml_random_generator = A_surfxml_random_generator_DRAND48;
-       YY_BREAK
-case 70:
+       
+        YY_RULE_SETUP
+        A_surfxml_random_generator = A_surfxml_random_generator_DRAND48;
+      YY_BREAK case 70:
 /* rule 70 can match eol */
-case 71:
+      case 71:
 /* rule 71 can match eol */
-YY_RULE_SETUP
-A_surfxml_random_generator = A_surfxml_random_generator_RAND;
-       YY_BREAK
-case 72:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_random_id) FAIL("Required attribute `id' not set for `random' element.");
-  if (!AX_surfxml_random_min) FAIL("Required attribute `min' not set for `random' element.");
-  if (!AX_surfxml_random_max) FAIL("Required attribute `max' not set for `random' element.");
-  if (!AX_surfxml_random_mean) FAIL("Required attribute `mean' not set for `random' element.");
-  if (!AX_surfxml_random_std_deviation) FAIL("Required attribute `std_deviation' not set for `random' element.");
-  LEAVE; STag_surfxml_random();surfxml_pcdata_ix = 0; ENTER(S_surfxml_random);
- }
-       YY_BREAK
-case 73:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_random_id) FAIL("Required attribute `id' not set for `random' element.");
-  if (!AX_surfxml_random_min) FAIL("Required attribute `min' not set for `random' element.");
-  if (!AX_surfxml_random_max) FAIL("Required attribute `max' not set for `random' element.");
-  if (!AX_surfxml_random_mean) FAIL("Required attribute `mean' not set for `random' element.");
-  if (!AX_surfxml_random_std_deviation) FAIL("Required attribute `std_deviation' not set for `random' element.");
-  LEAVE; STag_surfxml_random(); surfxml_pcdata_ix = 0; ETag_surfxml_random(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 74:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of random element.", surf_parse_text[0]);
-       YY_BREAK
-case 75:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `random' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_random):
-FAIL("EOF in attribute list of `random' element.");
-       YY_BREAK
-
-case 76:
+       
+        YY_RULE_SETUP
+        A_surfxml_random_generator = A_surfxml_random_generator_RAND;
+      YY_BREAK case 72:YY_RULE_SETUP {
+        if (!AX_surfxml_random_id)
+          FAIL("Required attribute `id' not set for `random' element.");
+        if (!AX_surfxml_random_min)
+          FAIL("Required attribute `min' not set for `random' element.");
+        if (!AX_surfxml_random_max)
+          FAIL("Required attribute `max' not set for `random' element.");
+        if (!AX_surfxml_random_mean)
+          FAIL("Required attribute `mean' not set for `random' element.");
+        if (!AX_surfxml_random_std_deviation)
+          FAIL
+            ("Required attribute `std_deviation' not set for `random' element.");
+        LEAVE;
+        STag_surfxml_random();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_random);
+      } YY_BREAK case 73:YY_RULE_SETUP {
+        if (!AX_surfxml_random_id)
+          FAIL("Required attribute `id' not set for `random' element.");
+        if (!AX_surfxml_random_min)
+          FAIL("Required attribute `min' not set for `random' element.");
+        if (!AX_surfxml_random_max)
+          FAIL("Required attribute `max' not set for `random' element.");
+        if (!AX_surfxml_random_mean)
+          FAIL("Required attribute `mean' not set for `random' element.");
+        if (!AX_surfxml_random_std_deviation)
+          FAIL
+            ("Required attribute `std_deviation' not set for `random' element.");
+        LEAVE;
+        STag_surfxml_random();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_random();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 74:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of random element.",
+             surf_parse_text[0]);
+      YY_BREAK case 75:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `random' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_random):FAIL
+        ("EOF in attribute list of `random' element.");
+      YY_BREAK case 76:
 /* rule 76 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_random();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 77:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_random();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 77:
 /* rule 77 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</random>' expected.",surf_parse_text);
-       YY_BREAK
-case 78:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</random>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_random_2):
-case YY_STATE_EOF(S_surfxml_random):
-case YY_STATE_EOF(E_surfxml_random):
-FAIL("Premature EOF: `</random>' expected.");
-       YY_BREAK
-
-case 79:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</random>' expected.",
+             surf_parse_text);
+      YY_BREAK case 78:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</random>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_random_2):case
+        YY_STATE_EOF(S_surfxml_random):case
+        YY_STATE_EOF(E_surfxml_random):FAIL
+        ("Premature EOF: `</random>' expected.");
+      YY_BREAK case 79:
 /* rule 79 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <trace:connect> is not allowed here.");
-       YY_BREAK
-case 80:
+       
+        YY_RULE_SETUP
+        FAIL("Starting tag <trace:connect> is not allowed here.");
+      YY_BREAK case 80:
 /* rule 80 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_HOST_AVAIL;
-  AX_surfxml_trace_c_connect_trace = 0;
-  AX_surfxml_trace_c_connect_element = 0;
-  ENTER(AL_surfxml_trace_c_connect); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 81:
+        YY_RULE_SETUP {
+        AX_surfxml_trace_c_connect_kind =
+          A_surfxml_trace_c_connect_kind_HOST_AVAIL;
+        AX_surfxml_trace_c_connect_trace = 0;
+        AX_surfxml_trace_c_connect_element = 0;
+        ENTER(AL_surfxml_trace_c_connect);
+        pushbuffer(0);
+      } YY_BREAK case 81:
 /* rule 81 can match eol */
-case 82:
+      case 82:
 /* rule 82 can match eol */
-YY_RULE_SETUP
-A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_HOST_AVAIL;
-       YY_BREAK
-case 83:
+       
+        YY_RULE_SETUP
+        A_surfxml_trace_c_connect_kind =
+        A_surfxml_trace_c_connect_kind_HOST_AVAIL;
+      YY_BREAK case 83:
 /* rule 83 can match eol */
-case 84:
+      case 84:
 /* rule 84 can match eol */
-YY_RULE_SETUP
-A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_POWER;
-       YY_BREAK
-case 85:
+       
+        YY_RULE_SETUP
+        A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_POWER;
+      YY_BREAK case 85:
 /* rule 85 can match eol */
-case 86:
+      case 86:
 /* rule 86 can match eol */
-YY_RULE_SETUP
-A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_LINK_AVAIL;
-       YY_BREAK
-case 87:
+       
+        YY_RULE_SETUP
+        A_surfxml_trace_c_connect_kind =
+        A_surfxml_trace_c_connect_kind_LINK_AVAIL;
+      YY_BREAK case 87:
 /* rule 87 can match eol */
-case 88:
+      case 88:
 /* rule 88 can match eol */
-YY_RULE_SETUP
-A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_BANDWIDTH;
-       YY_BREAK
-case 89:
+       
+        YY_RULE_SETUP
+        A_surfxml_trace_c_connect_kind =
+        A_surfxml_trace_c_connect_kind_BANDWIDTH;
+      YY_BREAK case 89:
 /* rule 89 can match eol */
-case 90:
+      case 90:
 /* rule 90 can match eol */
-YY_RULE_SETUP
-A_surfxml_trace_c_connect_kind = A_surfxml_trace_c_connect_kind_LATENCY;
-       YY_BREAK
-case 91:
+       
+        YY_RULE_SETUP
+        A_surfxml_trace_c_connect_kind =
+        A_surfxml_trace_c_connect_kind_LATENCY;
+      YY_BREAK case 91:
 /* rule 91 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_c_connect_trace);
-       YY_BREAK
-case 92:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_trace_c_connect_trace);
+      YY_BREAK case 92:
 /* rule 92 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_c_connect_trace);
-       YY_BREAK
-case 93:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_trace_c_connect_trace);
+      YY_BREAK case 93:
 /* rule 93 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_trace_c_connect_element);
-       YY_BREAK
-case 94:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_trace_c_connect_element);
+      YY_BREAK case 94:
 /* rule 94 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_trace_c_connect_element);
-       YY_BREAK
-case 95:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_trace_c_connect_trace) FAIL("Required attribute `trace' not set for `trace:connect' element.");
-  if (!AX_surfxml_trace_c_connect_element) FAIL("Required attribute `element' not set for `trace:connect' element.");
-  LEAVE; STag_surfxml_trace_c_connect();surfxml_pcdata_ix = 0; ENTER(E_surfxml_trace_c_connect);
- }
-       YY_BREAK
-case 96:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_trace_c_connect_trace) FAIL("Required attribute `trace' not set for `trace:connect' element.");
-  if (!AX_surfxml_trace_c_connect_element) FAIL("Required attribute `element' not set for `trace:connect' element.");
-  LEAVE; STag_surfxml_trace_c_connect(); surfxml_pcdata_ix = 0; ETag_surfxml_trace_c_connect(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-   case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 97:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of trace:connect element.", surf_parse_text[0]);
-       YY_BREAK
-case 98:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `trace:connect' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_trace_c_connect):
-FAIL("EOF in attribute list of `trace:connect' element.");
-       YY_BREAK
-
-case 99:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_trace_c_connect_element);
+      YY_BREAK case 95:YY_RULE_SETUP {
+        if (!AX_surfxml_trace_c_connect_trace)
+          FAIL
+            ("Required attribute `trace' not set for `trace:connect' element.");
+        if (!AX_surfxml_trace_c_connect_element)
+          FAIL
+            ("Required attribute `element' not set for `trace:connect' element.");
+        LEAVE;
+        STag_surfxml_trace_c_connect();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_trace_c_connect);
+      } YY_BREAK case 96:YY_RULE_SETUP {
+        if (!AX_surfxml_trace_c_connect_trace)
+          FAIL
+            ("Required attribute `trace' not set for `trace:connect' element.");
+        if (!AX_surfxml_trace_c_connect_element)
+          FAIL
+            ("Required attribute `element' not set for `trace:connect' element.");
+        LEAVE;
+        STag_surfxml_trace_c_connect();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_trace_c_connect();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+          case S_surfxml_platform_2:SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 97:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of trace:connect element.",
+         surf_parse_text[0]);
+      YY_BREAK case 98:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `trace:connect' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_trace_c_connect):FAIL
+        ("EOF in attribute list of `trace:connect' element.");
+      YY_BREAK case 99:
 /* rule 99 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_trace_c_connect();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-   case S_surfxml_platform_2: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 100:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_trace_c_connect();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+          case S_surfxml_platform_2:SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 100:
 /* rule 100 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</trace:connect>' expected.",surf_parse_text);
-       YY_BREAK
-case 101:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</trace:connect>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_trace_c_connect):
-FAIL("Premature EOF: `</trace:connect>' expected.");
-       YY_BREAK
-
-case 102:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</trace:connect>' expected.",
+             surf_parse_text);
+      YY_BREAK case 101:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</trace:connect>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_trace_c_connect):FAIL
+        ("Premature EOF: `</trace:connect>' expected.");
+      YY_BREAK case 102:
 /* rule 102 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <set> is not allowed here.");
-       YY_BREAK
-case 103:
+        YY_RULE_SETUP FAIL("Starting tag <set> is not allowed here.");
+      YY_BREAK case 103:
 /* rule 103 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_set_id = 0;
-  AX_surfxml_set_prefix = 0;
-  AX_surfxml_set_suffix = 0;
-  AX_surfxml_set_radical = 0;
-  ENTER(AL_surfxml_set); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 104:
+        YY_RULE_SETUP {
+        AX_surfxml_set_id = 0;
+        AX_surfxml_set_prefix = 0;
+        AX_surfxml_set_suffix = 0;
+        AX_surfxml_set_radical = 0;
+        ENTER(AL_surfxml_set);
+        pushbuffer(0);
+      } YY_BREAK case 104:
 /* rule 104 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_set_id);
-       YY_BREAK
-case 105:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_set_id);
+      YY_BREAK case 105:
 /* rule 105 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_set_id);
-       YY_BREAK
-case 106:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_set_id);
+      YY_BREAK case 106:
 /* rule 106 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_set_prefix);
-       YY_BREAK
-case 107:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_set_prefix);
+      YY_BREAK case 107:
 /* rule 107 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_set_prefix);
-       YY_BREAK
-case 108:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_set_prefix);
+      YY_BREAK case 108:
 /* rule 108 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_set_suffix);
-       YY_BREAK
-case 109:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_set_suffix);
+      YY_BREAK case 109:
 /* rule 109 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_set_suffix);
-       YY_BREAK
-case 110:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_set_suffix);
+      YY_BREAK case 110:
 /* rule 110 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_set_radical);
-       YY_BREAK
-case 111:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_set_radical);
+      YY_BREAK case 111:
 /* rule 111 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_set_radical);
-       YY_BREAK
-case 112:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_set_id) FAIL("Required attribute `id' not set for `set' element.");
-  if (!AX_surfxml_set_prefix) FAIL("Required attribute `prefix' not set for `set' element.");
-  if (!AX_surfxml_set_suffix) FAIL("Required attribute `suffix' not set for `set' element.");
-  if (!AX_surfxml_set_radical) FAIL("Required attribute `radical' not set for `set' element.");
-  LEAVE; STag_surfxml_set();surfxml_pcdata_ix = 0; ENTER(E_surfxml_set);
- }
-       YY_BREAK
-case 113:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_set_id) FAIL("Required attribute `id' not set for `set' element.");
-  if (!AX_surfxml_set_prefix) FAIL("Required attribute `prefix' not set for `set' element.");
-  if (!AX_surfxml_set_suffix) FAIL("Required attribute `suffix' not set for `set' element.");
-  if (!AX_surfxml_set_radical) FAIL("Required attribute `radical' not set for `set' element.");
-  LEAVE; STag_surfxml_set(); surfxml_pcdata_ix = 0; ETag_surfxml_set(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 114:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of set element.", surf_parse_text[0]);
-       YY_BREAK
-case 115:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `set' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_set):
-FAIL("EOF in attribute list of `set' element.");
-       YY_BREAK
-
-case 116:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_set_radical);
+      YY_BREAK case 112:YY_RULE_SETUP {
+        if (!AX_surfxml_set_id)
+          FAIL("Required attribute `id' not set for `set' element.");
+        if (!AX_surfxml_set_prefix)
+          FAIL("Required attribute `prefix' not set for `set' element.");
+        if (!AX_surfxml_set_suffix)
+          FAIL("Required attribute `suffix' not set for `set' element.");
+        if (!AX_surfxml_set_radical)
+          FAIL("Required attribute `radical' not set for `set' element.");
+        LEAVE;
+        STag_surfxml_set();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_set);
+      } YY_BREAK case 113:YY_RULE_SETUP {
+        if (!AX_surfxml_set_id)
+          FAIL("Required attribute `id' not set for `set' element.");
+        if (!AX_surfxml_set_prefix)
+          FAIL("Required attribute `prefix' not set for `set' element.");
+        if (!AX_surfxml_set_suffix)
+          FAIL("Required attribute `suffix' not set for `set' element.");
+        if (!AX_surfxml_set_radical)
+          FAIL("Required attribute `radical' not set for `set' element.");
+        LEAVE;
+        STag_surfxml_set();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_set();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 114:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of set element.",
+             surf_parse_text[0]);
+      YY_BREAK case 115:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `set' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_set):FAIL
+        ("EOF in attribute list of `set' element.");
+      YY_BREAK case 116:
 /* rule 116 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_set();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 117:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_set();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 117:
 /* rule 117 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</set>' expected.",surf_parse_text);
-       YY_BREAK
-case 118:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</set>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_set):
-FAIL("Premature EOF: `</set>' expected.");
-       YY_BREAK
-
-case 119:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</set>' expected.", surf_parse_text);
+      YY_BREAK case 118:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</set>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_set):FAIL("Premature EOF: `</set>' expected.");
+      YY_BREAK case 119:
 /* rule 119 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <foreach> is not allowed here.");
-       YY_BREAK
-case 120:
+        YY_RULE_SETUP FAIL("Starting tag <foreach> is not allowed here.");
+      YY_BREAK case 120:
 /* rule 120 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_foreach_set_id = 0;
-  ENTER(AL_surfxml_foreach); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 121:
+        YY_RULE_SETUP {
+        AX_surfxml_foreach_set_id = 0;
+        ENTER(AL_surfxml_foreach);
+        pushbuffer(0);
+      } YY_BREAK case 121:
 /* rule 121 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_foreach_set_id);
-       YY_BREAK
-case 122:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_foreach_set_id);
+      YY_BREAK case 122:
 /* rule 122 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_foreach_set_id);
-       YY_BREAK
-case 123:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_foreach_set_id) FAIL("Required attribute `set_id' not set for `foreach' element.");
-  LEAVE; STag_surfxml_foreach();surfxml_pcdata_ix = 0; ENTER(S_surfxml_foreach);
- }
-       YY_BREAK
-case 124:
-YY_RULE_SETUP
-FAIL("`foreach' element cannot be empty.");
-       YY_BREAK
-case 125:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of foreach element.", surf_parse_text[0]);
-       YY_BREAK
-case 126:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `foreach' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_foreach):
-FAIL("EOF in attribute list of `foreach' element.");
-       YY_BREAK
-
-case 127:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_foreach_set_id);
+      YY_BREAK case 123:YY_RULE_SETUP {
+        if (!AX_surfxml_foreach_set_id)
+          FAIL("Required attribute `set_id' not set for `foreach' element.");
+        LEAVE;
+        STag_surfxml_foreach();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_foreach);
+      } YY_BREAK case 124:YY_RULE_SETUP
+        FAIL("`foreach' element cannot be empty.");
+      YY_BREAK case 125:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of foreach element.",
+         surf_parse_text[0]);
+      YY_BREAK case 126:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `foreach' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_foreach):FAIL
+        ("EOF in attribute list of `foreach' element.");
+      YY_BREAK case 127:
 /* rule 127 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_foreach();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 128:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_foreach();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 128:
 /* rule 128 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</foreach>' expected.",surf_parse_text);
-       YY_BREAK
-case 129:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</foreach>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_foreach):
-FAIL("Premature EOF: `</foreach>' expected.");
-       YY_BREAK
-
-case 130:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</foreach>' expected.",
+             surf_parse_text);
+      YY_BREAK case 129:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</foreach>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_foreach):FAIL
+        ("Premature EOF: `</foreach>' expected.");
+      YY_BREAK case 130:
 /* rule 130 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <host> is not allowed here.");
-       YY_BREAK
-case 131:
+        YY_RULE_SETUP FAIL("Starting tag <host> is not allowed here.");
+      YY_BREAK case 131:
 /* rule 131 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_host_id = 0;
-  AX_surfxml_host_power = 0;
-  AX_surfxml_host_availability = 69;
-  AX_surfxml_host_availability_file = 0;
-  AX_surfxml_host_state = A_surfxml_host_state_ON;
-  AX_surfxml_host_state_file = 0;
-  AX_surfxml_host_interference_send = 73;
-  AX_surfxml_host_interference_recv = 77;
-  AX_surfxml_host_interference_send_recv = 81;
-  AX_surfxml_host_max_outgoing_rate = 85;
-  ENTER(AL_surfxml_host); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 132:
+        YY_RULE_SETUP {
+        AX_surfxml_host_id = 0;
+        AX_surfxml_host_power = 0;
+        AX_surfxml_host_availability = 69;
+        AX_surfxml_host_availability_file = 0;
+        AX_surfxml_host_state = A_surfxml_host_state_ON;
+        AX_surfxml_host_state_file = 0;
+        AX_surfxml_host_interference_send = 73;
+        AX_surfxml_host_interference_recv = 77;
+        AX_surfxml_host_interference_send_recv = 81;
+        AX_surfxml_host_max_outgoing_rate = 85;
+        ENTER(AL_surfxml_host);
+        pushbuffer(0);
+      } YY_BREAK case 132:
 /* rule 132 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_id);
-       YY_BREAK
-case 133:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_id);
+      YY_BREAK case 133:
 /* rule 133 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_id);
-       YY_BREAK
-case 134:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_id);
+      YY_BREAK case 134:
 /* rule 134 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_power);
-       YY_BREAK
-case 135:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_power);
+      YY_BREAK case 135:
 /* rule 135 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_power);
-       YY_BREAK
-case 136:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_power);
+      YY_BREAK case 136:
 /* rule 136 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_availability);
-       YY_BREAK
-case 137:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_availability);
+      YY_BREAK case 137:
 /* rule 137 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_availability);
-       YY_BREAK
-case 138:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_availability);
+      YY_BREAK case 138:
 /* rule 138 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_availability_file);
-       YY_BREAK
-case 139:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_availability_file);
+      YY_BREAK case 139:
 /* rule 139 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_availability_file);
-       YY_BREAK
-case 140:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_availability_file);
+      YY_BREAK case 140:
 /* rule 140 can match eol */
-case 141:
+      case 141:
 /* rule 141 can match eol */
-YY_RULE_SETUP
-A_surfxml_host_state = A_surfxml_host_state_ON;
-       YY_BREAK
-case 142:
+        YY_RULE_SETUP A_surfxml_host_state = A_surfxml_host_state_ON;
+      YY_BREAK case 142:
 /* rule 142 can match eol */
-case 143:
+      case 143:
 /* rule 143 can match eol */
-YY_RULE_SETUP
-A_surfxml_host_state = A_surfxml_host_state_OFF;
-       YY_BREAK
-case 144:
+        YY_RULE_SETUP A_surfxml_host_state = A_surfxml_host_state_OFF;
+      YY_BREAK case 144:
 /* rule 144 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_state_file);
-       YY_BREAK
-case 145:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_state_file);
+      YY_BREAK case 145:
 /* rule 145 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_state_file);
-       YY_BREAK
-case 146:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_state_file);
+      YY_BREAK case 146:
 /* rule 146 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_interference_send);
-       YY_BREAK
-case 147:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_interference_send);
+      YY_BREAK case 147:
 /* rule 147 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_interference_send);
-       YY_BREAK
-case 148:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_interference_send);
+      YY_BREAK case 148:
 /* rule 148 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_interference_recv);
-       YY_BREAK
-case 149:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_interference_recv);
+      YY_BREAK case 149:
 /* rule 149 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_interference_recv);
-       YY_BREAK
-case 150:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_interference_recv);
+      YY_BREAK case 150:
 /* rule 150 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_interference_send_recv);
-       YY_BREAK
-case 151:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_interference_send_recv);
+      YY_BREAK case 151:
 /* rule 151 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_interference_send_recv);
-       YY_BREAK
-case 152:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_interference_send_recv);
+      YY_BREAK case 152:
 /* rule 152 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_host_max_outgoing_rate);
-       YY_BREAK
-case 153:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_host_max_outgoing_rate);
+      YY_BREAK case 153:
 /* rule 153 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_host_max_outgoing_rate);
-       YY_BREAK
-case 154:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_host_id) FAIL("Required attribute `id' not set for `host' element.");
-  if (!AX_surfxml_host_power) FAIL("Required attribute `power' not set for `host' element.");
-  LEAVE; STag_surfxml_host();surfxml_pcdata_ix = 0; ENTER(S_surfxml_host);
- }
-       YY_BREAK
-case 155:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_host_id) FAIL("Required attribute `id' not set for `host' element.");
-  if (!AX_surfxml_host_power) FAIL("Required attribute `power' not set for `host' element.");
-  LEAVE; STag_surfxml_host(); surfxml_pcdata_ix = 0; ETag_surfxml_host(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-   case S_surfxml_foreach: SET(S_surfxml_foreach_1); break;
-  }
- }
-       YY_BREAK
-case 156:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of host element.", surf_parse_text[0]);
-       YY_BREAK
-case 157:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `host' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_host):
-FAIL("EOF in attribute list of `host' element.");
-       YY_BREAK
-
-case 158:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_host_max_outgoing_rate);
+      YY_BREAK case 154:YY_RULE_SETUP {
+        if (!AX_surfxml_host_id)
+          FAIL("Required attribute `id' not set for `host' element.");
+        if (!AX_surfxml_host_power)
+          FAIL("Required attribute `power' not set for `host' element.");
+        LEAVE;
+        STag_surfxml_host();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_host);
+      } YY_BREAK case 155:YY_RULE_SETUP {
+        if (!AX_surfxml_host_id)
+          FAIL("Required attribute `id' not set for `host' element.");
+        if (!AX_surfxml_host_power)
+          FAIL("Required attribute `power' not set for `host' element.");
+        LEAVE;
+        STag_surfxml_host();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_host();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+          case S_surfxml_foreach:SET(S_surfxml_foreach_1);
+          break;
+      }} YY_BREAK case 156:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of host element.",
+             surf_parse_text[0]);
+      YY_BREAK case 157:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `host' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_host):FAIL
+        ("EOF in attribute list of `host' element.");
+      YY_BREAK case 158:
 /* rule 158 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_host();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break;
-   case S_surfxml_foreach: SET(S_surfxml_foreach_1); break;
-  }
- }
-       YY_BREAK
-case 159:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_host();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform:
+          SET(S_surfxml_platform_3);
+          break;
+          case S_surfxml_foreach:SET(S_surfxml_foreach_1);
+          break;
+      }} YY_BREAK case 159:
 /* rule 159 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</host>' expected.",surf_parse_text);
-       YY_BREAK
-case 160:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</host>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_host):
-case YY_STATE_EOF(E_surfxml_host):
-case YY_STATE_EOF(S_surfxml_host_2):
-FAIL("Premature EOF: `</host>' expected.");
-       YY_BREAK
-
-case 161:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</host>' expected.", surf_parse_text);
+      YY_BREAK case 160:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</host>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_host):case
+        YY_STATE_EOF(E_surfxml_host):case
+        YY_STATE_EOF(S_surfxml_host_2):FAIL
+        ("Premature EOF: `</host>' expected.");
+      YY_BREAK case 161:
 /* rule 161 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <prop> is not allowed here.");
-       YY_BREAK
-case 162:
+        YY_RULE_SETUP FAIL("Starting tag <prop> is not allowed here.");
+      YY_BREAK case 162:
 /* rule 162 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_prop_id = 0;
-  AX_surfxml_prop_value = 0;
-  ENTER(AL_surfxml_prop); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 163:
+        YY_RULE_SETUP {
+        AX_surfxml_prop_id = 0;
+        AX_surfxml_prop_value = 0;
+        ENTER(AL_surfxml_prop);
+        pushbuffer(0);
+      } YY_BREAK case 163:
 /* rule 163 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_prop_id);
-       YY_BREAK
-case 164:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_prop_id);
+      YY_BREAK case 164:
 /* rule 164 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_prop_id);
-       YY_BREAK
-case 165:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_prop_id);
+      YY_BREAK case 165:
 /* rule 165 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_prop_value);
-       YY_BREAK
-case 166:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_prop_value);
+      YY_BREAK case 166:
 /* rule 166 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_prop_value);
-       YY_BREAK
-case 167:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_prop_id) FAIL("Required attribute `id' not set for `prop' element.");
-  if (!AX_surfxml_prop_value) FAIL("Required attribute `value' not set for `prop' element.");
-  LEAVE; STag_surfxml_prop();surfxml_pcdata_ix = 0; ENTER(E_surfxml_prop);
- }
-       YY_BREAK
-case 168:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_prop_id) FAIL("Required attribute `id' not set for `prop' element.");
-  if (!AX_surfxml_prop_value) FAIL("Required attribute `value' not set for `prop' element.");
-  LEAVE; STag_surfxml_prop(); surfxml_pcdata_ix = 0; ETag_surfxml_prop(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_random: case S_surfxml_random_2: case S_surfxml_random_1: SET(S_surfxml_random_2); break;
-   case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
-   case S_surfxml_host: case S_surfxml_host_1: case S_surfxml_host_2: SET(S_surfxml_host_2); break;
-   case S_surfxml_link_1: case S_surfxml_link_2: case S_surfxml_link: SET(S_surfxml_link_2); break;
-  }
- }
-       YY_BREAK
-case 169:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of prop element.", surf_parse_text[0]);
-       YY_BREAK
-case 170:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `prop' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_prop):
-FAIL("EOF in attribute list of `prop' element.");
-       YY_BREAK
-
-case 171:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_prop_value);
+      YY_BREAK case 167:YY_RULE_SETUP {
+        if (!AX_surfxml_prop_id)
+          FAIL("Required attribute `id' not set for `prop' element.");
+        if (!AX_surfxml_prop_value)
+          FAIL("Required attribute `value' not set for `prop' element.");
+        LEAVE;
+        STag_surfxml_prop();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_prop);
+      } YY_BREAK case 168:YY_RULE_SETUP {
+        if (!AX_surfxml_prop_id)
+          FAIL("Required attribute `id' not set for `prop' element.");
+        if (!AX_surfxml_prop_value)
+          FAIL("Required attribute `value' not set for `prop' element.");
+        LEAVE;
+        STag_surfxml_prop();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_prop();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_random:
+        case S_surfxml_random_2:
+        case S_surfxml_random_1:
+          SET(S_surfxml_random_2);
+          break;
+          case S_surfxml_process_1:case S_surfxml_process:case
+            S_surfxml_process_2:SET(S_surfxml_process_2);
+          break;
+          case S_surfxml_host:case S_surfxml_host_1:case
+            S_surfxml_host_2:SET(S_surfxml_host_2);
+          break;
+          case S_surfxml_link_1:case S_surfxml_link_2:case
+            S_surfxml_link:SET(S_surfxml_link_2);
+          break;
+      }} YY_BREAK case 169:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of prop element.",
+             surf_parse_text[0]);
+      YY_BREAK case 170:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `prop' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_prop):FAIL
+        ("EOF in attribute list of `prop' element.");
+      YY_BREAK case 171:
 /* rule 171 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_prop();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_random: case S_surfxml_random_2: case S_surfxml_random_1: SET(S_surfxml_random_2); break;
-   case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
-   case S_surfxml_host: case S_surfxml_host_1: case S_surfxml_host_2: SET(S_surfxml_host_2); break;
-   case S_surfxml_link_1: case S_surfxml_link_2: case S_surfxml_link: SET(S_surfxml_link_2); break;
-  }
- }
-       YY_BREAK
-case 172:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_prop();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_random:
+        case S_surfxml_random_2:
+        case S_surfxml_random_1:
+          SET(S_surfxml_random_2);
+          break;
+          case S_surfxml_process_1:case S_surfxml_process:case
+            S_surfxml_process_2:SET(S_surfxml_process_2);
+          break;
+          case S_surfxml_host:case S_surfxml_host_1:case
+            S_surfxml_host_2:SET(S_surfxml_host_2);
+          break;
+          case S_surfxml_link_1:case S_surfxml_link_2:case
+            S_surfxml_link:SET(S_surfxml_link_2);
+          break;
+      }} YY_BREAK case 172:
 /* rule 172 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</prop>' expected.",surf_parse_text);
-       YY_BREAK
-case 173:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</prop>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_prop):
-FAIL("Premature EOF: `</prop>' expected.");
-       YY_BREAK
-
-case 174:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</prop>' expected.", surf_parse_text);
+      YY_BREAK case 173:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</prop>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_prop):FAIL
+        ("Premature EOF: `</prop>' expected.");
+      YY_BREAK case 174:
 /* rule 174 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <cluster> is not allowed here.");
-       YY_BREAK
-case 175:
+        YY_RULE_SETUP FAIL("Starting tag <cluster> is not allowed here.");
+      YY_BREAK case 175:
 /* rule 175 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_cluster_id = 0;
-  AX_surfxml_cluster_prefix = 0;
-  AX_surfxml_cluster_suffix = 0;
-  AX_surfxml_cluster_radical = 0;
-  AX_surfxml_cluster_power = 0;
-  AX_surfxml_cluster_bw = 0;
-  AX_surfxml_cluster_lat = 0;
-  AX_surfxml_cluster_bb_bw = 0;
-  AX_surfxml_cluster_bb_lat = 0;
-  ENTER(AL_surfxml_cluster); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 176:
+        YY_RULE_SETUP {
+        AX_surfxml_cluster_id = 0;
+        AX_surfxml_cluster_prefix = 0;
+        AX_surfxml_cluster_suffix = 0;
+        AX_surfxml_cluster_radical = 0;
+        AX_surfxml_cluster_power = 0;
+        AX_surfxml_cluster_bw = 0;
+        AX_surfxml_cluster_lat = 0;
+        AX_surfxml_cluster_bb_bw = 0;
+        AX_surfxml_cluster_bb_lat = 0;
+        ENTER(AL_surfxml_cluster);
+        pushbuffer(0);
+      } YY_BREAK case 176:
 /* rule 176 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_id);
-       YY_BREAK
-case 177:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_id);
+      YY_BREAK case 177:
 /* rule 177 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_id);
-       YY_BREAK
-case 178:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_id);
+      YY_BREAK case 178:
 /* rule 178 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_prefix);
-       YY_BREAK
-case 179:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_prefix);
+      YY_BREAK case 179:
 /* rule 179 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_prefix);
-       YY_BREAK
-case 180:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_prefix);
+      YY_BREAK case 180:
 /* rule 180 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_suffix);
-       YY_BREAK
-case 181:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_suffix);
+      YY_BREAK case 181:
 /* rule 181 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_suffix);
-       YY_BREAK
-case 182:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_suffix);
+      YY_BREAK case 182:
 /* rule 182 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_radical);
-       YY_BREAK
-case 183:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_radical);
+      YY_BREAK case 183:
 /* rule 183 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_radical);
-       YY_BREAK
-case 184:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_radical);
+      YY_BREAK case 184:
 /* rule 184 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_power);
-       YY_BREAK
-case 185:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_power);
+      YY_BREAK case 185:
 /* rule 185 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_power);
-       YY_BREAK
-case 186:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_power);
+      YY_BREAK case 186:
 /* rule 186 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_bw);
-       YY_BREAK
-case 187:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_bw);
+      YY_BREAK case 187:
 /* rule 187 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_bw);
-       YY_BREAK
-case 188:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_bw);
+      YY_BREAK case 188:
 /* rule 188 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_lat);
-       YY_BREAK
-case 189:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_lat);
+      YY_BREAK case 189:
 /* rule 189 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_lat);
-       YY_BREAK
-case 190:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_lat);
+      YY_BREAK case 190:
 /* rule 190 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_bb_bw);
-       YY_BREAK
-case 191:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_bb_bw);
+      YY_BREAK case 191:
 /* rule 191 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_bb_bw);
-       YY_BREAK
-case 192:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_bb_bw);
+      YY_BREAK case 192:
 /* rule 192 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_cluster_bb_lat);
-       YY_BREAK
-case 193:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_cluster_bb_lat);
+      YY_BREAK case 193:
 /* rule 193 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_cluster_bb_lat);
-       YY_BREAK
-case 194:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_cluster_id) FAIL("Required attribute `id' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_prefix) FAIL("Required attribute `prefix' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_suffix) FAIL("Required attribute `suffix' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_radical) FAIL("Required attribute `radical' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_power) FAIL("Required attribute `power' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_bw) FAIL("Required attribute `bw' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_lat) FAIL("Required attribute `lat' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_bb_bw) FAIL("Required attribute `bb_bw' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_bb_lat) FAIL("Required attribute `bb_lat' not set for `cluster' element.");
-  LEAVE; STag_surfxml_cluster();surfxml_pcdata_ix = 0; ENTER(E_surfxml_cluster);
- }
-       YY_BREAK
-case 195:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_cluster_id) FAIL("Required attribute `id' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_prefix) FAIL("Required attribute `prefix' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_suffix) FAIL("Required attribute `suffix' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_radical) FAIL("Required attribute `radical' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_power) FAIL("Required attribute `power' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_bw) FAIL("Required attribute `bw' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_lat) FAIL("Required attribute `lat' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_bb_bw) FAIL("Required attribute `bb_bw' not set for `cluster' element.");
-  if (!AX_surfxml_cluster_bb_lat) FAIL("Required attribute `bb_lat' not set for `cluster' element.");
-  LEAVE; STag_surfxml_cluster(); surfxml_pcdata_ix = 0; ETag_surfxml_cluster(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 196:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of cluster element.", surf_parse_text[0]);
-       YY_BREAK
-case 197:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `cluster' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_cluster):
-FAIL("EOF in attribute list of `cluster' element.");
-       YY_BREAK
-
-case 198:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_cluster_bb_lat);
+      YY_BREAK case 194:YY_RULE_SETUP {
+        if (!AX_surfxml_cluster_id)
+          FAIL("Required attribute `id' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_prefix)
+          FAIL("Required attribute `prefix' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_suffix)
+          FAIL("Required attribute `suffix' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_radical)
+          FAIL("Required attribute `radical' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_power)
+          FAIL("Required attribute `power' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_bw)
+          FAIL("Required attribute `bw' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_lat)
+          FAIL("Required attribute `lat' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_bb_bw)
+          FAIL("Required attribute `bb_bw' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_bb_lat)
+          FAIL("Required attribute `bb_lat' not set for `cluster' element.");
+        LEAVE;
+        STag_surfxml_cluster();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_cluster);
+      } YY_BREAK case 195:YY_RULE_SETUP {
+        if (!AX_surfxml_cluster_id)
+          FAIL("Required attribute `id' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_prefix)
+          FAIL("Required attribute `prefix' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_suffix)
+          FAIL("Required attribute `suffix' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_radical)
+          FAIL("Required attribute `radical' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_power)
+          FAIL("Required attribute `power' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_bw)
+          FAIL("Required attribute `bw' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_lat)
+          FAIL("Required attribute `lat' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_bb_bw)
+          FAIL("Required attribute `bb_bw' not set for `cluster' element.");
+        if (!AX_surfxml_cluster_bb_lat)
+          FAIL("Required attribute `bb_lat' not set for `cluster' element.");
+        LEAVE;
+        STag_surfxml_cluster();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_cluster();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 196:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of cluster element.",
+         surf_parse_text[0]);
+      YY_BREAK case 197:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `cluster' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_cluster):FAIL
+        ("EOF in attribute list of `cluster' element.");
+      YY_BREAK case 198:
 /* rule 198 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_cluster();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 199:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_cluster();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 199:
 /* rule 199 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</cluster>' expected.",surf_parse_text);
-       YY_BREAK
-case 200:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</cluster>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_cluster):
-FAIL("Premature EOF: `</cluster>' expected.");
-       YY_BREAK
-
-case 201:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</cluster>' expected.",
+             surf_parse_text);
+      YY_BREAK case 200:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</cluster>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_cluster):FAIL
+        ("Premature EOF: `</cluster>' expected.");
+      YY_BREAK case 201:
 /* rule 201 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <router> is not allowed here.");
-       YY_BREAK
-case 202:
+        YY_RULE_SETUP FAIL("Starting tag <router> is not allowed here.");
+      YY_BREAK case 202:
 /* rule 202 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_router_id = 0;
-  ENTER(AL_surfxml_router); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 203:
+        YY_RULE_SETUP {
+        AX_surfxml_router_id = 0;
+        ENTER(AL_surfxml_router);
+        pushbuffer(0);
+      } YY_BREAK case 203:
 /* rule 203 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_router_id);
-       YY_BREAK
-case 204:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_router_id);
+      YY_BREAK case 204:
 /* rule 204 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_router_id);
-       YY_BREAK
-case 205:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_router_id) FAIL("Required attribute `id' not set for `router' element.");
-  LEAVE; STag_surfxml_router();surfxml_pcdata_ix = 0; ENTER(E_surfxml_router);
- }
-       YY_BREAK
-case 206:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_router_id) FAIL("Required attribute `id' not set for `router' element.");
-  LEAVE; STag_surfxml_router(); surfxml_pcdata_ix = 0; ETag_surfxml_router(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 207:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of router element.", surf_parse_text[0]);
-       YY_BREAK
-case 208:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `router' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_router):
-FAIL("EOF in attribute list of `router' element.");
-       YY_BREAK
-
-case 209:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_router_id);
+      YY_BREAK case 205:YY_RULE_SETUP {
+        if (!AX_surfxml_router_id)
+          FAIL("Required attribute `id' not set for `router' element.");
+        LEAVE;
+        STag_surfxml_router();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_router);
+      } YY_BREAK case 206:YY_RULE_SETUP {
+        if (!AX_surfxml_router_id)
+          FAIL("Required attribute `id' not set for `router' element.");
+        LEAVE;
+        STag_surfxml_router();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_router();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 207:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of router element.",
+             surf_parse_text[0]);
+      YY_BREAK case 208:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `router' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_router):FAIL
+        ("EOF in attribute list of `router' element.");
+      YY_BREAK case 209:
 /* rule 209 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_router();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 210:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_router();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_2:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+          SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 210:
 /* rule 210 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</router>' expected.",surf_parse_text);
-       YY_BREAK
-case 211:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</router>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_router):
-FAIL("Premature EOF: `</router>' expected.");
-       YY_BREAK
-
-case 212:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</router>' expected.",
+             surf_parse_text);
+      YY_BREAK case 211:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</router>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_router):FAIL
+        ("Premature EOF: `</router>' expected.");
+      YY_BREAK case 212:
 /* rule 212 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <link> is not allowed here.");
-       YY_BREAK
-case 213:
+        YY_RULE_SETUP FAIL("Starting tag <link> is not allowed here.");
+      YY_BREAK case 213:
 /* rule 213 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_link_id = 0;
-  AX_surfxml_link_bandwidth = 0;
-  AX_surfxml_link_bandwidth_file = 0;
-  AX_surfxml_link_latency = 90;
-  AX_surfxml_link_latency_file = 0;
-  AX_surfxml_link_state = A_surfxml_link_state_ON;
-  AX_surfxml_link_state_file = 0;
-  AX_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
-  ENTER(AL_surfxml_link); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 214:
+        YY_RULE_SETUP {
+        AX_surfxml_link_id = 0;
+        AX_surfxml_link_bandwidth = 0;
+        AX_surfxml_link_bandwidth_file = 0;
+        AX_surfxml_link_latency = 90;
+        AX_surfxml_link_latency_file = 0;
+        AX_surfxml_link_state = A_surfxml_link_state_ON;
+        AX_surfxml_link_state_file = 0;
+        AX_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
+        ENTER(AL_surfxml_link);
+        pushbuffer(0);
+      } YY_BREAK case 214:
 /* rule 214 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_id);
-       YY_BREAK
-case 215:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_id);
+      YY_BREAK case 215:
 /* rule 215 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_id);
-       YY_BREAK
-case 216:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_id);
+      YY_BREAK case 216:
 /* rule 216 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_bandwidth);
-       YY_BREAK
-case 217:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_bandwidth);
+      YY_BREAK case 217:
 /* rule 217 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_bandwidth);
-       YY_BREAK
-case 218:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_bandwidth);
+      YY_BREAK case 218:
 /* rule 218 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_bandwidth_file);
-       YY_BREAK
-case 219:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_bandwidth_file);
+      YY_BREAK case 219:
 /* rule 219 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_bandwidth_file);
-       YY_BREAK
-case 220:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_bandwidth_file);
+      YY_BREAK case 220:
 /* rule 220 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_latency);
-       YY_BREAK
-case 221:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_latency);
+      YY_BREAK case 221:
 /* rule 221 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_latency);
-       YY_BREAK
-case 222:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_latency);
+      YY_BREAK case 222:
 /* rule 222 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_latency_file);
-       YY_BREAK
-case 223:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_latency_file);
+      YY_BREAK case 223:
 /* rule 223 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_latency_file);
-       YY_BREAK
-case 224:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_latency_file);
+      YY_BREAK case 224:
 /* rule 224 can match eol */
-case 225:
+      case 225:
 /* rule 225 can match eol */
-YY_RULE_SETUP
-A_surfxml_link_state = A_surfxml_link_state_ON;
-       YY_BREAK
-case 226:
+        YY_RULE_SETUP A_surfxml_link_state = A_surfxml_link_state_ON;
+      YY_BREAK case 226:
 /* rule 226 can match eol */
-case 227:
+      case 227:
 /* rule 227 can match eol */
-YY_RULE_SETUP
-A_surfxml_link_state = A_surfxml_link_state_OFF;
-       YY_BREAK
-case 228:
+        YY_RULE_SETUP A_surfxml_link_state = A_surfxml_link_state_OFF;
+      YY_BREAK case 228:
 /* rule 228 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_state_file);
-       YY_BREAK
-case 229:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_state_file);
+      YY_BREAK case 229:
 /* rule 229 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_state_file);
-       YY_BREAK
-case 230:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_state_file);
+      YY_BREAK case 230:
 /* rule 230 can match eol */
-case 231:
+      case 231:
 /* rule 231 can match eol */
-YY_RULE_SETUP
-A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
-       YY_BREAK
-case 232:
+       
+        YY_RULE_SETUP
+        A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
+      YY_BREAK case 232:
 /* rule 232 can match eol */
-case 233:
+      case 233:
 /* rule 233 can match eol */
-YY_RULE_SETUP
-A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;
-       YY_BREAK
-case 234:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_link_id) FAIL("Required attribute `id' not set for `link' element.");
-  if (!AX_surfxml_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `link' element.");
-  LEAVE; STag_surfxml_link();surfxml_pcdata_ix = 0; ENTER(S_surfxml_link);
- }
-       YY_BREAK
-case 235:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_link_id) FAIL("Required attribute `id' not set for `link' element.");
-  if (!AX_surfxml_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `link' element.");
-  LEAVE; STag_surfxml_link(); surfxml_pcdata_ix = 0; ETag_surfxml_link(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_foreach: case S_surfxml_foreach_1: SET(E_surfxml_foreach); break;
-   case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 236:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of link element.", surf_parse_text[0]);
-       YY_BREAK
-case 237:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `link' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_link):
-FAIL("EOF in attribute list of `link' element.");
-       YY_BREAK
-
-case 238:
+       
+        YY_RULE_SETUP
+        A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;
+      YY_BREAK case 234:YY_RULE_SETUP {
+        if (!AX_surfxml_link_id)
+          FAIL("Required attribute `id' not set for `link' element.");
+        if (!AX_surfxml_link_bandwidth)
+          FAIL("Required attribute `bandwidth' not set for `link' element.");
+        LEAVE;
+        STag_surfxml_link();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_link);
+      } YY_BREAK case 235:YY_RULE_SETUP {
+        if (!AX_surfxml_link_id)
+          FAIL("Required attribute `id' not set for `link' element.");
+        if (!AX_surfxml_link_bandwidth)
+          FAIL("Required attribute `bandwidth' not set for `link' element.");
+        LEAVE;
+        STag_surfxml_link();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_link();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_foreach:
+        case S_surfxml_foreach_1:
+          SET(E_surfxml_foreach);
+          break;
+          case S_surfxml_platform_2:case S_surfxml_platform:case
+            S_surfxml_platform_3:SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 236:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of link element.",
+             surf_parse_text[0]);
+      YY_BREAK case 237:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `link' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_link):FAIL
+        ("EOF in attribute list of `link' element.");
+      YY_BREAK case 238:
 /* rule 238 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_link();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_foreach: case S_surfxml_foreach_1: SET(E_surfxml_foreach); break;
-   case S_surfxml_platform_2: case S_surfxml_platform: case S_surfxml_platform_3: SET(S_surfxml_platform_3); break;
-  }
- }
-       YY_BREAK
-case 239:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_link();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_foreach:
+        case S_surfxml_foreach_1:
+          SET(E_surfxml_foreach);
+          break;
+          case S_surfxml_platform_2:case S_surfxml_platform:case
+            S_surfxml_platform_3:SET(S_surfxml_platform_3);
+          break;
+      }} YY_BREAK case 239:
 /* rule 239 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</link>' expected.",surf_parse_text);
-       YY_BREAK
-case 240:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</link>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_link_2):
-case YY_STATE_EOF(E_surfxml_link):
-case YY_STATE_EOF(S_surfxml_link):
-FAIL("Premature EOF: `</link>' expected.");
-       YY_BREAK
-
-case 241:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</link>' expected.", surf_parse_text);
+      YY_BREAK case 240:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</link>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_link_2):case
+        YY_STATE_EOF(E_surfxml_link):case
+        YY_STATE_EOF(S_surfxml_link):FAIL
+        ("Premature EOF: `</link>' expected.");
+      YY_BREAK case 241:
 /* rule 241 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <route:multi> is not allowed here.");
-       YY_BREAK
-case 242:
+        YY_RULE_SETUP FAIL("Starting tag <route:multi> is not allowed here.");
+      YY_BREAK case 242:
 /* rule 242 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_route_c_multi_src = 0;
-  AX_surfxml_route_c_multi_dst = 0;
-  AX_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_POSTPEND;
-  AX_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_YES;
-  ENTER(AL_surfxml_route_c_multi); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 243:
+        YY_RULE_SETUP {
+        AX_surfxml_route_c_multi_src = 0;
+        AX_surfxml_route_c_multi_dst = 0;
+        AX_surfxml_route_c_multi_action =
+          A_surfxml_route_c_multi_action_POSTPEND;
+        AX_surfxml_route_c_multi_symmetric =
+          A_surfxml_route_c_multi_symmetric_YES;
+        ENTER(AL_surfxml_route_c_multi);
+        pushbuffer(0);
+      } YY_BREAK case 243:
 /* rule 243 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_c_multi_src);
-       YY_BREAK
-case 244:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_c_multi_src);
+      YY_BREAK case 244:
 /* rule 244 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_c_multi_src);
-       YY_BREAK
-case 245:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_c_multi_src);
+      YY_BREAK case 245:
 /* rule 245 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_c_multi_dst);
-       YY_BREAK
-case 246:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_c_multi_dst);
+      YY_BREAK case 246:
 /* rule 246 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_c_multi_dst);
-       YY_BREAK
-case 247:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_c_multi_dst);
+      YY_BREAK case 247:
 /* rule 247 can match eol */
-case 248:
+      case 248:
 /* rule 248 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_POSTPEND;
-       YY_BREAK
-case 249:
+       
+        YY_RULE_SETUP
+        A_surfxml_route_c_multi_action =
+        A_surfxml_route_c_multi_action_POSTPEND;
+      YY_BREAK case 249:
 /* rule 249 can match eol */
-case 250:
+      case 250:
 /* rule 250 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_PREPEND;
-       YY_BREAK
-case 251:
+       
+        YY_RULE_SETUP
+        A_surfxml_route_c_multi_action =
+        A_surfxml_route_c_multi_action_PREPEND;
+      YY_BREAK case 251:
 /* rule 251 can match eol */
-case 252:
+      case 252:
 /* rule 252 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_OVERRIDE;
-       YY_BREAK
-case 253:
+       
+        YY_RULE_SETUP
+        A_surfxml_route_c_multi_action =
+        A_surfxml_route_c_multi_action_OVERRIDE;
+      YY_BREAK case 253:
 /* rule 253 can match eol */
-case 254:
+      case 254:
 /* rule 254 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_YES;
-       YY_BREAK
-case 255:
+       
+        YY_RULE_SETUP
+        A_surfxml_route_c_multi_symmetric =
+        A_surfxml_route_c_multi_symmetric_YES;
+      YY_BREAK case 255:
 /* rule 255 can match eol */
-case 256:
+      case 256:
 /* rule 256 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_NO;
-       YY_BREAK
-case 257:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_route_c_multi_src) FAIL("Required attribute `src' not set for `route:multi' element.");
-  if (!AX_surfxml_route_c_multi_dst) FAIL("Required attribute `dst' not set for `route:multi' element.");
-  LEAVE; STag_surfxml_route_c_multi();surfxml_pcdata_ix = 0; ENTER(S_surfxml_route_c_multi);
- }
-       YY_BREAK
-case 258:
-YY_RULE_SETUP
-FAIL("`route:multi' element cannot be empty.");
-       YY_BREAK
-case 259:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of route:multi element.", surf_parse_text[0]);
-       YY_BREAK
-case 260:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `route:multi' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_route_c_multi):
-FAIL("EOF in attribute list of `route:multi' element.");
-       YY_BREAK
-
-case 261:
+       
+        YY_RULE_SETUP
+        A_surfxml_route_c_multi_symmetric =
+        A_surfxml_route_c_multi_symmetric_NO;
+      YY_BREAK case 257:YY_RULE_SETUP {
+        if (!AX_surfxml_route_c_multi_src)
+          FAIL("Required attribute `src' not set for `route:multi' element.");
+        if (!AX_surfxml_route_c_multi_dst)
+          FAIL("Required attribute `dst' not set for `route:multi' element.");
+        LEAVE;
+        STag_surfxml_route_c_multi();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_route_c_multi);
+      } YY_BREAK case 258:YY_RULE_SETUP
+        FAIL("`route:multi' element cannot be empty.");
+      YY_BREAK case 259:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of route:multi element.",
+         surf_parse_text[0]);
+      YY_BREAK case 260:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `route:multi' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_route_c_multi):FAIL
+        ("EOF in attribute list of `route:multi' element.");
+      YY_BREAK case 261:
 /* rule 261 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_route_c_multi();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-  }
- }
-       YY_BREAK
-case 262:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_route_c_multi();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+      }} YY_BREAK case 262:
 /* rule 262 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</route:multi>' expected.",surf_parse_text);
-       YY_BREAK
-case 263:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</route:multi>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_route_c_multi_2):
-case YY_STATE_EOF(E_surfxml_route_c_multi):
-FAIL("Premature EOF: `</route:multi>' expected.");
-       YY_BREAK
-
-case 264:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</route:multi>' expected.",
+             surf_parse_text);
+      YY_BREAK case 263:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</route:multi>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_route_c_multi_2):case
+        YY_STATE_EOF(E_surfxml_route_c_multi):FAIL
+        ("Premature EOF: `</route:multi>' expected.");
+      YY_BREAK case 264:
 /* rule 264 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <route> is not allowed here.");
-       YY_BREAK
-case 265:
+        YY_RULE_SETUP FAIL("Starting tag <route> is not allowed here.");
+      YY_BREAK case 265:
 /* rule 265 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_route_src = 0;
-  AX_surfxml_route_dst = 0;
-  AX_surfxml_route_impact_on_src = 94;
-  AX_surfxml_route_impact_on_dst = 98;
-  AX_surfxml_route_impact_on_src_with_other_recv = 102;
-  AX_surfxml_route_impact_on_dst_with_other_send = 106;
-  AX_surfxml_route_action = A_surfxml_route_action_POSTPEND;
-  ENTER(AL_surfxml_route); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 266:
+        YY_RULE_SETUP {
+        AX_surfxml_route_src = 0;
+        AX_surfxml_route_dst = 0;
+        AX_surfxml_route_impact_on_src = 94;
+        AX_surfxml_route_impact_on_dst = 98;
+        AX_surfxml_route_impact_on_src_with_other_recv = 102;
+        AX_surfxml_route_impact_on_dst_with_other_send = 106;
+        AX_surfxml_route_action = A_surfxml_route_action_POSTPEND;
+        ENTER(AL_surfxml_route);
+        pushbuffer(0);
+      } YY_BREAK case 266:
 /* rule 266 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_src);
-       YY_BREAK
-case 267:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_src);
+      YY_BREAK case 267:
 /* rule 267 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_src);
-       YY_BREAK
-case 268:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_src);
+      YY_BREAK case 268:
 /* rule 268 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_dst);
-       YY_BREAK
-case 269:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_dst);
+      YY_BREAK case 269:
 /* rule 269 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_dst);
-       YY_BREAK
-case 270:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_dst);
+      YY_BREAK case 270:
 /* rule 270 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_src);
-       YY_BREAK
-case 271:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_impact_on_src);
+      YY_BREAK case 271:
 /* rule 271 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_src);
-       YY_BREAK
-case 272:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_impact_on_src);
+      YY_BREAK case 272:
 /* rule 272 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_dst);
-       YY_BREAK
-case 273:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_impact_on_dst);
+      YY_BREAK case 273:
 /* rule 273 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_dst);
-       YY_BREAK
-case 274:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_impact_on_dst);
+      YY_BREAK case 274:
 /* rule 274 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
-       YY_BREAK
-case 275:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
+      YY_BREAK case 275:
 /* rule 275 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
-       YY_BREAK
-case 276:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_impact_on_src_with_other_recv);
+      YY_BREAK case 276:
 /* rule 276 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
-       YY_BREAK
-case 277:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
+      YY_BREAK case 277:
 /* rule 277 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
-       YY_BREAK
-case 278:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_route_impact_on_dst_with_other_send);
+      YY_BREAK case 278:
 /* rule 278 can match eol */
-case 279:
+      case 279:
 /* rule 279 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_action = A_surfxml_route_action_POSTPEND;
-       YY_BREAK
-case 280:
+       
+        YY_RULE_SETUP A_surfxml_route_action =
+        A_surfxml_route_action_POSTPEND;
+      YY_BREAK case 280:
 /* rule 280 can match eol */
-case 281:
+      case 281:
 /* rule 281 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_action = A_surfxml_route_action_PREPEND;
-       YY_BREAK
-case 282:
+        YY_RULE_SETUP A_surfxml_route_action = A_surfxml_route_action_PREPEND;
+      YY_BREAK case 282:
 /* rule 282 can match eol */
-case 283:
+      case 283:
 /* rule 283 can match eol */
-YY_RULE_SETUP
-A_surfxml_route_action = A_surfxml_route_action_OVERRIDE;
-       YY_BREAK
-case 284:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
-  if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
-  LEAVE; STag_surfxml_route();surfxml_pcdata_ix = 0; ENTER(S_surfxml_route);
- }
-       YY_BREAK
-case 285:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_route_src) FAIL("Required attribute `src' not set for `route' element.");
-  if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element.");
-  LEAVE; STag_surfxml_route(); surfxml_pcdata_ix = 0; ETag_surfxml_route(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-  }
- }
-       YY_BREAK
-case 286:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of route element.", surf_parse_text[0]);
-       YY_BREAK
-case 287:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `route' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_route):
-FAIL("EOF in attribute list of `route' element.");
-       YY_BREAK
-
-case 288:
+       
+        YY_RULE_SETUP A_surfxml_route_action =
+        A_surfxml_route_action_OVERRIDE;
+      YY_BREAK case 284:YY_RULE_SETUP {
+        if (!AX_surfxml_route_src)
+          FAIL("Required attribute `src' not set for `route' element.");
+        if (!AX_surfxml_route_dst)
+          FAIL("Required attribute `dst' not set for `route' element.");
+        LEAVE;
+        STag_surfxml_route();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_route);
+      } YY_BREAK case 285:YY_RULE_SETUP {
+        if (!AX_surfxml_route_src)
+          FAIL("Required attribute `src' not set for `route' element.");
+        if (!AX_surfxml_route_dst)
+          FAIL("Required attribute `dst' not set for `route' element.");
+        LEAVE;
+        STag_surfxml_route();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_route();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+      }} YY_BREAK case 286:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of route element.",
+             surf_parse_text[0]);
+      YY_BREAK case 287:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `route' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_route):FAIL
+        ("EOF in attribute list of `route' element.");
+      YY_BREAK case 288:
 /* rule 288 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_route();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-  }
- }
-       YY_BREAK
-case 289:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_route();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+      }} YY_BREAK case 289:
 /* rule 289 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</route>' expected.",surf_parse_text);
-       YY_BREAK
-case 290:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</route>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_route):
-case YY_STATE_EOF(S_surfxml_route_2):
-case YY_STATE_EOF(E_surfxml_route):
-FAIL("Premature EOF: `</route>' expected.");
-       YY_BREAK
-
-case 291:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</route>' expected.",
+             surf_parse_text);
+      YY_BREAK case 290:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</route>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_route):case
+        YY_STATE_EOF(S_surfxml_route_2):case
+        YY_STATE_EOF(E_surfxml_route):FAIL
+        ("Premature EOF: `</route>' expected.");
+      YY_BREAK case 291:
 /* rule 291 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <link:ctn> is not allowed here.");
-       YY_BREAK
-case 292:
+        YY_RULE_SETUP FAIL("Starting tag <link:ctn> is not allowed here.");
+      YY_BREAK case 292:
 /* rule 292 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_link_c_ctn_id = 0;
-  ENTER(AL_surfxml_link_c_ctn); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 293:
+        YY_RULE_SETUP {
+        AX_surfxml_link_c_ctn_id = 0;
+        ENTER(AL_surfxml_link_c_ctn);
+        pushbuffer(0);
+      } YY_BREAK case 293:
 /* rule 293 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_link_c_ctn_id);
-       YY_BREAK
-case 294:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_link_c_ctn_id);
+      YY_BREAK case 294:
 /* rule 294 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_link_c_ctn_id);
-       YY_BREAK
-case 295:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_link_c_ctn_id) FAIL("Required attribute `id' not set for `link:ctn' element.");
-  LEAVE; STag_surfxml_link_c_ctn();surfxml_pcdata_ix = 0; ENTER(E_surfxml_link_c_ctn);
- }
-       YY_BREAK
-case 296:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_link_c_ctn_id) FAIL("Required attribute `id' not set for `link:ctn' element.");
-  LEAVE; STag_surfxml_link_c_ctn(); surfxml_pcdata_ix = 0; ETag_surfxml_link_c_ctn(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
-   case S_surfxml_route_c_multi_2: case S_surfxml_route_c_multi_1: case S_surfxml_route_c_multi: SET(S_surfxml_route_c_multi_2); break;
-  }
- }
-       YY_BREAK
-case 297:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of link:ctn element.", surf_parse_text[0]);
-       YY_BREAK
-case 298:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `link:ctn' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_link_c_ctn):
-FAIL("EOF in attribute list of `link:ctn' element.");
-       YY_BREAK
-
-case 299:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_link_c_ctn_id);
+      YY_BREAK case 295:YY_RULE_SETUP {
+        if (!AX_surfxml_link_c_ctn_id)
+          FAIL("Required attribute `id' not set for `link:ctn' element.");
+        LEAVE;
+        STag_surfxml_link_c_ctn();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_link_c_ctn);
+      } YY_BREAK case 296:YY_RULE_SETUP {
+        if (!AX_surfxml_link_c_ctn_id)
+          FAIL("Required attribute `id' not set for `link:ctn' element.");
+        LEAVE;
+        STag_surfxml_link_c_ctn();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_link_c_ctn();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_route_1:
+        case S_surfxml_route:
+        case S_surfxml_route_2:
+          SET(S_surfxml_route_2);
+          break;
+          case S_surfxml_route_c_multi_2:case S_surfxml_route_c_multi_1:case
+            S_surfxml_route_c_multi:SET(S_surfxml_route_c_multi_2);
+          break;
+      }} YY_BREAK case 297:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of link:ctn element.",
+         surf_parse_text[0]);
+      YY_BREAK case 298:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `link:ctn' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_link_c_ctn):FAIL
+        ("EOF in attribute list of `link:ctn' element.");
+      YY_BREAK case 299:
 /* rule 299 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_link_c_ctn();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_route_1: case S_surfxml_route: case S_surfxml_route_2: SET(S_surfxml_route_2); break;
-   case S_surfxml_route_c_multi_2: case S_surfxml_route_c_multi_1: case S_surfxml_route_c_multi: SET(S_surfxml_route_c_multi_2); break;
-  }
- }
-       YY_BREAK
-case 300:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_link_c_ctn();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_route_1:
+        case S_surfxml_route:
+        case S_surfxml_route_2:
+          SET(S_surfxml_route_2);
+          break;
+          case S_surfxml_route_c_multi_2:case S_surfxml_route_c_multi_1:case
+            S_surfxml_route_c_multi:SET(S_surfxml_route_c_multi_2);
+          break;
+      }} YY_BREAK case 300:
 /* rule 300 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</link:ctn>' expected.",surf_parse_text);
-       YY_BREAK
-case 301:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</link:ctn>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_link_c_ctn):
-FAIL("Premature EOF: `</link:ctn>' expected.");
-       YY_BREAK
-
-case 302:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</link:ctn>' expected.",
+             surf_parse_text);
+      YY_BREAK case 301:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</link:ctn>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_link_c_ctn):FAIL
+        ("Premature EOF: `</link:ctn>' expected.");
+      YY_BREAK case 302:
 /* rule 302 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <process> is not allowed here.");
-       YY_BREAK
-case 303:
+        YY_RULE_SETUP FAIL("Starting tag <process> is not allowed here.");
+      YY_BREAK case 303:
 /* rule 303 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_process_host = 0;
-  AX_surfxml_process_function = 0;
-  AX_surfxml_process_start_time = 110;
-  AX_surfxml_process_kill_time = 115;
-  ENTER(AL_surfxml_process); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 304:
+        YY_RULE_SETUP {
+        AX_surfxml_process_host = 0;
+        AX_surfxml_process_function = 0;
+        AX_surfxml_process_start_time = 110;
+        AX_surfxml_process_kill_time = 115;
+        ENTER(AL_surfxml_process);
+        pushbuffer(0);
+      } YY_BREAK case 304:
 /* rule 304 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_process_host);
-       YY_BREAK
-case 305:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_process_host);
+      YY_BREAK case 305:
 /* rule 305 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_process_host);
-       YY_BREAK
-case 306:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_process_host);
+      YY_BREAK case 306:
 /* rule 306 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_process_function);
-       YY_BREAK
-case 307:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_process_function);
+      YY_BREAK case 307:
 /* rule 307 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_process_function);
-       YY_BREAK
-case 308:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_process_function);
+      YY_BREAK case 308:
 /* rule 308 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_process_start_time);
-       YY_BREAK
-case 309:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_process_start_time);
+      YY_BREAK case 309:
 /* rule 309 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_process_start_time);
-       YY_BREAK
-case 310:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_process_start_time);
+      YY_BREAK case 310:
 /* rule 310 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_process_kill_time);
-       YY_BREAK
-case 311:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_process_kill_time);
+      YY_BREAK case 311:
 /* rule 311 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_process_kill_time);
-       YY_BREAK
-case 312:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
-  if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
-  LEAVE; STag_surfxml_process();surfxml_pcdata_ix = 0; ENTER(S_surfxml_process);
- }
-       YY_BREAK
-case 313:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_process_host) FAIL("Required attribute `host' not set for `process' element.");
-  if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element.");
-  LEAVE; STag_surfxml_process(); surfxml_pcdata_ix = 0; ETag_surfxml_process(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-  }
- }
-       YY_BREAK
-case 314:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of process element.", surf_parse_text[0]);
-       YY_BREAK
-case 315:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `process' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_process):
-FAIL("EOF in attribute list of `process' element.");
-       YY_BREAK
-
-case 316:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_process_kill_time);
+      YY_BREAK case 312:YY_RULE_SETUP {
+        if (!AX_surfxml_process_host)
+          FAIL("Required attribute `host' not set for `process' element.");
+        if (!AX_surfxml_process_function)
+          FAIL
+            ("Required attribute `function' not set for `process' element.");
+        LEAVE;
+        STag_surfxml_process();
+        surfxml_pcdata_ix = 0;
+        ENTER(S_surfxml_process);
+      } YY_BREAK case 313:YY_RULE_SETUP {
+        if (!AX_surfxml_process_host)
+          FAIL("Required attribute `host' not set for `process' element.");
+        if (!AX_surfxml_process_function)
+          FAIL
+            ("Required attribute `function' not set for `process' element.");
+        LEAVE;
+        STag_surfxml_process();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_process();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+      }} YY_BREAK case 314:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of process element.",
+         surf_parse_text[0]);
+      YY_BREAK case 315:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `process' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_process):FAIL
+        ("EOF in attribute list of `process' element.");
+      YY_BREAK case 316:
 /* rule 316 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_process();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_4: SET(S_surfxml_platform_5); break;
-  }
- }
-       YY_BREAK
-case 317:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_process();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_platform_5:
+        case S_surfxml_platform_1:
+        case S_surfxml_platform:
+        case S_surfxml_platform_3:
+        case S_surfxml_platform_4:
+          SET(S_surfxml_platform_5);
+          break;
+      }} YY_BREAK case 317:
 /* rule 317 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</process>' expected.",surf_parse_text);
-       YY_BREAK
-case 318:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</process>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_surfxml_process):
-case YY_STATE_EOF(E_surfxml_process):
-case YY_STATE_EOF(S_surfxml_process_2):
-FAIL("Premature EOF: `</process>' expected.");
-       YY_BREAK
-
-case 319:
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</process>' expected.",
+             surf_parse_text);
+      YY_BREAK case 318:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</process>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_surfxml_process):case
+        YY_STATE_EOF(E_surfxml_process):case
+        YY_STATE_EOF(S_surfxml_process_2):FAIL
+        ("Premature EOF: `</process>' expected.");
+      YY_BREAK case 319:
 /* rule 319 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <argument> is not allowed here.");
-       YY_BREAK
-case 320:
+        YY_RULE_SETUP FAIL("Starting tag <argument> is not allowed here.");
+      YY_BREAK case 320:
 /* rule 320 can match eol */
-YY_RULE_SETUP
-{
-  AX_surfxml_argument_value = 0;
-  ENTER(AL_surfxml_argument); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 321:
+        YY_RULE_SETUP {
+        AX_surfxml_argument_value = 0;
+        ENTER(AL_surfxml_argument);
+        pushbuffer(0);
+      } YY_BREAK case 321:
 /* rule 321 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_surfxml_argument_value);
-       YY_BREAK
-case 322:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_surfxml_argument_value);
+      YY_BREAK case 322:
 /* rule 322 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_surfxml_argument_value);
-       YY_BREAK
-case 323:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
-  LEAVE; STag_surfxml_argument();surfxml_pcdata_ix = 0; ENTER(E_surfxml_argument);
- }
-       YY_BREAK
-case 324:
-YY_RULE_SETUP
-{
-  if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element.");
-  LEAVE; STag_surfxml_argument(); surfxml_pcdata_ix = 0; ETag_surfxml_argument(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
-  }
- }
-       YY_BREAK
-case 325:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of argument element.", surf_parse_text[0]);
-       YY_BREAK
-case 326:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `argument' element start tag.",surf_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_surfxml_argument):
-FAIL("EOF in attribute list of `argument' element.");
-       YY_BREAK
-
-case 327:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_surfxml_argument_value);
+      YY_BREAK case 323:YY_RULE_SETUP {
+        if (!AX_surfxml_argument_value)
+          FAIL("Required attribute `value' not set for `argument' element.");
+        LEAVE;
+        STag_surfxml_argument();
+        surfxml_pcdata_ix = 0;
+        ENTER(E_surfxml_argument);
+      } YY_BREAK case 324:YY_RULE_SETUP {
+        if (!AX_surfxml_argument_value)
+          FAIL("Required attribute `value' not set for `argument' element.");
+        LEAVE;
+        STag_surfxml_argument();
+        surfxml_pcdata_ix = 0;
+        ETag_surfxml_argument();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_process_1:
+        case S_surfxml_process:
+        case S_surfxml_process_2:
+          SET(S_surfxml_process_2);
+          break;
+      }} YY_BREAK case 325:YY_RULE_SETUP
+        FAIL
+        ("Unexpected character `%c' in attribute list of argument element.",
+         surf_parse_text[0]);
+      YY_BREAK case 326:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `argument' element start tag.",
+             surf_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_surfxml_argument):FAIL
+        ("EOF in attribute list of `argument' element.");
+      YY_BREAK case 327:
 /* rule 327 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_surfxml_argument();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_surfxml_process_1: case S_surfxml_process: case S_surfxml_process_2: SET(S_surfxml_process_2); break;
-  }
- }
-       YY_BREAK
-case 328:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_surfxml_argument();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_surfxml_process_1:
+        case S_surfxml_process:
+        case S_surfxml_process_2:
+          SET(S_surfxml_process_2);
+          break;
+      }} YY_BREAK case 328:
 /* rule 328 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</argument>' expected.",surf_parse_text);
-       YY_BREAK
-case 329:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</argument>' expected.",surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_surfxml_argument):
-FAIL("Premature EOF: `</argument>' expected.");
-       YY_BREAK
-
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</argument>' expected.",
+             surf_parse_text);
+      YY_BREAK case 329:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</argument>' expected.",
+             surf_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_surfxml_argument):FAIL
+        ("Premature EOF: `</argument>' expected.");
+      YY_BREAK
 /* EPILOG: after the root element. */
-
-case 330:
-YY_RULE_SETUP
-{SET(PROLOG); yyless(0); CLEANUP; return -1;}
-       YY_BREAK
-case YY_STATE_EOF(EPILOG):
-SUCCEED;
-       YY_BREAK
-
+    case 330:
+      YY_RULE_SETUP {
+        SET(PROLOG);
+        yyless(0);
+        CLEANUP;
+        return -1;
+      }
+      YY_BREAK case YY_STATE_EOF(EPILOG):SUCCEED;
+      YY_BREAK
 /* CHARACTER DATA. */
-
 /* Non-defined standard entities... */
-case 331:
-YY_RULE_SETUP
-BUFFERPUTC('&');
-       YY_BREAK
-case 332:
-YY_RULE_SETUP
-BUFFERPUTC('<');
-       YY_BREAK
-case 333:
-YY_RULE_SETUP
-BUFFERPUTC('>');
-       YY_BREAK
-case 334:
-YY_RULE_SETUP
-BUFFERPUTC('\'');
-       YY_BREAK
-case 335:
-YY_RULE_SETUP
-BUFFERPUTC('"');
-       YY_BREAK
+    case 331:
+      YY_RULE_SETUP BUFFERPUTC('&');
+      YY_BREAK case 332:YY_RULE_SETUP BUFFERPUTC('<');
+      YY_BREAK case 333:YY_RULE_SETUP BUFFERPUTC('>');
+      YY_BREAK case 334:YY_RULE_SETUP BUFFERPUTC('\'');
+      YY_BREAK case 335:YY_RULE_SETUP BUFFERPUTC('"');
+      YY_BREAK
 /* Character entities. */
-case 336:
-YY_RULE_SETUP
-BUFFERPUTC((unsigned char)atoi(surf_parse_text+2));
-       YY_BREAK
-case 337:
-YY_RULE_SETUP
-BUFFERPUTC((unsigned char)strtol(surf_parse_text+3,NULL,16));
-       YY_BREAK
-
-case 338:
+    case 336:
+      YY_RULE_SETUP BUFFERPUTC((unsigned char) atoi(surf_parse_text + 2));
+      YY_BREAK case 337:YY_RULE_SETUP
+        BUFFERPUTC((unsigned char) strtol(surf_parse_text + 3, NULL, 16));
+      YY_BREAK case 338:
 /* rule 338 can match eol */
-case 339:
+      case 339:
 /* rule 339 can match eol */
-case 340:
+      case 340:
 /* rule 340 can match eol */
-case 341:
+      case 341:
 /* rule 341 can match eol */
-YY_RULE_SETUP
-BUFFERPUTC('\n');
-       YY_BREAK
-
-case 342:
-YY_RULE_SETUP
-ENTER(CDATA);
-       YY_BREAK
-case 343:
-YY_RULE_SETUP
-FAIL("Unexpected `]""]>' in character data.");
-       YY_BREAK
-
-case 344:
-YY_RULE_SETUP
-BUFFERDONE; LEAVE;
-       YY_BREAK
-case YY_STATE_EOF(VALUE1):
-FAIL("EOF in literal (\"'\" expected).");
-       YY_BREAK
-
-case 345:
-YY_RULE_SETUP
-BUFFERDONE; LEAVE;
-       YY_BREAK
-case YY_STATE_EOF(VALUE2):
-FAIL("EOF in literal (`\"' expected).");
-       YY_BREAK
-
-case 346:
+        YY_RULE_SETUP BUFFERPUTC('\n');
+      YY_BREAK case 342:YY_RULE_SETUP ENTER(CDATA);
+      YY_BREAK case 343:YY_RULE_SETUP FAIL("Unexpected `]"
+                                           "]>' in character data.");
+      YY_BREAK case 344:YY_RULE_SETUP BUFFERDONE;
+      LEAVE;
+      YY_BREAK case
+        YY_STATE_EOF(VALUE1):FAIL("EOF in literal (\"'\" expected).");
+      YY_BREAK case 345:YY_RULE_SETUP BUFFERDONE;
+      LEAVE;
+      YY_BREAK case
+        YY_STATE_EOF(VALUE2):FAIL("EOF in literal (`\"' expected).");
+      YY_BREAK case 346:
 /* rule 346 can match eol */
-YY_RULE_SETUP
-BUFFERPUTC(surf_parse_text[0]);
-       YY_BREAK
-case 347:
-YY_RULE_SETUP
-FAIL("Spurious `%c' in character data.",surf_parse_text[0]);
-       YY_BREAK
-
-case 348:
-YY_RULE_SETUP
-LEAVE;
-       YY_BREAK
+        YY_RULE_SETUP BUFFERPUTC(surf_parse_text[0]);
+      YY_BREAK case 347:YY_RULE_SETUP
+        FAIL("Spurious `%c' in character data.", surf_parse_text[0]);
+      YY_BREAK case 348:YY_RULE_SETUP LEAVE;
+      YY_BREAK
 /* "]""]"              BUFFERPUTC(surf_parse_text[0]); BUFFERPUTC(surf_parse_text[1]); */
-case 349:
-YY_RULE_SETUP
-BUFFERPUTC(surf_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(CDATA):
-FAIL("EOF in CDATA section.");
-       YY_BREAK
-
+    case 349:
+      YY_RULE_SETUP BUFFERPUTC(surf_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(CDATA):FAIL("EOF in CDATA section.");
+      YY_BREAK
 /* Impossible rules to avoid warnings from flex(1). */
 /* Ideally, this should be replaced by code in flexml.pl that
     generates just the states not covered by other rules. */
-
-case 350:
+    case 350:
 /* rule 350 can match eol */
-YY_RULE_SETUP
-FAIL("Syntax error on character `%c'.", surf_parse_text[0]);
-       YY_BREAK
-
-case 351:
-YY_RULE_SETUP
-ECHO;
-       YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(ROOT_surfxml_platform):
-case YY_STATE_EOF(S_surfxml_platform_2):
-case YY_STATE_EOF(S_surfxml_platform_4):
-case YY_STATE_EOF(S_surfxml_random_1):
-case YY_STATE_EOF(S_surfxml_foreach):
-case YY_STATE_EOF(S_surfxml_foreach_1):
-case YY_STATE_EOF(S_surfxml_host_1):
-case YY_STATE_EOF(S_surfxml_link_1):
-case YY_STATE_EOF(S_surfxml_route_c_multi):
-case YY_STATE_EOF(S_surfxml_route_c_multi_1):
-case YY_STATE_EOF(S_surfxml_route_1):
-case YY_STATE_EOF(S_surfxml_process_1):
-case YY_STATE_EOF(IMPOSSIBLE):
-       yyterminate();
-
-       case YY_END_OF_BUFFER:
-               {
-               /* Amount of text matched not including the EOB char. */
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */
-               *yy_cp = (yy_hold_char);
-               YY_RESTORE_YY_MORE_OFFSET
-
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-                       {
-                       /* We're scanning a new file or input source.  It's
-                        * possible that this happened because the user
-                        * just pointed surf_parse_in at a new source and called
-                        * surf_parse_lex().  If so, then we have to assure
-                        * consistency between YY_CURRENT_BUFFER and our
-                        * globals.  Here is the right place to do so, because
-                        * this is the first action (other than possibly a
-                        * back-up) that will match for the new input source.
-                        */
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = surf_parse_in;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-                       }
-
-               /* Note that here we test for yy_c_buf_p "<=" to the position
-                * of the first EOB in the buffer, since yy_c_buf_p will
-                * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the
-                * end-of-buffer state).  Contrast this with the test
-                * in input().
-                */
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       { /* This was really a NUL. */
-                       yy_state_type yy_next_state;
-
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state(  );
-
-                       /* Okay, we're now positioned to make the NUL
-                        * transition.  We couldn't have
-                        * yy_get_previous_state() go ahead and do it
-                        * for us because it doesn't know how to deal
-                        * with the possibility of jamming (and we don't
-                        * want to build jamming into it because then it
-                        * will run more slowly).
-                        */
-
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );
-
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
-                       if ( yy_next_state )
-                               {
-                               /* Consume the NUL. */
-                               yy_cp = ++(yy_c_buf_p);
-                               yy_current_state = yy_next_state;
-                               goto yy_match;
-                               }
-
-                       else
-                               {
-                               yy_cp = (yy_c_buf_p);
-                               goto yy_find_action;
-                               }
-                       }
-
-               else switch ( yy_get_next_buffer(  ) )
-                       {
-                       case EOB_ACT_END_OF_FILE:
-                               {
-                               (yy_did_buffer_switch_on_eof) = 0;
-
-                               if ( surf_parse_wrap( ) )
-                                       {
-                                       /* Note: because we've taken care in
-                                        * yy_get_next_buffer() to have set up
-                                        * surf_parse_text, we can now set up
-                                        * yy_c_buf_p so that if some total
-                                        * hoser (like flex itself) wants to
-                                        * call the scanner after we return the
-                                        * YY_NULL, it'll still work - another
-                                        * YY_NULL will get returned.
-                                        */
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
-                                       yy_act = YY_STATE_EOF(YY_START);
-                                       goto do_action;
-                                       }
-
-                               else
-                                       {
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-                                       }
-                               break;
-                               }
-
-                       case EOB_ACT_CONTINUE_SCAN:
-                               (yy_c_buf_p) =
-                                       (yytext_ptr) + yy_amount_of_matched_text;
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_match;
-
-                       case EOB_ACT_LAST_MATCH:
-                               (yy_c_buf_p) =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_find_action;
-                       }
-               break;
-               }
-
-       default:
-               YY_FATAL_ERROR(
-                       "fatal flex scanner internal error--no action found" );
-       } /* end of action switch */
-               } /* end of scanning one token */
-} /* end of surf_parse_lex */
+      YY_RULE_SETUP
+        FAIL("Syntax error on character `%c'.", surf_parse_text[0]);
+      YY_BREAK case 351:YY_RULE_SETUP ECHO;
+      YY_BREAK case YY_STATE_EOF(INITIAL):case
+        YY_STATE_EOF(ROOT_surfxml_platform):case
+        YY_STATE_EOF(S_surfxml_platform_2):case
+        YY_STATE_EOF(S_surfxml_platform_4):case
+        YY_STATE_EOF(S_surfxml_random_1):case
+        YY_STATE_EOF(S_surfxml_foreach):case
+        YY_STATE_EOF(S_surfxml_foreach_1):case
+        YY_STATE_EOF(S_surfxml_host_1):case
+        YY_STATE_EOF(S_surfxml_link_1):case
+        YY_STATE_EOF(S_surfxml_route_c_multi):case
+        YY_STATE_EOF(S_surfxml_route_c_multi_1):case
+        YY_STATE_EOF(S_surfxml_route_1):case
+        YY_STATE_EOF(S_surfxml_process_1):case
+        YY_STATE_EOF(IMPOSSIBLE):yyterminate();
+
+    case YY_END_OF_BUFFER:
+      {
+        /* Amount of text matched not including the EOB char. */
+        int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+        /* Undo the effects of YY_DO_BEFORE_ACTION. */
+        *yy_cp = (yy_hold_char);
+        YY_RESTORE_YY_MORE_OFFSET
+          if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
+          /* We're scanning a new file or input source.  It's
+           * possible that this happened because the user
+           * just pointed surf_parse_in at a new source and called
+           * surf_parse_lex().  If so, then we have to assure
+           * consistency between YY_CURRENT_BUFFER and our
+           * globals.  Here is the right place to do so, because
+           * this is the first action (other than possibly a
+           * back-up) that will match for the new input source.
+           */
+          (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+          YY_CURRENT_BUFFER_LVALUE->yy_input_file = surf_parse_in;
+          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+        }
+
+        /* Note that here we test for yy_c_buf_p "<=" to the position
+         * of the first EOB in the buffer, since yy_c_buf_p will
+         * already have been incremented past the NUL character
+         * (since all states make transitions on EOB to the
+         * end-of-buffer state).  Contrast this with the test
+         * in input().
+         */
+        if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) {       /* This was really a NUL. */
+          yy_state_type yy_next_state;
+
+          (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+          yy_current_state = yy_get_previous_state();
+
+          /* Okay, we're now positioned to make the NUL
+           * transition.  We couldn't have
+           * yy_get_previous_state() go ahead and do it
+           * for us because it doesn't know how to deal
+           * with the possibility of jamming (and we don't
+           * want to build jamming into it because then it
+           * will run more slowly).
+           */
+
+          yy_next_state = yy_try_NUL_trans(yy_current_state);
+
+          yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+          if (yy_next_state) {
+            /* Consume the NUL. */
+            yy_cp = ++(yy_c_buf_p);
+            yy_current_state = yy_next_state;
+            goto yy_match;
+          }
+
+          else {
+            yy_cp = (yy_c_buf_p);
+            goto yy_find_action;
+          }
+        }
+
+        else
+          switch (yy_get_next_buffer()) {
+          case EOB_ACT_END_OF_FILE:
+            {
+              (yy_did_buffer_switch_on_eof) = 0;
+
+              if (surf_parse_wrap()) {
+                /* Note: because we've taken care in
+                 * yy_get_next_buffer() to have set up
+                 * surf_parse_text, we can now set up
+                 * yy_c_buf_p so that if some total
+                 * hoser (like flex itself) wants to
+                 * call the scanner after we return the
+                 * YY_NULL, it'll still work - another
+                 * YY_NULL will get returned.
+                 */
+                (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+                yy_act = YY_STATE_EOF(YY_START);
+                goto do_action;
+              }
+
+              else {
+                if (!(yy_did_buffer_switch_on_eof))
+                  YY_NEW_FILE;
+              }
+              break;
+            }
+
+          case EOB_ACT_CONTINUE_SCAN:
+            (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+            yy_current_state = yy_get_previous_state();
+
+            yy_cp = (yy_c_buf_p);
+            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+            goto yy_match;
+
+          case EOB_ACT_LAST_MATCH:
+            (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+            yy_current_state = yy_get_previous_state();
+
+            yy_cp = (yy_c_buf_p);
+            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+            goto yy_find_action;
+          }
+        break;
+      }
+
+    default:
+      YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
+    }                           /* end of action switch */
+  }                             /* end of scanning one token */
+}                               /* end of surf_parse_lex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -5984,165 +5751,154 @@ case YY_STATE_EOF(IMPOSSIBLE):
  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  *     EOB_ACT_END_OF_FILE - end of file
  */
-static int yy_get_next_buffer (void)
+static int yy_get_next_buffer(void)
 {
-       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-       register char *source = (yytext_ptr);
-       register int number_to_move, i;
-       int ret_val;
-
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
-               YY_FATAL_ERROR(
-               "fatal flex scanner internal error--end of buffer missed" );
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-               { /* Don't try to fill the buffer, so this is an EOF. */
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
-                       {
-                       /* We matched a single character, the EOB, so
-                        * treat this as a final EOF.
-                        */
-                       return EOB_ACT_END_OF_FILE;
-                       }
-
-               else
-                       {
-                       /* We matched some text prior to the EOB, first
-                        * process it.
-                        */
-                       return EOB_ACT_LAST_MATCH;
-                       }
-               }
-
-       /* Try to read more data. */
-
-       /* First move last chars to start of buffer. */
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
-
-       for ( i = 0; i < number_to_move; ++i )
-               *(dest++) = *(source++);
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-               /* don't do the read, it's not guaranteed to return an EOF,
-                * just force an EOF
-                */
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
-       else
-               {
-                       int num_to_read =
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-               while ( num_to_read <= 0 )
-                       { /* Not enough room in the buffer - grow it. */
-
-                       /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
-                       int yy_c_buf_p_offset =
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-                       if ( b->yy_is_our_buffer )
-                               {
-                               int new_size = b->yy_buf_size * 2;
-
-                               if ( new_size <= 0 )
-                                       b->yy_buf_size += b->yy_buf_size / 8;
-                               else
-                                       b->yy_buf_size *= 2;
-
-                               b->yy_ch_buf = (char *)
-                                       /* Include room in for 2 EOB chars. */
-                                       surf_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
-                               }
-                       else
-                               /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = 0;
-
-                       if ( ! b->yy_ch_buf )
-                               YY_FATAL_ERROR(
-                               "fatal error - scanner input buffer overflow" );
-
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-                                               number_to_move - 1;
-
-                       }
-
-               if ( num_to_read > YY_READ_BUF_SIZE )
-                       num_to_read = YY_READ_BUF_SIZE;
-
-               /* Read in more data. */
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), (size_t) num_to_read );
-
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       if ( (yy_n_chars) == 0 )
-               {
-               if ( number_to_move == YY_MORE_ADJ )
-                       {
-                       ret_val = EOB_ACT_END_OF_FILE;
-                       surf_parse_restart(surf_parse_in  );
-                       }
-
-               else
-                       {
-                       ret_val = EOB_ACT_LAST_MATCH;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-                               YY_BUFFER_EOF_PENDING;
-                       }
-               }
-
-       else
-               ret_val = EOB_ACT_CONTINUE_SCAN;
-
-       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-               /* Extend the array by 50%, plus the number we really need. */
-               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
-               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) surf_parse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
-               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-       }
+  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+  register char *source = (yytext_ptr);
+  register int number_to_move, i;
+  int ret_val;
+
+  if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
+    YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
+
+  if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) {  /* Don't try to fill the buffer, so this is an EOF. */
+    if ((yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1) {
+      /* We matched a single character, the EOB, so
+       * treat this as a final EOF.
+       */
+      return EOB_ACT_END_OF_FILE;
+    }
+
+    else {
+      /* We matched some text prior to the EOB, first
+       * process it.
+       */
+      return EOB_ACT_LAST_MATCH;
+    }
+  }
+
+  /* Try to read more data. */
+
+  /* First move last chars to start of buffer. */
+  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+  for (i = 0; i < number_to_move; ++i)
+    *(dest++) = *(source++);
+
+  if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
+    /* don't do the read, it's not guaranteed to return an EOF,
+     * just force an EOF
+     */
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+  else {
+    int num_to_read =
+      YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+    while (num_to_read <= 0) {  /* Not enough room in the buffer - grow it. */
 
-       (yy_n_chars) += number_to_move;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+      /* just a shorter name for the current buffer */
+      YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+      int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
-       return ret_val;
+      if (b->yy_is_our_buffer) {
+        int new_size = b->yy_buf_size * 2;
+
+        if (new_size <= 0)
+          b->yy_buf_size += b->yy_buf_size / 8;
+        else
+          b->yy_buf_size *= 2;
+
+        b->yy_ch_buf = (char *)
+          /* Include room in for 2 EOB chars. */
+          surf_parse_realloc((void *) b->yy_ch_buf, b->yy_buf_size + 2);
+      } else
+        /* Can't grow it, we don't own it. */
+        b->yy_ch_buf = 0;
+
+      if (!b->yy_ch_buf)
+        YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
+
+      (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+      num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+        number_to_move - 1;
+
+    }
+
+    if (num_to_read > YY_READ_BUF_SIZE)
+      num_to_read = YY_READ_BUF_SIZE;
+
+    /* Read in more data. */
+    YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+             (yy_n_chars), (size_t) num_to_read);
+
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  if ((yy_n_chars) == 0) {
+    if (number_to_move == YY_MORE_ADJ) {
+      ret_val = EOB_ACT_END_OF_FILE;
+      surf_parse_restart(surf_parse_in);
+    }
+
+    else {
+      ret_val = EOB_ACT_LAST_MATCH;
+      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
+    }
+  }
+
+  else
+    ret_val = EOB_ACT_CONTINUE_SCAN;
+
+  if ((yy_size_t) ((yy_n_chars) + number_to_move) >
+      YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+    /* Extend the array by 50%, plus the number we really need. */
+    yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf =
+      (char *) surf_parse_realloc((void *)
+                                  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,
+                                  new_size);
+    if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+      YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
+  }
+
+  (yy_n_chars) += number_to_move;
+  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] =
+    YY_END_OF_BUFFER_CHAR;
+
+  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+  return ret_val;
 }
 
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
-    static yy_state_type yy_get_previous_state (void)
+static yy_state_type yy_get_previous_state(void)
 {
-       register yy_state_type yy_current_state;
-       register char *yy_cp;
-    
-       yy_current_state = (yy_start);
-
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-               {
-               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-               if ( yy_accept[yy_current_state] )
-                       {
-                       (yy_last_accepting_state) = yy_current_state;
-                       (yy_last_accepting_cpos) = yy_cp;
-                       }
-               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                       {
-                       yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 2023 )
-                               yy_c = yy_meta[(unsigned int) yy_c];
-                       }
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-               }
-
-       return yy_current_state;
+  register yy_state_type yy_current_state;
+  register char *yy_cp;
+
+  yy_current_state = (yy_start);
+
+  for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
+    register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+    if (yy_accept[yy_current_state]) {
+      (yy_last_accepting_state) = yy_current_state;
+      (yy_last_accepting_cpos) = yy_cp;
+    }
+    while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+      yy_current_state = (int) yy_def[yy_current_state];
+      if (yy_current_state >= 2023)
+        yy_c = yy_meta[(unsigned int) yy_c];
+    }
+    yy_current_state =
+      yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+  }
+
+  return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -6150,167 +5906,158 @@ static int yy_get_next_buffer (void)
  * synopsis
  *     next_state = yy_try_NUL_trans( current_state );
  */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
 {
-       register int yy_is_jam;
-       register char *yy_cp = (yy_c_buf_p);
-
-       register YY_CHAR yy_c = 1;
-       if ( yy_accept[yy_current_state] )
-               {
-               (yy_last_accepting_state) = yy_current_state;
-               (yy_last_accepting_cpos) = yy_cp;
-               }
-       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-               {
-               yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 2023 )
-                       yy_c = yy_meta[(unsigned int) yy_c];
-               }
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 2022);
-
-       return yy_is_jam ? 0 : yy_current_state;
+  register int yy_is_jam;
+  register char *yy_cp = (yy_c_buf_p);
+
+  register YY_CHAR yy_c = 1;
+  if (yy_accept[yy_current_state]) {
+    (yy_last_accepting_state) = yy_current_state;
+    (yy_last_accepting_cpos) = yy_cp;
+  }
+  while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+    yy_current_state = (int) yy_def[yy_current_state];
+    if (yy_current_state >= 2023)
+      yy_c = yy_meta[(unsigned int) yy_c];
+  }
+  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+  yy_is_jam = (yy_current_state == 2022);
+
+  return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-    static int yyinput (void)
+static int yyinput(void)
 #else
-    static int input  (void)
+static int input(void)
 #endif
-
 {
-       int c;
-    
-       *(yy_c_buf_p) = (yy_hold_char);
-
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
-               {
-               /* yy_c_buf_p now points to the character we want to return.
-                * If this occurs *before* the EOB characters, then it's a
-                * valid NUL; if not, then we've hit the end of the buffer.
-                */
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       /* This was really a NUL. */
-                       *(yy_c_buf_p) = '\0';
-
-               else
-                       { /* need more input */
-                       int offset = (yy_c_buf_p) - (yytext_ptr);
-                       ++(yy_c_buf_p);
-
-                       switch ( yy_get_next_buffer(  ) )
-                               {
-                               case EOB_ACT_LAST_MATCH:
-                                       /* This happens because yy_g_n_b()
-                                        * sees that we've accumulated a
-                                        * token and flags that we need to
-                                        * try matching the token before
-                                        * proceeding.  But for input(),
-                                        * there's no matching to consider.
-                                        * So convert the EOB_ACT_LAST_MATCH
-                                        * to EOB_ACT_END_OF_FILE.
-                                        */
-
-                                       /* Reset buffer status. */
-                                       surf_parse_restart(surf_parse_in );
-
-                                       /*FALLTHROUGH*/
-
-                               case EOB_ACT_END_OF_FILE:
-                                       {
-                                       if ( surf_parse_wrap( ) )
-                                               return EOF;
-
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
+  int c;
+
+  *(yy_c_buf_p) = (yy_hold_char);
+
+  if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
+    /* yy_c_buf_p now points to the character we want to return.
+     * If this occurs *before* the EOB characters, then it's a
+     * valid NUL; if not, then we've hit the end of the buffer.
+     */
+    if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
+      /* This was really a NUL. */
+      *(yy_c_buf_p) = '\0';
+
+    else {                      /* need more input */
+      int offset = (yy_c_buf_p) - (yytext_ptr);
+      ++(yy_c_buf_p);
+
+      switch (yy_get_next_buffer()) {
+      case EOB_ACT_LAST_MATCH:
+        /* This happens because yy_g_n_b()
+         * sees that we've accumulated a
+         * token and flags that we need to
+         * try matching the token before
+         * proceeding.  But for input(),
+         * there's no matching to consider.
+         * So convert the EOB_ACT_LAST_MATCH
+         * to EOB_ACT_END_OF_FILE.
+         */
+
+        /* Reset buffer status. */
+        surf_parse_restart(surf_parse_in);
+
+       /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE:
+        {
+          if (surf_parse_wrap())
+            return EOF;
+
+          if (!(yy_did_buffer_switch_on_eof))
+            YY_NEW_FILE;
 #ifdef __cplusplus
-                                       return yyinput();
+          return yyinput();
 #else
-                                       return input();
+          return input();
 #endif
-                                       }
+        }
 
-                               case EOB_ACT_CONTINUE_SCAN:
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;
-                                       break;
-                               }
-                       }
-               }
+      case EOB_ACT_CONTINUE_SCAN:
+        (yy_c_buf_p) = (yytext_ptr) + offset;
+        break;
+      }
+    }
+  }
 
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve surf_parse_text */
-       (yy_hold_char) = *++(yy_c_buf_p);
+  c = *(unsigned char *) (yy_c_buf_p);  /* cast for 8-bit char's */
+  *(yy_c_buf_p) = '\0';         /* preserve surf_parse_text */
+  (yy_hold_char) = *++(yy_c_buf_p);
+
+  if (c == '\n')
 
-       if ( c == '\n' )
-                  
     surf_parse_lineno++;
-;
+  ;
 
-       return c;
+  return c;
 }
-#endif /* ifndef YY_NO_INPUT */
+#endif /* ifndef YY_NO_INPUT */
 
 /** Immediately switch to a different input stream.
  * @param input_file A readable stream.
  * 
  * @note This function does not reset the start condition to @c INITIAL .
  */
-    void surf_parse_restart  (FILE * input_file )
+void surf_parse_restart(FILE * input_file)
 {
-    
-       if ( ! YY_CURRENT_BUFFER ){
-        surf_parse_ensure_buffer_stack ();
-               YY_CURRENT_BUFFER_LVALUE =
-            surf_parse__create_buffer(surf_parse_in,YY_BUF_SIZE );
-       }
 
-       surf_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
-       surf_parse__load_buffer_state( );
+  if (!YY_CURRENT_BUFFER) {
+    surf_parse_ensure_buffer_stack();
+    YY_CURRENT_BUFFER_LVALUE =
+      surf_parse__create_buffer(surf_parse_in, YY_BUF_SIZE);
+  }
+
+  surf_parse__init_buffer(YY_CURRENT_BUFFER, input_file);
+  surf_parse__load_buffer_state();
 }
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
  * 
  */
-    void surf_parse__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+void surf_parse__switch_to_buffer(YY_BUFFER_STATE new_buffer)
 {
-    
-       /* TODO. We should be able to replace this entire function body
-        * with
-        *              surf_parse_pop_buffer_state();
-        *              surf_parse_push_buffer_state(new_buffer);
-     */
-       surf_parse_ensure_buffer_stack ();
-       if ( YY_CURRENT_BUFFER == new_buffer )
-               return;
-
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       surf_parse__load_buffer_state( );
-
-       /* We don't actually know whether we did this switch during
-        * EOF (surf_parse_wrap()) processing, but the only time this flag
-        * is looked at is after surf_parse_wrap() is called, so it's safe
-        * to go ahead and always set it.
-        */
-       (yy_did_buffer_switch_on_eof) = 1;
+
+  /* TODO. We should be able to replace this entire function body
+   * with
+   *              surf_parse_pop_buffer_state();
+   *              surf_parse_push_buffer_state(new_buffer);
+   */
+  surf_parse_ensure_buffer_stack();
+  if (YY_CURRENT_BUFFER == new_buffer)
+    return;
+
+  if (YY_CURRENT_BUFFER) {
+    /* Flush out information for old buffer. */
+    *(yy_c_buf_p) = (yy_hold_char);
+    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  YY_CURRENT_BUFFER_LVALUE = new_buffer;
+  surf_parse__load_buffer_state();
+
+  /* We don't actually know whether we did this switch during
+   * EOF (surf_parse_wrap()) processing, but the only time this flag
+   * is looked at is after surf_parse_wrap() is called, so it's safe
+   * to go ahead and always set it.
+   */
+  (yy_did_buffer_switch_on_eof) = 1;
 }
 
-static void surf_parse__load_buffer_state  (void)
+static void surf_parse__load_buffer_state(void)
 {
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-       surf_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-       (yy_hold_char) = *(yy_c_buf_p);
+  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+  surf_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+  (yy_hold_char) = *(yy_c_buf_p);
 }
 
 /** Allocate and initialize an input buffer state.
@@ -6319,108 +6066,107 @@ static void surf_parse__load_buffer_state  (void)
  * 
  * @return the allocated buffer state.
  */
-    YY_BUFFER_STATE surf_parse__create_buffer  (FILE * file, int  size )
+YY_BUFFER_STATE surf_parse__create_buffer(FILE * file, int size)
 {
-       YY_BUFFER_STATE b;
-    
-       b = (YY_BUFFER_STATE) surf_parse_alloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in surf_parse__create_buffer()" );
+  YY_BUFFER_STATE b;
+
+  b = (YY_BUFFER_STATE) surf_parse_alloc(sizeof(struct yy_buffer_state));
+  if (!b)
+    YY_FATAL_ERROR("out of dynamic memory in surf_parse__create_buffer()");
 
-       b->yy_buf_size = size;
+  b->yy_buf_size = size;
 
-       /* yy_ch_buf has to be 2 characters longer than the size given because
-        * we need to put in 2 end-of-buffer characters.
-        */
-       b->yy_ch_buf = (char *) surf_parse_alloc(b->yy_buf_size + 2  );
-       if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in surf_parse__create_buffer()" );
+  /* yy_ch_buf has to be 2 characters longer than the size given because
+   * we need to put in 2 end-of-buffer characters.
+   */
+  b->yy_ch_buf = (char *) surf_parse_alloc(b->yy_buf_size + 2);
+  if (!b->yy_ch_buf)
+    YY_FATAL_ERROR("out of dynamic memory in surf_parse__create_buffer()");
 
-       b->yy_is_our_buffer = 1;
+  b->yy_is_our_buffer = 1;
 
-       surf_parse__init_buffer(b,file );
+  surf_parse__init_buffer(b, file);
 
-       return b;
+  return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with surf_parse__create_buffer()
  * 
  */
-    void surf_parse__delete_buffer (YY_BUFFER_STATE  b )
+void surf_parse__delete_buffer(YY_BUFFER_STATE b)
 {
-    
-       if ( ! b )
-               return;
 
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+  if (!b)
+    return;
 
-       if ( b->yy_is_our_buffer )
-               surf_parse_free((void *) b->yy_ch_buf  );
+  if (b == YY_CURRENT_BUFFER)   /* Not sure if we should pop here. */
+    YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
-       surf_parse_free((void *) b  );
+  if (b->yy_is_our_buffer)
+    surf_parse_free((void *) b->yy_ch_buf);
+
+  surf_parse_free((void *) b);
 }
 
 #ifndef __cplusplus
 #ifndef WIN32
-extern int isatty (int );
+extern int isatty(int);
 #endif
 #endif /* __cplusplus */
-    
+
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a surf_parse_restart() or at EOF.
  */
-    static void surf_parse__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
-
+static void surf_parse__init_buffer(YY_BUFFER_STATE b, FILE * file)
 {
-       int oerrno = errno;
-    
-       surf_parse__flush_buffer(b );
+  int oerrno = errno;
 
-       b->yy_input_file = file;
-       b->yy_fill_buffer = 1;
+  surf_parse__flush_buffer(b);
 
-    /* If b is the current buffer, then surf_parse__init_buffer was _probably_
-     * called from surf_parse_restart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
+  b->yy_input_file = file;
+  b->yy_fill_buffer = 1;
+
+  /* If b is the current buffer, then surf_parse__init_buffer was _probably_
+   * called from surf_parse_restart() or through yy_get_next_buffer.
+   * In that case, we don't want to reset the lineno or column.
+   */
+  if (b != YY_CURRENT_BUFFER) {
+    b->yy_bs_lineno = 1;
+    b->yy_bs_column = 0;
+  }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-    
-       errno = oerrno;
+  b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
+
+  errno = oerrno;
 }
 
 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  * 
  */
-    void surf_parse__flush_buffer (YY_BUFFER_STATE  b )
+void surf_parse__flush_buffer(YY_BUFFER_STATE b)
 {
-       if ( ! b )
-               return;
+  if (!b)
+    return;
 
-       b->yy_n_chars = 0;
+  b->yy_n_chars = 0;
 
-       /* We always need two end-of-buffer characters.  The first causes
-        * a transition to the end-of-buffer state.  The second causes
-        * a jam in that state.
-        */
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+  /* We always need two end-of-buffer characters.  The first causes
+   * a transition to the end-of-buffer state.  The second causes
+   * a jam in that state.
+   */
+  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
-       b->yy_buf_pos = &b->yy_ch_buf[0];
+  b->yy_buf_pos = &b->yy_ch_buf[0];
 
-       b->yy_at_bol = 1;
-       b->yy_buffer_status = YY_BUFFER_NEW;
+  b->yy_at_bol = 1;
+  b->yy_buffer_status = YY_BUFFER_NEW;
 
-       if ( b == YY_CURRENT_BUFFER )
-               surf_parse__load_buffer_state( );
+  if (b == YY_CURRENT_BUFFER)
+    surf_parse__load_buffer_state();
 }
 
 /** Pushes the new state onto the stack. The new state becomes
@@ -6429,96 +6175,98 @@ extern int isatty (int );
  *  @param new_buffer The new state.
  *  
  */
-void surf_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
+void surf_parse_push_buffer_state(YY_BUFFER_STATE new_buffer)
 {
-       if (new_buffer == NULL)
-               return;
-
-       surf_parse_ensure_buffer_stack();
-
-       /* This block is copied from surf_parse__switch_to_buffer. */
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       /* Only push if top exists. Otherwise, replace top. */
-       if (YY_CURRENT_BUFFER)
-               (yy_buffer_stack_top)++;
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-       /* copied from surf_parse__switch_to_buffer. */
-       surf_parse__load_buffer_state( );
-       (yy_did_buffer_switch_on_eof) = 1;
+  if (new_buffer == NULL)
+    return;
+
+  surf_parse_ensure_buffer_stack();
+
+  /* This block is copied from surf_parse__switch_to_buffer. */
+  if (YY_CURRENT_BUFFER) {
+    /* Flush out information for old buffer. */
+    *(yy_c_buf_p) = (yy_hold_char);
+    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  /* Only push if top exists. Otherwise, replace top. */
+  if (YY_CURRENT_BUFFER)
+    (yy_buffer_stack_top)++;
+  YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+  /* copied from surf_parse__switch_to_buffer. */
+  surf_parse__load_buffer_state();
+  (yy_did_buffer_switch_on_eof) = 1;
 }
 
 /** Removes and deletes the top of the stack, if present.
  *  The next element becomes the new top.
  *  
  */
-void surf_parse_pop_buffer_state (void)
+void surf_parse_pop_buffer_state(void)
 {
-       if (!YY_CURRENT_BUFFER)
-               return;
+  if (!YY_CURRENT_BUFFER)
+    return;
 
-       surf_parse__delete_buffer(YY_CURRENT_BUFFER );
-       YY_CURRENT_BUFFER_LVALUE = NULL;
-       if ((yy_buffer_stack_top) > 0)
-               --(yy_buffer_stack_top);
+  surf_parse__delete_buffer(YY_CURRENT_BUFFER);
+  YY_CURRENT_BUFFER_LVALUE = NULL;
+  if ((yy_buffer_stack_top) > 0)
+    --(yy_buffer_stack_top);
 
-       if (YY_CURRENT_BUFFER) {
-               surf_parse__load_buffer_state( );
-               (yy_did_buffer_switch_on_eof) = 1;
-       }
+  if (YY_CURRENT_BUFFER) {
+    surf_parse__load_buffer_state();
+    (yy_did_buffer_switch_on_eof) = 1;
+  }
 }
 
 /* Allocates the stack if it does not exist.
  *  Guarantees space for at least one push.
  */
-static void surf_parse_ensure_buffer_stack (void)
+static void surf_parse_ensure_buffer_stack(void)
 {
-       int num_to_alloc;
-    
-       if (!(yy_buffer_stack)) {
+  int num_to_alloc;
 
-               /* First allocation is just for 2 elements, since we don't know if this
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an
-                * immediate realloc on the next call.
-         */
-               num_to_alloc = 1;
-               (yy_buffer_stack) = (struct yy_buffer_state**)surf_parse_alloc
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in surf_parse_ensure_buffer_stack()" );
-                                                                 
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-                               
-               (yy_buffer_stack_max) = num_to_alloc;
-               (yy_buffer_stack_top) = 0;
-               return;
-       }
+  if (!(yy_buffer_stack)) {
 
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+    /* First allocation is just for 2 elements, since we don't know if this
+     * scanner will even need a stack. We use 2 instead of 1 to avoid an
+     * immediate realloc on the next call.
+     */
+    num_to_alloc = 1;
+    (yy_buffer_stack) = (struct yy_buffer_state **) surf_parse_alloc
+      (num_to_alloc * sizeof(struct yy_buffer_state *)
+      );
+    if (!(yy_buffer_stack))
+      YY_FATAL_ERROR
+        ("out of dynamic memory in surf_parse_ensure_buffer_stack()");
+
+    memset((yy_buffer_stack), 0,
+           num_to_alloc * sizeof(struct yy_buffer_state *));
+
+    (yy_buffer_stack_max) = num_to_alloc;
+    (yy_buffer_stack_top) = 0;
+    return;
+  }
 
-               /* Increase the buffer to prepare for a possible push. */
-               int grow_size = 8 /* arbitrary grow size */;
+  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
 
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;
-               (yy_buffer_stack) = (struct yy_buffer_state**)surf_parse_realloc
-                                                               ((yy_buffer_stack),
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in surf_parse_ensure_buffer_stack()" );
+    /* Increase the buffer to prepare for a possible push. */
+    int grow_size = 8 /* arbitrary grow size */ ;
 
-               /* zero only the new slots.*/
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-               (yy_buffer_stack_max) = num_to_alloc;
-       }
+    num_to_alloc = (yy_buffer_stack_max) + grow_size;
+    (yy_buffer_stack) = (struct yy_buffer_state **) surf_parse_realloc
+      ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)
+      );
+    if (!(yy_buffer_stack))
+      YY_FATAL_ERROR
+        ("out of dynamic memory in surf_parse_ensure_buffer_stack()");
+
+    /* zero only the new slots. */
+    memset((yy_buffer_stack) + (yy_buffer_stack_max), 0,
+           grow_size * sizeof(struct yy_buffer_state *));
+    (yy_buffer_stack_max) = num_to_alloc;
+  }
 }
 
 /** Setup the input buffer state to scan directly from a user-specified character buffer.
@@ -6527,33 +6275,33 @@ static void surf_parse_ensure_buffer_stack (void)
  * 
  * @return the newly allocated buffer state object. 
  */
-YY_BUFFER_STATE surf_parse__scan_buffer  (char * base, yy_size_t  size )
+YY_BUFFER_STATE surf_parse__scan_buffer(char *base, yy_size_t size)
 {
-       YY_BUFFER_STATE b;
-    
-       if ( size < 2 ||
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||
-            base[size-1] != YY_END_OF_BUFFER_CHAR )
-               /* They forgot to leave room for the EOB's. */
-               return 0;
-
-       b = (YY_BUFFER_STATE) surf_parse_alloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in surf_parse__scan_buffer()" );
-
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
-       b->yy_buf_pos = b->yy_ch_buf = base;
-       b->yy_is_our_buffer = 0;
-       b->yy_input_file = 0;
-       b->yy_n_chars = b->yy_buf_size;
-       b->yy_is_interactive = 0;
-       b->yy_at_bol = 1;
-       b->yy_fill_buffer = 0;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       surf_parse__switch_to_buffer(b  );
-
-       return b;
+  YY_BUFFER_STATE b;
+
+  if (size < 2 ||
+      base[size - 2] != YY_END_OF_BUFFER_CHAR ||
+      base[size - 1] != YY_END_OF_BUFFER_CHAR)
+    /* They forgot to leave room for the EOB's. */
+    return 0;
+
+  b = (YY_BUFFER_STATE) surf_parse_alloc(sizeof(struct yy_buffer_state));
+  if (!b)
+    YY_FATAL_ERROR("out of dynamic memory in surf_parse__scan_buffer()");
+
+  b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
+  b->yy_buf_pos = b->yy_ch_buf = base;
+  b->yy_is_our_buffer = 0;
+  b->yy_input_file = 0;
+  b->yy_n_chars = b->yy_buf_size;
+  b->yy_is_interactive = 0;
+  b->yy_at_bol = 1;
+  b->yy_fill_buffer = 0;
+  b->yy_buffer_status = YY_BUFFER_NEW;
+
+  surf_parse__switch_to_buffer(b);
+
+  return b;
 }
 
 /** Setup the input buffer state to scan a string. The next call to surf_parse_lex() will
@@ -6564,10 +6312,10 @@ YY_BUFFER_STATE surf_parse__scan_buffer  (char * base, yy_size_t  size )
  * @note If you want to scan bytes that may contain NUL values, then use
  *       surf_parse__scan_bytes() instead.
  */
-YY_BUFFER_STATE surf_parse__scan_string (yyconst char * yystr )
+YY_BUFFER_STATE surf_parse__scan_string(yyconst char *yystr)
 {
-    
-       return surf_parse__scan_bytes(yystr,strlen(yystr) );
+
+  return surf_parse__scan_bytes(yystr, strlen(yystr));
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to surf_parse_lex() will
@@ -6577,76 +6325,77 @@ YY_BUFFER_STATE surf_parse__scan_string (yyconst char * yystr )
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE surf_parse__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE surf_parse__scan_bytes(yyconst char *yybytes,
+                                       int _yybytes_len)
 {
-       YY_BUFFER_STATE b;
-       char *buf;
-       yy_size_t n;
-       int i;
-    
-       /* Get memory for full buffer, including space for trailing EOB's. */
-       n = _yybytes_len + 2;
-       buf = (char *) surf_parse_alloc(n  );
-       if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in surf_parse__scan_bytes()" );
-
-       for ( i = 0; i < _yybytes_len; ++i )
-               buf[i] = yybytes[i];
-
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-       b = surf_parse__scan_buffer(buf,n );
-       if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in surf_parse__scan_bytes()" );
-
-       /* It's okay to grow etc. this buffer, and we should throw it
-        * away when we're done.
-        */
-       b->yy_is_our_buffer = 1;
-
-       return b;
+  YY_BUFFER_STATE b;
+  char *buf;
+  yy_size_t n;
+  int i;
+
+  /* Get memory for full buffer, including space for trailing EOB's. */
+  n = _yybytes_len + 2;
+  buf = (char *) surf_parse_alloc(n);
+  if (!buf)
+    YY_FATAL_ERROR("out of dynamic memory in surf_parse__scan_bytes()");
+
+  for (i = 0; i < _yybytes_len; ++i)
+    buf[i] = yybytes[i];
+
+  buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
+
+  b = surf_parse__scan_buffer(buf, n);
+  if (!b)
+    YY_FATAL_ERROR("bad buffer in surf_parse__scan_bytes()");
+
+  /* It's okay to grow etc. this buffer, and we should throw it
+   * away when we're done.
+   */
+  b->yy_is_our_buffer = 1;
+
+  return b;
 }
 
-    static void yy_push_state (int  new_state )
+static void yy_push_state(int new_state)
 {
-       if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
-               {
-               yy_size_t new_size;
+  if ((yy_start_stack_ptr) >= (yy_start_stack_depth)) {
+    yy_size_t new_size;
 
-               (yy_start_stack_depth) += YY_START_STACK_INCR;
-               new_size = (yy_start_stack_depth) * sizeof( int );
+    (yy_start_stack_depth) += YY_START_STACK_INCR;
+    new_size = (yy_start_stack_depth) * sizeof(int);
 
-               if ( ! (yy_start_stack) )
-                       (yy_start_stack) = (int *) surf_parse_alloc(new_size  );
+    if (!(yy_start_stack))
+      (yy_start_stack) = (int *) surf_parse_alloc(new_size);
 
-               else
-                       (yy_start_stack) = (int *) surf_parse_realloc((void *) (yy_start_stack),new_size  );
+    else
+      (yy_start_stack) =
+        (int *) surf_parse_realloc((void *) (yy_start_stack), new_size);
 
-               if ( ! (yy_start_stack) )
-                       YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
-               }
+    if (!(yy_start_stack))
+      YY_FATAL_ERROR("out of memory expanding start-condition stack");
+  }
 
-       (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+  (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
 
-       BEGIN(new_state);
+  BEGIN(new_state);
 }
 
-    static void yy_pop_state  (void)
+static void yy_pop_state(void)
 {
-       if ( --(yy_start_stack_ptr) < 0 )
-               YY_FATAL_ERROR( "start-condition stack underflow" );
+  if (--(yy_start_stack_ptr) < 0)
+    YY_FATAL_ERROR("start-condition stack underflow");
 
-       BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+  BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
 }
 
 #ifndef YY_EXIT_FAILURE
 #define YY_EXIT_FAILURE 2
 #endif
 
-static void yy_fatal_error (yyconst char* msg )
+static void yy_fatal_error(yyconst char *msg)
 {
-       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
+  (void) fprintf(stderr, "%s\n", msg);
+  exit(YY_EXIT_FAILURE);
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -6671,53 +6420,53 @@ static void yy_fatal_error (yyconst char* msg )
 /** Get the current line number.
  * 
  */
-int surf_parse_get_lineno  (void)
+int surf_parse_get_lineno(void)
 {
-        
-    return surf_parse_lineno;
+
+  return surf_parse_lineno;
 }
 
 /** Get the input stream.
  * 
  */
-FILE *surf_parse_get_in  (void)
+FILE *surf_parse_get_in(void)
 {
-        return surf_parse_in;
+  return surf_parse_in;
 }
 
 /** Get the output stream.
  * 
  */
-FILE *surf_parse_get_out  (void)
+FILE *surf_parse_get_out(void)
 {
-        return surf_parse_out;
+  return surf_parse_out;
 }
 
 /** Get the length of the current token.
  * 
  */
-int surf_parse_get_leng  (void)
+int surf_parse_get_leng(void)
 {
-        return surf_parse_leng;
+  return surf_parse_leng;
 }
 
 /** Get the current token.
  * 
  */
 
-char *surf_parse_get_text  (void)
+char *surf_parse_get_text(void)
 {
-        return surf_parse_text;
+  return surf_parse_text;
 }
 
 /** Set the current line number.
  * @param line_number
  * 
  */
-void surf_parse_set_lineno (int  line_number )
+void surf_parse_set_lineno(int line_number)
 {
-    
-    surf_parse_lineno = line_number;
+
+  surf_parse_lineno = line_number;
 }
 
 /** Set the input stream. This does not discard the current
@@ -6726,85 +6475,85 @@ void surf_parse_set_lineno (int  line_number )
  * 
  * @see surf_parse__switch_to_buffer
  */
-void surf_parse_set_in (FILE *  in_str )
+void surf_parse_set_in(FILE * in_str)
 {
-        surf_parse_in = in_str ;
+  surf_parse_in = in_str;
 }
 
-void surf_parse_set_out (FILE *  out_str )
+void surf_parse_set_out(FILE * out_str)
 {
-        surf_parse_out = out_str ;
+  surf_parse_out = out_str;
 }
 
-int surf_parse_get_debug  (void)
+int surf_parse_get_debug(void)
 {
-        return surf_parse__flex_debug;
+  return surf_parse__flex_debug;
 }
 
-void surf_parse_set_debug (int  bdebug )
+void surf_parse_set_debug(int bdebug)
 {
-        surf_parse__flex_debug = bdebug ;
+  surf_parse__flex_debug = bdebug;
 }
 
-static int yy_init_globals (void)
+static int yy_init_globals(void)
 {
-        /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from surf_parse_lex_destroy(), so don't allocate here.
-     */
+  /* Initialization is the same as for the non-reentrant scanner.
+   * This function is called from surf_parse_lex_destroy(), so don't allocate here.
+   */
 
-    /* We do not touch surf_parse_lineno unless the option is enabled. */
-    surf_parse_lineno =  1;
-    
-    (yy_buffer_stack) = 0;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char *) 0;
-    (yy_init) = 0;
-    (yy_start) = 0;
+  /* We do not touch surf_parse_lineno unless the option is enabled. */
+  surf_parse_lineno = 1;
 
-    (yy_start_stack_ptr) = 0;
-    (yy_start_stack_depth) = 0;
-    (yy_start_stack) =  NULL;
+  (yy_buffer_stack) = 0;
+  (yy_buffer_stack_top) = 0;
+  (yy_buffer_stack_max) = 0;
+  (yy_c_buf_p) = (char *) 0;
+  (yy_init) = 0;
+  (yy_start) = 0;
+
+  (yy_start_stack_ptr) = 0;
+  (yy_start_stack_depth) = 0;
+  (yy_start_stack) = NULL;
 
 /* Defined in main.c */
 #ifdef YY_STDINIT
-    surf_parse_in = stdin;
-    surf_parse_out = stdout;
+  surf_parse_in = stdin;
+  surf_parse_out = stdout;
 #else
-    surf_parse_in = (FILE *) 0;
-    surf_parse_out = (FILE *) 0;
+  surf_parse_in = (FILE *) 0;
+  surf_parse_out = (FILE *) 0;
 #endif
 
-    /* For future reference: Set errno on error, since we are called by
-     * surf_parse_lex_init()
-     */
-    return 0;
+  /* For future reference: Set errno on error, since we are called by
+   * surf_parse_lex_init()
+   */
+  return 0;
 }
 
 /* surf_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
-int surf_parse_lex_destroy  (void)
+int surf_parse_lex_destroy(void)
 {
-    
-    /* Pop the buffer stack, destroying each element. */
-       while(YY_CURRENT_BUFFER){
-               surf_parse__delete_buffer(YY_CURRENT_BUFFER  );
-               YY_CURRENT_BUFFER_LVALUE = NULL;
-               surf_parse_pop_buffer_state();
-       }
 
-       /* Destroy the stack itself. */
-       surf_parse_free((yy_buffer_stack) );
-       (yy_buffer_stack) = NULL;
+  /* Pop the buffer stack, destroying each element. */
+  while (YY_CURRENT_BUFFER) {
+    surf_parse__delete_buffer(YY_CURRENT_BUFFER);
+    YY_CURRENT_BUFFER_LVALUE = NULL;
+    surf_parse_pop_buffer_state();
+  }
 
-    /* Destroy the start condition stack. */
-        surf_parse_free((yy_start_stack)  );
-        (yy_start_stack) = NULL;
+  /* Destroy the stack itself. */
+  surf_parse_free((yy_buffer_stack));
+  (yy_buffer_stack) = NULL;
 
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * surf_parse_lex() is called, initialization will occur. */
-    yy_init_globals( );
+  /* Destroy the start condition stack. */
+  surf_parse_free((yy_start_stack));
+  (yy_start_stack) = NULL;
 
-    return 0;
+  /* Reset the globals. This is important in a non-reentrant scanner so the next time
+   * surf_parse_lex() is called, initialization will occur. */
+  yy_init_globals();
+
+  return 0;
 }
 
 /*
@@ -6812,45 +6561,44 @@ int surf_parse_lex_destroy  (void)
  */
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+static void yy_flex_strncpy(char *s1, yyconst char *s2, int n)
 {
-       register int i;
-       for ( i = 0; i < n; ++i )
-               s1[i] = s2[i];
+  register int i;
+  for (i = 0; i < n; ++i)
+    s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
+static int yy_flex_strlen(yyconst char *s)
 {
-       register int n;
-       for ( n = 0; s[n]; ++n )
-               ;
+  register int n;
+  for (n = 0; s[n]; ++n);
 
-       return n;
+  return n;
 }
 #endif
 
-void *surf_parse_alloc (yy_size_t  size )
+void *surf_parse_alloc(yy_size_t size)
 {
-       return (void *) malloc( size );
+  return (void *) malloc(size);
 }
 
-void *surf_parse_realloc  (void * ptr, yy_size_t  size )
+void *surf_parse_realloc(void *ptr, yy_size_t size)
 {
-       /* The cast to (char *) in the following accommodates both
-        * implementations that use char* generic pointers, and those
-        * that use void* generic pointers.  It works with the latter
-        * because both ANSI C and C++ allow castless assignment from
-        * any pointer type to void*, and deal with argument conversions
-        * as though doing an assignment.
-        */
-       return (void *) realloc( (char *) ptr, size );
+  /* The cast to (char *) in the following accommodates both
+   * implementations that use char* generic pointers, and those
+   * that use void* generic pointers.  It works with the latter
+   * because both ANSI C and C++ allow castless assignment from
+   * any pointer type to void*, and deal with argument conversions
+   * as though doing an assignment.
+   */
+  return (void *) realloc((char *) ptr, size);
 }
 
-void surf_parse_free (void * ptr )
+void surf_parse_free(void *ptr)
 {
-       free( (char *) ptr );   /* see surf_parse_realloc() for (char *) cast */
+  free((char *) ptr);           /* see surf_parse_realloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
@@ -6858,96 +6606,101 @@ void surf_parse_free (void * ptr )
 /* Element context stack lookup. */
 int surfxml_element_context(int i)
 {
-  return (0<i && i<yy_start_stack_depth
-         ? yy_start_stack[yy_start_stack_ptr - i]
-         : 0);
+  return (0 < i && i < yy_start_stack_depth
+          ? yy_start_stack[yy_start_stack_ptr - i]
+          : 0);
 }
 
 #ifdef FLEX_DEBUG
-void print_yy_stack(charfmt, ...)
+void print_yy_stack(char *fmt, ...)
 {
-  int i = 0; va_list ap; va_start(ap, fmt);
+  int i = 0;
+  va_list ap;
+  va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
   if (surfxml_statenames) {
-      for (i=1; i<yy_start_stack_ptr; i++) {
-          fprintf(stderr, "%s/", surfxml_statenames[yy_start_stack[i] ]);
-      }
-      fprintf(stderr,"%s\n", surfxml_statenames[YY_START]);
+    for (i = 1; i < yy_start_stack_ptr; i++) {
+      fprintf(stderr, "%s/", surfxml_statenames[yy_start_stack[i]]);
+    }
+    fprintf(stderr, "%s\n", surfxml_statenames[YY_START]);
   }
   va_end(ap);
 }
 
 void print_surfxml_bufferstack()
 {
-    int i;
-    fputs("Buffer: ", stderr);
-    for (i = 0; i < blimit; i++) {
-       if ( surfxml_bufferstack[i] == '\377' ) break;
-         putc(surfxml_bufferstack[i], stderr);
-    }
-    putc('\n', stderr);
+  int i;
+  fputs("Buffer: ", stderr);
+  for (i = 0; i < blimit; i++) {
+    if (surfxml_bufferstack[i] == '\377')
+      break;
+    putc(surfxml_bufferstack[i], stderr);
+  }
+  putc('\n', stderr);
 }
 
-static void debug_enter(int state, const char* statename) {
+static void debug_enter(int state, const char *statename)
+{
   yy_push_state(state);
   if (surf_parse__flex_debug) {
-       print_yy_stack("--ENTER(%s) : ",statename);
-       print_surfxml_bufferstack();
+    print_yy_stack("--ENTER(%s) : ", statename);
+    print_surfxml_bufferstack();
   }
 }
 
-static void debug_leave(void) {
-    if (surf_parse__flex_debug) {
-        print_yy_stack("--LEAVE : ");
-       print_surfxml_bufferstack();
-    }
+static void debug_leave(void)
+{
+  if (surf_parse__flex_debug) {
+    print_yy_stack("--LEAVE : ");
+    print_surfxml_bufferstack();
+  }
   yy_pop_state();
 }
 
-static void debug_set(int state, const char* statename) {
+static void debug_set(int state, const char *statename)
+{
   BEGIN(state);
-  if (surf_parse__flex_debug) print_yy_stack("--SET(%s) : ",statename);
+  if (surf_parse__flex_debug)
+    print_yy_stack("--SET(%s) : ", statename);
 }
 #endif
 
 static void cleanup(void)
 {
-    if (surfxml_statenames) {
-        free(surfxml_statenames);
-       surfxml_statenames = NULL;
-    }
-    free(surfxml_bufferstack);
-    surfxml_bufferstack = NULL;
+  if (surfxml_statenames) {
+    free(surfxml_statenames);
+    surfxml_statenames = NULL;
+  }
+  free(surfxml_bufferstack);
+  surfxml_bufferstack = NULL;
 
-    free(indexstack);
-    indexstack = NULL;
+  free(indexstack);
+  indexstack = NULL;
 }
 
-static int fail(const charfmt, ...)
+static int fail(const char *fmt, ...)
 {
-    int chars_left, used;
-    va_list ap; va_start(ap, fmt);
+  int chars_left, used;
+  va_list ap;
+  va_start(ap, fmt);
 #ifdef FLEXML_yylineno
-    used = sprintf(flexml_err_msg,
-                  "Invalid XML (XML input line %d, state %d): ",
-                  surf_parse_lineno, YY_START);
+  used = sprintf(flexml_err_msg,
+                 "Invalid XML (XML input line %d, state %d): ",
+                 surf_parse_lineno, YY_START);
 #else
-    used = sprintf(flexml_err_msg,
-                  "Invalid XML (state %d): ",
-                  YY_START);
+  used = sprintf(flexml_err_msg, "Invalid XML (state %d): ", YY_START);
 #endif
-    chars_left = flexml_max_err_msg_size - used - 1;
-    vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
-    va_end(ap);
+  chars_left = flexml_max_err_msg_size - used - 1;
+  vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
+  va_end(ap);
 
 #ifndef FLEXML_quiet_parser
-    /* print directly to sdterr */
-    fprintf(stderr, "%s\n", flexml_err_msg);
-    flexml_err_msg[0] = '\0';
+  /* print directly to sdterr */
+  fprintf(stderr, "%s\n", flexml_err_msg);
+  flexml_err_msg[0] = '\0';
 #endif
 
-    cleanup();
+  cleanup();
 
-    return 1;
+  return 1;
 }
-
index a1d6ebf..564e4a0 100644 (file)
@@ -11,7 +11,7 @@
 #include "xbt/module.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf,
-                               "Logging specific to SURF (kernel)");
+                                "Logging specific to SURF (kernel)");
 
 int use_sdp_solver = 0;
 int use_lagrange_solver = 0;
@@ -52,7 +52,7 @@ static const char *disk_drives_letter_table[MAX_DRIVE] = {
   "Y:\\",
   "Z:\\"
 };
-#endif                         /* #ifdef _WIN32 */
+#endif /* #ifdef _WIN32 */
 
 /*
  * Returns the initial path. On Windows the initial path is
@@ -139,31 +139,31 @@ s_surf_model_description_t surf_network_model_description[] = {
   {"Reno", NULL, surf_network_model_init_Reno},
   {"Reno2", NULL, surf_network_model_init_Reno2},
   {"Vegas", NULL, surf_network_model_init_Vegas},
-  { NULL,NULL,NULL} /* this array must be NULL terminated */
+  {NULL, NULL, NULL}            /* this array must be NULL terminated */
 };
 
 s_surf_model_description_t surf_cpu_model_description[] = {
   {"Cas01", NULL, surf_cpu_model_init_Cas01},
-  { NULL,NULL,NULL} /* this array must be NULL terminated */
+  {NULL, NULL, NULL}            /* this array must be NULL terminated */
 };
 
 s_surf_model_description_t surf_workstation_model_description[] = {
   {"CLM03", NULL, surf_workstation_model_init_CLM03, create_workstations},
-  {"compound", NULL, surf_workstation_model_init_compound, create_workstations},
+  {"compound", NULL, surf_workstation_model_init_compound,
+   create_workstations},
   {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07, NULL},
-  { NULL,NULL,NULL} /* this array must be NULL terminated */
+  {NULL, NULL, NULL}            /* this array must be NULL terminated */
 };
 
 void update_model_description(s_surf_model_description_t * table,
-                             const char *name,
-                             surf_model_t model)
+                              const char *name, surf_model_t model)
 {
   int i = find_model_description(table, name);
   table[i].model = model;
 }
 
 int find_model_description(s_surf_model_description_t * table,
-                          const char *name)
+                           const char *name)
 {
   int i;
   char *name_list = NULL;
@@ -175,19 +175,18 @@ int find_model_description(s_surf_model_description_t * table,
   name_list = strdup(table[0].name);
   for (i = 1; table[i].name; i++) {
     name_list =
-       xbt_realloc(name_list,
-                   strlen(name_list) + strlen(table[i].name) + 2);
+      xbt_realloc(name_list, strlen(name_list) + strlen(table[i].name) + 2);
     strcat(name_list, ", ");
     strcat(name_list, table[i].name);
   }
   xbt_assert2(0, "Model '%s' is invalid! Valid models are: %s.", name,
-             name_list);
+              name_list);
 }
 
 double generic_maxmin_share_resources(xbt_swag_t running_actions,
-                                     size_t offset,
-                                     lmm_system_t sys,
-                                     void (*solve) (lmm_system_t))
+                                      size_t offset,
+                                      lmm_system_t sys,
+                                      void (*solve) (lmm_system_t))
 {
   surf_action_t action = NULL;
   double min = -1;
@@ -207,9 +206,9 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions,
     return -1.0;
 
   if (value > 0) {
-    if(action->remains>0) 
+    if (action->remains > 0)
       min = action->remains / value;
-    else 
+    else
       min = 0.0;
     if ((action->max_duration >= 0) && (action->max_duration < min))
       min = action->max_duration;
@@ -218,17 +217,16 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions,
 
 
   for (action = xbt_swag_getNext(action, running_actions->offset);
-       action;
-       action = xbt_swag_getNext(action, running_actions->offset)) {
+       action; action = xbt_swag_getNext(action, running_actions->offset)) {
     value = lmm_variable_getvalue(VARIABLE(action));
     if (value > 0) {
-      if(action->remains>0) 
-       value = action->remains / value;
-      else 
-       value = 0.0;
+      if (action->remains > 0)
+        value = action->remains / value;
+      else
+        value = 0.0;
       if (value < min) {
-       min = value;
-       DEBUG2("Updating min (value) with %p: %f", action, min);
+        min = value;
+        DEBUG2("Updating min (value) with %p: %f", action, min);
       }
     }
     if ((action->max_duration >= 0) && (action->max_duration < min)) {
@@ -245,7 +243,7 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions,
 e_surf_action_state_t surf_action_get_state(surf_action_t action)
 {
   surf_action_state_t action_state =
-      &(action->model_type->common_public->states);
+    &(action->model_type->common_public->states);
 
   if (action->state_set == action_state->ready_action_set)
     return SURF_ACTION_READY;
@@ -276,10 +274,10 @@ void surf_action_free(surf_action_t * action)
 }
 
 void surf_action_change_state(surf_action_t action,
-                             e_surf_action_state_t state)
+                              e_surf_action_state_t state)
 {
   surf_action_state_t action_state =
-      &(action->model_type->common_public->states);
+    &(action->model_type->common_public->states);
   XBT_IN2("(%p,%s)", action, surf_action_state_names[state]);
   xbt_swag_remove(action, action->state_set);
 
@@ -315,11 +313,11 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_timer);
 XBT_LOG_EXTERNAL_CATEGORY(surf_workstation);
 
 #ifdef HAVE_SDP
-  XBT_LOG_EXTERNAL_CATEGORY(surf_sdp_out);
-  XBT_LOG_EXTERNAL_CATEGORY(surf_sdp);
+XBT_LOG_EXTERNAL_CATEGORY(surf_sdp_out);
+XBT_LOG_EXTERNAL_CATEGORY(surf_sdp);
 #endif
 #ifdef HAVE_GTNETS
-  XBT_LOG_EXTERNAL_CATEGORY(surf_network_gtnets);
+XBT_LOG_EXTERNAL_CATEGORY(surf_network_gtnets);
 #endif
 
 void surf_init(int *argc, char **argv)
@@ -333,7 +331,7 @@ void surf_init(int *argc, char **argv)
   XBT_LOG_CONNECT(surf_cpu, surf);
   XBT_LOG_CONNECT(surf_kernel, surf);
   XBT_LOG_CONNECT(surf_lagrange, surf);
-    XBT_LOG_CONNECT(surf_lagrange_dichotomy, surf_lagrange);
+  XBT_LOG_CONNECT(surf_lagrange_dichotomy, surf_lagrange);
   XBT_LOG_CONNECT(surf_maxmin, surf);
   XBT_LOG_CONNECT(surf_network, surf);
   XBT_LOG_CONNECT(surf_parse, surf);
@@ -347,7 +345,7 @@ void surf_init(int *argc, char **argv)
 #ifdef HAVE_GTNETS
   XBT_LOG_CONNECT(surf_network_gtnets, surf);
 #endif
-   
+
   xbt_init(argc, argv);
   if (!surf_path) {
 
@@ -355,23 +353,23 @@ void surf_init(int *argc, char **argv)
     initial_path = __surf_get_initial_path();
 
     xbt_assert0((initial_path),
-               "__surf_get_initial_path() failed! Can't resolves current Windows directory");
+                "__surf_get_initial_path() failed! Can't resolves current Windows directory");
 
     surf_path = xbt_dynar_new(sizeof(char *), NULL);
     xbt_dynar_push(surf_path, &initial_path);
 
     for (i = 1; i < *argc; i++) {
       if (!strncmp(argv[i], "--surf-path=", strlen("--surf-path="))) {
-       opt = strchr(argv[i], '=');
-       opt++;
-       xbt_dynar_push(surf_path, &opt);
-       /*remove this from argv */
-       for (j = i + 1; j < *argc; j++) {
-         argv[j - 1] = argv[j];
-       }
-       argv[j - 1] = NULL;
-       (*argc)--;
-       i--;                    /* compensate effect of next loop incrementation */
+        opt = strchr(argv[i], '=');
+        opt++;
+        xbt_dynar_push(surf_path, &opt);
+        /*remove this from argv */
+        for (j = i + 1; j < *argc; j++) {
+          argv[j - 1] = argv[j];
+        }
+        argv[j - 1] = NULL;
+        (*argc)--;
+        i--;                    /* compensate effect of next loop incrementation */
       }
     }
   }
@@ -387,17 +385,17 @@ FILE *surf_fopen(const char *name, const char *mode)
   unsigned int iter;
   char *path = NULL;
   FILE *file = NULL;
-  unsigned int path_name_len = 0;      /* don't count '\0' */
+  unsigned int path_name_len = 0;       /* don't count '\0' */
 
   xbt_assert0(name, "Need a non-NULL file name");
 
   xbt_assert0(surf_path,
-             "surf_init has to be called before using surf_fopen");
+              "surf_init has to be called before using surf_fopen");
 
-  if (__surf_is_absolute_file_path(name)) {    /* don't mess with absolute file names */
+  if (__surf_is_absolute_file_path(name)) {     /* don't mess with absolute file names */
     return fopen(name, mode);
 
-  } else {                     /* search relative files in the path */
+  } else {                      /* search relative files in the path */
 
     if (!path_name) {
       path_name_len = strlen(name);
@@ -406,17 +404,17 @@ FILE *surf_fopen(const char *name, const char *mode)
 
     xbt_dynar_foreach(surf_path, iter, path) {
       if (path_name_len < strlen(path) + strlen(name) + 1) {
-       path_name_len = strlen(path) + strlen(name) + 1;        /* plus '/' */
-       path_name = xbt_realloc(path_name, path_name_len + 1);
+        path_name_len = strlen(path) + strlen(name) + 1;        /* plus '/' */
+        path_name = xbt_realloc(path_name, path_name_len + 1);
       }
-      #ifdef WIN32
+#ifdef WIN32
       sprintf(path_name, "%s\\%s", path, name);
-      #else
+#else
       sprintf(path_name, "%s/%s", path, name);
-      #endif
+#endif
       file = fopen(path_name, mode);
       if (file)
-       return file;
+        return file;
     }
   }
   return file;
@@ -453,34 +451,35 @@ void surf_exit(void)
   }
   surf_parse_free_callbacks();
   xbt_dict_free(&route_table);
-  NOW=0; /* Just in case the user plans to restart the simulation afterward */
+  NOW = 0;                      /* Just in case the user plans to restart the simulation afterward */
   xbt_exit();
 }
 
-void surf_presolve(void) {
+void surf_presolve(void)
+{
   double next_event_date = -1.0;
   tmgr_trace_event_t event = NULL;
   double value = -1.0;
   surf_model_object_t model_obj = NULL;
   surf_model_t model = NULL;
   unsigned int iter;
-   
-    DEBUG0
-       ("First Run! Let's \"purge\" events and put models in the right state");
-    while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
-      if (next_event_date > NOW)
-       break;
-      while ((event =
-             tmgr_history_get_next_event_leq(history, next_event_date,
-                                             &value,
-                                             (void **) &model_obj))) {
-       model_obj->model->common_private->
-         update_resource_state(model_obj, event, value,NOW);
-      }
-    }
-    xbt_dynar_foreach(model_list, iter, model) {
-      model->common_private->update_actions_state(NOW, 0.0);
+
+  DEBUG0
+    ("First Run! Let's \"purge\" events and put models in the right state");
+  while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
+    if (next_event_date > NOW)
+      break;
+    while ((event =
+            tmgr_history_get_next_event_leq(history, next_event_date,
+                                            &value, (void **) &model_obj))) {
+      model_obj->model->common_private->update_resource_state(model_obj,
+                                                              event, value,
+                                                              NOW);
     }
+  }
+  xbt_dynar_foreach(model_list, iter, model) {
+    model->common_private->update_actions_state(NOW, 0.0);
+  }
 }
 
 double surf_solve(void)
@@ -499,12 +498,11 @@ double surf_solve(void)
   DEBUG0("Looking for next action end");
   xbt_dynar_foreach(model_list, iter, model) {
     DEBUG1("Running for Resource [%s]", model->common_public->name);
-    model_next_action_end =
-       model->common_private->share_resources(NOW);
+    model_next_action_end = model->common_private->share_resources(NOW);
     DEBUG2("Resource [%s] : next action end = %f",
-          model->common_public->name, model_next_action_end);
+           model->common_public->name, model_next_action_end);
     if (((min < 0.0) || (model_next_action_end < min))
-       && (model_next_action_end >= 0.0))
+        && (model_next_action_end >= 0.0))
       min = model_next_action_end;
   }
   DEBUG1("Next action end : %f", min);
@@ -519,20 +517,18 @@ double surf_solve(void)
       break;
     DEBUG0("Updating models");
     while ((event =
-           tmgr_history_get_next_event_leq(history, next_event_date,
-                                           &value,
-                                           (void **) &model_obj))) {
-      if (model_obj->model->common_private->
-         resource_used(model_obj)) {
-       min = next_event_date - NOW;
-       DEBUG1
-           ("This event will modify model state. Next event set to %f",
-            min);
+            tmgr_history_get_next_event_leq(history, next_event_date,
+                                            &value, (void **) &model_obj))) {
+      if (model_obj->model->common_private->resource_used(model_obj)) {
+        min = next_event_date - NOW;
+        DEBUG1
+          ("This event will modify model state. Next event set to %f", min);
       }
       /* update state of model_obj according to new value. Does not touch lmm.
          It will be modified if needed when updating actions */
-      model_obj->model->common_private->
-       update_resource_state(model_obj, event, value,NOW+min);
+      model_obj->model->common_private->update_resource_state(model_obj,
+                                                              event, value,
+                                                              NOW + min);
     }
   }
 
index 21de0d3..4d41932 100644 (file)
@@ -21,8 +21,8 @@
 extern const char *surf_action_state_names[6];
 
 typedef enum {
-  SURF_LINK_ON = 1,    /* Ready        */
-  SURF_LINK_OFF = 0    /* Running      */
+  SURF_LINK_ON = 1,             /* Ready        */
+  SURF_LINK_OFF = 0             /* Running      */
 } e_surf_link_state_t;
 
 typedef enum {
@@ -38,7 +38,7 @@ typedef struct surf_model_private {
   /* Update the actions' state */
   void (*update_actions_state) (double now, double delta);
   void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
-                                double value, double time);
+                                 double value, double time);
   void (*finalize) (void);
 } s_surf_model_private_t;
 
@@ -49,9 +49,9 @@ extern int use_sdp_solver;
 extern int use_lagrange_solver;
 
 double generic_maxmin_share_resources(xbt_swag_t running_actions,
-                                      size_t offset,
-                                      lmm_system_t sys,
-                                      void (*solve)(lmm_system_t));
+                                      size_t offset,
+                                      lmm_system_t sys,
+                                      void (*solve) (lmm_system_t));
 
 /* Generic functions common to all modelss */
 e_surf_action_state_t surf_action_get_state(surf_action_t action);
@@ -59,10 +59,9 @@ double surf_action_get_start_time(surf_action_t action);
 double surf_action_get_finish_time(surf_action_t action);
 void surf_action_free(surf_action_t * action);
 void surf_action_change_state(surf_action_t action,
-                             e_surf_action_state_t state);
-void surf_action_set_data(surf_action_t action,
-                         void *data);
-FILE * surf_fopen(const char *name, const char *mode);
+                              e_surf_action_state_t state);
+void surf_action_set_data(surf_action_t action, void *data);
+FILE *surf_fopen(const char *name, const char *mode);
 
 extern tmgr_history_t history;
 extern xbt_dynar_t surf_path;
@@ -73,12 +72,12 @@ extern xbt_dynar_t surf_path;
  * case the function returns "./" that represents the current
  * directory on Unix/Linux platforms.
  */
-const char__surf_get_initial_path(void);
+const char *__surf_get_initial_path(void);
 
 /* The __surf_is_absolute_file_path() returns 1 if
  * file_path is a absolute file path, in the other
  * case the function returns 0.
  */
-int __surf_is_absolute_file_path(const charfile_path);
+int __surf_is_absolute_file_path(const char *file_path);
 
-#endif                         /* _SURF_SURF_PRIVATE_H */
+#endif /* _SURF_SURF_PRIVATE_H */
index d61560c..79d9193 100644 (file)
@@ -9,7 +9,7 @@
 #include "surf_timer_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_timer, surf,
-                               "Logging specific to SURF (timer)");
+                                "Logging specific to SURF (timer)");
 
 surf_timer_model_t surf_timer_model = NULL;
 static tmgr_trace_t empty_trace = NULL;
@@ -89,7 +89,7 @@ static void action_recycle(surf_action_t action)
 }
 
 static void action_change_state(surf_action_t action,
-                               e_surf_action_state_t state)
+                                e_surf_action_state_t state)
 {
   DIE_IMPOSSIBLE;
   return;
@@ -114,8 +114,8 @@ static void update_actions_state(double now, double delta)
 }
 
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double date)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double date)
 {
   command_t command = id;
 
@@ -178,14 +178,10 @@ static void finalize(void)
   xbt_swag_free(command_pending);
   xbt_swag_free(command_to_run);
 
-  xbt_swag_free(surf_timer_model->common_public->states.
-               ready_action_set);
-  xbt_swag_free(surf_timer_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_timer_model->common_public->states.
-               failed_action_set);
-  xbt_swag_free(surf_timer_model->common_public->states.
-               done_action_set);
+  xbt_swag_free(surf_timer_model->common_public->states.ready_action_set);
+  xbt_swag_free(surf_timer_model->common_public->states.running_action_set);
+  xbt_swag_free(surf_timer_model->common_public->states.failed_action_set);
+  xbt_swag_free(surf_timer_model->common_public->states.done_action_set);
   free(surf_timer_model->common_public);
   free(surf_timer_model->common_private);
   free(surf_timer_model->extension_public);
@@ -200,43 +196,37 @@ static void surf_timer_model_init_internal(void)
 
   surf_timer_model = xbt_new0(s_surf_timer_model_t, 1);
 
-  surf_timer_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
-  surf_timer_model->common_public =
-      xbt_new0(s_surf_model_public_t, 1);
+  surf_timer_model->common_private = xbt_new0(s_surf_model_private_t, 1);
+  surf_timer_model->common_public = xbt_new0(s_surf_model_public_t, 1);
 
   surf_timer_model->extension_public =
-      xbt_new0(s_surf_timer_model_extension_public_t, 1);
+    xbt_new0(s_surf_timer_model_extension_public_t, 1);
 
   surf_timer_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_timer_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_timer_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_timer_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_timer_model->common_public->name_service = name_service;
-  surf_timer_model->common_public->get_resource_name =
-      get_resource_name;
-  surf_timer_model->common_public->action_get_state =
-      surf_action_get_state;
+  surf_timer_model->common_public->get_resource_name = get_resource_name;
+  surf_timer_model->common_public->action_get_state = surf_action_get_state;
   surf_timer_model->common_public->action_free = action_free;
   surf_timer_model->common_public->action_cancel = action_cancel;
   surf_timer_model->common_public->action_recycle = action_recycle;
-  surf_timer_model->common_public->action_change_state =
-      action_change_state;
-  surf_timer_model->common_public->action_set_data =
-      surf_action_set_data;
+  surf_timer_model->common_public->action_change_state = action_change_state;
+  surf_timer_model->common_public->action_set_data = surf_action_set_data;
   surf_timer_model->common_public->name = "TIMER";
 
   surf_timer_model->common_private->resource_used = resource_used;
   surf_timer_model->common_private->share_resources = share_resources;
   surf_timer_model->common_private->update_actions_state =
-      update_actions_state;
+    update_actions_state;
   surf_timer_model->common_private->update_resource_state =
-      update_resource_state;
+    update_resource_state;
   surf_timer_model->common_private->finalize = finalize;
 
   surf_timer_model->common_public->suspend = action_suspend;
@@ -248,10 +238,8 @@ static void surf_timer_model_init_internal(void)
 
   {
     s_command_t var;
-    command_pending =
-       xbt_swag_new(xbt_swag_offset(var, command_set_hookup));
-    command_to_run =
-       xbt_swag_new(xbt_swag_offset(var, command_set_hookup));
+    command_pending = xbt_swag_new(xbt_swag_offset(var, command_set_hookup));
+    command_to_run = xbt_swag_new(xbt_swag_offset(var, command_set_hookup));
   }
 
   empty_trace = tmgr_empty_trace_new();
index 584f73c..e2b76f4 100644 (file)
@@ -17,8 +17,8 @@
 /* } s_surf_action_timer_t, *surf_action_timer_t; */
 
 typedef struct command {
-  surf_model_t model;  /* Any such object, added in a trace
-                                  should start by this field!!! */
+  surf_model_t model;           /* Any such object, added in a trace
+                                   should start by this field!!! */
   void *function;
   void *args;
   s_xbt_swag_hookup_t command_set_hookup;
@@ -26,4 +26,4 @@ typedef struct command {
 
 extern xbt_dict_t command_set;
 
-#endif                         /* _SURF_TIMER_PRIVATE_H */
+#endif /* _SURF_TIMER_PRIVATE_H */
index c711cca..7bac0d6 100644 (file)
@@ -13,7 +13,7 @@
 #include "surf/surf_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf,
-                               "Logging specific to the SURF parsing module");
+                                "Logging specific to the SURF parsing module");
 #undef CLEANUP
 #include "simgrid_dtd.c"
 
@@ -30,12 +30,13 @@ xbt_dict_t trace_connect_list_latency = NULL;
 /* This buffer is used to store the original buffer before substituing it by out own buffer. Usefull for the foreach tag */
 static xbt_dynar_t surfxml_bufferstack_stack = NULL;
 static int surfxml_bufferstack_size = 2048;
-static char *old_buff=NULL;
+static char *old_buff = NULL;
 static void surf_parse_error(char *msg);
 
 static void push_surfxml_bufferstack(int new)
 {
-  if(!new) old_buff = surfxml_bufferstack;
+  if (!new)
+    old_buff = surfxml_bufferstack;
   else {
     xbt_dynar_push(surfxml_bufferstack_stack, &surfxml_bufferstack);
     surfxml_bufferstack = xbt_new0(char, surfxml_bufferstack_size);
@@ -44,7 +45,8 @@ static void push_surfxml_bufferstack(int new)
 
 static void pop_surfxml_bufferstack(int new)
 {
-  if(!new) surfxml_bufferstack = old_buff;
+  if (!new)
+    surfxml_bufferstack = old_buff;
   else {
     free(surfxml_bufferstack);
     xbt_dynar_pop(surfxml_bufferstack_stack, &surfxml_bufferstack);
@@ -52,7 +54,7 @@ static void pop_surfxml_bufferstack(int new)
 }
 
 /* Stores the set name reffered to by the foreach tag */
-static charforeach_set_name;
+static char *foreach_set_name;
 static xbt_dynar_t main_STag_surfxml_host_cb_list = NULL;
 static xbt_dynar_t main_ETag_surfxml_host_cb_list = NULL;
 static xbt_dynar_t main_STag_surfxml_link_cb_list = NULL;
@@ -167,38 +169,44 @@ void surf_parse_free_callbacks(void)
 void surf_parse_reset_parser(void)
 {
   surf_parse_free_callbacks();
-  STag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_link_c_ctn_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_route_c_multi_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_route_c_multi_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_trace_c_connect_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_trace_c_connect_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
+  STag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_platform_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_router_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_route_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_link_c_ctn_cb_list =
+    xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_link_c_ctn_cb_list =
+    xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_process_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_argument_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_prop_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_set_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_foreach_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_route_c_multi_cb_list =
+    xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_route_c_multi_cb_list =
+    xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_cluster_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_trace_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_trace_c_connect_cb_list =
+    xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_trace_c_connect_cb_list =
+    xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_random_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
 }
 
 void STag_surfxml_include(void)
@@ -208,7 +216,7 @@ void STag_surfxml_include(void)
 
   surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r");
   xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n",
-             A_surfxml_include_file);
+              A_surfxml_include_file);
   surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10);
   surf_parse__switch_to_buffer(surf_input_buffer);
   printf("STAG\n");
@@ -232,22 +240,22 @@ void STag_surfxml_platform(void)
   sscanf(A_surfxml_platform_version, "%lg", &version);
 
   xbt_assert0((version >= 1.0), "******* BIG FAT WARNING *********\n "
-             "You're using an ancient XML file. "
-             "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
-             "instead of MBytes, MFlops and seconds. "
-             "A script (surfxml_update.pl) to help you convert your old "
-             "platform files "
-             "is available in the contrib/platform_generation directory "
-             "of the simgrid repository. Please check also out the "
-             "SURF section of the ChangeLog for the 3.1 version. "
-             "Last, do not forget to also update your values for "
-             "the calls to MSG_task_create (if any).");
+              "You're using an ancient XML file. "
+              "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
+              "instead of MBytes, MFlops and seconds. "
+              "A script (surfxml_update.pl) to help you convert your old "
+              "platform files "
+              "is available in the contrib/platform_generation directory "
+              "of the simgrid repository. Please check also out the "
+              "SURF section of the ChangeLog for the 3.1 version. "
+              "Last, do not forget to also update your values for "
+              "the calls to MSG_task_create (if any).");
   xbt_assert0((version >= 2.0), "******* BIG FAT WARNING *********\n "
-             "You're using an old XML file. "
-             "A script (surfxml_update.pl) to help you convert your old "
-             "platform files "
-             "is available in the contrib/platform_generation directory "
-             "of the simgrid repository.");
+              "You're using an old XML file. "
+              "A script (surfxml_update.pl) to help you convert your old "
+              "platform files "
+              "is available in the contrib/platform_generation directory "
+              "of the simgrid repository.");
 
   surfxml_call_cb_functions(STag_surfxml_platform_cb_list);
 
@@ -336,6 +344,7 @@ void STag_surfxml_prop(void)
 {
   surfxml_call_cb_functions(STag_surfxml_prop_cb_list);
 }
+
 void ETag_surfxml_prop(void)
 {
   surfxml_call_cb_functions(ETag_surfxml_prop_cb_list);
@@ -430,11 +439,11 @@ void ETag_surfxml_random(void)
 
 void surf_parse_open(const char *file)
 {
-  static int warned = 0;       /* warn only once */
+  static int warned = 0;        /* warn only once */
   if (!file) {
     if (!warned) {
       WARN0
-         ("Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.");
+        ("Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.");
       warned = 1;
     }
     return;
@@ -474,8 +483,8 @@ int_f_void_t surf_parse = _surf_parse;
 
 void surf_parse_error(char *msg)
 {
-   fprintf(stderr,"Parse error on line %d: %s\n",surf_parse_lineno,msg);
-   abort();
+  fprintf(stderr, "Parse error on line %d: %s\n", surf_parse_lineno, msg);
+  abort();
 }
 
 
@@ -485,7 +494,7 @@ void surf_parse_get_double(double *value, const char *string)
 
   ret = sscanf(string, "%lg", value);
   if (ret != 1)
-     surf_parse_error(bprintf("%s is not a double", string));
+    surf_parse_error(bprintf("%s is not a double", string));
 }
 
 void surf_parse_get_int(int *value, const char *string)
@@ -494,7 +503,7 @@ void surf_parse_get_int(int *value, const char *string)
 
   ret = sscanf(string, "%d", value);
   if (ret != 1)
-     surf_parse_error(bprintf("%s is not an integer", string));
+    surf_parse_error(bprintf("%s is not an integer", string));
 }
 
 void surf_parse_get_trace(tmgr_trace_t * trace, const char *string)
@@ -509,10 +518,11 @@ void parse_properties(void)
 {
   char *value = NULL;
 
-  if(!current_property_set) current_property_set = xbt_dict_new();
+  if (!current_property_set)
+    current_property_set = xbt_dict_new();
 
-   value = xbt_strdup(A_surfxml_prop_value);
-   xbt_dict_set(current_property_set, A_surfxml_prop_id, value, free);
+  value = xbt_strdup(A_surfxml_prop_value);
+  xbt_dict_set(current_property_set, A_surfxml_prop_id, value, free);
 }
 
 void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
@@ -524,13 +534,14 @@ static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t cb_list)
 {
   unsigned int iterator;
   void_f_void_t fun;
-  xbt_dynar_foreach(cb_list, iterator, fun){
-       DEBUG2("call %p %p",fun,*fun);
-       (*fun)();
-    }
+  xbt_dynar_foreach(cb_list, iterator, fun) {
+    DEBUG2("call %p %p", fun, *fun);
+    (*fun) ();
+  }
 }
 
-static void parse_route_set_endpoints(void) {
+static void parse_route_set_endpoints(void)
+{
   route_link_list = xbt_dynar_new(sizeof(char *), NULL);
 }
 
@@ -540,12 +551,13 @@ static void init_data(void)
   xbt_dynar_free(&route_link_list);
   route_table = xbt_dict_new();
 
-  if(!surfxml_bufferstack_stack)
-    surfxml_bufferstack_stack=xbt_dynar_new(sizeof(char*),NULL);
+  if (!surfxml_bufferstack_stack)
+    surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), NULL);
   route_multi_table = xbt_dict_new();
-  route_multi_elements = xbt_dynar_new(sizeof(char*), NULL);
+  route_multi_elements = xbt_dynar_new(sizeof(char *), NULL);
   traces_set_list = xbt_dict_new();
-  if (set_list == NULL) set_list = xbt_dict_new();
+  if (set_list == NULL)
+    set_list = xbt_dict_new();
 
   trace_connect_list_host_avail = xbt_dict_new();
   trace_connect_list_power = xbt_dict_new();
@@ -556,32 +568,36 @@ static void init_data(void)
   random_data_list = xbt_dict_new();
   surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties);
   surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
+  surfxml_add_callback(STag_surfxml_route_cb_list,
+                       &parse_route_set_endpoints);
   surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets);
-  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints);
-  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route);
+  surfxml_add_callback(STag_surfxml_route_c_multi_cb_list,
+                       &parse_route_multi_set_endpoints);
+  surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list,
+                       &parse_route_multi_set_route);
   surfxml_add_callback(STag_surfxml_foreach_cb_list, &parse_foreach);
   surfxml_add_callback(STag_surfxml_cluster_cb_list, &parse_cluster);
   surfxml_add_callback(STag_surfxml_trace_cb_list, &parse_trace_init);
   surfxml_add_callback(ETag_surfxml_trace_cb_list, &parse_trace_finalize);
-  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list, &parse_trace_c_connect);
+  surfxml_add_callback(STag_surfxml_trace_c_connect_cb_list,
+                       &parse_trace_c_connect);
   surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness);
   surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness);
 }
 
 static void free_data(void)
 {
-  char *key,*data;
+  char *key, *data;
   xbt_dict_cursor_t cursor = NULL;
   char *name;
   unsigned int cpt = 0;
 
   xbt_dict_foreach(route_table, cursor, key, data) {
-    xbt_dynar_t links = (xbt_dynar_t)data;
+    xbt_dynar_t links = (xbt_dynar_t) data;
     char *name;
     unsigned int cpt = 0;
 
-    xbt_dynar_foreach (links, cpt, name)  free(name);
+    xbt_dynar_foreach(links, cpt, name) free(name);
     xbt_dynar_free(&links);
   }
   xbt_dict_free(&route_table);
@@ -589,13 +605,13 @@ static void free_data(void)
 
   xbt_dict_free(&route_multi_table);
 
-  xbt_dynar_foreach (route_multi_elements, cpt, name)  free(name);
+  xbt_dynar_foreach(route_multi_elements, cpt, name) free(name);
   xbt_dynar_free(&route_multi_elements);
 
   xbt_dict_foreach(set_list, cursor, key, data) {
-    xbt_dynar_t set = (xbt_dynar_t)data;
+    xbt_dynar_t set = (xbt_dynar_t) data;
 
-    xbt_dynar_foreach (set, cpt, name)  free(name);
+    xbt_dynar_foreach(set, cpt, name) free(name);
     xbt_dynar_free(&set);
   }
   xbt_dict_free(&set_list);
@@ -611,49 +627,57 @@ static void free_data(void)
   xbt_dict_free(&traces_set_list);
 }
 
-void parse_platform_file(const charfile)
+void parse_platform_file(const char *file)
 {
   surf_parse_open(file);
   init_data();
-  xbt_assert1((!(*surf_parse)()), "Parse error in %s", file);
+  xbt_assert1((!(*surf_parse) ()), "Parse error in %s", file);
   free_data();
   surf_parse_close();
 }
 
 /* Functions to bypass route, host and link tags. Used by the foreach and route:multi tags */
 
-static void parse_make_temporary_route(const char *src, const char *dst, int action)
+static void parse_make_temporary_route(const char *src, const char *dst,
+                                       int action)
 {
   int AX_ptr = 0;
 
   A_surfxml_route_action = action;
-  SURFXML_BUFFER_SET(route_src,                     src);
-  SURFXML_BUFFER_SET(route_dst,                     dst);
+  SURFXML_BUFFER_SET(route_src, src);
+  SURFXML_BUFFER_SET(route_dst, dst);
 }
 
-static void parse_change_cpu_data(const char* hostName, const char* surfxml_host_power, const char* surfxml_host_availability,
-                                       const char* surfxml_host_availability_file, const char* surfxml_host_state_file)
+static void parse_change_cpu_data(const char *hostName,
+                                  const char *surfxml_host_power,
+                                  const char *surfxml_host_availability,
+                                  const char *surfxml_host_availability_file,
+                                  const char *surfxml_host_state_file)
 {
   int AX_ptr = 0;
 
-  SURFXML_BUFFER_SET(host_id,                     hostName);
-  SURFXML_BUFFER_SET(host_power,                  surfxml_host_power /*hostPower*/);
-  SURFXML_BUFFER_SET(host_availability,           surfxml_host_availability);
-  SURFXML_BUFFER_SET(host_availability_file,      surfxml_host_availability_file);
-  SURFXML_BUFFER_SET(host_state_file,             surfxml_host_state_file);
+  SURFXML_BUFFER_SET(host_id, hostName);
+  SURFXML_BUFFER_SET(host_power, surfxml_host_power /*hostPower */ );
+  SURFXML_BUFFER_SET(host_availability, surfxml_host_availability);
+  SURFXML_BUFFER_SET(host_availability_file, surfxml_host_availability_file);
+  SURFXML_BUFFER_SET(host_state_file, surfxml_host_state_file);
 }
 
-static void parse_change_link_data(const char* linkName, const char* surfxml_link_bandwidth, const char* surfxml_link_bandwidth_file,
-                                       const char* surfxml_link_latency, const char* surfxml_link_latency_file, const char* surfxml_link_state_file)
+static void parse_change_link_data(const char *linkName,
+                                   const char *surfxml_link_bandwidth,
+                                   const char *surfxml_link_bandwidth_file,
+                                   const char *surfxml_link_latency,
+                                   const char *surfxml_link_latency_file,
+                                   const char *surfxml_link_state_file)
 {
   int AX_ptr = 0;
 
-  SURFXML_BUFFER_SET(link_id,                linkName);
-  SURFXML_BUFFER_SET(link_bandwidth,         surfxml_link_bandwidth);
-  SURFXML_BUFFER_SET(link_bandwidth_file,    surfxml_link_bandwidth_file);
-  SURFXML_BUFFER_SET(link_latency,           surfxml_link_latency);
-  SURFXML_BUFFER_SET(link_latency_file,      surfxml_link_latency_file);
-  SURFXML_BUFFER_SET(link_state_file,        surfxml_link_state_file);
+  SURFXML_BUFFER_SET(link_id, linkName);
+  SURFXML_BUFFER_SET(link_bandwidth, surfxml_link_bandwidth);
+  SURFXML_BUFFER_SET(link_bandwidth_file, surfxml_link_bandwidth_file);
+  SURFXML_BUFFER_SET(link_latency, surfxml_link_latency);
+  SURFXML_BUFFER_SET(link_latency_file, surfxml_link_latency_file);
+  SURFXML_BUFFER_SET(link_state_file, surfxml_link_state_file);
 }
 
 /* Functions for the sets and foreach tags */
@@ -665,7 +689,7 @@ static void parse_sets(void)
   xbt_dynar_t radical_elements;
   xbt_dynar_t radical_ends;
   xbt_dynar_t current_set;
-  char *value,*groups;
+  char *value, *groups;
   int i;
   unsigned int iter;
 
@@ -675,38 +699,40 @@ static void parse_sets(void)
   radical = xbt_strdup(A_surfxml_set_radical);
 
   if (xbt_dict_get_or_null(set_list, id))
-     surf_parse_error(bprintf("Set '%s' declared several times in the platform file.",id));
+    surf_parse_error(bprintf
+                     ("Set '%s' declared several times in the platform file.",
+                      id));
 
-  current_set = xbt_dynar_new(sizeof(char*), NULL);
+  current_set = xbt_dynar_new(sizeof(char *), NULL);
 
-  radical_elements = xbt_str_split(radical,",");
-  xbt_dynar_foreach(radical_elements,iter, groups) {
+  radical_elements = xbt_str_split(radical, ",");
+  xbt_dynar_foreach(radical_elements, iter, groups) {
 
-     radical_ends = xbt_str_split(groups, "-");
-     switch (xbt_dynar_length(radical_ends)) {
-      case 1:
-       surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char*));
-       value = bprintf("%s%d%s", prefix, start, suffix);
-       xbt_dynar_push(current_set, &value);
-       break;
+    radical_ends = xbt_str_split(groups, "-");
+    switch (xbt_dynar_length(radical_ends)) {
+    case 1:
+      surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
+      value = bprintf("%s%d%s", prefix, start, suffix);
+      xbt_dynar_push(current_set, &value);
+      break;
 
-      case 2:
+    case 2:
 
-       surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char*));
-       surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char*));
+      surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char *));
+      surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *));
 
 
-       for (i=start; i<=end; i++) {
-          value = bprintf("%s%d%s", prefix, i, suffix);
-          xbt_dynar_push(current_set, &value);
-       }
-       break;
+      for (i = start; i <= end; i++) {
+        value = bprintf("%s%d%s", prefix, i, suffix);
+        xbt_dynar_push(current_set, &value);
+      }
+      break;
 
-      default:
-       surf_parse_error(xbt_strdup("Malformed radical"));
-     }
+    default:
+      surf_parse_error(xbt_strdup("Malformed radical"));
+    }
 
-     xbt_dynar_free(&radical_ends);
+    xbt_dynar_free(&radical_ends);
   }
 
   xbt_dict_set(set_list, id, current_set, NULL);
@@ -718,10 +744,10 @@ static void parse_sets(void)
   free(id);
 }
 
-static const charsurfxml_host_power;
-static const charsurfxml_host_availability;
-static const charsurfxml_host_availability_file;
-static const charsurfxml_host_state_file;
+static const char *surfxml_host_power;
+static const char *surfxml_host_availability;
+static const char *surfxml_host_availability_file;
+static const char *surfxml_host_state_file;
 
 static void parse_host_foreach(void)
 {
@@ -737,28 +763,31 @@ static void finalize_host_foreach(void)
   unsigned int cpt = 0;
   char *name;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key, *data;
 
   xbt_dict_t cluster_host_props = current_property_set;
 
   names = xbt_dict_get_or_null(set_list, foreach_set_name);
   if (!names)
-     surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
-                              foreach_set_name));
+    surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
+                             foreach_set_name));
   if (strcmp(A_surfxml_host_id, "$1"))
-     surf_parse_error(bprintf("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
-                             A_surfxml_host_id));
+    surf_parse_error(bprintf
+                     ("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
+                      A_surfxml_host_id));
 
 
   /* foreach name in set call the main host callback */
-  xbt_dynar_foreach (names, cpt, name) {
+  xbt_dynar_foreach(names, cpt, name) {
     push_surfxml_bufferstack(1);
     parse_change_cpu_data(name, surfxml_host_power, surfxml_host_availability,
-                                       surfxml_host_availability_file, surfxml_host_state_file);
+                          surfxml_host_availability_file,
+                          surfxml_host_state_file);
     surfxml_call_cb_functions(main_STag_surfxml_host_cb_list);
 
-    xbt_dict_foreach(cluster_host_props,cursor,key,data) {
-           xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data), free);
+    xbt_dict_foreach(cluster_host_props, cursor, key, data) {
+      xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data),
+                   free);
     }
 
     surfxml_call_cb_functions(main_ETag_surfxml_host_cb_list);
@@ -770,11 +799,11 @@ static void finalize_host_foreach(void)
   pop_surfxml_bufferstack(0);
 }
 
-static const charsurfxml_link_bandwidth;
-static const charsurfxml_link_bandwidth_file;
-static const charsurfxml_link_latency;
-static const charsurfxml_link_latency_file;
-static const charsurfxml_link_state_file;
+static const char *surfxml_link_bandwidth;
+static const char *surfxml_link_bandwidth_file;
+static const char *surfxml_link_latency;
+static const char *surfxml_link_latency_file;
+static const char *surfxml_link_state_file;
 
 static void parse_link_foreach(void)
 {
@@ -791,27 +820,31 @@ static void finalize_link_foreach(void)
   unsigned int cpt = 0;
   char *name;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key, *data;
 
   xbt_dict_t cluster_link_props = current_property_set;
 
   names = xbt_dict_get_or_null(set_list, foreach_set_name);
   if (!names)
-     surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
-                              foreach_set_name));
+    surf_parse_error(bprintf("Set name '%s' used in <foreach> not found.",
+                             foreach_set_name));
   if (strcmp(A_surfxml_link_id, "$1"))
-     surf_parse_error(bprintf("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
-                             A_surfxml_link_id));
+    surf_parse_error(bprintf
+                     ("The host id within <foreach> should point to the foreach set_id (use $1 instead of %s)",
+                      A_surfxml_link_id));
 
   /* for each name in set call the main link callback */
-  xbt_dynar_foreach (names, cpt, name) {
+  xbt_dynar_foreach(names, cpt, name) {
     push_surfxml_bufferstack(1);
-    parse_change_link_data(name, surfxml_link_bandwidth, surfxml_link_bandwidth_file,
-                                       surfxml_link_latency, surfxml_link_latency_file, surfxml_link_state_file);
+    parse_change_link_data(name, surfxml_link_bandwidth,
+                           surfxml_link_bandwidth_file, surfxml_link_latency,
+                           surfxml_link_latency_file,
+                           surfxml_link_state_file);
     surfxml_call_cb_functions(main_STag_surfxml_link_cb_list);
 
-    xbt_dict_foreach(cluster_link_props,cursor,key,data) {
-           xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data), free);
+    xbt_dict_foreach(cluster_link_props, cursor, key, data) {
+      xbt_dict_set(current_property_set, xbt_strdup(key), xbt_strdup(data),
+                   free);
     }
 
     surfxml_call_cb_functions(main_ETag_surfxml_link_cb_list);
@@ -822,7 +855,7 @@ static void finalize_link_foreach(void)
 
   pop_surfxml_bufferstack(0);
   free(foreach_set_name);
-  foreach_set_name=NULL;
+  foreach_set_name = NULL;
 }
 
 static void parse_foreach(void)
@@ -834,10 +867,10 @@ static void parse_foreach(void)
   main_ETag_surfxml_link_cb_list = ETag_surfxml_link_cb_list;
 
   /* define host & link callbacks to be used only by the foreach tag */
-  STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
-  ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t),NULL);
+  STag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_host_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  STag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
+  ETag_surfxml_link_cb_list = xbt_dynar_new(sizeof(void_f_void_t), NULL);
 
   surfxml_add_callback(STag_surfxml_host_cb_list, &parse_host_foreach);
   surfxml_add_callback(ETag_surfxml_host_cb_list, &finalize_host_foreach);
@@ -850,8 +883,8 @@ static void parse_foreach(void)
 
 /* Route:multi functions */
 
-static int route_multi_size=0;
-static charsrc_name, *dst_name;
+static int route_multi_size = 0;
+static char *src_name, *dst_name;
 static int is_symmetric_route;
 
 static void parse_route_elem(void)
@@ -874,12 +907,12 @@ static void parse_route_multi_set_endpoints(void)
   route_link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
 }
 
-static int contains(xbt_dynar_t list, const charvalue)
+static int contains(xbt_dynar_t list, const char *value)
 {
- unsigned int cpt;
char * val;
- xbt_dynar_foreach(list, cpt, val) {
-   if (strcmp(val, value) == 0)
 unsigned int cpt;
 char *val;
 xbt_dynar_foreach(list, cpt, val) {
+    if (strcmp(val, value) == 0)
       return 1;
   }
   return 0;
@@ -889,7 +922,8 @@ static int contains(xbt_dynar_t list, const char* value)
    This function is used to append or override the contents of an already existing route in the case a new one with its name is found.
    The decision is based upon the value of action specified in the xml route:multi attribute action
  */
-void manage_route(xbt_dict_t routing_table, const char *route_name, int action, int isMultiRoute)
+void manage_route(xbt_dict_t routing_table, const char *route_name,
+                  int action, int isMultiRoute)
 {
   unsigned int cpt;
   xbt_dynar_t links;
@@ -899,37 +933,40 @@ void manage_route(xbt_dict_t routing_table, const char *route_name, int action,
   links = xbt_dict_get_or_null(routing_table, route_name);
   DEBUG1("ROUTE: %s", route_name);
   if (links != NULL) {
-     switch (action) {
-        case A_surfxml_route_action_PREPEND: /* add existing links at the end; route_link_list + links */
-                                   xbt_dynar_foreach(links, cpt, value) {
-                                       xbt_dynar_push(route_link_list,&value);
-                                   }
-                                   xbt_dynar_free(&links);
-                                    break;
-        case A_surfxml_route_action_POSTPEND: /* add existing links in front; links + route_link_list */
-                                   xbt_dynar_foreach(route_link_list, cpt, value) {
-                                       xbt_dynar_push(links,&value);
-                                   }
-                                   xbt_dynar_free(&route_link_list);
-                                    route_link_list = links;
-                                   break;
-        case A_surfxml_route_action_OVERRIDE:
-                                   xbt_dynar_free(&links);
-                                    break;
-        default:break;
-     }
+    switch (action) {
+    case A_surfxml_route_action_PREPEND:       /* add existing links at the end; route_link_list + links */
+      xbt_dynar_foreach(links, cpt, value) {
+        xbt_dynar_push(route_link_list, &value);
+      }
+      xbt_dynar_free(&links);
+      break;
+    case A_surfxml_route_action_POSTPEND:      /* add existing links in front; links + route_link_list */
+      xbt_dynar_foreach(route_link_list, cpt, value) {
+        xbt_dynar_push(links, &value);
+      }
+      xbt_dynar_free(&route_link_list);
+      route_link_list = links;
+      break;
+    case A_surfxml_route_action_OVERRIDE:
+      xbt_dynar_free(&links);
+      break;
+    default:
+      break;
+    }
   }
   /* this is the final route; do not add if name is a set; add only if name is in set list */
-  if (!isMultiRoute){
+  if (!isMultiRoute) {
     xbt_dict_set(routing_table, route_name, route_link_list, NULL);
   }
 }
 
 static void parse_route_multi_set_route(void)
 {
-  charroute_name;
+  char *route_name;
 
-  route_name = bprintf("%s#%s#%d#%d#%d", src_name, dst_name, route_action, is_symmetric_route, route_multi_size);
+  route_name =
+    bprintf("%s#%s#%d#%d#%d", src_name, dst_name, route_action,
+            is_symmetric_route, route_multi_size);
 
   xbt_dynar_push(route_multi_elements, &route_name);
 
@@ -937,7 +974,9 @@ static void parse_route_multi_set_route(void)
   xbt_dict_set(route_multi_table, route_name, route_link_list, NULL);
   /* add symmetric if it is the case */
   if (is_symmetric_route == 1) {
-    char * symmetric_name = bprintf("%s#%s#%d#%d#%d", dst_name, src_name, route_action, !is_symmetric_route, route_multi_size);
+    char *symmetric_name =
+      bprintf("%s#%s#%d#%d#%d", dst_name, src_name, route_action,
+              !is_symmetric_route, route_multi_size);
 
     xbt_dict_set(route_multi_table, symmetric_name, route_link_list, NULL);
     xbt_dynar_push(route_multi_elements, &symmetric_name);
@@ -947,33 +986,35 @@ static void parse_route_multi_set_route(void)
   free(dst_name);
 }
 
-static void add_multi_links(const char* src, const char* dst, xbt_dynar_t links, const char* src_name, const char* dst_name)
+static void add_multi_links(const char *src, const char *dst,
+                            xbt_dynar_t links, const char *src_name,
+                            const char *dst_name)
 {
   unsigned int cpt;
-  charvalue, *val;
+  char *value, *val;
 
   push_surfxml_bufferstack(1);
 
-   parse_make_temporary_route(src_name, dst_name, route_action);
-   surfxml_call_cb_functions(STag_surfxml_route_cb_list);
-   DEBUG2("\tADDING ROUTE: %s -> %s", src_name, dst_name);
-   /* Build link list */
-   xbt_dynar_foreach(links, cpt, value) {
-     if (strcmp(value, src) == 0)
-       val =  xbt_strdup(src_name);
-     else if (strcmp(value, dst) == 0)
-       val = xbt_strdup(dst_name);
-     else if (strcmp(value, "$dst") == 0)
-       val = xbt_strdup(dst_name);
-     else if (strcmp(value, "$src") == 0)
-       val = xbt_strdup(src_name);
-     else
-       val = xbt_strdup(value);
-     DEBUG1("\t\tELEMENT: %s", val);
-     xbt_dynar_push(route_link_list, &val);
-   }
-   surfxml_call_cb_functions(ETag_surfxml_route_cb_list);
-   pop_surfxml_bufferstack(1);
+  parse_make_temporary_route(src_name, dst_name, route_action);
+  surfxml_call_cb_functions(STag_surfxml_route_cb_list);
+  DEBUG2("\tADDING ROUTE: %s -> %s", src_name, dst_name);
+  /* Build link list */
+  xbt_dynar_foreach(links, cpt, value) {
+    if (strcmp(value, src) == 0)
+      val = xbt_strdup(src_name);
+    else if (strcmp(value, dst) == 0)
+      val = xbt_strdup(dst_name);
+    else if (strcmp(value, "$dst") == 0)
+      val = xbt_strdup(dst_name);
+    else if (strcmp(value, "$src") == 0)
+      val = xbt_strdup(src_name);
+    else
+      val = xbt_strdup(value);
+    DEBUG1("\t\tELEMENT: %s", val);
+    xbt_dynar_push(route_link_list, &val);
+  }
+  surfxml_call_cb_functions(ETag_surfxml_route_cb_list);
+  pop_surfxml_bufferstack(1);
 }
 
 static void convert_route_multi_to_routes(void)
@@ -981,73 +1022,83 @@ static void convert_route_multi_to_routes(void)
   xbt_dict_cursor_t cursor_w;
   int symmetric;
   unsigned int cpt, cpt2, cursor;
-  char *src_host_name, *dst_host_name, *key, *src, *dst, *val, *key_w, *data_w;
-  const char* sep="#";
+  char *src_host_name, *dst_host_name, *key, *src, *dst, *val, *key_w,
+    *data_w;
+  const char *sep = "#";
   xbt_dict_t set;
   xbt_dynar_t src_names = NULL, dst_names = NULL, links;
 
-  if (!route_multi_elements) return;
+  if (!route_multi_elements)
+    return;
 
   set = cpu_set;
   DEBUG1("%d", xbt_dict_length(workstation_set));
   if (workstation_set != NULL && xbt_dict_length(workstation_set) > 0)
-     set = workstation_set;
+    set = workstation_set;
 
 
   push_surfxml_bufferstack(0);
   /* Get all routes in the exact order they were entered in the platform file */
   xbt_dynar_foreach(route_multi_elements, cursor, key) {
-     /* Get links for the route */
-     links = (xbt_dynar_t)xbt_dict_get_or_null(route_multi_table, key);
-     keys = xbt_str_split_str(key, sep);
-     /* Get route ends */
-     src = xbt_dynar_get_as(keys, 0, char*);
-     dst = xbt_dynar_get_as(keys, 1, char*);
-     route_action = atoi(xbt_dynar_get_as(keys, 2, char*));
-     symmetric = atoi(xbt_dynar_get_as(keys, 3, char*));
+    /* Get links for the route */
+    links = (xbt_dynar_t) xbt_dict_get_or_null(route_multi_table, key);
+    keys = xbt_str_split_str(key, sep);
+    /* Get route ends */
+    src = xbt_dynar_get_as(keys, 0, char *);
+    dst = xbt_dynar_get_as(keys, 1, char *);
+    route_action = atoi(xbt_dynar_get_as(keys, 2, char *));
+    symmetric = atoi(xbt_dynar_get_as(keys, 3, char *));
 
     /* Create the dynar of src and dst hosts for the new routes */
     /* NOTE: src and dst can be either set names or simple host names */
-    src_names = (xbt_dynar_t)xbt_dict_get_or_null(set_list, src);
-    dst_names = (xbt_dynar_t)xbt_dict_get_or_null(set_list, dst);
+    src_names = (xbt_dynar_t) xbt_dict_get_or_null(set_list, src);
+    dst_names = (xbt_dynar_t) xbt_dict_get_or_null(set_list, dst);
     /* Add to dynar even if they are simple names */
     if (src_names == NULL) {
-       src_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
-       val = xbt_strdup(src);
-       xbt_dynar_push(src_names, &val);
-       if (strcmp(val,"$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
-         THROW3(unknown_error,0,"(In route:multi (%s -> %s) source %s does not exist (not a set or a host)", src, dst, src);
+      src_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
+      val = xbt_strdup(src);
+      xbt_dynar_push(src_names, &val);
+      if (strcmp(val, "$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
+        THROW3(unknown_error, 0,
+               "(In route:multi (%s -> %s) source %s does not exist (not a set or a host)",
+               src, dst, src);
     }
     if (dst_names == NULL) {
-       dst_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
-       val = xbt_strdup(dst);
-       if (strcmp(val,"$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
-         THROW3(unknown_error,0,"(In route:multi (%s -> %s) destination %s does not exist (not a set or a host)", src, dst, dst);
-       xbt_dynar_push(dst_names, &val);
+      dst_names = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
+      val = xbt_strdup(dst);
+      if (strcmp(val, "$*") != 0 && NULL == xbt_dict_get_or_null(set, val))
+        THROW3(unknown_error, 0,
+               "(In route:multi (%s -> %s) destination %s does not exist (not a set or a host)",
+               src, dst, dst);
+      xbt_dynar_push(dst_names, &val);
     }
 
     /* Build the routes */
-    DEBUG2("ADDING MULTI ROUTE: %s -> %s", xbt_dynar_get_as(keys, 0, char*), xbt_dynar_get_as(keys, 1, char*));
+    DEBUG2("ADDING MULTI ROUTE: %s -> %s", xbt_dynar_get_as(keys, 0, char *),
+           xbt_dynar_get_as(keys, 1, char *));
     xbt_dynar_foreach(src_names, cpt, src_host_name) {
       xbt_dynar_foreach(dst_names, cpt2, dst_host_name) {
         /* If dst is $* then set this route to have its dst point to all hosts */
-        if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") == 0){
-                 xbt_dict_foreach(set, cursor_w, key_w, data_w) {
-                          //int n = xbt_dynar_member(src_names, (char*)key_w);
-                                   add_multi_links(src, dst, links, src_host_name, key_w);
-                 }
+        if (strcmp(src_host_name, "$*") != 0
+            && strcmp(dst_host_name, "$*") == 0) {
+          xbt_dict_foreach(set, cursor_w, key_w, data_w) {
+            //int n = xbt_dynar_member(src_names, (char*)key_w);
+            add_multi_links(src, dst, links, src_host_name, key_w);
+          }
         }
         /* If src is $* then set this route to have its dst point to all hosts */
-        if (strcmp(src_host_name,"$*") == 0 && strcmp(dst_host_name,"$*") != 0){
-                 xbt_dict_foreach(set, cursor_w, key_w, data_w) {
-                     // if (!symmetric || (symmetric && !contains(dst_names, key_w)))
-                       add_multi_links(src, dst, links, key_w, dst_host_name);
-                }
+        if (strcmp(src_host_name, "$*") == 0
+            && strcmp(dst_host_name, "$*") != 0) {
+          xbt_dict_foreach(set, cursor_w, key_w, data_w) {
+            // if (!symmetric || (symmetric && !contains(dst_names, key_w)))
+            add_multi_links(src, dst, links, key_w, dst_host_name);
+          }
         }
         /* if none of them are equal to $* */
-        if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") != 0) {
-                       add_multi_links(src, dst, links, src_host_name, dst_host_name);
-       }
+        if (strcmp(src_host_name, "$*") != 0
+            && strcmp(dst_host_name, "$*") != 0) {
+          add_multi_links(src, dst, links, src_host_name, dst_host_name);
+        }
       }
     }
     xbt_dynar_free(&keys);
@@ -1059,150 +1110,165 @@ static void convert_route_multi_to_routes(void)
 
 static void parse_cluster(void)
 {
-   static int AX_ptr = 0;
+  static int AX_ptr = 0;
 
-   char* cluster_id = A_surfxml_cluster_id;
-   char* cluster_prefix = A_surfxml_cluster_prefix;
-   char* cluster_suffix = A_surfxml_cluster_suffix;
-   char* cluster_radical = A_surfxml_cluster_radical;
-   char* cluster_power = A_surfxml_cluster_power;
-   char* cluster_bw = A_surfxml_cluster_bw;
-   char* cluster_lat = A_surfxml_cluster_lat;
-   char* cluster_bb_bw = A_surfxml_cluster_bb_bw;
-   char* cluster_bb_lat = A_surfxml_cluster_bb_lat;
-   char* backbone_name;
+  char *cluster_id = A_surfxml_cluster_id;
+  char *cluster_prefix = A_surfxml_cluster_prefix;
+  char *cluster_suffix = A_surfxml_cluster_suffix;
+  char *cluster_radical = A_surfxml_cluster_radical;
+  char *cluster_power = A_surfxml_cluster_power;
+  char *cluster_bw = A_surfxml_cluster_bw;
+  char *cluster_lat = A_surfxml_cluster_lat;
+  char *cluster_bb_bw = A_surfxml_cluster_bb_bw;
+  char *cluster_bb_lat = A_surfxml_cluster_bb_lat;
+  char *backbone_name;
 
-   push_surfxml_bufferstack(1);
+  push_surfxml_bufferstack(1);
 
-   /* Make set */
-   SURFXML_BUFFER_SET(set_id, cluster_id);
-   SURFXML_BUFFER_SET(set_prefix, cluster_prefix);
-   SURFXML_BUFFER_SET(set_suffix, cluster_suffix);
-   SURFXML_BUFFER_SET(set_radical, cluster_radical);
+  /* Make set */
+  SURFXML_BUFFER_SET(set_id, cluster_id);
+  SURFXML_BUFFER_SET(set_prefix, cluster_prefix);
+  SURFXML_BUFFER_SET(set_suffix, cluster_suffix);
+  SURFXML_BUFFER_SET(set_radical, cluster_radical);
 
-   SURFXML_START_TAG(set);
-   SURFXML_END_TAG(set);
+  SURFXML_START_TAG(set);
+  SURFXML_END_TAG(set);
 
-   /* Make foreach */
-   SURFXML_BUFFER_SET(foreach_set_id, cluster_id);
+  /* Make foreach */
+  SURFXML_BUFFER_SET(foreach_set_id, cluster_id);
 
-   SURFXML_START_TAG(foreach);
+  SURFXML_START_TAG(foreach);
 
-     /* Make host for the foreach */
-     parse_change_cpu_data("$1", cluster_power, "1.0", "", "");
-     A_surfxml_host_state = A_surfxml_host_state_ON;
+  /* Make host for the foreach */
+  parse_change_cpu_data("$1", cluster_power, "1.0", "", "");
+  A_surfxml_host_state = A_surfxml_host_state_ON;
 
-     SURFXML_START_TAG(host);
-     SURFXML_END_TAG(host);
+  SURFXML_START_TAG(host);
+  SURFXML_END_TAG(host);
 
-     /* Make link for the foreach */
-     parse_change_link_data("$1", cluster_bw, "", cluster_lat, "", "");
-     A_surfxml_link_state = A_surfxml_link_state_ON;
-     A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
+  /* Make link for the foreach */
+  parse_change_link_data("$1", cluster_bw, "", cluster_lat, "", "");
+  A_surfxml_link_state = A_surfxml_link_state_ON;
+  A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
 
-     SURFXML_START_TAG(link);
-     SURFXML_END_TAG(link);
+  SURFXML_START_TAG(link);
+  SURFXML_END_TAG(link);
 
-   SURFXML_END_TAG(foreach);
+  SURFXML_END_TAG(foreach);
 
-   /* Make backbone link */
-   backbone_name = bprintf("%s_bb", cluster_id);
-   parse_change_link_data(backbone_name, cluster_bb_bw, "", cluster_bb_lat, "", "");
-   A_surfxml_link_state = A_surfxml_link_state_ON;
-   A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;
+  /* Make backbone link */
+  backbone_name = bprintf("%s_bb", cluster_id);
+  parse_change_link_data(backbone_name, cluster_bb_bw, "", cluster_bb_lat, "",
+                         "");
+  A_surfxml_link_state = A_surfxml_link_state_ON;
+  A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_FATPIPE;
 
-   SURFXML_START_TAG(link);
-   SURFXML_END_TAG(link);
+  SURFXML_START_TAG(link);
+  SURFXML_END_TAG(link);
 
-   /* Make route multi with the outside world, i.e. cluster->$* */
-   SURFXML_BUFFER_SET(route_c_multi_src, cluster_id);
-   SURFXML_BUFFER_SET(route_c_multi_dst, "$*");
-   A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_NO;
-   A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_OVERRIDE;
+  /* Make route multi with the outside world, i.e. cluster->$* */
+  SURFXML_BUFFER_SET(route_c_multi_src, cluster_id);
+  SURFXML_BUFFER_SET(route_c_multi_dst, "$*");
+  A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_NO;
+  A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_OVERRIDE;
 
-   SURFXML_START_TAG(route_c_multi);
+  SURFXML_START_TAG(route_c_multi);
 
-     SURFXML_BUFFER_SET(link_c_ctn_id, "$src");
+  SURFXML_BUFFER_SET(link_c_ctn_id, "$src");
 
-     SURFXML_START_TAG(link_c_ctn);
-     SURFXML_END_TAG(link_c_ctn);
+  SURFXML_START_TAG(link_c_ctn);
+  SURFXML_END_TAG(link_c_ctn);
 
-   SURFXML_END_TAG(route_c_multi);
+  SURFXML_END_TAG(route_c_multi);
 
-   /* Make route multi between cluster hosts, i.e. cluster->cluster */
-   SURFXML_BUFFER_SET(route_c_multi_src, cluster_id);
-   SURFXML_BUFFER_SET(route_c_multi_dst, cluster_id);
-   A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_POSTPEND;
-   A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_NO;
+  /* Make route multi between cluster hosts, i.e. cluster->cluster */
+  SURFXML_BUFFER_SET(route_c_multi_src, cluster_id);
+  SURFXML_BUFFER_SET(route_c_multi_dst, cluster_id);
+  A_surfxml_route_c_multi_action = A_surfxml_route_c_multi_action_POSTPEND;
+  A_surfxml_route_c_multi_symmetric = A_surfxml_route_c_multi_symmetric_NO;
 
-   SURFXML_START_TAG(route_c_multi);
+  SURFXML_START_TAG(route_c_multi);
 
-     SURFXML_BUFFER_SET(link_c_ctn_id, backbone_name);
+  SURFXML_BUFFER_SET(link_c_ctn_id, backbone_name);
 
-     SURFXML_START_TAG(link_c_ctn);
-     SURFXML_END_TAG(link_c_ctn);
+  SURFXML_START_TAG(link_c_ctn);
+  SURFXML_END_TAG(link_c_ctn);
 
-   SURFXML_END_TAG(route_c_multi);
+  SURFXML_END_TAG(route_c_multi);
 
 
-   free(backbone_name);
+  free(backbone_name);
 
-   /* Restore buff */
-   pop_surfxml_bufferstack(1);
+  /* Restore buff */
+  pop_surfxml_bufferstack(1);
 }
 
 /* Trace management functions */
 
 static double trace_periodicity = -1.0;
-static chartrace_file = NULL;
-static chartrace_id;
+static char *trace_file = NULL;
+static char *trace_id;
 
 static void parse_trace_init(void)
 {
-   trace_id = strdup(A_surfxml_trace_id);
-   trace_file = strdup(A_surfxml_trace_file);
-   surf_parse_get_double(&trace_periodicity, A_surfxml_trace_periodicity);
+  trace_id = strdup(A_surfxml_trace_id);
+  trace_file = strdup(A_surfxml_trace_file);
+  surf_parse_get_double(&trace_periodicity, A_surfxml_trace_periodicity);
 }
 
 static void parse_trace_finalize(void)
 {
   tmgr_trace_t trace;
-  if (!trace_file || strcmp(trace_file,"") != 0) {
+  if (!trace_file || strcmp(trace_file, "") != 0) {
     surf_parse_get_trace(&trace, trace_file);
-  }
-  else {
-    if (strcmp(surfxml_pcdata, "") == 0) trace = NULL;
+  } else {
+    if (strcmp(surfxml_pcdata, "") == 0)
+      trace = NULL;
     else
-      trace = tmgr_trace_new_from_string(trace_id, surfxml_pcdata, trace_periodicity);
+      trace =
+        tmgr_trace_new_from_string(trace_id, surfxml_pcdata,
+                                   trace_periodicity);
   }
-  xbt_dict_set(traces_set_list, trace_id, (void *)trace, NULL);
+  xbt_dict_set(traces_set_list, trace_id, (void *) trace, NULL);
 }
 
 static void parse_trace_c_connect(void)
 {
-   xbt_assert2(xbt_dict_get_or_null(traces_set_list, A_surfxml_trace_c_connect_trace),
-             "Cannot connect trace %s to %s: trace unknown", A_surfxml_trace_c_connect_trace,A_surfxml_trace_c_connect_element);
-
-   switch (A_surfxml_trace_c_connect_kind) {
-    case A_surfxml_trace_c_connect_kind_HOST_AVAIL:
-      xbt_dict_set(trace_connect_list_host_avail, A_surfxml_trace_c_connect_trace, xbt_strdup(A_surfxml_trace_c_connect_element), free);
-      break;
-    case A_surfxml_trace_c_connect_kind_POWER:
-      xbt_dict_set(trace_connect_list_power, A_surfxml_trace_c_connect_trace, xbt_strdup(A_surfxml_trace_c_connect_element), free);
-      break;
-    case A_surfxml_trace_c_connect_kind_LINK_AVAIL:
-      xbt_dict_set(trace_connect_list_link_avail, A_surfxml_trace_c_connect_trace, xbt_strdup(A_surfxml_trace_c_connect_element), free);
-      break;
-    case A_surfxml_trace_c_connect_kind_BANDWIDTH:
-      xbt_dict_set(trace_connect_list_bandwidth, A_surfxml_trace_c_connect_trace, xbt_strdup(A_surfxml_trace_c_connect_element), free);
-      break;
-    case A_surfxml_trace_c_connect_kind_LATENCY:
-      xbt_dict_set(trace_connect_list_latency, A_surfxml_trace_c_connect_trace, xbt_strdup(A_surfxml_trace_c_connect_element), free);
-      break;
-    default:
-      xbt_die(bprintf("Cannot connect trace %s to %s: kind of trace unknown",
-                     A_surfxml_trace_c_connect_trace,A_surfxml_trace_c_connect_element));
-   }
+  xbt_assert2(xbt_dict_get_or_null
+              (traces_set_list, A_surfxml_trace_c_connect_trace),
+              "Cannot connect trace %s to %s: trace unknown",
+              A_surfxml_trace_c_connect_trace,
+              A_surfxml_trace_c_connect_element);
+
+  switch (A_surfxml_trace_c_connect_kind) {
+  case A_surfxml_trace_c_connect_kind_HOST_AVAIL:
+    xbt_dict_set(trace_connect_list_host_avail,
+                 A_surfxml_trace_c_connect_trace,
+                 xbt_strdup(A_surfxml_trace_c_connect_element), free);
+    break;
+  case A_surfxml_trace_c_connect_kind_POWER:
+    xbt_dict_set(trace_connect_list_power, A_surfxml_trace_c_connect_trace,
+                 xbt_strdup(A_surfxml_trace_c_connect_element), free);
+    break;
+  case A_surfxml_trace_c_connect_kind_LINK_AVAIL:
+    xbt_dict_set(trace_connect_list_link_avail,
+                 A_surfxml_trace_c_connect_trace,
+                 xbt_strdup(A_surfxml_trace_c_connect_element), free);
+    break;
+  case A_surfxml_trace_c_connect_kind_BANDWIDTH:
+    xbt_dict_set(trace_connect_list_bandwidth,
+                 A_surfxml_trace_c_connect_trace,
+                 xbt_strdup(A_surfxml_trace_c_connect_element), free);
+    break;
+  case A_surfxml_trace_c_connect_kind_LATENCY:
+    xbt_dict_set(trace_connect_list_latency, A_surfxml_trace_c_connect_trace,
+                 xbt_strdup(A_surfxml_trace_c_connect_element), free);
+    break;
+  default:
+    xbt_die(bprintf("Cannot connect trace %s to %s: kind of trace unknown",
+                    A_surfxml_trace_c_connect_trace,
+                    A_surfxml_trace_c_connect_element));
+  }
 }
 
 /* Random tag functions */
@@ -1214,23 +1280,25 @@ double get_cpu_power(const char *power)
   char *generator;
   random_data_t random = NULL;
   /* randomness is inserted like this: power="$rand(my_random)" */
-  if (((p = strstr(power, "$rand(")) != NULL) && ((q = strstr(power, ")")) != NULL)) {
-     if (p < q) {
-       generator = xbt_malloc(q - (p + 6) + 1);
-       memcpy(generator, p + 6, q - (p + 6));
-       generator[q - (p + 6)] = '\0';
-       xbt_assert1((random = xbt_dict_get_or_null(random_data_list, generator)),
-             "Random generator %s undefined", generator);
-       power_scale = random_generate(random);
-     }
-  }
-  else {
+  if (((p = strstr(power, "$rand(")) != NULL)
+      && ((q = strstr(power, ")")) != NULL)) {
+    if (p < q) {
+      generator = xbt_malloc(q - (p + 6) + 1);
+      memcpy(generator, p + 6, q - (p + 6));
+      generator[q - (p + 6)] = '\0';
+      xbt_assert1((random =
+                   xbt_dict_get_or_null(random_data_list, generator)),
+                  "Random generator %s undefined", generator);
+      power_scale = random_generate(random);
+    }
+  } else {
     surf_parse_get_double(&power_scale, power);
   }
   return power_scale;
 }
 
-double random_min, random_max, random_mean, random_std_deviation, random_generator;
+double random_min, random_max, random_mean, random_std_deviation,
+  random_generator;
 char *random_id;
 
 static void init_randomness(void)
@@ -1239,14 +1307,16 @@ static void init_randomness(void)
   surf_parse_get_double(&random_min, A_surfxml_random_min);
   surf_parse_get_double(&random_max, A_surfxml_random_max);
   surf_parse_get_double(&random_mean, A_surfxml_random_mean);
-  surf_parse_get_double(&random_std_deviation, A_surfxml_random_std_deviation);
+  surf_parse_get_double(&random_std_deviation,
+                        A_surfxml_random_std_deviation);
   random_generator = A_surfxml_random_generator;
 }
 
 static void add_randomness(void)
 {
-   /* If needed aditional properties can be added by using the prop tag */
-  random_data_t random = random_new(random_generator, 0, random_min, random_max, random_mean, random_std_deviation);
-   xbt_dict_set(random_data_list, random_id, (void *)random, NULL);
+  /* If needed aditional properties can be added by using the prop tag */
+  random_data_t random =
+    random_new(random_generator, 0, random_min, random_max, random_mean,
+               random_std_deviation);
+  xbt_dict_set(random_data_list, random_id, (void *) random, NULL);
 }
-
index 87bb192..6442cb3 100644 (file)
@@ -24,7 +24,7 @@ tmgr_history_t tmgr_history_new(void)
 
   h = xbt_new0(s_tmgr_history_t, 1);
 
-  h->heap = xbt_heap_new(8, xbt_free_f);       /* Why 8 ? Well, why not... */
+  h->heap = xbt_heap_new(8, xbt_free_f);        /* Why 8 ? Well, why not... */
 
   return h;
 }
@@ -35,7 +35,8 @@ void tmgr_history_free(tmgr_history_t h)
   free(h);
 }
 
-tmgr_trace_t tmgr_trace_new_from_string(const char* id, const char *input, double periodicity)
+tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input,
+                                        double periodicity)
 {
   tmgr_trace_t trace = NULL;
   int linecount = 0;
@@ -43,7 +44,7 @@ tmgr_trace_t tmgr_trace_new_from_string(const char* id, const char *input, doubl
   tmgr_event_t last_event = NULL;
   xbt_dynar_t list;
   unsigned int cpt;
-  char * val;
+  char *val;
 
   if (trace_list) {
     trace = xbt_dict_get_or_null(trace_list, id);
@@ -52,34 +53,39 @@ tmgr_trace_t tmgr_trace_new_from_string(const char* id, const char *input, doubl
   }
 
   if (periodicity <= 0) {
-    xbt_assert1(0, "Periodicity has to be positive. Your value %lg", periodicity);
+    xbt_assert1(0, "Periodicity has to be positive. Your value %lg",
+                periodicity);
   }
 
   trace = xbt_new0(s_tmgr_trace_t, 1);
   trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
 
-  list = xbt_str_split(input,"\n\r");
+  list = xbt_str_split(input, "\n\r");
 
 
   xbt_dynar_foreach(list, cpt, val) {
-     linecount++;
-     xbt_str_trim(val, " \t\n\r\x0B");
-     if (strlen(val) > 0) {
-       if (sscanf(val, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2) {
-          xbt_assert2(0, "%s\n%d: Syntax error", input, linecount);
-       }
-       if (last_event) {
-           if ((last_event->delta = event.delta - last_event->delta) <= 0) {
-              xbt_assert2(0, "%s\n%d: Invalid trace value, events have to be sorted", input, linecount);
-           }
-       }
-       xbt_dynar_push(trace->event_list, &event);
-       last_event = xbt_dynar_get_ptr(trace->event_list, xbt_dynar_length(trace->event_list) - 1);
-       if (periodicity > 0) {
-         if (last_event)
-           last_event->delta = periodicity;
-       }
-     }
+    linecount++;
+    xbt_str_trim(val, " \t\n\r\x0B");
+    if (strlen(val) > 0) {
+      if (sscanf(val, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2) {
+        xbt_assert2(0, "%s\n%d: Syntax error", input, linecount);
+      }
+      if (last_event) {
+        if ((last_event->delta = event.delta - last_event->delta) <= 0) {
+          xbt_assert2(0,
+                      "%s\n%d: Invalid trace value, events have to be sorted",
+                      input, linecount);
+        }
+      }
+      xbt_dynar_push(trace->event_list, &event);
+      last_event =
+        xbt_dynar_get_ptr(trace->event_list,
+                          xbt_dynar_length(trace->event_list) - 1);
+      if (periodicity > 0) {
+        if (last_event)
+          last_event->delta = periodicity;
+      }
+    }
   }
 
   if (!trace_list)
@@ -97,7 +103,7 @@ tmgr_trace_t tmgr_trace_new(const char *filename)
   FILE *f = NULL;
   int linecount = 0;
   char line[256];
-  double periodicity = -1.0;   /* No periodicity by default */
+  double periodicity = -1.0;    /* No periodicity by default */
   s_tmgr_event_t event;
   tmgr_event_t last_event = NULL;
 
@@ -120,31 +126,29 @@ tmgr_trace_t tmgr_trace_new(const char *filename)
       continue;
 
     if (sscanf(line, "PERIODICITY " "%lg" "\n", &(periodicity))
-       == 1) {
+        == 1) {
       if (periodicity <= 0) {
-       xbt_assert2(0,
-                   "%s,%d: Syntax error. Periodicity has to be positive",
-                   filename, linecount);
+        xbt_assert2(0,
+                    "%s,%d: Syntax error. Periodicity has to be positive",
+                    filename, linecount);
       }
       continue;
     }
 
-    if (sscanf
-       (line, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2) {
+    if (sscanf(line, "%lg" " " "%lg" "\n", &event.delta, &event.value) != 2) {
       xbt_assert2(0, "%s,%d: Syntax error", filename, linecount);
     }
 
     if (last_event) {
       if ((last_event->delta = event.delta - last_event->delta) <= 0) {
-       xbt_assert2(0,
-                   "%s,%d: Invalid trace value, events have to be sorted",
-                   filename, linecount);
+        xbt_assert2(0,
+                    "%s,%d: Invalid trace value, events have to be sorted",
+                    filename, linecount);
       }
     }
     xbt_dynar_push(trace->event_list, &event);
     last_event = xbt_dynar_get_ptr(trace->event_list,
-                                  xbt_dynar_length(trace->event_list) -
-                                  1);
+                                   xbt_dynar_length(trace->event_list) - 1);
   }
 
   if (periodicity > 0) {
@@ -188,9 +192,9 @@ void tmgr_trace_free(tmgr_trace_t trace)
 }
 
 tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
-                                         tmgr_trace_t trace,
-                                         double start_time, unsigned int offset,
-                                         void *model)
+                                          tmgr_trace_t trace,
+                                          double start_time,
+                                          unsigned int offset, void *model)
 {
   tmgr_trace_event_t trace_event = NULL;
 
@@ -200,7 +204,7 @@ tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h,
   trace_event->model = model;
 
   xbt_assert0((trace_event->idx < xbt_dynar_length(trace->event_list)),
-             "You're referring to an event that does not exist!");
+              "You're referring to an event that does not exist!");
 
   xbt_heap_push(h->heap, trace_event, start_time);
 
@@ -216,9 +220,9 @@ double tmgr_history_next_date(tmgr_history_t h)
 }
 
 tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
-                                                  double date,
-                                                  double *value,
-                                                  void **model)
+                                                   double date,
+                                                   double *value,
+                                                   void **model)
 {
   double event_date = tmgr_history_next_date(h);
   tmgr_trace_event_t trace_event = NULL;
@@ -240,12 +244,12 @@ tmgr_trace_event_t tmgr_history_get_next_event_leq(tmgr_history_t h,
   if (trace_event->idx < xbt_dynar_length(trace->event_list) - 1) {
     xbt_heap_push(h->heap, trace_event, event_date + event->delta);
     trace_event->idx++;
-  } else if (event->delta > 0) {       /* Last element, checking for periodicity */
+  } else if (event->delta > 0) {        /* Last element, checking for periodicity */
     xbt_heap_push(h->heap, trace_event, event_date + event->delta);
     trace_event->idx = 0;
-  } else {                     /* We don't need this trace_event anymore */
+  } else {                      /* We don't need this trace_event anymore */
     free(trace_event);
-       return NULL;
+    return NULL;
   }
 
   return trace_event;
index 972002a..d736301 100644 (file)
@@ -31,4 +31,4 @@ typedef struct tmgr_history {
   xbt_heap_t heap;
 } s_tmgr_history_t;
 
-#endif                         /* _SURF_TMGR_PRIVATE_H */
+#endif /* _SURF_TMGR_PRIVATE_H */
index 78e3360..b94c527 100644 (file)
 #include "network_common.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf,
-                               "Logging specific to the SURF workstation module");
+                                "Logging specific to the SURF workstation module");
 
 surf_workstation_model_t surf_workstation_model = NULL;
 xbt_dict_t workstation_set = NULL;
 
 static workstation_CLM03_t workstation_new(const char *name,
-                                          void *cpu, void *card)
+                                           void *cpu, void *card)
 {
   workstation_CLM03_t workstation = xbt_new0(s_workstation_CLM03_t, 1);
 
@@ -49,7 +49,7 @@ void create_workstations(void)
     xbt_assert1(nw_card, "No corresponding card found for %s", name);
 
     xbt_dict_set(workstation_set, name,
-                workstation_new(name, cpu, nw_card), workstation_free);
+                 workstation_new(name, cpu, nw_card), workstation_free);
   }
 }
 
@@ -65,22 +65,22 @@ static const char *get_resource_name(void *resource_id)
 
 static int resource_used(void *resource_id)
 {
-  THROW_IMPOSSIBLE;  /* This model does not implement parallel tasks */
+  THROW_IMPOSSIBLE;             /* This model does not implement parallel tasks */
 }
 
 static void parallel_action_cancel(surf_action_t action)
 {
-  THROW_UNIMPLEMENTED;  /* This model does not implement parallel tasks */
+  THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
 }
 
 static int parallel_action_free(surf_action_t action)
 {
-  THROW_UNIMPLEMENTED;  /* This model does not implement parallel tasks */
+  THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
 }
 
 static void parallel_action_use(surf_action_t action)
 {
-  THROW_UNIMPLEMENTED;  /* This model does not implement parallel tasks */
+  THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
 }
 
 static int action_free(surf_action_t action)
@@ -89,8 +89,7 @@ static int action_free(surf_action_t action)
     return surf_network_model->common_public->action_free(action);
   else if (action->model_type == (surf_model_t) surf_cpu_model)
     return surf_cpu_model->common_public->action_free(action);
-  else if (action->model_type ==
-          (surf_model_t) surf_workstation_model)
+  else if (action->model_type == (surf_model_t) surf_workstation_model)
     return parallel_action_free(action);
   else
     DIE_IMPOSSIBLE;
@@ -103,8 +102,7 @@ static void action_use(surf_action_t action)
     surf_network_model->common_public->action_use(action);
   else if (action->model_type == (surf_model_t) surf_cpu_model)
     surf_cpu_model->common_public->action_use(action);
-  else if (action->model_type ==
-          (surf_model_t) surf_workstation_model)
+  else if (action->model_type == (surf_model_t) surf_workstation_model)
     parallel_action_use(action);
   else
     DIE_IMPOSSIBLE;
@@ -117,8 +115,7 @@ static void action_cancel(surf_action_t action)
     surf_network_model->common_public->action_cancel(action);
   else if (action->model_type == (surf_model_t) surf_cpu_model)
     surf_cpu_model->common_public->action_cancel(action);
-  else if (action->model_type ==
-          (surf_model_t) surf_workstation_model)
+  else if (action->model_type == (surf_model_t) surf_workstation_model)
     parallel_action_cancel(action);
   else
     DIE_IMPOSSIBLE;
@@ -132,15 +129,13 @@ static void action_recycle(surf_action_t action)
 }
 
 static void action_change_state(surf_action_t action,
-                               e_surf_action_state_t state)
+                                e_surf_action_state_t state)
 {
   if (action->model_type == (surf_model_t) surf_network_model)
-    surf_network_model->common_public->action_change_state(action,
-                                                             state);
+    surf_network_model->common_public->action_change_state(action, state);
   else if (action->model_type == (surf_model_t) surf_cpu_model)
     surf_cpu_model->common_public->action_change_state(action, state);
-  else if (action->model_type ==
-          (surf_model_t) surf_workstation_model)
+  else if (action->model_type == (surf_model_t) surf_workstation_model)
     surf_action_change_state(action, state);
   else
     DIE_IMPOSSIBLE;
@@ -158,22 +153,23 @@ static void update_actions_state(double now, double delta)
 }
 
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double date)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double date)
 {
-  THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
+  THROW_IMPOSSIBLE;             /* This model does not implement parallel tasks */
 }
 
 static surf_action_t execute(void *workstation, double size)
 {
-  return surf_cpu_model->extension_public->
-      execute(((workstation_CLM03_t) workstation)->cpu, size);
+  return surf_cpu_model->
+    extension_public->execute(((workstation_CLM03_t) workstation)->cpu, size);
 }
 
 static surf_action_t action_sleep(void *workstation, double duration)
 {
-  return surf_cpu_model->extension_public->
-      sleep(((workstation_CLM03_t) workstation)->cpu, duration);
+  return surf_cpu_model->
+    extension_public->sleep(((workstation_CLM03_t) workstation)->cpu,
+                            duration);
 }
 
 static void action_suspend(surf_action_t action)
@@ -208,8 +204,7 @@ static int action_is_suspended(surf_action_t action)
 static void action_set_max_duration(surf_action_t action, double duration)
 {
   if (action->model_type == (surf_model_t) surf_network_model)
-    surf_network_model->common_public->set_max_duration(action,
-                                                          duration);
+    surf_network_model->common_public->set_max_duration(action, duration);
   else if (action->model_type == (surf_model_t) surf_cpu_model)
     surf_cpu_model->common_public->set_max_duration(action, duration);
   else
@@ -227,47 +222,49 @@ static void action_set_priority(surf_action_t action, double priority)
 }
 
 static surf_action_t communicate(void *workstation_src,
-                                void *workstation_dst, double size,
-                                double rate)
+                                 void *workstation_dst, double size,
+                                 double rate)
 {
-  return surf_network_model->extension_public->
-      communicate(((workstation_CLM03_t) workstation_src)->network_card,
-                 ((workstation_CLM03_t) workstation_dst)->network_card,
-                 size, rate);
+  return surf_network_model->
+    extension_public->communicate(((workstation_CLM03_t) workstation_src)->
+                                  network_card,
+                                  ((workstation_CLM03_t) workstation_dst)->
+                                  network_card, size, rate);
 }
 
 static e_surf_cpu_state_t get_state(void *workstation)
 {
-  return surf_cpu_model->extension_public->
-      get_state(((workstation_CLM03_t) workstation)->cpu);
+  return surf_cpu_model->
+    extension_public->get_state(((workstation_CLM03_t) workstation)->cpu);
 }
 
 static double get_speed(void *workstation, double load)
 {
-  return surf_cpu_model->extension_public->
-      get_speed(((workstation_CLM03_t) workstation)->cpu, load);
+  return surf_cpu_model->
+    extension_public->get_speed(((workstation_CLM03_t) workstation)->cpu,
+                                load);
 }
 
 static double get_available_speed(void *workstation)
 {
-  return surf_cpu_model->extension_public->
-      get_available_speed(((workstation_CLM03_t) workstation)->cpu);
+  return surf_cpu_model->
+    extension_public->get_available_speed(((workstation_CLM03_t)
+                                           workstation)->cpu);
 }
 
 static xbt_dict_t get_properties(void *workstation)
 {
-  return surf_cpu_model->common_public->
-      get_properties(((workstation_CLM03_t) workstation)->cpu);
+  return surf_cpu_model->
+    common_public->get_properties(((workstation_CLM03_t) workstation)->cpu);
 }
 
 static surf_action_t execute_parallel_task(int workstation_nb,
-                                          void **workstation_list,
-                                          double *computation_amount,
-                                          double *communication_amount,
-                                          double amount,
-                                          double rate)
+                                           void **workstation_list,
+                                           double *computation_amount,
+                                           double *communication_amount,
+                                           double amount, double rate)
 {
-  THROW_UNIMPLEMENTED;  /* This model does not implement parallel tasks */
+  THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
 }
 
 
@@ -276,18 +273,19 @@ static const void **get_route(void *src, void *dst)
 {
   workstation_CLM03_t workstation_src = (workstation_CLM03_t) src;
   workstation_CLM03_t workstation_dst = (workstation_CLM03_t) dst;
-  return surf_network_model->extension_public->
-      get_route(workstation_src->network_card,
-               workstation_dst->network_card);
+  return surf_network_model->extension_public->get_route(workstation_src->
+                                                         network_card,
+                                                         workstation_dst->
+                                                         network_card);
 }
 
 static int get_route_size(void *src, void *dst)
 {
   workstation_CLM03_t workstation_src = (workstation_CLM03_t) src;
   workstation_CLM03_t workstation_dst = (workstation_CLM03_t) dst;
-  return surf_network_model->extension_public->
-      get_route_size(workstation_src->network_card,
-                    workstation_dst->network_card);
+  return surf_network_model->
+    extension_public->get_route_size(workstation_src->network_card,
+                                     workstation_dst->network_card);
 }
 
 static const char *get_link_name(const void *link)
@@ -313,14 +311,14 @@ static int link_shared(const void *link)
 static void finalize(void)
 {
   xbt_dict_free(&workstation_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               ready_action_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               failed_action_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               done_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.ready_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.running_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.failed_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.done_action_set);
 
   free(surf_workstation_model->common_public);
   free(surf_workstation_model->common_private);
@@ -337,84 +335,76 @@ static void surf_workstation_model_init_internal(void)
   surf_workstation_model = xbt_new0(s_surf_workstation_model_t, 1);
 
   surf_workstation_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
-  surf_workstation_model->common_public =
-      xbt_new0(s_surf_model_public_t, 1);
+    xbt_new0(s_surf_model_private_t, 1);
+  surf_workstation_model->common_public = xbt_new0(s_surf_model_public_t, 1);
 /*   surf_workstation_model->extension_private = xbt_new0(s_surf_workstation_model_extension_private_t,1); */
   surf_workstation_model->extension_public =
-      xbt_new0(s_surf_workstation_model_extension_public_t, 1);
+    xbt_new0(s_surf_workstation_model_extension_public_t, 1);
 
   surf_workstation_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_workstation_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_workstation_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_workstation_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_workstation_model->common_public->name_service = name_service;
   surf_workstation_model->common_public->get_resource_name =
-      get_resource_name;
+    get_resource_name;
   surf_workstation_model->common_public->action_get_state =
-      surf_action_get_state;
+    surf_action_get_state;
   surf_workstation_model->common_public->action_get_start_time =
-      surf_action_get_start_time;
+    surf_action_get_start_time;
   surf_workstation_model->common_public->action_get_finish_time =
-      surf_action_get_finish_time;
+    surf_action_get_finish_time;
   surf_workstation_model->common_public->action_free = action_free;
   surf_workstation_model->common_public->action_use = action_use;
   surf_workstation_model->common_public->action_cancel = action_cancel;
-  surf_workstation_model->common_public->action_recycle =
-      action_recycle;
+  surf_workstation_model->common_public->action_recycle = action_recycle;
   surf_workstation_model->common_public->action_change_state =
-      action_change_state;
+    action_change_state;
   surf_workstation_model->common_public->action_set_data =
-      surf_action_set_data;
+    surf_action_set_data;
   surf_workstation_model->common_public->name = "Workstation";
 
   surf_workstation_model->common_private->resource_used = resource_used;
-  surf_workstation_model->common_private->share_resources =
-      share_resources;
+  surf_workstation_model->common_private->share_resources = share_resources;
   surf_workstation_model->common_private->update_actions_state =
-      update_actions_state;
+    update_actions_state;
   surf_workstation_model->common_private->update_resource_state =
-      update_resource_state;
+    update_resource_state;
   surf_workstation_model->common_private->finalize = finalize;
 
   surf_workstation_model->common_public->suspend = action_suspend;
   surf_workstation_model->common_public->resume = action_resume;
-  surf_workstation_model->common_public->is_suspended =
-      action_is_suspended;
+  surf_workstation_model->common_public->is_suspended = action_is_suspended;
   surf_workstation_model->common_public->set_max_duration =
-      action_set_max_duration;
-  surf_workstation_model->common_public->set_priority =
-      action_set_priority;
+    action_set_max_duration;
+  surf_workstation_model->common_public->set_priority = action_set_priority;
 
   surf_workstation_model->extension_public->execute = execute;
   surf_workstation_model->extension_public->sleep = action_sleep;
   surf_workstation_model->extension_public->get_state = get_state;
   surf_workstation_model->extension_public->get_speed = get_speed;
   surf_workstation_model->extension_public->get_available_speed =
-      get_available_speed;
+    get_available_speed;
 
-  /*manage the properties of the workstation*/
+  /*manage the properties of the workstation */
   surf_workstation_model->common_public->get_properties = get_properties;
 
   surf_workstation_model->extension_public->communicate = communicate;
   surf_workstation_model->extension_public->execute_parallel_task =
-      execute_parallel_task;
+    execute_parallel_task;
   surf_workstation_model->extension_public->get_route = get_route;
-  surf_workstation_model->extension_public->get_route_size =
-      get_route_size;
-  surf_workstation_model->extension_public->get_link_name =
-      get_link_name;
+  surf_workstation_model->extension_public->get_route_size = get_route_size;
+  surf_workstation_model->extension_public->get_link_name = get_link_name;
   surf_workstation_model->extension_public->get_link_bandwidth =
-      get_link_bandwidth;
+    get_link_bandwidth;
   surf_workstation_model->extension_public->get_link_latency =
-      get_link_latency;
-  surf_workstation_model->extension_public->link_shared =
-      link_shared;
+    get_link_latency;
+  surf_workstation_model->extension_public->link_shared = link_shared;
 
   workstation_set = xbt_dict_new();
 }
@@ -436,8 +426,7 @@ void surf_workstation_model_init_CLM03(const char *filename)
   surf_cpu_model_init_Cas01(filename);
   surf_network_model_init_CM02(filename);
   update_model_description(surf_workstation_model_description,
-                          "CLM03",
-                          (surf_model_t) surf_workstation_model);
+                           "CLM03", (surf_model_t) surf_workstation_model);
   xbt_dynar_push(model_list, &surf_workstation_model);
 }
 
@@ -449,8 +438,7 @@ void surf_workstation_model_init_compound(const char *filename)
   surf_workstation_model_init_internal();
 
   update_model_description(surf_workstation_model_description,
-                          "compound",
-                          (surf_model_t) surf_workstation_model);
+                           "compound", (surf_model_t) surf_workstation_model);
 
   xbt_dynar_push(model_list, &surf_workstation_model);
 }
index 89f16a4..3a80ce4 100644 (file)
@@ -11,8 +11,8 @@
 #include "surf_private.h"
 
 typedef struct workstation_CLM03 {
-  surf_model_t model;  /* Any such object, added in a trace
-                                  should start by this field!!! */
+  surf_model_t model;           /* Any such object, added in a trace
+                                   should start by this field!!! */
   char *name;
   void *cpu;
   void *network_card;
@@ -25,4 +25,4 @@ typedef struct surf_action_parallel_task_CSL05 {
   int suspended;
 } s_surf_action_parallel_task_CSL05_t, *surf_action_parallel_task_CSL05_t;
 
-#endif                         /* _SURF_WORKSTATION_PRIVATE_H */
+#endif /* _SURF_WORKSTATION_PRIVATE_H */
index 989379e..d5d987e 100644 (file)
@@ -20,17 +20,17 @@ typedef enum {
 /********* cpu object *****************/
 /**************************************/
 typedef struct cpu_L07 {
-  surf_model_t model;  /* Do not move this field: must match model_obj_t */
-  xbt_dict_t properties;                /* Do not move this field: must match link_L07_t */
-  e_surf_workstation_model_type_t type;        /* Do not move this field: must match link_L07_t */
-  char *name;                          /* Do not move this field: must match link_L07_t */
-  lmm_constraint_t constraint;         /* Do not move this field: must match link_L07_t */
+  surf_model_t model;           /* Do not move this field: must match model_obj_t */
+  xbt_dict_t properties;        /* Do not move this field: must match link_L07_t */
+  e_surf_workstation_model_type_t type; /* Do not move this field: must match link_L07_t */
+  char *name;                   /* Do not move this field: must match link_L07_t */
+  lmm_constraint_t constraint;  /* Do not move this field: must match link_L07_t */
   double power_scale;
   double power_current;
   tmgr_trace_event_t power_event;
   e_surf_cpu_state_t state_current;
   tmgr_trace_event_t state_event;
-  int id;                      /* cpu and network card are a single object... */
+  int id;                       /* cpu and network card are a single object... */
 } s_cpu_L07_t, *cpu_L07_t;
 
 /**************************************/
@@ -38,11 +38,11 @@ typedef struct cpu_L07 {
 /**************************************/
 
 typedef struct link_L07 {
-  surf_model_t model;  /* Do not move this field: must match model_obj_t */
-  xbt_dict_t properties;                /* Do not move this field: must match link_L07_t */
-  e_surf_workstation_model_type_t type;        /* Do not move this field: must match cpu_L07_t */
-  char *name;                          /* Do not move this field: must match cpu_L07_t */
-  lmm_constraint_t constraint;         /* Do not move this field: must match cpu_L07_t */
+  surf_model_t model;           /* Do not move this field: must match model_obj_t */
+  xbt_dict_t properties;        /* Do not move this field: must match link_L07_t */
+  e_surf_workstation_model_type_t type; /* Do not move this field: must match cpu_L07_t */
+  char *name;                   /* Do not move this field: must match cpu_L07_t */
+  lmm_constraint_t constraint;  /* Do not move this field: must match cpu_L07_t */
   double lat_current;
   tmgr_trace_event_t lat_event;
   double bw_current;
@@ -89,7 +89,7 @@ static void update_action_bound(surf_action_workstation_L07_t action)
   double lat_current = 0.0;
   double lat_bound = -1.0;
   int i, j, k;
-  
+
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
       cpu_L07_t card_src = action->workstation_list[i];
@@ -97,12 +97,14 @@ static void update_action_bound(surf_action_workstation_L07_t action)
       int route_size = ROUTE(card_src->id, card_dst->id).size;
       link_L07_t *route = ROUTE(card_src->id, card_dst->id).links;
       double lat = 0.0;
-      
+
       if (action->communication_amount[i * workstation_nb + j] > 0) {
-       for (k = 0; k < route_size; k++) {
-         lat += route[k]->lat_current;
-       }
-       lat_current=MAX(lat_current,lat*action->communication_amount[i * workstation_nb + j]);
+        for (k = 0; k < route_size; k++) {
+          lat += route[k]->lat_current;
+        }
+        lat_current =
+          MAX(lat_current,
+              lat * action->communication_amount[i * workstation_nb + j]);
       }
     }
   }
@@ -111,10 +113,10 @@ static void update_action_bound(surf_action_workstation_L07_t action)
   if ((action->latency == 0.0) && (action->suspended == 0)) {
     if (action->rate < 0)
       lmm_update_variable_bound(ptask_maxmin_system, action->variable,
-                               lat_bound);
+                                lat_bound);
     else
       lmm_update_variable_bound(ptask_maxmin_system, action->variable,
-                               min(action->rate,lat_bound));
+                                min(action->rate, lat_bound));
   }
 }
 
@@ -135,32 +137,33 @@ static const char *get_resource_name(void *resource_id)
 
   return ((cpu_L07_t) resource_id)->name;
 }
-static xbt_dict_t get_properties(void *r) {
+
+static xbt_dict_t get_properties(void *r)
+{
   /* We can freely cast as a cpu_L07_t since it has the same prefix than link_L07_t */
- return ((cpu_L07_t) r)->properties;
 return ((cpu_L07_t) r)->properties;
 }
 
 /* action_get_state is inherited from the surf module */
 
 static void action_use(surf_action_t action)
 {
-  action->refcount ++;
+  action->refcount++;
   return;
 }
 
 static int action_free(surf_action_t action)
 {
-  action->refcount --;
+  action->refcount--;
 
-  if (!action->refcount ) {
+  if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
     if (((surf_action_workstation_L07_t) action)->variable)
       lmm_variable_free(ptask_maxmin_system,
-                       ((surf_action_workstation_L07_t) action)->
-                       variable);
-    free(((surf_action_workstation_L07_t)action)->workstation_list);
-    free(((surf_action_workstation_L07_t)action)->communication_amount);
-    free(((surf_action_workstation_L07_t)action)->computation_amount);
+                        ((surf_action_workstation_L07_t) action)->variable);
+    free(((surf_action_workstation_L07_t) action)->workstation_list);
+    free(((surf_action_workstation_L07_t) action)->communication_amount);
+    free(((surf_action_workstation_L07_t) action)->computation_amount);
     free(action);
     return 1;
   }
@@ -188,8 +191,8 @@ static void action_suspend(surf_action_t action)
   if (((surf_action_workstation_L07_t) action)->suspended != 2) {
     ((surf_action_workstation_L07_t) action)->suspended = 1;
     lmm_update_variable_weight(ptask_maxmin_system,
-                              ((surf_action_workstation_L07_t)
-                               action)->variable, 0.0);
+                               ((surf_action_workstation_L07_t)
+                                action)->variable, 0.0);
   }
   XBT_OUT;
 }
@@ -200,7 +203,7 @@ static void action_resume(surf_action_t action)
 
   XBT_IN1("(%p)", act);
   if (act->suspended != 2) {
-    lmm_update_variable_weight(ptask_maxmin_system,act->variable, 1.0);
+    lmm_update_variable_weight(ptask_maxmin_system, act->variable, 1.0);
     act->suspended = 0;
   }
   XBT_OUT;
@@ -212,7 +215,7 @@ static int action_is_suspended(surf_action_t action)
 }
 
 static void action_set_max_duration(surf_action_t action, double duration)
-{                              /* FIXME: should inherit */
+{                               /* FIXME: should inherit */
   XBT_IN2("(%p,%g)", action, duration);
   action->max_duration = duration;
   XBT_OUT;
@@ -220,7 +223,7 @@ static void action_set_max_duration(surf_action_t action, double duration)
 
 
 static void action_set_priority(surf_action_t action, double priority)
-{                              /* FIXME: should inherit */
+{                               /* FIXME: should inherit */
   XBT_IN2("(%p,%g)", action, priority);
   action->priority = priority;
   XBT_OUT;
@@ -235,8 +238,7 @@ static int resource_used(void *resource_id)
   /* We can freely cast as a link_L07_t because it has
      the same prefix as cpu_L07_t */
   return lmm_constraint_used(ptask_maxmin_system,
-                            ((link_L07_t) resource_id)->
-                            constraint);
+                             ((link_L07_t) resource_id)->constraint);
 
 }
 
@@ -246,23 +248,23 @@ static double share_resources(double now)
   surf_action_workstation_L07_t action = NULL;
 
   xbt_swag_t running_actions =
-      surf_workstation_model->common_public->states.running_action_set;
+    surf_workstation_model->common_public->states.running_action_set;
   double min = generic_maxmin_share_resources(running_actions,
-                                             xbt_swag_offset(s_action,
-                                                             variable),
-                                             ptask_maxmin_system,
-                                             bottleneck_solve);
+                                              xbt_swag_offset(s_action,
+                                                              variable),
+                                              ptask_maxmin_system,
+                                              bottleneck_solve);
 
   xbt_swag_foreach(action, running_actions) {
     if (action->latency > 0) {
       if (min < 0) {
-       min = action->latency;
-       DEBUG3("Updating min (value) with %p (start %f): %f", action,
-              action->generic_action.start, min);
+        min = action->latency;
+        DEBUG3("Updating min (value) with %p (start %f): %f", action,
+               action->generic_action.start, min);
       } else if (action->latency < min) {
-       min = action->latency;
-       DEBUG3("Updating min (latency) with %p (start %f): %f", action,
-              action->generic_action.start, min);
+        min = action->latency;
+        DEBUG3("Updating min (latency) with %p (start %f): %f", action,
+               action->generic_action.start, min);
       }
     }
   }
@@ -278,40 +280,41 @@ static void update_actions_state(double now, double delta)
   surf_action_workstation_L07_t action = NULL;
   surf_action_workstation_L07_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_workstation_model->common_public->states.running_action_set;
+    surf_workstation_model->common_public->states.running_action_set;
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
     deltap = delta;
     if (action->latency > 0) {
       if (action->latency > deltap) {
-       double_update(&(action->latency), deltap);
-       deltap = 0.0;
+        double_update(&(action->latency), deltap);
+        deltap = 0.0;
       } else {
-       double_update(&(deltap), action->latency);
-       action->latency = 0.0;
+        double_update(&(deltap), action->latency);
+        action->latency = 0.0;
       }
       if ((action->latency == 0.0) && (action->suspended == 0)) {
-       update_action_bound(action);
-       lmm_update_variable_weight(ptask_maxmin_system,action->variable, 1.0);
+        update_action_bound(action);
+        lmm_update_variable_weight(ptask_maxmin_system, action->variable,
+                                   1.0);
       }
     }
     DEBUG3("Action (%p) : remains (%g) updated by %g.",
-          action, action->generic_action.remains,
-          lmm_variable_getvalue(action->variable) * delta);
+           action, action->generic_action.remains,
+           lmm_variable_getvalue(action->variable) * delta);
     double_update(&(action->generic_action.remains),
-                 lmm_variable_getvalue(action->variable) * delta);
+                  lmm_variable_getvalue(action->variable) * delta);
 
     if (action->generic_action.max_duration != NO_MAX_DURATION)
       double_update(&(action->generic_action.max_duration), delta);
 
     DEBUG2("Action (%p) : remains (%g).",
-          action, action->generic_action.remains);
+           action, action->generic_action.remains);
     if ((action->generic_action.remains <= 0) &&
-       (lmm_get_variable_weight(action->variable) > 0)) {
+        (lmm_get_variable_weight(action->variable) > 0)) {
       action->generic_action.finish = surf_get_clock();
       surf_action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     } else if ((action->generic_action.max_duration != NO_MAX_DURATION) &&
-              (action->generic_action.max_duration <= 0)) {
+               (action->generic_action.max_duration <= 0)) {
       action->generic_action.finish = surf_get_clock();
       surf_action_change_state((surf_action_t) action, SURF_ACTION_DONE);
     } else {
@@ -321,9 +324,9 @@ static void update_actions_state(double now, double delta)
       void *constraint_id = NULL;
 
       while ((cnst =
-             lmm_get_cnst_from_var(ptask_maxmin_system, action->variable,
-                                   i++))) {
-       constraint_id = lmm_constraint_id(cnst);
+              lmm_get_cnst_from_var(ptask_maxmin_system, action->variable,
+                                    i++))) {
+        constraint_id = lmm_constraint_id(cnst);
 
 /*     if(((link_L07_t)constraint_id)->type== */
 /*        SURF_WORKSTATION_RESOURCE_LINK) { */
@@ -339,20 +342,19 @@ static void update_actions_state(double now, double delta)
 /*              ((cpu_L07_t)constraint_id)->state_current==SURF_CPU_OFF?"Off":"On"); */
 /*     } */
 
-       if (((((link_L07_t) constraint_id)->type ==
-             SURF_WORKSTATION_RESOURCE_LINK) &&
-            (((link_L07_t) constraint_id)->state_current ==
-             SURF_LINK_OFF)) ||
-           ((((cpu_L07_t) constraint_id)->type ==
-             SURF_WORKSTATION_RESOURCE_CPU) &&
-            (((cpu_L07_t) constraint_id)->state_current ==
-             SURF_CPU_OFF))) {
-         DEBUG1("Action (%p) Failed!!", action);
-         action->generic_action.finish = surf_get_clock();
-         surf_action_change_state((surf_action_t) action,
-                                  SURF_ACTION_FAILED);
-         break;
-       }
+        if (((((link_L07_t) constraint_id)->type ==
+              SURF_WORKSTATION_RESOURCE_LINK) &&
+             (((link_L07_t) constraint_id)->state_current ==
+              SURF_LINK_OFF)) ||
+            ((((cpu_L07_t) constraint_id)->type ==
+              SURF_WORKSTATION_RESOURCE_CPU) &&
+             (((cpu_L07_t) constraint_id)->state_current == SURF_CPU_OFF))) {
+          DEBUG1("Action (%p) Failed!!", action);
+          action->generic_action.finish = surf_get_clock();
+          surf_action_change_state((surf_action_t) action,
+                                   SURF_ACTION_FAILED);
+          break;
+        }
       }
     }
   }
@@ -360,8 +362,8 @@ static void update_actions_state(double now, double delta)
 }
 
 static void update_resource_state(void *id,
-                                 tmgr_trace_event_t event_type,
-                                 double value, double date)
+                                  tmgr_trace_event_t event_type,
+                                  double value, double date)
 {
   cpu_L07_t cpu = id;
   link_L07_t nw_link = id;
@@ -371,7 +373,7 @@ static void update_resource_state(void *id,
     if (event_type == nw_link->bw_event) {
       nw_link->bw_current = value;
       lmm_update_constraint_bound(ptask_maxmin_system, nw_link->constraint,
-                                 nw_link->bw_current);
+                                  nw_link->bw_current);
     } else if (event_type == nw_link->lat_event) {
       lmm_variable_t var = NULL;
       surf_action_workstation_L07_t action = NULL;
@@ -379,18 +381,18 @@ static void update_resource_state(void *id,
 
       nw_link->lat_current = value;
       while ((var = lmm_get_var_from_cnst
-            (ptask_maxmin_system, nw_link->constraint, &elem))) {
-       
+              (ptask_maxmin_system, nw_link->constraint, &elem))) {
+
 
-       action = lmm_variable_id(var);
-       update_action_bound(action);
+        action = lmm_variable_id(var);
+        update_action_bound(action);
       }
 
     } else if (event_type == nw_link->state_event) {
       if (value > 0)
-       nw_link->state_current = SURF_LINK_ON;
+        nw_link->state_current = SURF_LINK_ON;
       else
-       nw_link->state_current = SURF_LINK_OFF;
+        nw_link->state_current = SURF_LINK_OFF;
     } else {
       CRITICAL0("Unknown event ! \n");
       xbt_abort();
@@ -401,12 +403,12 @@ static void update_resource_state(void *id,
     if (event_type == cpu->power_event) {
       cpu->power_current = value;
       lmm_update_constraint_bound(ptask_maxmin_system, cpu->constraint,
-                                 cpu->power_current * cpu->power_scale);
+                                  cpu->power_current * cpu->power_scale);
     } else if (event_type == cpu->state_event) {
       if (value > 0)
-       cpu->state_current = SURF_CPU_ON;
+        cpu->state_current = SURF_CPU_ON;
       else
-       cpu->state_current = SURF_CPU_OFF;
+        cpu->state_current = SURF_CPU_OFF;
     } else {
       CRITICAL0("Unknown event ! \n");
       xbt_abort();
@@ -427,14 +429,14 @@ static void finalize(void)
   if (parallel_task_link_set != NULL) {
     xbt_dict_free(&parallel_task_link_set);
   }
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               ready_action_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               running_action_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               failed_action_set);
-  xbt_swag_free(surf_workstation_model->common_public->states.
-               done_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.ready_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.running_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.failed_action_set);
+  xbt_swag_free(surf_workstation_model->common_public->
+                states.done_action_set);
 
   free(surf_workstation_model->common_public);
   free(surf_workstation_model->common_private);
@@ -476,10 +478,10 @@ static double get_available_speed(void *cpu)
 }
 
 static surf_action_t execute_parallel_task(int workstation_nb,
-                                          void **workstation_list,
-                                          double *computation_amount,
-                                          double *communication_amount,
-                                          double amount, double rate)
+                                           void **workstation_list,
+                                           double *computation_amount,
+                                           double *communication_amount,
+                                           double amount, double rate)
 {
   surf_action_workstation_L07_t action = NULL;
   int i, j, k;
@@ -502,12 +504,12 @@ static surf_action_t execute_parallel_task(int workstation_nb,
       double lat = 0.0;
 
       if (communication_amount[i * workstation_nb + j] > 0)
-       for (k = 0; k < route_size; k++) {
-         lat += route[k]->lat_current;
-         xbt_dict_set(parallel_task_link_set, route[k]->name,
-                      route[k], NULL);
-       }
-      latency=MAX(latency,lat);
+        for (k = 0; k < route_size; k++) {
+          lat += route[k]->lat_current;
+          xbt_dict_set(parallel_task_link_set, route[k]->name,
+                       route[k], NULL);
+        }
+      latency = MAX(latency, lat);
     }
   }
 
@@ -520,54 +522,53 @@ static surf_action_t execute_parallel_task(int workstation_nb,
 
   action = xbt_new0(s_surf_action_workstation_L07_t, 1);
   DEBUG3("Creating a parallel task (%p) with %d cpus and %d links.",
-        action, workstation_nb, nb_link);
-  action->generic_action.refcount  = 1;
+         action, workstation_nb, nb_link);
+  action->generic_action.refcount = 1;
   action->generic_action.cost = amount;
   action->generic_action.remains = amount;
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
-  action->generic_action.model_type =
-      (surf_model_t) surf_workstation_model;
-  action->suspended = 0;       /* Should be useless because of the
-                                  calloc but it seems to help valgrind... */
+  action->generic_action.model_type = (surf_model_t) surf_workstation_model;
+  action->suspended = 0;        /* Should be useless because of the
+                                   calloc but it seems to help valgrind... */
   action->workstation_nb = workstation_nb;
-  action->workstation_list = (cpu_L07_t *)workstation_list;
+  action->workstation_list = (cpu_L07_t *) workstation_list;
   action->computation_amount = computation_amount;
   action->communication_amount = communication_amount;
   action->latency = latency;
   action->generic_action.state_set =
-      surf_workstation_model->common_public->states.running_action_set;
+    surf_workstation_model->common_public->states.running_action_set;
 
   xbt_swag_insert(action, action->generic_action.state_set);
   action->rate = rate;
 
   action->variable =
-    lmm_variable_new(ptask_maxmin_system, action, 1.0, 
-                    (action->rate>0)?action->rate:-1.0,
-                    workstation_nb + nb_link);
+    lmm_variable_new(ptask_maxmin_system, action, 1.0,
+                     (action->rate > 0) ? action->rate : -1.0,
+                     workstation_nb + nb_link);
 
-  if (action->latency > 0) 
-    lmm_update_variable_weight(ptask_maxmin_system,action->variable,0.0);
+  if (action->latency > 0)
+    lmm_update_variable_weight(ptask_maxmin_system, action->variable, 0.0);
 
   for (i = 0; i < workstation_nb; i++)
     lmm_expand(ptask_maxmin_system,
-              ((cpu_L07_t) workstation_list[i])->constraint,
-              action->variable, computation_amount[i]);
-  
+               ((cpu_L07_t) workstation_list[i])->constraint,
+               action->variable, computation_amount[i]);
+
   for (i = 0; i < workstation_nb; i++) {
     for (j = 0; j < workstation_nb; j++) {
       cpu_L07_t card_src = workstation_list[i];
       cpu_L07_t card_dst = workstation_list[j];
       int route_size = ROUTE(card_src->id, card_dst->id).size;
       link_L07_t *route = ROUTE(card_src->id, card_dst->id).links;
-      
-      if (communication_amount[i * workstation_nb + j] == 0.0) 
-       continue;
+
+      if (communication_amount[i * workstation_nb + j] == 0.0)
+        continue;
       for (k = 0; k < route_size; k++) {
-         lmm_expand_add(ptask_maxmin_system, route[k]->constraint,
-                        action->variable,
-                        communication_amount[i * workstation_nb + j]);
+        lmm_expand_add(ptask_maxmin_system, route[k]->constraint,
+                       action->variable,
+                       communication_amount[i * workstation_nb + j]);
       }
     }
   }
@@ -591,11 +592,11 @@ static surf_action_t execute(void *cpu, double size)
   computation_amount[0] = size;
 
   return execute_parallel_task(1, workstation_list, computation_amount,
-                              communication_amount, 1, -1);
+                               communication_amount, 1, -1);
 }
 
 static surf_action_t communicate(void *src, void *dst, double size,
-                                double rate)
+                                 double rate)
 {
   void **workstation_list = xbt_new0(void *, 2);
   double *computation_amount = xbt_new0(double, 2);
@@ -607,8 +608,8 @@ static surf_action_t communicate(void *src, void *dst, double size,
   communication_amount[1] = size;
 
   res = execute_parallel_task(2, workstation_list,
-                             computation_amount, communication_amount,
-                             1, rate);
+                              computation_amount, communication_amount,
+                              1, rate);
 
   return res;
 }
@@ -673,20 +674,19 @@ static int link_shared(const void *link)
 static void cpu_free(void *cpu)
 {
   free(((cpu_L07_t) cpu)->name);
-  xbt_dict_free(&(((cpu_L07_t)cpu)->properties));
+  xbt_dict_free(&(((cpu_L07_t) cpu)->properties));
   free(cpu);
 }
 
 static cpu_L07_t cpu_new(const char *name, double power_scale,
-                        double power_initial,
-                        tmgr_trace_t power_trace,
-                        e_surf_cpu_state_t state_initial,
-                        tmgr_trace_t state_trace,
-                         xbt_dict_t cpu_properties)
+                         double power_initial,
+                         tmgr_trace_t power_trace,
+                         e_surf_cpu_state_t state_initial,
+                         tmgr_trace_t state_trace, xbt_dict_t cpu_properties)
 {
   cpu_L07_t cpu = xbt_new0(s_cpu_L07_t, 1);
-  xbt_assert1(! xbt_dict_get_or_null(workstation_set, name),
-             "Host '%s' declared several times in the platform file.",name);
+  xbt_assert1(!xbt_dict_get_or_null(workstation_set, name),
+              "Host '%s' declared several times in the platform file.", name);
 
   cpu->model = (surf_model_t) surf_workstation_model;
   cpu->type = SURF_WORKSTATION_RESOURCE_CPU;
@@ -699,19 +699,19 @@ static cpu_L07_t cpu_new(const char *name, double power_scale,
   cpu->power_current = power_initial;
   if (power_trace)
     cpu->power_event =
-       tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
+      tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu);
 
   cpu->state_current = state_initial;
   if (state_trace)
     cpu->state_event =
-       tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
+      tmgr_history_add_trace(history, state_trace, 0.0, 0, cpu);
 
   cpu->constraint =
-      lmm_constraint_new(ptask_maxmin_system, cpu,
-                        cpu->power_current * cpu->power_scale);
+    lmm_constraint_new(ptask_maxmin_system, cpu,
+                       cpu->power_current * cpu->power_scale);
 
-  /*add the property set*/
-  cpu->properties =  current_property_set;
+  /*add the property set */
+  cpu->properties = current_property_set;
 
   xbt_dict_set(workstation_set, name, cpu, cpu_free);
 
@@ -720,7 +720,7 @@ static cpu_L07_t cpu_new(const char *name, double power_scale,
 
 static void create_routing_table(void)
 {
-   routing_table = xbt_new0(s_route_L07_t, nb_workstation * nb_workstation);
+  routing_table = xbt_new0(s_route_L07_t, nb_workstation * nb_workstation);
 }
 
 static void parse_cpu_init(void)
@@ -736,8 +736,8 @@ static void parse_cpu_init(void)
   surf_parse_get_trace(&power_trace, A_surfxml_host_availability_file);
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
-             (A_surfxml_host_state == A_surfxml_host_state_OFF),
-             "Invalid state");
+              (A_surfxml_host_state == A_surfxml_host_state_OFF),
+              "Invalid state");
   if (A_surfxml_host_state == A_surfxml_host_state_ON)
     state_initial = SURF_CPU_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
@@ -746,30 +746,30 @@ static void parse_cpu_init(void)
 
   current_property_set = xbt_dict_new();
   cpu_new(A_surfxml_host_id, power_scale, power_initial, power_trace,
-         state_initial, state_trace,current_property_set);
+          state_initial, state_trace, current_property_set);
 }
 
 static void link_free(void *nw_link)
 {
   free(((link_L07_t) nw_link)->name);
-  xbt_dict_free(&(((link_L07_t)nw_link)->properties));
+  xbt_dict_free(&(((link_L07_t) nw_link)->properties));
   free(nw_link);
 }
 
 static link_L07_t link_new(char *name,
-                          double bw_initial,
-                          tmgr_trace_t bw_trace,
-                          double lat_initial,
-                          tmgr_trace_t lat_trace,
-                          e_surf_link_state_t
-                          state_initial,
-                          tmgr_trace_t state_trace,
-                          e_surf_link_sharing_policy_t
-                          policy, xbt_dict_t properties)
-{   
+                           double bw_initial,
+                           tmgr_trace_t bw_trace,
+                           double lat_initial,
+                           tmgr_trace_t lat_trace,
+                           e_surf_link_state_t
+                           state_initial,
+                           tmgr_trace_t state_trace,
+                           e_surf_link_sharing_policy_t
+                           policy, xbt_dict_t properties)
+{
   link_L07_t nw_link = xbt_new0(s_link_L07_t, 1);
-  xbt_assert1(! xbt_dict_get_or_null(link_set, name),
-             "Link '%s' declared several times in the platform file.",name);
+  xbt_assert1(!xbt_dict_get_or_null(link_set, name),
+              "Link '%s' declared several times in the platform file.", name);
 
   nw_link->model = (surf_model_t) surf_workstation_model;
   nw_link->type = SURF_WORKSTATION_RESOURCE_LINK;
@@ -777,25 +777,24 @@ static link_L07_t link_new(char *name,
   nw_link->bw_current = bw_initial;
   if (bw_trace)
     nw_link->bw_event =
-       tmgr_history_add_trace(history, bw_trace, 0.0, 0, nw_link);
+      tmgr_history_add_trace(history, bw_trace, 0.0, 0, nw_link);
   nw_link->state_current = state_initial;
   nw_link->lat_current = lat_initial;
   if (lat_trace)
     nw_link->lat_event =
-       tmgr_history_add_trace(history, lat_trace, 0.0, 0, nw_link);
+      tmgr_history_add_trace(history, lat_trace, 0.0, 0, nw_link);
   if (state_trace)
     nw_link->state_event =
-       tmgr_history_add_trace(history, state_trace, 0.0, 0, nw_link);
+      tmgr_history_add_trace(history, state_trace, 0.0, 0, nw_link);
 
   nw_link->constraint =
-      lmm_constraint_new(ptask_maxmin_system, nw_link,
-                        nw_link->bw_current);
+    lmm_constraint_new(ptask_maxmin_system, nw_link, nw_link->bw_current);
 
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(nw_link->constraint);
 
   nw_link->properties = properties;
-  
+
   xbt_dict_set(link_set, name, nw_link, link_free);
 
   return nw_link;
@@ -818,37 +817,36 @@ static void parse_link_init(void)
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
   surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
 
-  xbt_assert0((A_surfxml_link_state ==
-              A_surfxml_link_state_ON)
-             || (A_surfxml_link_state ==
-                 A_surfxml_link_state_OFF), "Invalid state");
+  xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
+              || (A_surfxml_link_state ==
+                  A_surfxml_link_state_OFF), "Invalid state");
   if (A_surfxml_link_state == A_surfxml_link_state_ON)
     state_initial_link = SURF_LINK_ON;
-  else if (A_surfxml_link_state ==
-          A_surfxml_link_state_OFF)
+  else if (A_surfxml_link_state == A_surfxml_link_state_OFF)
     state_initial_link = SURF_LINK_OFF;
 
-  if (A_surfxml_link_sharing_policy ==
-      A_surfxml_link_sharing_policy_SHARED)
+  if (A_surfxml_link_sharing_policy == A_surfxml_link_sharing_policy_SHARED)
     policy_initial_link = SURF_LINK_SHARED;
   else if (A_surfxml_link_sharing_policy ==
-          A_surfxml_link_sharing_policy_FATPIPE)
+           A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
   surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
 
   current_property_set = xbt_dict_new();
   link_new(name_link, bw_initial, bw_trace, lat_initial, lat_trace,
-                  state_initial_link, state_trace, policy_initial_link, current_property_set);
- }
+           state_initial_link, state_trace, policy_initial_link,
+           current_property_set);
+}
 
 static void route_new(int src_id, int dst_id,
-                     link_L07_t * link_list , int nb_link)
+                      link_L07_t * link_list, int nb_link)
 {
   route_L07_t route = &(ROUTE(src_id, dst_id));
 
   route->size = nb_link;
-  route->links = link_list = xbt_realloc(link_list, sizeof(link_L07_t) * nb_link); 
+  route->links = link_list =
+    xbt_realloc(link_list, sizeof(link_L07_t) * nb_link);
 }
 
 
@@ -874,11 +872,11 @@ static void parse_route_set_endpoints(void)
 
 static void parse_route_set_route(void)
 {
-  charname;
+  char *name;
   if (src_id != -1 && dst_id != -1) {
-     name = bprintf("%x#%x",src_id, dst_id);
-     manage_route(route_table, name, route_action, 0);
-     free(name);
+    name = bprintf("%x#%x", src_id, dst_id);
+    manage_route(route_table, name, route_action, 0);
+    free(name);
   }
 }
 
@@ -890,10 +888,9 @@ static void add_loopback(void)
   for (i = 0; i < nb_workstation; i++)
     if (!ROUTE(i, i).size) {
       if (!loopback)
-       loopback = link_new(xbt_strdup("__MSG_loopback__"),
-                                   498000000, NULL, 0.000015, NULL,
-                                   SURF_LINK_ON, NULL,
-                                   SURF_LINK_FATPIPE,NULL);
+        loopback = link_new(xbt_strdup("__MSG_loopback__"),
+                            498000000, NULL, 0.000015, NULL,
+                            SURF_LINK_ON, NULL, SURF_LINK_FATPIPE, NULL);
 
       ROUTE(i, i).size = 1;
       ROUTE(i, i).links = xbt_new0(link_L07_t, 1);
@@ -903,100 +900,103 @@ static void add_loopback(void)
 
 static void add_route(void)
 {
-    xbt_ex_t e;
-    int nb_link = 0;
-    unsigned int cpt = 0;
-    int link_list_capacity = 0;
-    link_L07_t *link_list = NULL;
-    xbt_dict_cursor_t cursor = NULL;
-    char *key,*data, *end;
-    const char *sep = "#";
-    xbt_dynar_t links, keys;
-       char* link = NULL;
-
-    if (routing_table == NULL) create_routing_table();
-
-    xbt_dict_foreach(route_table, cursor, key, data) {
-       nb_link = 0;
-       links = (xbt_dynar_t)data;
-       keys = xbt_str_split_str(key, sep);
-       
-       src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
-       dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
-
-       link_list_capacity = xbt_dynar_length(links);
-       link_list = xbt_new(link_L07_t, link_list_capacity);
-
-       
-       xbt_dynar_foreach (links, cpt, link) {
-         TRY {
-           link_list[nb_link++] = xbt_dict_get(link_set, link);
-         }
-         CATCH(e) {
-           RETHROW1("Link %s not found (dict raised this exception: %s)", link);
-         }    
-       }
-       route_new(src_id, dst_id, link_list, nb_link);
-   }
+  xbt_ex_t e;
+  int nb_link = 0;
+  unsigned int cpt = 0;
+  int link_list_capacity = 0;
+  link_L07_t *link_list = NULL;
+  xbt_dict_cursor_t cursor = NULL;
+  char *key, *data, *end;
+  const char *sep = "#";
+  xbt_dynar_t links, keys;
+  char *link = NULL;
+
+  if (routing_table == NULL)
+    create_routing_table();
+
+  xbt_dict_foreach(route_table, cursor, key, data) {
+    nb_link = 0;
+    links = (xbt_dynar_t) data;
+    keys = xbt_str_split_str(key, sep);
+
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char *), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char *), &end, 16);
+
+    link_list_capacity = xbt_dynar_length(links);
+    link_list = xbt_new(link_L07_t, link_list_capacity);
+
+
+    xbt_dynar_foreach(links, cpt, link) {
+      TRY {
+        link_list[nb_link++] = xbt_dict_get(link_set, link);
+      }
+      CATCH(e) {
+        RETHROW1("Link %s not found (dict raised this exception: %s)", link);
+      }
+    }
+    route_new(src_id, dst_id, link_list, nb_link);
+  }
 }
 
-static void add_traces(void) {   
-   xbt_dict_cursor_t cursor=NULL;
-   char *trace_name,*elm;
-   
-   if (!trace_connect_list_host_avail) return;
-   /* Connect traces relative to cpu */
-   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      cpu_L07_t host = xbt_dict_get_or_null(workstation_set, elm);
-      
-      xbt_assert1(host, "Host %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); 
-   }
+static void add_traces(void)
+{
+  xbt_dict_cursor_t cursor = NULL;
+  char *trace_name, *elm;
 
-   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      cpu_L07_t host = xbt_dict_get_or_null(workstation_set, elm);
-      
-      xbt_assert1(host, "Host %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); 
-   }
+  if (!trace_connect_list_host_avail)
+    return;
 
-   /* Connect traces relative to network */
-   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      link_L07_t link = xbt_dict_get_or_null(link_set, elm);
-      
-      xbt_assert1(link, "Link %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      link->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
-   }
+  /* Connect traces relative to cpu */
+  xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    cpu_L07_t host = xbt_dict_get_or_null(workstation_set, elm);
 
-   xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      link_L07_t link = xbt_dict_get_or_null(link_set, elm);
-      
-      xbt_assert1(link, "Link %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      link->bw_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
-   }
-   
-   xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
-      tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
-      link_L07_t link = xbt_dict_get_or_null(link_set, elm);
-      
-      xbt_assert1(link, "Link %s undefined", elm);
-      xbt_assert1(trace, "Trace %s undefined", trace_name);
-      
-      link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
-   }
+    xbt_assert1(host, "Host %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host);
+  }
+
+  xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    cpu_L07_t host = xbt_dict_get_or_null(workstation_set, elm);
+
+    xbt_assert1(host, "Host %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host);
+  }
+
+  /* Connect traces relative to network */
+  xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    link_L07_t link = xbt_dict_get_or_null(link_set, elm);
+
+    xbt_assert1(link, "Link %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    link->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
+  }
+
+  xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    link_L07_t link = xbt_dict_get_or_null(link_set, elm);
+
+    xbt_assert1(link, "Link %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    link->bw_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
+  }
+
+  xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
+    tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
+    link_L07_t link = xbt_dict_get_or_null(link_set, elm);
+
+    xbt_assert1(link, "Link %s undefined", elm);
+    xbt_assert1(trace, "Trace %s undefined", trace_name);
+
+    link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
+  }
 /*
    
    xbt_dynar_foreach (traces_connect_list, cpt, value) {
@@ -1033,7 +1033,8 @@ static void define_callbacks(const char *file)
   surf_parse_reset_parser();
   surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init);
   surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init);
-  surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints);
+  surfxml_add_callback(STag_surfxml_route_cb_list,
+                       &parse_route_set_endpoints);
   surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route);
   surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback);
@@ -1052,79 +1053,70 @@ static void model_init_internal(void)
   surf_workstation_model = xbt_new0(s_surf_workstation_model_t, 1);
 
   surf_workstation_model->common_private =
-      xbt_new0(s_surf_model_private_t, 1);
-  surf_workstation_model->common_public =
-      xbt_new0(s_surf_model_public_t, 1);
+    xbt_new0(s_surf_model_private_t, 1);
+  surf_workstation_model->common_public = xbt_new0(s_surf_model_public_t, 1);
   surf_workstation_model->extension_public =
-      xbt_new0(s_surf_workstation_model_extension_public_t, 1);
+    xbt_new0(s_surf_workstation_model_extension_public_t, 1);
 
   surf_workstation_model->common_public->states.ready_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_workstation_model->common_public->states.running_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_workstation_model->common_public->states.failed_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
   surf_workstation_model->common_public->states.done_action_set =
-      xbt_swag_new(xbt_swag_offset(action, state_hookup));
+    xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_workstation_model->common_public->name_service = name_service;
   surf_workstation_model->common_public->get_resource_name =
-      get_resource_name;
+    get_resource_name;
   surf_workstation_model->common_public->action_get_state =
-      surf_action_get_state;
+    surf_action_get_state;
   surf_workstation_model->common_public->action_get_start_time =
-      surf_action_get_start_time;
+    surf_action_get_start_time;
   surf_workstation_model->common_public->action_get_finish_time =
-      surf_action_get_finish_time;
+    surf_action_get_finish_time;
   surf_workstation_model->common_public->action_use = action_use;
   surf_workstation_model->common_public->action_free = action_free;
   surf_workstation_model->common_public->action_cancel = action_cancel;
-  surf_workstation_model->common_public->action_recycle =
-      action_recycle;
+  surf_workstation_model->common_public->action_recycle = action_recycle;
   surf_workstation_model->common_public->action_change_state =
-      surf_action_change_state;
+    surf_action_change_state;
   surf_workstation_model->common_public->action_set_data =
-      surf_action_set_data;
+    surf_action_set_data;
   surf_workstation_model->common_public->suspend = action_suspend;
   surf_workstation_model->common_public->resume = action_resume;
-  surf_workstation_model->common_public->is_suspended =
-      action_is_suspended;
+  surf_workstation_model->common_public->is_suspended = action_is_suspended;
   surf_workstation_model->common_public->set_max_duration =
-      action_set_max_duration;
-  surf_workstation_model->common_public->set_priority =
-      action_set_priority;
+    action_set_max_duration;
+  surf_workstation_model->common_public->set_priority = action_set_priority;
   surf_workstation_model->common_public->name = "Workstation ptask_L07";
 
   surf_workstation_model->common_private->resource_used = resource_used;
-  surf_workstation_model->common_private->share_resources =
-      share_resources;
+  surf_workstation_model->common_private->share_resources = share_resources;
   surf_workstation_model->common_private->update_actions_state =
-      update_actions_state;
+    update_actions_state;
   surf_workstation_model->common_private->update_resource_state =
-      update_resource_state;
+    update_resource_state;
   surf_workstation_model->common_private->finalize = finalize;
 
   surf_workstation_model->extension_public->execute = execute;
   surf_workstation_model->extension_public->sleep = action_sleep;
-  surf_workstation_model->extension_public->get_state =
-      resource_get_state;
+  surf_workstation_model->extension_public->get_state = resource_get_state;
   surf_workstation_model->extension_public->get_speed = get_speed;
   surf_workstation_model->extension_public->get_available_speed =
-      get_available_speed;
+    get_available_speed;
   surf_workstation_model->extension_public->communicate = communicate;
   surf_workstation_model->extension_public->execute_parallel_task =
-      execute_parallel_task;
+    execute_parallel_task;
   surf_workstation_model->extension_public->get_route = get_route;
-  surf_workstation_model->extension_public->get_route_size =
-      get_route_size;
-  surf_workstation_model->extension_public->get_link_name =
-      get_link_name;
+  surf_workstation_model->extension_public->get_route_size = get_route_size;
+  surf_workstation_model->extension_public->get_link_name = get_link_name;
   surf_workstation_model->extension_public->get_link_bandwidth =
-      get_link_bandwidth;
+    get_link_bandwidth;
   surf_workstation_model->extension_public->get_link_latency =
-      get_link_latency;
-  surf_workstation_model->extension_public->link_shared =
-      link_shared;
+    get_link_latency;
+  surf_workstation_model->extension_public->link_shared = link_shared;
 
   surf_workstation_model->common_public->get_properties = get_properties;
 
@@ -1141,13 +1133,12 @@ static void model_init_internal(void)
 void surf_workstation_model_init_ptask_L07(const char *filename)
 {
   xbt_assert0(!surf_cpu_model, "CPU model type already defined");
-  xbt_assert0(!surf_network_model,
-             "network model type already defined");
+  xbt_assert0(!surf_network_model, "network model type already defined");
   model_init_internal();
   define_callbacks(filename);
 
   update_model_description(surf_workstation_model_description,
-                          "ptask_L07",
-                          (surf_model_t) surf_workstation_model);
+                           "ptask_L07",
+                           (surf_model_t) surf_workstation_model);
   xbt_dynar_push(model_list, &surf_workstation_model);
 }
index 7b3912b..cd29583 100644 (file)
@@ -6,7 +6,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <stdlib.h> /* abort */
+#include <stdlib.h>             /* abort */
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 
@@ -24,12 +24,14 @@ XBT_LOG_DEFAULT_CATEGORY(xbt);
  * If you want to pass arguments to the format, you can always write xbt_assert1(0,"fmt",args) or
  * xbt_die(bprintf("fmt", arg))
  */
-void xbt_die (const char *msg) {
-  CRITICAL1("%s",msg);
+void xbt_die(const char *msg)
+{
+  CRITICAL1("%s", msg);
   xbt_abort();
 }
 
 /** @brief Kill the program in silence */
-void xbt_abort(void) {
+void xbt_abort(void)
+{
   abort();
 }
index a4e1509..823f685 100644 (file)
 #include "xbt_modinter.h"
 
 /* Module creation/destruction */
-void xbt_backtrace_init(void) { }
-void xbt_backtrace_exit(void) { }
+void xbt_backtrace_init(void)
+{
+}
+
+void xbt_backtrace_exit(void)
+{
+}
 
 /* create a backtrace in the given exception */
-void xbt_backtrace_current(xbt_ex_t *e)  { }
+void xbt_backtrace_current(xbt_ex_t * e)
+{
+}
 
 /* prepare a backtrace for display */
-void xbt_ex_setup_backtrace(xbt_ex_t *e)  { }
-
+void xbt_ex_setup_backtrace(xbt_ex_t * e)
+{
+}
index b4fe6be..89e229f 100644 (file)
 /* This file is to be included in ex.c, so the following headers are not mandatory, but it's to make sure that eclipse see them too */
 #include "xbt/ex.h"
 #include "xbt/str.h"
-#include "xbt/module.h" /* xbt_binary_name */
-#include "xbt_modinter.h" /* backtrace initialization headers */
+#include "xbt/module.h"         /* xbt_binary_name */
+#include "xbt_modinter.h"       /* backtrace initialization headers */
 /* end of "useless" inclusions */
 
 extern char **environ;          /* the environment, as specified by the opengroup */
 
 /* Module creation/destruction: nothing to do on linux */
-void xbt_backtrace_init(void) { }
-void xbt_backtrace_exit(void) { }
+void xbt_backtrace_init(void)
+{
+}
+
+void xbt_backtrace_exit(void)
+{
+}
 
-void xbt_backtrace_current(xbt_ex_t * e) {
+void xbt_backtrace_current(xbt_ex_t * e)
+{
   e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE);
 }
 
@@ -52,12 +58,14 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e)
   struct stat stat_buf;
   char *binary_name = NULL;
 
-  xbt_assert0(e && e->used,"Backtrace not setup yet, cannot set it up for display");
+  xbt_assert0(e
+              && e->used,
+              "Backtrace not setup yet, cannot set it up for display");
 
   backtrace_syms = backtrace_symbols(e->bt, e->used);
   /* ignore first one, which is this xbt_backtrace_current() */
   e->used--;
-  memmove(backtrace_syms,backtrace_syms+1,sizeof(char*)*e->used);
+  memmove(backtrace_syms, backtrace_syms + 1, sizeof(char *) * e->used);
   addrs = xbt_new(char *, e->used);
 
   e->bt_strings = NULL;
@@ -144,11 +152,13 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e)
     DEBUG2("Looking for symbol %d, addr = '%s'", i, addrs[i]);
     fgets_res = fgets(line_func, 1024, pipe);
     if (fgets_res == NULL)
-      THROW2(system_error,0, "Cannot run fgets to look for symbol %d, addr %s",i, addrs[i]);
+      THROW2(system_error, 0,
+             "Cannot run fgets to look for symbol %d, addr %s", i, addrs[i]);
     line_func[strlen(line_func) - 1] = '\0';
     fgets_res = fgets(line_pos, 1024, pipe);
     if (fgets_res == NULL)
-      THROW2(system_error,0, "Cannot run fgets to look for symbol %d, addr %s",i, addrs[i]);
+      THROW2(system_error, 0,
+             "Cannot run fgets to look for symbol %d, addr %s", i, addrs[i]);
     line_pos[strlen(line_pos) - 1] = '\0';
 
     if (strcmp("??", line_func)) {
@@ -199,7 +209,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e)
         if (found) {
           DEBUG3("%#lx in [%#lx-%#lx]", addr, first, last);
           DEBUG0
-          ("Symbol found, map lines not further displayed (even if looking for next ones)");
+            ("Symbol found, map lines not further displayed (even if looking for next ones)");
         }
       }
       fclose(maps);
@@ -207,7 +217,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e)
 
       if (!found) {
         VERB0
-        ("Problem while reading the maps file. Following backtrace will be mangled.");
+          ("Problem while reading the maps file. Following backtrace will be mangled.");
         DEBUG1("No dynamic. Static symbol: %s", backtrace_syms[i]);
         e->bt_strings[i] = bprintf("**   In ?? (%s)", backtrace_syms[i]);
         continue;
@@ -245,13 +255,15 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e)
           CRITICAL0("Cannot fork addr2line to display the backtrace");
           abort();
         }
-        fgets_res=fgets(line_func, 1024, subpipe);
+        fgets_res = fgets(line_func, 1024, subpipe);
         if (fgets_res == NULL)
-          THROW1(system_error,0, "Cannot read result of subcommand %s",subcmd);
+          THROW1(system_error, 0, "Cannot read result of subcommand %s",
+                 subcmd);
         line_func[strlen(line_func) - 1] = '\0';
         fgets_res = fgets(line_pos, 1024, subpipe);
         if (fgets_res == NULL)
-          THROW1(system_error,0, "Cannot read result of subcommand %s",subcmd);
+          THROW1(system_error, 0, "Cannot read result of subcommand %s",
+                 subcmd);
         line_pos[strlen(line_pos) - 1] = '\0';
         pclose(subpipe);
         free(subcmd);
index e2e60e6..0b73f77 100644 (file)
@@ -37,34 +37,33 @@ static fun_function_table_access_t fun_function_table_access;
 
 /* SymGetLineFromAddr() */
 typedef BOOL(WINAPI * fun_get_line_from_addr_t) (HANDLE, DWORD,
-    PDWORD,
-    PIMAGEHLP_LINE);
+                                                 PDWORD, PIMAGEHLP_LINE);
 static fun_get_line_from_addr_t fun_get_line_from_addr;
 
 /* SymGetModuleBase() */
-typedef DWORD(WINAPI *fun_get_module_base_t) (HANDLE, DWORD);
+typedef DWORD(WINAPI * fun_get_module_base_t) (HANDLE, DWORD);
 static fun_get_module_base_t fun_get_module_base;
 
 /* SymGetOptions() */
-typedef DWORD(WINAPI *fun_get_options_t) (VOID);
+typedef DWORD(WINAPI * fun_get_options_t) (VOID);
 static fun_get_options_t fun_get_options;
 
 /* SymSetOptions() */
-typedef DWORD(WINAPI *fun_set_options_t) (DWORD);
+typedef DWORD(WINAPI * fun_set_options_t) (DWORD);
 static fun_set_options_t fun_set_options;
 
 /* Pointer function to SymGetSymFromAddr() */
-typedef BOOL(WINAPI *fun_get_sym_from_addr_t) (HANDLE, DWORD, PDWORD,
-    OUT PIMAGEHLP_SYMBOL);
+typedef BOOL(WINAPI * fun_get_sym_from_addr_t) (HANDLE, DWORD, PDWORD,
+                                                OUT PIMAGEHLP_SYMBOL);
 static fun_get_sym_from_addr_t fun_get_sym_from_addr;
 
 /* Pointer function to StackWalk() */
 typedef BOOL(WINAPI * fun_stack_walk_t) (DWORD, HANDLE, HANDLE,
-    LPSTACKFRAME, PVOID,
-    PREAD_PROCESS_MEMORY_ROUTINE,
-    PFUNCTION_TABLE_ACCESS_ROUTINE,
-    PGET_MODULE_BASE_ROUTINE,
-    PTRANSLATE_ADDRESS_ROUTINE);
+                                         LPSTACKFRAME, PVOID,
+                                         PREAD_PROCESS_MEMORY_ROUTINE,
+                                         PFUNCTION_TABLE_ACCESS_ROUTINE,
+                                         PGET_MODULE_BASE_ROUTINE,
+                                         PTRANSLATE_ADDRESS_ROUTINE);
 static fun_stack_walk_t fun_stack_walk;
 
 static HINSTANCE hlp_dbg_instance = NULL;
@@ -72,7 +71,8 @@ static HANDLE process_handle = NULL;
 
 
 /* Module creation/destruction: nothing to do on linux */
-void xbt_backtrace_init(void) {
+void xbt_backtrace_init(void)
+{
   process_handle = GetCurrentProcess();
 
   if (hlp_dbg_instance) {
@@ -92,15 +92,19 @@ void xbt_backtrace_init(void) {
   fun_cleanup =
     (fun_cleanup_t) GetProcAddress(hlp_dbg_instance, "SymCleanup");
   fun_function_table_access =
-    (fun_function_table_access_t) GetProcAddress(hlp_dbg_instance, "SymFunctionTableAccess");
+    (fun_function_table_access_t) GetProcAddress(hlp_dbg_instance,
+                                                 "SymFunctionTableAccess");
   fun_get_line_from_addr =
-    (fun_get_line_from_addr_t) GetProcAddress(hlp_dbg_instance, "SymGetLineFromAddr");
+    (fun_get_line_from_addr_t) GetProcAddress(hlp_dbg_instance,
+                                              "SymGetLineFromAddr");
   fun_get_module_base =
-    (fun_get_module_base_t) GetProcAddress(hlp_dbg_instance, "SymGetModuleBase");
+    (fun_get_module_base_t) GetProcAddress(hlp_dbg_instance,
+                                           "SymGetModuleBase");
   fun_get_options =
     (fun_get_options_t) GetProcAddress(hlp_dbg_instance, "SymGetOptions");
   fun_get_sym_from_addr =
-    (fun_get_sym_from_addr_t) GetProcAddress(hlp_dbg_instance, "SymGetSymFromAddr");
+    (fun_get_sym_from_addr_t) GetProcAddress(hlp_dbg_instance,
+                                             "SymGetSymFromAddr");
   fun_set_options =
     (fun_set_options_t) GetProcAddress(hlp_dbg_instance, "SymSetOptions");
   fun_stack_walk =
@@ -113,24 +117,23 @@ void xbt_backtrace_init(void) {
       !fun_get_line_from_addr ||
       !fun_get_module_base ||
       !fun_get_options ||
-      !fun_get_sym_from_addr ||
-      !fun_set_options ||
-      !fun_stack_walk
-  ) {
+      !fun_get_sym_from_addr || !fun_set_options || !fun_stack_walk) {
     FreeLibrary(hlp_dbg_instance);
     hlp_dbg_instance = NULL;
     return;
   }
 
   (*fun_set_options) ((*fun_get_options) () |
-      SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS);
+                      SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS);
 
   if (!(*fun_initialize) (process_handle, 0, 1)) {
     FreeLibrary(hlp_dbg_instance);
     hlp_dbg_instance = NULL;
   }
 }
-void xbt_backtrace_exit(void) {
+
+void xbt_backtrace_exit(void)
+{
   if (!hlp_dbg_instance)
     return;
 
@@ -165,7 +168,8 @@ int backtrace(void **buffer, int size);
  */
 char **backtrace_symbols(void *const *buffer, int size);
 
-void xbt_backtrace_current(xbt_ex_t * e) {
+void xbt_backtrace_current(xbt_ex_t * e)
+{
   e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE);
 }
 
@@ -175,7 +179,9 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e)
   int i;
   char **backtrace_syms;
 
-  xbt_assert0(e && e->used,"Backtrace not setup yet, cannot set it up for display");
+  xbt_assert0(e
+              && e->used,
+              "Backtrace not setup yet, cannot set it up for display");
 
   backtrace_syms = backtrace_symbols(e->bt, e->used);
   e->bt_strings = NULL;
@@ -199,8 +205,8 @@ int backtrace(void **buffer, int size)
   unsigned long offset = 0;
   IMAGEHLP_LINE line_info = { 0 };
   byte
-  __buffer[(sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR) +
-      sizeof(ULONG64) - 1) / sizeof(ULONG64)];
+    __buffer[(sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR) +
+              sizeof(ULONG64) - 1) / sizeof(ULONG64)];
 
   CONTEXT context = { CONTEXT_FULL };
   GetThreadContext(GetCurrentThread(), &context);
@@ -208,13 +214,12 @@ int backtrace(void **buffer, int size)
   /* ebp points on stack base */
   /* esp points on stack pointer, ie on last stacked element (current element) */
   _asm call $ + 5
-  _asm pop eax
-  _asm mov context.Eip, eax
-  _asm mov eax, esp
-  _asm mov context.Esp, eax
-  _asm mov context.Ebp, ebp
-
-  if ((NULL == hlp_dbg_instance) || (size <= 0) || (NULL == buffer)) {
+    _asm pop eax
+    _asm mov context.Eip, eax
+    _asm mov eax, esp
+    _asm mov context.Esp, eax
+    _asm mov context.Ebp, ebp
+    if ((NULL == hlp_dbg_instance) || (size <= 0) || (NULL == buffer)) {
     errno = EINVAL;
     return 0;
   }
@@ -246,18 +251,21 @@ int backtrace(void **buffer, int size)
     stack_frame->AddrStack.Mode = AddrModeFlat;
 
     if ((*fun_stack_walk) (IMAGE_FILE_MACHINE_I386,
-        process_handle,
-        GetCurrentThread(),
-        stack_frame,
-        &context,
-        NULL,
-        fun_function_table_access,
-        fun_get_module_base, NULL)
+                           process_handle,
+                           GetCurrentThread(),
+                           stack_frame,
+                           &context,
+                           NULL,
+                           fun_function_table_access,
+                           fun_get_module_base, NULL)
         && !first) {
       if (stack_frame->AddrReturn.Offset) {
 
-        if ((*fun_get_sym_from_addr) (process_handle, stack_frame->AddrPC.Offset, &offset, pSym)) {
-          if ((*fun_get_line_from_addr) (process_handle, stack_frame->AddrPC.Offset, &offset, &line_info))
+        if ((*fun_get_sym_from_addr)
+            (process_handle, stack_frame->AddrPC.Offset, &offset, pSym)) {
+          if ((*fun_get_line_from_addr)
+              (process_handle, stack_frame->AddrPC.Offset, &offset,
+               &line_info))
             buffer[pos++] = (void *) stack_frame;
         }
       } else {
@@ -288,8 +296,8 @@ char **backtrace_symbols(void *const *buffer, int size)
   IMAGEHLP_LINE line_info = { 0 };
   IMAGEHLP_MODULE module = { 0 };
   byte
-  __buffer[(sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR) +
-      sizeof(ULONG64) - 1) / sizeof(ULONG64)];
+    __buffer[(sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR) +
+              sizeof(ULONG64) - 1) / sizeof(ULONG64)];
 
   if ((NULL == hlp_dbg_instance) || (size <= 0) || (NULL == buffer)) {
     errno = EINVAL;
@@ -312,11 +320,13 @@ char **backtrace_symbols(void *const *buffer, int size)
 
     if (NULL != stack_frame) {
 
-      if ((*fun_get_sym_from_addr) (process_handle, stack_frame->AddrPC.Offset, &offset, pSym)) {
-        if ((*fun_get_line_from_addr) (process_handle, stack_frame->AddrPC.Offset, &offset, &line_info)) {
+      if ((*fun_get_sym_from_addr)
+          (process_handle, stack_frame->AddrPC.Offset, &offset, pSym)) {
+        if ((*fun_get_line_from_addr)
+            (process_handle, stack_frame->AddrPC.Offset, &offset, &line_info)) {
           strings[pos] =
             bprintf("**   In %s() at %s:%d", pSym->Name, line_info.FileName,
-                    (int)line_info.LineNumber);
+                    (int) line_info.LineNumber);
         } else {
           strings[pos] = bprintf("**   In %s()", pSym->Name);
         }
index c20d935..d9a0166 100644 (file)
@@ -18,9 +18,9 @@
 #include "xbt/dict.h"
 #include "xbt/peer.h"
 
-#include "xbt/config.h" /* prototypes of this module */
+#include "xbt/config.h"         /* prototypes of this module */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg,xbt,"configuration support");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
 
 /* xbt_cfgelm_t: the typedef corresponding to a config variable.
 
@@ -30,7 +30,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg,xbt,"configuration support");
 typedef struct {
   /* Allowed type of the variable */
   e_xbt_cfgelm_type_t type;
-  int min,max;
+  int min, max;
 
   /* Callbacks */
   xbt_cfg_cb_t cb_set;
@@ -39,10 +39,10 @@ typedef struct {
   /* actual content
      (cannot be an union because type peer uses both str and i) */
   xbt_dynar_t content;
-} s_xbt_cfgelm_t,*xbt_cfgelm_t;
+} s_xbt_cfgelm_t, *xbt_cfgelm_t;
 
-static const char *xbt_cfgelm_type_name[xbt_cfgelm_type_count]=
-{"int","double","string","peer","any"};
+static const char *xbt_cfgelm_type_name[xbt_cfgelm_type_count] =
+  { "int", "double", "string", "peer", "any" };
 
 /* Internal stuff used in cache to free a variable */
 static void xbt_cfgelm_free(void *data);
@@ -59,8 +59,9 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, const char *name,
  */
 
 
-xbt_cfg_t xbt_cfg_new(void) {
-  return (xbt_cfg_t)xbt_dict_new();
+xbt_cfg_t xbt_cfg_new(void)
+{
+  return (xbt_cfg_t) xbt_dict_new();
 }
 
 /** \brief Copy an existing configuration set
@@ -71,26 +72,27 @@ xbt_cfg_t xbt_cfg_new(void) {
  * This only copy the registrations, not the actual content
  */
 
-void
-xbt_cfg_cpy(xbt_cfg_t tocopy,xbt_cfg_t *whereto) {
-  xbt_dict_cursor_t cursor=NULL;
-  xbt_cfgelm_t variable=NULL;
-  char *name=NULL;
-
-  DEBUG1("Copy cfg set %p",tocopy);
-  *whereto=NULL;
-  xbt_assert0(tocopy,"cannot copy NULL config");
-
-  xbt_dict_foreach((xbt_dict_t)tocopy,cursor,name,variable) {
-    xbt_cfg_register(*whereto, name, variable->type, variable->min, variable->max,
-                     variable->cb_set, variable->cb_rm);
+void xbt_cfg_cpy(xbt_cfg_t tocopy, xbt_cfg_t * whereto)
+{
+  xbt_dict_cursor_t cursor = NULL;
+  xbt_cfgelm_t variable = NULL;
+  char *name = NULL;
+
+  DEBUG1("Copy cfg set %p", tocopy);
+  *whereto = NULL;
+  xbt_assert0(tocopy, "cannot copy NULL config");
+
+  xbt_dict_foreach((xbt_dict_t) tocopy, cursor, name, variable) {
+    xbt_cfg_register(*whereto, name, variable->type, variable->min,
+                     variable->max, variable->cb_set, variable->cb_rm);
   }
 }
 
 /** @brief Destructor */
-void xbt_cfg_free(xbt_cfg_t *cfg) {
-  DEBUG1("Frees cfg set %p",cfg);
-  xbt_dict_free((xbt_dict_t*)cfg);
+void xbt_cfg_free(xbt_cfg_t * cfg)
+{
+  DEBUG1("Frees cfg set %p", cfg);
+  xbt_dict_free((xbt_dict_t *) cfg);
 }
 
 /** @brief Dump a config set for debuging purpose
@@ -99,11 +101,12 @@ void xbt_cfg_free(xbt_cfg_t *cfg) {
  * \arg indent what to write at the begining of each line (right number of spaces)
  * \arg cfg the config set
  */
-void xbt_cfg_dump(const char *name,const char *indent,xbt_cfg_t cfg) {
+void xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cfg)
+{
   xbt_dict_t dict = (xbt_dict_t) cfg;
-  xbt_dict_cursor_t cursor=NULL;
-  xbt_cfgelm_t variable=NULL;
-  char *key=NULL;
+  xbt_dict_cursor_t cursor = NULL;
+  xbt_cfgelm_t variable = NULL;
+  char *key = NULL;
   int i;
   int size;
   int ival;
@@ -112,54 +115,55 @@ void xbt_cfg_dump(const char *name,const char *indent,xbt_cfg_t cfg) {
   xbt_peer_t hval;
 
   if (name)
-    printf("%s>> Dumping of the config set '%s':\n",indent,name);
-  xbt_dict_foreach(dict,cursor,key,variable) {
+    printf("%s>> Dumping of the config set '%s':\n", indent, name);
+  xbt_dict_foreach(dict, cursor, key, variable) {
 
-    printf("%s  %s:",indent,key);
+    printf("%s  %s:", indent, key);
 
     size = xbt_dynar_length(variable->content);
-    printf("%d_to_%d_%s. Actual size=%d. prerm=%p,postset=%p, List of values:\n",
-           variable->min,variable->max,xbt_cfgelm_type_name[variable->type],
-           size,
-           variable->cb_rm, variable->cb_set);
+    printf
+      ("%d_to_%d_%s. Actual size=%d. prerm=%p,postset=%p, List of values:\n",
+       variable->min, variable->max, xbt_cfgelm_type_name[variable->type],
+       size, variable->cb_rm, variable->cb_set);
 
     switch (variable->type) {
 
-      case xbt_cfgelm_int:
-        for (i=0; i<size; i++) {
-          ival = xbt_dynar_get_as(variable->content,i,int);
-          printf ("%s    %d\n",indent,ival);
-        }
-        break;
+    case xbt_cfgelm_int:
+      for (i = 0; i < size; i++) {
+        ival = xbt_dynar_get_as(variable->content, i, int);
+        printf("%s    %d\n", indent, ival);
+      }
+      break;
 
-      case xbt_cfgelm_double:
-        for (i=0; i<size; i++) {
-          dval = xbt_dynar_get_as(variable->content,i,double);
-          printf ("%s    %f\n",indent,dval);
-        }
-        break;
+    case xbt_cfgelm_double:
+      for (i = 0; i < size; i++) {
+        dval = xbt_dynar_get_as(variable->content, i, double);
+        printf("%s    %f\n", indent, dval);
+      }
+      break;
 
-      case xbt_cfgelm_string:
-        for (i=0; i<size; i++) {
-          sval = xbt_dynar_get_as(variable->content,i,char*);
-          printf ("%s    %s\n",indent,sval);
-        }
-        break;
+    case xbt_cfgelm_string:
+      for (i = 0; i < size; i++) {
+        sval = xbt_dynar_get_as(variable->content, i, char *);
+        printf("%s    %s\n", indent, sval);
+      }
+      break;
 
-      case xbt_cfgelm_peer:
-        for (i=0; i<size; i++) {
-          hval = xbt_dynar_get_as(variable->content,i,xbt_peer_t);
-          printf ("%s    %s:%d\n",indent,hval->name,hval->port);
-        }
-        break;
+    case xbt_cfgelm_peer:
+      for (i = 0; i < size; i++) {
+        hval = xbt_dynar_get_as(variable->content, i, xbt_peer_t);
+        printf("%s    %s:%d\n", indent, hval->name, hval->port);
+      }
+      break;
 
-      default:
-        printf("%s    Invalid type!!\n",indent);
+    default:
+      printf("%s    Invalid type!!\n", indent);
     }
 
   }
 
-  if (name) printf("%s<< End of the config set '%s'\n",indent,name);
+  if (name)
+    printf("%s<< End of the config set '%s'\n", indent, name);
   fflush(stdout);
 
   xbt_dict_cursor_free(&cursor);
@@ -170,11 +174,13 @@ void xbt_cfg_dump(const char *name,const char *indent,xbt_cfg_t cfg) {
  * free an config element
  */
 
-void xbt_cfgelm_free(void *data) {
-  xbt_cfgelm_t c=(xbt_cfgelm_t)data;
+void xbt_cfgelm_free(void *data)
+{
+  xbt_cfgelm_t c = (xbt_cfgelm_t) data;
 
-  DEBUG1("Frees cfgelm %p",c);
-  if (!c) return;
+  DEBUG1("Frees cfgelm %p", c);
+  if (!c)
+    return;
   xbt_dynar_free(&(c->content));
   free(c);
 }
@@ -192,53 +198,53 @@ void xbt_cfgelm_free(void *data) {
 void
 xbt_cfg_register(xbt_cfg_t cfg,
                  const char *name, e_xbt_cfgelm_type_t type,
-                 int min, int max,
-                 xbt_cfg_cb_t cb_set,  xbt_cfg_cb_t cb_rm){
+                 int min, int max, xbt_cfg_cb_t cb_set, xbt_cfg_cb_t cb_rm)
+{
   xbt_cfgelm_t res;
 
   xbt_assert(cfg);
-  xbt_assert4(type>=xbt_cfgelm_int && type<=xbt_cfgelm_peer,
+  xbt_assert4(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer,
               "type of %s not valid (%d should be between %d and %d)",
-              name,type,xbt_cfgelm_int, xbt_cfgelm_peer);
-  res = xbt_dict_get_or_null((xbt_dict_t)cfg,name);
+              name, type, xbt_cfgelm_int, xbt_cfgelm_peer);
+  res = xbt_dict_get_or_null((xbt_dict_t) cfg, name);
 
   if (res) {
-    WARN1("Config elem %s registered twice.",name);
+    WARN1("Config elem %s registered twice.", name);
     /* Will be removed by the insertion of the new one */
   }
 
-  res=xbt_new(s_xbt_cfgelm_t,1);
+  res = xbt_new(s_xbt_cfgelm_t, 1);
   DEBUG7("Register cfg elm %s (%d to %d %s (=%d) @%p in set %p)",
-         name,min,max,xbt_cfgelm_type_name[type],type,res,cfg);
+         name, min, max, xbt_cfgelm_type_name[type], type, res, cfg);
 
-  res->type=type;
-  res->min=min;
-  res->max=max;
+  res->type = type;
+  res->min = min;
+  res->max = max;
   res->cb_set = cb_set;
-  res->cb_rm  = cb_rm;
+  res->cb_rm = cb_rm;
 
   switch (type) {
-    case xbt_cfgelm_int:
-      res->content = xbt_dynar_new(sizeof(int), NULL);
-      break;
+  case xbt_cfgelm_int:
+    res->content = xbt_dynar_new(sizeof(int), NULL);
+    break;
 
-    case xbt_cfgelm_double:
-      res->content = xbt_dynar_new(sizeof(double), NULL);
-      break;
+  case xbt_cfgelm_double:
+    res->content = xbt_dynar_new(sizeof(double), NULL);
+    break;
 
-    case xbt_cfgelm_string:
-      res->content = xbt_dynar_new(sizeof(char*),xbt_free_ref);
-      break;
+  case xbt_cfgelm_string:
+    res->content = xbt_dynar_new(sizeof(char *), xbt_free_ref);
+    break;
 
-    case xbt_cfgelm_peer:
-      res->content = xbt_dynar_new(sizeof(xbt_peer_t),xbt_peer_free_voidp);
-      break;
+  case xbt_cfgelm_peer:
+    res->content = xbt_dynar_new(sizeof(xbt_peer_t), xbt_peer_free_voidp);
+    break;
 
-    default:
-      ERROR1("%d is an invalide type code",type);
+  default:
+    ERROR1("%d is an invalide type code", type);
   }
 
-  xbt_dict_set((xbt_dict_t)cfg,name,res,&xbt_cfgelm_free);
+  xbt_dict_set((xbt_dict_t) cfg, name, res, &xbt_cfgelm_free);
 }
 
 /** @brief Unregister an element from a config set.
@@ -250,10 +256,10 @@ xbt_cfg_register(xbt_cfg_t cfg,
  *  Throws not_found when no such element exists.
  */
 
-void
-xbt_cfg_unregister(xbt_cfg_t cfg,const char *name) {
-  DEBUG2("Unregister elm '%s' from set %p",name,cfg);
-  xbt_dict_remove((xbt_dict_t)cfg,name);
+void xbt_cfg_unregister(xbt_cfg_t cfg, const char *name)
+{
+  DEBUG2("Unregister elm '%s' from set %p", name, cfg);
+  xbt_dict_remove((xbt_dict_t) cfg, name);
 }
 
 /**
@@ -267,102 +273,93 @@ xbt_cfg_unregister(xbt_cfg_t cfg,const char *name) {
  * with type being one of  'string','int', 'peer' or 'double'.
  */
 
-void
-xbt_cfg_register_str(xbt_cfg_t cfg,const char *entry) {
-  char *entrycpy=xbt_strdup(entry);
+void xbt_cfg_register_str(xbt_cfg_t cfg, const char *entry)
+{
+  char *entrycpy = xbt_strdup(entry);
   char *tok;
 
-  int min,max;
+  int min, max;
   e_xbt_cfgelm_type_t type;
-  DEBUG1("Register string '%s'",entry);
+  DEBUG1("Register string '%s'", entry);
 
-  tok=strchr(entrycpy, ':');
-  xbt_assert2(tok,"Invalid config element descriptor: %s%s",
-              entry,
-              "; Should be <name>:<min nb>_to_<max nb>_<type>");
-  *(tok++)='\0';
+  tok = strchr(entrycpy, ':');
+  xbt_assert2(tok, "Invalid config element descriptor: %s%s",
+              entry, "; Should be <name>:<min nb>_to_<max nb>_<type>");
+  *(tok++) = '\0';
 
-  min=strtol(tok, &tok, 10);
-  xbt_assert1(tok,"Invalid minimum in config element descriptor %s",entry);
+  min = strtol(tok, &tok, 10);
+  xbt_assert1(tok, "Invalid minimum in config element descriptor %s", entry);
 
-  xbt_assert2(strcmp(tok,"_to_"),
+  xbt_assert2(strcmp(tok, "_to_"),
               "Invalid config element descriptor : %s%s",
-              entry,
-              "; Should be <name>:<min nb>_to_<max nb>_<type>");
+              entry, "; Should be <name>:<min nb>_to_<max nb>_<type>");
   tok += strlen("_to_");
 
-  max=strtol(tok, &tok, 10);
-  xbt_assert1(tok,"Invalid maximum in config element descriptor %s",entry);
+  max = strtol(tok, &tok, 10);
+  xbt_assert1(tok, "Invalid maximum in config element descriptor %s", entry);
 
-  xbt_assert2( *(tok++) =='_',
-               "Invalid config element descriptor: %s%s",entry,
-               "; Should be <name>:<min nb>_to_<max nb>_<type>");
+  xbt_assert2(*(tok++) == '_',
+              "Invalid config element descriptor: %s%s", entry,
+              "; Should be <name>:<min nb>_to_<max nb>_<type>");
 
-  for (type=0;
-  type<xbt_cfgelm_type_count && strcmp(tok,xbt_cfgelm_type_name[type]);
-  type++);
+  for (type = 0;
+       type < xbt_cfgelm_type_count
+       && strcmp(tok, xbt_cfgelm_type_name[type]); type++);
   xbt_assert2(type < xbt_cfgelm_type_count,
-              "Invalid type in config element descriptor: %s%s",entry,
+              "Invalid type in config element descriptor: %s%s", entry,
               "; Should be one of 'string', 'int', 'peer' or 'double'.");
 
-  xbt_cfg_register(cfg,entrycpy,type,min,max,NULL,NULL);
+  xbt_cfg_register(cfg, entrycpy, type, min, max, NULL, NULL);
 
-  free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */
+  free(entrycpy);               /* strdup'ed by dict mechanism, but cannot be const */
 }
 
 /** @brief Check that each variable have the right amount of values */
 
-void
-xbt_cfg_check(xbt_cfg_t cfg) {
+void xbt_cfg_check(xbt_cfg_t cfg)
+{
   xbt_dict_cursor_t cursor;
   xbt_cfgelm_t variable;
   char *name;
   int size;
 
-  xbt_assert0(cfg,"NULL config set.");
-  DEBUG1("Check cfg set %p",cfg);
+  xbt_assert0(cfg, "NULL config set.");
+  DEBUG1("Check cfg set %p", cfg);
 
-  xbt_dict_foreach((xbt_dict_t)cfg,cursor,name,variable) {
+  xbt_dict_foreach((xbt_dict_t) cfg, cursor, name, variable) {
     size = xbt_dynar_length(variable->content);
     if (variable->min > size) {
       xbt_dict_cursor_free(&cursor);
-      THROW4(mismatch_error,0,
+      THROW4(mismatch_error, 0,
              "Config elem %s needs at least %d %s, but there is only %d values.",
-             name,
-             variable->min,
-             xbt_cfgelm_type_name[variable->type],
-             size);
+             name, variable->min, xbt_cfgelm_type_name[variable->type], size);
     }
 
     if (variable->max > 0 && variable->max < size) {
       xbt_dict_cursor_free(&cursor);
-      THROW4(mismatch_error,0,
+      THROW4(mismatch_error, 0,
              "Config elem %s accepts at most %d %s, but there is %d values.",
-             name,
-             variable->max,
-             xbt_cfgelm_type_name[variable->type],
-             size);
+             name, variable->max, xbt_cfgelm_type_name[variable->type], size);
     }
   }
 
   xbt_dict_cursor_free(&cursor);
 }
 
-static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t  cfg,
-                                   const char *name,
-                                   e_xbt_cfgelm_type_t type){
-  xbt_cfgelm_t res=NULL;
+static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg,
+                                   const char *name, e_xbt_cfgelm_type_t type)
+{
+  xbt_cfgelm_t res = NULL;
 
-  res = xbt_dict_get_or_null((xbt_dict_t)cfg,name);
+  res = xbt_dict_get_or_null((xbt_dict_t) cfg, name);
   if (!res)
-    THROW1(not_found_error,0,
-           "No registered variable '%s' in this config set",name);
+    THROW1(not_found_error, 0,
+           "No registered variable '%s' in this config set", name);
 
   xbt_assert3(type == xbt_cfgelm_any || res->type == type,
               "You tried to access to the config element %s as an %s, but its type is %s.",
               name,
-              xbt_cfgelm_type_name[type],
-              xbt_cfgelm_type_name[res->type]);
+              xbt_cfgelm_type_name[type], xbt_cfgelm_type_name[res->type]);
 
   return res;
 }
@@ -375,17 +372,18 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t  cfg,
  *
  */
 
-e_xbt_cfgelm_type_t
-xbt_cfg_get_type(xbt_cfg_t cfg, const char *name) {
+e_xbt_cfgelm_type_t xbt_cfg_get_type(xbt_cfg_t cfg, const char *name)
+{
 
   xbt_cfgelm_t variable = NULL;
 
-  variable = xbt_dict_get_or_null((xbt_dict_t)cfg,name);
+  variable = xbt_dict_get_or_null((xbt_dict_t) cfg, name);
   if (!variable)
-    THROW1(not_found_error,0,
-           "Can't get the type of '%s' since this variable does not exist",name);
+    THROW1(not_found_error, 0,
+           "Can't get the type of '%s' since this variable does not exist",
+           name);
 
-  INFO1("type in variable = %d",variable->type);
+  INFO1("type in variable = %d", variable->type);
 
   return variable->type;
 }
@@ -399,49 +397,51 @@ xbt_cfg_get_type(xbt_cfg_t cfg, const char *name) {
  *
  * Add some values to the config set.
  */
-void
-xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) {
+void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa)
+{
   char *str;
   int i;
   double d;
-  e_xbt_cfgelm_type_t type=0; /* Set a dummy value to make gcc happy. It cannot get uninitialized */
+  e_xbt_cfgelm_type_t type = 0; /* Set a dummy value to make gcc happy. It cannot get uninitialized */
 
   xbt_ex_t e;
 
   TRY {
-    type = xbt_cfg_get_type(cfg,name);
+    type = xbt_cfg_get_type(cfg, name);
   } CATCH(e) {
     if (e.category == not_found_error) {
       xbt_ex_free(e);
-      THROW1(not_found_error,0,"Can't set the property '%s' since it's not registered",name);
+      THROW1(not_found_error, 0,
+             "Can't set the property '%s' since it's not registered", name);
     }
     RETHROW;
   }
 
   switch (type) {
-    case xbt_cfgelm_peer:
-      str = va_arg(pa, char *);
-      i=va_arg(pa,int);
-      xbt_cfg_set_peer(cfg,name,str,i);
-      break;
-
-    case xbt_cfgelm_string:
-      str=va_arg(pa, char *);
-      xbt_cfg_set_string(cfg, name, str);
-      break;
-
-    case xbt_cfgelm_int:
-      i=va_arg(pa,int);
-      xbt_cfg_set_int(cfg,name,i);
-      break;
-
-    case xbt_cfgelm_double:
-      d=va_arg(pa,double);
-      xbt_cfg_set_double(cfg,name,d);
-      break;
-
-    default:
-      xbt_assert2(0,"Config element variable %s not valid (type=%d)",name,type);
+  case xbt_cfgelm_peer:
+    str = va_arg(pa, char *);
+    i = va_arg(pa, int);
+    xbt_cfg_set_peer(cfg, name, str, i);
+    break;
+
+  case xbt_cfgelm_string:
+    str = va_arg(pa, char *);
+    xbt_cfg_set_string(cfg, name, str);
+    break;
+
+  case xbt_cfgelm_int:
+    i = va_arg(pa, int);
+    xbt_cfg_set_int(cfg, name, i);
+    break;
+
+  case xbt_cfgelm_double:
+    d = va_arg(pa, double);
+    xbt_cfg_set_double(cfg, name, d);
+    break;
+
+  default:
+    xbt_assert2(0, "Config element variable %s not valid (type=%d)", name,
+                type);
   }
 }
 
@@ -452,11 +452,12 @@ xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) {
  * \arg varargs variable value
  *
  */
-void xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...) {
+void xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...)
+{
   va_list pa;
 
-  va_start(pa,name);
-  xbt_cfg_set_vargs(cfg,name,pa);
+  va_start(pa, name);
+  xbt_cfg_set_vargs(cfg, name, pa);
   va_end(pa);
 }
 
@@ -472,147 +473,152 @@ void xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...) {
  * @todo This is a crude manual parser, it should be a proper lexer.
  */
 
-void
-xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) {
+void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
+{
   xbt_ex_t e;
 
   int i;
   double d;
   char *str;
 
-  xbt_cfgelm_t variable=NULL;
+  xbt_cfgelm_t variable = NULL;
   char *optionlist_cpy;
-  char *option,  *name,*val;
+  char *option, *name, *val;
 
   int len;
 
   XBT_IN;
-  if (!options || !strlen(options)) { /* nothing to do */
+  if (!options || !strlen(options)) {   /* nothing to do */
     return;
   }
-  optionlist_cpy=xbt_strdup(options);
+  optionlist_cpy = xbt_strdup(options);
 
-  DEBUG1("List to parse and set:'%s'",options);
-  option=optionlist_cpy;
-  while (1) { /* breaks in the code */
+  DEBUG1("List to parse and set:'%s'", options);
+  option = optionlist_cpy;
+  while (1) {                   /* breaks in the code */
 
     if (!option)
       break;
-    name=option;
-    len=strlen(name);
+    name = option;
+    len = strlen(name);
     DEBUG3("Still to parse and set: '%s'. len=%d; option-name=%ld",
-           name,len,(long)(option-name));
+           name, len, (long) (option - name));
 
     /* Pass the value */
-    while (option-name<=(len-1) && *option != ' ' && *option != '\n' && *option != '\t') {
-      DEBUG1("Take %c.",*option);
+    while (option - name <= (len - 1) && *option != ' ' && *option != '\n'
+           && *option != '\t') {
+      DEBUG1("Take %c.", *option);
       option++;
     }
-    if (option-name == len) {
+    if (option - name == len) {
       DEBUG0("Boundary=EOL");
-      option=NULL; /* don't do next iteration */
+      option = NULL;            /* don't do next iteration */
 
     } else {
       DEBUG3("Boundary on '%c'. len=%d;option-name=%ld",
-             *option,len,(long)(option-name));
+             *option, len, (long) (option - name));
 
       /* Pass the following blank chars */
-      *(option++)='\0';
-      while (option-name<(len-1) &&
-          (*option == ' ' || *option == '\n' || *option == '\t')) {
-        /*      fprintf(stderr,"Ignore a blank char.\n");*/
+      *(option++) = '\0';
+      while (option - name < (len - 1) &&
+             (*option == ' ' || *option == '\n' || *option == '\t')) {
+        /*      fprintf(stderr,"Ignore a blank char.\n"); */
         option++;
       }
-      if (option-name == len-1)
-        option=NULL; /* don't do next iteration */
+      if (option - name == len - 1)
+        option = NULL;          /* don't do next iteration */
     }
-    DEBUG2("parse now:'%s'; parse later:'%s'",name,option);
+    DEBUG2("parse now:'%s'; parse later:'%s'", name, option);
 
     if (name[0] == ' ' || name[0] == '\n' || name[0] == '\t')
       continue;
     if (!strlen(name))
       break;
 
-    val=strchr(name,':');
+    val = strchr(name, ':');
     if (!val) {
       free(optionlist_cpy);
       xbt_assert1(FALSE,
                   "Option '%s' badly formated. Should be of the form 'name:value'",
                   name);
     }
-    *(val++)='\0';
+    *(val++) = '\0';
 
-    DEBUG2("name='%s';val='%s'",name,val);
+    DEBUG2("name='%s';val='%s'", name, val);
 
     TRY {
-      variable = xbt_dict_get((xbt_dict_t)cfg,name);
-    } CATCH(e) {
+      variable = xbt_dict_get((xbt_dict_t) cfg, name);
+    }
+    CATCH(e) {
       /* put it back on what won't get freed, ie within "options" and out of "optionlist_cpy" */
-      name = (char*) (optionlist_cpy-name + options);
+      name = (char *) (optionlist_cpy - name + options);
       free(optionlist_cpy);
       if (e.category == not_found_error) {
         xbt_ex_free(e);
-        THROW1(not_found_error,0,"No registrated variable corresponding to '%s'.",name);
+        THROW1(not_found_error, 0,
+               "No registrated variable corresponding to '%s'.", name);
       }
       RETHROW;
     }
 
     TRY {
       switch (variable->type) {
-        case xbt_cfgelm_string:
-          xbt_cfg_set_string(cfg, name, val); /* throws */
-          break;
-
-        case xbt_cfgelm_int:
-          i=strtol(val, &val, 0);
-          if (val==NULL) {
-            free(optionlist_cpy);
-            xbt_assert1(FALSE,
-                        "Value of option %s not valid. Should be an integer",
-                        name);
-          }
-
-          xbt_cfg_set_int(cfg,name,i); /* throws */
-          break;
-
-        case xbt_cfgelm_double:
-          d=strtod(val, &val);
-          if (val==NULL) {
-            free(optionlist_cpy);
-            xbt_assert1(FALSE,
-                        "Value of option %s not valid. Should be a double",
-                        name);
-          }
-
-          xbt_cfg_set_double(cfg,name,d); /* throws */
-          break;
-
-        case xbt_cfgelm_peer:
-          str=val;
-          val=strchr(val,':');
-          if (!val) {
-            free(optionlist_cpy);
-            xbt_assert1(FALSE,
-                        "Value of option %s not valid. Should be an peer (machine:port)",
-                        name);
-          }
-
-          *(val++)='\0';
-          i=strtol(val, &val, 0);
-          if (val==NULL) {
-            free(optionlist_cpy);
-            xbt_assert1(FALSE,
-                        "Value of option %s not valid. Should be an peer (machine:port)",
-                        name);
-          }
-
-          xbt_cfg_set_peer(cfg,name,str,i); /* throws */
-          break;
-
-        default:
-          THROW1(unknown_error,0,"Type of config element %s is not valid.",name);
+      case xbt_cfgelm_string:
+        xbt_cfg_set_string(cfg, name, val);     /* throws */
+        break;
+
+      case xbt_cfgelm_int:
+        i = strtol(val, &val, 0);
+        if (val == NULL) {
+          free(optionlist_cpy);
+          xbt_assert1(FALSE,
+                      "Value of option %s not valid. Should be an integer",
+                      name);
+        }
+
+        xbt_cfg_set_int(cfg, name, i);  /* throws */
+        break;
+
+      case xbt_cfgelm_double:
+        d = strtod(val, &val);
+        if (val == NULL) {
+          free(optionlist_cpy);
+          xbt_assert1(FALSE,
+                      "Value of option %s not valid. Should be a double",
+                      name);
+        }
+
+        xbt_cfg_set_double(cfg, name, d);       /* throws */
+        break;
+
+      case xbt_cfgelm_peer:
+        str = val;
+        val = strchr(val, ':');
+        if (!val) {
+          free(optionlist_cpy);
+          xbt_assert1(FALSE,
+                      "Value of option %s not valid. Should be an peer (machine:port)",
+                      name);
+        }
+
+        *(val++) = '\0';
+        i = strtol(val, &val, 0);
+        if (val == NULL) {
+          free(optionlist_cpy);
+          xbt_assert1(FALSE,
+                      "Value of option %s not valid. Should be an peer (machine:port)",
+                      name);
+        }
+
+        xbt_cfg_set_peer(cfg, name, str, i);    /* throws */
+        break;
+
+      default:
+        THROW1(unknown_error, 0, "Type of config element %s is not valid.",
+               name);
       }
-    } CATCH(e) {
+    }
+    CATCH(e) {
       free(optionlist_cpy);
       RETHROW;
     }
@@ -627,29 +633,31 @@ xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) {
  * \arg name the name of the variable
  * \arg val the value of the variable
  */
-void
-xbt_cfg_set_int(xbt_cfg_t cfg,const char*name, int val) {
+void xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val)
+{
   xbt_cfgelm_t variable;
 
-  VERB2("Configuration setting: %s=%d",name,val);
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
+  VERB2("Configuration setting: %s=%d", name, val);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
 
   if (variable->max == 1) {
     if (variable->cb_rm && xbt_dynar_length(variable->content))
-      (*variable->cb_rm)(name, 0);
+      (*variable->cb_rm) (name, 0);
 
-    xbt_dynar_set(variable->content,0,&val);
+    xbt_dynar_set(variable->content, 0, &val);
   } else {
-    if (variable->max && xbt_dynar_length(variable->content) == (unsigned long)variable->max)
-      THROW3(mismatch_error,0,
+    if (variable->max
+        && xbt_dynar_length(variable->content) ==
+        (unsigned long) variable->max)
+      THROW3(mismatch_error, 0,
              "Cannot add value %d to the config element %s since it's already full (size=%d)",
-             val,name,variable->max);
+             val, name, variable->max);
 
-    xbt_dynar_push(variable->content,&val);
+    xbt_dynar_push(variable->content, &val);
   }
 
   if (variable->cb_set)
-    (*variable->cb_set)(name, xbt_dynar_length(variable->content) -1);
+    (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1);
 }
 
 /** @brief Set or add a double value to \a name within \a cfg
@@ -659,29 +667,29 @@ xbt_cfg_set_int(xbt_cfg_t cfg,const char*name, int val) {
  * \arg val the doule to set
  */
 
-void
-xbt_cfg_set_double(xbt_cfg_t cfg,const char*name, double val) {
+void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val)
+{
   xbt_cfgelm_t variable;
 
-  VERB2("Configuration setting: %s=%f",name,val);
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
+  VERB2("Configuration setting: %s=%f", name, val);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
 
   if (variable->max == 1) {
     if (variable->cb_rm && xbt_dynar_length(variable->content))
-      (*variable->cb_rm)(name, 0);
+      (*variable->cb_rm) (name, 0);
 
-    xbt_dynar_set(variable->content,0,&val);
+    xbt_dynar_set(variable->content, 0, &val);
   } else {
     if (variable->max && xbt_dynar_length(variable->content) == variable->max)
-      THROW3(mismatch_error,0,
+      THROW3(mismatch_error, 0,
              "Cannot add value %f to the config element %s since it's already full (size=%d)",
-             val,name,variable->max);
+             val, name, variable->max);
 
-    xbt_dynar_push(variable->content,&val);
+    xbt_dynar_push(variable->content, &val);
   }
 
   if (variable->cb_set)
-    (*variable->cb_set)(name, xbt_dynar_length(variable->content) -1);
+    (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1);
 }
 
 /** @brief Set or add a string value to \a name within \a cfg
@@ -692,38 +700,39 @@ xbt_cfg_set_double(xbt_cfg_t cfg,const char*name, double val) {
  *
  */
 
-void
-xbt_cfg_set_string(xbt_cfg_t cfg,const char*name, const char*val) {
+void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val)
+{
   xbt_cfgelm_t variable;
   char *newval = xbt_strdup(val);
 
-  VERB2("Configuration setting: %s=%s",name,val);
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
+  VERB2("Configuration setting: %s=%s", name, val);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
   DEBUG5("Variable: %d to %d %s (=%d) @%p",
-         variable->min,variable->max,xbt_cfgelm_type_name[variable->type],variable->type,variable);
+         variable->min, variable->max, xbt_cfgelm_type_name[variable->type],
+         variable->type, variable);
 
   if (variable->max == 1) {
     if (xbt_dynar_length(variable->content)) {
       if (variable->cb_rm)
-        (*variable->cb_rm)(name, 0);
+        (*variable->cb_rm) (name, 0);
       else if (variable->type == xbt_cfgelm_string) {
-        char * sval=xbt_dynar_get_as(variable->content,0,char*);
+        char *sval = xbt_dynar_get_as(variable->content, 0, char *);
         free(sval);
       }
     }
 
-    xbt_dynar_set(variable->content,0,&newval);
+    xbt_dynar_set(variable->content, 0, &newval);
   } else {
     if (variable->max && xbt_dynar_length(variable->content) == variable->max)
-      THROW3(mismatch_error,0,
+      THROW3(mismatch_error, 0,
              "Cannot add value %s to the config element %s since it's already full (size=%d)",
-             name,val,variable->max);
+             name, val, variable->max);
 
-    xbt_dynar_push(variable->content,&newval);
+    xbt_dynar_push(variable->content, &newval);
   }
 
   if (variable->cb_set)
-    (*variable->cb_set)(name, xbt_dynar_length(variable->content) -1);
+    (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1);
 }
 
 /** @brief Set or add an peer value to \a name within \a cfg
@@ -737,31 +746,31 @@ xbt_cfg_set_string(xbt_cfg_t cfg,const char*name, const char*val) {
  */
 
 void
-xbt_cfg_set_peer(xbt_cfg_t cfg,const char*name,
-                 const char *peer,int port) {
+xbt_cfg_set_peer(xbt_cfg_t cfg, const char *name, const char *peer, int port)
+{
   xbt_cfgelm_t variable;
-  xbt_peer_t val=xbt_peer_new(peer,port);
+  xbt_peer_t val = xbt_peer_new(peer, port);
 
-  VERB3("Configuration setting: %s=%s:%d",name,peer,port);
+  VERB3("Configuration setting: %s=%s:%d", name, peer, port);
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_peer);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
 
   if (variable->max == 1) {
     if (variable->cb_rm && xbt_dynar_length(variable->content))
-      (*variable->cb_rm)(name, 0);
+      (*variable->cb_rm) (name, 0);
 
-    xbt_dynar_set(variable->content,0,&val);
+    xbt_dynar_set(variable->content, 0, &val);
   } else {
     if (variable->max && xbt_dynar_length(variable->content) == variable->max)
-      THROW4(mismatch_error,0,
+      THROW4(mismatch_error, 0,
              "Cannot add value %s:%d to the config element %s since it's already full (size=%d)",
-             peer,port,name,variable->max);
+             peer, port, name, variable->max);
 
-    xbt_dynar_push(variable->content,&val);
+    xbt_dynar_push(variable->content, &val);
   }
 
   if (variable->cb_set)
-    (*variable->cb_set)(name, xbt_dynar_length(variable->content) -1);
+    (*variable->cb_set) (name, xbt_dynar_length(variable->content) - 1);
 }
 
 /* ---- [ Removing ] ---- */
@@ -772,29 +781,32 @@ xbt_cfg_set_peer(xbt_cfg_t cfg,const char*name,
  * \arg name the name of the variable
  * \arg val the value to be removed
  */
-void xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
+void xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val)
+{
 
   xbt_cfgelm_t variable;
   unsigned int cpt;
   int seen;
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
 
   if (xbt_dynar_length(variable->content) == variable->min)
-    THROW3(mismatch_error,0,
+    THROW3(mismatch_error, 0,
            "Cannot remove value %d from the config element %s since it's already at its minimal size (=%d)",
-           val,name,variable->min);
+           val, name, variable->min);
 
-  xbt_dynar_foreach(variable->content,cpt,seen) {
+  xbt_dynar_foreach(variable->content, cpt, seen) {
     if (seen == val) {
-      if (variable->cb_rm) (*variable->cb_rm)(name, cpt);
-      xbt_dynar_cursor_rm(variable->content,&cpt);
+      if (variable->cb_rm)
+        (*variable->cb_rm) (name, cpt);
+      xbt_dynar_cursor_rm(variable->content, &cpt);
       return;
     }
   }
 
-  THROW2(not_found_error,0,
-         "Can't remove the value %d of config element %s: value not found.",val,name);
+  THROW2(not_found_error, 0,
+         "Can't remove the value %d of config element %s: value not found.",
+         val, name);
 }
 
 /** @brief Remove the provided \e val double value from a variable
@@ -804,29 +816,31 @@ void xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
  * \arg val the value to be removed
  */
 
-void xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
+void xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, double val)
+{
   xbt_cfgelm_t variable;
   unsigned int cpt;
   double seen;
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
 
   if (xbt_dynar_length(variable->content) == variable->min)
-    THROW3(mismatch_error,0,
+    THROW3(mismatch_error, 0,
            "Cannot remove value %f from the config element %s since it's already at its minimal size (=%d)",
-           val,name,variable->min);
+           val, name, variable->min);
 
-  xbt_dynar_foreach(variable->content,cpt,seen) {
+  xbt_dynar_foreach(variable->content, cpt, seen) {
     if (seen == val) {
-      xbt_dynar_cursor_rm(variable->content,&cpt);
+      xbt_dynar_cursor_rm(variable->content, &cpt);
       if (variable->cb_rm)
-        (*variable->cb_rm)(name, cpt);
+        (*variable->cb_rm) (name, cpt);
       return;
     }
   }
 
-  THROW2(not_found_error,0,
-         "Can't remove the value %f of config element %s: value not found.",val,name);
+  THROW2(not_found_error, 0,
+         "Can't remove the value %f of config element %s: value not found.",
+         val, name);
 }
 
 /** @brief Remove the provided \e val string value from a variable
@@ -835,30 +849,31 @@ void xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
  * \arg name the name of the variable
  * \arg val the value of the string which will be removed
  */
-void
-xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
+void xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, const char *val)
+{
   xbt_cfgelm_t variable;
   unsigned int cpt;
   char *seen;
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
 
   if (xbt_dynar_length(variable->content) == variable->min)
-    THROW3(mismatch_error,0,
+    THROW3(mismatch_error, 0,
            "Cannot remove value %s from the config element %s since it's already at its minimal size (=%d)",
-           name,val,variable->min);
+           name, val, variable->min);
 
-  xbt_dynar_foreach(variable->content,cpt,seen) {
-    if (!strcpy(seen,val)) {
+  xbt_dynar_foreach(variable->content, cpt, seen) {
+    if (!strcpy(seen, val)) {
       if (variable->cb_rm)
-        (*variable->cb_rm)(name, cpt);
-      xbt_dynar_cursor_rm(variable->content,&cpt);
+        (*variable->cb_rm) (name, cpt);
+      xbt_dynar_cursor_rm(variable->content, &cpt);
       return;
     }
   }
 
-  THROW2(not_found_error,0,
-         "Can't remove the value %s of config element %s: value not found.",val,name);
+  THROW2(not_found_error, 0,
+         "Can't remove the value %s of config element %s: value not found.",
+         val, name);
 }
 
 /** @brief Remove the provided \e val peer value from a variable
@@ -870,45 +885,49 @@ xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
  */
 
 void
-xbt_cfg_rm_peer(xbt_cfg_t cfg,const char*name, const char *peer,int port) {
+xbt_cfg_rm_peer(xbt_cfg_t cfg, const char *name, const char *peer, int port)
+{
   xbt_cfgelm_t variable;
   unsigned int cpt;
   xbt_peer_t seen;
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_peer);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
 
   if (xbt_dynar_length(variable->content) == variable->min)
-    THROW4(mismatch_error,0,
+    THROW4(mismatch_error, 0,
            "Cannot remove value %s:%d from the config element %s since it's already at its minimal size (=%d)",
-           peer,port,name,variable->min);
+           peer, port, name, variable->min);
 
-  xbt_dynar_foreach(variable->content,cpt,seen) {
-    if (!strcpy(seen->name,peer) && seen->port == port) {
-      if (variable->cb_rm) (*variable->cb_rm)(name, cpt);
-      xbt_dynar_cursor_rm(variable->content,&cpt);
+  xbt_dynar_foreach(variable->content, cpt, seen) {
+    if (!strcpy(seen->name, peer) && seen->port == port) {
+      if (variable->cb_rm)
+        (*variable->cb_rm) (name, cpt);
+      xbt_dynar_cursor_rm(variable->content, &cpt);
       return;
     }
   }
 
-  THROW3(not_found_error,0,
+  THROW3(not_found_error, 0,
          "Can't remove the value %s:%d of config element %s: value not found.",
-         peer,port,name);
+         peer, port, name);
 }
 
 /** @brief Remove the \e pos th value from the provided variable */
 
-void xbt_cfg_rm_at   (xbt_cfg_t cfg, const char *name, int pos) {
+void xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos)
+{
 
   xbt_cfgelm_t variable;
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_any);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_any);
 
   if (xbt_dynar_length(variable->content) == variable->min)
-    THROW3(mismatch_error,0,
+    THROW3(mismatch_error, 0,
            "Cannot remove %dth value from the config element %s since it's already at its minimal size (=%d)",
-           pos,name,variable->min);
+           pos, name, variable->min);
 
-  if (variable->cb_rm) (*variable->cb_rm)(name, pos);
+  if (variable->cb_rm)
+    (*variable->cb_rm) (name, pos);
   xbt_dynar_remove_at(variable->content, pos, NULL);
 }
 
@@ -918,28 +937,29 @@ void xbt_cfg_rm_at   (xbt_cfg_t cfg, const char *name, int pos) {
  * \arg name the name of the variable
  */
 
-void
-xbt_cfg_empty(xbt_cfg_t cfg,const char*name) {
-  xbt_cfgelm_t variable=NULL;
+void xbt_cfg_empty(xbt_cfg_t cfg, const char *name)
+{
+  xbt_cfgelm_t variable = NULL;
   xbt_ex_t e;
 
   TRY {
-    variable = xbt_dict_get((xbt_dict_t)cfg,name);
+    variable = xbt_dict_get((xbt_dict_t) cfg, name);
   } CATCH(e) {
     if (e.category != not_found_error)
       RETHROW;
 
     xbt_ex_free(e);
-    THROW1(not_found_error,0,
-           "Can't empty  '%s' since this config element does not exist", name);
+    THROW1(not_found_error, 0,
+           "Can't empty  '%s' since this config element does not exist",
+           name);
   }
 
   if (variable) {
     if (variable->cb_rm) {
       unsigned int cpt;
       void *ignored;
-      xbt_dynar_foreach(variable->content,cpt,ignored) {
-        (*variable->cb_rm)(name, cpt);
+      xbt_dynar_foreach(variable->content, cpt, ignored) {
+        (*variable->cb_rm) (name, cpt);
       }
     }
     xbt_dynar_reset(variable->content);
@@ -960,13 +980,14 @@ xbt_cfg_empty(xbt_cfg_t cfg,const char*name) {
  *
  * \warning the returned value is the actual content of the config set
  */
-int
-xbt_cfg_get_int (xbt_cfg_t  cfg, const char *name) {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
+int xbt_cfg_get_int(xbt_cfg_t cfg, const char *name)
+{
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
 
   if (xbt_dynar_length(variable->content) > 1) {
-    WARN2("You asked for the first value of the config element '%s', but there is %lu values",
-          name, xbt_dynar_length(variable->content));
+    WARN2
+      ("You asked for the first value of the config element '%s', but there is %lu values",
+       name, xbt_dynar_length(variable->content));
   }
 
   return xbt_dynar_get_as(variable->content, 0, int);
@@ -985,13 +1006,14 @@ xbt_cfg_get_int (xbt_cfg_t  cfg, const char *name) {
  * \warning the returned value is the actual content of the config set
  */
 
-double
-xbt_cfg_get_double(xbt_cfg_t  cfg, const char *name) {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
+double xbt_cfg_get_double(xbt_cfg_t cfg, const char *name)
+{
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
 
   if (xbt_dynar_length(variable->content) > 1) {
-    WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
-          name, xbt_dynar_length(variable->content));
+    WARN2
+      ("You asked for the first value of the config element '%s', but there is %lu values\n",
+       name, xbt_dynar_length(variable->content));
   }
 
   return xbt_dynar_get_as(variable->content, 0, double);
@@ -1010,12 +1032,14 @@ xbt_cfg_get_double(xbt_cfg_t  cfg, const char *name) {
  * \warning the returned value is the actual content of the config set
  */
 
-char* xbt_cfg_get_string(xbt_cfg_t  cfg, const char *name) {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
+char *xbt_cfg_get_string(xbt_cfg_t cfg, const char *name)
+{
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
 
   if (xbt_dynar_length(variable->content) > 1) {
-    WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
-          name, xbt_dynar_length(variable->content));
+    WARN2
+      ("You asked for the first value of the config element '%s', but there is %lu values\n",
+       name, xbt_dynar_length(variable->content));
   }
 
   return xbt_dynar_get_as(variable->content, 0, char *);
@@ -1035,21 +1059,22 @@ char* xbt_cfg_get_string(xbt_cfg_t  cfg, const char *name) {
  * \warning the returned value is the actual content of the config set
  */
 
-void xbt_cfg_get_peer  (xbt_cfg_t   cfg,  const char *name,
-                        char      **peer, int        *port) {
+void xbt_cfg_get_peer(xbt_cfg_t cfg, const char *name, char **peer, int *port)
+{
   xbt_cfgelm_t variable;
-  xbt_peer_t  val;
+  xbt_peer_t val;
 
-  variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_peer);
+  variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
 
   if (xbt_dynar_length(variable->content) > 1) {
-    WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
-          name, xbt_dynar_length(variable->content));
+    WARN2
+      ("You asked for the first value of the config element '%s', but there is %lu values\n",
+       name, xbt_dynar_length(variable->content));
   }
 
   val = xbt_dynar_get_as(variable->content, 0, xbt_peer_t);
-  *peer=val->name;
-  *port=val->port;
+  *peer = val->name;
+  *port = val->port;
 }
 
 /** @brief Retrieve the dynar of all the values stored in a variable
@@ -1062,17 +1087,18 @@ void xbt_cfg_get_peer  (xbt_cfg_t   cfg,  const char *name,
  *
  * \warning the returned value is the actual content of the config set
  */
-xbt_dynar_t xbt_cfg_get_dynar (xbt_cfg_t    cfg, const char *name) {
-  xbt_cfgelm_t variable=NULL;
-  xbt_ex_t     e;
+xbt_dynar_t xbt_cfg_get_dynar(xbt_cfg_t cfg, const char *name)
+{
+  xbt_cfgelm_t variable = NULL;
+  xbt_ex_t e;
 
   TRY {
-    variable = xbt_dict_get((xbt_dict_t)cfg,name);
+    variable = xbt_dict_get((xbt_dict_t) cfg, name);
   } CATCH(e) {
     if (e.category == not_found_error) {
       xbt_ex_free(e);
-      THROW1(not_found_error,0,
-             "No registered variable %s in this config set",name);
+      THROW1(not_found_error, 0,
+             "No registered variable %s in this config set", name);
     }
     RETHROW;
   }
@@ -1082,36 +1108,37 @@ xbt_dynar_t xbt_cfg_get_dynar (xbt_cfg_t    cfg, const char *name) {
 
 
 /** @brief Retrieve one of the integer value of a variable */
-int
-xbt_cfg_get_int_at(xbt_cfg_t cfg, const char *name, int pos) {
+int xbt_cfg_get_int_at(xbt_cfg_t cfg, const char *name, int pos)
+{
 
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
   return xbt_dynar_get_as(variable->content, pos, int);
 }
 
 /** @brief Retrieve one of the double value of a variable */
-double
-xbt_cfg_get_double_at(xbt_cfg_t cfg, const char *name, int pos) {
+double xbt_cfg_get_double_at(xbt_cfg_t cfg, const char *name, int pos)
+{
 
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_double);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
   return xbt_dynar_get_as(variable->content, pos, double);
 }
 
 
 /** @brief Retrieve one of the string value of a variable */
-char*
-xbt_cfg_get_string_at(xbt_cfg_t cfg, const char *name, int pos) {
+char *xbt_cfg_get_string_at(xbt_cfg_t cfg, const char *name, int pos)
+{
 
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_string);
-  return xbt_dynar_get_as(variable->content, pos, char*);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
+  return xbt_dynar_get_as(variable->content, pos, char *);
 }
 
 /** @brief Retrieve one of the peer value of a variable */
 void
 xbt_cfg_get_peer_at(xbt_cfg_t cfg, const char *name, int pos,
-                    char **peer, int *port) {
+                    char **peer, int *port)
+{
 
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg,name,xbt_cfgelm_int);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
   xbt_peer_t val = xbt_dynar_get_ptr(variable->content, pos);
 
   *port = val->port;
@@ -1123,39 +1150,46 @@ xbt_cfg_get_peer_at(xbt_cfg_t cfg, const char *name, int pos,
 #include "xbt.h"
 #include "xbt/ex.h"
 
-XBT_TEST_SUITE("config","Configuration support");
+XBT_TEST_SUITE("config", "Configuration support");
 
-static xbt_cfg_t make_set(){
-  xbt_cfg_t set=NULL;
+static xbt_cfg_t make_set()
+{
+  xbt_cfg_t set = NULL;
 
   set = xbt_cfg_new();
-  xbt_cfg_register_str(set,"speed:1_to_2_int");
-  xbt_cfg_register_str(set,"peername:1_to_1_string");
-  xbt_cfg_register_str(set,"user:1_to_10_string");
+  xbt_cfg_register_str(set, "speed:1_to_2_int");
+  xbt_cfg_register_str(set, "peername:1_to_1_string");
+  xbt_cfg_register_str(set, "user:1_to_10_string");
 
   return set;
-} /* end_of_make_set */
+}                               /* end_of_make_set */
 
-XBT_TEST_UNIT("memuse",test_config_memuse,"Alloc and free a config set") {
-  xbt_cfg_t set=make_set();
+XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")
+{
+  xbt_cfg_t set = make_set();
   xbt_test_add0("Alloc and free a config set");
-  xbt_cfg_set_parse(set, "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
+  xbt_cfg_set_parse(set,
+                    "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
   xbt_cfg_free(&set);
   xbt_cfg_free(&set);
 }
 
-XBT_TEST_UNIT("validation",test_config_validation,"Validation tests") {
-  xbt_cfg_t set = set=make_set();
+XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
+{
+  xbt_cfg_t set = set = make_set();
   xbt_ex_t e;
 
   xbt_test_add0("Having too few elements for speed");
-  xbt_cfg_set_parse(set, "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
+  xbt_cfg_set_parse(set,
+                    "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
   TRY {
     xbt_cfg_check(set);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     if (e.category != mismatch_error ||
-        strncmp(e.msg,"Config elem speed needs",strlen("Config elem speed needs")))
-      xbt_test_fail1("Got an exception. msg=%s",e.msg);
+        strncmp(e.msg, "Config elem speed needs",
+                strlen("Config elem speed needs")))
+      xbt_test_fail1("Got an exception. msg=%s", e.msg);
     xbt_ex_free(e);
   }
   xbt_cfg_free(&set);
@@ -1164,15 +1198,16 @@ XBT_TEST_UNIT("validation",test_config_validation,"Validation tests") {
 
 
   xbt_test_add0("Having too much values of 'speed'");
-  set=make_set();
-  xbt_cfg_set_parse(set,"peername:toto:42 user:alegrand");
+  set = make_set();
+  xbt_cfg_set_parse(set, "peername:toto:42 user:alegrand");
   TRY {
-    xbt_cfg_set_parse(set,"speed:42 speed:24 speed:34");
-  } CATCH(e) {
+    xbt_cfg_set_parse(set, "speed:42 speed:24 speed:34");
+  }
+  CATCH(e) {
     if (e.category != mismatch_error ||
-        strncmp(e.msg,"Cannot add value 34 to the config elem speed",
+        strncmp(e.msg, "Cannot add value 34 to the config elem speed",
                 strlen("Config elem speed needs")))
-      xbt_test_fail1("Got an exception. msg=%s",e.msg);
+      xbt_test_fail1("Got an exception. msg=%s", e.msg);
     xbt_ex_free(e);
   }
   xbt_cfg_check(set);
@@ -1181,18 +1216,19 @@ XBT_TEST_UNIT("validation",test_config_validation,"Validation tests") {
 
 }
 
-XBT_TEST_UNIT("use",test_config_use,"Data retrieving tests") {
+XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
+{
 
   xbt_test_add0("Get a single value");
   {
     /* get_single_value */
     int ival;
-    xbt_cfg_t myset=make_set();
+    xbt_cfg_t myset = make_set();
 
-    xbt_cfg_set_parse(myset,"peername:toto:42 speed:42");
-    ival = xbt_cfg_get_int(myset,"speed");
+    xbt_cfg_set_parse(myset, "peername:toto:42 speed:42");
+    ival = xbt_cfg_get_int(myset, "speed");
     if (ival != 42)
-      xbt_test_fail1("Speed value = %d, I expected 42",ival);
+      xbt_test_fail1("Speed value = %d, I expected 42", ival);
     xbt_cfg_free(&myset);
   }
 
@@ -1200,31 +1236,35 @@ XBT_TEST_UNIT("use",test_config_use,"Data retrieving tests") {
   {
     /* get_multiple_value */
     xbt_dynar_t dyn;
-    xbt_cfg_t myset=make_set();
+    xbt_cfg_t myset = make_set();
 
     xbt_cfg_set_parse(myset, "peername:veloce user:foo\nuser:bar\tuser:toto");
-    xbt_cfg_set_parse(myset,"speed:42");
+    xbt_cfg_set_parse(myset, "speed:42");
     xbt_cfg_check(myset);
-    dyn = xbt_cfg_get_dynar(myset,"user");
+    dyn = xbt_cfg_get_dynar(myset, "user");
 
     if (xbt_dynar_length(dyn) != 3)
-      xbt_test_fail1("Dynar length = %lu, I expected 3", xbt_dynar_length(dyn));
+      xbt_test_fail1("Dynar length = %lu, I expected 3",
+                     xbt_dynar_length(dyn));
 
-    if (strcmp(xbt_dynar_get_as(dyn,0,char*),"foo"))
-      xbt_test_fail1("Dynar[0] = %s, I expected foo",   xbt_dynar_get_as(dyn,0,char*));
+    if (strcmp(xbt_dynar_get_as(dyn, 0, char *), "foo"))
+        xbt_test_fail1("Dynar[0] = %s, I expected foo",
+                       xbt_dynar_get_as(dyn, 0, char *));
 
-    if (strcmp(xbt_dynar_get_as(dyn,1,char*),"bar"))
-      xbt_test_fail1("Dynar[1] = %s, I expected bar",   xbt_dynar_get_as(dyn,1,char*));
+    if (strcmp(xbt_dynar_get_as(dyn, 1, char *), "bar"))
+        xbt_test_fail1("Dynar[1] = %s, I expected bar",
+                       xbt_dynar_get_as(dyn, 1, char *));
 
-    if (strcmp(xbt_dynar_get_as(dyn,2,char*),"toto"))
-      xbt_test_fail1("Dynar[2] = %s, I expected toto",  xbt_dynar_get_as(dyn,2,char*));
+    if (strcmp(xbt_dynar_get_as(dyn, 2, char *), "toto"))
+        xbt_test_fail1("Dynar[2] = %s, I expected toto",
+                       xbt_dynar_get_as(dyn, 2, char *));
     xbt_cfg_free(&myset);
   }
 
   xbt_test_add0("Access to a non-existant entry");
   {
     /* non-existant_entry */
-    xbt_cfg_t myset=make_set();
+    xbt_cfg_t myset = make_set();
     xbt_ex_t e;
 
     TRY {
index c22342e..15d6afa 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "portable.h"
 
-#include "xbt/sysdep.h"    /* vasprintf */
+#include "xbt/sysdep.h"         /* vasprintf */
 #include "xbt/cunit.h"
 #include "xbt/dynar.h"
 
@@ -23,12 +23,12 @@ static int _xbt_test_test_failed = 0;
 static int _xbt_test_test_ignore = 0;
 static int _xbt_test_test_expect = 0;
 
-static int _xbt_test_nb_units    = 0;
+static int _xbt_test_nb_units = 0;
 static int _xbt_test_unit_failed = 0;
 static int _xbt_test_unit_ignore = 0;
 static int _xbt_test_unit_disabled = 0;
 
-static int _xbt_test_nb_suites    = 0;
+static int _xbt_test_nb_suites = 0;
 static int _xbt_test_suite_failed = 0;
 static int _xbt_test_suite_ignore = 0;
 static int _xbt_test_suite_disabled = 0;
@@ -39,87 +39,91 @@ xbt_test_unit_t _xbt_test_current_unit = NULL;
 
 /* test suite test log */
 typedef struct s_xbt_test_log {
-  char              *text;
-  const char        *file;
-  int                line;
+  char *text;
+  const char *file;
+  int line;
 } *xbt_test_log_t;
 
-static void xbt_test_log_dump(xbt_test_log_t log) {
+static void xbt_test_log_dump(xbt_test_log_t log)
+{
   if (log)
-    fprintf(stderr,"      log %p(%s:%d)=%s\n",log,log->file,log->line,log->text);
+    fprintf(stderr, "      log %p(%s:%d)=%s\n", log, log->file, log->line,
+            log->text);
   else
-    fprintf(stderr,"      log=NULL\n");
+    fprintf(stderr, "      log=NULL\n");
 }
 
 /* test suite test check */
 typedef struct s_xbt_test_test {
-  char        *title;
-  int          failed;
-  int          expected_failure;
-  int          ignored;
-  const char  *file;
-  int          line;
-  xbt_dynar_t  logs;
+  char *title;
+  int failed;
+  int expected_failure;
+  int ignored;
+  const char *file;
+  int line;
+  xbt_dynar_t logs;
 } *xbt_test_test_t;
 
-static void xbt_test_test_dump(xbt_test_test_t test){
+static void xbt_test_test_dump(xbt_test_test_t test)
+{
   if (test) {
     xbt_test_log_t log;
     unsigned int it_log;
-    fprintf(stderr,"    test %p(%s:%d)=%s (%s)\n",
-            test,test->file,test->line,test->title,
-            test->failed?"failed":"not failed");
-    xbt_dynar_foreach(test->logs,it_log,log)
-    xbt_test_log_dump(log);
-  }
-  else
-    fprintf(stderr,"    test=NULL\n");
+    fprintf(stderr, "    test %p(%s:%d)=%s (%s)\n",
+            test, test->file, test->line, test->title,
+            test->failed ? "failed" : "not failed");
+    xbt_dynar_foreach(test->logs, it_log, log)
+      xbt_test_log_dump(log);
+  } else
+    fprintf(stderr, "    test=NULL\n");
 }
 
 /* test suite test unit */
 struct s_xbt_test_unit {
-  int          enabled;
-  char        *name;
-  char        *title;
+  int enabled;
+  char *name;
+  char *title;
   ts_test_cb_t func;
-  const char  *file;
-  int          line;
-  xbt_dynar_t  tests; /* of xbt_test_test_t*/
+  const char *file;
+  int line;
+  xbt_dynar_t tests;            /* of xbt_test_test_t */
 
   int nb_tests;
-  int test_failed,test_ignore,test_expect;
+  int test_failed, test_ignore, test_expect;
 };
 
-static void xbt_test_unit_dump(xbt_test_unit_t unit) {
+static void xbt_test_unit_dump(xbt_test_unit_t unit)
+{
   if (unit) {
     xbt_test_test_t test;
     unsigned int it_test;
-    fprintf(stderr,"  UNIT %s: %s (%s)\n",
-            unit->name,unit->title,
-            (unit->enabled?"enabled":"disabled"));
+    fprintf(stderr, "  UNIT %s: %s (%s)\n",
+            unit->name, unit->title,
+            (unit->enabled ? "enabled" : "disabled"));
     if (unit->enabled)
-      xbt_dynar_foreach(unit->tests,it_test,test)
-      xbt_test_test_dump(test);
+      xbt_dynar_foreach(unit->tests, it_test, test)
+        xbt_test_test_dump(test);
   } else {
-    fprintf(stderr,"  unit=NULL\n");
+    fprintf(stderr, "  unit=NULL\n");
   }
 }
 
 /* test suite */
 struct s_xbt_test_suite {
-  int         enabled;
+  int enabled;
   const char *name;
-  char       *title;
-  xbt_dynar_t units; /* of xbt_test_unit_t */
+  char *title;
+  xbt_dynar_t units;            /* of xbt_test_unit_t */
 
-  int nb_tests,nb_units;
-  int test_failed,test_ignore,test_expect;
-  int unit_failed,unit_ignore,unit_disabled;
+  int nb_tests, nb_units;
+  int test_failed, test_ignore, test_expect;
+  int unit_failed, unit_ignore, unit_disabled;
 };
 
 /* destroy test suite */
-static void xbt_test_suite_free(void *s) {
-  xbt_test_suite_t suite = *(xbt_test_suite_t*) s;
+static void xbt_test_suite_free(void *s)
+{
+  xbt_test_suite_t suite = *(xbt_test_suite_t *) s;
 
   if (suite == NULL)
     return;
@@ -128,48 +132,57 @@ static void xbt_test_suite_free(void *s) {
   free(suite);
 }
 
-static void xbt_test_unit_free(void *unit) {
-  xbt_test_unit_t u = *(xbt_test_unit_t*)unit;
+static void xbt_test_unit_free(void *unit)
+{
+  xbt_test_unit_t u = *(xbt_test_unit_t *) unit;
   /* name is static */
   free(u->title);
   xbt_dynar_free(&u->tests);
   free(u);
 }
-static void xbt_test_test_free(void *test) {
-  xbt_test_test_t t = *(xbt_test_test_t*)test;
+
+static void xbt_test_test_free(void *test)
+{
+  xbt_test_test_t t = *(xbt_test_test_t *) test;
   free(t->title);
   xbt_dynar_free(&(t->logs));
   free(t);
 }
-static void xbt_test_log_free(void *log) {
-  xbt_test_log_t l= *(xbt_test_log_t*) log;
+
+static void xbt_test_log_free(void *log)
+{
+  xbt_test_log_t l = *(xbt_test_log_t *) log;
   free(l->text);
   free(l);
 }
 
 /** @brief create test suite */
-xbt_test_suite_t xbt_test_suite_new(const char *name, const char *fmt, ...) {
-  xbt_test_suite_t suite = xbt_new0(struct s_xbt_test_suite,1);
+xbt_test_suite_t xbt_test_suite_new(const char *name, const char *fmt, ...)
+{
+  xbt_test_suite_t suite = xbt_new0(struct s_xbt_test_suite, 1);
   va_list ap;
   int vres;
 
   if (!_xbt_test_suites)
-    _xbt_test_suites = xbt_dynar_new(sizeof(xbt_test_suite_t),xbt_test_suite_free);
+    _xbt_test_suites =
+      xbt_dynar_new(sizeof(xbt_test_suite_t), xbt_test_suite_free);
 
   va_start(ap, fmt);
-  vres = vasprintf(&suite->title,fmt, ap);
+  vres = vasprintf(&suite->title, fmt, ap);
   suite->units = xbt_dynar_new(sizeof(xbt_test_unit_t), &xbt_test_unit_free);
   va_end(ap);
   suite->name = name;
   suite->enabled = 1;
 
-  xbt_dynar_push(_xbt_test_suites,&suite);
+  xbt_dynar_push(_xbt_test_suites, &suite);
 
   return suite;
 }
 
 /** @brief retrieve a testsuite from name, or create a new one */
-xbt_test_suite_t xbt_test_suite_by_name(const char *name,const char *fmt, ...) {
+xbt_test_suite_t xbt_test_suite_by_name(const char *name, const char *fmt,
+                                        ...)
+{
   xbt_test_suite_t suite;
   unsigned int it_suite;
 
@@ -179,35 +192,38 @@ xbt_test_suite_t xbt_test_suite_by_name(const char *name,const char *fmt, ...) {
 
   if (_xbt_test_suites)
     xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
-    if (!strcmp(suite->name,name))
+      if (!strcmp(suite->name, name))
       return suite;
 
   va_start(ap, fmt);
-  vres = vasprintf(&bufname,fmt, ap);
+  vres = vasprintf(&bufname, fmt, ap);
   va_end(ap);
-  suite = xbt_test_suite_new(name,bufname,NULL);
+  suite = xbt_test_suite_new(name, bufname, NULL);
   free(bufname);
 
   return suite;
 }
 
-void xbt_test_suite_dump(xbt_test_suite_t suite) {
+void xbt_test_suite_dump(xbt_test_suite_t suite)
+{
   if (suite) {
     xbt_test_unit_t unit;
     unsigned int it_unit;
-    fprintf(stderr,"TESTSUITE %s: %s (%s)\n",
+    fprintf(stderr, "TESTSUITE %s: %s (%s)\n",
             suite->name, suite->title,
-            suite->enabled?"enabled":"disabled");
+            suite->enabled ? "enabled" : "disabled");
     if (suite->enabled)
-      xbt_dynar_foreach(suite->units,it_unit,unit)
-      xbt_test_unit_dump(unit);
+      xbt_dynar_foreach(suite->units, it_unit, unit)
+        xbt_test_unit_dump(unit);
   } else {
-    fprintf(stderr,"TESTSUITE IS NULL!\n");
+    fprintf(stderr, "TESTSUITE IS NULL!\n");
   }
 }
 
 /* add test case to test suite */
-void xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t func, const char *fmt, ...) {
+void xbt_test_suite_push(xbt_test_suite_t suite, const char *name,
+                         ts_test_cb_t func, const char *fmt, ...)
+{
   xbt_test_unit_t unit;
   va_list ap;
   int vres;
@@ -216,11 +232,11 @@ void xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t
   xbt_assert(func);
   xbt_assert(fmt);
 
-  unit = xbt_new0(struct s_xbt_test_unit,1);
+  unit = xbt_new0(struct s_xbt_test_unit, 1);
   va_start(ap, fmt);
   vres = vasprintf(&unit->title, fmt, ap);
   va_end(ap);
-  unit->name = (char*)name;
+  unit->name = (char *) name;
   unit->func = func;
   unit->file = NULL;
   unit->line = 0;
@@ -232,7 +248,8 @@ void xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t
 }
 
 /* run test one suite */
-static int xbt_test_suite_run(xbt_test_suite_t suite) {
+static int xbt_test_suite_run(xbt_test_suite_t suite)
+{
   xbt_test_unit_t unit;
   xbt_test_test_t test;
   xbt_test_log_t log;
@@ -240,9 +257,9 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
   const char *file;
   int line;
   char *cp;
-  unsigned int it_unit,it_test,it_log;
+  unsigned int it_unit, it_test, it_log;
 
-  int first=1; /* for result pretty printing */
+  int first = 1;                /* for result pretty printing */
   int vres;
 
   if (suite == NULL)
@@ -251,23 +268,24 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
   /* suite title pretty-printing */
   {
     char suite_title[80];
-    int suite_len=strlen(suite->title);
+    int suite_len = strlen(suite->title);
     int i;
 
-    xbt_assert2(suite_len<68,"suite title \"%s\" too long (%d should be less than 68",
-                suite->title,suite_len);
+    xbt_assert2(suite_len < 68,
+                "suite title \"%s\" too long (%d should be less than 68",
+                suite->title, suite_len);
 
-    suite_title[0]=' ';
-    for (i=1;i<79;i++)
-      suite_title[i]='=';
-    suite_title[i++]='\n';
-    suite_title[79]='\0';
+    suite_title[0] = ' ';
+    for (i = 1; i < 79; i++)
+      suite_title[i] = '=';
+    suite_title[i++] = '\n';
+    suite_title[79] = '\0';
 
-    sprintf(suite_title + 40 - (suite_len+4)/2, "[ %s ]", suite->title);
-    suite_title[40 + (suite_len+5)/2] = '=';
+    sprintf(suite_title + 40 - (suite_len + 4) / 2, "[ %s ]", suite->title);
+    suite_title[40 + (suite_len + 5) / 2] = '=';
     if (!suite->enabled)
-      sprintf(suite_title+ 70," DISABLED ");
-    fprintf(stderr, "\n%s\n",suite_title);
+      sprintf(suite_title + 70, " DISABLED ");
+    fprintf(stderr, "\n%s\n", suite_title);
   }
 
   if (suite->enabled) {
@@ -280,8 +298,8 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
       unit->test_expect = 0;
 
       /* display unit title */
-      vres=asprintf(&cp," Unit: %s ......................................"
-               "......................................", unit->title);
+      vres = asprintf(&cp, " Unit: %s ......................................"
+                      "......................................", unit->title);
       cp[70] = '\0';
       fprintf(stderr, "%s", cp);
       free(cp);
@@ -292,14 +310,16 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
         unit->func();
 
       /* iterate through all performed tests to determine status */
-      xbt_dynar_foreach(unit->tests,it_test, test) {
+      xbt_dynar_foreach(unit->tests, it_test, test) {
         if (test->ignored) {
           unit->test_ignore++;
         } else {
           unit->nb_tests++;
 
-          if ( test->failed && !test->expected_failure) unit->test_failed++;
-          if (!test->failed &&  test->expected_failure) unit->test_failed++;
+          if (test->failed && !test->expected_failure)
+            unit->test_failed++;
+          if (!test->failed && test->expected_failure)
+            unit->test_failed++;
           if (test->expected_failure)
             unit->test_expect++;
         }
@@ -312,53 +332,58 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
         if (unit->test_failed > 0) {
           fprintf(stderr, ".. failed\n");
         } else if (unit->nb_tests) {
-          fprintf(stderr, "...... ok\n"); /* successful, but show about expected */
+          fprintf(stderr, "...... ok\n");       /* successful, but show about expected */
         } else {
-          fprintf(stderr, ".... skip\n"); /* shouldn't happen, but I'm a bit lost with this logic */
+          fprintf(stderr, ".... skip\n");       /* shouldn't happen, but I'm a bit lost with this logic */
         }
-        xbt_dynar_foreach(unit->tests,it_test, test) {
+        xbt_dynar_foreach(unit->tests, it_test, test) {
           file = (test->file != NULL ? test->file : unit->file);
-          line = (test->line != 0    ? test->line : unit->line);
+          line = (test->line != 0 ? test->line : unit->line);
           fprintf(stderr, "      %s: %s [%s:%d]\n",
-                  (test->ignored?" SKIP":(test->expected_failure?(test->failed?"EFAIL":"EPASS"):
-                    (test->failed?" FAIL":" PASS"))),
-                    test->title, file, line);
-
-          if  ( (test->expected_failure && !test->failed) || (!test->expected_failure && test->failed) ) {
-            xbt_dynar_foreach(test->logs,it_log,log) {
+                  (test->ignored ? " SKIP"
+                   : (test->expected_failure
+                      ? (test->failed ? "EFAIL" : "EPASS") : (test->failed ?
+                                                              " FAIL" :
+                                                              " PASS"))),
+                  test->title, file, line);
+
+          if ((test->expected_failure && !test->failed)
+              || (!test->expected_failure && test->failed)) {
+            xbt_dynar_foreach(test->logs, it_log, log) {
               file = (log->file != NULL ? log->file : file);
-              line = (log->line != 0    ? log->line : line);
+              line = (log->line != 0 ? log->line : line);
               fprintf(stderr, "             %s:%d: %s\n",
-                      file, line,log->text);
+                      file, line, log->text);
 
             }
           }
         }
-        fprintf(stderr, "    Summary: %d of %d tests failed",unit->test_failed, unit->nb_tests);
+        fprintf(stderr, "    Summary: %d of %d tests failed",
+                unit->test_failed, unit->nb_tests);
         if (unit->test_ignore) {
-          fprintf(stderr," (%d tests ignored)\n",unit->test_ignore);
+          fprintf(stderr, " (%d tests ignored)\n", unit->test_ignore);
         } else {
-          fprintf(stderr,"\n");
+          fprintf(stderr, "\n");
         }
 
       } else if (!unit->enabled) {
         fprintf(stderr, " disabled\n"); /* no test were run */
       } else if (unit->nb_tests) {
         fprintf(stderr, "...... ok\n"); /* successful */
-      } else  {
+      } else {
         fprintf(stderr, ".... skip\n"); /* no test were run */
       }
 
       /* Accumulate test counts into the suite */
-      suite->nb_tests      += unit->nb_tests;
-      suite->test_failed   += unit->test_failed;
-      suite->test_ignore   += unit->test_ignore;
-      suite->test_expect   += unit->test_expect;
+      suite->nb_tests += unit->nb_tests;
+      suite->test_failed += unit->test_failed;
+      suite->test_ignore += unit->test_ignore;
+      suite->test_expect += unit->test_expect;
 
-      _xbt_test_nb_tests      += unit->nb_tests;
-      _xbt_test_test_failed   += unit->test_failed;
-      _xbt_test_test_ignore   += unit->test_ignore;
-      _xbt_test_test_expect   += unit->test_expect;
+      _xbt_test_nb_tests += unit->nb_tests;
+      _xbt_test_test_failed += unit->test_failed;
+      _xbt_test_test_ignore += unit->test_ignore;
+      _xbt_test_test_expect += unit->test_expect;
 
       /* What's the conclusion of this test anyway? */
       if (unit->nb_tests) {
@@ -372,9 +397,9 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
       }
     }
   }
-  _xbt_test_nb_units      += suite->nb_units;
-  _xbt_test_unit_failed   += suite->unit_failed;
-  _xbt_test_unit_ignore   += suite->unit_ignore;
+  _xbt_test_nb_units += suite->nb_units;
+  _xbt_test_unit_failed += suite->unit_failed;
+  _xbt_test_unit_ignore += suite->unit_ignore;
   _xbt_test_unit_disabled += suite->unit_disabled;
 
   if (suite->nb_units) {
@@ -393,60 +418,72 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
 
     fprintf(stderr,
             " =====================================================================%s\n",
-            (suite->nb_units ? (suite->unit_failed   ? "== FAILED":"====== OK")
-                             : (suite->unit_disabled ? " DISABLED":"==== SKIP")));
+            (suite->nb_units
+             ? (suite->unit_failed ? "== FAILED" : "====== OK")
+             : (suite->unit_disabled ? " DISABLED" : "==== SKIP")));
     fprintf(stderr, " Summary: Units: %.0f%% ok (%d units: ",
-            suite->nb_units?((1-(double)suite->unit_failed/(double)suite->nb_units)*100.0):100.0,
-                           suite->nb_units);
+            suite->nb_units
+            ? ((1 -
+                (double) suite->unit_failed / (double) suite->nb_units) *
+               100.0) : 100.0, suite->nb_units);
 
     if (suite->nb_units != suite->unit_failed) {
-      fprintf(stderr, "%s%d ok",(first?"":", "),suite->nb_units - suite->unit_failed);
+      fprintf(stderr, "%s%d ok", (first ? "" : ", "),
+              suite->nb_units - suite->unit_failed);
       first = 0;
     }
     if (suite->unit_failed) {
-      fprintf(stderr, "%s%d failed",(first?"":", "),suite->unit_failed);
+      fprintf(stderr, "%s%d failed", (first ? "" : ", "), suite->unit_failed);
       first = 0;
     }
     if (suite->unit_ignore) {
-      fprintf(stderr, "%s%d ignored",(first?"":", "),suite->unit_ignore);
+      fprintf(stderr, "%s%d ignored", (first ? "" : ", "),
+              suite->unit_ignore);
       first = 0;
     }
     if (suite->unit_disabled) {
-      fprintf(stderr, "%s%d disabled",(first?"":", "),suite->unit_disabled);
+      fprintf(stderr, "%s%d disabled", (first ? "" : ", "),
+              suite->unit_disabled);
       first = 0;
     }
-    fprintf(stderr,")\n          Tests: %.0f%% ok (%d tests: ",
-            suite->nb_tests?((1-(double)suite->test_failed/(double)suite->nb_tests)*100.0):100.0,
-                           suite->nb_tests);
+    fprintf(stderr, ")\n          Tests: %.0f%% ok (%d tests: ",
+            suite->nb_tests
+            ? ((1 -
+                (double) suite->test_failed / (double) suite->nb_tests) *
+               100.0) : 100.0, suite->nb_tests);
 
-    first=1;
+    first = 1;
     if (suite->nb_tests != suite->test_failed) {
-      fprintf(stderr, "%s%d ok",(first?"":", "),suite->nb_tests - suite->test_failed);
+      fprintf(stderr, "%s%d ok", (first ? "" : ", "),
+              suite->nb_tests - suite->test_failed);
       first = 0;
     }
     if (suite->test_failed) {
-      fprintf(stderr, "%s%d failed",(first?"":", "),suite->test_failed);
+      fprintf(stderr, "%s%d failed", (first ? "" : ", "), suite->test_failed);
       first = 0;
     }
     if (suite->test_ignore) {
-      fprintf(stderr, "%s%d ignored",(first?"":"; "),suite->test_ignore);
+      fprintf(stderr, "%s%d ignored", (first ? "" : "; "),
+              suite->test_ignore);
       first = 0;
     }
     if (suite->test_expect) {
-      fprintf(stderr, "%s%d expected to fail",(first?"":"; "),suite->test_expect);
+      fprintf(stderr, "%s%d expected to fail", (first ? "" : "; "),
+              suite->test_expect);
       first = 0;
     }
-    fprintf(stderr,")\n");
+    fprintf(stderr, ")\n");
   }
   return suite->unit_failed;
 }
 
-static void apply_selection(char *selection) {
+static void apply_selection(char *selection)
+{
   /* for the parsing */
-  char *sel=selection;
+  char *sel = selection;
   char *p;
   int done = 0;
-  char dir[1024]; /* the directive */
+  char dir[1024];               /* the directive */
   /* iterators */
   unsigned int it_suite;
   xbt_test_suite_t suite;
@@ -459,91 +496,98 @@ static void apply_selection(char *selection) {
   if (!selection || selection[0] == '\0')
     return;
 
-  /*printf("Test selection: %s\n", selection);*/
+  /*printf("Test selection: %s\n", selection); */
 
   /* First apply the selection */
   while (!done) {
     int enabling = 1;
 
-    p=strchr(sel,',');
+    p = strchr(sel, ',');
     if (p) {
-      strncpy(dir,sel,p-sel);
-      dir[p-sel]='\0';
-      sel=p+1;
+      strncpy(dir, sel, p - sel);
+      dir[p - sel] = '\0';
+      sel = p + 1;
     } else {
       strcpy(dir, sel);
-      done=1;
+      done = 1;
     }
 
     if (dir[0] == '-') {
       enabling = 0;
-      memmove(dir,dir+1,strlen(dir));
+      memmove(dir, dir + 1, strlen(dir));
     }
     if (dir[0] == '+') {
       enabling = 1;
-      memmove(dir,dir+1,strlen(dir));
+      memmove(dir, dir + 1, strlen(dir));
     }
 
-    p =strchr(dir,':');
+    p = strchr(dir, ':');
     if (p) {
-      strcpy(unitname,p+1);
-      strncpy(suitename,dir,p-dir);
-      suitename[p-dir]='\0';
+      strcpy(unitname, p + 1);
+      strncpy(suitename, dir, p - dir);
+      suitename[p - dir] = '\0';
     } else {
-      strcpy(suitename,dir);
+      strcpy(suitename, dir);
       unitname[0] = '\0';
     }
     /*fprintf(stderr,"Seen %s (%s; suite=%s; unit=%s)\n",
-      dir,enabling?"enabling":"disabling", suitename, unitname);*/
+       dir,enabling?"enabling":"disabling", suitename, unitname); */
 
     /* Deal with the specific case of 'all' pseudo serie */
-    if (!strcmp("all",suitename)) {
-      if (unitname[0]!='\0') {
-        fprintf(stderr,"The 'all' pseudo-suite does not accept any unit specification\n");
+    if (!strcmp("all", suitename)) {
+      if (unitname[0] != '\0') {
+        fprintf(stderr,
+                "The 'all' pseudo-suite does not accept any unit specification\n");
         exit(1);
       }
 
-      xbt_dynar_foreach(_xbt_test_suites,it_suite,suite) {
-        xbt_dynar_foreach(suite->units,it_unit,unit) {
+      xbt_dynar_foreach(_xbt_test_suites, it_suite, suite) {
+        xbt_dynar_foreach(suite->units, it_unit, unit) {
           unit->enabled = enabling;
         }
         suite->enabled = enabling;
       }
     } else {
       unsigned int it;
-      for (it=0; it< xbt_dynar_length(_xbt_test_suites); it++) {
-        xbt_test_suite_t thissuite=xbt_dynar_get_as(_xbt_test_suites,it,xbt_test_suite_t);
-        if (!strcmp(suitename,thissuite->name)) {
+      for (it = 0; it < xbt_dynar_length(_xbt_test_suites); it++) {
+        xbt_test_suite_t thissuite =
+          xbt_dynar_get_as(_xbt_test_suites, it, xbt_test_suite_t);
+        if (!strcmp(suitename, thissuite->name)) {
           /* Do not disable the whole suite when we just want to disable a child */
-          if (enabling || (unitname[0]=='\0'))
+          if (enabling || (unitname[0] == '\0'))
             thissuite->enabled = enabling;
 
-          if (unitname[0]=='\0') {
-            xbt_dynar_foreach(thissuite->units,it_unit,unit){
+          if (unitname[0] == '\0') {
+            xbt_dynar_foreach(thissuite->units, it_unit, unit) {
               unit->enabled = enabling;
             }
-          } else { /* act on one child only */
+          } else {              /* act on one child only */
             unsigned int it2_unit;
             /* search it, first (we won't reuse it for external loop which gets broken) */
-            for (it2_unit=0; it2_unit< xbt_dynar_length(thissuite->units); it2_unit++) {
-              xbt_test_unit_t thisunit=xbt_dynar_get_as(thissuite->units,it2_unit,xbt_test_unit_t);
-              if (!strcmp(thisunit->name,unitname)) {
+            for (it2_unit = 0; it2_unit < xbt_dynar_length(thissuite->units);
+                 it2_unit++) {
+              xbt_test_unit_t thisunit =
+                xbt_dynar_get_as(thissuite->units, it2_unit, xbt_test_unit_t);
+              if (!strcmp(thisunit->name, unitname)) {
                 thisunit->enabled = enabling;
                 break;
               }
-            } /* search relevant unit */
-            if (it2_unit==xbt_dynar_length(thissuite->units)) {
-              fprintf(stderr,"Suite '%s' has no unit of name '%s'. Cannot apply the selection\n",
-                      suitename,unitname);
+            }                   /* search relevant unit */
+            if (it2_unit == xbt_dynar_length(thissuite->units)) {
+              fprintf(stderr,
+                      "Suite '%s' has no unit of name '%s'. Cannot apply the selection\n",
+                      suitename, unitname);
               exit(1);
             }
-          } /* act on childs (either all or one) */
+          }                     /* act on childs (either all or one) */
 
-          break;/* found the relevant serie. We are happy */
+          break;                /* found the relevant serie. We are happy */
         }
-      } /* search relevant series */
-      if (it==xbt_dynar_length(_xbt_test_suites)) {
-        fprintf(stderr,"No suite of name '%s' found. Cannot apply the selection\n",suitename);
+      }                         /* search relevant series */
+      if (it == xbt_dynar_length(_xbt_test_suites)) {
+        fprintf(stderr,
+                "No suite of name '%s' found. Cannot apply the selection\n",
+                suitename);
         exit(1);
       }
     }
@@ -551,101 +595,122 @@ static void apply_selection(char *selection) {
   }
 }
 
-void xbt_test_dump(char *selection) {
+void xbt_test_dump(char *selection)
+{
   apply_selection(selection);
 
   if (_xbt_test_suites) {
     unsigned int it_suite;
     xbt_test_suite_t suite;
 
-    xbt_dynar_foreach(_xbt_test_suites,it_suite,suite)
-    xbt_test_suite_dump(suite);
+    xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
+      xbt_test_suite_dump(suite);
   } else {
     printf(" No suite defined.");
   }
 }
 
-int xbt_test_run(char *selection) {
+int xbt_test_run(char *selection)
+{
   apply_selection(selection);
 
   if (_xbt_test_suites) {
     unsigned int it_suite;
     xbt_test_suite_t suite;
-    int first=1;
+    int first = 1;
 
     /* Run all the suites */
-    xbt_dynar_foreach(_xbt_test_suites,it_suite,suite)
-    xbt_test_suite_run(suite);
+    xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
+      xbt_test_suite_run(suite);
 
     /* Display some more statistics */
-    fprintf(stderr,"\n\n TOTAL: Suites: %.0f%% ok (%d suites: ",
+    fprintf(stderr, "\n\n TOTAL: Suites: %.0f%% ok (%d suites: ",
             _xbt_test_nb_suites
-            ? ((1-(double)_xbt_test_suite_failed/(double)_xbt_test_nb_suites)*100.0)
-            : 100.0,
-            _xbt_test_nb_suites);
+            ? ((1 -
+                (double) _xbt_test_suite_failed /
+                (double) _xbt_test_nb_suites) * 100.0)
+            : 100.0, _xbt_test_nb_suites);
     if (_xbt_test_nb_suites != _xbt_test_suite_failed) {
-      fprintf(stderr, "%d ok",_xbt_test_nb_suites - _xbt_test_suite_failed);
+      fprintf(stderr, "%d ok", _xbt_test_nb_suites - _xbt_test_suite_failed);
       first = 0;
     }
     if (_xbt_test_suite_failed) {
-      fprintf(stderr, "%s%d failed",(first?"":", "),_xbt_test_suite_failed);
+      fprintf(stderr, "%s%d failed", (first ? "" : ", "),
+              _xbt_test_suite_failed);
       first = 0;
     }
 
     if (_xbt_test_suite_ignore) {
-      fprintf(stderr, "%s%d ignored",(first?"":", "),_xbt_test_suite_ignore);
+      fprintf(stderr, "%s%d ignored", (first ? "" : ", "),
+              _xbt_test_suite_ignore);
       first = 0;
     }
-    fprintf(stderr,")\n        Units:  %.0f%% ok (%d units: ",
-            _xbt_test_nb_units?((1-(double)_xbt_test_unit_failed/(double)_xbt_test_nb_units)*100.0):100.0,
-                              _xbt_test_nb_units);
-    first=1;
+    fprintf(stderr, ")\n        Units:  %.0f%% ok (%d units: ",
+            _xbt_test_nb_units
+            ? ((1 -
+                (double) _xbt_test_unit_failed /
+                (double) _xbt_test_nb_units) * 100.0) : 100.0,
+            _xbt_test_nb_units);
+    first = 1;
     if (_xbt_test_nb_units != _xbt_test_unit_failed) {
-      fprintf(stderr, "%s%d ok",(first?"":", "),_xbt_test_nb_units - _xbt_test_unit_failed);
+      fprintf(stderr, "%s%d ok", (first ? "" : ", "),
+              _xbt_test_nb_units - _xbt_test_unit_failed);
       first = 0;
     }
     if (_xbt_test_unit_failed) {
-      fprintf(stderr, "%s%d failed",(first?"":", "),_xbt_test_unit_failed);
+      fprintf(stderr, "%s%d failed", (first ? "" : ", "),
+              _xbt_test_unit_failed);
       first = 0;
     }
     if (_xbt_test_unit_ignore) {
-      fprintf(stderr, "%s%d ignored",(first?"":", "),_xbt_test_unit_ignore);
+      fprintf(stderr, "%s%d ignored", (first ? "" : ", "),
+              _xbt_test_unit_ignore);
       first = 0;
     }
-    fprintf(stderr,")\n        Tests:  %.0f%% ok (%d tests: ",
-            _xbt_test_nb_tests?((1-(double)_xbt_test_test_failed/(double)_xbt_test_nb_tests)*100.0):100.0,
-                              _xbt_test_nb_tests);
-    first=1;
+    fprintf(stderr, ")\n        Tests:  %.0f%% ok (%d tests: ",
+            _xbt_test_nb_tests
+            ? ((1 -
+                (double) _xbt_test_test_failed /
+                (double) _xbt_test_nb_tests) * 100.0) : 100.0,
+            _xbt_test_nb_tests);
+    first = 1;
     if (_xbt_test_nb_tests != _xbt_test_test_failed) {
-      fprintf(stderr, "%s%d ok",(first?"":", "),_xbt_test_nb_tests - _xbt_test_test_failed);
+      fprintf(stderr, "%s%d ok", (first ? "" : ", "),
+              _xbt_test_nb_tests - _xbt_test_test_failed);
       first = 0;
     }
     if (_xbt_test_test_failed) {
-      fprintf(stderr, "%s%d failed",(first?"":", "),_xbt_test_test_failed);
+      fprintf(stderr, "%s%d failed", (first ? "" : ", "),
+              _xbt_test_test_failed);
       first = 0;
     }
     if (_xbt_test_test_ignore) {
-      fprintf(stderr, "%s%d ignored",(first?"":", "),_xbt_test_test_ignore);
+      fprintf(stderr, "%s%d ignored", (first ? "" : ", "),
+              _xbt_test_test_ignore);
       first = 0;
     }
     if (_xbt_test_test_expect) {
-      fprintf(stderr, "%s%d expected to fail",(first?"":", "),_xbt_test_test_expect);
+      fprintf(stderr, "%s%d expected to fail", (first ? "" : ", "),
+              _xbt_test_test_expect);
     }
 
-    fprintf(stderr,")\n");
+    fprintf(stderr, ")\n");
   } else {
-    fprintf(stderr,"No unit to run!\n");
+    fprintf(stderr, "No unit to run!\n");
     _xbt_test_unit_failed++;
   }
   return _xbt_test_unit_failed;
 }
-void xbt_test_exit(void) {
+
+void xbt_test_exit(void)
+{
   xbt_dynar_free(&_xbt_test_suites);
 }
 
 /* annotate test case with test */
-void _xbt_test_add(const char*file,int line, const char *fmt, ...) {
-  xbt_test_unit_t unit=_xbt_test_current_unit;
+void _xbt_test_add(const char *file, int line, const char *fmt, ...)
+{
+  xbt_test_unit_t unit = _xbt_test_current_unit;
   xbt_test_test_t test;
   va_list ap;
   int vres;
@@ -653,22 +718,23 @@ void _xbt_test_add(const char*file,int line, const char *fmt, ...) {
   xbt_assert(unit);
   xbt_assert(fmt);
 
-  test = xbt_new0(struct s_xbt_test_test,1);
+  test = xbt_new0(struct s_xbt_test_test, 1);
   va_start(ap, fmt);
-  vres=vasprintf(&test->title, fmt, ap);
+  vres = vasprintf(&test->title, fmt, ap);
   va_end(ap);
   test->failed = 0;
   test->expected_failure = 0;
   test->ignored = 0;
   test->file = file;
   test->line = line;
-  test->logs = xbt_dynar_new(sizeof(xbt_test_log_t),xbt_test_log_free);
-  xbt_dynar_push(unit->tests,&test);
+  test->logs = xbt_dynar_new(sizeof(xbt_test_log_t), xbt_test_log_free);
+  xbt_dynar_push(unit->tests, &test);
   return;
 }
 
 /* annotate test case with log message and failure */
-void _xbt_test_fail(const char*file,int line,const char *fmt, ...) {
+void _xbt_test_fail(const char *file, int line, const char *fmt, ...)
+{
   xbt_test_unit_t unit = _xbt_test_current_unit;
   xbt_test_test_t test;
   xbt_test_log_t log;
@@ -682,9 +748,9 @@ void _xbt_test_fail(const char*file,int line,const char *fmt, ...) {
               "Test failed even before being declared (broken unit: %s)",
               unit->title);
 
-  log = xbt_new(struct s_xbt_test_log,1);
+  log = xbt_new(struct s_xbt_test_log, 1);
   va_start(ap, fmt);
-  vres=vasprintf(&log->text,fmt, ap);
+  vres = vasprintf(&log->text, fmt, ap);
   va_end(ap);
   log->file = file;
   log->line = line;
@@ -695,33 +761,38 @@ void _xbt_test_fail(const char*file,int line,const char *fmt, ...) {
   test->failed = 1;
 }
 
-void xbt_test_exception(xbt_ex_t e) {
-  _xbt_test_fail(e.file,e.line,"Exception %s raised: %s",xbt_ex_catname(e.category),e.msg);
+void xbt_test_exception(xbt_ex_t e)
+{
+  _xbt_test_fail(e.file, e.line, "Exception %s raised: %s",
+                 xbt_ex_catname(e.category), e.msg);
 }
 
-void xbt_test_expect_failure(void) {
+void xbt_test_expect_failure(void)
+{
   xbt_test_test_t test;
   xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests),
               "Cannot expect the failure of a test before declaring it (broken unit: %s)",
               _xbt_test_current_unit->title);
-  test = xbt_dynar_getlast_as(_xbt_test_current_unit->tests,xbt_test_test_t);
+  test = xbt_dynar_getlast_as(_xbt_test_current_unit->tests, xbt_test_test_t);
   test->expected_failure = 1;
 }
-void xbt_test_skip(void) {
+
+void xbt_test_skip(void)
+{
   xbt_test_test_t test;
 
   xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests),
               "Test skiped even before being declared (broken unit: %s)",
               _xbt_test_current_unit->title);
 
-  test = xbt_dynar_getlast_as(_xbt_test_current_unit->tests,
-                              xbt_test_test_t);
+  test = xbt_dynar_getlast_as(_xbt_test_current_unit->tests, xbt_test_test_t);
   test->ignored = 1;
 }
 
 /* annotate test case with log message only */
-void _xbt_test_log(const char*file,int line,const char *fmt, ...) {
-  xbt_test_unit_t unit=_xbt_test_current_unit;
+void _xbt_test_log(const char *file, int line, const char *fmt, ...)
+{
+  xbt_test_unit_t unit = _xbt_test_current_unit;
   xbt_test_test_t test;
   xbt_test_log_t log;
   va_list ap;
@@ -731,16 +802,17 @@ void _xbt_test_log(const char*file,int line,const char *fmt, ...) {
   xbt_assert(fmt);
 
   xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests),
-              "Test logged into even before being declared (broken test unit: %s)",unit->title);
+              "Test logged into even before being declared (broken test unit: %s)",
+              unit->title);
 
-  log = xbt_new(struct s_xbt_test_log,1);
+  log = xbt_new(struct s_xbt_test_log, 1);
   va_start(ap, fmt);
-  vres=vasprintf(&log->text, fmt, ap);
+  vres = vasprintf(&log->text, fmt, ap);
   va_end(ap);
   log->file = file;
   log->line = line;
 
-  test = xbt_dynar_getlast_as(unit->tests,xbt_test_test_t);
+  test = xbt_dynar_getlast_as(unit->tests, xbt_test_test_t);
   xbt_dynar_push(test->logs, &log);
 }
 
@@ -749,15 +821,16 @@ void _xbt_test_log(const char*file,int line,const char *fmt, ...) {
 
 #ifdef SIMGRID_TEST
 
-XBT_TEST_SUITE("cunit","Testsuite mechanism autotest");
+XBT_TEST_SUITE("cunit", "Testsuite mechanism autotest");
 
-XBT_TEST_UNIT("expect",test_expected_failure,"expected failures") {
+XBT_TEST_UNIT("expect", test_expected_failure, "expected failures")
+{
   xbt_test_add0("Skipped test");
   xbt_test_skip();
 
-  xbt_test_add2("%s %s","EXPECTED","FAILURE");
+  xbt_test_add2("%s %s", "EXPECTED", "FAILURE");
   xbt_test_expect_failure();
-  xbt_test_log2("%s %s","Test","log");
+  xbt_test_log2("%s %s", "Test", "log");
   xbt_test_fail0("EXPECTED FAILURE");
 }
 
index 649091b..967e0ec 100644 (file)
 #include "xbt_modinter.h"
 #include "dict_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict,xbt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict, xbt,
                                 "Dictionaries provide the same functionalities than hash tables");
 /*####[ Private prototypes ]#################################################*/
 
 static xbt_mallocator_t dict_mallocator = NULL;
-static voiddict_mallocator_new_f(void);
-static void dict_mallocator_free_f(voiddict);
-static void dict_mallocator_reset_f(voiddict);
+static void *dict_mallocator_new_f(void);
+static void dict_mallocator_free_f(void *dict);
+static void dict_mallocator_reset_f(void *dict);
 
 
 /*####[ Code ]###############################################################*/
@@ -37,7 +37,8 @@ static void dict_mallocator_reset_f(void* dict);
  *
  * Creates and initialize a new dictionary with a default hashtable size.
  */
-xbt_dict_t xbt_dict_new(void) {
+xbt_dict_t xbt_dict_new(void)
+{
   xbt_dict_t dict;
 
   if (dict_mallocator == NULL) {
@@ -54,7 +55,7 @@ xbt_dict_t xbt_dict_new(void) {
 
   dict = xbt_mallocator_get(dict_mallocator);
   dict->table_size = 127;
-  dict->table = xbt_new0(xbt_dictelm_t, dict->table_size+1);
+  dict->table = xbt_new0(xbt_dictelm_t, dict->table_size + 1);
   dict->count = 0;
   dict->fill = 0;
 
@@ -67,7 +68,8 @@ xbt_dict_t xbt_dict_new(void) {
  *
  * Frees a dictionary with all the data
  */
-void xbt_dict_free(xbt_dict_t *dict) {
+void xbt_dict_free(xbt_dict_t * dict)
+{
   int i;
   xbt_dictelm_t current, previous;
   int table_size;
@@ -96,14 +98,16 @@ void xbt_dict_free(xbt_dict_t *dict) {
 /**
  * Returns the amount of elements in the dict
  */
-unsigned int xbt_dict_size(xbt_dict_t dict) {
+unsigned int xbt_dict_size(xbt_dict_t dict)
+{
   return dict->count;
 }
 
 /**
  * Returns the hash code of a string.
  */
-static XBT_INLINE unsigned int xbt_dict_hash_ext(const char *str, int str_len) {
+static XBT_INLINE unsigned int xbt_dict_hash_ext(const char *str, int str_len)
+{
 
 
 #ifdef DJB2_HASH_FUNCTION
@@ -113,19 +117,20 @@ static XBT_INLINE unsigned int xbt_dict_hash_ext(const char *str, int str_len) {
 
   while (str_len--) {
     c = *str++;
-    hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+    hash = ((hash << 5) + hash) + c;    /* hash * 33 + c */
   }
 # elif defined(FNV_HASH_FUNCTION)
   register unsigned int hash = 0x811c9dc5;
-  unsigned char *bp = (unsigned char *)str;   /* start of buffer */
-  unsigned char *be = bp + str_len;               /* beyond end of buffer */
+  unsigned char *bp = (unsigned char *) str;    /* start of buffer */
+  unsigned char *be = bp + str_len;     /* beyond end of buffer */
 
   while (bp < be) {
     /* multiply by the 32 bit FNV magic prime mod 2^32 */
-    hash += (hash<<1) + (hash<<4) + (hash<<7) + (hash<<8) + (hash<<24);
+    hash +=
+      (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
 
     /* xor the bottom with the current octet */
-    hash ^= (unsigned int)*bp++;
+    hash ^= (unsigned int) *bp++;
   }
 
 # else
@@ -140,14 +145,15 @@ static XBT_INLINE unsigned int xbt_dict_hash_ext(const char *str, int str_len) {
   return hash;
 }
 
-static XBT_INLINE unsigned int xbt_dict_hash(const char *str) {
+static XBT_INLINE unsigned int xbt_dict_hash(const char *str)
+{
 #ifdef DJB2_HASH_FUNCTION
   /* fast implementation of djb2 algorithm */
   int c;
   register unsigned int hash = 5381;
 
-  while ( (c = *str++) ) {
-    hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+  while ((c = *str++)) {
+    hash = ((hash << 5) + hash) + c;    /* hash * 33 + c */
   }
 
 # elif defined(FNV_HASH_FUNCTION)
@@ -155,10 +161,11 @@ static XBT_INLINE unsigned int xbt_dict_hash(const char *str) {
 
   while (*str) {
     /* multiply by the 32 bit FNV magic prime mod 2^32 */
-    hash += (hash<<1) + (hash<<4) + (hash<<7) + (hash<<8) + (hash<<24);
+    hash +=
+      (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
 
     /* xor the bottom with the current byte */
-    hash ^= (unsigned int)*str++;
+    hash ^= (unsigned int) *str++;
   }
 
 # else
@@ -173,7 +180,8 @@ static XBT_INLINE unsigned int xbt_dict_hash(const char *str) {
 }
 
 /* Expend the size of the dict */
-static void xbt_dict_rehash(xbt_dict_t dict) {
+static void xbt_dict_rehash(xbt_dict_t dict)
+{
   const int oldsize = dict->table_size + 1;
   register int newsize = oldsize * 2;
   register int i;
@@ -182,24 +190,24 @@ static void xbt_dict_rehash(xbt_dict_t dict) {
   register xbt_dictelm_t bucklet;
   register xbt_dictelm_t *pprev;
 
-  currcell = (xbt_dictelm_t*) xbt_realloc((char*)dict->table, newsize * sizeof(xbt_dictelm_t));
-  memset(&currcell[oldsize], 0, oldsize * sizeof(xbt_dictelm_t)); /* zero second half */
+  currcell =
+    (xbt_dictelm_t *) xbt_realloc((char *) dict->table,
+                                  newsize * sizeof(xbt_dictelm_t));
+  memset(&currcell[oldsize], 0, oldsize * sizeof(xbt_dictelm_t));       /* zero second half */
   dict->table_size = --newsize;
   dict->table = currcell;
-  DEBUG2("REHASH (%d->%d)",oldsize,newsize);
+  DEBUG2("REHASH (%d->%d)", oldsize, newsize);
 
-  for (i=0; i<oldsize; i++,currcell++) {
-    if (!*currcell) /* empty cell */
+  for (i = 0; i < oldsize; i++, currcell++) {
+    if (!*currcell)             /* empty cell */
       continue;
-    twincell = currcell+oldsize;
-    for (pprev = currcell, bucklet = *currcell;
-    bucklet;
-    bucklet = *pprev) {
+    twincell = currcell + oldsize;
+    for (pprev = currcell, bucklet = *currcell; bucklet; bucklet = *pprev) {
       /* Since we use "& size" instead of "%size" and since the size was doubled,
-           each bucklet of this cell must either :
-            - stay  in  cell i (ie, currcell)
-            - go to the cell i+oldsize (ie, twincell) */
-      if ((bucklet->hash_code & newsize) != i) { /* Move to b */
+         each bucklet of this cell must either :
+         - stay  in  cell i (ie, currcell)
+         - go to the cell i+oldsize (ie, twincell) */
+      if ((bucklet->hash_code & newsize) != i) {        /* Move to b */
         *pprev = bucklet->next;
         bucklet->next = *twincell;
         if (!*twincell)
@@ -212,7 +220,7 @@ static void xbt_dict_rehash(xbt_dict_t dict) {
 
     }
 
-    if (!*currcell)  /* everything moved */
+    if (!*currcell)             /* everything moved */
       dict->fill--;
   }
 }
@@ -231,17 +239,20 @@ static void xbt_dict_rehash(xbt_dict_t dict) {
  */
 XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
                                  const char *key, int key_len,
-                                 void *data, void_f_pvoid_t free_ctn) {
+                                 void *data, void_f_pvoid_t free_ctn)
+{
 
-  unsigned int hash_code = xbt_dict_hash_ext(key,key_len);
+  unsigned int hash_code = xbt_dict_hash_ext(key, key_len);
 
   xbt_dictelm_t current, previous = NULL;
   xbt_assert(dict);
 
-  DEBUG5("ADD %.*s hash = %d, size = %d, & = %d",key_len,key,hash_code, dict->table_size, hash_code & dict->table_size);
+  DEBUG5("ADD %.*s hash = %d, size = %d, & = %d", key_len, key, hash_code,
+         dict->table_size, hash_code & dict->table_size);
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
-      (hash_code != current->hash_code || key_len != current->key_len || memcmp(key, current->key, key_len))) {
+         (hash_code != current->hash_code || key_len != current->key_len
+          || memcmp(key, current->key, key_len))) {
     previous = current;
     current = current->next;
   }
@@ -258,13 +269,11 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
     } else {
       previous->next = current;
     }
-  }
-  else {
+  } else {
 
     DEBUG6("Replace %.*s by %.*s under key %.*s",
-           key_len,(char*)current->content,
-           key_len,(char*)data,
-           key_len,(char*)key);
+           key_len, (char *) current->content,
+           key_len, (char *) data, key_len, (char *) key);
     /* there is already an element with the same key: overwrite it */
     if (current->content != NULL && current->free_f != NULL) {
       current->free_f(current->content);
@@ -286,10 +295,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict,
  * set the \a data in the structure under the \a key, which is a
  * null terminated string.
  */
-void xbt_dict_set(xbt_dict_t      dict,
-                  const char     *key,
-                  void           *data,
-                  void_f_pvoid_t  free_ctn) {
+void xbt_dict_set(xbt_dict_t dict,
+                  const char *key, void *data, void_f_pvoid_t free_ctn)
+{
 
   xbt_dict_set_ext(dict, key, strlen(key), data, free_ctn);
 }
@@ -304,18 +312,19 @@ void xbt_dict_set(xbt_dict_t      dict,
  *
  * Search the given \a key. Throws not_found_error when not found.
  */
-void *xbt_dict_get_ext(xbt_dict_t dict,
-                       const char *key, int key_len) {
+void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, int key_len)
+{
 
 
-  unsigned int hash_code = xbt_dict_hash_ext(key,key_len);
+  unsigned int hash_code = xbt_dict_hash_ext(key, key_len);
   xbt_dictelm_t current;
 
   xbt_assert(dict);
 
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
-      (hash_code != current->hash_code || key_len != current->key_len || memcmp(key, current->key, key_len))) {
+         (hash_code != current->hash_code || key_len != current->key_len
+          || memcmp(key, current->key, key_len))) {
     current = current->next;
   }
 
@@ -324,19 +333,21 @@ void *xbt_dict_get_ext(xbt_dict_t dict,
 
   return current->content;
 }
+
 /**
  * \brief like xbt_dict_get_ext(), but returning NULL when not found
  */
-void *xbt_dict_get_or_null_ext(xbt_dict_t dict,
-                               const char *key, int key_len) {
-  unsigned int hash_code = xbt_dict_hash_ext(key,key_len);
+void *xbt_dict_get_or_null_ext(xbt_dict_t dict, const char *key, int key_len)
+{
+  unsigned int hash_code = xbt_dict_hash_ext(key, key_len);
   xbt_dictelm_t current;
 
   xbt_assert(dict);
 
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
-      (hash_code != current->hash_code || key_len != current->key_len || memcmp(key, current->key, key_len))) {
+         (hash_code != current->hash_code || key_len != current->key_len
+          || memcmp(key, current->key, key_len))) {
     current = current->next;
   }
 
@@ -357,8 +368,8 @@ void *xbt_dict_get_or_null_ext(xbt_dict_t dict,
  * Check xbt_dict_get_or_null() for a version returning NULL without exception when
  * not found.
  */
-void *xbt_dict_get(xbt_dict_t dict,
-                   const char *key) {
+void *xbt_dict_get(xbt_dict_t dict, const char *key)
+{
 
   unsigned int hash_code = xbt_dict_hash(key);
   xbt_dictelm_t current;
@@ -366,7 +377,8 @@ void *xbt_dict_get(xbt_dict_t dict,
   xbt_assert(dict);
 
   current = dict->table[hash_code & dict->table_size];
-  while (current != NULL && (hash_code != current->hash_code || strcmp(key, current->key)))
+  while (current != NULL
+         && (hash_code != current->hash_code || strcmp(key, current->key)))
     current = current->next;
 
   if (current == NULL)
@@ -378,8 +390,8 @@ void *xbt_dict_get(xbt_dict_t dict,
 /**
  * \brief like xbt_dict_get(), but returning NULL when not found
  */
-void *xbt_dict_get_or_null(xbt_dict_t dict,
-                           const char *key) {
+void *xbt_dict_get_or_null(xbt_dict_t dict, const char *key)
+{
   unsigned int hash_code = xbt_dict_hash(key);
   xbt_dictelm_t current;
 
@@ -387,7 +399,7 @@ void *xbt_dict_get_or_null(xbt_dict_t dict,
 
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
-      hash_code != current->hash_code && strcmp(key, current->key))
+         hash_code != current->hash_code && strcmp(key, current->key))
     current = current->next;
 
   if (current == NULL)
@@ -406,12 +418,11 @@ void *xbt_dict_get_or_null(xbt_dict_t dict,
  *
  * Remove the entry associated with the given \a key (throws not_found)
  */
-void xbt_dict_remove_ext(xbt_dict_t  dict,
-                         const char  *key,
-                         int          key_len) {
+void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len)
+{
 
 
-  unsigned int hash_code = xbt_dict_hash_ext(key,key_len);
+  unsigned int hash_code = xbt_dict_hash_ext(key, key_len);
   xbt_dictelm_t current, previous = NULL;
 
   xbt_assert(dict);
@@ -419,8 +430,9 @@ void xbt_dict_remove_ext(xbt_dict_t  dict,
   //  fprintf(stderr,"RM %.*s hash = %d, size = %d, & = %d\n",key_len,key,hash_code, dict->table_size, hash_code & dict->table_size);
   current = dict->table[hash_code & dict->table_size];
   while (current != NULL &&
-      (hash_code != current->hash_code || key_len != current->key_len || strncmp(key, current->key, key_len))) {
-    previous = current; /* save the previous node */
+         (hash_code != current->hash_code || key_len != current->key_len
+          || strncmp(key, current->key, key_len))) {
+    previous = current;         /* save the previous node */
     current = current->next;
   }
 
@@ -448,7 +460,8 @@ void xbt_dict_remove_ext(xbt_dict_t  dict,
  *
  * Remove the entry associated with the given \a key
  */
-void xbt_dict_remove(xbt_dict_t dict, const char *key) {
+void xbt_dict_remove(xbt_dict_t dict, const char *key)
+{
   xbt_dict_remove_ext(dict, key, strlen(key));
 }
 
@@ -456,7 +469,8 @@ void xbt_dict_remove(xbt_dict_t dict, const char *key) {
  * \brief Remove all data from the dict
  * \param dict the dict
  */
-void xbt_dict_reset(xbt_dict_t dict) {
+void xbt_dict_reset(xbt_dict_t dict)
+{
 
   int i;
   xbt_dictelm_t current, previous = NULL;
@@ -484,15 +498,17 @@ void xbt_dict_reset(xbt_dict_t dict) {
  * \brief Return the number of elements in the dict.
  * \param dict a dictionary
  */
-int xbt_dict_length(xbt_dict_t dict) {
+int xbt_dict_length(xbt_dict_t dict)
+{
   xbt_assert(dict);
 
   return dict->count;
 }
 
 /** @brief function to be used in xbt_dict_dump as long as the stored values are strings */
-void xbt_dict_dump_output_string(void *s) {
-  fputs(s,stdout);
+void xbt_dict_dump_output_string(void *s)
+{
+  fputs(s, stdout);
 }
 
 
@@ -506,8 +522,8 @@ void xbt_dict_dump_output_string(void *s) {
  * function to output the data. If NULL, data won't be displayed.
  */
 
-void xbt_dict_dump(xbt_dict_t     dict,
-                   void_f_pvoid_t output) {
+void xbt_dict_dump(xbt_dict_t dict, void_f_pvoid_t output)
+{
   int i;
   xbt_dictelm_t element;
   printf("Dict %p:\n", dict);
@@ -519,7 +535,7 @@ void xbt_dict_dump(xbt_dict_t     dict,
         while (element != NULL) {
           printf(" %s -> '", element->key);
           if (output != NULL) {
-            (*output)(element->content);
+            (*output) (element->content);
           }
           printf("'\n");
           element = element->next;
@@ -534,56 +550,58 @@ void xbt_dict_dump(xbt_dict_t     dict,
 
 xbt_dynar_t all_sizes = NULL;
 /** @brief shows some debugging info about the bucklet repartition */
-void xbt_dict_dump_sizes(xbt_dict_t dict) {
+void xbt_dict_dump_sizes(xbt_dict_t dict)
+{
 
   int i;
   unsigned int count;
   unsigned int size;
   xbt_dictelm_t element;
-  xbt_dynar_t sizes = xbt_dynar_new(sizeof(int),NULL);
+  xbt_dynar_t sizes = xbt_dynar_new(sizeof(int), NULL);
 
-  printf("Dict %p: %d bucklets, %d used cells (of %d) ", dict, dict->count, dict->fill,dict->table_size);
+  printf("Dict %p: %d bucklets, %d used cells (of %d) ", dict, dict->count,
+         dict->fill, dict->table_size);
   if (dict != NULL) {
     for (i = 0; i < dict->table_size; i++) {
       element = dict->table[i];
       size = 0;
       if (element) {
         while (element != NULL) {
-          size ++;
+          size++;
           element = element->next;
         }
       }
       if (xbt_dynar_length(sizes) <= size) {
         int prevsize = 1;
-        xbt_dynar_set(sizes,size,&prevsize);
+        xbt_dynar_set(sizes, size, &prevsize);
       } else {
         int prevsize;
-        xbt_dynar_get_cpy(sizes,size,&prevsize);
+        xbt_dynar_get_cpy(sizes, size, &prevsize);
         prevsize++;
-        xbt_dynar_set(sizes,size,&prevsize);
+        xbt_dynar_set(sizes, size, &prevsize);
       }
     }
     if (!all_sizes)
       all_sizes = xbt_dynar_new(sizeof(int), NULL);
 
-    xbt_dynar_foreach(sizes,count,size) {
+    xbt_dynar_foreach(sizes, count, size) {
       /* Copy values of this one into all_sizes */
       int prevcount;
       if (xbt_dynar_length(all_sizes) <= count) {
         prevcount = size;
-        xbt_dynar_set(all_sizes,count,&prevcount);
+        xbt_dynar_set(all_sizes, count, &prevcount);
       } else {
-        xbt_dynar_get_cpy(all_sizes,count,&prevcount);
+        xbt_dynar_get_cpy(all_sizes, count, &prevcount);
         prevcount += size;
-        xbt_dynar_set(all_sizes,count,&prevcount);
+        xbt_dynar_set(all_sizes, count, &prevcount);
       }
 
       /* Report current sizes */
-      if (count==0)
+      if (count == 0)
         continue;
-      if (size==0)
+      if (size == 0)
         continue;
-      printf("%delm x %u cells; ",count,size);
+      printf("%delm x %u cells; ", count, size);
     }
   }
   printf("\n");
@@ -594,7 +612,8 @@ void xbt_dict_dump_sizes(xbt_dict_t dict) {
  * Destroy the dict mallocators.
  * This is an internal XBT function called by xbt_exit().
  */
-void xbt_dict_exit(void) {
+void xbt_dict_exit(void)
+{
   if (dict_mallocator != NULL) {
     xbt_mallocator_free(dict_mallocator);
     dict_mallocator = NULL;
@@ -607,28 +626,31 @@ void xbt_dict_exit(void) {
     double avg = 0;
     int total_count = 0;
     printf("Overall stats:");
-    xbt_dynar_foreach(all_sizes,count,size) {
-      if (count==0)
+    xbt_dynar_foreach(all_sizes, count, size) {
+      if (count == 0)
         continue;
-      if (size==0)
+      if (size == 0)
         continue;
-      printf("%delm x %d cells; ",count,size);
+      printf("%delm x %d cells; ", count, size);
       avg += count * size;
       total_count += size;
     }
-    printf("; %f elm per cell\n",avg/(double)total_count);
+    printf("; %f elm per cell\n", avg / (double) total_count);
   }
 }
 
-static void* dict_mallocator_new_f(void) {
+static void *dict_mallocator_new_f(void)
+{
   return xbt_new(s_xbt_dict_t, 1);
 }
 
-static void dict_mallocator_free_f(void* dict) {
+static void dict_mallocator_free_f(void *dict)
+{
   xbt_free(dict);
 }
 
-static void dict_mallocator_reset_f(void* dict) {
+static void dict_mallocator_reset_f(void *dict)
+{
   /* nothing to do because all fields are
    * initialized in xbt_dict_new
    */
@@ -642,103 +664,121 @@ static void dict_mallocator_reset_f(void* dict) {
 XBT_LOG_EXTERNAL_CATEGORY(xbt_dict);
 XBT_LOG_DEFAULT_CATEGORY(xbt_dict);
 
-XBT_TEST_SUITE("dict","Dict data container");
+XBT_TEST_SUITE("dict", "Dict data container");
 
-static void print_str(void *str) {
-  printf("%s",(char*)PRINTF_STR(str));
+static void print_str(void *str)
+{
+  printf("%s", (char *) PRINTF_STR(str));
 }
 
-static void debuged_add_ext(xbt_dict_t head,const char*key,const char*data_to_fill) {
-  char *data=xbt_strdup(data_to_fill);
+static void debuged_add_ext(xbt_dict_t head, const char *key,
+                            const char *data_to_fill)
+{
+  char *data = xbt_strdup(data_to_fill);
 
-  xbt_test_log2("Add %s under %s",PRINTF_STR(data_to_fill),PRINTF_STR(key));
+  xbt_test_log2("Add %s under %s", PRINTF_STR(data_to_fill), PRINTF_STR(key));
 
-  xbt_dict_set(head,key,data,&free);
-  if (XBT_LOG_ISENABLED(xbt_dict,xbt_log_priority_debug)) {
-    xbt_dict_dump(head,(void (*)(void*))&printf);
+  xbt_dict_set(head, key, data, &free);
+  if (XBT_LOG_ISENABLED(xbt_dict, xbt_log_priority_debug)) {
+    xbt_dict_dump(head, (void (*)(void *)) &printf);
     fflush(stdout);
   }
 }
-static void debuged_add(xbt_dict_t head,const char*key) {
-  debuged_add_ext(head,key,key);
+
+static void debuged_add(xbt_dict_t head, const char *key)
+{
+  debuged_add_ext(head, key, key);
 }
 
-static void fill(xbt_dict_t *head) {
+static void fill(xbt_dict_t * head)
+{
   xbt_test_add0("Fill in the dictionnary");
 
   *head = xbt_dict_new();
-  debuged_add(*head,"12");
-  debuged_add(*head,"12a");
-  debuged_add(*head,"12b");
-  debuged_add(*head,"123");
-  debuged_add(*head,"123456");
+  debuged_add(*head, "12");
+  debuged_add(*head, "12a");
+  debuged_add(*head, "12b");
+  debuged_add(*head, "123");
+  debuged_add(*head, "123456");
   /* Child becomes child of what to add */
-  debuged_add(*head,"1234");
+  debuged_add(*head, "1234");
   /* Need of common ancestor */
-  debuged_add(*head,"123457");
+  debuged_add(*head, "123457");
 }
 
 
-static void search_ext(xbt_dict_t head,const char*key, const char *data) {
+static void search_ext(xbt_dict_t head, const char *key, const char *data)
+{
   void *found;
 
-  xbt_test_add1("Search %s",key);
-  found=xbt_dict_get(head,key);
-  xbt_test_log1("Found %s",(char *)found);
+  xbt_test_add1("Search %s", key);
+  found = xbt_dict_get(head, key);
+  xbt_test_log1("Found %s", (char *) found);
   if (data)
-    xbt_test_assert1(found,"data do not match expectations: found NULL while searching for %s",data);
+    xbt_test_assert1(found,
+                     "data do not match expectations: found NULL while searching for %s",
+                     data);
   if (found)
-    xbt_test_assert2(!strcmp((char*)data,found),"data do not match expectations: found %s while searching for %s", (char*)found, data);
+    xbt_test_assert2(!strcmp((char *) data, found),
+                     "data do not match expectations: found %s while searching for %s",
+                     (char *) found, data);
 }
 
-static void search(xbt_dict_t head,const char*key) {
-  search_ext(head,key,key);
+static void search(xbt_dict_t head, const char *key)
+{
+  search_ext(head, key, key);
 }
 
-static void debuged_remove(xbt_dict_t head,const char*key) {
+static void debuged_remove(xbt_dict_t head, const char *key)
+{
 
-  xbt_test_add1("Remove '%s'",PRINTF_STR(key));
-  xbt_dict_remove(head,key);
+  xbt_test_add1("Remove '%s'", PRINTF_STR(key));
+  xbt_dict_remove(head, key);
   /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
 }
 
 
-static void traverse(xbt_dict_t head) {
-  xbt_dict_cursor_t cursor=NULL;
+static void traverse(xbt_dict_t head)
+{
+  xbt_dict_cursor_t cursor = NULL;
   char *key;
   char *data;
   int i = 0;
 
-  xbt_dict_foreach(head,cursor,key,data) {
-    if (!key || !data || strcmp(key,data)) {
-      xbt_test_log3("Seen #%d:  %s->%s",++i,PRINTF_STR(key),PRINTF_STR(data));
+  xbt_dict_foreach(head, cursor, key, data) {
+    if (!key || !data || strcmp(key, data)) {
+      xbt_test_log3("Seen #%d:  %s->%s", ++i, PRINTF_STR(key),
+                    PRINTF_STR(data));
     } else {
-      xbt_test_log2("Seen #%d:  %s",++i,PRINTF_STR(key));
+      xbt_test_log2("Seen #%d:  %s", ++i, PRINTF_STR(key));
     }
-    xbt_test_assert2(!data || !strcmp(key,data),
-                     "Key(%s) != value(%s). Aborting",key,data);
+    xbt_test_assert2(!data || !strcmp(key, data),
+                     "Key(%s) != value(%s). Aborting", key, data);
   }
 }
 
-static void search_not_found(xbt_dict_t head, const char *data) {
-  int ok=0;
+static void search_not_found(xbt_dict_t head, const char *data)
+{
+  int ok = 0;
   xbt_ex_t e;
 
-  xbt_test_add1("Search %s (expected not to be found)",data);
+  xbt_test_add1("Search %s (expected not to be found)", data);
 
   TRY {
     data = xbt_dict_get(head, data);
-    THROW1(unknown_error,0,"Found something which shouldn't be there (%s)",data);
+    THROW1(unknown_error, 0, "Found something which shouldn't be there (%s)",
+           data);
   } CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
     xbt_ex_free(e);
-    ok=1;
+    ok = 1;
   }
-  xbt_test_assert0(ok,"Exception not raised");
+  xbt_test_assert0(ok, "Exception not raised");
 }
 
-static void count(xbt_dict_t dict, int length) {
+static void count(xbt_dict_t dict, int length)
+{
   xbt_dict_cursor_t cursor;
   char *key;
   void *data;
@@ -746,20 +786,25 @@ static void count(xbt_dict_t dict, int length) {
 
 
   xbt_test_add1("Count elements (expecting %d)", length);
-  xbt_test_assert2(xbt_dict_length(dict) == length, "Announced length(%d) != %d.", xbt_dict_length(dict), length);
+  xbt_test_assert2(xbt_dict_length(dict) == length,
+                   "Announced length(%d) != %d.", xbt_dict_length(dict),
+                   length);
 
-  xbt_dict_foreach(dict,cursor,key,data) {
+  xbt_dict_foreach(dict, cursor, key, data) {
     effective++;
   }
-  xbt_test_assert2(effective == length, "Effective length(%d) != %d.", effective, length);
+  xbt_test_assert2(effective == length, "Effective length(%d) != %d.",
+                   effective, length);
 }
 
 xbt_ex_t e;
-xbt_dict_t head=NULL;
+xbt_dict_t head = NULL;
 char *data;
 
 
-XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse"){
+XBT_TEST_UNIT("basic", test_dict_basic,
+              "Basic usage: change, retrieve, traverse")
+{
   xbt_test_add0("Traversal the null dictionary");
   traverse(head);
 
@@ -767,7 +812,7 @@ XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse")
   head = xbt_dict_new();
   traverse(head);
   TRY {
-    debuged_remove(head,"12346");
+    debuged_remove(head, "12346");
   } CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
@@ -779,11 +824,11 @@ XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse")
   fill(&head);
   count(head, 7);
 
-  debuged_add_ext(head,"toto","tutu");
-  search_ext(head,"toto","tutu");
-  debuged_remove(head,"toto");
+  debuged_add_ext(head, "toto", "tutu");
+  search_ext(head, "toto", "tutu");
+  debuged_remove(head, "toto");
 
-  search(head,"12a");
+  search(head, "12a");
   traverse(head);
 
   xbt_test_add0("Free the dictionary (twice)");
@@ -794,19 +839,19 @@ XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse")
   fill(&head);
   count(head, 7);
   xbt_test_add0("Change 123 to 'Changed 123'");
-  xbt_dict_set(head,"123",strdup("Changed 123"),&free);
+  xbt_dict_set(head, "123", strdup("Changed 123"), &free);
   count(head, 7);
 
   xbt_test_add0("Change 123 back to '123'");
-  xbt_dict_set(head,"123",strdup("123"),&free);
+  xbt_dict_set(head, "123", strdup("123"), &free);
   count(head, 7);
 
   xbt_test_add0("Change 12a to 'Dummy 12a'");
-  xbt_dict_set(head,"12a",strdup("Dummy 12a"),&free);
+  xbt_dict_set(head, "12a", strdup("Dummy 12a"), &free);
   count(head, 7);
 
   xbt_test_add0("Change 12a to '12a'");
-  xbt_dict_set(head,"12a",strdup("12a"),&free);
+  xbt_dict_set(head, "12a", strdup("12a"), &free);
   count(head, 7);
 
   xbt_test_add0("Traverse the resulting dictionary");
@@ -814,20 +859,20 @@ XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse")
 
   /* RETRIEVE */
   xbt_test_add0("Search 123");
-  data = xbt_dict_get(head,"123");
+  data = xbt_dict_get(head, "123");
   xbt_test_assert(data);
-  xbt_test_assert(!strcmp("123",data));
+  xbt_test_assert(!strcmp("123", data));
 
-  search_not_found(head,"Can't be found");
-  search_not_found(head,"123 Can't be found");
-  search_not_found(head,"12345678 NOT");
+  search_not_found(head, "Can't be found");
+  search_not_found(head, "123 Can't be found");
+  search_not_found(head, "12345678 NOT");
 
-  search(head,"12a");
-  search(head,"12b");
-  search(head,"12");
-  search(head,"123456");
-  search(head,"1234");
-  search(head,"123457");
+  search(head, "12a");
+  search(head, "12b");
+  search(head, "12");
+  search(head, "123456");
+  search(head, "1234");
+  search(head, "123457");
 
   xbt_test_add0("Traverse the resulting dictionary");
   traverse(head);
@@ -842,13 +887,15 @@ XBT_TEST_UNIT("basic",test_dict_basic,"Basic usage: change, retrieve, traverse")
   traverse(head);
 }
 
-XBT_TEST_UNIT("remove",test_dict_remove,"Removing some values"){
+XBT_TEST_UNIT("remove", test_dict_remove, "Removing some values")
+{
   fill(&head);
   count(head, 7);
   xbt_test_add0("Remove non existing data");
   TRY {
-    debuged_remove(head,"Does not exist");
-  } CATCH(e) {
+    debuged_remove(head, "Does not exist");
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
     xbt_ex_free(e);
@@ -857,34 +904,45 @@ XBT_TEST_UNIT("remove",test_dict_remove,"Removing some values"){
 
   xbt_dict_free(&head);
 
-  xbt_test_add0("Remove each data manually (traversing the resulting dictionary each time)");
+  xbt_test_add0
+    ("Remove each data manually (traversing the resulting dictionary each time)");
   fill(&head);
-  debuged_remove(head,"12a");    traverse(head);
+  debuged_remove(head, "12a");
+  traverse(head);
   count(head, 6);
-  debuged_remove(head,"12b");    traverse(head);
+  debuged_remove(head, "12b");
+  traverse(head);
   count(head, 5);
-  debuged_remove(head,"12");     traverse(head);
+  debuged_remove(head, "12");
+  traverse(head);
   count(head, 4);
-  debuged_remove(head,"123456"); traverse(head);
+  debuged_remove(head, "123456");
+  traverse(head);
   count(head, 3);
   TRY {
-    debuged_remove(head,"12346");
-  } CATCH(e) {
+    debuged_remove(head, "12346");
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
     xbt_ex_free(e);
     traverse(head);
   }
-  debuged_remove(head,"1234");   traverse(head);
-  debuged_remove(head,"123457"); traverse(head);
-  debuged_remove(head,"123");    traverse(head);
+  debuged_remove(head, "1234");
+  traverse(head);
+  debuged_remove(head, "123457");
+  traverse(head);
+  debuged_remove(head, "123");
+  traverse(head);
   TRY {
-    debuged_remove(head,"12346");
-  } CATCH(e) {
+    debuged_remove(head, "12346");
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
     xbt_ex_free(e);
-  }                              traverse(head);
+  }
+  traverse(head);
 
   xbt_test_add0("Free dict, create new fresh one, and then reset the dict");
   xbt_dict_free(&head);
@@ -898,80 +956,87 @@ XBT_TEST_UNIT("remove",test_dict_remove,"Removing some values"){
   xbt_dict_free(&head);
 }
 
-XBT_TEST_UNIT("nulldata",test_dict_nulldata,"NULL data management"){
+XBT_TEST_UNIT("nulldata", test_dict_nulldata, "NULL data management")
+{
   fill(&head);
 
   xbt_test_add0("Store NULL under 'null'");
-  xbt_dict_set(head,"null",NULL,NULL);
-  search_ext(head,"null",NULL);
+  xbt_dict_set(head, "null", NULL, NULL);
+  search_ext(head, "null", NULL);
 
   xbt_test_add0("Check whether I see it while traversing...");
   {
-    xbt_dict_cursor_t cursor=NULL;
+    xbt_dict_cursor_t cursor = NULL;
     char *key;
-    int found=0;
+    int found = 0;
 
-    xbt_dict_foreach(head,cursor,key,data) {
-      if (!key || !data || strcmp(key,data)) {
-        xbt_test_log2("Seen:  %s->%s",PRINTF_STR(key),PRINTF_STR(data));
+    xbt_dict_foreach(head, cursor, key, data) {
+      if (!key || !data || strcmp(key, data)) {
+        xbt_test_log2("Seen:  %s->%s", PRINTF_STR(key), PRINTF_STR(data));
       } else {
-        xbt_test_log1("Seen:  %s",PRINTF_STR(key));
+        xbt_test_log1("Seen:  %s", PRINTF_STR(key));
       }
 
-      if (!strcmp(key,"null"))
+      if (!strcmp(key, "null"))
         found = 1;
     }
-    xbt_test_assert0(found,"the key 'null', associated to NULL is not found");
+    xbt_test_assert0(found,
+                     "the key 'null', associated to NULL is not found");
   }
   xbt_dict_free(&head);
 }
 
 #define NB_ELM 20000
 #define SIZEOFKEY 1024
-static int countelems(xbt_dict_t head) {
+static int countelems(xbt_dict_t head)
+{
   xbt_dict_cursor_t cursor;
   char *key;
   void *data;
   int res = 0;
 
-  xbt_dict_foreach(head,cursor,key,data) {
+  xbt_dict_foreach(head, cursor, key, data) {
     res++;
   }
   return res;
 }
 
-XBT_TEST_UNIT("crash",test_dict_crash,"Crash test"){
-  xbt_dict_t head=NULL;
-  int i,j,k, nb;
+XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
+{
+  xbt_dict_t head = NULL;
+  int i, j, k, nb;
   char *key;
   void *data;
 
-  srand((unsigned int)time(NULL));
+  srand((unsigned int) time(NULL));
 
-  for (i=0;i<10;i++) {
-    xbt_test_add2("CRASH test number %d (%d to go)",i+1,10-i-1);
+  for (i = 0; i < 10; i++) {
+    xbt_test_add2("CRASH test number %d (%d to go)", i + 1, 10 - i - 1);
     xbt_test_log0("Fill the struct, count its elems and frees the structure");
-    xbt_test_log1("using 1000 elements with %d chars long randomized keys.",SIZEOFKEY);
-    head=xbt_dict_new();
+    xbt_test_log1("using 1000 elements with %d chars long randomized keys.",
+                  SIZEOFKEY);
+    head = xbt_dict_new();
     /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */
-    nb=0;
-    for (j=0;j<1000;j++) {
+    nb = 0;
+    for (j = 0; j < 1000; j++) {
       char *data = NULL;
-      key=xbt_malloc(SIZEOFKEY);
+      key = xbt_malloc(SIZEOFKEY);
 
       do {
-        for (k=0;k<SIZEOFKEY-1;k++)
-          key[k]=rand() % ('z' - 'a') + 'a';
-        key[k]='\0';
+        for (k = 0; k < SIZEOFKEY - 1; k++)
+          key[k] = rand() % ('z' - 'a') + 'a';
+        key[k] = '\0';
         /*      printf("[%d %s]\n",j,key); */
-        data = xbt_dict_get_or_null(head,key);
+        data = xbt_dict_get_or_null(head, key);
       } while (data != NULL);
 
-      xbt_dict_set(head,key,key,&free);
-      data = xbt_dict_get(head,key);
-      xbt_test_assert2(!strcmp(key,data), "Retrieved value (%s) != Injected value (%s)",key,data);
+      xbt_dict_set(head, key, key, &free);
+      data = xbt_dict_get(head, key);
+      xbt_test_assert2(!strcmp(key, data),
+                       "Retrieved value (%s) != Injected value (%s)", key,
+                       data);
 
-      count(head,j+1);
+      count(head, j + 1);
     }
     /*    xbt_dict_dump(head,(void (*)(void*))&printf); */
     traverse(head);
@@ -980,46 +1045,47 @@ XBT_TEST_UNIT("crash",test_dict_crash,"Crash test"){
   }
 
 
-  head=xbt_dict_new();
-  xbt_test_add1("Fill %d elements, with keys being the number of element",NB_ELM);
-  for (j=0;j<NB_ELM;j++) {
+  head = xbt_dict_new();
+  xbt_test_add1("Fill %d elements, with keys being the number of element",
+                NB_ELM);
+  for (j = 0; j < NB_ELM; j++) {
     /* if (!(j%1000)) { printf("."); fflush(stdout); } */
 
     key = xbt_malloc(10);
 
-    sprintf(key,"%d",j);
-    xbt_dict_set(head,key,key,&free);
+    sprintf(key, "%d", j);
+    xbt_dict_set(head, key, key, &free);
   }
-  /*xbt_dict_dump(head,(void (*)(void*))&printf);*/
+  /*xbt_dict_dump(head,(void (*)(void*))&printf); */
 
   xbt_test_add0("Count the elements (retrieving the key and data for each)");
   i = countelems(head);
-  xbt_test_log1("There is %d elements",i);
+  xbt_test_log1("There is %d elements", i);
 
-  xbt_test_add1("Search my %d elements 20 times",NB_ELM);
-  key=xbt_malloc(10);
-  for (i=0;i<20;i++) {
+  xbt_test_add1("Search my %d elements 20 times", NB_ELM);
+  key = xbt_malloc(10);
+  for (i = 0; i < 20; i++) {
     /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */
-    for (j=0;j<NB_ELM;j++) {
-
-      sprintf(key,"%d",j);
-      data = xbt_dict_get(head,key);
-      xbt_test_assert2(!strcmp(key,(char*)data),
-                       "with get, key=%s != data=%s",key,(char*)data);
-      data = xbt_dict_get_ext(head,key,strlen(key));
-      xbt_test_assert2(!strcmp(key,(char*)data),
-                       "with get_ext, key=%s != data=%s",key,(char*)data);
+    for (j = 0; j < NB_ELM; j++) {
+
+      sprintf(key, "%d", j);
+      data = xbt_dict_get(head, key);
+      xbt_test_assert2(!strcmp(key, (char *) data),
+                       "with get, key=%s != data=%s", key, (char *) data);
+      data = xbt_dict_get_ext(head, key, strlen(key));
+      xbt_test_assert2(!strcmp(key, (char *) data),
+                       "with get_ext, key=%s != data=%s", key, (char *) data);
     }
   }
   free(key);
 
-  xbt_test_add1("Remove my %d elements",NB_ELM);
-  key=xbt_malloc(10);
-  for (j=0;j<NB_ELM;j++) {
+  xbt_test_add1("Remove my %d elements", NB_ELM);
+  key = xbt_malloc(10);
+  for (j = 0; j < NB_ELM; j++) {
     /* if (!(j%10000)) printf("."); fflush(stdout); */
 
-    sprintf(key,"%d",j);
-    xbt_dict_remove(head,key);
+    sprintf(key, "%d", j);
+    xbt_dict_remove(head, key);
   }
   free(key);
 
@@ -1029,23 +1095,25 @@ XBT_TEST_UNIT("crash",test_dict_crash,"Crash test"){
   xbt_dict_free(&head);
 }
 
-static void str_free(void *s) {
-  char *c=*(char**)s;
+static void str_free(void *s)
+{
+  char *c = *(char **) s;
   free(c);
 }
 
-XBT_TEST_UNIT("multicrash",test_dict_multicrash,"Multi-dict crash test"){
+XBT_TEST_UNIT("multicrash", test_dict_multicrash, "Multi-dict crash test")
+{
 
 #undef NB_ELM
-#define NB_ELM 100 /*00*/
+#define NB_ELM 100              /*00 */
 #define DEPTH 5
 #define KEY_SIZE 512
-#define NB_TEST 20 /*20*/
-  int verbose=0;
+#define NB_TEST 20              /*20 */
+  int verbose = 0;
 
   xbt_dict_t mdict = NULL;
-  int i,j,k,l;
-  xbt_dynar_t keys = xbt_dynar_new(sizeof(char*),str_free);
+  int i, j, k, l;
+  xbt_dynar_t keys = xbt_dynar_new(sizeof(char *), str_free);
   void *data;
   char *key;
 
@@ -1053,42 +1121,45 @@ XBT_TEST_UNIT("multicrash",test_dict_multicrash,"Multi-dict crash test"){
   xbt_test_add0("Generic multicache CRASH test");
   xbt_test_log4(" Fill the struct and frees it %d times, using %d elements, "
                 "depth of multicache=%d, key size=%d",
-                NB_TEST,NB_ELM,DEPTH,KEY_SIZE);
+                NB_TEST, NB_ELM, DEPTH, KEY_SIZE);
 
-  for (l=0 ; l<DEPTH ; l++) {
-    key=xbt_malloc(KEY_SIZE);
-    xbt_dynar_push(keys,&key);
+  for (l = 0; l < DEPTH; l++) {
+    key = xbt_malloc(KEY_SIZE);
+    xbt_dynar_push(keys, &key);
   }
 
-  for (i=0;i<NB_TEST;i++) {
+  for (i = 0; i < NB_TEST; i++) {
     mdict = xbt_dict_new();
-    VERB1("mdict=%p",mdict);
-    if (verbose>0)
-      printf("Test %d\n",i);
-    /* else if (i%10) printf("."); else printf("%d",i/10);*/
+    VERB1("mdict=%p", mdict);
+    if (verbose > 0)
+      printf("Test %d\n", i);
+    /* else if (i%10) printf("."); else printf("%d",i/10); */
 
-    for (j=0;j<NB_ELM;j++) {
-      if (verbose>0) printf ("  Add {");
+    for (j = 0; j < NB_ELM; j++) {
+      if (verbose > 0)
+        printf("  Add {");
 
-      for (l=0 ; l<DEPTH ; l++) {
-        key=*(char**)xbt_dynar_get_ptr(keys,l);
+      for (l = 0; l < DEPTH; l++) {
+        key = *(char **) xbt_dynar_get_ptr(keys, l);
 
-        for (k=0;k<KEY_SIZE-1;k++)
-          key[k]=rand() % ('z' - 'a') + 'a';
+        for (k = 0; k < KEY_SIZE - 1; k++)
+          key[k] = rand() % ('z' - 'a') + 'a';
 
-        key[k]='\0';
+        key[k] = '\0';
 
-        if (verbose>0) printf("%p=%s %s ",key, key,(l<DEPTH-1?";":"}"));
+        if (verbose > 0)
+          printf("%p=%s %s ", key, key, (l < DEPTH - 1 ? ";" : "}"));
       }
-      if (verbose>0) printf("in multitree %p.\n",mdict);
+      if (verbose > 0)
+        printf("in multitree %p.\n", mdict);
 
-      xbt_multidict_set(mdict,keys,xbt_strdup(key),free);
+      xbt_multidict_set(mdict, keys, xbt_strdup(key), free);
 
-      data = xbt_multidict_get(mdict,keys);
+      data = xbt_multidict_get(mdict, keys);
 
-      xbt_test_assert2(data && !strcmp((char*)data,key),
+      xbt_test_assert2(data && !strcmp((char *) data, key),
                        "Retrieved value (%s) does not match the given one (%s)\n",
-                       (char*)data,key);
+                       (char *) data, key);
     }
     xbt_dict_free(&mdict);
   }
@@ -1096,7 +1167,7 @@ XBT_TEST_UNIT("multicrash",test_dict_multicrash,"Multi-dict crash test"){
   xbt_dynar_free(&keys);
 
   /*  if (verbose>0)
-    xbt_dict_dump(mdict,&xbt_dict_print);*/
+     xbt_dict_dump(mdict,&xbt_dict_print); */
 
   xbt_dict_free(&mdict);
   xbt_dynar_free(&keys);
index eb93f69..1808ab8 100644 (file)
 #include "xbt/ex.h"
 #include "dict_private.h"
 
-#include <string.h> /* strlen() */
+#include <string.h>             /* strlen() */
 
 XBT_LOG_EXTERNAL_CATEGORY(xbt_dict);
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_cursor,xbt_dict,"To traverse dictionaries");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_cursor, xbt_dict,
+                                "To traverse dictionaries");
 
 
 /*####[ Dict cursor functions ]#############################################*/
@@ -33,7 +34,8 @@ struct xbt_dict_cursor_ {
 /** @brief Creator
  *  @param dict the dict
  */
-xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict) {
+xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict)
+{
   xbt_dict_cursor_t res = NULL;
 
   res = xbt_new(s_xbt_dict_cursor_t, 1);
@@ -48,7 +50,8 @@ xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict) {
  * @brief Destructor
  * @param cursor poor victim
  */
-void xbt_dict_cursor_free(xbt_dict_cursor_t *cursor) {
+void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor)
+{
   if (*cursor) {
     xbt_free(*cursor);
     *cursor = NULL;
@@ -58,21 +61,22 @@ void xbt_dict_cursor_free(xbt_dict_cursor_t *cursor) {
 /*
  * Sanity check to see if the head contains something
  */
-static XBT_INLINE void __cursor_not_null(xbt_dict_cursor_t cursor) {
+static XBT_INLINE void __cursor_not_null(xbt_dict_cursor_t cursor)
+{
   xbt_assert0(cursor, "Null cursor");
 }
 
 
 /** @brief Reinitialize the cursor. Mandatory after removal or add in dict. */
-void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) {
+void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor)
+{
   CDEBUG0(xbt_dict_cursor, "xbt_dict_cursor_rewind");
   xbt_assert(cursor);
 
   cursor->line = 0;
   if (cursor->dict != NULL) {
     cursor->current = cursor->dict->table[0];
-  }
-  else {
+  } else {
     cursor->current = NULL;
   }
 }
@@ -83,18 +87,17 @@ void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) {
  * @param      dict   on what to let the cursor iterate
  * @param[out] cursor dest address
  */
-void xbt_dict_cursor_first(const xbt_dict_t   dict,
-                           xbt_dict_cursor_t *cursor){
+void xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t * cursor)
+{
   DEBUG0("xbt_dict_cursor_first");
   if (!*cursor) {
     DEBUG0("Create the cursor on first use");
     *cursor = xbt_dict_cursor_new(dict);
-  }
-  else {
+  } else {
     xbt_dict_cursor_rewind(*cursor);
   }
   if (dict != NULL && (*cursor)->current == NULL) {
-    xbt_dict_cursor_step(*cursor); /* find the first element */
+    xbt_dict_cursor_step(*cursor);      /* find the first element */
   }
 }
 
@@ -102,10 +105,11 @@ void xbt_dict_cursor_first(const xbt_dict_t   dict,
 /**
  * \brief Move to the next element.
  */
-void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) {
+void xbt_dict_cursor_step(xbt_dict_cursor_t cursor)
+{
 
 
-  xbt_dictelm_t current ;
+  xbt_dictelm_t current;
   int line;
 
   DEBUG0("xbt_dict_cursor_step");
@@ -139,9 +143,9 @@ void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) {
  *
  * @returns true if it's ok, false if there is no more data
  */
-int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t  *cursor,
-                                char               **key,
-                                void               **data) {
+int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t cursor,
+                                char **key, void **data)
+{
 
   xbt_dictelm_t current;
 
@@ -152,7 +156,7 @@ int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t  *cursor,
     return FALSE;
 
   current = (*cursor)->current;
-  if (current == NULL) { /* no data left */
+  if (current == NULL) {        /* no data left */
     xbt_dict_cursor_free(cursor);
     return FALSE;
   }
@@ -167,7 +171,8 @@ int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t  *cursor,
  * @param cursor: the cursor
  * @returns the current key
  */
-char *xbt_dict_cursor_get_key(xbt_dict_cursor_t   cursor) {
+char *xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor)
+{
   __cursor_not_null(cursor);
 
   return cursor->current->key;
@@ -178,10 +183,9 @@ char *xbt_dict_cursor_get_key(xbt_dict_cursor_t   cursor) {
  * @param cursor the cursor
  * @returns the current data
  */
-void *xbt_dict_cursor_get_data(xbt_dict_cursor_t   cursor) {
+void *xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor)
+{
   __cursor_not_null(cursor);
 
   return cursor->current->content;
 }
-
-
index 4cdb299..72f2f61 100644 (file)
@@ -7,23 +7,28 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "dict_private.h"  /* prototypes of this module */
+#include "dict_private.h"       /* prototypes of this module */
 
 XBT_LOG_EXTERNAL_CATEGORY(xbt_dict);
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_elm,xbt_dict,"Dictionaries internals");
-
-XBT_LOG_NEW_SUBCATEGORY(xbt_dict_add,xbt_dict,"Dictionaries internals: elements addition");
-XBT_LOG_NEW_SUBCATEGORY(xbt_dict_search,xbt_dict,"Dictionaries internals: searching");
-XBT_LOG_NEW_SUBCATEGORY(xbt_dict_remove,xbt_dict,"Dictionaries internals: elements removal");
-XBT_LOG_NEW_SUBCATEGORY(xbt_dict_collapse,xbt_dict,"Dictionaries internals: post-removal cleanup");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_elm, xbt_dict,
+                                "Dictionaries internals");
+
+XBT_LOG_NEW_SUBCATEGORY(xbt_dict_add, xbt_dict,
+                        "Dictionaries internals: elements addition");
+XBT_LOG_NEW_SUBCATEGORY(xbt_dict_search, xbt_dict,
+                        "Dictionaries internals: searching");
+XBT_LOG_NEW_SUBCATEGORY(xbt_dict_remove, xbt_dict,
+                        "Dictionaries internals: elements removal");
+XBT_LOG_NEW_SUBCATEGORY(xbt_dict_collapse, xbt_dict,
+                        "Dictionaries internals: post-removal cleanup");
 
 xbt_mallocator_t dict_elm_mallocator = NULL;
 
 xbt_dictelm_t xbt_dictelm_new(const char *key,
                               int key_len,
                               unsigned int hash_code,
-                              void *content,
-                              void_f_pvoid_t free_f) {
+                              void *content, void_f_pvoid_t free_f)
+{
   xbt_dictelm_t element = xbt_mallocator_get(dict_elm_mallocator);
 
   element->key = xbt_new(char, key_len + 1);
@@ -40,7 +45,8 @@ xbt_dictelm_t xbt_dictelm_new(const char *key,
   return element;
 }
 
-void xbt_dictelm_free(xbt_dictelm_t element) {
+void xbt_dictelm_free(xbt_dictelm_t element)
+{
   if (element != NULL) {
     xbt_free(element->key);
 
@@ -52,14 +58,17 @@ void xbt_dictelm_free(xbt_dictelm_t element) {
   }
 }
 
-void* dict_elm_mallocator_new_f(void) {
+void *dict_elm_mallocator_new_f(void)
+{
   return xbt_new(s_xbt_dictelm_t, 1);
 }
 
-void dict_elm_mallocator_free_f(void* elem) {
+void dict_elm_mallocator_free_f(void *elem)
+{
   xbt_free(elem);
 }
 
-void dict_elm_mallocator_reset_f(void* elem) {
+void dict_elm_mallocator_reset_f(void *elem)
+{
 
 }
index 773ec8f..c3b7a5e 100644 (file)
@@ -9,11 +9,13 @@
 
 #include "dict_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_multi,xbt_dict, "Dictionaries of multiple keys");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_multi, xbt_dict,
+                                "Dictionaries of multiple keys");
 
-static void _free_dict(void*d) {
-  VERB1("free dict %p",d);
-  xbt_dict_free((xbt_dict_t*)&d);
+static void _free_dict(void *d)
+{
+  VERB1("free dict %p", d);
+  xbt_dict_free((xbt_dict_t *) & d);
 }
 
 /** \brief Insert \e data under all the keys contained in \e keys, providing their sizes in \e lens.
@@ -28,37 +30,37 @@ static void _free_dict(void*d) {
  */
 
 void
-xbt_multidict_set_ext(xbt_dict_t  mdict,
-                      xbt_dynar_t keys, xbt_dynar_t     lens,
-                      void       *data, void_f_pvoid_t  free_ctn) {
+xbt_multidict_set_ext(xbt_dict_t mdict,
+                      xbt_dynar_t keys, xbt_dynar_t lens,
+                      void *data, void_f_pvoid_t free_ctn)
+{
 
-  xbt_dict_t thislevel,nextlevel=NULL;
+  xbt_dict_t thislevel, nextlevel = NULL;
   int i;
 
   unsigned long int thislen;
   char *thiskey;
-  int keys_len=xbt_dynar_length(keys);
+  int keys_len = xbt_dynar_length(keys);
 
   xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens));
   xbt_assert0(keys_len, "Can't set a zero-long key set in a multidict");
 
   DEBUG2("xbt_multidict_set(%p,%d)", mdict, keys_len);
 
-  for (i=0 , thislevel = mdict    ;
-       i<keys_len-1               ;
-       i++ , thislevel = nextlevel) {
+  for (i = 0, thislevel = mdict; i < keys_len - 1; i++, thislevel = nextlevel) {
 
     xbt_dynar_get_cpy(keys, i, &thiskey);
     xbt_dynar_get_cpy(lens, i, &thislen);
 
-    DEBUG5("multi_set: at level %d, len=%ld, key=%p |%*s|", i, thislen, thiskey, (int)thislen,thiskey);
+    DEBUG5("multi_set: at level %d, len=%ld, key=%p |%*s|", i, thislen,
+           thiskey, (int) thislen, thiskey);
 
     /* search the dict of next level */
     nextlevel = xbt_dict_get_or_null_ext(thislevel, thiskey, thislen);
     if (nextlevel == NULL) {
       /* make sure the dict of next level exists */
-      nextlevel=xbt_dict_new();
-      VERB1("Create a dict (%p)",nextlevel);
+      nextlevel = xbt_dict_new();
+      VERB1("Create a dict (%p)", nextlevel);
       xbt_dict_set_ext(thislevel, thiskey, thislen, nextlevel, &_free_dict);
     }
   }
@@ -77,18 +79,18 @@ xbt_multidict_set_ext(xbt_dict_t  mdict,
  * \arg free_ctn: function to use to free the pushed content on need
  */
 void
-xbt_multidict_set(xbt_dict_t  mdict,
-                  xbt_dynar_t keys,
-                  void       *data,  void_f_pvoid_t free_ctn) {
-  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int),NULL);
+xbt_multidict_set(xbt_dict_t mdict,
+                  xbt_dynar_t keys, void *data, void_f_pvoid_t free_ctn)
+{
+  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL);
   unsigned long i;
   xbt_ex_t e;
 
   for (i = 0; i < xbt_dynar_length(keys); i++) {
-    char *thiskey = xbt_dynar_get_as(keys, i, char*);
+    char *thiskey = xbt_dynar_get_as(keys, i, char *);
     unsigned long int thislen = (unsigned long int) strlen(thiskey);
-    DEBUG2("Push %ld as level %lu length",thislen, i);
-    xbt_dynar_push(lens,&thislen);
+    DEBUG2("Push %ld as level %lu length", thislen, i);
+    xbt_dynar_push(lens, &thislen);
   }
 
   TRY {
@@ -110,30 +112,29 @@ xbt_multidict_set(xbt_dict_t  mdict,
  *
  * Dynars are not modified during the operation.
  */
-void *
-xbt_multidict_get_ext(xbt_dict_t  mdict,
-                      xbt_dynar_t keys,   xbt_dynar_t lens) {
-  xbt_dict_t thislevel,nextlevel;
+void *xbt_multidict_get_ext(xbt_dict_t mdict,
+                            xbt_dynar_t keys, xbt_dynar_t lens)
+{
+  xbt_dict_t thislevel, nextlevel;
   int i;
 
   unsigned long int thislen;
   char *thiskey;
-  int keys_len=xbt_dynar_length(keys);
+  int keys_len = xbt_dynar_length(keys);
 
   xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens));
-  xbt_assert0(xbt_dynar_length(keys) >= 1, "Can't get a zero-long key set in a multidict");
+  xbt_assert0(xbt_dynar_length(keys) >= 1,
+              "Can't get a zero-long key set in a multidict");
 
   DEBUG2("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys));
 
-  for (i=0         , thislevel=mdict      ;
-  i<keys_len-1                       ;
-  i++         , thislevel = nextlevel) {
+  for (i = 0, thislevel = mdict; i < keys_len - 1; i++, thislevel = nextlevel) {
 
     xbt_dynar_get_cpy(keys, i, &thiskey);
     xbt_dynar_get_cpy(lens, i, &thislen);
 
     DEBUG6("multi_get: at level %d (%p), len=%ld, key=%p |%*s|",
-           i, thislevel, thislen, thiskey, (int)thislen,thiskey);
+           i, thislevel, thislen, thiskey, (int) thislen, thiskey);
 
     /* search the dict of next level: let mismatch raise if not found */
     nextlevel = xbt_dict_get_ext(thislevel, thiskey, thislen);
@@ -145,20 +146,19 @@ xbt_multidict_get_ext(xbt_dict_t  mdict,
   return xbt_dict_get_ext(thislevel, thiskey, thislen);
 }
 
-void *
-xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys) {
-  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int),NULL);
+void *xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys)
+{
+  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL);
   unsigned long i;
   void *res;
 
   for (i = 0; i < xbt_dynar_length(keys); i++) {
-    char *thiskey = xbt_dynar_get_as(keys, i, char*);
+    char *thiskey = xbt_dynar_get_as(keys, i, char *);
     unsigned long int thislen = (unsigned long int) strlen(thiskey);
-    xbt_dynar_push(lens,&thislen);
+    xbt_dynar_push(lens, &thislen);
   }
 
-  res = xbt_multidict_get_ext(mdict, keys, lens),
-  xbt_dynar_free(&lens);
+  res = xbt_multidict_get_ext(mdict, keys, lens), xbt_dynar_free(&lens);
   return res;
 }
 
@@ -177,21 +177,21 @@ xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys) {
  */
 
 void
-xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, xbt_dynar_t lens) {
-  xbt_dict_t thislevel,nextlevel=NULL;
+xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, xbt_dynar_t lens)
+{
+  xbt_dict_t thislevel, nextlevel = NULL;
   int i;
   xbt_ex_t e;
 
   unsigned long int thislen;
   char *thiskey;
-  int keys_len=xbt_dynar_length(keys);
+  int keys_len = xbt_dynar_length(keys);
 
   xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens));
-  xbt_assert0(xbt_dynar_length(keys), "Can't remove a zero-long key set in a multidict");
+  xbt_assert0(xbt_dynar_length(keys),
+              "Can't remove a zero-long key set in a multidict");
 
-  for (i=0         , thislevel=mdict      ;
-  i<keys_len-1                       ;
-  i++         , thislevel = nextlevel) {
+  for (i = 0, thislevel = mdict; i < keys_len - 1; i++, thislevel = nextlevel) {
 
     xbt_dynar_get_cpy(keys, i, &thiskey);
     xbt_dynar_get_cpy(lens, i, &thislen);
@@ -199,7 +199,8 @@ xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, xbt_dynar_t lens) {
     /* search the dict of next level */
     TRY {
       nextlevel = xbt_dict_get_ext(thislevel, thiskey, thislen);
-    } CATCH(e) {
+    }
+    CATCH(e) {
       /* If non-existant entry, nothing to do */
       if (e.category == arg_error)
         xbt_ex_free(e);
@@ -214,17 +215,17 @@ xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, xbt_dynar_t lens) {
   xbt_dict_remove_ext(thislevel, thiskey, thislen);
 }
 
-void
-xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys) {
+void xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys)
+{
 
   xbt_ex_t e;
-  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int),NULL);
+  xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL);
   unsigned long i;
 
   for (i = 0; i < xbt_dynar_length(keys); i++) {
-    char *thiskey = xbt_dynar_get_as(keys, i, char*);
+    char *thiskey = xbt_dynar_get_as(keys, i, char *);
     unsigned long int thislen = strlen(thiskey);
-    xbt_dynar_push(lens,&thislen);
+    xbt_dynar_push(lens, &thislen);
   }
 
   TRY {
index d384580..9ec22a9 100644 (file)
@@ -43,14 +43,15 @@ typedef struct xbt_dict_ {
 typedef struct xbt_dict_cursor_ s_xbt_dict_cursor_t;
 
 extern xbt_mallocator_t dict_elm_mallocator;
-extern voiddict_elm_mallocator_new_f(void);
-extern void dict_elm_mallocator_free_f(voidelem);
-extern void dict_elm_mallocator_reset_f(voidelem);
+extern void *dict_elm_mallocator_new_f(void);
+extern void dict_elm_mallocator_free_f(void *elem);
+extern void dict_elm_mallocator_reset_f(void *elem);
 
 /*####[ Function prototypes ]################################################*/
-xbt_dictelm_t xbt_dictelm_new(const char *key, int key_len, unsigned int hash_code,
-                              void *content, void_f_pvoid_t free_f);
+xbt_dictelm_t xbt_dictelm_new(const char *key, int key_len,
+                              unsigned int hash_code, void *content,
+                              void_f_pvoid_t free_f);
 void xbt_dictelm_free(xbt_dictelm_t element);
 void xbt_dict_add_element(xbt_dict_t dict, xbt_dictelm_t element);
 
-#endif  /* _XBT_DICT_PRIVATE_H_ */
+#endif /* _XBT_DICT_PRIVATE_H_ */
index 90adeb5..68be697 100644 (file)
@@ -7,7 +7,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "portable.h" /* SIZEOF_MAX */
+#include "portable.h"           /* SIZEOF_MAX */
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dynar.h"
 #include <sys/types.h>
 
-#include "xbt/dynar_private.h" /* type definition, which we share with the
-                                 code in charge of sending this across the net */
+#include "xbt/dynar_private.h"  /* type definition, which we share with the
+                                   code in charge of sending this across the net */
 
 /* IMPLEMENTATION NOTE ON SYNCHRONIZATION: every functions which name is prefixed by _
  * assumes that the dynar is already locked if we have to.
  * Other functions (public ones) check for this.
  */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dyn,xbt,"Dynamic arrays");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dyn, xbt, "Dynamic arrays");
 
-static XBT_INLINE void  _dynar_lock(xbt_dynar_t dynar) {
-       if (dynar->mutex)
-               xbt_mutex_acquire(dynar->mutex);
+static XBT_INLINE void _dynar_lock(xbt_dynar_t dynar)
+{
+  if (dynar->mutex)
+    xbt_mutex_acquire(dynar->mutex);
 }
-static XBT_INLINE void  _dynar_unlock(xbt_dynar_t dynar) {
-       if (dynar->mutex)
-               xbt_mutex_release(dynar->mutex);
+
+static XBT_INLINE void _dynar_unlock(xbt_dynar_t dynar)
+{
+  if (dynar->mutex)
+    xbt_mutex_release(dynar->mutex);
 }
-static XBT_INLINE void _sanity_check_dynar(xbt_dynar_t dynar) {
-       xbt_assert0(dynar, "dynar is NULL");
+
+static XBT_INLINE void _sanity_check_dynar(xbt_dynar_t dynar)
+{
+  xbt_assert0(dynar, "dynar is NULL");
 }
-static XBT_INLINE void _sanity_check_idx(int idx) {
-       xbt_assert1(idx >= 0, "dynar idx(=%d) < 0", (int) (idx));
+
+static XBT_INLINE void _sanity_check_idx(int idx)
+{
+  xbt_assert1(idx >= 0, "dynar idx(=%d) < 0", (int) (idx));
 }
 
-static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx) {
-       if (idx<0 || idx>=dynar->used) {
-               _dynar_unlock(dynar);
-               THROW2(bound_error,idx,
-                               "dynar is not that long. You asked %d, but it's only %lu long",
-                               (int) (idx), (unsigned long) dynar->used);
-       }
+static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx)
+{
+  if (idx < 0 || idx >= dynar->used) {
+    _dynar_unlock(dynar);
+    THROW2(bound_error, idx,
+           "dynar is not that long. You asked %d, but it's only %lu long",
+           (int) (idx), (unsigned long) dynar->used);
+  }
 }
-static XBT_INLINE void _check_sloppy_inbound_idx(xbt_dynar_t dynar, int idx) {
-       if (idx > dynar->used) {
-               _dynar_unlock(dynar);
-               THROW2(bound_error,idx,
-                               "dynar is not that long. You asked %d, but it's only %lu long (could have been equal to it)",
-                               (int) (idx), (unsigned long) dynar->used);
-       }
+
+static XBT_INLINE void _check_sloppy_inbound_idx(xbt_dynar_t dynar, int idx)
+{
+  if (idx > dynar->used) {
+    _dynar_unlock(dynar);
+    THROW2(bound_error, idx,
+           "dynar is not that long. You asked %d, but it's only %lu long (could have been equal to it)",
+           (int) (idx), (unsigned long) dynar->used);
+  }
 }
-static XBT_INLINE void  _check_populated_dynar(xbt_dynar_t dynar) {
-       if (dynar->used == 0) {
-               _dynar_unlock(dynar);
-               THROW1(bound_error,0, "dynar %p is empty", dynar);
-       }
+
+static XBT_INLINE void _check_populated_dynar(xbt_dynar_t dynar)
+{
+  if (dynar->used == 0) {
+    _dynar_unlock(dynar);
+    THROW1(bound_error, 0, "dynar %p is empty", dynar);
+  }
 }
 
-static void _dynar_map(const xbt_dynar_t  dynar,
-                       void_f_pvoid_t     const op);
+static void _dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op);
 
 static XBT_INLINE
-void _xbt_clear_mem(void * const ptr,
-                    const unsigned long length) {
+  void _xbt_clear_mem(void *const ptr, const unsigned long length)
+{
   memset(ptr, 0, length);
 }
 
 static XBT_INLINE
-void
-_xbt_dynar_expand(xbt_dynar_t const dynar,
-                  const unsigned long          nb) {
-  const unsigned long old_size    = dynar->size;
+  void _xbt_dynar_expand(xbt_dynar_t const dynar, const unsigned long nb)
+{
+  const unsigned long old_size = dynar->size;
 
   if (nb > old_size) {
-    char * const old_data    = (char *) dynar->data;
+    char *const old_data = (char *) dynar->data;
 
-    const unsigned long elmsize     = dynar->elmsize;
-    const unsigned long old_length  = old_size*elmsize;
+    const unsigned long elmsize = dynar->elmsize;
+    const unsigned long old_length = old_size * elmsize;
 
-    const unsigned long used        = dynar->used;
-    const unsigned long used_length = used*elmsize;
+    const unsigned long used = dynar->used;
+    const unsigned long used_length = used * elmsize;
 
-    const unsigned long new_size    = nb > (2*(old_size+1)) ? nb : (2*(old_size+1));
-    const unsigned long new_length  = new_size*elmsize;
-    char * const new_data    = (char *) xbt_malloc0(elmsize*new_size);
+    const unsigned long new_size =
+      nb > (2 * (old_size + 1)) ? nb : (2 * (old_size + 1));
+    const unsigned long new_length = new_size * elmsize;
+    char *const new_data = (char *) xbt_malloc0(elmsize * new_size);
 
-    DEBUG3("expend %p from %lu to %lu elements", (void*)dynar, (unsigned long)old_size, nb);
+    DEBUG3("expend %p from %lu to %lu elements", (void *) dynar,
+           (unsigned long) old_size, nb);
 
     if (old_data) {
       memcpy(new_data, old_data, used_length);
@@ -107,76 +119,73 @@ _xbt_dynar_expand(xbt_dynar_t const dynar,
 }
 
 static XBT_INLINE
-void *
-_xbt_dynar_elm(const xbt_dynar_t  dynar,
-               const unsigned long idx) {
-  char * const data    = (char*) dynar->data;
+  void *_xbt_dynar_elm(const xbt_dynar_t dynar, const unsigned long idx)
+{
+  char *const data = (char *) dynar->data;
   const unsigned long elmsize = dynar->elmsize;
 
-  return data + idx*elmsize;
+  return data + idx * elmsize;
 }
 
 static XBT_INLINE
-void
-_xbt_dynar_get_elm(void  * const       dst,
-                   const xbt_dynar_t  dynar,
-                   const unsigned long idx) {
-  void * const elm     = _xbt_dynar_elm(dynar, idx);
+  void
+_xbt_dynar_get_elm(void *const dst,
+                   const xbt_dynar_t dynar, const unsigned long idx)
+{
+  void *const elm = _xbt_dynar_elm(dynar, idx);
 
   memcpy(dst, elm, dynar->elmsize);
 }
 
 static XBT_INLINE
-void
-_xbt_dynar_put_elm(const xbt_dynar_t  dynar,
-                   const unsigned long idx,
-                   const void * const  src) {
-  void * const elm     = _xbt_dynar_elm(dynar, idx);
+  void
+_xbt_dynar_put_elm(const xbt_dynar_t dynar,
+                   const unsigned long idx, const void *const src)
+{
+  void *const elm = _xbt_dynar_elm(dynar, idx);
   const unsigned long elmsize = dynar->elmsize;
 
   memcpy(elm, src, elmsize);
 }
 
 static XBT_INLINE
-void
-_xbt_dynar_remove_at(xbt_dynar_t  const dynar,
-               const unsigned long            idx,
-               void         * const object) {
-
-       unsigned long nb_shift;
-       unsigned long offset;
-
-       _sanity_check_dynar(dynar);
-       _check_inbound_idx(dynar, idx);
-
-       if (object) {
-               _xbt_dynar_get_elm(object, dynar, idx);
-       } else if (dynar->free_f) {
-               if (dynar->elmsize <= SIZEOF_MAX) {
-                       char elm[SIZEOF_MAX];
-                       _xbt_dynar_get_elm(elm, dynar, idx);
-                       (*dynar->free_f)(elm);
-               } else {
-                       char *elm=malloc(dynar->elmsize);
-                       _xbt_dynar_get_elm(elm, dynar, idx);
-                       (*dynar->free_f)(elm);
-                       free(elm);
-               }
-       }
-
-       nb_shift =  dynar->used-1 - idx;
-       offset   =  nb_shift * dynar->elmsize;
-
-       memmove(_xbt_dynar_elm(dynar, idx),
-                       _xbt_dynar_elm(dynar, idx+1),
-                       offset);
-
-       dynar->used--;
+  void
+_xbt_dynar_remove_at(xbt_dynar_t const dynar,
+                     const unsigned long idx, void *const object)
+{
+
+  unsigned long nb_shift;
+  unsigned long offset;
+
+  _sanity_check_dynar(dynar);
+  _check_inbound_idx(dynar, idx);
+
+  if (object) {
+    _xbt_dynar_get_elm(object, dynar, idx);
+  } else if (dynar->free_f) {
+    if (dynar->elmsize <= SIZEOF_MAX) {
+      char elm[SIZEOF_MAX];
+      _xbt_dynar_get_elm(elm, dynar, idx);
+      (*dynar->free_f) (elm);
+    } else {
+      char *elm = malloc(dynar->elmsize);
+      _xbt_dynar_get_elm(elm, dynar, idx);
+      (*dynar->free_f) (elm);
+      free(elm);
+    }
+  }
+
+  nb_shift = dynar->used - 1 - idx;
+  offset = nb_shift * dynar->elmsize;
+
+  memmove(_xbt_dynar_elm(dynar, idx), _xbt_dynar_elm(dynar, idx + 1), offset);
+
+  dynar->used--;
 }
 
-void
-xbt_dynar_dump(xbt_dynar_t dynar) {
-       INFO5("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
+void xbt_dynar_dump(xbt_dynar_t dynar)
+{
+  INFO5("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
         dynar->size, dynar->used, dynar->elmsize, dynar->data, dynar->free_f);
 }
 
@@ -190,17 +199,17 @@ xbt_dynar_dump(xbt_dynar_t dynar) {
  * types (int, char, double, etc) or pointer of pointers (struct **).
  */
 xbt_dynar_t
-xbt_dynar_new(const unsigned long elmsize,
-              void_f_pvoid_t const free_f) {
+xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
+{
 
-  xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t,1);
+  xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t, 1);
 
-  dynar->size    = 0;
-  dynar->used    = 0;
+  dynar->size = 0;
+  dynar->used = 0;
   dynar->elmsize = elmsize;
-  dynar->data    = NULL;
-  dynar->free_f    = free_f;
-  dynar->mutex    = NULL;
+  dynar->data = NULL;
+  dynar->free_f = free_f;
+  dynar->mutex = NULL;
 
   return dynar;
 }
@@ -211,9 +220,9 @@ xbt_dynar_new(const unsigned long elmsize,
  *
  */
 xbt_dynar_t
-xbt_dynar_new_sync(const unsigned long elmsize,
-                   void_f_pvoid_t const free_f) {
-  xbt_dynar_t res = xbt_dynar_new(elmsize,free_f);
+xbt_dynar_new_sync(const unsigned long elmsize, void_f_pvoid_t const free_f)
+{
+  xbt_dynar_t res = xbt_dynar_new(elmsize, free_f);
   res->mutex = xbt_mutex_init();
   return res;
 }
@@ -225,8 +234,8 @@ xbt_dynar_new_sync(const unsigned long elmsize,
  * kilkil a dynar BUT NOT its content. Ie, the array is freed, but the content
  * is not touched (the \a free_f function is not used)
  */
-void
-xbt_dynar_free_container(xbt_dynar_t *dynar) {
+void xbt_dynar_free_container(xbt_dynar_t * dynar)
+{
   if (dynar && *dynar) {
 
     if ((*dynar)->data) {
@@ -240,7 +249,7 @@ xbt_dynar_free_container(xbt_dynar_t *dynar) {
     _xbt_clear_mem(*dynar, sizeof(s_xbt_dynar_t));
 
     free(*dynar);
-    *dynar=NULL;
+    *dynar = NULL;
   }
 }
 
@@ -248,27 +257,27 @@ xbt_dynar_free_container(xbt_dynar_t *dynar) {
  *
  * \param dynar who to squeeze
  */
-void
-xbt_dynar_reset(xbt_dynar_t const dynar) {
+void xbt_dynar_reset(xbt_dynar_t const dynar)
+{
   _dynar_lock(dynar);
 
   _sanity_check_dynar(dynar);
 
-  DEBUG1("Reset the dynar %p",(void*)dynar);
+  DEBUG1("Reset the dynar %p", (void *) dynar);
   if (dynar->free_f) {
     _dynar_map(dynar, dynar->free_f);
   }
   /*
-  if (dynar->data)
-    free(dynar->data);
+     if (dynar->data)
+     free(dynar->data);
 
-  dynar->size = 0;
+     dynar->size = 0;
    */
   dynar->used = 0;
 
   _dynar_unlock(dynar);
 
-  /*  dynar->data = NULL;*/
+  /*  dynar->data = NULL; */
 }
 
 /**
@@ -286,7 +295,8 @@ xbt_dynar_reset(xbt_dynar_t const dynar) {
  * Note that if \a empty_slots_wanted is greater than the array size, the internal
  * array is not expanded and nothing is done.
  */
-void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) {
+void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
+{
   unsigned long size_wanted;
 
   _dynar_lock(dynar);
@@ -294,7 +304,7 @@ void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) {
   size_wanted = dynar->used + empty_slots_wanted;
   if (size_wanted < dynar->size) {
     dynar->size = size_wanted;
-    dynar->data = xbt_realloc(dynar->data, sizeof(void*) * dynar->size);
+    dynar->data = xbt_realloc(dynar->data, sizeof(void *) * dynar->size);
   }
   _dynar_unlock(dynar);
 }
@@ -306,25 +316,27 @@ void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) {
  * kilkil a dynar and its content
  */
 
-void
-xbt_dynar_free(xbt_dynar_t * dynar) {
+void xbt_dynar_free(xbt_dynar_t * dynar)
+{
   if (dynar && *dynar) {
     xbt_dynar_reset(*dynar);
     xbt_dynar_free_container(dynar);
   }
 }
+
 /** \brief free a dynar passed as void* (handy to store dynar in dynars or dict) */
-void xbt_dynar_free_voidp(void *d) {
-  xbt_dynar_free( (xbt_dynar_t*) d);
+void xbt_dynar_free_voidp(void *d)
+{
+  xbt_dynar_free((xbt_dynar_t *) d);
 }
 
 /** @brief Count of dynar's elements
  *
  * \param dynar the dynar we want to mesure
  */
-unsigned long
-xbt_dynar_length(const xbt_dynar_t dynar) {
-  return (dynar ? (unsigned long) dynar->used : (unsigned long)0);
+unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
+{
+  return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
 }
 
 /** @brief Retrieve a copy of the Nth element of a dynar.
@@ -335,8 +347,8 @@ xbt_dynar_length(const xbt_dynar_t dynar) {
  */
 void
 xbt_dynar_get_cpy(const xbt_dynar_t dynar,
-                  const unsigned long         idx,
-                  void       * const dst) {
+                  const unsigned long idx, void *const dst)
+{
   _dynar_lock(dynar);
   _sanity_check_dynar(dynar);
   _check_inbound_idx(dynar, idx);
@@ -354,8 +366,8 @@ xbt_dynar_get_cpy(const xbt_dynar_t dynar,
  * \warning The returned value is the actual content of the dynar.
  * Make a copy before fooling with it.
  */
-void*
-xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx) {
+void *xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+{
 
   void *res;
   _dynar_lock(dynar);
@@ -368,18 +380,18 @@ xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx) {
 }
 
 
-static void XBT_INLINE /* not synchronized */
-_xbt_dynar_set(xbt_dynar_t         dynar,
-               const unsigned long   idx,
-               const void   * const src) {
+static void XBT_INLINE          /* not synchronized */
+_xbt_dynar_set(xbt_dynar_t dynar,
+               const unsigned long idx, const void *const src)
+{
 
   _sanity_check_dynar(dynar);
   _sanity_check_idx(idx);
 
-  _xbt_dynar_expand(dynar, idx+1);
+  _xbt_dynar_expand(dynar, idx + 1);
 
   if (idx >= dynar->used) {
-    dynar->used = idx+1;
+    dynar->used = idx + 1;
   }
 
   _xbt_dynar_put_elm(dynar, idx, src);
@@ -393,13 +405,11 @@ _xbt_dynar_set(xbt_dynar_t         dynar,
  *
  * If you want to free the previous content, use xbt_dynar_replace().
  */
-void
-xbt_dynar_set(xbt_dynar_t         dynar,
-              const int            idx,
-              const void   * const src) {
+void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void *const src)
+{
 
   _dynar_lock(dynar);
-  _xbt_dynar_set(dynar,idx,src);
+  _xbt_dynar_set(dynar, idx, src);
   _dynar_unlock(dynar);
 }
 
@@ -414,26 +424,26 @@ xbt_dynar_set(xbt_dynar_t         dynar,
  * previous content, use xbt_dynar_set().
  */
 void
-xbt_dynar_replace(xbt_dynar_t         dynar,
-                  const unsigned long       idx,
-                  const void   * const object) {
+xbt_dynar_replace(xbt_dynar_t dynar,
+                  const unsigned long idx, const void *const object)
+{
   _dynar_lock(dynar);
   _sanity_check_dynar(dynar);
   _sanity_check_idx(idx);
 
   if (idx < dynar->used && dynar->free_f) {
-    void * const old_object = _xbt_dynar_elm(dynar, idx);
+    void *const old_object = _xbt_dynar_elm(dynar, idx);
 
-    (*(dynar->free_f))(old_object);
+    (*(dynar->free_f)) (old_object);
   }
 
   _xbt_dynar_set(dynar, idx, object);
   _dynar_unlock(dynar);
 }
 
-static XBT_INLINE void *
-_xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
-                         const unsigned long            idx) {
+static XBT_INLINE void *_xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
+                                                 const unsigned long idx)
+{
   void *res;
   unsigned long old_used;
   unsigned long new_used;
@@ -448,15 +458,14 @@ _xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
 
   _xbt_dynar_expand(dynar, new_used);
 
-  nb_shift =  old_used - idx;
+  nb_shift = old_used - idx;
 
   if (nb_shift)
-    memmove(_xbt_dynar_elm(dynar, idx+1),
-            _xbt_dynar_elm(dynar, idx),
-            nb_shift * dynar->elmsize);
+    memmove(_xbt_dynar_elm(dynar, idx + 1),
+            _xbt_dynar_elm(dynar, idx), nb_shift * dynar->elmsize);
 
   dynar->used = new_used;
-  res = _xbt_dynar_elm(dynar,idx);
+  res = _xbt_dynar_elm(dynar, idx);
   return res;
 }
 
@@ -465,13 +474,12 @@ _xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
  * You can then use regular affectation to set its value instead of relying
  * on the slow memcpy. This is what xbt_dynar_insert_at_as() does.
  */
-void *
-xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
-                        const int            idx) {
+void *xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
+{
   void *res;
 
   _dynar_lock(dynar);
-  res = _xbt_dynar_insert_at_ptr(dynar,idx);
+  res = _xbt_dynar_insert_at_ptr(dynar, idx);
   _dynar_unlock(dynar);
   return res;
 }
@@ -483,15 +491,13 @@ xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
  * position right in the dynar.
  */
 void
-xbt_dynar_insert_at(xbt_dynar_t  const dynar,
-                    const int            idx,
-                    const void   * const src) {
+xbt_dynar_insert_at(xbt_dynar_t const dynar,
+                    const int idx, const void *const src)
+{
 
   _dynar_lock(dynar);
   /* checks done in xbt_dynar_insert_at_ptr */
-  memcpy(_xbt_dynar_insert_at_ptr(dynar,idx),
-         src,
-         dynar->elmsize);
+  memcpy(_xbt_dynar_insert_at_ptr(dynar, idx), src, dynar->elmsize);
   _dynar_unlock(dynar);
 }
 
@@ -505,9 +511,9 @@ xbt_dynar_insert_at(xbt_dynar_t  const dynar,
  * free_f function passed at dynar creation.
  */
 void
-xbt_dynar_remove_at(xbt_dynar_t  const dynar,
-                    const int            idx,
-                    void         * const object) {
+xbt_dynar_remove_at(xbt_dynar_t const dynar,
+                    const int idx, void *const object)
+{
 
   _dynar_lock(dynar);
   _xbt_dynar_remove_at(dynar, idx, object);
@@ -518,31 +524,29 @@ xbt_dynar_remove_at(xbt_dynar_t  const dynar,
  *
  * Raises not_found_error if not found.
  */
-int
-xbt_dynar_search(xbt_dynar_t  const dynar,
-                 void        *const elem) {
+int xbt_dynar_search(xbt_dynar_t const dynar, void *const elem)
+{
   unsigned long it;
 
   _dynar_lock(dynar);
-  for (it=0; it< dynar->used; it++)
-    if (!memcmp(_xbt_dynar_elm(dynar, it),elem,dynar->elmsize)) {
+  for (it = 0; it < dynar->used; it++)
+    if (!memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
       _dynar_unlock(dynar);
       return it;
     }
 
   _dynar_unlock(dynar);
-  THROW2(not_found_error,0,"Element %p not part of dynar %p",elem,dynar);
+  THROW2(not_found_error, 0, "Element %p not part of dynar %p", elem, dynar);
 }
 
 /** @brief Returns a boolean indicating whether the element is part of the dynar */
-int
-xbt_dynar_member(xbt_dynar_t  const dynar,
-                 void        *const elem) {
+int xbt_dynar_member(xbt_dynar_t const dynar, void *const elem)
+{
 
   xbt_ex_t e;
 
   TRY {
-    xbt_dynar_search(dynar,elem);
+    xbt_dynar_search(dynar, elem);
   } CATCH(e) {
     if (e.category == not_found_error) {
       xbt_ex_free(e);
@@ -558,28 +562,25 @@ xbt_dynar_member(xbt_dynar_t  const dynar,
  * You can then use regular affectation to set its value instead of relying
  * on the slow memcpy. This is what xbt_dynar_push_as() does.
  */
-void *
-xbt_dynar_push_ptr(xbt_dynar_t  const dynar) {
+void *xbt_dynar_push_ptr(xbt_dynar_t const dynar)
+{
   void *res;
 
   /* we have to inline xbt_dynar_insert_at_ptr here to make sure that
-    dynar->used don't change between reading it and getting the lock
-   within xbt_dynar_insert_at_ptr */
+     dynar->used don't change between reading it and getting the lock
+     within xbt_dynar_insert_at_ptr */
   _dynar_lock(dynar);
-  res = _xbt_dynar_insert_at_ptr(dynar,dynar->used);
+  res = _xbt_dynar_insert_at_ptr(dynar, dynar->used);
   _dynar_unlock(dynar);
   return res;
 }
 
 /** @brief Add an element at the end of the dynar */
-void
-xbt_dynar_push(xbt_dynar_t  const dynar,
-               const void   * const src) {
+void xbt_dynar_push(xbt_dynar_t const dynar, const void *const src)
+{
   _dynar_lock(dynar);
   /* checks done in xbt_dynar_insert_at_ptr */
-  memcpy(_xbt_dynar_insert_at_ptr(dynar,dynar->used),
-         src,
-         dynar->elmsize);
+  memcpy(_xbt_dynar_insert_at_ptr(dynar, dynar->used), src, dynar->elmsize);
   _dynar_unlock(dynar);
 }
 
@@ -588,28 +589,27 @@ xbt_dynar_push(xbt_dynar_t  const dynar,
  * You can then use regular affectation to set its value instead of relying
  * on the slow memcpy. This is what xbt_dynar_pop_as() does.
  */
-void *
-xbt_dynar_pop_ptr(xbt_dynar_t  const dynar) {
+void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
+{
   void *res;
 
   _dynar_lock(dynar);
   _check_populated_dynar(dynar);
-  DEBUG1("Pop %p",(void*)dynar);
+  DEBUG1("Pop %p", (void *) dynar);
   dynar->used--;
-  res = _xbt_dynar_elm(dynar,dynar->used);
+  res = _xbt_dynar_elm(dynar, dynar->used);
   _dynar_unlock(dynar);
   return res;
 }
 
 /** @brief Get and remove the last element of the dynar */
-void
-xbt_dynar_pop(xbt_dynar_t  const dynar,
-              void         * const dst) {
+void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst)
+{
 
   /* sanity checks done by remove_at */
-  DEBUG1("Pop %p",(void*)dynar);
+  DEBUG1("Pop %p", (void *) dynar);
   _dynar_lock(dynar);
-  _xbt_dynar_remove_at(dynar, dynar->used-1, dst);
+  _xbt_dynar_remove_at(dynar, dynar->used - 1, dst);
   _dynar_unlock(dynar);
 }
 
@@ -617,9 +617,8 @@ xbt_dynar_pop(xbt_dynar_t  const dynar,
  *
  * This is less efficient than xbt_dynar_push()
  */
-void
-xbt_dynar_unshift(xbt_dynar_t  const dynar,
-                  const void   * const src) {
+void xbt_dynar_unshift(xbt_dynar_t const dynar, const void *const src)
+{
 
   /* sanity checks done by insert_at */
   xbt_dynar_insert_at(dynar, 0, src);
@@ -629,23 +628,22 @@ xbt_dynar_unshift(xbt_dynar_t  const dynar,
  *
  * This is less efficient than xbt_dynar_pop()
  */
-void
-xbt_dynar_shift(xbt_dynar_t  const dynar,
-                void         * const dst) {
+void xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst)
+{
 
   /* sanity checks done by remove_at */
   xbt_dynar_remove_at(dynar, 0, dst);
 }
 
-static void _dynar_map(const xbt_dynar_t  dynar,
-                       void_f_pvoid_t     const op) {
-  char         elm[SIZEOF_MAX];
+static void _dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
+{
+  char elm[SIZEOF_MAX];
   const unsigned long used = dynar->used;
-  unsigned long       i    = 0;
+  unsigned long i = 0;
 
   for (i = 0; i < used; i++) {
     _xbt_dynar_get_elm(elm, dynar, i);
-    (*op)(elm);
+    (*op) (elm);
   }
 }
 
@@ -658,14 +656,13 @@ static void _dynar_map(const xbt_dynar_t  dynar,
  * operation, so make sure your function don't call any function
  * from xbt_dynar_* on it, or you'll get a deadlock.
  */
-void
-xbt_dynar_map(const xbt_dynar_t  dynar,
-              void_f_pvoid_t     const op) {
+void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
+{
 
   _dynar_lock(dynar);
   _sanity_check_dynar(dynar);
 
-  _dynar_map(dynar,op);
+  _dynar_map(dynar, op);
 
   _dynar_unlock(dynar);
 }
@@ -678,11 +675,11 @@ xbt_dynar_map(const xbt_dynar_t  dynar,
  * @warning Do not call this function directly, but only through xbt_dynar_foreach.
  */
 void
-_xbt_dynar_cursor_first(const xbt_dynar_t dynar,
-                        unsigned int * const cursor) {
+_xbt_dynar_cursor_first(const xbt_dynar_t dynar, unsigned int *const cursor)
+{
 
   _dynar_lock(dynar);
-  DEBUG1("Set cursor on %p to the first position",(void*)dynar);
+  DEBUG1("Set cursor on %p to the first position", (void *) dynar);
   *cursor = 0;
 }
 
@@ -691,8 +688,8 @@ _xbt_dynar_cursor_first(const xbt_dynar_t dynar,
  * @warning Do not call this function directly, but only through xbt_dynar_foreach.
  */
 void
-_xbt_dynar_cursor_step(const xbt_dynar_t dynar,
-                       unsigned int * const cursor) {
+_xbt_dynar_cursor_step(const xbt_dynar_t dynar, unsigned int *const cursor)
+{
 
   (*cursor)++;
 }
@@ -703,8 +700,8 @@ _xbt_dynar_cursor_step(const xbt_dynar_t dynar,
  */
 int
 _xbt_dynar_cursor_get(const xbt_dynar_t dynar,
-                      unsigned int  * const cursor,
-                      void               * const dst) {
+                      unsigned int *const cursor, void *const dst)
+{
 
   _sanity_check_dynar(dynar);
   {
@@ -712,11 +709,11 @@ _xbt_dynar_cursor_get(const xbt_dynar_t dynar,
     const unsigned long idx = *cursor;
 
     if (idx >= dynar->used) {
-      DEBUG1("Cursor on %p already on last elem",(void*)dynar);
+      DEBUG1("Cursor on %p already on last elem", (void *) dynar);
       _dynar_unlock(dynar);
       return FALSE;
     }
-    DEBUG2("Cash out cursor on %p at %lu",(void*)dynar,idx);
+    DEBUG2("Cash out cursor on %p at %lu", (void *) dynar, idx);
 
     _xbt_dynar_get_elm(dst, dynar, idx);
   }
@@ -728,10 +725,10 @@ _xbt_dynar_cursor_get(const xbt_dynar_t dynar,
  *
  * This function can be used while traversing without problem.
  */
-void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
-                         unsigned int * const cursor) {
+void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int *const cursor)
+{
 
-  _xbt_dynar_remove_at(dynar,(*cursor)--,NULL);
+  _xbt_dynar_remove_at(dynar, (*cursor)--, NULL);
 }
 
 /** @brief Unlocks a synchronized dynar when you want to break the traversal
@@ -740,7 +737,8 @@ void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
  * xbt_dynar_foreach loop, but shouldn't be called at the end of a
  * regular traversal reaching the end of the elements
  */
-void xbt_dynar_cursor_unlock(xbt_dynar_t dynar) {
+void xbt_dynar_cursor_unlock(xbt_dynar_t dynar)
+{
   _dynar_unlock(dynar);
 }
 
@@ -748,67 +746,69 @@ void xbt_dynar_cursor_unlock(xbt_dynar_t dynar) {
 
 #define NB_ELEM 5000
 
-XBT_TEST_SUITE("dynar","Dynar data container");
+XBT_TEST_SUITE("dynar", "Dynar data container");
 XBT_LOG_EXTERNAL_CATEGORY(xbt_dyn);
 XBT_LOG_DEFAULT_CATEGORY(xbt_dyn);
 
-XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
+XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
+{
   /* Vars_decl [doxygen cruft] */
   xbt_dynar_t d;
-  int i,cpt;
+  int i, cpt;
   unsigned int cursor;
   int *iptr;
 
   xbt_test_add0("==== Traverse the empty dynar");
-  d=xbt_dynar_new(sizeof(int),NULL);
-  xbt_dynar_foreach(d,cursor,i){
-    xbt_assert0(0,"Damnit, there is something in the empty dynar");
+  d = xbt_dynar_new(sizeof(int), NULL);
+  xbt_dynar_foreach(d, cursor, i) {
+    xbt_assert0(0, "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
-  xbt_test_add1("==== Push %d int, set them again 3 times, traverse them, shift them",
-                NB_ELEM);
+  xbt_test_add1
+    ("==== Push %d int, set them again 3 times, traverse them, shift them",
+     NB_ELEM);
   /* Populate_ints [doxygen cruft] */
   /* 1. Populate the dynar */
-  d=xbt_dynar_new(sizeof(int),NULL);
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    xbt_dynar_push_as(d,int,cpt); /* This is faster (and possible only with scalars) */
+  d = xbt_dynar_new(sizeof(int), NULL);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    xbt_dynar_push_as(d, int, cpt);     /* This is faster (and possible only with scalars) */
     /* xbt_dynar_push(d,&cpt);       This would also work */
-    xbt_test_log2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
+    xbt_test_log2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
   /* 2. Traverse manually the dynar */
-  for (cursor=0; cursor< NB_ELEM; cursor++) {
-    iptr=xbt_dynar_get_ptr(d,cursor);
+  for (cursor = 0; cursor < NB_ELEM; cursor++) {
+    iptr = xbt_dynar_get_ptr(d, cursor);
     xbt_test_assert2(cursor == *iptr,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
-                     cursor,cpt);
+                     cursor, cpt);
   }
 
   /* 3. Traverse the dynar using the neat macro to that extend */
-  xbt_dynar_foreach(d,cursor,cpt){
+  xbt_dynar_foreach(d, cursor, cpt) {
     xbt_test_assert2(cursor == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
-                     cursor,cpt);
+                     cursor, cpt);
   }
   /* end_of_traversal */
 
-  for (cpt=0; cpt< NB_ELEM; cpt++)
-    *(int*)xbt_dynar_get_ptr(d,cpt) = cpt;
+  for (cpt = 0; cpt < NB_ELEM; cpt++)
+    *(int *) xbt_dynar_get_ptr(d, cpt) = cpt;
 
-  for (cpt=0; cpt< NB_ELEM; cpt++)
-    *(int*)xbt_dynar_get_ptr(d,cpt) = cpt;
-  /*     xbt_dynar_set(d,cpt,&cpt);*/
+  for (cpt = 0; cpt < NB_ELEM; cpt++)
+    *(int *) xbt_dynar_get_ptr(d, cpt) = cpt;
+  /*     xbt_dynar_set(d,cpt,&cpt); */
 
-  for (cpt=0; cpt< NB_ELEM; cpt++)
-    *(int*)xbt_dynar_get_ptr(d,cpt) = cpt;
+  for (cpt = 0; cpt < NB_ELEM; cpt++)
+    *(int *) xbt_dynar_get_ptr(d, cpt) = cpt;
 
-  cpt=0;
-  xbt_dynar_foreach(d,cursor,i){
+  cpt = 0;
+  xbt_dynar_foreach(d, cursor, i) {
     xbt_test_assert2(i == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
-                     i,cpt);
+                     i, cpt);
     cpt++;
   }
   xbt_test_assert2(cpt == NB_ELEM,
@@ -817,12 +817,12 @@ XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
 
   /* shifting [doxygen cruft] */
   /* 4. Shift all the values */
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    xbt_dynar_shift(d,&i);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    xbt_dynar_shift(d, &i);
     xbt_test_assert2(i == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
-                     i,cpt);
-    xbt_test_log2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
+                     i, cpt);
+    xbt_test_log2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
   /* 5. Free the resources */
@@ -830,180 +830,182 @@ XBT_TEST_UNIT("int",test_dynar_int,"Dynars of integers") {
   xbt_dynar_free(&d);
 
 
-  xbt_test_add1("==== Unshift/pop %d int",NB_ELEM);
-  d=xbt_dynar_new(sizeof(int),NULL);
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    xbt_dynar_unshift(d,&cpt);
-    DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
+  xbt_test_add1("==== Unshift/pop %d int", NB_ELEM);
+  d = xbt_dynar_new(sizeof(int), NULL);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    xbt_dynar_unshift(d, &cpt);
+    DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    i=xbt_dynar_pop_as(d,int);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    i = xbt_dynar_pop_as(d, int);
     xbt_test_assert2(i == cpt,
                      "The retrieved value is not the same than the injected one (%d!=%d)",
-                     i,cpt);
-    xbt_test_log2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
+                     i, cpt);
+    xbt_test_log2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
-  xbt_test_add1("==== Push %d int, insert 1000 int in the middle, shift everything",NB_ELEM);
-  d=xbt_dynar_new(sizeof(int),NULL);
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    xbt_dynar_push_as(d,int,cpt);
-    DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
+  xbt_test_add1
+    ("==== Push %d int, insert 1000 int in the middle, shift everything",
+     NB_ELEM);
+  d = xbt_dynar_new(sizeof(int), NULL);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    xbt_dynar_push_as(d, int, cpt);
+    DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
-  for (cpt=0; cpt< 1000; cpt++) {
-    xbt_dynar_insert_at_as(d,2500,int,cpt);
-    DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
+  for (cpt = 0; cpt < 1000; cpt++) {
+    xbt_dynar_insert_at_as(d, 2500, int, cpt);
+    DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(d));
   }
 
-  for (cpt=0; cpt< 2500; cpt++) {
-    xbt_dynar_shift(d,&i);
+  for (cpt = 0; cpt < 2500; cpt++) {
+    xbt_dynar_shift(d, &i);
     xbt_test_assert2(i == cpt,
                      "The retrieved value is not the same than the injected one at the begining (%d!=%d)",
-                     i,cpt);
-    DEBUG2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
+                     i, cpt);
+    DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
-  for (cpt=999; cpt>=0; cpt--) {
-    xbt_dynar_shift(d,&i);
+  for (cpt = 999; cpt >= 0; cpt--) {
+    xbt_dynar_shift(d, &i);
     xbt_test_assert2(i == cpt,
                      "The retrieved value is not the same than the injected one in the middle (%d!=%d)",
-                     i,cpt);
+                     i, cpt);
   }
-  for (cpt=2500; cpt< NB_ELEM; cpt++) {
-    xbt_dynar_shift(d,&i);
+  for (cpt = 2500; cpt < NB_ELEM; cpt++) {
+    xbt_dynar_shift(d, &i);
     xbt_test_assert2(i == cpt,
                      "The retrieved value is not the same than the injected one at the end (%d!=%d)",
-                     i,cpt);
+                     i, cpt);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
-  xbt_test_add1("==== Push %d int, remove 2000-4000. free the rest",NB_ELEM);
-  d=xbt_dynar_new(sizeof(int),NULL);
-  for (cpt=0; cpt< NB_ELEM; cpt++)
-    xbt_dynar_push_as(d,int,cpt);
+  xbt_test_add1("==== Push %d int, remove 2000-4000. free the rest", NB_ELEM);
+  d = xbt_dynar_new(sizeof(int), NULL);
+  for (cpt = 0; cpt < NB_ELEM; cpt++)
+    xbt_dynar_push_as(d, int, cpt);
 
-  for (cpt=2000; cpt< 4000; cpt++) {
-    xbt_dynar_remove_at(d,2000,&i);
+  for (cpt = 2000; cpt < 4000; cpt++) {
+    xbt_dynar_remove_at(d, 2000, &i);
     xbt_test_assert2(i == cpt,
-                     "Remove a bad value. Got %d, expected %d",
-                     i,cpt);
-    DEBUG2("remove %d, length=%lu",cpt, xbt_dynar_length(d));
+                     "Remove a bad value. Got %d, expected %d", i, cpt);
+    DEBUG2("remove %d, length=%lu", cpt, xbt_dynar_length(d));
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 }
+
 /*******************************************************************************/
 /*******************************************************************************/
 /*******************************************************************************/
-XBT_TEST_UNIT("double",test_dynar_double,"Dynars of doubles") {
+XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
+{
   xbt_dynar_t d;
   int cpt;
   unsigned int cursor;
-  double d1,d2;
+  double d1, d2;
 
   xbt_test_add0("==== Traverse the empty dynar");
-  d=xbt_dynar_new(sizeof(int),NULL);
-  xbt_dynar_foreach(d,cursor,cpt){
-    xbt_test_assert0(FALSE,
-                     "Damnit, there is something in the empty dynar");
+  d = xbt_dynar_new(sizeof(int), NULL);
+  xbt_dynar_foreach(d, cursor, cpt) {
+    xbt_test_assert0(FALSE, "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
   xbt_test_add0("==== Push/shift 5000 doubles");
-  d=xbt_dynar_new(sizeof(double),NULL);
-  for (cpt=0; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_push(d,&d1);
+  d = xbt_dynar_new(sizeof(double), NULL);
+  for (cpt = 0; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_push(d, &d1);
   }
-  xbt_dynar_foreach(d,cursor,d2){
-    d1=(double)cursor;
+  xbt_dynar_foreach(d, cursor, d2) {
+    d1 = (double) cursor;
     xbt_test_assert2(d1 == d2,
                      "The retrieved value is not the same than the injected one (%f!=%f)",
-                     d1,d2);
+                     d1, d2);
   }
-  for (cpt=0; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_shift(d,&d2);
+  for (cpt = 0; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_shift(d, &d2);
     xbt_test_assert2(d1 == d2,
                      "The retrieved value is not the same than the injected one (%f!=%f)",
-                     d1,d2);
+                     d1, d2);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
   xbt_test_add0("==== Unshift/pop 5000 doubles");
-  d=xbt_dynar_new(sizeof(double),NULL);
-  for (cpt=0; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_unshift(d,&d1);
+  d = xbt_dynar_new(sizeof(double), NULL);
+  for (cpt = 0; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_unshift(d, &d1);
   }
-  for (cpt=0; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_pop(d,&d2);
-    xbt_test_assert2 (d1 == d2,
-                      "The retrieved value is not the same than the injected one (%f!=%f)",
-                      d1,d2);
+  for (cpt = 0; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_pop(d, &d2);
+    xbt_test_assert2(d1 == d2,
+                     "The retrieved value is not the same than the injected one (%f!=%f)",
+                     d1, d2);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
 
-  xbt_test_add0("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
-  d=xbt_dynar_new(sizeof(double),NULL);
-  for (cpt=0; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_push(d,&d1);
+  xbt_test_add0
+    ("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
+  d = xbt_dynar_new(sizeof(double), NULL);
+  for (cpt = 0; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_push(d, &d1);
   }
-  for (cpt=0; cpt< 1000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_insert_at(d,2500,&d1);
+  for (cpt = 0; cpt < 1000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_insert_at(d, 2500, &d1);
   }
 
-  for (cpt=0; cpt< 2500; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_shift(d,&d2);
+  for (cpt = 0; cpt < 2500; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_shift(d, &d2);
     xbt_test_assert2(d1 == d2,
                      "The retrieved value is not the same than the injected one at the begining (%f!=%f)",
-                     d1,d2);
-    DEBUG2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
+                     d1, d2);
+    DEBUG2("Pop %d, length=%lu", cpt, xbt_dynar_length(d));
   }
-  for (cpt=999; cpt>=0; cpt--) {
-    d1=(double)cpt;
-    xbt_dynar_shift(d,&d2);
-    xbt_test_assert2 (d1 == d2,
-                      "The retrieved value is not the same than the injected one in the middle (%f!=%f)",
-                      d1,d2);
+  for (cpt = 999; cpt >= 0; cpt--) {
+    d1 = (double) cpt;
+    xbt_dynar_shift(d, &d2);
+    xbt_test_assert2(d1 == d2,
+                     "The retrieved value is not the same than the injected one in the middle (%f!=%f)",
+                     d1, d2);
   }
-  for (cpt=2500; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_shift(d,&d2);
-    xbt_test_assert2 (d1 == d2,
-                      "The retrieved value is not the same than the injected one at the end (%f!=%f)",
-                      d1,d2);
+  for (cpt = 2500; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_shift(d, &d2);
+    xbt_test_assert2(d1 == d2,
+                     "The retrieved value is not the same than the injected one at the end (%f!=%f)",
+                     d1, d2);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
   xbt_test_add0("==== Push 5000 double, remove 2000-4000. free the rest");
-  d=xbt_dynar_new(sizeof(double),NULL);
-  for (cpt=0; cpt< 5000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_push(d,&d1);
+  d = xbt_dynar_new(sizeof(double), NULL);
+  for (cpt = 0; cpt < 5000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_push(d, &d1);
   }
-  for (cpt=2000; cpt< 4000; cpt++) {
-    d1=(double)cpt;
-    xbt_dynar_remove_at(d,2000,&d2);
-    xbt_test_assert2 (d1 == d2,
-                      "Remove a bad value. Got %f, expected %f",
-                      d2,d1);
+  for (cpt = 2000; cpt < 4000; cpt++) {
+    d1 = (double) cpt;
+    xbt_dynar_remove_at(d, 2000, &d2);
+    xbt_test_assert2(d1 == d2,
+                     "Remove a bad value. Got %f, expected %f", d2, d1);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
@@ -1015,79 +1017,80 @@ XBT_TEST_UNIT("double",test_dynar_double,"Dynars of doubles") {
 /*******************************************************************************/
 /*******************************************************************************/
 /*******************************************************************************/
-XBT_TEST_UNIT("string",test_dynar_string,"Dynars of strings") {
+XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
+{
   xbt_dynar_t d;
   int cpt;
   unsigned int iter;
   char buf[1024];
-  char *s1,*s2;
+  char *s1, *s2;
 
   xbt_test_add0("==== Traverse the empty dynar");
-  d=xbt_dynar_new(sizeof(char *),&xbt_free_ref);
-  xbt_dynar_foreach(d,iter,s1){
-    xbt_test_assert0(FALSE,
-                     "Damnit, there is something in the empty dynar");
+  d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
+  xbt_dynar_foreach(d, iter, s1) {
+    xbt_test_assert0(FALSE, "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
-  xbt_test_add1("==== Push %d strings, set them again 3 times, shift them",NB_ELEM);
+  xbt_test_add1("==== Push %d strings, set them again 3 times, shift them",
+                NB_ELEM);
   /* Populate_str [doxygen cruft] */
-  d=xbt_dynar_new(sizeof(char*),&xbt_free_ref);
+  d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
   /* 1. Populate the dynar */
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_push(d,&s1);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_push(d, &s1);
   }
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_replace(d,cpt,&s1);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_replace(d, cpt, &s1);
   }
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_replace(d,cpt,&s1);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_replace(d, cpt, &s1);
   }
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_replace(d,cpt,&s1);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_replace(d, cpt, &s1);
   }
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    xbt_dynar_shift(d,&s2);
-    xbt_test_assert2 (!strcmp(buf,s2),
-                      "The retrieved value is not the same than the injected one (%s!=%s)",
-                      buf,s2);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    xbt_dynar_shift(d, &s2);
+    xbt_test_assert2(!strcmp(buf, s2),
+                     "The retrieved value is not the same than the injected one (%s!=%s)",
+                     buf, s2);
     free(s2);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
-  xbt_test_add1("==== Unshift, traverse and pop %d strings",NB_ELEM);
-  d=xbt_dynar_new(sizeof(char**),&xbt_free_ref);
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_unshift(d,&s1);
+  xbt_test_add1("==== Unshift, traverse and pop %d strings", NB_ELEM);
+  d = xbt_dynar_new(sizeof(char **), &xbt_free_ref);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_unshift(d, &s1);
   }
   /* 2. Traverse the dynar with the macro */
-  xbt_dynar_foreach(d,iter,s1) {
-    sprintf(buf,"%d",NB_ELEM - iter -1);
-    xbt_test_assert2 (!strcmp(buf,s1),
-                      "The retrieved value is not the same than the injected one (%s!=%s)",
-                      buf,s1);
+  xbt_dynar_foreach(d, iter, s1) {
+    sprintf(buf, "%d", NB_ELEM - iter - 1);
+    xbt_test_assert2(!strcmp(buf, s1),
+                     "The retrieved value is not the same than the injected one (%s!=%s)",
+                     buf, s1);
   }
   /* 3. Traverse the dynar with the macro */
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    xbt_dynar_pop(d,&s2);
-    xbt_test_assert2 (!strcmp(buf,s2),
-                      "The retrieved value is not the same than the injected one (%s!=%s)",
-                      buf,s2);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    xbt_dynar_pop(d, &s2);
+    xbt_test_assert2(!strcmp(buf, s2),
+                     "The retrieved value is not the same than the injected one (%s!=%s)",
+                     buf, s2);
     free(s2);
   }
   /* 4. Free the resources */
@@ -1095,63 +1098,65 @@ XBT_TEST_UNIT("string",test_dynar_string,"Dynars of strings") {
   xbt_dynar_free(&d);
 
 
-  xbt_test_add2("==== Push %d strings, insert %d strings in the middle, shift everything",NB_ELEM,NB_ELEM/5);
-  d=xbt_dynar_new(sizeof(char*),&xbt_free_ref);
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_push(d,&s1);
+  xbt_test_add2
+    ("==== Push %d strings, insert %d strings in the middle, shift everything",
+     NB_ELEM, NB_ELEM / 5);
+  d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_push(d, &s1);
   }
-  for (cpt=0; cpt< NB_ELEM/5; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_insert_at(d,NB_ELEM/2,&s1);
+  for (cpt = 0; cpt < NB_ELEM / 5; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_insert_at(d, NB_ELEM / 2, &s1);
   }
 
-  for (cpt=0; cpt< NB_ELEM/2; cpt++) {
-    sprintf(buf,"%d",cpt);
-    xbt_dynar_shift(d,&s2);
-    xbt_test_assert2(!strcmp(buf,s2),
+  for (cpt = 0; cpt < NB_ELEM / 2; cpt++) {
+    sprintf(buf, "%d", cpt);
+    xbt_dynar_shift(d, &s2);
+    xbt_test_assert2(!strcmp(buf, s2),
                      "The retrieved value is not the same than the injected one at the begining (%s!=%s)",
-                     buf,s2);
+                     buf, s2);
     free(s2);
   }
-  for (cpt=(NB_ELEM/5)-1; cpt>=0; cpt--) {
-    sprintf(buf,"%d",cpt);
-    xbt_dynar_shift(d,&s2);
-    xbt_test_assert2 (!strcmp(buf,s2),
-                      "The retrieved value is not the same than the injected one in the middle (%s!=%s)",
-                      buf,s2);
+  for (cpt = (NB_ELEM / 5) - 1; cpt >= 0; cpt--) {
+    sprintf(buf, "%d", cpt);
+    xbt_dynar_shift(d, &s2);
+    xbt_test_assert2(!strcmp(buf, s2),
+                     "The retrieved value is not the same than the injected one in the middle (%s!=%s)",
+                     buf, s2);
     free(s2);
   }
-  for (cpt=NB_ELEM/2; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    xbt_dynar_shift(d,&s2);
-    xbt_test_assert2 (!strcmp(buf,s2),
-                      "The retrieved value is not the same than the injected one at the end (%s!=%s)",
-                      buf,s2);
+  for (cpt = NB_ELEM / 2; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    xbt_dynar_shift(d, &s2);
+    xbt_test_assert2(!strcmp(buf, s2),
+                     "The retrieved value is not the same than the injected one at the end (%s!=%s)",
+                     buf, s2);
     free(s2);
   }
   xbt_dynar_free(&d);
   xbt_dynar_free(&d);
 
 
-  xbt_test_add3("==== Push %d strings, remove %d-%d. free the rest",NB_ELEM,2*(NB_ELEM/5),4*(NB_ELEM/5));
-  d=xbt_dynar_new(sizeof(char*),&xbt_free_ref);
-  for (cpt=0; cpt< NB_ELEM; cpt++) {
-    sprintf(buf,"%d",cpt);
-    s1=strdup(buf);
-    xbt_dynar_push(d,&s1);
+  xbt_test_add3("==== Push %d strings, remove %d-%d. free the rest", NB_ELEM,
+                2 * (NB_ELEM / 5), 4 * (NB_ELEM / 5));
+  d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
+  for (cpt = 0; cpt < NB_ELEM; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_push(d, &s1);
   }
-  for (cpt=2*(NB_ELEM/5); cpt< 4*(NB_ELEM/5); cpt++) {
-    sprintf(buf,"%d",cpt);
-    xbt_dynar_remove_at(d,2*(NB_ELEM/5),&s2);
-    xbt_test_assert2(!strcmp(buf,s2),
-                     "Remove a bad value. Got %s, expected %s",
-                     s2,buf);
+  for (cpt = 2 * (NB_ELEM / 5); cpt < 4 * (NB_ELEM / 5); cpt++) {
+    sprintf(buf, "%d", cpt);
+    xbt_dynar_remove_at(d, 2 * (NB_ELEM / 5), &s2);
+    xbt_test_assert2(!strcmp(buf, s2),
+                     "Remove a bad value. Got %s, expected %s", s2, buf);
     free(s2);
   }
-  xbt_dynar_free(&d); /* end_of_doxygen */
+  xbt_dynar_free(&d);           /* end_of_doxygen */
 }
 
 
@@ -1159,23 +1164,27 @@ XBT_TEST_UNIT("string",test_dynar_string,"Dynars of strings") {
 /*******************************************************************************/
 /*******************************************************************************/
 #include "xbt/synchro.h"
-static void pusher_f(void *a) {
-  xbt_dynar_t d=(xbt_dynar_t)a;
+static void pusher_f(void *a)
+{
+  xbt_dynar_t d = (xbt_dynar_t) a;
   int i;
-  for (i=0; i<500; i++) {
-    xbt_dynar_push(d,&i);
+  for (i = 0; i < 500; i++) {
+    xbt_dynar_push(d, &i);
   }
 }
-static void poper_f(void *a) {
-  xbt_dynar_t d=(xbt_dynar_t)a;
+
+static void poper_f(void *a)
+{
+  xbt_dynar_t d = (xbt_dynar_t) a;
   int i;
   int data;
   xbt_ex_t e;
 
-  for (i=0; i<500; i++) {
+  for (i = 0; i < 500; i++) {
     TRY {
-      xbt_dynar_pop(d,&data);
-    } CATCH(e) {
+      xbt_dynar_pop(d, &data);
+    }
+    CATCH(e) {
       if (e.category == bound_error) {
         xbt_ex_free(e);
         i--;
@@ -1187,15 +1196,17 @@ static void poper_f(void *a) {
 }
 
 
-XBT_TEST_UNIT("synchronized int",test_dynar_sync_int,"Synchronized dynars of integers") {
+XBT_TEST_UNIT("synchronized int", test_dynar_sync_int,
+              "Synchronized dynars of integers")
+{
   /* Vars_decl [doxygen cruft] */
   xbt_dynar_t d;
-  xbt_thread_t pusher,poper;
+  xbt_thread_t pusher, poper;
 
   xbt_test_add0("==== Have a pusher and a popper on the dynar");
-  d=xbt_dynar_new_sync(sizeof(int),NULL);
-  pusher = xbt_thread_create("pusher",pusher_f,d);
-  poper = xbt_thread_create("poper",poper_f,d);
+  d = xbt_dynar_new_sync(sizeof(int), NULL);
+  pusher = xbt_thread_create("pusher", pusher_f, d);
+  poper = xbt_thread_create("poper", poper_f, d);
   xbt_thread_join(pusher);
   xbt_thread_join(poper);
   xbt_dynar_free(&d);
index 85edb74..0a9bdfe 100644 (file)
 
 #include "xbt/synchro.h"
 typedef struct xbt_dynar_s {
-  unsigned long          size;
-  unsigned long          used;
-  unsigned long          elmsize;
-  void           *data;
+  unsigned long size;
+  unsigned long used;
+  unsigned long elmsize;
+  void *data;
   void_f_pvoid_t free_f;
-  xbt_mutex_t    mutex;
+  xbt_mutex_t mutex;
 } s_xbt_dynar_t;
 
 #endif /* DYNAR_PRIVATE_H */
index 6ffba19..2182083 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "portable.h" /* execinfo when available */
+#include "portable.h"           /* execinfo when available */
 #include "xbt/ex.h"
 #include "xbt/str.h"
-#include "xbt/module.h" /* xbt_binary_name */
-#include "xbt_modinter.h" /* backtrace initialization headers */
-#include "xbt/synchro.h" /* xbt_thread_self */
+#include "xbt/module.h"         /* xbt_binary_name */
+#include "xbt_modinter.h"       /* backtrace initialization headers */
+#include "xbt/synchro.h"        /* xbt_thread_self */
 
 #include "gras/Virtu/virtu_interface.h" /* gras_os_myname */
 #include "xbt/ex_interface.h"
 
 #undef HAVE_BACKTRACE
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
-# define HAVE_BACKTRACE 1 /* Hello linux box */
+# define HAVE_BACKTRACE 1       /* Hello linux box */
 #endif
 
 #if defined(WIN32) && defined(_M_IX86) && !defined(__GNUC__)
-# define HAVE_BACKTRACE 1 /* Hello x86 windows box */
+# define HAVE_BACKTRACE 1       /* Hello x86 windows box */
 #endif
 
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ex,xbt,"Exception mecanism");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ex, xbt, "Exception mecanism");
 
 /* default __ex_ctx callback function */
-ex_ctx_t *__xbt_ex_ctx_default(void) {
+ex_ctx_t *__xbt_ex_ctx_default(void)
+{
   /* Don't scream: this is a default which is never used (so, yes,
      there is one setjump container by running entity).
 
@@ -54,26 +55,27 @@ ex_ctx_t *__xbt_ex_ctx_default(void) {
 }
 
 /* Change raw libc symbols to file names and line numbers */
-void xbt_ex_setup_backtrace(xbt_ex_t *e);
+void xbt_ex_setup_backtrace(xbt_ex_t * e);
 
-void xbt_backtrace_display(xbt_ex_t *e) {
+void xbt_backtrace_display(xbt_ex_t * e)
+{
   xbt_ex_setup_backtrace(e);
 
 #ifdef HAVE_BACKTRACE
   if (e->used == 0) {
-    fprintf(stderr,"(backtrace not set)\n");
+    fprintf(stderr, "(backtrace not set)\n");
   } else {
     int i;
 
-    fprintf(stderr,"Backtrace (displayed in thread %p):\n",
-            (void*)xbt_thread_self());
-    for (i=1; i<e->used; i++) /* no need to display "xbt_display_backtrace" */
-      fprintf(stderr,"---> %s\n",e->bt_strings[i] +4);
+    fprintf(stderr, "Backtrace (displayed in thread %p):\n",
+            (void *) xbt_thread_self());
+    for (i = 1; i < e->used; i++)       /* no need to display "xbt_display_backtrace" */
+      fprintf(stderr, "---> %s\n", e->bt_strings[i] + 4);
   }
 
   /* don't fool xbt_ex_free with uninitialized msg field */
-  e->msg=NULL;
-  e->remote=0;
+  e->msg = NULL;
+  e->remote = 0;
   xbt_ex_free(*e);
 #else
 
@@ -82,7 +84,8 @@ void xbt_backtrace_display(xbt_ex_t *e) {
 }
 
 /** \brief show the backtrace of the current point (lovely while debuging) */
-void xbt_backtrace_display_current(void) {
+void xbt_backtrace_display_current(void)
+{
   xbt_ex_t e;
   xbt_backtrace_current(&e);
   xbt_backtrace_display(&e);
@@ -97,20 +100,21 @@ void xbt_backtrace_display_current(void) {
 #endif
 
 /** @brief shows an exception content and the associated stack if available */
-void xbt_ex_display(xbt_ex_t *e)  {
-  char *thrower=NULL;
+void xbt_ex_display(xbt_ex_t * e)
+{
+  char *thrower = NULL;
 
   if (e->remote)
-    thrower = bprintf(" on host %s(%d)",e->host,e->pid);
+    thrower = bprintf(" on host %s(%d)", e->host, e->pid);
 
   fprintf(stderr,
           "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n"
           "** %s\n"
           "** Thrown by %s()%s\n",
-          gras_os_myname(),(*xbt_getpid)(),
+          gras_os_myname(), (*xbt_getpid) (),
           xbt_ex_catname(e->category), e->value, e->msg,
-          e->procname,thrower?thrower:" in this process");
-  CRITICAL1("%s",e->msg);
+          e->procname, thrower ? thrower : " in this process");
+  CRITICAL1("%s", e->msg);
 
   if (!e->remote && !e->bt_strings)
     xbt_ex_setup_backtrace(e);
@@ -120,34 +124,38 @@ void xbt_ex_display(xbt_ex_t *e)  {
   {
     int i;
 
-    fprintf(stderr,"\n");
-    for (i=0; i<e->used; i++)
-      fprintf(stderr,"%s\n",e->bt_strings[i]);
+    fprintf(stderr, "\n");
+    for (i = 0; i < e->used; i++)
+      fprintf(stderr, "%s\n", e->bt_strings[i]);
 
   }
 #else
-  fprintf(stderr," at %s:%d:%s (no backtrace available on that arch)\n",
-          e->file,e->line,e->func);
+  fprintf(stderr, " at %s:%d:%s (no backtrace available on that arch)\n",
+          e->file, e->line, e->func);
 #endif
 }
 
 
 /* default __ex_terminate callback function */
-void __xbt_ex_terminate_default(xbt_ex_t *e)  {
+void __xbt_ex_terminate_default(xbt_ex_t * e)
+{
   xbt_ex_display(e);
 
   abort();
 }
 
 /* the externally visible API */
-XBT_EXPORT_NO_IMPORT(ex_ctx_cb_t)  __xbt_ex_ctx       = &__xbt_ex_ctx_default;
-XBT_EXPORT_NO_IMPORT(ex_term_cb_t) __xbt_ex_terminate = &__xbt_ex_terminate_default;
+XBT_EXPORT_NO_IMPORT(ex_ctx_cb_t) __xbt_ex_ctx = &__xbt_ex_ctx_default;
+XBT_EXPORT_NO_IMPORT(ex_term_cb_t) __xbt_ex_terminate =
+  &__xbt_ex_terminate_default;
 
 
-void xbt_ex_free(xbt_ex_t e) {
+     void xbt_ex_free(xbt_ex_t e)
+{
   int i;
 
-  if (e.msg) free(e.msg);
+  if (e.msg)
+    free(e.msg);
   if (e.remote) {
     free(e.procname);
     free(e.file);
@@ -156,25 +164,35 @@ void xbt_ex_free(xbt_ex_t e) {
   }
 
   if (e.bt_strings) {
-    for (i=0; i<e.used; i++)
-      free((char*)e.bt_strings[i]);
-    free((char **)e.bt_strings);
+    for (i = 0; i < e.used; i++)
+      free((char *) e.bt_strings[i]);
+    free((char **) e.bt_strings);
   }
   /* memset(e,0,sizeof(xbt_ex_t)); */
 }
 
 /** \brief returns a short name for the given exception category */
-const char * xbt_ex_catname(xbt_errcat_t cat) {
+const char *xbt_ex_catname(xbt_errcat_t cat)
+{
   switch (cat) {
-    case unknown_error:   return  "unknown_err";
-    case arg_error:       return "invalid_arg";
-    case mismatch_error:  return "mismatch";
-    case not_found_error: return "not found";
-    case system_error:    return "system_err";
-    case network_error:   return "network_err";
-    case timeout_error:   return "timeout";
-    case thread_error:    return "thread_err";
-    default:              return "INVALID_ERR";
+  case unknown_error:
+    return "unknown_err";
+  case arg_error:
+    return "invalid_arg";
+  case mismatch_error:
+    return "mismatch";
+  case not_found_error:
+    return "not found";
+  case system_error:
+    return "system_err";
+  case network_error:
+    return "network_err";
+  case timeout_error:
+    return "timeout";
+  case thread_error:
+    return "thread_err";
+  default:
+    return "INVALID_ERR";
   }
 }
 
@@ -183,11 +201,12 @@ const char * xbt_ex_catname(xbt_errcat_t cat) {
 #include <stdio.h>
 #include "xbt/ex.h"
 
-XBT_TEST_SUITE("xbt_ex","Exception Handling");
+XBT_TEST_SUITE("xbt_ex", "Exception Handling");
 
-XBT_TEST_UNIT("controlflow",test_controlflow, "basic nested control flow") {
+XBT_TEST_UNIT("controlflow", test_controlflow, "basic nested control flow")
+{
   xbt_ex_t ex;
-  volatile int n=1;
+  volatile int n = 1;
 
   xbt_test_add0("basic nested control flow");
 
@@ -199,8 +218,9 @@ XBT_TEST_UNIT("controlflow",test_controlflow, "basic nested control flow") {
       if (n != 2)
         xbt_test_fail1("M2: n=%d (!= 2)", n);
       n++;
-      THROW0(unknown_error,0,"something");
-    } CATCH (ex) {
+      THROW0(unknown_error, 0, "something");
+    }
+    CATCH(ex) {
       if (n != 3)
         xbt_test_fail1("M3: n=%d (!= 3)", n);
       n++;
@@ -211,8 +231,9 @@ XBT_TEST_UNIT("controlflow",test_controlflow, "basic nested control flow") {
       if (n != 5)
         xbt_test_fail1("M2: n=%d (!= 5)", n);
       n++;
-      THROW0(unknown_error,0,"something");
-    } CATCH (ex) {
+      THROW0(unknown_error, 0, "something");
+    }
+    CATCH(ex) {
       if (n != 6)
         xbt_test_fail1("M3: n=%d (!= 6)", n);
       n++;
@@ -231,24 +252,27 @@ XBT_TEST_UNIT("controlflow",test_controlflow, "basic nested control flow") {
     xbt_test_fail1("M5: n=%d (!= 8)", n);
 }
 
-XBT_TEST_UNIT("value",test_value,"exception value passing") {
+XBT_TEST_UNIT("value", test_value, "exception value passing")
+{
   xbt_ex_t ex;
 
   TRY {
     THROW0(unknown_error, 2, "toto");
-  } CATCH(ex) {
+  }
+  CATCH(ex) {
     xbt_test_add0("exception value passing");
     if (ex.category != unknown_error)
       xbt_test_fail1("category=%d (!= 1)", ex.category);
     if (ex.value != 2)
       xbt_test_fail1("value=%d (!= 2)", ex.value);
-    if (strcmp(ex.msg,"toto"))
+    if (strcmp(ex.msg, "toto"))
       xbt_test_fail1("message=%s (!= toto)", ex.msg);
     xbt_ex_free(ex);
   }
 }
 
-XBT_TEST_UNIT("variables",test_variables,"variable value preservation") {
+XBT_TEST_UNIT("variables", test_variables, "variable value preservation")
+{
   xbt_ex_t ex;
   int r1, r2;
   volatile int v1, v2;
@@ -271,7 +295,8 @@ XBT_TEST_UNIT("variables",test_variables,"variable value preservation") {
   }
 }
 
-XBT_TEST_UNIT("cleanup",test_cleanup,"cleanup handling") {
+XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling")
+{
   xbt_ex_t ex;
   volatile int v1;
   int c;
@@ -287,10 +312,11 @@ XBT_TEST_UNIT("cleanup",test_cleanup,"cleanup handling") {
     if (v1 != 5678)
       xbt_test_fail1("v1 = %d (!= 5678)", v1);
     c = 1;
-  } CATCH(ex) {
+  }
+  CATCH(ex) {
     if (v1 != 5678)
       xbt_test_fail1("v1 = %d (!= 5678)", v1);
-    if (!(ex.category == 1 && ex.value == 2 && !strcmp(ex.msg,"blah")))
+    if (!(ex.category == 1 && ex.value == 2 && !strcmp(ex.msg, "blah")))
       xbt_test_fail0("unexpected exception contents");
     xbt_ex_free(ex);
   }
@@ -304,15 +330,20 @@ XBT_TEST_UNIT("cleanup",test_cleanup,"cleanup handling") {
  * idea to check its syntax even if we don't try to run it.
  * And actually, it allows to put comments in the code despite doxygen.
  */
-static char *mallocex(int size) {
+static char *mallocex(int size)
+{
   return NULL;
 }
+
 #define SMALLAMOUNT 10
 #define TOOBIG 100000000
 
-#if 0 /* this contains syntax errors, actually */
-static void bad_example(void) {
-  struct {char*first;} *globalcontext;
+#if 0                           /* this contains syntax errors, actually */
+static void bad_example(void)
+{
+  struct {
+    char *first;
+  } *globalcontext;
   ex_t ex;
 
   /* BAD_EXAMPLE */
@@ -326,43 +357,51 @@ static void bad_example(void) {
     strcpy(cp1, "foo");
     strcpy(cp2, "bar");
   } CLEANUP {
-    if (cp3 != NULL) free(cp3);
-    if (cp2 != NULL) free(cp2);
-    if (cp1 != NULL) free(cp1);
-  } CATCH(ex) {
+    if (cp3 != NULL)
+      free(cp3);
+    if (cp2 != NULL)
+      free(cp2);
+    if (cp1 != NULL)
+      free(cp1);
+  }
+  CATCH(ex) {
     printf("cp3=%s", cp3);
     RETHROW;
   }
   /* end_of_bad_example */
 }
 #endif
-typedef struct {char *first;} global_context_t;
+typedef struct {
+  char *first;
+} global_context_t;
 
-static void good_example(void) {
-  global_context_t *global_context=malloc(sizeof(global_context_t));
+static void good_example(void)
+{
+  global_context_t *global_context = malloc(sizeof(global_context_t));
   xbt_ex_t ex;
 
   /* GOOD_EXAMPLE */
-  { /*01*/
-    char * volatile /*03*/ cp1 = NULL /*02*/;
-    char * volatile /*03*/ cp2 = NULL /*02*/;
-    char * volatile /*03*/ cp3 = NULL /*02*/;
+  {                             /*01 */
+    char *volatile /*03 */ cp1 = NULL /*02 */ ;
+    char *volatile /*03 */ cp2 = NULL /*02 */ ;
+    char *volatile /*03 */ cp3 = NULL /*02 */ ;
     TRY {
       cp1 = mallocex(SMALLAMOUNT);
       global_context->first = cp1;
-      cp1 = NULL /*05 give away*/;
+      cp1 = NULL /*05 give away */ ;
       cp2 = mallocex(TOOBIG);
       cp3 = mallocex(SMALLAMOUNT);
       strcpy(cp1, "foo");
       strcpy(cp2, "bar");
-    } CLEANUP { /*04*/
-      printf("cp3=%s", cp3 == NULL /*02*/ ? "" : cp3);
+    } CLEANUP {                 /*04 */
+      printf("cp3=%s", cp3 == NULL /*02 */ ? "" : cp3);
       if (cp3 != NULL)
         free(cp3);
       if (cp2 != NULL)
         free(cp2);
       /*05 cp1 was given away */
-    } CATCH(ex) {
+    }
+    CATCH(ex) {
       /*05 global context untouched */
       RETHROW;
     }
index 89ebbcf..3bcbf1f 100644 (file)
 
 #include "xbt/ex.h"
 /* The display made by an uncatched exception */
-void xbt_ex_display(xbt_ex_t *e);
+void xbt_ex_display(xbt_ex_t * e);
 
 /* Change raw libc symbols to file names and line numbers */
-void xbt_ex_setup_backtrace(xbt_ex_t *e);
-
-#endif  /* _XBT_EX_INTERFACE_H_ */
+void xbt_ex_setup_backtrace(xbt_ex_t * e);
 
+#endif /* _XBT_EX_INTERFACE_H_ */
index 8e5ad69..de76e64 100644 (file)
 #include "fifo_private.h"
 #include "xbt_modinter.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_fifo,xbt,"FIFO");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_fifo, xbt, "FIFO");
 
-static voidfifo_item_mallocator_new_f(void);
-static void fifo_item_mallocator_free_f(voiditem);
-static void fifo_item_mallocator_reset_f(voiditem);
+static void *fifo_item_mallocator_new_f(void);
+static void fifo_item_mallocator_free_f(void *item);
+static void fifo_item_mallocator_reset_f(void *item);
 
 static xbt_mallocator_t item_mallocator = NULL;
 
@@ -25,7 +25,7 @@ static xbt_mallocator_t item_mallocator = NULL;
 xbt_fifo_t xbt_fifo_new(void)
 {
   xbt_fifo_t fifo;
-  fifo = xbt_new0(struct xbt_fifo,1);
+  fifo = xbt_new0(struct xbt_fifo, 1);
 
   if (item_mallocator == NULL) {
     item_mallocator = xbt_mallocator_new(256,
@@ -46,7 +46,7 @@ void xbt_fifo_free(xbt_fifo_t l)
   xbt_fifo_item_t b, tmp;
 
   for (b = xbt_fifo_get_first_item(l); b;
-  tmp = b, b = b->next, xbt_fifo_free_item(tmp));
+       tmp = b, b = b->next, xbt_fifo_free_item(tmp));
   xbt_free(l);
   return;
 }
@@ -65,7 +65,7 @@ xbt_fifo_item_t xbt_fifo_push(xbt_fifo_t l, void *t)
   new = xbt_fifo_new_item();
   new->content = t;
 
-  xbt_fifo_push_item(l,new);
+  xbt_fifo_push_item(l, new);
   return new;
 }
 
@@ -81,8 +81,10 @@ void *xbt_fifo_pop(xbt_fifo_t l)
   xbt_fifo_item_t item;
   void *content;
 
-  if(l==NULL) return NULL;
-  if(!(item = xbt_fifo_pop_item(l))) return NULL;
+  if (l == NULL)
+    return NULL;
+  if (!(item = xbt_fifo_pop_item(l)))
+    return NULL;
 
   content = item->content;
   xbt_fifo_free_item(item);
@@ -102,7 +104,7 @@ xbt_fifo_item_t xbt_fifo_unshift(xbt_fifo_t l, void *t)
 
   new = xbt_fifo_new_item();
   new->content = t;
-  xbt_fifo_unshift_item(l,new);
+  xbt_fifo_unshift_item(l, new);
   return new;
 }
 
@@ -118,8 +120,10 @@ void *xbt_fifo_shift(xbt_fifo_t l)
   xbt_fifo_item_t item;
   void *content;
 
-  if(l==NULL) return NULL;
-  if(!(item = xbt_fifo_shift_item(l))) return NULL;
+  if (l == NULL)
+    return NULL;
+  if (!(item = xbt_fifo_shift_item(l)))
+    return NULL;
 
   content = item->content;
   xbt_fifo_free_item(item);
@@ -134,7 +138,7 @@ void *xbt_fifo_shift(xbt_fifo_t l)
  */
 void xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t new)
 {
-  xbt_assert0((new->next == NULL)&&(new->prev == NULL),"Invalid item!");
+  xbt_assert0((new->next == NULL) && (new->prev == NULL), "Invalid item!");
   (l->count)++;
   if (l->head == NULL) {
     l->head = new;
@@ -182,7 +186,7 @@ xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t l)
  */
 void xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t new)
 {
-  xbt_assert0((new->next == NULL)&&(new->prev == NULL),"Invalid item!");
+  xbt_assert0((new->next == NULL) && (new->prev == NULL), "Invalid item!");
   (l->count)++;
   if (l->head == NULL) {
     l->head = new;
@@ -231,7 +235,7 @@ xbt_fifo_item_t xbt_fifo_shift_item(xbt_fifo_t l)
  * \warning it will not remove duplicates
  * \return 1 if an item was removed and 0 otherwise.
  */
-int  xbt_fifo_remove(xbt_fifo_t l, void *t)
+int xbt_fifo_remove(xbt_fifo_t l, void *t)
 {
   xbt_fifo_item_t current, current_next;
 
@@ -257,10 +261,10 @@ int  xbt_fifo_remove(xbt_fifo_t l, void *t)
  * removes all occurences of \a t from \a l.
  * \return 1 if an item was removed and 0 otherwise.
  */
-int  xbt_fifo_remove_all(xbt_fifo_t l, void *t)
+int xbt_fifo_remove_all(xbt_fifo_t l, void *t)
 {
   xbt_fifo_item_t current, current_next;
-  int res=0;
+  int res = 0;
 
   for (current = l->head; current; current = current_next) {
     current_next = current->next;
@@ -269,7 +273,7 @@ int  xbt_fifo_remove_all(xbt_fifo_t l, void *t)
     /* remove the item */
     xbt_fifo_remove_item(l, current);
     xbt_fifo_free_item(current);
-    res=1;
+    res = 1;
   }
   return res;
 }
@@ -283,8 +287,8 @@ int  xbt_fifo_remove_all(xbt_fifo_t l, void *t)
  */
 void xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t current)
 {
-  if (l->head == l->tail) {    /* special case */
-    xbt_assert0((current==l->head),"This item is not in the list!");
+  if (l->head == l->tail) {     /* special case */
+    xbt_assert0((current == l->head), "This item is not in the list!");
     l->head = NULL;
     l->tail = NULL;
     (l->count)--;
@@ -292,13 +296,13 @@ void xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t current)
     return;
   }
 
-  if (current == l->head) {    /* It's the head */
+  if (current == l->head) {     /* It's the head */
     l->head = current->next;
     l->head->prev = NULL;
-  } else if (current == l->tail) {     /* It's the tail */
+  } else if (current == l->tail) {      /* It's the tail */
     l->tail = current->prev;
     l->tail->next = NULL;
-  } else {                     /* It's in the middle */
+  } else {                      /* It's in the middle */
     current->prev->next = current->next;
     current->next->prev = current->prev;
   }
@@ -361,15 +365,18 @@ xbt_fifo_t xbt_fifo_copy(xbt_fifo_t f)
 }
 
 /* Functions passed to the mallocator constructor */
-static void* fifo_item_mallocator_new_f(void) {
+static void *fifo_item_mallocator_new_f(void)
+{
   return xbt_new(s_xbt_fifo_item_t, 1);
 }
 
-static void fifo_item_mallocator_free_f(void* item) {
+static void fifo_item_mallocator_free_f(void *item)
+{
   xbt_free(item);
 }
 
-static void fifo_item_mallocator_reset_f(void* item) {
+static void fifo_item_mallocator_reset_f(void *item)
+{
   /* memset to zero like calloc */
   memset(item, 0, sizeof(s_xbt_fifo_item_t));
 }
@@ -396,9 +403,9 @@ xbt_fifo_item_t xbt_fifo_newitem(void)
  *
  * stores \a v in \a i.
  */
-void xbt_fifo_set_item_content(xbt_fifo_item_t i , void *v)
+void xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v)
 {
-  xbt_fifo_setItemcontent(i,v);
+  xbt_fifo_setItemcontent(i, v);
 }
 
 /**
@@ -463,7 +470,8 @@ xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l)
  */
 xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i)
 {
-  if(i) return i->next;
+  if (i)
+    return i->next;
   return NULL;
 }
 
@@ -481,7 +489,8 @@ xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i)
  */
 xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i)
 {
-  if(i) return i->prev;
+  if (i)
+    return i->prev;
   return NULL;
 }
 
@@ -497,7 +506,8 @@ xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i)
  * Destroy the fifo item mallocator.
  * This is an internal XBT function called by xbt_exit().
  */
-void xbt_fifo_exit(void) {
+void xbt_fifo_exit(void)
+{
   if (item_mallocator != NULL) {
     xbt_mallocator_free(item_mallocator);
     item_mallocator = NULL;
@@ -505,5 +515,3 @@ void xbt_fifo_exit(void) {
 }
 
 /* @} */
-
-
index 02470db..b8a74ef 100644 (file)
@@ -47,4 +47,4 @@ typedef struct xbt_fifo {
 /*   return NULL; */
 /* } */
 
-#endif                         /* _XBT_FIFO_PRIVATE_H */
+#endif /* _XBT_FIFO_PRIVATE_H */
index 53341c8..670584b 100644 (file)
@@ -68,7 +68,7 @@ xbt_edge_t xbt_graph_new_edge(xbt_graph_t g,
   xbt_dynar_push(src->out, &edge);
   if (g->directed)
     xbt_dynar_push(dst->in, &edge);
-  else                         /* only the "out" field is used */
+  else                          /* only the "out" field is used */
     xbt_dynar_push(dst->out, &edge);
 
   edge->data = data;
@@ -86,13 +86,15 @@ xbt_edge_t xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst)
   unsigned int cursor;
 
   xbt_dynar_foreach(src->out, cursor, edge) {
-    DEBUG3("%p = %p--%p",edge,edge->src,edge->dst);
-    if((edge->src==src) && (edge->dst==dst)) return edge;
+    DEBUG3("%p = %p--%p", edge, edge->src, edge->dst);
+    if ((edge->src == src) && (edge->dst == dst))
+      return edge;
   }
-  if(!g->directed) {
+  if (!g->directed) {
     xbt_dynar_foreach(src->out, cursor, edge) {
-      DEBUG3("%p = %p--%p",edge,edge->src,edge->dst);
-      if((edge->dst==src) && (edge->src==dst)) return edge;
+      DEBUG3("%p = %p--%p", edge, edge->src, edge->dst);
+      if ((edge->dst == src) && (edge->src == dst))
+        return edge;
     }
   }
   return NULL;
@@ -140,23 +142,23 @@ void xbt_graph_free_graph(xbt_graph_t g,
     xbt_dynar_free(&(node->out));
     xbt_dynar_free(&(node->in));
     if (node_free_function)
-      (*node_free_function)(node->data);
+      (*node_free_function) (node->data);
   }
 
   xbt_dynar_foreach(g->edges, cursor, edge) {
     if (edge_free_function)
-      (*edge_free_function)(edge->data);
+      (*edge_free_function) (edge->data);
   }
 
   xbt_dynar_foreach(g->nodes, cursor, node)
-  free(node);
+    free(node);
   xbt_dynar_free(&(g->nodes));
 
   xbt_dynar_foreach(g->edges, cursor, edge)
-  free(edge);
+    free(edge);
   xbt_dynar_free(&(g->edges));
-  if(graph_free_function)
-    (*graph_free_function)(g->data);
+  if (graph_free_function)
+    (*graph_free_function) (g->data);
   free(g);
 
   return;
@@ -182,15 +184,15 @@ void xbt_graph_free_node(xbt_graph_t g, xbt_node_t n,
     if ((edge->dst == n) || (edge->src == n)) {
       xbt_graph_free_edge(g, edge, edge_free_function);
     } else
-      cursor ++;
+      cursor++;
   }
 
   if ((node_free_function) && (n->data))
-    (*node_free_function)(n->data);
+    (*node_free_function) (n->data);
 
   cursor = 0;
   xbt_dynar_foreach(g->nodes, cursor, node)
-  if (node == n)
+    if (node == n)
     xbt_dynar_cursor_rm(g->nodes, &cursor);
 
   xbt_dynar_free(&(n->in));
@@ -210,14 +212,14 @@ void xbt_graph_free_edge(xbt_graph_t g, xbt_edge_t e,
   xbt_edge_t edge = NULL;
 
   if ((free_function) && (e->data))
-    (*free_function)(e->data);
+    (*free_function) (e->data);
 
   xbt_dynar_foreach(g->edges, cursor, edge) {
     if (edge == e) {
       if (g->directed) {
         idx = __xbt_find_in_dynar(edge->dst->in, edge);
         xbt_dynar_remove_at(edge->dst->in, idx, NULL);
-      } else {                 /* only the out field is used */
+      } else {                  /* only the out field is used */
         idx = __xbt_find_in_dynar(edge->dst->out, edge);
         xbt_dynar_remove_at(edge->dst->out, idx, NULL);
       }
@@ -314,7 +316,7 @@ double *xbt_graph_get_length_matrix(xbt_graph_t g)
     xbt_dynar_foreach(node->out, in_cursor, edge) {
       if (edge->dst == node)
         idx = __xbt_find_in_dynar(g->nodes, edge->src);
-      else                     /*case of  undirected graphs */
+      else                      /*case of  undirected graphs */
         idx = __xbt_find_in_dynar(g->nodes, edge->dst);
       D(cursor, idx) = edge->length;
     }
@@ -446,7 +448,7 @@ xbt_edge_t *xbt_graph_spanning_tree_prim(xbt_graph_t g)
   node->xbtdata = (void *) 1;
   edge_list = node->out;
   xbt_dynar_foreach(edge_list, cursor, e)
-  xbt_heap_push(heap, e, -(e->length));
+    xbt_heap_push(heap, e, -(e->length));
 
   while ((edge = xbt_heap_pop(heap))) {
     if ((edge->src->xbtdata) && (edge->dst->xbtdata))
@@ -500,10 +502,10 @@ xbt_node_t *xbt_graph_topo_sort(xbt_graph_t g)
   sorted = xbt_malloc(n * sizeof(xbt_node_t));
 
   xbt_dynar_foreach(g->nodes, cursor, node)
-  node->xbtdata = xbt_new0(int, 1);
+    node->xbtdata = xbt_new0(int, 1);
 
   xbt_dynar_foreach(g->nodes, cursor, node)
-  xbt_graph_depth_visit(g, node, sorted, &idx);
+    xbt_graph_depth_visit(g, node, sorted, &idx);
 
   xbt_dynar_foreach(g->nodes, cursor, node) {
     free(node->xbtdata);
@@ -541,9 +543,9 @@ static xbt_graph_t parsed_graph = NULL;
 static xbt_dict_t parsed_nodes = NULL;
 
 static void *(*__parse_node_label_and_data) (xbt_node_t, const char *,
-    const char *) = NULL;
+                                             const char *) = NULL;
 static void *(*__parse_edge_label_and_data) (xbt_edge_t, const char *,
-    const char *) = NULL;
+                                             const char *) = NULL;
 
 static void __parse_graph_begin(void)
 {
@@ -570,10 +572,8 @@ static void __parse_node(void)
   if (__parse_node_label_and_data)
     node->data = __parse_node_label_and_data(node, A_graphxml_node_label,
                                              A_graphxml_node_data);
-  xbt_graph_parse_get_double(&(node->position_x),
-                             A_graphxml_node_position_x);
-  xbt_graph_parse_get_double(&(node->position_y),
-                             A_graphxml_node_position_y);
+  xbt_graph_parse_get_double(&(node->position_x), A_graphxml_node_position_x);
+  xbt_graph_parse_get_double(&(node->position_y), A_graphxml_node_position_y);
 
   xbt_dict_set(parsed_nodes, A_graphxml_node_name, (void *) node, NULL);
 }
@@ -583,9 +583,9 @@ static void __parse_edge(void)
   xbt_edge_t edge = xbt_graph_new_edge(parsed_graph,
                                        xbt_dict_get(parsed_nodes,
                                                     A_graphxml_edge_source),
-                                                    xbt_dict_get(parsed_nodes,
-                                                                 A_graphxml_edge_target),
-                                                                 NULL);
+                                       xbt_dict_get(parsed_nodes,
+                                                    A_graphxml_edge_target),
+                                       NULL);
 
   if (__parse_edge_label_and_data)
     edge->data = __parse_edge_label_and_data(edge, A_graphxml_edge_label,
@@ -601,11 +601,11 @@ static void __parse_edge(void)
 /** @brief Import a graph from a file following the GraphXML format */
 xbt_graph_t xbt_graph_read(const char *filename,
                            void *(*node_label_and_data) (xbt_node_t,
-                               const char *,
-                               const char *),
-                               void *(*edge_label_and_data) (xbt_edge_t,
-                                   const char *,
-                                   const char *))
+                                                         const char *,
+                                                         const char *),
+                           void *(*edge_label_and_data) (xbt_edge_t,
+                                                         const char *,
+                                                         const char *))
 {
 
   xbt_graph_t graph = NULL;
@@ -621,7 +621,7 @@ xbt_graph_t xbt_graph_read(const char *filename,
   ETag_graphxml_edge_fun = __parse_edge;
 
   xbt_graph_parse_open(filename);
-  xbt_assert1((!(*xbt_graph_parse)()), "Parse error in %s", filename);
+  xbt_assert1((!(*xbt_graph_parse) ()), "Parse error in %s", filename);
   xbt_graph_parse_close();
 
   graph = parsed_graph;
index 2c7cef2..4f6645a 100644 (file)
 
 /* Node structure */
 /* typedef struct xbt_node *xbt_node_t; */
-typedef struct xbt_node 
-{
+typedef struct xbt_node {
   xbt_dynar_t out;
-  xbt_dynar_t in;  /* not used when the graph is directed */
-  double position_x; /* positive value: negative means undefined */
-  double position_y; /* positive value: negative means undefined */
-  void *data;      /* user data */
-  void *xbtdata;   /* private xbt data: should be reinitialized at the
-                     beginning of your algorithm if you need to use it */  
+  xbt_dynar_t in;               /* not used when the graph is directed */
+  double position_x;            /* positive value: negative means undefined */
+  double position_y;            /* positive value: negative means undefined */
+  void *data;                   /* user data */
+  void *xbtdata;                /* private xbt data: should be reinitialized at the
+                                   beginning of your algorithm if you need to use it */
 } s_xbt_node_t;
 
 /* edge structure */
 /* typedef struct xbt_edge *xbt_edge_t; */
-typedef struct xbt_edge 
-{
+typedef struct xbt_edge {
   xbt_node_t src;
   xbt_node_t dst;
-  void *data;      /* user data */
-  void *xbtdata;   /* private xbt data: should be reinitialized at the
-                     beginning of your algorithm if you need to use it */  
-  double length;   /* positive value: negative means undefined */
+  void *data;                   /* user data */
+  void *xbtdata;                /* private xbt data: should be reinitialized at the
+                                   beginning of your algorithm if you need to use it */
+  double length;                /* positive value: negative means undefined */
 } s_xbt_edge_t;
 
 /* Graph structure */
 /* typedef struct xbt_graph *xbt_graph_t; */
-typedef struct xbt_graph 
-{
+typedef struct xbt_graph {
   xbt_dynar_t nodes;
   xbt_dynar_t edges;
   unsigned short int directed;
-  void *data;      /* user data */
-  void *xbtdata;   /* private xbt data: should be reinitialized at the
-                     beginning of your algorithm if you need to use it */  
+  void *data;                   /* user data */
+  void *xbtdata;                /* private xbt data: should be reinitialized at the
+                                   beginning of your algorithm if you need to use it */
 } s_xbt_graph_t;
-void xbt_floyd_algorithm(xbt_graph_t g, double* adj,double* d,  xbt_node_t* p);
-void xbt_graph_depth_visit (xbt_graph_t g,xbt_node_t n,xbt_node_t* sorted,int* idx);
+void xbt_floyd_algorithm(xbt_graph_t g, double *adj, double *d,
+                         xbt_node_t * p);
+void xbt_graph_depth_visit(xbt_graph_t g, xbt_node_t n, xbt_node_t * sorted,
+                           int *idx);
 
-#endif                         /* _XBT_GRAPH_PRIVATE_H */
+#endif /* _XBT_GRAPH_PRIVATE_H */
index 0d4354c..856218c 100644 (file)
@@ -69,7 +69,7 @@ typedef uint32_t flex_uint32_t;
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
+typedef unsigned char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -111,15 +111,15 @@ typedef unsigned int flex_uint32_t;
 /* The "const" storage-class-modifier is valid. */
 #define YY_USE_CONST
 
-#else  /* ! __cplusplus */
+#else /* ! __cplusplus */
 
 /* C99 requires __STDC__ to be defined as 1. */
 #if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
 #define yyconst const
@@ -187,14 +187,14 @@ extern FILE *xbt_graph_parse_in, *xbt_graph_parse_out;
      *       a 5% performance hit in a non-xbt_graph_parse_lineno scanner, because yy_act is
      *       normally declared as a register variable-- so it is not worth it.
      */
-    #define  YY_LESS_LINENO(n) \
+#define  YY_LESS_LINENO(n) \
             do { \
                 int yyl;\
                 for ( yyl = n; yyl < xbt_graph_parse_leng; ++yyl )\
                     if ( xbt_graph_parse_text[yyl] == '\n' )\
                         --xbt_graph_parse_lineno;\
             }while(0)
-    
+
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
        do \
@@ -218,73 +218,72 @@ typedef size_t yy_size_t;
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-       {
-       FILE *yy_input_file;
-
-       char *yy_ch_buf;                /* input buffer */
-       char *yy_buf_pos;               /* current position in input buffer */
-
-       /* Size of input buffer in bytes, not including room for EOB
-        * characters.
-        */
-       yy_size_t yy_buf_size;
-
-       /* Number of characters read into yy_ch_buf, not including EOB
-        * characters.
-        */
-       int yy_n_chars;
-
-       /* Whether we "own" the buffer - i.e., we know we created it,
-        * and can realloc() it to grow it, and should free() it to
-        * delete it.
-        */
-       int yy_is_our_buffer;
-
-       /* Whether this is an "interactive" input source; if so, and
-        * if we're using stdio for input, then we want to use getc()
-        * instead of fread(), to make sure we stop fetching input after
-        * each newline.
-        */
-       int yy_is_interactive;
-
-       /* Whether we're considered to be at the beginning of a line.
-        * If so, '^' rules will be active on the next match, otherwise
-        * not.
-        */
-       int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-       /* Whether to try to fill the input buffer when we reach the
-        * end of it.
-        */
-       int yy_fill_buffer;
-
-       int yy_buffer_status;
+struct yy_buffer_state {
+  FILE *yy_input_file;
+
+  char *yy_ch_buf;              /* input buffer */
+  char *yy_buf_pos;             /* current position in input buffer */
+
+  /* Size of input buffer in bytes, not including room for EOB
+   * characters.
+   */
+  yy_size_t yy_buf_size;
+
+  /* Number of characters read into yy_ch_buf, not including EOB
+   * characters.
+   */
+  int yy_n_chars;
+
+  /* Whether we "own" the buffer - i.e., we know we created it,
+   * and can realloc() it to grow it, and should free() it to
+   * delete it.
+   */
+  int yy_is_our_buffer;
+
+  /* Whether this is an "interactive" input source; if so, and
+   * if we're using stdio for input, then we want to use getc()
+   * instead of fread(), to make sure we stop fetching input after
+   * each newline.
+   */
+  int yy_is_interactive;
+
+  /* Whether we're considered to be at the beginning of a line.
+   * If so, '^' rules will be active on the next match, otherwise
+   * not.
+   */
+  int yy_at_bol;
+
+  int yy_bs_lineno;   /**< The line count. */
+  int yy_bs_column;   /**< The column count. */
+
+  /* Whether to try to fill the input buffer when we reach the
+   * end of it.
+   */
+  int yy_fill_buffer;
+
+  int yy_buffer_status;
 
 #define YY_BUFFER_NEW 0
 #define YY_BUFFER_NORMAL 1
-       /* When an EOF's been seen but there's still some text to process
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-        * shouldn't try reading from the input source any more.  We might
-        * still have a bunch of tokens to match, though, because of
-        * possible backing-up.
-        *
-        * When we actually see the EOF, we change the status to "new"
-        * (via xbt_graph_parse_restart()), so that the user can continue scanning by
-        * just pointing xbt_graph_parse_in at a new input file.
-        */
+  /* When an EOF's been seen but there's still some text to process
+   * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+   * shouldn't try reading from the input source any more.  We might
+   * still have a bunch of tokens to match, though, because of
+   * possible backing-up.
+   *
+   * When we actually see the EOF, we change the status to "new"
+   * (via xbt_graph_parse_restart()), so that the user can continue scanning by
+   * just pointing xbt_graph_parse_in at a new input file.
+   */
 #define YY_BUFFER_EOF_PENDING 2
 
-       };
+};
 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
 /* Stack of input buffers. */
 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+static YY_BUFFER_STATE *yy_buffer_stack = 0;  /**< Stack as an array. */
 
 /* We provide macros for accessing buffer states in case in the
  * future we want to put the buffer states in a more general
@@ -303,40 +302,40 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
 /* yy_hold_char holds the character lost when xbt_graph_parse_text is formed. */
 static char yy_hold_char;
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */
+static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 int xbt_graph_parse_leng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0;                /* whether we need to initialize */
-static int yy_start = 0;       /* start state number */
+static int yy_init = 0;         /* whether we need to initialize */
+static int yy_start = 0;        /* start state number */
 
 /* Flag which is used to allow xbt_graph_parse_wrap()'s to do buffer switches
  * instead of setting up a fresh xbt_graph_parse_in.  A bit of a hack ...
  */
 static int yy_did_buffer_switch_on_eof;
 
-void xbt_graph_parse_restart (FILE *input_file  );
-void xbt_graph_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
-YY_BUFFER_STATE xbt_graph_parse__create_buffer (FILE *file,int size  );
-void xbt_graph_parse__delete_buffer (YY_BUFFER_STATE b  );
-void xbt_graph_parse__flush_buffer (YY_BUFFER_STATE b  );
-void xbt_graph_parse_push_buffer_state (YY_BUFFER_STATE new_buffer  );
-void xbt_graph_parse_pop_buffer_state (void );
+void xbt_graph_parse_restart(FILE * input_file);
+void xbt_graph_parse__switch_to_buffer(YY_BUFFER_STATE new_buffer);
+YY_BUFFER_STATE xbt_graph_parse__create_buffer(FILE * file, int size);
+void xbt_graph_parse__delete_buffer(YY_BUFFER_STATE b);
+void xbt_graph_parse__flush_buffer(YY_BUFFER_STATE b);
+void xbt_graph_parse_push_buffer_state(YY_BUFFER_STATE new_buffer);
+void xbt_graph_parse_pop_buffer_state(void);
 
-static void xbt_graph_parse_ensure_buffer_stack (void );
-static void xbt_graph_parse__load_buffer_state (void );
-static void xbt_graph_parse__init_buffer (YY_BUFFER_STATE b,FILE *file  );
+static void xbt_graph_parse_ensure_buffer_stack(void);
+static void xbt_graph_parse__load_buffer_state(void);
+static void xbt_graph_parse__init_buffer(YY_BUFFER_STATE b, FILE * file);
 
 #define YY_FLUSH_BUFFER xbt_graph_parse__flush_buffer(YY_CURRENT_BUFFER )
 
-YY_BUFFER_STATE xbt_graph_parse__scan_buffer (char *base,yy_size_t size  );
-YY_BUFFER_STATE xbt_graph_parse__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE xbt_graph_parse__scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE xbt_graph_parse__scan_buffer(char *base, yy_size_t size);
+YY_BUFFER_STATE xbt_graph_parse__scan_string(yyconst char *yy_str);
+YY_BUFFER_STATE xbt_graph_parse__scan_bytes(yyconst char *bytes, int len);
 
-void *xbt_graph_parse_alloc (yy_size_t  );
-void *xbt_graph_parse_realloc (void *,yy_size_t  );
-void xbt_graph_parse_free (void *  );
+void *xbt_graph_parse_alloc(yy_size_t);
+void *xbt_graph_parse_realloc(void *, yy_size_t);
+void xbt_graph_parse_free(void *);
 
 #define yy_new_buffer xbt_graph_parse__create_buffer
 
@@ -380,10 +379,10 @@ int xbt_graph_parse_lineno = 1;
 extern char *xbt_graph_parse_text;
 #define yytext_ptr xbt_graph_parse_text
 
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[]  );
+static yy_state_type yy_get_previous_state(void);
+static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
+static int yy_get_next_buffer(void);
+static void yy_fatal_error(yyconst char msg[]);
 
 /* Done after the current pattern has been matched and before the
  * corresponding action - sets up xbt_graph_parse_text.
@@ -399,637 +398,627 @@ static void yy_fatal_error (yyconst char msg[]  );
 #define YY_END_OF_BUFFER 93
 /* This struct is not used in this scanner,
    but its presence is necessary. */
-struct yy_trans_info
-       {
-       flex_int32_t yy_verify;
-       flex_int32_t yy_nxt;
-       };
-static yyconst flex_int16_t yy_accept[564] =
-    {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       93,   91,   17,   10,   10,   17,   17,   71,   10,   71,
-        5,    6,    5,    8,    9,    8,   87,   79,   80,   88,
-       85,   88,   86,   90,   79,   80,   90,   91,   26,   10,
-       26,   26,   26,   24,   26,   30,   10,   30,   30,   91,
-       91,   30,   91,   45,   10,   45,   45,   45,   43,   45,
-
-       45,   45,   45,   49,   10,   49,   91,   66,   10,   66,
-       66,   66,   64,   66,   66,   66,   66,   66,   70,   10,
-       70,   88,   87,   10,    0,    2,    2,    0,    4,    7,
-       82,   81,    0,    0,    0,    0,    0,    0,    0,   25,
-       27,   27,    0,    0,    0,    0,    0,    0,   44,   46,
-       46,   46,   46,   46,    0,   65,   67,   67,   67,   67,
-       67,   67,   67,    0,    0,    0,    0,    0,    0,    0,
-        3,    0,    0,    0,    0,    0,    0,    0,   89,    0,
-       27,    0,    0,    0,    0,    0,    0,    0,   46,   46,
-       46,   46,    0,    0,   67,   67,   67,   67,   67,   67,
-
-        0,    0,    0,   84,    0,   16,    1,    0,    0,   77,
-        0,    0,    0,   74,   73,    0,    0,   27,    0,    0,
-       29,    0,    0,    0,    0,    0,    0,   46,   46,   46,
-       46,    0,    0,   48,    0,   67,   67,   67,   67,   67,
-       67,    0,    0,   69,    0,    0,    0,    0,   78,   72,
-        0,    0,    0,   27,    0,   51,    0,   32,   31,   50,
-        0,    0,   46,    0,    0,   46,    0,    0,    0,   67,
-       67,    0,    0,   67,   67,    0,    0,    0,    0,    0,
-       12,    0,   75,   76,   19,   27,    0,   51,   18,   32,
-       31,   50,    0,   38,   37,    0,    0,    0,   36,   35,
-
-       46,    0,    0,   63,   62,    0,    0,   67,    0,   55,
-       54,   67,   67,    0,    0,    0,    0,    0,   11,   19,
-       27,    0,   18,    0,   34,   33,   46,    0,   47,    0,
-       53,   52,    0,    0,    0,    0,    0,    0,    0,   68,
-        0,    0,    0,    0,   27,    0,   28,   46,    0,   61,
-       60,    0,   57,   56,    0,   59,   58,    0,    0,    0,
-        0,   27,   46,   83,    0,    0,    0,   27,   46,   46,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-       40,   39,    0,   42,   41,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   12,    0,   12,    0,    0,   21,    0,
-       20,    0,    0,    0,    0,    0,    0,    0,   23,   22,
-        0,    0,    0,    0,    0,    0,    0,   11,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,   13,    0,    0,   14,
-        0,   15,    0
-    } ;
-
-static yyconst flex_int32_t yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    2,    4,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    5,    6,    7,    1,    1,    8,    9,    1,
-        1,    1,    1,    1,   10,   11,   12,   13,   13,   13,
-       13,   13,   13,   13,   13,   13,   13,   14,   15,   16,
-       17,   18,   19,    1,   20,   21,   22,   23,   24,   21,
-       14,   14,   14,   14,   14,   14,   25,   14,   26,   27,
-       14,   14,   28,   29,   14,   14,   14,   14,   30,   14,
-       31,    1,   32,    1,   33,    1,   34,   35,   36,   37,
-
-       38,   39,   40,   41,   42,   14,   14,   43,   44,   45,
-       46,   47,   48,   49,   50,   51,   52,   53,   14,   54,
-       55,   14,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst flex_int32_t yy_meta[56] =
-    {   0,
-        1,    2,    2,    2,    1,    1,    1,    1,    1,    3,
-        3,    1,    4,    5,    1,    1,    1,    6,    1,    7,
-        7,    7,    7,    7,    5,    5,    5,    5,    5,    5,
-        1,    1,    5,    7,    7,    7,    7,    7,    7,    5,
-        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
-        5,    5,    5,    5,    5
-    } ;
-
-static yyconst flex_int16_t yy_base[594] =
-    {   0,
-        0,    0,    0,    3,    6,    9,   24,   27,   11,   14,
-       15,   17,   29,   38,   45,   52,   59,   61,   67,   70,
-       93,  135,   73,   76,  111,  114,  117,  153,  156,  159,
-      176,  179,  182,  185,  200,  203,  206,  209,  225,    0,
-      279,  282,  285,  288,  304,    0,  358,  361,  363,  365,
-     1585, 1586, 1586,  380,  383,   47,   62, 1586,  386,  171,
-     1586, 1586, 1574, 1586, 1586, 1565, 1586, 1578, 1578,  365,
-     1586, 1586, 1586, 1586, 1576, 1576, 1546,  375, 1586,  389,
-     1559,    0,  195, 1586, 1526, 1586,  398,  391,  399,  402,
-      411,  414,  393, 1586,  420, 1557,    0,  401, 1586, 1540,
-
-     1539, 1538, 1525, 1586,  458,  422,  427, 1586,  464, 1552,
-        0,  409, 1586, 1535,    1, 1534, 1521, 1532, 1586,  467,
-      438, 1560, 1532,  470,   34, 1509, 1586, 1552, 1543, 1586,
-     1586, 1586,   69,   40, 1509, 1508, 1506, 1539, 1507, 1586,
-        0, 1532, 1514, 1516, 1503, 1505, 1504, 1512, 1586,    0,
-     1497, 1512, 1502, 1495, 1499, 1586,    0, 1492, 1507, 1496,
-     1496, 1487, 1489, 1499, 1505, 1517, 1516, 1523,  108, 1488,
-     1586,   75,    0, 1484, 1484, 1514, 1513, 1481, 1586, 1492,
-     1483,  473,  476, 1484, 1489, 1485, 1484, 1480, 1485, 1480,
-     1479, 1474,  479,  482, 1481, 1476, 1473, 1474, 1462, 1470,
-
-      485,  502, 1487, 1586, 1490, 1586, 1586,  110, 1464, 1586,
-     1491, 1490, 1454, 1586, 1586, 1452, 1455, 1452,  505,  508,
-     1586,  511, 1462, 1452, 1460, 1459, 1458,  514, 1452,  530,
-     1443,  533,  538, 1586,  546,  550, 1450, 1373,  555, 1387,
-     1375,  558,  566, 1586,  571, 1387,  435,  575, 1586, 1586,
-     1392, 1389, 1356, 1354,  578,  583, 1346,  588,  595,  598,
-      601,  604,  612,  617,  624, 1263,  620,  633,  637,  645,
-     1263,  649,  661, 1264, 1250,  653, 1280,  472, 1280,  657,
-     1586, 1279, 1586, 1586,  670, 1260,  674,  677,  680,  683,
-      686,  694,  697, 1586, 1586,  705,  710,  721, 1586, 1586,
-
-     1248,  729,  732, 1586, 1586,  740,  746,  756,  759, 1586,
-     1586,  767,  772,  775, 1264,   32,  104,  153, 1586,  778,
-     1226,  783,  788,  793, 1586, 1586, 1230,  801, 1586,  804,
-     1586, 1586,  812,  818,  828,  831,  839,  844,  855, 1586,
-     1234,  146,  179,  147, 1212,  858, 1586, 1215,  861, 1586,
-     1586,  875, 1586, 1586,  883, 1586, 1586, 1111,  891,  175,
-      445, 1066,  119, 1586,  894,  181,   89,  897,  900,  903,
-      501,  360,  399,  480,  475,  919,  922,  938,  941,  949,
-      954,  506,  509,  526,  599,  624,  965,  654,  678,  973,
-     1586, 1586,  981, 1586, 1586,  417,  176,  594,  548,  989,
-
-     1058, 1003, 1016,  937,  992,  407,  995,  998, 1001, 1018,
-      930,  918,  922,  910, 1026, 1029, 1035, 1038, 1055, 1063,
-     1081, 1113,  819,  790,  733,  616,  710, 1073,  721, 1131,
-      748,  284, 1149, 1181,  557,  565,  458,  449,  537,  770,
-      676,  805,  278,  369,  285,  291, 1076,  293, 1586,  211,
-     1586,  708,  693,  727,  162,  110,   76, 1105, 1586, 1586,
-      352,  735,  794,    5,  199,  820,  474, 1586, 1144,  850,
-     1173, 1199, 1207, 1212,  591,  754, 1220,  799,  831,  749,
-      833,  834,  848,  862,  897,  684,  791,  900,  912,  895,
-      901,  483,  808,  920,  930,  836,  890,  627,  892,  941,
-
-      962,  971,  993,  818,  873, 1005, 1007,  954,  960,  702,
-      872,  963, 1008, 1027, 1092, 1017, 1025, 1151, 1160, 1031,
-     1084, 1093, 1152, 1176, 1188, 1161, 1209, 1033, 1087, 1217,
-     1221, 1123, 1155, 1088, 1108, 1215, 1216, 1120, 1156, 1218,
-     1219, 1222, 1223, 1224, 1225, 1239, 1240, 1226, 1228, 1241,
-     1242, 1264, 1258, 1260, 1268, 1277, 1586, 1281, 1285, 1586,
-     1288, 1586, 1586, 1306, 1313, 1320, 1327, 1334, 1341, 1348,
-     1355, 1362, 1369, 1376, 1381, 1386, 1391, 1398, 1401, 1404,
-     1407, 1414, 1418, 1424, 1430, 1436, 1443, 1450, 1457, 1464,
-     1471, 1478, 1485
-
-    } ;
-
-static yyconst flex_int16_t yy_def[594] =
-    {   0,
-      564,  564,  565,  565,  565,  565,  566,  566,  567,  567,
-      568,  568,  569,  569,  569,  569,  570,  570,  564,  564,
-      571,  571,  572,  572,  572,  572,  564,  564,  572,  572,
-      564,  564,  572,  572,  572,  572,  564,  564,  563,   39,
-      573,  573,  564,  564,  563,   45,  574,  574,  569,  569,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  575,  563,  563,  575,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  576,  563,  563,  576,
-
-      576,  576,  576,  563,  563,  563,  563,  563,  563,  563,
-      577,  563,  563,  577,  577,  577,  577,  577,  563,  563,
-      563,  563,  563,  563,  578,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      575,  575,  579,  563,  563,  563,  563,  563,  563,  576,
-      576,  576,  576,  576,  580,  563,  577,  577,  577,  577,
-      577,  577,  577,  581,  563,  563,  582,  563,  582,  563,
-      563,  563,  583,  563,  563,  563,  563,  563,  563,  563,
-      575,  584,  584,  563,  563,  563,  563,  563,  576,  576,
-      576,  576,  585,  585,  577,  577,  577,  577,  577,  577,
-
-      586,  586,  563,  563,  582,  563,  563,  582,  563,  563,
-      583,  563,  563,  563,  563,  563,  563,  575,  563,  584,
-      563,  584,  563,  563,  563,  563,  563,  576,  576,  576,
-      576,  563,  585,  563,  585,  577,  577,  577,  577,  577,
-      577,  563,  586,  563,  586,  563,  582,  587,  563,  563,
-      563,  563,  563,  575,  584,  563,  563,  563,  563,  563,
-      563,  563,  576,  563,  563,  576,  585,  563,  563,  577,
-      577,  563,  563,  577,  577,  586,  563,  582,  587,  587,
-      563,  587,  563,  563,  563,  575,  584,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-
-      576,  585,  563,  563,  563,  563,  563,  577,  563,  563,
-      563,  577,  577,  586,  563,  582,  587,  587,  563,  563,
-      575,  584,  563,  563,  563,  563,  576,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  582,  587,  587,  575,  563,  563,  576,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  582,  587,
-      587,  575,  576,  563,  582,  587,  587,  575,  576,  576,
-      582,  582,  582,  587,  587,  563,  563,  563,  563,  563,
-      563,  582,  582,  582,  587,  587,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  582,  582,  582,  587,  587,
-
-      563,  563,  563,  563,  582,  582,  582,  587,  587,  587,
-      563,  563,  563,  563,  582,  582,  582,  587,  587,  587,
-      588,  589,  563,  563,  563,  563,  582,  582,  582,  587,
-      590,  591,  588,  589,  563,  563,  563,  563,  582,  582,
-      582,  590,  587,  592,  591,  593,  587,  563,  563,  563,
-      563,  582,  582,  582,  592,  563,  593,  587,  563,  563,
-      582,  582,  582,  563,  582,  582,  582,  563,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  582,  582,  582,  582,
-      582,  582,  582,  582,  582,  582,  563,  582,  582,  563,
-      582,  563,    0,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563
-
-    } ;
-
-static yyconst flex_int16_t yy_nxt[1642] =
-    {   0,
-      563,   54,   55,   54,   54,   55,   54,   54,   55,   54,
-       54,   55,   54,   62,  563,   56,   62,   65,   56,   65,
-       63,   57,  468,   63,   57,   59,   55,   59,   59,   55,
-       59,   68,   69,   66,  159,   66,   70,   71,  160,   60,
-       68,   69,   60,  168,   72,   70,   71,   68,   69,  206,
-       73,  125,   70,   72,   68,   69,  169,   73,  342,   70,
-       72,   75,   76,   75,   76,  126,  125,   72,   55,   55,
-       55,   55,   55,   55,   87,   55,   87,   87,   55,   87,
-      127,  172,   78,  174,  456,   78,  175,  172,   88,  210,
-       77,   88,   77,   79,   80,   55,   80,   79,   79,   79,
-
-       79,   79,   79,   79,   81,   79,  281,   79,   83,   79,
-       84,   79,   87,   55,   87,   87,   55,   87,   55,   55,
-       55,  281,  173,   79,   79,  206,   89,  206,  464,   89,
-      375,  247,   90,  208,   85,   79,   80,   55,   80,   79,
-       79,   79,   79,   79,   79,   79,   81,   79,  343,   79,
-       83,   79,   84,   79,   55,   55,   55,   87,   55,   87,
-       87,   55,   87,  206,  281,   79,   79,  456,   90,  359,
-      281,   88,  369,  370,   88,  128,   85,   55,   55,   55,
-       55,   55,   55,   87,   55,   87,   87,   55,   87,  127,
-      344,   91,  281,  206,   91,  361,  281,   89,  281,  128,
-
-       89,   87,   55,   87,   87,   55,   87,   55,   55,   55,
-       55,   55,   55,  127,  360,   92,  206,  374,   92,  460,
-      366,   93,  406,  469,   93,   94,   95,   55,   95,   94,
-       94,   94,   94,   94,   94,   94,   96,   94,   97,   94,
-       98,   94,   99,   94,   97,   97,   97,   97,   97,   97,
-       97,   97,   97,   97,   97,   94,   94,   97,   97,   97,
-       97,  100,   97,   97,   97,   97,   97,  101,   97,  102,
-       97,  103,   97,   97,   97,   97,   97,   97,   97,   97,
-      105,   55,  105,  105,   55,  105,   55,   55,   55,   55,
-       55,   55,  443,  443,  106,  281,  282,  106,  459,  456,
-
-      107,  446,  446,  107,  108,  109,   55,  109,  108,  108,
-      108,  108,  108,  108,  108,  110,  108,  111,  108,  112,
-      108,  113,  108,  111,  111,  111,  111,  111,  111,  111,
-      111,  111,  111,  111,  108,  108,  111,  111,  111,  111,
-      114,  111,  111,  111,  111,  111,  115,  111,  116,  111,
-      111,  111,  111,  117,  118,  111,  111,  111,  111,  120,
-       55,  120,  120,   55,  120,   68,   69,   68,   69,  206,
-       70,  133,   70,  121,  456,  465,  121,  206,  122,  128,
-      122,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  127,  123,  128,  123,  128,  134,  124,
-
-      124,  124,  143,  128,  135,  128,  128,  136,  383,  127,
-      143,  127,  137,  128,  139,  128,  206,  127,  128,  127,
-      127,  124,  124,  124,  206,  143,  128,  127,  144,  127,
-      145,  128,  127,  155,  206,  146,  144,  146,  145,  148,
-      127,  145,  128,  147,  384,  127,  146,  416,  144,  164,
-      145,  148,  206,  145,  405,  147,  127,  451,  147,  124,
-      124,  124,  281,  278,  144,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  219,  219,  219,  219,  219,  219,
-      232,  232,  232,  232,  232,  232,  242,  242,  242,  206,
-      221,  206,  281,  221,  367,  450,  234,  281,  471,  234,
-
-      206,  316,  244,  242,  242,  242,  219,  219,  219,  219,
-      219,  219,  219,  219,  219,  261,  261,  261,  206,  244,
-      386,  385,  221,  206,  222,  221,  206,  235,  221,  498,
-      262,  264,  264,  264,  232,  232,  232,  382,  245,  232,
-      232,  232,  397,  206,  255,  396,  265,  232,  232,  232,
-      234,  268,  268,  268,  206,  234,  272,  272,  272,  242,
-      242,  242,  398,  234,  452,  281,  269,  242,  242,  242,
-      449,  273,  242,  242,  242,  244,  280,  280,  280,  219,
-      219,  219,  267,  244,  288,  288,  288,  408,  244,  290,
-      290,  290,  281,  282,  448,  221,  291,  291,  291,  292,
-
-      292,  292,  261,  261,  261,  293,  293,  293,  206,  294,
-      276,  206,  295,  296,  296,  296,  281,  262,  264,  264,
-      264,  232,  232,  232,  287,  298,  298,  298,  297,  299,
-      480,  407,  300,  265,  268,  268,  268,  234,  303,  303,
-      303,  281,  304,  399,  206,  305,  306,  306,  306,  269,
-      272,  272,  272,  438,  242,  242,  242,  302,  280,  280,
-      280,  307,  309,  309,  309,  273,  310,  504,  400,  311,
-      244,  320,  320,  320,  281,  219,  219,  219,  288,  288,
-      288,  323,  323,  323,  290,  290,  290,  291,  291,  291,
-      314,  221,  401,  206,  317,  292,  292,  292,  293,  293,
-
-      293,  206,  294,  454,  402,  295,  296,  296,  296,  318,
-      206,  324,  324,  324,  322,  325,  403,  492,  326,  206,
-      462,  297,  298,  298,  298,  206,  299,  206,  404,  300,
-      328,  328,  328,  303,  303,  303,  461,  304,  206,  439,
-      305,  306,  306,  306,  206,  516,  329,  330,  330,  330,
-      441,  331,  206,  443,  332,  463,  307,  333,  333,  333,
-      309,  309,  309,  466,  310,  444,  206,  311,  335,  335,
-      335,  206,  334,  337,  337,  337,  339,  339,  339,  320,
-      320,  320,  437,  336,  346,  346,  346,  206,  338,  323,
-      323,  323,  340,  481,  324,  324,  324,  486,  325,  453,
-
-      347,  326,  328,  328,  328,  330,  330,  330,  206,  331,
-      443,  206,  332,  333,  333,  333,  206,  467,  329,  349,
-      349,  349,  444,  350,  493,  206,  351,  436,  334,  335,
-      335,  335,  352,  352,  352,  206,  353,  206,  484,  354,
-      337,  337,  337,  470,  336,  355,  355,  355,  206,  356,
-      206,  206,  357,  206,  499,  338,  339,  339,  339,  346,
-      346,  346,  349,  349,  349,  206,  350,  206,  435,  351,
-      485,  510,  340,  488,  473,  347,  352,  352,  352,  206,
-      353,  487,  502,  354,  355,  355,  355,  489,  356,  206,
-      206,  357,  365,  365,  365,  365,  365,  365,  376,  376,
-
-      376,  378,  378,  378,  380,  380,  380,  206,  206,  206,
-      490,  206,  206,  377,  206,  517,  379,  206,  206,  381,
-      376,  376,  376,  387,  387,  387,  511,  388,  496,  206,
-      389,  371,  505,  372,  497,  377,  503,  206,  373,  378,
-      378,  378,  390,  390,  390,  491,  391,  206,  494,  392,
-      380,  380,  380,  500,  379,  393,  393,  393,  206,  394,
-      495,  426,  395,  501,  425,  381,  387,  387,  387,  424,
-      388,  206,  423,  389,  390,  390,  390,  206,  391,  206,
-      206,  392,  393,  393,  393,  414,  394,  506,  206,  395,
-      409,  409,  409,  415,  415,  415,  417,  417,  417,  418,
-
-      418,  418,  409,  409,  409,  410,  281,  514,  507,  206,
-      206,  508,  206,  515,  419,  281,  518,  410,  281,  420,
-      420,  420,  206,  421,  206,  206,  422,  415,  415,  415,
-      428,  428,  428,  509,  206,  281,  417,  417,  417,  418,
-      418,  418,  206,  206,  206,  512,  206,  513,  206,  413,
-      206,  412,  206,  427,  419,  281,  430,  430,  430,  522,
-      431,  519,  429,  432,  420,  420,  420,  523,  421,  534,
-      520,  422,  281,  526,  428,  428,  428,  458,  458,  458,
-      281,  279,  279,  279,  279,  279,  279,  279,  279,  279,
-      206,  411,  279,  281,  282,  279,  279,  279,  281,  279,
-
-      440,  206,  368,  528,  206,  206,  458,  458,  458,  206,
-      206,  279,  279,  279,  279,  279,  279,  279,  279,  279,
-      279,  279,  281,  535,  279,  206,  527,  279,  279,  279,
-      281,  279,  430,  430,  430,  521,  431,  206,  540,  432,
-      206,  364,  317,  279,  279,  472,  472,  472,  281,  279,
-      279,  279,  279,  279,  447,  279,  279,  279,  541,  538,
-      279,  206,  529,  279,  279,  279,  281,  279,  206,  206,
-      544,  532,  206,  206,  474,  474,  474,  206,  206,  279,
-      279,  279,  279,  279,  279,  279,  279,  279,  279,  447,
-      206,  539,  279,  206,  524,  279,  279,  279,  281,  279,
-
-      472,  472,  472,  525,  475,  206,  545,  476,  477,  477,
-      477,  279,  279,  474,  474,  474,  206,  478,  530,  533,
-      479,  477,  477,  477,  206,  482,  206,  536,  483,  206,
-      531,  537,  206,  206,  206,  206,  206,  206,  206,  206,
-      206,  206,  206,  206,  552,  206,  555,  363,  552,  362,
-      555,  542,  543,  358,  546,  547,  206,  206,  206,  206,
-      550,  551,  553,  558,  554,  556,  556,  556,  558,  559,
-      559,  559,  548,  549,  348,  206,  345,  206,  556,  556,
-      556,  557,  561,  561,  561,  560,  559,  559,  559,  561,
-      561,  561,  341,  327,  557,  321,  319,  281,  562,  315,
-
-      313,  312,  560,  308,  301,  562,   52,   52,   52,   52,
-       52,   52,   52,   53,   53,   53,   53,   53,   53,   53,
-       58,   58,   58,   58,   58,   58,   58,   61,   61,   61,
-       61,   61,   61,   61,   64,   64,   64,   64,   64,   64,
-       64,   67,   67,   67,   67,   67,   67,   67,   74,   74,
-       74,   74,   74,   74,   74,   82,   82,   82,   82,   82,
-       82,   82,   86,   86,   86,   86,   86,   86,   86,  104,
-      104,  104,  104,  104,  104,  104,  119,  119,  119,  119,
-      119,  119,  119,  141,  141,  141,  289,  141,  150,  150,
-      150,  286,  150,  157,  157,  157,  285,  157,  167,  167,
-
-      167,  167,  167,  284,  167,  182,  283,  182,  193,  277,
-      193,  201,  275,  201,  205,  205,  205,  205,  205,  205,
-      205,  211,  274,  271,  211,  220,  220,  220,  220,  220,
-      220,  233,  233,  233,  233,  233,  233,  243,  243,  243,
-      243,  243,  243,  279,  279,  279,  279,  279,  279,  279,
-      433,  433,  433,  433,  433,  433,  433,  434,  434,  434,
-      434,  434,  434,  434,  442,  442,  442,  442,  442,  442,
-      442,  445,  445,  445,  445,  445,  445,  445,  455,  455,
-      455,  455,  455,  455,  455,  457,  457,  457,  457,  457,
-      457,  457,  270,  266,  263,  260,  259,  258,  257,  256,
-
-      254,  253,  252,  251,  250,  249,  248,  206,  246,  241,
-      240,  239,  238,  237,  236,  231,  230,  229,  228,  227,
-      226,  225,  224,  223,  218,  217,  216,  215,  214,  213,
-      212,  209,  207,  206,  204,  203,  202,  200,  199,  198,
-      197,  196,  195,  194,  192,  191,  190,  189,  188,  187,
-      186,  185,  184,  183,  181,  180,  179,  178,  177,  176,
-      171,  168,  170,  166,  165,  163,  162,  161,  158,  156,
-      154,  153,  152,  151,  149,  142,  140,  138,  132,  131,
-      132,  131,  130,  129,  563,   51,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563
-    } ;
-
-static yyconst flex_int16_t yy_chk[1642] =
-    {   0,
-        0,    3,    3,    3,    4,    4,    4,    5,    5,    5,
-        6,    6,    6,    9,    0,    3,   10,   11,    4,   12,
-        9,    5,  464,   10,    6,    7,    7,    7,    8,    8,
-        8,   13,   13,   11,  115,   12,   13,   13,  115,    7,
-       14,   14,    8,  125,   13,   14,   14,   15,   15,  316,
-       15,   56,   15,   14,   16,   16,  125,   16,  316,   16,
-       15,   17,   17,   18,   18,   56,   57,   16,   19,   19,
-       19,   20,   20,   20,   23,   23,   23,   24,   24,   24,
-       57,  133,   19,  134,  457,   20,  134,  172,   23,  172,
-       17,   24,   18,   21,   21,   21,   21,   21,   21,   21,
-
-       21,   21,   21,   21,   21,   21,  367,   21,   21,   21,
-       21,   21,   25,   25,   25,   26,   26,   26,   27,   27,
-       27,  317,  133,   21,   21,  169,   25,  208,  456,   26,
-      367,  208,   27,  169,   21,   22,   22,   22,   22,   22,
-       22,   22,   22,   22,   22,   22,   22,   22,  317,   22,
-       22,   22,   22,   22,   28,   28,   28,   29,   29,   29,
-       30,   30,   30,  342,  344,   22,   22,  455,   28,  342,
-      318,   29,  363,  363,   30,   60,   22,   31,   31,   31,
-       32,   32,   32,   33,   33,   33,   34,   34,   34,   60,
-      318,   31,  360,  397,   32,  344,  343,   33,  366,   83,
-
-       34,   35,   35,   35,   36,   36,   36,   37,   37,   37,
-       38,   38,   38,   83,  343,   35,  465,  366,   36,  450,
-      360,   37,  397,  465,   38,   39,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,   39,   39,
-       41,   41,   41,   42,   42,   42,   43,   43,   43,   44,
-       44,   44,  432,  445,   41,  443,  443,   42,  448,  446,
-
-       43,  432,  445,   44,   45,   45,   45,   45,   45,   45,
-       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
-       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
-       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
-       45,   45,   45,   45,   45,   45,   45,   45,   45,   45,
-       45,   45,   45,   45,   45,   45,   45,   45,   45,   47,
-       47,   47,   48,   48,   48,   49,   49,   50,   50,  461,
-       49,   70,   50,   47,  444,  461,   48,  372,   49,   78,
-       50,   54,   54,   54,   55,   55,   55,   59,   59,   59,
-       80,   80,   80,   78,   49,   88,   50,   93,   70,   87,
-
-       87,   87,   88,   89,   70,   98,   90,   70,  372,   88,
-       89,   93,   70,  112,   78,   91,  373,   89,   92,   98,
-       90,   95,   95,   95,  406,   92,  106,  112,   88,   91,
-       88,  107,   92,  106,  396,   88,   89,   93,   89,   90,
-      106,   90,  121,   89,  373,  107,   90,  406,   91,  121,
-       91,   92,  247,   92,  396,   91,  121,  438,   92,  105,
-      105,  105,  361,  247,  107,  109,  109,  109,  120,  120,
-      120,  124,  124,  124,  182,  182,  182,  183,  183,  183,
-      193,  193,  193,  194,  194,  194,  201,  201,  201,  278,
-      182,  467,  375,  183,  361,  437,  193,  374,  467,  194,
-
-      492,  278,  201,  202,  202,  202,  219,  219,  219,  220,
-      220,  220,  222,  222,  222,  228,  228,  228,  371,  202,
-      375,  374,  219,  382,  183,  220,  383,  194,  222,  492,
-      228,  230,  230,  230,  232,  232,  232,  371,  202,  233,
-      233,  233,  383,  384,  222,  382,  230,  235,  235,  235,
-      232,  236,  236,  236,  439,  233,  239,  239,  239,  242,
-      242,  242,  384,  235,  439,  399,  236,  243,  243,  243,
-      436,  239,  245,  245,  245,  242,  248,  248,  248,  255,
-      255,  255,  235,  243,  256,  256,  256,  399,  245,  258,
-      258,  258,  248,  248,  435,  255,  259,  259,  259,  260,
-
-      260,  260,  261,  261,  261,  262,  262,  262,  475,  262,
-      245,  398,  262,  263,  263,  263,  385,  261,  264,  264,
-      264,  267,  267,  267,  255,  265,  265,  265,  263,  265,
-      475,  398,  265,  264,  268,  268,  268,  267,  269,  269,
-      269,  386,  269,  385,  498,  269,  270,  270,  270,  268,
-      272,  272,  272,  426,  276,  276,  276,  267,  280,  280,
-      280,  270,  273,  273,  273,  272,  273,  498,  386,  273,
-      276,  285,  285,  285,  280,  287,  287,  287,  288,  288,
-      288,  289,  289,  289,  290,  290,  290,  291,  291,  291,
-      276,  287,  388,  441,  280,  292,  292,  292,  293,  293,
-
-      293,  486,  293,  441,  388,  293,  296,  296,  296,  280,
-      453,  297,  297,  297,  287,  297,  389,  486,  297,  510,
-      453,  296,  298,  298,  298,  452,  298,  427,  389,  298,
-      302,  302,  302,  303,  303,  303,  452,  303,  429,  427,
-      303,  306,  306,  306,  454,  510,  302,  307,  307,  307,
-      429,  307,  462,  431,  307,  454,  306,  308,  308,  308,
-      309,  309,  309,  462,  309,  431,  480,  309,  312,  312,
-      312,  476,  308,  313,  313,  313,  314,  314,  314,  320,
-      320,  320,  425,  312,  322,  322,  322,  440,  313,  323,
-      323,  323,  314,  476,  324,  324,  324,  480,  324,  440,
-
-      322,  324,  328,  328,  328,  330,  330,  330,  487,  330,
-      442,  463,  330,  333,  333,  333,  478,  463,  328,  334,
-      334,  334,  442,  334,  487,  493,  334,  424,  333,  335,
-      335,  335,  336,  336,  336,  504,  336,  466,  478,  336,
-      337,  337,  337,  466,  335,  338,  338,  338,  479,  338,
-      481,  482,  338,  496,  493,  337,  339,  339,  339,  346,
-      346,  346,  349,  349,  349,  483,  349,  470,  423,  349,
-      479,  504,  339,  482,  470,  346,  352,  352,  352,  484,
-      352,  481,  496,  352,  355,  355,  355,  483,  355,  511,
-      505,  355,  359,  359,  359,  365,  365,  365,  368,  368,
-
-      368,  369,  369,  369,  370,  370,  370,  497,  359,  499,
-      484,  365,  490,  368,  485,  511,  369,  488,  491,  370,
-      376,  376,  376,  377,  377,  377,  505,  377,  490,  489,
-      377,  365,  499,  365,  491,  376,  497,  494,  365,  378,
-      378,  378,  379,  379,  379,  485,  379,  495,  488,  379,
-      380,  380,  380,  494,  378,  381,  381,  381,  500,  381,
-      489,  414,  381,  495,  413,  380,  387,  387,  387,  412,
-      387,  508,  411,  387,  390,  390,  390,  509,  390,  501,
-      512,  390,  393,  393,  393,  404,  393,  500,  502,  393,
-      400,  400,  400,  405,  405,  405,  407,  407,  407,  408,
-
-      408,  408,  409,  409,  409,  400,  400,  508,  501,  405,
-      503,  502,  407,  509,  408,  408,  512,  409,  409,  410,
-      410,  410,  506,  410,  507,  513,  410,  415,  415,  415,
-      416,  416,  416,  503,  516,  410,  417,  417,  417,  418,
-      418,  418,  517,  415,  514,  506,  416,  507,  520,  403,
-      528,  402,  417,  415,  418,  418,  419,  419,  419,  516,
-      419,  513,  417,  419,  420,  420,  420,  517,  420,  528,
-      514,  420,  419,  520,  428,  428,  428,  447,  447,  447,
-      420,  421,  421,  421,  421,  421,  421,  421,  421,  421,
-      428,  401,  421,  447,  447,  421,  421,  421,  421,  421,
-
-      428,  521,  362,  522,  529,  534,  458,  458,  458,  515,
-      522,  421,  421,  422,  422,  422,  422,  422,  422,  422,
-      422,  422,  458,  529,  422,  535,  521,  422,  422,  422,
-      422,  422,  430,  430,  430,  515,  430,  538,  534,  430,
-      532,  358,  458,  422,  422,  469,  469,  469,  430,  433,
-      433,  433,  433,  433,  433,  433,  433,  433,  535,  532,
-      433,  469,  523,  433,  433,  433,  433,  433,  518,  523,
-      538,  526,  533,  539,  471,  471,  471,  519,  526,  433,
-      433,  434,  434,  434,  434,  434,  434,  434,  434,  434,
-      471,  533,  434,  524,  518,  434,  434,  434,  434,  434,
-
-      472,  472,  472,  519,  472,  525,  539,  472,  473,  473,
-      473,  434,  434,  474,  474,  474,  472,  474,  524,  527,
-      474,  477,  477,  477,  473,  477,  527,  530,  477,  474,
-      525,  531,  536,  537,  530,  540,  541,  477,  531,  542,
-      543,  544,  545,  548,  546,  549,  550,  348,  547,  345,
-      551,  536,  537,  341,  540,  541,  546,  547,  550,  551,
-      544,  545,  548,  553,  549,  552,  552,  552,  554,  555,
-      555,  555,  542,  543,  327,  553,  321,  554,  556,  556,
-      556,  552,  558,  558,  558,  555,  559,  559,  559,  561,
-      561,  561,  315,  301,  556,  286,  282,  279,  558,  277,
-
-      275,  274,  559,  271,  266,  561,  564,  564,  564,  564,
-      564,  564,  564,  565,  565,  565,  565,  565,  565,  565,
-      566,  566,  566,  566,  566,  566,  566,  567,  567,  567,
-      567,  567,  567,  567,  568,  568,  568,  568,  568,  568,
-      568,  569,  569,  569,  569,  569,  569,  569,  570,  570,
-      570,  570,  570,  570,  570,  571,  571,  571,  571,  571,
-      571,  571,  572,  572,  572,  572,  572,  572,  572,  573,
-      573,  573,  573,  573,  573,  573,  574,  574,  574,  574,
-      574,  574,  574,  575,  575,  575,  257,  575,  576,  576,
-      576,  254,  576,  577,  577,  577,  253,  577,  578,  578,
-
-      578,  578,  578,  252,  578,  579,  251,  579,  580,  246,
-      580,  581,  241,  581,  582,  582,  582,  582,  582,  582,
-      582,  583,  240,  238,  583,  584,  584,  584,  584,  584,
-      584,  585,  585,  585,  585,  585,  585,  586,  586,  586,
-      586,  586,  586,  587,  587,  587,  587,  587,  587,  587,
-      588,  588,  588,  588,  588,  588,  588,  589,  589,  589,
-      589,  589,  589,  589,  590,  590,  590,  590,  590,  590,
-      590,  591,  591,  591,  591,  591,  591,  591,  592,  592,
-      592,  592,  592,  592,  592,  593,  593,  593,  593,  593,
-      593,  593,  237,  231,  229,  227,  226,  225,  224,  223,
-
-      218,  217,  216,  213,  212,  211,  209,  205,  203,  200,
-      199,  198,  197,  196,  195,  192,  191,  190,  189,  188,
-      187,  186,  185,  184,  181,  180,  178,  177,  176,  175,
-      174,  170,  168,  167,  166,  165,  164,  163,  162,  161,
-      160,  159,  158,  155,  154,  153,  152,  151,  148,  147,
-      146,  145,  144,  143,  142,  139,  138,  137,  136,  135,
-      129,  128,  126,  123,  122,  118,  117,  116,  114,  110,
-      103,  102,  101,  100,   96,   85,   81,   77,   76,   75,
-       69,   68,   66,   63,   51,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
-      563
-    } ;
+struct yy_trans_info {
+  flex_int32_t yy_verify;
+  flex_int32_t yy_nxt;
+};
+static yyconst flex_int16_t yy_accept[564] = { 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  93, 91, 17, 10, 10, 17, 17, 71, 10, 71,
+  5, 6, 5, 8, 9, 8, 87, 79, 80, 88,
+  85, 88, 86, 90, 79, 80, 90, 91, 26, 10,
+  26, 26, 26, 24, 26, 30, 10, 30, 30, 91,
+  91, 30, 91, 45, 10, 45, 45, 45, 43, 45,
+
+  45, 45, 45, 49, 10, 49, 91, 66, 10, 66,
+  66, 66, 64, 66, 66, 66, 66, 66, 70, 10,
+  70, 88, 87, 10, 0, 2, 2, 0, 4, 7,
+  82, 81, 0, 0, 0, 0, 0, 0, 0, 25,
+  27, 27, 0, 0, 0, 0, 0, 0, 44, 46,
+  46, 46, 46, 46, 0, 65, 67, 67, 67, 67,
+  67, 67, 67, 0, 0, 0, 0, 0, 0, 0,
+  3, 0, 0, 0, 0, 0, 0, 0, 89, 0,
+  27, 0, 0, 0, 0, 0, 0, 0, 46, 46,
+  46, 46, 0, 0, 67, 67, 67, 67, 67, 67,
+
+  0, 0, 0, 84, 0, 16, 1, 0, 0, 77,
+  0, 0, 0, 74, 73, 0, 0, 27, 0, 0,
+  29, 0, 0, 0, 0, 0, 0, 46, 46, 46,
+  46, 0, 0, 48, 0, 67, 67, 67, 67, 67,
+  67, 0, 0, 69, 0, 0, 0, 0, 78, 72,
+  0, 0, 0, 27, 0, 51, 0, 32, 31, 50,
+  0, 0, 46, 0, 0, 46, 0, 0, 0, 67,
+  67, 0, 0, 67, 67, 0, 0, 0, 0, 0,
+  12, 0, 75, 76, 19, 27, 0, 51, 18, 32,
+  31, 50, 0, 38, 37, 0, 0, 0, 36, 35,
+
+  46, 0, 0, 63, 62, 0, 0, 67, 0, 55,
+  54, 67, 67, 0, 0, 0, 0, 0, 11, 19,
+  27, 0, 18, 0, 34, 33, 46, 0, 47, 0,
+  53, 52, 0, 0, 0, 0, 0, 0, 0, 68,
+  0, 0, 0, 0, 27, 0, 28, 46, 0, 61,
+  60, 0, 57, 56, 0, 59, 58, 0, 0, 0,
+  0, 27, 46, 83, 0, 0, 0, 27, 46, 46,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  40, 39, 0, 42, 41, 0, 0, 0, 0, 0,
+
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 12, 0, 12, 0, 0, 21, 0,
+  20, 0, 0, 0, 0, 0, 0, 0, 23, 22,
+  0, 0, 0, 0, 0, 0, 0, 11, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  0, 0, 0, 0, 0, 0, 13, 0, 0, 14,
+  0, 15, 0
+};
+
+static yyconst flex_int32_t yy_ec[256] = { 0,
+  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+  1, 2, 4, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
+  1, 1, 1, 1, 10, 11, 12, 13, 13, 13,
+  13, 13, 13, 13, 13, 13, 13, 14, 15, 16,
+  17, 18, 19, 1, 20, 21, 22, 23, 24, 21,
+  14, 14, 14, 14, 14, 14, 25, 14, 26, 27,
+  14, 14, 28, 29, 14, 14, 14, 14, 30, 14,
+  31, 1, 32, 1, 33, 1, 34, 35, 36, 37,
+
+  38, 39, 40, 41, 42, 14, 14, 43, 44, 45,
+  46, 47, 48, 49, 50, 51, 52, 53, 14, 54,
+  55, 14, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 1
+};
+
+static yyconst flex_int32_t yy_meta[56] = { 0,
+  1, 2, 2, 2, 1, 1, 1, 1, 1, 3,
+  3, 1, 4, 5, 1, 1, 1, 6, 1, 7,
+  7, 7, 7, 7, 5, 5, 5, 5, 5, 5,
+  1, 1, 5, 7, 7, 7, 7, 7, 7, 5,
+  5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+  5, 5, 5, 5, 5
+};
+
+static yyconst flex_int16_t yy_base[594] = { 0,
+  0, 0, 0, 3, 6, 9, 24, 27, 11, 14,
+  15, 17, 29, 38, 45, 52, 59, 61, 67, 70,
+  93, 135, 73, 76, 111, 114, 117, 153, 156, 159,
+  176, 179, 182, 185, 200, 203, 206, 209, 225, 0,
+  279, 282, 285, 288, 304, 0, 358, 361, 363, 365,
+  1585, 1586, 1586, 380, 383, 47, 62, 1586, 386, 171,
+  1586, 1586, 1574, 1586, 1586, 1565, 1586, 1578, 1578, 365,
+  1586, 1586, 1586, 1586, 1576, 1576, 1546, 375, 1586, 389,
+  1559, 0, 195, 1586, 1526, 1586, 398, 391, 399, 402,
+  411, 414, 393, 1586, 420, 1557, 0, 401, 1586, 1540,
+
+  1539, 1538, 1525, 1586, 458, 422, 427, 1586, 464, 1552,
+  0, 409, 1586, 1535, 1, 1534, 1521, 1532, 1586, 467,
+  438, 1560, 1532, 470, 34, 1509, 1586, 1552, 1543, 1586,
+  1586, 1586, 69, 40, 1509, 1508, 1506, 1539, 1507, 1586,
+  0, 1532, 1514, 1516, 1503, 1505, 1504, 1512, 1586, 0,
+  1497, 1512, 1502, 1495, 1499, 1586, 0, 1492, 1507, 1496,
+  1496, 1487, 1489, 1499, 1505, 1517, 1516, 1523, 108, 1488,
+  1586, 75, 0, 1484, 1484, 1514, 1513, 1481, 1586, 1492,
+  1483, 473, 476, 1484, 1489, 1485, 1484, 1480, 1485, 1480,
+  1479, 1474, 479, 482, 1481, 1476, 1473, 1474, 1462, 1470,
+
+  485, 502, 1487, 1586, 1490, 1586, 1586, 110, 1464, 1586,
+  1491, 1490, 1454, 1586, 1586, 1452, 1455, 1452, 505, 508,
+  1586, 511, 1462, 1452, 1460, 1459, 1458, 514, 1452, 530,
+  1443, 533, 538, 1586, 546, 550, 1450, 1373, 555, 1387,
+  1375, 558, 566, 1586, 571, 1387, 435, 575, 1586, 1586,
+  1392, 1389, 1356, 1354, 578, 583, 1346, 588, 595, 598,
+  601, 604, 612, 617, 624, 1263, 620, 633, 637, 645,
+  1263, 649, 661, 1264, 1250, 653, 1280, 472, 1280, 657,
+  1586, 1279, 1586, 1586, 670, 1260, 674, 677, 680, 683,
+  686, 694, 697, 1586, 1586, 705, 710, 721, 1586, 1586,
+
+  1248, 729, 732, 1586, 1586, 740, 746, 756, 759, 1586,
+  1586, 767, 772, 775, 1264, 32, 104, 153, 1586, 778,
+  1226, 783, 788, 793, 1586, 1586, 1230, 801, 1586, 804,
+  1586, 1586, 812, 818, 828, 831, 839, 844, 855, 1586,
+  1234, 146, 179, 147, 1212, 858, 1586, 1215, 861, 1586,
+  1586, 875, 1586, 1586, 883, 1586, 1586, 1111, 891, 175,
+  445, 1066, 119, 1586, 894, 181, 89, 897, 900, 903,
+  501, 360, 399, 480, 475, 919, 922, 938, 941, 949,
+  954, 506, 509, 526, 599, 624, 965, 654, 678, 973,
+  1586, 1586, 981, 1586, 1586, 417, 176, 594, 548, 989,
+
+  1058, 1003, 1016, 937, 992, 407, 995, 998, 1001, 1018,
+  930, 918, 922, 910, 1026, 1029, 1035, 1038, 1055, 1063,
+  1081, 1113, 819, 790, 733, 616, 710, 1073, 721, 1131,
+  748, 284, 1149, 1181, 557, 565, 458, 449, 537, 770,
+  676, 805, 278, 369, 285, 291, 1076, 293, 1586, 211,
+  1586, 708, 693, 727, 162, 110, 76, 1105, 1586, 1586,
+  352, 735, 794, 5, 199, 820, 474, 1586, 1144, 850,
+  1173, 1199, 1207, 1212, 591, 754, 1220, 799, 831, 749,
+  833, 834, 848, 862, 897, 684, 791, 900, 912, 895,
+  901, 483, 808, 920, 930, 836, 890, 627, 892, 941,
+
+  962, 971, 993, 818, 873, 1005, 1007, 954, 960, 702,
+  872, 963, 1008, 1027, 1092, 1017, 1025, 1151, 1160, 1031,
+  1084, 1093, 1152, 1176, 1188, 1161, 1209, 1033, 1087, 1217,
+  1221, 1123, 1155, 1088, 1108, 1215, 1216, 1120, 1156, 1218,
+  1219, 1222, 1223, 1224, 1225, 1239, 1240, 1226, 1228, 1241,
+  1242, 1264, 1258, 1260, 1268, 1277, 1586, 1281, 1285, 1586,
+  1288, 1586, 1586, 1306, 1313, 1320, 1327, 1334, 1341, 1348,
+  1355, 1362, 1369, 1376, 1381, 1386, 1391, 1398, 1401, 1404,
+  1407, 1414, 1418, 1424, 1430, 1436, 1443, 1450, 1457, 1464,
+  1471, 1478, 1485
+};
+
+static yyconst flex_int16_t yy_def[594] = { 0,
+  564, 564, 565, 565, 565, 565, 566, 566, 567, 567,
+  568, 568, 569, 569, 569, 569, 570, 570, 564, 564,
+  571, 571, 572, 572, 572, 572, 564, 564, 572, 572,
+  564, 564, 572, 572, 572, 572, 564, 564, 563, 39,
+  573, 573, 564, 564, 563, 45, 574, 574, 569, 569,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 575, 563, 563, 575, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 576, 563, 563, 576,
+
+  576, 576, 576, 563, 563, 563, 563, 563, 563, 563,
+  577, 563, 563, 577, 577, 577, 577, 577, 563, 563,
+  563, 563, 563, 563, 578, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  575, 575, 579, 563, 563, 563, 563, 563, 563, 576,
+  576, 576, 576, 576, 580, 563, 577, 577, 577, 577,
+  577, 577, 577, 581, 563, 563, 582, 563, 582, 563,
+  563, 563, 583, 563, 563, 563, 563, 563, 563, 563,
+  575, 584, 584, 563, 563, 563, 563, 563, 576, 576,
+  576, 576, 585, 585, 577, 577, 577, 577, 577, 577,
+
+  586, 586, 563, 563, 582, 563, 563, 582, 563, 563,
+  583, 563, 563, 563, 563, 563, 563, 575, 563, 584,
+  563, 584, 563, 563, 563, 563, 563, 576, 576, 576,
+  576, 563, 585, 563, 585, 577, 577, 577, 577, 577,
+  577, 563, 586, 563, 586, 563, 582, 587, 563, 563,
+  563, 563, 563, 575, 584, 563, 563, 563, 563, 563,
+  563, 563, 576, 563, 563, 576, 585, 563, 563, 577,
+  577, 563, 563, 577, 577, 586, 563, 582, 587, 587,
+  563, 587, 563, 563, 563, 575, 584, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+
+  576, 585, 563, 563, 563, 563, 563, 577, 563, 563,
+  563, 577, 577, 586, 563, 582, 587, 587, 563, 563,
+  575, 584, 563, 563, 563, 563, 576, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 582, 587, 587, 575, 563, 563, 576, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 582, 587,
+  587, 575, 576, 563, 582, 587, 587, 575, 576, 576,
+  582, 582, 582, 587, 587, 563, 563, 563, 563, 563,
+  563, 582, 582, 582, 587, 587, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 582, 582, 582, 587, 587,
+
+  563, 563, 563, 563, 582, 582, 582, 587, 587, 587,
+  563, 563, 563, 563, 582, 582, 582, 587, 587, 587,
+  588, 589, 563, 563, 563, 563, 582, 582, 582, 587,
+  590, 591, 588, 589, 563, 563, 563, 563, 582, 582,
+  582, 590, 587, 592, 591, 593, 587, 563, 563, 563,
+  563, 582, 582, 582, 592, 563, 593, 587, 563, 563,
+  582, 582, 582, 563, 582, 582, 582, 563, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 582, 582, 582, 582,
+  582, 582, 582, 582, 582, 582, 563, 582, 582, 563,
+  582, 563, 0, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563
+};
+
+static yyconst flex_int16_t yy_nxt[1642] = { 0,
+  563, 54, 55, 54, 54, 55, 54, 54, 55, 54,
+  54, 55, 54, 62, 563, 56, 62, 65, 56, 65,
+  63, 57, 468, 63, 57, 59, 55, 59, 59, 55,
+  59, 68, 69, 66, 159, 66, 70, 71, 160, 60,
+  68, 69, 60, 168, 72, 70, 71, 68, 69, 206,
+  73, 125, 70, 72, 68, 69, 169, 73, 342, 70,
+  72, 75, 76, 75, 76, 126, 125, 72, 55, 55,
+  55, 55, 55, 55, 87, 55, 87, 87, 55, 87,
+  127, 172, 78, 174, 456, 78, 175, 172, 88, 210,
+  77, 88, 77, 79, 80, 55, 80, 79, 79, 79,
+
+  79, 79, 79, 79, 81, 79, 281, 79, 83, 79,
+  84, 79, 87, 55, 87, 87, 55, 87, 55, 55,
+  55, 281, 173, 79, 79, 206, 89, 206, 464, 89,
+  375, 247, 90, 208, 85, 79, 80, 55, 80, 79,
+  79, 79, 79, 79, 79, 79, 81, 79, 343, 79,
+  83, 79, 84, 79, 55, 55, 55, 87, 55, 87,
+  87, 55, 87, 206, 281, 79, 79, 456, 90, 359,
+  281, 88, 369, 370, 88, 128, 85, 55, 55, 55,
+  55, 55, 55, 87, 55, 87, 87, 55, 87, 127,
+  344, 91, 281, 206, 91, 361, 281, 89, 281, 128,
+
+  89, 87, 55, 87, 87, 55, 87, 55, 55, 55,
+  55, 55, 55, 127, 360, 92, 206, 374, 92, 460,
+  366, 93, 406, 469, 93, 94, 95, 55, 95, 94,
+  94, 94, 94, 94, 94, 94, 96, 94, 97, 94,
+  98, 94, 99, 94, 97, 97, 97, 97, 97, 97,
+  97, 97, 97, 97, 97, 94, 94, 97, 97, 97,
+  97, 100, 97, 97, 97, 97, 97, 101, 97, 102,
+  97, 103, 97, 97, 97, 97, 97, 97, 97, 97,
+  105, 55, 105, 105, 55, 105, 55, 55, 55, 55,
+  55, 55, 443, 443, 106, 281, 282, 106, 459, 456,
+
+  107, 446, 446, 107, 108, 109, 55, 109, 108, 108,
+  108, 108, 108, 108, 108, 110, 108, 111, 108, 112,
+  108, 113, 108, 111, 111, 111, 111, 111, 111, 111,
+  111, 111, 111, 111, 108, 108, 111, 111, 111, 111,
+  114, 111, 111, 111, 111, 111, 115, 111, 116, 111,
+  111, 111, 111, 117, 118, 111, 111, 111, 111, 120,
+  55, 120, 120, 55, 120, 68, 69, 68, 69, 206,
+  70, 133, 70, 121, 456, 465, 121, 206, 122, 128,
+  122, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+  124, 124, 124, 127, 123, 128, 123, 128, 134, 124,
+
+  124, 124, 143, 128, 135, 128, 128, 136, 383, 127,
+  143, 127, 137, 128, 139, 128, 206, 127, 128, 127,
+  127, 124, 124, 124, 206, 143, 128, 127, 144, 127,
+  145, 128, 127, 155, 206, 146, 144, 146, 145, 148,
+  127, 145, 128, 147, 384, 127, 146, 416, 144, 164,
+  145, 148, 206, 145, 405, 147, 127, 451, 147, 124,
+  124, 124, 281, 278, 144, 124, 124, 124, 124, 124,
+  124, 124, 124, 124, 219, 219, 219, 219, 219, 219,
+  232, 232, 232, 232, 232, 232, 242, 242, 242, 206,
+  221, 206, 281, 221, 367, 450, 234, 281, 471, 234,
+
+  206, 316, 244, 242, 242, 242, 219, 219, 219, 219,
+  219, 219, 219, 219, 219, 261, 261, 261, 206, 244,
+  386, 385, 221, 206, 222, 221, 206, 235, 221, 498,
+  262, 264, 264, 264, 232, 232, 232, 382, 245, 232,
+  232, 232, 397, 206, 255, 396, 265, 232, 232, 232,
+  234, 268, 268, 268, 206, 234, 272, 272, 272, 242,
+  242, 242, 398, 234, 452, 281, 269, 242, 242, 242,
+  449, 273, 242, 242, 242, 244, 280, 280, 280, 219,
+  219, 219, 267, 244, 288, 288, 288, 408, 244, 290,
+  290, 290, 281, 282, 448, 221, 291, 291, 291, 292,
+
+  292, 292, 261, 261, 261, 293, 293, 293, 206, 294,
+  276, 206, 295, 296, 296, 296, 281, 262, 264, 264,
+  264, 232, 232, 232, 287, 298, 298, 298, 297, 299,
+  480, 407, 300, 265, 268, 268, 268, 234, 303, 303,
+  303, 281, 304, 399, 206, 305, 306, 306, 306, 269,
+  272, 272, 272, 438, 242, 242, 242, 302, 280, 280,
+  280, 307, 309, 309, 309, 273, 310, 504, 400, 311,
+  244, 320, 320, 320, 281, 219, 219, 219, 288, 288,
+  288, 323, 323, 323, 290, 290, 290, 291, 291, 291,
+  314, 221, 401, 206, 317, 292, 292, 292, 293, 293,
+
+  293, 206, 294, 454, 402, 295, 296, 296, 296, 318,
+  206, 324, 324, 324, 322, 325, 403, 492, 326, 206,
+  462, 297, 298, 298, 298, 206, 299, 206, 404, 300,
+  328, 328, 328, 303, 303, 303, 461, 304, 206, 439,
+  305, 306, 306, 306, 206, 516, 329, 330, 330, 330,
+  441, 331, 206, 443, 332, 463, 307, 333, 333, 333,
+  309, 309, 309, 466, 310, 444, 206, 311, 335, 335,
+  335, 206, 334, 337, 337, 337, 339, 339, 339, 320,
+  320, 320, 437, 336, 346, 346, 346, 206, 338, 323,
+  323, 323, 340, 481, 324, 324, 324, 486, 325, 453,
+
+  347, 326, 328, 328, 328, 330, 330, 330, 206, 331,
+  443, 206, 332, 333, 333, 333, 206, 467, 329, 349,
+  349, 349, 444, 350, 493, 206, 351, 436, 334, 335,
+  335, 335, 352, 352, 352, 206, 353, 206, 484, 354,
+  337, 337, 337, 470, 336, 355, 355, 355, 206, 356,
+  206, 206, 357, 206, 499, 338, 339, 339, 339, 346,
+  346, 346, 349, 349, 349, 206, 350, 206, 435, 351,
+  485, 510, 340, 488, 473, 347, 352, 352, 352, 206,
+  353, 487, 502, 354, 355, 355, 355, 489, 356, 206,
+  206, 357, 365, 365, 365, 365, 365, 365, 376, 376,
+
+  376, 378, 378, 378, 380, 380, 380, 206, 206, 206,
+  490, 206, 206, 377, 206, 517, 379, 206, 206, 381,
+  376, 376, 376, 387, 387, 387, 511, 388, 496, 206,
+  389, 371, 505, 372, 497, 377, 503, 206, 373, 378,
+  378, 378, 390, 390, 390, 491, 391, 206, 494, 392,
+  380, 380, 380, 500, 379, 393, 393, 393, 206, 394,
+  495, 426, 395, 501, 425, 381, 387, 387, 387, 424,
+  388, 206, 423, 389, 390, 390, 390, 206, 391, 206,
+  206, 392, 393, 393, 393, 414, 394, 506, 206, 395,
+  409, 409, 409, 415, 415, 415, 417, 417, 417, 418,
+
+  418, 418, 409, 409, 409, 410, 281, 514, 507, 206,
+  206, 508, 206, 515, 419, 281, 518, 410, 281, 420,
+  420, 420, 206, 421, 206, 206, 422, 415, 415, 415,
+  428, 428, 428, 509, 206, 281, 417, 417, 417, 418,
+  418, 418, 206, 206, 206, 512, 206, 513, 206, 413,
+  206, 412, 206, 427, 419, 281, 430, 430, 430, 522,
+  431, 519, 429, 432, 420, 420, 420, 523, 421, 534,
+  520, 422, 281, 526, 428, 428, 428, 458, 458, 458,
+  281, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+  206, 411, 279, 281, 282, 279, 279, 279, 281, 279,
+
+  440, 206, 368, 528, 206, 206, 458, 458, 458, 206,
+  206, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+  279, 279, 281, 535, 279, 206, 527, 279, 279, 279,
+  281, 279, 430, 430, 430, 521, 431, 206, 540, 432,
+  206, 364, 317, 279, 279, 472, 472, 472, 281, 279,
+  279, 279, 279, 279, 447, 279, 279, 279, 541, 538,
+  279, 206, 529, 279, 279, 279, 281, 279, 206, 206,
+  544, 532, 206, 206, 474, 474, 474, 206, 206, 279,
+  279, 279, 279, 279, 279, 279, 279, 279, 279, 447,
+  206, 539, 279, 206, 524, 279, 279, 279, 281, 279,
+
+  472, 472, 472, 525, 475, 206, 545, 476, 477, 477,
+  477, 279, 279, 474, 474, 474, 206, 478, 530, 533,
+  479, 477, 477, 477, 206, 482, 206, 536, 483, 206,
+  531, 537, 206, 206, 206, 206, 206, 206, 206, 206,
+  206, 206, 206, 206, 552, 206, 555, 363, 552, 362,
+  555, 542, 543, 358, 546, 547, 206, 206, 206, 206,
+  550, 551, 553, 558, 554, 556, 556, 556, 558, 559,
+  559, 559, 548, 549, 348, 206, 345, 206, 556, 556,
+  556, 557, 561, 561, 561, 560, 559, 559, 559, 561,
+  561, 561, 341, 327, 557, 321, 319, 281, 562, 315,
+
+  313, 312, 560, 308, 301, 562, 52, 52, 52, 52,
+  52, 52, 52, 53, 53, 53, 53, 53, 53, 53,
+  58, 58, 58, 58, 58, 58, 58, 61, 61, 61,
+  61, 61, 61, 61, 64, 64, 64, 64, 64, 64,
+  64, 67, 67, 67, 67, 67, 67, 67, 74, 74,
+  74, 74, 74, 74, 74, 82, 82, 82, 82, 82,
+  82, 82, 86, 86, 86, 86, 86, 86, 86, 104,
+  104, 104, 104, 104, 104, 104, 119, 119, 119, 119,
+  119, 119, 119, 141, 141, 141, 289, 141, 150, 150,
+  150, 286, 150, 157, 157, 157, 285, 157, 167, 167,
+
+  167, 167, 167, 284, 167, 182, 283, 182, 193, 277,
+  193, 201, 275, 201, 205, 205, 205, 205, 205, 205,
+  205, 211, 274, 271, 211, 220, 220, 220, 220, 220,
+  220, 233, 233, 233, 233, 233, 233, 243, 243, 243,
+  243, 243, 243, 279, 279, 279, 279, 279, 279, 279,
+  433, 433, 433, 433, 433, 433, 433, 434, 434, 434,
+  434, 434, 434, 434, 442, 442, 442, 442, 442, 442,
+  442, 445, 445, 445, 445, 445, 445, 445, 455, 455,
+  455, 455, 455, 455, 455, 457, 457, 457, 457, 457,
+  457, 457, 270, 266, 263, 260, 259, 258, 257, 256,
+
+  254, 253, 252, 251, 250, 249, 248, 206, 246, 241,
+  240, 239, 238, 237, 236, 231, 230, 229, 228, 227,
+  226, 225, 224, 223, 218, 217, 216, 215, 214, 213,
+  212, 209, 207, 206, 204, 203, 202, 200, 199, 198,
+  197, 196, 195, 194, 192, 191, 190, 189, 188, 187,
+  186, 185, 184, 183, 181, 180, 179, 178, 177, 176,
+  171, 168, 170, 166, 165, 163, 162, 161, 158, 156,
+  154, 153, 152, 151, 149, 142, 140, 138, 132, 131,
+  132, 131, 130, 129, 563, 51, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563
+};
+
+static yyconst flex_int16_t yy_chk[1642] = { 0,
+  0, 3, 3, 3, 4, 4, 4, 5, 5, 5,
+  6, 6, 6, 9, 0, 3, 10, 11, 4, 12,
+  9, 5, 464, 10, 6, 7, 7, 7, 8, 8,
+  8, 13, 13, 11, 115, 12, 13, 13, 115, 7,
+  14, 14, 8, 125, 13, 14, 14, 15, 15, 316,
+  15, 56, 15, 14, 16, 16, 125, 16, 316, 16,
+  15, 17, 17, 18, 18, 56, 57, 16, 19, 19,
+  19, 20, 20, 20, 23, 23, 23, 24, 24, 24,
+  57, 133, 19, 134, 457, 20, 134, 172, 23, 172,
+  17, 24, 18, 21, 21, 21, 21, 21, 21, 21,
+
+  21, 21, 21, 21, 21, 21, 367, 21, 21, 21,
+  21, 21, 25, 25, 25, 26, 26, 26, 27, 27,
+  27, 317, 133, 21, 21, 169, 25, 208, 456, 26,
+  367, 208, 27, 169, 21, 22, 22, 22, 22, 22,
+  22, 22, 22, 22, 22, 22, 22, 22, 317, 22,
+  22, 22, 22, 22, 28, 28, 28, 29, 29, 29,
+  30, 30, 30, 342, 344, 22, 22, 455, 28, 342,
+  318, 29, 363, 363, 30, 60, 22, 31, 31, 31,
+  32, 32, 32, 33, 33, 33, 34, 34, 34, 60,
+  318, 31, 360, 397, 32, 344, 343, 33, 366, 83,
+
+  34, 35, 35, 35, 36, 36, 36, 37, 37, 37,
+  38, 38, 38, 83, 343, 35, 465, 366, 36, 450,
+  360, 37, 397, 465, 38, 39, 39, 39, 39, 39,
+  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+  39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+  41, 41, 41, 42, 42, 42, 43, 43, 43, 44,
+  44, 44, 432, 445, 41, 443, 443, 42, 448, 446,
+
+  43, 432, 445, 44, 45, 45, 45, 45, 45, 45,
+  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+  45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+  45, 45, 45, 45, 45, 45, 45, 45, 45, 47,
+  47, 47, 48, 48, 48, 49, 49, 50, 50, 461,
+  49, 70, 50, 47, 444, 461, 48, 372, 49, 78,
+  50, 54, 54, 54, 55, 55, 55, 59, 59, 59,
+  80, 80, 80, 78, 49, 88, 50, 93, 70, 87,
+
+  87, 87, 88, 89, 70, 98, 90, 70, 372, 88,
+  89, 93, 70, 112, 78, 91, 373, 89, 92, 98,
+  90, 95, 95, 95, 406, 92, 106, 112, 88, 91,
+  88, 107, 92, 106, 396, 88, 89, 93, 89, 90,
+  106, 90, 121, 89, 373, 107, 90, 406, 91, 121,
+  91, 92, 247, 92, 396, 91, 121, 438, 92, 105,
+  105, 105, 361, 247, 107, 109, 109, 109, 120, 120,
+  120, 124, 124, 124, 182, 182, 182, 183, 183, 183,
+  193, 193, 193, 194, 194, 194, 201, 201, 201, 278,
+  182, 467, 375, 183, 361, 437, 193, 374, 467, 194,
+
+  492, 278, 201, 202, 202, 202, 219, 219, 219, 220,
+  220, 220, 222, 222, 222, 228, 228, 228, 371, 202,
+  375, 374, 219, 382, 183, 220, 383, 194, 222, 492,
+  228, 230, 230, 230, 232, 232, 232, 371, 202, 233,
+  233, 233, 383, 384, 222, 382, 230, 235, 235, 235,
+  232, 236, 236, 236, 439, 233, 239, 239, 239, 242,
+  242, 242, 384, 235, 439, 399, 236, 243, 243, 243,
+  436, 239, 245, 245, 245, 242, 248, 248, 248, 255,
+  255, 255, 235, 243, 256, 256, 256, 399, 245, 258,
+  258, 258, 248, 248, 435, 255, 259, 259, 259, 260,
+
+  260, 260, 261, 261, 261, 262, 262, 262, 475, 262,
+  245, 398, 262, 263, 263, 263, 385, 261, 264, 264,
+  264, 267, 267, 267, 255, 265, 265, 265, 263, 265,
+  475, 398, 265, 264, 268, 268, 268, 267, 269, 269,
+  269, 386, 269, 385, 498, 269, 270, 270, 270, 268,
+  272, 272, 272, 426, 276, 276, 276, 267, 280, 280,
+  280, 270, 273, 273, 273, 272, 273, 498, 386, 273,
+  276, 285, 285, 285, 280, 287, 287, 287, 288, 288,
+  288, 289, 289, 289, 290, 290, 290, 291, 291, 291,
+  276, 287, 388, 441, 280, 292, 292, 292, 293, 293,
+
+  293, 486, 293, 441, 388, 293, 296, 296, 296, 280,
+  453, 297, 297, 297, 287, 297, 389, 486, 297, 510,
+  453, 296, 298, 298, 298, 452, 298, 427, 389, 298,
+  302, 302, 302, 303, 303, 303, 452, 303, 429, 427,
+  303, 306, 306, 306, 454, 510, 302, 307, 307, 307,
+  429, 307, 462, 431, 307, 454, 306, 308, 308, 308,
+  309, 309, 309, 462, 309, 431, 480, 309, 312, 312,
+  312, 476, 308, 313, 313, 313, 314, 314, 314, 320,
+  320, 320, 425, 312, 322, 322, 322, 440, 313, 323,
+  323, 323, 314, 476, 324, 324, 324, 480, 324, 440,
+
+  322, 324, 328, 328, 328, 330, 330, 330, 487, 330,
+  442, 463, 330, 333, 333, 333, 478, 463, 328, 334,
+  334, 334, 442, 334, 487, 493, 334, 424, 333, 335,
+  335, 335, 336, 336, 336, 504, 336, 466, 478, 336,
+  337, 337, 337, 466, 335, 338, 338, 338, 479, 338,
+  481, 482, 338, 496, 493, 337, 339, 339, 339, 346,
+  346, 346, 349, 349, 349, 483, 349, 470, 423, 349,
+  479, 504, 339, 482, 470, 346, 352, 352, 352, 484,
+  352, 481, 496, 352, 355, 355, 355, 483, 355, 511,
+  505, 355, 359, 359, 359, 365, 365, 365, 368, 368,
+
+  368, 369, 369, 369, 370, 370, 370, 497, 359, 499,
+  484, 365, 490, 368, 485, 511, 369, 488, 491, 370,
+  376, 376, 376, 377, 377, 377, 505, 377, 490, 489,
+  377, 365, 499, 365, 491, 376, 497, 494, 365, 378,
+  378, 378, 379, 379, 379, 485, 379, 495, 488, 379,
+  380, 380, 380, 494, 378, 381, 381, 381, 500, 381,
+  489, 414, 381, 495, 413, 380, 387, 387, 387, 412,
+  387, 508, 411, 387, 390, 390, 390, 509, 390, 501,
+  512, 390, 393, 393, 393, 404, 393, 500, 502, 393,
+  400, 400, 400, 405, 405, 405, 407, 407, 407, 408,
+
+  408, 408, 409, 409, 409, 400, 400, 508, 501, 405,
+  503, 502, 407, 509, 408, 408, 512, 409, 409, 410,
+  410, 410, 506, 410, 507, 513, 410, 415, 415, 415,
+  416, 416, 416, 503, 516, 410, 417, 417, 417, 418,
+  418, 418, 517, 415, 514, 506, 416, 507, 520, 403,
+  528, 402, 417, 415, 418, 418, 419, 419, 419, 516,
+  419, 513, 417, 419, 420, 420, 420, 517, 420, 528,
+  514, 420, 419, 520, 428, 428, 428, 447, 447, 447,
+  420, 421, 421, 421, 421, 421, 421, 421, 421, 421,
+  428, 401, 421, 447, 447, 421, 421, 421, 421, 421,
+
+  428, 521, 362, 522, 529, 534, 458, 458, 458, 515,
+  522, 421, 421, 422, 422, 422, 422, 422, 422, 422,
+  422, 422, 458, 529, 422, 535, 521, 422, 422, 422,
+  422, 422, 430, 430, 430, 515, 430, 538, 534, 430,
+  532, 358, 458, 422, 422, 469, 469, 469, 430, 433,
+  433, 433, 433, 433, 433, 433, 433, 433, 535, 532,
+  433, 469, 523, 433, 433, 433, 433, 433, 518, 523,
+  538, 526, 533, 539, 471, 471, 471, 519, 526, 433,
+  433, 434, 434, 434, 434, 434, 434, 434, 434, 434,
+  471, 533, 434, 524, 518, 434, 434, 434, 434, 434,
+
+  472, 472, 472, 519, 472, 525, 539, 472, 473, 473,
+  473, 434, 434, 474, 474, 474, 472, 474, 524, 527,
+  474, 477, 477, 477, 473, 477, 527, 530, 477, 474,
+  525, 531, 536, 537, 530, 540, 541, 477, 531, 542,
+  543, 544, 545, 548, 546, 549, 550, 348, 547, 345,
+  551, 536, 537, 341, 540, 541, 546, 547, 550, 551,
+  544, 545, 548, 553, 549, 552, 552, 552, 554, 555,
+  555, 555, 542, 543, 327, 553, 321, 554, 556, 556,
+  556, 552, 558, 558, 558, 555, 559, 559, 559, 561,
+  561, 561, 315, 301, 556, 286, 282, 279, 558, 277,
+
+  275, 274, 559, 271, 266, 561, 564, 564, 564, 564,
+  564, 564, 564, 565, 565, 565, 565, 565, 565, 565,
+  566, 566, 566, 566, 566, 566, 566, 567, 567, 567,
+  567, 567, 567, 567, 568, 568, 568, 568, 568, 568,
+  568, 569, 569, 569, 569, 569, 569, 569, 570, 570,
+  570, 570, 570, 570, 570, 571, 571, 571, 571, 571,
+  571, 571, 572, 572, 572, 572, 572, 572, 572, 573,
+  573, 573, 573, 573, 573, 573, 574, 574, 574, 574,
+  574, 574, 574, 575, 575, 575, 257, 575, 576, 576,
+  576, 254, 576, 577, 577, 577, 253, 577, 578, 578,
+
+  578, 578, 578, 252, 578, 579, 251, 579, 580, 246,
+  580, 581, 241, 581, 582, 582, 582, 582, 582, 582,
+  582, 583, 240, 238, 583, 584, 584, 584, 584, 584,
+  584, 585, 585, 585, 585, 585, 585, 586, 586, 586,
+  586, 586, 586, 587, 587, 587, 587, 587, 587, 587,
+  588, 588, 588, 588, 588, 588, 588, 589, 589, 589,
+  589, 589, 589, 589, 590, 590, 590, 590, 590, 590,
+  590, 591, 591, 591, 591, 591, 591, 591, 592, 592,
+  592, 592, 592, 592, 592, 593, 593, 593, 593, 593,
+  593, 593, 237, 231, 229, 227, 226, 225, 224, 223,
+
+  218, 217, 216, 213, 212, 211, 209, 205, 203, 200,
+  199, 198, 197, 196, 195, 192, 191, 190, 189, 188,
+  187, 186, 185, 184, 181, 180, 178, 177, 176, 175,
+  174, 170, 168, 167, 166, 165, 164, 163, 162, 161,
+  160, 159, 158, 155, 154, 153, 152, 151, 148, 147,
+  146, 145, 144, 143, 142, 139, 138, 137, 136, 135,
+  129, 128, 126, 123, 122, 118, 117, 116, 114, 110,
+  103, 102, 101, 100, 96, 85, 81, 77, 76, 75,
+  69, 68, 66, 63, 51, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563, 563, 563, 563, 563, 563, 563, 563, 563, 563,
+  563
+};
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[93] =
-    {   0,
-0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 
-    1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
-    1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 
-    1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,     };
+static yyconst flex_int32_t yy_rule_can_match_eol[93] = { 0,
+  0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
+  1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+  1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+  1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0,
+};
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -1094,18 +1083,18 @@ char *xbt_graph_parse_text;
 
 /* Version strings. */
 const char rcs_graphxml_flexml_skeleton[] =
- "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
 "$" "Id: skel,v 1.40 2007/10/11 09:57:24 mquinson Exp $";
 const char rcs_graphxml_flexml[] =
- "$" "Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp $";
 "$" "Id: flexml.pl,v 1.63 2007/10/11 14:46:08 mquinson Exp $";
 
 /* ANSI headers. */
-#include <stdlib.h> /* for realloc() -- needed here when using flex 2.5.4 */
+#include <stdlib.h>             /* for realloc() -- needed here when using flex 2.5.4 */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 #include <stdarg.h>
 #include <ctype.h>
-     
+
 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__TOS_WIN__)
 # ifndef __STRICT_ANSI__
 #  include <io.h>
@@ -1114,7 +1103,7 @@ const char rcs_graphxml_flexml[] =
 #else
 # include <unistd.h>
 #endif
-     
+
 #ifndef FLEXML_INDEXSTACKSIZE
 #define FLEXML_INDEXSTACKSIZE 1000
 #endif
@@ -1161,9 +1150,9 @@ AT_graphxml_edge_name AX_graphxml_edge_name;
 # define ENTER(state)  debug_enter(state,#state)
 # define LEAVE         debug_leave()
 # define SET(state)    debug_set(state,#state)
-  static void debug_enter(int, const char*);
-  static void debug_leave(void);
-  static void debug_set(int, const char*);
+static void debug_enter(int, const char *);
+static void debug_leave(void);
+static void debug_set(int, const char *);
 #else
 # define ENTER(state)  (yy_push_state(state))
 # define LEAVE         (yy_pop_state())
@@ -1171,21 +1160,22 @@ AT_graphxml_edge_name AX_graphxml_edge_name;
 #endif
 
 /* Generic actions. */
-#define SKIP   /*skip*/
+#define SKIP                    /*skip */
 #define SUCCEED        CLEANUP; return 0
 
 #define FAIL   return fail
-static int fail(const char*, ...);
+static int fail(const char *, ...);
 
-enum {flexml_max_err_msg_size = 512};
+enum { flexml_max_err_msg_size = 512 };
 static char flexml_err_msg[flexml_max_err_msg_size];
-const char * graphxml_parse_err_msg()
+const char *graphxml_parse_err_msg()
 {
-    return flexml_err_msg;
+  return flexml_err_msg;
 }
+
 static void reset_graphxml_parse_err_msg()
 {
-    flexml_err_msg[0] = '\0';
+  flexml_err_msg[0] = '\0';
 }
 
 /* Cleanup */
@@ -1210,39 +1200,44 @@ static int inext = 1;
 /* after this is called, there are at least 2 slots left in the stack */
 static int ck_blimit()
 {
-     if (bnext >= blimit) {
-        blimit += FLEXML_BUFFERSTACKSIZE + 2;
-        {
-            char *temp = (char *) realloc(graphxml_bufferstack, blimit);
-            assert(temp);
-            graphxml_bufferstack = temp;
-        }
-     }
-     return 0;
+  if (bnext >= blimit) {
+    blimit += FLEXML_BUFFERSTACKSIZE + 2;
+    {
+      char *temp = (char *) realloc(graphxml_bufferstack, blimit);
+      assert(temp);
+      graphxml_bufferstack = temp;
+    }
+  }
+  return 0;
 }
 
 /* after this is called, there are at least 2 slots left in the stack */
 static int ck_ilimit()
 {
-     if (inext >= ilimit) {
-        ilimit += FLEXML_INDEXSTACKSIZE + 2;
-        {
-            int *temp = (int *) realloc(indexstack, ilimit);
-            assert(temp);
-            indexstack = temp;
-        }
-     }
-     return 0;
+  if (inext >= ilimit) {
+    ilimit += FLEXML_INDEXSTACKSIZE + 2;
+    {
+      int *temp = (int *) realloc(indexstack, ilimit);
+      assert(temp);
+      indexstack = temp;
+    }
+  }
+  return 0;
 }
 
 #ifdef FLEXML_NEED_BUFFERLIT
-static void graphxml_bufferliteral(char c, int* pp, const char* text)
+static void graphxml_bufferliteral(char c, int *pp, const char *text)
 {
-  const char *s = (c ? strchr(text,c) : text-1), *e = strrchr(text,c);
-  assert(s <= e); BUFFERSET(*pp);
-  while (++s<e) {
-    if (isspace(*s) && c) { BUFFERPUTC(' '); while (isspace(*s)) ++s; }
-    else BUFFERPUTC(*s);
+  const char *s = (c ? strchr(text, c) : text - 1), *e = strrchr(text, c);
+  assert(s <= e);
+  BUFFERSET(*pp);
+  while (++s < e) {
+    if (isspace(*s) && c) {
+      BUFFERPUTC(' ');
+      while (isspace(*s))
+        ++s;
+    } else
+      BUFFERPUTC(*s);
   }
   BUFFERDONE;
 }
@@ -1250,16 +1245,16 @@ static void graphxml_bufferliteral(char c, int* pp, const char* text)
 
 static void pushbuffer(int p)
 {
-    ck_ilimit();
-    indexstack[inext++] = p;
-    indexstack[inext++] = bnext;    
+  ck_ilimit();
+  indexstack[inext++] = p;
+  indexstack[inext++] = bnext;
 }
 
 static int popbuffer(void)
 {
-    assert(inext >= 2);
-    bnext = indexstack[--inext];
-    return indexstack[--inext];
+  assert(inext >= 2);
+  bnext = indexstack[--inext];
+  return indexstack[--inext];
 }
 
 /* General internal entities are `unput' back onto the input stream... */
@@ -1291,7 +1286,7 @@ static int popbuffer(void)
  */
 
 /* State names. */
-const char* *graphxml_statenames=NULL;
+const char **graphxml_statenames = NULL;
 
 #define INITIAL 0
 #define PROLOG 1
@@ -1338,36 +1333,36 @@ const char* *graphxml_statenames=NULL;
 #define YY_EXTRA_TYPE void *
 #endif
 
-static int yy_init_globals (void );
+static int yy_init_globals(void);
 
 /* Accessor methods to globals.
    These are made visible to non-reentrant scanners for convenience. */
 
-int xbt_graph_parse_lex_destroy (void );
+int xbt_graph_parse_lex_destroy(void);
 
-int xbt_graph_parse_get_debug (void );
+int xbt_graph_parse_get_debug(void);
 
-void xbt_graph_parse_set_debug (int debug_flag  );
+void xbt_graph_parse_set_debug(int debug_flag);
 
-YY_EXTRA_TYPE xbt_graph_parse_get_extra (void );
+YY_EXTRA_TYPE xbt_graph_parse_get_extra(void);
 
-void xbt_graph_parse_set_extra (YY_EXTRA_TYPE user_defined  );
+void xbt_graph_parse_set_extra(YY_EXTRA_TYPE user_defined);
 
-FILE *xbt_graph_parse_get_in (void );
+FILE *xbt_graph_parse_get_in(void);
 
-void xbt_graph_parse_set_in  (FILE * in_str  );
+void xbt_graph_parse_set_in(FILE * in_str);
 
-FILE *xbt_graph_parse_get_out (void );
+FILE *xbt_graph_parse_get_out(void);
 
-void xbt_graph_parse_set_out  (FILE * out_str  );
+void xbt_graph_parse_set_out(FILE * out_str);
 
-int xbt_graph_parse_get_leng (void );
+int xbt_graph_parse_get_leng(void);
 
-char *xbt_graph_parse_get_text (void );
+char *xbt_graph_parse_get_text(void);
 
-int xbt_graph_parse_get_lineno (void );
+int xbt_graph_parse_get_lineno(void);
 
-void xbt_graph_parse_set_lineno (int line_number  );
+void xbt_graph_parse_set_lineno(int line_number);
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -1375,38 +1370,38 @@ void xbt_graph_parse_set_lineno (int line_number  );
 
 #ifndef YY_SKIP_YYWRAP
 #ifdef __cplusplus
-extern "C" int xbt_graph_parse_wrap (void );
+extern "C" int xbt_graph_parse_wrap(void);
 #else
-extern int xbt_graph_parse_wrap (void );
+extern int xbt_graph_parse_wrap(void);
 #endif
 #endif
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
+static void yy_flex_strncpy(char *, yyconst char *, int);
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
+static int yy_flex_strlen(yyconst char *);
 #endif
 
 #ifndef YY_NO_INPUT
 
 #ifdef __cplusplus
-static int yyinput (void );
+static int yyinput(void);
 #else
-static int input (void );
+static int input(void);
 #endif
 
 #endif
 
-        static int yy_start_stack_ptr = 0;
-        static int yy_start_stack_depth = 0;
-        static int *yy_start_stack = NULL;
-    
-    static void yy_push_state (int new_state );
-    
-    static void yy_pop_state (void );
-    
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = NULL;
+
+static void yy_push_state(int new_state);
+
+static void yy_pop_state(void);
+
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
 #define YY_READ_BUF_SIZE 8192
@@ -1482,7 +1477,7 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int xbt_graph_parse_lex (void);
+extern int xbt_graph_parse_lex(void);
 
 #define YY_DECL int xbt_graph_parse_lex (void)
 #endif /* !YY_DECL */
@@ -1504,458 +1499,386 @@ extern int xbt_graph_parse_lex (void);
 
 /** The main scanner function which does all the work.
  */
-YY_DECL
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp, *yy_bp;
-       register int yy_act;
-    
- /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
- SET(PROLOG);
- reset_graphxml_parse_err_msg();
- graphxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
- assert(graphxml_bufferstack);
- #ifdef FLEX_DEBUG
- {
-     int i;
-     for (i = 0; i < blimit; i++) {
-         graphxml_bufferstack[i] = '\377';
-     }
- }
- #endif
- graphxml_bufferstack[0] = '\0';
- indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
- assert(indexstack);
- indexstack[0] = 0;
+YY_DECL {
+  register yy_state_type yy_current_state;
+  register char *yy_cp, *yy_bp;
+  register int yy_act;
+
+  /* Bypass Flex's default INITIAL state and begin by parsing the XML prolog. */
+  SET(PROLOG);
+  reset_graphxml_parse_err_msg();
+  graphxml_bufferstack = (char *) malloc(FLEXML_BUFFERSTACKSIZE);
+  assert(graphxml_bufferstack);
+#ifdef FLEX_DEBUG
+  {
+    int i;
+    for (i = 0; i < blimit; i++) {
+      graphxml_bufferstack[i] = '\377';
+    }
+  }
+#endif
+  graphxml_bufferstack[0] = '\0';
+  indexstack = (int *) malloc(FLEXML_INDEXSTACKSIZE * sizeof(int));
+  assert(indexstack);
+  indexstack[0] = 0;
 
   /* FleXML_init */
   bnext = inext = 1;
   graphxml_bufferliteral('\0', &bnext, "-1.0");
   graphxml_bufferliteral('\0', &bnext, "-1.0");
   graphxml_bufferliteral('\0', &bnext, "-1.0");
-  if(!graphxml_statenames) {graphxml_statenames= (const char **)calloc(IMPOSSIBLE,sizeof(char*));
-  graphxml_statenames[PROLOG] = NULL;
-  graphxml_statenames[DOCTYPE] = NULL;
-  graphxml_statenames[EPILOG] = NULL;
-  graphxml_statenames[INCOMMENT] = NULL;
-  graphxml_statenames[INPI] = NULL;
-  graphxml_statenames[VALUE1] = NULL;
-  graphxml_statenames[VALUE2] = NULL;
-  graphxml_statenames[CDATA] = NULL;
-  graphxml_statenames[ROOT_graphxml_graph] = NULL;
-  graphxml_statenames[AL_graphxml_graph] = NULL;
-  graphxml_statenames[S_graphxml_graph] = "graph";
-  graphxml_statenames[S_graphxml_graph_1] = "graph";
-  graphxml_statenames[S_graphxml_graph_2] = "graph";
-  graphxml_statenames[S_graphxml_graph_3] = "graph";
-  graphxml_statenames[S_graphxml_graph_4] = "graph";
-  graphxml_statenames[S_graphxml_graph_5] = "graph";
-  graphxml_statenames[E_graphxml_graph] = "graph";
-  graphxml_statenames[ROOT_graphxml_node] = NULL;
-  graphxml_statenames[AL_graphxml_node] = NULL;
-  graphxml_statenames[E_graphxml_node] = "node";
-  graphxml_statenames[ROOT_graphxml_edge] = NULL;
-  graphxml_statenames[AL_graphxml_edge] = NULL;
-  graphxml_statenames[E_graphxml_edge] = "edge";
+  if (!graphxml_statenames) {
+    graphxml_statenames = (const char **) calloc(IMPOSSIBLE, sizeof(char *));
+    graphxml_statenames[PROLOG] = NULL;
+    graphxml_statenames[DOCTYPE] = NULL;
+    graphxml_statenames[EPILOG] = NULL;
+    graphxml_statenames[INCOMMENT] = NULL;
+    graphxml_statenames[INPI] = NULL;
+    graphxml_statenames[VALUE1] = NULL;
+    graphxml_statenames[VALUE2] = NULL;
+    graphxml_statenames[CDATA] = NULL;
+    graphxml_statenames[ROOT_graphxml_graph] = NULL;
+    graphxml_statenames[AL_graphxml_graph] = NULL;
+    graphxml_statenames[S_graphxml_graph] = "graph";
+    graphxml_statenames[S_graphxml_graph_1] = "graph";
+    graphxml_statenames[S_graphxml_graph_2] = "graph";
+    graphxml_statenames[S_graphxml_graph_3] = "graph";
+    graphxml_statenames[S_graphxml_graph_4] = "graph";
+    graphxml_statenames[S_graphxml_graph_5] = "graph";
+    graphxml_statenames[E_graphxml_graph] = "graph";
+    graphxml_statenames[ROOT_graphxml_node] = NULL;
+    graphxml_statenames[AL_graphxml_node] = NULL;
+    graphxml_statenames[E_graphxml_node] = "node";
+    graphxml_statenames[ROOT_graphxml_edge] = NULL;
+    graphxml_statenames[AL_graphxml_edge] = NULL;
+    graphxml_statenames[E_graphxml_edge] = "edge";
   }
 
- /* COMMENTS and PIs: handled uniformly for efficiency. */
 /* COMMENTS and PIs: handled uniformly for efficiency. */
 
-       if ( !(yy_init) )
-               {
-               (yy_init) = 1;
+  if (!(yy_init)) {
+    (yy_init) = 1;
 
 #ifdef YY_USER_INIT
-               YY_USER_INIT;
+    YY_USER_INIT;
 #endif
 
-               if ( ! (yy_start) )
-                       (yy_start) = 1; /* first start state */
-
-               if ( ! xbt_graph_parse_in )
-                       xbt_graph_parse_in = stdin;
-
-               if ( ! xbt_graph_parse_out )
-                       xbt_graph_parse_out = stdout;
-
-               if ( ! YY_CURRENT_BUFFER ) {
-                       xbt_graph_parse_ensure_buffer_stack ();
-                       YY_CURRENT_BUFFER_LVALUE =
-                               xbt_graph_parse__create_buffer(xbt_graph_parse_in,YY_BUF_SIZE );
-               }
-
-               xbt_graph_parse__load_buffer_state( );
-               }
-
-       while ( 1 )             /* loops until end-of-file is reached */
-               {
-               yy_cp = (yy_c_buf_p);
-
-               /* Support of xbt_graph_parse_text. */
-               *yy_cp = (yy_hold_char);
-
-               /* yy_bp points to the position in yy_ch_buf of the start of
-                * the current run.
-                */
-               yy_bp = yy_cp;
-
-               yy_current_state = (yy_start);
-yy_match:
-               do
-                       {
-                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
-                       if ( yy_accept[yy_current_state] )
-                               {
-                               (yy_last_accepting_state) = yy_current_state;
-                               (yy_last_accepting_cpos) = yy_cp;
-                               }
-                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                               {
-                               yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 564 )
-                                       yy_c = yy_meta[(unsigned int) yy_c];
-                               }
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-                       ++yy_cp;
-                       }
-               while ( yy_base[yy_current_state] != 1586 );
-
-yy_find_action:
-               yy_act = yy_accept[yy_current_state];
-               if ( yy_act == 0 )
-                       { /* have to back up */
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       yy_act = yy_accept[yy_current_state];
-                       }
-
-               YY_DO_BEFORE_ACTION;
-
-               if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
-                       {
-                       int yyl;
-                       for ( yyl = 0; yyl < xbt_graph_parse_leng; ++yyl )
-                               if ( xbt_graph_parse_text[yyl] == '\n' )
-                                          
-    xbt_graph_parse_lineno++;
-;
-                       }
-
-do_action:     /* This label is used only to access EOF actions. */
-
-               switch ( yy_act )
-       { /* beginning of action switch */
-                       case 0: /* must back up */
-                       /* undo the effects of YY_DO_BEFORE_ACTION */
-                       *yy_cp = (yy_hold_char);
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-ENTER(INCOMMENT);
-       YY_BREAK
-case 2:
-YY_RULE_SETUP
-ENTER(INPI);
-       YY_BREAK
-
-case 3:
-YY_RULE_SETUP
-LEAVE;
-       YY_BREAK
-case 4:
-case 5:
-case 6:
+    if (!(yy_start))
+      (yy_start) = 1;           /* first start state */
+
+    if (!xbt_graph_parse_in)
+      xbt_graph_parse_in = stdin;
+
+    if (!xbt_graph_parse_out)
+      xbt_graph_parse_out = stdout;
+
+    if (!YY_CURRENT_BUFFER) {
+      xbt_graph_parse_ensure_buffer_stack();
+      YY_CURRENT_BUFFER_LVALUE =
+        xbt_graph_parse__create_buffer(xbt_graph_parse_in, YY_BUF_SIZE);
+    }
+
+    xbt_graph_parse__load_buffer_state();
+  }
+
+  while (1) {                   /* loops until end-of-file is reached */
+    yy_cp = (yy_c_buf_p);
+
+    /* Support of xbt_graph_parse_text. */
+    *yy_cp = (yy_hold_char);
+
+    /* yy_bp points to the position in yy_ch_buf of the start of
+     * the current run.
+     */
+    yy_bp = yy_cp;
+
+    yy_current_state = (yy_start);
+  yy_match:
+    do {
+      register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+      if (yy_accept[yy_current_state]) {
+        (yy_last_accepting_state) = yy_current_state;
+        (yy_last_accepting_cpos) = yy_cp;
+      }
+      while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+        yy_current_state = (int) yy_def[yy_current_state];
+        if (yy_current_state >= 564)
+          yy_c = yy_meta[(unsigned int) yy_c];
+      }
+      yy_current_state =
+        yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+      ++yy_cp;
+    }
+    while (yy_base[yy_current_state] != 1586);
+
+  yy_find_action:
+    yy_act = yy_accept[yy_current_state];
+    if (yy_act == 0) {          /* have to back up */
+      yy_cp = (yy_last_accepting_cpos);
+      yy_current_state = (yy_last_accepting_state);
+      yy_act = yy_accept[yy_current_state];
+    }
+
+    YY_DO_BEFORE_ACTION;
+
+    if (yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]) {
+      int yyl;
+      for (yyl = 0; yyl < xbt_graph_parse_leng; ++yyl)
+        if (xbt_graph_parse_text[yyl] == '\n')
+
+          xbt_graph_parse_lineno++;
+      ;
+    }
+
+  do_action:                   /* This label is used only to access EOF actions. */
+
+    switch (yy_act) {           /* beginning of action switch */
+    case 0:                    /* must back up */
+      /* undo the effects of YY_DO_BEFORE_ACTION */
+      *yy_cp = (yy_hold_char);
+      yy_cp = (yy_last_accepting_cpos);
+      yy_current_state = (yy_last_accepting_state);
+      goto yy_find_action;
+
+    case 1:
+      YY_RULE_SETUP ENTER(INCOMMENT);
+      YY_BREAK case 2:YY_RULE_SETUP ENTER(INPI);
+      YY_BREAK case 3:YY_RULE_SETUP LEAVE;
+      YY_BREAK case 4:case 5:case 6:
 /* rule 6 can match eol */
-YY_RULE_SETUP
-SKIP;
-       YY_BREAK
-case YY_STATE_EOF(INCOMMENT):
-FAIL("EOF in comment.");
-       YY_BREAK
-
-case 7:
-YY_RULE_SETUP
-LEAVE;
-       YY_BREAK
-case 8:
-case 9:
+        YY_RULE_SETUP SKIP;
+      YY_BREAK case YY_STATE_EOF(INCOMMENT):FAIL("EOF in comment.");
+      YY_BREAK case 7:YY_RULE_SETUP LEAVE;
+      YY_BREAK case 8:case 9:
 /* rule 9 can match eol */
-YY_RULE_SETUP
-SKIP;
-       YY_BREAK
-case YY_STATE_EOF(INPI):
-FAIL("EOF in PI (processing instruction).");
-       YY_BREAK
-
+        YY_RULE_SETUP SKIP;
+      YY_BREAK case
+        YY_STATE_EOF(INPI):FAIL("EOF in PI (processing instruction).");
+      YY_BREAK
 /* SPACES: skipped uniformly */
-case 10:
+    case 10:
 /* rule 10 can match eol */
-YY_RULE_SETUP
-SKIP;
-       YY_BREAK
+      YY_RULE_SETUP SKIP;
+      YY_BREAK
 /* PROLOG: determine root element and process it. */
-
-case 11:
+    case 11:
 /* rule 11 can match eol */
-YY_RULE_SETUP
-SET(DOCTYPE); 
-       YY_BREAK
-case 12:
+      YY_RULE_SETUP SET(DOCTYPE);
+      YY_BREAK case 12:
 /* rule 12 can match eol */
-YY_RULE_SETUP
-FAIL("Bad declaration %s.",xbt_graph_parse_text);
-       YY_BREAK
-
-case 13:
+        YY_RULE_SETUP FAIL("Bad declaration %s.", xbt_graph_parse_text);
+      YY_BREAK case 13:
 /* rule 13 can match eol */
-YY_RULE_SETUP
-SET(ROOT_graphxml_edge);
-       YY_BREAK
-case 14:
+        YY_RULE_SETUP SET(ROOT_graphxml_edge);
+      YY_BREAK case 14:
 /* rule 14 can match eol */
-YY_RULE_SETUP
-SET(ROOT_graphxml_node);
-       YY_BREAK
-case 15:
+        YY_RULE_SETUP SET(ROOT_graphxml_node);
+      YY_BREAK case 15:
 /* rule 15 can match eol */
-YY_RULE_SETUP
-SET(ROOT_graphxml_graph);
-       YY_BREAK
-case 16:
+        YY_RULE_SETUP SET(ROOT_graphxml_graph);
+      YY_BREAK case 16:
 /* rule 16 can match eol */
-YY_RULE_SETUP
-FAIL("Bad declaration %s.",xbt_graph_parse_text);
-       YY_BREAK
-case 17:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in prolog.", xbt_graph_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(PROLOG):
-case YY_STATE_EOF(DOCTYPE):
-FAIL("EOF in prolog.");
-       YY_BREAK
-
+        YY_RULE_SETUP FAIL("Bad declaration %s.", xbt_graph_parse_text);
+      YY_BREAK case 17:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in prolog.", xbt_graph_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(PROLOG):case
+        YY_STATE_EOF(DOCTYPE):FAIL("EOF in prolog.");
+      YY_BREAK
 /* RULES DERIVED FROM DTD. */
 /* <!-- Small DTD for xbt graphs. -->  */
 /*     isDirected (true|false) "true"
   * >  */
-case 18:
+    case 18:
 /* rule 18 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <graph> is not allowed here.");
-       YY_BREAK
-case 19:
+      YY_RULE_SETUP FAIL("Starting tag <graph> is not allowed here.");
+      YY_BREAK case 19:
 /* rule 19 can match eol */
-YY_RULE_SETUP
-{
-  AX_graphxml_graph_isDirected = A_graphxml_graph_isDirected_true;
-  ENTER(AL_graphxml_graph); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 20:
+        YY_RULE_SETUP {
+        AX_graphxml_graph_isDirected = A_graphxml_graph_isDirected_true;
+        ENTER(AL_graphxml_graph);
+        pushbuffer(0);
+      } YY_BREAK case 20:
 /* rule 20 can match eol */
-case 21:
+      case 21:
 /* rule 21 can match eol */
-YY_RULE_SETUP
-A_graphxml_graph_isDirected = A_graphxml_graph_isDirected_true;
-       YY_BREAK
-case 22:
+       
+        YY_RULE_SETUP
+        A_graphxml_graph_isDirected = A_graphxml_graph_isDirected_true;
+      YY_BREAK case 22:
 /* rule 22 can match eol */
-case 23:
+      case 23:
 /* rule 23 can match eol */
-YY_RULE_SETUP
-A_graphxml_graph_isDirected = A_graphxml_graph_isDirected_false;
-       YY_BREAK
-case 24:
-YY_RULE_SETUP
-{
-  LEAVE; STag_graphxml_graph();graphxml_pcdata_ix = 0; ENTER(S_graphxml_graph);
- }
-       YY_BREAK
-case 25:
-YY_RULE_SETUP
-{
-  LEAVE; STag_graphxml_graph(); graphxml_pcdata_ix = 0; ETag_graphxml_graph(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case ROOT_graphxml_graph: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 26:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of graph element.", xbt_graph_parse_text[0]);
-       YY_BREAK
-case 27:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `graph' element start tag.",xbt_graph_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_graphxml_graph):
-FAIL("EOF in attribute list of `graph' element.");
-       YY_BREAK
-
-case 28:
+       
+        YY_RULE_SETUP
+        A_graphxml_graph_isDirected = A_graphxml_graph_isDirected_false;
+      YY_BREAK case 24:YY_RULE_SETUP {
+        LEAVE;
+        STag_graphxml_graph();
+        graphxml_pcdata_ix = 0;
+        ENTER(S_graphxml_graph);
+      } YY_BREAK case 25:YY_RULE_SETUP {
+        LEAVE;
+        STag_graphxml_graph();
+        graphxml_pcdata_ix = 0;
+        ETag_graphxml_graph();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case ROOT_graphxml_graph:
+          SET(EPILOG);
+          break;
+      }} YY_BREAK case 26:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of graph element.",
+             xbt_graph_parse_text[0]);
+      YY_BREAK case 27:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `graph' element start tag.",
+             xbt_graph_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_graphxml_graph):FAIL
+        ("EOF in attribute list of `graph' element.");
+      YY_BREAK case 28:
 /* rule 28 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_graphxml_graph();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case ROOT_graphxml_graph: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 29:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_graphxml_graph();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case ROOT_graphxml_graph:
+          SET(EPILOG);
+          break;
+      }} YY_BREAK case 29:
 /* rule 29 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</graph>' expected.",xbt_graph_parse_text);
-       YY_BREAK
-case 30:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</graph>' expected.",xbt_graph_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(S_graphxml_graph_1):
-case YY_STATE_EOF(E_graphxml_graph):
-case YY_STATE_EOF(S_graphxml_graph_3):
-case YY_STATE_EOF(S_graphxml_graph_5):
-case YY_STATE_EOF(S_graphxml_graph):
-FAIL("Premature EOF: `</graph>' expected.");
-       YY_BREAK
-
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</graph>' expected.",
+             xbt_graph_parse_text);
+      YY_BREAK case 30:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</graph>' expected.",
+             xbt_graph_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(S_graphxml_graph_1):case
+        YY_STATE_EOF(E_graphxml_graph):case
+        YY_STATE_EOF(S_graphxml_graph_3):case
+        YY_STATE_EOF(S_graphxml_graph_5):case
+        YY_STATE_EOF(S_graphxml_graph):FAIL
+        ("Premature EOF: `</graph>' expected.");
+      YY_BREAK
 /*     label           CDATA                ""
   *     name            CDATA                #REQUIRED
   *     data            CDATA                ""
   *     position_x         CDATA                "-1.0"
   *     position_y         CDATA                "-1.0"
   * >  */
-case 31:
+    case 31:
 /* rule 31 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <node> is not allowed here.");
-       YY_BREAK
-case 32:
+      YY_RULE_SETUP FAIL("Starting tag <node> is not allowed here.");
+      YY_BREAK case 32:
 /* rule 32 can match eol */
-YY_RULE_SETUP
-{
-  AX_graphxml_node_label = 0;
-  AX_graphxml_node_name = 0;
-  AX_graphxml_node_data = 0;
-  AX_graphxml_node_position_x = 1;
-  AX_graphxml_node_position_y = 6;
-  ENTER(AL_graphxml_node); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 33:
+        YY_RULE_SETUP {
+        AX_graphxml_node_label = 0;
+        AX_graphxml_node_name = 0;
+        AX_graphxml_node_data = 0;
+        AX_graphxml_node_position_x = 1;
+        AX_graphxml_node_position_y = 6;
+        ENTER(AL_graphxml_node);
+        pushbuffer(0);
+      } YY_BREAK case 33:
 /* rule 33 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_node_label);
-       YY_BREAK
-case 34:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_node_label);
+      YY_BREAK case 34:
 /* rule 34 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_node_label);
-       YY_BREAK
-case 35:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_node_label);
+      YY_BREAK case 35:
 /* rule 35 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_node_name);
-       YY_BREAK
-case 36:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_node_name);
+      YY_BREAK case 36:
 /* rule 36 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_node_name);
-       YY_BREAK
-case 37:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_node_name);
+      YY_BREAK case 37:
 /* rule 37 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_node_data);
-       YY_BREAK
-case 38:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_node_data);
+      YY_BREAK case 38:
 /* rule 38 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_node_data);
-       YY_BREAK
-case 39:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_node_data);
+      YY_BREAK case 39:
 /* rule 39 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_node_position_x);
-       YY_BREAK
-case 40:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_node_position_x);
+      YY_BREAK case 40:
 /* rule 40 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_node_position_x);
-       YY_BREAK
-case 41:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_node_position_x);
+      YY_BREAK case 41:
 /* rule 41 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_node_position_y);
-       YY_BREAK
-case 42:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_node_position_y);
+      YY_BREAK case 42:
 /* rule 42 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_node_position_y);
-       YY_BREAK
-case 43:
-YY_RULE_SETUP
-{
-  if (!AX_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element.");
-  LEAVE; STag_graphxml_node();graphxml_pcdata_ix = 0; ENTER(E_graphxml_node);
- }
-       YY_BREAK
-case 44:
-YY_RULE_SETUP
-{
-  if (!AX_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element.");
-  LEAVE; STag_graphxml_node(); graphxml_pcdata_ix = 0; ETag_graphxml_node(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_graphxml_graph_2: case S_graphxml_graph_3: case S_graphxml_graph: SET(S_graphxml_graph_3); break;
-   case ROOT_graphxml_node: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 45:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of node element.", xbt_graph_parse_text[0]);
-       YY_BREAK
-case 46:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `node' element start tag.",xbt_graph_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_graphxml_node):
-FAIL("EOF in attribute list of `node' element.");
-       YY_BREAK
-
-case 47:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_node_position_y);
+      YY_BREAK case 43:YY_RULE_SETUP {
+        if (!AX_graphxml_node_name)
+          FAIL("Required attribute `name' not set for `node' element.");
+        LEAVE;
+        STag_graphxml_node();
+        graphxml_pcdata_ix = 0;
+        ENTER(E_graphxml_node);
+      } YY_BREAK case 44:YY_RULE_SETUP {
+        if (!AX_graphxml_node_name)
+          FAIL("Required attribute `name' not set for `node' element.");
+        LEAVE;
+        STag_graphxml_node();
+        graphxml_pcdata_ix = 0;
+        ETag_graphxml_node();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_graphxml_graph_2:
+        case S_graphxml_graph_3:
+        case S_graphxml_graph:
+          SET(S_graphxml_graph_3);
+          break;
+          case ROOT_graphxml_node:SET(EPILOG);
+          break;
+      }} YY_BREAK case 45:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of node element.",
+             xbt_graph_parse_text[0]);
+      YY_BREAK case 46:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `node' element start tag.",
+             xbt_graph_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_graphxml_node):FAIL
+        ("EOF in attribute list of `node' element.");
+      YY_BREAK case 47:
 /* rule 47 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_graphxml_node();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_graphxml_graph_2: case S_graphxml_graph_3: case S_graphxml_graph: SET(S_graphxml_graph_3); break;
-   case ROOT_graphxml_node: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 48:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_graphxml_node();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_graphxml_graph_2:
+        case S_graphxml_graph_3:
+        case S_graphxml_graph:
+          SET(S_graphxml_graph_3);
+          break;
+          case ROOT_graphxml_node:SET(EPILOG);
+          break;
+      }} YY_BREAK case 48:
 /* rule 48 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</node>' expected.",xbt_graph_parse_text);
-       YY_BREAK
-case 49:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</node>' expected.",xbt_graph_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_graphxml_node):
-FAIL("Premature EOF: `</node>' expected.");
-       YY_BREAK
-
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</node>' expected.",
+             xbt_graph_parse_text);
+      YY_BREAK case 49:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</node>' expected.",
+             xbt_graph_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_graphxml_node):FAIL
+        ("Premature EOF: `</node>' expected.");
+      YY_BREAK
 /*     label           CDATA                ""
   *     name            CDATA               #IMPLIED
   *     source          CDATA               #REQUIRED
@@ -1963,397 +1886,327 @@ FAIL("Premature EOF: `</node>' expected.");
   *     length          CDATA               "-1.0"
   *     data            CDATA               ""
   * >  */
-case 50:
+    case 50:
 /* rule 50 can match eol */
-YY_RULE_SETUP
-FAIL("Starting tag <edge> is not allowed here.");
-       YY_BREAK
-case 51:
+      YY_RULE_SETUP FAIL("Starting tag <edge> is not allowed here.");
+      YY_BREAK case 51:
 /* rule 51 can match eol */
-YY_RULE_SETUP
-{
-  AX_graphxml_edge_label = 0;
-  AX_graphxml_edge_name = 0;
-  AX_graphxml_edge_source = 0;
-  AX_graphxml_edge_target = 0;
-  AX_graphxml_edge_length = 11;
-  AX_graphxml_edge_data = 0;
-  ENTER(AL_graphxml_edge); pushbuffer(0);
-  }
-       YY_BREAK
-
-case 52:
+        YY_RULE_SETUP {
+        AX_graphxml_edge_label = 0;
+        AX_graphxml_edge_name = 0;
+        AX_graphxml_edge_source = 0;
+        AX_graphxml_edge_target = 0;
+        AX_graphxml_edge_length = 11;
+        AX_graphxml_edge_data = 0;
+        ENTER(AL_graphxml_edge);
+        pushbuffer(0);
+      } YY_BREAK case 52:
 /* rule 52 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_label);
-       YY_BREAK
-case 53:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_edge_label);
+      YY_BREAK case 53:
 /* rule 53 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_label);
-       YY_BREAK
-case 54:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_edge_label);
+      YY_BREAK case 54:
 /* rule 54 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_name);
-       YY_BREAK
-case 55:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_edge_name);
+      YY_BREAK case 55:
 /* rule 55 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_name);
-       YY_BREAK
-case 56:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_edge_name);
+      YY_BREAK case 56:
 /* rule 56 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_source);
-       YY_BREAK
-case 57:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_edge_source);
+      YY_BREAK case 57:
 /* rule 57 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_source);
-       YY_BREAK
-case 58:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_edge_source);
+      YY_BREAK case 58:
 /* rule 58 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_target);
-       YY_BREAK
-case 59:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_edge_target);
+      YY_BREAK case 59:
 /* rule 59 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_target);
-       YY_BREAK
-case 60:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_edge_target);
+      YY_BREAK case 60:
 /* rule 60 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_length);
-       YY_BREAK
-case 61:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_edge_length);
+      YY_BREAK case 61:
 /* rule 61 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_length);
-       YY_BREAK
-case 62:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_edge_length);
+      YY_BREAK case 62:
 /* rule 62 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE1); BUFFERSET(AX_graphxml_edge_data);
-       YY_BREAK
-case 63:
+        YY_RULE_SETUP ENTER(VALUE1);
+      BUFFERSET(AX_graphxml_edge_data);
+      YY_BREAK case 63:
 /* rule 63 can match eol */
-YY_RULE_SETUP
-ENTER(VALUE2); BUFFERSET(AX_graphxml_edge_data);
-       YY_BREAK
-case 64:
-YY_RULE_SETUP
-{
-  if (!AX_graphxml_edge_source) FAIL("Required attribute `source' not set for `edge' element.");
-  if (!AX_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element.");
-  LEAVE; STag_graphxml_edge();graphxml_pcdata_ix = 0; ENTER(E_graphxml_edge);
- }
-       YY_BREAK
-case 65:
-YY_RULE_SETUP
-{
-  if (!AX_graphxml_edge_source) FAIL("Required attribute `source' not set for `edge' element.");
-  if (!AX_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element.");
-  LEAVE; STag_graphxml_edge(); graphxml_pcdata_ix = 0; ETag_graphxml_edge(); popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_graphxml_graph_1: case S_graphxml_graph_3: case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph: SET(S_graphxml_graph_5); break;
-   case ROOT_graphxml_edge: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 66:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c' in attribute list of edge element.", xbt_graph_parse_text[0]);
-       YY_BREAK
-case 67:
-YY_RULE_SETUP
-FAIL("Bad attribute `%s' in `edge' element start tag.",xbt_graph_parse_text);
-       YY_BREAK
-case YY_STATE_EOF(AL_graphxml_edge):
-FAIL("EOF in attribute list of `edge' element.");
-       YY_BREAK
-
-case 68:
+        YY_RULE_SETUP ENTER(VALUE2);
+      BUFFERSET(AX_graphxml_edge_data);
+      YY_BREAK case 64:YY_RULE_SETUP {
+        if (!AX_graphxml_edge_source)
+          FAIL("Required attribute `source' not set for `edge' element.");
+        if (!AX_graphxml_edge_target)
+          FAIL("Required attribute `target' not set for `edge' element.");
+        LEAVE;
+        STag_graphxml_edge();
+        graphxml_pcdata_ix = 0;
+        ENTER(E_graphxml_edge);
+      } YY_BREAK case 65:YY_RULE_SETUP {
+        if (!AX_graphxml_edge_source)
+          FAIL("Required attribute `source' not set for `edge' element.");
+        if (!AX_graphxml_edge_target)
+          FAIL("Required attribute `target' not set for `edge' element.");
+        LEAVE;
+        STag_graphxml_edge();
+        graphxml_pcdata_ix = 0;
+        ETag_graphxml_edge();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_graphxml_graph_1:
+        case S_graphxml_graph_3:
+        case S_graphxml_graph_5:
+        case S_graphxml_graph_4:
+        case S_graphxml_graph:
+          SET(S_graphxml_graph_5);
+          break;
+          case ROOT_graphxml_edge:SET(EPILOG);
+          break;
+      }} YY_BREAK case 66:YY_RULE_SETUP
+        FAIL("Unexpected character `%c' in attribute list of edge element.",
+             xbt_graph_parse_text[0]);
+      YY_BREAK case 67:YY_RULE_SETUP
+        FAIL("Bad attribute `%s' in `edge' element start tag.",
+             xbt_graph_parse_text);
+      YY_BREAK case
+        YY_STATE_EOF(AL_graphxml_edge):FAIL
+        ("EOF in attribute list of `edge' element.");
+      YY_BREAK case 68:
 /* rule 68 can match eol */
-YY_RULE_SETUP
-{
-  LEAVE;
-  ETag_graphxml_edge();
-  popbuffer(); /* attribute */
-  switch (YY_START) {
-   case S_graphxml_graph_1: case S_graphxml_graph_3: case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph: SET(S_graphxml_graph_5); break;
-   case ROOT_graphxml_edge: SET(EPILOG); break;
-  }
- }
-       YY_BREAK
-case 69:
+        YY_RULE_SETUP {
+        LEAVE;
+        ETag_graphxml_edge();
+        popbuffer();            /* attribute */
+        switch (YY_START) {
+        case S_graphxml_graph_1:
+        case S_graphxml_graph_3:
+        case S_graphxml_graph_5:
+        case S_graphxml_graph_4:
+        case S_graphxml_graph:
+          SET(S_graphxml_graph_5);
+          break;
+          case ROOT_graphxml_edge:SET(EPILOG);
+          break;
+      }} YY_BREAK case 69:
 /* rule 69 can match eol */
-YY_RULE_SETUP
-FAIL("Unexpected end-tag `%s': `</edge>' expected.",xbt_graph_parse_text);
-       YY_BREAK
-case 70:
-YY_RULE_SETUP
-FAIL("Unexpected character `%c': `</edge>' expected.",xbt_graph_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(E_graphxml_edge):
-FAIL("Premature EOF: `</edge>' expected.");
-       YY_BREAK
-
+       
+        YY_RULE_SETUP
+        FAIL("Unexpected end-tag `%s': `</edge>' expected.",
+             xbt_graph_parse_text);
+      YY_BREAK case 70:YY_RULE_SETUP
+        FAIL("Unexpected character `%c': `</edge>' expected.",
+             xbt_graph_parse_text[0]);
+      YY_BREAK case
+        YY_STATE_EOF(E_graphxml_edge):FAIL
+        ("Premature EOF: `</edge>' expected.");
+      YY_BREAK
 /* EPILOG: after the root element. */
-
-case 71:
-YY_RULE_SETUP
-{SET(PROLOG); yyless(0); CLEANUP; return -1;}
-       YY_BREAK
-case YY_STATE_EOF(EPILOG):
-SUCCEED;
-       YY_BREAK
-
+    case 71:
+      YY_RULE_SETUP {
+        SET(PROLOG);
+        yyless(0);
+        CLEANUP;
+        return -1;
+      }
+      YY_BREAK case YY_STATE_EOF(EPILOG):SUCCEED;
+      YY_BREAK
 /* CHARACTER DATA. */
-
 /* Non-defined standard entities... */
-case 72:
-YY_RULE_SETUP
-BUFFERPUTC('&');
-       YY_BREAK
-case 73:
-YY_RULE_SETUP
-BUFFERPUTC('<');
-       YY_BREAK
-case 74:
-YY_RULE_SETUP
-BUFFERPUTC('>');
-       YY_BREAK
-case 75:
-YY_RULE_SETUP
-BUFFERPUTC('\'');
-       YY_BREAK
-case 76:
-YY_RULE_SETUP
-BUFFERPUTC('"');
-       YY_BREAK
+    case 72:
+      YY_RULE_SETUP BUFFERPUTC('&');
+      YY_BREAK case 73:YY_RULE_SETUP BUFFERPUTC('<');
+      YY_BREAK case 74:YY_RULE_SETUP BUFFERPUTC('>');
+      YY_BREAK case 75:YY_RULE_SETUP BUFFERPUTC('\'');
+      YY_BREAK case 76:YY_RULE_SETUP BUFFERPUTC('"');
+      YY_BREAK
 /* Character entities. */
-case 77:
-YY_RULE_SETUP
-BUFFERPUTC((unsigned char)atoi(xbt_graph_parse_text+2));
-       YY_BREAK
-case 78:
-YY_RULE_SETUP
-BUFFERPUTC((unsigned char)strtol(xbt_graph_parse_text+3,NULL,16));
-       YY_BREAK
-
-case 79:
+    case 77:
+      YY_RULE_SETUP
+        BUFFERPUTC((unsigned char) atoi(xbt_graph_parse_text + 2));
+      YY_BREAK case 78:YY_RULE_SETUP
+        BUFFERPUTC((unsigned char)
+                   strtol(xbt_graph_parse_text + 3, NULL, 16));
+      YY_BREAK case 79:
 /* rule 79 can match eol */
-case 80:
+      case 80:
 /* rule 80 can match eol */
-case 81:
+      case 81:
 /* rule 81 can match eol */
-case 82:
+      case 82:
 /* rule 82 can match eol */
-YY_RULE_SETUP
-BUFFERPUTC('\n');
-       YY_BREAK
-
-case 83:
-YY_RULE_SETUP
-ENTER(CDATA);
-       YY_BREAK
-case 84:
-YY_RULE_SETUP
-FAIL("Unexpected `]""]>' in character data.");
-       YY_BREAK
-
-case 85:
-YY_RULE_SETUP
-BUFFERDONE; LEAVE;
-       YY_BREAK
-case YY_STATE_EOF(VALUE1):
-FAIL("EOF in literal (\"'\" expected).");
-       YY_BREAK
-
-case 86:
-YY_RULE_SETUP
-BUFFERDONE; LEAVE;
-       YY_BREAK
-case YY_STATE_EOF(VALUE2):
-FAIL("EOF in literal (`\"' expected).");
-       YY_BREAK
-
-case 87:
+        YY_RULE_SETUP BUFFERPUTC('\n');
+      YY_BREAK case 83:YY_RULE_SETUP ENTER(CDATA);
+      YY_BREAK case 84:YY_RULE_SETUP FAIL("Unexpected `]"
+                                          "]>' in character data.");
+      YY_BREAK case 85:YY_RULE_SETUP BUFFERDONE;
+      LEAVE;
+      YY_BREAK case
+        YY_STATE_EOF(VALUE1):FAIL("EOF in literal (\"'\" expected).");
+      YY_BREAK case 86:YY_RULE_SETUP BUFFERDONE;
+      LEAVE;
+      YY_BREAK case
+        YY_STATE_EOF(VALUE2):FAIL("EOF in literal (`\"' expected).");
+      YY_BREAK case 87:
 /* rule 87 can match eol */
-YY_RULE_SETUP
-BUFFERPUTC(xbt_graph_parse_text[0]);
-       YY_BREAK
-case 88:
-YY_RULE_SETUP
-FAIL("Spurious `%c' in character data.",xbt_graph_parse_text[0]);
-       YY_BREAK
-
-case 89:
-YY_RULE_SETUP
-LEAVE;
-       YY_BREAK
+        YY_RULE_SETUP BUFFERPUTC(xbt_graph_parse_text[0]);
+      YY_BREAK case 88:YY_RULE_SETUP
+        FAIL("Spurious `%c' in character data.", xbt_graph_parse_text[0]);
+      YY_BREAK case 89:YY_RULE_SETUP LEAVE;
+      YY_BREAK
 /* "]""]"              BUFFERPUTC(xbt_graph_parse_text[0]); BUFFERPUTC(xbt_graph_parse_text[1]); */
-case 90:
-YY_RULE_SETUP
-BUFFERPUTC(xbt_graph_parse_text[0]);
-       YY_BREAK
-case YY_STATE_EOF(CDATA):
-FAIL("EOF in CDATA section.");
-       YY_BREAK
-
+    case 90:
+      YY_RULE_SETUP BUFFERPUTC(xbt_graph_parse_text[0]);
+      YY_BREAK case YY_STATE_EOF(CDATA):FAIL("EOF in CDATA section.");
+      YY_BREAK
 /* Impossible rules to avoid warnings from flex(1). */
 /* Ideally, this should be replaced by code in flexml.pl that
     generates just the states not covered by other rules. */
-
-case 91:
+    case 91:
 /* rule 91 can match eol */
-YY_RULE_SETUP
-FAIL("Syntax error on character `%c'.", xbt_graph_parse_text[0]);
-       YY_BREAK
-
-case 92:
-YY_RULE_SETUP
-ECHO;
-       YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(ROOT_graphxml_graph):
-case YY_STATE_EOF(S_graphxml_graph_2):
-case YY_STATE_EOF(S_graphxml_graph_4):
-case YY_STATE_EOF(ROOT_graphxml_node):
-case YY_STATE_EOF(ROOT_graphxml_edge):
-case YY_STATE_EOF(IMPOSSIBLE):
-       yyterminate();
-
-       case YY_END_OF_BUFFER:
-               {
-               /* Amount of text matched not including the EOB char. */
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */
-               *yy_cp = (yy_hold_char);
-               YY_RESTORE_YY_MORE_OFFSET
-
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-                       {
-                       /* We're scanning a new file or input source.  It's
-                        * possible that this happened because the user
-                        * just pointed xbt_graph_parse_in at a new source and called
-                        * xbt_graph_parse_lex().  If so, then we have to assure
-                        * consistency between YY_CURRENT_BUFFER and our
-                        * globals.  Here is the right place to do so, because
-                        * this is the first action (other than possibly a
-                        * back-up) that will match for the new input source.
-                        */
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = xbt_graph_parse_in;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-                       }
-
-               /* Note that here we test for yy_c_buf_p "<=" to the position
-                * of the first EOB in the buffer, since yy_c_buf_p will
-                * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the
-                * end-of-buffer state).  Contrast this with the test
-                * in input().
-                */
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       { /* This was really a NUL. */
-                       yy_state_type yy_next_state;
-
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state(  );
-
-                       /* Okay, we're now positioned to make the NUL
-                        * transition.  We couldn't have
-                        * yy_get_previous_state() go ahead and do it
-                        * for us because it doesn't know how to deal
-                        * with the possibility of jamming (and we don't
-                        * want to build jamming into it because then it
-                        * will run more slowly).
-                        */
-
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );
-
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
-                       if ( yy_next_state )
-                               {
-                               /* Consume the NUL. */
-                               yy_cp = ++(yy_c_buf_p);
-                               yy_current_state = yy_next_state;
-                               goto yy_match;
-                               }
-
-                       else
-                               {
-                               yy_cp = (yy_c_buf_p);
-                               goto yy_find_action;
-                               }
-                       }
-
-               else switch ( yy_get_next_buffer(  ) )
-                       {
-                       case EOB_ACT_END_OF_FILE:
-                               {
-                               (yy_did_buffer_switch_on_eof) = 0;
-
-                               if ( xbt_graph_parse_wrap( ) )
-                                       {
-                                       /* Note: because we've taken care in
-                                        * yy_get_next_buffer() to have set up
-                                        * xbt_graph_parse_text, we can now set up
-                                        * yy_c_buf_p so that if some total
-                                        * hoser (like flex itself) wants to
-                                        * call the scanner after we return the
-                                        * YY_NULL, it'll still work - another
-                                        * YY_NULL will get returned.
-                                        */
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
-                                       yy_act = YY_STATE_EOF(YY_START);
-                                       goto do_action;
-                                       }
-
-                               else
-                                       {
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-                                       }
-                               break;
-                               }
-
-                       case EOB_ACT_CONTINUE_SCAN:
-                               (yy_c_buf_p) =
-                                       (yytext_ptr) + yy_amount_of_matched_text;
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_match;
-
-                       case EOB_ACT_LAST_MATCH:
-                               (yy_c_buf_p) =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_find_action;
-                       }
-               break;
-               }
-
-       default:
-               YY_FATAL_ERROR(
-                       "fatal flex scanner internal error--no action found" );
-       } /* end of action switch */
-               } /* end of scanning one token */
-} /* end of xbt_graph_parse_lex */
+      YY_RULE_SETUP
+        FAIL("Syntax error on character `%c'.", xbt_graph_parse_text[0]);
+      YY_BREAK case 92:YY_RULE_SETUP ECHO;
+      YY_BREAK case YY_STATE_EOF(INITIAL):case
+        YY_STATE_EOF(ROOT_graphxml_graph):case
+        YY_STATE_EOF(S_graphxml_graph_2):case
+        YY_STATE_EOF(S_graphxml_graph_4):case
+        YY_STATE_EOF(ROOT_graphxml_node):case
+        YY_STATE_EOF(ROOT_graphxml_edge):case
+        YY_STATE_EOF(IMPOSSIBLE):yyterminate();
+
+    case YY_END_OF_BUFFER:
+      {
+        /* Amount of text matched not including the EOB char. */
+        int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+        /* Undo the effects of YY_DO_BEFORE_ACTION. */
+        *yy_cp = (yy_hold_char);
+        YY_RESTORE_YY_MORE_OFFSET
+          if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
+          /* We're scanning a new file or input source.  It's
+           * possible that this happened because the user
+           * just pointed xbt_graph_parse_in at a new source and called
+           * xbt_graph_parse_lex().  If so, then we have to assure
+           * consistency between YY_CURRENT_BUFFER and our
+           * globals.  Here is the right place to do so, because
+           * this is the first action (other than possibly a
+           * back-up) that will match for the new input source.
+           */
+          (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+          YY_CURRENT_BUFFER_LVALUE->yy_input_file = xbt_graph_parse_in;
+          YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+        }
+
+        /* Note that here we test for yy_c_buf_p "<=" to the position
+         * of the first EOB in the buffer, since yy_c_buf_p will
+         * already have been incremented past the NUL character
+         * (since all states make transitions on EOB to the
+         * end-of-buffer state).  Contrast this with the test
+         * in input().
+         */
+        if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) {       /* This was really a NUL. */
+          yy_state_type yy_next_state;
+
+          (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+          yy_current_state = yy_get_previous_state();
+
+          /* Okay, we're now positioned to make the NUL
+           * transition.  We couldn't have
+           * yy_get_previous_state() go ahead and do it
+           * for us because it doesn't know how to deal
+           * with the possibility of jamming (and we don't
+           * want to build jamming into it because then it
+           * will run more slowly).
+           */
+
+          yy_next_state = yy_try_NUL_trans(yy_current_state);
+
+          yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+          if (yy_next_state) {
+            /* Consume the NUL. */
+            yy_cp = ++(yy_c_buf_p);
+            yy_current_state = yy_next_state;
+            goto yy_match;
+          }
+
+          else {
+            yy_cp = (yy_c_buf_p);
+            goto yy_find_action;
+          }
+        }
+
+        else
+          switch (yy_get_next_buffer()) {
+          case EOB_ACT_END_OF_FILE:
+            {
+              (yy_did_buffer_switch_on_eof) = 0;
+
+              if (xbt_graph_parse_wrap()) {
+                /* Note: because we've taken care in
+                 * yy_get_next_buffer() to have set up
+                 * xbt_graph_parse_text, we can now set up
+                 * yy_c_buf_p so that if some total
+                 * hoser (like flex itself) wants to
+                 * call the scanner after we return the
+                 * YY_NULL, it'll still work - another
+                 * YY_NULL will get returned.
+                 */
+                (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+                yy_act = YY_STATE_EOF(YY_START);
+                goto do_action;
+              }
+
+              else {
+                if (!(yy_did_buffer_switch_on_eof))
+                  YY_NEW_FILE;
+              }
+              break;
+            }
+
+          case EOB_ACT_CONTINUE_SCAN:
+            (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+            yy_current_state = yy_get_previous_state();
+
+            yy_cp = (yy_c_buf_p);
+            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+            goto yy_match;
+
+          case EOB_ACT_LAST_MATCH:
+            (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+            yy_current_state = yy_get_previous_state();
+
+            yy_cp = (yy_c_buf_p);
+            yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+            goto yy_find_action;
+          }
+        break;
+      }
+
+    default:
+      YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
+    }                           /* end of action switch */
+  }                             /* end of scanning one token */
+}                               /* end of xbt_graph_parse_lex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -2362,165 +2215,154 @@ case YY_STATE_EOF(IMPOSSIBLE):
  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  *     EOB_ACT_END_OF_FILE - end of file
  */
-static int yy_get_next_buffer (void)
+static int yy_get_next_buffer(void)
 {
-       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-       register char *source = (yytext_ptr);
-       register int number_to_move, i;
-       int ret_val;
-
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
-               YY_FATAL_ERROR(
-               "fatal flex scanner internal error--end of buffer missed" );
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-               { /* Don't try to fill the buffer, so this is an EOF. */
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
-                       {
-                       /* We matched a single character, the EOB, so
-                        * treat this as a final EOF.
-                        */
-                       return EOB_ACT_END_OF_FILE;
-                       }
-
-               else
-                       {
-                       /* We matched some text prior to the EOB, first
-                        * process it.
-                        */
-                       return EOB_ACT_LAST_MATCH;
-                       }
-               }
-
-       /* Try to read more data. */
-
-       /* First move last chars to start of buffer. */
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
-
-       for ( i = 0; i < number_to_move; ++i )
-               *(dest++) = *(source++);
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-               /* don't do the read, it's not guaranteed to return an EOF,
-                * just force an EOF
-                */
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
-       else
-               {
-                       int num_to_read =
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-               while ( num_to_read <= 0 )
-                       { /* Not enough room in the buffer - grow it. */
-
-                       /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
-                       int yy_c_buf_p_offset =
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-                       if ( b->yy_is_our_buffer )
-                               {
-                               int new_size = b->yy_buf_size * 2;
-
-                               if ( new_size <= 0 )
-                                       b->yy_buf_size += b->yy_buf_size / 8;
-                               else
-                                       b->yy_buf_size *= 2;
-
-                               b->yy_ch_buf = (char *)
-                                       /* Include room in for 2 EOB chars. */
-                                       xbt_graph_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
-                               }
-                       else
-                               /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = 0;
-
-                       if ( ! b->yy_ch_buf )
-                               YY_FATAL_ERROR(
-                               "fatal error - scanner input buffer overflow" );
-
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-                                               number_to_move - 1;
-
-                       }
-
-               if ( num_to_read > YY_READ_BUF_SIZE )
-                       num_to_read = YY_READ_BUF_SIZE;
-
-               /* Read in more data. */
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), (size_t) num_to_read );
-
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       if ( (yy_n_chars) == 0 )
-               {
-               if ( number_to_move == YY_MORE_ADJ )
-                       {
-                       ret_val = EOB_ACT_END_OF_FILE;
-                       xbt_graph_parse_restart(xbt_graph_parse_in  );
-                       }
-
-               else
-                       {
-                       ret_val = EOB_ACT_LAST_MATCH;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-                               YY_BUFFER_EOF_PENDING;
-                       }
-               }
-
-       else
-               ret_val = EOB_ACT_CONTINUE_SCAN;
-
-       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-               /* Extend the array by 50%, plus the number we really need. */
-               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
-               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xbt_graph_parse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
-               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-       }
+  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+  register char *source = (yytext_ptr);
+  register int number_to_move, i;
+  int ret_val;
+
+  if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
+    YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
+
+  if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) {  /* Don't try to fill the buffer, so this is an EOF. */
+    if ((yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1) {
+      /* We matched a single character, the EOB, so
+       * treat this as a final EOF.
+       */
+      return EOB_ACT_END_OF_FILE;
+    }
+
+    else {
+      /* We matched some text prior to the EOB, first
+       * process it.
+       */
+      return EOB_ACT_LAST_MATCH;
+    }
+  }
+
+  /* Try to read more data. */
+
+  /* First move last chars to start of buffer. */
+  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+  for (i = 0; i < number_to_move; ++i)
+    *(dest++) = *(source++);
+
+  if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
+    /* don't do the read, it's not guaranteed to return an EOF,
+     * just force an EOF
+     */
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+  else {
+    int num_to_read =
+      YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+    while (num_to_read <= 0) {  /* Not enough room in the buffer - grow it. */
+
+      /* just a shorter name for the current buffer */
+      YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 
-       (yy_n_chars) += number_to_move;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+      int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+      if (b->yy_is_our_buffer) {
+        int new_size = b->yy_buf_size * 2;
+
+        if (new_size <= 0)
+          b->yy_buf_size += b->yy_buf_size / 8;
+        else
+          b->yy_buf_size *= 2;
+
+        b->yy_ch_buf = (char *)
+          /* Include room in for 2 EOB chars. */
+          xbt_graph_parse_realloc((void *) b->yy_ch_buf, b->yy_buf_size + 2);
+      } else
+        /* Can't grow it, we don't own it. */
+        b->yy_ch_buf = 0;
+
+      if (!b->yy_ch_buf)
+        YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
+
+      (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+      num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+        number_to_move - 1;
+
+    }
+
+    if (num_to_read > YY_READ_BUF_SIZE)
+      num_to_read = YY_READ_BUF_SIZE;
+
+    /* Read in more data. */
+    YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+             (yy_n_chars), (size_t) num_to_read);
+
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  if ((yy_n_chars) == 0) {
+    if (number_to_move == YY_MORE_ADJ) {
+      ret_val = EOB_ACT_END_OF_FILE;
+      xbt_graph_parse_restart(xbt_graph_parse_in);
+    }
 
-       return ret_val;
+    else {
+      ret_val = EOB_ACT_LAST_MATCH;
+      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
+    }
+  }
+
+  else
+    ret_val = EOB_ACT_CONTINUE_SCAN;
+
+  if ((yy_size_t) ((yy_n_chars) + number_to_move) >
+      YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+    /* Extend the array by 50%, plus the number we really need. */
+    yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf =
+      (char *) xbt_graph_parse_realloc((void *)
+                                       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,
+                                       new_size);
+    if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
+      YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
+  }
+
+  (yy_n_chars) += number_to_move;
+  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] =
+    YY_END_OF_BUFFER_CHAR;
+
+  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+  return ret_val;
 }
 
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
-    static yy_state_type yy_get_previous_state (void)
+static yy_state_type yy_get_previous_state(void)
 {
-       register yy_state_type yy_current_state;
-       register char *yy_cp;
-    
-       yy_current_state = (yy_start);
-
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-               {
-               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-               if ( yy_accept[yy_current_state] )
-                       {
-                       (yy_last_accepting_state) = yy_current_state;
-                       (yy_last_accepting_cpos) = yy_cp;
-                       }
-               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                       {
-                       yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 564 )
-                               yy_c = yy_meta[(unsigned int) yy_c];
-                       }
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-               }
-
-       return yy_current_state;
+  register yy_state_type yy_current_state;
+  register char *yy_cp;
+
+  yy_current_state = (yy_start);
+
+  for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) {
+    register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+    if (yy_accept[yy_current_state]) {
+      (yy_last_accepting_state) = yy_current_state;
+      (yy_last_accepting_cpos) = yy_cp;
+    }
+    while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+      yy_current_state = (int) yy_def[yy_current_state];
+      if (yy_current_state >= 564)
+        yy_c = yy_meta[(unsigned int) yy_c];
+    }
+    yy_current_state =
+      yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+  }
+
+  return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -2528,167 +2370,158 @@ static int yy_get_next_buffer (void)
  * synopsis
  *     next_state = yy_try_NUL_trans( current_state );
  */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
 {
-       register int yy_is_jam;
-       register char *yy_cp = (yy_c_buf_p);
-
-       register YY_CHAR yy_c = 1;
-       if ( yy_accept[yy_current_state] )
-               {
-               (yy_last_accepting_state) = yy_current_state;
-               (yy_last_accepting_cpos) = yy_cp;
-               }
-       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-               {
-               yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 564 )
-                       yy_c = yy_meta[(unsigned int) yy_c];
-               }
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 563);
-
-       return yy_is_jam ? 0 : yy_current_state;
+  register int yy_is_jam;
+  register char *yy_cp = (yy_c_buf_p);
+
+  register YY_CHAR yy_c = 1;
+  if (yy_accept[yy_current_state]) {
+    (yy_last_accepting_state) = yy_current_state;
+    (yy_last_accepting_cpos) = yy_cp;
+  }
+  while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
+    yy_current_state = (int) yy_def[yy_current_state];
+    if (yy_current_state >= 564)
+      yy_c = yy_meta[(unsigned int) yy_c];
+  }
+  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+  yy_is_jam = (yy_current_state == 563);
+
+  return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-    static int yyinput (void)
+static int yyinput(void)
 #else
-    static int input  (void)
+static int input(void)
 #endif
-
 {
-       int c;
-    
-       *(yy_c_buf_p) = (yy_hold_char);
-
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
-               {
-               /* yy_c_buf_p now points to the character we want to return.
-                * If this occurs *before* the EOB characters, then it's a
-                * valid NUL; if not, then we've hit the end of the buffer.
-                */
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       /* This was really a NUL. */
-                       *(yy_c_buf_p) = '\0';
-
-               else
-                       { /* need more input */
-                       int offset = (yy_c_buf_p) - (yytext_ptr);
-                       ++(yy_c_buf_p);
-
-                       switch ( yy_get_next_buffer(  ) )
-                               {
-                               case EOB_ACT_LAST_MATCH:
-                                       /* This happens because yy_g_n_b()
-                                        * sees that we've accumulated a
-                                        * token and flags that we need to
-                                        * try matching the token before
-                                        * proceeding.  But for input(),
-                                        * there's no matching to consider.
-                                        * So convert the EOB_ACT_LAST_MATCH
-                                        * to EOB_ACT_END_OF_FILE.
-                                        */
-
-                                       /* Reset buffer status. */
-                                       xbt_graph_parse_restart(xbt_graph_parse_in );
-
-                                       /*FALLTHROUGH*/
-
-                               case EOB_ACT_END_OF_FILE:
-                                       {
-                                       if ( xbt_graph_parse_wrap( ) )
-                                               return EOF;
-
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
+  int c;
+
+  *(yy_c_buf_p) = (yy_hold_char);
+
+  if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) {
+    /* yy_c_buf_p now points to the character we want to return.
+     * If this occurs *before* the EOB characters, then it's a
+     * valid NUL; if not, then we've hit the end of the buffer.
+     */
+    if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
+      /* This was really a NUL. */
+      *(yy_c_buf_p) = '\0';
+
+    else {                      /* need more input */
+      int offset = (yy_c_buf_p) - (yytext_ptr);
+      ++(yy_c_buf_p);
+
+      switch (yy_get_next_buffer()) {
+      case EOB_ACT_LAST_MATCH:
+        /* This happens because yy_g_n_b()
+         * sees that we've accumulated a
+         * token and flags that we need to
+         * try matching the token before
+         * proceeding.  But for input(),
+         * there's no matching to consider.
+         * So convert the EOB_ACT_LAST_MATCH
+         * to EOB_ACT_END_OF_FILE.
+         */
+
+        /* Reset buffer status. */
+        xbt_graph_parse_restart(xbt_graph_parse_in);
+
+       /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE:
+        {
+          if (xbt_graph_parse_wrap())
+            return EOF;
+
+          if (!(yy_did_buffer_switch_on_eof))
+            YY_NEW_FILE;
 #ifdef __cplusplus
-                                       return yyinput();
+          return yyinput();
 #else
-                                       return input();
+          return input();
 #endif
-                                       }
+        }
+
+      case EOB_ACT_CONTINUE_SCAN:
+        (yy_c_buf_p) = (yytext_ptr) + offset;
+        break;
+      }
+    }
+  }
 
-                               case EOB_ACT_CONTINUE_SCAN:
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;
-                                       break;
-                               }
-                       }
-               }
+  c = *(unsigned char *) (yy_c_buf_p);  /* cast for 8-bit char's */
+  *(yy_c_buf_p) = '\0';         /* preserve xbt_graph_parse_text */
+  (yy_hold_char) = *++(yy_c_buf_p);
 
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve xbt_graph_parse_text */
-       (yy_hold_char) = *++(yy_c_buf_p);
+  if (c == '\n')
 
-       if ( c == '\n' )
-                  
     xbt_graph_parse_lineno++;
-;
+  ;
 
-       return c;
+  return c;
 }
-#endif /* ifndef YY_NO_INPUT */
+#endif /* ifndef YY_NO_INPUT */
 
 /** Immediately switch to a different input stream.
  * @param input_file A readable stream.
  * 
  * @note This function does not reset the start condition to @c INITIAL .
  */
-    void xbt_graph_parse_restart  (FILE * input_file )
+void xbt_graph_parse_restart(FILE * input_file)
 {
-    
-       if ( ! YY_CURRENT_BUFFER ){
-        xbt_graph_parse_ensure_buffer_stack ();
-               YY_CURRENT_BUFFER_LVALUE =
-            xbt_graph_parse__create_buffer(xbt_graph_parse_in,YY_BUF_SIZE );
-       }
 
-       xbt_graph_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
-       xbt_graph_parse__load_buffer_state( );
+  if (!YY_CURRENT_BUFFER) {
+    xbt_graph_parse_ensure_buffer_stack();
+    YY_CURRENT_BUFFER_LVALUE =
+      xbt_graph_parse__create_buffer(xbt_graph_parse_in, YY_BUF_SIZE);
+  }
+
+  xbt_graph_parse__init_buffer(YY_CURRENT_BUFFER, input_file);
+  xbt_graph_parse__load_buffer_state();
 }
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
  * 
  */
-    void xbt_graph_parse__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+void xbt_graph_parse__switch_to_buffer(YY_BUFFER_STATE new_buffer)
 {
-    
-       /* TODO. We should be able to replace this entire function body
-        * with
-        *              xbt_graph_parse_pop_buffer_state();
-        *              xbt_graph_parse_push_buffer_state(new_buffer);
-     */
-       xbt_graph_parse_ensure_buffer_stack ();
-       if ( YY_CURRENT_BUFFER == new_buffer )
-               return;
-
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       xbt_graph_parse__load_buffer_state( );
-
-       /* We don't actually know whether we did this switch during
-        * EOF (xbt_graph_parse_wrap()) processing, but the only time this flag
-        * is looked at is after xbt_graph_parse_wrap() is called, so it's safe
-        * to go ahead and always set it.
-        */
-       (yy_did_buffer_switch_on_eof) = 1;
+
+  /* TODO. We should be able to replace this entire function body
+   * with
+   *              xbt_graph_parse_pop_buffer_state();
+   *              xbt_graph_parse_push_buffer_state(new_buffer);
+   */
+  xbt_graph_parse_ensure_buffer_stack();
+  if (YY_CURRENT_BUFFER == new_buffer)
+    return;
+
+  if (YY_CURRENT_BUFFER) {
+    /* Flush out information for old buffer. */
+    *(yy_c_buf_p) = (yy_hold_char);
+    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  YY_CURRENT_BUFFER_LVALUE = new_buffer;
+  xbt_graph_parse__load_buffer_state();
+
+  /* We don't actually know whether we did this switch during
+   * EOF (xbt_graph_parse_wrap()) processing, but the only time this flag
+   * is looked at is after xbt_graph_parse_wrap() is called, so it's safe
+   * to go ahead and always set it.
+   */
+  (yy_did_buffer_switch_on_eof) = 1;
 }
 
-static void xbt_graph_parse__load_buffer_state  (void)
+static void xbt_graph_parse__load_buffer_state(void)
 {
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-       xbt_graph_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-       (yy_hold_char) = *(yy_c_buf_p);
+  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+  xbt_graph_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+  (yy_hold_char) = *(yy_c_buf_p);
 }
 
 /** Allocate and initialize an input buffer state.
@@ -2697,106 +2530,107 @@ static void xbt_graph_parse__load_buffer_state  (void)
  * 
  * @return the allocated buffer state.
  */
-    YY_BUFFER_STATE xbt_graph_parse__create_buffer  (FILE * file, int  size )
+YY_BUFFER_STATE xbt_graph_parse__create_buffer(FILE * file, int size)
 {
-       YY_BUFFER_STATE b;
-    
-       b = (YY_BUFFER_STATE) xbt_graph_parse_alloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in xbt_graph_parse__create_buffer()" );
+  YY_BUFFER_STATE b;
+
+  b = (YY_BUFFER_STATE) xbt_graph_parse_alloc(sizeof(struct yy_buffer_state));
+  if (!b)
+    YY_FATAL_ERROR
+      ("out of dynamic memory in xbt_graph_parse__create_buffer()");
 
-       b->yy_buf_size = size;
+  b->yy_buf_size = size;
 
-       /* yy_ch_buf has to be 2 characters longer than the size given because
-        * we need to put in 2 end-of-buffer characters.
-        */
-       b->yy_ch_buf = (char *) xbt_graph_parse_alloc(b->yy_buf_size + 2  );
-       if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in xbt_graph_parse__create_buffer()" );
+  /* yy_ch_buf has to be 2 characters longer than the size given because
+   * we need to put in 2 end-of-buffer characters.
+   */
+  b->yy_ch_buf = (char *) xbt_graph_parse_alloc(b->yy_buf_size + 2);
+  if (!b->yy_ch_buf)
+    YY_FATAL_ERROR
+      ("out of dynamic memory in xbt_graph_parse__create_buffer()");
 
-       b->yy_is_our_buffer = 1;
+  b->yy_is_our_buffer = 1;
 
-       xbt_graph_parse__init_buffer(b,file );
+  xbt_graph_parse__init_buffer(b, file);
 
-       return b;
+  return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with xbt_graph_parse__create_buffer()
  * 
  */
-    void xbt_graph_parse__delete_buffer (YY_BUFFER_STATE  b )
+void xbt_graph_parse__delete_buffer(YY_BUFFER_STATE b)
 {
-    
-       if ( ! b )
-               return;
 
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+  if (!b)
+    return;
+
+  if (b == YY_CURRENT_BUFFER)   /* Not sure if we should pop here. */
+    YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
-       if ( b->yy_is_our_buffer )
-               xbt_graph_parse_free((void *) b->yy_ch_buf  );
+  if (b->yy_is_our_buffer)
+    xbt_graph_parse_free((void *) b->yy_ch_buf);
 
-       xbt_graph_parse_free((void *) b  );
+  xbt_graph_parse_free((void *) b);
 }
 
 #ifndef __cplusplus
-extern int isatty (int );
+extern int isatty(int);
 #endif /* __cplusplus */
-    
+
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a xbt_graph_parse_restart() or at EOF.
  */
-    static void xbt_graph_parse__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
-
+static void xbt_graph_parse__init_buffer(YY_BUFFER_STATE b, FILE * file)
 {
-       int oerrno = errno;
-    
-       xbt_graph_parse__flush_buffer(b );
+  int oerrno = errno;
 
-       b->yy_input_file = file;
-       b->yy_fill_buffer = 1;
+  xbt_graph_parse__flush_buffer(b);
 
-    /* If b is the current buffer, then xbt_graph_parse__init_buffer was _probably_
-     * called from xbt_graph_parse_restart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
+  b->yy_input_file = file;
+  b->yy_fill_buffer = 1;
+
+  /* If b is the current buffer, then xbt_graph_parse__init_buffer was _probably_
+   * called from xbt_graph_parse_restart() or through yy_get_next_buffer.
+   * In that case, we don't want to reset the lineno or column.
+   */
+  if (b != YY_CURRENT_BUFFER) {
+    b->yy_bs_lineno = 1;
+    b->yy_bs_column = 0;
+  }
+
+  b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-    
-       errno = oerrno;
+  errno = oerrno;
 }
 
 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  * 
  */
-    void xbt_graph_parse__flush_buffer (YY_BUFFER_STATE  b )
+void xbt_graph_parse__flush_buffer(YY_BUFFER_STATE b)
 {
-       if ( ! b )
-               return;
+  if (!b)
+    return;
 
-       b->yy_n_chars = 0;
+  b->yy_n_chars = 0;
 
-       /* We always need two end-of-buffer characters.  The first causes
-        * a transition to the end-of-buffer state.  The second causes
-        * a jam in that state.
-        */
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+  /* We always need two end-of-buffer characters.  The first causes
+   * a transition to the end-of-buffer state.  The second causes
+   * a jam in that state.
+   */
+  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
-       b->yy_buf_pos = &b->yy_ch_buf[0];
+  b->yy_buf_pos = &b->yy_ch_buf[0];
 
-       b->yy_at_bol = 1;
-       b->yy_buffer_status = YY_BUFFER_NEW;
+  b->yy_at_bol = 1;
+  b->yy_buffer_status = YY_BUFFER_NEW;
 
-       if ( b == YY_CURRENT_BUFFER )
-               xbt_graph_parse__load_buffer_state( );
+  if (b == YY_CURRENT_BUFFER)
+    xbt_graph_parse__load_buffer_state();
 }
 
 /** Pushes the new state onto the stack. The new state becomes
@@ -2805,96 +2639,98 @@ extern int isatty (int );
  *  @param new_buffer The new state.
  *  
  */
-void xbt_graph_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
+void xbt_graph_parse_push_buffer_state(YY_BUFFER_STATE new_buffer)
 {
-       if (new_buffer == NULL)
-               return;
-
-       xbt_graph_parse_ensure_buffer_stack();
-
-       /* This block is copied from xbt_graph_parse__switch_to_buffer. */
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       /* Only push if top exists. Otherwise, replace top. */
-       if (YY_CURRENT_BUFFER)
-               (yy_buffer_stack_top)++;
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-       /* copied from xbt_graph_parse__switch_to_buffer. */
-       xbt_graph_parse__load_buffer_state( );
-       (yy_did_buffer_switch_on_eof) = 1;
+  if (new_buffer == NULL)
+    return;
+
+  xbt_graph_parse_ensure_buffer_stack();
+
+  /* This block is copied from xbt_graph_parse__switch_to_buffer. */
+  if (YY_CURRENT_BUFFER) {
+    /* Flush out information for old buffer. */
+    *(yy_c_buf_p) = (yy_hold_char);
+    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+  }
+
+  /* Only push if top exists. Otherwise, replace top. */
+  if (YY_CURRENT_BUFFER)
+    (yy_buffer_stack_top)++;
+  YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+  /* copied from xbt_graph_parse__switch_to_buffer. */
+  xbt_graph_parse__load_buffer_state();
+  (yy_did_buffer_switch_on_eof) = 1;
 }
 
 /** Removes and deletes the top of the stack, if present.
  *  The next element becomes the new top.
  *  
  */
-void xbt_graph_parse_pop_buffer_state (void)
+void xbt_graph_parse_pop_buffer_state(void)
 {
-       if (!YY_CURRENT_BUFFER)
-               return;
+  if (!YY_CURRENT_BUFFER)
+    return;
 
-       xbt_graph_parse__delete_buffer(YY_CURRENT_BUFFER );
-       YY_CURRENT_BUFFER_LVALUE = NULL;
-       if ((yy_buffer_stack_top) > 0)
-               --(yy_buffer_stack_top);
+  xbt_graph_parse__delete_buffer(YY_CURRENT_BUFFER);
+  YY_CURRENT_BUFFER_LVALUE = NULL;
+  if ((yy_buffer_stack_top) > 0)
+    --(yy_buffer_stack_top);
 
-       if (YY_CURRENT_BUFFER) {
-               xbt_graph_parse__load_buffer_state( );
-               (yy_did_buffer_switch_on_eof) = 1;
-       }
+  if (YY_CURRENT_BUFFER) {
+    xbt_graph_parse__load_buffer_state();
+    (yy_did_buffer_switch_on_eof) = 1;
+  }
 }
 
 /* Allocates the stack if it does not exist.
  *  Guarantees space for at least one push.
  */
-static void xbt_graph_parse_ensure_buffer_stack (void)
+static void xbt_graph_parse_ensure_buffer_stack(void)
 {
-       int num_to_alloc;
-    
-       if (!(yy_buffer_stack)) {
+  int num_to_alloc;
 
-               /* First allocation is just for 2 elements, since we don't know if this
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an
-                * immediate realloc on the next call.
-         */
-               num_to_alloc = 1;
-               (yy_buffer_stack) = (struct yy_buffer_state**)xbt_graph_parse_alloc
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in xbt_graph_parse_ensure_buffer_stack()" );
-                                                                 
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-                               
-               (yy_buffer_stack_max) = num_to_alloc;
-               (yy_buffer_stack_top) = 0;
-               return;
-       }
+  if (!(yy_buffer_stack)) {
 
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+    /* First allocation is just for 2 elements, since we don't know if this
+     * scanner will even need a stack. We use 2 instead of 1 to avoid an
+     * immediate realloc on the next call.
+     */
+    num_to_alloc = 1;
+    (yy_buffer_stack) = (struct yy_buffer_state **) xbt_graph_parse_alloc
+      (num_to_alloc * sizeof(struct yy_buffer_state *)
+      );
+    if (!(yy_buffer_stack))
+      YY_FATAL_ERROR
+        ("out of dynamic memory in xbt_graph_parse_ensure_buffer_stack()");
+
+    memset((yy_buffer_stack), 0,
+           num_to_alloc * sizeof(struct yy_buffer_state *));
+
+    (yy_buffer_stack_max) = num_to_alloc;
+    (yy_buffer_stack_top) = 0;
+    return;
+  }
 
-               /* Increase the buffer to prepare for a possible push. */
-               int grow_size = 8 /* arbitrary grow size */;
+  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
 
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;
-               (yy_buffer_stack) = (struct yy_buffer_state**)xbt_graph_parse_realloc
-                                                               ((yy_buffer_stack),
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               if ( ! (yy_buffer_stack) )
-                       YY_FATAL_ERROR( "out of dynamic memory in xbt_graph_parse_ensure_buffer_stack()" );
+    /* Increase the buffer to prepare for a possible push. */
+    int grow_size = 8 /* arbitrary grow size */ ;
 
-               /* zero only the new slots.*/
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-               (yy_buffer_stack_max) = num_to_alloc;
-       }
+    num_to_alloc = (yy_buffer_stack_max) + grow_size;
+    (yy_buffer_stack) = (struct yy_buffer_state **) xbt_graph_parse_realloc
+      ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)
+      );
+    if (!(yy_buffer_stack))
+      YY_FATAL_ERROR
+        ("out of dynamic memory in xbt_graph_parse_ensure_buffer_stack()");
+
+    /* zero only the new slots. */
+    memset((yy_buffer_stack) + (yy_buffer_stack_max), 0,
+           grow_size * sizeof(struct yy_buffer_state *));
+    (yy_buffer_stack_max) = num_to_alloc;
+  }
 }
 
 /** Setup the input buffer state to scan directly from a user-specified character buffer.
@@ -2903,33 +2739,33 @@ static void xbt_graph_parse_ensure_buffer_stack (void)
  * 
  * @return the newly allocated buffer state object. 
  */
-YY_BUFFER_STATE xbt_graph_parse__scan_buffer  (char * base, yy_size_t  size )
+YY_BUFFER_STATE xbt_graph_parse__scan_buffer(char *base, yy_size_t size)
 {
-       YY_BUFFER_STATE b;
-    
-       if ( size < 2 ||
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||
-            base[size-1] != YY_END_OF_BUFFER_CHAR )
-               /* They forgot to leave room for the EOB's. */
-               return 0;
-
-       b = (YY_BUFFER_STATE) xbt_graph_parse_alloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in xbt_graph_parse__scan_buffer()" );
-
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
-       b->yy_buf_pos = b->yy_ch_buf = base;
-       b->yy_is_our_buffer = 0;
-       b->yy_input_file = 0;
-       b->yy_n_chars = b->yy_buf_size;
-       b->yy_is_interactive = 0;
-       b->yy_at_bol = 1;
-       b->yy_fill_buffer = 0;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       xbt_graph_parse__switch_to_buffer(b  );
-
-       return b;
+  YY_BUFFER_STATE b;
+
+  if (size < 2 ||
+      base[size - 2] != YY_END_OF_BUFFER_CHAR ||
+      base[size - 1] != YY_END_OF_BUFFER_CHAR)
+    /* They forgot to leave room for the EOB's. */
+    return 0;
+
+  b = (YY_BUFFER_STATE) xbt_graph_parse_alloc(sizeof(struct yy_buffer_state));
+  if (!b)
+    YY_FATAL_ERROR("out of dynamic memory in xbt_graph_parse__scan_buffer()");
+
+  b->yy_buf_size = size - 2;    /* "- 2" to take care of EOB's */
+  b->yy_buf_pos = b->yy_ch_buf = base;
+  b->yy_is_our_buffer = 0;
+  b->yy_input_file = 0;
+  b->yy_n_chars = b->yy_buf_size;
+  b->yy_is_interactive = 0;
+  b->yy_at_bol = 1;
+  b->yy_fill_buffer = 0;
+  b->yy_buffer_status = YY_BUFFER_NEW;
+
+  xbt_graph_parse__switch_to_buffer(b);
+
+  return b;
 }
 
 /** Setup the input buffer state to scan a string. The next call to xbt_graph_parse_lex() will
@@ -2940,10 +2776,10 @@ YY_BUFFER_STATE xbt_graph_parse__scan_buffer  (char * base, yy_size_t  size )
  * @note If you want to scan bytes that may contain NUL values, then use
  *       xbt_graph_parse__scan_bytes() instead.
  */
-YY_BUFFER_STATE xbt_graph_parse__scan_string (yyconst char * yystr )
+YY_BUFFER_STATE xbt_graph_parse__scan_string(yyconst char *yystr)
 {
-    
-       return xbt_graph_parse__scan_bytes(yystr,strlen(yystr) );
+
+  return xbt_graph_parse__scan_bytes(yystr, strlen(yystr));
 }
 
 /** Setup the input buffer state to scan the given bytes. The next call to xbt_graph_parse_lex() will
@@ -2953,76 +2789,77 @@ YY_BUFFER_STATE xbt_graph_parse__scan_string (yyconst char * yystr )
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE xbt_graph_parse__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE xbt_graph_parse__scan_bytes(yyconst char *yybytes,
+                                            int _yybytes_len)
 {
-       YY_BUFFER_STATE b;
-       char *buf;
-       yy_size_t n;
-       int i;
-    
-       /* Get memory for full buffer, including space for trailing EOB's. */
-       n = _yybytes_len + 2;
-       buf = (char *) xbt_graph_parse_alloc(n  );
-       if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in xbt_graph_parse__scan_bytes()" );
-
-       for ( i = 0; i < _yybytes_len; ++i )
-               buf[i] = yybytes[i];
-
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-       b = xbt_graph_parse__scan_buffer(buf,n );
-       if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in xbt_graph_parse__scan_bytes()" );
-
-       /* It's okay to grow etc. this buffer, and we should throw it
-        * away when we're done.
-        */
-       b->yy_is_our_buffer = 1;
-
-       return b;
+  YY_BUFFER_STATE b;
+  char *buf;
+  yy_size_t n;
+  int i;
+
+  /* Get memory for full buffer, including space for trailing EOB's. */
+  n = _yybytes_len + 2;
+  buf = (char *) xbt_graph_parse_alloc(n);
+  if (!buf)
+    YY_FATAL_ERROR("out of dynamic memory in xbt_graph_parse__scan_bytes()");
+
+  for (i = 0; i < _yybytes_len; ++i)
+    buf[i] = yybytes[i];
+
+  buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
+
+  b = xbt_graph_parse__scan_buffer(buf, n);
+  if (!b)
+    YY_FATAL_ERROR("bad buffer in xbt_graph_parse__scan_bytes()");
+
+  /* It's okay to grow etc. this buffer, and we should throw it
+   * away when we're done.
+   */
+  b->yy_is_our_buffer = 1;
+
+  return b;
 }
 
-    static void yy_push_state (int  new_state )
+static void yy_push_state(int new_state)
 {
-       if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
-               {
-               yy_size_t new_size;
+  if ((yy_start_stack_ptr) >= (yy_start_stack_depth)) {
+    yy_size_t new_size;
 
-               (yy_start_stack_depth) += YY_START_STACK_INCR;
-               new_size = (yy_start_stack_depth) * sizeof( int );
+    (yy_start_stack_depth) += YY_START_STACK_INCR;
+    new_size = (yy_start_stack_depth) * sizeof(int);
 
-               if ( ! (yy_start_stack) )
-                       (yy_start_stack) = (int *) xbt_graph_parse_alloc(new_size  );
+    if (!(yy_start_stack))
+      (yy_start_stack) = (int *) xbt_graph_parse_alloc(new_size);
 
-               else
-                       (yy_start_stack) = (int *) xbt_graph_parse_realloc((void *) (yy_start_stack),new_size  );
+    else
+      (yy_start_stack) =
+        (int *) xbt_graph_parse_realloc((void *) (yy_start_stack), new_size);
 
-               if ( ! (yy_start_stack) )
-                       YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
-               }
+    if (!(yy_start_stack))
+      YY_FATAL_ERROR("out of memory expanding start-condition stack");
+  }
 
-       (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+  (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
 
-       BEGIN(new_state);
+  BEGIN(new_state);
 }
 
-    static void yy_pop_state  (void)
+static void yy_pop_state(void)
 {
-       if ( --(yy_start_stack_ptr) < 0 )
-               YY_FATAL_ERROR( "start-condition stack underflow" );
+  if (--(yy_start_stack_ptr) < 0)
+    YY_FATAL_ERROR("start-condition stack underflow");
 
-       BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+  BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
 }
 
 #ifndef YY_EXIT_FAILURE
 #define YY_EXIT_FAILURE 2
 #endif
 
-static void yy_fatal_error (yyconst char* msg )
+static void yy_fatal_error(yyconst char *msg)
 {
-       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
+  (void) fprintf(stderr, "%s\n", msg);
+  exit(YY_EXIT_FAILURE);
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -3047,53 +2884,53 @@ static void yy_fatal_error (yyconst char* msg )
 /** Get the current line number.
  * 
  */
-int xbt_graph_parse_get_lineno  (void)
+int xbt_graph_parse_get_lineno(void)
 {
-        
-    return xbt_graph_parse_lineno;
+
+  return xbt_graph_parse_lineno;
 }
 
 /** Get the input stream.
  * 
  */
-FILE *xbt_graph_parse_get_in  (void)
+FILE *xbt_graph_parse_get_in(void)
 {
-        return xbt_graph_parse_in;
+  return xbt_graph_parse_in;
 }
 
 /** Get the output stream.
  * 
  */
-FILE *xbt_graph_parse_get_out  (void)
+FILE *xbt_graph_parse_get_out(void)
 {
-        return xbt_graph_parse_out;
+  return xbt_graph_parse_out;
 }
 
 /** Get the length of the current token.
  * 
  */
-int xbt_graph_parse_get_leng  (void)
+int xbt_graph_parse_get_leng(void)
 {
-        return xbt_graph_parse_leng;
+  return xbt_graph_parse_leng;
 }
 
 /** Get the current token.
  * 
  */
 
-char *xbt_graph_parse_get_text  (void)
+char *xbt_graph_parse_get_text(void)
 {
-        return xbt_graph_parse_text;
+  return xbt_graph_parse_text;
 }
 
 /** Set the current line number.
  * @param line_number
  * 
  */
-void xbt_graph_parse_set_lineno (int  line_number )
+void xbt_graph_parse_set_lineno(int line_number)
 {
-    
-    xbt_graph_parse_lineno = line_number;
+
+  xbt_graph_parse_lineno = line_number;
 }
 
 /** Set the input stream. This does not discard the current
@@ -3102,85 +2939,85 @@ void xbt_graph_parse_set_lineno (int  line_number )
  * 
  * @see xbt_graph_parse__switch_to_buffer
  */
-void xbt_graph_parse_set_in (FILE *  in_str )
+void xbt_graph_parse_set_in(FILE * in_str)
 {
-        xbt_graph_parse_in = in_str ;
+  xbt_graph_parse_in = in_str;
 }
 
-void xbt_graph_parse_set_out (FILE *  out_str )
+void xbt_graph_parse_set_out(FILE * out_str)
 {
-        xbt_graph_parse_out = out_str ;
+  xbt_graph_parse_out = out_str;
 }
 
-int xbt_graph_parse_get_debug  (void)
+int xbt_graph_parse_get_debug(void)
 {
-        return xbt_graph_parse__flex_debug;
+  return xbt_graph_parse__flex_debug;
 }
 
-void xbt_graph_parse_set_debug (int  bdebug )
+void xbt_graph_parse_set_debug(int bdebug)
 {
-        xbt_graph_parse__flex_debug = bdebug ;
+  xbt_graph_parse__flex_debug = bdebug;
 }
 
-static int yy_init_globals (void)
+static int yy_init_globals(void)
 {
-        /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from xbt_graph_parse_lex_destroy(), so don't allocate here.
-     */
+  /* Initialization is the same as for the non-reentrant scanner.
+   * This function is called from xbt_graph_parse_lex_destroy(), so don't allocate here.
+   */
 
-    /* We do not touch xbt_graph_parse_lineno unless the option is enabled. */
-    xbt_graph_parse_lineno =  1;
-    
-    (yy_buffer_stack) = 0;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char *) 0;
-    (yy_init) = 0;
-    (yy_start) = 0;
+  /* We do not touch xbt_graph_parse_lineno unless the option is enabled. */
+  xbt_graph_parse_lineno = 1;
+
+  (yy_buffer_stack) = 0;
+  (yy_buffer_stack_top) = 0;
+  (yy_buffer_stack_max) = 0;
+  (yy_c_buf_p) = (char *) 0;
+  (yy_init) = 0;
+  (yy_start) = 0;
 
-    (yy_start_stack_ptr) = 0;
-    (yy_start_stack_depth) = 0;
-    (yy_start_stack) =  NULL;
+  (yy_start_stack_ptr) = 0;
+  (yy_start_stack_depth) = 0;
+  (yy_start_stack) = NULL;
 
 /* Defined in main.c */
 #ifdef YY_STDINIT
-    xbt_graph_parse_in = stdin;
-    xbt_graph_parse_out = stdout;
+  xbt_graph_parse_in = stdin;
+  xbt_graph_parse_out = stdout;
 #else
-    xbt_graph_parse_in = (FILE *) 0;
-    xbt_graph_parse_out = (FILE *) 0;
+  xbt_graph_parse_in = (FILE *) 0;
+  xbt_graph_parse_out = (FILE *) 0;
 #endif
 
-    /* For future reference: Set errno on error, since we are called by
-     * xbt_graph_parse_lex_init()
-     */
-    return 0;
+  /* For future reference: Set errno on error, since we are called by
+   * xbt_graph_parse_lex_init()
+   */
+  return 0;
 }
 
 /* xbt_graph_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
-int xbt_graph_parse_lex_destroy  (void)
+int xbt_graph_parse_lex_destroy(void)
 {
-    
-    /* Pop the buffer stack, destroying each element. */
-       while(YY_CURRENT_BUFFER){
-               xbt_graph_parse__delete_buffer(YY_CURRENT_BUFFER  );
-               YY_CURRENT_BUFFER_LVALUE = NULL;
-               xbt_graph_parse_pop_buffer_state();
-       }
 
-       /* Destroy the stack itself. */
-       xbt_graph_parse_free((yy_buffer_stack) );
-       (yy_buffer_stack) = NULL;
+  /* Pop the buffer stack, destroying each element. */
+  while (YY_CURRENT_BUFFER) {
+    xbt_graph_parse__delete_buffer(YY_CURRENT_BUFFER);
+    YY_CURRENT_BUFFER_LVALUE = NULL;
+    xbt_graph_parse_pop_buffer_state();
+  }
 
-    /* Destroy the start condition stack. */
-        xbt_graph_parse_free((yy_start_stack)  );
-        (yy_start_stack) = NULL;
+  /* Destroy the stack itself. */
+  xbt_graph_parse_free((yy_buffer_stack));
+  (yy_buffer_stack) = NULL;
 
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * xbt_graph_parse_lex() is called, initialization will occur. */
-    yy_init_globals( );
+  /* Destroy the start condition stack. */
+  xbt_graph_parse_free((yy_start_stack));
+  (yy_start_stack) = NULL;
 
-    return 0;
+  /* Reset the globals. This is important in a non-reentrant scanner so the next time
+   * xbt_graph_parse_lex() is called, initialization will occur. */
+  yy_init_globals();
+
+  return 0;
 }
 
 /*
@@ -3188,45 +3025,44 @@ int xbt_graph_parse_lex_destroy  (void)
  */
 
 #ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+static void yy_flex_strncpy(char *s1, yyconst char *s2, int n)
 {
-       register int i;
-       for ( i = 0; i < n; ++i )
-               s1[i] = s2[i];
+  register int i;
+  for (i = 0; i < n; ++i)
+    s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
+static int yy_flex_strlen(yyconst char *s)
 {
-       register int n;
-       for ( n = 0; s[n]; ++n )
-               ;
+  register int n;
+  for (n = 0; s[n]; ++n);
 
-       return n;
+  return n;
 }
 #endif
 
-void *xbt_graph_parse_alloc (yy_size_t  size )
+void *xbt_graph_parse_alloc(yy_size_t size)
 {
-       return (void *) malloc( size );
+  return (void *) malloc(size);
 }
 
-void *xbt_graph_parse_realloc  (void * ptr, yy_size_t  size )
+void *xbt_graph_parse_realloc(void *ptr, yy_size_t size)
 {
-       /* The cast to (char *) in the following accommodates both
-        * implementations that use char* generic pointers, and those
-        * that use void* generic pointers.  It works with the latter
-        * because both ANSI C and C++ allow castless assignment from
-        * any pointer type to void*, and deal with argument conversions
-        * as though doing an assignment.
-        */
-       return (void *) realloc( (char *) ptr, size );
+  /* The cast to (char *) in the following accommodates both
+   * implementations that use char* generic pointers, and those
+   * that use void* generic pointers.  It works with the latter
+   * because both ANSI C and C++ allow castless assignment from
+   * any pointer type to void*, and deal with argument conversions
+   * as though doing an assignment.
+   */
+  return (void *) realloc((char *) ptr, size);
 }
 
-void xbt_graph_parse_free (void * ptr )
+void xbt_graph_parse_free(void *ptr)
 {
-       free( (char *) ptr );   /* see xbt_graph_parse_realloc() for (char *) cast */
+  free((char *) ptr);           /* see xbt_graph_parse_realloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
@@ -3234,96 +3070,101 @@ void xbt_graph_parse_free (void * ptr )
 /* Element context stack lookup. */
 int graphxml_element_context(int i)
 {
-  return (0<i && i<yy_start_stack_depth
-         ? yy_start_stack[yy_start_stack_ptr - i]
-         : 0);
+  return (0 < i && i < yy_start_stack_depth
+          ? yy_start_stack[yy_start_stack_ptr - i]
+          : 0);
 }
 
 #ifdef FLEX_DEBUG
-void print_yy_stack(charfmt, ...)
+void print_yy_stack(char *fmt, ...)
 {
-  int i = 0; va_list ap; va_start(ap, fmt);
+  int i = 0;
+  va_list ap;
+  va_start(ap, fmt);
   vfprintf(stderr, fmt, ap);
   if (graphxml_statenames) {
-      for (i=1; i<yy_start_stack_ptr; i++) {
-          fprintf(stderr, "%s/", graphxml_statenames[yy_start_stack[i] ]);
-      }
-      fprintf(stderr,"%s\n", graphxml_statenames[YY_START]);
+    for (i = 1; i < yy_start_stack_ptr; i++) {
+      fprintf(stderr, "%s/", graphxml_statenames[yy_start_stack[i]]);
+    }
+    fprintf(stderr, "%s\n", graphxml_statenames[YY_START]);
   }
   va_end(ap);
 }
 
 void print_graphxml_bufferstack()
 {
-    int i;
-    fputs("Buffer: ", stderr);
-    for (i = 0; i < blimit; i++) {
-       if ( graphxml_bufferstack[i] == '\377' ) break;
-         putc(graphxml_bufferstack[i], stderr);
-    }
-    putc('\n', stderr);
+  int i;
+  fputs("Buffer: ", stderr);
+  for (i = 0; i < blimit; i++) {
+    if (graphxml_bufferstack[i] == '\377')
+      break;
+    putc(graphxml_bufferstack[i], stderr);
+  }
+  putc('\n', stderr);
 }
 
-static void debug_enter(int state, const char* statename) {
+static void debug_enter(int state, const char *statename)
+{
   yy_push_state(state);
   if (xbt_graph_parse__flex_debug) {
-       print_yy_stack("--ENTER(%s) : ",statename);
-       print_graphxml_bufferstack();
+    print_yy_stack("--ENTER(%s) : ", statename);
+    print_graphxml_bufferstack();
   }
 }
 
-static void debug_leave(void) {
-    if (xbt_graph_parse__flex_debug) {
-        print_yy_stack("--LEAVE : ");
-       print_graphxml_bufferstack();
-    }
+static void debug_leave(void)
+{
+  if (xbt_graph_parse__flex_debug) {
+    print_yy_stack("--LEAVE : ");
+    print_graphxml_bufferstack();
+  }
   yy_pop_state();
 }
 
-static void debug_set(int state, const char* statename) {
+static void debug_set(int state, const char *statename)
+{
   BEGIN(state);
-  if (xbt_graph_parse__flex_debug) print_yy_stack("--SET(%s) : ",statename);
+  if (xbt_graph_parse__flex_debug)
+    print_yy_stack("--SET(%s) : ", statename);
 }
 #endif
 
 static void cleanup(void)
 {
-    if (graphxml_statenames) {
-        free(graphxml_statenames);
-       graphxml_statenames = NULL;
-    }
-    free(graphxml_bufferstack);
-    graphxml_bufferstack = NULL;
+  if (graphxml_statenames) {
+    free(graphxml_statenames);
+    graphxml_statenames = NULL;
+  }
+  free(graphxml_bufferstack);
+  graphxml_bufferstack = NULL;
 
-    free(indexstack);
-    indexstack = NULL;
+  free(indexstack);
+  indexstack = NULL;
 }
 
-static int fail(const charfmt, ...)
+static int fail(const char *fmt, ...)
 {
-    int chars_left, used;
-    va_list ap; va_start(ap, fmt);
+  int chars_left, used;
+  va_list ap;
+  va_start(ap, fmt);
 #ifdef FLEXML_yylineno
-    used = sprintf(flexml_err_msg,
-                  "Invalid XML (XML input line %d, state %d): ",
-                  xbt_graph_parse_lineno, YY_START);
+  used = sprintf(flexml_err_msg,
+                 "Invalid XML (XML input line %d, state %d): ",
+                 xbt_graph_parse_lineno, YY_START);
 #else
-    used = sprintf(flexml_err_msg,
-                  "Invalid XML (state %d): ",
-                  YY_START);
+  used = sprintf(flexml_err_msg, "Invalid XML (state %d): ", YY_START);
 #endif
-    chars_left = flexml_max_err_msg_size - used - 1;
-    vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
-    va_end(ap);
+  chars_left = flexml_max_err_msg_size - used - 1;
+  vsnprintf(flexml_err_msg + used, chars_left, fmt, ap);
+  va_end(ap);
 
 #ifndef FLEXML_quiet_parser
-    /* print directly to sdterr */
-    fprintf(stderr, "%s\n", flexml_err_msg);
-    flexml_err_msg[0] = '\0';
+  /* print directly to sdterr */
+  fprintf(stderr, "%s\n", flexml_err_msg);
+  flexml_err_msg[0] = '\0';
 #endif
 
-    cleanup();
+  cleanup();
 
-    return 1;
+  return 1;
 }
-
index 5768ea0..d251761 100644 (file)
 #include "xbt/dynar.h"
 #include "xbt/graphxml_parse.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(graphxml_parse, xbt ,"Logging specific to the graphxml parsing  module");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(graphxml_parse, xbt,
+                                "Logging specific to the graphxml parsing  module");
 
 #undef CLEANUP
 #include "graphxml.c"
 
-static xbt_dynar_t xbt_graph_input_buffer_stack=NULL;
-static xbt_dynar_t xbt_graph_file_to_parse_stack=NULL;
+static xbt_dynar_t xbt_graph_input_buffer_stack = NULL;
+static xbt_dynar_t xbt_graph_file_to_parse_stack = NULL;
 
 static void nil_function(void)
 {
@@ -48,62 +49,67 @@ void xbt_graph_parse_reset_parser(void)
 
 void STag_graphxml_graph(void)
 {
-  (*STag_graphxml_graph_fun)();
+  (*STag_graphxml_graph_fun) ();
 }
 
 void ETag_graphxml_graph(void)
 {
-  (*ETag_graphxml_graph_fun)();
+  (*ETag_graphxml_graph_fun) ();
 }
 
 
 void STag_graphxml_node(void)
 {
-  (*STag_graphxml_node_fun)();
+  (*STag_graphxml_node_fun) ();
 }
 
 void ETag_graphxml_node(void)
 {
-  (*ETag_graphxml_node_fun)();
+  (*ETag_graphxml_node_fun) ();
 }
 
 
 void STag_graphxml_edge(void)
 {
-  (*STag_graphxml_edge_fun)();
+  (*STag_graphxml_edge_fun) ();
 }
 
 void ETag_graphxml_edge(void)
 {
-  (*ETag_graphxml_edge_fun)();
+  (*ETag_graphxml_edge_fun) ();
 }
 
 
 
-void  xbt_graph_parse_open(const char *file) {
-  if(!file) {
-    WARN0("I hope you know what you're doing... you just gave me a NULL pointer!");
+void xbt_graph_parse_open(const char *file)
+{
+  if (!file) {
+    WARN0
+      ("I hope you know what you're doing... you just gave me a NULL pointer!");
     return;
   }
-  if(!xbt_graph_input_buffer_stack)
-    xbt_graph_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE),NULL);
-  if(!xbt_graph_file_to_parse_stack)
-    xbt_graph_file_to_parse_stack = xbt_dynar_new(sizeof(FILE*),NULL);
-
-  xbt_graph_file_to_parse = fopen(file,"r");  /* FIXME should use something like surf_fopen */
-  xbt_assert1((xbt_graph_file_to_parse), "Unable to open \"%s\"\n",file);
-  xbt_graph_input_buffer = xbt_graph_parse__create_buffer( xbt_graph_file_to_parse, 10);
+  if (!xbt_graph_input_buffer_stack)
+    xbt_graph_input_buffer_stack =
+      xbt_dynar_new(sizeof(YY_BUFFER_STATE), NULL);
+  if (!xbt_graph_file_to_parse_stack)
+    xbt_graph_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL);
+
+  xbt_graph_file_to_parse = fopen(file, "r");   /* FIXME should use something like surf_fopen */
+  xbt_assert1((xbt_graph_file_to_parse), "Unable to open \"%s\"\n", file);
+  xbt_graph_input_buffer =
+    xbt_graph_parse__create_buffer(xbt_graph_file_to_parse, 10);
   xbt_graph_parse__switch_to_buffer(xbt_graph_input_buffer);
   xbt_graph_parse_lineno = 1;
 }
 
-void  xbt_graph_parse_close(void) {
-  if(xbt_graph_input_buffer_stack)
+void xbt_graph_parse_close(void)
+{
+  if (xbt_graph_input_buffer_stack)
     xbt_dynar_free(&xbt_graph_input_buffer_stack);
-  if(xbt_graph_file_to_parse_stack)
+  if (xbt_graph_file_to_parse_stack)
     xbt_dynar_free(&xbt_graph_file_to_parse_stack);
 
-  if(xbt_graph_file_to_parse) {
+  if (xbt_graph_file_to_parse) {
     xbt_graph_parse__delete_buffer(xbt_graph_input_buffer);
     fclose(xbt_graph_file_to_parse);
   }
@@ -117,12 +123,11 @@ static int _xbt_graph_parse(void)
 
 int_f_void_t xbt_graph_parse = _xbt_graph_parse;
 
-void xbt_graph_parse_get_double(double *value,const char *string)
+void xbt_graph_parse_get_double(double *value, const char *string)
 {
   int ret = 0;
 
   ret = sscanf(string, "%lg", value);
-  xbt_assert2((ret==1), "Parse error line %d : %s not a number", xbt_graph_parse_lineno,
-              string);
+  xbt_assert2((ret == 1), "Parse error line %d : %s not a number",
+              xbt_graph_parse_lineno, string);
 }
-
index 8423b0c..7f97bd8 100644 (file)
@@ -45,7 +45,7 @@ void xbt_heap_free(xbt_heap_t H)
   int i;
   if (H->free)
     for (i = 0; i < H->count; i++)
-      (*(H->free))(H->items[i].content);
+      (*(H->free)) (H->items[i].content);
   free(H->items);
   free(H);
   return;
@@ -78,7 +78,8 @@ void xbt_heap_push(xbt_heap_t H, void *content, double key)
 
   if (count > size) {
     H->size = 2 * size + 1;
-    H->items =(void *) realloc(H->items,(H->size) * sizeof(struct xbt_heapItem));
+    H->items =
+      (void *) realloc(H->items, (H->size) * sizeof(struct xbt_heapItem));
   }
 
   item = &(H->items[count - 1]);
@@ -112,8 +113,7 @@ void *xbt_heap_pop(xbt_heap_t H)
   if (H->count < H->size / 4 && H->size > 16) {
     H->size = H->size / 2 + 1;
     H->items =
-      (void *) realloc(H->items,
-                       (H->size) * sizeof(struct xbt_heapItem));
+      (void *) realloc(H->items, (H->size) * sizeof(struct xbt_heapItem));
   }
   return max;
 }
@@ -126,7 +126,7 @@ void *xbt_heap_pop(xbt_heap_t H)
  */
 double xbt_heap_maxkey(xbt_heap_t H)
 {
-  xbt_assert0(H->count != 0,"Empty heap");
+  xbt_assert0(H->count != 0, "Empty heap");
   return KEY(H, 0);
 }
 
@@ -139,7 +139,7 @@ double xbt_heap_maxkey(xbt_heap_t H)
  */
 void *xbt_heap_maxcontent(xbt_heap_t H)
 {
-  xbt_assert0(H->count != 0,"Empty heap");
+  xbt_assert0(H->count != 0, "Empty heap");
   return CONTENT(H, 0);
 }
 
index 026cbb4..bcd3ce9 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef _XBT_HEAP_PRIVATE_H
 #define _XBT_HEAP_PRIVATE_H
 
-#include "xbt/dynar.h" /* void_f_pvoid_t */
+#include "xbt/dynar.h"          /* void_f_pvoid_t */
 #include "xbt/heap.h"
 
 typedef struct xbt_heapItem {
@@ -33,4 +33,4 @@ typedef struct xbt_heap {
 static void xbt_heap_maxHeapify(xbt_heap_t H);
 static void xbt_heap_increaseKey(xbt_heap_t H, int i);
 
-#endif                         /* _XBT_HEAP_PRIVATE_H */
+#endif /* _XBT_HEAP_PRIVATE_H */
index 834acb2..84e40ef 100644 (file)
 
 #include <stdarg.h>
 #include <ctype.h>
-#include <stdio.h> /* snprintf */
-#include <stdlib.h> /* snprintf */
+#include <stdio.h>              /* snprintf */
+#include <stdlib.h>             /* snprintf */
 
-#include "portable.h" /* to get a working stdarg.h */
+#include "portable.h"           /* to get a working stdarg.h */
 
 #include "xbt_modinter.h"
 
@@ -24,7 +24,7 @@
 #include "xbt/log_private.h"
 #include "xbt/dynar.h"
 
-XBT_PUBLIC_DATA(int) (*xbt_pid)();
+XBT_PUBLIC_DATA(int) (*xbt_pid) ();
 
 /** \addtogroup XBT_log
  *
@@ -463,10 +463,10 @@ This is on our TODO list for quite a while now, but your help would be
 welcome here, too.
 
 
*//*'*/
                                                                                                                                                                                             *//*' */
 
 
-xbt_log_appender_t xbt_log_default_appender = NULL; /* set in log_init */
+xbt_log_appender_t xbt_log_default_appender = NULL;     /* set in log_init */
 xbt_log_layout_t xbt_log_default_layout = NULL; /* set in log_init */
 int _log_usable = 0;
 
@@ -476,12 +476,13 @@ typedef struct {
   char *fmt;
   int additivity;
   xbt_log_appender_t appender;
-} s_xbt_log_setting_t,*xbt_log_setting_t;
+} s_xbt_log_setting_t, *xbt_log_setting_t;
 
-static xbt_dynar_t xbt_log_settings=NULL;
+static xbt_dynar_t xbt_log_settings = NULL;
 
-static void _free_setting(void *s) {
-  xbt_log_setting_t set=*(xbt_log_setting_t*)s;
+static void _free_setting(void *s)
+{
+  xbt_log_setting_t set = *(xbt_log_setting_t *) s;
   if (set) {
     free(set->catname);
     if (set->fmt)
@@ -489,84 +490,89 @@ static void _free_setting(void *s) {
     free(set);
   }
 }
+
 static void _xbt_log_cat_apply_set(xbt_log_category_t category,
                                    xbt_log_setting_t setting);
 
 const char *xbt_log_priority_names[8] = {
-                                         "NONE",
-                                         "TRACE",
-                                         "DEBUG",
-                                         "VERBOSE",
-                                         "INFO",
-                                         "WARNING",
-                                         "ERROR",
-                                         "CRITICAL"
+  "NONE",
+  "TRACE",
+  "DEBUG",
+  "VERBOSE",
+  "INFO",
+  "WARNING",
+  "ERROR",
+  "CRITICAL"
 };
 
 s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT) = {
-                                                    NULL /*parent*/, NULL /* firstChild */, NULL /* nextSibling */,
-                                                    "root", xbt_log_priority_uninitialized /* threshold */,
-                                                    0 /* isThreshInherited */,
-                                                    NULL /* appender */, NULL /* layout */,
-                                                    0 /* additivity */
+  NULL /*parent */ , NULL /* firstChild */ , NULL /* nextSibling */ ,
+    "root", xbt_log_priority_uninitialized /* threshold */ ,
+    0 /* isThreshInherited */ ,
+    NULL /* appender */ , NULL /* layout */ ,
+    0                           /* additivity */
 };
 
-XBT_LOG_NEW_CATEGORY(xbt,"All XBT categories (simgrid toolbox)");
-XBT_LOG_NEW_CATEGORY(surf,"All SURF categories");
-XBT_LOG_NEW_CATEGORY(msg,"All MSG categories");
-XBT_LOG_NEW_CATEGORY(simix,"All SIMIX categories");
+XBT_LOG_NEW_CATEGORY(xbt, "All XBT categories (simgrid toolbox)");
+XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
+XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
+XBT_LOG_NEW_CATEGORY(simix, "All SIMIX categories");
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log,xbt,"Loggings from the logging mechanism itself");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log, xbt,
+                                "Loggings from the logging mechanism itself");
 
 /** @brief Get all logging settings from the command line
  *
  * xbt_log_control_set() is called on each string we got from cmd line
  */
-void xbt_log_init(int *argc,char **argv) {
-  int i,j;
+void xbt_log_init(int *argc, char **argv)
+{
+  int i, j;
   char *opt;
 
   /* create the default appender and install it in the root category,
-          which were already created (damnit. Too slow little beetle)*/
+     which were already created (damnit. Too slow little beetle) */
   xbt_log_default_appender = xbt_log_appender_file_new(NULL);
   xbt_log_default_layout = xbt_log_layout_simple_new(NULL);
   _XBT_LOGV(XBT_LOG_ROOT_CAT).appender = xbt_log_default_appender;
   _XBT_LOGV(XBT_LOG_ROOT_CAT).layout = xbt_log_default_layout;
   _log_usable = 1;
 
-  //   _XBT_LOGV(log).threshold = xbt_log_priority_debug; /* uncomment to set the LOG category to debug directly */
+  //    _XBT_LOGV(log).threshold = xbt_log_priority_debug; /* uncomment to set the LOG category to debug directly */
 
   /* Set logs and init log submodule */
-  for (i=1; i<*argc; i++){
-    if (!strncmp(argv[i],"--log=",strlen("--log=")) ||
-        !strncmp(argv[i],"--gras-log=",strlen("--gras-log=")) ||
-        !strncmp(argv[i],"--surf-log=",strlen("--surf-log=")) ||
-        !strncmp(argv[i],"--msg-log=",strlen("--msg-log=")) ||
-        !strncmp(argv[i],"--simix-log=",strlen("--simix-log=")) ||
-        !strncmp(argv[i],"--xbt-log=",strlen("--xbt-log="))){
-
-      if (strncmp(argv[i],"--log=",strlen("--log=")))
-        WARN2("Option %.*s is deprecated and will disapear in the future. Use --log instead.",
-              (int)(strchr(argv[i],'=')-argv[i]),argv[i]);
-
-      opt=strchr(argv[i],'=');
+  for (i = 1; i < *argc; i++) {
+    if (!strncmp(argv[i], "--log=", strlen("--log=")) ||
+        !strncmp(argv[i], "--gras-log=", strlen("--gras-log=")) ||
+        !strncmp(argv[i], "--surf-log=", strlen("--surf-log=")) ||
+        !strncmp(argv[i], "--msg-log=", strlen("--msg-log=")) ||
+        !strncmp(argv[i], "--simix-log=", strlen("--simix-log=")) ||
+        !strncmp(argv[i], "--xbt-log=", strlen("--xbt-log="))) {
+
+      if (strncmp(argv[i], "--log=", strlen("--log=")))
+        WARN2
+          ("Option %.*s is deprecated and will disapear in the future. Use --log instead.",
+           (int) (strchr(argv[i], '=') - argv[i]), argv[i]);
+
+      opt = strchr(argv[i], '=');
       opt++;
       xbt_log_control_set(opt);
-      DEBUG1("Did apply '%s' as log setting",opt);
-      /*remove this from argv*/
+      DEBUG1("Did apply '%s' as log setting", opt);
+      /*remove this from argv */
 
-      for (j=i+1; j<*argc; j++){
-        argv[j-1] = argv[j];
+      for (j = i + 1; j < *argc; j++) {
+        argv[j - 1] = argv[j];
       }
 
-      argv[j-1] = NULL;
+      argv[j - 1] = NULL;
       (*argc)--;
-      i--; /* compensate effect of next loop incrementation */
+      i--;                      /* compensate effect of next loop incrementation */
     }
   }
 }
 
-static void log_cat_exit(xbt_log_category_t cat) {
+static void log_cat_exit(xbt_log_category_t cat)
+{
   xbt_log_category_t child;
 
   if (cat->appender) {
@@ -580,18 +586,20 @@ static void log_cat_exit(xbt_log_category_t cat) {
     free(cat->layout);
   }
 
-  for(child=cat->firstChild ; child != NULL; child = child->nextSibling)
+  for (child = cat->firstChild; child != NULL; child = child->nextSibling)
     log_cat_exit(child);
 }
 
-void xbt_log_exit(void) {
+void xbt_log_exit(void)
+{
   VERB0("Exiting log");
   xbt_dynar_free(&xbt_log_settings);
   log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT));
   _log_usable = 0;
 }
 
-void _xbt_log_event_log( xbt_log_event_t ev, const char *fmt, ...) {
+void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...)
+{
 
   xbt_log_category_t cat = ev->cat;
   if (!_log_usable) {
@@ -605,10 +613,12 @@ void _xbt_log_event_log( xbt_log_event_t ev, const char *fmt, ...) {
 
   va_start(ev->ap, fmt);
   va_start(ev->ap_copy, fmt);
-  while(1) {
+  while (1) {
     xbt_log_appender_t appender = cat->appender;
     if (appender != NULL) {
-      xbt_assert1(cat->layout,"No valid layout for the appender of category %s",cat->name);
+      xbt_assert1(cat->layout,
+                  "No valid layout for the appender of category %s",
+                  cat->name);
       cat->layout->do_layout(cat->layout, ev, fmt, appender);
     }
     if (!cat->additivity)
@@ -625,7 +635,8 @@ void _xbt_log_event_log( xbt_log_event_t ev, const char *fmt, ...) {
 }
 
 static void _xbt_log_cat_apply_set(xbt_log_category_t category,
-                                   xbt_log_setting_t setting) {
+                                   xbt_log_setting_t setting)
+{
 
   s_xbt_log_event_t _log_ev;
 
@@ -635,9 +646,9 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category,
     if (category->threshold <= xbt_log_priority_debug) {
       _log_ev.cat = category;
       _log_ev.priority = xbt_log_priority_debug;
-      _log_ev.fileName = __FILE__ ;
-      _log_ev.functionName = _XBT_FUNCTION ;
-      _log_ev.lineNum = __LINE__ ;
+      _log_ev.fileName = __FILE__;
+      _log_ev.functionName = _XBT_FUNCTION;
+      _log_ev.lineNum = __LINE__;
 
       _xbt_log_event_log(&_log_ev,
                          "Apply settings for category '%s': set threshold to %s (=%d)",
@@ -648,67 +659,67 @@ static void _xbt_log_cat_apply_set(xbt_log_category_t category,
   }
 
   if (setting->fmt) {
-    xbt_log_layout_set(category,xbt_log_layout_format_new(setting->fmt));
+    xbt_log_layout_set(category, xbt_log_layout_format_new(setting->fmt));
 
     if (category->threshold <= xbt_log_priority_debug) {
       _log_ev.cat = category;
       _log_ev.priority = xbt_log_priority_debug;
-      _log_ev.fileName = __FILE__ ;
-      _log_ev.functionName = _XBT_FUNCTION ;
-      _log_ev.lineNum = __LINE__ ;
+      _log_ev.fileName = __FILE__;
+      _log_ev.functionName = _XBT_FUNCTION;
+      _log_ev.lineNum = __LINE__;
 
       _xbt_log_event_log(&_log_ev,
                          "Apply settings for category '%s': set format to %s",
-                         category->name,
-                         setting->fmt);
+                         category->name, setting->fmt);
     }
   }
 
   if (setting->additivity != -1) {
-    xbt_log_additivity_set(category,setting->additivity);
+    xbt_log_additivity_set(category, setting->additivity);
 
     if (category->threshold <= xbt_log_priority_debug) {
       _log_ev.cat = category;
       _log_ev.priority = xbt_log_priority_debug;
-      _log_ev.fileName = __FILE__ ;
-      _log_ev.functionName = _XBT_FUNCTION ;
-      _log_ev.lineNum = __LINE__ ;
+      _log_ev.fileName = __FILE__;
+      _log_ev.functionName = _XBT_FUNCTION;
+      _log_ev.lineNum = __LINE__;
 
       _xbt_log_event_log(&_log_ev,
                          "Apply settings for category '%s': set additivity to %s",
                          category->name,
-                         (setting->additivity?"on":"off"));
+                         (setting->additivity ? "on" : "off"));
     }
   }
   if (setting->appender) {
-         xbt_log_appender_set(category,setting->appender);
-         if (!category->layout)
-                 xbt_log_layout_set(category,xbt_log_layout_simple_new(NULL));
-         category->additivity = 0;
-         if (category->threshold <= xbt_log_priority_debug) {
-             _log_ev.cat = category;
-             _log_ev.priority = xbt_log_priority_debug;
-             _log_ev.fileName = __FILE__ ;
-             _log_ev.functionName = _XBT_FUNCTION ;
-             _log_ev.lineNum = __LINE__ ;
-
-             _xbt_log_event_log(&_log_ev,
-                                "Set %p as appender of category '%s'",
-                                setting->appender,
-                                category->name);
-           }
+    xbt_log_appender_set(category, setting->appender);
+    if (!category->layout)
+      xbt_log_layout_set(category, xbt_log_layout_simple_new(NULL));
+    category->additivity = 0;
+    if (category->threshold <= xbt_log_priority_debug) {
+      _log_ev.cat = category;
+      _log_ev.priority = xbt_log_priority_debug;
+      _log_ev.fileName = __FILE__;
+      _log_ev.functionName = _XBT_FUNCTION;
+      _log_ev.lineNum = __LINE__;
+
+      _xbt_log_event_log(&_log_ev,
+                         "Set %p as appender of category '%s'",
+                         setting->appender, category->name);
+    }
   }
 
 }
+
 /*
  * This gets called the first time a category is referenced and performs the
  * initialization.
  * Also resets threshold to inherited!
  */
 int _xbt_log_cat_init(xbt_log_category_t category,
-                      e_xbt_log_priority_t priority) {
+                      e_xbt_log_priority_t priority)
+{
   unsigned int cursor;
-  xbt_log_setting_t setting=NULL;
+  xbt_log_setting_t setting = NULL;
   int found = 0;
   s_xbt_log_event_t _log_ev;
 
@@ -716,17 +727,21 @@ int _xbt_log_cat_init(xbt_log_category_t category,
       && _XBT_LOGV(log).threshold != xbt_log_priority_uninitialized) {
     _log_ev.cat = &_XBT_LOGV(log);
     _log_ev.priority = xbt_log_priority_debug;
-    _log_ev.fileName = __FILE__ ;
-    _log_ev.functionName = _XBT_FUNCTION ;
-    _log_ev.lineNum = __LINE__ ;
-    _xbt_log_event_log(&_log_ev, "Initializing category '%s' (firstChild=%s, nextSibling=%s)",
+    _log_ev.fileName = __FILE__;
+    _log_ev.functionName = _XBT_FUNCTION;
+    _log_ev.lineNum = __LINE__;
+    _xbt_log_event_log(&_log_ev,
+                       "Initializing category '%s' (firstChild=%s, nextSibling=%s)",
                        category->name,
-                       (category->firstChild ?category->firstChild->name :"none"),
-                       (category->nextSibling?category->nextSibling->name:"none"));
+                       (category->firstChild ? category->
+                        firstChild->name : "none"),
+                       (category->nextSibling ? category->
+                        nextSibling->name : "none"));
   }
 
-  if(category == &_XBT_LOGV(XBT_LOG_ROOT_CAT)){
-    category->threshold = xbt_log_priority_info;/* xbt_log_priority_debug*/;
+  if (category == &_XBT_LOGV(XBT_LOG_ROOT_CAT)) {
+    category->threshold = xbt_log_priority_info;
+    /* xbt_log_priority_debug */ ;
     category->appender = xbt_log_default_appender;
     category->layout = xbt_log_default_layout;
   } else {
@@ -736,20 +751,24 @@ int _xbt_log_cat_init(xbt_log_category_t category,
 
     if (_XBT_LOGV(log).threshold <= xbt_log_priority_debug
         && _XBT_LOGV(log).threshold != xbt_log_priority_uninitialized) {
-      _log_ev.lineNum = __LINE__ ;
-      _xbt_log_event_log(&_log_ev, "Set %s (%s) as father of %s ", category->parent->name,
-                         (category->parent->threshold == xbt_log_priority_uninitialized ? "uninited":xbt_log_priority_names[category->parent->threshold]),
+      _log_ev.lineNum = __LINE__;
+      _xbt_log_event_log(&_log_ev, "Set %s (%s) as father of %s ",
+                         category->parent->name,
+                         (category->parent->threshold ==
+                          xbt_log_priority_uninitialized ? "uninited" :
+                          xbt_log_priority_names[category->
+                                                 parent->threshold]),
                          category->name);
     }
     xbt_log_parent_set(category, category->parent);
 
     if (_XBT_LOGV(log).threshold < xbt_log_priority_info
         && _XBT_LOGV(log).threshold != xbt_log_priority_uninitialized) {
-      char *buf,*res=NULL;
+      char *buf, *res = NULL;
       xbt_log_category_t cpp = category->parent->firstChild;
       while (cpp) {
         if (res) {
-          buf = bprintf("%s %s",res,cpp->name);
+          buf = bprintf("%s %s", res, cpp->name);
           free(res);
           res = buf;
         } else {
@@ -758,10 +777,12 @@ int _xbt_log_cat_init(xbt_log_category_t category,
         cpp = cpp->nextSibling;
       }
 
-      _log_ev.lineNum = __LINE__ ;
+      _log_ev.lineNum = __LINE__;
       _xbt_log_event_log(&_log_ev,
-                         "Childs of %s: %s; nextSibling: %s", category->parent->name,res,
-                         (category->parent->nextSibling?category->parent->nextSibling->name:"none"));
+                         "Childs of %s: %s; nextSibling: %s",
+                         category->parent->name, res,
+                         (category->parent->nextSibling ? category->
+                          parent->nextSibling->name : "none"));
 
       free(res);
     }
@@ -772,20 +793,21 @@ int _xbt_log_cat_init(xbt_log_category_t category,
   if (!xbt_log_settings)
     return priority >= category->threshold;
 
-  xbt_assert0(category,"NULL category");
+  xbt_assert0(category, "NULL category");
   xbt_assert(category->name);
 
-  xbt_dynar_foreach(xbt_log_settings,cursor,setting) {
-    xbt_assert0(setting,"Damnit, NULL cat in the list");
-    xbt_assert1(setting->catname,"NULL setting(=%p)->catname",(void*)setting);
+  xbt_dynar_foreach(xbt_log_settings, cursor, setting) {
+    xbt_assert0(setting, "Damnit, NULL cat in the list");
+    xbt_assert1(setting->catname, "NULL setting(=%p)->catname",
+                (void *) setting);
 
-    if (!strcmp(setting->catname,category->name)) {
+    if (!strcmp(setting->catname, category->name)) {
 
       found = 1;
 
-      _xbt_log_cat_apply_set(category,setting);
+      _xbt_log_cat_apply_set(category, setting);
 
-      xbt_dynar_cursor_rm(xbt_log_settings,&cursor);
+      xbt_dynar_cursor_rm(xbt_log_settings, &cursor);
     }
   }
 
@@ -793,33 +815,35 @@ int _xbt_log_cat_init(xbt_log_category_t category,
 
     _log_ev.cat = &_XBT_LOGV(log);
     _log_ev.priority = xbt_log_priority_verbose;
-    _log_ev.fileName = __FILE__ ;
-    _log_ev.functionName = _XBT_FUNCTION ;
-    _log_ev.lineNum = __LINE__ ;
+    _log_ev.fileName = __FILE__;
+    _log_ev.functionName = _XBT_FUNCTION;
+    _log_ev.lineNum = __LINE__;
 
     _xbt_log_event_log(&_log_ev,
                        "Category '%s': inherited threshold = %s (=%d)",
                        category->name,
-                       xbt_log_priority_names[category->threshold], category->threshold);
+                       xbt_log_priority_names[category->threshold],
+                       category->threshold);
   }
 
   return priority >= category->threshold;
 }
 
-void xbt_log_parent_set(xbt_log_category_t cat,xbt_log_category_t parent)  {
+void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent)
+{
 
-  xbt_assert0(cat,"NULL category to be given a parent");
-  xbt_assert1(parent,"The parent category of %s is NULL",cat->name);
+  xbt_assert0(cat, "NULL category to be given a parent");
+  xbt_assert1(parent, "The parent category of %s is NULL", cat->name);
 
   /*
    * if the threshold is initialized
    * unlink from current parent
    */
-  if(cat->threshold != xbt_log_priority_uninitialized){
+  if (cat->threshold != xbt_log_priority_uninitialized) {
 
-    xbt_log_category_tcpp = &parent->firstChild;
+    xbt_log_category_t *cpp = &parent->firstChild;
 
-    while(*cpp != cat && *cpp != NULL) {
+    while (*cpp != cat && *cpp != NULL) {
       cpp = &(*cpp)->nextSibling;
     }
 
@@ -832,10 +856,9 @@ void xbt_log_parent_set(xbt_log_category_t cat,xbt_log_category_t parent)  {
 
   parent->firstChild = cat;
 
-  if (parent->threshold == xbt_log_priority_uninitialized){
+  if (parent->threshold == xbt_log_priority_uninitialized) {
 
-    _xbt_log_cat_init(parent,
-                      xbt_log_priority_uninitialized/* ignored*/);
+    _xbt_log_cat_init(parent, xbt_log_priority_uninitialized /* ignored */ );
   }
 
   cat->threshold = parent->threshold;
@@ -844,15 +867,17 @@ void xbt_log_parent_set(xbt_log_category_t cat,xbt_log_category_t parent)  {
 
 }
 
-static void _set_inherited_thresholds(xbt_log_category_t cat) {
+static void _set_inherited_thresholds(xbt_log_category_t cat)
+{
 
   xbt_log_category_t child = cat->firstChild;
 
-  for; child != NULL; child = child->nextSibling) {
+  for (; child != NULL; child = child->nextSibling) {
     if (child->isThreshInherited) {
       if (cat != &_XBT_LOGV(log))
         VERB3("Set category threshold of %s to %s (=%d)",
-              child->name,xbt_log_priority_names[cat->threshold],cat->threshold);
+              child->name, xbt_log_priority_names[cat->threshold],
+              cat->threshold);
       child->threshold = cat->threshold;
       _set_inherited_thresholds(child);
     }
@@ -861,8 +886,9 @@ static void _set_inherited_thresholds(xbt_log_category_t cat) {
 
 }
 
-void xbt_log_threshold_set(xbt_log_category_t   cat,
-                           e_xbt_log_priority_t threshold) {
+void xbt_log_threshold_set(xbt_log_category_t cat,
+                           e_xbt_log_priority_t threshold)
+{
   cat->threshold = threshold;
   cat->isThreshInherited = 0;
 
@@ -870,12 +896,13 @@ void xbt_log_threshold_set(xbt_log_category_t   cat,
 
 }
 
-static xbt_log_setting_t _xbt_log_parse_setting(const char* control_string) {
+static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string)
+{
 
-  xbt_log_setting_t set = xbt_new(s_xbt_log_setting_t,1);
+  xbt_log_setting_t set = xbt_new(s_xbt_log_setting_t, 1);
   const char *name, *dot, *eq;
 
-  set->catname=NULL;
+  set->catname = NULL;
   set->thresh = xbt_log_priority_uninitialized;
   set->fmt = NULL;
   set->additivity = -1;
@@ -883,7 +910,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char* control_string) {
 
   if (!*control_string)
     return set;
-  DEBUG1("Parse log setting '%s'",control_string);
+  DEBUG1("Parse log setting '%s'", control_string);
 
   control_string += strspn(control_string, " ");
   name = control_string;
@@ -894,91 +921,92 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char* control_string) {
   control_string += strcspn(control_string, " ");
 
   xbt_assert1(*dot == '.' && (*eq == '=' || *eq == ':'),
-              "Invalid control string '%s'",control_string);
+              "Invalid control string '%s'", control_string);
 
-  if (!strncmp(dot + 1, "thresh", (size_t)(eq - dot - 1))) {
+  if (!strncmp(dot + 1, "thresh", (size_t) (eq - dot - 1))) {
     int i;
-    char *neweq=xbt_strdup(eq+1);
-    char *p=neweq-1;
+    char *neweq = xbt_strdup(eq + 1);
+    char *p = neweq - 1;
 
     while (*(++p) != '\0') {
       if (*p >= 'a' && *p <= 'z') {
-        *p-='a'-'A';
+        *p -= 'a' - 'A';
       }
     }
 
-    DEBUG1("New priority name = %s",neweq);
-    for (i=0; i<xbt_log_priority_infinite; i++) {
-      if (!strncmp(xbt_log_priority_names[i],neweq,p-eq)) {
-        DEBUG1("This is priority %d",i);
+    DEBUG1("New priority name = %s", neweq);
+    for (i = 0; i < xbt_log_priority_infinite; i++) {
+      if (!strncmp(xbt_log_priority_names[i], neweq, p - eq)) {
+        DEBUG1("This is priority %d", i);
         break;
       }
     }
-    if (i<xbt_log_priority_infinite) {
-      set->thresh= (e_xbt_log_priority_t) i;
+    if (i < xbt_log_priority_infinite) {
+      set->thresh = (e_xbt_log_priority_t) i;
     } else {
-      THROW1(arg_error,0,
-             "Unknown priority name: %s (must be one of: trace,debug,verbose,info,warning,error,critical)",eq+1);
+      THROW1(arg_error, 0,
+             "Unknown priority name: %s (must be one of: trace,debug,verbose,info,warning,error,critical)",
+             eq + 1);
     }
     free(neweq);
-  } else if ( !strncmp(dot + 1, "add", (size_t)(eq - dot - 1)) ||
-      !strncmp(dot + 1, "additivity", (size_t)(eq - dot - 1)) ) {
+  } else if (!strncmp(dot + 1, "add", (size_t) (eq - dot - 1)) ||
+             !strncmp(dot + 1, "additivity", (size_t) (eq - dot - 1))) {
 
-    char *neweq=xbt_strdup(eq+1);
-    char *p=neweq-1;
+    char *neweq = xbt_strdup(eq + 1);
+    char *p = neweq - 1;
 
     while (*(++p) != '\0') {
       if (*p >= 'a' && *p <= 'z') {
-        *p-='a'-'A';
+        *p -= 'a' - 'A';
       }
     }
-    if ( !strcmp(neweq,"ON") ||
-        !strcmp(neweq,"YES") ||
-        !strcmp(neweq,"1") ) {
+    if (!strcmp(neweq, "ON") || !strcmp(neweq, "YES") || !strcmp(neweq, "1")) {
       set->additivity = 1;
     } else {
       set->additivity = 0;
     }
     free(neweq);
-  } else if ( !strncmp(dot + 1, "app", (size_t)(eq - dot - 1)) ||
-      !strncmp(dot + 1, "appender", (size_t)(eq - dot - 1)) ) {
+  } else if (!strncmp(dot + 1, "app", (size_t) (eq - dot - 1)) ||
+             !strncmp(dot + 1, "appender", (size_t) (eq - dot - 1))) {
 
-    char *neweq=xbt_strdup(eq+1);
+    char *neweq = xbt_strdup(eq + 1);
 
-    if ( !strncmp(neweq,"file:",5) ) {
-      set->appender = xbt_log_appender_file_new(neweq+5);
+    if (!strncmp(neweq, "file:", 5)) {
+      set->appender = xbt_log_appender_file_new(neweq + 5);
     } else {
-       THROW1(arg_error,0,"Unknown appender log type: '%s'",neweq);
+      THROW1(arg_error, 0, "Unknown appender log type: '%s'", neweq);
     }
     free(neweq);
-  } else if (!strncmp(dot + 1, "fmt", (size_t)(eq - dot - 1))) {
-    set->fmt = xbt_strdup(eq+1);
+  } else if (!strncmp(dot + 1, "fmt", (size_t) (eq - dot - 1))) {
+    set->fmt = xbt_strdup(eq + 1);
   } else {
     char buff[512];
-    snprintf(buff,min(512,eq - dot),"%s",dot+1);
-    THROW1(arg_error,0,"Unknown setting of the log category: '%s'",buff);
+    snprintf(buff, min(512, eq - dot), "%s", dot + 1);
+    THROW1(arg_error, 0, "Unknown setting of the log category: '%s'", buff);
   }
-  set->catname=(char*)xbt_malloc(dot - name+1);
+  set->catname = (char *) xbt_malloc(dot - name + 1);
 
-  memcpy(set->catname,name,dot-name);
-  set->catname[dot-name]='\0'; /* Just in case */
+  memcpy(set->catname, name, dot - name);
+  set->catname[dot - name] = '\0';      /* Just in case */
   DEBUG1("This is for cat '%s'", set->catname);
 
   return set;
 }
 
-static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,char *name) {
-  xbt_log_category_t child,res;
+static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,
+                                                 char *name)
+{
+  xbt_log_category_t child, res;
 
-  DEBUG4("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')",name,cat->name,
-         (cat->firstChild  ? cat->firstChild->name :"none"),
-         (cat->nextSibling ? cat->nextSibling->name:"none"));
-  if (!strcmp(cat->name,name))
+  DEBUG4("Search '%s' into '%s' (firstChild='%s'; nextSibling='%s')", name,
+         cat->name, (cat->firstChild ? cat->firstChild->name : "none"),
+         (cat->nextSibling ? cat->nextSibling->name : "none"));
+  if (!strcmp(cat->name, name))
     return cat;
 
-  for (child=cat->firstChild ; child != NULL; child = child->nextSibling) {
-    DEBUG1("Dig into %s",child->name);
-    res = _xbt_log_cat_searchsub(child,name);
+  for (child = cat->firstChild; child != NULL; child = child->nextSibling) {
+    DEBUG1("Dig into %s", child->name);
+    res = _xbt_log_cat_searchsub(child, name);
     if (res)
       return res;
   }
@@ -1009,7 +1037,8 @@ static xbt_log_category_t _xbt_log_cat_searchsub(xbt_log_category_t cat,char *na
  *      information.
  *
  */
-void xbt_log_control_set(const char* control_string) {
+void xbt_log_control_set(const char *control_string)
+{
   xbt_log_setting_t set;
 
   /* To split the string in commands, and the cursors */
@@ -1019,7 +1048,7 @@ void xbt_log_control_set(const char* control_string) {
 
   if (!control_string)
     return;
-  DEBUG1("Parse log settings '%s'",control_string);
+  DEBUG1("Parse log settings '%s'", control_string);
 
   /* some initialization if this is the first time that this get called */
   if (xbt_log_settings == NULL)
@@ -1027,36 +1056,37 @@ void xbt_log_control_set(const char* control_string) {
                                      _free_setting);
 
   /* split the string, and remove empty entries */
-  set_strings=xbt_str_split_quoted(control_string);
+  set_strings = xbt_str_split_quoted(control_string);
 
-  if (xbt_dynar_length(set_strings) == 0) { /* vicious user! */
+  if (xbt_dynar_length(set_strings) == 0) {     /* vicious user! */
     xbt_dynar_free(&set_strings);
     return;
   }
 
   /* Parse each entry and either use it right now (if the category was already
      created), or store it for further use */
-  xbt_dynar_foreach(set_strings,cpt,str) {
-    xbt_log_category_t cat=NULL;
+  xbt_dynar_foreach(set_strings, cpt, str) {
+    xbt_log_category_t cat = NULL;
 
     set = _xbt_log_parse_setting(str);
-    cat = _xbt_log_cat_searchsub(&_XBT_LOGV(XBT_LOG_ROOT_CAT),set->catname);
+    cat = _xbt_log_cat_searchsub(&_XBT_LOGV(XBT_LOG_ROOT_CAT), set->catname);
 
     if (cat) {
       DEBUG0("Apply directly");
-      _xbt_log_cat_apply_set(cat,set);
-      _free_setting((void*)&set);
+      _xbt_log_cat_apply_set(cat, set);
+      _free_setting((void *) &set);
     } else {
 
       DEBUG0("Store for further application");
-      DEBUG1("push %p to the settings",(void*)set);
-      xbt_dynar_push(xbt_log_settings,&set);
+      DEBUG1("push %p to the settings", (void *) set);
+      xbt_dynar_push(xbt_log_settings, &set);
     }
   }
   xbt_dynar_free(&set_strings);
 }
 
-void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app) {
+void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app)
+{
   if (cat->appender) {
     if (cat->appender->free_)
       cat->appender->free_(cat->appender);
@@ -1064,11 +1094,13 @@ void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app) {
   }
   cat->appender = app;
 }
-void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay) {
+
+void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay)
+{
   if (!cat->appender) {
     VERB1("No appender to category %s. Setting the file appender as default",
           cat->name);
-    xbt_log_appender_set(cat,xbt_log_appender_file_new(NULL));
+    xbt_log_appender_set(cat, xbt_log_appender_file_new(NULL));
   }
   if (cat->layout && cat != &_XBT_LOGV(root)) {
     /* better leak the default layout than check every categories to
@@ -1079,10 +1111,10 @@ void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay) {
     }
   }
   cat->layout = lay;
-  xbt_log_additivity_set(cat,0);
+  xbt_log_additivity_set(cat, 0);
 }
 
-void xbt_log_additivity_set(xbt_log_category_t cat, int additivity) {
+void xbt_log_additivity_set(xbt_log_category_t cat, int additivity)
+{
   cat->additivity = additivity;
 }
-
index 17341d3..1680b59 100644 (file)
 
 #include "xbt/log.h"
 struct xbt_log_appender_s {
-  void (*do_append) (xbt_log_appender_t this_appender,
-      char *event);
+  void (*do_append) (xbt_log_appender_t this_appender, char *event);
   void (*free_) (xbt_log_appender_t this_);
   void *data;
 };
 
 struct xbt_log_layout_s {
-  void (*do_layout)(xbt_log_layout_t l,
-      xbt_log_event_t event, const char *fmt,
-      xbt_log_appender_t appender);
+  void (*do_layout) (xbt_log_layout_t l,
+                     xbt_log_event_t event, const char *fmt,
+                     xbt_log_appender_t appender);
   void (*free_) (xbt_log_layout_t l);
   void *data;
-} ;
+};
 
 
 /**
index 62c34ee..460dda8 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt/sysdep.h"
 #include "mallocator_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator,xbt,"Mallocators");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
 
 /**
  * \brief Constructor
@@ -32,20 +32,22 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator,xbt,"Mallocators");
 xbt_mallocator_t xbt_mallocator_new(int size,
                                     pvoid_f_void_t new_f,
                                     void_f_pvoid_t free_f,
-                                    void_f_pvoid_t reset_f) {
+                                    void_f_pvoid_t reset_f)
+{
 
 
   xbt_mallocator_t m;
 
   xbt_assert0(size > 0, "size must be positive");
-  xbt_assert0(new_f != NULL && free_f != NULL && reset_f != NULL,"invalid parameter");
+  xbt_assert0(new_f != NULL && free_f != NULL
+              && reset_f != NULL, "invalid parameter");
 
   m = xbt_new0(s_xbt_mallocator_t, 1);
-  VERB1("Create mallocator %p",m);
-  if (XBT_LOG_ISENABLED(xbt_mallocator,xbt_log_priority_verbose))
+  VERB1("Create mallocator %p", m);
+  if (XBT_LOG_ISENABLED(xbt_mallocator, xbt_log_priority_verbose))
     xbt_backtrace_display_current();
 
-  m->objects = xbt_new0(void*, size);
+  m->objects = xbt_new0(void *, size);
   m->max_size = size;
   m->current_size = 0;
   m->new_f = new_f;
@@ -63,14 +65,15 @@ xbt_mallocator_t xbt_mallocator_new(int size,
  *
  * \see xbt_mallocator_new()
  */
-void xbt_mallocator_free(xbt_mallocator_t m) {
+void xbt_mallocator_free(xbt_mallocator_t m)
+{
 
   int i;
   xbt_assert0(m != NULL, "Invalid parameter");
 
-  VERB3("Frees mallocator %p (size:%d/%d)",m,m->current_size,m->max_size);
+  VERB3("Frees mallocator %p (size:%d/%d)", m, m->current_size, m->max_size);
   for (i = 0; i < m->current_size; i++) {
-    (*(m->free_f))(m->objects[i]);
+    (*(m->free_f)) (m->objects[i]);
   }
   xbt_free(m->objects);
   xbt_free(m);
@@ -92,21 +95,23 @@ void xbt_mallocator_free(xbt_mallocator_t m) {
  *
  * \see xbt_mallocator_release()
  */
-void *xbt_mallocator_get(xbt_mallocator_t m) {
+void *xbt_mallocator_get(xbt_mallocator_t m)
+{
   void *object;
   xbt_assert0(m != NULL, "Invalid parameter");
 
   if (m->current_size > 0) {
     /* there is at least an available object */
-    DEBUG3("Reuse an old object for mallocator %p (size:%d/%d)",m,m->current_size,m->max_size);
+    DEBUG3("Reuse an old object for mallocator %p (size:%d/%d)", m,
+           m->current_size, m->max_size);
     object = m->objects[--m->current_size];
-  }
-  else {
+  } else {
     /* otherwise we must allocate a new object */
-    DEBUG3("Create a new object for mallocator %p (size:%d/%d)",m,m->current_size,m->max_size);
-    object = (*(m->new_f))();
+    DEBUG3("Create a new object for mallocator %p (size:%d/%d)", m,
+           m->current_size, m->max_size);
+    object = (*(m->new_f)) ();
   }
-  (*(m->reset_f))(object);
+  (*(m->reset_f)) (object);
   return object;
 }
 
@@ -123,17 +128,20 @@ void *xbt_mallocator_get(xbt_mallocator_t m) {
  *
  * \see xbt_mallocator_get()
  */
-void xbt_mallocator_release(xbt_mallocator_t m, void *object) {
+void xbt_mallocator_release(xbt_mallocator_t m, void *object)
+{
   xbt_assert0(m != NULL && object != NULL, "Invalid parameter");
 
   if (m->current_size < m->max_size) {
     /* there is enough place to push the object */
-    DEBUG3("Store deleted object in mallocator %p for further use (size:%d/%d)",m,m->current_size,m->max_size);
+    DEBUG3
+      ("Store deleted object in mallocator %p for further use (size:%d/%d)",
+       m, m->current_size, m->max_size);
     m->objects[m->current_size++] = object;
-  }
-  else {
+  } else {
     /* otherwise we don't have a choice, we must free the object */
-    DEBUG3("Free deleted object: mallocator %p is full (size:%d/%d)",m,m->current_size,m->max_size);
-    (*(m->free_f))(object);
+    DEBUG3("Free deleted object: mallocator %p is full (size:%d/%d)", m,
+           m->current_size, m->max_size);
+    (*(m->free_f)) (object);
   }
 }
index 42a6d94..952564c 100644 (file)
@@ -9,12 +9,12 @@
 #define _XBT_MALLOCATOR_PRIVATE_H__
 
 typedef struct s_xbt_mallocator {
-  int current_size;       /* number of objects currently stored */
-  void **objects;         /* objects stored by the mallocator and available for the user */
-  int max_size;           /* maximum number of objects */
-  pvoid_f_void_t new_f;   /* function to call when we are running out of objects */
-  void_f_pvoid_t free_f;  /* function to call when we have got too many objects */
-  void_f_pvoid_t reset_f; /* function to call when an object is released by the user */
+  int current_size;             /* number of objects currently stored */
+  void **objects;               /* objects stored by the mallocator and available for the user */
+  int max_size;                 /* maximum number of objects */
+  pvoid_f_void_t new_f;         /* function to call when we are running out of objects */
+  void_f_pvoid_t free_f;        /* function to call when we have got too many objects */
+  void_f_pvoid_t reset_f;       /* function to call when an object is released by the user */
 } s_xbt_mallocator_t;
 
 #endif /* _XBT_MALLOCATOR_PRIVATE_H__ */
index dc96161..0e56152 100644 (file)
 
 #include "xbt/set.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_set,xbt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_set, xbt,
                                 "set: data container consisting in dict+dynar");
 
 /*####[ Type definition ]####################################################*/
 typedef struct xbt_set_ {
-  xbt_dict_t  dict;  /* data stored by name */
-  xbt_dynar_t dynar; /* data stored by ID   */
-  xbt_dynar_t available_ids; /* free places in the dynar */
+  xbt_dict_t dict;              /* data stored by name */
+  xbt_dynar_t dynar;            /* data stored by ID   */
+  xbt_dynar_t available_ids;    /* free places in the dynar */
 } s_xbt_set_t;
 
 /*####[ Memory  ]############################################################*/
@@ -31,35 +31,37 @@ typedef struct xbt_set_ {
 static int _xbt_set_get_id(xbt_set_t set);
 
 /** @brief Constructor */
-xbt_set_t xbt_set_new(void) {
+xbt_set_t xbt_set_new(void)
+{
   xbt_set_t res = xbt_new(s_xbt_set_t, 1);
 
   res->dict = xbt_dict_new();
-  res->dynar = xbt_dynar_new(sizeof(void*), NULL);
+  res->dynar = xbt_dynar_new(sizeof(void *), NULL);
   res->available_ids = xbt_dynar_new(sizeof(int), NULL);
 
   return res;
 }
 
 /** @brief Destructor */
-void  xbt_set_free(xbt_set_t *set) {
+void xbt_set_free(xbt_set_t * set)
+{
   if (*set) {
-    xbt_dict_free ( &( (*set)->dict  ) );
-    xbt_dynar_free( &( (*set)->dynar ) );
-    xbt_dynar_free( &( (*set)->available_ids ) );
+    xbt_dict_free(&((*set)->dict));
+    xbt_dynar_free(&((*set)->dynar));
+    xbt_dynar_free(&((*set)->available_ids));
     free(*set);
     *set = NULL;
   }
 }
 
 /* Compute an ID in order to add an element into the set. */
-static int _xbt_set_get_id(xbt_set_t set) {
+static int _xbt_set_get_id(xbt_set_t set)
+{
   int id;
   if (xbt_dynar_length(set->available_ids) > 0) {
     /* if there are some available ids */
     xbt_dynar_pop(set->available_ids, &id);
-  }
-  else {
+  } else {
     /* otherwise we will add the element at the dynar end */
     id = xbt_dynar_length(set->dynar);
   }
@@ -76,24 +78,23 @@ static int _xbt_set_get_id(xbt_set_t set) {
  * if elm->name_len <= 0, it is recomputed. If >0, it's used as is;
  * elm->ID is attributed automatically.
  */
-void xbt_set_add    (xbt_set_t      set,
-                     xbt_set_elm_t  elm,
-                     void_f_pvoid_t free_func) {
+void xbt_set_add(xbt_set_t set, xbt_set_elm_t elm, void_f_pvoid_t free_func)
+{
 
   int found = 1;
   xbt_set_elm_t found_in_dict = NULL;
   xbt_ex_t e;
 
-  VERB1("add %s to the set",elm->name);
+  VERB1("add %s to the set", elm->name);
 
   if (elm->name_len <= 0) {
     elm->name_len = strlen(elm->name);
   }
 
   TRY {
-    found_in_dict = xbt_dict_get_ext (set->dict,
-                                      elm->name, elm->name_len);
-  CATCH(e) {
+    found_in_dict = xbt_dict_get_ext(set->dict, elm->name, elm->name_len);
+  }
+  CATCH(e) {
     if (e.category != not_found_error)
       RETHROW;
     found = 0;
@@ -106,11 +107,12 @@ void xbt_set_add    (xbt_set_t      set,
 
   if (found) {
     if (elm == found_in_dict) {
-      DEBUG2("Ignoring request to insert the same element twice (key %s ; id %d)",
-             elm->name, elm->ID);
+      DEBUG2
+        ("Ignoring request to insert the same element twice (key %s ; id %d)",
+         elm->name, elm->ID);
       return;
     } else {
-      elm->ID=found_in_dict->ID;
+      elm->ID = found_in_dict->ID;
       DEBUG2("Reinsertion of key %s (id %d)", elm->name, elm->ID);
       xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
       xbt_dynar_set(set->dynar, elm->ID, &elm);
@@ -124,9 +126,10 @@ void xbt_set_add    (xbt_set_t      set,
  * \param set a set
  * \param elm element to remove
  */
-void xbt_set_remove (xbt_set_t set, xbt_set_elm_t elm) {
+void xbt_set_remove(xbt_set_t set, xbt_set_elm_t elm)
+{
   int id = elm->ID;
-  xbt_dynar_push_as(set->available_ids, int, id); /* this id becomes available now */
+  xbt_dynar_push_as(set->available_ids, int, id);       /* this id becomes available now */
   xbt_dict_remove_ext(set->dict, elm->name, elm->name_len);
   elm = NULL;
   xbt_dynar_set(set->dynar, id, &elm);
@@ -137,7 +140,8 @@ void xbt_set_remove (xbt_set_t set, xbt_set_elm_t elm) {
  * \param set a set
  * \param key name of the element to remove
  */
-void xbt_set_remove_by_name (xbt_set_t set, const char *key) {
+void xbt_set_remove_by_name(xbt_set_t set, const char *key)
+{
   xbt_set_elm_t elm = xbt_set_get_by_name(set, key);
   xbt_set_remove(set, elm);
 }
@@ -149,7 +153,8 @@ void xbt_set_remove_by_name (xbt_set_t set, const char *key) {
  * \param key name of the element to remove
  * \param key_len length of \a name
  */
-void xbt_set_remove_by_name_ext (xbt_set_t set, const char *key, int key_len) {
+void xbt_set_remove_by_name_ext(xbt_set_t set, const char *key, int key_len)
+{
   xbt_set_elm_t elm = xbt_set_get_by_name_ext(set, key, key_len);
   xbt_set_remove(set, elm);
 }
@@ -159,7 +164,8 @@ void xbt_set_remove_by_name_ext (xbt_set_t set, const char *key, int key_len) {
  * \param set a set
  * \param id id of the element to remove
  */
-void xbt_set_remove_by_id (xbt_set_t set, int id) {
+void xbt_set_remove_by_id(xbt_set_t set, int id)
+{
   xbt_set_elm_t elm = xbt_set_get_by_id(set, id);
   xbt_set_remove(set, elm);
 }
@@ -170,9 +176,9 @@ void xbt_set_remove_by_id (xbt_set_t set, int id) {
  * \param name Name of the searched cell
  * \returns the data you're looking for
  */
-xbt_set_elm_t xbt_set_get_by_name    (xbt_set_t     set,
-                                      const char     *name) {
-  DEBUG1("Lookup key %s",name);
+xbt_set_elm_t xbt_set_get_by_name(xbt_set_t set, const char *name)
+{
+  DEBUG1("Lookup key %s", name);
   return xbt_dict_get(set->dict, name);
 }
 
@@ -186,11 +192,11 @@ xbt_set_elm_t xbt_set_get_by_name    (xbt_set_t     set,
  * This is useful when strlen cannot be trusted because you don't use a char*
  * as name, you weirdo.
  */
-xbt_set_elm_t xbt_set_get_by_name_ext(xbt_set_t      set,
-                                      const char     *name,
-                                      int             name_len) {
+xbt_set_elm_t xbt_set_get_by_name_ext(xbt_set_t set,
+                                      const char *name, int name_len)
+{
 
-  return xbt_dict_get_ext (set->dict, name, name_len);
+  return xbt_dict_get_ext(set->dict, name, name_len);
 }
 
 /** @brief Retrieve data by providing its ID
@@ -201,12 +207,13 @@ xbt_set_elm_t xbt_set_get_by_name_ext(xbt_set_t      set,
  *
  * @warning, if the ID does not exists, you're getting into trouble
  */
-xbt_set_elm_t xbt_set_get_by_id (xbt_set_t set, int id) {
+xbt_set_elm_t xbt_set_get_by_id(xbt_set_t set, int id)
+{
   xbt_set_elm_t res;
 
   /* Don't bother checking the bounds, the dynar does so */
 
-  res = xbt_dynar_get_as(set->dynar,id, xbt_set_elm_t);
+  res = xbt_dynar_get_as(set->dynar, id, xbt_set_elm_t);
   if (res == NULL) {
     THROW1(not_found_error, 0, "Invalid id: %d", id);
   }
@@ -221,7 +228,8 @@ xbt_set_elm_t xbt_set_get_by_id (xbt_set_t set, int id) {
  * \param set a set
  * \return the number of elements in the set
  */
-unsigned long xbt_set_length (const xbt_set_t set) {
+unsigned long xbt_set_length(const xbt_set_t set)
+{
   return xbt_dynar_length(set->dynar);
 }
 
@@ -234,16 +242,15 @@ typedef struct xbt_set_cursor_ {
 } s_xbt_set_cursor_t;
 
 /** @brief Create the cursor if it does not exists, rewind it in any case. */
-void         xbt_set_cursor_first       (xbt_set_t         set,
-                                         xbt_set_cursor_t *cursor) {
+void xbt_set_cursor_first(xbt_set_t set, xbt_set_cursor_t * cursor)
+{
   xbt_dynar_t dynar;
 
   if (set != NULL) {
     if (!*cursor) {
       DEBUG0("Create the cursor on first use");
-      *cursor = xbt_new(s_xbt_set_cursor_t,1);
-      xbt_assert0(*cursor,
-                  "Malloc error during the creation of the cursor");
+      *cursor = xbt_new(s_xbt_set_cursor_t, 1);
+      xbt_assert0(*cursor, "Malloc error during the creation of the cursor");
     }
     (*cursor)->set = set;
 
@@ -260,31 +267,32 @@ void         xbt_set_cursor_first       (xbt_set_t         set,
 }
 
 /** @brief Move to the next element.  */
-void         xbt_set_cursor_step        (xbt_set_cursor_t cursor) {
+void xbt_set_cursor_step(xbt_set_cursor_t cursor)
+{
   xbt_dynar_t dynar = cursor->set->dynar;
   do {
     cursor->val++;
   }
   while (cursor->val < xbt_dynar_length(dynar) &&
-      xbt_dynar_get_ptr(dynar, cursor->val) == NULL);
+         xbt_dynar_get_ptr(dynar, cursor->val) == NULL);
 }
 
 /** @brief Get current data
  *
  * \return true if it's ok, false if there is no more data
  */
-int          xbt_set_cursor_get_or_free (xbt_set_cursor_t *curs,
-                                         xbt_set_elm_t    *elm) {
+int xbt_set_cursor_get_or_free(xbt_set_cursor_t * curs, xbt_set_elm_t * elm)
+{
   xbt_set_cursor_t cursor;
 
   if (!curs || !(*curs))
     return FALSE;
 
-  cursor=*curs;
+  cursor = *curs;
 
   if (cursor->val >= xbt_dynar_length(cursor->set->dynar)) {
     free(cursor);
-    *curs=NULL;
+    *curs = NULL;
     return FALSE;
   }
 
@@ -296,21 +304,22 @@ int          xbt_set_cursor_get_or_free (xbt_set_cursor_t *curs,
 #include "xbt.h"
 #include "xbt/ex.h"
 
-XBT_TEST_SUITE("set","Set data container");
+XBT_TEST_SUITE("set", "Set data container");
 
-typedef struct  {
+typedef struct {
   /* headers */
   unsigned int ID;
-  char        *name;
+  char *name;
   unsigned int name_len;
 
   /* payload */
-  char         *data;
-} s_my_elem_t,*my_elem_t;
+  char *data;
+} s_my_elem_t, *my_elem_t;
 
 
-static void my_elem_free(void *e) {
-  my_elem_t elm=(my_elem_t)e;
+static void my_elem_free(void *e)
+{
+  my_elem_t elm = (my_elem_t) e;
 
   if (elm) {
     free(elm->name);
@@ -319,93 +328,94 @@ static void my_elem_free(void *e) {
   }
 }
 
-static void debuged_add(xbt_set_t  set,
-                        const char *name,
-                        const char *data) {
-  my_elem_t    elm;
+static void debuged_add(xbt_set_t set, const char *name, const char *data)
+{
+  my_elem_t elm;
 
-  elm = xbt_new(s_my_elem_t,1);
-  elm->name=xbt_strdup(name);
-  elm->name_len=0;
+  elm = xbt_new(s_my_elem_t, 1);
+  elm->name = xbt_strdup(name);
+  elm->name_len = 0;
 
-  elm->data=xbt_strdup(data);
+  elm->data = xbt_strdup(data);
 
-  xbt_test_log2("Add %s (->%s)",name,data);
-  xbt_set_add(set, (xbt_set_elm_t)elm, &my_elem_free);
+  xbt_test_log2("Add %s (->%s)", name, data);
+  xbt_set_add(set, (xbt_set_elm_t) elm, &my_elem_free);
 }
 
-static void fill(xbt_set_t *set) {
+static void fill(xbt_set_t * set)
+{
   xbt_test_add0("Fill in the data set");
 
-  *set=xbt_set_new();
-  debuged_add(*set,"12",     "12");
-  debuged_add(*set,"12a",    "12a");
-  debuged_add(*set,"12b",    "12b");
-  debuged_add(*set,"123",    "123");
-  debuged_add(*set,"123456", "123456");
+  *set = xbt_set_new();
+  debuged_add(*set, "12", "12");
+  debuged_add(*set, "12a", "12a");
+  debuged_add(*set, "12b", "12b");
+  debuged_add(*set, "123", "123");
+  debuged_add(*set, "123456", "123456");
   xbt_test_log0("Child becomes child of what to add");
-  debuged_add(*set,"1234",   "1234");
+  debuged_add(*set, "1234", "1234");
   xbt_test_log0("Need of common ancestor");
-  debuged_add(*set,"123457", "123457");
+  debuged_add(*set, "123457", "123457");
 }
 
-static void search_name(xbt_set_t head,const char*key) {
+static void search_name(xbt_set_t head, const char *key)
+{
   my_elem_t elm;
 
-  xbt_test_add1("Search by name %s",key);
-  elm = (my_elem_t)xbt_set_get_by_name(head,key);
+  xbt_test_add1("Search by name %s", key);
+  elm = (my_elem_t) xbt_set_get_by_name(head, key);
   xbt_test_log2(" Found %s (under ID %d)\n",
-                elm? elm->data:"(null)",
-                   elm? elm->ID:-1);
-  if (strcmp(key,elm->name))
-    THROW2(mismatch_error,0,"The key (%s) is not the one expected (%s)",
-           key,elm->name);
-  if (strcmp(elm->name,elm->data))
-    THROW2(mismatch_error,0,"The name (%s) != data (%s)",
-           key,elm->name);
+                elm ? elm->data : "(null)", elm ? elm->ID : -1);
+  if (strcmp(key, elm->name))
+    THROW2(mismatch_error, 0, "The key (%s) is not the one expected (%s)",
+           key, elm->name);
+  if (strcmp(elm->name, elm->data))
+    THROW2(mismatch_error, 0, "The name (%s) != data (%s)", key, elm->name);
   fflush(stdout);
 }
 
-static void search_id(xbt_set_t head,int id,const char*key) {
+static void search_id(xbt_set_t head, int id, const char *key)
+{
   my_elem_t elm;
 
-  xbt_test_add1("Search by id %d",id);
-  elm = (my_elem_t) xbt_set_get_by_id(head,id);
+  xbt_test_add1("Search by id %d", id);
+  elm = (my_elem_t) xbt_set_get_by_id(head, id);
   xbt_test_log2("Found %s (data %s)",
-                elm? elm->name:"(null)",
-                   elm? elm->data:"(null)");
+                elm ? elm->name : "(null)", elm ? elm->data : "(null)");
   if (id != elm->ID)
-    THROW2(mismatch_error,0,"The found ID (%d) is not the one expected (%d)",
-           elm->ID,id);
-  if (strcmp(key,elm->name))
-    THROW2(mismatch_error,0,"The key (%s) is not the one expected (%s)",
-           elm->name,key);
-  if (strcmp(elm->name,elm->data))
-    THROW2(mismatch_error,0,"The name (%s) != data (%s)",
-           elm->name,elm->data);
+    THROW2(mismatch_error, 0,
+           "The found ID (%d) is not the one expected (%d)", elm->ID, id);
+  if (strcmp(key, elm->name))
+    THROW2(mismatch_error, 0, "The key (%s) is not the one expected (%s)",
+           elm->name, key);
+  if (strcmp(elm->name, elm->data))
+    THROW2(mismatch_error, 0, "The name (%s) != data (%s)",
+           elm->name, elm->data);
 }
 
 
-static void traverse(xbt_set_t set) {
-  xbt_set_cursor_t cursor=NULL;
-  my_elem_t         elm=NULL;
+static void traverse(xbt_set_t set)
+{
+  xbt_set_cursor_t cursor = NULL;
+  my_elem_t elm = NULL;
 
-  xbt_set_foreach(set,cursor,elm) {
-    xbt_test_assert0(elm,"Dude ! Got a null elm during traversal!");
-    xbt_test_log3("Id(%d):  %s->%s\n",elm->ID,elm->name,elm->data);
-    xbt_test_assert2(!strcmp(elm->name,elm->data),
-                     "Key(%s) != value(%s). Abording",
-                     elm->name,elm->data);
+  xbt_set_foreach(set, cursor, elm) {
+    xbt_test_assert0(elm, "Dude ! Got a null elm during traversal!");
+    xbt_test_log3("Id(%d):  %s->%s\n", elm->ID, elm->name, elm->data);
+    xbt_test_assert2(!strcmp(elm->name, elm->data),
+                     "Key(%s) != value(%s). Abording", elm->name, elm->data);
   }
 }
 
-static void search_not_found(xbt_set_t set, const char *data) {
+static void search_not_found(xbt_set_t set, const char *data)
+{
   xbt_ex_t e;
 
-  xbt_test_add1("Search %s (expected not to be found)",data);
+  xbt_test_add1("Search %s (expected not to be found)", data);
   TRY {
-    xbt_set_get_by_name(set,data);
-    THROW1(unknown_error,0,"Found something which shouldn't be there (%s)",data);
+    xbt_set_get_by_name(set, data);
+    THROW1(unknown_error, 0, "Found something which shouldn't be there (%s)",
+           data);
   } CATCH(e) {
     if (e.category != not_found_error)
       xbt_test_exception(e);
@@ -416,8 +426,9 @@ static void search_not_found(xbt_set_t set, const char *data) {
 xbt_set_t set = NULL;
 
 
-XBT_TEST_UNIT("basic",test_set_basic,"Basic usage") {
-  set=NULL;
+XBT_TEST_UNIT("basic", test_set_basic, "Basic usage")
+{
+  set = NULL;
 
   xbt_test_add0("Traverse the empty set");
   traverse(set);
@@ -431,53 +442,55 @@ XBT_TEST_UNIT("basic",test_set_basic,"Basic usage") {
 
 }
 
-XBT_TEST_UNIT("change",test_set_change,"Changing some values") {
+XBT_TEST_UNIT("change", test_set_change, "Changing some values")
+{
   fill(&set);
 
   xbt_test_add0("Change 123 to 'Changed 123'");
-  debuged_add(set,"123","Changed 123");
+  debuged_add(set, "123", "Changed 123");
 
   xbt_test_add0("Change 123 back to '123'");
-  debuged_add(set,"123","123");
+  debuged_add(set, "123", "123");
 
   xbt_test_add0("Change 12a to 'Dummy 12a'");
-  debuged_add(set,"12a","Dummy 12a");
+  debuged_add(set, "12a", "Dummy 12a");
 
   xbt_test_add0("Change 12a to '12a'");
-  debuged_add(set,"12a","12a");
+  debuged_add(set, "12a", "12a");
 
   /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
   xbt_test_add0("Traverse the resulting data set");
   traverse(set);
 }
 
-XBT_TEST_UNIT("retrieve",test_set_retrieve,"Retrieving some values") {
+XBT_TEST_UNIT("retrieve", test_set_retrieve, "Retrieving some values")
+{
   my_elem_t elm;
 
   xbt_test_add0("Search 123");
-  elm = (my_elem_t) xbt_set_get_by_name(set,"123");
-  xbt_test_assert0(elm,"elm must be there");
-  xbt_assert(!strcmp("123",elm->data));
-
-  search_not_found(set,"Can't be found");
-  search_not_found(set,"123 Can't be found");
-  search_not_found(set,"12345678 NOT");
-
-  search_name(set,"12");
-  search_name(set,"12a");
-  search_name(set,"12b");
-  search_name(set,"123");
-  search_name(set,"123456");
-  search_name(set,"1234");
-  search_name(set,"123457");
-
-  search_id(set,0,"12");
-  search_id(set,1,"12a");
-  search_id(set,2,"12b");
-  search_id(set,3,"123");
-  search_id(set,4,"123456");
-  search_id(set,5,"1234");
-  search_id(set,6,"123457");
+  elm = (my_elem_t) xbt_set_get_by_name(set, "123");
+  xbt_test_assert0(elm, "elm must be there");
+  xbt_assert(!strcmp("123", elm->data));
+
+  search_not_found(set, "Can't be found");
+  search_not_found(set, "123 Can't be found");
+  search_not_found(set, "12345678 NOT");
+
+  search_name(set, "12");
+  search_name(set, "12a");
+  search_name(set, "12b");
+  search_name(set, "123");
+  search_name(set, "123456");
+  search_name(set, "1234");
+  search_name(set, "123457");
+
+  search_id(set, 0, "12");
+  search_id(set, 1, "12a");
+  search_id(set, 2, "12b");
+  search_id(set, 3, "123");
+  search_id(set, 4, "123456");
+  search_id(set, 5, "1234");
+  search_id(set, 6, "123457");
 
   xbt_test_add0("Traverse the resulting data set");
   traverse(set);
@@ -492,7 +505,8 @@ XBT_TEST_UNIT("retrieve",test_set_retrieve,"Retrieving some values") {
   traverse(set);
 }
 
-XBT_TEST_UNIT("remove",test_set_remove,"Removing some values") {
+XBT_TEST_UNIT("remove", test_set_remove, "Removing some values")
+{
   my_elem_t elm;
 
   xbt_set_free(&set);
@@ -501,19 +515,19 @@ XBT_TEST_UNIT("remove",test_set_remove,"Removing some values") {
   xbt_set_remove_by_name(set, "12a");
   search_not_found(set, "12a");
 
-  search_name(set,"12");
-  search_name(set,"12b");
-  search_name(set,"123");
-  search_name(set,"123456");
-  search_name(set,"1234");
-  search_name(set,"123457");
-
-  search_id(set,0,"12");
-  search_id(set,2,"12b");
-  search_id(set,3,"123");
-  search_id(set,4,"123456");
-  search_id(set,5,"1234");
-  search_id(set,6,"123457");
+  search_name(set, "12");
+  search_name(set, "12b");
+  search_name(set, "123");
+  search_name(set, "123456");
+  search_name(set, "1234");
+  search_name(set, "123457");
+
+  search_id(set, 0, "12");
+  search_id(set, 2, "12b");
+  search_id(set, 3, "123");
+  search_id(set, 4, "123456");
+  search_id(set, 5, "1234");
+  search_id(set, 6, "123457");
 
   debuged_add(set, "12anew", "12anew");
   elm = (my_elem_t) xbt_set_get_by_id(set, 1);
index 31cd4a0..5fbb410 100644 (file)
 #define LINUX_COMPATIBLE
 #endif
 
-#include "portable.h" /* to get a working stdarg.h */
+#include "portable.h"           /* to get a working stdarg.h */
 
 #include <sys/types.h>
 #include <string.h>
  * Small values favor memcpy, large values favor inline code.
  */
 #if defined(__alpha__) || defined(__alpha)
-#  define breakeven_point   2  /* AXP (DEC Alpha)     - gcc or cc or egcs */
+#  define breakeven_point   2   /* AXP (DEC Alpha)     - gcc or cc or egcs */
 #endif
 #if defined(__i386__)  || defined(__i386)
-#  define breakeven_point  12  /* Intel Pentium/Linux - gcc 2.96 */
+#  define breakeven_point  12   /* Intel Pentium/Linux - gcc 2.96 */
 #endif
 #if defined(__hppa)
-#  define breakeven_point  10  /* HP-PA               - gcc */
+#  define breakeven_point  10   /* HP-PA               - gcc */
 #endif
 #if defined(__sparc__) || defined(__sparc)
-#  define breakeven_point  33  /* Sun Sparc 5         - gcc 2.8.1 */
+#  define breakeven_point  33   /* Sun Sparc 5         - gcc 2.8.1 */
 #endif
 
 /* some other values of possible interest: */
-/* #define breakeven_point  8 */  /* VAX 4000          - vaxc */
-/* #define breakeven_point 19 */  /* VAX 4000          - gcc 2.7.0 */
+                                                                                                                                                                                                  /* #define breakeven_point  8 *//* VAX 4000          - vaxc */
+                                                                                                                                                                                                  /* #define breakeven_point 19 *//* VAX 4000          - gcc 2.7.0 */
 
 #ifndef breakeven_point
-#  define breakeven_point   6  /* some reasonable one-size-fits-all value */
+#  define breakeven_point   6   /* some reasonable one-size-fits-all value */
 #endif
 
 #define fast_memcpy(d,s,n) \
 
 
 #if defined(NEED_ASPRINTF)
-int asprintf   (char **ptr, const char *fmt, /*args*/ ...);
+int asprintf(char **ptr, const char *fmt, /*args */ ...);
 #endif
 #if defined(NEED_VASPRINTF)
-int vasprintf  (char **ptr, const char *fmt, va_list ap);
+int vasprintf(char **ptr, const char *fmt, va_list ap);
 #endif
 
 #if defined(NEED_ASNPRINTF)
-int asnprintf  (char **ptr, size_t str_m, const char *fmt, /*args*/ ...);
+int asnprintf(char **ptr, size_t str_m, const char *fmt, /*args */ ...);
 #endif
 #if defined(NEED_VASNPRINTF)
-int vasnprintf (char **ptr, size_t str_m, const char *fmt, va_list ap);
+int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
 #endif
 
 #if defined(HAVE_SNPRINTF)
@@ -414,7 +414,8 @@ int vasnprintf (char **ptr, size_t str_m, const char *fmt, va_list ap);
 #endif
 
 #if !defined(HAVE_SNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
-int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
+int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args */
+                      ...);
 #if !defined(NEED_SNPRINTF_ONLY)
 int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
 #endif
@@ -429,24 +430,27 @@ static char credits[] = "\n\
 
 static void __foo__(void)
 {
-  printf("%s",credits);
+  printf("%s", credits);
   __foo__();
 }
 
 #if defined(NEED_ASPRINTF)
-int asprintf(char **ptr, const char *fmt, /*args*/ ...) {
+int asprintf(char **ptr, const char *fmt, /*args */ ...)
+{
   va_list ap;
   size_t str_m;
   int str_l;
 
   *ptr = NULL;
-  va_start(ap, fmt);                            /* measure the required size */
-  str_l = portable_vsnprintf(NULL, (size_t)0, fmt, ap);
+  va_start(ap, fmt);            /* measure the required size */
+  str_l = portable_vsnprintf(NULL, (size_t) 0, fmt, ap);
   va_end(ap);
-  assert(str_l >= 0);        /* possible integer overflow if str_m > INT_MAX */
-  *ptr = (char *) malloc(str_m = (size_t)str_l + 1);
-  if (*ptr == NULL) { errno = ENOMEM; str_l = -1; }
-  else {
+  assert(str_l >= 0);           /* possible integer overflow if str_m > INT_MAX */
+  *ptr = (char *) malloc(str_m = (size_t) str_l + 1);
+  if (*ptr == NULL) {
+    errno = ENOMEM;
+    str_l = -1;
+  } else {
     int str_l2;
     va_start(ap, fmt);
     str_l2 = portable_vsnprintf(*ptr, str_m, fmt, ap);
@@ -458,20 +462,24 @@ int asprintf(char **ptr, const char *fmt, /*args*/ ...) {
 #endif
 
 #if defined(NEED_VASPRINTF)
-int vasprintf(char **ptr, const char *fmt, va_list ap) {
+int vasprintf(char **ptr, const char *fmt, va_list ap)
+{
   size_t str_m;
   int str_l;
 
   *ptr = NULL;
-  { va_list ap2;
-  va_copy(ap2, ap);  /* don't consume the original ap, we'll need it again */
-  str_l = portable_vsnprintf(NULL, (size_t)0, fmt, ap2);/*get required size*/
-  va_end(ap2);
+  {
+    va_list ap2;
+    va_copy(ap2, ap);           /* don't consume the original ap, we'll need it again */
+    str_l = portable_vsnprintf(NULL, (size_t) 0, fmt, ap2);     /*get required size */
+    va_end(ap2);
   }
-  assert(str_l >= 0);        /* possible integer overflow if str_m > INT_MAX */
-  *ptr = (char *) malloc(str_m = (size_t)str_l + 1);
-  if (*ptr == NULL) { errno = ENOMEM; str_l = -1; }
-  else {
+  assert(str_l >= 0);           /* possible integer overflow if str_m > INT_MAX */
+  *ptr = (char *) malloc(str_m = (size_t) str_l + 1);
+  if (*ptr == NULL) {
+    errno = ENOMEM;
+    str_l = -1;
+  } else {
     int str_l2 = portable_vsnprintf(*ptr, str_m, fmt, ap);
     assert(str_l2 == str_l);
   }
@@ -480,22 +488,26 @@ int vasprintf(char **ptr, const char *fmt, va_list ap) {
 #endif
 
 #if defined(NEED_ASNPRINTF)
-int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...) {
+int asnprintf(char **ptr, size_t str_m, const char *fmt, /*args */ ...)
+{
   va_list ap;
   int str_l;
 
   *ptr = NULL;
-  va_start(ap, fmt);                            /* measure the required size */
-  str_l = portable_vsnprintf(NULL, (size_t)0, fmt, ap);
+  va_start(ap, fmt);            /* measure the required size */
+  str_l = portable_vsnprintf(NULL, (size_t) 0, fmt, ap);
   va_end(ap);
-  assert(str_l >= 0);        /* possible integer overflow if str_m > INT_MAX */
-  if ((size_t)str_l + 1 < str_m) str_m = (size_t)str_l + 1;      /* truncate */
+  assert(str_l >= 0);           /* possible integer overflow if str_m > INT_MAX */
+  if ((size_t) str_l + 1 < str_m)
+    str_m = (size_t) str_l + 1; /* truncate */
   /* if str_m is 0, no buffer is allocated, just set *ptr to NULL */
-  if (str_m == 0) {  /* not interested in resulting string, just return size */
+  if (str_m == 0) {             /* not interested in resulting string, just return size */
   } else {
     *ptr = (char *) malloc(str_m);
-    if (*ptr == NULL) { errno = ENOMEM; str_l = -1; }
-    else {
+    if (*ptr == NULL) {
+      errno = ENOMEM;
+      str_l = -1;
+    } else {
       int str_l2;
       va_start(ap, fmt);
       str_l2 = portable_vsnprintf(*ptr, str_m, fmt, ap);
@@ -508,23 +520,28 @@ int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...) {
 #endif
 
 #if defined(NEED_VASNPRINTF)
-int vasnprintf (char **ptr, size_t str_m, const char *fmt, va_list ap) {
+int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap)
+{
   int str_l;
 
   *ptr = NULL;
-  { va_list ap2;
-  va_copy(ap2, ap);  /* don't consume the original ap, we'll need it again */
-  str_l = portable_vsnprintf(NULL, (size_t)0, fmt, ap2);/*get required size*/
-  va_end(ap2);
+  {
+    va_list ap2;
+    va_copy(ap2, ap);           /* don't consume the original ap, we'll need it again */
+    str_l = portable_vsnprintf(NULL, (size_t) 0, fmt, ap2);     /*get required size */
+    va_end(ap2);
   }
-  assert(str_l >= 0);        /* possible integer overflow if str_m > INT_MAX */
-  if ((size_t)str_l + 1 < str_m) str_m = (size_t)str_l + 1;      /* truncate */
+  assert(str_l >= 0);           /* possible integer overflow if str_m > INT_MAX */
+  if ((size_t) str_l + 1 < str_m)
+    str_m = (size_t) str_l + 1; /* truncate */
   /* if str_m is 0, no buffer is allocated, just set *ptr to NULL */
-  if (str_m == 0) {  /* not interested in resulting string, just return size */
+  if (str_m == 0) {             /* not interested in resulting string, just return size */
   } else {
     *ptr = (char *) malloc(str_m);
-    if (*ptr == NULL) { errno = ENOMEM; str_l = -1; }
-    else {
+    if (*ptr == NULL) {
+      errno = ENOMEM;
+      str_l = -1;
+    } else {
       int str_l2 = portable_vsnprintf(*ptr, str_m, fmt, ap);
       assert(str_l2 == str_l);
     }
@@ -540,7 +557,8 @@ int vasnprintf (char **ptr, size_t str_m, const char *fmt, va_list ap) {
 #if !defined(HAVE_SNPRINTF) || defined(PREFER_PORTABLE_SNPRINTF)
 
 #if !defined(NEED_SNPRINTF_ONLY)
-int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...) {
+int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args */ ...)
+{
   va_list ap;
   int str_l;
 
@@ -552,510 +570,610 @@ int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...) {
 #endif
 
 #if defined(NEED_SNPRINTF_ONLY)
-int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...) {
+int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args */ ...)
+{
 #else
-  int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
+int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap)
+{
 #endif
 
 #if defined(NEED_SNPRINTF_ONLY)
-    va_list ap;
+  va_list ap;
 #endif
-    size_t str_l = 0;
-    const char *p = fmt;
+  size_t str_l = 0;
+  const char *p = fmt;
 
-    /* In contrast with POSIX, the ISO C99 now says
-     * that str can be NULL and str_m can be 0.
-     * This is more useful than the old:  if (str_m < 1) return -1; */
+  /* In contrast with POSIX, the ISO C99 now says
+   * that str can be NULL and str_m can be 0.
+   * This is more useful than the old:  if (str_m < 1) return -1; */
 
 #if defined(NEED_SNPRINTF_ONLY)
-    va_start(ap, fmt);
+  va_start(ap, fmt);
 #endif
-    if (!p) p = "";
-    while (*p) {
-      if (*p != '%') {
-        /* if (str_l < str_m) str[str_l++] = *p++;    -- this would be sufficient */
-        /* but the following code achieves better performance for cases
-         * where format string is long and contains few conversions */
-        const char *q = strchr(p+1,'%');
-        size_t n = !q ? strlen(p) : (q-p);
-        if (str_l < str_m) {
-          size_t avail = str_m-str_l;
-          fast_memcpy(str+str_l, p, (n>avail?avail:n));
-        }
-        p += n; str_l += n;
-      } else {
-        const char *starting_p;
-        size_t min_field_width = 0, precision = 0;
-        int zero_padding = 0, precision_specified = 0, justify_left = 0;
-        int alternate_form = 0, force_sign = 0;
-        int space_for_positive = 1; /* If both the ' ' and '+' flags appear,
-                                     the ' ' flag should be ignored. */
-        char length_modifier = '\0';            /* allowed values: \0, h, l, L */
-        char tmp[32];/* temporary buffer for simple numeric->string conversion */
-
-        const char *str_arg;      /* string address in case of string argument */
-        size_t str_arg_l;         /* natural field width of arg without padding
+  if (!p)
+    p = "";
+  while (*p) {
+    if (*p != '%') {
+      /* if (str_l < str_m) str[str_l++] = *p++;    -- this would be sufficient */
+      /* but the following code achieves better performance for cases
+       * where format string is long and contains few conversions */
+      const char *q = strchr(p + 1, '%');
+      size_t n = !q ? strlen(p) : (q - p);
+      if (str_l < str_m) {
+        size_t avail = str_m - str_l;
+        fast_memcpy(str + str_l, p, (n > avail ? avail : n));
+      }
+      p += n;
+      str_l += n;
+    } else {
+      const char *starting_p;
+      size_t min_field_width = 0, precision = 0;
+      int zero_padding = 0, precision_specified = 0, justify_left = 0;
+      int alternate_form = 0, force_sign = 0;
+      int space_for_positive = 1;       /* If both the ' ' and '+' flags appear,
+                                           the ' ' flag should be ignored. */
+      char length_modifier = '\0';      /* allowed values: \0, h, l, L */
+      char tmp[32];             /* temporary buffer for simple numeric->string conversion */
+
+      const char *str_arg;      /* string address in case of string argument */
+      size_t str_arg_l;         /* natural field width of arg without padding
                                    and sign */
-        unsigned char uchar_arg;
-        /* unsigned char argument value - only defined for c conversion.
-           N.B. standard explicitly states the char argument for
-           the c conversion is unsigned */
-
-        size_t number_of_zeros_to_pad = 0;
-        /* number of zeros to be inserted for numeric conversions
-           as required by the precision or minimal field width */
-
-        size_t zero_padding_insertion_ind = 0;
-        /* index into tmp where zero padding is to be inserted */
-
-        char fmt_spec = '\0';
-        /* current conversion specifier character */
-
-        str_arg = credits;/* just to make compiler happy (defined but not used)*/
-        str_arg = NULL;
-        starting_p = p; p++;  /* skip '%' */
-        /* parse flags */
-        while (*p == '0' || *p == '-' || *p == '+' ||
-            *p == ' ' || *p == '#' || *p == '\'') {
-          switch (*p) {
-            case '0': zero_padding = 1; break;
-            case '-': justify_left = 1; break;
-            case '+': force_sign = 1; space_for_positive = 0; break;
-            case ' ': force_sign = 1;
-            /* If both the ' ' and '+' flags appear, the ' ' flag should be ignored */
+      unsigned char uchar_arg;
+      /* unsigned char argument value - only defined for c conversion.
+         N.B. standard explicitly states the char argument for
+         the c conversion is unsigned */
+
+      size_t number_of_zeros_to_pad = 0;
+      /* number of zeros to be inserted for numeric conversions
+         as required by the precision or minimal field width */
+
+      size_t zero_padding_insertion_ind = 0;
+      /* index into tmp where zero padding is to be inserted */
+
+      char fmt_spec = '\0';
+      /* current conversion specifier character */
+
+      str_arg = credits;        /* just to make compiler happy (defined but not used) */
+      str_arg = NULL;
+      starting_p = p;
+      p++;                      /* skip '%' */
+      /* parse flags */
+      while (*p == '0' || *p == '-' || *p == '+' ||
+             *p == ' ' || *p == '#' || *p == '\'') {
+        switch (*p) {
+        case '0':
+          zero_padding = 1;
+          break;
+        case '-':
+          justify_left = 1;
+          break;
+        case '+':
+          force_sign = 1;
+          space_for_positive = 0;
+          break;
+        case ' ':
+          force_sign = 1;
+          /* If both the ' ' and '+' flags appear, the ' ' flag should be ignored */
 #ifdef PERL_COMPATIBLE
-            /* ... but in Perl the last of ' ' and '+' applies */
-            space_for_positive = 1;
+          /* ... but in Perl the last of ' ' and '+' applies */
+          space_for_positive = 1;
 #endif
-            break;
-            case '#': alternate_form = 1; break;
-            case '\'': break;
-          }
-          p++;
+          break;
+        case '#':
+          alternate_form = 1;
+          break;
+        case '\'':
+          break;
         }
-        /* If the '0' and '-' flags both appear, the '0' flag should be ignored. */
-
-        /* parse field width */
+        p++;
+      }
+      /* If the '0' and '-' flags both appear, the '0' flag should be ignored. */
+
+      /* parse field width */
+      if (*p == '*') {
+        int j;
+        p++;
+        j = va_arg(ap, int);
+        if (j >= 0)
+          min_field_width = j;
+        else {
+          min_field_width = -j;
+          justify_left = 1;
+        }
+      } else if (isdigit((int) (*p))) {
+        /* size_t could be wider than unsigned int;
+           make sure we treat argument like common implementations do */
+        unsigned int uj = *p++ - '0';
+        while (isdigit((int) (*p)))
+          uj = 10 * uj + (unsigned int) (*p++ - '0');
+        min_field_width = uj;
+      }
+      /* parse precision */
+      if (*p == '.') {
+        p++;
+        precision_specified = 1;
         if (*p == '*') {
-          int j;
-          p++; j = va_arg(ap, int);
-          if (j >= 0) min_field_width = j;
-          else { min_field_width = -j; justify_left = 1; }
-        } else if (isdigit((int)(*p))) {
+          int j = va_arg(ap, int);
+          p++;
+          if (j >= 0)
+            precision = j;
+          else {
+            precision_specified = 0;
+            precision = 0;
+            /* NOTE:
+             *   Solaris 2.6 man page claims that in this case the precision
+             *   should be set to 0.  Digital Unix 4.0, HPUX 10 and BSD man page
+             *   claim that this case should be treated as unspecified precision,
+             *   which is what we do here.
+             */
+          }
+        } else if (isdigit((int) (*p))) {
           /* size_t could be wider than unsigned int;
-           make sure we treat argument like common implementations do */
-          unsigned int uj = *p++ - '0';
-          while (isdigit((int)(*p))) uj = 10*uj + (unsigned int)(*p++ - '0');
-          min_field_width = uj;
-        }
-        /* parse precision */
-        if (*p == '.') {
-          p++; precision_specified = 1;
-          if (*p == '*') {
-            int j = va_arg(ap, int);
-            p++;
-            if (j >= 0) precision = j;
-            else {
-              precision_specified = 0; precision = 0;
-              /* NOTE:
-               *   Solaris 2.6 man page claims that in this case the precision
-               *   should be set to 0.  Digital Unix 4.0, HPUX 10 and BSD man page
-               *   claim that this case should be treated as unspecified precision,
-               *   which is what we do here.
-               */
-            }
-          } else if (isdigit((int)(*p))) {
-            /* size_t could be wider than unsigned int;
              make sure we treat argument like common implementations do */
-            unsigned int uj = *p++ - '0';
-            while (isdigit((int)(*p))) uj = 10*uj + (unsigned int)(*p++ - '0');
-            precision = uj;
-          }
+          unsigned int uj = *p++ - '0';
+          while (isdigit((int) (*p)))
+            uj = 10 * uj + (unsigned int) (*p++ - '0');
+          precision = uj;
         }
-        /* parse 'h', 'l' and 'll' length modifiers */
-        if (*p == 'h' || *p == 'l') {
-          length_modifier = *p; p++;
-          if (length_modifier == 'l' && *p == 'l') {   /* double l = long long */
+      }
+      /* parse 'h', 'l' and 'll' length modifiers */
+      if (*p == 'h' || *p == 'l') {
+        length_modifier = *p;
+        p++;
+        if (length_modifier == 'l' && *p == 'l') {      /* double l = long long */
 #ifdef SNPRINTF_LONGLONG_SUPPORT
-            length_modifier = '2';                  /* double l encoded as '2' */
+          length_modifier = '2';        /* double l encoded as '2' */
 #else
-            length_modifier = 'l';                 /* treat it as a single 'l' */
+          length_modifier = 'l';        /* treat it as a single 'l' */
 #endif
-            p++;
-          }
-        }
-        fmt_spec = *p;
-        /* common synonyms: */
-        switch (fmt_spec) {
-          case 'i': fmt_spec = 'd'; break;
-          case 'D': fmt_spec = 'd'; length_modifier = 'l'; break;
-          case 'U': fmt_spec = 'u'; length_modifier = 'l'; break;
-          case 'O': fmt_spec = 'o'; length_modifier = 'l'; break;
-          default: break;
+          p++;
         }
-        /* get parameter value, do initial processing */
-        switch (fmt_spec) {
-          case '%': /* % behaves similar to 's' regarding flags and field widths */
-          case 'c': /* c behaves similar to 's' regarding flags and field widths */
-          case 's':
-            length_modifier = '\0';          /* wint_t and wchar_t not supported */
-            /* the result of zero padding flag with non-numeric conversion specifier*/
-            /* is undefined. Solaris and HPUX 10 does zero padding in this case,    */
-            /* Digital Unix and Linux does not. */
+      }
+      fmt_spec = *p;
+      /* common synonyms: */
+      switch (fmt_spec) {
+      case 'i':
+        fmt_spec = 'd';
+        break;
+      case 'D':
+        fmt_spec = 'd';
+        length_modifier = 'l';
+        break;
+      case 'U':
+        fmt_spec = 'u';
+        length_modifier = 'l';
+        break;
+      case 'O':
+        fmt_spec = 'o';
+        length_modifier = 'l';
+        break;
+      default:
+        break;
+      }
+      /* get parameter value, do initial processing */
+      switch (fmt_spec) {
+      case '%':                /* % behaves similar to 's' regarding flags and field widths */
+      case 'c':                /* c behaves similar to 's' regarding flags and field widths */
+      case 's':
+        length_modifier = '\0'; /* wint_t and wchar_t not supported */
+        /* the result of zero padding flag with non-numeric conversion specifier */
+        /* is undefined. Solaris and HPUX 10 does zero padding in this case,    */
+        /* Digital Unix and Linux does not. */
 #if !defined(SOLARIS_COMPATIBLE) && !defined(HPUX_COMPATIBLE)
-            zero_padding = 0;    /* turn zero padding off for string conversions */
+        zero_padding = 0;       /* turn zero padding off for string conversions */
 #endif
-            str_arg_l = 1;
-            switch (fmt_spec) {
-              case '%':
-                str_arg = p; break;
-              case 'c': {
-                int j = va_arg(ap, int);
-                uchar_arg = (unsigned char) j;   /* standard demands unsigned char */
-                str_arg = (const char *) &uchar_arg;
-                break;
-              }
-              case 's':
-                str_arg = va_arg(ap, const char *);
-                if (!str_arg) str_arg_l = 0;
-                /* make sure not to address string beyond the specified precision !!! */
-                else if (!precision_specified) str_arg_l = strlen(str_arg);
-                /* truncate string if necessary as requested by precision */
-                else if (precision == 0) str_arg_l = 0;
-                else {
-                  /* memchr on HP does not like n > 2^31  !!! */
-                  char *q = (char *) memchr(str_arg, '\0',
-                                            precision <= 0x7fffffff ? precision : 0x7fffffff);
-                  str_arg_l = !q ? precision : (q-str_arg);
-                }
-                break;
-              default: break;
-            }
+        str_arg_l = 1;
+        switch (fmt_spec) {
+        case '%':
+          str_arg = p;
+          break;
+        case 'c':{
+            int j = va_arg(ap, int);
+            uchar_arg = (unsigned char) j;      /* standard demands unsigned char */
+            str_arg = (const char *) &uchar_arg;
             break;
-              case 'd': case 'u': case 'o': case 'x': case 'X': case 'p': {
-                /* NOTE: the u, o, x, X and p conversion specifiers imply
-                 the value is unsigned;  d implies a signed value */
-
-                int arg_sign = 0;
-                /* 0 if numeric argument is zero (or if pointer is NULL for 'p'),
-            +1 if greater than zero (or nonzero for unsigned arguments),
-            -1 if negative (unsigned argument is never negative) */
-
-                int int_arg = 0;  unsigned int uint_arg = 0;
-                /* only defined for length modifier h, or for no length modifiers */
-
-                long int long_arg = 0;  unsigned long int ulong_arg = 0;
-                /* only defined for length modifier l */
-
-                void *ptr_arg = NULL;
-                /* pointer argument value -only defined for p conversion */
+          }
+        case 's':
+          str_arg = va_arg(ap, const char *);
+          if (!str_arg)
+            str_arg_l = 0;
+          /* make sure not to address string beyond the specified precision !!! */
+          else if (!precision_specified)
+            str_arg_l = strlen(str_arg);
+          /* truncate string if necessary as requested by precision */
+          else if (precision == 0)
+            str_arg_l = 0;
+          else {
+            /* memchr on HP does not like n > 2^31  !!! */
+            char *q = (char *) memchr(str_arg, '\0',
+                                      precision <=
+                                      0x7fffffff ? precision : 0x7fffffff);
+            str_arg_l = !q ? precision : (q - str_arg);
+          }
+          break;
+        default:
+          break;
+        }
+        break;
+      case 'd':
+      case 'u':
+      case 'o':
+      case 'x':
+      case 'X':
+      case 'p':{
+          /* NOTE: the u, o, x, X and p conversion specifiers imply
+             the value is unsigned;  d implies a signed value */
+
+          int arg_sign = 0;
+          /* 0 if numeric argument is zero (or if pointer is NULL for 'p'),
+             +1 if greater than zero (or nonzero for unsigned arguments),
+             -1 if negative (unsigned argument is never negative) */
+
+          int int_arg = 0;
+          unsigned int uint_arg = 0;
+          /* only defined for length modifier h, or for no length modifiers */
+
+          long int long_arg = 0;
+          unsigned long int ulong_arg = 0;
+          /* only defined for length modifier l */
+
+          void *ptr_arg = NULL;
+          /* pointer argument value -only defined for p conversion */
 
 #ifdef SNPRINTF_LONGLONG_SUPPORT
-                long long int long_long_arg = 0;
-                unsigned long long int ulong_long_arg = 0;
-                /* only defined for length modifier ll */
+          long long int long_long_arg = 0;
+          unsigned long long int ulong_long_arg = 0;
+          /* only defined for length modifier ll */
 #endif
-                if (fmt_spec == 'p') {
-                  /* HPUX 10: An l, h, ll or L before any other conversion character
-                   *   (other than d, i, u, o, x, or X) is ignored.
-                   * Digital Unix:
-                   *   not specified, but seems to behave as HPUX does.
-                   * Solaris: If an h, l, or L appears before any other conversion
-                   *   specifier (other than d, i, u, o, x, or X), the behavior
-                   *   is undefined. (Actually %hp converts only 16-bits of address
-                   *   and %llp treats address as 64-bit data which is incompatible
-                   *   with (void *) argument on a 32-bit system).
-                   */
+          if (fmt_spec == 'p') {
+            /* HPUX 10: An l, h, ll or L before any other conversion character
+             *   (other than d, i, u, o, x, or X) is ignored.
+             * Digital Unix:
+             *   not specified, but seems to behave as HPUX does.
+             * Solaris: If an h, l, or L appears before any other conversion
+             *   specifier (other than d, i, u, o, x, or X), the behavior
+             *   is undefined. (Actually %hp converts only 16-bits of address
+             *   and %llp treats address as 64-bit data which is incompatible
+             *   with (void *) argument on a 32-bit system).
+             */
 #ifdef SOLARIS_COMPATIBLE
 #  ifdef SOLARIS_BUG_COMPATIBLE
-                  /* keep length modifiers even if it represents 'll' */
+            /* keep length modifiers even if it represents 'll' */
 #  else
-                  if (length_modifier == '2') length_modifier = '\0';
+            if (length_modifier == '2')
+              length_modifier = '\0';
 #  endif
 #else
-                  length_modifier = '\0';
+            length_modifier = '\0';
 #endif
-                  ptr_arg = va_arg(ap, void *);
-                  if (ptr_arg != NULL) arg_sign = 1;
-                } else if (fmt_spec == 'd') {  /* signed */
-                  switch (length_modifier) {
-                    case '\0':
-                    case 'h':
-                      /* It is non-portable to specify a second argument of char or short
-                       * to va_arg, because arguments seen by the called function
-                       * are not char or short.  C converts char and short arguments
-                       * to int before passing them to a function.
-                       */
-                      int_arg = va_arg(ap, int);
-                      if      (int_arg > 0) arg_sign =  1;
-                      else if (int_arg < 0) arg_sign = -1;
-                      break;
-                    case 'l':
-                      long_arg = va_arg(ap, long int);
-                      if      (long_arg > 0) arg_sign =  1;
-                      else if (long_arg < 0) arg_sign = -1;
-                      break;
+            ptr_arg = va_arg(ap, void *);
+            if (ptr_arg != NULL)
+              arg_sign = 1;
+          } else if (fmt_spec == 'd') { /* signed */
+            switch (length_modifier) {
+            case '\0':
+            case 'h':
+              /* It is non-portable to specify a second argument of char or short
+               * to va_arg, because arguments seen by the called function
+               * are not char or short.  C converts char and short arguments
+               * to int before passing them to a function.
+               */
+              int_arg = va_arg(ap, int);
+              if (int_arg > 0)
+                arg_sign = 1;
+              else if (int_arg < 0)
+                arg_sign = -1;
+              break;
+            case 'l':
+              long_arg = va_arg(ap, long int);
+              if (long_arg > 0)
+                arg_sign = 1;
+              else if (long_arg < 0)
+                arg_sign = -1;
+              break;
 #ifdef SNPRINTF_LONGLONG_SUPPORT
-                    case '2':
-                      long_long_arg = va_arg(ap, long long int);
-                      if      (long_long_arg > 0) arg_sign =  1;
-                      else if (long_long_arg < 0) arg_sign = -1;
-                      break;
+            case '2':
+              long_long_arg = va_arg(ap, long long int);
+              if (long_long_arg > 0)
+                arg_sign = 1;
+              else if (long_long_arg < 0)
+                arg_sign = -1;
+              break;
 #endif
-                  }
-                } else {  /* unsigned */
-                  switch (length_modifier) {
-                    case '\0':
-                    case 'h':
-                      uint_arg = va_arg(ap, unsigned int);
-                      if (uint_arg) arg_sign = 1;
-                      break;
-                    case 'l':
-                      ulong_arg = va_arg(ap, unsigned long int);
-                      if (ulong_arg) arg_sign = 1;
-                      break;
+            }
+          } else {              /* unsigned */
+            switch (length_modifier) {
+            case '\0':
+            case 'h':
+              uint_arg = va_arg(ap, unsigned int);
+              if (uint_arg)
+                arg_sign = 1;
+              break;
+            case 'l':
+              ulong_arg = va_arg(ap, unsigned long int);
+              if (ulong_arg)
+                arg_sign = 1;
+              break;
 #ifdef SNPRINTF_LONGLONG_SUPPORT
-                    case '2':
-                      ulong_long_arg = va_arg(ap, unsigned long long int);
-                      if (ulong_long_arg) arg_sign = 1;
-                      break;
+            case '2':
+              ulong_long_arg = va_arg(ap, unsigned long long int);
+              if (ulong_long_arg)
+                arg_sign = 1;
+              break;
 #endif
-                  }
-                }
-                str_arg = tmp; str_arg_l = 0;
-                /* NOTE:
-                 *   For d, i, u, o, x, and X conversions, if precision is specified,
-                 *   the '0' flag should be ignored. This is so with Solaris 2.6,
-                 *   Digital UNIX 4.0, HPUX 10, Linux, FreeBSD, NetBSD; but not with Perl.
-                 */
+            }
+          }
+          str_arg = tmp;
+          str_arg_l = 0;
+          /* NOTE:
+           *   For d, i, u, o, x, and X conversions, if precision is specified,
+           *   the '0' flag should be ignored. This is so with Solaris 2.6,
+           *   Digital UNIX 4.0, HPUX 10, Linux, FreeBSD, NetBSD; but not with Perl.
+           */
 #ifndef PERL_COMPATIBLE
-                if (precision_specified) zero_padding = 0;
+          if (precision_specified)
+            zero_padding = 0;
 #endif
-                if (fmt_spec == 'd') {
-                  if (force_sign && arg_sign >= 0)
-                    tmp[str_arg_l++] = space_for_positive ? ' ' : '+';
-                  /* leave negative numbers for sprintf to handle,
-            to avoid handling tricky cases like (short int)(-32768) */
+          if (fmt_spec == 'd') {
+            if (force_sign && arg_sign >= 0)
+              tmp[str_arg_l++] = space_for_positive ? ' ' : '+';
+            /* leave negative numbers for sprintf to handle,
+               to avoid handling tricky cases like (short int)(-32768) */
 #ifdef LINUX_COMPATIBLE
-                } else if (fmt_spec == 'p' && force_sign && arg_sign > 0) {
-                  tmp[str_arg_l++] = space_for_positive ? ' ' : '+';
+          } else if (fmt_spec == 'p' && force_sign && arg_sign > 0) {
+            tmp[str_arg_l++] = space_for_positive ? ' ' : '+';
 #endif
-                } else if (alternate_form) {
-                  if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X') )
-                  { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; }
-                  /* alternate form should have no effect for p conversion, but ... */
+          } else if (alternate_form) {
+            if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X')) {
+              tmp[str_arg_l++] = '0';
+              tmp[str_arg_l++] = fmt_spec;
+            }
+            /* alternate form should have no effect for p conversion, but ... */
 #ifdef HPUX_COMPATIBLE
-                  else if (fmt_spec == 'p'
-                    /* HPUX 10: for an alternate form of p conversion,
-                     *          a nonzero result is prefixed by 0x. */
+            else if (fmt_spec == 'p'
+                     /* HPUX 10: for an alternate form of p conversion,
+                      *          a nonzero result is prefixed by 0x. */
 #ifndef HPUX_BUG_COMPATIBLE
-                    /* Actually it uses 0x prefix even for a zero value. */
-                    && arg_sign != 0
+                     /* Actually it uses 0x prefix even for a zero value. */
+                     && arg_sign != 0
 #endif
-                  ) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = 'x'; }
+              ) {
+              tmp[str_arg_l++] = '0';
+              tmp[str_arg_l++] = 'x';
+            }
 #endif
-                }
-                zero_padding_insertion_ind = str_arg_l;
-                if (!precision_specified) precision = 1;   /* default precision is 1 */
-                if (precision == 0 && arg_sign == 0
+          }
+          zero_padding_insertion_ind = str_arg_l;
+          if (!precision_specified)
+            precision = 1;      /* default precision is 1 */
+          if (precision == 0 && arg_sign == 0
 #if defined(HPUX_BUG_COMPATIBLE) || defined(LINUX_COMPATIBLE)
-                    && fmt_spec != 'p'
-                      /* HPUX 10 man page claims: With conversion character p the result of
-                       * converting a zero value with a precision of zero is a null string.
-                       * Actually HP returns all zeroes, and Linux returns "(nil)". */
+              && fmt_spec != 'p'
+              /* HPUX 10 man page claims: With conversion character p the result of
+               * converting a zero value with a precision of zero is a null string.
+               * Actually HP returns all zeroes, and Linux returns "(nil)". */
 #endif
-                ) {
-                  /* converted to null string */
-                  /* When zero value is formatted with an explicit precision 0,
-            the resulting formatted string is empty (d, i, u, o, x, X, p).   */
-                } else {
-                  char f[5]; int f_l = 0;
-                  f[f_l++] = '%';    /* construct a simple format string for sprintf */
-                  if (!length_modifier) { }
-                  else if (length_modifier=='2') { f[f_l++] = 'l'; f[f_l++] = 'l'; }
-                  else f[f_l++] = length_modifier;
-                  f[f_l++] = fmt_spec; f[f_l++] = '\0';
-                  if (fmt_spec == 'p') str_arg_l += sprintf(tmp+str_arg_l, f, ptr_arg);
-                  else if (fmt_spec == 'd') {  /* signed */
-                    switch (length_modifier) {
-                      case '\0':
-                      case 'h': str_arg_l+=sprintf(tmp+str_arg_l, f, int_arg);  break;
-                      case 'l': str_arg_l+=sprintf(tmp+str_arg_l, f, long_arg); break;
+            ) {
+            /* converted to null string */
+            /* When zero value is formatted with an explicit precision 0,
+               the resulting formatted string is empty (d, i, u, o, x, X, p).   */
+          } else {
+            char f[5];
+            int f_l = 0;
+            f[f_l++] = '%';     /* construct a simple format string for sprintf */
+            if (!length_modifier) {
+            } else if (length_modifier == '2') {
+              f[f_l++] = 'l';
+              f[f_l++] = 'l';
+            } else
+              f[f_l++] = length_modifier;
+            f[f_l++] = fmt_spec;
+            f[f_l++] = '\0';
+            if (fmt_spec == 'p')
+              str_arg_l += sprintf(tmp + str_arg_l, f, ptr_arg);
+            else if (fmt_spec == 'd') { /* signed */
+              switch (length_modifier) {
+              case '\0':
+              case 'h':
+                str_arg_l += sprintf(tmp + str_arg_l, f, int_arg);
+                break;
+              case 'l':
+                str_arg_l += sprintf(tmp + str_arg_l, f, long_arg);
+                break;
 #ifdef SNPRINTF_LONGLONG_SUPPORT
-                      case '2': str_arg_l+=sprintf(tmp+str_arg_l,f,long_long_arg); break;
+              case '2':
+                str_arg_l += sprintf(tmp + str_arg_l, f, long_long_arg);
+                break;
 #endif
-                    }
-                  } else {  /* unsigned */
-                    switch (length_modifier) {
-                      case '\0':
-                      case 'h': str_arg_l+=sprintf(tmp+str_arg_l, f, uint_arg);  break;
-                      case 'l': str_arg_l+=sprintf(tmp+str_arg_l, f, ulong_arg); break;
+              }
+            } else {            /* unsigned */
+              switch (length_modifier) {
+              case '\0':
+              case 'h':
+                str_arg_l += sprintf(tmp + str_arg_l, f, uint_arg);
+                break;
+              case 'l':
+                str_arg_l += sprintf(tmp + str_arg_l, f, ulong_arg);
+                break;
 #ifdef SNPRINTF_LONGLONG_SUPPORT
-                      case '2': str_arg_l+=sprintf(tmp+str_arg_l,f,ulong_long_arg);break;
+              case '2':
+                str_arg_l += sprintf(tmp + str_arg_l, f, ulong_long_arg);
+                break;
 #endif
-                    }
-                  }
-                  /* include the optional minus sign and possible "0x"
-            in the region before the zero padding insertion point */
-                  if (zero_padding_insertion_ind < str_arg_l &&
-                      tmp[zero_padding_insertion_ind] == '-') {
-                    zero_padding_insertion_ind++;
-                  }
-                  if (zero_padding_insertion_ind+1 < str_arg_l &&
-                      tmp[zero_padding_insertion_ind]   == '0' &&
-                      (tmp[zero_padding_insertion_ind+1] == 'x' ||
-                          tmp[zero_padding_insertion_ind+1] == 'X') ) {
-                    zero_padding_insertion_ind += 2;
-                  }
-                }
-                { size_t num_of_digits = str_arg_l - zero_padding_insertion_ind;
-                if (alternate_form && fmt_spec == 'o'
-#ifdef HPUX_COMPATIBLE                                  /* ("%#.o",0) -> ""  */
-                  && (str_arg_l > 0)
+              }
+            }
+            /* include the optional minus sign and possible "0x"
+               in the region before the zero padding insertion point */
+            if (zero_padding_insertion_ind < str_arg_l &&
+                tmp[zero_padding_insertion_ind] == '-') {
+              zero_padding_insertion_ind++;
+            }
+            if (zero_padding_insertion_ind + 1 < str_arg_l &&
+                tmp[zero_padding_insertion_ind] == '0' &&
+                (tmp[zero_padding_insertion_ind + 1] == 'x' ||
+                 tmp[zero_padding_insertion_ind + 1] == 'X')) {
+              zero_padding_insertion_ind += 2;
+            }
+          }
+          {
+            size_t num_of_digits = str_arg_l - zero_padding_insertion_ind;
+            if (alternate_form && fmt_spec == 'o'
+#ifdef HPUX_COMPATIBLE          /* ("%#.o",0) -> ""  */
+                && (str_arg_l > 0)
 #endif
-#ifdef DIGITAL_UNIX_BUG_COMPATIBLE                      /* ("%#o",0) -> "00" */
+#ifdef DIGITAL_UNIX_BUG_COMPATIBLE      /* ("%#o",0) -> "00" */
 #else
-                  /* unless zero is already the first character */
-                  && !(zero_padding_insertion_ind < str_arg_l
-                      && tmp[zero_padding_insertion_ind] == '0')
+                /* unless zero is already the first character */
+                && !(zero_padding_insertion_ind < str_arg_l
+                     && tmp[zero_padding_insertion_ind] == '0')
 #endif
-                ) {        /* assure leading zero for alternate-form octal numbers */
-                  if (!precision_specified || precision < num_of_digits+1) {
-                    /* precision is increased to force the first character to be zero,
-                except if a zero value is formatted with an explicit precision
-                of zero */
-                    precision = num_of_digits+1; precision_specified = 1;
-                  }
-                }
-                /* zero padding to specified precision? */
-                if (num_of_digits < precision)
-                  number_of_zeros_to_pad = precision - num_of_digits;
-                }
-                /* zero padding to specified minimal field width? */
-                if (!justify_left && zero_padding) {
-                  int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
-                  if (n > 0) number_of_zeros_to_pad += n;
-                }
-                break;
+              ) {               /* assure leading zero for alternate-form octal numbers */
+              if (!precision_specified || precision < num_of_digits + 1) {
+                /* precision is increased to force the first character to be zero,
+                   except if a zero value is formatted with an explicit precision
+                   of zero */
+                precision = num_of_digits + 1;
+                precision_specified = 1;
               }
-              default: /* unrecognized conversion specifier, keep format string as-is*/
-                zero_padding = 0;  /* turn zero padding off for non-numeric convers. */
+            }
+            /* zero padding to specified precision? */
+            if (num_of_digits < precision)
+              number_of_zeros_to_pad = precision - num_of_digits;
+          }
+          /* zero padding to specified minimal field width? */
+          if (!justify_left && zero_padding) {
+            int n = min_field_width - (str_arg_l + number_of_zeros_to_pad);
+            if (n > 0)
+              number_of_zeros_to_pad += n;
+          }
+          break;
+        }
+      default:                 /* unrecognized conversion specifier, keep format string as-is */
+        zero_padding = 0;       /* turn zero padding off for non-numeric convers. */
 #ifndef DIGITAL_UNIX_COMPATIBLE
-                justify_left = 1; min_field_width = 0;                /* reset flags */
+        justify_left = 1;
+        min_field_width = 0;    /* reset flags */
 #endif
 #if defined(PERL_COMPATIBLE) || defined(LINUX_COMPATIBLE)
-                /* keep the entire format string unchanged */
-                str_arg = starting_p; str_arg_l = p - starting_p;
-                /* well, not exactly so for Linux, which does something inbetween,
-                 * and I don't feel an urge to imitate it: "%+++++hy" -> "%+y"  */
+        /* keep the entire format string unchanged */
+        str_arg = starting_p;
+        str_arg_l = p - starting_p;
+        /* well, not exactly so for Linux, which does something inbetween,
+         * and I don't feel an urge to imitate it: "%+++++hy" -> "%+y"  */
 #else
-                /* discard the unrecognized conversion, just keep *
-                 * the unrecognized conversion character          */
-                str_arg = p; str_arg_l = 0;
+        /* discard the unrecognized conversion, just keep *
+         * the unrecognized conversion character          */
+        str_arg = p;
+        str_arg_l = 0;
 #endif
-                if (*p) str_arg_l++;  /* include invalid conversion specifier unchanged
-                                 if not at end-of-string */
-                break;
-        }
-        if (*p) p++;      /* step over the just processed conversion specifier */
-        /* insert padding to the left as requested by min_field_width;
-      this does not include the zero padding in case of numerical conversions*/
-        if (!justify_left) {                /* left padding with blank or zero */
-          int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
-          if (n > 0) {
-            if (str_l < str_m) {
-              int avail = str_m-str_l;
-              fast_memset(str+str_l, (zero_padding?'0':' '), (n>avail?avail:n));
-            }
-            str_l += n;
+        if (*p)
+          str_arg_l++;          /* include invalid conversion specifier unchanged
+                                   if not at end-of-string */
+        break;
+      }
+      if (*p)
+        p++;                    /* step over the just processed conversion specifier */
+      /* insert padding to the left as requested by min_field_width;
+         this does not include the zero padding in case of numerical conversions */
+      if (!justify_left) {      /* left padding with blank or zero */
+        int n = min_field_width - (str_arg_l + number_of_zeros_to_pad);
+        if (n > 0) {
+          if (str_l < str_m) {
+            int avail = str_m - str_l;
+            fast_memset(str + str_l, (zero_padding ? '0' : ' '),
+                        (n > avail ? avail : n));
           }
+          str_l += n;
         }
-        /* zero padding as requested by the precision or by the minimal field width
-         * for numeric conversions required? */
-        if (number_of_zeros_to_pad <= 0) {
-          /* will not copy first part of numeric right now, *
-           * force it to be copied later in its entirety    */
-          zero_padding_insertion_ind = 0;
-        } else {
-          /* insert first part of numerics (sign or '0x') before zero padding */
-          int n = zero_padding_insertion_ind;
-          if (n > 0) {
-            if (str_l < str_m) {
-              int avail = str_m-str_l;
-              fast_memcpy(str+str_l, str_arg, (n>avail?avail:n));
-            }
-            str_l += n;
-          }
-          /* insert zero padding as requested by the precision or min field width */
-          n = number_of_zeros_to_pad;
-          if (n > 0) {
-            if (str_l < str_m) {
-              int avail = str_m-str_l;
-              fast_memset(str+str_l, '0', (n>avail?avail:n));
-            }
-            str_l += n;
+      }
+      /* zero padding as requested by the precision or by the minimal field width
+       * for numeric conversions required? */
+      if (number_of_zeros_to_pad <= 0) {
+        /* will not copy first part of numeric right now, *
+         * force it to be copied later in its entirety    */
+        zero_padding_insertion_ind = 0;
+      } else {
+        /* insert first part of numerics (sign or '0x') before zero padding */
+        int n = zero_padding_insertion_ind;
+        if (n > 0) {
+          if (str_l < str_m) {
+            int avail = str_m - str_l;
+            fast_memcpy(str + str_l, str_arg, (n > avail ? avail : n));
           }
+          str_l += n;
         }
-        /* insert formatted string
-         * (or as-is conversion specifier for unknown conversions) */
-        { int n = str_arg_l - zero_padding_insertion_ind;
+        /* insert zero padding as requested by the precision or min field width */
+        n = number_of_zeros_to_pad;
         if (n > 0) {
           if (str_l < str_m) {
-            int avail = str_m-str_l;
-            fast_memcpy(str+str_l, str_arg+zero_padding_insertion_ind,
-                        (n>avail?avail:n));
+            int avail = str_m - str_l;
+            fast_memset(str + str_l, '0', (n > avail ? avail : n));
           }
           str_l += n;
         }
+      }
+      /* insert formatted string
+       * (or as-is conversion specifier for unknown conversions) */
+      {
+        int n = str_arg_l - zero_padding_insertion_ind;
+        if (n > 0) {
+          if (str_l < str_m) {
+            int avail = str_m - str_l;
+            fast_memcpy(str + str_l, str_arg + zero_padding_insertion_ind,
+                        (n > avail ? avail : n));
+          }
+          str_l += n;
         }
-        /* insert right padding */
-        if (justify_left) {          /* right blank padding to the field width */
-          int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
-          if (n > 0) {
-            if (str_l < str_m) {
-              int avail = str_m-str_l;
-              fast_memset(str+str_l, ' ', (n>avail?avail:n));
-            }
-            str_l += n;
+      }
+      /* insert right padding */
+      if (justify_left) {       /* right blank padding to the field width */
+        int n = min_field_width - (str_arg_l + number_of_zeros_to_pad);
+        if (n > 0) {
+          if (str_l < str_m) {
+            int avail = str_m - str_l;
+            fast_memset(str + str_l, ' ', (n > avail ? avail : n));
           }
+          str_l += n;
         }
       }
     }
+  }
 #if defined(NEED_SNPRINTF_ONLY)
-    va_end(ap);
+  va_end(ap);
 #endif
-    if (str_m > 0) { /* make sure the string is null-terminated
-                      even at the expense of overwriting the last character
-                      (shouldn't happen, but just in case) */
-      str[str_l <= str_m-1 ? str_l : str_m-1] = '\0';
-    }
-    /* Return the number of characters formatted (excluding trailing null
-     * character), that is, the number of characters that would have been
-     * written to the buffer if it were large enough.
-     *
-     * The value of str_l should be returned, but str_l is of unsigned type
-     * size_t, and snprintf is int, possibly leading to an undetected
-     * integer overflow, resulting in a negative return value, which is illegal.
-     * Both XSH5 and ISO C99 (at least the draft) are silent on this issue.
-     * Should errno be set to EOVERFLOW and EOF returned in this case???
-     */
-    return (int) str_l;
+  if (str_m > 0) {              /* make sure the string is null-terminated
+                                   even at the expense of overwriting the last character
+                                   (shouldn't happen, but just in case) */
+    str[str_l <= str_m - 1 ? str_l : str_m - 1] = '\0';
   }
+  /* Return the number of characters formatted (excluding trailing null
+   * character), that is, the number of characters that would have been
+   * written to the buffer if it were large enough.
+   *
+   * The value of str_l should be returned, but str_l is of unsigned type
+   * size_t, and snprintf is int, possibly leading to an undetected
+   * integer overflow, resulting in a negative return value, which is illegal.
+   * Both XSH5 and ISO C99 (at least the draft) are silent on this issue.
+   * Should errno be set to EOVERFLOW and EOF returned in this case???
+   */
+  return (int) str_l;
+}
 #endif
 
 
   /* FIXME: better place */
 #include "xbt/sysdep.h"
 
-  char *bprintf(const char*fmt, ...) {
-    va_list ap;
-    char *res;
-    int len;
+char *bprintf(const char *fmt, ...)
+{
+  va_list ap;
+  char *res;
+  int len;
 
-    va_start(ap, fmt);
+  va_start(ap, fmt);
 
-    len = vasprintf(&res,fmt,ap);
+  len = vasprintf(&res, fmt, ap);
 
-    va_end(ap);
-    return res;
-  }
+  va_end(ap);
+  return res;
+}
index eda86e4..a87c745 100644 (file)
@@ -154,25 +154,25 @@ void *xbt_swag_remove(void *obj, xbt_swag_t swag)
 
   if ((!obj) || (!swag))
     return NULL;
-  if(!xbt_swag_belongs(obj, swag)) /* Trying to remove an object that
-                                     was not in this swag */
+  if (!xbt_swag_belongs(obj, swag))     /* Trying to remove an object that
+                                           was not in this swag */
     return NULL;
 
-  if (swag->head == swag->tail) {      /* special case */
-    if (swag->head != obj)     /* Trying to remove an object that was not in this swag */
+  if (swag->head == swag->tail) {       /* special case */
+    if (swag->head != obj)      /* Trying to remove an object that was not in this swag */
       return NULL;
     swag->head = NULL;
     swag->tail = NULL;
     NEXT(obj, offset) = PREV(obj, offset) = NULL;
-  } else if (obj == swag->head) {      /* It's the head */
+  } else if (obj == swag->head) {       /* It's the head */
     swag->head = NEXT(obj, offset);
     PREV(swag->head, offset) = NULL;
     NEXT(obj, offset) = NULL;
-  } else if (obj == swag->tail) {      /* It's the tail */
+  } else if (obj == swag->tail) {       /* It's the tail */
     swag->tail = PREV(obj, offset);
     NEXT(swag->tail, offset) = NULL;
     PREV(obj, offset) = NULL;
-  } else {                     /* It's in the middle */
+  } else {                      /* It's in the middle */
     NEXT(PREV(obj, offset), offset) = NEXT(obj, offset);
     PREV(NEXT(obj, offset), offset) = PREV(obj, offset);
     PREV(obj, offset) = NEXT(obj, offset) = NULL;
@@ -195,7 +195,7 @@ void *xbt_swag_extract(xbt_swag_t swag)
 
   obj = swag->head;
 
-  if (swag->head == swag->tail) {      /* special case */
+  if (swag->head == swag->tail) {       /* special case */
     swag->head = swag->tail = NULL;
     PREV(obj, offset) = NEXT(obj, offset) = NULL;
   } else {
@@ -207,6 +207,7 @@ void *xbt_swag_extract(xbt_swag_t swag)
 
   return obj;
 }
+
 /**
  * \param swag a swag
  * \return the number of objects in \a swag
@@ -224,13 +225,13 @@ int xbt_swag_size(xbt_swag_t swag)
 int xbt_swag_belongs(void *obj, xbt_swag_t swag)
 {
   return ((NEXT(obj, swag->offset)) || (PREV(obj, swag->offset))
-      || (swag->head == obj));
+          || (swag->head == obj));
 }
 
 
 #ifdef SIMGRID_TEST
 
-XBT_TEST_SUITE("swag","Swag data container");
+XBT_TEST_SUITE("swag", "Swag data container");
 
 typedef struct {
   s_xbt_swag_hookup_t setA;
@@ -239,22 +240,23 @@ typedef struct {
 } shmurtz, s_shmurtz_t, *shmurtz_t;
 
 
-XBT_TEST_UNIT("basic",test_swag_basic,"Basic usage") {
+XBT_TEST_UNIT("basic", test_swag_basic, "Basic usage")
+{
   shmurtz_t obj1, obj2, obj;
-  xbt_swag_t setA,setB;
+  xbt_swag_t setA, setB;
 
-  obj1 = xbt_new0(s_shmurtz_t,1);
-  obj2 = xbt_new0(s_shmurtz_t,1);
+  obj1 = xbt_new0(s_shmurtz_t, 1);
+  obj2 = xbt_new0(s_shmurtz_t, 1);
 
-  obj1->name="Obj 1";
-  obj2->name="Obj 2";
+  obj1->name = "Obj 1";
+  obj2->name = "Obj 2";
 
   xbt_test_add0("Basic usage");
-  xbt_test_log3("%p %p %ld\n",obj1,&(obj1->setB),
-                (long)((char *)&(obj1->setB) - (char *)obj1));
+  xbt_test_log3("%p %p %ld\n", obj1, &(obj1->setB),
+                (long) ((char *) &(obj1->setB) - (char *) obj1));
 
-  setA = xbt_swag_new(xbt_swag_offset(*obj1,setA));
-  setB = xbt_swag_new(xbt_swag_offset(*obj1,setB));
+  setA = xbt_swag_new(xbt_swag_offset(*obj1, setA));
+  setB = xbt_swag_new(xbt_swag_offset(*obj1, setB));
 
   xbt_swag_insert(obj1, setA);
   xbt_swag_insert(obj1, setB);
@@ -262,24 +264,24 @@ XBT_TEST_UNIT("basic",test_swag_basic,"Basic usage") {
   xbt_swag_insert(obj2, setB);
 
   xbt_swag_remove(obj1, setB);
-  /*  xbt_swag_remove(obj2, setB);*/
+  /*  xbt_swag_remove(obj2, setB); */
 
   xbt_test_add0("Traverse set A");
-  xbt_swag_foreach(obj,setA) {
-    xbt_test_log1("Saw: %s",obj->name);
+  xbt_swag_foreach(obj, setA) {
+    xbt_test_log1("Saw: %s", obj->name);
   }
 
   xbt_test_add0("Traverse set B");
-  xbt_swag_foreach(obj,setB) {
-    xbt_test_log1("Saw: %s",obj->name);
+  xbt_swag_foreach(obj, setB) {
+    xbt_test_log1("Saw: %s", obj->name);
   }
 
   xbt_test_add0("Ensure set content and length");
-  xbt_test_assert(  xbt_swag_belongs(obj1,setA));
-  xbt_test_assert(  xbt_swag_belongs(obj2,setA));
+  xbt_test_assert(xbt_swag_belongs(obj1, setA));
+  xbt_test_assert(xbt_swag_belongs(obj2, setA));
 
-  xbt_test_assert(! xbt_swag_belongs(obj1,setB));
-  xbt_test_assert(  xbt_swag_belongs(obj2,setB));
+  xbt_test_assert(!xbt_swag_belongs(obj1, setB));
+  xbt_test_assert(xbt_swag_belongs(obj2, setB));
 
   xbt_test_assert(xbt_swag_size(setA) == 2);
   xbt_test_assert(xbt_swag_size(setB) == 1);
index 42673a9..d969580 100644 (file)
@@ -11,7 +11,8 @@
 #include "xbt/swag.h"
 #include "xbt_context_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_context,xbt,"Context switching mecanism");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_context, xbt,
+                                "Context switching mecanism");
 
 /* the context associated with the current process                             */
 xbt_context_t current_context = NULL;
@@ -138,13 +139,13 @@ xbt_context_new(const char *name,
                 void *startup_arg,
                 void_f_pvoid_t cleanup_func,
                 void *cleanup_arg, int argc, char *argv[]
-)
+  )
 {
   /* use the appropriate context factory to create the appropriate context */
   xbt_context_t context =
     (*(context_factory->create_context)) (name, code, startup_func,
-        startup_arg, cleanup_func,
-        cleanup_arg, argc, argv);
+                                          startup_arg, cleanup_func,
+                                          cleanup_arg, argc, argv);
 
   /* add the context in the list of the contexts in use */
   xbt_swag_insert(context, context_living);
index fdbc2ea..7c75315 100644 (file)
 
 SG_BEGIN_DECL()
 
-typedef struct s_xbt_ctx_java {
-  XBT_CTX_BASE_T;
-  jobject jprocess;        /* the java process instance binded with the msg process structure                                                      */
-  JNIEnv *jenv;            /* jni interface pointer associated to this thread                                                                                      */
-} s_xbt_ctx_java_t, *xbt_ctx_java_t;
+     typedef struct s_xbt_ctx_java {
+       XBT_CTX_BASE_T;
+       jobject jprocess;        /* the java process instance binded with the msg process structure                                                      */
+       JNIEnv *jenv;            /* jni interface pointer associated to this thread                                                                                      */
+     } s_xbt_ctx_java_t, *xbt_ctx_java_t;
 
 SG_END_DECL()
 #endif /* !_XBT_CONTEXT_JAVA_H */
index c95e438..b1842e9 100644 (file)
@@ -19,17 +19,17 @@ SG_BEGIN_DECL()
 /* Context type definition */
 /* *********************** */
 /* the following function pointers describe the interface that all context concepts must implement */
-typedef void (*xbt_pfn_context_free_t) (xbt_context_t);    /* pointer type to the function used to destroy the specified context   */
+     typedef void (*xbt_pfn_context_free_t) (xbt_context_t);    /* pointer type to the function used to destroy the specified context   */
 
-typedef void (*xbt_pfn_context_kill_t) (xbt_context_t);    /* pointer type to the function used to kill the specified context              */
+     typedef void (*xbt_pfn_context_kill_t) (xbt_context_t);    /* pointer type to the function used to kill the specified context              */
 
-typedef void (*xbt_pfn_context_schedule_t) (xbt_context_t);        /* pointer type to the function used to resume the specified context    */
+     typedef void (*xbt_pfn_context_schedule_t) (xbt_context_t);        /* pointer type to the function used to resume the specified context    */
 
-typedef void (*xbt_pfn_context_yield_t) (void);    /* pointer type to the function used to yield the specified context             */
+     typedef void (*xbt_pfn_context_yield_t) (void);    /* pointer type to the function used to yield the specified context             */
 
-typedef void (*xbt_pfn_context_start_t) (xbt_context_t);   /* pointer type to the function used to start the specified context             */
+     typedef void (*xbt_pfn_context_start_t) (xbt_context_t);   /* pointer type to the function used to start the specified context             */
 
-typedef void (*xbt_pfn_context_stop_t) (int);      /* pointer type to the function used to stop the current context                */
+     typedef void (*xbt_pfn_context_stop_t) (int);      /* pointer type to the function used to stop the current context                */
 
 /* each context type must contain this macro at its begining -- OOP in C :/ */
 #define XBT_CTX_BASE_T \
@@ -52,56 +52,56 @@ typedef void (*xbt_pfn_context_stop_t) (int);      /* pointer type to the functi
   xbt_pfn_context_stop_t stop
 
 /* all other context types derive from this structure */
-typedef struct s_xbt_context {
-  XBT_CTX_BASE_T;
-} s_xbt_context_t;
+     typedef struct s_xbt_context {
+       XBT_CTX_BASE_T;
+     } s_xbt_context_t;
 
 /* ****************** */
 /* Globals definition */
 /* ****************** */
 
 /* Important guys */
-extern xbt_context_t current_context;
+     extern xbt_context_t current_context;
 
-extern xbt_context_t maestro_context;
+     extern xbt_context_t maestro_context;
 
 /* All dudes lists */
-extern xbt_swag_t context_living;
+     extern xbt_swag_t context_living;
 
-extern xbt_swag_t context_to_destroy;
+     extern xbt_swag_t context_to_destroy;
 
 /* *********************** */
 /* factory type definition */
 /* *********************** */
-typedef struct s_xbt_context_factory *xbt_context_factory_t;
+     typedef struct s_xbt_context_factory *xbt_context_factory_t;
 
 /* this function describes the interface that all context factory must implement */
-typedef xbt_context_t(*xbt_pfn_context_factory_create_context_t) (const
-    char *,
-    xbt_main_func_t,
-    void_f_pvoid_t,
-    void *,
-    void_f_pvoid_t,
-    void *,
-    int,
-    char
-    **);
-typedef
-int (*xbt_pfn_context_factory_create_maestro_context_t) (xbt_context_t
-    *);
+     typedef xbt_context_t(*xbt_pfn_context_factory_create_context_t) (const
+                                                                       char *,
+                                                                       xbt_main_func_t,
+                                                                       void_f_pvoid_t,
+                                                                       void *,
+                                                                       void_f_pvoid_t,
+                                                                       void *,
+                                                                       int,
+                                                                       char
+                                                                       **);
+     typedef
+     int (*xbt_pfn_context_factory_create_maestro_context_t) (xbt_context_t
+                                                              *);
 
 /* this function finalize the specified context factory */
-typedef int (*xbt_pfn_context_factory_finalize_t) (xbt_context_factory_t
-    *);
+     typedef int (*xbt_pfn_context_factory_finalize_t) (xbt_context_factory_t
+                                                        *);
 
 /* this interface is used by the xbt context module to create the appropriate concept */
-typedef struct s_xbt_context_factory {
-  xbt_pfn_context_factory_create_maestro_context_t create_maestro_context; /* create the context of the maestro    */
-  xbt_pfn_context_factory_create_context_t create_context; /* create a new context                 */
-  xbt_pfn_context_factory_finalize_t finalize;     /* finalize the context factory         */
-  const char *name;        /* the name of the context factory      */
+     typedef struct s_xbt_context_factory {
+       xbt_pfn_context_factory_create_maestro_context_t create_maestro_context; /* create the context of the maestro    */
+       xbt_pfn_context_factory_create_context_t create_context; /* create a new context                 */
+       xbt_pfn_context_factory_finalize_t finalize;     /* finalize the context factory         */
+       const char *name;        /* the name of the context factory      */
 
-} s_xbt_context_factory_t;
+     } s_xbt_context_factory_t;
 
 /**
  * This function select a context factory associated with the name specified by
@@ -109,27 +109,29 @@ typedef struct s_xbt_context_factory {
  * If successful the function returns 0. Otherwise the function returns the error
  * code.
  */
-int
-xbt_context_select_factory(const char *name);
+     int
+       xbt_context_select_factory(const char *name);
 
 /**
  * This function initialize a context factory from the name specified by the parameter
  * name.
  * If the factory cannot be found, an exception is raised.
  */
-void
+     void
 
 
-xbt_context_init_factory_by_name(xbt_context_factory_t * factory,
-                                 const char *name);
+
+      
+       xbt_context_init_factory_by_name(xbt_context_factory_t * factory,
+                                        const char *name);
 
 
 /* All factories init */
-void xbt_ctx_thread_factory_init(xbt_context_factory_t * factory);
+     void xbt_ctx_thread_factory_init(xbt_context_factory_t * factory);
 
-void xbt_ctx_sysv_factory_init(xbt_context_factory_t * factory);
+     void xbt_ctx_sysv_factory_init(xbt_context_factory_t * factory);
 
-void xbt_ctx_java_factory_init(xbt_context_factory_t * factory);
+     void xbt_ctx_java_factory_init(xbt_context_factory_t * factory);
 
 
 
index 1823d10..d90bd8f 100644 (file)
 extern const char *xbt_log_priority_names[7];
 
 
-static void append_file(xbt_log_appender_t this_appender, char *str) {
-  fprintf((FILE*)(this_appender->data), "%s", str);
+static void append_file(xbt_log_appender_t this_appender, char *str)
+{
+  fprintf((FILE *) (this_appender->data), "%s", str);
 }
 
-static void free_ (xbt_log_appender_t this_) {
-       if (this_->data != stderr)
-               fclose(this_->data);
+static void free_(xbt_log_appender_t this_)
+{
+  if (this_->data != stderr)
+    fclose(this_->data);
 }
 
 
 
-xbt_log_appender_t xbt_log_appender_file_new(char *arg){
-  xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t,1);
+xbt_log_appender_t xbt_log_appender_file_new(char *arg)
+{
+  xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t, 1);
   res->do_append = append_file;
   res->free_ = free_;
   if (arg)
-         res->data = (void*)fopen(arg, "w");
+    res->data = (void *) fopen(arg, "w");
   else
-         res->data = (void*)stderr;
+    res->data = (void *) stderr;
   return res;
 }
index b312bb8..9936400 100644 (file)
@@ -7,12 +7,12 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "portable.h" /* execinfo when available */
+#include "portable.h"           /* execinfo when available */
 #include "xbt/sysdep.h"
 #include "xbt/strbuff.h"
 #include "xbt/log_private.h"
-#include "gras/virtu.h" /* gras_os_myname (KILLME) */
-#include "xbt/synchro.h" /* xbt_thread_self_name */
+#include "gras/virtu.h"         /* gras_os_myname (KILLME) */
+#include "xbt/synchro.h"        /* xbt_thread_self_name */
 #include <stdio.h>
 
 extern const char *xbt_log_priority_names[7];
@@ -49,124 +49,126 @@ static double begin_of_time = -1;
 
 static void xbt_log_layout_format_dynamic(xbt_log_layout_t l,
                                           xbt_log_event_t ev,
-                                          const char*fmt,
-                                          xbt_log_appender_t app) {
+                                          const char *fmt,
+                                          xbt_log_appender_t app)
+{
   xbt_strbuff_t buff = xbt_strbuff_new();
-  int precision=-1;
+  int precision = -1;
   char *q = l->data;
   char *tmp;
   char *tmp2;
-  int vres; /* shut gcc up, but ignored */
+  int vres;                     /* shut gcc up, but ignored */
 
   while (*q != '\0') {
     if (*q == '%') {
       q++;
-      handle_modifier:
+    handle_modifier:
       switch (*q) {
-        case '\0':
-          fprintf(stderr,"Layout format (%s) ending with %%\n",(char*)l->data);
-          abort();
-        case '%':
-          xbt_strbuff_append(buff,"%");
-          break;
-        case 'n': /* platform-dependant line separator (LOG4J compliant) */
-          xbt_strbuff_append(buff,"\n");
-          break;
-        case 'e': /* plain space (SimGrid extension) */
-          xbt_strbuff_append(buff," ");
-          break;
-
-        case '.': /* precision specifyier */
-          q++;
-          q += sscanf(q,"%d",&precision);
-          goto handle_modifier;
-
-        case 'c': /* category name; LOG4J compliant
-                  should accept a precision postfix to show the hierarchy */
-          append1("%s","%.*s",ev->cat->name);
-          break;
-        case 'p': /* priority name; LOG4J compliant */
-          append1("%s","%.*s",xbt_log_priority_names[ev->priority]);
-          break;
-
-        case 'h': /* host name; SimGrid extension */
-          append1("%s","%.*s",gras_os_myname());
-          break;
-        case 't': /* thread name; LOG4J compliant */
-          append1("%s","%.*s",xbt_thread_self_name());
-          break;
-        case 'P': /* process name; SimGrid extension */
-          append1("%s","%.*s",xbt_procname());
-          break;
-        case 'i': /* process PID name; SimGrid extension */
-          append1("%d","%.*d",(*xbt_getpid)());
-          break;
-
-        case 'F': /* file name; LOG4J compliant */
-          append1("%s","%.*s",ev->fileName);
-          break;
-        case 'l': /* location; LOG4J compliant */
-          append2("%s:%d",ev->fileName,ev->lineNum);
-          precision = -1; /* Ignored */
-          break;
-        case 'L': /* line number; LOG4J compliant */
-          append1("%d","%.*d",ev->lineNum);
-          break;
-        case 'M': /* method (ie, function) name; LOG4J compliant */
-          append1("%s","%.*s",ev->functionName);
-          break;
-        case 'b': /* backtrace; called %throwable in LOG4J */
-        case 'B': /* short backtrace; called %throwable{short} in LOG4J */
+      case '\0':
+        fprintf(stderr, "Layout format (%s) ending with %%\n",
+                (char *) l->data);
+        abort();
+      case '%':
+        xbt_strbuff_append(buff, "%");
+        break;
+      case 'n':                /* platform-dependant line separator (LOG4J compliant) */
+        xbt_strbuff_append(buff, "\n");
+        break;
+      case 'e':                /* plain space (SimGrid extension) */
+        xbt_strbuff_append(buff, " ");
+        break;
+
+      case '.':                /* precision specifyier */
+        q++;
+        q += sscanf(q, "%d", &precision);
+        goto handle_modifier;
+
+      case 'c':                /* category name; LOG4J compliant
+                                   should accept a precision postfix to show the hierarchy */
+        append1("%s", "%.*s", ev->cat->name);
+        break;
+      case 'p':                /* priority name; LOG4J compliant */
+        append1("%s", "%.*s", xbt_log_priority_names[ev->priority]);
+        break;
+
+      case 'h':                /* host name; SimGrid extension */
+        append1("%s", "%.*s", gras_os_myname());
+        break;
+      case 't':                /* thread name; LOG4J compliant */
+        append1("%s", "%.*s", xbt_thread_self_name());
+        break;
+      case 'P':                /* process name; SimGrid extension */
+        append1("%s", "%.*s", xbt_procname());
+        break;
+      case 'i':                /* process PID name; SimGrid extension */
+        append1("%d", "%.*d", (*xbt_getpid) ());
+        break;
+
+      case 'F':                /* file name; LOG4J compliant */
+        append1("%s", "%.*s", ev->fileName);
+        break;
+      case 'l':                /* location; LOG4J compliant */
+        append2("%s:%d", ev->fileName, ev->lineNum);
+        precision = -1;         /* Ignored */
+        break;
+      case 'L':                /* line number; LOG4J compliant */
+        append1("%d", "%.*d", ev->lineNum);
+        break;
+      case 'M':                /* method (ie, function) name; LOG4J compliant */
+        append1("%s", "%.*s", ev->functionName);
+        break;
+      case 'b':                /* backtrace; called %throwable in LOG4J */
+      case 'B':                /* short backtrace; called %throwable{short} in LOG4J */
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
         {
           xbt_ex_t e;
           int i;
 
-          e.used     = backtrace((void**)e.bt,XBT_BACKTRACE_SIZE);
+          e.used = backtrace((void **) e.bt, XBT_BACKTRACE_SIZE);
           e.bt_strings = NULL;
-          e.msg=NULL;
-          e.remote=0;
+          e.msg = NULL;
+          e.remote = 0;
           xbt_backtrace_current(&e);
-          if (*q=='B') {
-            append1("%s","%.*s",e.bt_strings[2]+8);
+          if (*q == 'B') {
+            append1("%s", "%.*s", e.bt_strings[2] + 8);
           } else {
-            for (i=2; i<e.used; i++)
-              append1("%s\n","%.*s\n",e.bt_strings[i]+8);
+            for (i = 2; i < e.used; i++)
+              append1("%s\n", "%.*s\n", e.bt_strings[i] + 8);
           }
 
           xbt_ex_free(e);
         }
 #else
-        append1("%s","%.*s","(no backtrace on this arch)");
+        append1("%s", "%.*s", "(no backtrace on this arch)");
 #endif
         break;
 
-        case 'd': /* date; LOG4J compliant */
-          append1("%f","%.*f", gras_os_time());
-          break;
-        case 'r': /* application age; LOG4J compliant */
-          append1("%f","%.*f", gras_os_time()-begin_of_time);
-          break;
+      case 'd':                /* date; LOG4J compliant */
+        append1("%f", "%.*f", gras_os_time());
+        break;
+      case 'r':                /* application age; LOG4J compliant */
+        append1("%f", "%.*f", gras_os_time() - begin_of_time);
+        break;
 
-        case 'm': /* user-provided message; LOG4J compliant */
-          vres = vasprintf(&tmp2, fmt, ev->ap_copy);
-          append1("%s","%.*s",tmp2);
-          free(tmp2);
-          break;
+      case 'm':                /* user-provided message; LOG4J compliant */
+        vres = vasprintf(&tmp2, fmt, ev->ap_copy);
+        append1("%s", "%.*s", tmp2);
+        free(tmp2);
+        break;
 
-        default:
-          fprintf(stderr,ERRMSG, *q,(char*)l->data);
-          abort();
+      default:
+        fprintf(stderr, ERRMSG, *q, (char *) l->data);
+        abort();
       }
       q++;
     } else {
       char tmp2[2];
       tmp2[0] = *(q++);
       tmp2[1] = '\0';
-      xbt_strbuff_append(buff,tmp2);
+      xbt_strbuff_append(buff, tmp2);
     }
   }
-  app->do_append(app,buff->data);
+  app->do_append(app, buff->data);
   xbt_strbuff_free(buff);
 }
 
@@ -178,12 +180,13 @@ static void xbt_log_layout_format_dynamic(xbt_log_layout_t l,
 static void xbt_log_layout_format_doit(xbt_log_layout_t l,
                                        xbt_log_event_t ev,
                                        const char *msg_fmt,
-                                       xbt_log_appender_t app) {
-  char *p,*q;
-  int precision=-1;
+                                       xbt_log_appender_t app)
+{
+  char *p, *q;
+  int precision = -1;
 
-  if (begin_of_time<0)
-    begin_of_time=gras_os_time();
+  if (begin_of_time < 0)
+    begin_of_time = gras_os_time();
 
   p = ev->buffer;
   q = l->data;
@@ -191,159 +194,222 @@ static void xbt_log_layout_format_doit(xbt_log_layout_t l,
   while (*q != '\0') {
     if (*q == '%') {
       q++;
-      handle_modifier:
+    handle_modifier:
       switch (*q) {
-        case '\0':
-          fprintf(stderr,"Layout format (%s) ending with %%\n",(char*)l->data);
-          abort();
-        case '%':
-          *p++ = '%';
-          break;
-        case 'n': /* platform-dependant line separator (LOG4J compliant) */
-          p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"\n");
+      case '\0':
+        fprintf(stderr, "Layout format (%s) ending with %%\n",
+                (char *) l->data);
+        abort();
+      case '%':
+        *p++ = '%';
+        break;
+      case 'n':                /* platform-dependant line separator (LOG4J compliant) */
+        p += snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "\n");
+        check_overflow;
+        break;
+      case 'e':                /* plain space (SimGrid extension) */
+        p += snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), " ");
+        check_overflow;
+        break;
+
+      case '.':                /* precision specifyier */
+        q++;
+        q += sscanf(q, "%d", &precision);
+        goto handle_modifier;
+
+      case 'c':                /* category name; LOG4J compliant
+                                   should accept a precision postfix to show the hierarchy */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     ev->cat->name);
           check_overflow;
-          break;
-        case 'e': /* plain space (SimGrid extension) */
-          p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer)," ");
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), ev->cat->name);
           check_overflow;
-          break;
-
-        case '.': /* precision specifyier */
-          q++;
-          q += sscanf(q,"%d",&precision);
-          goto handle_modifier;
-
-        case 'c': /* category name; LOG4J compliant
-                  should accept a precision postfix to show the hierarchy */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%s",ev->cat->name);
-            check_overflow;
-          } else {
-            p += sprintf(p,"%.*s",(int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision),ev->cat->name);
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'p': /* priority name; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s", xbt_log_priority_names[ev->priority] );
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*s", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), xbt_log_priority_names[ev->priority] );
-            check_overflow;
-            precision = -1;
-          }
-          break;
+          precision = -1;
+        }
+        break;
+      case 'p':                /* priority name; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     xbt_log_priority_names[ev->priority]);
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision),
+                    xbt_log_priority_names[ev->priority]);
+          check_overflow;
+          precision = -1;
+        }
+        break;
 
-        case 'h': /* host name; SimGrid extension */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s", gras_os_myname());
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*s", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), gras_os_myname());
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 't': /* thread name; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s", xbt_thread_self_name());
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*s", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), xbt_thread_self_name());
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'P': /* process name; SimGrid extension */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s", xbt_procname());
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*s", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision),xbt_procname());
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'i': /* process PID name; SimGrid extension */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%d", (*xbt_getpid)());
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*d", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), (*xbt_getpid)());
-            check_overflow;
-            precision = -1;
-          }
-          break;
+      case 'h':                /* host name; SimGrid extension */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     gras_os_myname());
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), gras_os_myname());
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 't':                /* thread name; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     xbt_thread_self_name());
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), xbt_thread_self_name());
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'P':                /* process name; SimGrid extension */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     xbt_procname());
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), xbt_procname());
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'i':                /* process PID name; SimGrid extension */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%d",
+                     (*xbt_getpid) ());
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*d",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), (*xbt_getpid) ());
+          check_overflow;
+          precision = -1;
+        }
+        break;
 
-        case 'F': /* file name; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%s",ev->fileName);
-            check_overflow;
-          } else {
-            p += sprintf(p,"%.*s",(int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), ev->fileName);
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'l': /* location; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s:%d", ev->fileName, ev->lineNum);
-            check_overflow;
-          } else {
-            p += snprintf(p, (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), "%s:%d", ev->fileName, ev->lineNum);
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'L': /* line number; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%d", ev->lineNum);
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*d", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), ev->lineNum);
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'M': /* method (ie, function) name; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s", ev->functionName);
-            check_overflow;
-          } else {
-            p += sprintf(p, "%.*s", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), ev->functionName);
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'b': /* backtrace; called %throwable in LOG4J */
-        case 'B': /* short backtrace; called %throwable{short} in LOG4J */
+      case 'F':                /* file name; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     ev->fileName);
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), ev->fileName);
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'l':                /* location; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s:%d",
+                     ev->fileName, ev->lineNum);
+          check_overflow;
+        } else {
+          p +=
+            snprintf(p,
+                     (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                               precision), "%s:%d", ev->fileName,
+                     ev->lineNum);
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'L':                /* line number; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%d",
+                     ev->lineNum);
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*d",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), ev->lineNum);
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'M':                /* method (ie, function) name; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                     ev->functionName);
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*s",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), ev->functionName);
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'b':                /* backtrace; called %throwable in LOG4J */
+      case 'B':                /* short backtrace; called %throwable{short} in LOG4J */
 #if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
         {
           xbt_ex_t e;
           int i;
 
-          e.used     = backtrace((void**)e.bt,XBT_BACKTRACE_SIZE);
+          e.used = backtrace((void **) e.bt, XBT_BACKTRACE_SIZE);
           e.bt_strings = NULL;
-          e.msg=NULL;
-          e.remote=0;
+          e.msg = NULL;
+          e.remote = 0;
           xbt_backtrace_current(&e);
-          if (*q=='B') {
+          if (*q == 'B') {
             if (precision == -1) {
-              p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%s",e.bt_strings[2]+8);
+              p +=
+                snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s",
+                         e.bt_strings[2] + 8);
               check_overflow;
             } else {
-              p += sprintf(p,"%.*s",(int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), e.bt_strings[2]+8);
+              p +=
+                sprintf(p, "%.*s",
+                        (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                                  precision), e.bt_strings[2] + 8);
               check_overflow;
               precision = -1;
             }
           } else {
-            for (i=2; i<e.used; i++)
+            for (i = 2; i < e.used; i++)
               if (precision == -1) {
-                p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%s\n",e.bt_strings[i]+8);
+                p +=
+                  snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s\n",
+                           e.bt_strings[i] + 8);
                 check_overflow;
               } else {
-                p += sprintf(p,"%.*s\n",(int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision),e.bt_strings[i]+8);
+                p +=
+                  sprintf(p, "%.*s\n",
+                          (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                                    precision), e.bt_strings[i] + 8);
                 check_overflow;
                 precision = -1;
               }
@@ -352,46 +418,63 @@ static void xbt_log_layout_format_doit(xbt_log_layout_t l,
           xbt_ex_free(e);
         }
 #else
-        p+=snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"(no backtrace on this arch)");
+        p +=
+          snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                   "(no backtrace on this arch)");
         check_overflow;
 #endif
         break;
 
-        case 'd': /* date; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%f", gras_os_time());
-            check_overflow;
-          } else {
-            p += sprintf(p,"%.*f", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), gras_os_time());
-            check_overflow;
-            precision = -1;
-          }
-          break;
-        case 'r': /* application age; LOG4J compliant */
-          if (precision == -1) {
-            p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%f", gras_os_time()-begin_of_time);
-            check_overflow;
-          } else {
-            p += sprintf(p,"%.*f", (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), gras_os_time()-begin_of_time);
-            check_overflow;
-            precision = -1;
-          }
-          break;
+      case 'd':                /* date; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%f",
+                     gras_os_time());
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*f",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), gras_os_time());
+          check_overflow;
+          precision = -1;
+        }
+        break;
+      case 'r':                /* application age; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%f",
+                     gras_os_time() - begin_of_time);
+          check_overflow;
+        } else {
+          p +=
+            sprintf(p, "%.*f",
+                    (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                              precision), gras_os_time() - begin_of_time);
+          check_overflow;
+          precision = -1;
+        }
+        break;
 
-        case 'm': /* user-provided message; LOG4J compliant */
-          if (precision == -1) {
-            p += vsnprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), msg_fmt, ev->ap);
-            check_overflow;
-          } else {
-            p += vsnprintf(p, (int)MIN(XBT_LOG_BUFF_SIZE-(p-ev->buffer),precision), msg_fmt, ev->ap);
-            check_overflow;
-            precision = -1;
-          }
-          break;
+      case 'm':                /* user-provided message; LOG4J compliant */
+        if (precision == -1) {
+          p +=
+            vsnprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), msg_fmt,
+                      ev->ap);
+          check_overflow;
+        } else {
+          p +=
+            vsnprintf(p,
+                      (int) MIN(XBT_LOG_BUFF_SIZE - (p - ev->buffer),
+                                precision), msg_fmt, ev->ap);
+          check_overflow;
+          precision = -1;
+        }
+        break;
 
-        default:
-          fprintf(stderr,ERRMSG,*q,(char*)l->data);
-          abort();
+      default:
+        fprintf(stderr, ERRMSG, *q, (char *) l->data);
+        abort();
       }
       q++;
     } else {
@@ -400,16 +483,19 @@ static void xbt_log_layout_format_doit(xbt_log_layout_t l,
     }
   }
   *p = '\0';
-  app->do_append(app,ev->buffer);
+  app->do_append(app, ev->buffer);
 }
 
-static void xbt_log_layout_format_free(xbt_log_layout_t lay) {
+static void xbt_log_layout_format_free(xbt_log_layout_t lay)
+{
   free(lay->data);
 }
-xbt_log_layout_t xbt_log_layout_format_new(char *arg) {
-  xbt_log_layout_t res = xbt_new0(s_xbt_log_layout_t,1);
+
+xbt_log_layout_t xbt_log_layout_format_new(char *arg)
+{
+  xbt_log_layout_t res = xbt_new0(s_xbt_log_layout_t, 1);
   res->do_layout = xbt_log_layout_format_doit;
-  res->free_     = xbt_log_layout_format_free;
-  res->data = xbt_strdup((char*)arg);
+  res->free_ = xbt_log_layout_format_free;
+  res->data = xbt_strdup((char *) arg);
   return res;
 }
index 17e18b8..77f6f09 100644 (file)
@@ -8,9 +8,9 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/sysdep.h"
-#include "xbt/strbuff.h" /* For dynamic version when the static one fails */
+#include "xbt/strbuff.h"        /* For dynamic version when the static one fails */
 #include "xbt/log_private.h"
-#include "xbt/synchro.h" /* xbt_thread_name */
+#include "xbt/synchro.h"        /* xbt_thread_name */
 
 #include "gras/virtu.h"
 #include <stdio.h>
@@ -22,34 +22,40 @@ static double begin_of_time = -1;
 
 static void xbt_log_layout_simple_dynamic(xbt_log_layout_t l,
                                           xbt_log_event_t ev,
-                                          const char*fmt,
-                                          xbt_log_appender_t app) {
+                                          const char *fmt,
+                                          xbt_log_appender_t app)
+{
   xbt_strbuff_t buff = xbt_strbuff_new();
   char loc_buff[256];
   char *p;
 
   /* Put every static information in a static buffer, and copy them in the dyn one */
   p = loc_buff;
-  p += snprintf(p,256-(p-ev->buffer),"[");
-
-  if(strlen(xbt_procname()))
-    p += snprintf(p,256-(p-ev->buffer),"%s:%s:(%d) ",
-                  gras_os_myname(), xbt_procname(),(*xbt_getpid)());
-  p += snprintf(p,256-(p-ev->buffer),"%f] ", gras_os_time()-begin_of_time);
+  p += snprintf(p, 256 - (p - ev->buffer), "[");
+
+  if (strlen(xbt_procname()))
+    p += snprintf(p, 256 - (p - ev->buffer), "%s:%s:(%d) ",
+                  gras_os_myname(), xbt_procname(), (*xbt_getpid) ());
+  p +=
+    snprintf(p, 256 - (p - ev->buffer), "%f] ",
+             gras_os_time() - begin_of_time);
   if (ev->priority != xbt_log_priority_info)
-    p += snprintf(p,256-(p-ev->buffer), "%s:%d: ", ev->fileName, ev->lineNum);
-  p += snprintf(p,256-(p-ev->buffer), "[%s/%s] ",
-                ev->cat->name, xbt_log_priority_names[ev->priority] );
+    p +=
+      snprintf(p, 256 - (p - ev->buffer), "%s:%d: ", ev->fileName,
+               ev->lineNum);
+  p +=
+    snprintf(p, 256 - (p - ev->buffer), "[%s/%s] ", ev->cat->name,
+             xbt_log_priority_names[ev->priority]);
 
-  xbt_strbuff_append(buff,loc_buff);
+  xbt_strbuff_append(buff, loc_buff);
 
-  vasprintf(&p,fmt,ev->ap_copy);
-  xbt_strbuff_append(buff,p);
+  vasprintf(&p, fmt, ev->ap_copy);
+  xbt_strbuff_append(buff, p);
   free(p);
 
-  xbt_strbuff_append(buff,"\n");
+  xbt_strbuff_append(buff, "\n");
 
-  app->do_append(app,buff->data);
+  app->do_append(app, buff->data);
   xbt_strbuff_free(buff);
 }
 
@@ -63,53 +69,59 @@ static void xbt_log_layout_simple_dynamic(xbt_log_layout_t l,
 static void xbt_log_layout_simple_doit(xbt_log_layout_t l,
                                        xbt_log_event_t ev,
                                        const char *fmt,
-                                       xbt_log_appender_t app) {
+                                       xbt_log_appender_t app)
+{
   char *p;
 
-  xbt_assert0(ev->priority>=0,
+  xbt_assert0(ev->priority >= 0,
               "Negative logging priority naturally forbidden");
-  xbt_assert1(ev->priority<sizeof(xbt_log_priority_names),
+  xbt_assert1(ev->priority < sizeof(xbt_log_priority_names),
               "Priority %d is greater than the biggest allowed value",
               ev->priority);
 
-  if (begin_of_time<0)
-    begin_of_time=gras_os_time();
+  if (begin_of_time < 0)
+    begin_of_time = gras_os_time();
 
   p = ev->buffer;
-  p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"[");
+  p += snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "[");
   check_overflow;
 
   /* Display the proc info if available */
-  if(strlen(xbt_procname())) {
-    p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%s:%s:(%d) ",
-                  gras_os_myname(), xbt_procname(),(*xbt_getpid)());
+  if (strlen(xbt_procname())) {
+    p += snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s:%s:(%d) ",
+                  gras_os_myname(), xbt_procname(), (*xbt_getpid) ());
     check_overflow;
   }
 
   /* Display the date */
-  p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer),"%f] ", gras_os_time()-begin_of_time);
+  p +=
+    snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%f] ",
+             gras_os_time() - begin_of_time);
   check_overflow;
 
-  /* Display file position if not INFO*/
+  /* Display file position if not INFO */
   if (ev->priority != xbt_log_priority_info)
-    p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "%s:%d: ", ev->fileName, ev->lineNum);
+    p +=
+      snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s:%d: ",
+               ev->fileName, ev->lineNum);
 
   /* Display category name */
-  p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "[%s/%s] ",
-                ev->cat->name, xbt_log_priority_names[ev->priority] );
+  p += snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "[%s/%s] ",
+                ev->cat->name, xbt_log_priority_names[ev->priority]);
 
   /* Display user-provided message */
-  p += vsnprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), fmt, ev->ap);
+  p += vsnprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), fmt, ev->ap);
   check_overflow;
 
   /* End it */
-  p += snprintf(p,XBT_LOG_BUFF_SIZE-(p-ev->buffer), "\n");
+  p += snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "\n");
   check_overflow;
-  app->do_append(app,ev->buffer);
+  app->do_append(app, ev->buffer);
 }
 
-xbt_log_layout_t xbt_log_layout_simple_new(char *arg) {
-  xbt_log_layout_t res = xbt_new0(s_xbt_log_layout_t,1);
+xbt_log_layout_t xbt_log_layout_simple_new(char *arg)
+{
+  xbt_log_layout_t res = xbt_new0(s_xbt_log_layout_t, 1);
   res->do_layout = xbt_log_layout_simple_doit;
   return res;
 }
index 54c9ac6..a533533 100644 (file)
@@ -7,21 +7,21 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "time.h" /* to seed the random generator */
+#include "time.h"               /* to seed the random generator */
 
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dynar.h"
 #include "xbt/config.h"
 
-#include "xbt/module.h" /* this module */
+#include "xbt/module.h"         /* this module */
 
-#include "xbt_modinter.h"  /* prototype of other module's init/exit in XBT */
+#include "xbt_modinter.h"       /* prototype of other module's init/exit in XBT */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
 
-char *xbt_binary_name=NULL; /* Mandatory to retrieve neat backtraces */
-int xbt_initialized=0;
+char *xbt_binary_name = NULL;   /* Mandatory to retrieve neat backtraces */
+int xbt_initialized = 0;
 
 XBT_LOG_EXTERNAL_CATEGORY(graphxml_parse);
 XBT_LOG_EXTERNAL_CATEGORY(log);
@@ -47,11 +47,11 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_set);
 XBT_LOG_EXTERNAL_CATEGORY(xbt_sync_os);
 
 /** @brief Initialize the xbt mechanisms. */
-void
-xbt_init(int *argc, char **argv) {
+void xbt_init(int *argc, char **argv)
+{
   xbt_initialized++;
 
-  if (xbt_initialized!=1)
+  if (xbt_initialized != 1)
     return;
 
   /* Connect our log channels: that must be done manually under windows */
@@ -79,18 +79,18 @@ xbt_init(int *argc, char **argv) {
   XBT_LOG_CONNECT(xbt_sync_os, xbt);
 
   xbt_binary_name = xbt_strdup(argv[0]);
-  srand((unsigned int)time(NULL));
+  srand((unsigned int) time(NULL));
   VERB0("Initialize XBT");
 
   xbt_backtrace_init();
-  xbt_log_init(argc,argv);
+  xbt_log_init(argc, argv);
   xbt_os_thread_mod_init();
   xbt_context_mod_init();
 }
 
 /** @brief Finalize the xbt mechanisms. */
-void
-xbt_exit(){
+void xbt_exit()
+{
   xbt_initialized--;
   if (xbt_initialized == 0) {
     xbt_fifo_exit();
@@ -106,12 +106,13 @@ xbt_exit(){
 
 /* these two functions belong to xbt/sysdep.h, which have no corresponding .c file */
 /** @brief like free, but you can be sure that it is a function  */
-XBT_PUBLIC(void) xbt_free_f(void* p) {
+XBT_PUBLIC(void) xbt_free_f(void *p)
+{
   free(p);
 }
 
 /** @brief should be given a pointer to pointer, and frees the second one */
-XBT_PUBLIC(void) xbt_free_ref(void *d){
-  free(*(void**)d);
+XBT_PUBLIC(void) xbt_free_ref(void *d)
+{
+  free(*(void **) d);
 }
-
index 32a28af..a9e13df 100644 (file)
 #include "xbt/log.h"
 #include "xbt/matrix.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_matrix,xbt,"2D data storage");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_matrix, xbt, "2D data storage");
 
 /** \brief constructor */
 xbt_matrix_t xbt_matrix_new(int lines, int rows,
                             const unsigned long elmsize,
-                            void_f_pvoid_t const free_f)  {
-  xbt_matrix_t res=xbt_new(s_xbt_matrix_t, 1);
-  res->lines   = lines;
-  res->rows    = rows;
+                            void_f_pvoid_t const free_f)
+{
+  xbt_matrix_t res = xbt_new(s_xbt_matrix_t, 1);
+  res->lines = lines;
+  res->rows = rows;
   res->elmsize = elmsize;
-  res->free_f  = free_f;
-  res->data    = xbt_malloc(elmsize*lines*rows);
+  res->free_f = free_f;
+  res->data = xbt_malloc(elmsize * lines * rows);
   return res;
 }
 
@@ -31,21 +32,23 @@ xbt_matrix_t xbt_matrix_new(int lines, int rows,
 xbt_matrix_t xbt_matrix_new_sub(xbt_matrix_t from,
                                 int lsize, int rsize,
                                 int lpos, int rpos,
-                                pvoid_f_pvoid_t const cpy_f) {
+                                pvoid_f_pvoid_t const cpy_f)
+{
 
-  xbt_matrix_t res=xbt_matrix_new(lsize,rsize,
-                                  from->elmsize, from->free_f);
-  xbt_matrix_copy_values(res,from,lsize,rsize,0,0,lpos,rpos,cpy_f);
+  xbt_matrix_t res = xbt_matrix_new(lsize, rsize,
+                                    from->elmsize, from->free_f);
+  xbt_matrix_copy_values(res, from, lsize, rsize, 0, 0, lpos, rpos, cpy_f);
   return res;
 }
 
 /** \brief destructor */
-void xbt_matrix_free(xbt_matrix_t mat) {
+void xbt_matrix_free(xbt_matrix_t mat)
+{
   unsigned int i;
   if (mat) {
     if (mat->free_f) {
-      for (i=0; i < (mat->lines * mat->rows) ; i++) {
-        (*(mat->free_f))( (void*)& (mat->data[i*mat->elmsize]) );
+      for (i = 0; i < (mat->lines * mat->rows); i++) {
+        (*(mat->free_f)) ((void *) &(mat->data[i * mat->elmsize]));
       }
     }
     free(mat->data);
@@ -54,35 +57,40 @@ void xbt_matrix_free(xbt_matrix_t mat) {
 }
 
 /** \brief Freeing function for containers of xbt_matrix_t */
-void xbt_matrix_free_voidp(void *d) {
-  xbt_matrix_free( (xbt_matrix_t) *(void**)d );
+void xbt_matrix_free_voidp(void *d)
+{
+  xbt_matrix_free((xbt_matrix_t) * (void **) d);
 }
 
 
 /** \brief Display the content of a matrix (debugging purpose)
  *  \param coords: boolean indicating whether we should add the coords of each cell to the output*/
-void xbt_matrix_dump(xbt_matrix_t matrix, const char*name, int coords,
-                     void_f_pvoid_t display_fun) {
-  unsigned int i,j;
-
-  fprintf(stderr,">>> Matrix %s dump (%d x %d)\n",name,matrix->lines,matrix->rows);
-  for (i=0; i<matrix->lines; i++) {
-    fprintf(stderr,"  ");
-    for (j=0; j<matrix->rows; j++) {
+void xbt_matrix_dump(xbt_matrix_t matrix, const char *name, int coords,
+                     void_f_pvoid_t display_fun)
+{
+  unsigned int i, j;
+
+  fprintf(stderr, ">>> Matrix %s dump (%d x %d)\n", name, matrix->lines,
+          matrix->rows);
+  for (i = 0; i < matrix->lines; i++) {
+    fprintf(stderr, "  ");
+    for (j = 0; j < matrix->rows; j++) {
       if (coords)
-        fprintf(stderr," (%d,%d)=",i,j);
+        fprintf(stderr, " (%d,%d)=", i, j);
       else
-        fprintf(stderr," ");
-      (*display_fun)(xbt_matrix_get_ptr(matrix,i,j));
+        fprintf(stderr, " ");
+      (*display_fun) (xbt_matrix_get_ptr(matrix, i, j));
     }
-    fprintf(stderr,"\n");
+    fprintf(stderr, "\n");
   }
-  fprintf(stderr,"<<< end_of_matrix %s dump\n",name);
+  fprintf(stderr, "<<< end_of_matrix %s dump\n", name);
 }
 
-void xbt_matrix_dump_display_double(void*d) {
-  fprintf(stderr,"%.2f",*(double*)d);
+void xbt_matrix_dump_display_double(void *d)
+{
+  fprintf(stderr, "%.2f", *(double *) d);
 }
+
 /** \brief Copy the values from the matrix src into the matrix dst
  * \param dest: destination
  * \param src: source
@@ -95,102 +103,109 @@ void xbt_matrix_dump_display_double(void*d) {
  */
 void xbt_matrix_copy_values(xbt_matrix_t dst, xbt_matrix_t src,
                             unsigned int lsize, unsigned int rsize,
-                            unsigned int lpos_dst,unsigned int rpos_dst,
-                            unsigned int lpos_src,unsigned int rpos_src,
-                            pvoid_f_pvoid_t const cpy_f) {
-  unsigned int i,j;
+                            unsigned int lpos_dst, unsigned int rpos_dst,
+                            unsigned int lpos_src, unsigned int rpos_src,
+                            pvoid_f_pvoid_t const cpy_f)
+{
+  unsigned int i, j;
 
   DEBUG10("Copy a %dx%d submatrix from %dx%d(of %dx%d) to %dx%d (of %dx%d)",
-          lsize,rsize,
-          lpos_src,rpos_src,src->lines,src->rows,
-          lpos_dst,rpos_dst,dst->lines,dst->rows);
+          lsize, rsize,
+          lpos_src, rpos_src, src->lines, src->rows,
+          lpos_dst, rpos_dst, dst->lines, dst->rows);
 
   /* everybody knows that issue is between the chair and the screen (particulary in my office) */
   xbt_assert(src->elmsize == dst->elmsize);
   /* don't check free_f since the user may play weird games with this */
 
-  xbt_assert(lpos_src+lsize <= src->lines);
-  xbt_assert(rpos_src+rsize <= src->rows);
+  xbt_assert(lpos_src + lsize <= src->lines);
+  xbt_assert(rpos_src + rsize <= src->rows);
 
-  xbt_assert(lpos_dst+lsize <= dst->lines);
-  xbt_assert(rpos_dst+rsize <= dst->rows);
+  xbt_assert(lpos_dst + lsize <= dst->lines);
+  xbt_assert(rpos_dst + rsize <= dst->rows);
 
   /* Lets get serious here */
-  for (i=0;i<rsize;i++) {
+  for (i = 0; i < rsize; i++) {
     if (cpy_f) {
-      for (j=0;j<lsize;j++)
-        xbt_matrix_get_as(dst,j+lpos_dst,i+rpos_dst,void*) = (*cpy_f)(xbt_matrix_get_ptr(src,j+rpos_src,i+lpos_src));
+      for (j = 0; j < lsize; j++)
+        xbt_matrix_get_as(dst, j + lpos_dst, i + rpos_dst, void *) =
+          (*cpy_f) (xbt_matrix_get_ptr(src, j + rpos_src, i + lpos_src));
     } else {
-      memcpy(xbt_matrix_get_ptr(dst,lpos_dst,i+rpos_dst),
-             xbt_matrix_get_ptr(src,lpos_src,i+rpos_src),
-             dst->elmsize*lsize);
+      memcpy(xbt_matrix_get_ptr(dst, lpos_dst, i + rpos_dst),
+             xbt_matrix_get_ptr(src, lpos_src, i + rpos_src),
+             dst->elmsize * lsize);
     }
   }
 
 }
 
 /** \brief Creates a new matrix of double filled with zeros */
-xbt_matrix_t xbt_matrix_double_new_zeros(int lines, int rows) {
-  xbt_matrix_t res = xbt_matrix_new(lines, rows,sizeof(double),NULL);
+xbt_matrix_t xbt_matrix_double_new_zeros(int lines, int rows)
+{
+  xbt_matrix_t res = xbt_matrix_new(lines, rows, sizeof(double), NULL);
 
-  memset(res->data,0, res->elmsize * res->lines * res->rows);
+  memset(res->data, 0, res->elmsize * res->lines * res->rows);
   return res;
 }
 
 /** \brief Creates a new matrix of double being the identity matrix */
-xbt_matrix_t xbt_matrix_double_new_id(int lines, int rows) {
+xbt_matrix_t xbt_matrix_double_new_id(int lines, int rows)
+{
   xbt_matrix_t res = xbt_matrix_double_new_zeros(lines, rows);
   int i;
 
-  for (i=0; i<lines; i++)
-    xbt_matrix_get_as(res,i,i,double) = 1;
+  for (i = 0; i < lines; i++)
+    xbt_matrix_get_as(res, i, i, double) = 1;
   return res;
 }
 
 /** \brief Creates a new matrix of double randomly filled */
-xbt_matrix_t xbt_matrix_double_new_rand(int lines, int rows) {
-  xbt_matrix_t res = xbt_matrix_new(lines, rows,sizeof(double),NULL);
-  int i,j;
-
-  for (i=0; i<lines; i++)
-    for (j=0; j<rows; j++)
-      xbt_matrix_get_as(res,i,j,double) = (double)rand();
+xbt_matrix_t xbt_matrix_double_new_rand(int lines, int rows)
+{
+  xbt_matrix_t res = xbt_matrix_new(lines, rows, sizeof(double), NULL);
+  int i, j;
+
+  for (i = 0; i < lines; i++)
+    for (j = 0; j < rows; j++)
+      xbt_matrix_get_as(res, i, j, double) = (double) rand();
   return res;
 }
+
 /** \brief Creates a new matrix of double randomly by subsequent numbers */
-xbt_matrix_t xbt_matrix_double_new_seq(int lines, int rows) {
-  xbt_matrix_t res = xbt_matrix_new(lines, rows,sizeof(double),NULL);
+xbt_matrix_t xbt_matrix_double_new_seq(int lines, int rows)
+{
+  xbt_matrix_t res = xbt_matrix_new(lines, rows, sizeof(double), NULL);
   int i;
 
-  for (i=0; i<lines*rows; i++)
-    *(double*)&res->data[i*res->elmsize] = i;
+  for (i = 0; i < lines * rows; i++)
+    *(double *) &res->data[i * res->elmsize] = i;
 
   return res;
 }
 
 /** \brief Creates a new matrix being the multiplication of two others */
-xbt_matrix_t xbt_matrix_double_new_mult(xbt_matrix_t A,xbt_matrix_t B) {
+xbt_matrix_t xbt_matrix_double_new_mult(xbt_matrix_t A, xbt_matrix_t B)
+{
   xbt_matrix_t result = xbt_matrix_double_new_zeros(A->lines, B->rows);
 
-  xbt_matrix_double_addmult(A,B,result);
+  xbt_matrix_double_addmult(A, B, result);
   return result;
 }
 
 /** \brief add to C the result of A*B */
-void xbt_matrix_double_addmult(xbt_matrix_t A,xbt_matrix_t B,
-                               /*OUT*/ xbt_matrix_t C) {
-  unsigned int i,j,k;
+void xbt_matrix_double_addmult(xbt_matrix_t A, xbt_matrix_t B,
+                               /*OUT*/ xbt_matrix_t C)
+{
+  unsigned int i, j, k;
 
   xbt_assert2(A->lines == C->lines,
-              "A->lines != C->lines (%d vs %d)",A->lines,C->lines);
+              "A->lines != C->lines (%d vs %d)", A->lines, C->lines);
   xbt_assert(B->rows == C->rows);
 
-  for (i=0; i<C->lines; i++)
-    for (j=0; j<C->rows; j++)
-      for (k=0; k<B->lines; k++)
-        xbt_matrix_get_as(C,i,j,double) +=
-          xbt_matrix_get_as(A,i,k,double) * xbt_matrix_get_as(B,k,j,double);
+  for (i = 0; i < C->lines; i++)
+    for (j = 0; j < C->rows; j++)
+      for (k = 0; k < B->lines; k++)
+        xbt_matrix_get_as(C, i, j, double) +=
+          xbt_matrix_get_as(A, i, k, double) * xbt_matrix_get_as(B, k, j,
+                                                                 double);
 }
-
-
-
index b3f41ba..f827c4a 100644 (file)
 
 #include "xbt/sysdep.h"
 #include "xbt/ex.h"
-#include "xbt/ex_interface.h" /* We play crude games with exceptions */
+#include "xbt/ex_interface.h"   /* We play crude games with exceptions */
 #include "portable.h"
-#include "xbt/xbt_os_time.h" /* Portable time facilities */
-#include "xbt/xbt_os_thread.h" /* This module */
-#include "xbt_modinter.h" /* Initialization/finalization of this module */
+#include "xbt/xbt_os_time.h"    /* Portable time facilities */
+#include "xbt/xbt_os_thread.h"  /* This module */
+#include "xbt_modinter.h"       /* Initialization/finalization of this module */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os,xbt,"Synchronization mechanism (OS-level)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt,
+                                "Synchronization mechanism (OS-level)");
 
 /* ********************************* PTHREAD IMPLEMENTATION ************************************ */
 #ifdef HAVE_PTHREAD_H
@@ -28,7 +29,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os,xbt,"Synchronization mechanism (OS-l
 
 #ifdef HAVE_MUTEX_TIMEDLOCK
 /* redefine the function header since we fail to get this from system headers on amd (at least) */
-int pthread_mutex_timedlock(pthread_mutex_t *mutex,
+int pthread_mutex_timedlock(pthread_mutex_t * mutex,
                             const struct timespec *abs_timeout);
 #endif
 
@@ -45,7 +46,7 @@ typedef struct xbt_os_thread_ {
   void *param;
   pvoid_f_pvoid_t start_routine;
   ex_ctx_t *exception;
-} s_xbt_os_thread_t ;
+} s_xbt_os_thread_t;
 static xbt_os_thread_t main_thread = NULL;
 
 /* thread-specific data containing the xbt_os_thread_t structure */
@@ -53,34 +54,39 @@ static pthread_key_t xbt_self_thread_key;
 static int thread_mod_inited = 0;
 
 /* frees the xbt_os_thread_t corresponding to the current thread */
-static void xbt_os_thread_free_thread_data(void*d){
+static void xbt_os_thread_free_thread_data(void *d)
+{
   free(d);
 }
 
 /* callback: context fetching */
-static ex_ctx_t *_os_thread_ex_ctx(void) {
+static ex_ctx_t *_os_thread_ex_ctx(void)
+{
   return xbt_os_thread_self()->exception;
 }
 
 /* callback: termination */
-static void _os_thread_ex_terminate(xbt_ex_t * e) {
+static void _os_thread_ex_terminate(xbt_ex_t * e)
+{
   xbt_ex_display(e);
 
   abort();
   /* FIXME: there should be a configuration variable to choose to kill everyone or only this one */
 }
 
-void xbt_os_thread_mod_init(void) {
+void xbt_os_thread_mod_init(void)
+{
   int errcode;
 
   if (thread_mod_inited)
     return;
 
-  if ((errcode=pthread_key_create(&xbt_self_thread_key, NULL)))
-    THROW0(system_error,errcode,"pthread_key_create failed for xbt_self_thread_key");
+  if ((errcode = pthread_key_create(&xbt_self_thread_key, NULL)))
+    THROW0(system_error, errcode,
+           "pthread_key_create failed for xbt_self_thread_key");
 
-  main_thread=xbt_new(s_xbt_os_thread_t,1);
-  main_thread->name = (char*)"main";
+  main_thread = xbt_new(s_xbt_os_thread_t, 1);
+  main_thread->name = (char *) "main";
   main_thread->start_routine = NULL;
   main_thread->param = NULL;
   main_thread->exception = xbt_new(ex_ctx_t, 1);
@@ -96,9 +102,11 @@ void xbt_os_thread_mod_init(void) {
 #endif
 
 }
-void xbt_os_thread_mod_exit(void) {
+
+void xbt_os_thread_mod_exit(void)
+{
   /* FIXME: don't try to free our key on shutdown.
-      Valgrind detects no leak if we don't, and whine if we try to */
+     Valgrind detects no leak if we don't, and whine if we try to */
   //   int errcode;
 
   //   if ((errcode=pthread_key_delete(xbt_self_thread_key)))
@@ -106,29 +114,31 @@ void xbt_os_thread_mod_exit(void) {
   free(main_thread->exception);
   free(main_thread);
   main_thread = NULL;
-  thread_mod_inited=0;
+  thread_mod_inited = 0;
 #ifndef HAVE_SEM_WAIT
   xbt_os_mutex_destroy(next_sem_ID_lock);
 #endif
 }
 
-static void * wrapper_start_routine(void *s) {
+static void *wrapper_start_routine(void *s)
+{
   xbt_os_thread_t t = s;
   int errcode;
 
-  if ((errcode=pthread_setspecific(xbt_self_thread_key,t)))
-    THROW0(system_error,errcode,
+  if ((errcode = pthread_setspecific(xbt_self_thread_key, t)))
+    THROW0(system_error, errcode,
            "pthread_setspecific failed for xbt_self_thread_key");
 
-  return (*(t->start_routine))(t->param);
+  return (*(t->start_routine)) (t->param);
 }
 
-xbt_os_thread_t xbt_os_thread_create(const char*name,
+xbt_os_thread_t xbt_os_thread_create(const char *name,
                                      pvoid_f_pvoid_t start_routine,
-                                     void* param)  {
+                                     void *param)
+{
   int errcode;
 
-  xbt_os_thread_t res_thread=xbt_new(s_xbt_os_thread_t,1);
+  xbt_os_thread_t res_thread = xbt_new(s_xbt_os_thread_t, 1);
   res_thread->name = xbt_strdup(name);
   res_thread->start_routine = start_routine;
   res_thread->param = param;
@@ -137,27 +147,30 @@ xbt_os_thread_t xbt_os_thread_create(const char*name,
 
   if ((errcode = pthread_create(&(res_thread->t), NULL,
                                 wrapper_start_routine, res_thread)))
-    THROW1(system_error,errcode,
-           "pthread_create failed: %s",strerror(errcode));
+    THROW1(system_error, errcode,
+           "pthread_create failed: %s", strerror(errcode));
 
   return res_thread;
 }
 
-const char* xbt_os_thread_name(xbt_os_thread_t t) {
+const char *xbt_os_thread_name(xbt_os_thread_t t)
+{
   return t->name;
 }
 
-const char* xbt_os_thread_self_name(void) {
+const char *xbt_os_thread_self_name(void)
+{
   xbt_os_thread_t self = xbt_os_thread_self();
-  return self?self->name:"main";
+  return self ? self->name : "main";
 }
-void
-xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return) {
+
+void xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return)
+{
 
   int errcode;
 
-  if ((errcode = pthread_join(thread->t,thread_return)))
-    THROW1(system_error,errcode, "pthread_join failed: %s",
+  if ((errcode = pthread_join(thread->t, thread_return)))
+    THROW1(system_error, errcode, "pthread_join failed: %s",
            strerror(errcode));
   if (thread->exception)
     free(thread->exception);
@@ -165,17 +178,19 @@ xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return) {
   if (thread->name)
     free(thread->name);
 
-  if (thread == main_thread) /* just killed main thread */
+  if (thread == main_thread)    /* just killed main thread */
     main_thread = NULL;
 
   free(thread);
 }
 
-void xbt_os_thread_exit(int *retval) {
+void xbt_os_thread_exit(int *retval)
+{
   pthread_exit(retval);
 }
 
-xbt_os_thread_t xbt_os_thread_self(void) {
+xbt_os_thread_t xbt_os_thread_self(void)
+{
   xbt_os_thread_t res;
 
   if (!thread_mod_inited)
@@ -189,12 +204,16 @@ xbt_os_thread_t xbt_os_thread_self(void) {
 }
 
 #include <sched.h>
-void xbt_os_thread_yield(void) {
+void xbt_os_thread_yield(void)
+{
   sched_yield();
 }
-void xbt_os_thread_cancel(xbt_os_thread_t t) {
+
+void xbt_os_thread_cancel(xbt_os_thread_t t)
+{
   pthread_cancel(t->t);
 }
+
 /****** mutex related functions ******/
 typedef struct xbt_os_mutex_ {
   /* KEEP IT IN SYNC WITH xbt_thread.c */
@@ -204,42 +223,46 @@ typedef struct xbt_os_mutex_ {
 #include <time.h>
 #include <math.h>
 
-xbt_os_mutex_t xbt_os_mutex_init(void) {
-  xbt_os_mutex_t res = xbt_new(s_xbt_os_mutex_t,1);
+xbt_os_mutex_t xbt_os_mutex_init(void)
+{
+  xbt_os_mutex_t res = xbt_new(s_xbt_os_mutex_t, 1);
   int errcode;
 
-  if ((errcode = pthread_mutex_init(&(res->m),NULL)))
-    THROW1(system_error,errcode,"pthread_mutex_init() failed: %s",
+  if ((errcode = pthread_mutex_init(&(res->m), NULL)))
+    THROW1(system_error, errcode, "pthread_mutex_init() failed: %s",
            strerror(errcode));
 
   return res;
 }
 
-void xbt_os_mutex_acquire(xbt_os_mutex_t mutex) {
+void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
+{
   int errcode;
 
-  if ((errcode=pthread_mutex_lock(&(mutex->m))))
-    THROW2(system_error,errcode,"pthread_mutex_lock(%p) failed: %s",
+  if ((errcode = pthread_mutex_lock(&(mutex->m))))
+    THROW2(system_error, errcode, "pthread_mutex_lock(%p) failed: %s",
            mutex, strerror(errcode));
 }
 
 
-void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) {
+void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay)
+{
   int errcode;
 
   if (delay < 0) {
     xbt_os_mutex_acquire(mutex);
 
   } else if (delay == 0) {
-    errcode=pthread_mutex_trylock(&(mutex->m));
+    errcode = pthread_mutex_trylock(&(mutex->m));
 
     switch (errcode) {
-      case 0:
-        return;
-      case ETIMEDOUT:
-        THROW1(timeout_error,0,"mutex %p not ready",mutex);
-      default:
-        THROW2(system_error,errcode,"xbt_mutex_timedacquire(%p) failed: %s",mutex, strerror(errcode));
+    case 0:
+      return;
+    case ETIMEDOUT:
+      THROW1(timeout_error, 0, "mutex %p not ready", mutex);
+    default:
+      THROW2(system_error, errcode, "xbt_mutex_timedacquire(%p) failed: %s",
+             mutex, strerror(errcode));
     }
 
 
@@ -250,10 +273,10 @@ void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) {
     double end = delay + xbt_os_time();
 
     ts_end.tv_sec = (time_t) floor(end);
-    ts_end.tv_nsec = (long)  ( ( end - ts_end.tv_sec) * 1000000000);
-    DEBUG2("pthread_mutex_timedlock(%p,%p)",&(mutex->m), &ts_end);
+    ts_end.tv_nsec = (long) ((end - ts_end.tv_sec) * 1000000000);
+    DEBUG2("pthread_mutex_timedlock(%p,%p)", &(mutex->m), &ts_end);
 
-    errcode=pthread_mutex_timedlock(&(mutex->m),&ts_end);
+    errcode = pthread_mutex_timedlock(&(mutex->m), &ts_end);
 
 #else /* Well, let's reimplement it since those lazy libc dudes didn't */
     double start = xbt_os_time();
@@ -261,7 +284,7 @@ void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) {
       errcode = pthread_mutex_trylock(&(mutex->m));
       if (errcode == EBUSY)
         xbt_os_thread_yield();
-    } while (errcode == EBUSY && xbt_os_time()-start <delay);
+    } while (errcode == EBUSY && xbt_os_time() - start < delay);
 
     if (errcode == EBUSY)
       errcode = ETIMEDOUT;
@@ -269,33 +292,39 @@ void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) {
 #endif /* HAVE_MUTEX_TIMEDLOCK */
 
     switch (errcode) {
-      case 0:
-        return;
+    case 0:
+      return;
 
-      case ETIMEDOUT:
-        THROW2(timeout_error,delay,"mutex %p wasn't signaled before timeout (%f)",mutex,delay);
+    case ETIMEDOUT:
+      THROW2(timeout_error, delay,
+             "mutex %p wasn't signaled before timeout (%f)", mutex, delay);
 
-      default:
-        THROW3(system_error,errcode,"pthread_mutex_timedlock(%p,%f) failed: %s",mutex,delay, strerror(errcode));
+    default:
+      THROW3(system_error, errcode,
+             "pthread_mutex_timedlock(%p,%f) failed: %s", mutex, delay,
+             strerror(errcode));
     }
   }
 }
 
-void xbt_os_mutex_release(xbt_os_mutex_t mutex) {
+void xbt_os_mutex_release(xbt_os_mutex_t mutex)
+{
   int errcode;
 
-  if ((errcode=pthread_mutex_unlock(&(mutex->m))))
-    THROW2(system_error,errcode,"pthread_mutex_unlock(%p) failed: %s",
+  if ((errcode = pthread_mutex_unlock(&(mutex->m))))
+    THROW2(system_error, errcode, "pthread_mutex_unlock(%p) failed: %s",
            mutex, strerror(errcode));
 }
 
-void xbt_os_mutex_destroy(xbt_os_mutex_t mutex) {
+void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
+{
   int errcode;
 
-  if (!mutex) return;
+  if (!mutex)
+    return;
 
-  if ((errcode=pthread_mutex_destroy(&(mutex->m))))
-    THROW2(system_error,errcode,"pthread_mutex_destroy(%p) failed: %s",
+  if ((errcode = pthread_mutex_destroy(&(mutex->m))))
+    THROW2(system_error, errcode, "pthread_mutex_destroy(%p) failed: %s",
            mutex, strerror(errcode));
   free(mutex);
 }
@@ -306,152 +335,168 @@ typedef struct xbt_os_cond_ {
   pthread_cond_t c;
 } s_xbt_os_cond_t;
 
-xbt_os_cond_t xbt_os_cond_init(void) {
-  xbt_os_cond_t res = xbt_new(s_xbt_os_cond_t,1);
+xbt_os_cond_t xbt_os_cond_init(void)
+{
+  xbt_os_cond_t res = xbt_new(s_xbt_os_cond_t, 1);
   int errcode;
-  if ((errcode=pthread_cond_init(&(res->c),NULL)))
-    THROW1(system_error,errcode,"pthread_cond_init() failed: %s",
+  if ((errcode = pthread_cond_init(&(res->c), NULL)))
+    THROW1(system_error, errcode, "pthread_cond_init() failed: %s",
            strerror(errcode));
 
   return res;
 }
 
-void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex) {
+void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex)
+{
   int errcode;
-  if ((errcode=pthread_cond_wait(&(cond->c),&(mutex->m))))
-    THROW3(system_error,errcode,"pthread_cond_wait(%p,%p) failed: %s",
-           cond,mutex, strerror(errcode));
+  if ((errcode = pthread_cond_wait(&(cond->c), &(mutex->m))))
+    THROW3(system_error, errcode, "pthread_cond_wait(%p,%p) failed: %s",
+           cond, mutex, strerror(errcode));
 }
 
 
-void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex, double delay) {
+void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex,
+                           double delay)
+{
   int errcode;
   struct timespec ts_end;
   double end = delay + xbt_os_time();
 
   if (delay < 0) {
-    xbt_os_cond_wait(cond,mutex);
+    xbt_os_cond_wait(cond, mutex);
   } else {
     ts_end.tv_sec = (time_t) floor(end);
-    ts_end.tv_nsec = (long)  ( ( end - ts_end.tv_sec) * 1000000000);
-    DEBUG3("pthread_cond_timedwait(%p,%p,%p)",&(cond->c),&(mutex->m), &ts_end);
-    switch ( (errcode=pthread_cond_timedwait(&(cond->c),&(mutex->m), &ts_end)) ) {
-      case 0:
-        return;
-      case ETIMEDOUT:
-        THROW3(timeout_error,errcode,"condition %p (mutex %p) wasn't signaled before timeout (%f)",
-               cond,mutex, delay);
-      default:
-        THROW4(system_error,errcode,"pthread_cond_timedwait(%p,%p,%f) failed: %s",
-               cond,mutex, delay, strerror(errcode));
+    ts_end.tv_nsec = (long) ((end - ts_end.tv_sec) * 1000000000);
+    DEBUG3("pthread_cond_timedwait(%p,%p,%p)", &(cond->c), &(mutex->m),
+           &ts_end);
+    switch ((errcode =
+             pthread_cond_timedwait(&(cond->c), &(mutex->m), &ts_end))) {
+    case 0:
+      return;
+    case ETIMEDOUT:
+      THROW3(timeout_error, errcode,
+             "condition %p (mutex %p) wasn't signaled before timeout (%f)",
+             cond, mutex, delay);
+    default:
+      THROW4(system_error, errcode,
+             "pthread_cond_timedwait(%p,%p,%f) failed: %s", cond, mutex,
+             delay, strerror(errcode));
     }
   }
 }
 
-void xbt_os_cond_signal(xbt_os_cond_t cond) {
+void xbt_os_cond_signal(xbt_os_cond_t cond)
+{
   int errcode;
-  if ((errcode=pthread_cond_signal(&(cond->c))))
-    THROW2(system_error,errcode,"pthread_cond_signal(%p) failed: %s",
+  if ((errcode = pthread_cond_signal(&(cond->c))))
+    THROW2(system_error, errcode, "pthread_cond_signal(%p) failed: %s",
            cond, strerror(errcode));
 }
 
-void xbt_os_cond_broadcast(xbt_os_cond_t cond){
+void xbt_os_cond_broadcast(xbt_os_cond_t cond)
+{
   int errcode;
-  if ((errcode=pthread_cond_broadcast(&(cond->c))))
-    THROW2(system_error,errcode,"pthread_cond_broadcast(%p) failed: %s",
+  if ((errcode = pthread_cond_broadcast(&(cond->c))))
+    THROW2(system_error, errcode, "pthread_cond_broadcast(%p) failed: %s",
            cond, strerror(errcode));
 }
-void xbt_os_cond_destroy(xbt_os_cond_t cond){
+
+void xbt_os_cond_destroy(xbt_os_cond_t cond)
+{
   int errcode;
 
-  if (!cond) return;
+  if (!cond)
+    return;
 
-  if ((errcode=pthread_cond_destroy(&(cond->c))))
-    THROW2(system_error,errcode,"pthread_cond_destroy(%p) failed: %s",
+  if ((errcode = pthread_cond_destroy(&(cond->c))))
+    THROW2(system_error, errcode, "pthread_cond_destroy(%p) failed: %s",
            cond, strerror(errcode));
   free(cond);
 }
 
-void *xbt_os_thread_getparam(void) {
+void *xbt_os_thread_getparam(void)
+{
   xbt_os_thread_t t = xbt_os_thread_self();
-  return t?t->param:NULL;
+  return t ? t->param : NULL;
 }
 
 typedef struct xbt_os_sem_ {
 #ifndef HAVE_SEM_INIT
-  charname;
+  char *name;
 #endif
   sem_t s;
   sem_t *ps;
-}s_xbt_os_sem_t ;
+} s_xbt_os_sem_t;
 
 #ifndef SEM_FAILED
 #define SEM_FAILED (-1)
 #endif
 
-xbt_os_sem_t
-xbt_os_sem_init(unsigned int value) {
-  xbt_os_sem_t res = xbt_new(s_xbt_os_sem_t,1);
+xbt_os_sem_t xbt_os_sem_init(unsigned int value)
+{
+  xbt_os_sem_t res = xbt_new(s_xbt_os_sem_t, 1);
 
   /* On some systems (MAC OS X), only the stub of sem_init is to be found.
    * Any attempt to use it leads to ENOSYS (function not implemented).
    * If such a prehistoric system is detected, do the job with sem_open instead
    */
 #ifdef HAVE_SEM_INIT
-  if(sem_init(&(res->s),0,value) != 0)
-    THROW1(system_error,errno,"sem_init() failed: %s", strerror(errno));
+  if (sem_init(&(res->s), 0, value) != 0)
+    THROW1(system_error, errno, "sem_init() failed: %s", strerror(errno));
   res->ps = &(res->s);
 
 #else /* damn, no sem_init(). Reimplement it */
 
   xbt_os_mutex_acquire(next_sem_ID_lock);
-  res->name = bprintf("/%d.%d",(*xbt_getpid)(),++next_sem_ID);
+  res->name = bprintf("/%d.%d", (*xbt_getpid) (), ++next_sem_ID);
   xbt_os_mutex_release(next_sem_ID_lock);
 
   res->ps = sem_open(res->name, O_CREAT, 0644, value);
-  if ((res->ps == (sem_t *)SEM_FAILED) && (errno == ENAMETOOLONG)) {
+  if ((res->ps == (sem_t *) SEM_FAILED) && (errno == ENAMETOOLONG)) {
     /* Old darwins only allow 13 chars. Did you create *that* amount of semaphores? */
     res->name[13] = '\0';
     res->ps = sem_open(res->name, O_CREAT, 0644, 1);
   }
-  if ((res->ps == (sem_t *)SEM_FAILED))
-    THROW1(system_error,errno,"sem_open() failed: %s",strerror(errno));
+  if ((res->ps == (sem_t *) SEM_FAILED))
+    THROW1(system_error, errno, "sem_open() failed: %s", strerror(errno));
 
   /* Remove the name from the semaphore namespace: we never join on it */
-  if(sem_unlink(res->name) < 0)
-    THROW1(system_error,errno,"sem_unlink() failed: %s", strerror(errno));
+  if (sem_unlink(res->name) < 0)
+    THROW1(system_error, errno, "sem_unlink() failed: %s", strerror(errno));
 
 #endif
 
   return res;
 }
 
-void
-xbt_os_sem_acquire(xbt_os_sem_t sem) {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot acquire of the NULL semaphore");
-  if(sem_wait(sem->ps) < 0)
-    THROW1(system_error,errno,"sem_wait() failed: %s", strerror(errno));
+void xbt_os_sem_acquire(xbt_os_sem_t sem)
+{
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot acquire of the NULL semaphore");
+  if (sem_wait(sem->ps) < 0)
+    THROW1(system_error, errno, "sem_wait() failed: %s", strerror(errno));
 }
 
-void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) {
+void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay)
+{
   int errcode;
 
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot acquire of the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot acquire of the NULL semaphore");
 
   if (delay < 0) {
     xbt_os_sem_acquire(sem);
-  } else if (delay==0) {
+  } else if (delay == 0) {
     errcode = sem_trywait(sem->ps);
 
     switch (errcode) {
-      case 0:
-        return;
-      case ETIMEDOUT:
-        THROW1(timeout_error,0,"semaphore %p not ready",sem);
-      default:
-        THROW2(system_error,errcode,"xbt_os_sem_timedacquire(%p) failed: %s",sem, strerror(errcode));
+    case 0:
+      return;
+    case ETIMEDOUT:
+      THROW1(timeout_error, 0, "semaphore %p not ready", sem);
+    default:
+      THROW2(system_error, errcode, "xbt_os_sem_timedacquire(%p) failed: %s",
+             sem, strerror(errcode));
     }
 
   } else {
@@ -460,9 +505,9 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) {
     double end = delay + xbt_os_time();
 
     ts_end.tv_sec = (time_t) floor(end);
-    ts_end.tv_nsec = (long)  ( ( end - ts_end.tv_sec) * 1000000000);
-    DEBUG2("sem_timedwait(%p,%p)",sem->ps,&ts_end);
-    errcode = sem_timedwait(sem->s,&ts_end);
+    ts_end.tv_nsec = (long) ((end - ts_end.tv_sec) * 1000000000);
+    DEBUG2("sem_timedwait(%p,%p)", sem->ps, &ts_end);
+    errcode = sem_timedwait(sem->s, &ts_end);
 
 #else /* Okay, reimplement this function then */
     double start = xbt_os_time();
@@ -470,65 +515,62 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) {
       errcode = sem_trywait(sem->ps);
       if (errcode == EBUSY)
         xbt_os_thread_yield();
-    } while (errcode == EBUSY && xbt_os_time()-start <delay);
+    } while (errcode == EBUSY && xbt_os_time() - start < delay);
 
     if (errcode == EBUSY)
       errcode = ETIMEDOUT;
 #endif
 
     switch (errcode) {
-      case 0:
-        return;
+    case 0:
+      return;
 
-      case ETIMEDOUT:
-        THROW2(timeout_error,delay,"semaphore %p wasn't signaled before timeout (%f)",sem,delay);
+    case ETIMEDOUT:
+      THROW2(timeout_error, delay,
+             "semaphore %p wasn't signaled before timeout (%f)", sem, delay);
 
-      default:
-        THROW3(system_error,errcode,"sem_timedwait(%p,%f) failed: %s",sem,delay, strerror(errcode));
+    default:
+      THROW3(system_error, errcode, "sem_timedwait(%p,%f) failed: %s", sem,
+             delay, strerror(errcode));
     }
   }
 }
 
-void
-xbt_os_sem_release(xbt_os_sem_t sem)
+void xbt_os_sem_release(xbt_os_sem_t sem)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot release of the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot release of the NULL semaphore");
 
-  if(sem_post(sem->ps) < 0)
-    THROW1(system_error,errno,"sem_post() failed: %s",
-           strerror(errno));
+  if (sem_post(sem->ps) < 0)
+    THROW1(system_error, errno, "sem_post() failed: %s", strerror(errno));
 }
 
-void
-xbt_os_sem_destroy(xbt_os_sem_t sem)
+void xbt_os_sem_destroy(xbt_os_sem_t sem)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot destroy the NULL sempahore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot destroy the NULL sempahore");
 
 #ifdef HAVE_SEM_INIT
-  if(sem_destroy(sem->ps)) < 0)
-  THROW1(system_error,errno,"sem_destroy() failed: %s",
-         strerror(errno));
+  if (sem_destroy(sem->ps))
+    <0)
+      THROW1(system_error, errno, "sem_destroy() failed: %s",
+             strerror(errno));
 #else
-  if(sem_close(sem->ps) < 0)
-    THROW1(system_error,errno,"sem_close() failed: %s",
-           strerror(errno));
+  if (sem_close(sem->ps) < 0)
+    THROW1(system_error, errno, "sem_close() failed: %s", strerror(errno));
   xbt_free(sem->name);
 
 #endif
   xbt_free(sem);
 }
 
-void
-xbt_os_sem_get_value(xbt_os_sem_t sem, int* svalue)
+void xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot get the value of the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot get the value of the NULL semaphore");
 
-  if(sem_getvalue(&(sem->s),svalue) < 0)
-    THROW1(system_error,errno,"sem_getvalue() failed: %s",
-           strerror(errno));
+  if (sem_getvalue(&(sem->s), svalue) < 0)
+    THROW1(system_error, errno, "sem_getvalue() failed: %s", strerror(errno));
 }
 
 /* ********************************* WINDOWS IMPLEMENTATION ************************************ */
@@ -539,11 +581,11 @@ xbt_os_sem_get_value(xbt_os_sem_t sem, int* svalue)
 
 typedef struct xbt_os_thread_ {
   char *name;
-  HANDLE handle;                  /* the win thread handle        */
-  unsigned long id;               /* the win thread id            */
+  HANDLE handle;                /* the win thread handle        */
+  unsigned long id;             /* the win thread id            */
   pvoid_f_pvoid_t start_routine;
-  voidparam;
-} s_xbt_os_thread_t ;
+  void *param;
+} s_xbt_os_thread_t;
 
 /* so we can specify the size of the stack of the threads */
 #ifndef STACK_SIZE_PARAM_IS_A_RESERVATION
@@ -556,102 +598,118 @@ typedef struct xbt_os_thread_ {
 /* key to the TLS containing the xbt_os_thread_t structure */
 static unsigned long xbt_self_thread_key;
 
-void xbt_os_thread_mod_init(void) {
+void xbt_os_thread_mod_init(void)
+{
   xbt_self_thread_key = TlsAlloc();
 }
-void xbt_os_thread_mod_exit(void) {
+
+void xbt_os_thread_mod_exit(void)
+{
 
   if (!TlsFree(xbt_self_thread_key))
-    THROW0(system_error,(int)GetLastError(),"TlsFree() failed to cleanup the thread submodule");
+    THROW0(system_error, (int) GetLastError(),
+           "TlsFree() failed to cleanup the thread submodule");
 }
 
-static DWORD WINAPI  wrapper_start_routine(void *s) {
-  xbt_os_thread_t t = (xbt_os_thread_t)s;
-  DWORD* rv;
+static DWORD WINAPI wrapper_start_routine(void *s)
+{
+  xbt_os_thread_t t = (xbt_os_thread_t) s;
+  DWORD *rv;
 
-  if(!TlsSetValue(xbt_self_thread_key,t))
-    THROW0(system_error,(int)GetLastError(),"TlsSetValue of data describing the created thread failed");
+  if (!TlsSetValue(xbt_self_thread_key, t))
+    THROW0(system_error, (int) GetLastError(),
+           "TlsSetValue of data describing the created thread failed");
 
-  rv = (DWORD*)((t->start_routine)(t->param));
+  rv = (DWORD *) ((t->start_routine) (t->param));
 
   return rv ? *rv : 0;
 
 }
 
 
-xbt_os_thread_t xbt_os_thread_create(const char *name,pvoid_f_pvoid_t start_routine,
-                                     void* param)  {
+xbt_os_thread_t xbt_os_thread_create(const char *name,
+                                     pvoid_f_pvoid_t start_routine,
+                                     void *param)
+{
 
-  xbt_os_thread_t t = xbt_new(s_xbt_os_thread_t,1);
+  xbt_os_thread_t t = xbt_new(s_xbt_os_thread_t, 1);
 
   t->name = xbt_strdup(name);
-  t->start_routine = start_routine ;
+  t->start_routine = start_routine;
   t->param = param;
 
-  t->handle = CreateThread(NULL,XBT_DEFAULT_THREAD_STACK_SIZE,
-                           (LPTHREAD_START_ROUTINE)wrapper_start_routine,
-                           t,STACK_SIZE_PARAM_IS_A_RESERVATION,&(t->id));
+  t->handle = CreateThread(NULL, XBT_DEFAULT_THREAD_STACK_SIZE,
+                           (LPTHREAD_START_ROUTINE) wrapper_start_routine,
+                           t, STACK_SIZE_PARAM_IS_A_RESERVATION, &(t->id));
 
-  if(!t->handle) {
+  if (!t->handle) {
     xbt_free(t);
-    THROW0(system_error,(int)GetLastError(),"CreateThread failed");
+    THROW0(system_error, (int) GetLastError(), "CreateThread failed");
   }
 
   return t;
 }
 
-const char* xbt_os_thread_name(xbt_os_thread_t t) {
+const char *xbt_os_thread_name(xbt_os_thread_t t)
+{
   return t->name;
 }
 
-const char* xbt_os_thread_self_name(void) {
+const char *xbt_os_thread_self_name(void)
+{
   xbt_os_thread_t t = xbt_os_thread_self();
-  return t?t->name:"main";
+  return t ? t->name : "main";
 }
 
-void
-xbt_os_thread_join(xbt_os_thread_t thread,void ** thread_return) {
+void xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return)
+{
 
-  if(WAIT_OBJECT_0 != WaitForSingleObject(thread->handle,INFINITE))
-    THROW0(system_error,(int)GetLastError(), "WaitForSingleObject failed");
+  if (WAIT_OBJECT_0 != WaitForSingleObject(thread->handle, INFINITE))
+    THROW0(system_error, (int) GetLastError(), "WaitForSingleObject failed");
 
-  if(thread_return){
+  if (thread_return) {
 
-    if(!GetExitCodeThread(thread->handle,(DWORD*)(*thread_return)))
-      THROW0(system_error,(int)GetLastError(), "GetExitCodeThread failed");
+    if (!GetExitCodeThread(thread->handle, (DWORD *) (*thread_return)))
+      THROW0(system_error, (int) GetLastError(), "GetExitCodeThread failed");
   }
 
   CloseHandle(thread->handle);
 
-  if(thread->name)
+  if (thread->name)
     free(thread->name);
 
   free(thread);
 }
 
-void xbt_os_thread_exit(int *retval) {
-  if(retval)
+void xbt_os_thread_exit(int *retval)
+{
+  if (retval)
     ExitThread(*retval);
   else
     ExitThread(0);
 }
 
-xbt_os_thread_t xbt_os_thread_self(void) {
+xbt_os_thread_t xbt_os_thread_self(void)
+{
   return TlsGetValue(xbt_self_thread_key);
 }
 
-void *xbt_os_thread_getparam(void) {
+void *xbt_os_thread_getparam(void)
+{
   xbt_os_thread_t t = xbt_os_thread_self();
   return t->param;
 }
 
 
-void xbt_os_thread_yield(void) {
+void xbt_os_thread_yield(void)
+{
   Sleep(0);
 }
-void xbt_os_thread_cancel(xbt_os_thread_t t) {
-  if(!TerminateThread(t->handle,0))
-    THROW0(system_error,(int)GetLastError(), "TerminateThread failed");
+
+void xbt_os_thread_cancel(xbt_os_thread_t t)
+{
+  if (!TerminateThread(t->handle, 0))
+    THROW0(system_error, (int) GetLastError(), "TerminateThread failed");
 }
 
 /****** mutex related functions ******/
@@ -660,8 +718,9 @@ typedef struct xbt_os_mutex_ {
   CRITICAL_SECTION lock;
 } s_xbt_os_mutex_t;
 
-xbt_os_mutex_t xbt_os_mutex_init(void) {
-  xbt_os_mutex_t res = xbt_new(s_xbt_os_mutex_t,1);
+xbt_os_mutex_t xbt_os_mutex_init(void)
+{
+  xbt_os_mutex_t res = xbt_new(s_xbt_os_mutex_t, 1);
 
   /* initialize the critical section object */
   InitializeCriticalSection(&(res->lock));
@@ -669,30 +728,35 @@ xbt_os_mutex_t xbt_os_mutex_init(void) {
   return res;
 }
 
-void xbt_os_mutex_acquire(xbt_os_mutex_t mutex) {
-  EnterCriticalSection(& mutex->lock);
+void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
+{
+  EnterCriticalSection(&mutex->lock);
 }
 
-void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) {
+void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay)
+{
   THROW_UNIMPLEMENTED;
 }
 
-void xbt_os_mutex_release(xbt_os_mutex_t mutex) {
+void xbt_os_mutex_release(xbt_os_mutex_t mutex)
+{
 
-  LeaveCriticalSection (&mutex->lock);
+  LeaveCriticalSection(&mutex->lock);
 
 }
 
-void xbt_os_mutex_destroy(xbt_os_mutex_t mutex) {
+void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
+{
 
-  if (!mutex) return;
+  if (!mutex)
+    return;
 
-  DeleteCriticalSection(& mutex->lock);
+  DeleteCriticalSection(&mutex->lock);
   free(mutex);
 }
 
 /***** condition related functions *****/
-enum { /* KEEP IT IN SYNC WITH xbt_thread.c */
+enum {                          /* KEEP IT IN SYNC WITH xbt_thread.c */
   SIGNAL = 0,
   BROADCAST = 1,
   MAX_EVENTS = 2
@@ -702,202 +766,219 @@ typedef struct xbt_os_cond_ {
   /* KEEP IT IN SYNC WITH xbt_thread.c */
   HANDLE events[MAX_EVENTS];
 
-  unsigned int waiters_count;           /* the number of waiters                        */
+  unsigned int waiters_count;   /* the number of waiters                        */
   CRITICAL_SECTION waiters_count_lock;  /* protect access to waiters_count  */
 } s_xbt_os_cond_t;
 
-xbt_os_cond_t xbt_os_cond_init(void) {
+xbt_os_cond_t xbt_os_cond_init(void)
+{
 
-  xbt_os_cond_t res = xbt_new0(s_xbt_os_cond_t,1);
+  xbt_os_cond_t res = xbt_new0(s_xbt_os_cond_t, 1);
 
-  memset(& res->waiters_count_lock,0,sizeof(CRITICAL_SECTION));
+  memset(&res->waiters_count_lock, 0, sizeof(CRITICAL_SECTION));
 
   /* initialize the critical section object */
-  InitializeCriticalSection(& res->waiters_count_lock);
+  InitializeCriticalSection(&res->waiters_count_lock);
 
   res->waiters_count = 0;
 
   /* Create an auto-reset event */
-  res->events[SIGNAL] = CreateEvent (NULL, FALSE, FALSE, NULL);
+  res->events[SIGNAL] = CreateEvent(NULL, FALSE, FALSE, NULL);
 
-  if(!res->events[SIGNAL]){
-    DeleteCriticalSection(& res->waiters_count_lock);
+  if (!res->events[SIGNAL]) {
+    DeleteCriticalSection(&res->waiters_count_lock);
     free(res);
-    THROW0(system_error,0,"CreateEvent failed for the signals");
+    THROW0(system_error, 0, "CreateEvent failed for the signals");
   }
 
   /* Create a manual-reset event. */
-  res->events[BROADCAST] = CreateEvent (NULL, TRUE, FALSE,NULL);
+  res->events[BROADCAST] = CreateEvent(NULL, TRUE, FALSE, NULL);
 
-  if(!res->events[BROADCAST]){
+  if (!res->events[BROADCAST]) {
 
-    DeleteCriticalSection(& res->waiters_count_lock);
+    DeleteCriticalSection(&res->waiters_count_lock);
     CloseHandle(res->events[SIGNAL]);
     free(res);
-    THROW0(system_error,0,"CreateEvent failed for the broadcasts");
+    THROW0(system_error, 0, "CreateEvent failed for the broadcasts");
   }
 
   return res;
 }
 
-void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex) {
+void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex)
+{
 
   unsigned long wait_result;
   int is_last_waiter;
 
   /* lock the threads counter and increment it */
-  EnterCriticalSection (& cond->waiters_count_lock);
+  EnterCriticalSection(&cond->waiters_count_lock);
   cond->waiters_count++;
-  LeaveCriticalSection (& cond->waiters_count_lock);
+  LeaveCriticalSection(&cond->waiters_count_lock);
 
   /* unlock the mutex associate with the condition */
-  LeaveCriticalSection (& mutex->lock);
+  LeaveCriticalSection(&mutex->lock);
 
   /* wait for a signal (broadcast or no) */
-  wait_result = WaitForMultipleObjects (2, cond->events, FALSE, INFINITE);
+  wait_result = WaitForMultipleObjects(2, cond->events, FALSE, INFINITE);
 
-  if(wait_result == WAIT_FAILED)
-    THROW0(system_error,0,"WaitForMultipleObjects failed, so we cannot wait on the condition");
+  if (wait_result == WAIT_FAILED)
+    THROW0(system_error, 0,
+           "WaitForMultipleObjects failed, so we cannot wait on the condition");
 
   /* we have a signal lock the condition */
-  EnterCriticalSection (& cond->waiters_count_lock);
+  EnterCriticalSection(&cond->waiters_count_lock);
   cond->waiters_count--;
 
   /* it's the last waiter or it's a broadcast ? */
-  is_last_waiter = ((wait_result == WAIT_OBJECT_0 + BROADCAST - 1) && (cond->waiters_count == 0));
+  is_last_waiter = ((wait_result == WAIT_OBJECT_0 + BROADCAST - 1)
+                    && (cond->waiters_count == 0));
 
-  LeaveCriticalSection (& cond->waiters_count_lock);
+  LeaveCriticalSection(&cond->waiters_count_lock);
 
   /* yes it's the last waiter or it's a broadcast
    * only reset the manual event (the automatic event is reset in the WaitForMultipleObjects() function
    * by the system.
    */
   if (is_last_waiter)
-    if(!ResetEvent (cond->events[BROADCAST]))
-      THROW0(system_error,0,"ResetEvent failed");
+    if (!ResetEvent(cond->events[BROADCAST]))
+      THROW0(system_error, 0, "ResetEvent failed");
 
   /* relock the mutex associated with the condition in accordance with the posix thread specification */
-  EnterCriticalSection (& mutex->lock);
+  EnterCriticalSection(&mutex->lock);
 }
-void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex, double delay) {
+
+void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex,
+                           double delay)
+{
 
   unsigned long wait_result = WAIT_TIMEOUT;
   int is_last_waiter;
-  unsigned long end = (unsigned long)(delay * 1000);
+  unsigned long end = (unsigned long) (delay * 1000);
 
 
   if (delay < 0) {
-    xbt_os_cond_wait(cond,mutex);
+    xbt_os_cond_wait(cond, mutex);
   } else {
-    DEBUG3("xbt_cond_timedwait(%p,%p,%lu)",&(cond->events),&(mutex->lock),end);
+    DEBUG3("xbt_cond_timedwait(%p,%p,%lu)", &(cond->events), &(mutex->lock),
+           end);
 
     /* lock the threads counter and increment it */
-    EnterCriticalSection (& cond->waiters_count_lock);
+    EnterCriticalSection(&cond->waiters_count_lock);
     cond->waiters_count++;
-    LeaveCriticalSection (& cond->waiters_count_lock);
+    LeaveCriticalSection(&cond->waiters_count_lock);
 
     /* unlock the mutex associate with the condition */
-    LeaveCriticalSection (& mutex->lock);
+    LeaveCriticalSection(&mutex->lock);
     /* wait for a signal (broadcast or no) */
 
-    wait_result = WaitForMultipleObjects (2, cond->events, FALSE, end);
+    wait_result = WaitForMultipleObjects(2, cond->events, FALSE, end);
 
-    switch(wait_result) {
-      case WAIT_TIMEOUT:
-        THROW3(timeout_error,GetLastError(),"condition %p (mutex %p) wasn't signaled before timeout (%f)",cond,mutex, delay);
-      case WAIT_FAILED:
-        THROW0(system_error,GetLastError(),"WaitForMultipleObjects failed, so we cannot wait on the condition");
+    switch (wait_result) {
+    case WAIT_TIMEOUT:
+      THROW3(timeout_error, GetLastError(),
+             "condition %p (mutex %p) wasn't signaled before timeout (%f)",
+             cond, mutex, delay);
+    case WAIT_FAILED:
+      THROW0(system_error, GetLastError(),
+             "WaitForMultipleObjects failed, so we cannot wait on the condition");
     }
 
     /* we have a signal lock the condition */
-    EnterCriticalSection (& cond->waiters_count_lock);
+    EnterCriticalSection(&cond->waiters_count_lock);
     cond->waiters_count--;
 
     /* it's the last waiter or it's a broadcast ? */
-    is_last_waiter = ((wait_result == WAIT_OBJECT_0 + BROADCAST - 1) && (cond->waiters_count == 0));
+    is_last_waiter = ((wait_result == WAIT_OBJECT_0 + BROADCAST - 1)
+                      && (cond->waiters_count == 0));
 
-    LeaveCriticalSection (& cond->waiters_count_lock);
+    LeaveCriticalSection(&cond->waiters_count_lock);
 
     /* yes it's the last waiter or it's a broadcast
      * only reset the manual event (the automatic event is reset in the WaitForMultipleObjects() function
      * by the system.
      */
     if (is_last_waiter)
-      if(!ResetEvent (cond->events[BROADCAST]))
-        THROW0(system_error,0,"ResetEvent failed");
+      if (!ResetEvent(cond->events[BROADCAST]))
+        THROW0(system_error, 0, "ResetEvent failed");
 
     /* relock the mutex associated with the condition in accordance with the posix thread specification */
-    EnterCriticalSection (& mutex->lock);
+    EnterCriticalSection(&mutex->lock);
   }
-  /*THROW_UNIMPLEMENTED;*/
+  /*THROW_UNIMPLEMENTED; */
 }
 
-void xbt_os_cond_signal(xbt_os_cond_t cond) {
+void xbt_os_cond_signal(xbt_os_cond_t cond)
+{
   int have_waiters;
 
-  EnterCriticalSection (& cond->waiters_count_lock);
+  EnterCriticalSection(&cond->waiters_count_lock);
   have_waiters = cond->waiters_count > 0;
-  LeaveCriticalSection (& cond->waiters_count_lock);
+  LeaveCriticalSection(&cond->waiters_count_lock);
 
   if (have_waiters)
-    if(!SetEvent(cond->events[SIGNAL]))
-      THROW0(system_error,0,"SetEvent failed");
+    if (!SetEvent(cond->events[SIGNAL]))
+      THROW0(system_error, 0, "SetEvent failed");
 
   xbt_os_thread_yield();
 }
 
-void xbt_os_cond_broadcast(xbt_os_cond_t cond){
+void xbt_os_cond_broadcast(xbt_os_cond_t cond)
+{
   int have_waiters;
 
-  EnterCriticalSection (& cond->waiters_count_lock);
+  EnterCriticalSection(&cond->waiters_count_lock);
   have_waiters = cond->waiters_count > 0;
-  LeaveCriticalSection (& cond->waiters_count_lock);
+  LeaveCriticalSection(&cond->waiters_count_lock);
 
   if (have_waiters)
     SetEvent(cond->events[BROADCAST]);
 }
 
-void xbt_os_cond_destroy(xbt_os_cond_t cond){
+void xbt_os_cond_destroy(xbt_os_cond_t cond)
+{
   int error = 0;
 
-  if (!cond) return;
+  if (!cond)
+    return;
 
-  if(!CloseHandle(cond->events[SIGNAL]))
+  if (!CloseHandle(cond->events[SIGNAL]))
     error = 1;
 
-  if(!CloseHandle(cond->events[BROADCAST]))
+  if (!CloseHandle(cond->events[BROADCAST]))
     error = 1;
 
-  DeleteCriticalSection(& cond->waiters_count_lock);
+  DeleteCriticalSection(&cond->waiters_count_lock);
 
   xbt_free(cond);
 
   if (error)
-    THROW0(system_error,0,"Error while destroying the condition");
+    THROW0(system_error, 0, "Error while destroying the condition");
 }
 
 typedef struct xbt_os_sem_ {
   HANDLE h;
   unsigned int value;
   CRITICAL_SECTION value_lock;  /* protect access to value of the semaphore  */
-}s_xbt_os_sem_t ;
+} s_xbt_os_sem_t;
 
 #ifndef INT_MAX
-# define INT_MAX 32767 /* let's be safe by underestimating this value: this is for 16bits only */
+# define INT_MAX 32767          /* let's be safe by underestimating this value: this is for 16bits only */
 #endif
 
-xbt_os_sem_t
-xbt_os_sem_init(unsigned int value)
+xbt_os_sem_t xbt_os_sem_init(unsigned int value)
 {
   xbt_os_sem_t res;
 
-  if(value > INT_MAX)
-    THROW1(arg_error,value,"Semaphore initial value too big: %ud cannot be stored as a signed int",value);
+  if (value > INT_MAX)
+    THROW1(arg_error, value,
+           "Semaphore initial value too big: %ud cannot be stored as a signed int",
+           value);
 
-  res = (xbt_os_sem_t)xbt_new0(s_xbt_os_sem_t,1);
+  res = (xbt_os_sem_t) xbt_new0(s_xbt_os_sem_t, 1);
 
-  if(!(res->h = CreateSemaphore(NULL,value,(long)INT_MAX,NULL))) {
-    THROW1(system_error,GetLastError(),"CreateSemaphore() failed: %s",
+  if (!(res->h = CreateSemaphore(NULL, value, (long) INT_MAX, NULL))) {
+    THROW1(system_error, GetLastError(), "CreateSemaphore() failed: %s",
            strerror(GetLastError()));
     return NULL;
   }
@@ -909,15 +990,14 @@ xbt_os_sem_init(unsigned int value)
   return res;
 }
 
-void
-xbt_os_sem_acquire(xbt_os_sem_t sem)
+void xbt_os_sem_acquire(xbt_os_sem_t sem)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot acquire the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot acquire the NULL semaphore");
 
   /* wait failure */
-  if(WAIT_OBJECT_0 != WaitForSingleObject(sem->h,INFINITE))
-    THROW1(system_error,GetLastError(),"WaitForSingleObject() failed: %s",
+  if (WAIT_OBJECT_0 != WaitForSingleObject(sem->h, INFINITE))
+    THROW1(system_error, GetLastError(), "WaitForSingleObject() failed: %s",
            strerror(GetLastError()));
   EnterCriticalSection(&(sem->value_lock));
   sem->value--;
@@ -930,60 +1010,59 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double timeout)
   long milliseconds;
   double end = timeout + xbt_os_time();
 
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot acquire the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot acquire the NULL semaphore");
 
-  if (timeout < 0)
-  {
+  if (timeout < 0) {
     xbt_os_sem_acquire(sem);
-  }
-  else /* timeout can be zero <-> try acquire ) */
-  {
+  } else {                      /* timeout can be zero <-> try acquire ) */
+
 
     seconds = (long) floor(end);
-    milliseconds = (long)( ( end - seconds) * 1000);
+    milliseconds = (long) ((end - seconds) * 1000);
     milliseconds += (seconds * 1000);
 
-    switch(WaitForSingleObject(sem->h,milliseconds))
-    {
-      case WAIT_OBJECT_0:
-        EnterCriticalSection(&(sem->value_lock));
-        sem->value--;
-        LeaveCriticalSection(&(sem->value_lock));
-        return;
-
-      case WAIT_TIMEOUT:
-        THROW2(timeout_error,GetLastError(),"semaphore %p wasn't signaled before timeout (%f)",sem,timeout);
-        return;
-
-      default:
-        THROW3(system_error,GetLastError(),"WaitForSingleObject(%p,%f) failed: %s",sem,timeout, strerror(GetLastError()));
+    switch (WaitForSingleObject(sem->h, milliseconds)) {
+    case WAIT_OBJECT_0:
+      EnterCriticalSection(&(sem->value_lock));
+      sem->value--;
+      LeaveCriticalSection(&(sem->value_lock));
+      return;
+
+    case WAIT_TIMEOUT:
+      THROW2(timeout_error, GetLastError(),
+             "semaphore %p wasn't signaled before timeout (%f)", sem,
+             timeout);
+      return;
+
+    default:
+      THROW3(system_error, GetLastError(),
+             "WaitForSingleObject(%p,%f) failed: %s", sem, timeout,
+             strerror(GetLastError()));
     }
   }
 }
 
-void
-xbt_os_sem_release(xbt_os_sem_t sem)
+void xbt_os_sem_release(xbt_os_sem_t sem)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot release the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot release the NULL semaphore");
 
-  if(!ReleaseSemaphore(sem->h,1, NULL))
-    THROW1(system_error,GetLastError(),"ReleaseSemaphore() failed: %s",
+  if (!ReleaseSemaphore(sem->h, 1, NULL))
+    THROW1(system_error, GetLastError(), "ReleaseSemaphore() failed: %s",
            strerror(GetLastError()));
-  EnterCriticalSection (&(sem->value_lock));
+  EnterCriticalSection(&(sem->value_lock));
   sem->value++;
   LeaveCriticalSection(&(sem->value_lock));
 }
 
-void
-xbt_os_sem_destroy(xbt_os_sem_t sem)
+void xbt_os_sem_destroy(xbt_os_sem_t sem)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot destroy the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot destroy the NULL semaphore");
 
-  if(!CloseHandle(sem->h))
-    THROW1(system_error,GetLastError(),"CloseHandle() failed: %s",
+  if (!CloseHandle(sem->h))
+    THROW1(system_error, GetLastError(), "CloseHandle() failed: %s",
            strerror(GetLastError()));
 
   DeleteCriticalSection(&(sem->value_lock));
@@ -992,11 +1071,10 @@ xbt_os_sem_destroy(xbt_os_sem_t sem)
 
 }
 
-void
-xbt_os_sem_get_value(xbt_os_sem_t sem, int* svalue)
+void xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue)
 {
-  if(!sem)
-    THROW0(arg_error,EINVAL,"Cannot get the value of the NULL semaphore");
+  if (!sem)
+    THROW0(arg_error, EINVAL, "Cannot get the value of the NULL semaphore");
 
   EnterCriticalSection(&(sem->value_lock));
   *svalue = sem->value;
index 2976a76..ebd1f8b 100644 (file)
@@ -8,17 +8,18 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/sysdep.h"
-#include "xbt/xbt_os_time.h" /* this module */
+#include "xbt/xbt_os_time.h"    /* this module */
 #include "xbt/log.h"
 #include "portable.h"
-#include <math.h> /* floor */
+#include <math.h>               /* floor */
 
 
 #ifdef WIN32
 #include <sys/timeb.h>
 #endif
 
-double xbt_os_time(void) {
+double xbt_os_time(void)
+{
 #ifdef HAVE_GETTIMEOFDAY
   struct timeval tv;
   gettimeofday(&tv, NULL);
@@ -27,45 +28,46 @@ double xbt_os_time(void) {
 #  if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
   struct _timeb tm;
 
-  _ftime (&tm);
+  _ftime(&tm);
 
   tv.tv_sec = tm.time;
   tv.tv_usec = tm.millitm * 1000;
 
 #  else
-  FILETIME  ft;
+  FILETIME ft;
   unsigned __int64 tm;
 
-  GetSystemTimeAsFileTime (&ft);
-  tm = (unsigned __int64)ft.dwHighDateTime << 32;
+  GetSystemTimeAsFileTime(&ft);
+  tm = (unsigned __int64) ft.dwHighDateTime << 32;
   tm |= ft.dwLowDateTime;
-  tm /=10;
+  tm /= 10;
   tm -= 11644473600000000ULL;
 
-  tv.tv_sec  = (long) (tm / 1000000L);
+  tv.tv_sec = (long) (tm / 1000000L);
   tv.tv_usec = (long) (tm % 1000000L);
 #  endif /* windows version checker */
 
-#else  /* not windows, no gettimeofday => poor resolution */
-  return (double)(time(NULL));
+#else /* not windows, no gettimeofday => poor resolution */
+  return (double) (time(NULL));
 #endif /* HAVE_GETTIMEOFDAY? */
 
-  return (double)(tv.tv_sec + tv.tv_usec / 1000000.0);
+  return (double) (tv.tv_sec + tv.tv_usec / 1000000.0);
 }
 
-void xbt_os_sleep(double sec) {
+void xbt_os_sleep(double sec)
+{
 #ifdef HAVE_USLEEP
   sleep(sec);
-  (void)usleep( (sec - floor(sec)) * 1000000);
+  (void) usleep((sec - floor(sec)) * 1000000);
 
 #elif WIN32
-  Sleep((floor(sec) * 1000) +((sec - floor(sec)) * 1000));
+  Sleep((floor(sec) * 1000) + ((sec - floor(sec)) * 1000));
 
 #else /* don't have usleep. Use select to sleep less than one second */
   struct timeval timeout;
 
 
-  timeout.tv_sec =  (unsigned long)(sec);
+  timeout.tv_sec = (unsigned long) (sec);
   timeout.tv_usec = (sec - floor(sec)) * 1000000;
 
   select(0, NULL, NULL, NULL, &timeout);
@@ -84,38 +86,47 @@ void xbt_os_sleep(double sec) {
 
 struct s_xbt_os_timer {
 #ifdef HAVE_GETTIMEOFDAY
-  struct timeval start,stop;
+  struct timeval start, stop;
 #else
-  unsigned long int start,stop;
+  unsigned long int start, stop;
 #endif
 };
 
-xbt_os_timer_t xbt_os_timer_new(void) {
-  return xbt_new0(struct s_xbt_os_timer,1);
+xbt_os_timer_t xbt_os_timer_new(void)
+{
+  return xbt_new0(struct s_xbt_os_timer, 1);
 }
-void xbt_os_timer_free(xbt_os_timer_t timer) {
-  free (timer);
+
+void xbt_os_timer_free(xbt_os_timer_t timer)
+{
+  free(timer);
 }
-void xbt_os_timer_start(xbt_os_timer_t timer) {
+
+void xbt_os_timer_start(xbt_os_timer_t timer)
+{
 #ifdef HAVE_GETTIMEOFDAY
   gettimeofday(&(timer->start), NULL);
 #else
-  timer->start = (unsigned long int)(time(NULL));
+  timer->start = (unsigned long int) (time(NULL));
 #endif
 }
-void xbt_os_timer_stop(xbt_os_timer_t timer) {
+
+void xbt_os_timer_stop(xbt_os_timer_t timer)
+{
 #ifdef HAVE_GETTIMEOFDAY
   gettimeofday(&(timer->stop), NULL);
 #else
-  timer->stop = (unsigned long int)(time(NULL));
+  timer->stop = (unsigned long int) (time(NULL));
 #endif
 }
-double xbt_os_timer_elapsed(xbt_os_timer_t timer) {
+
+double xbt_os_timer_elapsed(xbt_os_timer_t timer)
+{
 #ifdef HAVE_GETTIMEOFDAY
-  return  ((double)timer->stop.tv_sec)  - ((double)timer->start.tv_sec) +
-  ((((double)timer->stop.tv_usec) - ((double)timer->start.tv_usec)) / 1000000.0);
+  return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec) +
+    ((((double) timer->stop.tv_usec) -
+      ((double) timer->start.tv_usec)) / 1000000.0);
 #else
-  return  (double)timer->stop  - (double)timer->start;
+  return (double) timer->stop - (double) timer->start;
 #endif
 }
-
index 1d47f29..730fb2f 100644 (file)
 #include "xbt/log.h"
 #include "xbt/peer.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(peer,xbt,"peer management");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(peer, xbt, "peer management");
 
 /** \brief constructor */
-xbt_peer_t xbt_peer_new(const char *name, int port)  {
-  xbt_peer_t res=xbt_new(s_xbt_peer_t, 1);
+xbt_peer_t xbt_peer_new(const char *name, int port)
+{
+  xbt_peer_t res = xbt_new(s_xbt_peer_t, 1);
   res->name = xbt_strdup(name);
   res->port = port;
   return res;
 }
 
-xbt_peer_t xbt_peer_copy(xbt_peer_t h) {
-  return xbt_peer_new(h->name,h->port);
+xbt_peer_t xbt_peer_copy(xbt_peer_t h)
+{
+  return xbt_peer_new(h->name, h->port);
 }
 
 /** \brief constructor. Argument should be of form '(peername):(port)'. */
-xbt_peer_t xbt_peer_from_string(const char *peerport)  {
-  xbt_peer_t res=xbt_new(s_xbt_peer_t, 1);
-  char *name=xbt_strdup(peerport);
-  char *port_str=strchr(name,':');
-  xbt_assert1(port_str,"argument of xbt_peer_from_string should be of form <peername>:<port>, it's '%s'", peerport);
-  *port_str='\0';
+xbt_peer_t xbt_peer_from_string(const char *peerport)
+{
+  xbt_peer_t res = xbt_new(s_xbt_peer_t, 1);
+  char *name = xbt_strdup(peerport);
+  char *port_str = strchr(name, ':');
+  xbt_assert1(port_str,
+              "argument of xbt_peer_from_string should be of form <peername>:<port>, it's '%s'",
+              peerport);
+  *port_str = '\0';
   port_str++;
 
   res->name = xbt_strdup(name); /* it will be shorter now that we cut the port */
@@ -41,14 +46,17 @@ xbt_peer_t xbt_peer_from_string(const char *peerport)  {
 }
 
 /** \brief destructor */
-void xbt_peer_free(xbt_peer_t peer) {
+void xbt_peer_free(xbt_peer_t peer)
+{
   if (peer) {
-    if (peer->name) free(peer->name);
+    if (peer->name)
+      free(peer->name);
     free(peer);
   }
 }
 
 /** \brief Freeing function for dynars of xbt_peer_t */
-void xbt_peer_free_voidp(void *d) {
-  xbt_peer_free( (xbt_peer_t) *(void**)d );
+void xbt_peer_free_voidp(void *d)
+{
+  xbt_peer_free((xbt_peer_t) * (void **) d);
 }
index 976054f..f7c70ed 100644 (file)
 #include "xbt/dynar.h"
 
 #include "xbt/synchro.h"
-#include "xbt/queue.h" /* this module */
+#include "xbt/queue.h"          /* this module */
 #include "gras/virtu.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue,xbt,"Message exchanging queue");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue, xbt, "Message exchanging queue");
 
 typedef struct s_xbt_queue_ {
   int capacity;
   xbt_dynar_t data;
   xbt_mutex_t mutex;
-  xbt_cond_t  not_full, not_empty;
+  xbt_cond_t not_full, not_empty;
 } s_xbt_queue_t;
 
 /** @brief Create a new message exchange queue.
@@ -30,36 +30,40 @@ typedef struct s_xbt_queue_ {
  * @param capacity the capacity of the queue. If non-nul, any attempt to push an item which would let the size of the queue over this number will be blocking until someone else pop some data
  * @param elm_size size of each element stored in it (see #xbt_dynar_new)
  */
-xbt_queue_t xbt_queue_new(int capacity,unsigned long elm_size) {
-  xbt_queue_t res = xbt_new0(s_xbt_queue_t,1);
-  xbt_assert0(capacity>=0,"Capacity cannot be negative");
+xbt_queue_t xbt_queue_new(int capacity, unsigned long elm_size)
+{
+  xbt_queue_t res = xbt_new0(s_xbt_queue_t, 1);
+  xbt_assert0(capacity >= 0, "Capacity cannot be negative");
 
   res->capacity = capacity;
-  res->data = xbt_dynar_new(elm_size,NULL);
+  res->data = xbt_dynar_new(elm_size, NULL);
   res->mutex = xbt_mutex_init();
   res->not_full = xbt_cond_init();
   res->not_empty = xbt_cond_init();
   return res;
 }
+
 /** @brief Destroy a message exchange queue.
  *
  * Any remaining content is leaked.
  */
-void xbt_queue_free(xbt_queue_t *queue) {
+void xbt_queue_free(xbt_queue_t * queue)
+{
 
-  xbt_dynar_free(&( (*queue)->data ));
-  xbt_mutex_destroy( (*queue)->mutex );
-  xbt_cond_destroy( (*queue)->not_full );
-  xbt_cond_destroy( (*queue)->not_empty );
+  xbt_dynar_free(&((*queue)->data));
+  xbt_mutex_destroy((*queue)->mutex);
+  xbt_cond_destroy((*queue)->not_full);
+  xbt_cond_destroy((*queue)->not_empty);
   free((*queue));
   *queue = NULL;
 }
 
 /** @brief Get the queue size */
-unsigned long xbt_queue_length(const xbt_queue_t queue) {
+unsigned long xbt_queue_length(const xbt_queue_t queue)
+{
   unsigned long res;
   xbt_mutex_acquire(queue->mutex);
-  res=xbt_dynar_length(queue->data);
+  res = xbt_dynar_length(queue->data);
   xbt_mutex_release(queue->mutex);
   return res;
 }
@@ -70,13 +74,15 @@ unsigned long xbt_queue_length(const xbt_queue_t queue) {
  *
  * @see #xbt_dynar_push
  */
-void xbt_queue_push(xbt_queue_t queue, const void *src) {
+void xbt_queue_push(xbt_queue_t queue, const void *src)
+{
   xbt_mutex_acquire(queue->mutex);
-  while (queue->capacity != 0 && queue->capacity == xbt_dynar_length(queue->data)) {
-    DEBUG2("Capacity of %p exceded (=%d). Waiting",queue,queue->capacity);
-    xbt_cond_wait(queue->not_full,queue->mutex);
+  while (queue->capacity != 0
+         && queue->capacity == xbt_dynar_length(queue->data)) {
+    DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
+    xbt_cond_wait(queue->not_full, queue->mutex);
   }
-  xbt_dynar_push(queue->data,src);
+  xbt_dynar_push(queue->data, src);
   xbt_cond_signal(queue->not_empty);
   xbt_mutex_release(queue->mutex);
 }
@@ -89,13 +95,14 @@ void xbt_queue_push(xbt_queue_t queue, const void *src) {
  * @see #xbt_dynar_pop
  *
  */
-void xbt_queue_pop(xbt_queue_t queue, void* const dst) {
+void xbt_queue_pop(xbt_queue_t queue, void *const dst)
+{
   xbt_mutex_acquire(queue->mutex);
   while (xbt_dynar_length(queue->data) == 0) {
-    DEBUG1("Queue %p empty. Waiting",queue);
-    xbt_cond_wait(queue->not_empty,queue->mutex);
+    DEBUG1("Queue %p empty. Waiting", queue);
+    xbt_cond_wait(queue->not_empty, queue->mutex);
   }
-  xbt_dynar_pop(queue->data,dst);
+  xbt_dynar_pop(queue->data, dst);
   xbt_cond_signal(queue->not_full);
   xbt_mutex_release(queue->mutex);
 }
@@ -106,13 +113,15 @@ void xbt_queue_pop(xbt_queue_t queue, void* const dst) {
  *
  * @see #xbt_dynar_unshift
  */
-void xbt_queue_unshift(xbt_queue_t queue, const void *src) {
+void xbt_queue_unshift(xbt_queue_t queue, const void *src)
+{
   xbt_mutex_acquire(queue->mutex);
-  while (queue->capacity != 0 && queue->capacity == xbt_dynar_length(queue->data)) {
-    DEBUG2("Capacity of %p exceded (=%d). Waiting",queue,queue->capacity);
-    xbt_cond_wait(queue->not_full,queue->mutex);
+  while (queue->capacity != 0
+         && queue->capacity == xbt_dynar_length(queue->data)) {
+    DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
+    xbt_cond_wait(queue->not_full, queue->mutex);
   }
-  xbt_dynar_unshift(queue->data,src);
+  xbt_dynar_unshift(queue->data, src);
   xbt_cond_signal(queue->not_empty);
   xbt_mutex_release(queue->mutex);
 }
@@ -125,13 +134,14 @@ void xbt_queue_unshift(xbt_queue_t queue, const void *src) {
  * @see #xbt_dynar_shift
  *
  */
-void xbt_queue_shift(xbt_queue_t queue, void* const dst) {
+void xbt_queue_shift(xbt_queue_t queue, void *const dst)
+{
   xbt_mutex_acquire(queue->mutex);
   while (xbt_dynar_length(queue->data) == 0) {
-    DEBUG1("Queue %p empty. Waiting",queue);
-    xbt_cond_wait(queue->not_empty,queue->mutex);
+    DEBUG1("Queue %p empty. Waiting", queue);
+    xbt_cond_wait(queue->not_empty, queue->mutex);
   }
-  xbt_dynar_shift(queue->data,dst);
+  xbt_dynar_shift(queue->data, dst);
   xbt_cond_signal(queue->not_full);
   xbt_mutex_release(queue->mutex);
 }
@@ -143,7 +153,8 @@ void xbt_queue_shift(xbt_queue_t queue, void* const dst) {
  *
  * @see #xbt_queue_push
  */
-void xbt_queue_push_timed(xbt_queue_t queue, const void *src,double delay) {
+void xbt_queue_push_timed(xbt_queue_t queue, const void *src, double delay)
+{
   double begin = xbt_time();
   xbt_ex_t e;
 
@@ -154,27 +165,27 @@ void xbt_queue_push_timed(xbt_queue_t queue, const void *src,double delay) {
         queue->capacity == xbt_dynar_length(queue->data)) {
 
       xbt_mutex_release(queue->mutex);
-      THROW2(timeout_error,0,"Capacity of %p exceded (=%d), and delay = 0",
-             queue,queue->capacity);
+      THROW2(timeout_error, 0, "Capacity of %p exceded (=%d), and delay = 0",
+             queue, queue->capacity);
     }
   } else {
     while (queue->capacity != 0 &&
-        queue->capacity == xbt_dynar_length(queue->data) &&
-        (delay<0 || (xbt_time() - begin) <= delay) ) {
+           queue->capacity == xbt_dynar_length(queue->data) &&
+           (delay < 0 || (xbt_time() - begin) <= delay)) {
 
-      DEBUG2("Capacity of %p exceded (=%d). Waiting",
-             queue,queue->capacity);
+      DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
       TRY {
-        xbt_cond_timedwait(queue->not_full,queue->mutex,
-                           delay < 0 ? -1 : delay - (xbt_time()-begin));
-      } CATCH(e) {
+        xbt_cond_timedwait(queue->not_full, queue->mutex,
+                           delay < 0 ? -1 : delay - (xbt_time() - begin));
+      }
+      CATCH(e) {
         xbt_mutex_release(queue->mutex);
         RETHROW;
       }
     }
   }
 
-  xbt_dynar_push(queue->data,src);
+  xbt_dynar_push(queue->data, src);
   xbt_cond_signal(queue->not_empty);
   xbt_mutex_release(queue->mutex);
 }
@@ -185,7 +196,8 @@ void xbt_queue_push_timed(xbt_queue_t queue, const void *src,double delay) {
  * @see #xbt_queue_pop
  *
  */
-void xbt_queue_pop_timed(xbt_queue_t queue, void* const dst,double delay) {
+void xbt_queue_pop_timed(xbt_queue_t queue, void *const dst, double delay)
+{
   double begin = xbt_time();
   xbt_ex_t e;
 
@@ -194,23 +206,24 @@ void xbt_queue_pop_timed(xbt_queue_t queue, void* const dst,double delay) {
   if (delay == 0) {
     if (xbt_dynar_length(queue->data) == 0) {
       xbt_mutex_release(queue->mutex);
-      THROW0(timeout_error,0,"Delay = 0, and queue is empty");
+      THROW0(timeout_error, 0, "Delay = 0, and queue is empty");
     }
   } else {
-    while ( (xbt_dynar_length(queue->data) == 0) &&
-        (delay<0 || (xbt_time() - begin) <= delay) ) {
-      DEBUG1("Queue %p empty. Waiting",queue);
+    while ((xbt_dynar_length(queue->data) == 0) &&
+           (delay < 0 || (xbt_time() - begin) <= delay)) {
+      DEBUG1("Queue %p empty. Waiting", queue);
       TRY {
-        xbt_cond_timedwait(queue->not_empty,queue->mutex,
-                           delay<0 ? -1 : delay - (xbt_time()-begin));
-      } CATCH(e) {
+        xbt_cond_timedwait(queue->not_empty, queue->mutex,
+                           delay < 0 ? -1 : delay - (xbt_time() - begin));
+      }
+      CATCH(e) {
         xbt_mutex_release(queue->mutex);
         RETHROW;
       }
     }
   }
 
-  xbt_dynar_pop(queue->data,dst);
+  xbt_dynar_pop(queue->data, dst);
   xbt_cond_signal(queue->not_full);
   xbt_mutex_release(queue->mutex);
 }
@@ -219,38 +232,39 @@ void xbt_queue_pop_timed(xbt_queue_t queue, void* const dst,double delay) {
  *
  * @see #xbt_queue_unshift
  */
-void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src,double delay) {
+void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src, double delay)
+{
   double begin = xbt_time();
   xbt_ex_t e;
 
   xbt_mutex_acquire(queue->mutex);
 
-  if (delay==0) {
+  if (delay == 0) {
     if (queue->capacity != 0 &&
         queue->capacity == xbt_dynar_length(queue->data)) {
 
       xbt_mutex_release(queue->mutex);
-      THROW2(timeout_error,0,"Capacity of %p exceded (=%d), and delay = 0",
-             queue,queue->capacity);
+      THROW2(timeout_error, 0, "Capacity of %p exceded (=%d), and delay = 0",
+             queue, queue->capacity);
     }
   } else {
     while (queue->capacity != 0 &&
-        queue->capacity == xbt_dynar_length(queue->data) &&
-        (delay<0 || (xbt_time() - begin) <= delay) ) {
+           queue->capacity == xbt_dynar_length(queue->data) &&
+           (delay < 0 || (xbt_time() - begin) <= delay)) {
 
-      DEBUG2("Capacity of %p exceded (=%d). Waiting",
-             queue,queue->capacity);
+      DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
       TRY {
-        xbt_cond_timedwait(queue->not_full,queue->mutex,
-                           delay < 0 ? -1 : delay - (xbt_time()-begin));
-      } CATCH(e) {
+        xbt_cond_timedwait(queue->not_full, queue->mutex,
+                           delay < 0 ? -1 : delay - (xbt_time() - begin));
+      }
+      CATCH(e) {
         xbt_mutex_release(queue->mutex);
         RETHROW;
       }
     }
   }
 
-  xbt_dynar_unshift(queue->data,src);
+  xbt_dynar_unshift(queue->data, src);
   xbt_cond_signal(queue->not_empty);
   xbt_mutex_release(queue->mutex);
 }
@@ -261,7 +275,8 @@ void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src,double delay) {
  * @see #xbt_queue_shift
  *
  */
-void xbt_queue_shift_timed(xbt_queue_t queue, void* const dst,double delay) {
+void xbt_queue_shift_timed(xbt_queue_t queue, void *const dst, double delay)
+{
   double begin = xbt_time();
   xbt_ex_t e;
 
@@ -270,16 +285,17 @@ void xbt_queue_shift_timed(xbt_queue_t queue, void* const dst,double delay) {
   if (delay == 0) {
     if (xbt_dynar_length(queue->data) == 0) {
       xbt_mutex_release(queue->mutex);
-      THROW0(timeout_error,0,"Delay = 0, and queue is empty");
+      THROW0(timeout_error, 0, "Delay = 0, and queue is empty");
     }
   } else {
-    while ( (xbt_dynar_length(queue->data) == 0) &&
-        (delay<0 || (xbt_time() - begin) <= delay) ) {
-      DEBUG1("Queue %p empty. Waiting",queue);
+    while ((xbt_dynar_length(queue->data) == 0) &&
+           (delay < 0 || (xbt_time() - begin) <= delay)) {
+      DEBUG1("Queue %p empty. Waiting", queue);
       TRY {
-        xbt_cond_timedwait(queue->not_empty,queue->mutex,
-                           delay<0 ? -1 : delay - (xbt_time()-begin));
-      } CATCH(e) {
+        xbt_cond_timedwait(queue->not_empty, queue->mutex,
+                           delay < 0 ? -1 : delay - (xbt_time() - begin));
+      }
+      CATCH(e) {
         xbt_mutex_release(queue->mutex);
         RETHROW;
       }
@@ -288,10 +304,11 @@ void xbt_queue_shift_timed(xbt_queue_t queue, void* const dst,double delay) {
 
   if (xbt_dynar_length(queue->data) == 0) {
     xbt_mutex_release(queue->mutex);
-    THROW1(timeout_error,0,"Timeout (%f) elapsed, but queue still empty",delay);
+    THROW1(timeout_error, 0, "Timeout (%f) elapsed, but queue still empty",
+           delay);
   }
 
-  xbt_dynar_shift(queue->data,dst);
+  xbt_dynar_shift(queue->data, dst);
   xbt_cond_signal(queue->not_full);
   xbt_mutex_release(queue->mutex);
 }
index 88c6859..1a74c0b 100644 (file)
 #include "xbt/ex.h"
 #include "portable.h"
 
-#include "xbt/synchro.h"       /* This module */
-#include "xbt/xbt_os_thread.h" /* The implementation we use */
+#include "xbt/synchro.h"        /* This module */
+#include "xbt/xbt_os_thread.h"  /* The implementation we use */
 
 /* the implementation would be cleaner (and faster) with ELF symbol aliasing */
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_rl,xbt,"Synchronization mechanism (RL)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_rl, xbt,
+                                "Synchronization mechanism (RL)");
 
 typedef struct s_xbt_thread_ {
   xbt_os_thread_t os_thread;
   void_f_pvoid_t code;
   void *userparam;
-}s_xbt_thread_t;
+} s_xbt_thread_t;
 
-static void *xbt_thread_create_wrapper(void *p)  {
-  xbt_thread_t t = (xbt_thread_t)p;
-  DEBUG1("I'm thread %p",p);
-  (*t->code)(t->userparam);
+static void *xbt_thread_create_wrapper(void *p)
+{
+  xbt_thread_t t = (xbt_thread_t) p;
+  DEBUG1("I'm thread %p", p);
+  (*t->code) (t->userparam);
   return NULL;
 }
 
 
-xbt_thread_t xbt_thread_create(const char*name,void_f_pvoid_t code, void* param) {
+xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code,
+                               void *param)
+{
 
-  xbt_thread_t res = xbt_new0(s_xbt_thread_t,1);
+  xbt_thread_t res = xbt_new0(s_xbt_thread_t, 1);
   res->userparam = param;
   res->code = code;
-  DEBUG1("Create thread %p",res);
-  res->os_thread = xbt_os_thread_create(name,xbt_thread_create_wrapper,res);
+  DEBUG1("Create thread %p", res);
+  res->os_thread = xbt_os_thread_create(name, xbt_thread_create_wrapper, res);
   return res;
 }
 
-const char* xbt_thread_name(xbt_thread_t t) {
+const char *xbt_thread_name(xbt_thread_t t)
+{
   return xbt_os_thread_name(t->os_thread);
 }
 
-const char* xbt_thread_self_name(void) {
+const char *xbt_thread_self_name(void)
+{
   return xbt_os_thread_self_name();
 }
 
-void
-xbt_thread_join(xbt_thread_t thread) {
-  DEBUG1("Join thread %p",thread);
-  xbt_os_thread_join( thread->os_thread, NULL );
+void xbt_thread_join(xbt_thread_t thread)
+{
+  DEBUG1("Join thread %p", thread);
+  xbt_os_thread_join(thread->os_thread, NULL);
 }
 
-void xbt_thread_exit() {
+void xbt_thread_exit()
+{
   DEBUG0("Thread exits");
   xbt_os_thread_exit(NULL);
 }
 
-xbt_thread_t xbt_thread_self(void) {
-  return (xbt_thread_t)xbt_os_thread_self();
+xbt_thread_t xbt_thread_self(void)
+{
+  return (xbt_thread_t) xbt_os_thread_self();
 }
 
-void xbt_thread_yield(void) {
+void xbt_thread_yield(void)
+{
   DEBUG0("Thread yields");
   xbt_os_thread_yield();
 }
-void xbt_thread_cancel(xbt_thread_t t) {
-  DEBUG1("Cancel thread %p",t);
+
+void xbt_thread_cancel(xbt_thread_t t)
+{
+  DEBUG1("Cancel thread %p", t);
   xbt_os_thread_cancel(t->os_thread);
 }
+
 /****** mutex related functions ******/
 struct xbt_mutex_ {
   /* KEEP IT IN SYNC WITH OS IMPLEMENTATION (both win and lin) */
@@ -87,35 +99,39 @@ struct xbt_mutex_ {
 #endif
 };
 
-xbt_mutex_t xbt_mutex_init(void) {
-  xbt_mutex_t res = (xbt_mutex_t)xbt_os_mutex_init();
+xbt_mutex_t xbt_mutex_init(void)
+{
+  xbt_mutex_t res = (xbt_mutex_t) xbt_os_mutex_init();
   DEBUG1("Create mutex %p", res);
   return res;
 }
 
-void xbt_mutex_acquire(xbt_mutex_t mutex) {
+void xbt_mutex_acquire(xbt_mutex_t mutex)
+{
   DEBUG1("Acquire mutex %p", mutex);
-  xbt_os_mutex_acquire( (xbt_os_mutex_t)mutex );
+  xbt_os_mutex_acquire((xbt_os_mutex_t) mutex);
 }
 
 void xbt_mutex_timedacquire(xbt_mutex_t mutex, double delay)
 {
-  DEBUG2("Acquire mutex %p with delay %lf", mutex,delay);
-  xbt_os_mutex_timedacquire( (xbt_os_mutex_t)mutex,delay );
+  DEBUG2("Acquire mutex %p with delay %lf", mutex, delay);
+  xbt_os_mutex_timedacquire((xbt_os_mutex_t) mutex, delay);
 }
 
-void xbt_mutex_release(xbt_mutex_t mutex) {
+void xbt_mutex_release(xbt_mutex_t mutex)
+{
   DEBUG1("Unlock mutex %p", mutex);
-  xbt_os_mutex_release( (xbt_os_mutex_t)mutex );
+  xbt_os_mutex_release((xbt_os_mutex_t) mutex);
 }
 
-void xbt_mutex_destroy(xbt_mutex_t mutex) {
+void xbt_mutex_destroy(xbt_mutex_t mutex)
+{
   DEBUG1("Destroy mutex %p", mutex);
-  xbt_os_mutex_destroy( (xbt_os_mutex_t)mutex );
+  xbt_os_mutex_destroy((xbt_os_mutex_t) mutex);
 }
 
 #ifdef WIN32
-enum { /* KEEP IT IN SYNC WITH OS IMPLEM */
+enum {                          /* KEEP IT IN SYNC WITH OS IMPLEM */
   SIGNAL = 0,
   BROADCAST = 1,
   MAX_EVENTS = 2
@@ -130,38 +146,45 @@ typedef struct xbt_cond_ {
 #elif defined(WIN32)
   HANDLE events[MAX_EVENTS];
 
-  unsigned int waiters_count;           /* the number of waiters                        */
+  unsigned int waiters_count;   /* the number of waiters                        */
   CRITICAL_SECTION waiters_count_lock;  /* protect access to waiters_count  */
 #endif
 } s_xbt_cond_t;
 
-xbt_cond_t xbt_cond_init(void) {
+xbt_cond_t xbt_cond_init(void)
+{
   xbt_cond_t res = (xbt_cond_t) xbt_os_cond_init();
   DEBUG1("Create cond %p", res);
   return res;
 }
 
-void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex) {
+void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex)
+{
   DEBUG2("Wait cond %p, mutex %p", cond, mutex);
-  xbt_os_cond_wait( (xbt_os_cond_t)cond, (xbt_os_mutex_t)mutex );
+  xbt_os_cond_wait((xbt_os_cond_t) cond, (xbt_os_mutex_t) mutex);
 }
 
-void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay) {
-  DEBUG3("Wait cond %p, mutex %p for %f sec", cond, mutex,delay);
-  xbt_os_cond_timedwait( (xbt_os_cond_t)cond, (xbt_os_mutex_t)mutex, delay );
+void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
+{
+  DEBUG3("Wait cond %p, mutex %p for %f sec", cond, mutex, delay);
+  xbt_os_cond_timedwait((xbt_os_cond_t) cond, (xbt_os_mutex_t) mutex, delay);
   DEBUG3("Done waiting cond %p, mutex %p for %f sec", cond, mutex, delay);
 }
 
-void xbt_cond_signal(xbt_cond_t cond) {
+void xbt_cond_signal(xbt_cond_t cond)
+{
   DEBUG1("Signal cond %p", cond);
-  xbt_os_cond_signal( (xbt_os_cond_t)cond );
+  xbt_os_cond_signal((xbt_os_cond_t) cond);
 }
 
-void xbt_cond_broadcast(xbt_cond_t cond){
+void xbt_cond_broadcast(xbt_cond_t cond)
+{
   DEBUG1("Broadcast cond %p", cond);
-  xbt_os_cond_broadcast( (xbt_os_cond_t)cond );
+  xbt_os_cond_broadcast((xbt_os_cond_t) cond);
 }
-void xbt_cond_destroy(xbt_cond_t cond){
+
+void xbt_cond_destroy(xbt_cond_t cond)
+{
   DEBUG1("Destroy cond %p", cond);
-  xbt_os_cond_destroy( (xbt_os_cond_t)cond );
+  xbt_os_cond_destroy((xbt_os_cond_t) cond);
 }
index 1f1f1c4..72210a1 100644 (file)
@@ -7,19 +7,22 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <math.h> /* floor */
+#include <math.h>               /* floor */
 
 #include "portable.h"
 
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "gras/virtu.h"
-#include "xbt/xbt_os_time.h" /* private */
+#include "xbt/xbt_os_time.h"    /* private */
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu);
-double xbt_time(void) {
+double xbt_time(void)
+{
   return xbt_os_time();
 }
-void xbt_sleep(double sec) {
+
+void xbt_sleep(double sec)
+{
   xbt_os_sleep(sec);
 }
index 88d78e4..7feeeec 100644 (file)
@@ -20,7 +20,7 @@
 #include "xbt_modinter.h"
 #include "xbt/sysdep.h"
 #include "xbt/xbt_os_thread.h"
-#include "portable.h" /* CONTEXT_THREADS */
+#include "portable.h"           /* CONTEXT_THREADS */
 
 #ifndef CONTEXT_THREADS
 
  */
 
 /* Mod_init/exit mecanism */
-void xbt_os_thread_mod_init(void) {}
+void xbt_os_thread_mod_init(void)
+{
+}
 
-void xbt_os_thread_mod_exit(void) {}
+void xbt_os_thread_mod_exit(void)
+{
+}
 
 
 /* Main functions */
 
-xbt_os_thread_t xbt_os_thread_create(const char*name,pvoid_f_pvoid_t start_routine,void* param) {
+xbt_os_thread_t xbt_os_thread_create(const char *name,
+                                     pvoid_f_pvoid_t start_routine,
+                                     void *param)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
 }
 
-void xbt_os_thread_exit(int *retcode){
+void xbt_os_thread_exit(int *retcode)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_thread_exit)");
 }
 
-xbt_os_thread_t xbt_os_thread_self(void){
+xbt_os_thread_t xbt_os_thread_self(void)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_self)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_thread_self)");
 }
 
-void xbt_os_thread_yield(void){
+void xbt_os_thread_yield(void)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_yield)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_thread_yield)");
 }
 
 
-xbt_os_mutex_t xbt_os_mutex_init(void){
+xbt_os_mutex_t xbt_os_mutex_init(void)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_init)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_init)");
 }
 
-void xbt_os_mutex_acquire(xbt_os_mutex_t mutex){
+void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_acquire)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_acquire)");
 }
 
-void xbt_os_mutex_release(xbt_os_mutex_t mutex){
+void xbt_os_mutex_release(xbt_os_mutex_t mutex)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_release)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_release)");
 }
 
-void xbt_os_mutex_destroy(xbt_os_mutex_t mutex){
+void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_mutex_destroy)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_mutex_destroy)");
 }
 
-xbt_os_cond_t xbt_os_cond_init(void){
+xbt_os_cond_t xbt_os_cond_init(void)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_init)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_cond_init)");
 }
 
-void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex){
+void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_wait)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_cond_wait)");
 }
 
-void xbt_os_cond_signal(xbt_os_cond_t cond){
+void xbt_os_cond_signal(xbt_os_cond_t cond)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_signal)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_cond_signal)");
 }
 
-void xbt_os_cond_broadcast(xbt_os_cond_t cond){
+void xbt_os_cond_broadcast(xbt_os_cond_t cond)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_broadcast)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_cond_broadcast)");
 }
 
-void xbt_os_cond_destroy(xbt_os_cond_t cond){
+void xbt_os_cond_destroy(xbt_os_cond_t cond)
+{
   xbt_backtrace_display_current();
-  xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
+  xbt_die
+    ("No pthread in SG when compiled against the ucontext (xbt_os_cond_destroy)");
 }
 #endif
 
 
 #ifndef HAVE_JAVA
 #include "xbt/xbt_context_private.h"
-void xbt_ctx_java_factory_init(xbt_context_factory_t* factory) {}
+void xbt_ctx_java_factory_init(xbt_context_factory_t * factory)
+{
+}
 #endif
index 00dd1a4..c0d02a9 100644 (file)
@@ -13,9 +13,9 @@
 
 #include "xbt/ex.h"
 
-#include "xbt/synchro.h"     /* This module */
+#include "xbt/synchro.h"        /* This module */
 
-#include "simix/simix.h"     /* used implementation */
+#include "simix/simix.h"        /* used implementation */
 #include "simix/datatypes.h"
 
 /* the implementation would be cleaner (and faster) with ELF symbol aliasing */
@@ -28,17 +28,21 @@ typedef struct s_xbt_thread_ {
   void *father_data;
 } s_xbt_thread_t;
 
-static int xbt_thread_create_wrapper(int argc, char *argv[]) {
-  xbt_thread_t t = (xbt_thread_t)SIMIX_process_get_data(SIMIX_process_self());
-  SIMIX_process_set_data(SIMIX_process_self(),t->father_data);
-  (*t->code)(t->userparam);
+static int xbt_thread_create_wrapper(int argc, char *argv[])
+{
+  xbt_thread_t t =
+    (xbt_thread_t) SIMIX_process_get_data(SIMIX_process_self());
+  SIMIX_process_set_data(SIMIX_process_self(), t->father_data);
+  (*t->code) (t->userparam);
   free(t->name);
   free(t);
   return 0;
 }
 
-xbt_thread_t xbt_thread_create(const char*name,void_f_pvoid_t code, void* param)  {
-  xbt_thread_t res = xbt_new0(s_xbt_thread_t,1);
+xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code,
+                               void *param)
+{
+  xbt_thread_t res = xbt_new0(s_xbt_thread_t, 1);
   res->name = xbt_strdup(name);
   res->userparam = param;
   res->code = code;
@@ -46,105 +50,122 @@ xbt_thread_t xbt_thread_create(const char*name,void_f_pvoid_t code, void* param)
   //   char*name = bprintf("%s#%p",SIMIX_process_get_name(SIMIX_process_self()), param);
   res->s_process = SIMIX_process_create(name,
                                         xbt_thread_create_wrapper, res,
-                                        SIMIX_host_get_name(SIMIX_host_self()),
-                                        0,NULL,/*props*/NULL);
+                                        SIMIX_host_get_name(SIMIX_host_self
+                                                            ()), 0, NULL,
+                                        /*props */ NULL);
   //   free(name);
   return res;
 }
 
-const char* xbt_thread_name(xbt_thread_t t) {
+const char *xbt_thread_name(xbt_thread_t t)
+{
   return t->name;
 }
 
-const char* xbt_thread_self_name(void) {
+const char *xbt_thread_self_name(void)
+{
   xbt_thread_t me = xbt_thread_self();
   return me ? me->name : "maestro";
 }
 
 
-void
-xbt_thread_join(xbt_thread_t thread) {
-  THROW_UNIMPLEMENTED; /* FIXME */
+void xbt_thread_join(xbt_thread_t thread)
+{
+  THROW_UNIMPLEMENTED;          /* FIXME */
 }
 
-void
-xbt_thread_cancel(xbt_thread_t thread) {
+void xbt_thread_cancel(xbt_thread_t thread)
+{
   SIMIX_process_kill(thread->s_process);
   free(thread->name);
   free(thread);
 }
 
-void xbt_thread_exit() {
-  xbt_thread_t me=SIMIX_process_get_data(SIMIX_process_self());
+void xbt_thread_exit()
+{
+  xbt_thread_t me = SIMIX_process_get_data(SIMIX_process_self());
   SIMIX_process_kill(me->s_process);
   free(me);
 }
 
-xbt_thread_t xbt_thread_self(void) {
+xbt_thread_t xbt_thread_self(void)
+{
   smx_process_t p = SIMIX_process_self();
   return p ? SIMIX_process_get_data(p) : NULL;
 }
 
-void xbt_thread_yield(void) {
-  THROW_UNIMPLEMENTED; /* FIXME */
+void xbt_thread_yield(void)
+{
+  THROW_UNIMPLEMENTED;          /* FIXME */
 }
 
 /****** mutex related functions ******/
 struct s_xbt_mutex_ {
 
   /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_mutex */
-  xbt_swag_t sleeping;                 /* list of sleeping process */
-  int refcount ;
+  xbt_swag_t sleeping;          /* list of sleeping process */
+  int refcount;
   /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_mutex */
 
 };
 
-xbt_mutex_t xbt_mutex_init(void) {
-  return (xbt_mutex_t)SIMIX_mutex_init();
+xbt_mutex_t xbt_mutex_init(void)
+{
+  return (xbt_mutex_t) SIMIX_mutex_init();
 }
 
-void xbt_mutex_acquire(xbt_mutex_t mutex) {
-  SIMIX_mutex_lock( (smx_mutex_t)mutex) ;
+void xbt_mutex_acquire(xbt_mutex_t mutex)
+{
+  SIMIX_mutex_lock((smx_mutex_t) mutex);
 }
 
-void xbt_mutex_release(xbt_mutex_t mutex) {
-  SIMIX_mutex_unlock( (smx_mutex_t)mutex );
+void xbt_mutex_release(xbt_mutex_t mutex)
+{
+  SIMIX_mutex_unlock((smx_mutex_t) mutex);
 }
 
-void xbt_mutex_destroy(xbt_mutex_t mutex) {
-  SIMIX_mutex_destroy( (smx_mutex_t)mutex );
+void xbt_mutex_destroy(xbt_mutex_t mutex)
+{
+  SIMIX_mutex_destroy((smx_mutex_t) mutex);
 }
 
 /***** condition related functions *****/
 struct s_xbt_cond_ {
 
   /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_cond */
-  xbt_swag_t sleeping;                         /* list of sleeping process */
-  smx_mutex_t  mutex;
-  xbt_fifo_t actions;                  /* list of actions */
+  xbt_swag_t sleeping;          /* list of sleeping process */
+  smx_mutex_t mutex;
+  xbt_fifo_t actions;           /* list of actions */
   /* KEEP IT IN SYNC WITH src/simix/private.h::struct s_smx_cond */
 
 };
 
-xbt_cond_t xbt_cond_init(void) {
-  return (xbt_cond_t)SIMIX_cond_init();
+xbt_cond_t xbt_cond_init(void)
+{
+  return (xbt_cond_t) SIMIX_cond_init();
 }
 
-void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex) {
-  SIMIX_cond_wait( (smx_cond_t)cond , (smx_mutex_t)mutex );
+void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex)
+{
+  SIMIX_cond_wait((smx_cond_t) cond, (smx_mutex_t) mutex);
 }
 
-void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay) {
-  SIMIX_cond_wait_timeout( (smx_cond_t)cond , (smx_mutex_t)mutex, delay );
+void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
+{
+  SIMIX_cond_wait_timeout((smx_cond_t) cond, (smx_mutex_t) mutex, delay);
 }
 
-void xbt_cond_signal(xbt_cond_t cond) {
-  SIMIX_cond_signal( (smx_cond_t)cond );
+void xbt_cond_signal(xbt_cond_t cond)
+{
+  SIMIX_cond_signal((smx_cond_t) cond);
 }
 
-void xbt_cond_broadcast(xbt_cond_t cond){
-  SIMIX_cond_broadcast( (smx_cond_t)cond );
+void xbt_cond_broadcast(xbt_cond_t cond)
+{
+  SIMIX_cond_broadcast((smx_cond_t) cond);
 }
-void xbt_cond_destroy(xbt_cond_t cond){
-  SIMIX_cond_destroy( (smx_cond_t)cond );
+
+void xbt_cond_destroy(xbt_cond_t cond)
+{
+  SIMIX_cond_destroy((smx_cond_t) cond);
 }
index 84ba8df..05eebcc 100644 (file)
 /*
  * Time elapsed since the begining of the simulation.
  */
-double xbt_time() {
+double xbt_time()
+{
   return SIMIX_get_clock();
 }
 
 /*
  * Freeze the process for the specified amount of time
  */
-void xbt_sleep(double sec) {
+void xbt_sleep(double sec)
+{
   smx_action_t act_sleep;
   smx_process_t proc = SIMIX_process_self();
   smx_mutex_t mutex;
   smx_cond_t cond;
   /* create action to sleep */
-  act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc),sec);
+  act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc), sec);
 
   mutex = SIMIX_mutex_init();
   SIMIX_mutex_lock(mutex);
@@ -33,7 +35,7 @@ void xbt_sleep(double sec) {
   cond = SIMIX_cond_init();
 
   SIMIX_register_action_to_condition(act_sleep, cond);
-  SIMIX_cond_wait(cond,mutex);
+  SIMIX_cond_wait(cond, mutex);
   SIMIX_mutex_unlock(mutex);
 
   /* remove variables */
index bca3bf2..12fa575 100644 (file)
@@ -19,29 +19,32 @@ struct s_xbt_sha_ {
   int blen;
   unsigned int lenhi, lenlo;
 };
-static void sha_calculate (xbt_sha_t sha);
+static void sha_calculate(xbt_sha_t sha);
 
 /* ************** */
 /* User Interface */
 /* ************** */
 
 /** @brief constructor */
-xbt_sha_t xbt_sha_new (void) {
+xbt_sha_t xbt_sha_new(void)
+{
   xbt_sha_t sha;
 
-  sha = xbt_new(s_xbt_sha_t,1);
-  xbt_sha_reset (sha);
+  sha = xbt_new(s_xbt_sha_t, 1);
+  xbt_sha_reset(sha);
 
   return sha;
 }
 
 /** @brief destructor */
-void xbt_sha_free (xbt_sha_t sha) {
-  free (sha);
+void xbt_sha_free(xbt_sha_t sha)
+{
+  free(sha);
 }
 
-void xbt_sha_reset (xbt_sha_t sha) {
-  memset (sha, 0, sizeof (s_xbt_sha_t));
+void xbt_sha_reset(xbt_sha_t sha)
+{
+  memset(sha, 0, sizeof(s_xbt_sha_t));
   sha->hash[0] = 0x67452301;
   sha->hash[1] = 0xefcdab89;
   sha->hash[2] = 0x98badcfe;
@@ -50,14 +53,15 @@ void xbt_sha_reset (xbt_sha_t sha) {
 }
 
 /* @brief Add some more data to the buffer */
-void xbt_sha_feed (xbt_sha_t sha, const unsigned char *data, size_t len) {
+void xbt_sha_feed(xbt_sha_t sha, const unsigned char *data, size_t len)
+{
   int i;
 
-  for (i=0; i<len; i++) {
+  for (i = 0; i < len; i++) {
     sha->buf[sha->blen / 4] <<= 8;
-    sha->buf[sha->blen / 4] |= (unsigned int)data[i];
+    sha->buf[sha->blen / 4] |= (unsigned int) data[i];
     if ((++sha->blen) % 64 == 0) {
-      sha_calculate (sha);
+      sha_calculate(sha);
       sha->blen = 0;
     }
     sha->lenlo += 8;
@@ -66,56 +70,60 @@ void xbt_sha_feed (xbt_sha_t sha, const unsigned char *data, size_t len) {
 }
 
 /* finalize computation before displaying the result */
-static void xbt_sha_finalize (xbt_sha_t sha) {
+static void xbt_sha_finalize(xbt_sha_t sha)
+{
   unsigned char pad[8];
   unsigned char padc;
 
-  pad[0] = (unsigned char)((sha->lenhi >> 24) & 0xff);
-  pad[1] = (unsigned char)((sha->lenhi >> 16) & 0xff);
-  pad[2] = (unsigned char)((sha->lenhi >> 8) & 0xff);
-  pad[3] = (unsigned char)(sha->lenhi & 0xff);
-  pad[4] = (unsigned char)((sha->lenlo >> 24) & 0xff);
-  pad[5] = (unsigned char)((sha->lenlo >> 16) & 0xff);
-  pad[6] = (unsigned char)((sha->lenlo >> 8) & 0xff);
-  pad[7] = (unsigned char)(sha->lenlo & 255);
+  pad[0] = (unsigned char) ((sha->lenhi >> 24) & 0xff);
+  pad[1] = (unsigned char) ((sha->lenhi >> 16) & 0xff);
+  pad[2] = (unsigned char) ((sha->lenhi >> 8) & 0xff);
+  pad[3] = (unsigned char) (sha->lenhi & 0xff);
+  pad[4] = (unsigned char) ((sha->lenlo >> 24) & 0xff);
+  pad[5] = (unsigned char) ((sha->lenlo >> 16) & 0xff);
+  pad[6] = (unsigned char) ((sha->lenlo >> 8) & 0xff);
+  pad[7] = (unsigned char) (sha->lenlo & 255);
 
   padc = 0x80;
-  xbt_sha_feed (sha, &padc, 1);
+  xbt_sha_feed(sha, &padc, 1);
 
   padc = 0x00;
   while (sha->blen != 56)
-    xbt_sha_feed (sha, &padc, 1);
+    xbt_sha_feed(sha, &padc, 1);
 
-  xbt_sha_feed (sha, pad, 8);
+  xbt_sha_feed(sha, pad, 8);
 }
 
 /** @brief returns the sha hash into a newly allocated buffer (+ reset sha object) */
-char *xbt_sha_read(xbt_sha_t sha) {
+char *xbt_sha_read(xbt_sha_t sha)
+{
   char *res = xbt_malloc(40);
-  xbt_sha_print(sha,res);
+  xbt_sha_print(sha, res);
   return res;
 }
 
 /** @brief copy the content sha hash into the @a hash pre-allocated string (and reset buffer) */
-void xbt_sha_print (xbt_sha_t sha, char *hash) {
+void xbt_sha_print(xbt_sha_t sha, char *hash)
+{
   int i;
 
   xbt_sha_finalize(sha);
-  for (i=0; i<5; i++) {
-    sprintf (hash, "%08x", sha->hash[i]);
+  for (i = 0; i < 5; i++) {
+    sprintf(hash, "%08x", sha->hash[i]);
     hash += 8;
   }
 }
 
 
 /** @brief simply compute a SHA1 hash and copy it to the provided buffer */
-void xbt_sha (const char *data, char *hash) {
+void xbt_sha(const char *data, char *hash)
+{
   s_xbt_sha_t sha;
 
-  xbt_sha_reset (&sha);
-  xbt_sha_feed (&sha, (const unsigned char*)data, strlen (data));
+  xbt_sha_reset(&sha);
+  xbt_sha_feed(&sha, (const unsigned char *) data, strlen(data));
 
-  xbt_sha_print (&sha, hash);
+  xbt_sha_print(&sha, hash);
 }
 
 /* ********************* */
@@ -133,13 +141,15 @@ void xbt_sha (const char *data, char *hash) {
     A = TMP; \
   }
 
-static void sha_calculate (xbt_sha_t sha)
+static void sha_calculate(xbt_sha_t sha)
 {
   int i;
   unsigned int A, B, C, D, E, TMP;
 
-  for (i=16; i<80; i++)
-    sha->buf[i] = SRL (sha->buf[i-3] ^ sha->buf[i-8] ^ sha->buf[i-14] ^ sha->buf[i-16], 1);
+  for (i = 16; i < 80; i++)
+    sha->buf[i] =
+      SRL(sha->buf[i - 3] ^ sha->buf[i - 8] ^ sha->
+          buf[i - 14] ^ sha->buf[i - 16], 1);
 
   A = sha->hash[0];
   B = sha->hash[1];
@@ -147,10 +157,10 @@ static void sha_calculate (xbt_sha_t sha)
   D = sha->hash[3];
   E = sha->hash[4];
 
-  SHA (0,  19, ((C^D)&B)^D,     0x5a827999);
-  SHA (20, 39, B^C^D,           0x6ed9eba1);
-  SHA (40, 59, (B&C)|(D&(B|C)), 0x8f1bbcdc);
-  SHA (60, 79, B^C^D,           0xca62c1d6);
+  SHA(0, 19, ((C ^ D) & B) ^ D, 0x5a827999);
+  SHA(20, 39, B ^ C ^ D, 0x6ed9eba1);
+  SHA(40, 59, (B & C) | (D & (B | C)), 0x8f1bbcdc);
+  SHA(60, 79, B ^ C ^ D, 0xca62c1d6);
 
   sha->hash[0] += A;
   sha->hash[1] += B;
@@ -164,41 +174,47 @@ static void sha_calculate (xbt_sha_t sha)
 /* ************* */
 #ifdef SIMGRID_TEST
 #include "xbt/hash.h"
-#include "portable.h" /* hexa_str */
+#include "portable.h"           /* hexa_str */
 
-static char* mycmp(const char *p1, const char *p2,size_t n) {
+static char *mycmp(const char *p1, const char *p2, size_t n)
+{
   int i;
 
-  for (i=0; i<n; i++) {
+  for (i = 0; i < n; i++) {
     if (p1[i] != p2[i]) {
-      return bprintf("Differs on %d -- Ox%x",i,p1[i]);
+      return bprintf("Differs on %d -- Ox%x", i, p1[i]);
     }
   }
   return xbt_strdup("");
 }
 
-static void test_sha(const char *clear,const char *hashed) {
+static void test_sha(const char *clear, const char *hashed)
+{
   char hash[41];
-  xbt_sha(clear,hash);
+  xbt_sha(clear, hash);
 
-  xbt_test_add1("==== Test with '%s'",clear);
+  xbt_test_add1("==== Test with '%s'", clear);
   xbt_test_assert3(!memcmp(hash, hashed, 40), "Wrong sha: %40s!=%40s (%s)",
-                   hash,hashed,mycmp(hash,hashed,40));
+                   hash, hashed, mycmp(hash, hashed, 40));
 }
 
-XBT_TEST_SUITE("hash","Various hash functions");
+XBT_TEST_SUITE("hash", "Various hash functions");
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(hash,"Tests of various hash functions ");
+XBT_LOG_NEW_DEFAULT_CATEGORY(hash, "Tests of various hash functions ");
 
 
-XBT_TEST_UNIT("sha",test_crypto_sha,"Test of the sha algorithm") {
+XBT_TEST_UNIT("sha", test_crypto_sha, "Test of the sha algorithm")
+{
   /* Empty string as test vector */
-  test_sha("",                                            "da39a3ee5e6b4b0d3255bfef95601890afd80709");
+  test_sha("", "da39a3ee5e6b4b0d3255bfef95601890afd80709");
 
   /* Some pangram as test vector */
-  test_sha("The quick brown fox jumps over the lazy dog", "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12");
-  test_sha("Woven silk pyjamas exchanged for blue quartz","da3aff337c810c6470db4dbf0f205c8afc31c442");
-  test_sha("Pack my box with five dozen liquor jugs",     "373ba8be29d4d95708bf7cd43038f4e409dcb439");
+  test_sha("The quick brown fox jumps over the lazy dog",
+           "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12");
+  test_sha("Woven silk pyjamas exchanged for blue quartz",
+           "da3aff337c810c6470db4dbf0f205c8afc31c442");
+  test_sha("Pack my box with five dozen liquor jugs",
+           "373ba8be29d4d95708bf7cd43038f4e409dcb439");
 
 }
 #endif /* SIMGRID_TEST */
index 6cd5a2d..73279a4 100644 (file)
 
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
-#include "xbt/str.h" /* headers of these functions */
+#include "xbt/str.h"            /* headers of these functions */
 #include "xbt/strbuff.h"
 #include "portable.h"
-#include "xbt/matrix.h" /* for the diff */
+#include "xbt/matrix.h"         /* for the diff */
 
 /**  @brief Strip whitespace (or other characters) from the end of a string.
  *
  * @param char_list A string which contains the characters you want to strip.
  *
  */
-void
-xbt_str_rtrim(char* s, const char* char_list)
+void xbt_str_rtrim(char *s, const char *char_list)
 {
-  charcur = s;
-  const char__char_list = " \t\n\r\x0B";
-  char white_char[256] = {1,0};
+  char *cur = s;
+  const char *__char_list = " \t\n\r\x0B";
+  char white_char[256] = { 1, 0 };
 
-  if(!s)
+  if (!s)
     return;
 
-  if(!char_list){
-    while(*__char_list) {
-      white_char[(unsigned char)*__char_list++] = 1;
+  if (!char_list) {
+    while (*__char_list) {
+      white_char[(unsigned char) *__char_list++] = 1;
     }
-  }else{
-    while(*char_list) {
-      white_char[(unsigned char)*char_list++] = 1;
+  } else {
+    while (*char_list) {
+      white_char[(unsigned char) *char_list++] = 1;
     }
   }
 
-  while(*cur)
+  while (*cur)
     ++cur;
 
-  while((cur >= s) && white_char[(unsigned char)*cur])
+  while ((cur >= s) && white_char[(unsigned char) *cur])
     --cur;
 
   *++cur = '\0';
@@ -77,30 +76,29 @@ xbt_str_rtrim(char* s, const char* char_list)
  * @param char_list A string which contains the characters you want to strip.
  *
  */
-void
-xbt_str_ltrim( char* s, const char* char_list)
+void xbt_str_ltrim(char *s, const char *char_list)
 {
-  charcur = s;
-  const char__char_list = " \t\n\r\x0B";
-  char white_char[256] = {1,0};
+  char *cur = s;
+  const char *__char_list = " \t\n\r\x0B";
+  char white_char[256] = { 1, 0 };
 
-  if(!s)
+  if (!s)
     return;
 
-  if(!char_list){
-    while(*__char_list) {
-      white_char[(unsigned char)*__char_list++] = 1;
+  if (!char_list) {
+    while (*__char_list) {
+      white_char[(unsigned char) *__char_list++] = 1;
     }
-  }else{
-    while(*char_list) {
-      white_char[(unsigned char)*char_list++] = 1;
+  } else {
+    while (*char_list) {
+      white_char[(unsigned char) *char_list++] = 1;
     }
   }
 
-  while(*cur && white_char[(unsigned char)*cur])
+  while (*cur && white_char[(unsigned char) *cur])
     ++cur;
 
-  memmove(s,cur, strlen(cur)+1);
+  memmove(s, cur, strlen(cur) + 1);
 }
 
 /**  @brief Strip whitespace (or other characters) from the end and the begining of a string.
@@ -119,14 +117,14 @@ xbt_str_ltrim( char* s, const char* char_list)
  * @param char_list A string which contains the characters you want to strip.
  *
  */
-void
-xbt_str_trim(char* s, const char* char_list ){
+void xbt_str_trim(char *s, const char *char_list)
+{
 
-  if(!s)
+  if (!s)
     return;
 
-  xbt_str_rtrim(s,char_list);
-  xbt_str_ltrim(s,char_list);
+  xbt_str_rtrim(s, char_list);
+  xbt_str_ltrim(s, char_list);
 }
 
 /**  @brief Replace double whitespaces (but no other characters) from the string.
@@ -137,10 +135,10 @@ xbt_str_trim(char* s, const char* char_list ){
  * @param s The string to strip. Modified in place.
  *
  */
-void
-xbt_str_strip_spaces(char *s) {
+void xbt_str_strip_spaces(char *s)
+{
   char *p = s;
-  int   e = 0;
+  int e = 0;
 
   if (!s)
     return;
@@ -164,12 +162,12 @@ xbt_str_strip_spaces(char *s) {
     if (!*++p)
       goto end;
 
-    if (e ^ (*p!=' '))
+    if (e ^ (*p != ' '))
       if ((e = !e))
         *s++ = ' ';
   } while (1);
 
-  end:
+end:
   *s = '\0';
 }
 
@@ -180,7 +178,8 @@ xbt_str_strip_spaces(char *s) {
  * @param to char to put instead
  * @param amount amount of changes to do (=0 means all)
  */
-void xbt_str_subst(char *str, char from, char to, int occurence) {
+void xbt_str_subst(char *str, char from, char to, int occurence)
+{
   char *p = str;
   while (*p != '\0') {
     if (*p == from) {
@@ -192,6 +191,7 @@ void xbt_str_subst(char *str, char from, char to, int occurence) {
     p++;
   }
 }
+
 /** @brief Replaces a set of variables by their values
  *
  * @param str where to apply the change
@@ -201,10 +201,11 @@ void xbt_str_subst(char *str, char from, char to, int occurence) {
  * Check xbt_strbuff_varsubst() for more details, and remember that the string may be reallocated (moved) in the process.
  */
 
-char *xbt_str_varsubst(char *str, xbt_dict_t patterns) {
+char *xbt_str_varsubst(char *str, xbt_dict_t patterns)
+{
   xbt_strbuff_t buff = xbt_strbuff_new_from(str);
-  char * res;
-  xbt_strbuff_varsubst(buff,patterns);
+  char *res;
+  xbt_strbuff_varsubst(buff, patterns);
   res = buff->data;
   xbt_strbuff_free_container(buff);
   return res;
@@ -226,15 +227,16 @@ char *xbt_str_varsubst(char *str, xbt_dict_t patterns) {
  *     - "\x0B"        (ASCII 11       (0x0B)) vertical tab.
  */
 
-xbt_dynar_t xbt_str_split(const char *s, const char *sep) {
-  xbt_dynar_t res = xbt_dynar_new(sizeof(char*), xbt_free_ref);
+xbt_dynar_t xbt_str_split(const char *s, const char *sep)
+{
+  xbt_dynar_t res = xbt_dynar_new(sizeof(char *), xbt_free_ref);
   const char *p, *q;
   int done;
-  const charsep_dflt = " \t\n\r\x0B";
-  char is_sep[256] = {1,0};
+  const char *sep_dflt = " \t\n\r\x0B";
+  char is_sep[256] = { 1, 0 };
 
   /* check what are the separators */
-  memset(is_sep,0,sizeof(is_sep));
+  memset(is_sep, 0, sizeof(is_sep));
   if (!sep) {
     while (*sep_dflt)
       is_sep[(unsigned char) *sep_dflt++] = 1;
@@ -242,27 +244,27 @@ xbt_dynar_t xbt_str_split(const char *s, const char *sep) {
     while (*sep)
       is_sep[(unsigned char) *sep++] = 1;
   }
-  is_sep[0] = 1; /* End of string is also separator */
+  is_sep[0] = 1;                /* End of string is also separator */
 
   /* Do the job */
-  p=q=s;
-  done=0;
+  p = q = s;
+  done = 0;
 
   if (s[0] == '\0')
     return res;
 
   while (!done) {
     char *topush;
-    while (!is_sep[(unsigned char)*q]) {
+    while (!is_sep[(unsigned char) *q]) {
       q++;
     }
     if (*q == '\0')
       done = 1;
 
-    topush=xbt_malloc(q-p+1);
-    memcpy(topush,p,q-p);
+    topush = xbt_malloc(q - p + 1);
+    memcpy(topush, p, q - p);
     topush[q - p] = '\0';
-    xbt_dynar_push(res,&topush);
+    xbt_dynar_push(res, &topush);
     p = ++q;
   }
 
@@ -274,8 +276,9 @@ xbt_dynar_t xbt_str_split(const char *s, const char *sep) {
  * For example A!!B!!C splitted after !! will return the dynar {A,B,C}
  * \return An array of dynars containing the string tokens
  */
-xbt_dynar_t xbt_str_split_str(const char *s, const char *sep) {
-  xbt_dynar_t res = xbt_dynar_new(sizeof(char*), xbt_free_ref);
+xbt_dynar_t xbt_str_split_str(const char *s, const char *sep)
+{
+  xbt_dynar_t res = xbt_dynar_new(sizeof(char *), xbt_free_ref);
   int done;
   const char *p, *q;
 
@@ -303,15 +306,14 @@ xbt_dynar_t xbt_str_split_str(const char *s, const char *sep) {
       to_push[v] = '\0';
       xbt_dynar_push(res, &to_push);
       done = 1;
-    }
-    else {
+    } else {
       //get the appearance
       to_push = malloc(q - p + 1);
       memcpy(to_push, p, q - p);
       //add string terminator
       to_push[q - p] = '\0';
       xbt_dynar_push(res, &to_push);
-      p = q +strlen(sep);
+      p = q + strlen(sep);
     }
   }
   return res;
@@ -326,92 +328,92 @@ xbt_dynar_t xbt_str_split_str(const char *s, const char *sep) {
  *
  */
 
-xbt_dynar_t xbt_str_split_quoted(const char *s) {
-  xbt_dynar_t res = xbt_dynar_new(sizeof(char*), xbt_free_ref);
-  char *str_to_free; /* we have to copy the string before, to handle backslashes */
-  char *beg, *end; /* pointers around the parsed chunk */
-  int in_simple_quote=0, in_double_quote=0;
+xbt_dynar_t xbt_str_split_quoted(const char *s)
+{
+  xbt_dynar_t res = xbt_dynar_new(sizeof(char *), xbt_free_ref);
+  char *str_to_free;            /* we have to copy the string before, to handle backslashes */
+  char *beg, *end;              /* pointers around the parsed chunk */
+  int in_simple_quote = 0, in_double_quote = 0;
   int done = 0;
-  int ctn = 0; /* Got something in this block */
+  int ctn = 0;                  /* Got something in this block */
 
   if (s[0] == '\0')
     return res;
   beg = str_to_free = xbt_strdup(s);
 
   /* trim leading spaces */
-  xbt_str_ltrim(beg," ");
-  end=beg;
+  xbt_str_ltrim(beg, " ");
+  end = beg;
 
   while (!done) {
 
 
     switch (*end) {
-      case '\\':
-        ctn = 1;
-        /* Protected char; move it closer */
-        memmove(end,end+1,strlen(end));
-        if (*end=='\0')
-          THROW0(arg_error,0,"String ends with \\");
-        end++; /* Pass the protected char */
-        break;
-
-      case '\'':
-        ctn = 1;
-        if (!in_double_quote) {
-          in_simple_quote = !in_simple_quote;
-          memmove(end,end+1,strlen(end));
-        } else {
-          /* simple quote protected by double ones */
-          end++;
-        }
-        break;
-      case '"':
-        ctn = 1;
-        if (!in_simple_quote) {
-          in_double_quote = !in_double_quote;
-          memmove(end,end+1,strlen(end));
-        } else {
-          /* double quote protected by simple ones */
-          end++;
-        }
-        break;
-
-      case ' ':
-      case '\t':
-      case '\n':
-      case '\0':
-        if (*end == '\0' && (in_simple_quote || in_double_quote)) {
-          THROW2(arg_error,0,
-                 "End of string found while searching for %c in %s",
-                 (in_simple_quote?'\'':'"'),
-                 s);
+    case '\\':
+      ctn = 1;
+      /* Protected char; move it closer */
+      memmove(end, end + 1, strlen(end));
+      if (*end == '\0')
+        THROW0(arg_error, 0, "String ends with \\");
+      end++;                    /* Pass the protected char */
+      break;
+
+    case '\'':
+      ctn = 1;
+      if (!in_double_quote) {
+        in_simple_quote = !in_simple_quote;
+        memmove(end, end + 1, strlen(end));
+      } else {
+        /* simple quote protected by double ones */
+        end++;
+      }
+      break;
+    case '"':
+      ctn = 1;
+      if (!in_simple_quote) {
+        in_double_quote = !in_double_quote;
+        memmove(end, end + 1, strlen(end));
+      } else {
+        /* double quote protected by simple ones */
+        end++;
+      }
+      break;
+
+    case ' ':
+    case '\t':
+    case '\n':
+    case '\0':
+      if (*end == '\0' && (in_simple_quote || in_double_quote)) {
+        THROW2(arg_error, 0,
+               "End of string found while searching for %c in %s",
+               (in_simple_quote ? '\'' : '"'), s);
+      }
+      if (in_simple_quote || in_double_quote) {
+        end++;
+      } else {
+        if (ctn) {
+          /* Found a separator. Push the string if contains something */
+          char *topush = xbt_malloc(end - beg + 1);
+          memcpy(topush, beg, end - beg);
+          topush[end - beg] = '\0';
+          xbt_dynar_push(res, &topush);
         }
-        if (in_simple_quote || in_double_quote) {
-          end++;
-        } else {
-          if (ctn) {
-            /* Found a separator. Push the string if contains something */
-            char *topush=xbt_malloc(end-beg+1);
-            memcpy(topush,beg,end-beg);
-            topush[end - beg] = '\0';
-            xbt_dynar_push(res,&topush);
-          }
-          ctn= 0;
-
-          if (*end == '\0') {
-            done = 1;
-            break;
-          }
-
-          beg=++end;
-          xbt_str_ltrim(beg," ");
-          end=beg;
+        ctn = 0;
+
+        if (*end == '\0') {
+          done = 1;
+          break;
         }
-        break;
 
-      default:
-        ctn = 1;
-        end++;
+        beg = ++end;
+        xbt_str_ltrim(beg, " ");
+        end = beg;
+      }
+      break;
+
+    default:
+      ctn = 1;
+      end++;
     }
   }
   free(str_to_free);
@@ -431,8 +433,10 @@ xbt_dynar_t xbt_str_split_quoted(const char *s) {
                    free(s); \
                    xbt_dynar_free(&d);
 
-XBT_TEST_SUITE("xbt_str","String Handling");
-XBT_TEST_UNIT("xbt_str_split_quoted",test_split_quoted, "test the function xbt_str_split_quoted") {
+XBT_TEST_SUITE("xbt_str", "String Handling");
+XBT_TEST_UNIT("xbt_str_split_quoted", test_split_quoted,
+              "test the function xbt_str_split_quoted")
+{
   xbt_dynar_t d;
   char *s;
 
@@ -446,8 +450,10 @@ XBT_TEST_UNIT("xbt_str_split_quoted",test_split_quoted, "test the function xbt_s
   mytest("Single quotes", "'toto tutu' tata", "toto tutuXXXtata");
   mytest("Double quotes", "\"toto tutu\" tata", "toto tutuXXXtata");
   mytest("Mixed quotes", "\"toto' 'tutu\" tata", "toto' 'tutuXXXtata");
-  mytest("Backslashed quotes", "\\'toto tutu\\' tata", "'totoXXXtutu'XXXtata");
-  mytest("Backslashed quotes + quotes", "'toto \\'tutu' tata", "toto 'tutuXXXtata");
+  mytest("Backslashed quotes", "\\'toto tutu\\' tata",
+         "'totoXXXtutu'XXXtata");
+  mytest("Backslashed quotes + quotes", "'toto \\'tutu' tata",
+         "toto 'tutuXXXtata");
 
 }
 
@@ -461,7 +467,9 @@ XBT_TEST_UNIT("xbt_str_split_quoted",test_split_quoted, "test the function xbt_s
                    free(s); \
                    xbt_dynar_free(&d);
 
-XBT_TEST_UNIT("xbt_str_split_str",test_split_str, "test the function xbt_str_split_str") {
+XBT_TEST_UNIT("xbt_str_split_str", test_split_str,
+              "test the function xbt_str_split_str")
+{
   xbt_dynar_t d;
   char *s;
 
@@ -469,41 +477,42 @@ XBT_TEST_UNIT("xbt_str_split_str",test_split_str, "test the function xbt_str_spl
   mytest_str("Empty string", "", "##", "");
   mytest_str("Empty separator", "toto", "", "toto");
   mytest_str("String with no separator in it", "toto", "##", "toto");
-  mytest_str("Basic test", "toto##tutu",  "##", "totoXXXtutu");
+  mytest_str("Basic test", "toto##tutu", "##", "totoXXXtutu");
 }
 #endif /* SIMGRID_TEST */
 
 /** @brief Join a set of strings as a single string */
 
-char *xbt_str_join(xbt_dynar_t dyn, const char*sep) {
-  int len=1,dyn_len=xbt_dynar_length(dyn);
+char *xbt_str_join(xbt_dynar_t dyn, const char *sep)
+{
+  int len = 1, dyn_len = xbt_dynar_length(dyn);
   unsigned int cpt;
   char *cursor;
-  char *res,*p;
+  char *res, *p;
 
   if (!dyn_len)
     return xbt_strdup("");
 
   /* compute the length */
-  xbt_dynar_foreach(dyn,cpt,cursor) {
-    len+=strlen(cursor);
+  xbt_dynar_foreach(dyn, cpt, cursor) {
+    len += strlen(cursor);
   }
-  len+=strlen(sep)*dyn_len;
+  len += strlen(sep) * dyn_len;
   /* Do the job */
   res = xbt_malloc(len);
-  p=res;
-  xbt_dynar_foreach(dyn,cpt,cursor) {
-    if ((int)cpt<dyn_len-1)
-      p+=sprintf(p,"%s%s",cursor,sep);
+  p = res;
+  xbt_dynar_foreach(dyn, cpt, cursor) {
+    if ((int) cpt < dyn_len - 1)
+      p += sprintf(p, "%s%s", cursor, sep);
     else
-      p+=sprintf(p,"%s",cursor);
+      p += sprintf(p, "%s", cursor);
   }
   return res;
 }
 
 #if !defined(HAVE_GETLINE) || defined(DOXYGEN)
 /* prototype here, just in case */
-long getline(char **buf, size_t *n, FILE *stream);
+long getline(char **buf, size_t * n, FILE * stream);
 
 /** @brief Get a single line from the stream (reimplementation of the GNU getline)
  *
@@ -520,7 +529,8 @@ long getline(char **buf, size_t *n, FILE *stream);
  * as necessary.  In either case, on a successful call, *buf and *n will be updated to
  * reflect the buffer address and allocated size respectively.
  */
-long getline(char **buf, size_t *n, FILE *stream) {
+long getline(char **buf, size_t * n, FILE * stream)
+{
 
   size_t i;
   int ch;
@@ -531,16 +541,16 @@ long getline(char **buf, size_t *n, FILE *stream) {
   }
 
   if (feof(stream))
-    return (ssize_t)-1;
+    return (ssize_t) - 1;
 
-  for (i=0; (ch = fgetc(stream)) != EOF; i++)  {
+  for (i = 0; (ch = fgetc(stream)) != EOF; i++) {
 
     if (i >= (*n) + 1)
       *buf = xbt_realloc(*buf, *n += 512);
 
     (*buf)[i] = ch;
 
-    if ((*buf)[i] == '\n')  {
+    if ((*buf)[i] == '\n') {
       i++;
       (*buf)[i] = '\0';
       break;
@@ -552,7 +562,7 @@ long getline(char **buf, size_t *n, FILE *stream) {
 
   (*buf)[i] = '\0';
 
-  return (ssize_t)i;
+  return (ssize_t) i;
 }
 
 #endif /* HAVE_GETLINE */
@@ -560,106 +570,123 @@ long getline(char **buf, size_t *n, FILE *stream) {
 /*
  * Diff related functions
  */
-static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db) {
-  xbt_matrix_t C = xbt_matrix_new(xbt_dynar_length(da),xbt_dynar_length(db),
-                                  sizeof(int),NULL);
-  unsigned long i,j;
+static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db)
+{
+  xbt_matrix_t C = xbt_matrix_new(xbt_dynar_length(da), xbt_dynar_length(db),
+                                  sizeof(int), NULL);
+  unsigned long i, j;
 
   /* Compute the LCS */
   /*
-    C = array(0..m, 0..n)
-    for i := 0..m
-       C[i,0] = 0
-    for j := 1..n
-       C[0,j] = 0
-    for i := 1..m
-        for j := 1..n
-            if X[i] = Y[j]
-                C[i,j] := C[i-1,j-1] + 1
-            else:
-                C[i,j] := max(C[i,j-1], C[i-1,j])
-    return C[m,n]
+     C = array(0..m, 0..n)
+     for i := 0..m
+     C[i,0] = 0
+     for j := 1..n
+     C[0,j] = 0
+     for i := 1..m
+     for j := 1..n
+     if X[i] = Y[j]
+     C[i,j] := C[i-1,j-1] + 1
+     else:
+     C[i,j] := max(C[i,j-1], C[i-1,j])
+     return C[m,n]
    */
   if (xbt_dynar_length(db) != 0)
-    for (i=0; i<xbt_dynar_length(da); i++)
-      *((int*) xbt_matrix_get_ptr(C,i,0) ) = 0;
+    for (i = 0; i < xbt_dynar_length(da); i++)
+      *((int *) xbt_matrix_get_ptr(C, i, 0)) = 0;
 
   if (xbt_dynar_length(da) != 0)
-    for (j=0; j<xbt_dynar_length(db); j++)
-      *((int*) xbt_matrix_get_ptr(C,0,j) ) = 0;
+    for (j = 0; j < xbt_dynar_length(db); j++)
+      *((int *) xbt_matrix_get_ptr(C, 0, j)) = 0;
 
-  for (i=1; i<xbt_dynar_length(da); i++)
-    for (j=1; j<xbt_dynar_length(db); j++) {
+  for (i = 1; i < xbt_dynar_length(da); i++)
+    for (j = 1; j < xbt_dynar_length(db); j++) {
 
-      if (!strcmp(xbt_dynar_get_as(da,i,char*), xbt_dynar_get_as(db,j,char*)))
-        *((int*) xbt_matrix_get_ptr(C,i,j) ) = xbt_matrix_get_as(C,i-1,j-1,int) + 1;
+      if (!strcmp
+          (xbt_dynar_get_as(da, i, char *), xbt_dynar_get_as(db, j, char *)))
+         *((int *) xbt_matrix_get_ptr(C, i, j)) =
+          xbt_matrix_get_as(C, i - 1, j - 1, int) + 1;
       else
-        *((int*) xbt_matrix_get_ptr(C,i,j) ) = max(xbt_matrix_get_as(C,i  ,j-1,int),
-                                                   xbt_matrix_get_as(C,i-1,j,int));
+        *((int *) xbt_matrix_get_ptr(C, i, j)) =
+          max(xbt_matrix_get_as(C, i, j - 1, int),
+              xbt_matrix_get_as(C, i - 1, j, int));
     }
   return C;
 }
 
 static void diff_build_diff(xbt_dynar_t res,
                             xbt_matrix_t C,
-                            xbt_dynar_t da, xbt_dynar_t db,
-                            int i,int j) {
+                            xbt_dynar_t da, xbt_dynar_t db, int i, int j)
+{
   char *topush;
   /* Construct the diff
-  function printDiff(C[0..m,0..n], X[1..m], Y[1..n], i, j)
-    if i > 0 and j > 0 and X[i] = Y[j]
-        printDiff(C, X, Y, i-1, j-1)
-        print "  " + X[i]
-    else
-        if j > 0 and (i = 0 or C[i,j-1] >= C[i-1,j])
-            printDiff(C, X, Y, i, j-1)
-            print "+ " + Y[j]
-        else if i > 0 and (j = 0 or C[i,j-1] < C[i-1,j])
-            printDiff(C, X, Y, i-1, j)
-            print "- " + X[i]
+     function printDiff(C[0..m,0..n], X[1..m], Y[1..n], i, j)
+     if i > 0 and j > 0 and X[i] = Y[j]
+     printDiff(C, X, Y, i-1, j-1)
+     print "  " + X[i]
+     else
+     if j > 0 and (i = 0 or C[i,j-1] >= C[i-1,j])
+     printDiff(C, X, Y, i, j-1)
+     print "+ " + Y[j]
+     else if i > 0 and (j = 0 or C[i,j-1] < C[i-1,j])
+     printDiff(C, X, Y, i-1, j)
+     print "- " + X[i]
    */
 
-  if (i>=0 && j >= 0 && !strcmp(xbt_dynar_get_as(da,i,char*),
-                                xbt_dynar_get_as(db,j,char*))) {
-    diff_build_diff(res,C,da,db,i-1,j-1);
-    topush = bprintf("  %s",xbt_dynar_get_as(da,i,char*));
+  if (i >= 0 && j >= 0 && !strcmp(xbt_dynar_get_as(da, i, char *),
+                                  xbt_dynar_get_as(db, j, char *))) {
+    diff_build_diff(res, C, da, db, i - 1, j - 1);
+    topush = bprintf("  %s", xbt_dynar_get_as(da, i, char *));
+    xbt_dynar_push(res, &topush);
+  } else if (j >= 0 &&
+             (i <= 0 || j == 0
+              || xbt_matrix_get_as(C, i, j - 1, int) >= xbt_matrix_get_as(C,
+                                                                          i -
+                                                                          1,
+                                                                          j,
+                                                                          int)))
+  {
+    diff_build_diff(res, C, da, db, i, j - 1);
+    topush = bprintf("+ %s", xbt_dynar_get_as(db, j, char *));
+    xbt_dynar_push(res, &topush);
+  } else if (i >= 0 &&
+             (j <= 0
+              || xbt_matrix_get_as(C, i, j - 1, int) < xbt_matrix_get_as(C,
+                                                                         i -
+                                                                         1, j,
+                                                                         int)))
+  {
+    diff_build_diff(res, C, da, db, i - 1, j);
+    topush = bprintf("- %s", xbt_dynar_get_as(da, i, char *));
     xbt_dynar_push(res, &topush);
-  } else if (j>=0 &&
-      (i<=0 ||j==0|| xbt_matrix_get_as(C,i,j-1,int) >= xbt_matrix_get_as(C,i-1,j,int))) {
-    diff_build_diff(res,C,da,db,i,j-1);
-    topush = bprintf("+ %s",xbt_dynar_get_as(db,j,char*));
-    xbt_dynar_push(res,&topush);
-  } else if (i>=0 &&
-      (j<=0 || xbt_matrix_get_as(C,i,j-1,int) < xbt_matrix_get_as(C,i-1,j,int))) {
-    diff_build_diff(res,C,da,db,i-1,j);
-    topush = bprintf("- %s",xbt_dynar_get_as(da,i,char*));
-    xbt_dynar_push(res,&topush);
-  } else if (i<=0 && j<=0) {
+  } else if (i <= 0 && j <= 0) {
     return;
   } else {
-    THROW2(arg_error,0,"Invalid values: i=%d, j=%d",i,j);
+    THROW2(arg_error, 0, "Invalid values: i=%d, j=%d", i, j);
   }
 
 }
 
 /** @brief Compute the unified diff of two strings */
-char *xbt_str_diff(char *a, char *b) {
+char *xbt_str_diff(char *a, char *b)
+{
   xbt_dynar_t da = xbt_str_split(a, "\n");
   xbt_dynar_t db = xbt_str_split(b, "\n");
 
-  xbt_matrix_t C = diff_build_LCS(da,db);
-  xbt_dynar_t diff = xbt_dynar_new(sizeof(char*),xbt_free_ref);
-  char *res=NULL;
+  xbt_matrix_t C = diff_build_LCS(da, db);
+  xbt_dynar_t diff = xbt_dynar_new(sizeof(char *), xbt_free_ref);
+  char *res = NULL;
 
-  diff_build_diff(diff, C, da,db, xbt_dynar_length(da)-1, xbt_dynar_length(db)-1);
+  diff_build_diff(diff, C, da, db, xbt_dynar_length(da) - 1,
+                  xbt_dynar_length(db) - 1);
   /* Clean empty lines at the end */
   while (xbt_dynar_length(diff) > 0) {
     char *str;
-    xbt_dynar_pop(diff,&str);
-    if (str[0]=='\0' || !strcmp(str,"  ")) {
+    xbt_dynar_pop(diff, &str);
+    if (str[0] == '\0' || !strcmp(str, "  ")) {
       free(str);
     } else {
-      xbt_dynar_push(diff,&str);
+      xbt_dynar_push(diff, &str);
       break;
     }
   }
@@ -672,4 +699,3 @@ char *xbt_str_diff(char *a, char *b) {
 
   return res;
 }
-
index 9e5e949..f734c48 100644 (file)
 
 #define minimal_increment 512
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(strbuff,xbt,"String buffers");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(strbuff, xbt, "String buffers");
 
 /**
 ** Buffer code
 **/
 
-void xbt_strbuff_empty(xbt_strbuff_t b) {
-  b->used=0;
-  b->data[0]='\n';
-  b->data[1]='\0';
+void xbt_strbuff_empty(xbt_strbuff_t b)
+{
+  b->used = 0;
+  b->data[0] = '\n';
+  b->data[1] = '\0';
 }
-xbt_strbuff_t xbt_strbuff_new(void) {
-  xbt_strbuff_t res=malloc(sizeof(s_xbt_strbuff_t));
-  res->data=malloc(512);
-  res->size=512;
+
+xbt_strbuff_t xbt_strbuff_new(void)
+{
+  xbt_strbuff_t res = malloc(sizeof(s_xbt_strbuff_t));
+  res->data = malloc(512);
+  res->size = 512;
   xbt_strbuff_empty(res);
   return res;
 }
+
 /** @brief creates a new string buffer containing the provided string
  *
  * Beware, we store the ctn directly, not a copy of it
  */
-xbt_strbuff_t xbt_strbuff_new_from(char *ctn) {
-  xbt_strbuff_t res=malloc(sizeof(s_xbt_strbuff_t));
-  res->data=ctn;
-  res->used=res->size=strlen(ctn);
+xbt_strbuff_t xbt_strbuff_new_from(char *ctn)
+{
+  xbt_strbuff_t res = malloc(sizeof(s_xbt_strbuff_t));
+  res->data = ctn;
+  res->used = res->size = strlen(ctn);
   return res;
 }
+
 /** @brief frees only the container without touching to the contained string */
-void xbt_strbuff_free_container(xbt_strbuff_t b) {
+void xbt_strbuff_free_container(xbt_strbuff_t b)
+{
   free(b);
 }
+
 /** @brief frees the buffer and its content */
-void xbt_strbuff_free(xbt_strbuff_t b) {
+void xbt_strbuff_free(xbt_strbuff_t b)
+{
   if (b) {
     if (b->data)
       free(b->data);
     free(b);
   }
 }
-void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd) {
+
+void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd)
+{
   int addlen;
   int needed_space;
 
   if (!b)
-    THROW0(arg_error,0,"Asked to append stuff to NULL buffer");
+    THROW0(arg_error, 0, "Asked to append stuff to NULL buffer");
 
   addlen = strlen(toadd);
-  needed_space=b->used+addlen+1;
+  needed_space = b->used + addlen + 1;
 
   if (needed_space > b->size) {
-    b->data = realloc(b->data, MAX(minimal_increment+b->used, needed_space));
-    b->size = MAX(minimal_increment+b->used, needed_space);
+    b->data =
+      realloc(b->data, MAX(minimal_increment + b->used, needed_space));
+    b->size = MAX(minimal_increment + b->used, needed_space);
   }
-  strcpy(b->data+b->used, toadd);
+  strcpy(b->data + b->used, toadd);
   b->used += addlen;
 }
-void xbt_strbuff_chomp(xbt_strbuff_t b) {
+
+void xbt_strbuff_chomp(xbt_strbuff_t b)
+{
   while (b->data[b->used] == '\n') {
     b->data[b->used] = '\0';
     if (b->used)
@@ -82,10 +96,12 @@ void xbt_strbuff_chomp(xbt_strbuff_t b) {
   }
 }
 
-void xbt_strbuff_trim(xbt_strbuff_t b) {
-  xbt_str_trim(b->data," ");
+void xbt_strbuff_trim(xbt_strbuff_t b)
+{
+  xbt_str_trim(b->data, " ");
   b->used = strlen(b->data);
 }
+
 /** @brief Replaces a set of variables by their values
  *
  * @param b buffer to modify
@@ -100,10 +116,11 @@ void xbt_strbuff_trim(xbt_strbuff_t b) {
  * shouldn't to respect the shell standard (:= form should set the value in the dict,
  * but does not) (BUG).
  */
-void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) {
+void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns)
+{
 
-  char *end; /* pointers around the parsed chunk */
-  int in_simple_quote=0, in_double_quote=0;
+  char *end;                    /* pointers around the parsed chunk */
+  int in_simple_quote = 0, in_double_quote = 0;
   int done = 0;
 
   if (b->data[0] == '\0')
@@ -113,138 +130,145 @@ void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) {
   while (!done) {
 
     switch (*end) {
-      case '\\':
-        /* Protected char; pass the protection */
-        end++;
-        if (*end=='\0')
-          THROW0(arg_error,0,"String ends with \\");
-        break;
-
-      case '\'':
-        if (!in_double_quote) {
-          /* simple quote not protected by double ones, note it */
-          in_simple_quote = !in_simple_quote;
-        }
-        break;
-      case '"':
-        if (!in_simple_quote) {
-          /* double quote protected by simple ones, note it */
-          in_double_quote = !in_double_quote;
-        }
-        break;
-
-      case '$':
-        if (!in_simple_quote) {
-          /* Go for the substitution. First search the variable name */
-          char *beg_var,*end_var; /* variable name boundary */
-          char *beg_subst, *end_subst=NULL; /* where value should be written to */
-          char *value, *default_value=NULL;
-          int val_len;
-          beg_subst = end;
-
-
-          if (*(++end) == '{') {
-            /* the variable name is enclosed in braces. */
-            beg_var = end+1;
-            /* Search name's end */
-            end_var = beg_var;
-            while (*end_var != '\0' && *end_var != '}') {
-              /* TODO: we do not respect the standard for ":=", we should set this value in the dict */
-              if (*end_var == ':' && ((*(end_var+1) == '=') || (*(end_var+1) == '-'))) {
-                /* damn, we have a default value */
-                char *p = end_var+1;
-                while (*p != '\0' && *p != '}')
-                  p++;
-                if (*p == '\0')
-                  THROW0(arg_error,0,"Variable default value not terminated ('}' missing)");
-
-                default_value = xbt_malloc(p-end_var-1);
-                memcpy(default_value, end_var+2, p-end_var-2);
-                default_value[p-end_var-2] = '\0';
-
-                end_subst = p+1; /* eat '}' */
-
-                break;
-              }
-              end_var++;
+    case '\\':
+      /* Protected char; pass the protection */
+      end++;
+      if (*end == '\0')
+        THROW0(arg_error, 0, "String ends with \\");
+      break;
+
+    case '\'':
+      if (!in_double_quote) {
+        /* simple quote not protected by double ones, note it */
+        in_simple_quote = !in_simple_quote;
+      }
+      break;
+    case '"':
+      if (!in_simple_quote) {
+        /* double quote protected by simple ones, note it */
+        in_double_quote = !in_double_quote;
+      }
+      break;
+
+    case '$':
+      if (!in_simple_quote) {
+        /* Go for the substitution. First search the variable name */
+        char *beg_var, *end_var;        /* variable name boundary */
+        char *beg_subst, *end_subst = NULL;     /* where value should be written to */
+        char *value, *default_value = NULL;
+        int val_len;
+        beg_subst = end;
+
+
+        if (*(++end) == '{') {
+          /* the variable name is enclosed in braces. */
+          beg_var = end + 1;
+          /* Search name's end */
+          end_var = beg_var;
+          while (*end_var != '\0' && *end_var != '}') {
+            /* TODO: we do not respect the standard for ":=", we should set this value in the dict */
+            if (*end_var == ':'
+                && ((*(end_var + 1) == '=') || (*(end_var + 1) == '-'))) {
+              /* damn, we have a default value */
+              char *p = end_var + 1;
+              while (*p != '\0' && *p != '}')
+                p++;
+              if (*p == '\0')
+                THROW0(arg_error, 0,
+                       "Variable default value not terminated ('}' missing)");
+
+              default_value = xbt_malloc(p - end_var - 1);
+              memcpy(default_value, end_var + 2, p - end_var - 2);
+              default_value[p - end_var - 2] = '\0';
+
+              end_subst = p + 1;        /* eat '}' */
+
+              break;
             }
-            if (*end_var == '\0')
-              THROW0(arg_error,0,"Variable name not terminated ('}' missing)");
-
-            if (!end_subst) /* already set if there's a default value */
-              end_subst = end_var+1; /* also kill the } in the name */
-
-            if (end_var == beg_var)
-              THROW0(arg_error,0,"Variable name empty (${} is not valid)");
-
-
-          } else {
-            /* name given directly */
-            beg_var = end;
-            end_var = beg_var;
-            while (*end_var != '\0' && *end_var != ' ' && *end_var != '\t' && *end_var != '\n')
-              end_var++;
-            end_subst = end_var;
-            if (end_var == beg_var)
-              THROW0(arg_error,0,"Variable name empty ($ is not valid)");
+            end_var++;
           }
+          if (*end_var == '\0')
+            THROW0(arg_error, 0,
+                   "Variable name not terminated ('}' missing)");
+
+          if (!end_subst)       /* already set if there's a default value */
+            end_subst = end_var + 1;    /* also kill the } in the name */
+
+          if (end_var == beg_var)
+            THROW0(arg_error, 0, "Variable name empty (${} is not valid)");
+
+
+        } else {
+          /* name given directly */
+          beg_var = end;
+          end_var = beg_var;
+          while (*end_var != '\0' && *end_var != ' ' && *end_var != '\t'
+                 && *end_var != '\n')
+            end_var++;
+          end_subst = end_var;
+          if (end_var == beg_var)
+            THROW0(arg_error, 0, "Variable name empty ($ is not valid)");
+        }
 //          DEBUG1("End_var = %s",end_var);
 
-          /* ok, we now have the variable name. Search the dictionary for the substituted value */
-          value = xbt_dict_get_or_null_ext(patterns,beg_var,end_var-beg_var);
+        /* ok, we now have the variable name. Search the dictionary for the substituted value */
+        value =
+          xbt_dict_get_or_null_ext(patterns, beg_var, end_var - beg_var);
 //          DEBUG4("Search for %.*s, found %s (default value = %s)\n",
 //                  end_var-beg_var,beg_var,
 //                  (value?value:"NULL"),
 //                  (default_value?default_value:"NULL"));
 
-          if (value)
-            value = xbt_strdup(value);
-          else
-            value = xbt_strdup(default_value);
+        if (value)
+          value = xbt_strdup(value);
+        else
+          value = xbt_strdup(default_value);
 
-          if (!value)
-            value = xbt_strdup("");
+        if (!value)
+          value = xbt_strdup("");
 
-          /* En route for the actual substitution */
-          val_len = strlen(value);
+        /* En route for the actual substitution */
+        val_len = strlen(value);
 //          DEBUG2("val_len = %d, key_len=%d",val_len,end_subst-beg_subst);
-          if (val_len <= end_subst-beg_subst) {
-            /* enough room to do the substitute in place */
+        if (val_len <= end_subst - beg_subst) {
+          /* enough room to do the substitute in place */
 //            INFO3("Substitute '%s' with '%s' for %d chars",beg_subst,value, val_len);
-            memmove(beg_subst,value,val_len); /* substitute */
+          memmove(beg_subst, value, val_len);   /* substitute */
 //            INFO3("Substitute '%s' with '%s' for %d chars",beg_subst+val_len,end_subst, b->used-(end_subst-b->data)+1);
-            memmove(beg_subst+val_len,end_subst, b->used-(end_subst - b->data)+1); /* move the end of the string closer */
-            end = beg_subst+val_len; /* update the currently explored char in the overall loop*/
-            b->used -= end_subst-beg_subst-val_len;  /* update string buffer used size */
-          } else {
-            /* we have to extend the data area */
-            int tooshort = val_len-(end_subst-beg_subst) +1/*don't forget \0*/;
-            int newused = b->used + tooshort;
-            end += tooshort; /* update the pointer of the overall loop */
+          memmove(beg_subst + val_len, end_subst, b->used - (end_subst - b->data) + 1); /* move the end of the string closer */
+          end = beg_subst + val_len;    /* update the currently explored char in the overall loop */
+          b->used -= end_subst - beg_subst - val_len;   /* update string buffer used size */
+        } else {
+          /* we have to extend the data area */
+          int tooshort =
+            val_len - (end_subst - beg_subst) + 1 /*don't forget \0 */ ;
+          int newused = b->used + tooshort;
+          end += tooshort;      /* update the pointer of the overall loop */
 //            DEBUG2("Too short (by %d chars; %d chars left in area)",val_len- (end_subst-beg_subst), b->size - b->used);
-            if (newused > b->size) {
-              /* We have to realloc the data area before (because b->size is too small). We have to update our pointers, too */
-              char *newdata = realloc(b->data, b->used + MAX(minimal_increment,tooshort));
-              int offset = newdata - b->data;
-              b->data = newdata;
-              b->size = b->used + MAX(minimal_increment,tooshort);
-              end += offset;
-              beg_subst += offset;
-              end_subst += offset;
-            }
-            memmove(beg_subst+val_len,end_subst, b->used-(end_subst - b->data)+2); /* move the end of the string a bit further */
-            memmove(beg_subst,value,val_len); /* substitute */
-            b->used = newused;
+          if (newused > b->size) {
+            /* We have to realloc the data area before (because b->size is too small). We have to update our pointers, too */
+            char *newdata =
+              realloc(b->data, b->used + MAX(minimal_increment, tooshort));
+            int offset = newdata - b->data;
+            b->data = newdata;
+            b->size = b->used + MAX(minimal_increment, tooshort);
+            end += offset;
+            beg_subst += offset;
+            end_subst += offset;
           }
-          free(value);
-
-          if (default_value)
-            free(default_value);
+          memmove(beg_subst + val_len, end_subst, b->used - (end_subst - b->data) + 2); /* move the end of the string a bit further */
+          memmove(beg_subst, value, val_len);   /* substitute */
+          b->used = newused;
         }
-        break;
+        free(value);
+
+        if (default_value)
+          free(default_value);
+      }
+      break;
 
-      case '\0':
-        done=1;
+    case '\0':
+      done = 1;
     }
     end++;
   }
@@ -266,83 +290,125 @@ void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) {
   "9.........1.........2.........3.........4.........5.........6.........7.........8.........9........." \
   "0.........1.........2.........3.........4.........5.........6.........7.........8.........9........."
 
-static void mytest(const char *input, const char *patterns, const char *expected) {
-  xbt_dynar_t dyn_patterns; /* splited string */
-  xbt_dict_t p; /* patterns */
-  unsigned int cpt;  char *str; /*foreach*/
-  xbt_strbuff_t sb; /* what we test */
-
-  p=xbt_dict_new();
-  dyn_patterns=xbt_str_split(patterns," ");
-  xbt_dynar_foreach(dyn_patterns,cpt,str) {
-    xbt_dynar_t keyvals = xbt_str_split(str,"=");
-    char *key = xbt_dynar_get_as(keyvals,0,char*);
-    char *val = xbt_dynar_get_as(keyvals,1,char*);
-    xbt_str_subst(key,'_',' ',0); // to put space in names without breaking the enclosing dynar_foreach
-    xbt_dict_set(p,key,xbt_strdup(val),free);
+static void mytest(const char *input, const char *patterns,
+                   const char *expected)
+{
+  xbt_dynar_t dyn_patterns;     /* splited string */
+  xbt_dict_t p;                 /* patterns */
+  unsigned int cpt;
+  char *str;                    /*foreach */
+  xbt_strbuff_t sb;             /* what we test */
+
+  p = xbt_dict_new();
+  dyn_patterns = xbt_str_split(patterns, " ");
+  xbt_dynar_foreach(dyn_patterns, cpt, str) {
+    xbt_dynar_t keyvals = xbt_str_split(str, "=");
+    char *key = xbt_dynar_get_as(keyvals, 0, char *);
+    char *val = xbt_dynar_get_as(keyvals, 1, char *);
+    xbt_str_subst(key, '_', ' ', 0);    // to put space in names without breaking the enclosing dynar_foreach
+    xbt_dict_set(p, key, xbt_strdup(val), free);
     xbt_dynar_free(&keyvals);
   }
   xbt_dynar_free(&dyn_patterns);
   sb = xbt_strbuff_new();
-  xbt_strbuff_append(sb,input);
+  xbt_strbuff_append(sb, input);
   xbt_strbuff_varsubst(sb, p);
   xbt_dict_free(&p);
-  xbt_test_assert4(!strcmp(sb->data,expected),
+  xbt_test_assert4(!strcmp(sb->data, expected),
                    "Input (%s) with patterns (%s) leads to (%s) instead of (%s)",
-                   input,patterns,sb->data,expected);
+                   input, patterns, sb->data, expected);
   xbt_strbuff_free(sb);
 }
 
-XBT_TEST_SUITE("xbt_strbuff","String Buffers");
-XBT_TEST_UNIT("xbt_strbuff_substitute",test_strbuff_substitute, "test the function xbt_strbuff_substitute") {
-  xbt_test_add0("Empty");mytest("", "", "");
-
-  xbt_test_add0("Value shorter, no braces, only variable");mytest("$tutu", "tutu=t", "t");
-  xbt_test_add0("Value shorter, braces, only variable");mytest("${tutu}", "tutu=t", "t");
-  xbt_test_add0("Value shorter, no braces, data after");mytest("$tutu toto", "tutu=t", "t toto");
-  xbt_test_add0("Value shorter, braces, data after");mytest("${tutu} toto", "tutu=t", "t toto");
-  xbt_test_add0("Value shorter, no braces, data before");mytest("toto $tutu", "tutu=t", "toto t");
-  xbt_test_add0("Value shorter, braces, data before");mytest("toto ${tutu}", "tutu=t", "toto t");
-  xbt_test_add0("Value shorter, no braces, data before and after");mytest("toto $tutu tata", "tutu=t", "toto t tata");
-  xbt_test_add0("Value shorter, braces, data before and after");mytest("toto ${tutu} tata", "tutu=t", "toto t tata");
-
-  xbt_test_add0("Value as long, no braces, only variable");mytest("$tutu", "tutu=12345", "12345");
-  xbt_test_add0("Value as long, braces, only variable");mytest("${tutu}", "tutu=1234567", "1234567");
-  xbt_test_add0("Value as long, no braces, data after");mytest("$tutu toto", "tutu=12345", "12345 toto");
-  xbt_test_add0("Value as long, braces, data after");mytest("${tutu} toto", "tutu=1234567", "1234567 toto");
-  xbt_test_add0("Value as long, no braces, data before");mytest("toto $tutu", "tutu=12345", "toto 12345");
-  xbt_test_add0("Value as long, braces, data before");mytest("toto ${tutu}", "tutu=1234567", "toto 1234567");
-  xbt_test_add0("Value as long, no braces, data before and after");mytest("toto $tutu tata", "tutu=12345", "toto 12345 tata");
-  xbt_test_add0("Value as long, braces, data before and after");mytest("toto ${tutu} tata", "tutu=1234567", "toto 1234567 tata");
-
-  xbt_test_add0("Value longer, no braces, only variable");mytest("$t", "t=tututu", "tututu");
-  xbt_test_add0("Value longer, braces, only variable");mytest("${t}", "t=tututu", "tututu");
-  xbt_test_add0("Value longer, no braces, data after");mytest("$t toto", "t=tututu", "tututu toto");
-  xbt_test_add0("Value longer, braces, data after");mytest("${t} toto", "t=tututu", "tututu toto");
-  xbt_test_add0("Value longer, no braces, data before");mytest("toto $t", "t=tututu", "toto tututu");
-  xbt_test_add0("Value longer, braces, data before");mytest("toto ${t}", "t=tututu", "toto tututu");
-  xbt_test_add0("Value longer, no braces, data before and after");mytest("toto $t tata", "t=tututu", "toto tututu tata");
-  xbt_test_add0("Value longer, braces, data before and after");mytest("toto ${t} tata", "t=tututu", "toto tututu tata");
-
-  xbt_test_add0("Value much longer, no braces, only variable");mytest("$t", "t=" force_resize, force_resize);
-  xbt_test_add0("Value much longer, no braces, data after");mytest("$t toto", "t=" force_resize, force_resize " toto");
-  xbt_test_add0("Value much longer, braces, data after");mytest("${t} toto", "t=" force_resize, force_resize " toto");
-  xbt_test_add0("Value much longer, no braces, data before");mytest("toto $t", "t=" force_resize, "toto " force_resize);
-  xbt_test_add0("Value much longer, braces, data before");mytest("toto ${t}", "t=" force_resize, "toto " force_resize);
-  xbt_test_add0("Value much longer, no braces, data before and after");mytest("toto $t tata", "t=" force_resize, "toto " force_resize " tata");
-  xbt_test_add0("Value much longer, braces, data before and after");mytest("toto ${t} tata", "t=" force_resize, "toto " force_resize " tata");
-
-  xbt_test_add0("Escaped $");mytest("\\$tutu", "tutu=t", "\\$tutu");
-  xbt_test_add0("Space in var name (with braces)");mytest("${tu ti}", "tu_ti=t", "t");
-
-  xbt_test_add0("Two variables");mytest("$toto $tutu","toto=1 tutu=2", "1 2");
+XBT_TEST_SUITE("xbt_strbuff", "String Buffers");
+XBT_TEST_UNIT("xbt_strbuff_substitute", test_strbuff_substitute,
+              "test the function xbt_strbuff_substitute")
+{
+  xbt_test_add0("Empty");
+  mytest("", "", "");
+
+  xbt_test_add0("Value shorter, no braces, only variable");
+  mytest("$tutu", "tutu=t", "t");
+  xbt_test_add0("Value shorter, braces, only variable");
+  mytest("${tutu}", "tutu=t", "t");
+  xbt_test_add0("Value shorter, no braces, data after");
+  mytest("$tutu toto", "tutu=t", "t toto");
+  xbt_test_add0("Value shorter, braces, data after");
+  mytest("${tutu} toto", "tutu=t", "t toto");
+  xbt_test_add0("Value shorter, no braces, data before");
+  mytest("toto $tutu", "tutu=t", "toto t");
+  xbt_test_add0("Value shorter, braces, data before");
+  mytest("toto ${tutu}", "tutu=t", "toto t");
+  xbt_test_add0("Value shorter, no braces, data before and after");
+  mytest("toto $tutu tata", "tutu=t", "toto t tata");
+  xbt_test_add0("Value shorter, braces, data before and after");
+  mytest("toto ${tutu} tata", "tutu=t", "toto t tata");
+
+  xbt_test_add0("Value as long, no braces, only variable");
+  mytest("$tutu", "tutu=12345", "12345");
+  xbt_test_add0("Value as long, braces, only variable");
+  mytest("${tutu}", "tutu=1234567", "1234567");
+  xbt_test_add0("Value as long, no braces, data after");
+  mytest("$tutu toto", "tutu=12345", "12345 toto");
+  xbt_test_add0("Value as long, braces, data after");
+  mytest("${tutu} toto", "tutu=1234567", "1234567 toto");
+  xbt_test_add0("Value as long, no braces, data before");
+  mytest("toto $tutu", "tutu=12345", "toto 12345");
+  xbt_test_add0("Value as long, braces, data before");
+  mytest("toto ${tutu}", "tutu=1234567", "toto 1234567");
+  xbt_test_add0("Value as long, no braces, data before and after");
+  mytest("toto $tutu tata", "tutu=12345", "toto 12345 tata");
+  xbt_test_add0("Value as long, braces, data before and after");
+  mytest("toto ${tutu} tata", "tutu=1234567", "toto 1234567 tata");
+
+  xbt_test_add0("Value longer, no braces, only variable");
+  mytest("$t", "t=tututu", "tututu");
+  xbt_test_add0("Value longer, braces, only variable");
+  mytest("${t}", "t=tututu", "tututu");
+  xbt_test_add0("Value longer, no braces, data after");
+  mytest("$t toto", "t=tututu", "tututu toto");
+  xbt_test_add0("Value longer, braces, data after");
+  mytest("${t} toto", "t=tututu", "tututu toto");
+  xbt_test_add0("Value longer, no braces, data before");
+  mytest("toto $t", "t=tututu", "toto tututu");
+  xbt_test_add0("Value longer, braces, data before");
+  mytest("toto ${t}", "t=tututu", "toto tututu");
+  xbt_test_add0("Value longer, no braces, data before and after");
+  mytest("toto $t tata", "t=tututu", "toto tututu tata");
+  xbt_test_add0("Value longer, braces, data before and after");
+  mytest("toto ${t} tata", "t=tututu", "toto tututu tata");
+
+  xbt_test_add0("Value much longer, no braces, only variable");
+  mytest("$t", "t=" force_resize, force_resize);
+  xbt_test_add0("Value much longer, no braces, data after");
+  mytest("$t toto", "t=" force_resize, force_resize " toto");
+  xbt_test_add0("Value much longer, braces, data after");
+  mytest("${t} toto", "t=" force_resize, force_resize " toto");
+  xbt_test_add0("Value much longer, no braces, data before");
+  mytest("toto $t", "t=" force_resize, "toto " force_resize);
+  xbt_test_add0("Value much longer, braces, data before");
+  mytest("toto ${t}", "t=" force_resize, "toto " force_resize);
+  xbt_test_add0("Value much longer, no braces, data before and after");
+  mytest("toto $t tata", "t=" force_resize, "toto " force_resize " tata");
+  xbt_test_add0("Value much longer, braces, data before and after");
+  mytest("toto ${t} tata", "t=" force_resize, "toto " force_resize " tata");
+
+  xbt_test_add0("Escaped $");
+  mytest("\\$tutu", "tutu=t", "\\$tutu");
+  xbt_test_add0("Space in var name (with braces)");
+  mytest("${tu ti}", "tu_ti=t", "t");
+
+  xbt_test_add0("Two variables");
+  mytest("$toto $tutu", "toto=1 tutu=2", "1 2");
 
   // Commented: I'm too lazy to do a memmove in var name to remove the backslash after use.
   // Users should use braces.
   //  xbt_test_add0("Escaped space in var name", "$tu\\ ti", "tu_ti=t", "t");
 
-  xbt_test_add0("Default value");mytest("${t:-toto}", "", "toto");
-  xbt_test_add0("Useless default value (variable already defined)");mytest("${t:-toto}", "t=TRUC", "TRUC");
+  xbt_test_add0("Default value");
+  mytest("${t:-toto}", "", "toto");
+  xbt_test_add0("Useless default value (variable already defined)");
+  mytest("${t:-toto}", "t=TRUC", "TRUC");
 
 }
 
index 041bbd4..739058c 100644 (file)
@@ -11,9 +11,9 @@
 #include "xbt/virtu.h"
 #include "xbt/function_types.h"
 
-static int xbt_fake_pid(void) {
+static int xbt_fake_pid(void)
+{
   return 0;
 }
 
-int_f_void_t xbt_getpid=xbt_fake_pid;
-
+int_f_void_t xbt_getpid = xbt_fake_pid;
index 0060a26..ab2be1f 100644 (file)
@@ -15,7 +15,7 @@
 void xbt_backtrace_init(void);
 void xbt_backtrace_exit(void);
 
-void xbt_log_init(int *argc,char **argv);
+void xbt_log_init(int *argc, char **argv);
 void xbt_log_exit(void);
 void xbt_fifo_exit(void);
 void xbt_dict_exit(void);
@@ -24,6 +24,6 @@ void xbt_context_mod_init(void);
 void xbt_context_mod_exit(void);
 
 void xbt_os_thread_mod_init(void);
-void xbt_os_thread_mod_exit(void);   
-   
+void xbt_os_thread_mod_exit(void);
+
 #endif /* XBT_MODINTER_H */
index 155ebbf..916db98 100644 (file)
 
 #include "gras.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(structs,test,"Logs about the gigantic struct test");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(structs, test,
+                                "Logs about the gigantic struct test");
 
 #define READ  0
 #define WRITE 1
 #define RW    2
 
-void write_read(const char *type,void *src, void *dst, gras_socket_t *sock, int direction);
-
-GRAS_DEFINE_TYPE(cccc,struct cccc { char a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(ccsc,struct ccsc { char a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(ccic,struct ccic { char a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(cclc,struct cclc { char a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(ccLc,struct ccLc { char a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(ccfc,struct ccfc { char a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(ccdc,struct ccdc { char a; char b; double c;char d;};)
-GRAS_DEFINE_TYPE(sccc,struct sccc { short int a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(scsc,struct scsc { short int a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(scic,struct scic { short int a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(sclc,struct sclc { short int a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(scLc,struct scLc { short int a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(scfc,struct scfc { short int a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(scdc,struct scdc { short int a; char b; double c;char d;};)
-GRAS_DEFINE_TYPE(iccc,struct iccc { int a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(icsc,struct icsc { int a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(icic,struct icic { int a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(iclc,struct iclc { int a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(icLc,struct icLc { int a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(icfc,struct icfc { int a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(icdc,struct icdc { int a; char b; double c;char d;};)
-GRAS_DEFINE_TYPE(lccc,struct lccc { long int a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(lcsc,struct lcsc { long int a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(lcic,struct lcic { long int a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(lclc,struct lclc { long int a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(lcLc,struct lcLc { long int a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(lcfc,struct lcfc { long int a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(lcdc,struct lcdc { long int a; char b; double c;char d;};)
-GRAS_DEFINE_TYPE(Lccc,struct Lccc { long long int a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(Lcsc,struct Lcsc { long long int a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(Lcic,struct Lcic { long long int a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(Lclc,struct Lclc { long long int a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(LcLc,struct LcLc { long long int a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(Lcfc,struct Lcfc { long long int a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(Lcdc,struct Lcdc { long long int a; char b; double c;char d;};)
-GRAS_DEFINE_TYPE(fccc,struct fccc { float a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(fcsc,struct fcsc { float a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(fcic,struct fcic { float a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(fclc,struct fclc { float a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(fcLc,struct fcLc { float a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(fcfc,struct fcfc { float a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(fcdc,struct fcdc { float a; char b; double c;char d;};)
-GRAS_DEFINE_TYPE(dccc,struct dccc { double a; char b; char c;char d;};)
-GRAS_DEFINE_TYPE(dcsc,struct dcsc { double a; char b; short int c;char d;};)
-GRAS_DEFINE_TYPE(dcic,struct dcic { double a; char b; int c;char d;};)
-GRAS_DEFINE_TYPE(dclc,struct dclc { double a; char b; long int c;char d;};)
-GRAS_DEFINE_TYPE(dcLc,struct dcLc { double a; char b; long long int c;char d;};)
-GRAS_DEFINE_TYPE(dcfc,struct dcfc { double a; char b; float c;char d;};)
-GRAS_DEFINE_TYPE(dcdc,struct dcdc { double a; char b; double c;char d;};)
+void write_read(const char *type, void *src, void *dst, gras_socket_t * sock,
+                int direction);
+
+GRAS_DEFINE_TYPE(cccc, struct cccc {
+                 char a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(ccsc, struct ccsc {
+                   char a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(ccic, struct ccic {
+                   char a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(cclc, struct cclc {
+                   char a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(ccLc, struct ccLc {
+                   char a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(ccfc, struct ccfc {
+                   char a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(ccdc, struct ccdc {
+                   char a; char b; double c; char d;};)
+
+  GRAS_DEFINE_TYPE(sccc, struct sccc {
+                   short int a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(scsc, struct scsc {
+                   short int a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(scic, struct scic {
+                   short int a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(sclc, struct sclc {
+                   short int a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(scLc, struct scLc {
+                   short int a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(scfc, struct scfc {
+                   short int a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(scdc, struct scdc {
+                   short int a; char b; double c; char d;};)
+
+  GRAS_DEFINE_TYPE(iccc, struct iccc {
+                   int a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(icsc, struct icsc {
+                   int a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(icic, struct icic {
+                   int a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(iclc, struct iclc {
+                   int a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(icLc, struct icLc {
+                   int a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(icfc, struct icfc {
+                   int a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(icdc, struct icdc {
+                   int a; char b; double c; char d;};)
+
+  GRAS_DEFINE_TYPE(lccc, struct lccc {
+                   long int a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(lcsc, struct lcsc {
+                   long int a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(lcic, struct lcic {
+                   long int a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(lclc, struct lclc {
+                   long int a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(lcLc, struct lcLc {
+                   long int a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(lcfc, struct lcfc {
+                   long int a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(lcdc, struct lcdc {
+                   long int a; char b; double c; char d;};)
+
+  GRAS_DEFINE_TYPE(Lccc, struct Lccc {
+                   long long int a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(Lcsc, struct Lcsc {
+                   long long int a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(Lcic, struct Lcic {
+                   long long int a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(Lclc, struct Lclc {
+                   long long int a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(LcLc, struct LcLc {
+                   long long int a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(Lcfc, struct Lcfc {
+                   long long int a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(Lcdc, struct Lcdc {
+                   long long int a; char b; double c; char d;};)
+
+  GRAS_DEFINE_TYPE(fccc, struct fccc {
+                   float a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(fcsc, struct fcsc {
+                   float a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(fcic, struct fcic {
+                   float a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(fclc, struct fclc {
+                   float a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(fcLc, struct fcLc {
+                   float a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(fcfc, struct fcfc {
+                   float a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(fcdc, struct fcdc {
+                   float a; char b; double c; char d;};)
+
+  GRAS_DEFINE_TYPE(dccc, struct dccc {
+                   double a; char b; char c; char d;};)
+
+  GRAS_DEFINE_TYPE(dcsc, struct dcsc {
+                   double a; char b; short int c; char d;};)
+
+  GRAS_DEFINE_TYPE(dcic, struct dcic {
+                   double a; char b; int c; char d;};)
+
+  GRAS_DEFINE_TYPE(dclc, struct dclc {
+                   double a; char b; long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(dcLc, struct dcLc {
+                   double a; char b; long long int c; char d;};)
+
+  GRAS_DEFINE_TYPE(dcfc, struct dcfc {
+                   double a; char b; float c; char d;};)
+
+  GRAS_DEFINE_TYPE(dcdc, struct dcdc {
+                   double a; char b; double c; char d;};)
 
 #define test(a) xbt_assert(a)
-void register_structures(void);
-void register_structures(void) {
+     void register_structures(void);
+     void register_structures(void)
+{
   gras_msgtype_declare("cccc", gras_datadesc_by_symbol(cccc));
   gras_msgtype_declare("ccsc", gras_datadesc_by_symbol(ccsc));
   gras_msgtype_declare("ccic", gras_datadesc_by_symbol(ccic));
@@ -113,497 +213,684 @@ void register_structures(void) {
   gras_msgtype_declare("dcfc", gras_datadesc_by_symbol(dcfc));
   gras_msgtype_declare("dcdc", gras_datadesc_by_symbol(dcdc));
 }
-void test_structures(gras_socket_t *sock, int direction);
-void test_structures(gras_socket_t *sock, int direction) {
-  struct cccc my_cccc = {'w'+(char)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_cccc2;
-  struct ccsc my_ccsc = {'w'+(char)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_ccsc2;
-  struct ccic my_ccic = {'w'+(char)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_ccic2;
-  struct cclc my_cclc = {'w'+(char)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_cclc2;
-  struct ccLc my_ccLc = {'w'+(char)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_ccLc2;
-  struct ccfc my_ccfc = {'w'+(char)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_ccfc2;
-  struct ccdc my_ccdc = {'w'+(char)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_ccdc2;
-  struct sccc my_sccc = {134+(short int)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_sccc2;
-  struct scsc my_scsc = {134+(short int)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_scsc2;
-  struct scic my_scic = {134+(short int)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_scic2;
-  struct sclc my_sclc = {134+(short int)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_sclc2;
-  struct scLc my_scLc = {134+(short int)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_scLc2;
-  struct scfc my_scfc = {134+(short int)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_scfc2;
-  struct scdc my_scdc = {134+(short int)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_scdc2;
-  struct iccc my_iccc = {-11249+(int)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_iccc2;
-  struct icsc my_icsc = {-11249+(int)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_icsc2;
-  struct icic my_icic = {-11249+(int)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_icic2;
-  struct iclc my_iclc = {-11249+(int)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_iclc2;
-  struct icLc my_icLc = {-11249+(int)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_icLc2;
-  struct icfc my_icfc = {-11249+(int)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_icfc2;
-  struct icdc my_icdc = {-11249+(int)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_icdc2;
-  struct lccc my_lccc = {31319919+(long int)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_lccc2;
-  struct lcsc my_lcsc = {31319919+(long int)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_lcsc2;
-  struct lcic my_lcic = {31319919+(long int)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_lcic2;
-  struct lclc my_lclc = {31319919+(long int)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_lclc2;
-  struct lcLc my_lcLc = {31319919+(long int)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_lcLc2;
-  struct lcfc my_lcfc = {31319919+(long int)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_lcfc2;
-  struct lcdc my_lcdc = {31319919+(long int)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_lcdc2;
-  struct Lccc my_Lccc = {-232130010+(long long int)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_Lccc2;
-  struct Lcsc my_Lcsc = {-232130010+(long long int)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_Lcsc2;
-  struct Lcic my_Lcic = {-232130010+(long long int)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_Lcic2;
-  struct Lclc my_Lclc = {-232130010+(long long int)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_Lclc2;
-  struct LcLc my_LcLc = {-232130010+(long long int)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_LcLc2;
-  struct Lcfc my_Lcfc = {-232130010+(long long int)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_Lcfc2;
-  struct Lcdc my_Lcdc = {-232130010+(long long int)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_Lcdc2;
-  struct fccc my_fccc = {-11313.1135+(float)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_fccc2;
-  struct fcsc my_fcsc = {-11313.1135+(float)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_fcsc2;
-  struct fcic my_fcic = {-11313.1135+(float)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_fcic2;
-  struct fclc my_fclc = {-11313.1135+(float)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_fclc2;
-  struct fcLc my_fcLc = {-11313.1135+(float)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_fcLc2;
-  struct fcfc my_fcfc = {-11313.1135+(float)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_fcfc2;
-  struct fcdc my_fcdc = {-11313.1135+(float)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_fcdc2;
-  struct dccc my_dccc = {1424420.11331+(double)1,'w'+(char)2,'w'+(char)3,'w'+(char)4}, my_dccc2;
-  struct dcsc my_dcsc = {1424420.11331+(double)1,'w'+(char)2,134+(short int)3,'w'+(char)4}, my_dcsc2;
-  struct dcic my_dcic = {1424420.11331+(double)1,'w'+(char)2,-11249+(int)3,'w'+(char)4}, my_dcic2;
-  struct dclc my_dclc = {1424420.11331+(double)1,'w'+(char)2,31319919+(long int)3,'w'+(char)4}, my_dclc2;
-  struct dcLc my_dcLc = {1424420.11331+(double)1,'w'+(char)2,-232130010+(long long int)3,'w'+(char)4}, my_dcLc2;
-  struct dcfc my_dcfc = {1424420.11331+(double)1,'w'+(char)2,-11313.1135+(float)3,'w'+(char)4}, my_dcfc2;
-  struct dcdc my_dcdc = {1424420.11331+(double)1,'w'+(char)2,1424420.11331+(double)3,'w'+(char)4}, my_dcdc2;
+
+void test_structures(gras_socket_t * sock, int direction);
+void test_structures(gras_socket_t * sock, int direction)
+{
+  struct cccc my_cccc =
+    { 'w' + (char) 1, 'w' + (char) 2, 'w' + (char) 3, 'w' + (char) 4 },
+    my_cccc2;
+  struct ccsc my_ccsc =
+    { 'w' + (char) 1, 'w' + (char) 2, 134 + (short int) 3, 'w' + (char) 4 },
+    my_ccsc2;
+  struct ccic my_ccic =
+    { 'w' + (char) 1, 'w' + (char) 2, -11249 + (int) 3, 'w' + (char) 4 },
+    my_ccic2;
+  struct cclc my_cclc =
+    { 'w' + (char) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_cclc2;
+  struct ccLc my_ccLc =
+    { 'w' + (char) 1, 'w' + (char) 2, -232130010 + (long long int) 3,
+    'w' + (char) 4
+  }, my_ccLc2;
+  struct ccfc my_ccfc =
+    { 'w' + (char) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_ccfc2;
+  struct ccdc my_ccdc =
+    { 'w' + (char) 1, 'w' + (char) 2, 1424420.11331 + (double) 3,
+    'w' + (char) 4
+  }, my_ccdc2;
+  struct sccc my_sccc =
+    { 134 + (short int) 1, 'w' + (char) 2, 'w' + (char) 3, 'w' + (char) 4 },
+    my_sccc2;
+  struct scsc my_scsc =
+    { 134 + (short int) 1, 'w' + (char) 2, 134 + (short int) 3,
+    'w' + (char) 4
+  }, my_scsc2;
+  struct scic my_scic =
+    { 134 + (short int) 1, 'w' + (char) 2, -11249 + (int) 3, 'w' + (char) 4 },
+    my_scic2;
+  struct sclc my_sclc =
+    { 134 + (short int) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_sclc2;
+  struct scLc my_scLc =
+    { 134 + (short int) 1, 'w' + (char) 2, -232130010 + (long long int) 3,
+    'w' + (char) 4
+  }, my_scLc2;
+  struct scfc my_scfc =
+    { 134 + (short int) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_scfc2;
+  struct scdc my_scdc =
+    { 134 + (short int) 1, 'w' + (char) 2, 1424420.11331 + (double) 3,
+    'w' + (char) 4
+  }, my_scdc2;
+  struct iccc my_iccc =
+    { -11249 + (int) 1, 'w' + (char) 2, 'w' + (char) 3, 'w' + (char) 4 },
+    my_iccc2;
+  struct icsc my_icsc =
+    { -11249 + (int) 1, 'w' + (char) 2, 134 + (short int) 3, 'w' + (char) 4 },
+    my_icsc2;
+  struct icic my_icic =
+    { -11249 + (int) 1, 'w' + (char) 2, -11249 + (int) 3, 'w' + (char) 4 },
+    my_icic2;
+  struct iclc my_iclc =
+    { -11249 + (int) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_iclc2;
+  struct icLc my_icLc =
+    { -11249 + (int) 1, 'w' + (char) 2, -232130010 + (long long int) 3,
+    'w' + (char) 4
+  }, my_icLc2;
+  struct icfc my_icfc =
+    { -11249 + (int) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_icfc2;
+  struct icdc my_icdc =
+    { -11249 + (int) 1, 'w' + (char) 2, 1424420.11331 + (double) 3,
+    'w' + (char) 4
+  }, my_icdc2;
+  struct lccc my_lccc =
+    { 31319919 + (long int) 1, 'w' + (char) 2, 'w' + (char) 3,
+    'w' + (char) 4
+  }, my_lccc2;
+  struct lcsc my_lcsc =
+    { 31319919 + (long int) 1, 'w' + (char) 2, 134 + (short int) 3,
+    'w' + (char) 4
+  }, my_lcsc2;
+  struct lcic my_lcic =
+    { 31319919 + (long int) 1, 'w' + (char) 2, -11249 + (int) 3,
+    'w' + (char) 4
+  }, my_lcic2;
+  struct lclc my_lclc =
+    { 31319919 + (long int) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_lclc2;
+  struct lcLc my_lcLc =
+    { 31319919 + (long int) 1, 'w' + (char) 2, -232130010 + (long long int) 3,
+    'w' + (char) 4
+  }, my_lcLc2;
+  struct lcfc my_lcfc =
+    { 31319919 + (long int) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_lcfc2;
+  struct lcdc my_lcdc =
+    { 31319919 + (long int) 1, 'w' + (char) 2, 1424420.11331 + (double) 3,
+    'w' + (char) 4
+  }, my_lcdc2;
+  struct Lccc my_Lccc =
+    { -232130010 + (long long int) 1, 'w' + (char) 2, 'w' + (char) 3,
+    'w' + (char) 4
+  }, my_Lccc2;
+  struct Lcsc my_Lcsc =
+    { -232130010 + (long long int) 1, 'w' + (char) 2, 134 + (short int) 3,
+    'w' + (char) 4
+  }, my_Lcsc2;
+  struct Lcic my_Lcic =
+    { -232130010 + (long long int) 1, 'w' + (char) 2, -11249 + (int) 3,
+    'w' + (char) 4
+  }, my_Lcic2;
+  struct Lclc my_Lclc =
+    { -232130010 + (long long int) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_Lclc2;
+  struct LcLc my_LcLc = { -232130010 + (long long int) 1, 'w' + (char) 2,
+    -232130010 + (long long int) 3, 'w' + (char) 4
+  }, my_LcLc2;
+  struct Lcfc my_Lcfc =
+    { -232130010 + (long long int) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_Lcfc2;
+  struct Lcdc my_Lcdc = { -232130010 + (long long int) 1, 'w' + (char) 2,
+    1424420.11331 + (double) 3, 'w' + (char) 4
+  }, my_Lcdc2;
+  struct fccc my_fccc =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, 'w' + (char) 3,
+    'w' + (char) 4
+  }, my_fccc2;
+  struct fcsc my_fcsc =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, 134 + (short int) 3,
+    'w' + (char) 4
+  }, my_fcsc2;
+  struct fcic my_fcic =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, -11249 + (int) 3,
+    'w' + (char) 4
+  }, my_fcic2;
+  struct fclc my_fclc =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_fclc2;
+  struct fcLc my_fcLc =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, -232130010 + (long long int) 3,
+    'w' + (char) 4
+  }, my_fcLc2;
+  struct fcfc my_fcfc =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_fcfc2;
+  struct fcdc my_fcdc =
+    { -11313.1135 + (float) 1, 'w' + (char) 2, 1424420.11331 + (double) 3,
+    'w' + (char) 4
+  }, my_fcdc2;
+  struct dccc my_dccc =
+    { 1424420.11331 + (double) 1, 'w' + (char) 2, 'w' + (char) 3,
+    'w' + (char) 4
+  }, my_dccc2;
+  struct dcsc my_dcsc =
+    { 1424420.11331 + (double) 1, 'w' + (char) 2, 134 + (short int) 3,
+    'w' + (char) 4
+  }, my_dcsc2;
+  struct dcic my_dcic =
+    { 1424420.11331 + (double) 1, 'w' + (char) 2, -11249 + (int) 3,
+    'w' + (char) 4
+  }, my_dcic2;
+  struct dclc my_dclc =
+    { 1424420.11331 + (double) 1, 'w' + (char) 2, 31319919 + (long int) 3,
+    'w' + (char) 4
+  }, my_dclc2;
+  struct dcLc my_dcLc = { 1424420.11331 + (double) 1, 'w' + (char) 2,
+    -232130010 + (long long int) 3, 'w' + (char) 4
+  }, my_dcLc2;
+  struct dcfc my_dcfc =
+    { 1424420.11331 + (double) 1, 'w' + (char) 2, -11313.1135 + (float) 3,
+    'w' + (char) 4
+  }, my_dcfc2;
+  struct dcdc my_dcdc =
+    { 1424420.11331 + (double) 1, 'w' + (char) 2, 1424420.11331 + (double) 3,
+    'w' + (char) 4
+  }, my_dcdc2;
   INFO0("---- Test on all possible struct having 3 fields (49 structs) ----");
-  write_read("cccc", &my_cccc, &my_cccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_cccc.a == my_cccc2.a);
-     test(my_cccc.b == my_cccc2.b);
-     test(my_cccc.c == my_cccc2.c);
-     test(my_cccc.d == my_cccc2.d);
-     if (!failed) VERB0("Passed cccc");
-  }
-  write_read("ccsc", &my_ccsc, &my_ccsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_ccsc.a == my_ccsc2.a);
-     test(my_ccsc.b == my_ccsc2.b);
-     test(my_ccsc.c == my_ccsc2.c);
-     test(my_ccsc.d == my_ccsc2.d);
-     if (!failed) VERB0("Passed ccsc");
-  }
-  write_read("ccic", &my_ccic, &my_ccic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_ccic.a == my_ccic2.a);
-     test(my_ccic.b == my_ccic2.b);
-     test(my_ccic.c == my_ccic2.c);
-     test(my_ccic.d == my_ccic2.d);
-     if (!failed) VERB0("Passed ccic");
-  }
-  write_read("cclc", &my_cclc, &my_cclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_cclc.a == my_cclc2.a);
-     test(my_cclc.b == my_cclc2.b);
-     test(my_cclc.c == my_cclc2.c);
-     test(my_cclc.d == my_cclc2.d);
-     if (!failed) VERB0("Passed cclc");
-  }
-  write_read("ccLc", &my_ccLc, &my_ccLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_ccLc.a == my_ccLc2.a);
-     test(my_ccLc.b == my_ccLc2.b);
-     test(my_ccLc.c == my_ccLc2.c);
-     test(my_ccLc.d == my_ccLc2.d);
-     if (!failed) VERB0("Passed ccLc");
-  }
-  write_read("ccfc", &my_ccfc, &my_ccfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_ccfc.a == my_ccfc2.a);
-     test(my_ccfc.b == my_ccfc2.b);
-     test(my_ccfc.c == my_ccfc2.c);
-     test(my_ccfc.d == my_ccfc2.d);
-     if (!failed) VERB0("Passed ccfc");
-  }
-  write_read("ccdc", &my_ccdc, &my_ccdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_ccdc.a == my_ccdc2.a);
-     test(my_ccdc.b == my_ccdc2.b);
-     test(my_ccdc.c == my_ccdc2.c);
-     test(my_ccdc.d == my_ccdc2.d);
-     if (!failed) VERB0("Passed ccdc");
-  }
-  write_read("sccc", &my_sccc, &my_sccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_sccc.a == my_sccc2.a);
-     test(my_sccc.b == my_sccc2.b);
-     test(my_sccc.c == my_sccc2.c);
-     test(my_sccc.d == my_sccc2.d);
-     if (!failed) VERB0("Passed sccc");
-  }
-  write_read("scsc", &my_scsc, &my_scsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_scsc.a == my_scsc2.a);
-     test(my_scsc.b == my_scsc2.b);
-     test(my_scsc.c == my_scsc2.c);
-     test(my_scsc.d == my_scsc2.d);
-     if (!failed) VERB0("Passed scsc");
-  }
-  write_read("scic", &my_scic, &my_scic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_scic.a == my_scic2.a);
-     test(my_scic.b == my_scic2.b);
-     test(my_scic.c == my_scic2.c);
-     test(my_scic.d == my_scic2.d);
-     if (!failed) VERB0("Passed scic");
-  }
-  write_read("sclc", &my_sclc, &my_sclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_sclc.a == my_sclc2.a);
-     test(my_sclc.b == my_sclc2.b);
-     test(my_sclc.c == my_sclc2.c);
-     test(my_sclc.d == my_sclc2.d);
-     if (!failed) VERB0("Passed sclc");
-  }
-  write_read("scLc", &my_scLc, &my_scLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_scLc.a == my_scLc2.a);
-     test(my_scLc.b == my_scLc2.b);
-     test(my_scLc.c == my_scLc2.c);
-     test(my_scLc.d == my_scLc2.d);
-     if (!failed) VERB0("Passed scLc");
-  }
-  write_read("scfc", &my_scfc, &my_scfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_scfc.a == my_scfc2.a);
-     test(my_scfc.b == my_scfc2.b);
-     test(my_scfc.c == my_scfc2.c);
-     test(my_scfc.d == my_scfc2.d);
-     if (!failed) VERB0("Passed scfc");
-  }
-  write_read("scdc", &my_scdc, &my_scdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_scdc.a == my_scdc2.a);
-     test(my_scdc.b == my_scdc2.b);
-     test(my_scdc.c == my_scdc2.c);
-     test(my_scdc.d == my_scdc2.d);
-     if (!failed) VERB0("Passed scdc");
-  }
-  write_read("iccc", &my_iccc, &my_iccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_iccc.a == my_iccc2.a);
-     test(my_iccc.b == my_iccc2.b);
-     test(my_iccc.c == my_iccc2.c);
-     test(my_iccc.d == my_iccc2.d);
-     if (!failed) VERB0("Passed iccc");
-  }
-  write_read("icsc", &my_icsc, &my_icsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_icsc.a == my_icsc2.a);
-     test(my_icsc.b == my_icsc2.b);
-     test(my_icsc.c == my_icsc2.c);
-     test(my_icsc.d == my_icsc2.d);
-     if (!failed) VERB0("Passed icsc");
-  }
-  write_read("icic", &my_icic, &my_icic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_icic.a == my_icic2.a);
-     test(my_icic.b == my_icic2.b);
-     test(my_icic.c == my_icic2.c);
-     test(my_icic.d == my_icic2.d);
-     if (!failed) VERB0("Passed icic");
-  }
-  write_read("iclc", &my_iclc, &my_iclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_iclc.a == my_iclc2.a);
-     test(my_iclc.b == my_iclc2.b);
-     test(my_iclc.c == my_iclc2.c);
-     test(my_iclc.d == my_iclc2.d);
-     if (!failed) VERB0("Passed iclc");
-  }
-  write_read("icLc", &my_icLc, &my_icLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_icLc.a == my_icLc2.a);
-     test(my_icLc.b == my_icLc2.b);
-     test(my_icLc.c == my_icLc2.c);
-     test(my_icLc.d == my_icLc2.d);
-     if (!failed) VERB0("Passed icLc");
-  }
-  write_read("icfc", &my_icfc, &my_icfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_icfc.a == my_icfc2.a);
-     test(my_icfc.b == my_icfc2.b);
-     test(my_icfc.c == my_icfc2.c);
-     test(my_icfc.d == my_icfc2.d);
-     if (!failed) VERB0("Passed icfc");
-  }
-  write_read("icdc", &my_icdc, &my_icdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_icdc.a == my_icdc2.a);
-     test(my_icdc.b == my_icdc2.b);
-     test(my_icdc.c == my_icdc2.c);
-     test(my_icdc.d == my_icdc2.d);
-     if (!failed) VERB0("Passed icdc");
-  }
-  write_read("lccc", &my_lccc, &my_lccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lccc.a == my_lccc2.a);
-     test(my_lccc.b == my_lccc2.b);
-     test(my_lccc.c == my_lccc2.c);
-     test(my_lccc.d == my_lccc2.d);
-     if (!failed) VERB0("Passed lccc");
-  }
-  write_read("lcsc", &my_lcsc, &my_lcsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lcsc.a == my_lcsc2.a);
-     test(my_lcsc.b == my_lcsc2.b);
-     test(my_lcsc.c == my_lcsc2.c);
-     test(my_lcsc.d == my_lcsc2.d);
-     if (!failed) VERB0("Passed lcsc");
-  }
-  write_read("lcic", &my_lcic, &my_lcic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lcic.a == my_lcic2.a);
-     test(my_lcic.b == my_lcic2.b);
-     test(my_lcic.c == my_lcic2.c);
-     test(my_lcic.d == my_lcic2.d);
-     if (!failed) VERB0("Passed lcic");
-  }
-  write_read("lclc", &my_lclc, &my_lclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lclc.a == my_lclc2.a);
-     test(my_lclc.b == my_lclc2.b);
-     test(my_lclc.c == my_lclc2.c);
-     test(my_lclc.d == my_lclc2.d);
-     if (!failed) VERB0("Passed lclc");
-  }
-  write_read("lcLc", &my_lcLc, &my_lcLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lcLc.a == my_lcLc2.a);
-     test(my_lcLc.b == my_lcLc2.b);
-     test(my_lcLc.c == my_lcLc2.c);
-     test(my_lcLc.d == my_lcLc2.d);
-     if (!failed) VERB0("Passed lcLc");
-  }
-  write_read("lcfc", &my_lcfc, &my_lcfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lcfc.a == my_lcfc2.a);
-     test(my_lcfc.b == my_lcfc2.b);
-     test(my_lcfc.c == my_lcfc2.c);
-     test(my_lcfc.d == my_lcfc2.d);
-     if (!failed) VERB0("Passed lcfc");
-  }
-  write_read("lcdc", &my_lcdc, &my_lcdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_lcdc.a == my_lcdc2.a);
-     test(my_lcdc.b == my_lcdc2.b);
-     test(my_lcdc.c == my_lcdc2.c);
-     test(my_lcdc.d == my_lcdc2.d);
-     if (!failed) VERB0("Passed lcdc");
-  }
-  write_read("Lccc", &my_Lccc, &my_Lccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_Lccc.a == my_Lccc2.a);
-     test(my_Lccc.b == my_Lccc2.b);
-     test(my_Lccc.c == my_Lccc2.c);
-     test(my_Lccc.d == my_Lccc2.d);
-     if (!failed) VERB0("Passed Lccc");
-  }
-  write_read("Lcsc", &my_Lcsc, &my_Lcsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_Lcsc.a == my_Lcsc2.a);
-     test(my_Lcsc.b == my_Lcsc2.b);
-     test(my_Lcsc.c == my_Lcsc2.c);
-     test(my_Lcsc.d == my_Lcsc2.d);
-     if (!failed) VERB0("Passed Lcsc");
-  }
-  write_read("Lcic", &my_Lcic, &my_Lcic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_Lcic.a == my_Lcic2.a);
-     test(my_Lcic.b == my_Lcic2.b);
-     test(my_Lcic.c == my_Lcic2.c);
-     test(my_Lcic.d == my_Lcic2.d);
-     if (!failed) VERB0("Passed Lcic");
-  }
-  write_read("Lclc", &my_Lclc, &my_Lclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_Lclc.a == my_Lclc2.a);
-     test(my_Lclc.b == my_Lclc2.b);
-     test(my_Lclc.c == my_Lclc2.c);
-     test(my_Lclc.d == my_Lclc2.d);
-     if (!failed) VERB0("Passed Lclc");
-  }
-  write_read("LcLc", &my_LcLc, &my_LcLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_LcLc.a == my_LcLc2.a);
-     test(my_LcLc.b == my_LcLc2.b);
-     test(my_LcLc.c == my_LcLc2.c);
-     test(my_LcLc.d == my_LcLc2.d);
-     if (!failed) VERB0("Passed LcLc");
-  }
-  write_read("Lcfc", &my_Lcfc, &my_Lcfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_Lcfc.a == my_Lcfc2.a);
-     test(my_Lcfc.b == my_Lcfc2.b);
-     test(my_Lcfc.c == my_Lcfc2.c);
-     test(my_Lcfc.d == my_Lcfc2.d);
-     if (!failed) VERB0("Passed Lcfc");
-  }
-  write_read("Lcdc", &my_Lcdc, &my_Lcdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_Lcdc.a == my_Lcdc2.a);
-     test(my_Lcdc.b == my_Lcdc2.b);
-     test(my_Lcdc.c == my_Lcdc2.c);
-     test(my_Lcdc.d == my_Lcdc2.d);
-     if (!failed) VERB0("Passed Lcdc");
-  }
-  write_read("fccc", &my_fccc, &my_fccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fccc.a == my_fccc2.a);
-     test(my_fccc.b == my_fccc2.b);
-     test(my_fccc.c == my_fccc2.c);
-     test(my_fccc.d == my_fccc2.d);
-     if (!failed) VERB0("Passed fccc");
-  }
-  write_read("fcsc", &my_fcsc, &my_fcsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fcsc.a == my_fcsc2.a);
-     test(my_fcsc.b == my_fcsc2.b);
-     test(my_fcsc.c == my_fcsc2.c);
-     test(my_fcsc.d == my_fcsc2.d);
-     if (!failed) VERB0("Passed fcsc");
-  }
-  write_read("fcic", &my_fcic, &my_fcic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fcic.a == my_fcic2.a);
-     test(my_fcic.b == my_fcic2.b);
-     test(my_fcic.c == my_fcic2.c);
-     test(my_fcic.d == my_fcic2.d);
-     if (!failed) VERB0("Passed fcic");
-  }
-  write_read("fclc", &my_fclc, &my_fclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fclc.a == my_fclc2.a);
-     test(my_fclc.b == my_fclc2.b);
-     test(my_fclc.c == my_fclc2.c);
-     test(my_fclc.d == my_fclc2.d);
-     if (!failed) VERB0("Passed fclc");
-  }
-  write_read("fcLc", &my_fcLc, &my_fcLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fcLc.a == my_fcLc2.a);
-     test(my_fcLc.b == my_fcLc2.b);
-     test(my_fcLc.c == my_fcLc2.c);
-     test(my_fcLc.d == my_fcLc2.d);
-     if (!failed) VERB0("Passed fcLc");
-  }
-  write_read("fcfc", &my_fcfc, &my_fcfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fcfc.a == my_fcfc2.a);
-     test(my_fcfc.b == my_fcfc2.b);
-     test(my_fcfc.c == my_fcfc2.c);
-     test(my_fcfc.d == my_fcfc2.d);
-     if (!failed) VERB0("Passed fcfc");
-  }
-  write_read("fcdc", &my_fcdc, &my_fcdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_fcdc.a == my_fcdc2.a);
-     test(my_fcdc.b == my_fcdc2.b);
-     test(my_fcdc.c == my_fcdc2.c);
-     test(my_fcdc.d == my_fcdc2.d);
-     if (!failed) VERB0("Passed fcdc");
-  }
-  write_read("dccc", &my_dccc, &my_dccc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dccc.a == my_dccc2.a);
-     test(my_dccc.b == my_dccc2.b);
-     test(my_dccc.c == my_dccc2.c);
-     test(my_dccc.d == my_dccc2.d);
-     if (!failed) VERB0("Passed dccc");
-  }
-  write_read("dcsc", &my_dcsc, &my_dcsc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dcsc.a == my_dcsc2.a);
-     test(my_dcsc.b == my_dcsc2.b);
-     test(my_dcsc.c == my_dcsc2.c);
-     test(my_dcsc.d == my_dcsc2.d);
-     if (!failed) VERB0("Passed dcsc");
-  }
-  write_read("dcic", &my_dcic, &my_dcic2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dcic.a == my_dcic2.a);
-     test(my_dcic.b == my_dcic2.b);
-     test(my_dcic.c == my_dcic2.c);
-     test(my_dcic.d == my_dcic2.d);
-     if (!failed) VERB0("Passed dcic");
-  }
-  write_read("dclc", &my_dclc, &my_dclc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dclc.a == my_dclc2.a);
-     test(my_dclc.b == my_dclc2.b);
-     test(my_dclc.c == my_dclc2.c);
-     test(my_dclc.d == my_dclc2.d);
-     if (!failed) VERB0("Passed dclc");
-  }
-  write_read("dcLc", &my_dcLc, &my_dcLc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dcLc.a == my_dcLc2.a);
-     test(my_dcLc.b == my_dcLc2.b);
-     test(my_dcLc.c == my_dcLc2.c);
-     test(my_dcLc.d == my_dcLc2.d);
-     if (!failed) VERB0("Passed dcLc");
-  }
-  write_read("dcfc", &my_dcfc, &my_dcfc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dcfc.a == my_dcfc2.a);
-     test(my_dcfc.b == my_dcfc2.b);
-     test(my_dcfc.c == my_dcfc2.c);
-     test(my_dcfc.d == my_dcfc2.d);
-     if (!failed) VERB0("Passed dcfc");
-  }
-  write_read("dcdc", &my_dcdc, &my_dcdc2, sock,direction);
-  if (direction == READ || direction == RW) {
-     int failed = 0;
-     test(my_dcdc.a == my_dcdc2.a);
-     test(my_dcdc.b == my_dcdc2.b);
-     test(my_dcdc.c == my_dcdc2.c);
-     test(my_dcdc.d == my_dcdc2.d);
-     if (!failed) VERB0("Passed dcdc");
+  write_read("cccc", &my_cccc, &my_cccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_cccc.a == my_cccc2.a);
+    test(my_cccc.b == my_cccc2.b);
+    test(my_cccc.c == my_cccc2.c);
+    test(my_cccc.d == my_cccc2.d);
+    if (!failed)
+      VERB0("Passed cccc");
+  }
+  write_read("ccsc", &my_ccsc, &my_ccsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_ccsc.a == my_ccsc2.a);
+    test(my_ccsc.b == my_ccsc2.b);
+    test(my_ccsc.c == my_ccsc2.c);
+    test(my_ccsc.d == my_ccsc2.d);
+    if (!failed)
+      VERB0("Passed ccsc");
+  }
+  write_read("ccic", &my_ccic, &my_ccic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_ccic.a == my_ccic2.a);
+    test(my_ccic.b == my_ccic2.b);
+    test(my_ccic.c == my_ccic2.c);
+    test(my_ccic.d == my_ccic2.d);
+    if (!failed)
+      VERB0("Passed ccic");
+  }
+  write_read("cclc", &my_cclc, &my_cclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_cclc.a == my_cclc2.a);
+    test(my_cclc.b == my_cclc2.b);
+    test(my_cclc.c == my_cclc2.c);
+    test(my_cclc.d == my_cclc2.d);
+    if (!failed)
+      VERB0("Passed cclc");
+  }
+  write_read("ccLc", &my_ccLc, &my_ccLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_ccLc.a == my_ccLc2.a);
+    test(my_ccLc.b == my_ccLc2.b);
+    test(my_ccLc.c == my_ccLc2.c);
+    test(my_ccLc.d == my_ccLc2.d);
+    if (!failed)
+      VERB0("Passed ccLc");
+  }
+  write_read("ccfc", &my_ccfc, &my_ccfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_ccfc.a == my_ccfc2.a);
+    test(my_ccfc.b == my_ccfc2.b);
+    test(my_ccfc.c == my_ccfc2.c);
+    test(my_ccfc.d == my_ccfc2.d);
+    if (!failed)
+      VERB0("Passed ccfc");
+  }
+  write_read("ccdc", &my_ccdc, &my_ccdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_ccdc.a == my_ccdc2.a);
+    test(my_ccdc.b == my_ccdc2.b);
+    test(my_ccdc.c == my_ccdc2.c);
+    test(my_ccdc.d == my_ccdc2.d);
+    if (!failed)
+      VERB0("Passed ccdc");
+  }
+  write_read("sccc", &my_sccc, &my_sccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_sccc.a == my_sccc2.a);
+    test(my_sccc.b == my_sccc2.b);
+    test(my_sccc.c == my_sccc2.c);
+    test(my_sccc.d == my_sccc2.d);
+    if (!failed)
+      VERB0("Passed sccc");
+  }
+  write_read("scsc", &my_scsc, &my_scsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_scsc.a == my_scsc2.a);
+    test(my_scsc.b == my_scsc2.b);
+    test(my_scsc.c == my_scsc2.c);
+    test(my_scsc.d == my_scsc2.d);
+    if (!failed)
+      VERB0("Passed scsc");
+  }
+  write_read("scic", &my_scic, &my_scic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_scic.a == my_scic2.a);
+    test(my_scic.b == my_scic2.b);
+    test(my_scic.c == my_scic2.c);
+    test(my_scic.d == my_scic2.d);
+    if (!failed)
+      VERB0("Passed scic");
+  }
+  write_read("sclc", &my_sclc, &my_sclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_sclc.a == my_sclc2.a);
+    test(my_sclc.b == my_sclc2.b);
+    test(my_sclc.c == my_sclc2.c);
+    test(my_sclc.d == my_sclc2.d);
+    if (!failed)
+      VERB0("Passed sclc");
+  }
+  write_read("scLc", &my_scLc, &my_scLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_scLc.a == my_scLc2.a);
+    test(my_scLc.b == my_scLc2.b);
+    test(my_scLc.c == my_scLc2.c);
+    test(my_scLc.d == my_scLc2.d);
+    if (!failed)
+      VERB0("Passed scLc");
+  }
+  write_read("scfc", &my_scfc, &my_scfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_scfc.a == my_scfc2.a);
+    test(my_scfc.b == my_scfc2.b);
+    test(my_scfc.c == my_scfc2.c);
+    test(my_scfc.d == my_scfc2.d);
+    if (!failed)
+      VERB0("Passed scfc");
+  }
+  write_read("scdc", &my_scdc, &my_scdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_scdc.a == my_scdc2.a);
+    test(my_scdc.b == my_scdc2.b);
+    test(my_scdc.c == my_scdc2.c);
+    test(my_scdc.d == my_scdc2.d);
+    if (!failed)
+      VERB0("Passed scdc");
+  }
+  write_read("iccc", &my_iccc, &my_iccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_iccc.a == my_iccc2.a);
+    test(my_iccc.b == my_iccc2.b);
+    test(my_iccc.c == my_iccc2.c);
+    test(my_iccc.d == my_iccc2.d);
+    if (!failed)
+      VERB0("Passed iccc");
+  }
+  write_read("icsc", &my_icsc, &my_icsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_icsc.a == my_icsc2.a);
+    test(my_icsc.b == my_icsc2.b);
+    test(my_icsc.c == my_icsc2.c);
+    test(my_icsc.d == my_icsc2.d);
+    if (!failed)
+      VERB0("Passed icsc");
+  }
+  write_read("icic", &my_icic, &my_icic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_icic.a == my_icic2.a);
+    test(my_icic.b == my_icic2.b);
+    test(my_icic.c == my_icic2.c);
+    test(my_icic.d == my_icic2.d);
+    if (!failed)
+      VERB0("Passed icic");
+  }
+  write_read("iclc", &my_iclc, &my_iclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_iclc.a == my_iclc2.a);
+    test(my_iclc.b == my_iclc2.b);
+    test(my_iclc.c == my_iclc2.c);
+    test(my_iclc.d == my_iclc2.d);
+    if (!failed)
+      VERB0("Passed iclc");
+  }
+  write_read("icLc", &my_icLc, &my_icLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_icLc.a == my_icLc2.a);
+    test(my_icLc.b == my_icLc2.b);
+    test(my_icLc.c == my_icLc2.c);
+    test(my_icLc.d == my_icLc2.d);
+    if (!failed)
+      VERB0("Passed icLc");
+  }
+  write_read("icfc", &my_icfc, &my_icfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_icfc.a == my_icfc2.a);
+    test(my_icfc.b == my_icfc2.b);
+    test(my_icfc.c == my_icfc2.c);
+    test(my_icfc.d == my_icfc2.d);
+    if (!failed)
+      VERB0("Passed icfc");
+  }
+  write_read("icdc", &my_icdc, &my_icdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_icdc.a == my_icdc2.a);
+    test(my_icdc.b == my_icdc2.b);
+    test(my_icdc.c == my_icdc2.c);
+    test(my_icdc.d == my_icdc2.d);
+    if (!failed)
+      VERB0("Passed icdc");
+  }
+  write_read("lccc", &my_lccc, &my_lccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lccc.a == my_lccc2.a);
+    test(my_lccc.b == my_lccc2.b);
+    test(my_lccc.c == my_lccc2.c);
+    test(my_lccc.d == my_lccc2.d);
+    if (!failed)
+      VERB0("Passed lccc");
+  }
+  write_read("lcsc", &my_lcsc, &my_lcsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lcsc.a == my_lcsc2.a);
+    test(my_lcsc.b == my_lcsc2.b);
+    test(my_lcsc.c == my_lcsc2.c);
+    test(my_lcsc.d == my_lcsc2.d);
+    if (!failed)
+      VERB0("Passed lcsc");
+  }
+  write_read("lcic", &my_lcic, &my_lcic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lcic.a == my_lcic2.a);
+    test(my_lcic.b == my_lcic2.b);
+    test(my_lcic.c == my_lcic2.c);
+    test(my_lcic.d == my_lcic2.d);
+    if (!failed)
+      VERB0("Passed lcic");
+  }
+  write_read("lclc", &my_lclc, &my_lclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lclc.a == my_lclc2.a);
+    test(my_lclc.b == my_lclc2.b);
+    test(my_lclc.c == my_lclc2.c);
+    test(my_lclc.d == my_lclc2.d);
+    if (!failed)
+      VERB0("Passed lclc");
+  }
+  write_read("lcLc", &my_lcLc, &my_lcLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lcLc.a == my_lcLc2.a);
+    test(my_lcLc.b == my_lcLc2.b);
+    test(my_lcLc.c == my_lcLc2.c);
+    test(my_lcLc.d == my_lcLc2.d);
+    if (!failed)
+      VERB0("Passed lcLc");
+  }
+  write_read("lcfc", &my_lcfc, &my_lcfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lcfc.a == my_lcfc2.a);
+    test(my_lcfc.b == my_lcfc2.b);
+    test(my_lcfc.c == my_lcfc2.c);
+    test(my_lcfc.d == my_lcfc2.d);
+    if (!failed)
+      VERB0("Passed lcfc");
+  }
+  write_read("lcdc", &my_lcdc, &my_lcdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_lcdc.a == my_lcdc2.a);
+    test(my_lcdc.b == my_lcdc2.b);
+    test(my_lcdc.c == my_lcdc2.c);
+    test(my_lcdc.d == my_lcdc2.d);
+    if (!failed)
+      VERB0("Passed lcdc");
+  }
+  write_read("Lccc", &my_Lccc, &my_Lccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_Lccc.a == my_Lccc2.a);
+    test(my_Lccc.b == my_Lccc2.b);
+    test(my_Lccc.c == my_Lccc2.c);
+    test(my_Lccc.d == my_Lccc2.d);
+    if (!failed)
+      VERB0("Passed Lccc");
+  }
+  write_read("Lcsc", &my_Lcsc, &my_Lcsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_Lcsc.a == my_Lcsc2.a);
+    test(my_Lcsc.b == my_Lcsc2.b);
+    test(my_Lcsc.c == my_Lcsc2.c);
+    test(my_Lcsc.d == my_Lcsc2.d);
+    if (!failed)
+      VERB0("Passed Lcsc");
+  }
+  write_read("Lcic", &my_Lcic, &my_Lcic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_Lcic.a == my_Lcic2.a);
+    test(my_Lcic.b == my_Lcic2.b);
+    test(my_Lcic.c == my_Lcic2.c);
+    test(my_Lcic.d == my_Lcic2.d);
+    if (!failed)
+      VERB0("Passed Lcic");
+  }
+  write_read("Lclc", &my_Lclc, &my_Lclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_Lclc.a == my_Lclc2.a);
+    test(my_Lclc.b == my_Lclc2.b);
+    test(my_Lclc.c == my_Lclc2.c);
+    test(my_Lclc.d == my_Lclc2.d);
+    if (!failed)
+      VERB0("Passed Lclc");
+  }
+  write_read("LcLc", &my_LcLc, &my_LcLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_LcLc.a == my_LcLc2.a);
+    test(my_LcLc.b == my_LcLc2.b);
+    test(my_LcLc.c == my_LcLc2.c);
+    test(my_LcLc.d == my_LcLc2.d);
+    if (!failed)
+      VERB0("Passed LcLc");
+  }
+  write_read("Lcfc", &my_Lcfc, &my_Lcfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_Lcfc.a == my_Lcfc2.a);
+    test(my_Lcfc.b == my_Lcfc2.b);
+    test(my_Lcfc.c == my_Lcfc2.c);
+    test(my_Lcfc.d == my_Lcfc2.d);
+    if (!failed)
+      VERB0("Passed Lcfc");
+  }
+  write_read("Lcdc", &my_Lcdc, &my_Lcdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_Lcdc.a == my_Lcdc2.a);
+    test(my_Lcdc.b == my_Lcdc2.b);
+    test(my_Lcdc.c == my_Lcdc2.c);
+    test(my_Lcdc.d == my_Lcdc2.d);
+    if (!failed)
+      VERB0("Passed Lcdc");
+  }
+  write_read("fccc", &my_fccc, &my_fccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fccc.a == my_fccc2.a);
+    test(my_fccc.b == my_fccc2.b);
+    test(my_fccc.c == my_fccc2.c);
+    test(my_fccc.d == my_fccc2.d);
+    if (!failed)
+      VERB0("Passed fccc");
+  }
+  write_read("fcsc", &my_fcsc, &my_fcsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fcsc.a == my_fcsc2.a);
+    test(my_fcsc.b == my_fcsc2.b);
+    test(my_fcsc.c == my_fcsc2.c);
+    test(my_fcsc.d == my_fcsc2.d);
+    if (!failed)
+      VERB0("Passed fcsc");
+  }
+  write_read("fcic", &my_fcic, &my_fcic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fcic.a == my_fcic2.a);
+    test(my_fcic.b == my_fcic2.b);
+    test(my_fcic.c == my_fcic2.c);
+    test(my_fcic.d == my_fcic2.d);
+    if (!failed)
+      VERB0("Passed fcic");
+  }
+  write_read("fclc", &my_fclc, &my_fclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fclc.a == my_fclc2.a);
+    test(my_fclc.b == my_fclc2.b);
+    test(my_fclc.c == my_fclc2.c);
+    test(my_fclc.d == my_fclc2.d);
+    if (!failed)
+      VERB0("Passed fclc");
+  }
+  write_read("fcLc", &my_fcLc, &my_fcLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fcLc.a == my_fcLc2.a);
+    test(my_fcLc.b == my_fcLc2.b);
+    test(my_fcLc.c == my_fcLc2.c);
+    test(my_fcLc.d == my_fcLc2.d);
+    if (!failed)
+      VERB0("Passed fcLc");
+  }
+  write_read("fcfc", &my_fcfc, &my_fcfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fcfc.a == my_fcfc2.a);
+    test(my_fcfc.b == my_fcfc2.b);
+    test(my_fcfc.c == my_fcfc2.c);
+    test(my_fcfc.d == my_fcfc2.d);
+    if (!failed)
+      VERB0("Passed fcfc");
+  }
+  write_read("fcdc", &my_fcdc, &my_fcdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_fcdc.a == my_fcdc2.a);
+    test(my_fcdc.b == my_fcdc2.b);
+    test(my_fcdc.c == my_fcdc2.c);
+    test(my_fcdc.d == my_fcdc2.d);
+    if (!failed)
+      VERB0("Passed fcdc");
+  }
+  write_read("dccc", &my_dccc, &my_dccc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dccc.a == my_dccc2.a);
+    test(my_dccc.b == my_dccc2.b);
+    test(my_dccc.c == my_dccc2.c);
+    test(my_dccc.d == my_dccc2.d);
+    if (!failed)
+      VERB0("Passed dccc");
+  }
+  write_read("dcsc", &my_dcsc, &my_dcsc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dcsc.a == my_dcsc2.a);
+    test(my_dcsc.b == my_dcsc2.b);
+    test(my_dcsc.c == my_dcsc2.c);
+    test(my_dcsc.d == my_dcsc2.d);
+    if (!failed)
+      VERB0("Passed dcsc");
+  }
+  write_read("dcic", &my_dcic, &my_dcic2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dcic.a == my_dcic2.a);
+    test(my_dcic.b == my_dcic2.b);
+    test(my_dcic.c == my_dcic2.c);
+    test(my_dcic.d == my_dcic2.d);
+    if (!failed)
+      VERB0("Passed dcic");
+  }
+  write_read("dclc", &my_dclc, &my_dclc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dclc.a == my_dclc2.a);
+    test(my_dclc.b == my_dclc2.b);
+    test(my_dclc.c == my_dclc2.c);
+    test(my_dclc.d == my_dclc2.d);
+    if (!failed)
+      VERB0("Passed dclc");
+  }
+  write_read("dcLc", &my_dcLc, &my_dcLc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dcLc.a == my_dcLc2.a);
+    test(my_dcLc.b == my_dcLc2.b);
+    test(my_dcLc.c == my_dcLc2.c);
+    test(my_dcLc.d == my_dcLc2.d);
+    if (!failed)
+      VERB0("Passed dcLc");
+  }
+  write_read("dcfc", &my_dcfc, &my_dcfc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dcfc.a == my_dcfc2.a);
+    test(my_dcfc.b == my_dcfc2.b);
+    test(my_dcfc.c == my_dcfc2.c);
+    test(my_dcfc.d == my_dcfc2.d);
+    if (!failed)
+      VERB0("Passed dcfc");
+  }
+  write_read("dcdc", &my_dcdc, &my_dcdc2, sock, direction);
+  if (direction == READ || direction == RW) {
+    int failed = 0;
+    test(my_dcdc.a == my_dcdc2.a);
+    test(my_dcdc.b == my_dcdc2.b);
+    test(my_dcdc.c == my_dcdc2.c);
+    test(my_dcdc.d == my_dcdc2.d);
+    if (!failed)
+      VERB0("Passed dcdc");
   }
 }
index eab24a2..423596f 100644 (file)
@@ -15,7 +15,7 @@
 #include "gras.h"
 
 #include "gras/DataDesc/datadesc_interface.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this test");
 
 #define READ  0
 #define WRITE 1
@@ -24,26 +24,27 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 const char *filename = "datadesc_usage.out";
 
 void
-write_read(const char* msgtype,void *src, void *dst,
-               gras_socket_t sock, int direction);
+write_read(const char *msgtype, void *src, void *dst,
+           gras_socket_t sock, int direction);
 
 void
-write_read(const char* msgtype,void *src, void *dst,
-               gras_socket_t sock, int direction) {
-
-       switch (direction) {
-       case READ:
-               gras_msg_wait(15, msgtype, NULL, dst);
-               break;
-
-       case WRITE:
-               gras_msg_send(sock, msgtype, src);
-               break;
-
-       case COPY:
-               gras_datadesc_memcpy(gras_datadesc_by_name(msgtype), src, dst);
-               break;
-       }
+write_read(const char *msgtype, void *src, void *dst,
+           gras_socket_t sock, int direction)
+{
+
+  switch (direction) {
+  case READ:
+    gras_msg_wait(15, msgtype, NULL, dst);
+    break;
+
+  case WRITE:
+    gras_msg_send(sock, msgtype, src);
+    break;
+
+  case COPY:
+    gras_datadesc_memcpy(gras_datadesc_by_name(msgtype), src, dst);
+    break;
+  }
 }
 
 
@@ -55,127 +56,139 @@ void test_structures(gras_socket_t sock, int direction);
  * Each and every tests *
  ************************/
 
-static void test_int(gras_socket_t sock, int direction) {
-       int i=5,j;
+static void test_int(gras_socket_t sock, int direction)
+{
+  int i = 5, j;
 
-       INFO0("---- Test on integer ----");
-       write_read("int", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY)
-               xbt_assert(i == j);
+  INFO0("---- Test on integer ----");
+  write_read("int", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY)
+    xbt_assert(i == j);
 }
-static void test_float(gras_socket_t sock, int direction) {
-       float i=5.0,j;
 
-       INFO0("---- Test on float ----");
-       write_read("float", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY)
-               xbt_assert2(i == j,"%f != %f",i,j);
+static void test_float(gras_socket_t sock, int direction)
+{
+  float i = 5.0, j;
+
+  INFO0("---- Test on float ----");
+  write_read("float", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY)
+    xbt_assert2(i == j, "%f != %f", i, j);
 }
-static void test_double(gras_socket_t sock, int direction) {
-       double i=-3252355.1234,j;
 
-       INFO0("---- Test on double ----");
-       write_read("double", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY)
-               xbt_assert2(i == j,"%f != %f",i,j);
+static void test_double(gras_socket_t sock, int direction)
+{
+  double i = -3252355.1234, j;
+
+  INFO0("---- Test on double ----");
+  write_read("double", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY)
+    xbt_assert2(i == j, "%f != %f", i, j);
 }
 
 #define FIXED_ARRAY_SIZE 5
 typedef int array[FIXED_ARRAY_SIZE];
-static void test_array(gras_socket_t sock, int direction) {
-       array i = { 35212,-6226,74337,11414,7733};
-       array j;
-       int cpt;
-
-       INFO0("---- Test on fixed array ----");
-
-       write_read("fixed int array", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               for (cpt=0; cpt<FIXED_ARRAY_SIZE; cpt++) {
-                       DEBUG1("Test spot %d",cpt);
-                       xbt_assert4(i[cpt] == j[cpt],"i[%d]=%d  !=  j[%d]=%d",
-                                       cpt,i[cpt],cpt,j[cpt]);
-               }
-       }
+static void test_array(gras_socket_t sock, int direction)
+{
+  array i = { 35212, -6226, 74337, 11414, 7733 };
+  array j;
+  int cpt;
+
+  INFO0("---- Test on fixed array ----");
+
+  write_read("fixed int array", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    for (cpt = 0; cpt < FIXED_ARRAY_SIZE; cpt++) {
+      DEBUG1("Test spot %d", cpt);
+      xbt_assert4(i[cpt] == j[cpt], "i[%d]=%d  !=  j[%d]=%d",
+                  cpt, i[cpt], cpt, j[cpt]);
+    }
+  }
 }
+
 /*** Dynar of scalar ***/
 
-static void test_dynar_scal(gras_socket_t sock, int direction){
-       xbt_dynar_t i,j;
-       int cpt;
-
-       INFO0("---- Test on dynar containing integers ----");
-       i = xbt_dynar_new(sizeof(int),NULL);
-       for (cpt=0; cpt<64; cpt++) {
-               xbt_dynar_push_as(i,int,cpt);
-               DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(i));
-       }
-       /*  xbt_dynar_dump(i);*/
-       write_read("xbt_dynar_of_int", &i,&j, sock, direction);
-       /*  xbt_dynar_dump(j);*/
-       if (direction == READ || direction == COPY) {
-               for (cpt=0; cpt<64; cpt++){
-                       int ret=xbt_dynar_get_as(j,cpt,int);
-                       if (cpt != ret) {
-                               CRITICAL3("The retrieved value for cpt=%d is not the same than the injected one (%d!=%d)",
-                                               cpt,ret,cpt);
-                               xbt_abort();
-                       }
-               }
-               xbt_dynar_free(&j);
-       }
-       xbt_dynar_free(&i);
+static void test_dynar_scal(gras_socket_t sock, int direction)
+{
+  xbt_dynar_t i, j;
+  int cpt;
+
+  INFO0("---- Test on dynar containing integers ----");
+  i = xbt_dynar_new(sizeof(int), NULL);
+  for (cpt = 0; cpt < 64; cpt++) {
+    xbt_dynar_push_as(i, int, cpt);
+    DEBUG2("Push %d, length=%lu", cpt, xbt_dynar_length(i));
+  }
+  /*  xbt_dynar_dump(i); */
+  write_read("xbt_dynar_of_int", &i, &j, sock, direction);
+  /*  xbt_dynar_dump(j); */
+  if (direction == READ || direction == COPY) {
+    for (cpt = 0; cpt < 64; cpt++) {
+      int ret = xbt_dynar_get_as(j, cpt, int);
+      if (cpt != ret) {
+        CRITICAL3
+          ("The retrieved value for cpt=%d is not the same than the injected one (%d!=%d)",
+           cpt, ret, cpt);
+        xbt_abort();
+      }
+    }
+    xbt_dynar_free(&j);
+  }
+  xbt_dynar_free(&i);
 }
 
 /*** Empty dynar ***/
 
-static void test_dynar_empty(gras_socket_t sock, int direction){
-       xbt_dynar_t i,j;
-
-       INFO0("---- Test on empty dynar of integers ----");
-       i = xbt_dynar_new(sizeof(int),NULL);
-       write_read("xbt_dynar_of_int", &i,&j, sock, direction);
-       /*  xbt_dynar_dump(j);*/
-       if (direction == READ || direction == COPY) {
-               xbt_assert(xbt_dynar_length(j) == 0);
-               xbt_dynar_free(&j);
-       }
-       xbt_dynar_free(&i);
+static void test_dynar_empty(gras_socket_t sock, int direction)
+{
+  xbt_dynar_t i, j;
+
+  INFO0("---- Test on empty dynar of integers ----");
+  i = xbt_dynar_new(sizeof(int), NULL);
+  write_read("xbt_dynar_of_int", &i, &j, sock, direction);
+  /*  xbt_dynar_dump(j); */
+  if (direction == READ || direction == COPY) {
+    xbt_assert(xbt_dynar_length(j) == 0);
+    xbt_dynar_free(&j);
+  }
+  xbt_dynar_free(&i);
 }
 
-static void test_intref(gras_socket_t sock, int direction) {
-       int *i,*j;
+static void test_intref(gras_socket_t sock, int direction)
+{
+  int *i, *j;
 
-       i=xbt_new(int,1);
-       *i=12345;
+  i = xbt_new(int, 1);
+  *i = 12345;
 
-       INFO0("---- Test on a reference to an integer ----");
+  INFO0("---- Test on a reference to an integer ----");
 
-       write_read("int*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert2(*i == *j,"*i != *j (%d != %d)",*i,*j);
-               free(j);
-       }
-       free(i);
+  write_read("int*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert2(*i == *j, "*i != *j (%d != %d)", *i, *j);
+    free(j);
+  }
+  free(i);
 }
 
 /***
  *** string (dynamic array)
  ***/
-static void test_string(gras_socket_t sock, int direction) {
-       char *i=xbt_strdup("Some data"), *j=NULL;
-       int cpt;
-
-       INFO0("---- Test on string (ref to dynamic array) ----");
-       write_read("string", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               for (cpt=0; cpt<strlen(i); cpt++) {
-                       xbt_assert4(i[cpt] == j[cpt],"i[%d]=%c  !=  j[%d]=%c",
-                                       cpt,i[cpt],cpt,j[cpt]);
-               }
-               free(j);
-       }
-       free(i);
+static void test_string(gras_socket_t sock, int direction)
+{
+  char *i = xbt_strdup("Some data"), *j = NULL;
+  int cpt;
+
+  INFO0("---- Test on string (ref to dynamic array) ----");
+  write_read("string", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    for (cpt = 0; cpt < strlen(i); cpt++) {
+      xbt_assert4(i[cpt] == j[cpt], "i[%d]=%c  !=  j[%d]=%c",
+                  cpt, i[cpt], cpt, j[cpt]);
+    }
+    free(j);
+  }
+  free(i);
 }
 
 
@@ -183,115 +196,129 @@ static void test_string(gras_socket_t sock, int direction) {
  *** homogeneous struct
  ***/
 typedef struct {
-       int a,b,c,d;
+  int a, b, c, d;
 } homostruct;
-static void test_homostruct(gras_socket_t sock, int direction) {
-       homostruct *i, *j;
-
-       INFO0("---- Test on homogeneous structure ----");
-       /* init a value, exchange it and check its validity*/
-       i=xbt_new(homostruct,1);
-       i->a = 2235;    i->b = 433425;
-       i->c = -23423;  i->d = -235235;
-
-       write_read("homostruct*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert2(i->a == j->a,"i->a=%d != j->a=%d",i->a,j->a);
-               xbt_assert(i->b == j->b);
-               xbt_assert(i->c == j->c);
-               xbt_assert(i->d == j->d);
-               free(j);
-       }
-       free(i);
+static void test_homostruct(gras_socket_t sock, int direction)
+{
+  homostruct *i, *j;
+
+  INFO0("---- Test on homogeneous structure ----");
+  /* init a value, exchange it and check its validity */
+  i = xbt_new(homostruct, 1);
+  i->a = 2235;
+  i->b = 433425;
+  i->c = -23423;
+  i->d = -235235;
+
+  write_read("homostruct*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert2(i->a == j->a, "i->a=%d != j->a=%d", i->a, j->a);
+    xbt_assert(i->b == j->b);
+    xbt_assert(i->c == j->c);
+    xbt_assert(i->d == j->d);
+    free(j);
+  }
+  free(i);
 }
 
 /***
  *** heterogeneous struct
  ***/
 typedef struct {
-       unsigned char c1;
-       unsigned long int l1;
-       unsigned char c2;
-       unsigned long int l2;
+  unsigned char c1;
+  unsigned long int l1;
+  unsigned char c2;
+  unsigned long int l2;
 } hetestruct;
-static void test_hetestruct(gras_socket_t sock, int direction) {
-       hetestruct *i, *j;
-
-       INFO0("---- Test on heterogeneous structure ----");
-       /* init a value, exchange it and check its validity*/
-       i=xbt_new(hetestruct,1);
-       i->c1 = 's'; i->l1 = 123455;
-       i->c2 = 'e'; i->l2 = 774531;
-
-       write_read("hetestruct*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert(i->c1 == j->c1);
-               xbt_assert(i->c2 == j->c2);
-               xbt_assert2(i->l1 == j->l1,"i->l1(=%ld)  !=  j->l1(=%ld)",i->l1,j->l1);
-               xbt_assert(i->l2 == j->l2);
-               free(j);
-       }
-       free(i);
+static void test_hetestruct(gras_socket_t sock, int direction)
+{
+  hetestruct *i, *j;
+
+  INFO0("---- Test on heterogeneous structure ----");
+  /* init a value, exchange it and check its validity */
+  i = xbt_new(hetestruct, 1);
+  i->c1 = 's';
+  i->l1 = 123455;
+  i->c2 = 'e';
+  i->l2 = 774531;
+
+  write_read("hetestruct*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert(i->c1 == j->c1);
+    xbt_assert(i->c2 == j->c2);
+    xbt_assert2(i->l1 == j->l1, "i->l1(=%ld)  !=  j->l1(=%ld)", i->l1, j->l1);
+    xbt_assert(i->l2 == j->l2);
+    free(j);
+  }
+  free(i);
 }
 
-static void test_hetestruct_array(gras_socket_t sock, int direction) {
-       hetestruct *i, *j, *p,*q;
-       int cpt;
-
-       INFO0("---- Test on heterogeneous structure arrays ----");
-       /* init a value, exchange it and check its validity*/
-       i=xbt_malloc(sizeof(hetestruct)*10);
-       for (cpt=0,p=i;cpt<10;cpt++,p++) {
-               p->c1 = 's'+cpt; p->l1 = 123455+cpt;
-               p->c2 = 'e'+cpt; p->l2 = 774531+cpt;
-       }
-
-       write_read("hetestruct[10]*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               for (cpt=0,p=i,q=j;
-                        cpt<10;
-                        cpt++,p++,q++) {
-                       xbt_assert(p->c1 == q->c1);
-                       xbt_assert(p->c2 == q->c2);
-                       xbt_assert3(p->l1 == p->l1,
-                                       "for cpt=%d i->l1(=%ld)  !=  j->l1(=%ld)",cpt,p->l1,q->l1);
-                       xbt_assert(q->l2 == p->l2);
-               }
-               free(j);
-       }
-       free(i);
+static void test_hetestruct_array(gras_socket_t sock, int direction)
+{
+  hetestruct *i, *j, *p, *q;
+  int cpt;
+
+  INFO0("---- Test on heterogeneous structure arrays ----");
+  /* init a value, exchange it and check its validity */
+  i = xbt_malloc(sizeof(hetestruct) * 10);
+  for (cpt = 0, p = i; cpt < 10; cpt++, p++) {
+    p->c1 = 's' + cpt;
+    p->l1 = 123455 + cpt;
+    p->c2 = 'e' + cpt;
+    p->l2 = 774531 + cpt;
+  }
+
+  write_read("hetestruct[10]*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    for (cpt = 0, p = i, q = j; cpt < 10; cpt++, p++, q++) {
+      xbt_assert(p->c1 == q->c1);
+      xbt_assert(p->c2 == q->c2);
+      xbt_assert3(p->l1 == p->l1,
+                  "for cpt=%d i->l1(=%ld)  !=  j->l1(=%ld)", cpt, p->l1,
+                  q->l1);
+      xbt_assert(q->l2 == p->l2);
+    }
+    free(j);
+  }
+  free(i);
 }
+
 /***
  *** nested struct
  ***/
 typedef struct {
-       hetestruct hete;
-       homostruct homo;
+  hetestruct hete;
+  homostruct homo;
 } nestedstruct;
-static void test_nestedstruct(gras_socket_t sock, int direction) {
-       nestedstruct *i, *j;
-
-       INFO0("---- Test on nested structures ----");
-       /* init a value, exchange it and check its validity*/
-       i=xbt_new(nestedstruct,1);
-       i->homo.a = 235231;  i->homo.b = -124151;
-       i->homo.c = 211551;  i->homo.d = -664222;
-       i->hete.c1 = 's'; i->hete.l1 = 123455;
-       i->hete.c2 = 'e'; i->hete.l2 = 774531;
-
-       write_read("nestedstruct*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert(i->homo.a == j->homo.a);
-               xbt_assert(i->homo.b == j->homo.b);
-               xbt_assert(i->homo.c == j->homo.c);
-               xbt_assert(i->homo.d == j->homo.d);
-               xbt_assert(i->hete.c1 == j->hete.c1);
-               xbt_assert(i->hete.c2 == j->hete.c2);
-               xbt_assert(i->hete.l1 == j->hete.l1);
-               xbt_assert(i->hete.l2 == j->hete.l2);
-               free(j);
-       }
-       free(i);
+static void test_nestedstruct(gras_socket_t sock, int direction)
+{
+  nestedstruct *i, *j;
+
+  INFO0("---- Test on nested structures ----");
+  /* init a value, exchange it and check its validity */
+  i = xbt_new(nestedstruct, 1);
+  i->homo.a = 235231;
+  i->homo.b = -124151;
+  i->homo.c = 211551;
+  i->homo.d = -664222;
+  i->hete.c1 = 's';
+  i->hete.l1 = 123455;
+  i->hete.c2 = 'e';
+  i->hete.l2 = 774531;
+
+  write_read("nestedstruct*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert(i->homo.a == j->homo.a);
+    xbt_assert(i->homo.b == j->homo.b);
+    xbt_assert(i->homo.c == j->homo.c);
+    xbt_assert(i->homo.d == j->homo.d);
+    xbt_assert(i->hete.c1 == j->hete.c1);
+    xbt_assert(i->hete.c2 == j->hete.c2);
+    xbt_assert(i->hete.l1 == j->hete.l1);
+    xbt_assert(i->hete.l2 == j->hete.l2);
+    free(j);
+  }
+  free(i);
 }
 
 /***
@@ -299,344 +326,374 @@ static void test_nestedstruct(gras_socket_t sock, int direction) {
  ***/
 typedef struct s_chained_list chained_list_t;
 struct s_chained_list {
-       int          v;
-       chained_list_t *l;
+  int v;
+  chained_list_t *l;
 };
-chained_list_t *cons(int v, chained_list_t *l);
-void list_free(chained_list_t *l);
-int list_eq(chained_list_t*i,chained_list_t*j);
+chained_list_t *cons(int v, chained_list_t * l);
+void list_free(chained_list_t * l);
+int list_eq(chained_list_t * i, chained_list_t * j);
 
-chained_list_t * cons(int v, chained_list_t *l) {
-       chained_list_t *nl = xbt_new(chained_list_t,1);
+chained_list_t *cons(int v, chained_list_t * l)
+{
+  chained_list_t *nl = xbt_new(chained_list_t, 1);
 
-       nl->v = v;
-       nl->l = l;
+  nl->v = v;
+  nl->l = l;
 
-       return nl;
+  return nl;
 }
-void list_free(chained_list_t*l) {
-       if (l) {
-               list_free(l->l);
-               free(l);
-       }
+
+void list_free(chained_list_t * l)
+{
+  if (l) {
+    list_free(l->l);
+    free(l);
+  }
 }
-int list_eq(chained_list_t*i,chained_list_t*j) {
-       if (!i || !j) return i == j;
-       if (i->v != j->v)
-               return 0;
-       return list_eq(i->l, j->l);
+
+int list_eq(chained_list_t * i, chained_list_t * j)
+{
+  if (!i || !j)
+    return i == j;
+  if (i->v != j->v)
+    return 0;
+  return list_eq(i->l, j->l);
 }
-static void test_chain_list(gras_socket_t sock, int direction) {
-       chained_list_t *i, *j;
 
-       INFO0("---- Test on chained list ----");
+static void test_chain_list(gras_socket_t sock, int direction)
+{
+  chained_list_t *i, *j;
 
-       /* init a value, exchange it and check its validity*/
-       i = cons( 12355, cons( 246264 , cons( 23263, NULL)));
-       j = NULL;
+  INFO0("---- Test on chained list ----");
 
-       write_read("chained_list_t*", &i,&j,  sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert(list_eq(i,j));
-               list_free(j);
-       }
+  /* init a value, exchange it and check its validity */
+  i = cons(12355, cons(246264, cons(23263, NULL)));
+  j = NULL;
 
-       list_free(i);
+  write_read("chained_list_t*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert(list_eq(i, j));
+    list_free(j);
+  }
+
+  list_free(i);
 }
+
 /***
  *** graph
  ***/
-static void test_graph(gras_socket_t sock, int direction) {
-       chained_list_t *i, *j;
-
-       INFO0("---- Test on graph (cyclique chained list of 3 items) ----");
-       /* init a value, exchange it and check its validity*/
-       i = cons( 1151515, cons( -232362 , cons( 222552, NULL)));
-       i->l->l->l = i;
-       j = NULL;
-
-       write_read("chained_list_t*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-
-               DEBUG1("i=%p"         ,i);
-               DEBUG1("i->l=%p"      ,i->l);
-               DEBUG1("i->l->l=%p"   ,i->l->l);
-               DEBUG1("i->l->l->l=%p",i->l->l->l);
-               DEBUG1("j=%p"         ,j);
-               DEBUG1("j->l=%p"      ,j->l);
-               DEBUG1("j->l->l=%p"   ,j->l->l);
-               DEBUG1("j->l->l->l=%p",j->l->l->l);
-               xbt_assert4(j->l->l->l == j,
-                               "Received list is not cyclic. j=%p != j->l->l->l=%p\n"
-                               "j=%p; &j=%p",
-                               j,j->l->l->l,
-                               j ,&j);
-               j->l->l->l = NULL;
-               i->l->l->l = NULL;
-               xbt_assert(list_eq(i,j));
-
-               list_free(j);
-       }
-       i->l->l->l = NULL; /* do this even in WRITE mode */
-       list_free(i);
+static void test_graph(gras_socket_t sock, int direction)
+{
+  chained_list_t *i, *j;
+
+  INFO0("---- Test on graph (cyclique chained list of 3 items) ----");
+  /* init a value, exchange it and check its validity */
+  i = cons(1151515, cons(-232362, cons(222552, NULL)));
+  i->l->l->l = i;
+  j = NULL;
+
+  write_read("chained_list_t*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+
+    DEBUG1("i=%p", i);
+    DEBUG1("i->l=%p", i->l);
+    DEBUG1("i->l->l=%p", i->l->l);
+    DEBUG1("i->l->l->l=%p", i->l->l->l);
+    DEBUG1("j=%p", j);
+    DEBUG1("j->l=%p", j->l);
+    DEBUG1("j->l->l=%p", j->l->l);
+    DEBUG1("j->l->l->l=%p", j->l->l->l);
+    xbt_assert4(j->l->l->l == j,
+                "Received list is not cyclic. j=%p != j->l->l->l=%p\n"
+                "j=%p; &j=%p", j, j->l->l->l, j, &j);
+    j->l->l->l = NULL;
+    i->l->l->l = NULL;
+    xbt_assert(list_eq(i, j));
+
+    list_free(j);
+  }
+  i->l->l->l = NULL;            /* do this even in WRITE mode */
+  list_free(i);
 }
 
 
 /*** Dynar of references ***/
-static void free_string(void *d){ /* used to free the data in dynar */
-       free(*(void**)d);
+static void free_string(void *d)
+{                               /* used to free the data in dynar */
+  free(*(void **) d);
 }
-static void test_dynar_ref(gras_socket_t sock, int direction){
-       xbt_dynar_t i,j;
-       char buf[1024];
-       char *s1,*s2;
-       int cpt;
-
-       INFO0("---- Test on dynar containing integers ----");
-
-       i=xbt_dynar_new(sizeof(char*),&free_string);
-       for (cpt=0; cpt< 64; cpt++) {
-               sprintf(buf,"%d",cpt);
-               s1=strdup(buf);
-               xbt_dynar_push(i,&s1);
-       }
-
-       write_read("xbt_dynar_of_string", &i,&j, sock, direction);
-       if (direction == READ || direction == COPY) {
-               for (cpt=0; cpt< 64; cpt++) {
-                       sprintf(buf,"%d",cpt);
-                       xbt_dynar_shift(j,&s2);
-                       xbt_assert2 (!strcmp(buf,s2),
-                                       "The retrieved value is not the same than the injected one (%s!=%s)",
-                                       buf,s2);
-                       free(s2);
-               }
-               xbt_dynar_free(&j);
-       }
-       xbt_dynar_free(&i);
+
+static void test_dynar_ref(gras_socket_t sock, int direction)
+{
+  xbt_dynar_t i, j;
+  char buf[1024];
+  char *s1, *s2;
+  int cpt;
+
+  INFO0("---- Test on dynar containing integers ----");
+
+  i = xbt_dynar_new(sizeof(char *), &free_string);
+  for (cpt = 0; cpt < 64; cpt++) {
+    sprintf(buf, "%d", cpt);
+    s1 = strdup(buf);
+    xbt_dynar_push(i, &s1);
+  }
+
+  write_read("xbt_dynar_of_string", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    for (cpt = 0; cpt < 64; cpt++) {
+      sprintf(buf, "%d", cpt);
+      xbt_dynar_shift(j, &s2);
+      xbt_assert2(!strcmp(buf, s2),
+                  "The retrieved value is not the same than the injected one (%s!=%s)",
+                  buf, s2);
+      free(s2);
+    }
+    xbt_dynar_free(&j);
+  }
+  xbt_dynar_free(&i);
 }
 
 
 /**** PBIO *****/
-GRAS_DEFINE_TYPE(s_pbio,
-               struct s_pbio{ /* structure presented in the IEEE article */
-       int Cnstatv;
-       double Cstatev[12];
-       int Cnprops;
-       double Cprops[110];
-       int Cndi[4];
-       int Cnshr;
-       int Cnpt;
-       double Cdtime;
-       double Ctime[2];
-       int Cntens;
-       double Cdfgrd0[373][3];
-       double Cdfgrd1[3][3];
-       double Cstress[106];
-       double Cddsdde[106][106];
-};
-)
-typedef struct s_pbio pbio_t;
-
-static void test_pbio(gras_socket_t sock, int direction) {
-       int cpt;
-       int cpt2;
-       gras_datadesc_type_t pbio_type;
-       pbio_t i, j;
-
-       INFO0("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
-       pbio_type = gras_datadesc_by_symbol(s_pbio);
-
-       /* Fill in that damn struct */
-       i.Cnstatv = 325115;
-       for (cpt=0; cpt<12; cpt++)
-               i.Cstatev[cpt] = ((double) cpt) * -2361.11;
-       i.Cnprops = -37373;
-       for (cpt=0; cpt<110; cpt++)
-               i.Cprops[cpt] = cpt * 100.0;
-       for (cpt=0; cpt<4; cpt++)
-               i.Cndi[cpt] = cpt * 23262;
-       i.Cnshr = -4634;
-       i.Cnpt = 114142;
-       i.Cdtime = -11515.662;
-       i.Ctime[0] = 332523.226;
-       i.Ctime[1] = -26216.113;
-       i.Cntens = 235211411;
-
-       for (cpt=0; cpt<3; cpt++) {
-               for (cpt2=0; cpt2<373; cpt2++)
-                       i.Cdfgrd0[cpt2][cpt] = ((double)cpt) * ((double)cpt2);
-               for (cpt2=0; cpt2<3; cpt2++)
-                       i.Cdfgrd1[cpt][cpt2] = -((double)cpt) * ((double)cpt2);
-       }
-       for (cpt=0; cpt<106; cpt++) {
-               i.Cstress[cpt]=(double)cpt * 22.113;
-               for (cpt2=0; cpt2<106; cpt2++)
-                       i.Cddsdde[cpt][cpt2] = ((double)cpt) * ((double)cpt2);
-       }
-       write_read("s_pbio", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               /* Check that the data match */
-               xbt_assert(i.Cnstatv == j.Cnstatv);
-               for (cpt=0; cpt<12; cpt++)
-                       xbt_assert4(i.Cstatev[cpt] == j.Cstatev[cpt],
-                                       "i.Cstatev[%d] (=%f) != j.Cstatev[%d] (=%f)",
-                                       cpt,i.Cstatev[cpt],cpt,j.Cstatev[cpt]);
-               xbt_assert(i.Cnprops == j.Cnprops);
-               for (cpt=0; cpt<110; cpt++)
-                       xbt_assert(i.Cprops[cpt] == j.Cprops[cpt]);
-               for (cpt=0; cpt<4; cpt++)
-                       xbt_assert(i.Cndi[cpt] == j.Cndi[cpt]);
-               xbt_assert(i.Cnshr == j.Cnshr);
-               xbt_assert(i.Cnpt == j.Cnpt);
-               xbt_assert(i.Cdtime == j.Cdtime);
-               xbt_assert(i.Ctime[0] == j.Ctime[0]);
-               xbt_assert(i.Ctime[1] == j.Ctime[1]);
-               xbt_assert(i.Cntens == j.Cntens);
-               for (cpt=0; cpt<3; cpt++) {
-                       for (cpt2=0; cpt2<373; cpt2++)
-                               xbt_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
-                       for (cpt2=0; cpt2<3; cpt2++)
-                               xbt_assert(i.Cdfgrd1[cpt][cpt2] == j.Cdfgrd1[cpt][cpt2]);
-               }
-               for (cpt=0; cpt<106; cpt++) {
-                       xbt_assert(i.Cstress[cpt] == j.Cstress[cpt]);
-                       for (cpt2=0; cpt2<106; cpt2++)
-                               xbt_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
-                                               "%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
-                                               i.Cddsdde[cpt][cpt2],cpt,cpt2,j.Cddsdde[cpt][cpt2]);
-               }
-       }
+GRAS_DEFINE_TYPE(s_pbio, struct s_pbio {        /* structure presented in the IEEE article */
+                 int Cnstatv;
+                 double Cstatev[12];
+                 int Cnprops;
+                 double Cprops[110];
+                 int Cndi[4];
+                 int Cnshr;
+                 int Cnpt;
+                 double Cdtime;
+                 double Ctime[2];
+                 int Cntens;
+                 double Cdfgrd0[373][3];
+                 double Cdfgrd1[3][3]; double Cstress[106];
+                 double Cddsdde[106][106];
+                 };
+
+  )
+     typedef struct s_pbio pbio_t;
+
+     static void test_pbio(gras_socket_t sock, int direction)
+{
+  int cpt;
+  int cpt2;
+  gras_datadesc_type_t pbio_type;
+  pbio_t i, j;
+
+  INFO0
+    ("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
+  pbio_type = gras_datadesc_by_symbol(s_pbio);
+
+  /* Fill in that damn struct */
+  i.Cnstatv = 325115;
+  for (cpt = 0; cpt < 12; cpt++)
+    i.Cstatev[cpt] = ((double) cpt) * -2361.11;
+  i.Cnprops = -37373;
+  for (cpt = 0; cpt < 110; cpt++)
+    i.Cprops[cpt] = cpt * 100.0;
+  for (cpt = 0; cpt < 4; cpt++)
+    i.Cndi[cpt] = cpt * 23262;
+  i.Cnshr = -4634;
+  i.Cnpt = 114142;
+  i.Cdtime = -11515.662;
+  i.Ctime[0] = 332523.226;
+  i.Ctime[1] = -26216.113;
+  i.Cntens = 235211411;
+
+  for (cpt = 0; cpt < 3; cpt++) {
+    for (cpt2 = 0; cpt2 < 373; cpt2++)
+      i.Cdfgrd0[cpt2][cpt] = ((double) cpt) * ((double) cpt2);
+    for (cpt2 = 0; cpt2 < 3; cpt2++)
+      i.Cdfgrd1[cpt][cpt2] = -((double) cpt) * ((double) cpt2);
+  }
+  for (cpt = 0; cpt < 106; cpt++) {
+    i.Cstress[cpt] = (double) cpt *22.113;
+    for (cpt2 = 0; cpt2 < 106; cpt2++)
+      i.Cddsdde[cpt][cpt2] = ((double) cpt) * ((double) cpt2);
+  }
+  write_read("s_pbio", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    /* Check that the data match */
+    xbt_assert(i.Cnstatv == j.Cnstatv);
+    for (cpt = 0; cpt < 12; cpt++)
+      xbt_assert4(i.Cstatev[cpt] == j.Cstatev[cpt],
+                  "i.Cstatev[%d] (=%f) != j.Cstatev[%d] (=%f)",
+                  cpt, i.Cstatev[cpt], cpt, j.Cstatev[cpt]);
+    xbt_assert(i.Cnprops == j.Cnprops);
+    for (cpt = 0; cpt < 110; cpt++)
+      xbt_assert(i.Cprops[cpt] == j.Cprops[cpt]);
+    for (cpt = 0; cpt < 4; cpt++)
+      xbt_assert(i.Cndi[cpt] == j.Cndi[cpt]);
+    xbt_assert(i.Cnshr == j.Cnshr);
+    xbt_assert(i.Cnpt == j.Cnpt);
+    xbt_assert(i.Cdtime == j.Cdtime);
+    xbt_assert(i.Ctime[0] == j.Ctime[0]);
+    xbt_assert(i.Ctime[1] == j.Ctime[1]);
+    xbt_assert(i.Cntens == j.Cntens);
+    for (cpt = 0; cpt < 3; cpt++) {
+      for (cpt2 = 0; cpt2 < 373; cpt2++)
+        xbt_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
+      for (cpt2 = 0; cpt2 < 3; cpt2++)
+        xbt_assert(i.Cdfgrd1[cpt][cpt2] == j.Cdfgrd1[cpt][cpt2]);
+    }
+    for (cpt = 0; cpt < 106; cpt++) {
+      xbt_assert(i.Cstress[cpt] == j.Cstress[cpt]);
+      for (cpt2 = 0; cpt2 < 106; cpt2++)
+        xbt_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
+                    "%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
+                    i.Cddsdde[cpt][cpt2], cpt, cpt2, j.Cddsdde[cpt][cpt2]);
+    }
+  }
 }
 
-GRAS_DEFINE_TYPE(s_clause,
-               struct s_clause {
-       int num_lits;
-       int *literals GRAS_ANNOTE(size,num_lits); /* Tells GRAS where to find the size */
-};)
-typedef struct s_clause Clause;
-
-static void test_clause(gras_socket_t sock, int direction) {
-       Clause *i,*j;
-       int cpt;
-
-       INFO0("---- Test on struct containing dynamic array and its size (cbps test) ----");
-
-       /* create and fill the struct */
-       i=xbt_new(Clause,1);
-
-       i->num_lits = 5432;
-       i->literals = xbt_new(int, i->num_lits);
-       for (cpt=0; cpt<i->num_lits; cpt++)
-               i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
-       DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
-       DEBUG1("created count=%d",i->num_lits);
-
-       write_read("Clause*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert(i->num_lits == j->num_lits);
-               for (cpt=0; cpt<i->num_lits; cpt++)
-                       xbt_assert(i->literals[cpt] == j->literals[cpt]);
-
-               free(j->literals);
-               free(j);
-       }
-       free(i->literals);
-       free(i);
+GRAS_DEFINE_TYPE(s_clause, struct s_clause {
+                 int num_lits;
+                 int *literals GRAS_ANNOTE(size, num_lits);     /* Tells GRAS where to find the size */
+                 };)
+
+     typedef struct s_clause Clause;
+
+     static void test_clause(gras_socket_t sock, int direction)
+{
+  Clause *i, *j;
+  int cpt;
+
+  INFO0
+    ("---- Test on struct containing dynamic array and its size (cbps test) ----");
+
+  /* create and fill the struct */
+  i = xbt_new(Clause, 1);
+
+  i->num_lits = 5432;
+  i->literals = xbt_new(int, i->num_lits);
+  for (cpt = 0; cpt < i->num_lits; cpt++)
+    i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
+  DEBUG3("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
+  DEBUG1("created count=%d", i->num_lits);
+
+  write_read("Clause*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert(i->num_lits == j->num_lits);
+    for (cpt = 0; cpt < i->num_lits; cpt++)
+      xbt_assert(i->literals[cpt] == j->literals[cpt]);
+
+    free(j->literals);
+    free(j);
+  }
+  free(i->literals);
+  free(i);
 }
 
-static void test_clause_empty(gras_socket_t sock, int direction) {
-       Clause *i,*j;
+static void test_clause_empty(gras_socket_t sock, int direction)
+{
+  Clause *i, *j;
 
-       INFO0("---- Test on struct containing dynamic array and its size when size=0 (cbps test) ----");
+  INFO0
+    ("---- Test on struct containing dynamic array and its size when size=0 (cbps test) ----");
 
-       /* create and fill the struct */
-       i=xbt_new(Clause,1);
+  /* create and fill the struct */
+  i = xbt_new(Clause, 1);
 
-       i->num_lits = 0;
-       i->literals = NULL;
-       DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
-       DEBUG1("created count=%d",i->num_lits);
+  i->num_lits = 0;
+  i->literals = NULL;
+  DEBUG3("created data=%p (within %p @%p)", &(i->num_lits), i, &i);
+  DEBUG1("created count=%d", i->num_lits);
 
-       write_read("Clause*", &i,&j, sock,direction);
-       if (direction == READ || direction == COPY) {
-               xbt_assert(i->num_lits == j->num_lits);
+  write_read("Clause*", &i, &j, sock, direction);
+  if (direction == READ || direction == COPY) {
+    xbt_assert(i->num_lits == j->num_lits);
 
-               free(j->literals);
-               free(j);
-       }
-       free(i->literals);
-       free(i);
+    free(j->literals);
+    free(j);
+  }
+  free(i->literals);
+  free(i);
 }
 
-static void register_types(void) {
-       gras_datadesc_type_t my_type,ref_my_type;
-
-       gras_msgtype_declare("char",gras_datadesc_by_name("char"));
-       gras_msgtype_declare("int",gras_datadesc_by_name("int"));
-       gras_msgtype_declare("float",gras_datadesc_by_name("float"));
-       gras_msgtype_declare("double",gras_datadesc_by_name("double"));
-
-       my_type=gras_datadesc_array_fixed("fixed int array",
-                       gras_datadesc_by_name("int"),
-                       FIXED_ARRAY_SIZE);
-       gras_msgtype_declare("fixed int array",my_type);
-
-       my_type = gras_datadesc_dynar(gras_datadesc_by_name("int"),NULL);
-       gras_msgtype_declare("xbt_dynar_of_int",my_type);
-
-       my_type = gras_datadesc_ref("int*",gras_datadesc_by_name("int"));
-       gras_msgtype_declare("int*",my_type);
-
-       gras_msgtype_declare("string",gras_datadesc_by_name("string"));
-
-       my_type=gras_datadesc_struct("homostruct");
-       gras_datadesc_struct_append(my_type,"a",gras_datadesc_by_name("signed int"));
-       gras_datadesc_struct_append(my_type,"b",gras_datadesc_by_name("int"));
-       gras_datadesc_struct_append(my_type,"c",gras_datadesc_by_name("int"));
-       gras_datadesc_struct_append(my_type,"d",gras_datadesc_by_name("int"));
-       gras_datadesc_struct_close(my_type);
-       my_type=gras_datadesc_ref("homostruct*",gras_datadesc_by_name("homostruct"));
-       gras_msgtype_declare("homostruct*",my_type);
-
-       my_type=gras_datadesc_struct("hetestruct");
-       gras_datadesc_struct_append(my_type,"c1", gras_datadesc_by_name("unsigned char"));
-       gras_datadesc_struct_append(my_type,"l1", gras_datadesc_by_name("unsigned long int"));
-       gras_datadesc_struct_append(my_type,"c2", gras_datadesc_by_name("unsigned char"));
-       gras_datadesc_struct_append(my_type,"l2", gras_datadesc_by_name("unsigned long int"));
-       gras_datadesc_struct_close(my_type);
-       my_type=gras_datadesc_ref("hetestruct*", gras_datadesc_by_name("hetestruct"));
-       gras_msgtype_declare("hetestruct*",my_type);
-
-       my_type = gras_datadesc_array_fixed("hetestruct[10]",gras_datadesc_by_name("hetestruct"),10);
-       my_type = gras_datadesc_ref("hetestruct[10]*", my_type);
-       gras_msgtype_declare("hetestruct[10]*",my_type);
-
-       my_type=gras_datadesc_struct("nestedstruct");
-       gras_datadesc_struct_append(my_type,"hete",gras_datadesc_by_name("hetestruct"));
-       gras_datadesc_struct_append(my_type,"homo",gras_datadesc_by_name("homostruct"));
-       gras_datadesc_struct_close(my_type);
-       my_type=gras_datadesc_ref("nestedstruct*", gras_datadesc_by_name("nestedstruct"));
-       gras_msgtype_declare("nestedstruct*",my_type);
-
-       my_type=gras_datadesc_struct("chained_list_t");
-       ref_my_type=gras_datadesc_ref("chained_list_t*",my_type);
-       gras_datadesc_struct_append(my_type,"v", gras_datadesc_by_name("int"));
-       gras_datadesc_struct_append(my_type,"l", ref_my_type);
-       gras_datadesc_struct_close(my_type);
-       gras_datadesc_cycle_set(gras_datadesc_by_name("chained_list_t*"));
-       gras_msgtype_declare("chained_list_t",my_type);
-       gras_msgtype_declare("chained_list_t*",ref_my_type);
-
-       my_type = gras_datadesc_dynar(gras_datadesc_by_name("string"),&free_string);
-       gras_msgtype_declare("xbt_dynar_of_string",my_type);
-
-       my_type = gras_datadesc_by_symbol(s_pbio);
-       gras_msgtype_declare("s_pbio",my_type);
-
-       my_type = gras_datadesc_by_symbol(s_clause);
-       my_type = gras_datadesc_ref("Clause*",my_type);
-       gras_msgtype_declare("Clause*",my_type);
+static void register_types(void)
+{
+  gras_datadesc_type_t my_type, ref_my_type;
+
+  gras_msgtype_declare("char", gras_datadesc_by_name("char"));
+  gras_msgtype_declare("int", gras_datadesc_by_name("int"));
+  gras_msgtype_declare("float", gras_datadesc_by_name("float"));
+  gras_msgtype_declare("double", gras_datadesc_by_name("double"));
+
+  my_type = gras_datadesc_array_fixed("fixed int array",
+                                      gras_datadesc_by_name("int"),
+                                      FIXED_ARRAY_SIZE);
+  gras_msgtype_declare("fixed int array", my_type);
+
+  my_type = gras_datadesc_dynar(gras_datadesc_by_name("int"), NULL);
+  gras_msgtype_declare("xbt_dynar_of_int", my_type);
+
+  my_type = gras_datadesc_ref("int*", gras_datadesc_by_name("int"));
+  gras_msgtype_declare("int*", my_type);
+
+  gras_msgtype_declare("string", gras_datadesc_by_name("string"));
+
+  my_type = gras_datadesc_struct("homostruct");
+  gras_datadesc_struct_append(my_type, "a",
+                              gras_datadesc_by_name("signed int"));
+  gras_datadesc_struct_append(my_type, "b", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_append(my_type, "c", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_append(my_type, "d", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_close(my_type);
+  my_type =
+    gras_datadesc_ref("homostruct*", gras_datadesc_by_name("homostruct"));
+  gras_msgtype_declare("homostruct*", my_type);
+
+  my_type = gras_datadesc_struct("hetestruct");
+  gras_datadesc_struct_append(my_type, "c1",
+                              gras_datadesc_by_name("unsigned char"));
+  gras_datadesc_struct_append(my_type, "l1",
+                              gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_append(my_type, "c2",
+                              gras_datadesc_by_name("unsigned char"));
+  gras_datadesc_struct_append(my_type, "l2",
+                              gras_datadesc_by_name("unsigned long int"));
+  gras_datadesc_struct_close(my_type);
+  my_type =
+    gras_datadesc_ref("hetestruct*", gras_datadesc_by_name("hetestruct"));
+  gras_msgtype_declare("hetestruct*", my_type);
+
+  my_type =
+    gras_datadesc_array_fixed("hetestruct[10]",
+                              gras_datadesc_by_name("hetestruct"), 10);
+  my_type = gras_datadesc_ref("hetestruct[10]*", my_type);
+  gras_msgtype_declare("hetestruct[10]*", my_type);
+
+  my_type = gras_datadesc_struct("nestedstruct");
+  gras_datadesc_struct_append(my_type, "hete",
+                              gras_datadesc_by_name("hetestruct"));
+  gras_datadesc_struct_append(my_type, "homo",
+                              gras_datadesc_by_name("homostruct"));
+  gras_datadesc_struct_close(my_type);
+  my_type =
+    gras_datadesc_ref("nestedstruct*", gras_datadesc_by_name("nestedstruct"));
+  gras_msgtype_declare("nestedstruct*", my_type);
+
+  my_type = gras_datadesc_struct("chained_list_t");
+  ref_my_type = gras_datadesc_ref("chained_list_t*", my_type);
+  gras_datadesc_struct_append(my_type, "v", gras_datadesc_by_name("int"));
+  gras_datadesc_struct_append(my_type, "l", ref_my_type);
+  gras_datadesc_struct_close(my_type);
+  gras_datadesc_cycle_set(gras_datadesc_by_name("chained_list_t*"));
+  gras_msgtype_declare("chained_list_t", my_type);
+  gras_msgtype_declare("chained_list_t*", ref_my_type);
+
+  my_type =
+    gras_datadesc_dynar(gras_datadesc_by_name("string"), &free_string);
+  gras_msgtype_declare("xbt_dynar_of_string", my_type);
+
+  my_type = gras_datadesc_by_symbol(s_pbio);
+  gras_msgtype_declare("s_pbio", my_type);
+
+  my_type = gras_datadesc_by_symbol(s_clause);
+  my_type = gras_datadesc_ref("Clause*", my_type);
+  gras_msgtype_declare("Clause*", my_type);
 
 }
 
@@ -644,93 +701,96 @@ static void register_types(void) {
 #pragma argsused
 #endif
 
-int main(int argc,char *argv[]) {
-       gras_socket_t sock=NULL;
-       int direction = WRITE;
-       int cpt;
-       char local_arch, remote_arch;
-
-       gras_init(&argc,argv);
-       register_types();
-       register_structures();
-
-       for (cpt=1; cpt<argc; cpt++) {
-               if (!strcmp(argv[cpt], "--arch")) {
-                       INFO2("We are on %s (#%d)",
-                                       gras_datadesc_arch_name(gras_arch_selfid()),(int)gras_arch_selfid());
-                       exit(0);
-               } else if (!strcmp(argv[cpt], "--help")) {
-                       printf("Usage: datadesc_usage [option] [filename]\n");
-                       printf(" --arch: display the current architecture and quit.\n");
-                       printf(" --read file: reads the description from the given file\n");
-                       printf(" --write file: writes the description to the given file\n");
-                       printf(" --copy: copy the description in memory\n");
-                       printf(" --regen: write the description to the file of the current architecture\n");
-                       printf(" --help: displays this message\n");
-                       exit(0);
-               } else if (!strcmp(argv[cpt], "--regen")) {
-                       direction = WRITE;
-                       filename = bprintf("datadesc.%s",gras_datadesc_arch_name(gras_arch_selfid()));
-               } else if (!strcmp(argv[cpt], "--read")) {
-                       direction = READ;
-               } else if (!strcmp(argv[cpt], "--write")) {
-                       direction = WRITE;
-               } else if (!strcmp(argv[cpt], "--copy")) {
-                       direction = COPY;
-               } else {
-                       filename=argv[cpt];
-               }
-       }
-
-       if (direction == WRITE) {
-               INFO1("Write to file %s",filename);
-               sock = gras_socket_client_from_file(filename);
-       }
-       if (direction == READ) {
-               INFO1("Read from file %s",filename);
-               sock = gras_socket_server_from_file(filename);
-       }
-       if (direction == COPY) {
-               INFO0("Memory copy");
-       }
-
-       local_arch = gras_arch_selfid();
-       write_read("char", &local_arch,&remote_arch, sock,direction);
-       if (direction == READ)
-               VERB2("This file was generated on %s (%d)",
-                               gras_datadesc_arch_name(remote_arch),(int)remote_arch);
-
-
-       test_int(sock,direction);
-       test_float(sock,direction);
-       test_double(sock,direction);
-       test_array(sock,direction);
-       test_intref(sock,direction);
-
-       test_string(sock,direction);
-       test_dynar_scal(sock,direction);
-       test_dynar_empty(sock,direction);
-
-       test_structures(sock,direction);
-
-       test_homostruct(sock,direction);
-       test_hetestruct(sock,direction);
-       test_nestedstruct(sock,direction);
-       test_hetestruct_array(sock,direction);
-
-       test_chain_list(sock,direction);
-       test_graph(sock,direction);
-       test_dynar_ref(sock,direction);
-
-       test_pbio(sock,direction);
-
-       test_clause(sock,direction);
-       test_clause_empty(sock,direction);
-
-       if (direction != COPY)
-               gras_socket_close(sock);
-
-       gras_exit();
-       return 0;
+int main(int argc, char *argv[])
+{
+  gras_socket_t sock = NULL;
+  int direction = WRITE;
+  int cpt;
+  char local_arch, remote_arch;
+
+  gras_init(&argc, argv);
+  register_types();
+  register_structures();
+
+  for (cpt = 1; cpt < argc; cpt++) {
+    if (!strcmp(argv[cpt], "--arch")) {
+      INFO2("We are on %s (#%d)",
+            gras_datadesc_arch_name(gras_arch_selfid()),
+            (int) gras_arch_selfid());
+      exit(0);
+    } else if (!strcmp(argv[cpt], "--help")) {
+      printf("Usage: datadesc_usage [option] [filename]\n");
+      printf(" --arch: display the current architecture and quit.\n");
+      printf(" --read file: reads the description from the given file\n");
+      printf(" --write file: writes the description to the given file\n");
+      printf(" --copy: copy the description in memory\n");
+      printf
+        (" --regen: write the description to the file of the current architecture\n");
+      printf(" --help: displays this message\n");
+      exit(0);
+    } else if (!strcmp(argv[cpt], "--regen")) {
+      direction = WRITE;
+      filename =
+        bprintf("datadesc.%s", gras_datadesc_arch_name(gras_arch_selfid()));
+    } else if (!strcmp(argv[cpt], "--read")) {
+      direction = READ;
+    } else if (!strcmp(argv[cpt], "--write")) {
+      direction = WRITE;
+    } else if (!strcmp(argv[cpt], "--copy")) {
+      direction = COPY;
+    } else {
+      filename = argv[cpt];
+    }
+  }
+
+  if (direction == WRITE) {
+    INFO1("Write to file %s", filename);
+    sock = gras_socket_client_from_file(filename);
+  }
+  if (direction == READ) {
+    INFO1("Read from file %s", filename);
+    sock = gras_socket_server_from_file(filename);
+  }
+  if (direction == COPY) {
+    INFO0("Memory copy");
+  }
+
+  local_arch = gras_arch_selfid();
+  write_read("char", &local_arch, &remote_arch, sock, direction);
+  if (direction == READ)
+    VERB2("This file was generated on %s (%d)",
+          gras_datadesc_arch_name(remote_arch), (int) remote_arch);
+
+
+  test_int(sock, direction);
+  test_float(sock, direction);
+  test_double(sock, direction);
+  test_array(sock, direction);
+  test_intref(sock, direction);
+
+  test_string(sock, direction);
+  test_dynar_scal(sock, direction);
+  test_dynar_empty(sock, direction);
+
+  test_structures(sock, direction);
+
+  test_homostruct(sock, direction);
+  test_hetestruct(sock, direction);
+  test_nestedstruct(sock, direction);
+  test_hetestruct_array(sock, direction);
+
+  test_chain_list(sock, direction);
+  test_graph(sock, direction);
+  test_dynar_ref(sock, direction);
+
+  test_pbio(sock, direction);
+
+  test_clause(sock, direction);
+  test_clause_empty(sock, direction);
+
+  if (direction != COPY)
+    gras_socket_close(sock);
+
+  gras_exit();
+  return 0;
 }
-
index 04c60ee..c119a6c 100644 (file)
 
 #include "gras.h"
 
-int function (int argc,char *argv[]);
+int function(int argc, char *argv[]);
 
-int function (int argc,char *argv[]) { 
-  gras_init(&argc,argv);
+int function(int argc, char *argv[])
+{
+  gras_init(&argc, argv);
   //  gras_os_sleep(3);
   gras_exit();
   return 0;
-} 
-
-
+}
index cfe9e99..7c2eb8f 100644 (file)
 
 #include "gras.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Messages specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific to this test");
 
-int server (int argc,char *argv[]);
-int client (int argc,char *argv[]);
+int server(int argc, char *argv[]);
+int client(int argc, char *argv[]);
 
-static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx,
-                                  void *payload_data) {
+static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
+{
   INFO0("Got the message");
   return 0;
 }
 
-int server (int argc,char *argv[]) {
-  gras_socket_t me=NULL,pal=NULL;
+int server(int argc, char *argv[])
+{
+  gras_socket_t me = NULL, pal = NULL;
   int myport;
   char *palstr;
-   
+
   xbt_ex_t e;
   int got_expected;
   double now;
-  
-   
-  gras_init(&argc,argv);
-         
-  xbt_assert0(argc == 3,"Usage: server <myport> <client>");
-  myport=atoi(argv[1]);
+
+
+  gras_init(&argc, argv);
+
+  xbt_assert0(argc == 3, "Usage: server <myport> <client>");
+  myport = atoi(argv[1]);
   palstr = argv[2];
 
   gras_msgtype_declare("hello", NULL);
-  gras_cb_register("hello",&server_cb_hello_handler);
+  gras_cb_register("hello", &server_cb_hello_handler);
 
   INFO1("Launch server (port=%d)", myport);
   TRY {
@@ -46,58 +47,61 @@ int server (int argc,char *argv[]) {
   } CATCH(e) {
     RETHROW0("Unable to establish a server socket: %s");
   }
-  gras_os_sleep(1); /* Wait for pal to startup */
+  gras_os_sleep(1);             /* Wait for pal to startup */
   TRY {
     pal = gras_socket_client_from_string(palstr);
   } CATCH(e) {
-    RETHROW1("Unable to establish a socket to %s: %s",palstr);
+    RETHROW1("Unable to establish a socket to %s: %s", palstr);
   }
   INFO0("Initialization done.");
   now = gras_os_time();
 
   /* Launch handle(0) when there is no message. Timeout expected */
   got_expected = 0;
-  TRY {     
-     gras_msg_handle(0);
+  TRY {
+    gras_msg_handle(0);
   } CATCH(e) {
-     if (e.category == timeout_error) {
-       got_expected = 1;
-       xbt_ex_free(e);
-     } else {
-       RETHROW0("Didn't got the expected timeout: %s");
-     }
+    if (e.category == timeout_error) {
+      got_expected = 1;
+      xbt_ex_free(e);
+    } else {
+      RETHROW0("Didn't got the expected timeout: %s");
+    }
   }
-  xbt_assert0(got_expected,"gras_msg_handle(0) do not lead to any timeout exception");
+  xbt_assert0(got_expected,
+              "gras_msg_handle(0) do not lead to any timeout exception");
   xbt_assert1(gras_os_time() - now < 0.01,
-             "gras_msg_handle(0) do not anwser immediately (%.4fsec)",
-             gras_os_time() - now);
+              "gras_msg_handle(0) do not anwser immediately (%.4fsec)",
+              gras_os_time() - now);
   INFO0("gras_msg_handle(0) works as expected (immediate timeout)");
   /* Launch handle(0) when there is no message. Timeout expected */
   got_expected = 0;
-  TRY {     
-     gras_msg_handle(1);
-  } CATCH(e) {
-     if (e.category == timeout_error) {
-       got_expected = 1;
-       xbt_ex_free(e);
-     } else {
-       RETHROW0("Didn't got the expected timeout: %s");
-     }
+  TRY {
+    gras_msg_handle(1);
+  }
+  CATCH(e) {
+    if (e.category == timeout_error) {
+      got_expected = 1;
+      xbt_ex_free(e);
+    } else {
+      RETHROW0("Didn't got the expected timeout: %s");
+    }
   }
-  xbt_assert0(got_expected,"gras_msg_handle(1) do not lead to any timeout exception");
+  xbt_assert0(got_expected,
+              "gras_msg_handle(1) do not lead to any timeout exception");
   xbt_assert1(gras_os_time() - now < 1.5,
-             "gras_msg_handle(1) needs more than 1.5 sec to answer (%.4fsec)",
-             gras_os_time() - now);
+              "gras_msg_handle(1) needs more than 1.5 sec to answer (%.4fsec)",
+              gras_os_time() - now);
   xbt_assert1(gras_os_time() - now >= 1.0,
-             "gras_msg_handle(1) answers in less than one second (%.4fsec)",
-             gras_os_time() - now);
+              "gras_msg_handle(1) answers in less than one second (%.4fsec)",
+              gras_os_time() - now);
   INFO0("gras_msg_handle(1) works as expected (delayed timeout)");
   gras_os_sleep(3);
-   
+
   /* Send an hello to the client to unlock it */
   INFO0("Unlock pal");
   gras_msg_send(pal, "hello", NULL);
-  
+
   /* Frees the allocated resources, and shut GRAS down */
   gras_socket_close(me);
   gras_socket_close(pal);
@@ -105,43 +109,44 @@ int server (int argc,char *argv[]) {
   return 0;
 }
 
-int client(int argc,char *argv[]) {
-  gras_socket_t me=NULL,pal=NULL;
+int client(int argc, char *argv[])
+{
+  gras_socket_t me = NULL, pal = NULL;
   int myport;
   char *palstr;
-   
+
   xbt_ex_t e;
   int got_expected;
-  
-   
-  gras_init(&argc,argv);
-  xbt_assert0(argc == 3,"Usage: client <myport> <server>");
-  myport=atoi(argv[1]);
+
+
+  gras_init(&argc, argv);
+  xbt_assert0(argc == 3, "Usage: client <myport> <server>");
+  myport = atoi(argv[1]);
   palstr = argv[2];
 
   gras_msgtype_declare("hello", NULL);
-  gras_cb_register("hello",&server_cb_hello_handler);
-   
+  gras_cb_register("hello", &server_cb_hello_handler);
+
   INFO1("Launch client (port=%d)", myport);
   TRY {
     me = gras_socket_server(myport);
   } CATCH(e) {
     RETHROW0("Unable to establish a server socket: %s");
   }
-  gras_os_sleep(1); /* Wait for pal to startup */
+  gras_os_sleep(1);             /* Wait for pal to startup */
   TRY {
     pal = gras_socket_client_from_string(palstr);
   } CATCH(e) {
-    RETHROW1("Unable to establish a socket to %s: %s",palstr);
+    RETHROW1("Unable to establish a socket to %s: %s", palstr);
   }
   INFO0("Initialization done.");
-   
+
   /* Launch handle(-1). Lock until message from server expected */
   got_expected = 0;
-  TRY {     
-     gras_msg_handle(-1);
+  TRY {
+    gras_msg_handle(-1);
   } CATCH(e) {
-     RETHROW0("No exception expected during handle(-1), but got %s");
+    RETHROW0("No exception expected during handle(-1), but got %s");
   }
   INFO0("gras_msg_handle(-1) works as expected (locked)");
 
index 5079478..03a6387 100644 (file)
 
 #include "gras.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Small sleep test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Small sleep test");
 
-int function (int argc,char *argv[]);
+int function(int argc, char *argv[]);
 
 
-int function (int argc,char *argv[]) {
-  gras_init(&argc,argv);
+int function(int argc, char *argv[])
+{
+  gras_init(&argc, argv);
   gras_msg_handleall(100);
   INFO0("Let's go 1E-5");
   gras_msg_handleall(1E-5);
@@ -30,6 +31,4 @@ int function (int argc,char *argv[]) {
   INFO0("done");
   gras_exit();
   return 0;
-} 
-
-
+}
index 308d41d..b865574 100644 (file)
@@ -2,32 +2,35 @@
 #include "msg/msg.h"
 #include <float.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Messages specific to this example");
 
 
-static int send(int argc, char *argv[]){
+static int send(int argc, char *argv[])
+{
   INFO0("Sending");
-  MSG_task_put(MSG_task_create("Blah", 0.0, 0.0, NULL),
-              MSG_host_self(), 0);
-  MSG_process_sleep(1.); /* FIXME: if the sender exits before the receiver calls get_sender(), bad thing happens */
+  MSG_task_put(MSG_task_create("Blah", 0.0, 0.0, NULL), MSG_host_self(), 0);
+  MSG_process_sleep(1.);        /* FIXME: if the sender exits before the receiver calls get_sender(), bad thing happens */
   INFO0("Exiting");
   return 0;
 }
 
-static int receive(int argc, char *argv[]) {
+static int receive(int argc, char *argv[])
+{
   INFO0("Receiving");
   m_task_t task = NULL;
   MSG_task_get_with_timeout(&task, 0, DBL_MAX);
   xbt_assert0(MSG_task_get_sender(task), "No sender received");
-  INFO1("Got a message sent by '%s'", MSG_process_get_name(MSG_task_get_sender(task)));
+  INFO1("Got a message sent by '%s'",
+        MSG_process_get_name(MSG_task_get_sender(task)));
   return 0;
 }
 
 /** Main function */
-int main(int argc, char *argv[]) {
+int main(int argc, char *argv[])
+{
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc,argv);
+  MSG_global_init(&argc, argv);
   MSG_set_channel_number(100);
 
   /*   Application deployment */
@@ -38,7 +41,8 @@ int main(int argc, char *argv[]) {
   MSG_launch_application(argv[1]);
   res = MSG_main();
   MSG_clean();
-  if(res==MSG_OK) return 0;
-  else return 1;
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
 }
-
index c33e6ad..8803054 100644 (file)
@@ -2,17 +2,18 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
   SD_task_t taskInit;
   SD_task_t taskA;
   SD_task_t taskB;
 
-   /* scheduling parameters */
+  /* scheduling parameters */
 
   double communication_amount1[] = { 0, 100000000, 0, 0 };
   double communication_amount2[] = { 0, 1, 0, 0 };
-  const double no_cost[] = {0.0, 0.0};
+  const double no_cost[] = { 0.0, 0.0 };
 
   /* initialisation of SD */
   SD_init(&argc, argv);
@@ -21,18 +22,21 @@ int main(int argc, char **argv) {
   SD_create_environment(argv[1]);
 
   /* creation of the tasks and their dependencies */
-  taskInit = SD_task_create("Init",NULL,1.0);
+  taskInit = SD_task_create("Init", NULL, 1.0);
   taskA = SD_task_create("Task Comm 1", NULL, 1.0);
   taskB = SD_task_create("Task Comm 2", NULL, 1.0);
-  
 
-  
+
+
+
   /* let's launch the simulation! */
 
-  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
-  SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, communication_amount1, -1.0);
-  SD_task_schedule(taskB, 2, SD_workstation_get_list(), no_cost, communication_amount2, -1.0);
+  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
+  SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost,
+                   communication_amount1, -1.0);
+  SD_task_schedule(taskB, 2, SD_workstation_get_list(), no_cost,
+                   communication_amount2, -1.0);
 
   SD_task_dependency_add(NULL, NULL, taskInit, taskA);
   SD_task_dependency_add(NULL, NULL, taskInit, taskB);
@@ -42,4 +46,3 @@ int main(int argc, char **argv) {
   SD_exit();
   return 0;
 }
-
index 6456ca8..1e4e027 100644 (file)
@@ -2,45 +2,49 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
-       SD_task_t taskInit;
-    SD_task_t taskA;
-    SD_task_t taskB;
+  SD_task_t taskInit;
+  SD_task_t taskA;
+  SD_task_t taskB;
 
-       double communication_amount1 = 1000000000;
-    double communication_amount2 = 1000000000;
-    double no_cost = 0.0;
+  double communication_amount1 = 1000000000;
+  double communication_amount2 = 1000000000;
+  double no_cost = 0.0;
 
-       const SD_workstation_t* workstation;
+  const SD_workstation_t *workstation;
 
-    /* initialisation of SD */
-    SD_init(&argc, argv);
+  /* initialisation of SD */
+  SD_init(&argc, argv);
 
-    /* creation of the environment */
-    SD_create_environment(argv[1]);
+  /* creation of the environment */
+  SD_create_environment(argv[1]);
 
-    /* creation of the tasks and their dependencies */
-    taskInit = SD_task_create("Init",NULL,1.0);
-    taskA = SD_task_create("Task Comm A", NULL, 1.0);
-    taskB = SD_task_create("Task Comm B", NULL, 1.0);
+  /* creation of the tasks and their dependencies */
+  taskInit = SD_task_create("Init", NULL, 1.0);
+  taskA = SD_task_create("Task Comm A", NULL, 1.0);
+  taskB = SD_task_create("Task Comm B", NULL, 1.0);
 
 
-    /* scheduling parameters */
+  /* scheduling parameters */
 
-    
-       workstation = SD_workstation_get_list();
 
-    /* let's launch the simulation! */
-    SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost, &no_cost, -1.0);
-    SD_task_schedule(taskA, 1, &workstation[0], &no_cost, &communication_amount1, -1.0);
-    SD_task_schedule(taskB, 1, &workstation[1], &no_cost, &communication_amount2, -1.0);
+  workstation = SD_workstation_get_list();
 
-    SD_task_dependency_add(NULL, NULL, taskInit, taskA);
-    SD_task_dependency_add(NULL, NULL, taskInit, taskB);
-    
-    SD_simulate(-1.0);
+  /* let's launch the simulation! */
+  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost, &no_cost,
+                   -1.0);
+  SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
+                   &communication_amount1, -1.0);
+  SD_task_schedule(taskB, 1, &workstation[1], &no_cost,
+                   &communication_amount2, -1.0);
 
-    SD_exit();
-    return 0;
+  SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+  SD_task_dependency_add(NULL, NULL, taskInit, taskB);
+
+  SD_simulate(-1.0);
+
+  SD_exit();
+  return 0;
 }
index fb40143..9a76191 100644 (file)
@@ -2,44 +2,48 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
-       SD_task_t taskInit;
-    SD_task_t taskA;
-    SD_task_t taskB;
+  SD_task_t taskInit;
+  SD_task_t taskA;
+  SD_task_t taskB;
 
-       const SD_workstation_t* workstation;
+  const SD_workstation_t *workstation;
 
-       double communication_amount1 = 1000000000;
-    double communication_amount2 = 100000000;
-    double no_cost = 0.0;
+  double communication_amount1 = 1000000000;
+  double communication_amount2 = 100000000;
+  double no_cost = 0.0;
 
-    /* initialisation of SD */
-    SD_init(&argc, argv);
+  /* initialisation of SD */
+  SD_init(&argc, argv);
 
-    /* creation of the environment */
-    SD_create_environment(argv[1]);
+  /* creation of the environment */
+  SD_create_environment(argv[1]);
 
-    /* creation of the tasks and their dependencies */
-    taskInit = SD_task_create("Init",NULL,1.0);
-    taskA = SD_task_create("Task Comm A", NULL, 1.0);
-    taskB = SD_task_create("Task Comm B", NULL, 1.0);
+  /* creation of the tasks and their dependencies */
+  taskInit = SD_task_create("Init", NULL, 1.0);
+  taskA = SD_task_create("Task Comm A", NULL, 1.0);
+  taskB = SD_task_create("Task Comm B", NULL, 1.0);
 
 
-    /* scheduling parameters */
+  /* scheduling parameters */
 
-    workstation = SD_workstation_get_list();
+  workstation = SD_workstation_get_list();
 
-    /* let's launch the simulation! */
-    SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost, &no_cost, -1.0);
-    SD_task_schedule(taskA, 1, &workstation[0], &no_cost, &communication_amount1, -1.0);
-    SD_task_schedule(taskB, 1, &workstation[1], &no_cost, &communication_amount2, -1.0);
+  /* let's launch the simulation! */
+  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), &no_cost, &no_cost,
+                   -1.0);
+  SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
+                   &communication_amount1, -1.0);
+  SD_task_schedule(taskB, 1, &workstation[1], &no_cost,
+                   &communication_amount2, -1.0);
 
-    SD_task_dependency_add(NULL, NULL, taskInit, taskA);
-    SD_task_dependency_add(NULL, NULL, taskInit, taskB);
-    
-    SD_simulate(-1.0);
+  SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+  SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
-    SD_exit();
-    return 0;
+  SD_simulate(-1.0);
+
+  SD_exit();
+  return 0;
 }
index eb05f3c..87d5c78 100644 (file)
@@ -2,37 +2,41 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
-       SD_task_t taskInit;
-    SD_task_t taskA;
-    SD_task_t taskFin;
+  SD_task_t taskInit;
+  SD_task_t taskA;
+  SD_task_t taskFin;
 
-       /* scheduling parameters */
+  /* scheduling parameters */
 
-    double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
+  double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
 
-    /* initialisation of SD */
-    SD_init(&argc, argv);
+  /* initialisation of SD */
+  SD_init(&argc, argv);
 
-    /* creation of the environment */
-    SD_create_environment(argv[1]);
+  /* creation of the environment */
+  SD_create_environment(argv[1]);
 
-    /* creation of the tasks and their dependencies */
-    taskInit = SD_task_create("Task Init",NULL,1.0);
-    taskA = SD_task_create("Task A", NULL, 1.0);
-    taskFin = SD_task_create("Task Fin", NULL, 1.0);
+  /* creation of the tasks and their dependencies */
+  taskInit = SD_task_create("Task Init", NULL, 1.0);
+  taskA = SD_task_create("Task A", NULL, 1.0);
+  taskFin = SD_task_create("Task Fin", NULL, 1.0);
 
-    /* let's launch the simulation! */
-    SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
-    SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, no_cost, -1.0);
-    SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
+  /* let's launch the simulation! */
+  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
+  SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
+  SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
 
-    SD_task_dependency_add(NULL, NULL, taskInit, taskA);
-    SD_task_dependency_add(NULL, NULL, taskA, taskFin);
-    
-    SD_simulate(-1.0);
+  SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+  SD_task_dependency_add(NULL, NULL, taskA, taskFin);
 
-    SD_exit();
-    return 0;
+  SD_simulate(-1.0);
+
+  SD_exit();
+  return 0;
 }
index 3ab8374..1fa7b94 100644 (file)
@@ -2,41 +2,45 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
-       /* creation of the tasks and their dependencies */
-    
-       SD_task_t taskInit;
-    SD_task_t taskA;
-    SD_task_t taskFin;
+int main(int argc, char **argv)
+{
+  /* creation of the tasks and their dependencies */
 
+  SD_task_t taskInit;
+  SD_task_t taskA;
+  SD_task_t taskFin;
 
-    /* scheduling parameters */
 
-    double no_cost[] = { 0., 0., 0., 0. };
-    double amount[] = { 0., 1., 0., 0.};
+  /* scheduling parameters */
 
-    /* initialisation of SD */
-    SD_init(&argc, argv);
+  double no_cost[] = { 0., 0., 0., 0. };
+  double amount[] = { 0., 1., 0., 0. };
 
-    /* creation of the environment */
-    SD_create_environment(argv[1]);
+  /* initialisation of SD */
+  SD_init(&argc, argv);
 
-    /* creation of the tasks and their dependencies */
-    taskInit = SD_task_create("Task Init",NULL,1.0);
-    taskA = SD_task_create("Task A", NULL, 1.0);
-    taskFin = SD_task_create("Task Fin", NULL, 1.0);
+  /* creation of the environment */
+  SD_create_environment(argv[1]);
 
+  /* creation of the tasks and their dependencies */
+  taskInit = SD_task_create("Task Init", NULL, 1.0);
+  taskA = SD_task_create("Task A", NULL, 1.0);
+  taskFin = SD_task_create("Task Fin", NULL, 1.0);
 
-    /* let's launch the simulation! */
-    SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
-    SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, amount, -1.0);
-    SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
 
-    SD_task_dependency_add(NULL, NULL, taskInit, taskA);
-    SD_task_dependency_add(NULL, NULL, taskA, taskFin);
-    
-    SD_simulate(-1.0);
+  /* let's launch the simulation! */
+  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
+  SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, amount,
+                   -1.0);
+  SD_task_schedule(taskFin, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
 
-    SD_exit();
-    return 0;
+  SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+  SD_task_dependency_add(NULL, NULL, taskA, taskFin);
+
+  SD_simulate(-1.0);
+
+  SD_exit();
+  return 0;
 }
index 5fd8468..660b0a8 100644 (file)
@@ -2,41 +2,45 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
-       /* creation of the tasks and their dependencies */
-    SD_task_t taskInit;
-    SD_task_t taskA;
-    SD_task_t taskB;
+  /* creation of the tasks and their dependencies */
+  SD_task_t taskInit;
+  SD_task_t taskA;
+  SD_task_t taskB;
 
 
-    /* scheduling parameters */
+  /* scheduling parameters */
 
-    double no_cost[] = { 0., 0., 0., 0. };
-    double amount[] = { 0., 100000., 0., 0.};
-    double comput[] = { 10000000. };
+  double no_cost[] = { 0., 0., 0., 0. };
+  double amount[] = { 0., 100000., 0., 0. };
+  double comput[] = { 10000000. };
 
-    /* initialisation of SD */
-    SD_init(&argc, argv);
+  /* initialisation of SD */
+  SD_init(&argc, argv);
 
-    /* creation of the environment */
-    SD_create_environment(argv[1]);
+  /* creation of the environment */
+  SD_create_environment(argv[1]);
 
-    /* creation of the tasks and their dependencies */
-    taskInit = SD_task_create("Task Init",NULL,1.0);
-    taskA = SD_task_create("Task A", NULL, 1.0);
-    taskB = SD_task_create("Task B", NULL, 1.0);
+  /* creation of the tasks and their dependencies */
+  taskInit = SD_task_create("Task Init", NULL, 1.0);
+  taskA = SD_task_create("Task A", NULL, 1.0);
+  taskB = SD_task_create("Task B", NULL, 1.0);
 
-    /* let's launch the simulation! */
-    SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
-    SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, amount, -1.0);
-    SD_task_schedule(taskB, 1, SD_workstation_get_list(), comput, no_cost, -1.0);
+  /* let's launch the simulation! */
+  SD_task_schedule(taskInit, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
+  SD_task_schedule(taskA, 2, SD_workstation_get_list(), no_cost, amount,
+                   -1.0);
+  SD_task_schedule(taskB, 1, SD_workstation_get_list(), comput, no_cost,
+                   -1.0);
 
-    SD_task_dependency_add(NULL, NULL, taskInit, taskA);
-    SD_task_dependency_add(NULL, NULL, taskInit, taskB);
-    
-    SD_simulate(-1.0);
+  SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+  SD_task_dependency_add(NULL, NULL, taskInit, taskB);
 
-    SD_exit();
-    return 0;
+  SD_simulate(-1.0);
+
+  SD_exit();
+  return 0;
 }
index 1aa373c..9dcc466 100644 (file)
@@ -9,24 +9,25 @@
  * author: sahu
  */
 
-int main(int argc, char **argv) {
-    double comm_cost[] = { 0.0, 0.0, 0.0, 0.0 };
-    double comp_cost[] = { 1.0 };
-       SD_task_t taskA, taskB;
-       
-       SD_init(&argc, argv);
-    SD_create_environment(argv[1]);
+int main(int argc, char **argv)
+{
+  double comm_cost[] = { 0.0, 0.0, 0.0, 0.0 };
+  double comp_cost[] = { 1.0 };
+  SD_task_t taskA, taskB;
 
-    taskA = SD_task_create("Task A", NULL, 1.0);
-    taskB = SD_task_create("Task B", NULL, 1.0);
+  SD_init(&argc, argv);
+  SD_create_environment(argv[1]);
 
-    SD_task_schedule(taskA, 1, SD_workstation_get_list(), comp_cost, comm_cost,
-                    -1.0);
-    SD_task_schedule(taskB, 1, SD_workstation_get_list(), comp_cost, comm_cost,
-                    -1.0);
-           
-    SD_simulate(-1.0);
+  taskA = SD_task_create("Task A", NULL, 1.0);
+  taskB = SD_task_create("Task B", NULL, 1.0);
 
-    SD_exit();
-    return 0;
+  SD_task_schedule(taskA, 1, SD_workstation_get_list(), comp_cost, comm_cost,
+                   -1.0);
+  SD_task_schedule(taskB, 1, SD_workstation_get_list(), comp_cost, comm_cost,
+                   -1.0);
+
+  SD_simulate(-1.0);
+
+  SD_exit();
+  return 0;
 }
index 16f0fe8..1fe82e4 100644 (file)
  * 
  */
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   double time;
   SD_task_t task;
-  
-  double communication_amount[] = 
-       {     0.0, 1.0, 1.0, 1.0,
-                 1.0, 0.0, 1.0, 1.0,
-                 1.0, 1.0, 0.0, 1.0,
-                 1.0, 1.0, 1.0, 0.0,
-       };
-  
+
+  double communication_amount[] = { 0.0, 1.0, 1.0, 1.0,
+    1.0, 0.0, 1.0, 1.0,
+    1.0, 1.0, 0.0, 1.0,
+    1.0, 1.0, 1.0, 0.0,
+  };
+
   double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
 
-  
+
   /***************************************/
 
   SD_init(&argc, argv);
@@ -42,19 +42,19 @@ int main(int argc, char **argv) {
 
   task = SD_task_create("All2all task", NULL, 1.0);
 
-  SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost, communication_amount, -1.0);
-  
+  SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost,
+                   communication_amount, -1.0);
+
   SD_simulate(-1.0);
-  
+
   time = SD_get_clock();
 
   printf("%g\n", time);
   fflush(stdout);
-  
+
   SD_task_destroy(task);
-  
+
   SD_exit();
-  
+
   return 0;
 }
-
index a201a84..d0a53a6 100644 (file)
  * should be 1 + 2 latency = 3
  */
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   double time;
   SD_task_t task;
-  
-  double communication_amount[] = 
-       {     0.0, 1.0, 0.0, 0.0,
-                 0.0, 0.0, 0.0, 0.0,
-                 0.0, 0.0, 0.0, 1.0,
-                 0.0, 0.0, 0.0, 0.0,
-       };
-  
+
+  double communication_amount[] = { 0.0, 1.0, 0.0, 0.0,
+    0.0, 0.0, 0.0, 0.0,
+    0.0, 0.0, 0.0, 1.0,
+    0.0, 0.0, 0.0, 0.0,
+  };
+
   double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
 
-  
+
   /***************************************/
 
   SD_init(&argc, argv);
@@ -42,19 +42,19 @@ int main(int argc, char **argv) {
 
   task = SD_task_create("Comm 1", NULL, 1.0);
 
-  SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost, communication_amount, -1.0);
-  
+  SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost,
+                   communication_amount, -1.0);
+
   SD_simulate(-1.0);
-  
+
   time = SD_get_clock();
 
   printf("%g\n", time);
   fflush(stdout);
 
   SD_task_destroy(task);
-  
+
   SD_exit();
-  
+
   return 0;
 }
-
index 871343e..6884438 100644 (file)
  * time to send: 6 + latency at the beginning: 0.5 + 1 + 0.5
  */
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   double time;
   SD_task_t task;
-  
-  double communication_amount[] = 
-       {     0.0, 1.0, 2.0, 3.0,
-                 0.0, 0.0, 0.0, 0.0,
-                 0.0, 0.0, 0.0, 0.0,
-                 0.0, 0.0, 0.0, 0.0,
-       };
-  
+
+  double communication_amount[] = { 0.0, 1.0, 2.0, 3.0,
+    0.0, 0.0, 0.0, 0.0,
+    0.0, 0.0, 0.0, 0.0,
+    0.0, 0.0, 0.0, 0.0,
+  };
+
   double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
 
-  
+
   /***************************************/
 
   SD_init(&argc, argv);
@@ -43,19 +43,19 @@ int main(int argc, char **argv) {
 
   task = SD_task_create("Scatter task", NULL, 1.0);
 
-  SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost, communication_amount, -1.0);
-  
+  SD_task_schedule(task, 4, SD_workstation_get_list(), no_cost,
+                   communication_amount, -1.0);
+
   SD_simulate(-1.0);
-  
+
   time = SD_get_clock();
 
   printf("%g\n", time);
   fflush(stdout);
-  
+
   SD_task_destroy(task);
-  
+
   SD_exit();
-  
+
   return 0;
 }
-
index 3da1992..eb2e9e4 100644 (file)
  * see tesh file for expected output
  * 
  */
-int main(int argc, char **argv) {
-       double time;
-       double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
-       const double no_cost[] = { 0.0, 0.0 };
-       SD_task_t task;
+int main(int argc, char **argv)
+{
+  double time;
+  double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
+  const double no_cost[] = { 0.0, 0.0 };
+  SD_task_t task;
 
-       SD_init(&argc, argv);
-       SD_create_environment(argv[1]);
+  SD_init(&argc, argv);
+  SD_create_environment(argv[1]);
 
-       task = SD_task_create("Comm 1", NULL, 1.0);
+  task = SD_task_create("Comm 1", NULL, 1.0);
 
-       SD_task_schedule(task, 2, SD_workstation_get_list(), no_cost,
-                       communication_amount, -1.0);
+  SD_task_schedule(task, 2, SD_workstation_get_list(), no_cost,
+                   communication_amount, -1.0);
 
-       SD_simulate(-1.0);
+  SD_simulate(-1.0);
 
-       time = SD_get_clock();
+  time = SD_get_clock();
 
-       printf("%g\n", time);
-       fflush(stdout);
+  printf("%g\n", time);
+  fflush(stdout);
 
-       SD_task_destroy(task);
+  SD_task_destroy(task);
 
-       SD_exit();
+  SD_exit();
 
-       return 0;
+  return 0;
 }
-
index f3dd767..4e2dd74 100644 (file)
  * 
  */
 
-int main(int argc, char **argv) {
-       double time;
-       SD_task_t root;
-       SD_task_t task1;
-       SD_task_t task2;
-       double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
-       double communication_amount2[] = { 0.0, 1.0, 0.0, 0.0 };
-       double no_cost1[] = { 0.0 };
-       double no_cost[] = { 0.0, 0.0 };
+int main(int argc, char **argv)
+{
+  double time;
+  SD_task_t root;
+  SD_task_t task1;
+  SD_task_t task2;
+  double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
+  double communication_amount2[] = { 0.0, 1.0, 0.0, 0.0 };
+  double no_cost1[] = { 0.0 };
+  double no_cost[] = { 0.0, 0.0 };
 
-       SD_init(&argc, argv);
-       SD_create_environment(argv[1]);
+  SD_init(&argc, argv);
+  SD_create_environment(argv[1]);
 
-       root = SD_task_create("Root", NULL, 1.0);
-       task1 = SD_task_create("Comm 1", NULL, 1.0);
-       task2 = SD_task_create("Comm 2", NULL, 1.0);
+  root = SD_task_create("Root", NULL, 1.0);
+  task1 = SD_task_create("Comm 1", NULL, 1.0);
+  task2 = SD_task_create("Comm 2", NULL, 1.0);
 
-       SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1, no_cost1,
-                       -1.0);
-       SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
-                       communication_amount1, -1.0);
-       SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
-                       communication_amount2, -1.0);
+  SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1, no_cost1,
+                   -1.0);
+  SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
+                   communication_amount1, -1.0);
+  SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
+                   communication_amount2, -1.0);
 
-       SD_task_dependency_add(NULL, NULL, root, task1);
-       SD_task_dependency_add(NULL, NULL, root, task2);
+  SD_task_dependency_add(NULL, NULL, root, task1);
+  SD_task_dependency_add(NULL, NULL, root, task2);
 
-       SD_simulate(-1.0);
+  SD_simulate(-1.0);
 
-       time = SD_get_clock();
+  time = SD_get_clock();
 
-       printf("%g\n", time);
-       fflush(stdout);
+  printf("%g\n", time);
+  fflush(stdout);
 
-       SD_task_destroy(root);
-       SD_task_destroy(task1);
-       SD_task_destroy(task2);
+  SD_task_destroy(root);
+  SD_task_destroy(task1);
+  SD_task_destroy(task2);
 
-       SD_exit();
+  SD_exit();
 
-       return 0;
+  return 0;
 }
-
index 585ad93..c6f95cd 100644 (file)
@@ -19,7 +19,8 @@
  * 
  */
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   double time;
   SD_task_t root;
   SD_task_t task1;
@@ -28,37 +29,36 @@ int main(int argc, char **argv) {
   double communication_amount2[] = { 0.0, 0.0, 1.0, 0.0 };
   double no_cost1[] = { 0.0 };
   double no_cost[] = { 0.0, 0.0 };
-  
+
   SD_init(&argc, argv);
   SD_create_environment(argv[1]);
 
-  root  = SD_task_create("Root", NULL, 1.0);
+  root = SD_task_create("Root", NULL, 1.0);
   task1 = SD_task_create("Comm 1", NULL, 1.0);
   task2 = SD_task_create("Comm 2", NULL, 1.0);
-  
+
   SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost1,
-                       no_cost1, -1.0);
+                   no_cost1, -1.0);
   SD_task_schedule(task1, 2, SD_workstation_get_list(), no_cost,
-                       communication_amount1, -1.0);
+                   communication_amount1, -1.0);
   SD_task_schedule(task2, 2, SD_workstation_get_list(), no_cost,
-                       communication_amount2, -1.0);
-  
+                   communication_amount2, -1.0);
+
   SD_task_dependency_add(NULL, NULL, root, task1);
-  SD_task_dependency_add(NULL, NULL, root, task2);  
-  
+  SD_task_dependency_add(NULL, NULL, root, task2);
+
   SD_simulate(-1.0);
-  
+
   time = SD_get_clock();
 
   printf("%g\n", time);
   fflush(stdout);
-  
+
   SD_task_destroy(root);
   SD_task_destroy(task1);
   SD_task_destroy(task2);
-  
+
   SD_exit();
-  
+
   return 0;
 }
-
index daa2f8e..628d675 100644 (file)
  * assert this
  */
 
-int main(int argc, char **argv) {
-       int i;
-       double time;
-       double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
-       double no_cost[] = { 0.0, 0.0 };
+int main(int argc, char **argv)
+{
+  int i;
+  double time;
+  double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
+  double no_cost[] = { 0.0, 0.0 };
 
-       SD_task_t root;
-       SD_task_t task[TASK_NUM];
+  SD_task_t root;
+  SD_task_t task[TASK_NUM];
 
-       SD_init(&argc, argv);
-       SD_create_environment(argv[1]);
+  SD_init(&argc, argv);
+  SD_create_environment(argv[1]);
 
-       // xbt_assert0( check max tcp win size, "MAX TCP WIN SIZE is 20000");
+  // xbt_assert0( check max tcp win size, "MAX TCP WIN SIZE is 20000");
 
-       root = SD_task_create("Root", NULL, 1.0);
-       SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
+  root = SD_task_create("Root", NULL, 1.0);
+  SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
 
-       for (i=0; i<TASK_NUM; i++) {
-               task[i] = SD_task_create("Comm", NULL, 1.0);
-               SD_task_schedule(task[i], 2, SD_workstation_get_list(), no_cost,
-                               communication_amount, -1.0);
-               SD_task_dependency_add(NULL, NULL, root, task[i]);
-       }
+  for (i = 0; i < TASK_NUM; i++) {
+    task[i] = SD_task_create("Comm", NULL, 1.0);
+    SD_task_schedule(task[i], 2, SD_workstation_get_list(), no_cost,
+                     communication_amount, -1.0);
+    SD_task_dependency_add(NULL, NULL, root, task[i]);
+  }
 
-       SD_simulate(-1.0);
+  SD_simulate(-1.0);
 
-       time = SD_get_clock();
+  time = SD_get_clock();
 
-       printf("%g\n", time);
-       fflush(stdout);
+  printf("%g\n", time);
+  fflush(stdout);
 
-       for (i=0; i<TASK_NUM; i++) {
-               SD_task_destroy(task[i]);
-       }
+  for (i = 0; i < TASK_NUM; i++) {
+    SD_task_destroy(task[i]);
+  }
 
-       SD_exit();
+  SD_exit();
 
-       return 0;
+  return 0;
 }
-
index 68a2c99..340d41b 100644 (file)
  * 1.5
  */
 
-static SD_task_t create_empty_cost_root() {
-       double no_cost[] = { 0.0 };
-       SD_task_t root;
+static SD_task_t create_empty_cost_root()
+{
+  double no_cost[] = { 0.0 };
+  SD_task_t root;
 
-       root = SD_task_create("Root", NULL, 1.0);
-       SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost, -1.0);
+  root = SD_task_create("Root", NULL, 1.0);
+  SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost,
+                   -1.0);
 
-       return root;
+  return root;
 }
 
-static void zero_cost_test(int *argc, char *argv[]) {
-       double time;
-       SD_task_t task;
-       
-       SD_init(argc, argv);
-       SD_create_environment(argv[1]);
-       
-       task = create_empty_cost_root();
-       SD_simulate(-1.0);
-       SD_task_destroy(task);
-       
-       SD_application_reinit();
-       
-       task = create_empty_cost_root();
-       SD_simulate(-1.0);
-       SD_task_destroy(task);
-       
-       SD_simulate(-1.0);
-       
-       time = SD_get_clock();
-       printf("%g\n", time);
-       fflush(stdout);
-       
-       SD_exit();
+static void zero_cost_test(int *argc, char *argv[])
+{
+  double time;
+  SD_task_t task;
+
+  SD_init(argc, argv);
+  SD_create_environment(argv[1]);
+
+  task = create_empty_cost_root();
+  SD_simulate(-1.0);
+  SD_task_destroy(task);
+
+  SD_application_reinit();
+
+  task = create_empty_cost_root();
+  SD_simulate(-1.0);
+  SD_task_destroy(task);
+
+  SD_simulate(-1.0);
+
+  time = SD_get_clock();
+  printf("%g\n", time);
+  fflush(stdout);
+
+  SD_exit();
 }
 
-static SD_task_t create_root_with_costs() {
-       double comp_cost[] = { 0.0, 0.0 };
-       double comm_cost[] = { 0.0, 1.0, 0.0, 0.0 };
-       SD_task_t root;
+static SD_task_t create_root_with_costs()
+{
+  double comp_cost[] = { 0.0, 0.0 };
+  double comm_cost[] = { 0.0, 1.0, 0.0, 0.0 };
+  SD_task_t root;
+
+  root = SD_task_create("Root", NULL, 1.0);
+  SD_task_schedule(root, 2, SD_workstation_get_list(), comp_cost, comm_cost,
+                   -1.0);
 
-       root = SD_task_create("Root", NULL, 1.0);
-       SD_task_schedule(root, 2, SD_workstation_get_list(), comp_cost, comm_cost,
-                       -1.0);  
-       
-       return root;
+  return root;
 }
 
-static void zero_cost_test2(int *argc, char *argv[]) {
-       double time;
-       SD_task_t task;
-       
-       SD_init(argc, argv);
-       SD_create_environment(argv[1]);
-       
-       task = create_root_with_costs();
-       SD_simulate(-1.0);
-       SD_task_destroy(task);
-       
-       SD_application_reinit();
-       
-       task = create_empty_cost_root();
-       SD_simulate(-1.0);
-       SD_task_destroy(task);
-       
-       SD_simulate(-1.0);
-       
-       time = SD_get_clock();
-       printf("%g\n", time);
-       fflush(stdout);
-       
-       SD_exit();
+static void zero_cost_test2(int *argc, char *argv[])
+{
+  double time;
+  SD_task_t task;
+
+  SD_init(argc, argv);
+  SD_create_environment(argv[1]);
+
+  task = create_root_with_costs();
+  SD_simulate(-1.0);
+  SD_task_destroy(task);
+
+  SD_application_reinit();
+
+  task = create_empty_cost_root();
+  SD_simulate(-1.0);
+  SD_task_destroy(task);
+
+  SD_simulate(-1.0);
+
+  time = SD_get_clock();
+  printf("%g\n", time);
+  fflush(stdout);
+
+  SD_exit();
 }
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
   zero_cost_test(&argc, argv);
 
@@ -103,4 +109,3 @@ int main(int argc, char **argv) {
 
   return 0;
 }
-
index f453fa1..1da6d78 100644 (file)
 
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
-
-       double time;
-       double comm_amount[] = { 0.0, 0.0, 0.0, 0.0 };
-       double comp_cost[] = { 1.0, 1.0 };
-       
-       SD_task_t task;
-       
-       SD_init(&argc, argv);
-       SD_create_environment(argv[1]);
-       
-       task = SD_task_create("partask", NULL, 1.0);
-       SD_task_schedule(task, 2, SD_workstation_get_list(), comp_cost,
-                       comm_amount, -1.0);
-       
-       SD_simulate(-1.0);
-       
-       time = SD_get_clock();
-       
-       printf("%g\n", time);
-       fflush(stdout);
-       
-       SD_task_destroy(task);
-       
-       SD_exit();              
-       
-       return 0;
-}
+int main(int argc, char **argv)
+{
+
+  double time;
+  double comm_amount[] = { 0.0, 0.0, 0.0, 0.0 };
+  double comp_cost[] = { 1.0, 1.0 };
+
+  SD_task_t task;
+
+  SD_init(&argc, argv);
+  SD_create_environment(argv[1]);
+
+  task = SD_task_create("partask", NULL, 1.0);
+  SD_task_schedule(task, 2, SD_workstation_get_list(), comp_cost,
+                   comm_amount, -1.0);
+
+  SD_simulate(-1.0);
 
+  time = SD_get_clock();
+
+  printf("%g\n", time);
+  fflush(stdout);
+
+  SD_task_destroy(task);
+
+  SD_exit();
+
+  return 0;
+}
index 916154d..b27fe60 100644 (file)
 
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
-       double time;
-       double comm_amount[] = { 0.0 };
-       double comp_cost[] = { 1.0 };
+  double time;
+  double comm_amount[] = { 0.0 };
+  double comp_cost[] = { 1.0 };
 
-       SD_task_t task;
+  SD_task_t task;
 
-       SD_init(&argc, argv);
-       SD_create_environment(argv[1]);
+  SD_init(&argc, argv);
+  SD_create_environment(argv[1]);
 
-       task = SD_task_create("seqtask", NULL, 1.0);
-       SD_task_schedule(task, 1, SD_workstation_get_list(), comp_cost,
-                       comm_amount, -1.0);
+  task = SD_task_create("seqtask", NULL, 1.0);
+  SD_task_schedule(task, 1, SD_workstation_get_list(), comp_cost,
+                   comm_amount, -1.0);
 
-       SD_simulate(-1.0);
+  SD_simulate(-1.0);
 
-       time = SD_get_clock();
+  time = SD_get_clock();
 
-       printf("%g\n", time);
-       fflush(stdout);
+  printf("%g\n", time);
+  fflush(stdout);
 
-       SD_task_destroy(task);
+  SD_task_destroy(task);
 
-       SD_exit();
+  SD_exit();
 
-       return 0;
+  return 0;
 }
-
index 12705e9..d2a243e 100644 (file)
@@ -2,7 +2,8 @@
 #include <stdlib.h>
 #include "simdag/simdag.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   /* initialisation of SD */
   SD_init(&argc, argv);
 
@@ -12,4 +13,3 @@ int main(int argc, char **argv) {
   SD_exit();
   return 0;
 }
-
index dc4c3c8..33ea064 100644 (file)
 #include "xbt/dict.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(validator,
-                            "Logging specific to this SimDag example");
+                             "Logging specific to this SimDag example");
 
 static int name_compare_hosts(const void *n1, const void *n2)
 {
   char name1[80], name2[80];
-  strcpy(name1, SD_workstation_get_name(*((SD_workstation_t *)n1)));
-  strcpy(name2, SD_workstation_get_name(*((SD_workstation_t *)n2)));
+  strcpy(name1, SD_workstation_get_name(*((SD_workstation_t *) n1)));
+  strcpy(name2, SD_workstation_get_name(*((SD_workstation_t *) n2)));
 
-  return strcmp(name1,name2);
+  return strcmp(name1, name2);
 }
 
 static int name_compare_links(const void *n1, const void *n2)
 {
   char name1[80], name2[80];
-  strcpy(name1, SD_link_get_name(*((SD_link_t *)n1)));
-  strcpy(name2, SD_link_get_name(*((SD_link_t *)n2)));
+  strcpy(name1, SD_link_get_name(*((SD_link_t *) n1)));
+  strcpy(name2, SD_link_get_name(*((SD_link_t *) n2)));
 
-  return strcmp(name1,name2);
+  return strcmp(name1, name2);
 }
 
-int main(int argc, char **argv) {
-  char *platformFile=NULL;
+int main(int argc, char **argv)
+{
+  char *platformFile = NULL;
   int totalHosts, totalLinks, tmp_length;
-  int i,j,k;
+  int i, j, k;
   xbt_dict_t props = NULL;
-  xbt_dict_cursor_t cursor=NULL;
-  char *key,*data;
+  xbt_dict_cursor_t cursor = NULL;
+  char *key, *data;
 
   const SD_workstation_t *hosts;
   const SD_link_t *links, *tmp;
@@ -49,27 +50,27 @@ int main(int argc, char **argv) {
   SD_init(&argc, argv);
 
   platformFile = argv[1];
-  DEBUG1("%s",platformFile);
+  DEBUG1("%s", platformFile);
   SD_create_environment(platformFile);
 
-  printf ("<?xml version='1.0'?>\n");
-  printf ("<!DOCTYPE platform SYSTEM \"simgrid.dtd\">\n");
-  printf ("<platform version=\"2\">\n");
+  printf("<?xml version='1.0'?>\n");
+  printf("<!DOCTYPE platform SYSTEM \"simgrid.dtd\">\n");
+  printf("<platform version=\"2\">\n");
+
   totalHosts = SD_workstation_get_number();
   hosts = SD_workstation_get_list();
-  qsort((void *)hosts, totalHosts, sizeof(SD_workstation_t),
-       name_compare_hosts);
-  
-  for (i=0;i<totalHosts;i++){
-    printf("  <host id=\"%s\" power=\"%.0f\"", 
-          SD_workstation_get_name(hosts[i]),
-          SD_workstation_get_power(hosts[i]));
+  qsort((void *) hosts, totalHosts, sizeof(SD_workstation_t),
+        name_compare_hosts);
+
+  for (i = 0; i < totalHosts; i++) {
+    printf("  <host id=\"%s\" power=\"%.0f\"",
+           SD_workstation_get_name(hosts[i]),
+           SD_workstation_get_power(hosts[i]));
     props = SD_workstation_get_properties(hosts[i]);
-    if (xbt_dict_length(props)>0) {
+    if (xbt_dict_length(props) > 0) {
       printf(">\n");
-      xbt_dict_foreach(props,cursor,key,data) {
-       printf("    <prop id=\"%s\" value=\"%s\"/>\n",key,data);
+      xbt_dict_foreach(props, cursor, key, data) {
+        printf("    <prop id=\"%s\" value=\"%s\"/>\n", key, data);
       }
       printf("  </host>\n");
     } else {
@@ -79,43 +80,40 @@ int main(int argc, char **argv) {
 
   totalLinks = SD_link_get_number();
   links = SD_link_get_list();
-  qsort((void *)links, totalLinks, sizeof(SD_link_t),
-       name_compare_links);
-  
-  for (i=0;i<totalLinks;i++){
+  qsort((void *) links, totalLinks, sizeof(SD_link_t), name_compare_links);
+
+  for (i = 0; i < totalLinks; i++) {
     printf("  <link id=\"");
 
-    printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", 
-          SD_link_get_name(links[i]),
-          SD_link_get_current_bandwidth(links[i]),
-          SD_link_get_current_latency(links[i]));
-    if (SD_link_get_sharing_policy(links[i])== SD_LINK_SHARED) {
-      printf("/>\n"); 
+    printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"",
+           SD_link_get_name(links[i]),
+           SD_link_get_current_bandwidth(links[i]),
+           SD_link_get_current_latency(links[i]));
+    if (SD_link_get_sharing_policy(links[i]) == SD_LINK_SHARED) {
+      printf("/>\n");
     } else {
       printf(" sharing_policy=\"FATPIPE\"/>\n");
     }
   }
 
-  for (i=0;i<totalHosts;i++){
-    for (j=0;j<totalHosts;j++){
-      tmp = SD_route_get_list(hosts[i],hosts[j]);
-      if (tmp){
-       printf ("  <route src=\"%s\" dst=\"%s\">\n    ",
-               SD_workstation_get_name(hosts[i]),
-               SD_workstation_get_name(hosts[j]));
-      
-       tmp_length = SD_route_get_size(hosts[i],hosts[j]);
-       for (k=0; k<tmp_length;k++){
-         printf("<link:ctn id=\"%s\"/>", SD_link_get_name(tmp[k]));
-       }
-       printf("\n  </route>\n");
+  for (i = 0; i < totalHosts; i++) {
+    for (j = 0; j < totalHosts; j++) {
+      tmp = SD_route_get_list(hosts[i], hosts[j]);
+      if (tmp) {
+        printf("  <route src=\"%s\" dst=\"%s\">\n    ",
+               SD_workstation_get_name(hosts[i]),
+               SD_workstation_get_name(hosts[j]));
+
+        tmp_length = SD_route_get_size(hosts[i], hosts[j]);
+        for (k = 0; k < tmp_length; k++) {
+          printf("<link:ctn id=\"%s\"/>", SD_link_get_name(tmp[k]));
+        }
+        printf("\n  </route>\n");
       }
     }
   }
   printf("</platform>\n");
   SD_exit();
-  
+
   return 0;
 }
-
-
index 5759ec4..1255711 100644 (file)
 #include "gras.h"
 #include "xbt/synchro.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logs of this example");
-
-
-int main(int argc, char *argv[]){
-  char *tmp=bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s",
-                   1,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   2,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   3,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   4,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   5,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   6,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   7,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   8,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   9,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
-                   0,".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n");
-
-  xbt_init(&argc,argv);
-
-  INFO10("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s",tmp,tmp,tmp,tmp,tmp,tmp,tmp,tmp,tmp,tmp);
-  INFO1("Done (strlen>%d)",(int) (10*strlen(tmp)));
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example");
+
+
+int main(int argc, char *argv[])
+{
+  char *tmp = bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s",
+                      1,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      2,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      3,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      4,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      5,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      6,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      7,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      8,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      9,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n",
+                      0,
+                      ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n");
+
+  xbt_init(&argc, argv);
+
+  INFO10("This is a very large message:\n0%s1%s2%s3%s4%s5%s6%s7%s8%s9%s", tmp,
+         tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp);
+  INFO1("Done (strlen>%d)", (int) (10 * strlen(tmp)));
   free(tmp);
-   
+
   xbt_exit();
   return 0;
 }
index 0ced8a5..3d55f8c 100644 (file)
 #include "gras.h"
 #include "xbt/synchro.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest,"Logs of this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example");
 
 
-int test_amount = 99;    /* Up to 999 to not break the logs (and thus the testing mecanism) */
-int crasher_amount = 99; /* Up to 99  to not break the logs (and thus the testing mecanism) */
-int *id; /* to pass a pointer to the threads without race condition */
+int test_amount = 99;           /* Up to 999 to not break the logs (and thus the testing mecanism) */
+int crasher_amount = 99;        /* Up to 99  to not break the logs (and thus the testing mecanism) */
+int *id;                        /* to pass a pointer to the threads without race condition */
 
-int more_info=0; /* SET IT TO TRUE TO GET MORE INFO */
+int more_info = 0;              /* SET IT TO TRUE TO GET MORE INFO */
 
 /*
  * Some additionnal code to let the father wait the childs
@@ -29,36 +29,39 @@ int running_threads;
 xbt_mutex_t dead_end;
 
 /* Code ran by each thread */
-static void crasher_thread(void *arg) {
-   int id = *(int*)arg;
-   int i;
-
-   for (i=0; i<test_amount; i++) {
-     if (more_info)
-      INFO10("%03d (%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d)",test_amount-i,id,id,id,id,id,id,id,id,id);
-     else
-       INFO0("XXX (XX|XX|XX|XX|XX|XX|XX|XX|XX)");
-   }
-
-   xbt_mutex_acquire(mut_end);
-   running_threads--;
-   xbt_cond_signal(cond_end);
-   xbt_mutex_release(mut_end);
+static void crasher_thread(void *arg)
+{
+  int id = *(int *) arg;
+  int i;
+
+  for (i = 0; i < test_amount; i++) {
+    if (more_info)
+      INFO10("%03d (%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d|%02d)",
+             test_amount - i, id, id, id, id, id, id, id, id, id);
+    else
+      INFO0("XXX (XX|XX|XX|XX|XX|XX|XX|XX|XX)");
+  }
+
+  xbt_mutex_acquire(mut_end);
+  running_threads--;
+  xbt_cond_signal(cond_end);
+  xbt_mutex_release(mut_end);
 }
 
-int crasher (int argc,char *argv[]);
-int crasher (int argc,char *argv[]) {
+int crasher(int argc, char *argv[]);
+int crasher(int argc, char *argv[])
+{
   int i;
   xbt_thread_t *crashers;
 
-  gras_init(&argc,argv);
+  gras_init(&argc, argv);
 
   /* initializations of the philosopher mecanisms */
-  id = xbt_new0(int,crasher_amount);
-  crashers = xbt_new(xbt_thread_t,crasher_amount);
+  id = xbt_new0(int, crasher_amount);
+  crashers = xbt_new(xbt_thread_t, crasher_amount);
 
-  for (i=0; i<crasher_amount; i++)
-     id[i] = i;
+  for (i = 0; i < crasher_amount; i++)
+    id[i] = i;
 
   /* setup the ending mecanism */
   running_threads = crasher_amount;
@@ -66,26 +69,27 @@ int crasher (int argc,char *argv[]) {
   mut_end = xbt_mutex_init();
 
   /* spawn threads */
-  for (i=0; i<crasher_amount; i++) {
-     char *name = bprintf("thread %d",i);
-     crashers[i] = xbt_thread_create(name,&crasher_thread,&id[i]);
-     free(name);
+  for (i = 0; i < crasher_amount; i++) {
+    char *name = bprintf("thread %d", i);
+    crashers[i] = xbt_thread_create(name, &crasher_thread, &id[i]);
+    free(name);
   }
 
   /* wait for them */
   xbt_mutex_acquire(mut_end);
   while (running_threads)
-     xbt_cond_wait(cond_end,mut_end);
+    xbt_cond_wait(cond_end, mut_end);
   xbt_mutex_release(mut_end);
 
   gras_exit();
   return 0;
 }
 
-int main(int argc, char *argv[]){
+int main(int argc, char *argv[])
+{
   int errcode;
 
-  errcode=crasher(argc,argv);
+  errcode = crasher(argc, argv);
 
   return errcode;
 }
index 72b6ebb..b9cb902 100644 (file)
@@ -5,11 +5,12 @@
 #include "xbt/log.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
-                            "Logging specific to this SimDag example");
+                             "Logging specific to this SimDag example");
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   int i;
-  const charplatform_file;
+  const char *platform_file;
 
   const SD_workstation_t *workstations;
   SD_workstation_t w1;
@@ -32,15 +33,15 @@ int main(int argc, char **argv) {
   SD_init(&argc, argv);
 
   if (argc < 2) {
-     INFO1("Usage: %s platform_file", argv[0]);
-     INFO1("example: %s sd_platform.xml", argv[0]);
-     exit(1);
+    INFO1("Usage: %s platform_file", argv[0]);
+    INFO1("example: %s sd_platform.xml", argv[0]);
+    exit(1);
   }
 
   /* creation of the environment */
 
   platform_file = argv[1];
-  
+
   SD_create_environment(platform_file);
 
   /* test the estimation functions (use small_platform.xml) */
@@ -57,23 +58,27 @@ int main(int argc, char **argv) {
   taskD = SD_task_create("Task D", NULL, 60.0);
 
   INFO3("Computation time for %f flops on %s: %f", computation_amount1, name1,
-       SD_workstation_get_computation_time(w1, computation_amount1));
+        SD_workstation_get_computation_time(w1, computation_amount1));
   INFO3("Computation time for %f flops on %s: %f", computation_amount2, name2,
-       SD_workstation_get_computation_time(w2, computation_amount2));
+        SD_workstation_get_computation_time(w2, computation_amount2));
 
   INFO2("Route between %s and %s:", name1, name2);
   for (i = 0; i < route_size; i++) {
-    INFO3("\tLink %s: latency = %f, bandwidth = %f", SD_link_get_name(route[i]),
-         SD_link_get_current_latency(route[i]), SD_link_get_current_bandwidth(route[i]));
+    INFO3("\tLink %s: latency = %f, bandwidth = %f",
+          SD_link_get_name(route[i]), SD_link_get_current_latency(route[i]),
+          SD_link_get_current_bandwidth(route[i]));
   }
-  INFO2("Route latency = %f, route bandwidth = %f", SD_route_get_current_latency(w1, w2),
-       SD_route_get_current_bandwidth(w1, w2));
-  INFO4("Communication time for %f bytes between %s and %s: %f", communication_amount12, name1, name2,
-       SD_route_get_communication_time(w1, w2, communication_amount12));
-  INFO4("Communication time for %f bytes between %s and %s: %f", communication_amount21, name2, name1,
-       SD_route_get_communication_time(w2, w1, communication_amount21));
-
-  /* creation of the tasks and their dependencies */  
+  INFO2("Route latency = %f, route bandwidth = %f",
+        SD_route_get_current_latency(w1, w2),
+        SD_route_get_current_bandwidth(w1, w2));
+  INFO4("Communication time for %f bytes between %s and %s: %f",
+        communication_amount12, name1, name2,
+        SD_route_get_communication_time(w1, w2, communication_amount12));
+  INFO4("Communication time for %f bytes between %s and %s: %f",
+        communication_amount21, name2, name1,
+        SD_route_get_communication_time(w2, w1, communication_amount21));
+
+  /* creation of the tasks and their dependencies */
 
   SD_task_dependency_add(NULL, NULL, taskB, taskA);
   SD_task_dependency_add(NULL, NULL, taskC, taskA);
@@ -82,33 +87,34 @@ int main(int argc, char **argv) {
   /*  SD_task_dependency_add(NULL, NULL, taskA, taskD); /\* deadlock */
 
   TRY {
-    SD_task_dependency_add(NULL, NULL, taskA, taskA); /* shouldn't work and must raise an exception */
+    SD_task_dependency_add(NULL, NULL, taskA, taskA);   /* shouldn't work and must raise an exception */
     xbt_assert0(0, "Hey, I can add a dependency between Task A and Task A!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
   }
-  
+
   TRY {
-    SD_task_dependency_add(NULL, NULL, taskA, taskB); /* shouldn't work and must raise an exception */
+    SD_task_dependency_add(NULL, NULL, taskA, taskB);   /* shouldn't work and must raise an exception */
     xbt_assert0(0, "Oh oh, I can add an already existing dependency!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
   }
 
   SD_task_dependency_remove(taskA, taskB);
 
   TRY {
-    SD_task_dependency_remove(taskC, taskA); /* shouldn't work and must raise an exception */
+    SD_task_dependency_remove(taskC, taskA);    /* shouldn't work and must raise an exception */
     xbt_assert0(0, "Dude, I can remove an unknown dependency!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
   }
 
   TRY {
-    SD_task_dependency_remove(taskC, taskC); /* shouldn't work and must raise an exception */
-    xbt_assert0(0, "Wow, I can remove a dependency between Task C and itself!");
+    SD_task_dependency_remove(taskC, taskC);    /* shouldn't work and must raise an exception */
+    xbt_assert0(0,
+                "Wow, I can remove a dependency between Task C and itself!");
   }
-  CATCH (ex) {
+  CATCH(ex) {
   }
 
 
@@ -123,40 +129,40 @@ int main(int argc, char **argv) {
   /* scheduling parameters */
   {
     const int workstation_number = 2;
-    const SD_workstation_t workstation_list[] = {w1, w2};
-    double computation_amount[] = {computation_amount1, computation_amount2};
-    double communication_amount[] =
-      {
-       0, communication_amount12,
-       communication_amount21, 0
-      };
+    const SD_workstation_t workstation_list[] = { w1, w2 };
+    double computation_amount[] =
+      { computation_amount1, computation_amount2 };
+    double communication_amount[] = {
+      0, communication_amount12,
+      communication_amount21, 0
+    };
     SD_task_t *changed_tasks;
     double rate = -1.0;
-        
+
     /* estimated time */
     SD_task_t task = taskD;
     INFO2("Estimated time for '%s': %f", SD_task_get_name(task),
-         SD_task_get_execution_time(task, workstation_number, workstation_list,
-                                    computation_amount, communication_amount, rate));
-    
+          SD_task_get_execution_time(task, workstation_number,
+                                     workstation_list, computation_amount,
+                                     communication_amount, rate));
+
     /* let's launch the simulation! */
-    
+
     SD_task_schedule(taskA, workstation_number, workstation_list,
-                    computation_amount, communication_amount, rate);
+                     computation_amount, communication_amount, rate);
     SD_task_schedule(taskB, workstation_number, workstation_list,
-                    computation_amount, communication_amount, rate);
+                     computation_amount, communication_amount, rate);
     SD_task_schedule(taskC, workstation_number, workstation_list,
-                    computation_amount, communication_amount, rate);
+                     computation_amount, communication_amount, rate);
     SD_task_schedule(taskD, workstation_number, workstation_list,
-                    computation_amount, communication_amount, rate);
-    
+                     computation_amount, communication_amount, rate);
+
     changed_tasks = SD_simulate(-1.0);
     xbt_assert0(changed_tasks[0] == taskD &&
-               changed_tasks[1] == taskC &&
-               changed_tasks[2] == taskB &&
-               changed_tasks[3] == NULL,
-               "Unexpected simulation results");
-    
+                changed_tasks[1] == taskC &&
+                changed_tasks[2] == taskB &&
+                changed_tasks[3] == NULL, "Unexpected simulation results");
+
     xbt_free(changed_tasks);
   }
   DEBUG0("Destroying tasks...");
@@ -171,4 +177,3 @@ int main(int argc, char **argv) {
   SD_exit();
   return 0;
 }
-
index 3b534d9..2339813 100644 (file)
@@ -17,8 +17,7 @@
 #include "xbt/module.h"
 #include <math.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
-                            "Messages specific for surf example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 #define PRINT_VAR(var) DEBUG1(#var " = %g",lmm_variable_getvalue(var));
 #define SHOW_EXPR(expr) DEBUG1(#expr " = %g",expr);
@@ -37,7 +36,7 @@ typedef enum {
 } method_t;
 
 static double dichotomy(double func(double), double min, double max,
-                       double min_error)
+                        double min_error)
 {
   double middle;
   double min_func, max_func, middle_func;
@@ -59,7 +58,7 @@ static double dichotomy(double func(double), double min, double max,
   while (overall_error > min_error) {
     SHOW_EXPR(overall_error);
     if ((min_func > 0 && max_func > 0) ||
-       (min_func < 0 && max_func < 0) || (min_func > 0 && max_func < 0)) {
+        (min_func < 0 && max_func < 0) || (min_func > 0 && max_func < 0)) {
       abort();
     }
 
@@ -83,7 +82,7 @@ static double dichotomy(double func(double), double min, double max,
     } else if (middle_func > 0) {
       max = middle;
       max_func = middle_func;
-      overall_error = middle_func-min_func;
+      overall_error = middle_func - min_func;
     } else {
       overall_error = 0;
     }
@@ -96,10 +95,10 @@ double b_test_1 = 0;
 static double diff_lagrange_test_1(double x)
 {
   return -(3 / (1 + 3 * x * x / 2) -
-          3 / (2 * (3 * (a_test_1 - x) * (a_test_1 - x) / 2 + 1)) +
-          3 / (2 *
-               (3 * (b_test_1 - a_test_1 + x) *
-                (b_test_1 - a_test_1 + x) / 2 + 1)));
+           3 / (2 * (3 * (a_test_1 - x) * (a_test_1 - x) / 2 + 1)) +
+           3 / (2 *
+                (3 * (b_test_1 - a_test_1 + x) *
+                 (b_test_1 - a_test_1 + x) / 2 + 1)));
 }
 
 void test1(method_t method);
@@ -119,10 +118,10 @@ void test1(method_t method)
 
   if (method == LAGRANGE_VEGAS)
     lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
-                                     func_vegas_fpi);
+                                      func_vegas_fpi);
   else if (method == LAGRANGE_RENO)
     lmm_set_default_protocol_function(func_reno_f, func_reno_fpi,
-                                     func_reno_fpi);
+                                      func_reno_fpi);
 
   Sys = lmm_system_new();
   L1 = lmm_constraint_new(Sys, (void *) "L1", a);
@@ -158,7 +157,7 @@ void test1(method_t method)
 #endif
   } else if (method == LAGRANGE_VEGAS) {
     double x = 3 * a / 4 - 3 * b / 8 +
-       sqrt(9 * b * b + 4 * a * a - 4 * a * b) / 8;
+      sqrt(9 * b * b + 4 * a * a - 4 * a * b) / 8;
     /* Computed with mupad and D_f=1.0 */
     double max_deviation = 0.0;
     if (x > a) {
@@ -170,26 +169,24 @@ void test1(method_t method)
 
     lagrange_solve(Sys);
 
+    max_deviation = MAX(max_deviation, fabs(lmm_variable_getvalue(R_1) - x));
+    max_deviation = MAX(max_deviation, fabs(lmm_variable_getvalue(R_3) - x));
     max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_1) - x));
+      MAX(max_deviation, fabs(lmm_variable_getvalue(R_2) - (b - a + x)));
     max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_3) - x));
-    max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_2) - (b - a + x)));
-    max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_1_2_3) - (a - x)));
+      MAX(max_deviation, fabs(lmm_variable_getvalue(R_1_2_3) - (a - x)));
 
     if (max_deviation > MAXMIN_PRECISION) {
       WARN1("Max Deviation from optimal solution : %g", max_deviation);
       WARN1("Found x = %1.20f", x);
       WARN2("Deviation from optimal solution (R_1 = %g): %1.20f", x,
-           lmm_variable_getvalue(R_1) - x);
+            lmm_variable_getvalue(R_1) - x);
       WARN2("Deviation from optimal solution (R_2 = %g): %1.20f",
-           b - a + x, lmm_variable_getvalue(R_2) - (b - a + x));
+            b - a + x, lmm_variable_getvalue(R_2) - (b - a + x));
       WARN2("Deviation from optimal solution (R_3 = %g): %1.20f", x,
-           lmm_variable_getvalue(R_3) - x);
+            lmm_variable_getvalue(R_3) - x);
       WARN2("Deviation from optimal solution (R_1_2_3 = %g): %1.20f",
-           a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
+            a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
     }
   } else if (method == LAGRANGE_RENO) {
     double x;
@@ -205,26 +202,24 @@ void test1(method_t method)
       x = a;
     lagrange_solve(Sys);
 
+    max_deviation = MAX(max_deviation, fabs(lmm_variable_getvalue(R_1) - x));
+    max_deviation = MAX(max_deviation, fabs(lmm_variable_getvalue(R_3) - x));
     max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_1) - x));
-    max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_3) - x));
-    max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_2) - (b - a + x)));
+      MAX(max_deviation, fabs(lmm_variable_getvalue(R_2) - (b - a + x)));
     max_deviation =
-       MAX(max_deviation, fabs(lmm_variable_getvalue(R_1_2_3) - (a - x)));
+      MAX(max_deviation, fabs(lmm_variable_getvalue(R_1_2_3) - (a - x)));
 
     if (max_deviation > MAXMIN_PRECISION) {
       WARN1("Max Deviation from optimal solution : %g", max_deviation);
       WARN1("Found x = %1.20f", x);
       WARN2("Deviation from optimal solution (R_1 = %g): %1.20f", x,
-           lmm_variable_getvalue(R_1) - x);
+            lmm_variable_getvalue(R_1) - x);
       WARN2("Deviation from optimal solution (R_2 = %g): %1.20f",
-           b - a + x, lmm_variable_getvalue(R_2) - (b - a + x));
+            b - a + x, lmm_variable_getvalue(R_2) - (b - a + x));
       WARN2("Deviation from optimal solution (R_3 = %g): %1.20f", x,
-           lmm_variable_getvalue(R_3) - x);
+            lmm_variable_getvalue(R_3) - x);
       WARN2("Deviation from optimal solution (R_1_2_3 = %g): %1.20f",
-           a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
+            a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
     }
   } else {
     xbt_assert0(0, "Invalid method");
@@ -251,10 +246,10 @@ void test2(method_t method)
 
   if (method == LAGRANGE_VEGAS)
     lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
-                                     func_vegas_fpi);
+                                      func_vegas_fpi);
   else if (method == LAGRANGE_RENO)
     lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
-                                     func_reno_fpi);
+                                      func_reno_fpi);
 
   Sys = lmm_system_new();
   CPU1 = lmm_constraint_new(Sys, (void *) "CPU1", 200.0);
@@ -316,9 +311,9 @@ void test3(method_t method)
 
     1, 1, 1, 1, 1
   };
-       
-  /*A = xbt_new0(double*, links + 5);*/
-  A = xbt_new0(double*, links + 5);
+
+  /*A = xbt_new0(double*, links + 5); */
+  A = xbt_new0(double *, links + 5);
 
   for (i = 0; i < links + 5; i++) {
     A[i] = xbt_new0(double, flows + 5);
@@ -326,7 +321,7 @@ void test3(method_t method)
       A[i][j] = 0.0;
 
       if (i >= links || j >= flows) {
-       A[i][j] = 0.0;
+        A[i][j] = 0.0;
       }
     }
   }
@@ -403,21 +398,21 @@ void test3(method_t method)
 
   if (method == LAGRANGE_VEGAS)
     lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
-                                     func_vegas_fpi);
+                                      func_vegas_fpi);
   else if (method == LAGRANGE_RENO)
     lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
-                                     func_reno_fpi);
+                                      func_reno_fpi);
 
   Sys = lmm_system_new();
 
 
 
-  tmp_name = xbt_new0(char *,31);
+  tmp_name = xbt_new0(char *, 31);
 
   /*
    * Creates the constraints
    */
-  tmp_cnst = xbt_new0(lmm_constraint_t,15);
+  tmp_cnst = xbt_new0(lmm_constraint_t, 15);
   for (i = 0; i < 15; i++) {
     tmp_name[i] = bprintf("C_%03d", i);
     tmp_cnst[i] = lmm_constraint_new(Sys, (void *) tmp_name[i], B[i]);
@@ -427,11 +422,11 @@ void test3(method_t method)
   /*
    * Creates the variables
    */
-  tmp_var = xbt_new0(lmm_variable_t,16);
+  tmp_var = xbt_new0(lmm_variable_t, 16);
   for (j = 0; j < 16; j++) {
     tmp_name[i + j] = bprintf("X_%03d", j);
     tmp_var[j] =
-       lmm_variable_new(Sys, (void *) tmp_name[i + j], 1.0, -1.0, 15);
+      lmm_variable_new(Sys, (void *) tmp_name[i + j], 1.0, -1.0, 15);
     lmm_update_variable_weight(Sys, tmp_var[j], 1.0);
   }
 
@@ -441,7 +436,7 @@ void test3(method_t method)
   for (i = 0; i < 15; i++) {
     for (j = 0; j < 16; j++) {
       if (A[i][j]) {
-       lmm_expand(Sys, tmp_cnst[i], tmp_var[j], 1.0);
+        lmm_expand(Sys, tmp_cnst[i], tmp_var[j], 1.0);
       }
     }
   }
@@ -491,8 +486,8 @@ int main(int argc, char **argv)
   INFO0("***** Test 1 (Lagrange - Reno)");
   test1(LAGRANGE_RENO);
 
-   
-   
+
+
   INFO0("***** Test 2 (Max-Min)");
   test2(MAXMIN);
 #ifdef HAVE_SDP
index 6c0e34c..f462bfe 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdio.h>
 #include "surf/maxmin.h"
 #include "xbt/xbt_os_time.h"
-#include "xbt/sysdep.h"                /* time manipulation for benchmarking */
+#include "xbt/sysdep.h"         /* time manipulation for benchmarking */
 
 double date;
 
@@ -36,9 +36,9 @@ void test(int nb_cnst, int nb_var, int nb_elem);
 void test(int nb_cnst, int nb_var, int nb_elem)
 {
   lmm_system_t Sys = NULL;
-  lmm_constraint_t *cnst = xbt_new0(lmm_constraint_t,nb_cnst);
-  lmm_variable_t *var = xbt_new0(lmm_variable_t,nb_var);
-  int *used = xbt_new0(int,nb_cnst);
+  lmm_constraint_t *cnst = xbt_new0(lmm_constraint_t, nb_cnst);
+  lmm_variable_t *var = xbt_new0(lmm_variable_t, nb_var);
+  int *used = xbt_new0(int, nb_cnst);
   int i, j, k;
 
   Sys = lmm_system_new();
@@ -54,8 +54,8 @@ void test(int nb_cnst, int nb_var, int nb_elem)
     for (j = 0; j < nb_elem; j++) {
       k = int_random(nb_cnst);
       if (used[k]) {
-       j--;
-       continue;
+        j--;
+        continue;
       }
       lmm_expand(Sys, cnst[k], var[i], float_random(1.0));
       used[k] = 1;
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
   date = xbt_os_time() * 1000000;
   test(nb_cnst, nb_var, nb_elem);
   printf("One shot execution time for a total of %d constraints, "
-        "%d variables with %d active constraint each : %g microsecondes \n",
-        nb_cnst, nb_var, nb_elem, date);
+         "%d variables with %d active constraint each : %g microsecondes \n",
+         nb_cnst, nb_var, nb_elem, date);
   return 0;
 }
index 0120883..785f5f1 100644 (file)
@@ -6,7 +6,7 @@
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #ifdef __BORLANDC__
 #pragma hdrstop
 #endif
@@ -15,7 +15,7 @@
 #include "surf/surf.h"
 
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 const char *string_action(e_surf_action_state_t state);
 const char *string_action(e_surf_action_state_t state)
@@ -52,8 +52,8 @@ void test(char *platform)
   e_surf_action_state_t stateActionC;
   double now = -1.0;
 
-  surf_cpu_model_init_Cas01(platform); /* Now it is possible to use CPUs */
-  surf_network_model_init_CM02(platform);      /* Now it is possible to use eth0 */
+  surf_cpu_model_init_Cas01(platform);  /* Now it is possible to use CPUs */
+  surf_network_model_init_CM02(platform);       /* Now it is possible to use eth0 */
 
   parse_platform_file(platform);
 
@@ -64,9 +64,9 @@ void test(char *platform)
 
   /* Let's check that those two processors exist */
   DEBUG2("%s : %p",
-        surf_cpu_model->common_public->get_resource_name(cpuA), cpuA);
+         surf_cpu_model->common_public->get_resource_name(cpuA), cpuA);
   DEBUG2("%s : %p",
-        surf_cpu_model->common_public->get_resource_name(cpuB), cpuB);
+         surf_cpu_model->common_public->get_resource_name(cpuB), cpuB);
 
   /* Let's do something on it */
   actionA = surf_cpu_model->extension_public->execute(cpuA, 1000.0);
@@ -74,9 +74,9 @@ void test(char *platform)
   actionC = surf_cpu_model->extension_public->sleep(cpuB, 7.32);
 
   /* Use whatever calling style you want... */
-  stateActionA = surf_cpu_model->common_public->action_get_state(actionA);     /* When you know actionA model type */
-  stateActionB = actionB->model_type->common_public->action_get_state(actionB);        /* If you're unsure about it's model type */
-  stateActionC = surf_cpu_model->common_public->action_get_state(actionC);     /* When you know actionA model type */
+  stateActionA = surf_cpu_model->common_public->action_get_state(actionA);      /* When you know actionA model type */
+  stateActionB = actionB->model_type->common_public->action_get_state(actionB); /* If you're unsure about it's model type */
+  stateActionC = surf_cpu_model->common_public->action_get_state(actionC);      /* When you know actionA model type */
 
   /* And just look at the state of these tasks */
   DEBUG2("actionA : %p (%s)", actionA, string_action(stateActionA));
@@ -90,50 +90,48 @@ void test(char *platform)
 
   /* Let's check that those two processors exist */
   DEBUG2("%s : %p",
-        surf_network_model->common_public->get_resource_name(cardA),
-        cardA);
+         surf_network_model->common_public->get_resource_name(cardA), cardA);
   DEBUG2("%s : %p",
-        surf_network_model->common_public->get_resource_name(cardB),
-        cardB);
+         surf_network_model->common_public->get_resource_name(cardB), cardB);
 
   /* Let's do something on it */
   commAB =
-      surf_network_model->extension_public->communicate(cardA, cardB,
-                                                          150.0,-1.0);
+    surf_network_model->extension_public->communicate(cardA, cardB,
+                                                      150.0, -1.0);
 
-  surf_solve();                        /* Takes traces into account. Returns 0.0 */
+  surf_solve();                 /* Takes traces into account. Returns 0.0 */
   do {
     surf_action_t action = NULL;
     now = surf_get_clock();
     DEBUG1("Next Event : %g", now);
     DEBUG0("\t CPU actions");
     while ((action =
-           xbt_swag_extract(surf_cpu_model->common_public->states.
-                            failed_action_set))) {
+            xbt_swag_extract(surf_cpu_model->common_public->states.
+                             failed_action_set))) {
       DEBUG1("\t * Failed : %p", action);
       action->model_type->common_public->action_free(action);
     }
     while ((action =
-           xbt_swag_extract(surf_cpu_model->common_public->states.
-                            done_action_set))) {
+            xbt_swag_extract(surf_cpu_model->common_public->states.
+                             done_action_set))) {
       DEBUG1("\t * Done : %p", action);
       action->model_type->common_public->action_free(action);
     }
     DEBUG0("\t Network actions");
     while ((action =
-           xbt_swag_extract(surf_network_model->common_public->states.
-                            failed_action_set))) {
+            xbt_swag_extract(surf_network_model->common_public->states.
+                             failed_action_set))) {
       DEBUG1("\t * Failed : %p", action);
       action->model_type->common_public->action_free(action);
     }
     while ((action =
-           xbt_swag_extract(surf_network_model->common_public->states.
-                            done_action_set))) {
+            xbt_swag_extract(surf_network_model->common_public->states.
+                             done_action_set))) {
       DEBUG1("\t * Done : %p", action);
       action->model_type->common_public->action_free(action);
     }
 
-  } while (surf_solve()>=0.0);
+  } while (surf_solve() >= 0.0);
 
   DEBUG0("Simulation Terminated");
 }
@@ -144,10 +142,10 @@ void test(char *platform)
 
 int main(int argc, char **argv)
 {
-  surf_init(&argc, argv);      /* Initialize some common structures */
-  if(argc==1) {
-     fprintf(stderr,"Usage : %s platform.xml\n",argv[0]);
-     return 1;
+  surf_init(&argc, argv);       /* Initialize some common structures */
+  if (argc == 1) {
+    fprintf(stderr, "Usage : %s platform.xml\n", argv[0]);
+    return 1;
   }
   test(argv[1]);
 
index 9192bf7..ad38d7e 100644 (file)
@@ -14,7 +14,7 @@
 #include "surf/surf.h"
 
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 const char *string_action(e_surf_action_state_t state);
 const char *string_action(e_surf_action_state_t state)
@@ -48,7 +48,7 @@ void test(char *platform)
   double now = -1.0;
 
   int workstation_id =
-      find_model_description(surf_workstation_model_description,"CLM03");
+    find_model_description(surf_workstation_model_description, "CLM03");
 
   surf_workstation_model_description[workstation_id].model_init(platform);
   parse_platform_file(platform);
@@ -56,35 +56,31 @@ void test(char *platform)
     surf_workstation_model_description[workstation_id].create_ws();
 
   /*********************** WORKSTATION ***********************************/
-  workstationA =
-      surf_workstation_model->common_public->name_service("Cpu A");
-  workstationB =
-      surf_workstation_model->common_public->name_service("Cpu B");
+  workstationA = surf_workstation_model->common_public->name_service("Cpu A");
+  workstationB = surf_workstation_model->common_public->name_service("Cpu B");
 
   /* Let's check that those two processors exist */
   DEBUG2("%s : %p",
-        surf_workstation_model->common_public->
-        get_resource_name(workstationA), workstationA);
+         surf_workstation_model->common_public->
+         get_resource_name(workstationA), workstationA);
   DEBUG2("%s : %p",
-        surf_workstation_model->common_public->
-        get_resource_name(workstationB), workstationB);
+         surf_workstation_model->common_public->
+         get_resource_name(workstationB), workstationB);
 
   /* Let's do something on it */
   actionA =
-      surf_workstation_model->extension_public->execute(workstationA,
-                                                          1000.0);
+    surf_workstation_model->extension_public->execute(workstationA, 1000.0);
   actionB =
-      surf_workstation_model->extension_public->execute(workstationB,
-                                                          1000.0);
+    surf_workstation_model->extension_public->execute(workstationB, 1000.0);
   actionC =
-      surf_workstation_model->extension_public->sleep(workstationB,
-                                                        7.32);
+    surf_workstation_model->extension_public->sleep(workstationB, 7.32);
 
   commAB =
-      surf_workstation_model->extension_public->
-      communicate(workstationA, workstationB, 150.0, -1.0);
+    surf_workstation_model->extension_public->communicate(workstationA,
+                                                          workstationB, 150.0,
+                                                          -1.0);
 
-  surf_solve();                        /* Takes traces into account. Returns 0.0 */
+  surf_solve();                 /* Takes traces into account. Returns 0.0 */
   do {
     surf_action_t action = NULL;
     unsigned int iter;
@@ -96,19 +92,19 @@ void test(char *platform)
     xbt_dynar_foreach(model_list, iter, model) {
       DEBUG1("\t %s actions", model->common_public->name);
       while ((action =
-            xbt_swag_extract(model->common_public->states.
-                             failed_action_set))) {
-       DEBUG1("\t * Failed : %p", action);
-       model->common_public->action_free(action);
+              xbt_swag_extract(model->common_public->states.
+                               failed_action_set))) {
+        DEBUG1("\t * Failed : %p", action);
+        model->common_public->action_free(action);
       }
       while ((action =
-            xbt_swag_extract(model->common_public->states.
-                             done_action_set))) {
-       DEBUG1("\t * Done : %p", action);
-       model->common_public->action_free(action);
+              xbt_swag_extract(model->common_public->states.
+                               done_action_set))) {
+        DEBUG1("\t * Done : %p", action);
+        model->common_public->action_free(action);
       }
     }
-  } while (surf_solve()>=0.0);
+  } while (surf_solve() >= 0.0);
 
   DEBUG0("Simulation Terminated");
 
@@ -120,11 +116,11 @@ void test(char *platform)
 
 int main(int argc, char **argv)
 {
-  surf_init(&argc, argv);      /* Initialize some common structures */
-  if(argc==1) {
-     fprintf(stderr,"Usage : %s platform.txt\n",argv[0]);
-     surf_exit();
-     return 1;
+  surf_init(&argc, argv);       /* Initialize some common structures */
+  if (argc == 1) {
+    fprintf(stderr, "Usage : %s platform.txt\n", argv[0]);
+    surf_exit();
+    return 1;
   }
   test(argv[1]);
 
index 5082646..1d0dcb3 100644 (file)
@@ -17,7 +17,7 @@
 #include "surf/surf.h"
 
 #include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,"Messages specific for surf example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
 void test(void);
 void test(void)
@@ -37,7 +37,7 @@ void test(void)
   while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
     DEBUG1("%g" " : \n", next_event_date);
     while (tmgr_history_get_next_event_leq(history, next_event_date,
-                                          &value, (void **) &resource)) {
+                                           &value, (void **) &resource)) {
       DEBUG2("\t %s : " "%g" "\n", resource, value);
     }
     if (next_event_date > 1000)
@@ -56,7 +56,7 @@ void test(void)
 
 int main(int argc, char **argv)
 {
-  surf_init(&argc,argv);
+  surf_init(&argc, argv);
   test();
   surf_exit();
   return 0;
index 1392e23..60798a1 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "xbt.h"
 #include "xbt/context.h"
-#include "portable.h" /* To know whether we're using threads or context */
+#include "portable.h"           /* To know whether we're using threads or context */
 #include "xbt/fifo.h"
 
 xbt_context_t cA = NULL;
@@ -12,28 +12,28 @@ xbt_context_t cB = NULL;
 xbt_context_t cC = NULL;
 xbt_fifo_t fifo = NULL;
 
-void print_args(int argc, char** argv);
-void print_args(int argc, char** argv)
+void print_args(int argc, char **argv);
+void print_args(int argc, char **argv)
 {
-  int i ; 
+  int i;
 
   printf("args=<");
-  for(i=0; i<argc; i++) 
-    printf("%s ",argv[i]);
+  for (i = 0; i < argc; i++)
+    printf("%s ", argv[i]);
   printf(">\n");
 }
 
-int fA(int argc, char** argv);
-int fA(int argc, char** argv)
+int fA(int argc, char **argv);
+int fA(int argc, char **argv)
 {
   printf("Here is fA: ");
-  print_args(argc,argv);
+  print_args(argc, argv);
 
 /*   printf("\tContext A: Yield\n"); */
 /*   xbt_context_yield(); // FIXME: yielding to itself fails, no idea why */
-   
+
   printf("\tContext A: Push context B\n");
-  xbt_fifo_push(fifo,cB);
+  xbt_fifo_push(fifo, cB);
 
   printf("\tContext A: Yield\n");
   xbt_context_yield();
@@ -43,17 +43,17 @@ int fA(int argc, char** argv)
   return 0;
 }
 
-int fB(int argc, char** argv);
-int fB(int argc, char** argv)
+int fB(int argc, char **argv);
+int fB(int argc, char **argv)
 {
   printf("Here is fB: ");
-  print_args(argc,argv);
+  print_args(argc, argv);
 
   printf("\tContext B: Yield\n");
   xbt_context_yield();
 
   printf("\tContext B: Push context A\n");
-  xbt_fifo_push(fifo,cA);
+  xbt_fifo_push(fifo, cA);
 
   printf("\tContext B: Yield\n");
   xbt_context_yield();
@@ -63,11 +63,11 @@ int fB(int argc, char** argv)
   return 0;
 }
 
-int fC(int argc, char** argv);
-int fC(int argc, char** argv)
+int fC(int argc, char **argv);
+int fC(int argc, char **argv)
 {
   printf("Here is fC: ");
-  print_args(argc,argv);
+  print_args(argc, argv);
 
   printf("\tContext C: Yield\n");
   xbt_context_yield();
@@ -81,7 +81,7 @@ int fC(int argc, char** argv)
 #pragma argsused
 #endif
 
-int main(int argc, char** argv)
+int main(int argc, char **argv)
 {
   xbt_context_t context = NULL;
 
@@ -90,31 +90,32 @@ int main(int argc, char** argv)
   printf("XXX Using threads as a backend.\n");
 #else /* use SUSv2 contexts */
   printf("XXX Using SUSv2 contexts as a backend.\n");
-  printf("    If it fails, try another context backend.\n    For example, to force the pthread backend, use:\n       ./configure --with-context=pthread\n\n");
+  printf
+    ("    If it fails, try another context backend.\n    For example, to force the pthread backend, use:\n       ./configure --with-context=pthread\n\n");
 #endif
-   
+
   xbt_init(&argc, argv);
 
-  cA = xbt_context_new("A",fA, NULL, NULL, NULL, NULL, 0, NULL);
-  cB = xbt_context_new("B",fB, NULL, NULL, NULL, NULL, 0, NULL);
-  cC = xbt_context_new("C",fC, NULL, NULL, NULL, NULL, 0, NULL);
+  cA = xbt_context_new("A", fA, NULL, NULL, NULL, NULL, 0, NULL);
+  cB = xbt_context_new("B", fB, NULL, NULL, NULL, NULL, 0, NULL);
+  cC = xbt_context_new("C", fC, NULL, NULL, NULL, NULL, 0, NULL);
 
   fifo = xbt_fifo_new();
 
   printf("Here is context 'main'\n");
-  printf("\tPush context 'A' (%p) from context 'main'\n",cA);
-  xbt_fifo_push(fifo,cA); 
+  printf("\tPush context 'A' (%p) from context 'main'\n", cA);
+  xbt_fifo_push(fifo, cA);
   xbt_context_start(cA);
 
-  printf("\tPush context 'B' (%p) from context 'main'\n",cB);
-  xbt_fifo_push(fifo,cB);
+  printf("\tPush context 'B' (%p) from context 'main'\n", cB);
+  xbt_fifo_push(fifo, cB);
   xbt_context_start(cB);
 
-  printf("\tPush context 'C' (%p) from context 'main'\n",cC);
-  xbt_fifo_push(fifo,cC); 
+  printf("\tPush context 'C' (%p) from context 'main'\n", cC);
+  xbt_fifo_push(fifo, cC);
   xbt_context_start(cC);
 
-  while((context=xbt_fifo_shift(fifo))) {
+  while ((context = xbt_fifo_shift(fifo))) {
     printf("Context main: schedule\n");
     xbt_context_schedule(context);
   }
@@ -123,8 +124,8 @@ int main(int argc, char** argv)
   xbt_fifo_free(fifo);
   printf("\tExit & cleaning living threads\n");
   xbt_exit();
-  
-  cA=cB=cC=NULL;
+
+  cA = cB = cC = NULL;
   printf("Context main: Bye\n");
   return 0;
 }
index f0e63f9..3df9512 100644 (file)
@@ -7,9 +7,9 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 #ifdef __BORLANDC__
- #pragma hdrstop
- #endif
+#pragma hdrstop
+#endif
+
 #include <stdio.h>
 
 #ifdef _MSC_VER
@@ -26,11 +26,12 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to graphxml test");
 
 
 static void *node_label_and_data(xbt_node_t node, const char *label,
-                                const char *data)
+                                 const char *data)
 {
   char *lbl = xbt_strdup(label);
   return lbl;
 }
+
 #define free_label free
 
 static const char *node_name(xbt_node_t n)
@@ -55,15 +56,13 @@ void test(char *graph_file)
   xbt_dynar_t edges = NULL;
   xbt_dynar_t nodes = NULL;
 
-  xbt_graph_t graph =
-      xbt_graph_read(graph_file, &node_label_and_data, NULL);
+  xbt_graph_t graph = xbt_graph_read(graph_file, &node_label_and_data, NULL);
 
   n = xbt_dynar_length(xbt_graph_get_nodes(graph));
 
   if (test_export_xml) {
     INFO0("---- Testing XML export. Exporting to testgraph.xml ----");
-    xbt_graph_export_graphxml(graph, "testgraph.xml", NULL, NULL, NULL,
-                             NULL);
+    xbt_graph_export_graphxml(graph, "testgraph.xml", NULL, NULL, NULL, NULL);
   }
   if (test_export_dot) {
     INFO0("---- Testing GraphViz export. Exporting to testgraph.dot ----");
@@ -76,10 +75,10 @@ void test(char *graph_file)
 
     INFO0("---- Dumping Edge lengths ----");
     adj = xbt_graph_get_length_matrix(graph);
-    buf = xbt_new0(char,n * 20);
+    buf = xbt_new0(char, n * 20);
     for (i = 0; i < n; i++) {
       for (j = 0; j < n; j++) {
-       sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]);
+        sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]);
       }
       INFO1("%s", buf);
       buf[0] = '\000';
@@ -91,15 +90,15 @@ void test(char *graph_file)
   if (test_shortest_paths) {
     char *buf = NULL;
     xbt_node_t *route = NULL;
-  
+
     INFO0("---- Testing Shortest Paths ----");
     route = xbt_graph_shortest_paths(graph);
-    buf = xbt_new0(char,n * 40);
+    buf = xbt_new0(char, n * 40);
     for (i = 0; i < n; i++) {
       for (j = 0; j < n; j++) {
-       if (route[i * n + j])
-         snprintf(buf+strlen(buf), 40, "%s\t", 
-                  node_name(route[i * n + j]));
+        if (route[i * n + j])
+          snprintf(buf + strlen(buf), 40, "%s\t",
+                   node_name(route[i * n + j]));
       }
       INFO1("%s", buf);
       buf[0] = '\000';
@@ -115,7 +114,7 @@ void test(char *graph_file)
     sorted = xbt_graph_topo_sort(graph);
     for (i = 0; i < n; i++) {
       if (sorted[i]) {
-       INFO3("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]);
+        INFO3("sorted[%lu] = %s (%p)", i, node_name(sorted[i]), sorted[i]);
       }
     }
     free(sorted);
@@ -127,14 +126,14 @@ void test(char *graph_file)
     nodes = xbt_graph_get_nodes(graph);
     edges = xbt_graph_get_edges(graph);
     INFO2("Before Node deletion: %lu nodes, %lu edges",
-         xbt_dynar_length(nodes), xbt_dynar_length(edges));
+          xbt_dynar_length(nodes), xbt_dynar_length(edges));
 
     while (xbt_dynar_length(nodes))
       xbt_graph_free_node(graph,
-                         *((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)),
-                         free_label, NULL);
+                          *((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)),
+                          free_label, NULL);
     INFO2("After Node deletion:  %lu nodes, %lu edges",
-         xbt_dynar_length(nodes), xbt_dynar_length(edges));
+          xbt_dynar_length(nodes), xbt_dynar_length(edges));
   }
 
   if (test_edge_deletion) {
@@ -142,15 +141,15 @@ void test(char *graph_file)
     nodes = xbt_graph_get_nodes(graph);
     edges = xbt_graph_get_edges(graph);
     INFO2("Before Edge deletion: %lu nodes, %lu edges",
-         xbt_dynar_length(nodes), xbt_dynar_length(edges));
+          xbt_dynar_length(nodes), xbt_dynar_length(edges));
 
     while (xbt_dynar_length(edges))
       xbt_graph_free_edge(graph,
-                         *((xbt_edge_t *) xbt_dynar_get_ptr(edges, 0)),
-                         NULL);
+                          *((xbt_edge_t *) xbt_dynar_get_ptr(edges, 0)),
+                          NULL);
 
     INFO2("After Edge deletion:  %lu nodes, %lu edges",
-         xbt_dynar_length(nodes), xbt_dynar_length(edges));
+          xbt_dynar_length(nodes), xbt_dynar_length(edges));
   }
 
   xbt_graph_free_graph(graph, free_label, NULL, NULL);
@@ -158,9 +157,10 @@ void test(char *graph_file)
 
 #ifdef __BORLANDC__
 #pragma argsused
-#endif 
+#endif
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   xbt_init(&argc, argv);
   if (argc == 1) {
     fprintf(stderr, "Usage : %s graph.xml\n", argv[0]);
index ccab791..b13d065 100644 (file)
@@ -6,19 +6,19 @@
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
- #ifdef __BORLANDC__
- #pragma hdrstop
- #endif
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
 
 #include "xbt/heap.h"
-#include "gras/virtu.h"                /* time manipulation in bench */
+#include "gras/virtu.h"         /* time manipulation in bench */
 
-#include "xbt/sysdep.h" /* calloc, printf */
+#include "xbt/sysdep.h"         /* calloc, printf */
 
 #define MAX_TEST 1000000
 
@@ -30,7 +30,7 @@ int compare_double(const void *a, const void *b);
 
 void test_heap_validity(int size);
 void test_heap_mean_operation(int size);
-void test_reset_heap(xbt_heap_t heap,int size);
+void test_reset_heap(xbt_heap_t heap, int size);
 
 
 int compare_double(const void *a, const void *b)
@@ -50,13 +50,13 @@ int compare_double(const void *a, const void *b)
 void test_heap_validity(int size)
 {
   xbt_heap_t heap = xbt_heap_new(size, NULL);
-  double *tab = xbt_new0(double,size);
+  double *tab = xbt_new0(double, size);
 
   int i;
 
   for (i = 0; i < size; i++) {
-    tab[i] = (double)(10.0 * rand() / (RAND_MAX + 1.0));
-    xbt_heap_push(heap, NULL, (double)tab[i]);
+    tab[i] = (double) (10.0 * rand() / (RAND_MAX + 1.0));
+    xbt_heap_push(heap, NULL, (double) tab[i]);
   }
 
   qsort(tab, size, sizeof(double), compare_double);
@@ -90,28 +90,28 @@ void test_heap_mean_operation(int size)
 
   date = gras_os_time() * 1000000;
   for (j = 0; j < MAX_TEST; j++) {
-    
-    if(!(j%size) && j)
-      test_reset_heap(heap,size);
-    
+
+    if (!(j % size) && j)
+      test_reset_heap(heap, size);
+
     val = xbt_heap_maxkey(heap);
     xbt_heap_pop(heap);
     xbt_heap_push(heap, NULL, 3.0 * val);
   }
   date = gras_os_time() * 1000000 - date;
   printf("Mean access time for a %d size heap : %g\n", size,
-        date * 1.0 / (MAX_TEST + 0.0));
+         date * 1.0 / (MAX_TEST + 0.0));
 
   xbt_heap_free(heap);
 }
 
-void test_reset_heap(xbt_heap_t heap,int size)
+void test_reset_heap(xbt_heap_t heap, int size)
 {
   int i;
   xbt_heap_free(heap);
   heap = xbt_heap_new(size, NULL);
 
-  for (i = 0; i < size; i++){
+  for (i = 0; i < size; i++) {
     xbt_heap_push(heap, NULL, (10.0 * rand() / (RAND_MAX + 1.0)));
   }
 
@@ -119,7 +119,7 @@ void test_reset_heap(xbt_heap_t heap,int size)
 
 #ifdef __BORLANDC__
 #pragma argsused
-#endif 
+#endif
 
 int main(int argc, char **argv)
 {
index 80a2160..5be8fbd 100644 (file)
@@ -6,7 +6,7 @@
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #ifdef __BORLANDC__
 #pragma hdrstop
 #endif
 
 
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(test, top,"Logging specific to this test");
-XBT_LOG_NEW_CATEGORY(top,"Useless test channel");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(test, top, "Logging specific to this test");
+XBT_LOG_NEW_CATEGORY(top, "Useless test channel");
 
 #ifdef __BORLANDC__
 #pragma argsused
 #endif
 
-static void dolog(const char *settings) {
-  INFO1("Test with the settings '%s'",settings);
+static void dolog(const char *settings)
+{
+  INFO1("Test with the settings '%s'", settings);
   xbt_log_control_set(settings);
   DEBUG1("val=%d", 1);
   WARN1("val=%d", 2);
   CDEBUG2(top, "val=%d%s", 3, "!");
-  CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!");   
+  CRITICAL6("false alarm%s%s%s%s%s%s", "", "", "", "", "", "!");
 }
 
 
-int main(int argc, char **argv) {
-  xbt_init(&argc,argv);
+int main(int argc, char **argv)
+{
+  xbt_init(&argc, argv);
 
   dolog("");
   dolog(" ");
@@ -41,7 +43,7 @@ int main(int argc, char **argv) {
   dolog(" test.thres:debug ");
   dolog(" test.thres:verbose root.thres:error ");
   dolog(" test.thres:critical ");
-  
+
   xbt_exit();
   return 0;
 }
index 01c6688..189f7b6 100644 (file)
@@ -35,34 +35,30 @@ void generate_makefile_am(char *project, char *deployment);
 void generate_makefile_local(char *project, char *deployment);
 
 /* the gras.h header directory (used only in windows)*/
-extern char__gras_path;
+extern char *__gras_path;
 
 /*
  * Generate a borland simulation poject file.
  * @param name The name of the simulation project
  */
-void
-generate_borland_simulation_project(const char* name);
+void generate_borland_simulation_project(const char *name);
 
 /*
  * Generate a borland project file for real life.
  * @param name The name of the project to create.
  */
-void
-generate_borland_real_life_project(const char* name);
+void generate_borland_real_life_project(const char *name);
 
 
 /*
  * Create the Microsoft visual C++ file project for the simulation.
  */
-int
-generate_simulation_dsp_file(const char* project_name);
+int generate_simulation_dsp_file(const char *project_name);
 
 /*
  * Create the Microsoft visual C++ real life project file.
  */
-int
-generate_real_live_dsp_file(const char* project_name);
+int generate_real_live_dsp_file(const char *project_name);
 
 
 #endif
index fbba2ff..5236452 100644 (file)
 #include "xbt/log.h"
 #include "surf/surfxml_parse.h"
 #include "surf/surf.h"
-#include "portable.h" /* Needed for the time of the SIMIX convertion */
+#include "portable.h"           /* Needed for the time of the SIMIX convertion */
 
 #include "gras_stub_generator.h"
 #include <stdarg.h>
 
 
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen,gras,"Stub generator");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen, gras, "Stub generator");
 
 
 #ifdef _WIN32
@@ -46,10 +46,11 @@ xbt_dict_t process_function_set = NULL;
 xbt_dynar_t process_list = NULL;
 xbt_dict_t machine_set = NULL;
 
-void s_process_free(void *process) {
-  s_process_t*p = (s_process_t*)process;
+void s_process_free(void *process)
+{
+  s_process_t *p = (s_process_t *) process;
   int i;
-  for (i=0; i<p->argc ; i++)
+  for (i = 0; i < p->argc; i++)
     free(p->argv[i]);
   free(p->argv);
   free(p->host);
@@ -61,11 +62,11 @@ static void parse_process_init(void)
 {
   xbt_dict_set(process_function_set, A_surfxml_process_function, NULL, NULL);
   xbt_dict_set(machine_set, A_surfxml_process_host, NULL, NULL);
-  process.argc = 1 ;
-  process.argv = xbt_new(char*,1);
+  process.argc = 1;
+  process.argv = xbt_new(char *, 1);
   process.argv[0] = xbt_strdup(A_surfxml_process_function);
-  process.host=strdup(A_surfxml_process_host);
-  /*VERB1("Function: %s",A_surfxml_process_function);*/
+  process.host = strdup(A_surfxml_process_host);
+  /*VERB1("Function: %s",A_surfxml_process_function); */
 }
 
 static void parse_argument(void)
@@ -77,13 +78,13 @@ static void parse_argument(void)
 
 static void parse_process_finalize(void)
 {
-  xbt_dynar_push(process_list,&process);
-  /*VERB1("Function: %s",process.argv[0]);*/
+  xbt_dynar_push(process_list, &process);
+  /*VERB1("Function: %s",process.argv[0]); */
 }
 
 void surfxml_add_callback(xbt_dynar_t cb_list, void_f_void_t function)
 {
-   xbt_dynar_push(cb_list, &function);
+  xbt_dynar_push(cb_list, &function);
 }
 
 
@@ -92,67 +93,70 @@ int main(int argc, char *argv[])
   char *project_name = NULL;
   char *deployment_file = NULL;
   int i;
-   
+
   surf_init(&argc, argv);
   process_function_set = xbt_dict_new();
-  process_list = xbt_dynar_new(sizeof(s_process_t),s_process_free);
+  process_list = xbt_dynar_new(sizeof(s_process_t), s_process_free);
   machine_set = xbt_dict_new();
 
-  for (i=1; i<argc; i++) {
-     int need_removal = 0;
-     if (!strncmp("--extra-process=",argv[i], strlen("--extra-process="))) {
-       xbt_dict_set(process_function_set, argv[i]+strlen("--extra-process="), NULL, NULL);
-       need_removal = 1;
-     }
-     
-     
-     if (need_removal) { /* remove the handled argument from argv */
-       int j;  
-       for (j=i+1; j<argc; j++) {
-          argv[j-1] = argv[j];
-       }
-       argv[j-1] = NULL;
-       argc--;
-       i--; /* compensate effect of next loop incrementation */
-     }
+  for (i = 1; i < argc; i++) {
+    int need_removal = 0;
+    if (!strncmp("--extra-process=", argv[i], strlen("--extra-process="))) {
+      xbt_dict_set(process_function_set, argv[i] + strlen("--extra-process="),
+                   NULL, NULL);
+      need_removal = 1;
+    }
+
+
+    if (need_removal) {         /* remove the handled argument from argv */
+      int j;
+      for (j = i + 1; j < argc; j++) {
+        argv[j - 1] = argv[j];
+      }
+      argv[j - 1] = NULL;
+      argc--;
+      i--;                      /* compensate effect of next loop incrementation */
+    }
   }
-       
-  xbt_assert1((argc >= 3),"Usage: %s project_name deployment_file [deployment_file...]\n",argv[0]);
+
+  xbt_assert1((argc >= 3),
+              "Usage: %s project_name deployment_file [deployment_file...]\n",
+              argv[0]);
 
   project_name = argv[1];
 
   surf_parse_reset_parser();
-  DEBUG2("%p %p",parse_process_init,&parse_process_init);
+  DEBUG2("%p %p", parse_process_init, &parse_process_init);
   surfxml_add_callback(STag_surfxml_process_cb_list, &parse_process_init);
   surfxml_add_callback(ETag_surfxml_argument_cb_list, &parse_argument);
   surfxml_add_callback(ETag_surfxml_process_cb_list, &parse_process_finalize);
-  
-  for(i=2; i<argc; i++) {
-     deployment_file = argv[i];
-     surf_parse_open(deployment_file);
-     if(surf_parse()) 
-       xbt_assert1(0,"Parse error in %s",deployment_file);
-     
-     surf_parse_close();
+
+  for (i = 2; i < argc; i++) {
+    deployment_file = argv[i];
+    surf_parse_open(deployment_file);
+    if (surf_parse())
+      xbt_assert1(0, "Parse error in %s", deployment_file);
+
+    surf_parse_close();
   }
 
 
-  warning = xbt_new(char,strlen(WARN)+strlen(deployment_file)+10);
-  sprintf(warning,WARN,deployment_file);
+  warning = xbt_new(char, strlen(WARN) + strlen(deployment_file) + 10);
+  sprintf(warning, WARN, deployment_file);
 
   /*if(XBT_LOG_ISENABLED(stubgen, xbt_log_priority_debug)) {
-    xbt_dict_cursor_t cursor=NULL;
-    char *key = NULL;
-    void *data = NULL;
-
-    for (cursor=NULL, xbt_dict_cursor_first((process_function_set),&(cursor)) ;
-        xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));
-        xbt_dict_cursor_step(cursor) ) {
-      DEBUG1("Function %s", key);      
-    }
-    
-    xbt_dict_dump(process_function_set,print);
-  }*/
+     xbt_dict_cursor_t cursor=NULL;
+     char *key = NULL;
+     void *data = NULL;
+
+     for (cursor=NULL, xbt_dict_cursor_first((process_function_set),&(cursor)) ;
+     xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));
+     xbt_dict_cursor_step(cursor) ) {
+     DEBUG1("Function %s", key);      
+     }
+
+     xbt_dict_dump(process_function_set,print);
+     } */
 
   generate_sim(project_name);
   generate_rl(project_name);
@@ -163,8 +167,8 @@ int main(int argc, char *argv[])
   generate_simulation_dsp_file(project_name);
   generate_real_live_dsp_file(project_name);
 
-  if(__gras_path)
-    xbt_free(__gras_path);   
+  if (__gras_path)
+    xbt_free(__gras_path);
 #endif
 
   free(warning);
index 34f9944..b5bc335 100644 (file)
@@ -19,7 +19,7 @@
 #include "xbt/log.h"
 #include "surf/surfxml_parse.h"
 #include "surf/surf.h"
-#include "portable.h" /* Needed for the time of the SIMIX convertion */
+#include "portable.h"           /* Needed for the time of the SIMIX convertion */
 #include "gras_stub_generator.h"
 
 #include <stdarg.h>
 
 #ifdef _WIN32
 /* stupid stubs so that it compiles on windows */
-void generate_sim(char *project) {}
-void generate_rl(char *project) {}
-void generate_makefile_local(char *project, char *deployment) {}
-#else 
+void generate_sim(char *project)
+{
+}
+
+void generate_rl(char *project)
+{
+}
+
+void generate_makefile_local(char *project, char *deployment)
+{
+}
+#else
 /* real implementation */
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(stubgen);
 
@@ -58,16 +66,14 @@ char *warning = NULL;
 /**********************************************/
 
 const char *SIM_PREEMBULE =
-"/* specific to Borland Compiler */\n"
-"#ifdef __BORLANDC__\n"
-"#pragma hdrstop\n"
-"#endif\n\n"
-"#include <stdlib.h>\n"
-"#include <stdio.h>\n"
-"#include \"msg/msg.h\"\n"
-"#include <gras.h>\n"
-"\n"
-"char *gras_log=NULL;\n";
+  "/* specific to Borland Compiler */\n"
+  "#ifdef __BORLANDC__\n"
+  "#pragma hdrstop\n"
+  "#endif\n\n"
+  "#include <stdlib.h>\n"
+  "#include <stdio.h>\n"
+  "#include \"msg/msg.h\"\n"
+  "#include <gras.h>\n" "\n" "char *gras_log=NULL;\n";
 
 
 #define SIM_LAUNCH_FUNC  \
@@ -90,370 +96,362 @@ const char *SIM_PREEMBULE =
 "}\n"
 
 const char *SIM_MAIN_POSTEMBULE = "\n"
-"\n"
-"  gras_launch_application(argv[2]);\n"
-"\n"
-"  /*  Run the simulation */\n"
-"  gras_main();\n"
-"\n"
-"  /* cleanup the place */\n"
-"  gras_clean();\n"
-"  if (gras_log)\n"
-"    free(gras_log);\n"
-"  return 0;\n"
-"}\n";
-
-
-
-
-void generate_sim(char *project) {
-   xbt_dict_cursor_t cursor=NULL;
-   char *key = NULL;
-   void *data = NULL;
-   char *filename = NULL;
-   FILE *OUT = NULL;
-   
-   /* Output file: <projet>_simulator.c */
-   filename = xbt_new(char,strlen(project) + strlen(SIM_SOURCENAME));
-   sprintf(filename,SIM_SOURCENAME,project);
-   
-   OUT=fopen(filename,"w");
-   
-   xbt_assert1(OUT, "Unable to open %s for writing",filename);
-   
-   fprintf(OUT, "%s\n",warning);
-   fprintf(OUT, "%s", SIM_PREEMBULE);
-   
-   xbt_dict_foreach(process_function_set,cursor,key,data) {
-      fprintf(OUT,"int %s(int argc,char *argv[]);\n",key);
-   }
-   
-   fprintf(OUT,"\n");
-   
-   xbt_dict_foreach(process_function_set,cursor,key,data) {
-      fprintf(OUT,"int launch_%s(int argc,char *argv[]);\n",key);
-   }
-   
-   fprintf(OUT, "\n%s\n",warning);
-   
-   xbt_dict_foreach(process_function_set,cursor,key,data) {
-      fprintf(OUT,SIM_LAUNCH_FUNC,key,key);
-   }
-   fprintf(OUT, "\n%s\n",warning);
-   
-   fprintf(OUT,"%s", "/* specific to Borland Compiler */\n"
-          "#ifdef __BORLANDDC__\n"
-          "#pragma argsused\n"
-          "#endif\n\n");
-   
-   fprintf(OUT, "%s", "int main (int argc,char *argv[]) {\n"
-          "\n" 
-          "  /*  Simulation setup */\n" 
-          "  gras_global_init(&argc,argv);\n"
-          "  if (argc != 3) {\n" 
-          "    fprintf(stderr, \"Usage: %s platform.xml deployment.xml [--log=...]\\n\",argv[0]);\n" 
-          "    exit(1);\n" 
-          "  }\n"
-          "\n");
-   fprintf(OUT,
-          "  gras_create_environment(argv[1]);\n" 
-          "\n" 
-          "  /*  Application deployment */\n"
-          );
-   xbt_dict_foreach(process_function_set,cursor,key,data) {
-      fprintf(OUT,"  gras_function_register(\"%s\", launch_%s);\n",key,key);
-   }
-   fprintf(OUT, "%s", SIM_MAIN_POSTEMBULE);
-   fclose(OUT);
-   free(filename);
+  "\n"
+  "  gras_launch_application(argv[2]);\n"
+  "\n"
+  "  /*  Run the simulation */\n"
+  "  gras_main();\n"
+  "\n"
+  "  /* cleanup the place */\n"
+  "  gras_clean();\n"
+  "  if (gras_log)\n" "    free(gras_log);\n" "  return 0;\n" "}\n";
+
+
+
+
+void generate_sim(char *project)
+{
+  xbt_dict_cursor_t cursor = NULL;
+  char *key = NULL;
+  void *data = NULL;
+  char *filename = NULL;
+  FILE *OUT = NULL;
+
+  /* Output file: <projet>_simulator.c */
+  filename = xbt_new(char, strlen(project) + strlen(SIM_SOURCENAME));
+  sprintf(filename, SIM_SOURCENAME, project);
+
+  OUT = fopen(filename, "w");
+
+  xbt_assert1(OUT, "Unable to open %s for writing", filename);
+
+  fprintf(OUT, "%s\n", warning);
+  fprintf(OUT, "%s", SIM_PREEMBULE);
+
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, "int %s(int argc,char *argv[]);\n", key);
+  }
+
+  fprintf(OUT, "\n");
+
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, "int launch_%s(int argc,char *argv[]);\n", key);
+  }
+
+  fprintf(OUT, "\n%s\n", warning);
+
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, SIM_LAUNCH_FUNC, key, key);
+  }
+  fprintf(OUT, "\n%s\n", warning);
+
+  fprintf(OUT, "%s", "/* specific to Borland Compiler */\n"
+          "#ifdef __BORLANDDC__\n" "#pragma argsused\n" "#endif\n\n");
+
+  fprintf(OUT, "%s", "int main (int argc,char *argv[]) {\n"
+          "\n"
+          "  /*  Simulation setup */\n"
+          "  gras_global_init(&argc,argv);\n"
+          "  if (argc != 3) {\n"
+          "    fprintf(stderr, \"Usage: %s platform.xml deployment.xml [--log=...]\\n\",argv[0]);\n"
+          "    exit(1);\n" "  }\n" "\n");
+  fprintf(OUT,
+          "  gras_create_environment(argv[1]);\n"
+          "\n" "  /*  Application deployment */\n");
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, "  gras_function_register(\"%s\", launch_%s);\n", key, key);
+  }
+  fprintf(OUT, "%s", SIM_MAIN_POSTEMBULE);
+  fclose(OUT);
+  free(filename);
 }
 
 /**********************************************/
 /**** Generate the file for the real life *****/
 /**********************************************/
-void generate_rl(char *project) {
-  xbt_dict_cursor_t cursor=NULL;
+void generate_rl(char *project)
+{
+  xbt_dict_cursor_t cursor = NULL;
   char *key = NULL;
   void *data = NULL;
   char *filename = NULL;
   FILE *OUT = NULL;
 
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-    filename = xbt_new(char,strlen(project) + strlen(RL_SOURCENAME) + strlen(key));
-
-       sprintf(filename,RL_SOURCENAME,project,key);
-
-    OUT=fopen(filename,"w");
-    xbt_assert1(OUT, "Unable to open %s for writing",filename);
-
-    fprintf(OUT, "\n%s\n",warning);
-    fprintf(OUT, "/* specific to Borland Compiler */\n" \
-                 "#ifdef __BORLANDC__\n" \
-                 "#pragma hdrstop\n" \
-                 "#endif\n\n" \
-                 "#include <stdio.h>\n" \
-                 "#include <signal.h>\n" \
-                 "#include <gras.h>\n" \
-                 "\n" \
-                 "XBT_PUBLIC_DATA(const char *) _gras_procname;\n" \
-                 "/* user code */\n" \
-                 "int %s(int argc, char *argv[]);\n" \
-                 "\n" \
-                 "/* specific to Borland Compiler */\n" \
-                "#ifdef __BORLANDC__\n" \
-                "#pragma argsused\n" \
-                "#endif\n\n" \
-                 "int main(int argc, char *argv[]){\n" \
-                 "  int errcode;\n" \
-                 "\n" \
-                 "  _gras_procname = \"%s\";\n" \
-                 "  errcode=%s(argc,argv);\n"\
-                 " \n" \
-                 "  return errcode;\n"\
-                 "}\n",
-           key,key,key);
-    fprintf(OUT, "\n%s\n",warning);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    filename =
+      xbt_new(char, strlen(project) + strlen(RL_SOURCENAME) + strlen(key));
+
+    sprintf(filename, RL_SOURCENAME, project, key);
+
+    OUT = fopen(filename, "w");
+    xbt_assert1(OUT, "Unable to open %s for writing", filename);
+
+    fprintf(OUT, "\n%s\n", warning);
+    fprintf(OUT, "/* specific to Borland Compiler */\n"
+            "#ifdef __BORLANDC__\n"
+            "#pragma hdrstop\n"
+            "#endif\n\n"
+            "#include <stdio.h>\n"
+            "#include <signal.h>\n"
+            "#include <gras.h>\n"
+            "\n"
+            "XBT_PUBLIC_DATA(const char *) _gras_procname;\n"
+            "/* user code */\n"
+            "int %s(int argc, char *argv[]);\n"
+            "\n"
+            "/* specific to Borland Compiler */\n"
+            "#ifdef __BORLANDC__\n"
+            "#pragma argsused\n"
+            "#endif\n\n"
+            "int main(int argc, char *argv[]){\n"
+            "  int errcode;\n"
+            "\n"
+            "  _gras_procname = \"%s\";\n"
+            "  errcode=%s(argc,argv);\n"
+            " \n" "  return errcode;\n" "}\n", key, key, key);
+    fprintf(OUT, "\n%s\n", warning);
     fclose(OUT);
     free(filename);
   }
 }
 
-void generate_makefile_am(char *project, char *deployment) {
-  xbt_dict_cursor_t cursor=NULL;
+void generate_makefile_am(char *project, char *deployment)
+{
+  xbt_dict_cursor_t cursor = NULL;
   char *key = NULL;
   void *data = NULL;
   char *filename = NULL;
   FILE *OUT = NULL;
 
-  filename = xbt_new(char,strlen(project) + strlen(MAKEFILE_FILENAME_AM));
-  sprintf(filename,MAKEFILE_FILENAME_AM, project);
+  filename = xbt_new(char, strlen(project) + strlen(MAKEFILE_FILENAME_AM));
+  sprintf(filename, MAKEFILE_FILENAME_AM, project);
 
-  OUT=fopen(filename,"w");
-  xbt_assert1(OUT, "Unable to open %s for writing",filename);
+  OUT = fopen(filename, "w");
+  xbt_assert1(OUT, "Unable to open %s for writing", filename);
 
   fprintf(OUT, "# AUTOMAKE variable definition\n");
   fprintf(OUT, "INCLUDES= @CFLAGS_SimGrid@\n\n");
   fprintf(OUT, "PROGRAMS=");
-  fprintf(OUT, SIM_BINARYNAME,project);
+  fprintf(OUT, SIM_BINARYNAME, project);
 
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
     fprintf(OUT, " ");
     fprintf(OUT, RL_BINARYNAME, project, key);
   }
 
   fprintf(OUT, "\n\n");
-  fprintf(OUT, SIM_SOURCENAME_SOURCES,project);
+  fprintf(OUT, SIM_SOURCENAME_SOURCES, project);
   fprintf(OUT, "=\t");
-  fprintf(OUT, SIM_SOURCENAME,project);
+  fprintf(OUT, SIM_SOURCENAME, project);
   fprintf(OUT, " %s.c\n", project);
   fprintf(OUT, SIM_SOURCENAME_LDADD, project);
   fprintf(OUT, "=\tpath/to/libsimgrid.a\n\n");
 
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-    fprintf(OUT, RL_SOURCENAME_SOURCES, project,key);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, RL_SOURCENAME_SOURCES, project, key);
     fprintf(OUT, "=\t");
-    fprintf(OUT, RL_SOURCENAME, project,key);
+    fprintf(OUT, RL_SOURCENAME, project, key);
     fprintf(OUT, " %s.c\n", project);
     fprintf(OUT, RL_SOURCENAME_LDADD, project, key);
     fprintf(OUT, "=\tpath/to/libgras.a\n\n");
   }
 
-  fprintf(OUT, "\n# cleanup temps (allowing the user to add extra clean files)\n");
+  fprintf(OUT,
+          "\n# cleanup temps (allowing the user to add extra clean files)\n");
   fprintf(OUT, "CLEANFILES?= \n");
   fprintf(OUT, "CLEANFILES+= ");
   fprintf(OUT, SIM_SOURCENAME, project);
-  
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
+
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
     fprintf(OUT, " ");
-    fprintf(OUT, RL_SOURCENAME, project,key);
+    fprintf(OUT, RL_SOURCENAME, project, key);
   }
   fprintf(OUT, "\n");
 
   fprintf(OUT, "\n# generate temps\n");
-  fprintf(OUT, "\n# A rule to generate the source file each time the deployment file changes\n");
+  fprintf(OUT,
+          "\n# A rule to generate the source file each time the deployment file changes\n");
 
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-    fprintf(OUT, RL_SOURCENAME, project,key);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, RL_SOURCENAME, project, key);
     fprintf(OUT, " ");
   }
   fprintf(OUT, SIM_SOURCENAME, project);
   fprintf(OUT, ": %s\n", deployment);
-  fprintf(OUT, "\tgras_stub_generator %s %s >/dev/null\n", project, deployment);
+  fprintf(OUT, "\tgras_stub_generator %s %s >/dev/null\n", project,
+          deployment);
   fclose(OUT);
 }
 
-void generate_makefile_local(char *project, char *deployment) {
-  xbt_dict_cursor_t cursor=NULL;
+void generate_makefile_local(char *project, char *deployment)
+{
+  xbt_dict_cursor_t cursor = NULL;
   char *key = NULL;
   void *data = NULL;
   char *filename = NULL;
   FILE *OUT = NULL;
 
-  filename = xbt_new(char,strlen(project) + strlen(MAKEFILE_FILENAME_LOCAL));
-  sprintf(filename,MAKEFILE_FILENAME_LOCAL, project);
-  
-  OUT=fopen(filename,"w");
-  xbt_assert1(OUT, "Unable to open %s for writing",filename);
+  filename = xbt_new(char, strlen(project) + strlen(MAKEFILE_FILENAME_LOCAL));
+  sprintf(filename, MAKEFILE_FILENAME_LOCAL, project);
+
+  OUT = fopen(filename, "w");
+  xbt_assert1(OUT, "Unable to open %s for writing", filename);
   free(filename);
-   
+
   fprintf(OUT,
-         "\n"
-         "####\n"
-         "#### THIS FILE WAS GENERATED, DO NOT EDIT BEFORE RENAMING IT\n"
-         "####\n\n\n");
-
-  fprintf(OUT,"## Variable declarations\n"
-              "PROJECT_NAME=%s\n"
-             "DISTDIR=gras-$(PROJECT_NAME)\n\n"
-         ,project);
-   
+          "\n"
+          "####\n"
+          "#### THIS FILE WAS GENERATED, DO NOT EDIT BEFORE RENAMING IT\n"
+          "####\n\n\n");
+
+  fprintf(OUT, "## Variable declarations\n"
+          "PROJECT_NAME=%s\n" "DISTDIR=gras-$(PROJECT_NAME)\n\n", project);
+
   fprintf(OUT,
-         "# Set the GRAS_ROOT environment variable to the path under which you installed SimGrid\n"
-         "# Compilation will fail if you don't do so\n" 
-         "GRAS_ROOT?= $(shell if [ -e /usr/local/lib/libgras.so ] ; then echo /usr/local ; else echo \"\\\"<<<< GRAS_ROOT undefined !!! >>>>\\\"\"; fi)\n\n"
-         "# You can fiddle the following to make it fit your taste\n"
-         "INCLUDES = -I$(GRAS_ROOT)/include\n"
-         "CFLAGS ?= -O3 -w -g -Wall\n"
-         "LIBS_SIM = -lm  -L$(GRAS_ROOT)/lib/ -lsimgrid\n"
-         "LIBS_RL = -lm  -L$(GRAS_ROOT)/lib/ -lgras\n"
-         "LIBS = \n"
-         "\n");
+          "# Set the GRAS_ROOT environment variable to the path under which you installed SimGrid\n"
+          "# Compilation will fail if you don't do so\n"
+          "GRAS_ROOT?= $(shell if [ -e /usr/local/lib/libgras.so ] ; then echo /usr/local ; else echo \"\\\"<<<< GRAS_ROOT undefined !!! >>>>\\\"\"; fi)\n\n"
+          "# You can fiddle the following to make it fit your taste\n"
+          "INCLUDES = -I$(GRAS_ROOT)/include\n"
+          "CFLAGS ?= -O3 -w -g -Wall\n"
+          "LIBS_SIM = -lm  -L$(GRAS_ROOT)/lib/ -lsimgrid\n"
+          "LIBS_RL = -lm  -L$(GRAS_ROOT)/lib/ -lgras\n" "LIBS = \n" "\n");
 
   fprintf(OUT, "PRECIOUS_C_FILES ?= %s.c\n", project);
 
   fprintf(OUT, "GENERATED_C_FILES = ");
-  fprintf(OUT, SIM_SOURCENAME" ",project);
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-    fprintf(OUT, RL_SOURCENAME " ",project, key);
+  fprintf(OUT, SIM_SOURCENAME " ", project);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, RL_SOURCENAME " ", project, key);
   }
   fprintf(OUT, "\n");
 
-  fprintf(OUT,"OBJ_FILES = $(patsubst %%.c,%%.o,$(PRECIOUS_C_FILES))\n");
+  fprintf(OUT, "OBJ_FILES = $(patsubst %%.c,%%.o,$(PRECIOUS_C_FILES))\n");
 
   fprintf(OUT, "BIN_FILES = ");
 
-  fprintf(OUT, SIM_BINARYNAME " ",project);
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
+  fprintf(OUT, SIM_BINARYNAME " ", project);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
     fprintf(OUT, RL_BINARYNAME " ", project, key);
   }
   fprintf(OUT, "\n");
 
   fprintf(OUT,
-         "\n"
-         "## By default, build all the binaries\n"
-         "all: $(BIN_FILES)\n"
-         "\n");
-   
-  fprintf(OUT, "\n## generate temps: regenerate the source file each time the deployment file changes\n");
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-    fprintf(OUT, RL_SOURCENAME, project,key);
+          "\n"
+          "## By default, build all the binaries\n"
+          "all: $(BIN_FILES)\n" "\n");
+
+  fprintf(OUT,
+          "\n## generate temps: regenerate the source file each time the deployment file changes\n");
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, RL_SOURCENAME, project, key);
     fprintf(OUT, " ");
   }
   fprintf(OUT, SIM_SOURCENAME, project);
   fprintf(OUT, ": %s\n", deployment);
-  fprintf(OUT, "\tgras_stub_generator %s %s >/dev/null\n", project, deployment);
+  fprintf(OUT, "\tgras_stub_generator %s %s >/dev/null\n", project,
+          deployment);
 
   fprintf(OUT, "\n## Generate the binaries\n");
-  fprintf(OUT, SIM_BINARYNAME ": " SIM_OBJNAME " $(OBJ_FILES)\n",project, project);
-  fprintf(OUT, "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS_SIM) $(LIBS) $(LDADD) -o $@ \n");
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-    fprintf(OUT, RL_BINARYNAME " : " RL_OBJNAME " $(OBJ_FILES)\n", project, key, project, key);
-    fprintf(OUT, "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS_RL) $(LIBS) $(LDADD) -o $@ \n");
-  }  
-  fprintf(OUT, 
-         "\n"
-         "%%: %%.o\n"
-         "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@ \n"
-         "\n"
-         "%%.o: %%.c\n"
-         "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<\n"
-         "\n");
-   
+  fprintf(OUT, SIM_BINARYNAME ": " SIM_OBJNAME " $(OBJ_FILES)\n", project,
+          project);
   fprintf(OUT,
-         "## Rules for tarballs and cleaning\n"
-         "DIST_FILES= $(EXTRA_DIST) $(GENERATED_C_FILES) $(PRECIOUS_C_FILES) "MAKEFILE_FILENAME_LOCAL" " /*MAKEFILE_FILENAME_REMOTE*/"\n"
-         "distdir: $(DIST_FILES)\n"
-         "\trm -rf $(DISTDIR)\n"
-         "\tmkdir -p $(DISTDIR)\n"
-         "\tcp $^ $(DISTDIR)\n"
-         "\n"
-         "dist: clean distdir\n"
-         "\ttar c $(DISTDIR) | gzip -c9 > $(DISTDIR).tar.gz\n"
-         "\n", project /*, project*/);
+          "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS_SIM) $(LIBS) $(LDADD) -o $@ \n");
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, RL_BINARYNAME " : " RL_OBJNAME " $(OBJ_FILES)\n", project,
+            key, project, key);
+    fprintf(OUT,
+            "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS_RL) $(LIBS) $(LDADD) -o $@ \n");
+  }
+  fprintf(OUT,
+          "\n"
+          "%%: %%.o\n"
+          "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@ \n"
+          "\n"
+          "%%.o: %%.c\n"
+          "\t$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<\n" "\n");
+
+  fprintf(OUT,
+          "## Rules for tarballs and cleaning\n"
+          "DIST_FILES= $(EXTRA_DIST) $(GENERATED_C_FILES) $(PRECIOUS_C_FILES) "
+          MAKEFILE_FILENAME_LOCAL " " /*MAKEFILE_FILENAME_REMOTE */ "\n"
+          "distdir: $(DIST_FILES)\n" "\trm -rf $(DISTDIR)\n"
+          "\tmkdir -p $(DISTDIR)\n" "\tcp $^ $(DISTDIR)\n" "\n"
+          "dist: clean distdir\n"
+          "\ttar c $(DISTDIR) | gzip -c9 > $(DISTDIR).tar.gz\n" "\n",
+          project /*, project */ );
 
   fprintf(OUT,
-         "clean:\n"
-         "\trm -f $(CLEANFILES) $(BIN_FILES) $(OBJ_FILES) *~ %s.o " SIM_OBJNAME, project, project);
-  xbt_dict_foreach(process_function_set,cursor,key,data) {
-     fprintf(OUT, " " RL_OBJNAME, project, key);
+          "clean:\n"
+          "\trm -f $(CLEANFILES) $(BIN_FILES) $(OBJ_FILES) *~ %s.o "
+          SIM_OBJNAME, project, project);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    fprintf(OUT, " " RL_OBJNAME, project, key);
   }
-  fprintf(OUT,   
-         "\n"
-         "\trm -rf $(DISTDIR)\n"
-         "\n"
-         ".SUFFIXES:\n"
-         ".PHONY : clean\n"
-         "\n");
+  fprintf(OUT,
+          "\n"
+          "\trm -rf $(DISTDIR)\n"
+          "\n" ".SUFFIXES:\n" ".PHONY : clean\n" "\n");
   /* 
-  fprintf(OUT, "############ REMOTE COMPILING #########\n");
-  fprintf(OUT, 
-         "MACHINES ?= ");
-  xbt_dict_foreach(machine_set,cursor,key,data) {
-    fprintf(OUT, "%s ",key);
-  }
-  fprintf(OUT,"\n");
-
-  fprintf(OUT, 
-         "INSTALL_PATH ?='$$HOME/tmp/src' ### Has to be an absolute path !!! \n"
-         "GRAS_ROOT ?='$(INSTALL_PATH)' ### Has to be an absolute path !!! \n"
-         "SRCDIR ?= ./\n"
-         "SIMGRID_URL ?=http://gcl.ucsd.edu/simgrid/dl/\n"
-         "SIMGRID_VERSION ?=2.92\n"
-         "GRAS_PROJECT ?= %s\n"
-         "GRAS_PROJECT_URL ?= http://www-id.imag.fr/Laboratoire/Membres/Legrand_Arnaud/gras_test/\n"
-         "\n"
-         "remote:\n"
-         "\t@echo;echo \"----[ Compile the package on remote hosts ]----\"\n"
-         "\t@test -e $(SRCDIR)/buildlogs/ || mkdir -p $(SRCDIR)/buildlogs/\n"
-         "\t for site in $(MACHINES) ; do \\\n"
-         "\t   machine=`echo $$site |sed 's/^\\([^%%]*\\)%%.*$$/\\1/'`;\\\n"
-         "\t   machine2=`echo $$site |sed 's/^\\([^%%]*\\)%%\\(.*\\)$$/\\2/'`;\\\n"
-         "\t   cmd_mkdir=\"\\\"sh -c 'env INSTALL_PATH=$(INSTALL_PATH) GRAS_ROOT=$(GRAS_ROOT) \\\n"
-         "\t                        SIMGRID_URL=$(SIMGRID_URL) SIMGRID_VERSION=$(SIMGRID_VERSION) GRAS_PROJECT=$(GRAS_PROJECT) \\\n"
-         "\t                        GRAS_PROJECT_URL=$(GRAS_PROJECT_URL)  mkdir -p $(INSTALL_PATH) 2>&1'\\\"\";\\\n"
-         "\t   cmd_make=\"\\\"sh -c 'env INSTALL_PATH=$(INSTALL_PATH) GRAS_ROOT=$(GRAS_ROOT) \\\n"
-         "\t                        SIMGRID_URL=$(SIMGRID_URL) SIMGRID_VERSION=$(SIMGRID_VERSION) GRAS_PROJECT=$(GRAS_PROJECT) \\\n"
-         "\t                        GRAS_PROJECT_URL=$(GRAS_PROJECT_URL)  make -C $(INSTALL_PATH) -f "MAKEFILE_FILENAME_REMOTE" $(ACTION) 2>&1'\\\"\";\\\n"
-         "\t   if echo $$site | grep  '%%' >/dev/null ; then \\\n"
-         "\t     echo \"----[ Compile on $$machine2 (behind $$machine) ]----\";\\\n"
-         "\t   else \\\n"
-         "\t     machine=$$site;\\\n"
-         "\t     echo \"----[ Compile on $$machine ]----\";\\\n"
-         "\t   fi;\\\n"
-         "\t   if echo $$site | grep  '%%' >/dev/null ; then \\\n"
-         "\t     if ssh $$machine \"ssh -A $$machine2 $$cmd_mkdir\" 2>&1 > $(SRCDIR)/buildlogs/$$site.log;\\\n"
-         "\t     then true; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi;\\\n"
-         "\t   else \\\n"
-         "\t     if ssh $$machine \"eval $$cmd_mkdir\" 2>&1 > $(SRCDIR)/buildlogs/$$site.log ;\\\n"
-         "\t     then true; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi; \\\n"
-         "\t   fi;\\\n"
-         "\t   echo \"-- Copy the data over\"; \\\n"
-         "\t   scp "MAKEFILE_FILENAME_REMOTE" $$site:$(INSTALL_PATH) ;\\\n"
-         "\t   echo \"-- Compiling... (the output gets into $(SRCDIR)/buildlogs/$$site.log)\"; \\\n"
-         "\t   if echo $$site | grep  '%%' >/dev/null ; then \\\n"
-         "\t     if ssh $$machine \"ssh -A $$machine2 $$cmd_make\" 2>&1 >> $(SRCDIR)/buildlogs/$$site.log;\\\n"
-         "\t     then echo \"Sucessful\"; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi;echo; \\\n"
-         "\t   else \\\n"
-         "\t     if ssh $$machine \"eval $$cmd_make\" 2>&1 >> $(SRCDIR)/buildlogs/$$site.log ;\\\n"
-         "\t     then echo \"Sucessful\"; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi;echo; \\\n"
-         "\t   fi;\\\n"
-         "\t done;\n",project,project,project);
-*/
+     fprintf(OUT, "############ REMOTE COMPILING #########\n");
+     fprintf(OUT, 
+     "MACHINES ?= ");
+     xbt_dict_foreach(machine_set,cursor,key,data) {
+     fprintf(OUT, "%s ",key);
+     }
+     fprintf(OUT,"\n");
+
+     fprintf(OUT, 
+     "INSTALL_PATH ?='$$HOME/tmp/src' ### Has to be an absolute path !!! \n"
+     "GRAS_ROOT ?='$(INSTALL_PATH)' ### Has to be an absolute path !!! \n"
+     "SRCDIR ?= ./\n"
+     "SIMGRID_URL ?=http://gcl.ucsd.edu/simgrid/dl/\n"
+     "SIMGRID_VERSION ?=2.92\n"
+     "GRAS_PROJECT ?= %s\n"
+     "GRAS_PROJECT_URL ?= http://www-id.imag.fr/Laboratoire/Membres/Legrand_Arnaud/gras_test/\n"
+     "\n"
+     "remote:\n"
+     "\t@echo;echo \"----[ Compile the package on remote hosts ]----\"\n"
+     "\t@test -e $(SRCDIR)/buildlogs/ || mkdir -p $(SRCDIR)/buildlogs/\n"
+     "\t for site in $(MACHINES) ; do \\\n"
+     "\t   machine=`echo $$site |sed 's/^\\([^%%]*\\)%%.*$$/\\1/'`;\\\n"
+     "\t   machine2=`echo $$site |sed 's/^\\([^%%]*\\)%%\\(.*\\)$$/\\2/'`;\\\n"
+     "\t   cmd_mkdir=\"\\\"sh -c 'env INSTALL_PATH=$(INSTALL_PATH) GRAS_ROOT=$(GRAS_ROOT) \\\n"
+     "\t                        SIMGRID_URL=$(SIMGRID_URL) SIMGRID_VERSION=$(SIMGRID_VERSION) GRAS_PROJECT=$(GRAS_PROJECT) \\\n"
+     "\t                        GRAS_PROJECT_URL=$(GRAS_PROJECT_URL)  mkdir -p $(INSTALL_PATH) 2>&1'\\\"\";\\\n"
+     "\t   cmd_make=\"\\\"sh -c 'env INSTALL_PATH=$(INSTALL_PATH) GRAS_ROOT=$(GRAS_ROOT) \\\n"
+     "\t                        SIMGRID_URL=$(SIMGRID_URL) SIMGRID_VERSION=$(SIMGRID_VERSION) GRAS_PROJECT=$(GRAS_PROJECT) \\\n"
+     "\t                        GRAS_PROJECT_URL=$(GRAS_PROJECT_URL)  make -C $(INSTALL_PATH) -f "MAKEFILE_FILENAME_REMOTE" $(ACTION) 2>&1'\\\"\";\\\n"
+     "\t   if echo $$site | grep  '%%' >/dev/null ; then \\\n"
+     "\t     echo \"----[ Compile on $$machine2 (behind $$machine) ]----\";\\\n"
+     "\t   else \\\n"
+     "\t     machine=$$site;\\\n"
+     "\t     echo \"----[ Compile on $$machine ]----\";\\\n"
+     "\t   fi;\\\n"
+     "\t   if echo $$site | grep  '%%' >/dev/null ; then \\\n"
+     "\t     if ssh $$machine \"ssh -A $$machine2 $$cmd_mkdir\" 2>&1 > $(SRCDIR)/buildlogs/$$site.log;\\\n"
+     "\t     then true; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi;\\\n"
+     "\t   else \\\n"
+     "\t     if ssh $$machine \"eval $$cmd_mkdir\" 2>&1 > $(SRCDIR)/buildlogs/$$site.log ;\\\n"
+     "\t     then true; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi; \\\n"
+     "\t   fi;\\\n"
+     "\t   echo \"-- Copy the data over\"; \\\n"
+     "\t   scp "MAKEFILE_FILENAME_REMOTE" $$site:$(INSTALL_PATH) ;\\\n"
+     "\t   echo \"-- Compiling... (the output gets into $(SRCDIR)/buildlogs/$$site.log)\"; \\\n"
+     "\t   if echo $$site | grep  '%%' >/dev/null ; then \\\n"
+     "\t     if ssh $$machine \"ssh -A $$machine2 $$cmd_make\" 2>&1 >> $(SRCDIR)/buildlogs/$$site.log;\\\n"
+     "\t     then echo \"Sucessful\"; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi;echo; \\\n"
+     "\t   else \\\n"
+     "\t     if ssh $$machine \"eval $$cmd_make\" 2>&1 >> $(SRCDIR)/buildlogs/$$site.log ;\\\n"
+     "\t     then echo \"Sucessful\"; else failed=1;echo \"Failed (check $(SRCDIR)/buildlogs/$$site.log)\"; fi;echo; \\\n"
+     "\t   fi;\\\n"
+     "\t done;\n",project,project,project);
+   */
   fclose(OUT);
 }
 
 static void print(void *p)
 {
-  printf("%p",p);
+  printf("%p", p);
 }
 #endif
index 360352a..889a240 100644 (file)
@@ -21,7 +21,7 @@
 #include "xbt/log.h"
 #include "surf/surfxml_parse.h"
 #include "surf/surf.h"
-#include "portable.h" /* Needed for the time of the SIMIX convertion */
+#include "portable.h"           /* Needed for the time of the SIMIX convertion */
 
 #include <stdarg.h>
 
@@ -31,7 +31,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(stubgen);
 
 #ifdef _WIN32
 
-char__gras_path = NULL;
+char *__gras_path = NULL;
 
 /* tabulation level (used to indent the lines of the borland project file */
 static unsigned int level = 0;
@@ -44,31 +44,29 @@ static unsigned int level = 0;
 /*
  * A structure which represents a borland project file.
  */
-typedef struct s_borland_project
-{
-    const char* xml_version;/* the xml version used to write the borland project file                   */
-    const char* encoding;   /* the encoding used to write the borland project file                      */
-    const char* comment;    /* the xml comment to write at the begining of the borland project file     */
-       char* name;                     /* the name of the borland project file                                                                         */
-       FILE* stream;                   /* the stream to the borland project file                                                                       */
-       const char* version;    /* the builder version of the borland project file                                                      */
-       char* bin_dir;          /* the directory used to store the generated program                                            */
-       char* obj_dir;          /* the directory used to store the generated object files                                       */
-       char* lib_dir;          /* the directory used to store the librairies used in the borland project       */
-       char* src_dir;          /* the directory use to store the source files of the project                           */
-}s_borland_project_t,* borland_project_t;
+typedef struct s_borland_project {
+  const char *xml_version;      /* the xml version used to write the borland project file                   */
+  const char *encoding;         /* the encoding used to write the borland project file                      */
+  const char *comment;          /* the xml comment to write at the begining of the borland project file     */
+  char *name;                   /* the name of the borland project file                                                                         */
+  FILE *stream;                 /* the stream to the borland project file                                                                       */
+  const char *version;          /* the builder version of the borland project file                                                      */
+  char *bin_dir;                /* the directory used to store the generated program                                            */
+  char *obj_dir;                /* the directory used to store the generated object files                                       */
+  char *lib_dir;                /* the directory used to store the librairies used in the borland project       */
+  char *src_dir;                /* the directory use to store the source files of the project                           */
+} s_borland_project_t, *borland_project_t;
 
 
 /*
  * A structure which represents a visual C++ project file.
  */
-typedef struct s_dsp
-{
-       FILE* stream;
-       char* lib_dir;
-       char* src_dir;
-       char* name;
-}s_dsp_t,* dsp_t;
+typedef struct s_dsp {
+  FILE *stream;
+  char *lib_dir;
+  char *src_dir;
+  char *name;
+} s_dsp_t, *dsp_t;
 
 /*
  * Write tabs in a borland project file.
@@ -76,7 +74,7 @@ typedef struct s_dsp
  * @param count The count tab to write
  */
 static void
-borland_project_write_tabs(borland_project_t project,unsigned int count);
+borland_project_write_tabs(borland_project_t project, unsigned int count);
 
 /*
  * Write the begin of an xml node in the borland project file.
@@ -84,7 +82,7 @@ borland_project_write_tabs(borland_project_t project,unsigned int count);
  * @param name The name of the node.
  */
 static void
-borland_project_begin_xml_node(borland_project_t project, const charname);
+borland_project_begin_xml_node(borland_project_t project, const char *name);
 
 
 /*
@@ -93,7 +91,7 @@ borland_project_begin_xml_node(borland_project_t project, const char* name);
  * @param name The name of the node.
  */
 static void
-borland_project_end_xml_node(borland_project_t project, const charname);
+borland_project_end_xml_node(borland_project_t project, const char *name);
 
 /*
  * Write an xml element in a borland project file.
@@ -102,7 +100,8 @@ borland_project_end_xml_node(borland_project_t project, const char* name);
  * @param value The value of the element  
  */
 static void
-borland_project_write_xml_element(borland_project_t project,const char* name,const char* value);
+borland_project_write_xml_element(borland_project_t project, const char *name,
+                                  const char *value);
 
 /*
  * Write a FILE xml element in the borland project file.
@@ -115,55 +114,49 @@ borland_project_write_xml_element(borland_project_t project,const char* name,con
  * @param local_command The value of the attribute LOCALCOMMAND.
  */
 static void
-borland_project_write_file_element(    borland_project_t project,
-                                                                       const char* file_name,
-                                                                       const char* form_name,
-                                                                       const char* unit_name,
-                                                                       const char* container_id,
-                                                                       const char* design_class,
-                                                                       const char* local_command);
+borland_project_write_file_element(borland_project_t project,
+                                   const char *file_name,
+                                   const char *form_name,
+                                   const char *unit_name,
+                                   const char *container_id,
+                                   const char *design_class,
+                                   const char *local_command);
 /*
  * Write all options of the IDE of the Borland Builder C++ compiler.
  * @ param project The project concerned by this operation.
  */
 
-static void
-borland_project_write_ide_options(borland_project_t project);
+static void borland_project_write_ide_options(borland_project_t project);
 
 /*
  * Write the xml header of the xml document.
  * @param project The project concerned by the operation.
  */
-static void
-borland_project_write_xml_header(borland_project_t project);
+static void borland_project_write_xml_header(borland_project_t project);
 
 /*
  * Write an xml comment in a borland project file
  * @param project The project concerned by this operation.
  */
-static void
-borland_project_write_xml_comment(borland_project_t project);
+static void borland_project_write_xml_comment(borland_project_t project);
 
 /*
  * Create a bpf file used by a borland project file.
  * @param name The name of the bpf file to create.
  */
-static void
-borland_project_create_main_file(const char* name);
+static void borland_project_create_main_file(const char *name);
 
 /*
  * Create a borland project file.
  * @param project The project concerned by this operation.
  */
-static void
-borland_project_create(borland_project_t project);
+static void borland_project_create(borland_project_t project);
 
 /*
  * Close a borland project file.
  * @param project the borland project file to close.
  */
-static void
-borland_project_close(borland_project_t project);
+static void borland_project_close(borland_project_t project);
 
 
 /*
@@ -171,7 +164,8 @@ borland_project_close(borland_project_t project);
  * @param project The borland project to generate.
  */
 static void
-generate_borland_project(borland_project_t project,int is_rl,const char* name);
+generate_borland_project(borland_project_t project, int is_rl,
+                         const char *name);
 
 /*
  * Find the path of a file.
@@ -181,7 +175,7 @@ generate_borland_project(borland_project_t project,int is_rl,const char* name);
  *  retruns 0;
  */
 static int
-find_file_path(const char* root_dir,const char* file_name,char* path);
+find_file_path(const char *root_dir, const char *file_name, char *path);
 
 
 /*
@@ -190,823 +184,876 @@ find_file_path(const char* root_dir,const char* file_name,char* path);
 
 /*
  * generate a Microsoft Visual project file*/
-static void
-generate_dsp_project(dsp_t project,int is_rl,const char* name);
+static void generate_dsp_project(dsp_t project, int is_rl, const char *name);
 
 static void
-generate_borland_project(borland_project_t project,int is_rl,const char* name)
+generate_borland_project(borland_project_t project, int is_rl,
+                         const char *name)
 {
-       char* binary_path;      /* the path of the generated binary file                                */
-       char* obj_path;         /* the path of the generated object file                                */
-       char* lib_files;        /* a list of the libraries used in the borland project  */
-       char* main_source;      /* the name of the bpf file used by the borland project */
-       char* file_name;        /* the file name of the main source file                                */
-    char* include_path; /* the include path                                     */
-       char* buffer;
-
-    /* create the borland project file */
-    borland_project_create(project);
-
-    /* write the xml document header */
-    borland_project_write_xml_header(project);
-
-    /* write the xml comment to identify a borland project file */
-    borland_project_write_xml_comment(project);
-       
-       /* write the begin of the node PROJECT */
-       borland_project_begin_xml_node(project,"PROJECT");
-       
-       /* write the begin of node MACROS */
-       borland_project_begin_xml_node(project,"MACROS");
-       
-       /* write the borland project version */
-       borland_project_write_xml_element(project,"VERSION",project->version);
-       
-       /* construct and write the borland project binary path */
-       binary_path = xbt_new0(char,strlen(project->name) + strlen(project->bin_dir) + 6);
-       sprintf(binary_path,"%s\\%s.exe",project->bin_dir,project->name);
-       borland_project_write_xml_element(project,"PROJECT",binary_path);
-       xbt_free(binary_path);
-       
-       /* construct an write the object files to generate by the compiler */
-       obj_path = xbt_new0(char,strlen(project->name) + strlen(name) + (2*strlen(project->obj_dir)) + 11);
-       sprintf(binary_path,"%s\\%s.obj\n%s\\%s.obj",project->obj_dir,project->name,project->obj_dir,name);
-       borland_project_write_xml_element(project,"OBJFILES",obj_path);
-       xbt_free(obj_path);
-       
-       /* write the resource files used by the compiler (no resource file used) */
-       borland_project_write_xml_element(project,"RESFILES","");
-       
-       /* write the IDL files of the project (no IDL files used) */
-       borland_project_write_xml_element(project,"IDLFILES","");
-       
-       /* write the IDLGENFILES element (not used) */
-       borland_project_write_xml_element(project,"IDLGENFILES","");
-       
-       /* write the DEFFILE element (not used) */
-       borland_project_write_xml_element(project,"DEFFILE","");
-       
-       /* write the RESDEPEN element (not used, no resource file used) */
-       borland_project_write_xml_element(project,"RESDEPEN","$(RESFILES)");
-
-       /* construct and write the list of libraries used by the project */
-       /*
-    lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") + strlen("libgras.lib") + 3);
-       sprintf(lib_files,"%s\\simgrid.lib %s\\libgras.lib",project->lib_dir,project->lib_dir);
-    */
-       
-       if(is_rl){
-               lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("libgras.lib") + 2);
-               sprintf(lib_files,"%s\\libgras.lib",project->lib_dir);  
-       }else{
-       lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") + 2);
-               sprintf(lib_files,"%s\\simgrid.lib",project->lib_dir);
-       }
-
-       borland_project_write_xml_element(project,"LIBFILES",lib_files);
-       xbt_free(lib_files);
-       
-       /* write the SPARELIBS element (not used) */
-       borland_project_write_xml_element(project,"SPARELIBS","");
-       
-       /* write the PACKAGES element (no package used) */
-       borland_project_write_xml_element(project,"PACKAGES","");
-       
-       /* write the PATHCPP element (the path of the source files of the project)*/
-       borland_project_write_xml_element(project,"PATHCPP",".;");
-       
-       /* write the PATHPAS element (not used) */
-       borland_project_write_xml_element(project,"PATHPAS","");
-       
-       /* write the PATHRC element (not used) */
-       borland_project_write_xml_element(project,"PATHRC","");
-       
-       /* write the PATHASM element (not used) */
-       borland_project_write_xml_element(project,"PATHASM","");
-       
-       /* write the DEBUGLIBPATH element (the path for debug) */
-       borland_project_write_xml_element(project,"DEBUGLIBPATH","$(BCB)\\lib\\debug");
-       
-       /* write the RELEASELIBPATH element (the path for release) */
-       borland_project_write_xml_element(project,"RELEASELIBPATH","$(BCB)\\lib\\release");
-       
-       /* specify the linker to use */
-       borland_project_write_xml_element(project,"LINKER","ilink32");
-       
-       /* write the USERDEFINES element (user definitions (#define _DEBUG))*/
-       borland_project_write_xml_element(project,"USERDEFINES","_DEBUG");
-       
-       /* write the SYSDEFINES element (use the system definitions, not used strict ANSI and no use the VCL)*/
-       borland_project_write_xml_element(project,"SYSDEFINES","NO_STRICT;_NO_VCL");
-
-       /* construct and write the MAINSOURCE element */
-       main_source = xbt_new0(char,strlen(project->name) + 5);
-       sprintf(main_source,"%s.bpf",project->name);
-    /* write the main source file to use in the borland project file */
-       borland_project_write_xml_element(project,"MAINSOURCE",main_source);
-
-       /* create the bpf file used by the borland project */
-       borland_project_create_main_file(main_source);
-
-       /* FIXME resolve the include path */
-       /* write the INCLUDEPATH element  */
-
-    if(!__gras_path){
-       buffer =xbt_new0(char,MAX_PATH);
-       GetEnvironmentVariable("SG_INSTALL_DIR",buffer,MAX_PATH);
-       
-               __gras_path = xbt_new0(char,MAX_PATH);
-               sprintf(__gras_path,"%s\\simgrid\\include",buffer);
-               free(buffer);
-
-        /*find_file_path("C:\\","gras.h",__gras_path);*/
-    }
+  char *binary_path;            /* the path of the generated binary file                                */
+  char *obj_path;               /* the path of the generated object file                                */
+  char *lib_files;              /* a list of the libraries used in the borland project  */
+  char *main_source;            /* the name of the bpf file used by the borland project */
+  char *file_name;              /* the file name of the main source file                                */
+  char *include_path;           /* the include path                                     */
+  char *buffer;
+
+  /* create the borland project file */
+  borland_project_create(project);
+
+  /* write the xml document header */
+  borland_project_write_xml_header(project);
+
+  /* write the xml comment to identify a borland project file */
+  borland_project_write_xml_comment(project);
+
+  /* write the begin of the node PROJECT */
+  borland_project_begin_xml_node(project, "PROJECT");
+
+  /* write the begin of node MACROS */
+  borland_project_begin_xml_node(project, "MACROS");
+
+  /* write the borland project version */
+  borland_project_write_xml_element(project, "VERSION", project->version);
+
+  /* construct and write the borland project binary path */
+  binary_path =
+    xbt_new0(char, strlen(project->name) + strlen(project->bin_dir) + 6);
+  sprintf(binary_path, "%s\\%s.exe", project->bin_dir, project->name);
+  borland_project_write_xml_element(project, "PROJECT", binary_path);
+  xbt_free(binary_path);
+
+  /* construct an write the object files to generate by the compiler */
+  obj_path =
+    xbt_new0(char,
+             strlen(project->name) + strlen(name) +
+             (2 * strlen(project->obj_dir)) + 11);
+  sprintf(binary_path, "%s\\%s.obj\n%s\\%s.obj", project->obj_dir,
+          project->name, project->obj_dir, name);
+  borland_project_write_xml_element(project, "OBJFILES", obj_path);
+  xbt_free(obj_path);
+
+  /* write the resource files used by the compiler (no resource file used) */
+  borland_project_write_xml_element(project, "RESFILES", "");
+
+  /* write the IDL files of the project (no IDL files used) */
+  borland_project_write_xml_element(project, "IDLFILES", "");
+
+  /* write the IDLGENFILES element (not used) */
+  borland_project_write_xml_element(project, "IDLGENFILES", "");
+
+  /* write the DEFFILE element (not used) */
+  borland_project_write_xml_element(project, "DEFFILE", "");
+
+  /* write the RESDEPEN element (not used, no resource file used) */
+  borland_project_write_xml_element(project, "RESDEPEN", "$(RESFILES)");
+
+  /* construct and write the list of libraries used by the project */
+  /*
+     lib_files = xbt_new0(char,(2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") + strlen("libgras.lib") + 3);
+     sprintf(lib_files,"%s\\simgrid.lib %s\\libgras.lib",project->lib_dir,project->lib_dir);
+   */
+
+  if (is_rl) {
+    lib_files =
+      xbt_new0(char,
+               (2 * (strlen(project->lib_dir) + 1)) + strlen("libgras.lib") +
+               2);
+    sprintf(lib_files, "%s\\libgras.lib", project->lib_dir);
+  } else {
+    lib_files =
+      xbt_new0(char,
+               (2 * (strlen(project->lib_dir) + 1)) + strlen("simgrid.lib") +
+               2);
+    sprintf(lib_files, "%s\\simgrid.lib", project->lib_dir);
+  }
+
+  borland_project_write_xml_element(project, "LIBFILES", lib_files);
+  xbt_free(lib_files);
+
+  /* write the SPARELIBS element (not used) */
+  borland_project_write_xml_element(project, "SPARELIBS", "");
+
+  /* write the PACKAGES element (no package used) */
+  borland_project_write_xml_element(project, "PACKAGES", "");
+
+  /* write the PATHCPP element (the path of the source files of the project) */
+  borland_project_write_xml_element(project, "PATHCPP", ".;");
+
+  /* write the PATHPAS element (not used) */
+  borland_project_write_xml_element(project, "PATHPAS", "");
+
+  /* write the PATHRC element (not used) */
+  borland_project_write_xml_element(project, "PATHRC", "");
+
+  /* write the PATHASM element (not used) */
+  borland_project_write_xml_element(project, "PATHASM", "");
+
+  /* write the DEBUGLIBPATH element (the path for debug) */
+  borland_project_write_xml_element(project, "DEBUGLIBPATH",
+                                    "$(BCB)\\lib\\debug");
+
+  /* write the RELEASELIBPATH element (the path for release) */
+  borland_project_write_xml_element(project, "RELEASELIBPATH",
+                                    "$(BCB)\\lib\\release");
+
+  /* specify the linker to use */
+  borland_project_write_xml_element(project, "LINKER", "ilink32");
+
+  /* write the USERDEFINES element (user definitions (#define _DEBUG)) */
+  borland_project_write_xml_element(project, "USERDEFINES", "_DEBUG");
+
+  /* write the SYSDEFINES element (use the system definitions, not used strict ANSI and no use the VCL) */
+  borland_project_write_xml_element(project, "SYSDEFINES",
+                                    "NO_STRICT;_NO_VCL");
+
+  /* construct and write the MAINSOURCE element */
+  main_source = xbt_new0(char, strlen(project->name) + 5);
+  sprintf(main_source, "%s.bpf", project->name);
+  /* write the main source file to use in the borland project file */
+  borland_project_write_xml_element(project, "MAINSOURCE", main_source);
+
+  /* create the bpf file used by the borland project */
+  borland_project_create_main_file(main_source);
+
+  /* FIXME resolve the include path */
+  /* write the INCLUDEPATH element  */
+
+  if (!__gras_path) {
+    buffer = xbt_new0(char, MAX_PATH);
+    GetEnvironmentVariable("SG_INSTALL_DIR", buffer, MAX_PATH);
+
+    __gras_path = xbt_new0(char, MAX_PATH);
+    sprintf(__gras_path, "%s\\simgrid\\include", buffer);
+    free(buffer);
+
+    /*find_file_path("C:\\","gras.h",__gras_path); */
+  }
+
+  include_path =
+    xbt_new0(char, strlen("$(BCB)\\include") + strlen(__gras_path) + 2);
+  sprintf(include_path, "$(BCB)\\include;%s", __gras_path);
+
+  borland_project_write_xml_element(project, "INCLUDEPATH", include_path);
+
+  xbt_free(include_path);
+
+  /* write the LIBPATH element (no librarie paths specified) */
+  borland_project_write_xml_element(project, "LIBPATH",
+                                    "$(BCB)\\lib;$(BCB)\\lib\\obj");
+
+  /*
+   * write the WARNINGS element :
+   *  -w-sus (-w-8075) disabled the suspect conversion pointer warning
+   *  -w-rvl (-w-8070) disabled the function must return warning
+   *  -w-rch (-w-8066) disabled the warning which specify that we can't attain the code
+   *  -w-pia (-w-8060) disabled the warning that detect a possible bad assignement
+   *  -w-pch (-w-8058) disabled the warning throw when the compiler can't precompile a header file
+   *  -w-par (-w-8057) disabled the warning that detect an unused variable
+   *  -w-csu (-w-8012) disabled the warning that detect a comparison between a signed number and an unsigned number
+   *  -w-ccc (-w-8008) disabled the warning that detect une conditon which is always true
+   *  -w-aus (-w-8008) disabled the warning that detect an affected value which is never used
+   */
+  borland_project_write_xml_element(project, "WARNINGS",
+                                    "-w-sus -w-rvl -w-rch -w-pia -w-pch -w-par -w-csu -w-ccc -w-aus");
+
+  /* write the OTHERFILES element (no other files used used) */
+  borland_project_write_xml_element(project, "OTHERFILES", "");
+
+  /* write the end of the node MACROS */
+  borland_project_end_xml_node(project, "MACROS");
+
+  /* write the begin of the node OPTIONS */
+  borland_project_begin_xml_node(project, "OPTIONS");
+
+  /* FIXME check the idlcflags */
+  /* write the IDLCFLAGS element */
+  borland_project_write_xml_element(project, "IDLCFLAGS", "");
+
+  /*
+   * write the CFLAG1 element (compiler options ) :
+   *
+   *  -Od     this flag disable all compiler optimisation
+   *  -H      this flag specify the name of the file which will contain the precompiled header
+   *  -Hc     this flag specify to the compiler to cach the precompiled header
+   *  -Vx     this flag specify to the compiler to allow the empty structures
+   *  -Ve     this flag specify to the compiler to allow the empty base classes
+   *  -X-     this flag activate the auto-depend informations of the compiler
+   *  -r-     this flag disabled the use of the processor register
+   *  -a1     this flag specify that the data must be aligned on one byte
+   *  -b-     this flag specify that the enums are the smallest size of the integer
+   *  -k      (used during debug)
+   *  -y      this flag generate the line number for debug
+   *  -v      this flag enabled the debugging of the source files
+   *  -vi     check the expansion of the inline functions
+   *  -tWC    specify that it's a console application
+   *  -tWM-   specify that the application is not multithread
+   *  -c      generate the object file, no link
+   */
+  borland_project_write_xml_element(project, "CFLAG1",
+                                    "-Od -H=$(BCB)\\lib\\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM- -c");
+
+  /* write the PFLAGS element */
+  borland_project_write_xml_element(project, "PFLAGS",
+                                    "-N2obj -N0obj -$YD -$W -$O- -$A8 -v -JPHNE ");
+
+  /* write the RFLAGS element */
+  borland_project_write_xml_element(project, "RFLAGS", "");
+
+  /* write the AFLAGS element (assembler flags) :
+   *
+   *  /mx (not documented)
+   *  /w2 (not documented)
+   *  /zd (not documented)
+   *
+   */
+  borland_project_write_xml_element(project, "AFLAGS", "/mx /w2 /zd");
+
+  /* write the LFLAGS element (linker flags) :
+   *
+   *  -I      specify the output directory for object files
+   *  -D      register the specified description (no description "")
+   *  -ap     build a win32 console application
+   *  -Tpe    generate a exe file
+   *  -x      do not create the map file
+   *  -Gn     do not generate the state file
+   *  -v      include the complete debug informations  
+   */
+  borland_project_write_xml_element(project, "LFLAGS",
+                                    "-Iobj -D&quot;&quot; -ap -Tpe -x -Gn -v");
+
+  /* write the OTHERFILES element (not used) */
+  borland_project_write_xml_element(project, "OTHERFILES", "");
+
+  /* write the end of the node OPTIONS */
+  borland_project_end_xml_node(project, "OPTIONS");
+
+  /* write the begin of the node LINKER */
+  borland_project_begin_xml_node(project, "LINKER");
+
+  /* write the ALLOBJ element */
+  borland_project_write_xml_element(project, "ALLOBJ",
+                                    "c0x32.obj $(OBJFILES)");
+
+  /* write the ALLRES element (not used) */
+  borland_project_write_xml_element(project, "ALLRES", "");
+
+  /* write the ALLLIB element */
+  borland_project_write_xml_element(project, "ALLLIB",
+                                    "$(LIBFILES) $(LIBRARIES) import32.lib cw32.lib");
+
+  /* write the OTHERFILES element (not used) */
+  borland_project_write_xml_element(project, "OTHERFILES", "");
+
+  /* write the end of the node LINKER */
+  borland_project_end_xml_node(project, "LINKER");
+
+  /* write the begin of the node FILELIST */
+  borland_project_begin_xml_node(project, "FILELIST");
+
+  /* construct and write the list of file elements */
+
+  /* add the bpf file to the list */
+  borland_project_write_file_element(project, main_source, "", project->name,
+                                     "BPF", "", "");
+  xbt_free(main_source);
+
+  /* FIXME : check the source file directory */
+  /* add the generated source file to the list */
+
+  file_name =
+    xbt_new0(char, strlen(project->src_dir) + strlen(project->name) + 5);
+  sprintf(file_name, "%s\\_%s.c", project->src_dir, project->name);
+  borland_project_write_file_element(project, file_name, "", project->name,
+                                     "CCompiler", "", "");
+
+  memset(file_name, 0, strlen(project->src_dir) + strlen(project->name) + 4);
+  sprintf(file_name, "%s\\%s.c", project->src_dir, name);
+  borland_project_write_file_element(project, file_name, "", name,
+                                     "CCompiler", "", "");
+
+  xbt_free(file_name);
+
+  /* FIXME : check the libraries directory */
+  /* add the simgrid library to the list */
+
+  if (is_rl) {
+    file_name =
+      xbt_new0(char, strlen(project->lib_dir) + strlen("libgras.lib") + 2);
+    sprintf(file_name, "%s\\libgras.lib", project->lib_dir);
+    borland_project_write_file_element(project, file_name, "", "libgras.lib",
+                                       "LibTool", "", "");
+  } else {
+    file_name =
+      xbt_new0(char, strlen(project->lib_dir) + strlen("simgrid.lib") + 2);
+    sprintf(file_name, "%s\\simgrid.lib", project->lib_dir);
+    borland_project_write_file_element(project, file_name, "", "simgrid.lib",
+                                       "LibTool", "", "");
+  }
+
+
+  xbt_free(file_name);
+
+  /* write the end of the node FILELIST */
+  borland_project_end_xml_node(project, "FILELIST");
+
+  /* write the begin of the node BUILDTOOLS (not used) */
+  borland_project_begin_xml_node(project, "BUILDTOOLS");
+
+  /* write the end of the node BUILDTOOLS (not used) */
+  borland_project_end_xml_node(project, "BUILDTOOLS");
 
-    include_path = xbt_new0(char,strlen("$(BCB)\\include") + strlen(__gras_path) + 2);
-    sprintf(include_path,"$(BCB)\\include;%s",__gras_path);
-
-       borland_project_write_xml_element(project,"INCLUDEPATH",include_path);
-
-    xbt_free(include_path);
-
-       /* write the LIBPATH element (no librarie paths specified)*/
-       borland_project_write_xml_element(project,"LIBPATH","$(BCB)\\lib;$(BCB)\\lib\\obj");
-
-       /*
-     * write the WARNINGS element :
-     *  -w-sus (-w-8075) disabled the suspect conversion pointer warning
-     *  -w-rvl (-w-8070) disabled the function must return warning
-     *  -w-rch (-w-8066) disabled the warning which specify that we can't attain the code
-     *  -w-pia (-w-8060) disabled the warning that detect a possible bad assignement
-     *  -w-pch (-w-8058) disabled the warning throw when the compiler can't precompile a header file
-     *  -w-par (-w-8057) disabled the warning that detect an unused variable
-     *  -w-csu (-w-8012) disabled the warning that detect a comparison between a signed number and an unsigned number
-     *  -w-ccc (-w-8008) disabled the warning that detect une conditon which is always true
-     *  -w-aus (-w-8008) disabled the warning that detect an affected value which is never used
-     */
-       borland_project_write_xml_element(project,"WARNINGS","-w-sus -w-rvl -w-rch -w-pia -w-pch -w-par -w-csu -w-ccc -w-aus");
-
-       /* write the OTHERFILES element (no other files used used) */
-       borland_project_write_xml_element(project,"OTHERFILES","");
-
-       /* write the end of the node MACROS */
-       borland_project_end_xml_node(project,"MACROS");
-
-       /* write the begin of the node OPTIONS */
-       borland_project_begin_xml_node(project,"OPTIONS");
-
-       /* FIXME check the idlcflags */
-       /* write the IDLCFLAGS element */
-       borland_project_write_xml_element(project,"IDLCFLAGS","");
-
-       /*
-     * write the CFLAG1 element (compiler options ) :
-     *
-     *  -Od     this flag disable all compiler optimisation
-     *  -H      this flag specify the name of the file which will contain the precompiled header
-     *  -Hc     this flag specify to the compiler to cach the precompiled header
-     *  -Vx     this flag specify to the compiler to allow the empty structures
-     *  -Ve     this flag specify to the compiler to allow the empty base classes
-     *  -X-     this flag activate the auto-depend informations of the compiler
-     *  -r-     this flag disabled the use of the processor register
-     *  -a1     this flag specify that the data must be aligned on one byte
-     *  -b-     this flag specify that the enums are the smallest size of the integer
-     *  -k      (used during debug)
-     *  -y      this flag generate the line number for debug
-     *  -v      this flag enabled the debugging of the source files
-     *  -vi     check the expansion of the inline functions
-     *  -tWC    specify that it's a console application
-     *  -tWM-   specify that the application is not multithread
-     *  -c      generate the object file, no link
-     */
-       borland_project_write_xml_element(project,"CFLAG1","-Od -H=$(BCB)\\lib\\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC -tWM- -c");
-
-       /* write the PFLAGS element */
-       borland_project_write_xml_element(project,"PFLAGS","-N2obj -N0obj -$YD -$W -$O- -$A8 -v -JPHNE ");
-
-       /* write the RFLAGS element */
-       borland_project_write_xml_element(project,"RFLAGS","");
-
-       /* write the AFLAGS element (assembler flags) :
-     *
-     *  /mx (not documented)
-     *  /w2 (not documented)
-     *  /zd (not documented)
-     *
-     */
-       borland_project_write_xml_element(project,"AFLAGS","/mx /w2 /zd");
-
-       /* write the LFLAGS element (linker flags) :
-     *
-     *  -I      specify the output directory for object files
-     *  -D      register the specified description (no description "")
-     *  -ap     build a win32 console application
-     *  -Tpe    generate a exe file
-     *  -x      do not create the map file
-     *  -Gn     do not generate the state file
-     *  -v      include the complete debug informations  
-     */
-       borland_project_write_xml_element(project,"LFLAGS","-Iobj -D&quot;&quot; -ap -Tpe -x -Gn -v");
-
-       /* write the OTHERFILES element (not used)*/
-       borland_project_write_xml_element(project,"OTHERFILES","");
-
-       /* write the end of the node OPTIONS */
-       borland_project_end_xml_node(project,"OPTIONS");
-
-       /* write the begin of the node LINKER */
-       borland_project_begin_xml_node(project,"LINKER");
-
-       /* write the ALLOBJ element */
-       borland_project_write_xml_element(project,"ALLOBJ","c0x32.obj $(OBJFILES)");
-
-       /* write the ALLRES element (not used) */
-       borland_project_write_xml_element(project,"ALLRES","");
-
-       /* write the ALLLIB element */
-       borland_project_write_xml_element(project,"ALLLIB","$(LIBFILES) $(LIBRARIES) import32.lib cw32.lib");
-
-       /* write the OTHERFILES element (not used) */
-       borland_project_write_xml_element(project,"OTHERFILES","");
-
-       /* write the end of the node LINKER */
-       borland_project_end_xml_node(project,"LINKER");
-
-       /* write the begin of the node FILELIST */
-       borland_project_begin_xml_node(project,"FILELIST");
-       
-       /* construct and write the list of file elements */
-       
-       /* add the bpf file to the list */
-       borland_project_write_file_element(project,main_source,"",project->name,"BPF","","");
-       xbt_free(main_source);
-       
-       /* FIXME : check the source file directory */
-       /* add the generated source file to the list */
-       
-       file_name = xbt_new0(char,strlen(project->src_dir) + strlen(project->name) + 5);
-       sprintf(file_name,"%s\\_%s.c",project->src_dir,project->name);
-       borland_project_write_file_element(project,file_name,"",project->name,"CCompiler","","");
-
-       memset(file_name,0,strlen(project->src_dir) + strlen(project->name) + 4);
-       sprintf(file_name,"%s\\%s.c",project->src_dir,name);
-       borland_project_write_file_element(project,file_name,"",name,"CCompiler","","");
-
-       xbt_free(file_name);
-
-       /* FIXME : check the libraries directory */
-       /* add the simgrid library to the list */
-       
-       if(is_rl){
-               file_name = xbt_new0(char,strlen(project->lib_dir) + strlen("libgras.lib") + 2);
-               sprintf(file_name,"%s\\libgras.lib",project->lib_dir);
-               borland_project_write_file_element(project,file_name,"","libgras.lib","LibTool","","");
-       }else
-       {
-               file_name = xbt_new0(char,strlen(project->lib_dir) + strlen("simgrid.lib") + 2);
-               sprintf(file_name,"%s\\simgrid.lib",project->lib_dir);
-               borland_project_write_file_element(project,file_name,"","simgrid.lib","LibTool","","");
-       }
-       
-       
-       xbt_free(file_name);
-
-       /* write the end of the node FILELIST */
-       borland_project_end_xml_node(project,"FILELIST");
-       
-       /* write the begin of the node BUILDTOOLS (not used)*/
-       borland_project_begin_xml_node(project,"BUILDTOOLS");
-       
-       /* write the end of the node BUILDTOOLS (not used)*/
-       borland_project_end_xml_node(project,"BUILDTOOLS");
-       
-       /* write the begin of the node IDEOPTIONS */
-       borland_project_begin_xml_node(project,"IDEOPTIONS");
-       
-       /* write all of the option of the IDE of Borland C++ Builder */
-       borland_project_write_ide_options(project);
-       
-       /* write the end of the node IDEOPTIONS */
-       borland_project_end_xml_node(project,"IDEOPTIONS");
-
-    /* write the end of the node PROJECT */
-       borland_project_end_xml_node(project,"PROJECT");
-
-    /* close the borland project file */
-    borland_project_close(project);
+  /* write the begin of the node IDEOPTIONS */
+  borland_project_begin_xml_node(project, "IDEOPTIONS");
+
+  /* write all of the option of the IDE of Borland C++ Builder */
+  borland_project_write_ide_options(project);
+
+  /* write the end of the node IDEOPTIONS */
+  borland_project_end_xml_node(project, "IDEOPTIONS");
+
+  /* write the end of the node PROJECT */
+  borland_project_end_xml_node(project, "PROJECT");
+
+  /* close the borland project file */
+  borland_project_close(project);
 }
 
-void
-borland_project_write_tabs(borland_project_t project,unsigned int count)
+void borland_project_write_tabs(borland_project_t project, unsigned int count)
 {
-       unsigned int pos;
-       
-       for(pos = 0; pos < count; pos++)
-               fprintf(project->stream,"\t");          
+  unsigned int pos;
+
+  for (pos = 0; pos < count; pos++)
+    fprintf(project->stream, "\t");
 }
 
 void
-borland_project_begin_xml_node(borland_project_t project, const charname)
+borland_project_begin_xml_node(borland_project_t project, const char *name)
 {
-       if(level)
-               borland_project_write_tabs(project,level);
-               
-       fprintf(project->stream,"<%s>\n",name);
-       
-       level++;
+  if (level)
+    borland_project_write_tabs(project, level);
+
+  fprintf(project->stream, "<%s>\n", name);
+
+  level++;
 }
 
-void
-borland_project_end_xml_node(borland_project_t project, const char* name)
+void borland_project_end_xml_node(borland_project_t project, const char *name)
 {
-       level--;
-       
-       if(level)
-               borland_project_write_tabs(project,level);
-       
-       fprintf(project->stream,"</%s>\n",name);        
+  level--;
+
+  if (level)
+    borland_project_write_tabs(project, level);
+
+  fprintf(project->stream, "</%s>\n", name);
 }
 
 
 void
-borland_project_write_xml_element(borland_project_t project,const char* name,const char* value)
+borland_project_write_xml_element(borland_project_t project, const char *name,
+                                  const char *value)
 {
-       borland_project_write_tabs(project,level);
-       fprintf(project->stream,"<%s value=\"%s\"/>\n",name,value);
+  borland_project_write_tabs(project, level);
+  fprintf(project->stream, "<%s value=\"%s\"/>\n", name, value);
 }
 
-void
-borland_project_write_xml_header(borland_project_t project)
+void borland_project_write_xml_header(borland_project_t project)
 {
-    fprintf(project->stream,"<?xml version='%s' encoding='%s' ?>\n",project->xml_version, project->encoding);
+  fprintf(project->stream, "<?xml version='%s' encoding='%s' ?>\n",
+          project->xml_version, project->encoding);
 }
 
-void
-borland_project_create_main_file(const char* name)
+void borland_project_create_main_file(const char *name)
 {
-       FILE* stream = fopen(name,"w+");
+  FILE *stream = fopen(name, "w+");
 
-       fprintf(stream,"Ce fichier est uniquement utilisé par le gestionnaire de projets et doit Ãªtre traité comme le fichier projet\n\n\nmain\n");
+  fprintf(stream,
+          "Ce fichier est uniquement utilisé par le gestionnaire de projets et doit Ãªtre traité comme le fichier projet\n\n\nmain\n");
 
-       fclose(stream);
+  fclose(stream);
 }
 
-void
-borland_project_create(borland_project_t project)
+void borland_project_create(borland_project_t project)
 {
-    char* file_name = xbt_new0(char,strlen(project->name ) + 5);
-    sprintf(file_name,"%s.bpr",project->name);
-    project->stream = fopen(file_name,"w+");
-    xbt_free(file_name);
+  char *file_name = xbt_new0(char, strlen(project->name) + 5);
+  sprintf(file_name, "%s.bpr", project->name);
+  project->stream = fopen(file_name, "w+");
+  xbt_free(file_name);
 }
 
-void
-borland_project_write_xml_comment(borland_project_t project)
+void borland_project_write_xml_comment(borland_project_t project)
 {
-    fprintf(project->stream,"<!-- %s -->\n",project->comment);
+  fprintf(project->stream, "<!-- %s -->\n", project->comment);
 }
+
 void
-borland_project_write_file_element(    borland_project_t project,
-                                                                       const char* file_name,
-                                                                       const char* form_name,
-                                                                       const char* unit_name,
-                                                                       const char* container_id,
-                                                                       const char* design_class,
-                                                                       const char* local_command)
+borland_project_write_file_element(borland_project_t project,
+                                   const char *file_name,
+                                   const char *form_name,
+                                   const char *unit_name,
+                                   const char *container_id,
+                                   const char *design_class,
+                                   const char *local_command)
 {
-       borland_project_write_tabs(project,level);
+  borland_project_write_tabs(project, level);
 
-       fprintf(project->stream,"<FILE FILENAME=\"%s\" FORMNAME=\"%s\" UNITNAME=\"%s\" CONTAINERID=\"%s\" DESIGNCLASS=\"%s\" LOCALCOMMAND=\"%s\"/>\n",file_name,form_name,unit_name,container_id,design_class,local_command);
+  fprintf(project->stream,
+          "<FILE FILENAME=\"%s\" FORMNAME=\"%s\" UNITNAME=\"%s\" CONTAINERID=\"%s\" DESIGNCLASS=\"%s\" LOCALCOMMAND=\"%s\"/>\n",
+          file_name, form_name, unit_name, container_id, design_class,
+          local_command);
 }
 
-void
-borland_project_write_ide_options(borland_project_t project)
+void borland_project_write_ide_options(borland_project_t project)
 {
 
-       const char* ide_options =
-        "[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1036\nCodePage=1252\n\n"  \
-        "[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n" \
-        "[Excluded Packages]\n$(BCB)\\dclclxdb60.bpl=Composants BD CLX Borland\n$(BCB)\\Bin\\dclclxstd60.bpl=Composants Standard CLX Borland\n\n" \
-        "[HistoryLists\\hlIncludePath]\nCount=1\nItem0=$(BCB)\\include;$(BCB)\\include\\vcl;\n\n" \
-        "[HistoryLists\\hlLibraryPath]\nCount=1\nItem0=$(BCB)\\lib\\obj;$(BCB)\\lib\n\n" \
-        "[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\\\n\n" \
-        "[HistoryLists\\hlConditionals]\nCount=1\nItem0=_DEBUG\n\n" \
-        "[HistoryLists\\hlIntOutputDir]\nCount=0\n\n" \
-        "[HistoryLists\\hlFinalOutputDir]\nCount=0\n\n" \
-        "[HistoryLists\\hIBPIOutputDir]\nCount=0\n\n" \
-        "[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n" \
-        "[Parameters]\nRunParams=\nLauncher=\nUseLauncher=0\nDebugCWD=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteLauncher=\nRemoteCWD=\nRemoteDebug=0\n\n" \
-        "[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n" \
-        "[CORBA]\nAddServerUnit=1\nAddClientUnit=1\nPrecompiledHeaders=1\n\n" \
-        "[Language]\nActiveLang=\nProjectLang=\nRootDir=\n";
-
-       fprintf(project->stream,ide_options);
+  const char *ide_options =
+    "[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1036\nCodePage=1252\n\n"
+    "[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n\n"
+    "[Excluded Packages]\n$(BCB)\\dclclxdb60.bpl=Composants BD CLX Borland\n$(BCB)\\Bin\\dclclxstd60.bpl=Composants Standard CLX Borland\n\n"
+    "[HistoryLists\\hlIncludePath]\nCount=1\nItem0=$(BCB)\\include;$(BCB)\\include\\vcl;\n\n"
+    "[HistoryLists\\hlLibraryPath]\nCount=1\nItem0=$(BCB)\\lib\\obj;$(BCB)\\lib\n\n"
+    "[HistoryLists\\hlDebugSourcePath]\nCount=1\nItem0=$(BCB)\\source\\vcl\\\n\n"
+    "[HistoryLists\\hlConditionals]\nCount=1\nItem0=_DEBUG\n\n"
+    "[HistoryLists\\hlIntOutputDir]\nCount=0\n\n"
+    "[HistoryLists\\hlFinalOutputDir]\nCount=0\n\n"
+    "[HistoryLists\\hIBPIOutputDir]\nCount=0\n\n"
+    "[Debugging]\nDebugSourceDirs=$(BCB)\\source\\vcl\n\n"
+    "[Parameters]\nRunParams=\nLauncher=\nUseLauncher=0\nDebugCWD=\nHostApplication=\nRemoteHost=\nRemotePath=\nRemoteLauncher=\nRemoteCWD=\nRemoteDebug=0\n\n"
+    "[Compiler]\nShowInfoMsgs=0\nLinkDebugVcl=0\nLinkCGLIB=0\n\n"
+    "[CORBA]\nAddServerUnit=1\nAddClientUnit=1\nPrecompiledHeaders=1\n\n"
+    "[Language]\nActiveLang=\nProjectLang=\nRootDir=\n";
+
+  fprintf(project->stream, ide_options);
 }
 
-void
-borland_project_close(borland_project_t project)
+void borland_project_close(borland_project_t project)
 {
-    fclose(project->stream);
+  fclose(project->stream);
 }
 
-void
-generate_borland_simulation_project(const char* name)
+void generate_borland_simulation_project(const char *name)
 {
-    char buffer[MAX_PATH] = {0};
+  char buffer[MAX_PATH] = { 0 };
 
-    HANDLE hDir;
-    WIN32_FIND_DATA wfd = {0};
+  HANDLE hDir;
+  WIN32_FIND_DATA wfd = { 0 };
 
-    s_borland_project_t borland_project = {0};
-    borland_project.xml_version = "1.0";
-    borland_project.encoding ="utf-8";
-    borland_project.comment ="C++Builder XML Project";
-    borland_project.version = "BCB.06.00";
+  s_borland_project_t borland_project = { 0 };
+  borland_project.xml_version = "1.0";
+  borland_project.encoding = "utf-8";
+  borland_project.comment = "C++Builder XML Project";
+  borland_project.version = "BCB.06.00";
 
-    borland_project.lib_dir = xbt_new0(char,MAX_PATH);
+  borland_project.lib_dir = xbt_new0(char, MAX_PATH);
 
-    
-    GetEnvironmentVariable("LIB_SIMGRID_PATH",borland_project.lib_dir,MAX_PATH);
-               
 
-    GetCurrentDirectory(MAX_PATH,buffer);
+  GetEnvironmentVariable("LIB_SIMGRID_PATH", borland_project.lib_dir,
+                         MAX_PATH);
 
-    borland_project.src_dir = xbt_new0(char,strlen(buffer) + 1);
 
-    strcpy(borland_project.src_dir,buffer);
+  GetCurrentDirectory(MAX_PATH, buffer);
 
-    borland_project.name = xbt_new0(char,strlen(name) + strlen("simulator") + 2);
-    sprintf(borland_project.name,"%s_simulator",name);
+  borland_project.src_dir = xbt_new0(char, strlen(buffer) + 1);
 
-    borland_project.bin_dir = xbt_new0(char,strlen(buffer) + strlen("\\bin") + 1);
-    sprintf(borland_project.bin_dir,"%s\\bin",buffer);
+  strcpy(borland_project.src_dir, buffer);
 
-    hDir = FindFirstFile(borland_project.bin_dir,&wfd);
+  borland_project.name =
+    xbt_new0(char, strlen(name) + strlen("simulator") + 2);
+  sprintf(borland_project.name, "%s_simulator", name);
 
-    if(!hDir)
-        CreateDirectory(borland_project.bin_dir,NULL);
+  borland_project.bin_dir =
+    xbt_new0(char, strlen(buffer) + strlen("\\bin") + 1);
+  sprintf(borland_project.bin_dir, "%s\\bin", buffer);
 
-    borland_project.obj_dir = xbt_new0(char,strlen(buffer) + strlen("\\obj") + 1);
-    sprintf(borland_project.obj_dir,"%s\\obj",buffer);
+  hDir = FindFirstFile(borland_project.bin_dir, &wfd);
 
-    hDir = FindFirstFile(borland_project.obj_dir,&wfd);
+  if (!hDir)
+    CreateDirectory(borland_project.bin_dir, NULL);
 
-    if(INVALID_HANDLE_VALUE == hDir)
-        CreateDirectory(borland_project.obj_dir,NULL);
+  borland_project.obj_dir =
+    xbt_new0(char, strlen(buffer) + strlen("\\obj") + 1);
+  sprintf(borland_project.obj_dir, "%s\\obj", buffer);
 
-    generate_borland_project(&borland_project,0,name);
+  hDir = FindFirstFile(borland_project.obj_dir, &wfd);
 
-    xbt_free(borland_project.name);
-    xbt_free(borland_project.src_dir);
-    xbt_free(borland_project.bin_dir);
-    xbt_free(borland_project.obj_dir);
-    xbt_free(borland_project.lib_dir);
+  if (INVALID_HANDLE_VALUE == hDir)
+    CreateDirectory(borland_project.obj_dir, NULL);
+
+  generate_borland_project(&borland_project, 0, name);
+
+  xbt_free(borland_project.name);
+  xbt_free(borland_project.src_dir);
+  xbt_free(borland_project.bin_dir);
+  xbt_free(borland_project.obj_dir);
+  xbt_free(borland_project.lib_dir);
 }
 
-void
-generate_borland_real_life_project(const char* name)
+void generate_borland_real_life_project(const char *name)
 {
-    HANDLE hDir;
-    WIN32_FIND_DATA wfd = {0};
-    char buffer[MAX_PATH] = {0};
-    xbt_dict_cursor_t cursor = NULL;
-    char *key = NULL;
-    void *data = NULL;
-       s_borland_project_t borland_project = {0};
+  HANDLE hDir;
+  WIN32_FIND_DATA wfd = { 0 };
+  char buffer[MAX_PATH] = { 0 };
+  xbt_dict_cursor_t cursor = NULL;
+  char *key = NULL;
+  void *data = NULL;
+  s_borland_project_t borland_project = { 0 };
 
-       borland_project.xml_version = "1.0";
-    borland_project.encoding ="utf-8";
-    borland_project.comment ="C++Builder XML Project";
-    borland_project.version = "BCB.06.00";
+  borland_project.xml_version = "1.0";
+  borland_project.encoding = "utf-8";
+  borland_project.comment = "C++Builder XML Project";
+  borland_project.version = "BCB.06.00";
 
-    borland_project.lib_dir = xbt_new0(char,MAX_PATH);
+  borland_project.lib_dir = xbt_new0(char, MAX_PATH);
 
-    GetEnvironmentVariable("LIB_GRAS_PATH",borland_project.lib_dir,MAX_PATH);
-       
-    GetCurrentDirectory(MAX_PATH,buffer);
+  GetEnvironmentVariable("LIB_GRAS_PATH", borland_project.lib_dir, MAX_PATH);
 
-    borland_project.src_dir = xbt_new0(char,strlen(buffer) + 1);
+  GetCurrentDirectory(MAX_PATH, buffer);
 
-    strcpy(borland_project.src_dir,buffer);
+  borland_project.src_dir = xbt_new0(char, strlen(buffer) + 1);
 
-    borland_project.bin_dir = xbt_new0(char,strlen(buffer) + strlen("\\bin") + 1);
-    sprintf(borland_project.bin_dir,"%s\\bin",buffer);
+  strcpy(borland_project.src_dir, buffer);
 
-    hDir = FindFirstFile(borland_project.bin_dir,&wfd);
+  borland_project.bin_dir =
+    xbt_new0(char, strlen(buffer) + strlen("\\bin") + 1);
+  sprintf(borland_project.bin_dir, "%s\\bin", buffer);
 
-    if(INVALID_HANDLE_VALUE == hDir)
-        CreateDirectory(borland_project.bin_dir,NULL);
+  hDir = FindFirstFile(borland_project.bin_dir, &wfd);
 
-    borland_project.obj_dir = xbt_new0(char,strlen(buffer) + strlen("\\obj") + 1);
-    sprintf(borland_project.obj_dir,"%s\\obj",buffer);
+  if (INVALID_HANDLE_VALUE == hDir)
+    CreateDirectory(borland_project.bin_dir, NULL);
 
-    hDir = FindFirstFile(borland_project.obj_dir,&wfd);
+  borland_project.obj_dir =
+    xbt_new0(char, strlen(buffer) + strlen("\\obj") + 1);
+  sprintf(borland_project.obj_dir, "%s\\obj", buffer);
 
-    if(!hDir)
-        CreateDirectory(borland_project.obj_dir,NULL);
+  hDir = FindFirstFile(borland_project.obj_dir, &wfd);
 
+  if (!hDir)
+    CreateDirectory(borland_project.obj_dir, NULL);
 
-       xbt_dict_foreach(process_function_set,cursor,key,data) {
-        borland_project.name = xbt_new0(char,strlen(name) + strlen(key) + 2);
 
-        sprintf(borland_project.name,"%s_%s",name,key);
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    borland_project.name = xbt_new0(char, strlen(name) + strlen(key) + 2);
 
-        generate_borland_project(&borland_project,1,name);
-        xbt_free(borland_project.name);
-    }
+    sprintf(borland_project.name, "%s_%s", name, key);
+
+    generate_borland_project(&borland_project, 1, name);
+    xbt_free(borland_project.name);
+  }
 
-    xbt_free(borland_project.src_dir);
-    xbt_free(borland_project.bin_dir);
-    xbt_free(borland_project.obj_dir);
-    xbt_free(borland_project.lib_dir);
+  xbt_free(borland_project.src_dir);
+  xbt_free(borland_project.bin_dir);
+  xbt_free(borland_project.obj_dir);
+  xbt_free(borland_project.lib_dir);
 }
-int
-find_file_path(const char* root_dir,const char* file_name,char* path)
+
+int find_file_path(const char *root_dir, const char *file_name, char *path)
 {
-       HANDLE hFind;
-       WIN32_FIND_DATA wfd;
-       char* prev_dir = xbt_new(char,MAX_PATH);
-       GetCurrentDirectory(MAX_PATH,prev_dir);
-       SetCurrentDirectory(root_dir);
-       
-       // begining of the scan
-       hFind=FindFirstFile ("*.*", &wfd);
-       
-       if(hFind!=INVALID_HANDLE_VALUE){
-       
-               /* it's a file */
-               if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
-               
-                       if(!strcmp(file_name,wfd.cFileName)){
-                               GetCurrentDirectory(MAX_PATH,path);
-                               SetCurrentDirectory(prev_dir);
-                               xbt_free(prev_dir);
-                               FindClose(hFind);
-                               return 1;
-                       }
-               
-               }
-               /* it's a directory, scan it*/
-               else {
-               
-                       if(strcmp(wfd.cFileName,".") && strcmp(wfd.cFileName,"..")){
-                               if(find_file_path(wfd.cFileName,file_name,path)){
-                                       FindClose(hFind);
-                                       SetCurrentDirectory(prev_dir);
-                                       return 1;
-                               }
-                       }
-               }
-               
-               /* next file or directory */
-               while(FindNextFile(hFind,&wfd))
-               {
-                       /* it's a file */
-                       if(!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
-                       {
-                               if(!strcmp(file_name,wfd.cFileName)){
-                                       GetCurrentDirectory(MAX_PATH,path);
-                                       SetCurrentDirectory(prev_dir);
-                                       xbt_free(prev_dir);
-                                       FindClose(hFind);
-                                       return 1;
-                               }
-                       }
-                       /* it's a file scan it */
-                       else {
-               
-                               if(strcmp(wfd.cFileName,".") && strcmp(wfd.cFileName,"..")){
-               
-                                       if(find_file_path(wfd.cFileName,file_name,path)){
-                                               SetCurrentDirectory(prev_dir);
-                                               FindClose(hFind);
-                                               return 1;
-                                       }
-               
-                               }
-               
-                       }
-               }
-       }
-       
-       SetCurrentDirectory(prev_dir);
-       xbt_free(prev_dir);
-       FindClose (hFind);
-       return 0;
+  HANDLE hFind;
+  WIN32_FIND_DATA wfd;
+  char *prev_dir = xbt_new(char, MAX_PATH);
+  GetCurrentDirectory(MAX_PATH, prev_dir);
+  SetCurrentDirectory(root_dir);
+
+  // begining of the scan
+  hFind = FindFirstFile("*.*", &wfd);
+
+  if (hFind != INVALID_HANDLE_VALUE) {
+
+    /* it's a file */
+    if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+
+      if (!strcmp(file_name, wfd.cFileName)) {
+        GetCurrentDirectory(MAX_PATH, path);
+        SetCurrentDirectory(prev_dir);
+        xbt_free(prev_dir);
+        FindClose(hFind);
+        return 1;
+      }
+
+    }
+    /* it's a directory, scan it */
+    else {
+
+      if (strcmp(wfd.cFileName, ".") && strcmp(wfd.cFileName, "..")) {
+        if (find_file_path(wfd.cFileName, file_name, path)) {
+          FindClose(hFind);
+          SetCurrentDirectory(prev_dir);
+          return 1;
+        }
+      }
+    }
+
+    /* next file or directory */
+    while (FindNextFile(hFind, &wfd)) {
+      /* it's a file */
+      if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+        if (!strcmp(file_name, wfd.cFileName)) {
+          GetCurrentDirectory(MAX_PATH, path);
+          SetCurrentDirectory(prev_dir);
+          xbt_free(prev_dir);
+          FindClose(hFind);
+          return 1;
+        }
+      }
+      /* it's a file scan it */
+      else {
+
+        if (strcmp(wfd.cFileName, ".") && strcmp(wfd.cFileName, "..")) {
+
+          if (find_file_path(wfd.cFileName, file_name, path)) {
+            SetCurrentDirectory(prev_dir);
+            FindClose(hFind);
+            return 1;
+          }
+
+        }
+
+      }
+    }
+  }
+
+  SetCurrentDirectory(prev_dir);
+  xbt_free(prev_dir);
+  FindClose(hFind);
+  return 0;
 }
 
 /* Implementation of the functions used to create a Visual C++ project.*/
 
-int
-generate_simulation_dsp_file(const char* name)
+int generate_simulation_dsp_file(const char *name)
 {
-       char buffer[MAX_PATH] = {0};
-    s_dsp_t dsp = {0};
-    dsp.lib_dir = xbt_new0(char,MAX_PATH);
+  char buffer[MAX_PATH] = { 0 };
+  s_dsp_t dsp = { 0 };
+  dsp.lib_dir = xbt_new0(char, MAX_PATH);
 
-    GetEnvironmentVariable("LIB_SIMGRID_PATH",dsp.lib_dir,MAX_PATH);
-    GetCurrentDirectory(MAX_PATH,buffer);
+  GetEnvironmentVariable("LIB_SIMGRID_PATH", dsp.lib_dir, MAX_PATH);
+  GetCurrentDirectory(MAX_PATH, buffer);
 
-    dsp.src_dir = xbt_new0(char,strlen(buffer) + 1);
-    strcpy(dsp.src_dir,buffer);
-       dsp.name = xbt_new0(char,strlen(name) + strlen("simulator") + 2);
-       sprintf(dsp.name,"%s_simulator",name);
+  dsp.src_dir = xbt_new0(char, strlen(buffer) + 1);
+  strcpy(dsp.src_dir, buffer);
+  dsp.name = xbt_new0(char, strlen(name) + strlen("simulator") + 2);
+  sprintf(dsp.name, "%s_simulator", name);
 
-    generate_dsp_project(&dsp,0,name);
+  generate_dsp_project(&dsp, 0, name);
 
-    xbt_free(dsp.name);
-    xbt_free(dsp.src_dir);
-       xbt_free(dsp.lib_dir);
-    
-    return 0;          
+  xbt_free(dsp.name);
+  xbt_free(dsp.src_dir);
+  xbt_free(dsp.lib_dir);
+
+  return 0;
 }
 
 /*
  * Create the Microsoft visual C++ real life project file.
  */
-int
-generate_real_live_dsp_file(const char* name)
+int generate_real_live_dsp_file(const char *name)
 {
-       
-    char buffer[MAX_PATH] = {0};
-    xbt_dict_cursor_t cursor = NULL;
-    char *key = NULL;
-    void *data = NULL;
-       s_dsp_t dsp = {0};
 
-       
-    dsp.lib_dir = xbt_new0(char,MAX_PATH);
+  char buffer[MAX_PATH] = { 0 };
+  xbt_dict_cursor_t cursor = NULL;
+  char *key = NULL;
+  void *data = NULL;
+  s_dsp_t dsp = { 0 };
 
-    GetEnvironmentVariable("LIB_GRAS_PATH",dsp.lib_dir,MAX_PATH);
-       
-    GetCurrentDirectory(MAX_PATH,buffer);
 
-    dsp.src_dir = xbt_new0(char,strlen(buffer) + 1);
+  dsp.lib_dir = xbt_new0(char, MAX_PATH);
 
-    strcpy(dsp.src_dir,buffer);
+  GetEnvironmentVariable("LIB_GRAS_PATH", dsp.lib_dir, MAX_PATH);
 
+  GetCurrentDirectory(MAX_PATH, buffer);
 
-       xbt_dict_foreach(process_function_set,cursor,key,data) {
-        dsp.name = xbt_new0(char,strlen(name) + strlen(key) + 2);
+  dsp.src_dir = xbt_new0(char, strlen(buffer) + 1);
 
-        sprintf(dsp.name,"%s_%s",name,key);
+  strcpy(dsp.src_dir, buffer);
 
-        generate_dsp_project(&dsp,1,name);
-        xbt_free(dsp.name);
-    }
 
-    xbt_free(dsp.src_dir);
-    xbt_free(dsp.lib_dir);
-       return 0;
-}
+  xbt_dict_foreach(process_function_set, cursor, key, data) {
+    dsp.name = xbt_new0(char, strlen(name) + strlen(key) + 2);
 
-void
-generate_dsp_project(dsp_t project,int is_rl,const char* name)
-{
-       /* create the visual C++ project file */
-       char* buffer;
-       char* file_name = xbt_new0(char,strlen(project->name) + 5);
-    sprintf(file_name,"%s.dsp",project->name);
-    project->stream = fopen(file_name,"w+");
-    xbt_free(file_name);
-    
-    if(!__gras_path)
-       {
-       buffer =xbt_new0(char,MAX_PATH);
-       GetEnvironmentVariable("SG_INSTALL_DIR",buffer,MAX_PATH);
-       
-               __gras_path = xbt_new0(char,MAX_PATH);
-               sprintf(__gras_path,"%s\\simgrid\\include",buffer);
-               free(buffer);
-    }
-    
-    /* dsp file header */
-    fprintf(project->stream,"# Microsoft Developer Studio Project File - Name=\"%s\" - Package Owner=<4>\n",project->name);
-       fprintf(project->stream,"# Microsoft Developer Studio Generated Build File, Format Version 6.00\n");
-       fprintf(project->stream,"# ** DO NOT EDIT **\n\n");
-       
-       /* target type is a win32 x86 console application */
-       fprintf(project->stream,"# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n\n");
-       
-       /* the current config is win32-debug */
-       fprintf(project->stream,"CFG=%s - Win32 Debug\n",project->name);
-       
-       /* warning */
-       fprintf(project->stream,"!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n");
-       
-       /* NMAKE usage */
-       fprintf(project->stream,"!MESSAGE use the Export Makefile command and run\n");
-       fprintf(project->stream,"!MESSAGE\n");
-       fprintf(project->stream,"!MESSAGE NMAKE /f \"%s.mak\".\n",project->name);
-       fprintf(project->stream,"!MESSAGE\n");
-       fprintf(project->stream,"!MESSAGE You can specify a configuration when running NMAKE\n");
-       fprintf(project->stream,"!MESSAGE by defining the macro CFG on the command line. For example:\n");
-       fprintf(project->stream,"!MESSAGE\n"); 
-       fprintf(project->stream,"!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s - Win32 Debug\"\n",project->name,project->name);
-       fprintf(project->stream,"!MESSAGE\n");
-       fprintf(project->stream,"!MESSAGE Possible choices for configuration are:\n");
-       fprintf(project->stream,"!MESSAGE\n"); 
-       fprintf(project->stream,"!MESSAGE \"%s - Win32 Release\" (based on \"Win32 (x86) Console Application\")\n",project->name);
-       fprintf(project->stream,"!MESSAGE \"%s - Win32 Debug\" (based on \"Win32 (x86) Console Application\")\n",project->name);
-       fprintf(project->stream,"!MESSAGE\n\n"); 
-       
-       fprintf(project->stream,"# Begin Project\n\n");
-       fprintf(project->stream,"# PROP AllowPerConfigDependencies 0\n");
-       fprintf(project->stream,"# PROP Scc_ProjName\n");
-       fprintf(project->stream,"# PROP Scc_LocalPath\n");
-       fprintf(project->stream,"CPP=cl.exe\n");
-       fprintf(project->stream,"RSC=rc.exe\n\n");
-       
-       fprintf(project->stream,"!IF  \"$(CFG)\" == \"%s - Win32 Release\"\n\n",project->name);
-       
-       fprintf(project->stream,"# PROP BASE Use_MFC 0\n");
-       fprintf(project->stream,"# PROP BASE Use_Debug_Libraries 0\n");
-       fprintf(project->stream,"# PROP BASE Output_Dir \"Release\"\n");
-       fprintf(project->stream,"# PROP BASE Intermediate_Dir \"Release\"\n");
-       fprintf(project->stream,"# PROP BASE Target_Dir \"\"\n");
-       fprintf(project->stream,"# PROP Use_MFC 0\n");
-       fprintf(project->stream,"# PROP Use_Debug_Libraries 0\n");
-       fprintf(project->stream,"# PROP Output_Dir \"Release\"\n");
-       fprintf(project->stream,"# PROP Intermediate_Dir \"Release\"\n");
-       fprintf(project->stream,"# PROP Target_Dir \"\"\n");
-       /* TODO : the include directory */
-       /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /GX /O2 /I \"./%s\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n",__gras_path);*/
-       fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /GX /O2 /I \"%s\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n",__gras_path);
-       fprintf(project->stream,"# ADD CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n");
-       fprintf(project->stream,"# ADD BASE RSC /l 0x40c /d \"NDEBUG\"\n");
-       fprintf(project->stream,"# ADD RSC /l 0x40c /d \"NDEBUG\n");
-       fprintf(project->stream,"BSC32=bscmake.exe\n");
-       fprintf(project->stream,"# ADD BASE BSC32 /nologo\n");
-       fprintf(project->stream,"# ADD BSC32 /nologo\n");
-       fprintf(project->stream,"LINK32=link.exe\n");
-       fprintf(project->stream,"# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\n");
-       
-       if(is_rl)
-               fprintf(project->stream,"# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libgras.lib /nologo /subsystem:console /machine:I386\n\n");
-       else
-               fprintf(project->stream,"# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib simgrid.lib /nologo /subsystem:console /machine:I386\n\n");
-                       
-       fprintf(project->stream,"!ELSEIF  \"$(CFG)\" == \"%s - Win32 Debug\"\n",project->name);
-
-       fprintf(project->stream,"# PROP BASE Use_MFC 0\n");
-       fprintf(project->stream,"# PROP BASE Use_Debug_Libraries 1\n");
-       fprintf(project->stream,"# PROP BASE Output_Dir \"Debug\"\n");
-       fprintf(project->stream,"# PROP BASE Intermediate_Dir \"Debug\"\n");
-       fprintf(project->stream,"# PROP BASE Target_Dir \"\"\n");
-       fprintf(project->stream,"# PROP Use_MFC 0\n");
-       fprintf(project->stream,"# PROP Use_Debug_Libraries 1\n");
-       fprintf(project->stream,"# PROP Output_Dir \"Debug\"\n");
-       fprintf(project->stream,"# PROP Intermediate_Dir \"Debug\"\n");
-       fprintf(project->stream,"# PROP Ignore_Export_Lib 0\n");
-       fprintf(project->stream,"# PROP Target_Dir \"\"\n");
-       /* TODO : the include directory */
-       /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od  /I \"./%s\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ  /c\n",__gras_path);*/
-       fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od  /I \"%s\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ  /c\n",__gras_path);
-       fprintf(project->stream,"# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ  /c\n");
-       fprintf(project->stream,"# ADD BASE RSC /l 0x40c /d \"_DEBUG\"\n");
-       fprintf(project->stream,"# ADD RSC /l 0x40c /d \"_DEBUG\"\n");
-       fprintf(project->stream,"BSC32=bscmake.exe\n");
-       fprintf(project->stream,"# ADD BASE BSC32 /nologo\n");
-       fprintf(project->stream,"# ADD BSC32 /nologo\n");
-       fprintf(project->stream,"LINK32=link.exe\n");
-       fprintf(project->stream,"# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n");
-       
-       if(is_rl)
-               fprintf(project->stream,"# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib simgrid.lib  libgras.lib  /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n\n");
-       else
-               fprintf(project->stream,"# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib simgrid.lib  simgrid.lib  /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n\n");
-                       
-       fprintf(project->stream,"!ENDIF\n\n");
-       
-       fprintf(project->stream,"# Begin Target\n\n");
-       fprintf(project->stream,"# Name \"%s - Win32 Release\"\n",project->name);
-       fprintf(project->stream,"# Name \"%s - Win32 Debug\"\n",project->name);
-       fprintf(project->stream,"# Begin Group \"Source Files\"\n\n");
-       fprintf(project->stream,"# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n\n");
-       
-       fprintf(project->stream,"# Begin Source File\n");
-       fprintf(project->stream,"SOURCE=%s\\_%s.c\n",project->src_dir,project->name);
-       fprintf(project->stream,"# End Source File\n\n");
-       
-       fprintf(project->stream,"# Begin Source File\n");
-       fprintf(project->stream,"SOURCE=%s\\%s.c\n",project->src_dir,name);
-       fprintf(project->stream,"# End Source File\n\n");
-       
-       fprintf(project->stream,"# End Group\n");
-       fprintf(project->stream,"# Begin Group \"Header Files\"\n\n");
-       fprintf(project->stream,"# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n");
-       fprintf(project->stream,"# End Group\n");
-       fprintf(project->stream,"# Begin Group \"Resource Files\"\n\n");
-       fprintf(project->stream,"# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n");
-       fprintf(project->stream,"# End Group\n");
-       fprintf(project->stream,"# End Target\n");
-       fprintf(project->stream,"# End Project\n");
-       
-}
-
-#endif
+    sprintf(dsp.name, "%s_%s", name, key);
 
+    generate_dsp_project(&dsp, 1, name);
+    xbt_free(dsp.name);
+  }
 
+  xbt_free(dsp.src_dir);
+  xbt_free(dsp.lib_dir);
+  return 0;
+}
 
+void generate_dsp_project(dsp_t project, int is_rl, const char *name)
+{
+  /* create the visual C++ project file */
+  char *buffer;
+  char *file_name = xbt_new0(char, strlen(project->name) + 5);
+  sprintf(file_name, "%s.dsp", project->name);
+  project->stream = fopen(file_name, "w+");
+  xbt_free(file_name);
+
+  if (!__gras_path) {
+    buffer = xbt_new0(char, MAX_PATH);
+    GetEnvironmentVariable("SG_INSTALL_DIR", buffer, MAX_PATH);
+
+    __gras_path = xbt_new0(char, MAX_PATH);
+    sprintf(__gras_path, "%s\\simgrid\\include", buffer);
+    free(buffer);
+  }
+
+  /* dsp file header */
+  fprintf(project->stream,
+          "# Microsoft Developer Studio Project File - Name=\"%s\" - Package Owner=<4>\n",
+          project->name);
+  fprintf(project->stream,
+          "# Microsoft Developer Studio Generated Build File, Format Version 6.00\n");
+  fprintf(project->stream, "# ** DO NOT EDIT **\n\n");
+
+  /* target type is a win32 x86 console application */
+  fprintf(project->stream,
+          "# TARGTYPE \"Win32 (x86) Console Application\" 0x0103\n\n");
+
+  /* the current config is win32-debug */
+  fprintf(project->stream, "CFG=%s - Win32 Debug\n", project->name);
+
+  /* warning */
+  fprintf(project->stream,
+          "!MESSAGE This is not a valid makefile. To build this project using NMAKE,\n");
+
+  /* NMAKE usage */
+  fprintf(project->stream,
+          "!MESSAGE use the Export Makefile command and run\n");
+  fprintf(project->stream, "!MESSAGE\n");
+  fprintf(project->stream, "!MESSAGE NMAKE /f \"%s.mak\".\n", project->name);
+  fprintf(project->stream, "!MESSAGE\n");
+  fprintf(project->stream,
+          "!MESSAGE You can specify a configuration when running NMAKE\n");
+  fprintf(project->stream,
+          "!MESSAGE by defining the macro CFG on the command line. For example:\n");
+  fprintf(project->stream, "!MESSAGE\n");
+  fprintf(project->stream,
+          "!MESSAGE NMAKE /f \"%s.mak\" CFG=\"%s - Win32 Debug\"\n",
+          project->name, project->name);
+  fprintf(project->stream, "!MESSAGE\n");
+  fprintf(project->stream,
+          "!MESSAGE Possible choices for configuration are:\n");
+  fprintf(project->stream, "!MESSAGE\n");
+  fprintf(project->stream,
+          "!MESSAGE \"%s - Win32 Release\" (based on \"Win32 (x86) Console Application\")\n",
+          project->name);
+  fprintf(project->stream,
+          "!MESSAGE \"%s - Win32 Debug\" (based on \"Win32 (x86) Console Application\")\n",
+          project->name);
+  fprintf(project->stream, "!MESSAGE\n\n");
+
+  fprintf(project->stream, "# Begin Project\n\n");
+  fprintf(project->stream, "# PROP AllowPerConfigDependencies 0\n");
+  fprintf(project->stream, "# PROP Scc_ProjName\n");
+  fprintf(project->stream, "# PROP Scc_LocalPath\n");
+  fprintf(project->stream, "CPP=cl.exe\n");
+  fprintf(project->stream, "RSC=rc.exe\n\n");
+
+  fprintf(project->stream, "!IF  \"$(CFG)\" == \"%s - Win32 Release\"\n\n",
+          project->name);
+
+  fprintf(project->stream, "# PROP BASE Use_MFC 0\n");
+  fprintf(project->stream, "# PROP BASE Use_Debug_Libraries 0\n");
+  fprintf(project->stream, "# PROP BASE Output_Dir \"Release\"\n");
+  fprintf(project->stream, "# PROP BASE Intermediate_Dir \"Release\"\n");
+  fprintf(project->stream, "# PROP BASE Target_Dir \"\"\n");
+  fprintf(project->stream, "# PROP Use_MFC 0\n");
+  fprintf(project->stream, "# PROP Use_Debug_Libraries 0\n");
+  fprintf(project->stream, "# PROP Output_Dir \"Release\"\n");
+  fprintf(project->stream, "# PROP Intermediate_Dir \"Release\"\n");
+  fprintf(project->stream, "# PROP Target_Dir \"\"\n");
+  /* TODO : the include directory */
+  /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /GX /O2 /I \"./%s\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n",__gras_path); */
+  fprintf(project->stream,
+          "# ADD BASE CPP /nologo /W3 /GX /O2 /I \"%s\" /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n",
+          __gras_path);
+  fprintf(project->stream,
+          "# ADD CPP /nologo /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /c\n");
+  fprintf(project->stream, "# ADD BASE RSC /l 0x40c /d \"NDEBUG\"\n");
+  fprintf(project->stream, "# ADD RSC /l 0x40c /d \"NDEBUG\n");
+  fprintf(project->stream, "BSC32=bscmake.exe\n");
+  fprintf(project->stream, "# ADD BASE BSC32 /nologo\n");
+  fprintf(project->stream, "# ADD BSC32 /nologo\n");
+  fprintf(project->stream, "LINK32=link.exe\n");
+  fprintf(project->stream,
+          "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\n");
+
+  if (is_rl)
+    fprintf(project->stream,
+            "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libgras.lib /nologo /subsystem:console /machine:I386\n\n");
+  else
+    fprintf(project->stream,
+            "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib simgrid.lib /nologo /subsystem:console /machine:I386\n\n");
+
+  fprintf(project->stream, "!ELSEIF  \"$(CFG)\" == \"%s - Win32 Debug\"\n",
+          project->name);
+
+  fprintf(project->stream, "# PROP BASE Use_MFC 0\n");
+  fprintf(project->stream, "# PROP BASE Use_Debug_Libraries 1\n");
+  fprintf(project->stream, "# PROP BASE Output_Dir \"Debug\"\n");
+  fprintf(project->stream, "# PROP BASE Intermediate_Dir \"Debug\"\n");
+  fprintf(project->stream, "# PROP BASE Target_Dir \"\"\n");
+  fprintf(project->stream, "# PROP Use_MFC 0\n");
+  fprintf(project->stream, "# PROP Use_Debug_Libraries 1\n");
+  fprintf(project->stream, "# PROP Output_Dir \"Debug\"\n");
+  fprintf(project->stream, "# PROP Intermediate_Dir \"Debug\"\n");
+  fprintf(project->stream, "# PROP Ignore_Export_Lib 0\n");
+  fprintf(project->stream, "# PROP Target_Dir \"\"\n");
+  /* TODO : the include directory */
+  /*fprintf(project->stream,"# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od  /I \"./%s\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ  /c\n",__gras_path); */
+  fprintf(project->stream,
+          "# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od  /I \"%s\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ  /c\n",
+          __gras_path);
+  fprintf(project->stream,
+          "# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /YX /FD /GZ  /c\n");
+  fprintf(project->stream, "# ADD BASE RSC /l 0x40c /d \"_DEBUG\"\n");
+  fprintf(project->stream, "# ADD RSC /l 0x40c /d \"_DEBUG\"\n");
+  fprintf(project->stream, "BSC32=bscmake.exe\n");
+  fprintf(project->stream, "# ADD BASE BSC32 /nologo\n");
+  fprintf(project->stream, "# ADD BSC32 /nologo\n");
+  fprintf(project->stream, "LINK32=link.exe\n");
+  fprintf(project->stream,
+          "# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n");
+
+  if (is_rl)
+    fprintf(project->stream,
+            "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib simgrid.lib  libgras.lib  /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n\n");
+  else
+    fprintf(project->stream,
+            "# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib simgrid.lib  simgrid.lib  /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\n\n");
+
+  fprintf(project->stream, "!ENDIF\n\n");
+
+  fprintf(project->stream, "# Begin Target\n\n");
+  fprintf(project->stream, "# Name \"%s - Win32 Release\"\n", project->name);
+  fprintf(project->stream, "# Name \"%s - Win32 Debug\"\n", project->name);
+  fprintf(project->stream, "# Begin Group \"Source Files\"\n\n");
+  fprintf(project->stream,
+          "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat\"\n\n");
+
+  fprintf(project->stream, "# Begin Source File\n");
+  fprintf(project->stream, "SOURCE=%s\\_%s.c\n", project->src_dir,
+          project->name);
+  fprintf(project->stream, "# End Source File\n\n");
+
+  fprintf(project->stream, "# Begin Source File\n");
+  fprintf(project->stream, "SOURCE=%s\\%s.c\n", project->src_dir, name);
+  fprintf(project->stream, "# End Source File\n\n");
+
+  fprintf(project->stream, "# End Group\n");
+  fprintf(project->stream, "# Begin Group \"Header Files\"\n\n");
+  fprintf(project->stream, "# PROP Default_Filter \"h;hpp;hxx;hm;inl\"\n");
+  fprintf(project->stream, "# End Group\n");
+  fprintf(project->stream, "# Begin Group \"Resource Files\"\n\n");
+  fprintf(project->stream,
+          "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\"\n");
+  fprintf(project->stream, "# End Group\n");
+  fprintf(project->stream, "# End Target\n");
+  fprintf(project->stream, "# End Project\n");
 
+}
 
+#endif
index e24dd3e..e72d7b1 100644 (file)
@@ -25,26 +25,30 @@ xbt_os_mutex_t armageddon_mutex = NULL;
  * Module management
  */
 
-static void kill_it(void*r) {
-  rctx_t rctx = *(rctx_t*)r;
+static void kill_it(void *r)
+{
+  rctx_t rctx = *(rctx_t *) r;
 
-  VERB2("Join thread %p which were running background cmd <%s>",rctx->runner,rctx->filepos);
-  xbt_os_thread_join(rctx->runner,NULL);
+  VERB2("Join thread %p which were running background cmd <%s>", rctx->runner,
+        rctx->filepos);
+  xbt_os_thread_join(rctx->runner, NULL);
   rctx_free(rctx);
 }
 
-void rctx_init(void) {
-  bg_jobs = xbt_dynar_new_sync(sizeof(rctx_t),kill_it);
+void rctx_init(void)
+{
+  bg_jobs = xbt_dynar_new_sync(sizeof(rctx_t), kill_it);
   armageddon_mutex = xbt_os_mutex_init();
   armageddon_initiator = NULL;
 }
 
-void rctx_exit(void) {
+void rctx_exit(void)
+{
   if (bg_jobs) {
     /* Do not use xbt_dynar_free or it will lock the dynar, preventing armageddon from working */
     while (xbt_dynar_length(bg_jobs)) {
       rctx_t rctx;
-      xbt_dynar_pop(bg_jobs,&rctx);
+      xbt_dynar_pop(bg_jobs, &rctx);
       kill_it(&rctx);
     }
     xbt_dynar_free(&bg_jobs);
@@ -52,23 +56,26 @@ void rctx_exit(void) {
   xbt_os_mutex_destroy(armageddon_mutex);
 }
 
-void rctx_wait_bg(void) {
+void rctx_wait_bg(void)
+{
   if (bg_jobs) {
     /* Do not use xbt_dynar_free or it will lock the dynar, preventing armageddon from working */
     while (xbt_dynar_length(bg_jobs)) {
       rctx_t rctx;
-      xbt_dynar_pop(bg_jobs,&rctx);
+      xbt_dynar_pop(bg_jobs, &rctx);
       kill_it(&rctx);
     }
     xbt_dynar_free(&bg_jobs);
   }
-  bg_jobs = xbt_dynar_new_sync(sizeof(rctx_t),kill_it);
+  bg_jobs = xbt_dynar_new_sync(sizeof(rctx_t), kill_it);
 }
 
-void rctx_armageddon(rctx_t initiator, int exitcode) {
+void rctx_armageddon(rctx_t initiator, int exitcode)
+{
   rctx_t rctx;
 
-  DEBUG2("Armageddon request by <%s> (exit=%d)",initiator->filepos,exitcode);
+  DEBUG2("Armageddon request by <%s> (exit=%d)", initiator->filepos,
+         exitcode);
   xbt_os_mutex_acquire(armageddon_mutex);
   if (armageddon_initiator != NULL) {
     VERB0("Armageddon already started. Let it go");
@@ -76,22 +83,24 @@ void rctx_armageddon(rctx_t initiator, int exitcode) {
     xbt_os_mutex_release(armageddon_mutex);
     return;
   }
-  DEBUG1("Armageddon request by <%s> got the lock. Let's go amok",initiator->filepos);
+  DEBUG1("Armageddon request by <%s> got the lock. Let's go amok",
+         initiator->filepos);
   armageddon_initiator = initiator;
   xbt_os_mutex_release(armageddon_mutex);
 
   /* Kill any background commands */
   while (xbt_dynar_length(bg_jobs)) {
-    xbt_dynar_pop(bg_jobs,&rctx);
+    xbt_dynar_pop(bg_jobs, &rctx);
     if (rctx != initiator) {
-      INFO2("Kill <%s> because <%s> failed",rctx->filepos,initiator->filepos);
+      INFO2("Kill <%s> because <%s> failed", rctx->filepos,
+            initiator->filepos);
       xbt_os_mutex_acquire(rctx->interruption);
       rctx->interrupted = 1;
       xbt_os_mutex_release(rctx->interruption);
       if (!rctx->reader_done) {
-        kill(rctx->pid,SIGTERM);
+        kill(rctx->pid, SIGTERM);
         usleep(100);
-        kill(rctx->pid,SIGKILL);
+        kill(rctx->pid, SIGKILL);
       }
     }
   }
@@ -104,9 +113,10 @@ void rctx_armageddon(rctx_t initiator, int exitcode) {
  * Memory management
  */
 
-void rctx_empty(rctx_t rc) {
+void rctx_empty(rctx_t rc)
+{
   int i;
-  char **env_it=environ;
+  char **env_it = environ;
 
   if (rc->cmd)
     free(rc->cmd);
@@ -116,11 +126,11 @@ void rctx_empty(rctx_t rc) {
   if (rc->env)
     free(rc->env);
 
-  for (i=0;*env_it;i++,env_it++);
+  for (i = 0; *env_it; i++, env_it++);
   i++;
   rc->env_size = i;
-  rc->env = malloc(i*sizeof(char*));
-  memcpy(rc->env,environ,i*sizeof(char*));
+  rc->env = malloc(i * sizeof(char *));
+  memcpy(rc->env, environ, i * sizeof(char *));
 
   rc->filepos = NULL;
   rc->is_empty = 1;
@@ -136,20 +146,22 @@ void rctx_empty(rctx_t rc) {
 }
 
 
-rctx_t rctx_new() {
-  rctx_t res = xbt_new0(s_rctx_t,1);
+rctx_t rctx_new()
+{
+  rctx_t res = xbt_new0(s_rctx_t, 1);
 
-  res->input=xbt_strbuff_new();
-  res->output_wanted=xbt_strbuff_new();
-  res->output_got=xbt_strbuff_new();
+  res->input = xbt_strbuff_new();
+  res->output_wanted = xbt_strbuff_new();
+  res->output_got = xbt_strbuff_new();
   res->interruption = xbt_os_mutex_init();
   rctx_empty(res);
   return res;
 }
 
-void rctx_free(rctx_t rctx) {
+void rctx_free(rctx_t rctx)
+{
   DEBUG1("RCTX: Free %p", rctx);
-  rctx_dump(rctx,"free");
+  rctx_dump(rctx, "free");
   if (!rctx)
     return;
 
@@ -166,14 +178,15 @@ void rctx_free(rctx_t rctx) {
   free(rctx);
 }
 
-void rctx_dump(rctx_t rctx, const char *str) {
+void rctx_dump(rctx_t rctx, const char *str)
+{
   DEBUG9("%s RCTX %p={in%p={%d,%10s}, want={%d,%10s}, out={%d,%10s}}",
          str, rctx,
-         rctx->input,              rctx->input->used,        rctx->input->data,
-         rctx->output_wanted->used,rctx->output_wanted->data,
-         rctx->output_got->used,   rctx->output_got->data);
+         rctx->input, rctx->input->used, rctx->input->data,
+         rctx->output_wanted->used, rctx->output_wanted->data,
+         rctx->output_got->used, rctx->output_got->data);
   DEBUG5("%s RCTX %p=[cmd%p=%10s, pid=%d]",
-         str,rctx,rctx->cmd,rctx->cmd,rctx->pid);
+         str, rctx, rctx->cmd, rctx->cmd, rctx->pid);
 
 }
 
@@ -181,96 +194,97 @@ void rctx_dump(rctx_t rctx, const char *str) {
  * Getting instructions from the file
  */
 
-void rctx_pushline(const char* filepos, char kind, char *line) {
+void rctx_pushline(const char *filepos, char kind, char *line)
+{
 
   switch (kind) {
-    case '$':
-    case '&':
-      if (rctx->cmd) {
-        if (!rctx->is_empty) {
-          ERROR2("[%s] More than one command in this chunk of lines (previous: %s).\n"
-                 " Cannot guess which input/output belongs to which command.",
-                 filepos,rctx->cmd);
-          ERROR1("Test suite `%s': NOK (syntax error)",testsuite_name);
-          rctx_armageddon(rctx,1);
-          return;
-        }
-        rctx_start();
-        VERB1("[%s] More than one command in this chunk of lines",filepos);
-      }
-      if (kind == '&')
-        rctx->is_background = 1;
-      else
-        rctx->is_background = 0;
-
-      rctx->cmd = xbt_strdup(line);
-      rctx->filepos = xbt_strdup(filepos);
-      INFO3("[%s] %s%s",filepos,rctx->cmd,
-            ((rctx->is_background)?" (background command)":""));
-
-      break;
-
-    case '<':
-      rctx->is_empty = 0;
-      xbt_strbuff_append(rctx->input,line);
-      xbt_strbuff_append(rctx->input,"\n");
-      break;
-
-    case '>':
-      rctx->is_empty = 0;
-      xbt_strbuff_append(rctx->output_wanted,line);
-      xbt_strbuff_append(rctx->output_wanted,"\n");
-      break;
-
-    case '!':
-      if (rctx->cmd)
-        rctx_start();
-
-      if (!strncmp(line,"timeout no",strlen("timeout no"))) {
-        VERB1("[%s] (disable timeout)", filepos);
-        timeout_value = -1;
-      } else if (!strncmp(line,"timeout ",strlen("timeout "))) {
-        timeout_value=atoi(line+strlen("timeout"));
-        VERB2("[%s] (new timeout value: %d)",
-              filepos,timeout_value);
-
-      } else if (!strncmp(line,"expect signal ",strlen("expect signal "))) {
-        rctx->expected_signal = strdup(line + strlen("expect signal "));
-        xbt_str_trim(rctx->expected_signal," \n");
-        VERB2("[%s] (next command must raise signal %s)",
-              filepos, rctx->expected_signal);
-
-      } else if (!strncmp(line,"expect return ",strlen("expect return "))) {
-        rctx->expected_return = atoi(line+strlen("expect return "));
-        VERB2("[%s] (next command must return code %d)",
-              filepos, rctx->expected_return);
-
-      } else if (!strncmp(line,"output ignore",strlen("output ignore"))) {
-        rctx->output = e_output_ignore;
-        VERB1("[%s] (ignore output of next command)", filepos);
-
-      } else if (!strncmp(line,"output display",strlen("output display"))) {
-        rctx->output = e_output_display;
-        VERB1("[%s] (ignore output of next command)", filepos);
-
-      } else if (!strncmp(line,"setenv ",strlen("setenv "))) {
-        int len = strlen("setenv ");
-        char *eq = strchr(line+len,'=');
-        char *key = bprintf("%.*s",(int)(eq-line-len),line+len);
-        xbt_dict_set(env,key,xbt_strdup(eq+1),xbt_free_f);
-
-        rctx->env = realloc(rctx->env,++(rctx->env_size)*sizeof(char*));
-        rctx->env[rctx->env_size-2] = xbt_strdup(line+len);
-        rctx->env[rctx->env_size-1] = NULL;
-        VERB2("[%s] setenv %s", filepos,line+len);
-
-      } else {
-        ERROR2("%s: Malformed metacommand: %s",filepos,line);
-        ERROR1("Test suite `%s': NOK (syntax error)",testsuite_name);
-        rctx_armageddon(rctx,1);
+  case '$':
+  case '&':
+    if (rctx->cmd) {
+      if (!rctx->is_empty) {
+        ERROR2
+          ("[%s] More than one command in this chunk of lines (previous: %s).\n"
+           " Cannot guess which input/output belongs to which command.",
+           filepos, rctx->cmd);
+        ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+        rctx_armageddon(rctx, 1);
         return;
       }
-      break;
+      rctx_start();
+      VERB1("[%s] More than one command in this chunk of lines", filepos);
+    }
+    if (kind == '&')
+      rctx->is_background = 1;
+    else
+      rctx->is_background = 0;
+
+    rctx->cmd = xbt_strdup(line);
+    rctx->filepos = xbt_strdup(filepos);
+    INFO3("[%s] %s%s", filepos, rctx->cmd,
+          ((rctx->is_background) ? " (background command)" : ""));
+
+    break;
+
+  case '<':
+    rctx->is_empty = 0;
+    xbt_strbuff_append(rctx->input, line);
+    xbt_strbuff_append(rctx->input, "\n");
+    break;
+
+  case '>':
+    rctx->is_empty = 0;
+    xbt_strbuff_append(rctx->output_wanted, line);
+    xbt_strbuff_append(rctx->output_wanted, "\n");
+    break;
+
+  case '!':
+    if (rctx->cmd)
+      rctx_start();
+
+    if (!strncmp(line, "timeout no", strlen("timeout no"))) {
+      VERB1("[%s] (disable timeout)", filepos);
+      timeout_value = -1;
+    } else if (!strncmp(line, "timeout ", strlen("timeout "))) {
+      timeout_value = atoi(line + strlen("timeout"));
+      VERB2("[%s] (new timeout value: %d)", filepos, timeout_value);
+
+    } else if (!strncmp(line, "expect signal ", strlen("expect signal "))) {
+      rctx->expected_signal = strdup(line + strlen("expect signal "));
+      xbt_str_trim(rctx->expected_signal, " \n");
+      VERB2("[%s] (next command must raise signal %s)",
+            filepos, rctx->expected_signal);
+
+    } else if (!strncmp(line, "expect return ", strlen("expect return "))) {
+      rctx->expected_return = atoi(line + strlen("expect return "));
+      VERB2("[%s] (next command must return code %d)",
+            filepos, rctx->expected_return);
+
+    } else if (!strncmp(line, "output ignore", strlen("output ignore"))) {
+      rctx->output = e_output_ignore;
+      VERB1("[%s] (ignore output of next command)", filepos);
+
+    } else if (!strncmp(line, "output display", strlen("output display"))) {
+      rctx->output = e_output_display;
+      VERB1("[%s] (ignore output of next command)", filepos);
+
+    } else if (!strncmp(line, "setenv ", strlen("setenv "))) {
+      int len = strlen("setenv ");
+      char *eq = strchr(line + len, '=');
+      char *key = bprintf("%.*s", (int) (eq - line - len), line + len);
+      xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
+
+      rctx->env = realloc(rctx->env, ++(rctx->env_size) * sizeof(char *));
+      rctx->env[rctx->env_size - 2] = xbt_strdup(line + len);
+      rctx->env[rctx->env_size - 1] = NULL;
+      VERB2("[%s] setenv %s", filepos, line + len);
+
+    } else {
+      ERROR2("%s: Malformed metacommand: %s", filepos, line);
+      ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+      rctx_armageddon(rctx, 1);
+      return;
+    }
+    break;
   }
 }
 
@@ -281,64 +295,69 @@ void rctx_pushline(const char* filepos, char kind, char *line) {
 /* The IO of the childs are handled by the two following threads
    (one pair per child) */
 
-static void* thread_writer(void *r) {
+static void *thread_writer(void *r)
+{
   int posw;
-  rctx_t rctx = (rctx_t)r;
-  for (posw=0; posw<rctx->input->used && !rctx->brokenpipe; ) {
+  rctx_t rctx = (rctx_t) r;
+  for (posw = 0; posw < rctx->input->used && !rctx->brokenpipe;) {
     int got;
-    DEBUG1("Still %d chars to write",rctx->input->used-posw);
-    got=write(rctx->child_to,rctx->input->data+posw,rctx->input->used-posw);
-    if (got>0)
-      posw+=got;
-    if (got<0) {
+    DEBUG1("Still %d chars to write", rctx->input->used - posw);
+    got =
+      write(rctx->child_to, rctx->input->data + posw,
+            rctx->input->used - posw);
+    if (got > 0)
+      posw += got;
+    if (got < 0) {
       if (errno == EPIPE) {
         rctx->brokenpipe = 1;
-      } else if (errno!=EINTR && errno!=EAGAIN && errno!=EPIPE) {
+      } else if (errno != EINTR && errno != EAGAIN && errno != EPIPE) {
         perror("Error while writing input to child");
-        ERROR1("Test suite `%s': NOK (system error)",testsuite_name);
-        rctx_armageddon(rctx,4);
+        ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+        rctx_armageddon(rctx, 4);
         return NULL;
       }
     }
-    DEBUG1("written %d chars so far",posw);
+    DEBUG1("written %d chars so far", posw);
 
     if (got <= 0)
       usleep(100);
   }
-  rctx->input->data[0]='\0';
-  rctx->input->used=0;
+  rctx->input->data[0] = '\0';
+  rctx->input->used = 0;
   close(rctx->child_to);
 
   return NULL;
 }
-static void *thread_reader(void *r) {
-  rctx_t rctx = (rctx_t)r;
-  char *buffout=malloc(4096);
+
+static void *thread_reader(void *r)
+{
+  rctx_t rctx = (rctx_t) r;
+  char *buffout = malloc(4096);
   int posr, got_pid;
 
   do {
-    posr=read(rctx->child_from,buffout,4095);
-    if (posr<0 && errno!=EINTR && errno!=EAGAIN) {
+    posr = read(rctx->child_from, buffout, 4095);
+    if (posr < 0 && errno != EINTR && errno != EAGAIN) {
       perror("Error while reading output of child");
       ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
-      rctx_armageddon(rctx,4);
+      rctx_armageddon(rctx, 4);
       return NULL;
     }
-    if (posr>0) {
-      buffout[posr]='\0';
-      xbt_strbuff_append(rctx->output_got,buffout);
+    if (posr > 0) {
+      buffout[posr] = '\0';
+      xbt_strbuff_append(rctx->output_got, buffout);
     } else {
       usleep(100);
     }
-  } while (!rctx->timeout && posr!=0);
+  } while (!rctx->timeout && posr != 0);
   free(buffout);
 
   /* let this thread wait for the child so that the main thread can detect the timeout without blocking on the wait */
-  got_pid = waitpid(rctx->pid,&rctx->status,0);
+  got_pid = waitpid(rctx->pid, &rctx->status, 0);
   if (got_pid != rctx->pid) {
-    perror(bprintf("Cannot wait for the child %s",rctx->cmd));
+    perror(bprintf("Cannot wait for the child %s", rctx->cmd));
     ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
-    rctx_armageddon(rctx,4);
+    rctx_armageddon(rctx, 4);
     return NULL;
   }
 
@@ -347,35 +366,38 @@ static void *thread_reader(void *r) {
 }
 
 /* Special command: mkfile is a building creating a file with the input data as content */
-static void rctx_mkfile(void) {
+static void rctx_mkfile(void)
+{
   char *filename = xbt_strdup(rctx->cmd + strlen("mkfile "));
-  FILE*OUT;
-  xbt_str_trim(filename,NULL);
-  OUT=fopen(filename,"w");
+  FILE *OUT;
+  xbt_str_trim(filename, NULL);
+  OUT = fopen(filename, "w");
   if (!OUT) {
     free(filename);
-    THROW3(system_error,errno,"%s: Cannot create file %s: %s",rctx->filepos,filename,strerror(errno));
+    THROW3(system_error, errno, "%s: Cannot create file %s: %s",
+           rctx->filepos, filename, strerror(errno));
   }
-  fprintf(OUT,"%s",rctx->input->data);
+  fprintf(OUT, "%s", rctx->input->data);
   fclose(OUT);
 }
 
 /* function to be called from the child to start the actual process */
-static void start_command(rctx_t rctx){
+static void start_command(rctx_t rctx)
+{
   xbt_dynar_t cmd = xbt_str_split_quoted(rctx->cmd);
   char *binary_name = NULL;
   unsigned int it;
   char *str;
-  xbt_dynar_get_cpy(cmd,0,&binary_name);
-  char **args = xbt_new(char*,xbt_dynar_length(cmd)+1);
+  xbt_dynar_get_cpy(cmd, 0, &binary_name);
+  char **args = xbt_new(char *, xbt_dynar_length(cmd) + 1);
   int errcode;
 
-  if (!strncmp(rctx->cmd,"mkfile ",strlen("mkfile "))) {
+  if (!strncmp(rctx->cmd, "mkfile ", strlen("mkfile "))) {
     rctx_mkfile();
-    exit(0); /* end the working child */
+    exit(0);                    /* end the working child */
   }
 
-  xbt_dynar_foreach(cmd,it,str) {
+  xbt_dynar_foreach(cmd, it, str) {
     args[it] = xbt_strdup(str);
   }
   args[it] = NULL;
@@ -407,7 +429,7 @@ static void start_command(rctx_t rctx){
         xbt_dynar_free(&path);
         if (stat(binary_name, &stat_buf)) {
           /* not found */
-          printf("TESH_ERROR Command %s not found\n",args[0]);
+          printf("TESH_ERROR Command %s not found\n", args[0]);
           exit(127);
         }
         break;
@@ -418,35 +440,38 @@ static void start_command(rctx_t rctx){
   }
 
   errcode = execve(binary_name, args, rctx->env);
-  printf("TESH_ERROR %s: Cannot start %s: %s\n",rctx->filepos,rctx->cmd, strerror(errcode));
+  printf("TESH_ERROR %s: Cannot start %s: %s\n", rctx->filepos, rctx->cmd,
+         strerror(errcode));
   exit(127);
 }
 
 /* Start a new child, plug the pipes as expected and fire up the
    helping threads. Is also waits for the child to end if this is a
    foreground job, or fire up a thread to wait otherwise. */
-void rctx_start(void) {
+void rctx_start(void)
+{
   int child_in[2];
   int child_out[2];
 
-  DEBUG1("Cmd before rewriting %s",rctx->cmd);
-  rctx->cmd = xbt_str_varsubst(rctx->cmd,env);
-  VERB2("Start %s %s",rctx->cmd,(rctx->is_background?"(background job)":""));
+  DEBUG1("Cmd before rewriting %s", rctx->cmd);
+  rctx->cmd = xbt_str_varsubst(rctx->cmd, env);
+  VERB2("Start %s %s", rctx->cmd,
+        (rctx->is_background ? "(background job)" : ""));
   if (pipe(child_in) || pipe(child_out)) {
     perror("Cannot open the pipes");
     ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
-    rctx_armageddon(rctx,4);
+    rctx_armageddon(rctx, 4);
   }
 
-  rctx->pid=fork();
-  if (rctx->pid<0) {
+  rctx->pid = fork();
+  if (rctx->pid < 0) {
     perror("Cannot fork the command");
     ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
-    rctx_armageddon(rctx,4);
+    rctx_armageddon(rctx, 4);
     return;
   }
 
-  if (rctx->pid) { /* father */
+  if (rctx->pid) {              /* father */
     close(child_in[0]);
     rctx->child_to = child_in[1];
 
@@ -459,18 +484,20 @@ void rctx_start(void) {
       rctx->end_time = -1;
 
     rctx->reader_done = 0;
-    rctx->reader = xbt_os_thread_create("reader",thread_reader,(void*)rctx);
-    rctx->writer = xbt_os_thread_create("writer",thread_writer,(void*)rctx);
+    rctx->reader =
+      xbt_os_thread_create("reader", thread_reader, (void *) rctx);
+    rctx->writer =
+      xbt_os_thread_create("writer", thread_writer, (void *) rctx);
 
-  } else { /* child */
+  } else {                      /* child */
 
     close(child_in[1]);
-    dup2(child_in[0],0);
+    dup2(child_in[0], 0);
     close(child_in[0]);
 
     close(child_out[0]);
-    dup2(child_out[1],1);
-    dup2(child_out[1],2);
+    dup2(child_out[1], 1);
+    dup2(child_out[1], 2);
     close(child_out[1]);
 
     start_command(rctx);
@@ -486,14 +513,13 @@ void rctx_start(void) {
     xbt_os_thread_t runner;
 
     rctx = rctx_new();
-    DEBUG2("RCTX: new bg=%p, new fg=%p",old,rctx);
+    DEBUG2("RCTX: new bg=%p, new fg=%p", old, rctx);
 
-    DEBUG2("Launch a thread to wait for %s %d",old->cmd,old->pid);
-    runner = xbt_os_thread_create(old->cmd,rctx_wait,(void*)old);
+    DEBUG2("Launch a thread to wait for %s %d", old->cmd, old->pid);
+    runner = xbt_os_thread_create(old->cmd, rctx_wait, (void *) old);
     old->runner = runner;
-    VERB3("Launched thread %p to wait for %s %d",
-          runner,old->cmd, old->pid);
-    xbt_dynar_push(bg_jobs,&old);
+    VERB3("Launched thread %p to wait for %s %d", runner, old->cmd, old->pid);
+    xbt_dynar_push(bg_jobs, &old);
   }
 }
 
@@ -502,43 +528,45 @@ void rctx_start(void) {
    thread (for foreground jobs) or in a separate one for background jobs.
    That explains the prototype, forced by xbt_os_thread_create. */
 
-void *rctx_wait(void* r) {
-  rctx_t rctx = (rctx_t)r;
+void *rctx_wait(void *r)
+{
+  rctx_t rctx = (rctx_t) r;
   int errcode = 0;
   int now = time(NULL);
 
-  rctx_dump(rctx,"wait");
+  rctx_dump(rctx, "wait");
 
   if (!rctx->is_stoppable)
-    THROW1(unknown_error,0,"Cmd '%s' not started yet. Cannot wait it",
+    THROW1(unknown_error, 0, "Cmd '%s' not started yet. Cannot wait it",
            rctx->cmd);
 
   /* Wait for the child to die or the timeout to happen (or an armageddon to happen) */
-  while (!rctx->interrupted && !rctx->reader_done && (rctx->end_time <0 ||rctx->end_time >= now)) {
+  while (!rctx->interrupted && !rctx->reader_done
+         && (rctx->end_time < 0 || rctx->end_time >= now)) {
     usleep(100);
     now = time(NULL);
   }
 
   xbt_os_mutex_acquire(rctx->interruption);
   if (!rctx->interrupted && rctx->end_time > 0 && rctx->end_time < now) {
-    INFO1("<%s> timeouted. Kill the process.",rctx->filepos);
+    INFO1("<%s> timeouted. Kill the process.", rctx->filepos);
     rctx->timeout = 1;
-    kill(rctx->pid,SIGTERM);
+    kill(rctx->pid, SIGTERM);
     usleep(100);
-    kill(rctx->pid,SIGKILL);
+    kill(rctx->pid, SIGKILL);
     rctx->reader_done = 1;
   }
 
   /* Make sure helper threads die.
      Cannot block since they wait for the child we just killed
      if not already dead. */
-  xbt_os_thread_join(rctx->writer,NULL);
-  xbt_os_thread_join(rctx->reader,NULL);
+  xbt_os_thread_join(rctx->writer, NULL);
+  xbt_os_thread_join(rctx->reader, NULL);
 
   /*  xbt_os_mutex_release(rctx->interruption);
-  if (rctx->interrupted)
-    return NULL;
-    xbt_os_mutex_acquire(rctx->interruption);*/
+     if (rctx->interrupted)
+     return NULL;
+     xbt_os_mutex_acquire(rctx->interruption); */
 
   xbt_strbuff_chomp(rctx->output_got);
   xbt_strbuff_chomp(rctx->output_wanted);
@@ -553,12 +581,11 @@ void *rctx_wait(void* r) {
   if (rctx->timeout) {
     if (rctx->output_got->data[0])
       INFO2("<%s> Output on timeout:\n%s",
-            rctx->filepos,rctx->output_got->data);
+            rctx->filepos, rctx->output_got->data);
     else
-      INFO1("<%s> No output before timeout",
-            rctx->filepos);
+      INFO1("<%s> No output before timeout", rctx->filepos);
     ERROR3("Test suite `%s': NOK (<%s> timeout after %d sec)",
-           testsuite_name,rctx->filepos,timeout_value);
+           testsuite_name, rctx->filepos, timeout_value);
     DEBUG2("<%s> Interrupted = %d", rctx->filepos, rctx->interrupted);
     if (!rctx->interrupted) {
       rctx_armageddon(rctx, 3);
@@ -566,35 +593,35 @@ void *rctx_wait(void* r) {
     }
   }
 
-  DEBUG2("RCTX=%p (pid=%d)",rctx,rctx->pid);
-  DEBUG3("Status(%s|%d)=%d",rctx->cmd,rctx->pid,rctx->status);
+  DEBUG2("RCTX=%p (pid=%d)", rctx, rctx->pid);
+  DEBUG3("Status(%s|%d)=%d", rctx->cmd, rctx->pid, rctx->status);
 
   if (!rctx->interrupted) {
     if (WIFSIGNALED(rctx->status) && !rctx->expected_signal) {
       ERROR3("Test suite `%s': NOK (<%s> got signal %s)",
              testsuite_name, rctx->filepos,
-             signal_name(WTERMSIG(rctx->status),NULL));
-      errcode = WTERMSIG(rctx->status)+4;
+             signal_name(WTERMSIG(rctx->status), NULL));
+      errcode = WTERMSIG(rctx->status) + 4;
     }
 
     if (WIFSIGNALED(rctx->status) && rctx->expected_signal &&
-        strcmp(signal_name(WTERMSIG(rctx->status),rctx->expected_signal),
+        strcmp(signal_name(WTERMSIG(rctx->status), rctx->expected_signal),
                rctx->expected_signal)) {
       ERROR4("Test suite `%s': NOK (%s got signal %s instead of %s)",
              testsuite_name, rctx->filepos,
-             signal_name(WTERMSIG(rctx->status),rctx->expected_signal),
+             signal_name(WTERMSIG(rctx->status), rctx->expected_signal),
              rctx->expected_signal);
-      errcode = WTERMSIG(rctx->status)+4;
+      errcode = WTERMSIG(rctx->status) + 4;
     }
 
     if (!WIFSIGNALED(rctx->status) && rctx->expected_signal) {
       ERROR3("Test suite `%s': NOK (child %s expected signal %s)",
-             testsuite_name, rctx->filepos,
-             rctx->expected_signal);
+             testsuite_name, rctx->filepos, rctx->expected_signal);
       errcode = 5;
     }
 
-    if (WIFEXITED(rctx->status) && WEXITSTATUS(rctx->status) != rctx->expected_return ) {
+    if (WIFEXITED(rctx->status)
+        && WEXITSTATUS(rctx->status) != rctx->expected_return) {
       if (rctx->expected_return)
         ERROR4("Test suite `%s': NOK (<%s> returned code %d instead of %d)",
                testsuite_name, rctx->filepos,
@@ -602,53 +629,58 @@ void *rctx_wait(void* r) {
       else
         ERROR3("Test suite `%s': NOK (<%s> returned code %d)",
                testsuite_name, rctx->filepos, WEXITSTATUS(rctx->status));
-      errcode = 40+WEXITSTATUS(rctx->status);
+      errcode = 40 + WEXITSTATUS(rctx->status);
 
     }
     rctx->expected_return = 0;
 
-    if(rctx->expected_signal){
+    if (rctx->expected_signal) {
       free(rctx->expected_signal);
       rctx->expected_signal = NULL;
     }
   }
-  while (rctx->output_got->used && !strncmp(rctx->output_got->data,"TESH_ERROR ", strlen("TESH_ERROR "))) {
+  while (rctx->output_got->used
+         && !strncmp(rctx->output_got->data, "TESH_ERROR ",
+                     strlen("TESH_ERROR "))) {
     int marklen = strlen("TESH_ERROR ");
-    char *endline = strchr(rctx->output_got->data,'\n');
+    char *endline = strchr(rctx->output_got->data, '\n');
 
-    CRITICAL2("%.*s",(int)(endline -rctx->output_got->data-marklen), rctx->output_got->data+marklen);
-    memmove(rctx->output_got->data, rctx->output_got->data+marklen, rctx->output_got->used - marklen);
-    rctx->output_got->used -= endline -rctx->output_got->data+1;
+    CRITICAL2("%.*s", (int) (endline - rctx->output_got->data - marklen),
+              rctx->output_got->data + marklen);
+    memmove(rctx->output_got->data, rctx->output_got->data + marklen,
+            rctx->output_got->used - marklen);
+    rctx->output_got->used -= endline - rctx->output_got->data + 1;
     rctx->output_got->data[rctx->output_got->used] = '\0';
-    errcode=1;
+    errcode = 1;
   }
 
-  if (   rctx->output == e_output_check
-      && (    rctx->output_got->used != rctx->output_wanted->used
+  if (rctx->output == e_output_check
+      && (rctx->output_got->used != rctx->output_wanted->used
           || strcmp(rctx->output_got->data, rctx->output_wanted->data))) {
-    if (XBT_LOG_ISENABLED(tesh,xbt_log_priority_info)) {
-      char *diff= xbt_str_diff(rctx->output_wanted->data,rctx->output_got->data);
-      ERROR2("Output of <%s> mismatch:\n%s",rctx->filepos,diff);
+    if (XBT_LOG_ISENABLED(tesh, xbt_log_priority_info)) {
+      char *diff =
+        xbt_str_diff(rctx->output_wanted->data, rctx->output_got->data);
+      ERROR2("Output of <%s> mismatch:\n%s", rctx->filepos, diff);
       free(diff);
     }
     ERROR2("Test suite `%s': NOK (<%s> output mismatch)",
-           testsuite_name,rctx->filepos);
+           testsuite_name, rctx->filepos);
 
-    errcode=2;
+    errcode = 2;
   } else if (rctx->output == e_output_ignore) {
-    INFO1("(ignoring the output of <%s> as requested)",rctx->filepos);
+    INFO1("(ignoring the output of <%s> as requested)", rctx->filepos);
   } else if (rctx->output == e_output_display) {
     xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");
-    char *out = xbt_str_join(a,"\n||");
+    char *out = xbt_str_join(a, "\n||");
     xbt_dynar_free(&a);
-    INFO1("Here is the (ignored) command output: \n||%s",out);
+    INFO1("Here is the (ignored) command output: \n||%s", out);
     free(out);
-  } else if ( (errcode&&errcode!=1) || rctx->interrupted) {
+  } else if ((errcode && errcode != 1) || rctx->interrupted) {
     /* checking output, and matching */
     xbt_dynar_t a = xbt_str_split(rctx->output_got->data, "\n");
-    char *out = xbt_str_join(a,"\n||");
+    char *out = xbt_str_join(a, "\n||");
     xbt_dynar_free(&a);
-    INFO2("Output of <%s> so far: \n||%s",rctx->filepos,out);
+    INFO2("Output of <%s> so far: \n||%s", rctx->filepos, out);
     free(out);
   }
 
@@ -665,4 +697,3 @@ void *rctx_wait(void* r) {
   xbt_os_mutex_release(rctx->interruption);
   return NULL;
 }
-
index ae8ff5d..43762e9 100644 (file)
 
 #include "tesh.h"
 
-typedef enum {e_output_check, e_output_display, e_output_ignore} e_output_handling_t;
+typedef enum { e_output_check, e_output_display,
+  e_output_ignore
+} e_output_handling_t;
 
 
 typedef struct {
   /* kind of job */
   char *cmd;
   char **env;
-  int  env_size;
+  int env_size;
   char *filepos;
   int pid;
   int is_background:1;
@@ -30,22 +32,22 @@ typedef struct {
   int brokenpipe:1;
   int timeout:1;
 
-  int reader_done:1; /* reader set this to true when he's done because
-                       the child is dead. The main thread use it to detect
-                       that the child is not dead before the end of timeout */
+  int reader_done:1;            /* reader set this to true when he's done because
+                                   the child is dead. The main thread use it to detect
+                                   that the child is not dead before the end of timeout */
 
-  int interrupted:1; /* Whether we got stopped by an armageddon */
-  xbt_os_mutex_t interruption; /* To allow main thread to kill a runner
-                              one only at certain points */
+  int interrupted:1;            /* Whether we got stopped by an armageddon */
+  xbt_os_mutex_t interruption;  /* To allow main thread to kill a runner
+                                   one only at certain points */
 
   e_output_handling_t output;
 
   int status;
 
   /* expected results */
-  int end_time; /* begin_time + timeout, as epoch */
-  char* expected_signal; /* name of signal to raise (or NULL if none) */
-  int expected_return; /* the exepeted return code of following command */
+  int end_time;                 /* begin_time + timeout, as epoch */
+  char *expected_signal;        /* name of signal to raise (or NULL if none) */
+  int expected_return;          /* the exepeted return code of following command */
 
   /* buffers */
   xbt_strbuff_t input;
@@ -53,8 +55,8 @@ typedef struct {
   xbt_strbuff_t output_got;
 
   /* Threads */
-  xbt_os_thread_t writer, reader; /* IO handlers */
-  xbt_os_thread_t runner; /* Main thread, counting for timeouts */
+  xbt_os_thread_t writer, reader;       /* IO handlers */
+  xbt_os_thread_t runner;       /* Main thread, counting for timeouts */
 
   /* Pipes from/to the child */
   int child_to, child_from;
@@ -77,16 +79,16 @@ void rctx_armageddon(rctx_t initiator, int exitcode);
 /* create a new empty running context */
 rctx_t rctx_new(void);
 void rctx_free(rctx_t rctx);
-void rctx_empty(rctx_t rc); /*reset to empty*/
-void rctx_dump(rctx_t rctx,const char *str);
+void rctx_empty(rctx_t rc);     /*reset to empty */
+void rctx_dump(rctx_t rctx, const char *str);
 
 
 /* Launch the current command */
 void rctx_start(void);
 /* Wait till the end of this command */
-void *rctx_wait(voidrctx);
+void *rctx_wait(void *rctx);
 
 /* Parse a line comming from the suite file, and add this into the rctx */
-void rctx_pushline(const char* filepos, char kind ,char *line);
+void rctx_pushline(const char *filepos, char kind, char *line);
 
 #endif /* TESH_RUN_CONTEXT_H */
index 020caa2..53559ed 100644 (file)
 #include <signal.h>
 
 typedef struct s_signal_entry {
-  const charname;
+  const char *name;
   int number;
-} s_signal_entry_t,signal_entry_t;
+} s_signal_entry_t, *signal_entry_t;
 
 static const s_signal_entry_t signals[] = {
{"SIGHUP"     ,SIGHUP},
{"SIGINT"     ,SIGINT},
{"SIGQUIT"    ,SIGQUIT},
{"SIGILL"     ,SIGILL},
{"SIGTRAP"    ,SIGTRAP},
{"SIGABRT"    ,SIGABRT},
{"SIGFPE"     ,SIGFPE},
{"SIGKILL"    ,SIGKILL},
{"SIGBUS"     ,SIGBUS},
{"SIGSEGV"    ,SIGSEGV},
{"SIGSYS"     ,SIGSYS},
{"SIGPIPE"    ,SIGPIPE},
{"SIGALRM"    ,SIGALRM},
{"SIGTERM"    ,SIGTERM},
{"SIGURG"     ,SIGURG},
{"SIGSTOP"    ,SIGSTOP},
{"SIGTSTP"    ,SIGTSTP},
{"SIGCONT"    ,SIGCONT},
{"SIGCHLD"    ,SIGCHLD},
{"SIGTTIN"    ,SIGTTIN},
{"SIGTTOU"    ,SIGTTOU},
{"SIGIO"      ,SIGIO},
{"SIGXCPU"    ,SIGXCPU},
{"SIGXFSZ"    ,SIGXFSZ},
{"SIGVTALRM"  ,SIGVTALRM},
{"SIGPROF"    ,SIGPROF},
{"SIGWINCH"   ,SIGWINCH},
{"SIGUSR1"    ,SIGUSR1},
{"SIGUSR2"    ,SIGUSR2},
{"SIG UNKNOWN"  ,-1}
 {"SIGHUP", SIGHUP},
 {"SIGINT", SIGINT},
 {"SIGQUIT", SIGQUIT},
 {"SIGILL", SIGILL},
 {"SIGTRAP", SIGTRAP},
 {"SIGABRT", SIGABRT},
 {"SIGFPE", SIGFPE},
 {"SIGKILL", SIGKILL},
 {"SIGBUS", SIGBUS},
 {"SIGSEGV", SIGSEGV},
 {"SIGSYS", SIGSYS},
 {"SIGPIPE", SIGPIPE},
 {"SIGALRM", SIGALRM},
 {"SIGTERM", SIGTERM},
 {"SIGURG", SIGURG},
 {"SIGSTOP", SIGSTOP},
 {"SIGTSTP", SIGTSTP},
 {"SIGCONT", SIGCONT},
 {"SIGCHLD", SIGCHLD},
 {"SIGTTIN", SIGTTIN},
 {"SIGTTOU", SIGTTOU},
 {"SIGIO", SIGIO},
 {"SIGXCPU", SIGXCPU},
 {"SIGXFSZ", SIGXFSZ},
 {"SIGVTALRM", SIGVTALRM},
 {"SIGPROF", SIGPROF},
 {"SIGWINCH", SIGWINCH},
 {"SIGUSR1", SIGUSR1},
 {"SIGUSR2", SIGUSR2},
 {"SIG UNKNOWN", -1}
 };
 
 
-const char* signal_name(unsigned int got, char *expected) {
+const char *signal_name(unsigned int got, char *expected)
+{
   int i;
 
   /* Make SIGBUS a synonym for SIGSEGV
      (segfault leads to any of them depending on the system) */
-  if((got == SIGBUS) && !strcmp("SIGSEGV",expected))
+  if ((got == SIGBUS) && !strcmp("SIGSEGV", expected))
     got = SIGSEGV;
 
-  for (i=0; signals[i].number != -1; i++)
+  for (i = 0; signals[i].number != -1; i++)
     if (signals[i].number == got)
       return (signals[i].name);
 
index a83a4e4..7b1a4c0 100644 (file)
 #include "tesh.h"
 #include "xbt.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(tesh,"TEst SHell utility");
+XBT_LOG_NEW_DEFAULT_CATEGORY(tesh, "TEst SHell utility");
 
 /*** Options ***/
-int timeout_value = 5; /* child timeout value */
+int timeout_value = 5;          /* child timeout value */
 
 char *testsuite_name;
-static void handle_line(const char * filepos, char *line) {
+static void handle_line(const char *filepos, char *line)
+{
   /* Search end */
-  xbt_str_rtrim(line+2,"\n");
+  xbt_str_rtrim(line + 2, "\n");
 
   /*
-  DEBUG7("rctx={%s,in={%d,>>%10s<<},exp={%d,>>%10s<<},got={%d,>>%10s<<}}",
-        rctx->cmd,
-        rctx->input->used,        rctx->input->data,
-        rctx->output_wanted->used,rctx->output_wanted->data,
-        rctx->output_got->used,   rctx->output_got->data);
+     DEBUG7("rctx={%s,in={%d,>>%10s<<},exp={%d,>>%10s<<},got={%d,>>%10s<<}}",
+     rctx->cmd,
+     rctx->input->used,        rctx->input->data,
+     rctx->output_wanted->used,rctx->output_wanted->data,
+     rctx->output_got->used,   rctx->output_got->data);
    */
-  DEBUG2("[%s] %s",filepos,line);
+  DEBUG2("[%s] %s", filepos, line);
 
   switch (line[0]) {
-    case '#': break;
-
-    case '$':
-      /* further trim useless chars which are significant for in/output */
-      xbt_str_rtrim(line+2," \t");
-
-      /* Deal with CD commands here, not in rctx */
-      if (!strncmp("cd ",line+2,3)) {
-        char *dir=line+4;
-
-        if (rctx->cmd)
-          rctx_start();
-
-        /* search beginning */
-        while (*(dir++) == ' ');
-        dir--;
-        VERB1("Saw cd '%s'",dir);
-        if (chdir(dir)) {
-          ERROR2("Chdir to %s failed: %s",dir,strerror(errno));
-          ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
-          rctx_armageddon(rctx,4);
-        }
-        break;
-      } /* else, pushline */
-    case '&':
-    case '<':
-    case '>':
-    case '!':
-      rctx_pushline(filepos, line[0], line+2 /* pass '$ ' stuff*/);
-      break;
+  case '#':
+    break;
 
-    case 'p':
-      INFO2("[%s] %s",filepos,line+2);
-      break;
-    case 'P':
-      CRITICAL2("[%s] %s",filepos,line+2);
-      break;
+  case '$':
+    /* further trim useless chars which are significant for in/output */
+    xbt_str_rtrim(line + 2, " \t");
+
+    /* Deal with CD commands here, not in rctx */
+    if (!strncmp("cd ", line + 2, 3)) {
+      char *dir = line + 4;
+
+      if (rctx->cmd)
+        rctx_start();
 
-    default:
-      ERROR2("[%s] Syntax error: %s",filepos, line);
-      ERROR1("Test suite `%s': NOK (syntax error)",testsuite_name);
-      rctx_armageddon(rctx,1);
+      /* search beginning */
+      while (*(dir++) == ' ');
+      dir--;
+      VERB1("Saw cd '%s'", dir);
+      if (chdir(dir)) {
+        ERROR2("Chdir to %s failed: %s", dir, strerror(errno));
+        ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+        rctx_armageddon(rctx, 4);
+      }
       break;
+    }                           /* else, pushline */
+  case '&':
+  case '<':
+  case '>':
+  case '!':
+    rctx_pushline(filepos, line[0], line + 2 /* pass '$ ' stuff */ );
+    break;
+
+  case 'p':
+    INFO2("[%s] %s", filepos, line + 2);
+    break;
+  case 'P':
+    CRITICAL2("[%s] %s", filepos, line + 2);
+    break;
+
+  default:
+    ERROR2("[%s] Syntax error: %s", filepos, line);
+    ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+    rctx_armageddon(rctx, 1);
+    break;
   }
 }
 
-static void handle_suite(const char* filename, FILE* IN) {
+static void handle_suite(const char *filename, FILE * IN)
+{
   size_t len;
-  char * line = NULL;
-  int line_num=0;
+  char *line = NULL;
+  int line_num = 0;
   char file_pos[256];
 
-  xbt_strbuff_t buff=xbt_strbuff_new();
+  xbt_strbuff_t buff = xbt_strbuff_new();
   int buffbegin = 0;
 
   rctx = rctx_new();
@@ -97,10 +100,11 @@ static void handle_suite(const char* filename, FILE* IN) {
     line_num++;
 
     /* Count the line length while checking wheather it's blank */
-    int blankline=1;
+    int blankline = 1;
     int linelen = 0;
     while (line[linelen] != '\0') {
-      if (line[linelen] != ' ' && line[linelen] != '\t' && line[linelen]!='\n')
+      if (line[linelen] != ' ' && line[linelen] != '\t'
+          && line[linelen] != '\n')
         blankline = 0;
       linelen++;
     }
@@ -109,8 +113,8 @@ static void handle_suite(const char* filename, FILE* IN) {
       if (!rctx->cmd && !rctx->is_empty) {
         ERROR1("[%d] Error: no command found in this chunk of lines.",
                buffbegin);
-        ERROR1("Test suite `%s': NOK (syntax error)",testsuite_name);
-        rctx_armageddon(rctx,1);
+        ERROR1("Test suite `%s': NOK (syntax error)", testsuite_name);
+        rctx_armageddon(rctx, 1);
       }
       if (rctx->cmd)
         rctx_start();
@@ -120,14 +124,14 @@ static void handle_suite(const char* filename, FILE* IN) {
 
     /* Deal with \ at the end of the line, and call handle_line on result */
     int to_be_continued = 0;
-    if (linelen>1 && line[linelen-2]=='\\') {
-      if (linelen>2 && line[linelen-3] == '\\') {
+    if (linelen > 1 && line[linelen - 2] == '\\') {
+      if (linelen > 2 && line[linelen - 3] == '\\') {
         /* Damn. Escaped \ */
-        line[linelen-2] = '\n';
-        line[linelen-1] = '\0';
+        line[linelen - 2] = '\n';
+        line[linelen - 1] = '\0';
       } else {
         to_be_continued = 1;
-        line[linelen-2] = '\0';
+        line[linelen - 2] = '\0';
         linelen -= 2;
         if (!buff->used)
           buffbegin = line_num;
@@ -135,16 +139,16 @@ static void handle_suite(const char* filename, FILE* IN) {
     }
 
     if (buff->used || to_be_continued) {
-      xbt_strbuff_append(buff,line);
+      xbt_strbuff_append(buff, line);
 
       if (!to_be_continued) {
-        snprintf(file_pos,256,"%s:%d",filename,buffbegin);
+        snprintf(file_pos, 256, "%s:%d", filename, buffbegin);
         handle_line(file_pos, buff->data);
         xbt_strbuff_empty(buff);
       }
 
     } else {
-      snprintf(file_pos,256,"%s:%d",filename,line_num);
+      snprintf(file_pos, 256, "%s:%d", filename, line_num);
       handle_line(file_pos, line);
     }
   }
@@ -163,20 +167,22 @@ static void handle_suite(const char* filename, FILE* IN) {
 
 }
 
-static void parse_environ(){
+static void parse_environ()
+{
   char *p;
   int i;
   env = xbt_dict_new();
-  for (i=0; environ[i];i++) {
-    p=environ[i];
-    char *eq = strchr(p,'=');
-    char *key = bprintf("%.*s",(int)(eq-p),p);
-    xbt_dict_set(env,key,xbt_strdup(eq+1),xbt_free_f);
+  for (i = 0; environ[i]; i++) {
+    p = environ[i];
+    char *eq = strchr(p, '=');
+    char *key = bprintf("%.*s", (int) (eq - p), p);
+    xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
     free(key);
   }
 }
 
-int main(int argc,char *argv[]) {
+int main(int argc, char *argv[])
+{
 
   FILE *IN;
   int i;
@@ -185,59 +191,60 @@ int main(int argc,char *argv[]) {
      They will show up when we try to send data to dead buddies,
      but we will stop doing so when we're done with provided input */
   struct sigaction newact;
-  memset(&newact,0, sizeof(newact));
-  newact.sa_handler=SIG_IGN;
-  sigaction(SIGPIPE,&newact,NULL);
+  memset(&newact, 0, sizeof(newact));
+  newact.sa_handler = SIG_IGN;
+  sigaction(SIGPIPE, &newact, NULL);
 
-  xbt_init(&argc,argv);
+  xbt_init(&argc, argv);
   rctx_init();
   parse_environ();
 
   /* Get args */
-  for (i=1; i<argc; i++) {
-     if (!strncmp(argv[i],"--cd",strlen("--cd")+1)) {
-       if (i == argc-1) {
-          ERROR0("--cd argument requires an argument");
-          exit(1);
-       } 
-       if (chdir(argv[i+1])) {      
-          ERROR2("Cannot change directory to %s: %s",argv[i+1],strerror(errno));
-          exit(1);
-       }       
-       INFO1("Change directory to %s",argv[i+1]);
-       memmove(argv+i,argv+i+2,argc-i-1);
-       argc-=2;
-     }     
+  for (i = 1; i < argc; i++) {
+    if (!strncmp(argv[i], "--cd", strlen("--cd") + 1)) {
+      if (i == argc - 1) {
+        ERROR0("--cd argument requires an argument");
+        exit(1);
+      }
+      if (chdir(argv[i + 1])) {
+        ERROR2("Cannot change directory to %s: %s", argv[i + 1],
+               strerror(errno));
+        exit(1);
+      }
+      INFO1("Change directory to %s", argv[i + 1]);
+      memmove(argv + i, argv + i + 2, argc - i - 1);
+      argc -= 2;
+    }
   }
-   
+
   /* Find the description file */
   if (argc == 1) {
     INFO0("Test suite from stdin");
     testsuite_name = xbt_strdup("(stdin)");
-    handle_suite("stdin",stdin);
+    handle_suite("stdin", stdin);
     INFO0("Test suite from stdin OK");
 
   } else {
-    for (i=1; i<argc; i++) {
-      char *suitename=xbt_strdup(argv[i]);
-      if (!strcmp("./",suitename))
-        memmove(suitename, suitename+2, strlen(suitename+2));
+    for (i = 1; i < argc; i++) {
+      char *suitename = xbt_strdup(argv[i]);
+      if (!strcmp("./", suitename))
+        memmove(suitename, suitename + 2, strlen(suitename + 2));
 
-      if (!strcmp(".tesh",suitename+strlen(suitename)-5))
-        suitename[strlen(suitename)-5] = '\0';
+      if (!strcmp(".tesh", suitename + strlen(suitename) - 5))
+        suitename[strlen(suitename) - 5] = '\0';
 
-      INFO1("Test suite `%s'",suitename);
+      INFO1("Test suite `%s'", suitename);
       testsuite_name = suitename;
-      IN=fopen(argv[i], "r");
+      IN = fopen(argv[i], "r");
       if (!IN) {
-        perror(bprintf("Impossible to open the suite file `%s'",argv[i]));
-        ERROR1("Test suite `%s': NOK (system error)",testsuite_name);
-        rctx_armageddon(rctx,1);
+        perror(bprintf("Impossible to open the suite file `%s'", argv[i]));
+        ERROR1("Test suite `%s': NOK (system error)", testsuite_name);
+        rctx_armageddon(rctx, 1);
       }
-      handle_suite(suitename,IN);
+      handle_suite(suitename, IN);
       rctx_wait_bg();
       fclose(IN);
-      INFO1("Test suite `%s' OK",suitename);
+      INFO1("Test suite `%s' OK", suitename);
       free(suitename);
     }
   }
@@ -246,4 +253,3 @@ int main(int argc,char *argv[]) {
   xbt_exit();
   return 0;
 }
-
index 8e7b17e..a3cbe9a 100644 (file)
 /******************************************/
 /* return the name of a signal, aliasing SIGBUS to SIGSEGV since
    segfault leads to any of them depending on the system */
-const charsignal_name(unsigned int got, char *expected);
+const char *signal_name(unsigned int got, char *expected);
 
 #include "run_context.h"
 
 /*** Options ***/
-int timeout_value; /* child timeout value */
+int timeout_value;              /* child timeout value */
 
 rctx_t rctx;
 char *testsuite_name;
@@ -40,6 +40,6 @@ char *testsuite_name;
 extern char **environ;
 # endif
 
-xbt_dict_t env; /* the environment, stored as a dict (for variable substitution) */
+xbt_dict_t env;                 /* the environment, stored as a dict (for variable substitution) */
 
 #endif /* TESH_H */