Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move datadesc and TCP sockets from GRAS to XBT.
authorChristophe Thiéry <christopho128@gmail.com>
Tue, 31 Jan 2012 16:01:30 +0000 (17:01 +0100)
committerChristophe Thiéry <christopho128@gmail.com>
Tue, 31 Jan 2012 16:39:01 +0000 (17:39 +0100)
XBT supports sockets with explicit choice of the transport plugin.
XBT provides only one transport plugin: TCP (i.e. real sockets) and
allows other layers to write their custom plugins.
GRAS implements such custom plugins: simulated sockets and file sockets.

TCP sockets only existed in GRAS RL mode. They can now also be used in
GRAS SG mode.
More pieces of GRAS remain to be moved to XBT before TCP sockets can
also be used outside GRAS (e.g. in SIMIX 3, one day, to distribute the
simulation).

85 files changed:
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MaintainerMode.cmake
buildtools/Cmake/Supernovae.cmake
examples/amok/bandwidth/bandwidth.c
examples/amok/saturate/env.c
examples/amok/saturate/saturate.c
examples/gras/all2all/all2all.c
examples/gras/console/ping_client.c
examples/gras/console/ping_common.c
examples/gras/console/ping_server.c
examples/gras/mmrpc/mmrpc.c
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/p2p/can/can.c
examples/gras/p2p/can/can_tests.c
examples/gras/p2p/chord/chord.c
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/replay/replay.c
examples/gras/replay/xbt_workload.c
examples/gras/rpc/rpc.c
include/amok/bandwidth.h
include/amok/peermanagement.h
include/gras.h
include/gras/emul.h
include/gras/messages.h
include/gras/transport.h
include/xbt.h
include/xbt/datadesc.h [moved from include/gras/datadesc.h with 51% similarity]
include/xbt/socket.h [new file with mode: 0644]
src/amok/Bandwidth/bandwidth.c
src/amok/Bandwidth/saturate.c
src/amok/PeerManagement/peermanagement.c
src/gras/DataDesc/datadesc.c [deleted file]
src/gras/DataDesc/datadesc_interface.h [deleted file]
src/gras/DataDesc/datadesc_private.h [deleted file]
src/gras/DataDesc/ddt_parse.yy.h [deleted file]
src/gras/DataDesc/ddt_parse.yy.l [deleted file]
src/gras/Msg/gras_msg_exchange.c
src/gras/Msg/gras_msg_listener.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/Transport/README
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_private.h
src/gras/Virtu/process.c
src/gras/Virtu/sg_process.c
src/gras/Virtu/virtu_sg.h
src/gras/gras.c
src/gras_modinter.h
src/xbt/datadesc/cbps.c [moved from src/gras/DataDesc/cbps.c with 72% similarity]
src/xbt/datadesc/datadesc.c [new file with mode: 0644]
src/xbt/datadesc/datadesc_interface.h [new file with mode: 0644]
src/xbt/datadesc/datadesc_private.h [new file with mode: 0644]
src/xbt/datadesc/ddt_convert.c [moved from src/gras/DataDesc/ddt_convert.c with 69% similarity]
src/xbt/datadesc/ddt_create.c [moved from src/gras/DataDesc/ddt_create.c with 67% similarity]
src/xbt/datadesc/ddt_exchange.c [moved from src/gras/DataDesc/ddt_exchange.c with 73% similarity]
src/xbt/datadesc/ddt_parse.c [moved from src/gras/DataDesc/ddt_parse.c with 64% similarity]
src/xbt/datadesc/ddt_parse.yy.c [moved from src/gras/DataDesc/ddt_parse.yy.c with 73% similarity]
src/xbt/datadesc/ddt_parse.yy.h [new file with mode: 0644]
src/xbt/datadesc/ddt_parse.yy.l [new file with mode: 0644]
src/xbt/xbt_main.c
src/xbt/xbt_socket.c [new file with mode: 0644]
src/xbt/xbt_socket_private.h [new file with mode: 0644]
src/xbt/xbt_trp_plugin_tcp.c [moved from src/gras/Transport/transport_plugin_tcp.c with 72% similarity]
src/xbt_modinter.h
teshsuite/gras/README
teshsuite/gras/datadesc/datadesc_structs.c
teshsuite/gras/datadesc/datadesc_usage.c
teshsuite/gras/datadesc/mk_datadesc_structs.pl
teshsuite/gras/msg_handle/msg_handle.c

index a4a7159..50a0252 100644 (file)
@@ -437,8 +437,8 @@ else(BIGENDIAN)
   set(GRAS_BIGENDIAN 0)
 endif(BIGENDIAN)
 
-# The syntax of this magic string is given in src/gras/DataDesc/ddt_convert.c
-# It kinda matches the values that the gras_arch_desc_t structure can take
+# The syntax of this magic string is given in src/xbt/datadesc/ddt_convert.c
+# It kinda matches the values that the xbt_arch_desc_t structure can take
 
 # Basically, the syntax is one char l or B for endianness (little or Big)
 #   then there is a bunch of blocks separated by _.  
@@ -457,7 +457,7 @@ endif(BIGENDIAN)
 #    formalism to another. Only the GRAS_ARCH is transfered in the
 #    stream, and it it of cruxial importance to keep these detection
 #    information here synchronized with the data hardcoded in the
-#    source in src/gras/DataDesc/ddt_convert.c 
+#    source in src/xbt/datadesc/ddt_convert.c 
 
 # If you add something here (like a previously unknown architecture),
 #    please add it to the source code too. 
index 8d67de9..eaf168d 100644 (file)
@@ -35,6 +35,8 @@ set(EXTRA_DIST
        src/xbt/mmalloc/mvalloc.c
        src/xbt/mmalloc/sbrk-sup.c
        src/xbt/mmalloc/test/mmalloc_test.c
+       src/xbt/datadesc/ddt_parse.yy.l
+       src/xbt/datadesc/ddt_parse.yy.h
        src/surf/maxmin_private.h
        src/surf/trace_mgr_private.h
        src/surf/surf_private.h
@@ -69,8 +71,6 @@ set(EXTRA_DIST
        src/simdag/dax.dtd
        src/simdag/dax_dtd.h
        src/simdag/dax_dtd.c
-       src/gras/DataDesc/ddt_parse.yy.l
-       src/gras/DataDesc/ddt_parse.yy.h
        src/gras/Virtu/virtu_rl.h
        src/gras/Virtu/virtu_sg.h
        src/gras/Virtu/virtu_interface.h
@@ -135,8 +135,6 @@ set(GRAS_RL_SRC
        src/gras/rl_stubs.c
        src/xbt/xbt_os_thread.c
        src/gras/Transport/rl_transport.c
-       src/gras/Transport/transport_plugin_file.c
-       src/gras/Transport/transport_plugin_tcp.c
        src/gras/Virtu/rl_emul.c
        src/gras/Virtu/rl_process.c
        src/gras/Virtu/rl_dns.c
@@ -182,6 +180,18 @@ set(XBT_SRC
        src/xbt/xbt_replay_trace_reader.c
        src/xbt/lib.c
        src/xbt/automaton.c
+       src/xbt/datadesc/ddt_create.c
+       src/xbt/datadesc/ddt_convert.c
+       src/xbt/datadesc/ddt_exchange.c
+       src/xbt/datadesc/cbps.c
+       src/xbt/datadesc/datadesc.c
+       src/xbt/datadesc/datadesc_interface.h
+       src/xbt/datadesc/datadesc_private.h
+       src/xbt/datadesc/ddt_parse.c
+       src/xbt/datadesc/ddt_parse.yy.c
+       src/xbt/xbt_socket.c
+       src/xbt/xbt_socket_private.h
+       src/xbt/xbt_trp_plugin_tcp.c
 )
 
 if(HAVE_MMAP)
@@ -288,6 +298,7 @@ set(GRAS_COMMON_SRC
        src/gras/gras.c
        src/gras/Transport/transport.c
        src/gras/Transport/transport_private.h
+       src/gras/Transport/transport_plugin_file.c
        src/gras/Msg/gras_msg_mod.c
        src/gras/Msg/gras_msg_types.c
        src/gras/Msg/gras_msg_exchange.c
@@ -298,15 +309,6 @@ set(GRAS_COMMON_SRC
        src/gras/Msg/msg_private.h
        src/gras/Virtu/process.c
        src/gras/Virtu/gras_module.c
-       src/gras/DataDesc/ddt_create.c
-       src/gras/DataDesc/ddt_convert.c
-       src/gras/DataDesc/ddt_exchange.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_parse.c
-       src/gras/DataDesc/ddt_parse.yy.c
 )
 
 set(GRAS_SG_SRC
@@ -421,6 +423,7 @@ set(headers_to_install
        include/xbt/parmap.h
        include/xbt/automaton.h
        include/xbt/automatonparse_promela.h
+       include/xbt/datadesc.h
        include/simgrid/platf.h
        include/mc/modelchecker.h
        include/msg/msg.h
@@ -434,7 +437,6 @@ set(headers_to_install
        include/surf/surfxml_parse.h
        include/surf/simgrid_dtd.h
        include/surf/surf_routing.h
-       include/gras/datadesc.h
        include/gras/transport.h
        include/gras/virtu.h
        include/gras/emul.h
index 4c74e07..60fea12 100644 (file)
@@ -92,7 +92,7 @@ ADD_CUSTOM_COMMAND(
        COMMAND ${SED_EXE} -i ${string6} src/simdag/dax_dtd.h   
        COMMAND ${SED_EXE} -i ${string7} src/simdag/dax_dtd.h
        COMMAND ${SED_EXE} -i ${string14} src/simdag/dax_dtd.h
-       COMMAND ${FLEX_EXE} -o src/gras/DataDesc/ddt_parse.yy.c -Pgras_ddt_parse_ --noline src/gras/DataDesc/ddt_parse.yy.l
+       COMMAND ${FLEX_EXE} -o src/xbt/datadesc/ddt_parse.yy.c -Pxbt_ddt_parse_ --noline src/xbt/datadesc/ddt_parse.yy.l
        COMMAND ${CMAKE_COMMAND} -E echo "src/simdag/dax_dtd.h"
        
        #surf/simgrid_dtd.c: surf/simgrid_dtd.l
index 7da1bff..83af015 100644 (file)
@@ -4,7 +4,7 @@
 ### Add here every files that should not be supernovaed (generated files) ###
 #############################################################################
 set(simgrid_fragile_sources 
-       src/gras/DataDesc/ddt_parse.yy.c
+       src/xbt/datadesc/ddt_parse.yy.c
        src/surf/surfxml_parse.c
        src/xbt/graphxml_parse.c
        src/simdag/sd_daxloader.c
@@ -12,7 +12,7 @@ set(simgrid_fragile_sources
        ${GTNETS_USED}
 )
 set(gras_fragile_sources
-       src/gras/DataDesc/ddt_parse.yy.c
+       src/xbt/datadesc/ddt_parse.yy.c
        src/xbt/graphxml_parse.c
     src/xbt/mmalloc/mm.c
 )
index 354eeb7..8df320a 100644 (file)
@@ -18,9 +18,9 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth,
  * Sensor code
  * **********************************************************************/
 
-static gras_socket_t try_gras_socket_client_from_string(const char *host)
+static xbt_socket_t try_gras_socket_client_from_string(const char *host)
 {
-  volatile gras_socket_t sock = NULL;
+  volatile xbt_socket_t sock = NULL;
   xbt_ex_t e;
   TRY {
     sock = gras_socket_client_from_string(host);
@@ -36,8 +36,8 @@ int sensor(int argc, char *argv[]);
 
 int sensor(int argc, char *argv[])
 {
-  gras_socket_t mysock;
-  gras_socket_t master = NULL;
+  xbt_socket_t mysock;
+  xbt_socket_t master = NULL;
   int connection_try = 10;
 
   gras_init(&argc, argv);
@@ -76,8 +76,8 @@ int maestro(int argc, char *argv[])
   int msg_amount = 1;
   double min_duration = 1;
 
-  gras_socket_t peer;
-  gras_socket_t mysock;
+  xbt_socket_t peer;
+  xbt_socket_t mysock;
   xbt_peer_t h1, h2, h_temp;
   xbt_dynar_t group;
 
index e2d00f5..fc87222 100644 (file)
@@ -32,7 +32,7 @@ static void env_hosttohost_bw(int argc, char *argv[])
   int i;
   xbt_host_t h1;
 
-  gras_socket_t peer;           /* socket to sensor */
+  xbt_socket_t peer;           /* socket to sensor */
 
   /* wait to ensure that all server sockets are there before starting the experiment */
   gras_os_sleep(0.5);
@@ -82,7 +82,7 @@ static void env_Pairwisehost_bw(int argc, char *argv[])
   xbt_host_t h1, h2;
 
   /* socket to sensor */
-  gras_socket_t peer;
+  xbt_socket_t peer;
 
   /* wait to ensure that all server sockets are there before starting the experiment */
   gras_os_sleep(0.5);
index b89dccc..fde8bfc 100644 (file)
@@ -28,8 +28,8 @@ int sensor(int argc, char *argv[]);
 
 int sensor(int argc, char *argv[])
 {
-  gras_socket_t mysock;
-  gras_socket_t master;
+  xbt_socket_t mysock;
+  xbt_socket_t master;
 
   gras_init(&argc, argv);
   amok_bw_init();
@@ -100,7 +100,7 @@ static double XP(const char *bw1, const char *bw2,
 
 static void kill_buddy(char *name, int port)
 {
-  gras_socket_t sock = gras_socket_client(name, port);
+  xbt_socket_t sock = gras_socket_client(name, port);
   gras_msg_send(sock, "kill", NULL);
   gras_socket_close(sock);
 }
index 8e3b0f4..7872303 100644 (file)
@@ -31,8 +31,8 @@ int receiver(int argc, char *argv[])
   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 */
+  xbt_socket_t mysock;         /* socket on which other people contact me */
+  xbt_socket_t expeditor;      /* to notice who wrote me */
 
   /* Init the GRAS infrastructure and declare my globals */
   gras_init(&argc, argv);
@@ -42,14 +42,14 @@ int receiver(int argc, char *argv[])
   todo = atoi(argv[2]);
 
   /* Register the known messages */
-  gras_msgtype_declare("data", gras_datadesc_by_name("string"));
+  gras_msgtype_declare("data", xbt_datadesc_by_name("string"));
 
   /* Create my master socket */
   mysock = gras_socket_server(myport);
 
   /* Get the data */
   XBT_INFO("Listening on port %d (expecting %d messages)",
-        gras_socket_my_port(mysock), todo);
+        xbt_socket_my_port(mysock), todo);
   while (todo > 0) {
     gras_msg_wait(60 /* wait up to one minute */ ,
                   "data", &expeditor, &data);
@@ -57,8 +57,8 @@ int receiver(int argc, char *argv[])
     free(data);
 
     XBT_INFO("Got Data from %s:%d (still %d to go)",
-          gras_socket_peer_name(expeditor),
-          gras_socket_peer_port(expeditor), todo);
+          xbt_socket_peer_name(expeditor),
+          xbt_socket_peer_port(expeditor), todo);
 
   }
 
@@ -82,7 +82,7 @@ int sender(int argc, char *argv[])
   xbt_peer_t h;                 /* iterator */
   int connected = 0;
 
-  volatile gras_socket_t peer = NULL;    /* socket to node */
+  volatile xbt_socket_t peer = NULL;    /* socket to node */
 
 
   /* xbt_dynar for peers */
@@ -107,7 +107,7 @@ int sender(int argc, char *argv[])
   XBT_INFO("Launch current node");
 
   /* Register the known messages */
-  gras_msgtype_declare("data", gras_datadesc_by_name("string"));
+  gras_msgtype_declare("data", xbt_datadesc_by_name("string"));
 
 
   /* write to the receivers */
index ca0507e..d0af525 100644 (file)
@@ -9,9 +9,9 @@
 #include "ping.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping);
 
-static gras_socket_t try_gras_socket_client(const char *host, int port)
+static xbt_socket_t try_gras_socket_client(const char *host, int port)
 {
-  volatile gras_socket_t sock = NULL;
+  volatile xbt_socket_t sock = NULL;
   xbt_ex_t e;
   TRY {
     sock = gras_socket_client(host, port);
@@ -27,9 +27,9 @@ static gras_socket_t try_gras_socket_client(const char *host, int port)
 
 int client(int argc, char *argv[])
 {
-  gras_socket_t toserver = NULL;        /* peer */
+  xbt_socket_t toserver = NULL;        /* peer */
 
-  gras_socket_t from;
+  xbt_socket_t from;
   int ping, pong;
 
   const char *host = "127.0.0.1";
@@ -58,7 +58,7 @@ int client(int argc, char *argv[])
 
   /* 5. Keep the user informed of what's going on */
   XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 6. Prepare and send the ping message to the server */
   ping = 1234;
@@ -71,7 +71,7 @@ int client(int argc, char *argv[])
   }
   XBT_INFO(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
         ping,
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 7. Wait for the answer from the server, and deal with issues */
   TRY {
@@ -84,7 +84,7 @@ int client(int argc, char *argv[])
 
   /* 8. Keep the user informed of what's going on, again */
   XBT_INFO(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
-        pong, gras_socket_peer_name(from), gras_socket_peer_port(from));
+        pong, xbt_socket_peer_name(from), xbt_socket_peer_port(from));
 
   /* 9. Free the allocated resources, and shut GRAS down */
   gras_socket_close(toserver);
index 41e6b80..f0b6e49 100644 (file)
@@ -12,7 +12,7 @@ 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)
 {
-  gras_msgtype_declare("ping", gras_datadesc_by_name("int"));
-  gras_msgtype_declare("pong", gras_datadesc_by_name("int"));
+  gras_msgtype_declare("ping", xbt_datadesc_by_name("int"));
+  gras_msgtype_declare("pong", xbt_datadesc_by_name("int"));
   XBT_INFO("Messages registered");
 }
index 4e2af0a..bb01301 100644 (file)
@@ -12,7 +12,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping);
 
 /* Global private data */
 typedef struct {
-  gras_socket_t sock;
+  xbt_socket_t sock;
   int endcondition;
 } server_data_t;
 
@@ -21,7 +21,7 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
 {
   /* 1. Get the payload into the msg variable, and retrieve my caller */
   int msg = *(int *) payload;
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   /* 2. Retrieve the server's state (globals) */
 
@@ -31,8 +31,8 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
   /* 3. Log which client connected */
   XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
         msg,
-        gras_socket_peer_name(expeditor),
-        gras_socket_peer_port(expeditor));
+        xbt_socket_peer_name(expeditor),
+        xbt_socket_peer_port(expeditor));
 
   /* 4. Change the value of the msg variable */
   msg = 4321;
@@ -85,7 +85,7 @@ int server(int argc, char *argv[])
   gras_cb_register("ping", &server_cb_ping_handler);
 
   XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<",
-        gras_socket_my_port(globals->sock));
+        xbt_socket_my_port(globals->sock));
   globals->endcondition = 0;
 
   /* 6. Wait up to 20 minutes for an incomming message to handle */
index 5ab834d..f5998a5 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. */
 
-#define GRAS_DEFINE_TYPE_EXTERN
+#define XBT_DEFINE_TYPE_EXTERN
 #include "xbt/matrix.h"
 #include "mmrpc.h"
 
@@ -16,12 +16,12 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(MatMult, "Messages specific to this example");
    (common to client and server) */
 void mmrpc_register_messages(void)
 {
-  gras_datadesc_type_t matrix_type, request_type;
+  xbt_datadesc_type_t matrix_type, request_type;
 
-  matrix_type = gras_datadesc_matrix(gras_datadesc_by_name("double"),
+  matrix_type = xbt_datadesc_matrix(xbt_datadesc_by_name("double"),
                                      NULL);
   request_type =
-      gras_datadesc_array_fixed("s_matrix_t(double)[2]", matrix_type, 2);
+      xbt_datadesc_array_fixed("s_matrix_t(double)[2]", matrix_type, 2);
 
   gras_msgtype_declare("answer", matrix_type);
   gras_msgtype_declare("request", request_type);
@@ -32,7 +32,7 @@ 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);
+  xbt_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;
@@ -55,7 +55,7 @@ static int server_cb_request_handler(gras_msg_cb_ctx_t ctx,
 
 int server(int argc, char *argv[])
 {
-  gras_socket_t sock = NULL;
+  xbt_socket_t sock = NULL;
   int port = 4000;
 
   /* 1. Init the GRAS infrastructure */
@@ -95,9 +95,9 @@ int server(int argc, char *argv[])
 
 int client(int argc, char *argv[])
 {
-  gras_socket_t toserver = NULL;        /* peer */
+  xbt_socket_t toserver = NULL;        /* peer */
 
-  gras_socket_t from;
+  xbt_socket_t from;
   xbt_matrix_t request[2], answer;
 
   int i, j;
@@ -134,7 +134,7 @@ int client(int argc, char *argv[])
 
   /* 6. Keep the user informed of what's going on */
   XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 7. Prepare and send the request to the server */
 
@@ -151,7 +151,7 @@ int client(int argc, char *argv[])
   xbt_matrix_free(request[0]);
 
   XBT_INFO(">>>>>>>> Request sent to %s:%d <<<<<<<<",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 8. Wait for the answer from the server, and deal with issues */
   gras_msg_wait(6000, "answer", &from, &answer);
@@ -169,7 +169,7 @@ int client(int argc, char *argv[])
 
   /* 9. Keep the user informed of what's going on, again */
   XBT_INFO(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
-        gras_socket_peer_name(from), gras_socket_peer_port(from));
+        xbt_socket_peer_name(from), xbt_socket_peer_port(from));
 
   /* 10. Free the allocated resources, and shut GRAS down */
   xbt_matrix_free(request[1]);
index a4fb89f..6472af0 100644 (file)
@@ -6,15 +6,15 @@
 /* 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. */
 
-#define GRAS_DEFINE_TYPE_EXTERN
+#define XBT_DEFINE_TYPE_EXTERN
 #include "xbt/matrix.h"
 #include "mmrpc.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(MatMult);
 
-static gras_socket_t try_gras_socket_client(const char *host, int port)
+static xbt_socket_t try_gras_socket_client(const char *host, int port)
 {
-  volatile gras_socket_t sock = NULL;
+  volatile xbt_socket_t sock = NULL;
   xbt_ex_t e;
   TRY {
     sock = gras_socket_client(host, port);
@@ -29,9 +29,9 @@ static gras_socket_t try_gras_socket_client(const char *host, int port)
 
 int client(int argc, char *argv[])
 {
-  gras_socket_t toserver = NULL;        /* peer */
+  xbt_socket_t toserver = NULL;        /* peer */
 
-  gras_socket_t from;
+  xbt_socket_t from;
   xbt_matrix_t request[2], answer;
 
   int i;
@@ -61,7 +61,7 @@ int client(int argc, char *argv[])
 
   /* 5. Keep the user informed of what's going on */
   XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 6. Prepare and send the request to the server */
 
@@ -78,7 +78,7 @@ int client(int argc, char *argv[])
   xbt_matrix_free(request[0]);
 
   XBT_INFO(">>>>>>>> Request sent to %s:%d <<<<<<<<",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 7. Wait for the answer from the server, and deal with issues */
   gras_msg_wait(6000, "answer", &from, &answer);
@@ -96,7 +96,7 @@ int client(int argc, char *argv[])
 
   /* 8. Keep the user informed of what's going on, again */
   XBT_INFO(">>>>>>>> Got answer from %s:%d (values are right) <<<<<<<<",
-        gras_socket_peer_name(from), gras_socket_peer_port(from));
+        xbt_socket_peer_name(from), xbt_socket_peer_port(from));
 
   /* 9. Free the allocated resources, and shut GRAS down */
   xbt_matrix_free(request[1]);
index a488470..62da601 100644 (file)
@@ -14,12 +14,12 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(MatMult, "Messages specific to this example");
    (common to client and server) */
 void mmrpc_register_messages(void)
 {
-  gras_datadesc_type_t matrix_type, request_type;
+  xbt_datadesc_type_t matrix_type, request_type;
 
   matrix_type =
-      gras_datadesc_matrix(gras_datadesc_by_name("double"), NULL);
+      xbt_datadesc_matrix(xbt_datadesc_by_name("double"), NULL);
   request_type =
-      gras_datadesc_array_fixed("s_matrix_t(double)[2]", matrix_type, 2);
+      xbt_datadesc_array_fixed("s_matrix_t(double)[2]", matrix_type, 2);
 
   gras_msgtype_declare("answer", matrix_type);
   gras_msgtype_declare("request", request_type);
index afdb861..e3a1910 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. */
 
-#define GRAS_DEFINE_TYPE_EXTERN
+#define XBT_DEFINE_TYPE_EXTERN
 #include "xbt/matrix.h"
 #include "mmrpc.h"
 
@@ -18,7 +18,7 @@ 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);
+  xbt_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;
@@ -38,9 +38,9 @@ static int server_cb_request_handler(gras_msg_cb_ctx_t ctx,
   return 0;
 }                               /* end_of_server_cb_request_handler */
 
-static gras_socket_t try_gras_socket_server(int port)
+static xbt_socket_t try_gras_socket_server(int port)
 {
-  volatile gras_socket_t sock = NULL;
+  volatile xbt_socket_t sock = NULL;
   TRY {
     sock = gras_socket_server(port);
   }
@@ -52,7 +52,7 @@ static gras_socket_t try_gras_socket_server(int port)
 
 int server(int argc, char *argv[])
 {
-  gras_socket_t sock = NULL;
+  xbt_socket_t sock = NULL;
   int port = 4002;
 
   /* 1. Init the GRAS infrastructure */
index f05e731..90d6872 100644 (file)
@@ -24,10 +24,10 @@ int node(int argc, char *argv[]);
 
 /* Global private data */
 typedef struct {
-  gras_socket_t sock;           /* server socket on which I hear */
+  xbt_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 */
+  xbt_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;
@@ -38,7 +38,7 @@ static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload)
 {
   /* 1. Get the payload into the msg variable, and retrieve my caller */
   int msg = *(int *) payload;
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
 
   /* 2. Retrieve the node's state (globals) */
@@ -57,7 +57,7 @@ static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload)
     XBT_INFO("Begin a new loop. Still to do: %d", globals->remaining_loop);
   } else if (!(globals->remaining_loop % supersteps)) {
     XBT_VERB("Got token(%d) from %s remaining_loop=%d",
-          msg, gras_socket_peer_name(expeditor), globals->remaining_loop);
+          msg, xbt_socket_peer_name(expeditor), globals->remaining_loop);
   }
 
   /* 4. If the right shouldn't be stopped yet */
@@ -65,8 +65,8 @@ static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload)
     msg += 1;
 
     XBT_DEBUG("Send token(%d) to %s:%d", msg,
-           gras_socket_peer_name(globals->tosuccessor),
-           gras_socket_peer_port(globals->tosuccessor));
+           xbt_socket_peer_name(globals->tosuccessor),
+           xbt_socket_peer_port(globals->tosuccessor));
 
     /* 5. Send the token as payload of a stoken message to the successor */
     TRY {
@@ -133,7 +133,7 @@ int node(int argc, char *argv[])
           myport, host, peerport);
 
   /* 4. Register the known messages.  */
-  gras_msgtype_declare("stoken", gras_datadesc_by_name("int"));
+  gras_msgtype_declare("stoken", xbt_datadesc_by_name("int"));
 
   /* 5. Create my master socket for listening */
   globals->sock = gras_socket_server(myport);
index 5c4cb0d..c6755a0 100644 (file)
 int node_nuke_handler(gras_msg_cb_ctx_t ctx, void *payload_data);
 
 // struct of a "get_successor" message, when a node look after the area in which he want to be.
-GRAS_DEFINE_TYPE(s_get_suc, struct s_get_suc {
+XBT_DEFINE_TYPE(s_get_suc, struct s_get_suc {
                  int xId; int yId; char host[1024]; int port;};);
 
 typedef struct s_get_suc get_suc_t;
 
 // struct of a "response_successor" message, hen a node receive the information of his new area.
-GRAS_DEFINE_TYPE(s_rep_suc, struct s_rep_suc {
+XBT_DEFINE_TYPE(s_rep_suc, struct s_rep_suc {
                  int x1;        // Xmin
                  int x2;        // Xmax
                  int y1;        // Ymin
@@ -43,16 +43,16 @@ int node(int argc, char **argv);
 // registering messages types
 static void register_messages()
 {
-  gras_msgtype_declare("can_get_suc", gras_datadesc_by_symbol(s_get_suc));
-  gras_msgtype_declare("can_rep_suc", gras_datadesc_by_symbol(s_rep_suc));
-  gras_msgtype_declare("can_nuke", gras_datadesc_by_symbol(s_nuke));    // can_test.c message // include can_tests.c must be ON.
+  gras_msgtype_declare("can_get_suc", xbt_datadesc_by_symbol(s_get_suc));
+  gras_msgtype_declare("can_rep_suc", xbt_datadesc_by_symbol(s_rep_suc));
+  gras_msgtype_declare("can_nuke", xbt_datadesc_by_symbol(s_nuke));    // can_test.c message // include can_tests.c must be ON.
 }
 
 
 // a forwarding function for a "get_suc" message.
 static void forward_get_suc(get_suc_t msg, char host[1024], int port)
 {
-  gras_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock = NULL;
   //XBT_INFO("Transmiting message to %s:%d",host,port);
   TRY {
     temp_sock = gras_socket_client(host, port);
@@ -74,13 +74,13 @@ static void forward_get_suc(get_suc_t msg, char host[1024], int port)
 // the handling function of a "get_suc" message (what do a node when he receive a "get_suc" message.
 static int node_get_suc_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
 {
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
   get_suc_t *incoming = (get_suc_t *) payload_data;
   xbt_ex_t e;                   // the error variable used in TRY.. CATCH tokens.
   node_data_t *globals = (node_data_t *) gras_userdata_get();
-  gras_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock = NULL;
   XBT_INFO("Received a get_successor message from %s for (%d;%d)",
-        gras_socket_peer_name(expeditor), incoming->xId, incoming->yId);
+        xbt_socket_peer_name(expeditor), incoming->xId, incoming->yId);
   //XBT_INFO("My area is [%d;%d;%d;%d]",globals->x1,globals->x2,globals->y1,globals->y2);
   if (incoming->xId < globals->x1)      // test if the message must be forwarded to a neighbour.
     forward_get_suc(*incoming, globals->west_host, globals->west_port);
@@ -190,7 +190,7 @@ static int node_get_suc_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
       }
       CATCH_ANONYMOUS {
         RETHROWF("%s:Timeout sending environment informations to %s: %s",
-                 globals->host, gras_socket_peer_name(expeditor));
+                 globals->host, xbt_socket_peer_name(expeditor));
       }
       gras_socket_close(temp_sock);
     } else                      // we have a problem!
@@ -218,12 +218,12 @@ int node(int argc, char **argv)
 {
   node_data_t *globals = NULL;
   xbt_ex_t e;                   // the error variable used in TRY.. CATCH tokens.
-  gras_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock = NULL;
 
   rep_suc_t rep_suc_msg;
 
   get_suc_t get_suc_msg;        // building the "get_suc" message.
-  gras_socket_t temp_sock2 = NULL;
+  xbt_socket_t temp_sock2 = NULL;
 
   XBT_INFO("Starting");
 
index 44a7227..994eea6 100644 (file)
@@ -13,7 +13,7 @@
 XBT_LOG_NEW_DEFAULT_CATEGORY(can, "Messages specific to this example");
 
 // struct of a "nuke" message, when a node send a nuke to (xId;yId).
-GRAS_DEFINE_TYPE(s_nuke, struct s_nuke {
+XBT_DEFINE_TYPE(s_nuke, struct s_nuke {
                  int xId; int yId; char host[1024];     // original expeditor..
                  int port;      // ..and his port.
                  int version;   // fun.
@@ -25,7 +25,7 @@ typedef struct s_nuke nuke_t;
 int start_war(int argc, char **argv);
 int start_war(int argc, char **argv)
 {
-  gras_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock = NULL;
   nuke_t nuke_msg;
   //return 0; // in order to inhibit the War of the Nodes 
   gras_init(&argc, argv);
@@ -63,7 +63,7 @@ int start_war(int argc, char **argv)
 static int send_nuke(nuke_t * msg, int xId, int yId)
 {
   node_data_t *globals = (node_data_t *) gras_userdata_get();
-  gras_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock = NULL;
 
   if (xId >= globals->x1 && xId <= globals->x2 && yId >= globals->y1
       && yId <= globals->y2) {
@@ -115,14 +115,14 @@ static int send_nuke(nuke_t * msg, int xId, int yId)
 
 static int node_nuke_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
 {
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
   nuke_t *incoming = (nuke_t *) payload_data;
   node_data_t *globals = (node_data_t *) gras_userdata_get();
 
   int x;
   int y;
   nuke_t nuke_msg;              // writing my name one the nuke.
-  gras_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock = NULL;
   xbt_ex_t e;                   // the error variable used in TRY.. CATCH tokens.
 
 
index 7060096..528db0c 100644 (file)
@@ -23,7 +23,7 @@ typedef enum msg_typus {
   STD,
 } msg_typus;
 
-/*GRAS_DEFINE_TYPE(s_pbio,
+/*XBT_DEFINE_TYPE(s_pbio,
   struct s_pbio{
     msg_typus type;
     int dest;
@@ -32,14 +32,14 @@ typedef enum msg_typus {
 );
 typedef struct s_pbio pbio_t;*/
 
-/*GRAS_DEFINE_TYPE(s_ping,*/
+/*XBT_DEFINE_TYPE(s_ping,*/
 struct s_ping {
   int id;
 };
 /*);*/
 typedef struct s_ping ping_t;
 
-/*GRAS_DEFINE_TYPE(s_pong,*/
+/*XBT_DEFINE_TYPE(s_pong,*/
 struct s_pong {
   int id;
   int failed;
@@ -47,17 +47,17 @@ struct s_pong {
 /*);*/
 typedef struct s_pong pong_t;
 
-GRAS_DEFINE_TYPE(s_notify, struct s_notify {
+XBT_DEFINE_TYPE(s_notify, struct s_notify {
                  int id; char host[1024]; int port;};);
 
 typedef struct s_notify notify_t;
 
-GRAS_DEFINE_TYPE(s_get_suc, struct s_get_suc {
+XBT_DEFINE_TYPE(s_get_suc, struct s_get_suc {
                  int id;};);
 
 typedef struct s_get_suc get_suc_t;
 
-GRAS_DEFINE_TYPE(s_rep_suc, struct s_rep_suc {
+XBT_DEFINE_TYPE(s_rep_suc, struct s_rep_suc {
                  int id; char host[1024]; int port;};);
 
 typedef struct s_rep_suc rep_suc_t;
@@ -72,17 +72,17 @@ typedef struct finger_elem {
 
 static void register_messages()
 {
-/*  gras_msgtype_declare("chord",gras_datadesc_by_symbol(s_pbio));*/
+/*  gras_msgtype_declare("chord",xbt_datadesc_by_symbol(s_pbio));*/
   gras_msgtype_declare("chord_get_suc",
-                       gras_datadesc_by_symbol(s_get_suc));
+                       xbt_datadesc_by_symbol(s_get_suc));
   gras_msgtype_declare("chord_rep_suc",
-                       gras_datadesc_by_symbol(s_rep_suc));
-  gras_msgtype_declare("chord_notify", gras_datadesc_by_symbol(s_notify));
+                       xbt_datadesc_by_symbol(s_rep_suc));
+  gras_msgtype_declare("chord_notify", xbt_datadesc_by_symbol(s_notify));
 }
 
 /* Global private data */
 typedef struct {
-  gras_socket_t sock;           /* server socket on which I'm listening */
+  xbt_socket_t sock;           /* server socket on which I'm listening */
   int id;                       /* my id number */
   char host[1024];              /* my host name */
   int port;                     /* port on which I'm listening FIXME */
@@ -97,13 +97,13 @@ typedef struct {
 
 int node(int argc, char **argv);
 
-/*static int node_cb_chord_handler(gras_socket_t expeditor,void *payload_data){
+/*static int node_cb_chord_handler(xbt_socket_t expeditor,void *payload_data){
   xbt_ex_t e;
   pbio_t pbio_i=*(pbio_t*)payload_data;
 
   node_data_t *globals=(node_data_t*)gras_userdata_get();
 
-  XBT_INFO(">>> %d : received %d message from %s to %d <<<",globals->id,pbio_i.type,gras_socket_peer_name(expeditor),pbio_i.dest);
+  XBT_INFO(">>> %d : received %d message from %s to %d <<<",globals->id,pbio_i.type,xbt_socket_peer_name(expeditor),pbio_i.dest);
 
 
 
@@ -112,12 +112,12 @@ int node(int argc, char **argv);
 static int node_cb_get_suc_handler(gras_msg_cb_ctx_t ctx,
                                    void *payload_data)
 {
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
   get_suc_t incoming = *(get_suc_t *) payload_data;
   rep_suc_t outgoing;
   node_data_t *globals = (node_data_t *) gras_userdata_get();
   XBT_INFO("Received a get_successor message from %s for %d",
-        gras_socket_peer_name(expeditor), incoming.id);
+        xbt_socket_peer_name(expeditor), incoming.id);
   if ((globals->id == globals->finger[0].id) ||
       (incoming.id > globals->id
        && incoming.id <= globals->finger[0].id)) {
@@ -126,7 +126,7 @@ static int node_cb_get_suc_handler(gras_msg_cb_ctx_t ctx,
     outgoing.port = globals->finger[0].port;
     XBT_INFO("My successor is his successor!");
   } else {
-    gras_socket_t temp_sock;
+    xbt_socket_t temp_sock;
     int contact = closest_preceding_node(incoming.id);
     if (contact == -1) {
       outgoing.id = globals->finger[0].id;
@@ -159,7 +159,7 @@ static int node_cb_get_suc_handler(gras_msg_cb_ctx_t ctx,
   }
   CATCH_ANONYMOUS {
     RETHROWF("%s:Timeout sending successor information to %s: %s",
-             globals->host, gras_socket_peer_name(expeditor));
+             globals->host, xbt_socket_peer_name(expeditor));
   }
   gras_socket_close(expeditor);
   return 0;
@@ -181,12 +181,12 @@ static int closest_preceding_node(int id)
 static int node_cb_notify_handler(gras_msg_cb_ctx_t ctx,
                                   void *payload_data)
 {
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
   /*xbt_ex_t e; */
   notify_t incoming = *(notify_t *) payload_data;
   node_data_t *globals = (node_data_t *) gras_userdata_get();
   XBT_INFO("Received a notifying message from %s as %d",
-        gras_socket_peer_name(expeditor), incoming.id);
+        xbt_socket_peer_name(expeditor), incoming.id);
   if (globals->pre_id == -1 ||
       (incoming.id > globals->pre_id && incoming.id < globals->id)) {
     globals->pre_id = incoming.id;
@@ -200,8 +200,8 @@ static int node_cb_notify_handler(gras_msg_cb_ctx_t ctx,
 static void fix_fingers()
 {
   get_suc_t get_suc_msg;
-  gras_socket_t temp_sock = NULL;
-  gras_socket_t temp_sock2 = NULL;
+  xbt_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock2 = NULL;
   rep_suc_t rep_suc_msg;
   node_data_t *globals = (node_data_t *) gras_userdata_get();
 
@@ -241,7 +241,7 @@ static void fix_fingers()
 static void check_predecessor()
 {
   node_data_t *globals = (node_data_t *) gras_userdata_get();
-  gras_socket_t temp_sock;
+  xbt_socket_t temp_sock;
   ping_t ping;
   pong_t pong;
   xbt_ex_t e;
@@ -283,8 +283,8 @@ static void check_predecessor()
 int node(int argc, char **argv)
 {
   node_data_t *globals = NULL;
-  gras_socket_t temp_sock = NULL;
-  gras_socket_t temp_sock2 = NULL;
+  xbt_socket_t temp_sock = NULL;
+  xbt_socket_t temp_sock2 = NULL;
   get_suc_t get_suc_msg;
   rep_suc_t rep_suc_msg;
 
index d9aab2c..c60456d 100644 (file)
@@ -9,9 +9,9 @@
 #include "ping.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping);
 
-static gras_socket_t try_gras_socket_client(const char *host, int port)
+static xbt_socket_t try_gras_socket_client(const char *host, int port)
 {
-  volatile gras_socket_t sock = NULL;
+  volatile xbt_socket_t sock = NULL;
   xbt_ex_t e;
   TRY {
     sock = gras_socket_client(host, port);
@@ -27,9 +27,9 @@ static gras_socket_t try_gras_socket_client(const char *host, int port)
 
 int client(int argc, char *argv[])
 {
-  gras_socket_t toserver = NULL;        /* peer */
+  xbt_socket_t toserver = NULL;        /* peer */
 
-  gras_socket_t from;
+  xbt_socket_t from;
   int ping, pong;
 
   const char *host = "127.0.0.1";
@@ -58,7 +58,7 @@ int client(int argc, char *argv[])
 
   /* 5. Keep the user informed of what's going on */
   XBT_INFO(">>>>>>>> Connected to server which is on %s:%d <<<<<<<<",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 6. Prepare and send the ping message to the server */
   ping = 1234;
@@ -70,7 +70,7 @@ int client(int argc, char *argv[])
     RETHROWF("Failed to send PING to server: %s");
   }
   XBT_INFO(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<",
-        ping, gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        ping, xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 7. Wait for the answer from the server, and deal with issues */
   TRY {
@@ -83,7 +83,7 @@ int client(int argc, char *argv[])
 
   /* 8. Keep the user informed of what's going on, again */
   XBT_INFO(">>>>>>>> Got PONG(%d) from %s:%d <<<<<<<<",
-        pong, gras_socket_peer_name(from), gras_socket_peer_port(from));
+        pong, xbt_socket_peer_name(from), xbt_socket_peer_port(from));
 
   /* 9. Free the allocated resources, and shut GRAS down */
   gras_socket_close(toserver);
index 41e6b80..f0b6e49 100644 (file)
@@ -12,7 +12,7 @@ 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)
 {
-  gras_msgtype_declare("ping", gras_datadesc_by_name("int"));
-  gras_msgtype_declare("pong", gras_datadesc_by_name("int"));
+  gras_msgtype_declare("ping", xbt_datadesc_by_name("int"));
+  gras_msgtype_declare("pong", xbt_datadesc_by_name("int"));
   XBT_INFO("Messages registered");
 }
index 4167d41..ab4f75e 100644 (file)
@@ -12,7 +12,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping);
 
 /* Global private data */
 typedef struct {
-  gras_socket_t sock;
+  xbt_socket_t sock;
   int endcondition;
 } server_data_t;
 
@@ -21,7 +21,7 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
 {
   /* 1. Get the payload into the msg variable, and retrieve my caller */
   int msg = *(int *) payload;
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   /* 2. Retrieve the server's state (globals) */
 
@@ -31,8 +31,8 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
   /* 3. Log which client connected */
   XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
         msg,
-        gras_socket_peer_name(expeditor),
-        gras_socket_peer_port(expeditor));
+        xbt_socket_peer_name(expeditor),
+        xbt_socket_peer_port(expeditor));
 
   /* 4. Change the value of the msg variable */
   msg = 4321;
@@ -85,7 +85,7 @@ int server(int argc, char *argv[])
   gras_cb_register("ping", &server_cb_ping_handler);
 
   XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<",
-        gras_socket_my_port(globals->sock));
+        xbt_socket_my_port(globals->sock));
   globals->endcondition = 0;
 
   /* 6. Wait up to 10 minutes for an incomming message to handle */
index e45caa2..38c834c 100644 (file)
@@ -20,21 +20,21 @@ const int submatrix_size = DATA_MATRIX_SIZE / PROC_MATRIX_SIZE;
 XBT_LOG_NEW_DEFAULT_CATEGORY(pmm, "Parallel Matrix Multiplication");
 
 /* struct for recovering results */
-GRAS_DEFINE_TYPE(s_result, struct s_result {
+XBT_DEFINE_TYPE(s_result, struct s_result {
                  int linepos; int rowpos;
-                 xbt_matrix_t C GRAS_ANNOTE(subtype, double);
+                 xbt_matrix_t C XBT_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 {
+XBT_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);
+                 xbt_matrix_t A XBT_ANNOTE(subtype, double);
+                 xbt_matrix_t B XBT_ANNOTE(subtype, double);
                  });
 
 typedef struct s_pmm_assignment s_pmm_assignment_t;
@@ -42,12 +42,12 @@ 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)
 {
-  gras_datadesc_type_t result_type;
-  gras_datadesc_type_t pmm_assignment_type;
+  xbt_datadesc_type_t result_type;
+  xbt_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);
+  xbt_datadesc_set_const("NEIGHBOR_COUNT", NEIGHBOR_COUNT);
+  result_type = xbt_datadesc_by_symbol(s_result);
+  pmm_assignment_type = xbt_datadesc_by_symbol(s_pmm_assignment);
 
   /* receive a final result from slave */
   gras_msgtype_declare("result", result_type);
@@ -57,19 +57,19 @@ static void register_messages(void)
 
   /* send data between slaves */
   gras_msgtype_declare("dataA",
-                       gras_datadesc_matrix(gras_datadesc_by_name
+                       xbt_datadesc_matrix(xbt_datadesc_by_name
                                             ("double"), NULL));
   gras_msgtype_declare("dataB",
-                       gras_datadesc_matrix(gras_datadesc_by_name
+                       xbt_datadesc_matrix(xbt_datadesc_by_name
                                             ("double"), NULL));
 
   /* synchronization message */
   gras_msgtype_declare("pmm_sync", 0);
 }
 
-static gras_socket_t try_gras_socket_client_from_string(const char *host)
+static xbt_socket_t try_gras_socket_client_from_string(const char *host)
 {
-  volatile gras_socket_t sock = NULL;
+  volatile xbt_socket_t sock = NULL;
   xbt_ex_t e;
   TRY {
     sock = gras_socket_client_from_string(host);
@@ -84,7 +84,7 @@ static gras_socket_t try_gras_socket_client_from_string(const char *host)
 }
 
 static void my_gras_msg_wait(double timeout, const char* msgt_want,
-                             gras_socket_t* expeditor, void *payload,
+                             xbt_socket_t* expeditor, void *payload,
                              const char *error_msg)
 {
   TRY {
@@ -119,11 +119,11 @@ int master(int argc, char *argv[])
   xbt_matrix_t A, B, C;
   result_t result;
 
-  gras_socket_t from;
+  xbt_socket_t from;
 
   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 */
+  xbt_socket_t socket[SLAVE_COUNT];    /* sockets for brodcast to slaves */
 
   /* Init the GRAS's infrastructure */
   gras_init(&argc, argv);
@@ -266,7 +266,7 @@ 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_socket_t master = gras_msg_cb_ctx_from(ctx);
 
   int step, l;
   xbt_matrix_t bA = xbt_matrix_new(submatrix_size, submatrix_size,
@@ -281,11 +281,11 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
 
   result_t result;
 
-  gras_socket_t from;           /* to exchange data with my neighbor */
+  xbt_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];
+  xbt_socket_t socket_line[PROC_MATRIX_SIZE - 1];
+  xbt_socket_t socket_row[PROC_MATRIX_SIZE - 1];
   memset(socket_line, 0, sizeof(socket_line));
   memset(socket_row, 0, sizeof(socket_row));
 
@@ -324,7 +324,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
       XBT_VERB("LINE: step(%d) = Myline(%d). Broadcast my data.", step,
             myline);
       for (l = 0; l < PROC_MATRIX_SIZE - 1; l++) {
-        XBT_VERB("LINE:   Send to %s", gras_socket_peer_name(socket_row[l]));
+        XBT_VERB("LINE:   Send to %s", xbt_socket_peer_name(socket_row[l]));
         gras_msg_send(socket_row[l], "dataB", &mydataB);
       }
 
@@ -337,7 +337,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
       my_gras_msg_wait(600, "dataB", &from, &bB,
                        "Can't get a data message from line");
       XBT_VERB("LINE: step(%d) <> Myline(%d). Receive data from %s", step,
-            myline, gras_socket_peer_name(from));
+            myline, xbt_socket_peer_name(from));
     }
 
     /* a row brodcast */
@@ -345,7 +345,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
       XBT_VERB("ROW: step(%d)=myrow(%d). Broadcast my data.", step, myrow);
       for (l = 1; l < PROC_MATRIX_SIZE; l++) {
         XBT_VERB("ROW:   Send to %s",
-              gras_socket_peer_name(socket_line[l - 1]));
+              xbt_socket_peer_name(socket_line[l - 1]));
         gras_msg_send(socket_line[l - 1], "dataA", &mydataA);
       }
       xbt_matrix_free(bA);
@@ -356,7 +356,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
       my_gras_msg_wait(1200, "dataA", &from, &bA,
                        "Can't get a data message from row");
       XBT_VERB("ROW: step(%d)<>myrow(%d). Receive data from %s", step, myrow,
-            gras_socket_peer_name(from));
+            xbt_socket_peer_name(from));
     }
     xbt_matrix_double_addmult(bA, bB, bC);
 
@@ -374,7 +374,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
     RETHROWF("Failed to send answer to server: %s");
   }
   XBT_VERB(">>>>>>>> Result sent to %s:%d <<<<<<<<",
-        gras_socket_peer_name(master), gras_socket_peer_port(master));
+        xbt_socket_peer_name(master), xbt_socket_peer_port(master));
   /*  Free the allocated resources, and shut GRAS down */
 
   xbt_matrix_free(bA);
@@ -398,8 +398,8 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload)
 
 int slave(int argc, char *argv[])
 {
-  gras_socket_t mysock;
-  gras_socket_t master = NULL;
+  xbt_socket_t mysock;
+  xbt_socket_t master = NULL;
   int rank;
 
   /* Init the GRAS's infrastructure */
index fb1babe..7509e4f 100644 (file)
@@ -32,11 +32,11 @@ static void declare_msg()
   xbt_workload_declare_datadesc();
   gras_msgtype_declare("go", NULL);
   gras_msgtype_declare("commands",
-                       gras_datadesc_dynar(gras_datadesc_by_name
+                       xbt_datadesc_dynar(xbt_datadesc_by_name
                                            ("xbt_workload_elm_t"),
                                            xbt_workload_elm_free_voidp));
   gras_msgtype_declare("chunk",
-                       gras_datadesc_by_name("xbt_workload_data_chunk_t"));
+                       xbt_datadesc_by_name("xbt_workload_data_chunk_t"));
 }
 
 int master(int argc, char *argv[])
@@ -89,10 +89,10 @@ int master(int argc, char *argv[])
 
   /* Check who came */
   xbt_dict_t pals = xbt_dict_new_homogeneous(NULL);
-  gras_socket_t pal;
+  xbt_socket_t pal;
   xbt_dynar_foreach(peers, cursor, peer) {
     //XBT_INFO("%s is here",peer->name);
-    gras_socket_t sock = gras_socket_client(peer->name, peer->port);
+    xbt_socket_t sock = gras_socket_client(peer->name, peer->port);
     xbt_dict_set(pals, peer->name, sock, NULL);
   }
   /* check that we have a dude for every element of the trace */
@@ -132,14 +132,14 @@ int master(int argc, char *argv[])
 typedef struct {
   xbt_dynar_t commands;
   xbt_dict_t peers;
-  gras_socket_t mysock;
+  xbt_socket_t mysock;
 } s_worker_data_t, *worker_data_t;
 
 
-static gras_socket_t get_peer_sock(char *peer)
+static xbt_socket_t get_peer_sock(char *peer)
 {
   worker_data_t g = gras_userdata_get();
-  gras_socket_t peer_sock = xbt_dict_get_or_null(g->peers, peer);
+  xbt_socket_t peer_sock = xbt_dict_get_or_null(g->peers, peer);
   if (!peer_sock) {
     XBT_INFO("Create a socket to %s", peer);
     peer_sock = gras_socket_client(peer, 4000);
@@ -161,10 +161,10 @@ static void do_command(int rank, void *c)
   xbt_workload_data_chunk_t chunk;
 
   if (cmd->action == XBT_WORKLOAD_SEND) {
-    gras_socket_t sock = get_peer_sock(cmd->str_arg);
+    xbt_socket_t sock = get_peer_sock(cmd->str_arg);
     chunk = xbt_workload_data_chunk_new((int) (cmd->d_arg));
     XBT_INFO("Send %.f bytes to %s %s:%d", cmd->d_arg, cmd->str_arg,
-          gras_socket_peer_name(sock), gras_socket_peer_port(sock));
+          xbt_socket_peer_name(sock), xbt_socket_peer_port(sock));
     gras_msg_send_(sock, gras_msgtype_by_name("chunk"), &chunk);
     XBT_INFO("Done sending %.f bytes to %s", cmd->d_arg, cmd->str_arg);
 
@@ -195,7 +195,7 @@ int worker(int argc, char *argv[])
   globals = gras_userdata_new(s_worker_data_t);
   /* Create the connexions */
   globals->mysock = gras_socket_server(4000);   /* FIXME: shouldn't be hardcoded */
-  gras_socket_t master = NULL;
+  xbt_socket_t master = NULL;
   int connected = 0;
 
   gras_cb_register("commands", worker_commands_cb);
index ea04624..f0ba47a 100644 (file)
@@ -178,32 +178,32 @@ xbt_dynar_t xbt_workload_parse_file(char *filename)
 
 void xbt_workload_declare_datadesc(void)
 {
-  gras_datadesc_type_t ddt;
-
-  ddt = gras_datadesc_struct("s_xbt_workload_elm_t");
-  gras_datadesc_struct_append(ddt, "who", gras_datadesc_by_name("string"));
-  gras_datadesc_struct_append(ddt, "comment",
-                              gras_datadesc_by_name("string"));
-  gras_datadesc_struct_append(ddt, "action", gras_datadesc_by_name("int"));
-  gras_datadesc_struct_append(ddt, "date",
-                              gras_datadesc_by_name("double"));
-  gras_datadesc_struct_append(ddt, "d_arg",
-                              gras_datadesc_by_name("double"));
-  gras_datadesc_struct_append(ddt, "str_arg",
-                              gras_datadesc_by_name("string"));
-  gras_datadesc_struct_close(ddt);
-
-  gras_datadesc_ref("xbt_workload_elm_t", ddt);
-
-  ddt = gras_datadesc_struct("s_xbt_workload_data_chunk_t");
-  gras_datadesc_struct_append(ddt, "size", gras_datadesc_by_name("int"));
-  gras_datadesc_cb_field_push(ddt, "size");
-  gras_datadesc_struct_append(ddt, "chunk",
-                              gras_datadesc_ref_pop_arr
-                              (gras_datadesc_by_name("char")));
-  gras_datadesc_struct_close(ddt);
-
-  gras_datadesc_ref("xbt_workload_data_chunk_t", ddt);
+  xbt_datadesc_type_t ddt;
+
+  ddt = xbt_datadesc_struct("s_xbt_workload_elm_t");
+  xbt_datadesc_struct_append(ddt, "who", xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "comment",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "action", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_append(ddt, "date",
+                              xbt_datadesc_by_name("double"));
+  xbt_datadesc_struct_append(ddt, "d_arg",
+                              xbt_datadesc_by_name("double"));
+  xbt_datadesc_struct_append(ddt, "str_arg",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_close(ddt);
+
+  xbt_datadesc_ref("xbt_workload_elm_t", ddt);
+
+  ddt = xbt_datadesc_struct("s_xbt_workload_data_chunk_t");
+  xbt_datadesc_struct_append(ddt, "size", xbt_datadesc_by_name("int"));
+  xbt_datadesc_cb_field_push(ddt, "size");
+  xbt_datadesc_struct_append(ddt, "chunk",
+                              xbt_datadesc_ref_pop_arr
+                              (xbt_datadesc_by_name("char")));
+  xbt_datadesc_struct_close(ddt);
+
+  xbt_datadesc_ref("xbt_workload_data_chunk_t", ddt);
 }
 
 
index 10e84e0..4d12003 100644 (file)
@@ -14,8 +14,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(Rpc, "Messages specific to this example");
 static void register_messages(void)
 {
   gras_msgtype_declare_rpc("plain ping",
-                           gras_datadesc_by_name("int"),
-                           gras_datadesc_by_name("int"));
+                           xbt_datadesc_by_name("int"),
+                           xbt_datadesc_by_name("int"));
 
   gras_msgtype_declare_rpc("raise exception", NULL, NULL);
   gras_msgtype_declare_rpc("forward exception", NULL, NULL);
@@ -60,8 +60,8 @@ static void exception_catching(void)
  * Client code
  * **********************************************************************/
 
-static void client_create_sockets(gras_socket_t *toserver,
-                                  gras_socket_t *toforwarder,
+static void client_create_sockets(xbt_socket_t *toserver,
+                                  xbt_socket_t *toforwarder,
                                   const char *srv_host, int srv_port,
                                   const char *fwd_host, int fwd_port)
 {
@@ -78,8 +78,8 @@ static void client_create_sockets(gras_socket_t *toserver,
 int client(int argc, char *argv[])
 {
   xbt_ex_t e;
-  gras_socket_t toserver = NULL;        /* peer */
-  gras_socket_t toforwarder = NULL;     /* peer */
+  xbt_socket_t toserver = NULL;        /* peer */
+  xbt_socket_t toforwarder = NULL;     /* peer */
 
   int ping, pong, i;
   volatile int gotit = 0;
@@ -119,7 +119,7 @@ int client(int argc, char *argv[])
 
   /* 6. Keep the user informed of what's going on */
   XBT_INFO("Connected to server which is on %s:%d",
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver));
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver));
 
   /* 7. Prepare and send the ping message to the server */
   ping = 1234;
@@ -136,7 +136,7 @@ int client(int argc, char *argv[])
   /* 8. Keep the user informed of what's going on, again */
   XBT_INFO("The answer to PING(%d) on %s:%d is PONG(%d)",
         ping,
-        gras_socket_peer_name(toserver), gras_socket_peer_port(toserver),
+        xbt_socket_peer_name(toserver), xbt_socket_peer_port(toserver),
         pong);
 
   /* 9. Call a RPC which raises an exception (to test exception propagation) */
@@ -205,11 +205,11 @@ int client(int argc, char *argv[])
     exception_catching();
   }
 
-  XBT_INFO("Ask %s:%d to die", gras_socket_peer_name(toforwarder),
-        gras_socket_peer_port(toforwarder));
+  XBT_INFO("Ask %s:%d to die", xbt_socket_peer_name(toforwarder),
+        xbt_socket_peer_port(toforwarder));
   gras_msg_send(toforwarder, "kill", NULL);
-  XBT_INFO("Ask %s:%d to die", gras_socket_peer_name(toserver),
-        gras_socket_peer_port(toserver));
+  XBT_INFO("Ask %s:%d to die", xbt_socket_peer_name(toserver),
+        xbt_socket_peer_port(toserver));
   gras_msg_send(toserver, "kill", NULL);
 
   /* 11. Cleanup the place before leaving */
@@ -225,16 +225,16 @@ int client(int argc, char *argv[])
  * Forwarder code
  * **********************************************************************/
 typedef struct {
-  gras_socket_t server;
+  xbt_socket_t server;
   int done;
 } s_forward_data_t, *forward_data_t;
 
 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);
-  XBT_INFO("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
-        gras_socket_peer_port(expeditor));
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  XBT_INFO("Asked to die by %s:%d", xbt_socket_peer_name(expeditor),
+        xbt_socket_peer_port(expeditor));
   fdata = gras_userdata_get();
   fdata->done = 1;
   return 0;
@@ -252,7 +252,7 @@ static int forwarder_cb_forward_ex(gras_msg_cb_ctx_t ctx,
 
 int forwarder(int argc, char *argv[])
 {
-  gras_socket_t mysock;
+  xbt_socket_t mysock;
   int port;
   forward_data_t fdata;
 
@@ -290,17 +290,17 @@ int forwarder(int argc, char *argv[])
  * Server code
  * **********************************************************************/
 typedef struct {
-  gras_socket_t server;
+  xbt_socket_t server;
   int done;
 } s_server_data_t, *server_data_t;
 
 static int server_cb_kill(gras_msg_cb_ctx_t ctx, void *payload_data)
 {
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
   server_data_t sdata;
 
-  XBT_INFO("Asked to die by %s:%d", gras_socket_peer_name(expeditor),
-        gras_socket_peer_port(expeditor));
+  XBT_INFO("Asked to die by %s:%d", xbt_socket_peer_name(expeditor),
+        xbt_socket_peer_port(expeditor));
 
   sdata = gras_userdata_get();
   sdata->done = 1;
@@ -318,13 +318,13 @@ 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;
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   /* 2. Log which client connected */
   XBT_INFO("Got message PING(%d) from %s:%d",
         msg,
-        gras_socket_peer_name(expeditor),
-        gras_socket_peer_port(expeditor));
+        xbt_socket_peer_name(expeditor),
+        xbt_socket_peer_port(expeditor));
 
   /* 4. Change the value of the msg variable */
   msg = 4321;
@@ -342,7 +342,7 @@ static int server_cb_ping(gras_msg_cb_ctx_t ctx, void *payload_data)
 
 int server(int argc, char *argv[])
 {
-  gras_socket_t mysock;
+  xbt_socket_t mysock;
   server_data_t sdata;
 
   int port = 4001;
@@ -368,13 +368,13 @@ int server(int argc, char *argv[])
   gras_cb_register("raise exception", &server_cb_raise_ex);
   gras_cb_register("kill", &server_cb_kill);
 
-  XBT_INFO("Listening on port %d", gras_socket_my_port(mysock));
+  XBT_INFO("Listening on port %d", xbt_socket_my_port(mysock));
 
   /* 5. Wait for the ping incomming messages */
 
   /** \bug if the server is gone before the forwarder tries to connect,
      it dies awfully with the following message. The problem stands somewhere
-     at the interface between the gras_socket_t and the msg mess. There is thus
+     at the interface between the xbt_socket_t and the msg mess. There is thus
      no way for me to dive into this before this interface is rewritten
 ==15875== Invalid read of size 4
 ==15875==    at 0x408B805: find_port (transport_plugin_sg.c:68)
index 787a6c0..2c63d06 100644 (file)
@@ -91,7 +91,7 @@
 XBT_PUBLIC(void) amok_bw_init(void);
 XBT_PUBLIC(void) amok_bw_exit(void);
 
-XBT_PUBLIC(void) amok_bw_test(gras_socket_t peer,
+XBT_PUBLIC(void) amok_bw_test(xbt_socket_t peer,
                               unsigned long int buf_size,
                               unsigned long int msg_size,
                               unsigned long int msg_amount,
index 0b3e8c6..1f2fd7a 100644 (file)
@@ -61,21 +61,21 @@ 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(gras_socket_t buddy);
-XBT_PUBLIC(void) amok_pm_kill_sync(gras_socket_t buddy);
+XBT_PUBLIC(void) amok_pm_kill(xbt_socket_t buddy);
+XBT_PUBLIC(void) amok_pm_kill_sync(xbt_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,
+XBT_PUBLIC(xbt_dynar_t) amok_pm_group_get(xbt_socket_t master,
                                           const char *group_name);
 
-XBT_PUBLIC(int) amok_pm_group_join(gras_socket_t master,
+XBT_PUBLIC(int) amok_pm_group_join(xbt_socket_t master,
                                    const char *group_name);
-XBT_PUBLIC(void) amok_pm_group_leave(gras_socket_t master,
+XBT_PUBLIC(void) amok_pm_group_leave(xbt_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,
+XBT_PUBLIC(void) amok_pm_group_shutdown_remote(xbt_socket_t master,
                                                const char *group_name);
 
 
index 5e1f083..ba1cd5a 100644 (file)
@@ -18,7 +18,6 @@
 #include <gras/emul.h>
 
 #include <gras/transport.h>
-#include <gras/datadesc.h>
 #include <gras/messages.h>
 #include <gras/timer.h>
 
index 789b622..b71ee1f 100644 (file)
@@ -18,7 +18,7 @@ SG_BEGIN_DECL()
  * 
  *  Emulation and virtualization words have a lot of different meanings in
  *  computer science. Here is what we mean, and what this module allows you
- *  to do (if it does not match your personal belives, I'm sorry):
+ *  to do (if it does not match your personal beliefs, I'm sorry):
  * 
  *  - Virtualization: Having some specific code for the simulation or for the reality
  *  - Emulation: Report within the simulator the execution time of your code
index 5bf5fae..d2595c5 100644 (file)
@@ -10,9 +10,9 @@
 #ifndef GRAS_MESSAGES_H
 #define GRAS_MESSAGES_H
 
-#include "xbt/misc.h"
 #include "gras/transport.h"
-#include "gras/datadesc.h"
+#include "xbt/datadesc.h"
+#include "xbt/socket.h"
 
 SG_BEGIN_DECL()
 
@@ -43,7 +43,7 @@ SG_BEGIN_DECL()
  *
  *  If you absolutely want use a message able to convey several datatypes,
  *  you can always say that it conveys a generic reference (see
- *  \ref gras_datadesc_ref_generic).
+ *  \ref xbt_datadesc_ref_generic).
  * 
  *  In order to ease the upgrade of GRAS applications, it is possible to \e
  *  version the messages, ie to add a version number to the message (by
@@ -60,10 +60,10 @@ SG_BEGIN_DECL()
 typedef struct s_gras_msgtype *gras_msgtype_t;
 
 XBT_PUBLIC(void) gras_msgtype_declare(const char *name,
-                                      gras_datadesc_type_t payload);
+                                      xbt_datadesc_type_t payload);
 XBT_PUBLIC(void) gras_msgtype_declare_v(const char *name,
                                         short int version,
-                                        gras_datadesc_type_t payload);
+                                        xbt_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);
@@ -96,7 +96,7 @@ XBT_PUBLIC(void) gras_msgtype_dumpall(void);
 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(xbt_socket_t) gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx);
 
   /** \brief Type of message callback functions. 
    *
@@ -157,7 +157,7 @@ XBT_PUBLIC(void) gras_cb_unregister_(gras_msgtype_t msgtype,
  * 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,
+XBT_PUBLIC(void) gras_msg_send_(xbt_socket_t sock,
                                 gras_msgtype_t msgtype, void *payload);
 
 /** \brief Waits for a message to come in over a given socket
@@ -178,7 +178,7 @@ XBT_PUBLIC(void) gras_msg_send_(gras_socket_t sock,
 #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_socket_t * expeditor, void *payload);
 XBT_PUBLIC(void) gras_msg_handleall(double period);
 XBT_PUBLIC(void) gras_msg_handle(double timeOut);
 
@@ -202,16 +202,16 @@ XBT_PUBLIC(void) gras_msg_handle(double timeOut);
 
 /* declaration */
 XBT_PUBLIC(void) gras_msgtype_declare_rpc(const char *name,
-                                          gras_datadesc_type_t
+                                          xbt_datadesc_type_t
                                           payload_request,
-                                          gras_datadesc_type_t
+                                          xbt_datadesc_type_t
                                           payload_answer);
 
 XBT_PUBLIC(void) gras_msgtype_declare_rpc_v(const char *name,
                                             short int version,
-                                            gras_datadesc_type_t
+                                            xbt_datadesc_type_t
                                             payload_request,
-                                            gras_datadesc_type_t
+                                            xbt_datadesc_type_t
                                             payload_answer);
 
 /* client side */
@@ -220,7 +220,7 @@ XBT_PUBLIC(void) gras_msgtype_declare_rpc_v(const char *name,
  *  @hideinitializer
  */
 #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,
+XBT_PUBLIC(void) gras_msg_rpccall_(xbt_socket_t server,
                                    double timeOut,
                                    gras_msgtype_t msgtype,
                                    void *request, void *answer);
@@ -230,7 +230,7 @@ XBT_PUBLIC(gras_msg_cb_ctx_t)
  *  @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,
+    gras_msg_rpc_async_call_(xbt_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,
@@ -278,7 +278,7 @@ typedef enum {
 
 /** @brief Message instance (internal struct) */
 typedef struct {
-  gras_socket_t expe;
+  xbt_socket_t expe;
   e_gras_msg_kind_t kind;
   gras_msgtype_t type;
   unsigned long int ID;
@@ -291,7 +291,7 @@ 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,
+                                    xbt_socket_t expe_want,
                                     gras_msg_filter_t filter,
                                     void *filter_ctx, gras_msg_t msg_got);
 
index 0f8f868..cdddc2d 100644 (file)
@@ -11,6 +11,8 @@
 #ifndef GRAS_TRANSPORT_H
 #define GRAS_TRANSPORT_H
 
+#include "xbt/socket.h"
+
 /** \addtogroup GRAS_sock
  *  \brief Socket handling
  *
@@ -21,7 +23,7 @@
  *
  * The main difference is that you cannot exchange arbitrary bytes on
  * sockets, but messages. See the \ref GRAS_msg section for details.
- * 
+ *
  * If you need an example of how to use sockets, check \ref GRAS_ex_ping.
  *
  */
  *
  */
 /* @{*/
-/** \brief Opaque type describing a socket */
-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,
+XBT_PUBLIC(xbt_socket_t) gras_socket_client(const char *host,
                                              unsigned short port);
-XBT_PUBLIC(gras_socket_t) gras_socket_client_from_string(const char *host);
+XBT_PUBLIC(xbt_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(xbt_socket_t) gras_socket_server(unsigned short port);
+XBT_PUBLIC(void) gras_socket_close(xbt_socket_t sd);
 XBT_PUBLIC(void) gras_socket_close_voidp(void *sock);
 
 /** \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);
+XBT_PUBLIC(xbt_socket_t) gras_socket_client_ext(const char *host,
+                                                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);
-XBT_PUBLIC(gras_socket_t)
+XBT_PUBLIC(xbt_socket_t) gras_socket_server_ext(unsigned short port,
+                                                unsigned long int bufSize,
+                                                int measurement);
+XBT_PUBLIC(xbt_socket_t)
     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 
- *  \ingroup GRAS_sock
- * 
- * Who are you talking to? 
- */
-/* @{*/
-
-/** Get the port number on which this socket is connected on my side */
-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
- * gras_socket_master() function (if any, or a random number being uniq on 
- * the remote host). If remote used gras_socket_master() more than once, the 
- * lastly declared number will be used here.
- *
- * Note to BSD sockets experts: With BSD sockets, the sockaddr 
- * structure allows you to retrieve the port of the client socket on
- * remote side, but it is of no use (from user perspective, it is
- * some random number above 6000). That is why GRAS sockets differ
- * from BSD ones here. 
- */
-
-XBT_PUBLIC(int) gras_socket_peer_port(gras_socket_t sock);
-/** Get the host name of the remote side */
-XBT_PUBLIC(const char *) gras_socket_peer_name(gras_socket_t sock);
-/** Get the process name of the remote side */
-XBT_PUBLIC(const char *) gras_socket_peer_proc(gras_socket_t sock);
-/* @}*/
-
-/** \defgroup GRAS_sock_meas Using measurement sockets
- *  \ingroup GRAS_sock
- * 
- * You may want to use sockets not to exchange valuable data (in messages), 
- * but to conduct some bandwidth measurements and related experiments. If so, try those measurement sockets.
- * 
- * You can only use those functions on sockets openned with the "measurement" boolean set to true.
- * 
- */
-/* @{*/
-
-
-
-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(gras_socket_t) gras_socket_meas_accept(gras_socket_t peer);
+                             unsigned long int buf_size, int measurement);
 
 /* @}*/
 
@@ -125,9 +70,12 @@ 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(xbt_socket_t) gras_socket_client_from_file(const char *path);
+XBT_PUBLIC(xbt_socket_t) gras_socket_server_from_file(const char *path);
 
 /* @} */
 
+void gras_trp_sg_setup(xbt_trp_plugin_t plug);
+void gras_trp_file_setup(xbt_trp_plugin_t plug);
+
 #endif                          /* GRAS_TRANSPORT_H */
index ec288fe..9502ec7 100644 (file)
@@ -29,6 +29,7 @@
 #include <xbt/parmap.h>
 
 #include <xbt/peer.h>
+#include <xbt/datadesc.h>
 #include <xbt/config.h>
 #include <xbt/cunit.h>
 
similarity index 51%
rename from include/gras/datadesc.h
rename to include/xbt/datadesc.h
index 8523c19..bac0bc3 100644 (file)
@@ -1,4 +1,4 @@
-/* gras/datadesc.h - Describing the data you want to exchange               */
+/* xbt/datadesc.h - Describing the data you want to exchange               */
 
 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
  * All rights reserved.                                                     */
@@ -6,99 +6,99 @@
 /* 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. */
 
-#ifndef GRAS_DATADESC_H
-#define GRAS_DATADESC_H
+#ifndef XBT_DATADESC_H
+#define XBT_DATADESC_H
 
 #include "xbt/misc.h"           /* SG_BEGIN_DECL */
 #include "xbt/dynar.h"          /* void_f_pvoid_t */
 
 SG_BEGIN_DECL()
 
-/** @addtogroup GRAS_dd Data description
+/** @addtogroup XBT_dd Data description
  *  @brief Describing data to be exchanged
  *
- * Since GRAS takes care of potential representation conversion when the platform is heterogeneous, 
+ * Since XBT takes care of potential representation conversion when the platform is heterogeneous,
  * any data which transits on the network must be described beforehand.
  * 
- * There is several possible interfaces for this, ranging from the really completely automatic parsing to 
+ * There are several possible interfaces for this, ranging from the really completely automatic parsing to
  * completely manual. Let's study each of them from the simplest to the more advanced:
  * 
- *   - Section \ref GRAS_dd_basic presents how to retrieve and use an already described type.
- *   - Section \ref GRAS_dd_auto shows how to get GRAS parsing your type description automagically. This
+ *   - Section \ref XBT_dd_basic presents how to retrieve and use an already described type.
+ *   - Section \ref XBT_dd_auto shows how to make XBT parse your type description automagically. This
  *     is unfortunately not always possible (only works for some structures), but if it is for your data,
- *     this is definitly the way to go.
- *   - Section \ref GRAS_dd_manual presents how to build a description manually. This is useful when you want
+ *     this is definitely the way to go.
+ *   - Section \ref XBT_dd_manual presents how to build a description manually. This is useful when you want
  *     to describe an array or a pointer of pre-defined structures.
  *   - You sometimes need to exchange informations between descriptions at send or receive time. This is 
  *     for example useful when your structure contains an array which size is given by another field of the 
  *     structure.
- *     - 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.
+ *     - Section \ref XBT_dd_cb_simple provides a simple interface to do so, allowing to share integers stored on a stack.
+ *     - Section \ref XBT_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
+/** @defgroup XBT_dd_basic Basic operations on data descriptions
+ *  @ingroup XBT_dd
  * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Basics" --> \endhtmlonly
  *
  * If you only want to send pre-existing types, simply retrieve the pre-defined description with 
- * the \ref gras_datadesc_by_name function. Existing types entail:
+ * the \ref xbt_datadesc_by_name function. Existing types entail:
  *  - char (both signed and unsigned)
  *  - int (short, regular, long and long long, both signed and unsigned)
  *  - float and double
  *  - string (which is indeed a reference to a dynamically sized array of char, strlen being used to retrieve the size)
  * 
- * Example:\verbatim gras_datadesc_type_t i = gras_datadesc_by_name("int");
gras_datadesc_type_t uc = gras_datadesc_by_name("unsigned char");
gras_datadesc_type_t str = gras_datadesc_by_name("string");\endverbatim
+ * Example:\verbatim xbt_datadesc_type_t i = xbt_datadesc_by_name("int");
xbt_datadesc_type_t uc = xbt_datadesc_by_name("unsigned char");
xbt_datadesc_type_t str = xbt_datadesc_by_name("string");\endverbatim
  *
  */
 /* @{ */
 /** @brief Opaque type describing a type description. */
-typedef struct s_gras_datadesc_type *gras_datadesc_type_t;
+typedef struct s_xbt_datadesc_type *xbt_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
+XBT_PUBLIC(xbt_datadesc_type_t) xbt_datadesc_by_name(const char *name);
+XBT_PUBLIC(xbt_datadesc_type_t) xbt_datadesc_by_name_or_null(const char
                                                                *name);
 
 /* @} */
 
-/** @defgroup GRAS_dd_auto Automatic parsing of data descriptions
- *  @ingroup GRAS_dd
+/** @defgroup XBT_dd_auto Automatic parsing of data descriptions
+ *  @ingroup XBT_dd
  * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Automatic parsing" --> \endhtmlonly
  * 
- *  If you need to declare a new datatype, this is the simplest way to describe it to GRAS. Simply
- *  enclose its type definition  into a \ref GRAS_DEFINE_TYPE macro call, and you're set. Here is 
- *  an type declaration  example: \verbatim GRAS_DEFINE_TYPE(mytype,struct mytype {
+ *  If you need to declare a new datatype, this is the simplest way to describe it to XBT. Simply
+ *  enclose its type definition  into a \ref XBT_DEFINE_TYPE macro call, and you're set. Here is 
+ *  an type declaration  example: \verbatim XBT_DEFINE_TYPE(mytype,struct mytype {
    int myfirstfield;
    char mysecondfield;
  });\endverbatim
  *  The type is then both copied verbatim into your source file and stored for further parsing. This allows
- *  you to let GRAS parse the exact version you are actually using in your program.
- *  You can then retrieve the corresponding type description with \ref gras_datadesc_by_symbol.
+ *  you to let XBT parse the exact version you are actually using in your program.
+ *  You can then retrieve the corresponding type description with \ref xbt_datadesc_by_symbol.
  *  Don't worry too much for the performances, the type is only parsed once and a binary representation 
  *  is stored and used in any subsequent calls.
  * 
- *  If your structure contains any pointer, you have to explain GRAS the size of the pointed array. This
+ *  If your structure contains any pointer, you have to explain XBT the size of the pointed array. This
  *  can be 1 in the case of simple references, or more in the case of regular arrays. For that, use the 
- *  \ref GRAS_ANNOTE macro within the type declaration you are passing to \ref GRAS_DEFINE_TYPE. This macro
+ *  \ref XBT_ANNOTE macro within the type declaration you are passing to \ref XBT_DEFINE_TYPE. This macro
  *  rewrites itself to nothing in the declaration (so they won't pollute the type definition copied verbatim
- *  into your code), and give some information to GRAS about your pointer. 
+ *  into your code), and give some information to XBT about your pointer. 
  
- *  GRAS_ANNOTE takes two arguments being the key name and the key value. For now, the only accepted key name 
+ *  XBT_ANNOTE takes two arguments being the key name and the key value. For now, the only accepted key name 
  *  is "size", to specify the length of the pointed array. It can either be:
  *    - the string "1" (without the quote),
  *    - the name of another field of the structure
  *    - a sort of computed expression for multidimensional arrays (see below -- pay attention to the warnings below).
  *  
- *  Here is an example:\verbatim GRAS_DEFINE_TYPE(s_clause,
+ *  Here is an example:\verbatim XBT_DEFINE_TYPE(s_clause,
   struct s_array {
     xbt_string_t name;
-    struct s_array *father GRAS_ANNOTE(size,1);
+    struct s_array *father XBT_ANNOTE(size,1);
     int length;
-    int *data GRAS_ANNOTE(size,length);
+    int *data XBT_ANNOTE(size,length);
     int rows;
     int cols;
-    int *matrix GRAS_ANNOTE(size,rows*cols);
+    int *matrix XBT_ANNOTE(size,rows*cols);
  }
 ;)\endverbatim
  * It specifies that the structure s_array contains six fields, that the \a name field is a classical null-terminated 
@@ -106,65 +106,65 @@ XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_by_name_or_null(const char
  * that \a father field is a simple reference, that the size of the array pointed by \a data is the \a length field, and that the 
  * \a matrix field is an arraywhich size is the result of \a rows times \a cols.
  *
- *  \warning Since GRAS_DEFINE_TYPE is a macro, you shouldn't put any comma in your type definition 
+ *  \warning Since XBT_DEFINE_TYPE is a macro, you shouldn't put any comma in your type definition 
  *  (comma separates macro args). For example, change \verbatim int a, b;\endverbatim to \verbatim int a;
 int b;\endverbatim
  * 
- * \section gras_dd_define \#define and fixed size array
+ * \section xbt_dd_define \#define and fixed size array
  *
  * If you want to exchange arrays which size is given at compilation time by a
- * \#defined constant, you need to keep GRAS informed. It would be done the
+ * \#defined constant, you need to keep XBT informed. It would be done the
  * following way:
 
 \verbatim #define BLOCK_SIZE 32
-GRAS_DEFINE_TYPE(s_toto,
+XBT_DEFINE_TYPE(s_toto,
 struct {
   double data[BLOCK_SIZE];
 } s_toto;)
 
 void register_messages() { 
-  gras_datadesc_type_t toto_type;
+  xbt_datadesc_type_t toto_type;
 
-  gras_datadesc_set_const("BLOCK_SIZE",BLOCK_SIZE);
-  toto_type = gras_datadesc_by_symbol(s_toto); 
+  xbt_datadesc_set_const("BLOCK_SIZE",BLOCK_SIZE);
+  toto_type = xbt_datadesc_by_symbol(s_toto);
 }\endverbatim
  *
- * The form <tt>gras_datadesc_set_const("BLOCK_SIZE",BLOCK_SIZE);</tt> ensures
- * that when you change the definition of the constant, GRAS keeps informed of
+ * The form <tt>xbt_datadesc_set_const("BLOCK_SIZE",BLOCK_SIZE);</tt> ensures
+ * that when you change the definition of the constant, XBT keeps informed of
  * the right value. Passing the numerical value of the constant as second
  * argument would be a bad idea to that regard. Of course, the call to
- * gras_datadesc_set_const() should come before any gras_datadesc_by_symbol()
+ * xbt_datadesc_set_const() should come before any xbt_datadesc_by_symbol()
  * containing references to it.
  *
- * \section GRAS_dd_multidim Defining multidimentional arrays
+ * \section XBT_dd_multidim Defining multidimentional arrays
  * 
- *  The mecanism for multidimensional arrays is known to be fragile and cumbersome. If you want to use it, 
+ *  The mecanism for multidimensional arrays is known to be fragile and cumbersome. If you want to use it,
  *  you have to understand how it is implemented: the multiplication is performed using the sizes stack. In previous example,
- *  a \ref gras_datadesc_cb_push_int callback is added to the \a rows field and a \ref gras_datadesc_cb_push_int_mult one is 
- *  added to \a cols. So, when the structure is sent, the \a rows field push its value onto the stack, then the \a cols field 
+ *  a \ref xbt_datadesc_cb_push_int callback is added to the \a rows field and a \ref xbt_datadesc_cb_push_int_mult one is
+ *  added to \a cols. So, when the structure is sent, the \a rows field push its value onto the stack, then the \a cols field
  *  retrieve this value from the stack, compute (and push) the multiplication value. The \a matrix field can then retrieve this
  *  value by poping the array. There is several ways for this to go wrong:
- *   - if the matrix field is placed before the sizes, the right value won't get pushed into the stack soon enough. 
+ *   - if the matrix field is placed before the sizes, the right value won't get pushed into the stack soon enough.
  *     Reorder your structure fields if needed.
- *   - if you write GRAS_ANNOTE(size,cols*rows); in previous example (inverting rows and cols in annotation),
- *     \a rows will be given a \ref gras_datadesc_cb_push_int_mult. This cannot work since it will try to 
+ *   - if you write XBT_ANNOTE(size,cols*rows); in previous example (inverting rows and cols in annotation),
+ *     \a rows will be given a \ref xbt_datadesc_cb_push_int_mult. This cannot work since it will try to
  *     pop the value which will be pushed by \a cols <i>afterward</i>.
  *   - if you have more than one matrix in your structure, don't interleave the size. They are pushed/poped in the structure order.
- *   - if some of the sizes are used in more than one matrix, you cannot use this mecanism -- sorry. 
+ *   - if some of the sizes are used in more than one matrix, you cannot use this mecanism -- sorry.
  *
- * If you cannot express your datadescs with this mechanism, you'll have to use the more advanced 
- * (and somehow complex) one described in the \ref GRAS_dd_cb_full.
+ * If you cannot express your datadescs with this mechanism, you'll have to use the more advanced
+ * (and somehow complex) one described in the \ref XBT_dd_cb_full.
  *
- * \section GRAS_dd_multifile Projects spanning over multiple files
+ * \section XBT_dd_multifile Projects spanning over multiple files
  * 
- * GRAS_DEFINE_TYPE declares some symbols to work, it needs some special
+ * XBT_DEFINE_TYPE declares some symbols to work, it needs some special
  * care when used in several files. In such case, you want the regular type
- * definition in all files, but the gras specific symbol defined in only
- * one file. For example, consider the following gras project sketch.
+ * definition in all files, but the xbt specific symbol defined in only
+ * one file. For example, consider the following xbt project sketch.
  * 
-\verbatim #include <gras.h>
+\verbatim #include <xbt/datadesc.h>
 
-GRAS_DEFINE_TYPE(my_type,struct my_type {
+XBT_DEFINE_TYPE(my_type,struct my_type {
   int a;
   int b;
   double c;
@@ -179,10 +179,10 @@ int server(int argc, char *argv[]) {
 }\endverbatim
  * 
  * If you want to split this in two files (one for each kind of processes),
- * you need to put the GRAS_DEFINE_TYPE block in a separate header (so that
+ * you need to put the XBT_DEFINE_TYPE block in a separate header (so that
  * each process kind see the associated C type definition). But
  * then you cannot include this right away in all files because the extra
- * symbols containing the GRAS definition would be dupplicated.
+ * symbols containing the XBT definition would be dupplicated.
  * 
  * You thus have to decide in which C file the symbols will live. In that
  * file, include the header without restriction:
@@ -193,11 +193,12 @@ int client(int argc, char *argv[]) {
   ...
 }\endverbatim
 
- * And in the other files needing the C definitions without the extra GRAS
- * symbols, declare the symbol GRAS_DEFINE_TYPE_EXTERN before loading gras.h:
+ * And in the other files needing the C definitions without the extra XBT
+ * symbols, declare the symbol XBT_DEFINE_TYPE_EXTERN before loading
+ * xbt/datadesc.h:
  * 
-\verbatim #define GRAS_DEFINE_TYPE_EXTERN
-#include <gras.h>
+\verbatim #define XBT_DEFINE_TYPE_EXTERN
+#include <xbt/datadesc.h>
 #include "my_header.h"
 
 int server(int argc, char *argv[]) {
@@ -209,7 +210,7 @@ int server(int argc, char *argv[]) {
  * messages that you want to see from every file, and some private messages 
  * that you want to be defined only in one C file.
  * In that case, use the previous trick for common messages, and use 
- * #GRAS_DEFINE_TYPE_LOCAL for the private messages. 
+ * #XBT_DEFINE_TYPE_LOCAL for the private messages.
  *
  * For now, there is no way to have semi-private symbols (for example shared 
  * in all files of a library), sorry. Use functions as interface to your 
@@ -222,60 +223,60 @@ 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
+#define XBT_DEFINE_TYPE(name,def) \
+  const char * _xbt_this_type_symbol_does_not_exist__##name=#def; def
 
 #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
-#    undef GRAS_DEFINE_TYPE_EXTERN
+#  ifdef XBT_DEFINE_TYPE_EXTERN
+#    undef  XBT_DEFINE_TYPE
+#    define XBT_DEFINE_TYPE(name,def)  def
+#    undef XBT_DEFINE_TYPE_EXTERN
 #  endif
 #endif
 
-/**   @brief if this symbol is defined, the \a GRAS_DEFINE_TYPE symbols live in another file.
+/**   @brief if this symbol is defined, the \a XBT_DEFINE_TYPE symbols live in another file.
  *    @hideinitializer
  */
-#define GRAS_DEFINE_TYPE_EXTERN 1
+#define XBT_DEFINE_TYPE_EXTERN 1
 /* leave the fun of declaring this to the user */
-#undef GRAS_DEFINE_TYPE_EXTERN
+#undef XBT_DEFINE_TYPE_EXTERN
 
-/** @brief Define a symbol to be automatically parsed, disregarding #GRAS_DEFINE_TYPE_EXTERN
+/** @brief Define a symbol to be automatically parsed, disregarding #XBT_DEFINE_TYPE_EXTERN
  *  @hideinitializer
  * 
- *  Call this macro instead of #GRAS_DEFINE_TYPE if you had to define #GRAS_DEFINE_TYPE_EXTERN
+ *  Call this macro instead of #XBT_DEFINE_TYPE if you had to define #XBT_DEFINE_TYPE_EXTERN
  *  to load some external symbols, but if you now want to automatically parse the content of 
  *  your private messages.
  */
-#define GRAS_DEFINE_TYPE_LOCAL(name, def) \
-  const char * _gras_this_type_symbol_does_not_exist__##name=#def; def
+#define XBT_DEFINE_TYPE_LOCAL(name, def) \
+  const char * _xbt_this_type_symbol_does_not_exist__##name=#def; def
 
 /** @brief Retrieve a datadesc which was previously parsed 
  *  @hideinitializer
  */
-#define gras_datadesc_by_symbol(name)  \
-  (gras_datadesc_by_name_or_null(#name) ?      \
-   gras_datadesc_by_name_or_null(#name) :      \
-     gras_datadesc_parse(#name,        \
-                        _gras_this_type_symbol_does_not_exist__##name) \
+#define xbt_datadesc_by_symbol(name)  \
+  (xbt_datadesc_by_name_or_null(#name) ?      \
+   xbt_datadesc_by_name_or_null(#name) :      \
+     xbt_datadesc_parse(#name,        \
+                        _xbt_this_type_symbol_does_not_exist__##name) \
   )
 
-/** @def GRAS_ANNOTE
+/** @def XBT_ANNOTE
  *  @brief Add an annotation to a type to be automatically parsed
  */
-#define GRAS_ANNOTE(key,val)
+#define XBT_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) xbt_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(xbt_datadesc_type_t)
+    xbt_datadesc_parse(const char *name, const char *C_statement);
 
-/** @defgroup GRAS_dd_manual Simple manual data description
- *  @ingroup GRAS_dd
+/** @defgroup XBT_dd_manual Simple manual data description
+ *  @ingroup XBT_dd
  * 
  * Here are the functions to use if you want to declare your description manually. 
  * The function names should be self-explanatory in most cases.
@@ -288,7 +289,7 @@ XBT_PUBLIC(gras_datadesc_type_t)
  * specific callback for the string type which is in charge of computing the length of the char
  * array. This is done with the cbps mechanism, explained in next section.
  * 
- * If your types may contain pointer cycle, you must specify it to GRAS using the @ref gras_datadesc_cycle_set. 
+ * If your types may contain pointer cycle, you must specify it to XBT using the @ref xbt_datadesc_cycle_set.
  * 
  * Example:\verbatim
  typedef struct {
@@ -298,32 +299,32 @@ XBT_PUBLIC(gras_datadesc_type_t)
    unsigned long int l2;
  } mystruct;
  [...]
-  my_type=gras_datadesc_struct("mystruct");
-  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"));
-  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("mystruct*", gras_datadesc_by_name("mystruct"));
-  
+  my_type=xbt_datadesc_struct("mystruct");
+  xbt_datadesc_struct_append(my_type,"c1", xbt_datadesc_by_name("unsigned char"));
+  xbt_datadesc_struct_append(my_type,"l1", xbt_datadesc_by_name("unsigned long"));
+  xbt_datadesc_struct_append(my_type,"c2", xbt_datadesc_by_name("unsigned char"));
+  xbt_datadesc_struct_append(my_type,"l2", xbt_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_close(my_type);
+
+  my_type=xbt_datadesc_ref("mystruct*", xbt_datadesc_by_name("mystruct"));
+
   [Use my_type to send pointers to mystruct data]\endverbatim
  */
 /* @{ */
 
 
 /** \brief Opaque type describing a type description callback persistant state. */
-typedef struct s_gras_cbps *gras_cbps_t;
+typedef struct s_xbt_cbps *xbt_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,
+typedef void (*xbt_datadesc_type_cb_void_t) (xbt_datadesc_type_t
+                                              typedesc, xbt_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 (*xbt_datadesc_type_cb_int_t) (xbt_datadesc_type_t
+                                           typedesc, xbt_cbps_t vars,
+                                           void *data);
 /** \brief Prototype of type callbacks selecting a type. */
 typedef
 
@@ -331,9 +332,9 @@ typedef
 
 
 
-gras_datadesc_type_t(*gras_datadesc_selector_t) (gras_datadesc_type_t
+xbt_datadesc_type_t(*xbt_datadesc_selector_t) (xbt_datadesc_type_t
                                                  typedesc,
-                                                 gras_cbps_t vars,
+                                                 xbt_cbps_t vars,
                                                  void *data);
 
 
@@ -341,49 +342,49 @@ gras_datadesc_type_t(*gras_datadesc_selector_t) (gras_datadesc_type_t
  **** Declare datadescription yourself ****
  ******************************************/
 
-XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_struct(const char *name);
-XBT_PUBLIC(void) gras_datadesc_struct_append(gras_datadesc_type_t
+XBT_PUBLIC(xbt_datadesc_type_t) xbt_datadesc_struct(const char *name);
+XBT_PUBLIC(void) xbt_datadesc_struct_append(xbt_datadesc_type_t
                                              struct_type, const char *name,
-                                             gras_datadesc_type_t
+                                             xbt_datadesc_type_t
                                              field_type);
-XBT_PUBLIC(void) gras_datadesc_struct_close(gras_datadesc_type_t
+XBT_PUBLIC(void) xbt_datadesc_struct_close(xbt_datadesc_type_t
                                             struct_type);
 
 
-XBT_PUBLIC(gras_datadesc_type_t) gras_datadesc_union(const char *name,
-                                                     gras_datadesc_type_cb_int_t
+XBT_PUBLIC(xbt_datadesc_type_t) xbt_datadesc_union(const char *name,
+                                                     xbt_datadesc_type_cb_int_t
                                                      selector);
-XBT_PUBLIC(void) gras_datadesc_union_append(gras_datadesc_type_t
+XBT_PUBLIC(void) xbt_datadesc_union_append(xbt_datadesc_type_t
                                             union_type, const char *name,
-                                            gras_datadesc_type_t
+                                            xbt_datadesc_type_t
                                             field_type);
-XBT_PUBLIC(void) gras_datadesc_union_close(gras_datadesc_type_t
+XBT_PUBLIC(void) xbt_datadesc_union_close(xbt_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(xbt_datadesc_type_t)
+    xbt_datadesc_ref(const char *name, xbt_datadesc_type_t referenced_type);
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_copy(const char *name, xbt_datadesc_type_t copied_type);
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_ref_generic(const char *name,
+                          xbt_datadesc_selector_t selector);
 
-XBT_PUBLIC(gras_datadesc_type_t)
-    gras_datadesc_array_fixed(const char *name,
-                          gras_datadesc_type_t element_type,
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_array_fixed(const char *name,
+                          xbt_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,
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_array_dyn(const char *name,
+                        xbt_datadesc_type_t element_type,
+                        xbt_datadesc_type_cb_int_t dynamic_size);
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_ref_pop_arr(xbt_datadesc_type_t element_type);
+
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_dynar(xbt_datadesc_type_t elm_t, void_f_pvoid_t free_func);
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_matrix(xbt_datadesc_type_t elm_t,
                      void_f_pvoid_t const free_f);
 
 /*********************************
@@ -391,46 +392,46 @@ XBT_PUBLIC(gras_datadesc_type_t)
  *********************************/
 
 /** \brief Specify that this type may contain cycles */
-XBT_PUBLIC(void) gras_datadesc_cycle_set(gras_datadesc_type_t type);
+XBT_PUBLIC(void) xbt_datadesc_cycle_set(xbt_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);
+XBT_PUBLIC(void) xbt_datadesc_cycle_unset(xbt_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) xbt_datadesc_cb_send(xbt_datadesc_type_t type,
+                                      xbt_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) xbt_datadesc_cb_recv(xbt_datadesc_type_t type,
+                                      xbt_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) xbt_datadesc_cb_field_send(xbt_datadesc_type_t type,
+                                            const char *field_name,
+                                            xbt_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) xbt_datadesc_cb_field_recv(xbt_datadesc_type_t type,
+                                            const char *field_name,
+                                            xbt_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) xbt_datadesc_cb_field_push(xbt_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_datadesc_cb_field_push_multiplier(xbt_datadesc_type_t type,
+                                      const char
+                                      *field_name);
 
 /******************************
  * Get stuff within datadescs *
  ******************************/
 /** \brief Returns the name of a datadescription */
-XBT_PUBLIC(const char *) gras_datadesc_get_name(gras_datadesc_type_t ddt);
+XBT_PUBLIC(const char *) xbt_datadesc_get_name(xbt_datadesc_type_t ddt);
 /** \brief Returns the identifier of a datadescription */
-XBT_PUBLIC(int) gras_datadesc_get_id(gras_datadesc_type_t ddt);
+XBT_PUBLIC(int) xbt_datadesc_get_id(xbt_datadesc_type_t ddt);
 
 /* @} */
 
-/** @defgroup GRAS_dd_cb_simple Data description with Callback Persistant State: Simple push/pop mechanism
- *  @ingroup GRAS_dd
+/** @defgroup XBT_dd_cb_simple Data description with Callback Persistant State: Simple push/pop mechanism
+ *  @ingroup XBT_dd
  * 
  * Sometimes, one of the callbacks need to leave information for the next ones. If this is a simple integer (such as
  * an array size), you can use the functions described here. If not, you'll have to play with the complete cbps interface.
@@ -443,13 +444,13 @@ struct s_array {
   int *data;
 }
 [...]
-my_type=gras_datadesc_struct("s_array");
-gras_datadesc_struct_append(my_type,"length", gras_datadesc_by_name("int"));
-gras_datadesc_cb_field_send (my_type, "length", gras_datadesc_cb_push_int);
+my_type=xbt_datadesc_struct("s_array");
+xbt_datadesc_struct_append(my_type,"length", xbt_datadesc_by_name("int"));
+xbt_datadesc_cb_field_send (my_type, "length", xbt_datadesc_cb_push_int);
 
-gras_datadesc_struct_append(my_type,"data",
-                            gras_datadesc_array_dyn ("s_array::data",gras_datadesc_by_name("int"), gras_datadesc_cb_pop));
-gras_datadesc_struct_close(my_type);
+xbt_datadesc_struct_append(my_type,"data",
+                            xbt_datadesc_array_dyn ("s_array::data",xbt_datadesc_by_name("int"), xbt_datadesc_cb_pop));
+xbt_datadesc_struct_close(my_type);
 \endverbatim
 
  *
@@ -462,56 +463,56 @@ struct s_matrix {
   int *data;
 }
 [...]
-my_type=gras_datadesc_struct("s_matrix");
-gras_datadesc_struct_append(my_type,"row", gras_datadesc_by_name("int"));
-gras_datadesc_cb_field_send (my_type, "length", gras_datadesc_cb_push_int);
-gras_datadesc_struct_append(my_type,"col", gras_datadesc_by_name("int"));
-gras_datadesc_cb_field_send (my_type, "length", gras_datadesc_cb_push_int_mult);
-
-gras_datadesc_struct_append(my_type,"data",
-                            gras_datadesc_array_dyn ("s_matrix::data",gras_datadesc_by_name("int"), gras_datadesc_cb_pop));
-gras_datadesc_struct_close(my_type);
+my_type=xbt_datadesc_struct("s_matrix");
+xbt_datadesc_struct_append(my_type,"row", xbt_datadesc_by_name("int"));
+xbt_datadesc_cb_field_send (my_type, "length", xbt_datadesc_cb_push_int);
+xbt_datadesc_struct_append(my_type,"col", xbt_datadesc_by_name("int"));
+xbt_datadesc_cb_field_send (my_type, "length", xbt_datadesc_cb_push_int_mult);
+
+xbt_datadesc_struct_append(my_type,"data",
+                            xbt_datadesc_array_dyn ("s_matrix::data",xbt_datadesc_by_name("int"), xbt_datadesc_cb_pop));
+xbt_datadesc_struct_close(my_type);
 \endverbatim
  
  */
 /* @{ */
 
-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(void) xbt_cbps_i_push(xbt_cbps_t ps, int val);
+XBT_PUBLIC(int) xbt_cbps_i_pop(xbt_cbps_t ps);
 
-XBT_PUBLIC(int) gras_datadesc_cb_pop(gras_datadesc_type_t typedesc,
-                                     gras_cbps_t vars, void *data);
+XBT_PUBLIC(int) xbt_datadesc_cb_pop(xbt_datadesc_type_t typedesc,
+                                     xbt_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) xbt_datadesc_cb_push_int(xbt_datadesc_type_t typedesc,
+                                           xbt_cbps_t vars, void *data);
+XBT_PUBLIC(void) xbt_datadesc_cb_push_uint(xbt_datadesc_type_t typedesc,
+                                            xbt_cbps_t vars, void *data);
+XBT_PUBLIC(void) xbt_datadesc_cb_push_lint(xbt_datadesc_type_t typedesc,
+                                            xbt_cbps_t vars, void *data);
+XBT_PUBLIC(void) xbt_datadesc_cb_push_ulint(xbt_datadesc_type_t typedesc,
+                                             xbt_cbps_t vars, void *data);
 
-XBT_PUBLIC(void) gras_datadesc_cb_push_int_mult(gras_datadesc_type_t
-                                                typedesc, gras_cbps_t vars,
+XBT_PUBLIC(void) xbt_datadesc_cb_push_int_mult(xbt_datadesc_type_t
+                                                typedesc, xbt_cbps_t vars,
                                                 void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_uint_mult(gras_datadesc_type_t
+XBT_PUBLIC(void) xbt_datadesc_cb_push_uint_mult(xbt_datadesc_type_t
                                                  typedesc,
-                                                 gras_cbps_t vars,
+                                                 xbt_cbps_t vars,
                                                  void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_lint_mult(gras_datadesc_type_t
+XBT_PUBLIC(void) xbt_datadesc_cb_push_lint_mult(xbt_datadesc_type_t
                                                  typedesc,
-                                                 gras_cbps_t vars,
+                                                 xbt_cbps_t vars,
                                                  void *data);
-XBT_PUBLIC(void) gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t
+XBT_PUBLIC(void) xbt_datadesc_cb_push_ulint_mult(xbt_datadesc_type_t
                                                   typedesc,
-                                                  gras_cbps_t vars,
+                                                  xbt_cbps_t vars,
                                                   void *data);
 
 
 /* @} */
 
-/** @defgroup GRAS_dd_cb_full Data description with Callback Persistant State: Full featured interface
- *  @ingroup GRAS_dd
+/** @defgroup XBT_dd_cb_full Data description with Callback Persistant State: Full featured interface
+ *  @ingroup XBT_dd
  * 
  * Sometimes, one of the callbacks need to leave information for the next
  * ones. If the simple push/pop mechanism introduced in previous section
@@ -524,21 +525,21 @@ XBT_PUBLIC(void) gras_datadesc_cb_push_ulint_mult(gras_datadesc_type_t
 
 /* @{ */
 
-XBT_PUBLIC(void) gras_cbps_v_pop(gras_cbps_t ps, const char *name,
-                                 /* OUT */ gras_datadesc_type_t * ddt,
+XBT_PUBLIC(void) xbt_cbps_v_pop(xbt_cbps_t ps, const char *name,
+                                 /* OUT */ xbt_datadesc_type_t * ddt,
                                  /* OUT */ void **res);
-XBT_PUBLIC(void) gras_cbps_v_push(gras_cbps_t ps,
+XBT_PUBLIC(void) xbt_cbps_v_push(xbt_cbps_t ps,
                                   const char *name,
-                                  void *data, gras_datadesc_type_t ddt);
-XBT_PUBLIC(void) gras_cbps_v_set(gras_cbps_t ps,
+                                  void *data, xbt_datadesc_type_t ddt);
+XBT_PUBLIC(void) xbt_cbps_v_set(xbt_cbps_t ps,
                                  const char *name,
-                                 void *data, gras_datadesc_type_t ddt);
+                                 void *data, xbt_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 *) xbt_cbps_v_get(xbt_cbps_t ps, const char *name,
+                                   /* OUT */ xbt_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);
+XBT_PUBLIC(void) xbt_cbps_block_begin(xbt_cbps_t ps);
+XBT_PUBLIC(void) xbt_cbps_block_end(xbt_cbps_t ps);
 
 /* @} */
 /* @} */
@@ -547,7 +548,7 @@ XBT_PUBLIC(void) gras_cbps_block_end(gras_cbps_t ps);
 /*******************************
  **** About data convertion ****
  *******************************/
-XBT_PUBLIC(int) gras_arch_selfid(void); /* ID of this arch */
+XBT_PUBLIC(int) xbt_arch_selfid(void); /* ID of this arch */
 
 
 /*****************************
@@ -594,11 +595,11 @@ typedef struct DataDescriptorStruct {
   sizeof(structType) - offsetof(structType, lastMember) - \
   sizeof(memberType) * repetitions
 
-XBT_PUBLIC(gras_datadesc_type_t)
-    gras_datadesc_import_nws(const char *name,
+XBT_PUBLIC(xbt_datadesc_type_t)
+    xbt_datadesc_import_nws(const char *name,
                          const DataDescriptor * desc,
                          unsigned long howmany);
 
 
 SG_END_DECL()
-#endif                          /* GRAS_DATADESC_H */
+#endif                          /* XBT_DATADESC_H */
diff --git a/include/xbt/socket.h b/include/xbt/socket.h
new file mode 100644 (file)
index 0000000..177ad51
--- /dev/null
@@ -0,0 +1,206 @@
+/* transport - low level communication (send/receive bunches of bytes)      */
+/* module's public interface exported to end user.                          */
+
+/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+#ifndef XBT_SOCKET_H
+#define XBT_SOCKET_H
+
+#include "xbt/misc.h"
+
+/** \addtogroup XBT_sock
+ *  \brief Socket handling
+ *
+ * The model of communications in XBT is very close to the BSD socket one.
+ * To get two hosts exchanging data, one of them needs to open a
+ * <i>server</i> socket on which it can listen for incoming messages and the
+ * other one must connect a <i>client</i> socket onto the server one.
+ *
+ * The main difference is that you cannot exchange arbitrary bytes on
+ * sockets, but messages. See the \ref GRAS_msg section for details.
+ *
+ * If you need an example of how to use sockets, check \ref GRAS_ex_ping.
+ */
+
+/** \defgroup XBT_sock_create Socket creation functions
+ *  \ingroup XBT_sock
+ *
+ */
+/* @{*/
+/** \brief Opaque type describing a socket */
+typedef struct s_xbt_socket *xbt_socket_t;
+typedef struct s_xbt_trp_plugin s_xbt_trp_plugin_t, *xbt_trp_plugin_t;
+
+void xbt_socket_new(int incoming,
+                    xbt_socket_t* dst);
+void xbt_socket_new_ext(int incoming,
+                        xbt_socket_t* dst,
+                        xbt_trp_plugin_t plugin,
+                        unsigned long int buf_size,
+                        int measurement);
+XBT_INLINE void* xbt_socket_get_data(xbt_socket_t sock);
+XBT_INLINE void xbt_socket_set_data(xbt_socket_t sock, void* data);
+
+/** \brief Simply create a client socket (to speak to a remote host) */
+XBT_PUBLIC(xbt_socket_t) xbt_socket_tcp_client(const char *host,
+                                               unsigned short port);
+XBT_PUBLIC(xbt_socket_t) xbt_socket_tcp_client_from_string(const char *host);
+/** \brief Simply create a server socket (to ear from remote hosts speaking to you) */
+XBT_PUBLIC(xbt_socket_t) xbt_socket_tcp_server(unsigned short port);
+
+/** \brief Create a client socket, full interface to all relevant settings */
+XBT_PUBLIC(xbt_socket_t) xbt_socket_tcp_client_ext(const char *host,
+                                                   unsigned short port,
+                                                   unsigned long int bufSize,
+                                                   int measurement);
+/** \brief Create a server socket, full interface to all relevant settings */
+XBT_PUBLIC(xbt_socket_t) xbt_socket_tcp_server_ext(unsigned short portcp_t,
+                                                   unsigned long int bufSize,
+                                                   int measurement);
+XBT_PUBLIC(xbt_socket_t)
+    xbt_socket_tcp_server_range(unsigned short minport, unsigned short maxport,
+                                unsigned long int buf_size, int measurement);
+
+XBT_PUBLIC(void) xbt_socket_close(xbt_socket_t sd);
+XBT_PUBLIC(void) xbt_socket_close_voidp(void *sock);
+
+/* @}*/
+/** \defgroup XBT_sock_info Retrieving data about sockets and peers
+ *  \ingroup XBT_sock
+ * 
+ * Who are you talking to? 
+ */
+/* @{*/
+
+/** Get the port number on which this socket is connected on my side */
+XBT_PUBLIC(int) xbt_socket_my_port(xbt_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
+ * gras_socket_master() function (if any, or a random number being unique on
+ * the remote host). If remote used gras_socket_master() more than once, the 
+ * lastly declared number will be used here.
+ *
+ * Note to BSD sockets experts: With BSD sockets, the sockaddr 
+ * structure allows you to retrieve the port of the client socket on
+ * remote side, but it is of no use (from user perspective, it is
+ * some random number above 6000). That is why XBT sockets differ
+ * from BSD ones here. 
+ */
+XBT_PUBLIC(int) xbt_socket_peer_port(xbt_socket_t sock);
+/** Get the host name of the remote side */
+XBT_PUBLIC(const char *) xbt_socket_peer_name(xbt_socket_t sock);
+/** Get the process name of the remote side */
+XBT_PUBLIC(const char *) xbt_socket_peer_proc(xbt_socket_t sock);
+/* @}*/
+
+/** \defgroup XBT_sock_meas Using measurement sockets
+ *  \ingroup XBT_sock
+ * 
+ * You may want to use sockets not to exchange valuable data (in messages), 
+ * but to conduct some bandwidth measurements and related experiments. If so, try those measurement sockets.
+ * 
+ * You can only use those functions on sockets opened with the "measurement" boolean set to true.
+ * 
+ */
+/* @{*/
+
+XBT_PUBLIC(int) xbt_socket_is_meas(xbt_socket_t sock);
+XBT_PUBLIC(void) xbt_socket_meas_send(xbt_socket_t peer,
+                                      unsigned int timeout,
+                                      unsigned long int msgSize,
+                                      unsigned long int msgAmount);
+XBT_PUBLIC(void) xbt_socket_meas_recv(xbt_socket_t peer,
+                                      unsigned int timeout,
+                                      unsigned long int msgSize,
+                                      unsigned long int msgAmount);
+XBT_PUBLIC(xbt_socket_t) xbt_socket_meas_accept(xbt_socket_t peer);
+
+/* @}*/
+
+/***
+ *** Main user functions
+ ***/
+/* stable if we know the storage will keep as is until the next trp_flush */
+XBT_PUBLIC(void) xbt_trp_send(xbt_socket_t sd, char *data, long int size,
+                             int stable);
+XBT_PUBLIC(void) xbt_trp_recv(xbt_socket_t sd, char *data, long int size);
+XBT_PUBLIC(void) xbt_trp_flush(xbt_socket_t sd);
+
+/* Find which socket needs to be read next */
+XBT_PUBLIC(xbt_socket_t) xbt_trp_select(double timeout);
+
+/* Set the peer process name (used by messaging layer) */
+XBT_PUBLIC(void) xbt_socket_peer_proc_set(xbt_socket_t sock,
+                                          char *peer_proc);
+
+/** \defgroup XBT_sock_plugin Plugin mechanism
+ *  \ingroup XBT_sock
+ *
+ * XBT provides a TCP plugin that implements TCP sockets.
+ * You can also write your own plugin if you need another socket
+ * implementation.
+ */
+/* @{*/
+
+/* A plugin type */
+
+struct s_xbt_trp_plugin {
+  char *name;
+
+  /* dst pointers are created and initialized with default values
+     before call to socket_client/server.
+     Retrieve the info you need from there. */
+  void (*socket_client) (xbt_trp_plugin_t self, const char *host, int port, xbt_socket_t dst);
+  void (*socket_server) (xbt_trp_plugin_t self, int port, xbt_socket_t dst);
+
+  xbt_socket_t (*socket_accept) (xbt_socket_t from);
+
+  /* Getting info about who's speaking */
+  int (*my_port) (xbt_socket_t sd);
+  int (*peer_port) (xbt_socket_t sd);
+  const char* (*peer_name) (xbt_socket_t sd);
+  const char* (*peer_proc) (xbt_socket_t sd);
+  void (*peer_proc_set) (xbt_socket_t sd, char* peer_proc);
+
+  /* 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) (xbt_socket_t sd);
+
+  /* send/recv may be buffered */
+  void (*send) (xbt_socket_t sd,
+                const char *data,
+                unsigned long int size,
+                int stable /* storage will survive until flush */ );
+  int (*recv) (xbt_socket_t sd, char *data, unsigned long int size);
+  /* raw_send/raw_recv is never buffered (use it for measurement stuff) */
+  void (*raw_send) (xbt_socket_t sd,
+                    const char *data, unsigned long int size);
+  int (*raw_recv) (xbt_socket_t sd, char *data, unsigned long int size);
+
+  /* flush has to make sure that the pending communications are achieved */
+  void (*flush) (xbt_socket_t sd);
+
+  void *data;                   /* plugin-specific data */
+
+  /* exit is responsible for freeing data and telling to the OS that
+     this plugin is gone.
+     If exit is NULL, data gets brutally freed by the generic interface.
+     (i.e. an exit function is only needed when data contains pointers) */
+  void (*exit) (xbt_trp_plugin_t);
+};
+
+typedef void (*xbt_trp_setup_t) (xbt_trp_plugin_t dst);
+
+XBT_PUBLIC(void) xbt_trp_plugin_new(const char *name, xbt_trp_setup_t setup);
+XBT_PUBLIC(xbt_trp_plugin_t)
+    xbt_trp_plugin_get_by_name(const char *name);
+
+/* @}*/
+
+#endif                          /* XBT_SOCKET_H */
index 6372a56..d28219c 100644 (file)
@@ -54,32 +54,32 @@ static int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx, void *payload);
 
 void amok_bw_bw_init()
 {
-  gras_datadesc_type_t bw_request_desc, bw_res_desc;
+  xbt_datadesc_type_t bw_request_desc, bw_res_desc;
 
   /* 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_close(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_close(bw_res_desc);
-  bw_res_desc = gras_datadesc_ref("bw_res_t", bw_res_desc);
+  bw_request_desc = xbt_datadesc_struct("s_bw_request_t");
+  xbt_datadesc_struct_append(bw_request_desc, "peer",
+                              xbt_datadesc_by_name("s_xbt_peer_t"));
+  xbt_datadesc_struct_append(bw_request_desc, "buf_size",
+                              xbt_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(bw_request_desc, "msg_size",
+                              xbt_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(bw_request_desc, "msg_amount",
+                              xbt_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(bw_request_desc, "min_duration",
+                              xbt_datadesc_by_name("double"));
+  xbt_datadesc_struct_close(bw_request_desc);
+  bw_request_desc = xbt_datadesc_ref("bw_request_t", bw_request_desc);
+
+  bw_res_desc = xbt_datadesc_struct("s_bw_res_t");
+  xbt_datadesc_struct_append(bw_res_desc, "timestamp",
+                              xbt_datadesc_by_name("unsigned int"));
+  xbt_datadesc_struct_append(bw_res_desc, "seconds",
+                              xbt_datadesc_by_name("double"));
+  xbt_datadesc_struct_append(bw_res_desc, "bw",
+                              xbt_datadesc_by_name("double"));
+  xbt_datadesc_struct_close(bw_res_desc);
+  bw_res_desc = xbt_datadesc_ref("bw_res_t", bw_res_desc);
 
   gras_msgtype_declare_rpc("BW handshake", bw_request_desc,
                            bw_request_desc);
@@ -133,7 +133,7 @@ void amok_bw_bw_leave()
  *           bytes in a fat pipe.
  * 
  */
-void amok_bw_test(gras_socket_t peer,
+void amok_bw_test(xbt_socket_t peer,
                   unsigned long int buf_size,
                   unsigned long int msg_size,
                   unsigned long int msg_amount,
@@ -141,7 +141,7 @@ void amok_bw_test(gras_socket_t peer,
 {
 
   /* Measurement sockets for the experiments */
-  volatile gras_socket_t measMasterIn = NULL, measIn, measOut = NULL;
+  volatile xbt_socket_t measMasterIn = NULL, measIn, measOut = NULL;
   volatile int port;
   bw_request_t request, request_ack;
   xbt_ex_t e;
@@ -166,10 +166,10 @@ void amok_bw_test(gras_socket_t peer,
   request->msg_size = msg_size;
   request->msg_amount = msg_amount;
   request->peer.name = NULL;
-  request->peer.port = gras_socket_my_port(measMasterIn);
+  request->peer.port = xbt_socket_my_port(measMasterIn);
   XBT_DEBUG
       ("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),
+       xbt_socket_peer_name(peer), xbt_socket_peer_port(peer),
        request->peer.port, request->buf_size, request->msg_size,
        request->msg_amount);
 
@@ -179,17 +179,17 @@ void amok_bw_test(gras_socket_t peer,
   CATCH_ANONYMOUS {
     RETHROWF("Error encountered while sending the BW request: %s");
   }
-  measIn = gras_socket_meas_accept(measMasterIn);
+  measIn = xbt_socket_meas_accept(measMasterIn);
 
   TRY {
-    measOut = gras_socket_client_ext(gras_socket_peer_name(peer),
+    measOut = gras_socket_client_ext(xbt_socket_peer_name(peer),
                                      request_ack->peer.port,
                                      request->buf_size, 1);
   }
   CATCH_ANONYMOUS {
     RETHROWF
         ("Error encountered while opening the measurement socket to %s:%d for BW test: %s",
-         gras_socket_peer_name(peer), request_ack->peer.port);
+         xbt_socket_peer_name(peer), request_ack->peer.port);
   }
   XBT_DEBUG
       ("Got ACK; conduct the experiment (msg_size = %ld, msg_amount=%ld)",
@@ -240,10 +240,10 @@ void amok_bw_test(gras_socket_t peer,
     first_pass = 0;
     *sec = gras_os_time();
     TRY {
-      gras_socket_meas_send(measOut, 120, request->msg_size,
+      xbt_socket_meas_send(measOut, 120, request->msg_size,
                             request->msg_amount);
       XBT_DEBUG("Data sent. Wait ACK");
-      gras_socket_meas_recv(measIn, 120, 1, 1);
+      xbt_socket_meas_recv(measIn, 120, 1, 1);
     }
     CATCH_ANONYMOUS {
       gras_socket_close(measOut);
@@ -288,8 +288,8 @@ void amok_bw_test(gras_socket_t peer,
 */
 int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
 {
-  gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
-  volatile gras_socket_t measMasterIn = NULL,  measIn = NULL, measOut = NULL;
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+  volatile xbt_socket_t measMasterIn = NULL,  measIn = NULL, measOut = NULL;
   volatile bw_request_t request = *(bw_request_t *) payload;
   bw_request_t answer;
   xbt_ex_t e;
@@ -300,7 +300,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
 
   XBT_DEBUG
       ("Handshaked to connect to %s:%d (sizes: buf=%lu msg=%lu msg_amount=%lu)",
-       gras_socket_peer_name(expeditor), request->peer.port,
+       xbt_socket_peer_name(expeditor), request->peer.port,
        request->buf_size, request->msg_size, request->msg_amount);
 
   /* Build our answer */
@@ -324,7 +324,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
   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->peer.port = xbt_socket_my_port(measMasterIn);
 
   TRY {
     gras_msg_rpcreturn(60, ctx, &answer);
@@ -338,19 +338,19 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
 
   /* 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),
+    measOut = gras_socket_client_ext(xbt_socket_peer_name(expeditor),
                                      request->peer.port,
                                      request->buf_size, 1);
   }
   CATCH_ANONYMOUS {
     RETHROWF
         ("Error encountered while opening a measurement socket back to %s:%d : %s",
-         gras_socket_peer_name(expeditor), request->peer.port);
+         xbt_socket_peer_name(expeditor), request->peer.port);
     /* FIXME: tell error to remote */
   }
 
   TRY {
-    measIn = gras_socket_meas_accept(measMasterIn);
+    measIn = xbt_socket_meas_accept(measMasterIn);
     XBT_DEBUG
         ("BW handshake answered. buf_size=%lu msg_size=%lu msg_amount=%lu port=%d",
          answer->buf_size, answer->msg_size, answer->msg_amount,
@@ -374,9 +374,9 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
     void *payload;
     int msggot;
     TRY {
-      gras_socket_meas_recv(measIn, 120, request->msg_size,
+      xbt_socket_meas_recv(measIn, 120, request->msg_size,
                             request->msg_amount);
-      gras_socket_meas_send(measOut, 120, 1, 1);
+      xbt_socket_meas_send(measOut, 120, 1, 1);
     }
     CATCH_ANONYMOUS {
       gras_socket_close(measMasterIn);
@@ -443,7 +443,7 @@ void amok_bw_request(const char *from_name, unsigned int from_port,
                      double min_duration, /*OUT*/ double *sec, double *bw)
 {
 
-  gras_socket_t sock;
+  xbt_socket_t sock;
   /* The request */
   bw_request_t request;
   bw_res_t result;
@@ -486,11 +486,11 @@ 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;
+  xbt_socket_t peer, asker;
 
   asker = gras_msg_cb_ctx_from(ctx);
   XBT_VERB("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),
+        xbt_socket_peer_name(asker), xbt_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);
index 0f61258..191f18a 100644 (file)
@@ -19,19 +19,19 @@ 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");
-  gras_datadesc_type_t sat_request_desc;
+  xbt_datadesc_type_t bw_res_desc = xbt_datadesc_by_name("bw_res_t");
+  xbt_datadesc_type_t sat_request_desc;
   /* 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_close(sat_request_desc);
-  sat_request_desc = gras_datadesc_ref("sat_request_t", sat_request_desc);
+  sat_request_desc = xbt_datadesc_struct("s_sat_request_desc_t");
+  xbt_datadesc_struct_append(sat_request_desc, "peer",
+                              xbt_datadesc_by_name("s_xbt_peer_t"));
+  xbt_datadesc_struct_append(sat_request_desc, "msg_size",
+                              xbt_datadesc_by_name("unsigned int"));
+  xbt_datadesc_struct_append(sat_request_desc, "duration",
+                              xbt_datadesc_by_name("unsigned int"));
+  xbt_datadesc_struct_close(sat_request_desc);
+  sat_request_desc = xbt_datadesc_ref("sat_request_t", sat_request_desc);
 
   /* Register the saturation messages */
   gras_msgtype_declare_rpc("amok_bw_sat start", sat_request_desc, NULL);
@@ -76,7 +76,7 @@ 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;
+  xbt_socket_t sock;
   sat_request_t request = xbt_new(s_sat_request_t, 1);
 
   XBT_VERB("Start from_name %s:%d -> to_name %s:%d",
@@ -99,10 +99,10 @@ void amok_bw_saturate_start(const char *from_name, unsigned int from_port,
 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);
+  xbt_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
 
   XBT_VERB("Asked by %s:%d to start a saturation to %s:%d",
-        gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),
+        xbt_socket_peer_name(expeditor), xbt_socket_peer_port(expeditor),
         request->peer.name, request->peer.port);
 
   gras_msg_rpcreturn(60, ctx, NULL);
@@ -135,10 +135,10 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port,
 
   xbt_ex_t e;
 
-  gras_socket_t peer_cmd = gras_socket_client(to_name, to_port);
+  xbt_socket_t peer_cmd = gras_socket_client(to_name, to_port);
   gras_msg_cb_ctx_t ctx;
 
-  gras_socket_t meas;
+  xbt_socket_t meas;
 
   s_gras_msg_t msg_got;
 
@@ -194,7 +194,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port,
 
   do {
     /* do send it */
-    gras_socket_meas_send(meas, 120, msg_size, 1);
+    xbt_socket_meas_send(meas, 120, msg_size, 1);
     packet_sent++;
 
     /* Check whether someone asked us to stop saturation */
@@ -234,8 +234,8 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port,
 
     XBT_INFO("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));
+          xbt_socket_peer_name(msg_got.expe),
+          xbt_socket_peer_port(msg_got.expe));
     answer->timestamp = gras_os_time();
     answer->sec = elapsed;
     answer->bw = bw;
@@ -263,8 +263,8 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload)
   sat_request_t answer = xbt_new0(s_sat_request_t, 1);
   volatile int saturate_further = 1;
   xbt_ex_t e;
-  volatile gras_socket_t measMaster = NULL, meas = NULL;
-  volatile gras_socket_t from = gras_msg_cb_ctx_from(ctx);
+  volatile xbt_socket_t measMaster = NULL, meas = NULL;
+  volatile xbt_socket_t from = gras_msg_cb_ctx_from(ctx);
 
   volatile int port = 6000;
   while (port <= 10000 && measMaster == NULL) {
@@ -291,7 +291,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload)
   gras_os_sleep(5);             /* Wait for the accept */
 
   TRY {
-    meas = gras_socket_meas_accept(measMaster);
+    meas = xbt_socket_meas_accept(measMaster);
     XBT_DEBUG("saturation handshake answered");
   }
   CATCH_ANONYMOUS {
@@ -301,7 +301,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload)
 
   while (saturate_further) {
     TRY {
-      gras_socket_meas_recv(meas, 5, request->msg_size, 1);
+      xbt_socket_meas_recv(meas, 5, request->msg_size, 1);
     }
     CATCH(e) {
       saturate_further = 0;
@@ -309,7 +309,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload)
     }
   }
   XBT_INFO("Saturation comming from %s:%d stopped on %s:%d",
-        gras_socket_peer_name(from), gras_socket_peer_port(from),
+        xbt_socket_peer_name(from), xbt_socket_peer_port(from),
         gras_os_myname(), gras_os_myport());
 
   gras_socket_close(meas);
@@ -330,7 +330,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload)
 void amok_bw_saturate_stop(const char *from_name, unsigned int from_port,
                            /*out */ double *time, double *bw)
 {
-  gras_socket_t sock = gras_socket_client(from_name, from_port);
+  xbt_socket_t sock = gras_socket_client(from_name, from_port);
   bw_res_t answer;
   XBT_VERB("Ask %s:%d to stop the saturation", from_name, from_port);
   TRY {
index 1f02fe0..a04cfc9 100644 (file)
@@ -58,9 +58,9 @@ static int amok_pm_cb_join(gras_msg_cb_ctx_t ctx, void *payload)
   xbt_dynar_t group = xbt_dict_get(g->groups, group_name);
   int rank;
 
-  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));
+  xbt_socket_t exp = gras_msg_cb_ctx_from(ctx);
+  xbt_peer_t dude = xbt_peer_new(xbt_socket_peer_name(exp),
+                                 xbt_socket_peer_port(exp));
 
   rank = xbt_dynar_length(group);
   xbt_dynar_push(group, &dude);
@@ -78,9 +78,9 @@ static int amok_pm_cb_leave(gras_msg_cb_ctx_t ctx, void *payload)
   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));
+  xbt_socket_t exp = gras_msg_cb_ctx_from(ctx);
+  xbt_peer_t dude = xbt_peer_new(xbt_socket_peer_name(exp),
+                                 xbt_socket_peer_port(exp));
 
   unsigned int cpt;
   xbt_peer_t peer_it;
@@ -121,19 +121,19 @@ void amok_pm_mainloop(double 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);
+  xbt_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)
+void amok_pm_kill(xbt_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)
+void amok_pm_kill_sync(xbt_socket_t buddy)
 {
   gras_msg_rpccall(buddy, 30, "amok_pm_killrpc", NULL, NULL);
 }
@@ -161,7 +161,7 @@ xbt_dynar_t amok_pm_group_new(const char *group_name)
 }
 
 /** \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(xbt_socket_t master, const char *group_name)
 {
   xbt_dynar_t res;
 
@@ -173,16 +173,16 @@ xbt_dynar_t amok_pm_group_get(gras_socket_t master, const char *group_name)
  *
  * Returns the rank of the process in the group.
  */
-int amok_pm_group_join(gras_socket_t master, const char *group_name)
+int amok_pm_group_join(xbt_socket_t master, const char *group_name)
 {
   int rank;
   XBT_VERB("Join group '%s' on %s:%d",
-        group_name, gras_socket_peer_name(master),
-        gras_socket_peer_port(master));
+        group_name, xbt_socket_peer_name(master),
+        xbt_socket_peer_port(master));
   gras_msg_rpccall(master, 30, "amok_pm_join", &group_name, &rank);
   XBT_VERB("Joined group '%s' on %s:%d. Got rank %d",
-        group_name, gras_socket_peer_name(master),
-        gras_socket_peer_port(master), rank);
+        group_name, xbt_socket_peer_name(master),
+        xbt_socket_peer_port(master), rank);
   return rank;
 }
 
@@ -190,12 +190,12 @@ int amok_pm_group_join(gras_socket_t master, const char *group_name)
  *
  * If not found, call is ignored 
  */
-void amok_pm_group_leave(gras_socket_t master, const char *group_name)
+void amok_pm_group_leave(xbt_socket_t master, const char *group_name)
 {
   gras_msg_rpccall(master, 30, "amok_pm_leave", &group_name, NULL);
   XBT_VERB("Leaved group '%s' on %s:%d",
-        group_name, gras_socket_peer_name(master),
-        gras_socket_peer_port(master));
+        group_name, xbt_socket_peer_name(master),
+        xbt_socket_peer_port(master));
 }
 
 /** \brief stops all members of the given local group */
@@ -216,7 +216,7 @@ void amok_pm_group_shutdown(const char *group_name)
 }
 
 /** \brief stops all members of the given remote group */
-void amok_pm_group_shutdown_remote(gras_socket_t master,
+void amok_pm_group_shutdown_remote(xbt_socket_t master,
                                    const char *group_name)
 {
   gras_msg_rpccall(master, 30, "amok_pm_shutdown", &group_name, NULL);
@@ -235,22 +235,22 @@ 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_datadesc_type_t pm_group_type =
+      xbt_datadesc_dynar(xbt_datadesc_by_name("xbt_peer_t"),
                           xbt_peer_free_voidp);
 
   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", gras_datadesc_by_name("string"),
-                           gras_datadesc_by_name("int"));
+                           xbt_datadesc_by_name("string"), pm_group_type);
+  gras_msgtype_declare_rpc("amok_pm_join", xbt_datadesc_by_name("string"),
+                           xbt_datadesc_by_name("int"));
   gras_msgtype_declare_rpc("amok_pm_leave",
-                           gras_datadesc_by_name("string"), NULL);
+                           xbt_datadesc_by_name("string"), NULL);
 
   gras_msgtype_declare_rpc("amok_pm_shutdown",
-                           gras_datadesc_by_name("string"), NULL);
+                           xbt_datadesc_by_name("string"), NULL);
 }
 
 static void _amok_pm_join(void *p)
diff --git a/src/gras/DataDesc/datadesc.c b/src/gras/DataDesc/datadesc.c
deleted file mode 100644 (file)
index 220607f..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/* datadesc - data description in order to send/recv it in GRAS             */
-
-/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
- * 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. */
-
-#include "gras/DataDesc/datadesc_private.h"
-
-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;
-
-
-/* callback for array size when sending strings */
-static int _strlen_cb( /*@unused@ */ gras_datadesc_type_t type, /*@unused@ */
-                      gras_cbps_t vars, void *data)
-{
-
-  return 1 + (int) strlen(data);
-}
-
-
-/**
- * gras_datadesc_init:
- *
- * Initialize the datadesc module.
- * 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;
-
-  XBT_VERB("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_homogeneous(xbt_free_f);
-
-}
-
-/**
- * gras_datadesc_exit:
- *
- * Finalize the datadesc module
- **/
-void gras_datadesc_exit(void)
-{
-  XBT_VERB("Exiting DataDesc");
-  xbt_set_free(&gras_datadesc_set_local);
-  xbt_dict_free(&gras_dd_constants);
-  XBT_DEBUG("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)";
-}
-
-/** This is mainly to debug */
-int gras_datadesc_get_id(gras_datadesc_type_t ddt)
-{
-  return ddt->code;
-}
-
-/**
- * gras_datadesc_size:
- *
- * 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;
-}
-
-/**
- * gras_datadesc_type_dump:
- *
- * 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);
-}
diff --git a/src/gras/DataDesc/datadesc_interface.h b/src/gras/DataDesc/datadesc_interface.h
deleted file mode 100644 (file)
index d9bdfd5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* datadesc - describing the data to exchange                               */
-
-/* module's public interface exported within GRAS, but not to end user.     */
-
-/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
- * 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. */
-
-#ifndef GRAS_DATADESC_INTERFACE_H
-#define GRAS_DATADESC_INTERFACE_H
-
-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);
-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);
-
-/* Access function */
-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);
-
-/* 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);
-
-
-#endif                          /* GRAS_DATADESC_INTERFACE_H */
diff --git a/src/gras/DataDesc/datadesc_private.h b/src/gras/DataDesc/datadesc_private.h
deleted file mode 100644 (file)
index 1a7052d..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/* datadesc - describing the data to exchange                               */
-
-/* module's private interface masked even to other parts of GRAS.           */
-
-/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
- * 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. */
-
-#ifndef GRAS_DATADESC_PRIVATE_H
-#define GRAS_DATADESC_PRIVATE_H
-
-#include "xbt/sysdep.h"
-#include "xbt/log.h"
-#include "xbt/dynar.h"
-#include "xbt/dict.h"
-#include "xbt/set.h"
-
-#include "portable.h"           /* GRAS_THISARCH */
-
-#include "gras/transport.h"     /* socket handling */
-
-#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 */
-
-/**
- * ddt_aligned:
- *
- * Align the data v on the boundary a.
- */
-#define ddt_aligned(v, a) (((v) + (a - 1)) & ~(a - 1))
-
-/*@null@*/ extern xbt_set_t gras_datadesc_set_local;
-void gras_ddt_freev(void *ddt);
-/*******************************************
- * Descriptions of all known architectures *
- *******************************************/
-
-#define gras_arch_count 12
-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_pdata = 5,
-  gras_ddt_scalar_pfunc = 6,
-
-  gras_ddt_scalar_float = 7,
-  gras_ddt_scalar_double = 8
-} gras_ddt_scalar_type_t;
-
-typedef struct {
-  const char *name;
-
-  int endian;
-
-  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];
-extern const char *gras_datadesc_cat_names[9];
-
-/**********************************************************/
-/* Actual definitions of the stuff in the type descriptor */
-/**********************************************************/
-
-/**
- * e_gras_datadesc_type_category:
- *
- * Defines all possible type categories.
- */
-typedef enum e_gras_datadesc_type_category {
-
-  /* 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_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
-} gras_datadesc_type_category_t;
-
-/*------------------------------------------------*/
-/* definitions of specific data for each category */
-/*------------------------------------------------*/
-/**
- * s_gras_dd_cat_field:
- *
- * Fields of struct and union
- */
-typedef struct s_gras_dd_cat_field {
-
-  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;
-
-} s_gras_dd_cat_field_t, *gras_dd_cat_field_t;
-
-void gras_dd_cat_field_free(void *f);
-
-/**
- * gras_dd_cat_scalar_t:
- *
- * Specific fields of a scalar
- */
-enum e_gras_dd_scalar_encoding {
-  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_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 */
-} gras_dd_cat_scalar_t;
-
-/**
- * gras_dd_cat_struct_t:
- *
- * 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 */
-} gras_dd_cat_struct_t;
-
-/**
- * gras_dd_cat_union_t:
- *
- * 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_dd_cat_union_t;
-
-/**
- * gras_dd_cat_ref_t:
- *
- * Specific fields of a reference
- */
-typedef struct s_gras_dd_cat_ref {
-  gras_datadesc_type_t type;
-
-  /* callback used to return the referenced type number  */
-  gras_datadesc_selector_t selector;
-} gras_dd_cat_ref_t;
-
-
-/**
- * gras_dd_cat_array_t:
- *
- * Specific fields of an array
- */
-typedef struct s_gras_dd_cat_array {
-  gras_datadesc_type_t type;
-
-  /* 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;
-
-} gras_dd_cat_array_t;
-
-/**
- * u_gras_datadesc_category:
- *
- * 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;
-};
-
-/****************************************/
-/* The holy grail: type descriptor type */
-/****************************************/
-/**
- * s_gras_datadesc_type:
- *
- * Type descriptor.
- */
-typedef struct s_gras_datadesc_type {
-  /* 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 */
-
-  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;
-
-  gras_datadesc_type_cb_void_t send;
-  gras_datadesc_type_cb_void_t recv;
-
-  /* flags */
-  int cycle:1;
-
-  /* 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);
-
-gras_datadesc_type_t
-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_reset(gras_cbps_t state);
-
-/***************
- * Convertions *
- ***************/
-void
-gras_dd_convert_elm(gras_datadesc_type_t type, int count,
-                    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 */
-
-#endif                          /* GRAS_DATADESC_PRIVATE_H */
diff --git a/src/gras/DataDesc/ddt_parse.yy.h b/src/gras/DataDesc/ddt_parse.yy.h
deleted file mode 100644 (file)
index 025bbbb..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ddt_parse.h -- automatic parsing of data structures                      */
-
-/* Copyright (c) 2004, 2006, 2007, 2009, 2010. The SimGrid Team.
- * 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. */
-
-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_WORD,
-  GRAS_DDT_PARSE_TOKEN_SPACE,
-  GRAS_DDT_PARSE_TOKEN_COMMENT,
-  GRAS_DDT_PARSE_TOKEN_ANNOTATE,
-  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_ERROR
-} gras_ddt_parse_token_t;
-
-#define GRAS_DDT_PARSE_MAX_STR_CONST 4048
-
-extern int gras_ddt_parse_line_pos;
-extern int gras_ddt_parse_col_pos;
-extern int gras_ddt_parse_char_pos;
-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);
-
-/* 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);
-
-#define PARSE_ERROR(...)                                                \
-  PARSE_ERROR_(__VA_ARGS__,                                             \
-               gras_ddt_parse_line_pos, gras_ddt_parse_col_pos, definition)
-#define PARSE_ERROR_(fmt, ...)                           \
-  do {                                                   \
-    XBT_ERROR(fmt " at %d:%d of :\n%s", __VA_ARGS__);   \
-    xbt_abort();                                         \
-  } while (0)
diff --git a/src/gras/DataDesc/ddt_parse.yy.l b/src/gras/DataDesc/ddt_parse.yy.l
deleted file mode 100644 (file)
index 29d029d..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/* DataDesc/ddt_parse -- automatic parsing of data structures */
-
-/* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. 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. */
-
-%option noyywrap
-%{
-#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");
-#define SHOW_WHERE XBT_DEBUG("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
-%}
-
-%x annotate comment foo
-space           [ \t]
-letter          [A-Za-z._-]
-digit           [0-9]
-
-%%
-   int comment_caller=0;
-   int annotate_caller=0;
-
-"//"[^\n]*
-
-"/*g"{space}* { /****************** ANNOTATION ************************/
-  XBT_DEBUG("Begin annotation");
-  annotate_caller = INITIAL;
-  gras_ddt_parse_char_pos+= strlen(yytext);
-  gras_ddt_parse_col_pos+= strlen(yytext);
-  BEGIN(annotate);
-}
-<foo>"/*g"{space}* { /* trim annotation */
-  XBT_DEBUG("Begin annotation");
-  annotate_caller = foo;
-  gras_ddt_parse_char_pos+= strlen(yytext);
-  gras_ddt_parse_col_pos+= strlen(yytext);
-  BEGIN(annotate);
-}
-
-<annotate>{space}*"g*/" {
-  XBT_DEBUG("End annotation");
-  gras_ddt_parse_char_pos+= strlen(yytext);
-  gras_ddt_parse_col_pos+= strlen(yytext);
-  BEGIN(annotate_caller);
-}
-
-<annotate>"*/" {
-  PARSE_ERROR("``/*g'' construct closed by a regular ``*/''");
-}
-<annotate>\n  {
-  PARSE_ERROR("Type annotation cannot spread over several lines");
-}
-
-<annotate>.* { /* eat the rest */
-  gras_ddt_parse_char_pos+= strlen(yytext);
-  gras_ddt_parse_col_pos+= strlen(yytext);
-  return GRAS_DDT_PARSE_TOKEN_ANNOTATE;
-}
-
-"/*[^g]"   { /****************** COMMENTS ************************/
-  /* constructs like : */
-    /*g [string] g*/ 
-  /* are not comments but size annotations */
-  comment_caller = INITIAL;
-  BEGIN(comment);
-}
-
-<foo>"/*[^g]"    {
-  comment_caller = foo;
-  BEGIN(comment);
-}
-
-<comment>[^*\n]*      { /* eat anything that's not a '*' */
-}
-<comment>"*"+[^*/\n]* { /* eat up '*'s not followed by '/'s */
-}
-<comment>\n             {
-  ++gras_ddt_parse_line_pos;
-  gras_ddt_parse_col_pos=0;
-  gras_ddt_parse_char_pos++;
-}
-<comment>"*"+"/" {
-  gras_ddt_parse_char_pos+= strlen(yytext);
-  gras_ddt_parse_col_pos+= strlen(yytext);
-  BEGIN(comment_caller);
-}
-
-({letter}|{digit})* {  /****************** STATEMENTS ************************/
-  gras_ddt_parse_char_pos += strlen(yytext);
-  gras_ddt_parse_col_pos += strlen(yytext);
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_WORD);
-}
-"{"  { 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LA);
-}
-"}" {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RA);
-}
-"["  { 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LB);
-}
-"]" {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RB);
-}
-"("  { 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LP);
-}
-")" {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RP);
-}
-"*" {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_STAR);
-}
-";" {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
-}
-"," { 
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_COLON);
-}
-"\n" {
- gras_ddt_parse_line_pos++; 
- gras_ddt_parse_char_pos++;
- gras_ddt_parse_col_pos=0;
-  SHOW_WHERE;
-}
-. { 
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
-  SHOW_WHERE;
-}
-%%
-/* {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;}
-  }
-  printf("-->%s<-- [line %d, pos %d]\n",yytext,gras_ddt_parse_line_pos,gras_ddt_parse_char_pos);
-  return;
-}
-
-int gras_ddt_parse_lex_n_dump(void) {
-  gras_ddt_parse_tok_num = gras_ddt_parse_lex();
-  /*  gras_ddt_parse_char_pos += strlen(yytext);*/
-  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 = yy_create_buffer( gras_ddt_file_to_parse, 10 );
-  yy_switch_to_buffer(gras_ddt_input_buffer);
-
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_col_pos = 0;
-  gras_ddt_parse_tok_num = 0;
-}
-
-void  gras_ddt_parse_pointer_close(void) {
-  yy_delete_buffer(gras_ddt_input_buffer);
-  fclose(gras_ddt_file_to_parse);
-
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_tok_num = 0;
-}
-
-
-void  gras_ddt_parse_pointer_string_init(const char *string_to_parse) {
-  gras_ddt_input_buffer = yy_scan_string (string_to_parse);
-  definition = string_to_parse;
-  yy_switch_to_buffer(gras_ddt_input_buffer);
-
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_tok_num = 0;
-}
-
-void  gras_ddt_parse_pointer_string_close(void) {
-  yy_delete_buffer(gras_ddt_input_buffer);
-
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_tok_num = 0;
-
-  if (0)
-    yyunput('\0',NULL); /* fake a use of this function to calm gcc down */
-}
-
-/* Local variables:*/
-/* mode: c */
-/* End: */
index 66f6e64..993ae1e 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "xbt/ex.h"
 #include "xbt/ex_interface.h"
+#include "xbt/socket.h"
 #include "gras/Msg/msg_private.h"
 #include "gras/Virtu/virtu_interface.h"
 
@@ -35,7 +36,7 @@ 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,
+                   xbt_socket_t expe_want,
                    gras_msg_filter_t filter,
                    void *filter_ctx, gras_msg_t msg_got)
 {
@@ -54,8 +55,8 @@ gras_msg_wait_ext_(double 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))))
+        && (!expe_want || (!strcmp(xbt_socket_peer_name(msg.expe),
+                                   xbt_socket_peer_name(expe_want))))
         && (!filter || filter(&msg, filter_ctx))) {
 
       memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
@@ -67,8 +68,8 @@ gras_msg_wait_ext_(double timeout,
 
   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))))
+        && (!expe_want || (!strcmp(xbt_socket_peer_name(msg.expe),
+                                   xbt_socket_peer_name(expe_want))))
         && (!filter || filter(&msg, filter_ctx))) {
 
       memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
@@ -107,8 +108,8 @@ gras_msg_wait_ext_(double timeout,
     XBT_DEBUG("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))))
+        && (!expe_want || (!strcmp(xbt_socket_peer_name(msg.expe),
+                                   xbt_socket_peer_name(expe_want))))
         && (!filter || filter(&msg, filter_ctx))) {
 
       memcpy(msg_got, &msg, sizeof(s_gras_msg_t));
@@ -145,7 +146,7 @@ gras_msg_wait_ext_(double timeout,
 void
 gras_msg_wait_(double timeout,
                gras_msgtype_t msgt_want,
-               gras_socket_t * expeditor, void *payload)
+               xbt_socket_t * expeditor, void *payload)
 {
   s_gras_msg_t msg;
 
@@ -230,7 +231,7 @@ void gras_msg_wait_or(double timeout,
 
 /** \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 gras_msg_send_(xbt_socket_t sock, gras_msgtype_t msgtype,
                     void *payload)
 {
 
@@ -382,7 +383,7 @@ void gras_msg_handle(volatile double timeOut)
     XBT_INFO
         ("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_socket_peer_name(msg.expe), xbt_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 */
   }
@@ -429,8 +430,8 @@ void gras_msg_handle(volatile double timeOut)
         XBT_INFO
             ("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));
+             xbt_socket_peer_name(msg.expe),
+             xbt_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,
@@ -458,24 +459,24 @@ void gras_msg_handle(volatile double timeOut)
       THROWF(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 */
+    /* FIXME: xbt_datadesc_free not implemented => leaking the payload */
     break;
 
 
   case e_gras_msg_kind_rpcanswer:
     XBT_INFO("Unexpected RPC answer discarded (type: %s; from:%s:%d)",
-          msg.type->name, gras_socket_peer_name(msg.expe),
-          gras_socket_peer_port(msg.expe));
+          msg.type->name, xbt_socket_peer_name(msg.expe),
+          xbt_socket_peer_port(msg.expe));
     XBT_WARN
-        ("FIXME: gras_datadesc_free not implemented => leaking the payload");
+        ("FIXME: xbt_datadesc_free not implemented => leaking the payload");
     return;
 
   case e_gras_msg_kind_rpcerror:
     XBT_INFO("Unexpected RPC error discarded (type: %s; from:%s:%d)",
-          msg.type->name, gras_socket_peer_name(msg.expe),
-          gras_socket_peer_port(msg.expe));
+          msg.type->name, xbt_socket_peer_name(msg.expe),
+          xbt_socket_peer_port(msg.expe));
     XBT_WARN
-        ("FIXME: gras_datadesc_free not implemented => leaking the payload");
+        ("FIXME: xbt_datadesc_free not implemented => leaking the payload");
     return;
 
   default:
index dbe87a0..a08ee25 100644 (file)
@@ -21,8 +21,8 @@ typedef struct s_gras_msg_listener_ {
   xbt_thread_t listener; /* keep this first, gras_socket_im_the_server() does funky transtyping in sg_msg.c */
   xbt_queue_t incomming_messages;       /* messages received from the wire and still to be used by master */
   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_socket_t wakeup_sock_listener_side;
+  xbt_socket_t wakeup_sock_master_side;
   int port; /* The port on which the listener opened the command socket */
   xbt_mutex_t init_mutex;       /* both this mutex and condition are used at initialization to make sure that */
   xbt_cond_t init_cond;         /* the main thread speaks to the listener only once it is started (FIXME: It would be easier using a semaphore, if only semaphores were in xbt_synchro) */
@@ -62,7 +62,7 @@ static void listener_function(void *p)
   while (1) {
     msg = gras_msg_recv_any();
     if (msg->type != msg_wakeup_listener_t) {
-               /* Cannot display who sent this since in SG, gras_socket_peer_* wont work:
+               /* Cannot display who sent this since in SG, xbt_socket_peer_* wont work:
                   I'm not the user process but I'm just the listener. Too bad */
       XBT_VERB("Got a '%s' message (%s) from sock %p. Queue it for handling by main thread",
             gras_msgtype_get_name(msg->type),e_gras_msg_kind_names[msg->kind],msg->expe);
@@ -116,7 +116,7 @@ gras_msg_listener_t gras_msg_listener_launch(xbt_queue_t msg_received)
   arg->init_cond = xbt_cond_init();
 
   /* declare the message used to awake the listener from the master */
-  gras_msgtype_declare("_wakeup_listener", gras_datadesc_by_name("char"));
+  gras_msgtype_declare("_wakeup_listener", xbt_datadesc_by_name("char"));
 
   /* actually start the thread, and */
   /* wait for the listener to initialize before we connect to its socket */
index 0054640..a2f5d07 100644 (file)
@@ -9,7 +9,7 @@
 #include "xbt/ex.h"
 #include "gras/Msg/msg_private.h"
 #include "gras/Virtu/virtu_interface.h"
-#include "gras/DataDesc/datadesc_interface.h"
+#include "xbt/datadesc/datadesc_interface.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg, gras, "High level messaging");
 
@@ -44,11 +44,11 @@ void gras_msgtype_dumpall(void)
     XBT_INFO("  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),
+          xbt_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) : ""));
+           xbt_datadesc_get_name(msgtype->answer_type) : ""));
   }
 }
 
@@ -72,8 +72,8 @@ 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)
+                         xbt_datadesc_type_t payload_request,
+                         xbt_datadesc_type_t payload_answer)
 {
 
   gras_msgtype_t msgtype = NULL;
@@ -90,17 +90,17 @@ gras_msgtype_declare_ext(const char *name,
                 "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_assert(!gras_datadesc_type_cmp
+    xbt_assert(!xbt_datadesc_type_cmp
                 (msgtype->ctn_type, payload_request),
                 "Message %s re-registered with another payload (%s was %s)",
-                namev, gras_datadesc_get_name(payload_request),
-                gras_datadesc_get_name(msgtype->ctn_type));
+                namev, xbt_datadesc_get_name(payload_request),
+                xbt_datadesc_get_name(msgtype->ctn_type));
 
-    xbt_assert(!gras_datadesc_type_cmp
+    xbt_assert(!xbt_datadesc_type_cmp
                 (msgtype->answer_type, payload_answer),
                 "Message %s re-registered with another answer payload (%s was %s)",
-                namev, gras_datadesc_get_name(payload_answer),
-                gras_datadesc_get_name(msgtype->answer_type));
+                namev, xbt_datadesc_get_name(payload_answer),
+                xbt_datadesc_get_name(msgtype->answer_type));
 
     xbt_free(namev);
     return;                     /* do really ignore it */
@@ -108,8 +108,8 @@ gras_msgtype_declare_ext(const char *name,
 
   XBT_VERB("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));
+        version, name, xbt_datadesc_get_name(payload_request),
+        xbt_datadesc_get_name(payload_answer));
 
   msgtype = xbt_new(s_gras_msgtype_t, 1);
   msgtype->name = namev;
@@ -129,7 +129,7 @@ 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)
+void gras_msgtype_declare(const char *name, xbt_datadesc_type_t payload)
 {
   gras_msgtype_declare_ext(name, 0, e_gras_msg_kind_oneway, payload, NULL);
 }
@@ -150,7 +150,7 @@ void gras_msgtype_declare(const char *name, gras_datadesc_type_t payload)
  */
 void
 gras_msgtype_declare_v(const char *name,
-                       short int version, gras_datadesc_type_t payload)
+                       short int version, xbt_datadesc_type_t payload)
 {
 
   gras_msgtype_declare_ext(name, version,
@@ -294,13 +294,13 @@ void gras_cb_unregister_(gras_msgtype_t msgtype, gras_msg_cb_t cb)
 }
 
 /** \brief Retrieve the expeditor of the message */
-gras_socket_t gras_msg_cb_ctx_from(gras_msg_cb_ctx_t ctx)
+xbt_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_msg_cb_ctx_t gras_msg_cb_ctx_new(xbt_socket_t expe,
                                       gras_msgtype_t msgtype,
                                       unsigned long int ID,
                                       int answer_due, double timeout)
index b0c9543..68d1399 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "gras/transport.h"
 #include "xbt/fifo.h"
+#include "xbt/dynar.h"
+#include "xbt/queue.h"
 
 /*
  * Data of this module specific to each process
@@ -45,7 +47,7 @@ typedef struct {
 } s_gras_msg_procdata_t, *gras_msg_procdata_t;
 
 
-void gras_msg_send_namev(gras_socket_t sock,
+void gras_msg_send_namev(xbt_socket_t sock,
                          const char *namev, void *payload);
 void gras_msg_listener_awake(void);
 void gras_msg_listener_close_socket(int sd);
index a124213..b79897a 100644 (file)
@@ -19,7 +19,7 @@
 #include "xbt/queue.h"
 #include "xbt/set.h"
 #include "gras/transport.h"
-#include "gras/datadesc.h"
+#include "xbt/datadesc.h"
 #include "gras/virtu.h"
 
 #include "gras/messages.h"
@@ -39,8 +39,8 @@ 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);
+                         xbt_datadesc_type_t payload_request,
+                         xbt_datadesc_type_t payload_answer);
 
 /**
  * gras_msgtype_t:
@@ -56,8 +56,8 @@ typedef struct s_gras_msgtype {
   /* 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 */
+  xbt_datadesc_type_t ctn_type;
+  xbt_datadesc_type_t answer_type;     /* only used for RPC */
 } s_gras_msgtype_t;
 
 extern xbt_set_t _gras_msgtype_set;     /* of gras_msgtype_t */
@@ -66,8 +66,8 @@ void gras_msgtype_free(void *msgtype);
 
 /* functions to extract msg from socket or put it on wire (depend RL vs SG) */
 gras_msg_t gras_msg_recv_any(void);     /* Get first message arriving */
-void gras_msg_recv(gras_socket_t sock, gras_msg_t msg /*OUT*/);
-void gras_msg_send_ext(gras_socket_t sock,
+void gras_msg_recv(xbt_socket_t sock, gras_msg_t msg /*OUT*/);
+void gras_msg_send_ext(xbt_socket_t sock,
                        e_gras_msg_kind_t kind,
                        unsigned long int ID,
                        gras_msgtype_t msgtype, void *payload);
@@ -98,7 +98,7 @@ 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;
+  xbt_socket_t expeditor;
   gras_msgtype_t msgtype;
   unsigned long int ID;
   double timeout;
@@ -119,7 +119,7 @@ typedef struct {
 /* 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_msg_cb_ctx_t gras_msg_cb_ctx_new(xbt_socket_t expe,
                                       gras_msgtype_t msgtype,
                                       unsigned long int ID,
                                       int answer_due, double timeout);
index d395371..a973c66 100644 (file)
@@ -7,15 +7,16 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/ex.h"
+#include "xbt/datadesc.h"
+#include "xbt/datadesc/datadesc_interface.h"
+#include "xbt/socket.h"
 #include "gras/Msg/msg_private.h"
-
-#include "gras/DataDesc/datadesc_interface.h"
-#include "gras/Transport/transport_interface.h" /* gras_trp_send/recv */
+#include "gras/Transport/transport_interface.h"
 
 XBT_LOG_EXTERNAL_CATEGORY(gras_msg);
 XBT_LOG_DEFAULT_CATEGORY(gras_msg);
 
-void gras_msg_recv(gras_socket_t sock, gras_msg_t msg);
+void gras_msg_recv(xbt_socket_t sock, gras_msg_t msg);
 
 gras_msg_t gras_msg_recv_any(void)
 {
@@ -26,31 +27,31 @@ gras_msg_t gras_msg_recv_any(void)
   return msg;
 }
 
-void gras_msg_send_ext(gras_socket_t sock,
+void gras_msg_send_ext(xbt_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;
+  static xbt_datadesc_type_t string_type = NULL;
+  static xbt_datadesc_type_t ulong_type = NULL;
   char c_kind = (char) kind;
 
   xbt_assert(msgtype, "Cannot send the NULL message");
 
   if (!string_type) {
-    string_type = gras_datadesc_by_name("string");
+    string_type = xbt_datadesc_by_name("string");
     xbt_assert(string_type);
   }
   if (!ulong_type) {
-    ulong_type = gras_datadesc_by_name("unsigned long int");
+    ulong_type = xbt_datadesc_by_name("unsigned long int");
     xbt_assert(ulong_type);
   }
 
   XBT_DEBUG("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 */ );
+         xbt_socket_peer_name(sock), xbt_socket_peer_port(sock));
+  xbt_trp_send(sock, _GRAS_header, 6, 1 /* stable */ );
+  xbt_trp_send(sock, &c_kind, 1, 1 /* stable */ );
   switch (kind) {
   case e_gras_msg_kind_oneway:
     break;
@@ -58,27 +59,27 @@ void gras_msg_send_ext(gras_socket_t sock,
   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);
+    xbt_datadesc_send(sock, ulong_type, &ID);
     break;
 
   default:
     THROWF(unknown_error, 0, "Unknown msg kind %d", kind);
   }
 
-  gras_datadesc_send(sock, string_type, &msgtype->name);
+  xbt_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);
+    xbt_datadesc_send(sock, xbt_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);
+      xbt_datadesc_send(sock, msgtype->answer_type, payload);
   } else {
     /* regular message */
     if (msgtype->ctn_type)
-      gras_datadesc_send(sock, msgtype->ctn_type, payload);
+      xbt_datadesc_send(sock, msgtype->ctn_type, payload);
   }
 
-  gras_trp_flush(sock);
+  xbt_trp_flush(sock);
 }
 
 const char *hexa_str(unsigned char *data, int size, int downside);
@@ -87,34 +88,34 @@ 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)
+void gras_msg_recv(xbt_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;
+  static xbt_datadesc_type_t string_type = NULL;
+  static xbt_datadesc_type_t ulong_type = NULL;
   char header[6];
   int cpt;
   int r_arch;
   char *msg_name = NULL;
   char c_kind;
 
-  xbt_assert(!gras_socket_is_meas(sock),
+  xbt_assert(!xbt_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");
+    string_type = xbt_datadesc_by_name("string");
     xbt_assert(string_type);
   }
   if (!ulong_type) {
-    ulong_type = gras_datadesc_by_name("unsigned long int");
+    ulong_type = xbt_datadesc_by_name("unsigned long int");
     xbt_assert(ulong_type);
   }
 
 
   TRY {
-    gras_trp_recv(sock, header, 6);
-    gras_trp_recv(sock, &c_kind, 1);
+    xbt_trp_recv(sock, header, 6);
+    xbt_trp_recv(sock, &c_kind, 1);
     msg->kind = (e_gras_msg_kind_t) c_kind;
   }
   CATCH_ANONYMOUS {
@@ -139,18 +140,18 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg)
   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);
+    xbt_datadesc_recv(sock, ulong_type, r_arch, &msg->ID);
     break;
 
   default:
     THROW_IMPOSSIBLE;
   }
 
-  gras_datadesc_recv(sock, string_type, r_arch, &msg_name);
+  xbt_datadesc_recv(sock, string_type, r_arch, &msg_name);
   XBT_DEBUG
       ("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));
+       xbt_datadesc_arch_name(r_arch));
 
   TRY {
     msg->type =
@@ -172,21 +173,21 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg)
 
   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_size = xbt_datadesc_size(xbt_datadesc_by_name("ex_t"));
     msg->payl = xbt_malloc(msg->payl_size);
-    gras_datadesc_recv(sock, gras_datadesc_by_name("ex_t"), r_arch,
+    xbt_datadesc_recv(sock, xbt_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);
+      msg->payl_size = xbt_datadesc_size(msg->type->answer_type);
       xbt_assert(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);
+      xbt_datadesc_recv(sock, msg->type->answer_type, r_arch, msg->payl);
     } else {
       msg->payl = NULL;
       msg->payl_size = 0;
@@ -194,13 +195,13 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg)
   } else {
     /* regular message */
     if (msg->type->ctn_type) {
-      msg->payl_size = gras_datadesc_size(msg->type->ctn_type);
+      msg->payl_size = xbt_datadesc_size(msg->type->ctn_type);
       xbt_assert(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);
+      xbt_datadesc_recv(sock, msg->type->ctn_type, r_arch, msg->payl);
     } else {
       msg->payl = NULL;
       msg->payl_size = 0;
index c84c605..608e06c 100644 (file)
@@ -25,8 +25,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_msg_rpc, gras_msg, "RPC mecanism");
  */
 void
 gras_msgtype_declare_rpc(const char *name,
-                         gras_datadesc_type_t payload_request,
-                         gras_datadesc_type_t payload_answer)
+                         xbt_datadesc_type_t payload_request,
+                         xbt_datadesc_type_t payload_answer)
 {
 
   gras_msgtype_declare_ext(name, 0,
@@ -53,8 +53,8 @@ gras_msgtype_declare_rpc(const char *name,
 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_datadesc_type_t payload_request,
+                           xbt_datadesc_type_t payload_answer)
 {
 
   gras_msgtype_declare_ext(name, version,
@@ -111,7 +111,7 @@ void gras_msg_ctx_mallocator_reset_f(void *ctx)
 
 /** @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,
+gras_msg_rpc_async_call_(xbt_socket_t server,
                          double timeOut,
                          gras_msgtype_t msgtype, void *request)
 {
@@ -133,8 +133,8 @@ gras_msg_rpc_async_call_(gras_socket_t server,
   ctx->timeout = timeOut;
 
   XBT_VERB("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);
+        xbt_socket_peer_name(server),
+        xbt_socket_peer_port(server), msgtype->name, ctx->ID);
 
   gras_msg_send_ext(server, e_gras_msg_kind_rpccall, ctx->ID, msgtype,
                     request);
@@ -174,8 +174,8 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
     XBT_INFO
         ("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);
+         xbt_socket_peer_name(ctx->expeditor),
+         xbt_socket_peer_port(ctx->expeditor), e.msg);
     RETHROW;
   }
 
@@ -207,7 +207,7 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer)
 }
 
 /** @brief Conduct a RPC call */
-void gras_msg_rpccall_(gras_socket_t server,
+void gras_msg_rpccall_(xbt_socket_t server,
                        double timeout,
                        gras_msgtype_t msgtype, void *request, void *answer)
 {
@@ -233,8 +233,8 @@ void gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx,
   ctx->answer_due = 0;
   XBT_DEBUG("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);
+         xbt_socket_peer_name(ctx->expeditor),
+         xbt_socket_peer_port(ctx->expeditor), timeOut, answer);
   gras_msg_send_ext(ctx->expeditor, e_gras_msg_kind_rpcanswer, ctx->ID,
                     ctx->msgtype, answer);
 }
index f05928a..4f49dec 100644 (file)
@@ -7,12 +7,11 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/ex.h"
-
+#include "xbt/xbt_socket_private.h" /* FIXME */
+#include "xbt/datadesc.h"
+#include "xbt/datadesc/datadesc_interface.h" /* FIXME */
 #include "gras/Virtu/virtu_sg.h"
-
 #include "gras/Msg/msg_private.h"
-
-#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 */
 
@@ -33,7 +32,8 @@ typedef struct {
   smx_process_t s_process;
 } *fake_xbt_thread_t;
 
-int gras_socket_im_the_server(gras_socket_t sock) {
+int gras_socket_im_the_server(xbt_socket_t sock)
+{
   gras_trp_sg_sock_data_t sock_data = sock->data;
   gras_procdata_t* pd;
   gras_msg_listener_t l;
@@ -103,7 +103,7 @@ gras_msg_t gras_msg_recv_any(void)
   xbt_dynar_t comms = xbt_dynar_new(sizeof(smx_action_t), NULL);
   unsigned int cursor = 0;
   int got = 0;
-  gras_socket_t sock = NULL;
+  xbt_socket_t sock = NULL;
   gras_trp_sg_sock_data_t sock_data;
   xbt_dynar_foreach(trp_proc->sockets, cursor, sock) {
     sock_data = (gras_trp_sg_sock_data_t) sock->data;
@@ -164,7 +164,7 @@ gras_msg_t gras_msg_recv_any(void)
   got = simcall_comm_waitany(comms);
 
   /* retrieve the message sent in that communication */
-  sock = xbt_dynar_get_as(trp_proc->sockets, got, gras_socket_t);
+  sock = xbt_dynar_get_as(trp_proc->sockets, got, xbt_socket_t);
   sock_data = (gras_trp_sg_sock_data_t) sock->data;
   msg = sock_data->msg;
   XBT_VERB("Got something. Communication over rdv_server=%p, rdv_client=%p",
@@ -186,7 +186,7 @@ gras_msg_t gras_msg_recv_any(void)
 }
 
 
-void gras_msg_send_ext(gras_socket_t sock,
+void gras_msg_send_ext(xbt_socket_t sock,
                        e_gras_msg_kind_t kind,
                        unsigned long int ID,
                        gras_msgtype_t msgtype, void *payload)
@@ -209,32 +209,63 @@ void gras_msg_send_ext(gras_socket_t sock,
   msg->kind = kind;
   msg->type = msgtype;
   msg->ID = ID;
+  XBT_PUBLIC(xbt_datadesc_type_t) xbt_datadesc_by_id(long int code);
+
+  /* to debug */
+  XBT_PUBLIC(void) xbt_datadesc_type_dump(const xbt_datadesc_type_t ddt);
+  XBT_PUBLIC(const char *) xbt_datadesc_arch_name(int code);
+
+  /* compare two data type description */
+  XBT_PUBLIC(int)
+  xbt_datadesc_type_cmp(const xbt_datadesc_type_t d1,
+                         const xbt_datadesc_type_t d2);
+
+  /* Access function */
+  XBT_PUBLIC(int) xbt_datadesc_size(xbt_datadesc_type_t type);
+  /* Described data exchanges: direct use */
+  XBT_PUBLIC(int) xbt_datadesc_memcpy(xbt_datadesc_type_t type, void *src,
+                                       void *dst);
+  XBT_PUBLIC(void) xbt_datadesc_send(xbt_socket_t sock,
+                                      xbt_datadesc_type_t type, void *src);
+  XBT_PUBLIC(void) xbt_datadesc_recv(xbt_socket_t sock,
+                                      xbt_datadesc_type_t type, int r_arch,
+                                      void *dst);
+
+  /* Described data exchanges: IDL compilation FIXME: not implemented*/
+  void xbt_datadesc_gen_cpy(xbt_datadesc_type_t type, void *src,
+                             void **dst);
+  void xbt_datadesc_gen_send(xbt_socket_t sock,
+                              xbt_datadesc_type_t type, void *src);
+  void xbt_datadesc_gen_recv(xbt_socket_t sock,
+                              xbt_datadesc_type_t type, int r_arch,
+                              void *dst);
+
 
   XBT_VERB("Send msg %s (%s) to rdv %p sock %p",
       msgtype->name,  e_gras_msg_kind_names[kind], target_rdv, sock);
 
   if (kind == e_gras_msg_kind_rpcerror) {
     /* error on remote host, careful, payload is an exception */
-    msg->payl_size = gras_datadesc_size(gras_datadesc_by_name("ex_t"));
+    msg->payl_size = xbt_datadesc_size(xbt_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,
+        xbt_datadesc_memcpy(xbt_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);
+    msg->payl_size = xbt_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,
+      whole_payload_size = xbt_datadesc_memcpy(msgtype->answer_type,
                                                 payload, msg->payl);
   } else {
-    msg->payl_size = gras_datadesc_size(msgtype->ctn_type);
+    msg->payl_size = xbt_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,
+      whole_payload_size = xbt_datadesc_memcpy(msgtype->ctn_type,
                                                 payload, msg->payl);
   }
 
index e65d53d..e883290 100644 (file)
@@ -13,19 +13,19 @@ discuss using network sockets, or xbt_queue_t structures.
 IMPLEMENTATION NOTES ABOUT THE SG SIDE
 
 This area is quite messy. The thing is that I strived too much to keep
-the existing interface, which is lousely inspirated from BSD sockets.
+the existing interface, which is loosely inspired from BSD sockets.
 
 Vocabulary: 
   Server is the one who created the master socket. 
   Client is the one connecting to that from a remote host. 
-  Their roles keep the same for the whole connexion duration. 
+  Their roles keep the same for the whole connection duration. 
   Sender and Receiver denote the roles during one message exchange.
   If the server answers to the client, it becomes the sender while the
   client becomes the receiver. 
   All this seems trivial, but confusion is easy and dangerous.
 
 
-The connexion story goes that way. When we create a master socket, we
+The connection story goes that way. When we create a master socket, we
 look whether the given port is free on that host or not. For that, we
 traverse the gras_hostdata_t->ports dynar, which contains
 gras_sg_portrec_t records. If it's free, we create a socket with a
@@ -41,8 +41,8 @@ typedef struct {
 } s_gras_trp_sg_sock_data_t,*gras_trp_sg_sock_data_t;
 
 In GRAS, there is a listener process, in charge of pumping everything
-comming from the network and post that to the main user thread. That
-to overlap (incomming) communications and computations.
+coming from the network and post that to the main user thread. That
+to overlap (incoming) communications and computations.
 In SG, this is done by ensuring that a receive is posted on every
 opened socket, and having the listener doing a smx_sem_waitany() to
 find the first ending one (in RL, a select+ddt_recv does the same).
@@ -61,7 +61,7 @@ and working sockets, just like in BSD. There is no explicit accept.
 Master sockets get created by gras_socket_server() and friends. You
 can recognize them by the fact that the rdv_client field is always
 NULL. Such sockets are not really used to exchange data, but more to
-establish connexions. For actual exchanges, you need a working socket
+establish connections. For actual exchanges, you need a working socket
 created by gras_socket_client() and friends. So, they are created on
 client side, but the master side will see it as message expeditor when
 getting a message.
index eed89d0..85a1a0e 100644 (file)
@@ -7,12 +7,14 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/ex.h"
+#include "xbt/xbt_socket_private.h" /* FIXME */
 #include "portable.h"
 #include "gras/Transport/transport_private.h"
+
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_trp);
 
 /* check transport_private.h for an explanation of this variable */
-gras_socket_t _gras_lastly_selected_socket = NULL;
+xbt_socket_t _gras_lastly_selected_socket = NULL;
 
 /**
  * gras_trp_select:
@@ -24,7 +26,7 @@ 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_socket_t gras_trp_select(double timeout)
 {
   xbt_dynar_t sockets =
       ((gras_trp_procdata_t)
@@ -43,7 +45,7 @@ gras_socket_t gras_trp_select(double timeout)
   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 */
+  xbt_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.
@@ -180,7 +182,7 @@ gras_socket_t gras_trp_select(double timeout)
 
       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;
+        xbt_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);
@@ -239,7 +241,8 @@ gras_socket_t gras_trp_select(double timeout)
   THROWF(timeout_error, 0, "Timeout");
 }
 
-void gras_trp_sg_setup(gras_trp_plugin_t plug)
+/* to make the linker happy in SG mode */
+void gras_trp_sg_setup(xbt_trp_plugin_t plug)
 {
   THROWF(mismatch_error, 0, "No SG transport on live platforms");
 }
index b0fa264..8e52a75 100644 (file)
@@ -14,7 +14,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_trp);
 
 /* check transport_private.h for an explanation of this variable;
  * this just need to be defined to NULL in SG */
-gras_socket_t _gras_lastly_selected_socket = NULL;
+xbt_socket_t _gras_lastly_selected_socket = NULL;
 
 #ifdef KILLME
 /**    
@@ -126,25 +126,3 @@ gras_socket_t gras_trp_select(double timeout)
   return res;
 }
 #endif
-
-/* dummy implementations of the functions used in RL mode */
-
-void gras_trp_tcp_setup(gras_trp_plugin_t plug)
-{
-  THROW(mismatch_error, 0);
-}
-
-void gras_trp_file_setup(gras_trp_plugin_t plug)
-{
-  THROW(mismatch_error, 0);
-}
-
-void gras_trp_iov_setup(gras_trp_plugin_t plug)
-{
-  THROW(mismatch_error, 0);
-}
-
-gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock)
-{
-  return sock;
-}
index b090bfd..7b025ca 100644 (file)
 /***
  *** Options
  ***/
-int gras_opt_trp_nomoredata_on_close = 0;
+static int gras_opt_trp_nomoredata_on_close = 0;
 
 #include "xbt/ex.h"
 #include "xbt/peer.h"
+#include "xbt/socket.h"
+#include "xbt/xbt_socket_private.h" /* FIXME */
 #include "portable.h"
 #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");
-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 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);
-
-  XBT_DEBUG("Create plugin %s", name);
-
-  plug->name = xbt_strdup(name);
-
-  TRY {
-    setup(plug);
-  }
-  CATCH(e) {
-    if (e.category == mismatch_error) {
-      /* SG plugin raise mismatch when in RL mode (and vice versa) */
-      free(plug->name);
-      free(plug);
-      plug = NULL;
-      xbt_ex_free(e);
-    } else {
-      RETHROW;
-    }
-  }
-
-  if (plug)
-    xbt_dict_set(_gras_trp_plugins, name, plug, NULL);
-}
-
-void gras_trp_init(void)
-{
-  if (!_gras_trp_started) {
-    /* make room for all plugins */
-    _gras_trp_plugins = xbt_dict_new_homogeneous(gras_trp_plugin_free);
-
-#ifdef HAVE_WINSOCK2_H
-    /* initialize the windows mechanism */
-    {
-      WORD wVersionRequested;
-      WSADATA wsaData;
-
-      wVersionRequested = MAKEWORD(2, 0);
-      int res;
-      res = WSAStartup(wVersionRequested, &wsaData);
-      xbt_assert(res == 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_assert(LOBYTE(wsaData.wVersion) == 2 &&
-                  HIBYTE(wsaData.wVersion) == 0,
-                  "Cannot find a usable WinSock DLL");
-      XBT_INFO("Found and initialized winsock2");
-    }                           /* The WinSock DLL is acceptable. Proceed. */
-#elif HAVE_WINSOCK_H
-    {
-      WSADATA wsaData;
-      int res;
-      res = WSAStartup(0x0101, &wsaData);
-      xbt_assert(res == 0, "Cannot find a usable WinSock DLL");
-      XBT_INFO("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);
-  }
-
-  _gras_trp_started++;
-}
-
-void gras_trp_exit(void)
-{
-  XBT_DEBUG("gras_trp value %d", _gras_trp_started);
-  if (_gras_trp_started == 0) {
-    return;
-  }
-
-  if (--_gras_trp_started == 0) {
-#ifdef HAVE_WINSOCK_H
-    if (WSACleanup() == SOCKET_ERROR) {
-      if (WSAGetLastError() == WSAEINPROGRESS) {
-        WSACancelBlockingCall();
-        WSACleanup();
-      }
-    }
-#endif
-
-    /* Delete the plugins */
-    xbt_dict_free(&_gras_trp_plugins);
-  }
-}
-
-
-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) {
-      XBT_DEBUG("Plugin %s lacks exit(). Free data anyway.", plug->name);
-      free(plug->data);
-    }
-
-    free(plug->name);
-    free(plug);
-  }
-}
-
-
-/**
- * gras_trp_socket_new:
- *
- * Malloc a new socket, and initialize it with defaults
- */
-void gras_trp_socket_new(int incoming, gras_socket_t * dst)
-{
-
-  gras_socket_t sock = xbt_new0(s_gras_socket_t, 1);
-
-  XBT_VERB("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->meas = 0;
-  sock->recvd = 0;
-  sock->valid = 1;
-  sock->moredata = 0;
-
-  sock->refcount = 1;
-  sock->sd = -1;
-
-  sock->data = NULL;
-  sock->bufdata = NULL;
-
-  *dst = sock;
-
-  XBT_OUT();
-}
 
 /**
  * @brief Opens a server socket and makes it ready to be listened to.
@@ -184,30 +30,28 @@ void gras_trp_socket_new(int incoming, gras_socket_t * dst)
  *
  * In real life, you'll get a TCP socket.
  */
-gras_socket_t
+xbt_socket_t
 gras_socket_server_ext(unsigned short port,
                        unsigned long int buf_size, int measurement)
 {
-  gras_trp_plugin_t trp;
-  gras_socket_t sock;
+  xbt_trp_plugin_t trp;
+  xbt_socket_t sock;
 
   XBT_DEBUG("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 = xbt_trp_plugin_get_by_name(gras_if_SG() ? "sg" : "tcp");
 
   /* defaults settings */
-  gras_trp_socket_new(1, &sock);
-  sock->plugin = trp;
-  sock->buf_size = buf_size > 0 ? buf_size : 32 * 1024;
-  sock->meas = measurement;
+  xbt_socket_new_ext(1,
+                     &sock,
+                     trp,
+                     (buf_size > 0 ? buf_size : 32 * 1024),
+                     measurement);
 
   /* Call plugin socket creation function */
   XBT_DEBUG("Prepare socket with plugin (fct=%p)", trp->socket_server);
   TRY {
     trp->socket_server(trp, port, sock);
-    XBT_DEBUG("in=%c out=%c accept=%c",
-           sock->incoming ? 'y' : 'n',
-           sock->outgoing ? 'y' : 'n', sock->accepting ? 'y' : 'n');
   }
   CATCH_ANONYMOUS {
     free(sock);
@@ -235,13 +79,13 @@ gras_socket_server_ext(unsigned short port,
  *
  * If none of the provided ports works, raises the exception got when trying the last possibility
  */
-gras_socket_t
+xbt_socket_t
 gras_socket_server_range(unsigned short minport, unsigned short maxport,
                          unsigned long int buf_size, int measurement)
 {
 
   int port;
-  gras_socket_t res = NULL;
+  xbt_socket_t res = NULL;
   xbt_ex_t e;
 
   for (port = minport; port < maxport; port++) {
@@ -268,30 +112,28 @@ gras_socket_server_range(unsigned short minport, unsigned short maxport,
  *
  * In real life, you'll get a TCP socket.
  */
-gras_socket_t
+xbt_socket_t
 gras_socket_client_ext(const char *host,
                        unsigned short port,
                        unsigned long int buf_size, int measurement)
 {
-  gras_trp_plugin_t trp;
-  gras_socket_t sock;
+  xbt_trp_plugin_t trp;
+  xbt_socket_t sock;
 
-  trp = gras_trp_plugin_get_by_name(gras_if_SG()? "sg" : "tcp");
+  trp = xbt_trp_plugin_get_by_name(gras_if_SG() ? "sg" : "tcp");
 
   XBT_DEBUG("Create a client socket from plugin %s",
          gras_if_RL()? "tcp" : "sg");
   /* defaults settings */
-  gras_trp_socket_new(0, &sock);
-  sock->plugin = trp;
-  sock->buf_size = buf_size > 0 ? buf_size : 32 * 1024;
-  sock->meas = measurement;
+  xbt_socket_new_ext(0,
+                     &sock,
+                     trp,
+                     (buf_size > 0 ? buf_size : 32 * 1024),
+                     measurement);
 
   /* plugin-specific */
   TRY {
-    (*trp->socket_client) (trp,host,port,sock);
-    XBT_DEBUG("in=%c out=%c accept=%c",
-           sock->incoming ? 'y' : 'n',
-           sock->outgoing ? 'y' : 'n', sock->accepting ? 'y' : 'n');
+    (*trp->socket_client) (trp, host, port, sock);
   }
   CATCH_ANONYMOUS {
     free(sock);
@@ -309,33 +151,33 @@ 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)
+xbt_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)
+xbt_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_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_socket_t res = gras_socket_client_ext(p->name, p->port, 0, 0);
   xbt_peer_free(p);
   return res;
 }
 
 void gras_socket_close_voidp(void *sock)
 {
-  gras_socket_close((gras_socket_t) sock);
+  gras_socket_close((xbt_socket_t) sock);
 }
 
 /** \brief Close socket */
-void gras_socket_close(gras_socket_t sock)
+void gras_socket_close(xbt_socket_t sock)
 {
   if (--sock->refcount)
     return;
@@ -343,7 +185,7 @@ 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;
+  xbt_socket_t sock_iter = NULL;
   unsigned int cursor;
 
   XBT_IN("");
@@ -386,220 +228,6 @@ void gras_socket_close(gras_socket_t sock)
   XBT_OUT();
 }
 
-/**
- * gras_trp_send:
- *
- * 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_assert(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_assert(sd->incoming, "Socket not suited for data receive");
-  (sd->plugin->recv) (sd, data, size);
-}
-
-/**
- * gras_trp_flush:
- *
- * Make sure all pending communications are done
- */
-void gras_trp_flush(gras_socket_t sd)
-{
-  if (sd->plugin->flush)
-    (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);
-}
-
-int gras_socket_my_port(gras_socket_t sock)
-{
-  if (!sock->plugin->my_port)
-    THROWF(unknown_error,0,"Function my_port unimplemented in plugin %s",sock->plugin->name);
-  return sock->plugin->my_port(sock);
-
-}
-
-int gras_socket_peer_port(gras_socket_t sock)
-{
-  if (!sock->plugin->peer_port)
-    THROWF(unknown_error,0,"Function peer_port unimplemented in plugin %s",sock->plugin->name);
-  return sock->plugin->peer_port(sock);
-}
-
-const char *gras_socket_peer_name(gras_socket_t sock)
-{
-  xbt_assert(sock->plugin);
-  return sock->plugin->peer_name(sock);
-}
-
-const char *gras_socket_peer_proc(gras_socket_t sock)
-{
-  return sock->plugin->peer_proc(sock);
-}
-
-void gras_socket_peer_proc_set(gras_socket_t sock, char *peer_proc)
-{
-  return sock->plugin->peer_proc_set(sock,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)
-{
-  return sock->meas;
-}
-
-/** \brief Send a chunk of (random) data over a measurement socket
- *
- * @param peer measurement socket to use for the experiment
- * @param timeout timeout (in seconds)
- * @param msg_size size of each chunk sent over the socket (in bytes).
- * @param msg_amount how many of these packets you want to send.
- *
- * Calls to gras_socket_meas_send() and gras_socket_meas_recv() on
- * each side of the socket should be paired.
- *
- * The exchanged data is zeroed to make sure it's initialized, but
- * there is no way to control what is sent (ie, you cannot use these
- * functions to exchange data out of band).
- *
- * @warning: in SimGrid version 3.1 and previous, the numerical arguments
- *           were the total amount of data to send and the msg_size. This
- *           was changed for the fool wanting to send more than MAXINT
- *           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 long int sent_sofar;
-
-  XBT_IN("");
-  THROWF(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future."
-      "If you depend on it, sorry, you have to use an older version, or wait for the future version using it...");
-  if (gras_if_RL())
-    chunk = xbt_malloc0(msg_size);
-
-  xbt_assert(peer->meas,
-              "Asked to send measurement data on a regular socket");
-  xbt_assert(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++) {
-    XBT_CDEBUG(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_CDEBUG(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);
-
-  XBT_OUT();
-}
-
-/** \brief Receive a chunk of data over a measurement socket
- *
- * Calls to gras_socket_meas_send() and gras_socket_meas_recv() on
- * each side of the socket should be paired.
- *
- * @warning: in SimGrid version 3.1 and previous, the numerical arguments
- *           were the total amount of data to send and the msg_size. This
- *           was changed for the fool wanting to send more than MAXINT
- *           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)
-{
-
-  char *chunk = NULL;
-  unsigned long int got_sofar;
-
-  XBT_IN("");
-  THROWF(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future."
-      "If you depend on it, sorry, you have to use an older version, or wait for the future version using it...");
-
-  if (gras_if_RL())
-    chunk = xbt_malloc(msg_size);
-
-  xbt_assert(peer->meas,
-              "Asked to receive measurement data on a regular socket");
-  xbt_assert(peer->incoming, "Socket not suited for data receive");
-
-  for (got_sofar = 0; got_sofar < msg_amount; got_sofar++) {
-    XBT_CDEBUG(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);
-  }
-  XBT_CDEBUG(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);
-  XBT_OUT();
-}
-
-/**
- * \brief Something similar to the good old accept system call.
- *
- * Make sure that there is someone speaking to the provided server socket.
- * In RL, it does an accept(2) and return the result as last argument.
- * In SG, as accepts are useless, it returns the provided argument as result.
- * You should thus test whether (peer != accepted) before closing both of them.
- *
- * You should only call this on measurement sockets. It is automatically
- * 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 res;
-  THROWF(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future."
-      "If you depend on it, sorry, you have to use an older version, or wait for the future version using it...");
-
-  xbt_assert(peer->meas,
-              "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 */
-    return peer;
-  }
-
-  res = (peer->plugin->socket_accept) (peer);
-  res->meas = peer->meas;
-  XBT_CDEBUG(gras_trp_meas, "meas_accepted onto %d", res->sd);
-
-  return res;
-}
-
-
 /*
  * Creating procdata for this module
  */
@@ -609,7 +237,7 @@ static void *gras_trp_procdata_new(void)
 
   res->name = xbt_strdup("gras_trp");
   res->name_len = 0;
-  res->sockets = xbt_dynar_new_sync(sizeof(gras_socket_t *), NULL);
+  res->sockets = xbt_dynar_new_sync(sizeof(xbt_socket_t *), NULL);
   res->myport = 0;
 
   return (void *) res;
@@ -633,12 +261,12 @@ void gras_trp_socketset_dump(const char *name)
       (gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id);
 
   unsigned int it;
-  gras_socket_t s;
+  xbt_socket_t s;
 
   XBT_INFO("** Dump the socket set %s", name);
   xbt_dynar_foreach(procdata->sockets, it, s) {
     XBT_INFO("  %p -> %s:%d %s",
-          s, gras_socket_peer_name(s), gras_socket_peer_port(s),
+          s, xbt_socket_peer_name(s), xbt_socket_peer_port(s),
           s->valid ? "(valid)" : "(peer dead)");
   }
   XBT_INFO("** End of socket set %s", name);
index d59cef1..89e409a 100644 (file)
  ***/
 extern int gras_opt_trp_nomoredata_on_close;
 
-/***
- *** Main user functions
- ***/
-/* 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);
-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);
-
-/* Find which socket needs to be read next */
-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);
-
-/***
- *** Plugin mechanism 
- ***/
-
-/* A plugin type */
-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,const char *host,int port, gras_socket_t dst);
-  void (*socket_server) (gras_trp_plugin_t self, int port,gras_socket_t dst);
-
-  gras_socket_t(*socket_accept) (gras_socket_t from);
-
-  /* Getting info about who's speaking */
-  int (*my_port)(gras_socket_t sd);
-  int (*peer_port)(gras_socket_t sd);
-  const char* (*peer_name)(gras_socket_t sd);
-  const char* (*peer_proc)(gras_socket_t sd);
-  void (*peer_proc_set)(gras_socket_t sd,char*peer_proc);
-
-
-  /* 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)
  */
@@ -118,4 +44,6 @@ typedef struct {
 /* Display the content of our socket set (debugging purpose) */
 XBT_PUBLIC(void) gras_trp_socketset_dump(const char *name);
 
+XBT_PUBLIC(xbt_socket_t) gras_trp_select(double timeout);
+
 #endif                          /* GRAS_TRP_INTERFACE_H */
index c26b837..ba81c85 100644 (file)
@@ -9,6 +9,7 @@
 #include "portable.h"
 #include "gras/Transport/transport_private.h"
 #include "xbt/ex.h"
+#include "xbt/xbt_socket_private.h"
 #include "gras/Msg/msg_interface.h"     /* gras_msg_listener_awake */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_file, gras_trp,
@@ -17,15 +18,15 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_file, gras_trp,
 /***
  *** Prototypes
  ***/
-void gras_trp_file_close(gras_socket_t sd);
+void gras_trp_file_close(xbt_socket_t sd);
 
-void gras_trp_file_chunk_send_raw(gras_socket_t sd,
+void gras_trp_file_chunk_send_raw(xbt_socket_t sd,
                                   const char *data,
                                   unsigned long int size);
-void gras_trp_file_chunk_send(gras_socket_t sd, const char *data,
+void gras_trp_file_chunk_send(xbt_socket_t sd, const char *data,
                               unsigned long int size, int stable_ignored);
 
-int gras_trp_file_chunk_recv(gras_socket_t sd,
+int gras_trp_file_chunk_recv(xbt_socket_t sd,
                              char *data, unsigned long int size);
 
 /***
@@ -43,26 +44,26 @@ typedef struct {
 /***
  *** Info about who's speaking
  ***/
-static int gras_trp_file_my_port(gras_socket_t s) {
+static int gras_trp_file_my_port(xbt_socket_t s) {
   THROW_UNIMPLEMENTED;
 }
-static int gras_trp_file_peer_port(gras_socket_t s) {
+static int gras_trp_file_peer_port(xbt_socket_t s) {
   THROW_UNIMPLEMENTED;
 }
-static const char* gras_trp_file_peer_name(gras_socket_t s) {
+static const char* gras_trp_file_peer_name(xbt_socket_t s) {
   THROW_UNIMPLEMENTED;
 }
-static const char* gras_trp_file_peer_proc(gras_socket_t s) {
+static const char* gras_trp_file_peer_proc(xbt_socket_t s) {
   THROW_UNIMPLEMENTED;
 }
-static void gras_trp_file_peer_proc_set(gras_socket_t s,char *name) {
+static void gras_trp_file_peer_proc_set(xbt_socket_t s,char *name) {
   THROW_UNIMPLEMENTED;
 }
 
 /***
  *** Code
  ***/
-void gras_trp_file_setup(gras_trp_plugin_t plug)
+void gras_trp_file_setup(xbt_trp_plugin_t plug)
 {
 
   gras_trp_file_plug_data_t *file = xbt_new(gras_trp_file_plug_data_t, 1);
@@ -92,15 +93,13 @@ void 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)
+xbt_socket_t gras_socket_client_from_file(const char *path)
 {
-  gras_socket_t res;
+  xbt_socket_t res;
 
   xbt_assert(gras_if_RL(), "Cannot use file as socket in the simulator");
 
-  gras_trp_socket_new(0, &res);
-
-  res->plugin = gras_trp_plugin_get_by_name("file");
+  xbt_socket_new_ext(0, &res, xbt_trp_plugin_get_by_name("file"), 0, 0);
 
   if (strcmp("-", path)) {
     res->sd =
@@ -134,16 +133,13 @@ gras_socket_t 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)
+xbt_socket_t gras_socket_server_from_file(const char *path)
 {
-  gras_socket_t res;
+  xbt_socket_t res;
 
   xbt_assert(gras_if_RL(), "Cannot use file as socket in the simulator");
 
-  gras_trp_socket_new(1, &res);
-
-  res->plugin = gras_trp_plugin_get_by_name("file");
-
+  xbt_socket_new_ext(1, &res, xbt_trp_plugin_get_by_name("file"), 0, 0);
 
   if (strcmp("-", path)) {
     res->sd = open(path, O_RDONLY | O_BINARY);
@@ -168,7 +164,7 @@ gras_socket_t gras_socket_server_from_file(const char *path)
   return res;
 }
 
-void gras_trp_file_close(gras_socket_t sock)
+void gras_trp_file_close(xbt_socket_t sock)
 {
   gras_trp_file_plug_data_t *data;
 
@@ -199,7 +195,7 @@ void gras_trp_file_close(gras_socket_t sock)
  * Send data on a file pseudo-socket
  */
 void
-gras_trp_file_chunk_send(gras_socket_t sock,
+gras_trp_file_chunk_send(xbt_socket_t sock,
                          const char *data,
                          unsigned long int size, int stable_ignored)
 {
@@ -207,7 +203,7 @@ gras_trp_file_chunk_send(gras_socket_t sock,
 }
 
 void
-gras_trp_file_chunk_send_raw(gras_socket_t sock,
+gras_trp_file_chunk_send_raw(xbt_socket_t sock,
                              const char *data, unsigned long int size)
 {
 
@@ -240,7 +236,7 @@ gras_trp_file_chunk_send_raw(gras_socket_t sock,
  * Receive data on a file pseudo-socket.
  */
 int
-gras_trp_file_chunk_recv(gras_socket_t sock,
+gras_trp_file_chunk_recv(xbt_socket_t sock,
                          char *data, unsigned long int size)
 {
 
index 0eac7be..277aea0 100644 (file)
@@ -16,6 +16,7 @@
 #include "gras/Msg/msg_private.h"
 #include "gras/Transport/transport_private.h"
 #include "gras/Virtu/virtu_sg.h"
+#include "xbt/xbt_socket_private.h" /* FIXME */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_sg, gras_trp,
                                 "SimGrid pseudo-transport");
@@ -27,22 +28,22 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_sg, gras_trp,
 /* retrieve the port record associated to a numerical port on an host */
 static gras_sg_portrec_t find_port(gras_hostdata_t * hd, int port);
 
-void gras_trp_sg_socket_client(gras_trp_plugin_t self,
+void gras_trp_sg_socket_client(xbt_trp_plugin_t self,
                                const char*host,
                                int port,
-                               /* OUT */ gras_socket_t sock);
-void gras_trp_sg_socket_server(gras_trp_plugin_t self,
+                               /* OUT */ xbt_socket_t sock);
+void gras_trp_sg_socket_server(xbt_trp_plugin_t self,
                                int port,
-                               /* OUT */ gras_socket_t sock);
-void gras_trp_sg_socket_close(gras_socket_t sd);
+                               /* OUT */ xbt_socket_t sock);
+void gras_trp_sg_socket_close(xbt_socket_t sd);
 
-void gras_trp_sg_chunk_send_raw(gras_socket_t sd,
+void gras_trp_sg_chunk_send_raw(xbt_socket_t sd,
                                 const char *data, unsigned long int size);
-void gras_trp_sg_chunk_send(gras_socket_t sd,
+void gras_trp_sg_chunk_send(xbt_socket_t sd,
                             const char *data,
                             unsigned long int size, int stable_ignored);
 
-int gras_trp_sg_chunk_recv(gras_socket_t sd,
+int gras_trp_sg_chunk_recv(xbt_socket_t sd,
                            char *data, unsigned long int size);
 
 /***
@@ -73,39 +74,41 @@ static gras_sg_portrec_t find_port(gras_hostdata_t * hd, int port)
 /***
  *** Info about who's speaking
  ***/
-static int gras_trp_sg_my_port(gras_socket_t s) {
-  gras_trp_sg_sock_data_t sockdata = s->data;
+static int gras_trp_sg_my_port(xbt_socket_t s)
+{
+  gras_trp_sg_sock_data_t sockdata = xbt_socket_get_data(s);
   if (gras_socket_im_the_server(s))
     return sockdata->server_port;
   else
     return sockdata->client_port;
 }
-static int gras_trp_sg_peer_port(gras_socket_t s) {
-  gras_trp_sg_sock_data_t sockdata = s->data;
+static int gras_trp_sg_peer_port(xbt_socket_t s)
+{
+  gras_trp_sg_sock_data_t sockdata = xbt_socket_get_data(s);
   if (gras_socket_im_the_server(s))
     return sockdata->client_port;
   else
     return sockdata->server_port;
 }
 
-static const char* gras_trp_sg_peer_name(gras_socket_t s) {
-  gras_trp_sg_sock_data_t sockdata = s->data;
+static const char* gras_trp_sg_peer_name(xbt_socket_t s)
+{
+  gras_trp_sg_sock_data_t sockdata = xbt_socket_get_data(s);
   if (gras_socket_im_the_server(s))
     return SIMIX_host_get_name(simcall_process_get_host(sockdata->client));
   else {
     return SIMIX_host_get_name(simcall_process_get_host(sockdata->server));
   }
 }
-static const char* gras_trp_sg_peer_proc(gras_socket_t s) {
+static const char* gras_trp_sg_peer_proc(xbt_socket_t s) {
   THROW_UNIMPLEMENTED;
 }
-static void gras_trp_sg_peer_proc_set(gras_socket_t s,char *name) {
+static void gras_trp_sg_peer_proc_set(xbt_socket_t s,char *name) {
   THROW_UNIMPLEMENTED;
 }
 
-void gras_trp_sg_setup(gras_trp_plugin_t plug)
+void gras_trp_sg_setup(xbt_trp_plugin_t plug)
 {
-
   plug->my_port = gras_trp_sg_my_port;
   plug->peer_port = gras_trp_sg_peer_port;
   plug->peer_name = gras_trp_sg_peer_name;
@@ -127,10 +130,10 @@ void gras_trp_sg_setup(gras_trp_plugin_t plug)
   plug->flush = NULL;           /* nothing cached */
 }
 
-void gras_trp_sg_socket_client(gras_trp_plugin_t self,
+void gras_trp_sg_socket_client(xbt_trp_plugin_t self,
                                const char*host,
                                int port,
-                               /* OUT */ gras_socket_t sock)
+                               /* OUT */ xbt_socket_t sock)
 {
 
   smx_host_t peer;
@@ -192,7 +195,7 @@ void gras_trp_sg_socket_client(gras_trp_plugin_t self,
          data->rdv_server,data->rdv_client,data->comm_recv);
 }
 
-void gras_trp_sg_socket_server(gras_trp_plugin_t self, int port, gras_socket_t sock)
+void gras_trp_sg_socket_server(xbt_trp_plugin_t self, int port, xbt_socket_t sock)
 {
 
   gras_hostdata_t *hd =
@@ -244,7 +247,7 @@ void gras_trp_sg_socket_server(gras_trp_plugin_t self, int port, gras_socket_t s
 
 }
 
-void gras_trp_sg_socket_close(gras_socket_t sock)
+void gras_trp_sg_socket_close(xbt_socket_t sock)
 {
   gras_hostdata_t *hd =
       (gras_hostdata_t *) SIMIX_host_self_get_data();
@@ -284,14 +287,14 @@ typedef struct {
   void *data;
 } sg_task_data_t;
 
-void gras_trp_sg_chunk_send(gras_socket_t sock,
+void gras_trp_sg_chunk_send(xbt_socket_t sock,
                             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,
+void gras_trp_sg_chunk_send_raw(xbt_socket_t sock,
                                 const char *data, unsigned long int size)
 {
 #ifdef KILLME
@@ -323,7 +326,7 @@ void gras_trp_sg_chunk_send_raw(gras_socket_t sock,
   THROW_UNIMPLEMENTED;
 }
 
-int gras_trp_sg_chunk_recv(gras_socket_t sock,
+int gras_trp_sg_chunk_recv(xbt_socket_t sock,
                            char *data, unsigned long int size)
 {
   //gras_trp_sg_sock_data_t *sock_data =
@@ -333,7 +336,7 @@ int gras_trp_sg_chunk_recv(gras_socket_t sock,
   THROW_UNIMPLEMENTED;
 #ifdef KILLME
   gras_trp_sg_sock_data_t *remote_sock_data;
-  gras_socket_t remote_socket = NULL;
+  xbt_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");
index c74efd5..9f67861 100644 (file)
@@ -41,76 +41,6 @@ extern int gras_trp_libdata_id; /* our libdata identifier */
  
    It gets tricky since gras_socket_close is part of the common API, not 
    only the RL one. */
-extern gras_socket_t _gras_lastly_selected_socket;
-
-/**
- * s_gras_socket:
- * 
- * Description of a socket.
- */
-typedef struct gras_trp_bufdata_ gras_trp_bufdata_t;
-
-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 */
-
-  int refcount;                 /* refcounting on shared sockets */
-
-  unsigned long int buf_size;   /* what to say to the OS. 
-                                   Field here to remember it when accepting */
-
-  int sd;
-
-  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);
-
-/* The drivers */
-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);
-void gras_trp_file_setup(gras_trp_plugin_t plug);
-void gras_trp_sg_setup(gras_trp_plugin_t plug);
-
-/* FIXME: this should be solved by SIMIX
-
-  I'm tired of that shit. the select in SG has to create a socket to expeditor
-  manually do deal with the weirdness of the hostdata, themselves here to deal
-  with the weird channel concept of SG and convert them back to ports.
-  
-  When introducing buffered transport (which I want to get used in SG to debug
-  the buffering itself), we should not make the rest of the code aware of the
-  change and not specify code for this. This is bad design.
-  
-  But there is bad design all over the place, so fuck off for now, when we can
-  get rid of MSG and rely directly on SG, this crude hack can go away. But in
-  the meanwhile, I want to sleep this night (FIXME).
-  
-  Hu! You evil problem! Taste my axe!
-
-*/
-
-gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock);
+extern xbt_socket_t _gras_lastly_selected_socket;
 
 #endif                          /* GRAS_TRP_PRIVATE_H */
index fef78be..24c0f62 100644 (file)
@@ -10,7 +10,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "gras/transport.h"
-#include "gras/datadesc.h"
+#include "xbt/datadesc.h"
 #include "gras/messages.h"
 #include "gras_modinter.h"
 
index 781ab57..ea7e0f5 100644 (file)
@@ -66,10 +66,10 @@ void gras_process_init()
   } else
     pd->ppid = -1;
 
-  trp_pd->msg_selectable_sockets = xbt_queue_new(0, sizeof(gras_socket_t));
+  trp_pd->msg_selectable_sockets = xbt_queue_new(0, sizeof(xbt_socket_t));
 
   trp_pd->meas_selectable_sockets =
-      xbt_queue_new(0, sizeof(gras_socket_t));
+      xbt_queue_new(0, sizeof(xbt_socket_t));
 
   XBT_VERB("Creating process '%s' (%d)", SIMIX_process_self_get_name(),
       gras_os_getpid());
@@ -79,7 +79,7 @@ void gras_process_exit()
 {
   xbt_dynar_t sockets =
       ((gras_trp_procdata_t) gras_libdata_by_name("gras_trp"))->sockets;
-  gras_socket_t sock_iter;
+  xbt_socket_t sock_iter;
   unsigned int cursor;
   gras_hostdata_t *hd =
       (gras_hostdata_t *) SIMIX_host_self_get_data();
@@ -110,9 +110,9 @@ void gras_process_exit()
     xbt_dynar_foreach(msg_pd->msg_queue, cpt, msg) {
       XBT_WARN("   Message %s (%s) from %s@%s:%d", msg.type->name,
             e_gras_msg_kind_names[msg.kind],
-            gras_socket_peer_proc(msg.expe),
-            gras_socket_peer_name(msg.expe),
-            gras_socket_peer_port(msg.expe));
+            xbt_socket_peer_proc(msg.expe),
+            xbt_socket_peer_name(msg.expe),
+            xbt_socket_peer_port(msg.expe));
     }
   }
 
index b634604..93e1cce 100644 (file)
@@ -29,7 +29,7 @@ typedef struct {
 
 } gras_hostdata_t;
 
-/* data for each socket (FIXME: find a better location for that)*/
+/* data for each socket (FIXME: find a better location for that) */
 typedef struct {
   smx_process_t server;
   smx_process_t client;
@@ -45,7 +45,8 @@ typedef struct {
 
 
 /** \brief Returns if I am on the server side of this socket (either server or listener of server) */
-int gras_socket_im_the_server(gras_socket_t sock);
+/* FIXME make an im_the_server function in each socket plugin */
+int gras_socket_im_the_server(xbt_socket_t sock);
 
 
 void *gras_libdata_by_name_from_remote(const char *name, smx_process_t p);
index c810ef1..170275d 100644 (file)
@@ -11,6 +11,7 @@
 #include "xbt/module.h"         /* xbt_init/exit */
 #include "xbt/xbt_os_time.h"    /* xbt_os_time */
 #include "xbt/synchro.h"
+#include "xbt/socket.h"
 
 #include "Virtu/virtu_interface.h"      /* Module mechanism FIXME: deplace&rename */
 #include "Virtu/virtu_private.h"
@@ -20,6 +21,7 @@
 
 #include "gras.h"
 #include "gras/process.h"       /* FIXME: killme and put process_init in modinter */
+#include "gras/transport.h"
 #include "gras/Msg/msg_private.h"
 #include "portable.h"           /* hexa_*(); signalling stuff */
 
@@ -50,20 +52,11 @@ static void gras_sigint_handler(int sig)
 }
 #endif
 
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt);
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt_cbps);
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt_convert);
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt_create);
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt_exchange);
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt_lexer);
-XBT_LOG_EXTERNAL_CATEGORY(gras_ddt_parse);
 XBT_LOG_EXTERNAL_CATEGORY(gras_modules);
 XBT_LOG_EXTERNAL_CATEGORY(gras_msg);
 XBT_LOG_EXTERNAL_CATEGORY(gras_msg_read);
 XBT_LOG_EXTERNAL_CATEGORY(gras_msg_rpc);
 XBT_LOG_EXTERNAL_CATEGORY(gras_timer);
-XBT_LOG_EXTERNAL_CATEGORY(gras_trp);
-XBT_LOG_EXTERNAL_CATEGORY(gras_trp_meas);
 XBT_LOG_EXTERNAL_CATEGORY(gras_virtu);
 XBT_LOG_EXTERNAL_CATEGORY(gras_virtu_emul);
 XBT_LOG_EXTERNAL_CATEGORY(gras_virtu_process);
@@ -89,13 +82,6 @@ void gras_init(int *argc, char **argv)
   if (gras_running_process == 0) {
     first = 1;
     /* 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);
 
@@ -105,15 +91,18 @@ void gras_init(int *argc, char **argv)
 
     XBT_LOG_CONNECT(gras_timer, gras);
 
-    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);
 
     gras_trp_register();
     gras_msg_register();
+
+    xbt_trp_plugin_new("file", gras_trp_file_setup);
+    if (gras_if_SG()) {
+      xbt_trp_plugin_new("sg", gras_trp_sg_setup);
+    }
+    /* the TCP plugin (used in RL mode) is automatically loaded by XBT */
   }
   gras_running_process++;
 
@@ -128,8 +117,6 @@ void gras_init(int *argc, char **argv)
   if (first) {
     gras_emul_init();
     gras_msg_init();
-    gras_trp_init();
-    gras_datadesc_init();
 #if defined(HAVE_SIGNAL) && defined(HAVE_SIGNAL_H)
 # ifdef SIGUSR1
     signal(SIGUSR1, gras_sigusr_handler);
@@ -160,8 +147,6 @@ void gras_exit(void)
   gras_process_exit();
   if (--gras_running_process == 0) {
     gras_msg_exit();
-    gras_trp_exit();
-    gras_datadesc_exit();
     gras_emul_exit();
     gras_moddata_exit();
   }
index e2b0b9f..cbc2621 100644 (file)
@@ -18,10 +18,6 @@ void gras_msg_register(void);
 void gras_msg_init(void);
 void gras_msg_exit(void);
 void gras_trp_register(void);
-void gras_trp_init(void);
-void gras_trp_exit(void);
-void gras_datadesc_init(void);
-void gras_datadesc_exit(void);
 
 void gras_procdata_init(void);
 void gras_procdata_exit(void);
similarity index 72%
rename from src/gras/DataDesc/cbps.c
rename to src/xbt/datadesc/cbps.c
index cfb2b2a..b397268 100644 (file)
@@ -7,29 +7,29 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/ex.h"
-#include "gras/DataDesc/datadesc_private.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_cbps, gras_ddt,
+#include "xbt/datadesc/datadesc_private.h"
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_cbps, xbt_ddt,
                                 "callback persistant state");
 
 typedef struct {
-  gras_datadesc_type_t type;
+  xbt_datadesc_type_t type;
   void *data;
-} s_gras_cbps_elm_t, *gras_cbps_elm_t;
+} s_xbt_cbps_elm_t, *xbt_cbps_elm_t;
 
-typedef struct s_gras_cbps {
+typedef struct s_xbt_cbps {
   xbt_dynar_t lints;            /* simple stack of long integers (easy interface) */
 
-  xbt_dict_t space;             /* varname x dynar of gras_cbps_elm_t */
+  xbt_dict_t space;             /* varname x dynar of xbt_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;
+} s_xbt_cbps_t;
 
-gras_cbps_t gras_cbps_new(void)
+xbt_cbps_t xbt_cbps_new(void)
 {
-  gras_cbps_t res;
+  xbt_cbps_t res;
 
-  res = xbt_new(s_gras_cbps_t, 1);
+  res = xbt_new(s_xbt_cbps_t, 1);
 
   res->lints = xbt_dynar_new(sizeof(int), NULL);
   res->space = xbt_dict_new_homogeneous(NULL);
@@ -37,17 +37,17 @@ gras_cbps_t gras_cbps_new(void)
   res->frames = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
   res->globals = xbt_dynar_new(sizeof(char *), NULL);
 
-  gras_cbps_block_begin(res);
+  xbt_cbps_block_begin(res);
 
   return res;
 }
 
-void gras_cbps_free(gras_cbps_t * state)
+void xbt_cbps_free(xbt_cbps_t * state)
 {
 
   xbt_dynar_free(&((*state)->lints));
 
-  gras_cbps_block_end(*state);
+  xbt_cbps_block_end(*state);
   xbt_dict_free(&((*state)->space));
   xbt_dynar_free(&((*state)->frames));
   xbt_dynar_free(&((*state)->globals));
@@ -56,7 +56,7 @@ void gras_cbps_free(gras_cbps_t * state)
   *state = NULL;
 }
 
-void gras_cbps_reset(gras_cbps_t state)
+void xbt_cbps_reset(xbt_cbps_t state)
 {
 
   xbt_dynar_reset(state->lints);
@@ -74,12 +74,12 @@ 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_cbps_v_push(xbt_cbps_t ps,
+                 const char *name, void *data, xbt_datadesc_type_t ddt)
 {
 
   xbt_dynar_t varstack = NULL, frame;
-  gras_cbps_elm_t var;
+  xbt_cbps_elm_t var;
   char *varname = (char *) xbt_strdup(name);
   xbt_ex_t e;
 
@@ -93,13 +93,13 @@ gras_cbps_v_push(gras_cbps_t ps,
       RETHROW;
 
     XBT_DEBUG("Create a new variable stack for '%s' into the space", name);
-    varstack = xbt_dynar_new(sizeof(gras_cbps_elm_t *), NULL);
+    varstack = xbt_dynar_new(sizeof(xbt_cbps_elm_t *), NULL);
     xbt_dict_set(ps->space, name, (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 = xbt_new0(s_xbt_cbps_elm_t, 1);
   var->type = ddt;
   var->data = data;
 
@@ -118,11 +118,11 @@ 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_cbps_v_pop(xbt_cbps_t ps,
+                const char *name, xbt_datadesc_type_t * ddt, void **res)
 {
   xbt_dynar_t varstack = NULL, frame = NULL;
-  gras_cbps_elm_t var = NULL;
+  xbt_cbps_elm_t var = NULL;
   void *data = NULL;
   xbt_ex_t e;
 
@@ -181,21 +181,21 @@ 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)
+xbt_cbps_v_set(xbt_cbps_t ps,
+                const char *name, void *data, xbt_datadesc_type_t ddt)
 {
 
   xbt_dynar_t dynar = NULL;
-  gras_cbps_elm_t elm = NULL;
+  xbt_cbps_elm_t elm = NULL;
 
   XBT_DEBUG("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);
+    dynar = xbt_dynar_new(sizeof(xbt_cbps_elm_t), NULL);
     xbt_dict_set(ps->space, name, (void **) dynar, NULL);
 
-    elm = xbt_new0(s_gras_cbps_elm_t, 1);
+    elm = xbt_new0(s_xbt_cbps_elm_t, 1);
     xbt_dynar_push(ps->globals, &name);
   } else {
     xbt_dynar_pop(dynar, &elm);
@@ -215,12 +215,12 @@ 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 *xbt_cbps_v_get(xbt_cbps_t ps, const char *name,
+                      /* OUT */ xbt_datadesc_type_t * ddt)
 {
 
   xbt_dynar_t dynar = NULL;
-  gras_cbps_elm_t elm = NULL;
+  xbt_cbps_elm_t elm = NULL;
 
   XBT_DEBUG("get(%s)", name);
   dynar = xbt_dict_get(ps->space, name);
@@ -246,7 +246,7 @@ void *gras_cbps_v_get(gras_cbps_t ps, const char *name,
  * use block_{begin,end} to do the trick.
  */
 
-void gras_cbps_block_begin(gras_cbps_t ps)
+void xbt_cbps_block_begin(xbt_cbps_t ps)
 {
 
   xbt_dynar_t dynar = NULL;
@@ -257,7 +257,7 @@ void gras_cbps_block_begin(gras_cbps_t ps)
 }
 
 /** \brief End the current block, and go back to the upper one. */
-void gras_cbps_block_end(gras_cbps_t ps)
+void xbt_cbps_block_end(xbt_cbps_t ps)
 {
 
   xbt_dynar_t frame = NULL;
@@ -271,7 +271,7 @@ void gras_cbps_block_end(gras_cbps_t ps)
   xbt_dynar_foreach(frame, cursor, name) {
 
     xbt_dynar_t varstack = NULL;
-    gras_cbps_elm_t var = NULL;
+    xbt_cbps_elm_t var = NULL;
 
     XBT_DEBUG("Get ride of %s (%p)", name, (void *) name);
     varstack = xbt_dict_get(ps->space, name);
@@ -292,19 +292,19 @@ void gras_cbps_block_end(gras_cbps_t ps)
 
 
 /** \brief Push a new integer value into the cbps. */
-void gras_cbps_i_push(gras_cbps_t ps, int val)
+void xbt_cbps_i_push(xbt_cbps_t ps, int val)
 {
   XBT_DEBUG("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 xbt_cbps_i_pop(xbt_cbps_t ps)
 {
   int ret;
 
   xbt_assert(!xbt_dynar_is_empty(ps->lints),
-              "gras_cbps_i_pop: no value to pop");
+              "xbt_cbps_i_pop: no value to pop");
   ret = xbt_dynar_pop_as(ps->lints, int);
   XBT_DEBUG("pop %d as a size", ret);
   return ret;
@@ -312,12 +312,12 @@ int gras_cbps_i_pop(gras_cbps_t ps)
 
 /** \brief Generic cb returning the lastly pushed value
  *
- * Used by \ref gras_datadesc_ref_pop_arr
+ * Used by \ref xbt_datadesc_ref_pop_arr
  */
-int gras_datadesc_cb_pop(gras_datadesc_type_t ignored, gras_cbps_t vars,
+int xbt_datadesc_cb_pop(xbt_datadesc_type_t ignored, xbt_cbps_t vars,
                          void *data)
 {
-  return gras_cbps_i_pop(vars);
+  return xbt_cbps_i_pop(vars);
 }
 
 /* ************************* */
@@ -325,81 +325,81 @@ int gras_datadesc_cb_pop(gras_datadesc_type_t ignored, gras_cbps_t vars,
 /* ************************* */
 
 /** \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)
+void xbt_datadesc_cb_push_int(xbt_datadesc_type_t ignored,
+                               xbt_cbps_t vars, void *data)
 {
   int *i = (int *) data;
-  gras_cbps_i_push(vars, (int) *i);
+  xbt_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)
+void xbt_datadesc_cb_push_uint(xbt_datadesc_type_t ignored,
+                                xbt_cbps_t vars, void *data)
 {
   unsigned int *i = (unsigned int *) data;
-  gras_cbps_i_push(vars, (int) *i);
+  xbt_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)
+void xbt_datadesc_cb_push_lint(xbt_datadesc_type_t ignored,
+                                xbt_cbps_t vars, void *data)
 {
   long int *i = (long int *) data;
-  gras_cbps_i_push(vars, (int) *i);
+  xbt_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)
+void xbt_datadesc_cb_push_ulint(xbt_datadesc_type_t ignored,
+                                 xbt_cbps_t vars, void *data)
 {
   unsigned long int *i = (unsigned long int *) data;
-  gras_cbps_i_push(vars, (int) *i);
+  xbt_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)
+void xbt_datadesc_cb_push_int_mult(xbt_datadesc_type_t ignored,
+                                    xbt_cbps_t vars, void *data)
 {
   int old = *(int *) data;
-  int new = gras_cbps_i_pop(vars);
+  int new = xbt_cbps_i_pop(vars);
   XBT_DEBUG("push %d x %d as a size", old, new);
-  gras_cbps_i_push(vars, old * new);
+  xbt_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)
+void xbt_datadesc_cb_push_uint_mult(xbt_datadesc_type_t ignored,
+                                     xbt_cbps_t vars, void *data)
 {
   unsigned int old = *(unsigned int *) data;
-  unsigned int new = gras_cbps_i_pop(vars);
+  unsigned int new = xbt_cbps_i_pop(vars);
 
   XBT_DEBUG("push %d x %d as a size", old, new);
-  gras_cbps_i_push(vars, (int) (old * new));
+  xbt_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)
+void xbt_datadesc_cb_push_lint_mult(xbt_datadesc_type_t ignored,
+                                     xbt_cbps_t vars, void *data)
 {
   long int i = *(long int *) data;
-  i *= gras_cbps_i_pop(vars);
-  gras_cbps_i_push(vars, (int) i);
+  i *= xbt_cbps_i_pop(vars);
+  xbt_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)
+void xbt_datadesc_cb_push_ulint_mult(xbt_datadesc_type_t ignored,
+                                      xbt_cbps_t vars, void *data)
 {
   unsigned long int old = *(unsigned long int *) data;
-  unsigned long int new = gras_cbps_i_pop(vars);
+  unsigned long int new = xbt_cbps_i_pop(vars);
 
   XBT_DEBUG("push %ld x %ld as a size", old, new);
-  gras_cbps_i_push(vars, (int) (old * new));
+  xbt_cbps_i_push(vars, (int) (old * new));
 }
diff --git a/src/xbt/datadesc/datadesc.c b/src/xbt/datadesc/datadesc.c
new file mode 100644 (file)
index 0000000..6942b24
--- /dev/null
@@ -0,0 +1,258 @@
+/* datadesc - data description in order to send/recv it in XBT             */
+
+/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+#include "datadesc_private.h"
+#include "portable.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt, xbt, "Data description");
+/* FIXME: make this host-dependent using a trick such as UserData*/
+/*@null@*/ xbt_set_t xbt_datadesc_set_local = NULL;
+
+
+/* callback for array size when sending strings */
+static int _strlen_cb( /*@unused@ */ xbt_datadesc_type_t type, /*@unused@ */
+                      xbt_cbps_t vars, void *data)
+{
+
+  return 1 + (int) strlen(data);
+}
+
+
+/**
+ * xbt_datadesc_init:
+ *
+ * Initialize the datadesc module.
+ * FIXME: We assume that when neither signed nor unsigned is given,
+ *    that means signed. To be checked by configure.
+ **/
+void xbt_datadesc_preinit(void)
+{
+  xbt_datadesc_type_t ddt;     /* What to add */
+
+  /* only initialize once */
+  if (xbt_datadesc_set_local != NULL)
+    return;
+
+  XBT_VERB("Initializing DataDesc");
+
+  xbt_datadesc_set_local = xbt_set_new();
+
+
+  /* all known datatypes */
+
+  ddt = xbt_datadesc_scalar("signed char",
+                             xbt_ddt_scalar_char,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("char",
+                             xbt_ddt_scalar_char,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("unsigned char",
+                             xbt_ddt_scalar_char,
+                             e_xbt_dd_scalar_encoding_uint);
+
+  ddt = xbt_datadesc_scalar("signed short int",
+                             xbt_ddt_scalar_short,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("short int",
+                             xbt_ddt_scalar_short,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("short",
+                             xbt_ddt_scalar_short,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("unsigned short int",
+                             xbt_ddt_scalar_short,
+                             e_xbt_dd_scalar_encoding_uint);
+
+  ddt = xbt_datadesc_scalar("signed int",
+                             xbt_ddt_scalar_int,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("int",
+                             xbt_ddt_scalar_int,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("unsigned int",
+                             xbt_ddt_scalar_int,
+                             e_xbt_dd_scalar_encoding_uint);
+
+  ddt = xbt_datadesc_scalar("signed long int",
+                             xbt_ddt_scalar_long,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("long int",
+                             xbt_ddt_scalar_long,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("long",
+                             xbt_ddt_scalar_long,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("unsigned long int",
+                             xbt_ddt_scalar_long,
+                             e_xbt_dd_scalar_encoding_uint);
+
+  ddt = xbt_datadesc_scalar("signed long long int",
+                             xbt_ddt_scalar_long_long,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("long long int",
+                             xbt_ddt_scalar_long_long,
+                             e_xbt_dd_scalar_encoding_sint);
+  ddt = xbt_datadesc_scalar("unsigned long long int",
+                             xbt_ddt_scalar_long_long,
+                             e_xbt_dd_scalar_encoding_uint);
+
+  ddt = xbt_datadesc_scalar("data pointer",
+                             xbt_ddt_scalar_pdata,
+                             e_xbt_dd_scalar_encoding_uint);
+  ddt = xbt_datadesc_scalar("function pointer",
+                             xbt_ddt_scalar_pfunc,
+                             e_xbt_dd_scalar_encoding_uint);
+
+  ddt = xbt_datadesc_scalar("float",
+                             xbt_ddt_scalar_float,
+                             e_xbt_dd_scalar_encoding_float);
+  ddt = xbt_datadesc_scalar("double",
+                             xbt_ddt_scalar_double,
+                             e_xbt_dd_scalar_encoding_float);
+
+  ddt = xbt_datadesc_array_dyn("char[]",
+                                xbt_datadesc_by_name("char"), _strlen_cb);
+  xbt_datadesc_ref("string", ddt);
+  xbt_datadesc_ref("xbt_string_t", ddt);
+
+  /* specific datatype: the exception type (for RPC) */
+  ddt = xbt_datadesc_struct("ex_t");
+  xbt_datadesc_struct_append(ddt, "msg", xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "category",
+                              xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_append(ddt, "value", xbt_datadesc_by_name("int"));
+
+  xbt_datadesc_struct_append(ddt, "remote",
+                              xbt_datadesc_by_name("short int"));
+
+  xbt_datadesc_struct_append(ddt, "host",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "procname",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "pid",
+                              xbt_datadesc_by_name("long int"));
+  xbt_datadesc_struct_append(ddt, "file",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "line", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_append(ddt, "func",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "used", xbt_datadesc_by_name("int"));
+  xbt_datadesc_cb_field_push(ddt, "used");
+  xbt_datadesc_struct_append(ddt, "bt_strings",
+                              xbt_datadesc_ref_pop_arr
+                              (xbt_datadesc_by_name("string")));
+
+  xbt_datadesc_struct_close(ddt);
+
+  /* specific datatype: xbt_peer_t */
+  ddt = xbt_datadesc_struct("s_xbt_peer_t");
+  xbt_datadesc_struct_append(ddt, "name",
+                              xbt_datadesc_by_name("string"));
+  xbt_datadesc_struct_append(ddt, "port", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_close(ddt);
+
+  ddt = xbt_datadesc_ref("xbt_peer_t", ddt);
+
+  /* Dict containing the constant value (for the parsing macro) */
+  xbt_dd_constants = xbt_dict_new_homogeneous(xbt_free_f);
+
+}
+
+/**
+ * xbt_datadesc_exit:
+ *
+ * Finalize the datadesc module
+ **/
+void xbt_datadesc_postexit(void)
+{
+  XBT_VERB("Exiting DataDesc");
+  xbt_set_free(&xbt_datadesc_set_local);
+  xbt_dict_free(&xbt_dd_constants);
+  XBT_DEBUG("Exited DataDesc");
+}
+
+/** This is mainly to debug */
+const char *xbt_datadesc_get_name(xbt_datadesc_type_t ddt)
+{
+  return ddt ? (const char *) ddt->name : "(null)";
+}
+
+/** This is mainly to debug */
+int xbt_datadesc_get_id(xbt_datadesc_type_t ddt)
+{
+  return ddt->code;
+}
+
+/**
+ * xbt_datadesc_size:
+ *
+ * Returns the size occuped by data of this type (on the current arch).
+ *
+ */
+int xbt_datadesc_size(xbt_datadesc_type_t type)
+{
+  return type ? type->size[GRAS_THISARCH] : 0;
+}
+
+/**
+ * xbt_datadesc_type_dump:
+ *
+ * For debugging purpose
+ */
+void xbt_datadesc_type_dump(const xbt_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", xbt_datadesc_cat_names[ddt->category_code]);
+
+  printf("  size[");
+  for (cpt = 0; cpt < xbt_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 < xbt_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 < xbt_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_xbt_datadesc_type_cat_struct) {
+    xbt_dd_cat_struct_t struct_data;
+    xbt_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]);
+      xbt_datadesc_type_dump(field->type);
+      printf("<<< end dump field #%d (%s)\n", cpt, field->name);
+    }
+  }
+  fflush(stdout);
+}
diff --git a/src/xbt/datadesc/datadesc_interface.h b/src/xbt/datadesc/datadesc_interface.h
new file mode 100644 (file)
index 0000000..7568c45
--- /dev/null
@@ -0,0 +1,49 @@
+/* datadesc - describing the data to exchange                               */
+
+/* module's public interface exported within XBT, but not to end user.     */
+
+/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+#ifndef XBT_DATADESC_INTERFACE_H
+#define XBT_DATADESC_INTERFACE_H
+
+#include "xbt/datadesc.h"
+#include "xbt/misc.h"
+#include "xbt/socket.h"
+
+XBT_PUBLIC(xbt_datadesc_type_t) xbt_datadesc_by_id(long int code);
+
+/* to debug */
+XBT_PUBLIC(void) xbt_datadesc_type_dump(const xbt_datadesc_type_t ddt);
+XBT_PUBLIC(const char *) xbt_datadesc_arch_name(int code);
+
+/* compare two data type description */
+XBT_PUBLIC(int)
+xbt_datadesc_type_cmp(const xbt_datadesc_type_t d1,
+                       const xbt_datadesc_type_t d2);
+
+/* Access function */
+XBT_PUBLIC(int) xbt_datadesc_size(xbt_datadesc_type_t type);
+/* Described data exchanges: direct use */
+XBT_PUBLIC(int) xbt_datadesc_memcpy(xbt_datadesc_type_t type, void *src,
+                                     void *dst);
+XBT_PUBLIC(void) xbt_datadesc_send(xbt_socket_t sock,
+                                    xbt_datadesc_type_t type, void *src);
+XBT_PUBLIC(void) xbt_datadesc_recv(xbt_socket_t sock,
+                                    xbt_datadesc_type_t type, int r_arch,
+                                    void *dst);
+
+/* Described data exchanges: IDL compilation FIXME: not implemented*/
+void xbt_datadesc_gen_cpy(xbt_datadesc_type_t type, void *src,
+                           void **dst);
+void xbt_datadesc_gen_send(xbt_socket_t sock,
+                            xbt_datadesc_type_t type, void *src);
+void xbt_datadesc_gen_recv(xbt_socket_t sock,
+                            xbt_datadesc_type_t type, int r_arch,
+                            void *dst);
+
+#endif                          /* XBT_DATADESC_INTERFACE_H */
diff --git a/src/xbt/datadesc/datadesc_private.h b/src/xbt/datadesc/datadesc_private.h
new file mode 100644 (file)
index 0000000..a5fd45d
--- /dev/null
@@ -0,0 +1,255 @@
+/* datadesc - describing the data to exchange                               */
+
+/* module's private interface masked even to other parts of XBT.           */
+
+/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+#ifndef XBT_DATADESC_PRIVATE_H
+#define XBT_DATADESC_PRIVATE_H
+
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
+#include "xbt/set.h"
+
+#include "gras_config.h"        /* XBT_THISARCH */
+#include "xbt_modinter.h"       /* module init/exit */
+#include "datadesc_interface.h" /* semi-public API */
+
+/**
+ * ddt_aligned:
+ *
+ * Align the data v on the boundary a.
+ */
+#define ddt_aligned(v, a) (((v) + (a - 1)) & ~(a - 1))
+
+/*@null@*/ extern xbt_set_t xbt_datadesc_set_local;
+void xbt_ddt_freev(void *ddt);
+/*******************************************
+ * Descriptions of all known architectures *
+ *******************************************/
+
+#define xbt_arch_count 12
+typedef enum {
+  xbt_ddt_scalar_char = 0,
+  xbt_ddt_scalar_short = 1,
+  xbt_ddt_scalar_int = 2,
+  xbt_ddt_scalar_long = 3,
+  xbt_ddt_scalar_long_long = 4,
+
+  xbt_ddt_scalar_pdata = 5,
+  xbt_ddt_scalar_pfunc = 6,
+
+  xbt_ddt_scalar_float = 7,
+  xbt_ddt_scalar_double = 8
+} xbt_ddt_scalar_type_t;
+
+typedef struct {
+  const char *name;
+
+  int endian;
+
+  int sizeofs[9];               /* char,short,int,long,long_long,pdata,pfunc,float,double */
+  int boundaries[9];            /* idem */
+} xbt_arch_desc_t;
+
+extern const xbt_arch_desc_t xbt_arches[xbt_arch_count];
+extern const char *xbt_datadesc_cat_names[9];
+
+/**********************************************************/
+/* Actual definitions of the stuff in the type descriptor */
+/**********************************************************/
+
+/**
+ * e_xbt_datadesc_type_category:
+ *
+ * Defines all possible type categories.
+ */
+typedef enum e_xbt_datadesc_type_category {
+
+  /* if you edit this, also fix xbt_datadesc_cat_names in ddt_exchange.c */
+
+  e_xbt_datadesc_type_cat_undefined = 0,
+
+  e_xbt_datadesc_type_cat_scalar = 1,
+  e_xbt_datadesc_type_cat_struct = 2,
+  e_xbt_datadesc_type_cat_union = 3,
+  e_xbt_datadesc_type_cat_ref = 4,     /* ref to an uniq element */
+  e_xbt_datadesc_type_cat_array = 5,
+
+  e_xbt_datadesc_type_cat_invalid = 6
+} xbt_datadesc_type_category_t;
+
+/*------------------------------------------------*/
+/* definitions of specific data for each category */
+/*------------------------------------------------*/
+/**
+ * s_xbt_dd_cat_field:
+ *
+ * Fields of struct and union
+ */
+typedef struct s_xbt_dd_cat_field {
+
+  char *name;
+  long int offset[xbt_arch_count];
+  xbt_datadesc_type_t type;
+
+  xbt_datadesc_type_cb_void_t send;
+  xbt_datadesc_type_cb_void_t recv;
+
+} s_xbt_dd_cat_field_t, *xbt_dd_cat_field_t;
+
+void xbt_dd_cat_field_free(void *f);
+
+/**
+ * xbt_dd_cat_scalar_t:
+ *
+ * Specific fields of a scalar
+ */
+enum e_xbt_dd_scalar_encoding {
+  e_xbt_dd_scalar_encoding_undefined = 0,
+
+  e_xbt_dd_scalar_encoding_uint,
+  e_xbt_dd_scalar_encoding_sint,
+  e_xbt_dd_scalar_encoding_float,
+
+  e_xbt_dd_scalar_encoding_invalid
+};
+typedef struct s_xbt_dd_cat_scalar {
+  enum e_xbt_dd_scalar_encoding encoding;
+  xbt_ddt_scalar_type_t type;  /* to check easily that redefinition matches */
+} xbt_dd_cat_scalar_t;
+
+/**
+ * xbt_dd_cat_struct_t:
+ *
+ * Specific fields of a struct
+ */
+typedef struct s_xbt_dd_cat_struct {
+  xbt_dynar_t fields;           /* elm type = xbt_dd_cat_field_t */
+  int closed;                   /* xbt_datadesc_declare_struct_close() was called */
+} xbt_dd_cat_struct_t;
+
+/**
+ * xbt_dd_cat_union_t:
+ *
+ * Specific fields of a union
+ */
+typedef struct s_xbt_dd_cat_union {
+  xbt_datadesc_type_cb_int_t selector;
+  xbt_dynar_t fields;           /* elm type = xbt_dd_cat_field_t */
+  int closed;                   /* xbt_datadesc_declare_union_close() was called */
+} xbt_dd_cat_union_t;
+
+/**
+ * xbt_dd_cat_ref_t:
+ *
+ * Specific fields of a reference
+ */
+typedef struct s_xbt_dd_cat_ref {
+  xbt_datadesc_type_t type;
+
+  /* callback used to return the referenced type number  */
+  xbt_datadesc_selector_t selector;
+} xbt_dd_cat_ref_t;
+
+
+/**
+ * xbt_dd_cat_array_t:
+ *
+ * Specific fields of an array
+ */
+typedef struct s_xbt_dd_cat_array {
+  xbt_datadesc_type_t type;
+
+  /* element_count == -1 means dynamically defined */
+  long int fixed_size;
+
+  /* callback used to return the dynamic length */
+  xbt_datadesc_type_cb_int_t dynamic_size;
+
+} xbt_dd_cat_array_t;
+
+/**
+ * u_xbt_datadesc_category:
+ *
+ * Specific data to each possible category
+ */
+union u_xbt_datadesc_category {
+  void *undefined_data;
+  xbt_dd_cat_scalar_t scalar_data;
+  xbt_dd_cat_struct_t struct_data;
+  xbt_dd_cat_union_t union_data;
+  xbt_dd_cat_ref_t ref_data;
+  xbt_dd_cat_array_t array_data;
+};
+
+/****************************************/
+/* The holy grail: type descriptor type */
+/****************************************/
+/**
+ * s_xbt_datadesc_type:
+ *
+ * Type descriptor.
+ */
+typedef struct s_xbt_datadesc_type {
+  /* headers for the data set */
+  int code;
+  char *name;
+  unsigned int name_len;
+
+  /* payload */
+  long int size[xbt_arch_count];       /* Cannot be unsigned: -1 means dynamic */
+
+  unsigned long int alignment[xbt_arch_count];
+  unsigned long int aligned_size[xbt_arch_count];
+
+  enum e_xbt_datadesc_type_category category_code;
+  union u_xbt_datadesc_category category;
+
+  xbt_datadesc_type_cb_void_t send;
+  xbt_datadesc_type_cb_void_t recv;
+
+  /* flags */
+  int cycle:1;
+
+  /* random value for users (like default value or whatever) */
+  char extra[SIZEOF_MAX];
+
+} s_xbt_datadesc_type_t;
+
+/***************************
+ * constructor/desctructor *
+ ***************************/
+void xbt_datadesc_free(xbt_datadesc_type_t * type);
+
+xbt_datadesc_type_t
+xbt_datadesc_scalar(const char *name,
+                     xbt_ddt_scalar_type_t type,
+                     enum e_xbt_dd_scalar_encoding encoding);
+
+/****************************************************
+ * Callback persistant state constructor/destructor *
+ ****************************************************/
+xbt_cbps_t xbt_cbps_new(void);
+void xbt_cbps_free(xbt_cbps_t * state);
+void xbt_cbps_reset(xbt_cbps_t state);
+
+/***************
+ * Convertions *
+ ***************/
+void
+xbt_dd_convert_elm(xbt_datadesc_type_t type, int count,
+                    int r_arch, void *src, void *dst);
+
+/********************************************************************
+ * Dictionnary containing the constant values for the parsing macro *
+ ********************************************************************/
+extern xbt_dict_t xbt_dd_constants;    /* lives in ddt_parse.c of course */
+
+#endif                          /* XBT_DATADESC_PRIVATE_H */
similarity index 69%
rename from src/gras/DataDesc/ddt_convert.c
rename to src/xbt/datadesc/ddt_convert.c
index 1d9c1cd..2c6758c 100644 (file)
 /* C combines the power of assembler with the portability of assembler. */
 /************************************************************************/
 
-#include "gras/DataDesc/datadesc_private.h"
+#include "datadesc_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_convert, gras_ddt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_convert, xbt_ddt,
                                 "Inter-architecture convertions");
 
 /***
  *** Table of all known architectures:
  ***
-l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1: #gras_arch=0;  gras_size=32; gras_arch_name=little32_1;
-l_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2: #gras_arch=1;  gras_size=32; gras_arch_name=little32_2;
-l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4: #gras_arch=2;  gras_size=32; gras_arch_name=little32_4;
-l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8: #gras_arch=3;  gras_size=32; gras_arch_name=little32_8;
-l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8: #gras_arch=4;  gras_size=64; gras_arch_name=little64;
-l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:8/8:8/8:_D:4/4:8/8: #gras_arch=5;  gras_size=64; gras_arch_name=little64_2;
-
-B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8: #gras_arch=6;  gras_size=32; gras_arch_name=big32_8;
-B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4: #gras_arch=7;  gras_size=32; gras_arch_name=big32_8_4;
-B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4: #gras_arch=8;  gras_size=32; gras_arch_name=big32_4;
-B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2: #gras_arch=9;  gras_size=32; gras_arch_name=big32_2;
-B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8: #gras_arch=10; gras_size=64; gras_arch_name=big64;
-B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4: #gras_arch=11; gras_size=64; gras_arch_name=big64_8_4;
+l_C:1/1:_I:2/1:4/1:4/1:8/1:_P:4/1:4/1:_D:4/1:8/1: #xbt_arch=0;  xbt_size=32; xbt_arch_name=little32_1;
+l_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2: #xbt_arch=1;  xbt_size=32; xbt_arch_name=little32_2;
+l_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4: #xbt_arch=2;  xbt_size=32; xbt_arch_name=little32_4;
+l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8: #xbt_arch=3;  xbt_size=32; xbt_arch_name=little32_8;
+l_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8: #xbt_arch=4;  xbt_size=64; xbt_arch_name=little64;
+l_C:1/1:_I:2/2:4/4:4/4:8/8:_P:8/8:8/8:_D:4/4:8/8: #xbt_arch=5;  xbt_size=64; xbt_arch_name=little64_2;
+
+B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/8: #xbt_arch=6;  xbt_size=32; xbt_arch_name=big32_8;
+B_C:1/1:_I:2/2:4/4:4/4:8/8:_P:4/4:4/4:_D:4/4:8/4: #xbt_arch=7;  xbt_size=32; xbt_arch_name=big32_8_4;
+B_C:1/1:_I:2/2:4/4:4/4:8/4:_P:4/4:4/4:_D:4/4:8/4: #xbt_arch=8;  xbt_size=32; xbt_arch_name=big32_4;
+B_C:1/1:_I:2/2:4/2:4/2:8/2:_P:4/2:4/2:_D:4/2:8/2: #xbt_arch=9;  xbt_size=32; xbt_arch_name=big32_2;
+B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/8: #xbt_arch=10; xbt_size=64; xbt_arch_name=big64;
+B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4: #xbt_arch=11; xbt_size=64; xbt_arch_name=big64_8_4;
 
   PLEASE DO NOT MESS WITH THESE HARDCODED VALUES
   
@@ -39,7 +39,7 @@ B_C:1/1:_I:2/2:4/4:8/8:8/8:_P:8/8:8/8:_D:4/4:8/4: #gras_arch=11; gras_size=64; g
   
  ***/
 
-const gras_arch_desc_t gras_arches[gras_arch_count] = {
+const xbt_arch_desc_t xbt_arches[xbt_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}},
@@ -78,32 +78,32 @@ const gras_arch_desc_t gras_arches[gras_arch_count] = {
    {1, 2, 4, 8, 8, 8, 8, 4, 4}}
 };
 
-const char *gras_datadesc_arch_name(int code)
+const char *xbt_datadesc_arch_name(int code)
 {
-  if (code < 0 || code >= gras_arch_count)
+  if (code < 0 || code >= xbt_arch_count)
     return "[unknown arch]";
-  return gras_arches[code].name;
+  return xbt_arches[code].name;
 }
 
 
 /**
  * Local function doing the grunt work
  */
-static void gras_dd_reverse_bytes(void *to, const void *from,
+static void xbt_dd_reverse_bytes(void *to, const void *from,
                                   size_t length);
 
 /**
- * gras_dd_convert_elm:
+ * xbt_dd_convert_elm:
  *
  * Convert the element described by @type comming from architecture @r_arch.
  * The data to be converted is stored in @src, and is to be stored in @dst.
  * Both pointers may be the same location if no resizing is needed.
  */
 void
-gras_dd_convert_elm(gras_datadesc_type_t type, int count,
+xbt_dd_convert_elm(xbt_datadesc_type_t type, int count,
                     int r_arch, void *src, void *dst)
 {
-  gras_dd_cat_scalar_t scal = type->category.scalar_data;
+  xbt_dd_cat_scalar_t scal = type->category.scalar_data;
   int cpt;
   const void *r_data;
   void *l_data;
@@ -115,7 +115,7 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
      } tester;
    */
 
-  xbt_assert(type->category_code == e_gras_datadesc_type_cat_scalar);
+  xbt_assert(type->category_code == e_xbt_datadesc_type_cat_scalar);
   xbt_assert(r_arch != GRAS_THISARCH);
 
   r_size = type->size[r_arch];
@@ -123,8 +123,8 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
   XBT_DEBUG("r_size=%lu l_size=%lu,    src=%p dst=%p", r_size, l_size, src,
          dst);
 
-  XBT_DEBUG("remote=%c local=%c", gras_arches[r_arch].endian ? 'B' : 'l',
-         gras_arches[GRAS_THISARCH].endian ? 'B' : 'l');
+  XBT_DEBUG("remote=%c local=%c", xbt_arches[r_arch].endian ? 'B' : 'l',
+         xbt_arches[GRAS_THISARCH].endian ? 'B' : 'l');
 
   if (r_size != l_size) {
     for (cpt = 0, r_data = src, l_data = dst;
@@ -148,8 +148,8 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
       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;
+      int lowOrderFirst = !xbt_arches[r_arch].endian ||
+          xbt_arches[r_arch].endian == xbt_arches[GRAS_THISARCH].endian;
 
       XBT_DEBUG("Resize integer %d from %lu @%p to %lu @%p",
              cpt, r_size, r_data, l_size, l_data);
@@ -159,19 +159,19 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
         XBT_DEBUG("Truncate %d bytes (%s,%s)", -sizeChange,
                lowOrderFirst ? "lowOrderFirst" : "bigOrderFirst",
                scal.encoding ==
-               e_gras_dd_scalar_encoding_sint ? "signed" : "unsigned");
+               e_xbt_dd_scalar_encoding_sint ? "signed" : "unsigned");
         /* Truncate high-order bytes. */
         memcpy(l_data,
-               gras_arches[r_arch].endian ? ((char *) r_data - sizeChange)
+               xbt_arches[r_arch].endian ? ((char *) r_data - sizeChange)
                : r_data, l_size);
 
-        if (scal.encoding == e_gras_dd_scalar_encoding_sint) {
+        if (scal.encoding == e_xbt_dd_scalar_encoding_sint) {
           XBT_DEBUG("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
+          l_sign = xbt_arches[GRAS_THISARCH].endian
               ? ((unsigned char *) l_data + l_size - 1)
               : (unsigned char *) l_data;
-          r_sign = gras_arches[r_arch].endian
+          r_sign = xbt_arches[r_arch].endian
               ? ((unsigned char *) r_data + r_size - 1)
               : (unsigned char *) r_data;
           XBT_DEBUG("This is signed (r_sign=%c l_sign=%c", *r_sign, *l_sign);
@@ -185,13 +185,13 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
         }
       } else {
         XBT_DEBUG("Extend %d bytes", sizeChange);
-        if (scal.encoding != e_gras_dd_scalar_encoding_sint) {
+        if (scal.encoding != e_xbt_dd_scalar_encoding_sint) {
           XBT_DEBUG("This is signed");
           padding = 0;          /* pad unsigned with 0 */
         } else {
           /* extend sign */
           r_sign =
-              gras_arches[r_arch].endian ? ((unsigned char *) r_data +
+              xbt_arches[r_arch].endian ? ((unsigned char *) r_data +
                                             r_size - 1)
               : (unsigned char *) r_data;
           padding = (*r_sign > 127) ? 0xff : 0;
@@ -200,7 +200,7 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
         if (l_size != 0) {
           memset(l_data, padding, l_size);
         }
-        memcpy(!gras_arches[r_arch].endian ? l_data
+        memcpy(!xbt_arches[r_arch].endian ? l_data
                : ((char *) l_data + sizeChange), r_data, r_size);
 
         /*
@@ -224,20 +224,20 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
   }
 
   /* flip bytes if needed */
-  if (gras_arches[r_arch].endian != gras_arches[GRAS_THISARCH].endian &&
+  if (xbt_arches[r_arch].endian != xbt_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) {
 
       XBT_DEBUG("Flip elm %d", cpt);
-      gras_dd_reverse_bytes(l_data, r_data, l_size);
+      xbt_dd_reverse_bytes(l_data, r_data, l_size);
     }
   }
 
 }
 
-static void gras_dd_reverse_bytes(void *to, const void *from,
+static void xbt_dd_reverse_bytes(void *to, const void *from,
                                   size_t length)
 {
 
@@ -261,11 +261,11 @@ static void gras_dd_reverse_bytes(void *to, const void *from,
 
 
 /**
- * gras_arch_selfid:
+ * xbt_arch_selfid:
  *
  * returns the ID of the architecture the process is running on
  */
-int gras_arch_selfid(void)
+int xbt_arch_selfid(void)
 {
   return GRAS_THISARCH;
 }
similarity index 67%
rename from src/gras/DataDesc/ddt_create.c
rename to src/xbt/datadesc/ddt_create.c
index ece97c0..7d2b028 100644 (file)
@@ -8,53 +8,53 @@
 
 #include "xbt/misc.h"           /* min()/max() */
 #include "xbt/ex.h"
-#include "gras/DataDesc/datadesc_private.h"
+#include "datadesc_private.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_create, gras_ddt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_create, xbt_ddt,
                                 "Creating new datadescriptions");
 
 /*** prototypes ***/
-static gras_dd_cat_field_t
-gras_dd_find_field(gras_datadesc_type_t type, const char *field_name);
+static xbt_dd_cat_field_t
+xbt_dd_find_field(xbt_datadesc_type_t type, const char *field_name);
 /**
- * gras_ddt_freev:
+ * xbt_ddt_freev:
  *
  * gime that memory back, dude. I mean it.
  */
-void gras_ddt_freev(void *ddt)
+void xbt_ddt_freev(void *ddt)
 {
-  gras_datadesc_type_t type = (gras_datadesc_type_t) ddt;
+  xbt_datadesc_type_t type = (xbt_datadesc_type_t) ddt;
 
   if (type) {
-    gras_datadesc_free(&type);
+    xbt_datadesc_free(&type);
   }
 }
 
-static gras_datadesc_type_t gras_ddt_new(const char *name)
+static xbt_datadesc_type_t xbt_ddt_new(const char *name)
 {
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
 
   XBT_IN("(%s)", name);
-  res = xbt_new0(s_gras_datadesc_type_t, 1);
+  res = xbt_new0(s_xbt_datadesc_type_t, 1);
 
   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_set_add(xbt_datadesc_set_local, (xbt_set_elm_t) res,
+              xbt_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_datadesc_type_t xbt_datadesc_by_name_or_null(const char *name)
 {
   xbt_ex_t e;
-  gras_datadesc_type_t res = NULL;
+  xbt_datadesc_type_t res = NULL;
 
   TRY {
-    res = gras_datadesc_by_name(name);
+    res = xbt_datadesc_by_name(name);
   }
   CATCH(e) {
     res = NULL;
@@ -66,14 +66,14 @@ gras_datadesc_type_t gras_datadesc_by_name_or_null(const char *name)
 /**
  * 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_datadesc_type_t xbt_datadesc_by_name(const char *name)
 {
   xbt_ex_t e;
-  gras_datadesc_type_t res = NULL;
+  xbt_datadesc_type_t res = NULL;
   volatile int found = 0;
   TRY {
     res =
-        (gras_datadesc_type_t) xbt_set_get_by_name(gras_datadesc_set_local,
+        (xbt_datadesc_type_t) xbt_set_get_by_name(xbt_datadesc_set_local,
                                                    name);
     found = 1;
   }
@@ -92,13 +92,13 @@ gras_datadesc_type_t gras_datadesc_by_name(const char *name)
 /**
  * Retrieve a type from its code (or NULL if not found)
  */
-gras_datadesc_type_t gras_datadesc_by_id(long int code)
+xbt_datadesc_type_t xbt_datadesc_by_id(long int code)
 {
   xbt_ex_t e;
-  gras_datadesc_type_t res = NULL;
+  xbt_datadesc_type_t res = NULL;
   TRY {
     res =
-        (gras_datadesc_type_t) xbt_set_get_by_id(gras_datadesc_set_local,
+        (xbt_datadesc_type_t) xbt_set_get_by_id(xbt_datadesc_set_local,
                                                  code);
   }
   CATCH(e) {
@@ -113,19 +113,19 @@ gras_datadesc_type_t gras_datadesc_by_id(long int code)
 /**
  * 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)
+xbt_datadesc_type_t
+xbt_datadesc_scalar(const char *name,
+                     xbt_ddt_scalar_type_t type,
+                     enum e_xbt_dd_scalar_encoding encoding)
 {
 
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
   long int arch;
 
   XBT_IN("");
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
   if (res) {
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_scalar,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_scalar,
                 "Redefinition of type %s does not match", name);
     xbt_assert(res->category.scalar_data.encoding == encoding,
                 "Redefinition of type %s does not match", name);
@@ -134,16 +134,16 @@ gras_datadesc_scalar(const char *name,
     XBT_VERB("Discarding redefinition of %s", name);
     return res;
   }
-  res = gras_ddt_new(name);
+  res = xbt_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];
+  for (arch = 0; arch < xbt_arch_count; arch++) {
+    res->size[arch] = xbt_arches[arch].sizeofs[type];
+    res->alignment[arch] = xbt_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_code = e_xbt_datadesc_type_cat_scalar;
   res->category.scalar_data.encoding = encoding;
   res->category.scalar_data.type = type;
   XBT_OUT();
@@ -153,9 +153,9 @@ gras_datadesc_scalar(const char *name,
 
 
 /** Frees one struct or union field */
-void gras_dd_cat_field_free(void *f)
+void xbt_dd_cat_field_free(void *f)
 {
-  gras_dd_cat_field_t field = *(gras_dd_cat_field_t *) f;
+  xbt_dd_cat_field_t field = *(xbt_dd_cat_field_t *) f;
   XBT_IN("");
   if (field) {
     free(field->name);
@@ -165,31 +165,31 @@ void gras_dd_cat_field_free(void *f)
 }
 
 /** \brief Declare a new structure description */
-gras_datadesc_type_t gras_datadesc_struct(const char *name)
+xbt_datadesc_type_t xbt_datadesc_struct(const char *name)
 {
 
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
   long int arch;
 
   XBT_IN("(%s)", name);
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
   if (res) {
     /* FIXME: Check that field redefinition matches */
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_struct,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_struct,
                 "Redefinition of type %s does not match", name);
     XBT_DEBUG("Discarding redefinition of %s", name);
     return res;
   }
-  res = gras_ddt_new(name);
+  res = xbt_ddt_new(name);
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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_code = e_xbt_datadesc_type_cat_struct;
   res->category.struct_data.fields =
-      xbt_dynar_new(sizeof(gras_dd_cat_field_t), gras_dd_cat_field_free);
+      xbt_dynar_new(sizeof(xbt_dd_cat_field_t), xbt_dd_cat_field_free);
 
   XBT_OUT();
   return res;
@@ -197,12 +197,12 @@ gras_datadesc_type_t gras_datadesc_struct(const char *name)
 
 /** \brief Append a new field to a structure description */
 void
-gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
+xbt_datadesc_struct_append(xbt_datadesc_type_t struct_type,
                             const char *name,
-                            gras_datadesc_type_t field_type)
+                            xbt_datadesc_type_t field_type)
 {
 
-  gras_dd_cat_field_t field;
+  xbt_dd_cat_field_t field;
   int arch;
 
   xbt_assert(field_type,
@@ -220,7 +220,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
               "Cannot add a dynamically sized field in structure %s",
               struct_type->name);
 
-  field = xbt_new(s_gras_dd_cat_field_t, 1);
+  field = xbt_new(s_xbt_dd_cat_field_t, 1);
   field->name = (char *) strdup(name);
 
   XBT_DEBUG("----------------");
@@ -230,7 +230,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
          struct_type->aligned_size[GRAS_THISARCH]);
 
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_arch_count; arch++) {
     field->offset[arch] = ddt_aligned(struct_type->size[arch],
                                       field_type->alignment[arch]);
 
@@ -265,12 +265,12 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
  *
  * 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)
+void xbt_datadesc_struct_close(xbt_datadesc_type_t struct_type)
 {
   int arch;
   XBT_IN("");
   struct_type->category.struct_data.closed = 1;
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_arch_count; arch++) {
     struct_type->size[arch] = struct_type->aligned_size[arch];
   }
   XBT_DEBUG("structure %s closed. size=%ld,align=%ld,asize=%ld",
@@ -281,47 +281,47 @@ void gras_datadesc_struct_close(gras_datadesc_type_t struct_type)
 }
 
 /**
- * gras_datadesc_cycle_set:
+ * xbt_datadesc_cycle_set:
  *
- * Tell GRAS that the pointers of the type described by ddt may present
+ * Tell XBT that the pointers of the type described by ddt may present
  * some loop, and that the cycle detection mechanism is needed.
  *
  * 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)
+void xbt_datadesc_cycle_set(xbt_datadesc_type_t ddt)
 {
   ddt->cycle = 1;
 }
 
 /**
- * gras_datadesc_cycle_unset:
+ * xbt_datadesc_cycle_unset:
  *
- * Tell GRAS that the pointers of the type described by ddt do not present
+ * Tell XBT that the pointers of the type described by ddt do not present
  * any loop and that cycle detection mechanism are not needed.
  * (default)
  */
-void gras_datadesc_cycle_unset(gras_datadesc_type_t ddt)
+void xbt_datadesc_cycle_unset(xbt_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)
+xbt_datadesc_type_t
+xbt_datadesc_union(const char *name, xbt_datadesc_type_cb_int_t selector)
 {
 
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
   int arch;
 
   XBT_IN("(%s)", name);
   xbt_assert(selector,
               "Attempt to creat an union without field_count function");
 
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
   if (res) {
     /* FIXME: Check that field redefinition matches */
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_union,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_union,
                 "Redefinition of type %s does not match", name);
     xbt_assert(res->category.union_data.selector == selector,
                 "Redefinition of type %s does not match", name);
@@ -329,29 +329,29 @@ gras_datadesc_union(const char *name, gras_datadesc_type_cb_int_t selector)
     return res;
   }
 
-  res = gras_ddt_new(name);
+  res = xbt_ddt_new(name);
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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_code = e_xbt_datadesc_type_cat_union;
   res->category.union_data.fields =
-      xbt_dynar_new(sizeof(gras_dd_cat_field_t *), gras_dd_cat_field_free);
+      xbt_dynar_new(sizeof(xbt_dd_cat_field_t *), xbt_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,
+void xbt_datadesc_union_append(xbt_datadesc_type_t union_type,
                                 const char *name,
-                                gras_datadesc_type_t field_type)
+                                xbt_datadesc_type_t field_type)
 {
 
-  gras_dd_cat_field_t field;
+  xbt_dd_cat_field_t field;
   int arch;
 
   XBT_IN("(%s %s.%s;)", field_type->name, union_type->name, name);
@@ -365,7 +365,7 @@ void gras_datadesc_union_append(gras_datadesc_type_t union_type,
     return;
   }
 
-  field = xbt_new0(s_gras_dd_cat_field_t, 1);
+  field = xbt_new0(s_xbt_dd_cat_field_t, 1);
 
   field->name = (char *) strdup(name);
   field->type = field_type;
@@ -373,7 +373,7 @@ void gras_datadesc_union_append(gras_datadesc_type_t union_type,
 
   xbt_dynar_push(union_type->category.union_data.fields, &field);
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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],
@@ -389,7 +389,7 @@ 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)
+void xbt_datadesc_union_close(xbt_datadesc_type_t union_type)
 {
   union_type->category.union_data.closed = 1;
 }
@@ -398,32 +398,32 @@ void 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)
+xbt_datadesc_type_t
+xbt_datadesc_copy(const char *name, xbt_datadesc_type_t copied)
 {
 
-  gras_datadesc_type_t res = gras_ddt_new(name);
+  xbt_datadesc_type_t res = xbt_ddt_new(name);
   char *name_cpy = res->name;
 
-  memcpy(res, copied, sizeof(s_gras_datadesc_type_t));
+  memcpy(res, copied, sizeof(s_xbt_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)
+xbt_datadesc_type_t
+xbt_datadesc_ref(const char *name, xbt_datadesc_type_t referenced_type)
 {
 
-  gras_datadesc_type_t res;
-  gras_datadesc_type_t pointer_type =
-      gras_datadesc_by_name("data pointer");
+  xbt_datadesc_type_t res;
+  xbt_datadesc_type_t pointer_type =
+      xbt_datadesc_by_name("data pointer");
   int arch;
 
   XBT_IN("(%s)", name);
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
   if (res) {
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_ref,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_ref,
                 "Redefinition of %s does not match", name);
     xbt_assert(res->category.ref_data.type == referenced_type,
                 "Redefinition of %s does not match", name);
@@ -433,17 +433,17 @@ gras_datadesc_ref(const char *name, gras_datadesc_type_t referenced_type)
     return res;
   }
 
-  res = gras_ddt_new(name);
+  res = xbt_ddt_new(name);
 
   xbt_assert(pointer_type, "Cannot get the description of data pointer");
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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_code = e_xbt_datadesc_type_cat_ref;
   res->category.ref_data.type = referenced_type;
   res->category.ref_data.selector = NULL;
 
@@ -453,24 +453,24 @@ gras_datadesc_ref(const char *name, gras_datadesc_type_t referenced_type)
 /** \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.
- * So, when GRAS wants to send a generic reference, it passes the current data to the selector
+ * So, when XBT wants to send a generic reference, it passes the current data to the selector
  * 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)
+xbt_datadesc_type_t
+xbt_datadesc_ref_generic(const char *name,
+                          xbt_datadesc_selector_t selector)
 {
 
-  gras_datadesc_type_t res;
-  gras_datadesc_type_t pointer_type =
-      gras_datadesc_by_name("data pointer");
+  xbt_datadesc_type_t res;
+  xbt_datadesc_type_t pointer_type =
+      xbt_datadesc_by_name("data pointer");
   int arch;
 
   XBT_IN("(%s)", name);
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
 
   if (res) {
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_ref,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_ref,
                 "Redefinition of type %s does not match", name);
     xbt_assert(res->category.ref_data.type == NULL,
                 "Redefinition of type %s does not match", name);
@@ -479,17 +479,17 @@ gras_datadesc_ref_generic(const char *name,
     XBT_VERB("Discarding redefinition of %s", name);
     return res;
   }
-  res = gras_ddt_new(name);
+  res = xbt_ddt_new(name);
 
   xbt_assert(pointer_type, "Cannot get the description of data pointer");
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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_code = e_xbt_datadesc_type_cat_ref;
 
   res->category.ref_data.type = NULL;
   res->category.ref_data.selector = selector;
@@ -498,27 +498,27 @@ gras_datadesc_ref_generic(const char *name,
 }
 
 /** \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,
+xbt_datadesc_type_t
+xbt_datadesc_array_fixed(const char *name,
+                          xbt_datadesc_type_t element_type,
                           long int fixed_size)
 {
 
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
   int arch;
 
   XBT_IN("(%s)", name);
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
   if (res) {
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_array,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_array,
                 "Redefinition of type %s does not match", name);
 
     if (res->category.array_data.type != element_type) {
       XBT_ERROR
           ("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_datadesc_type_dump(res->category.array_data.type);
+      xbt_datadesc_type_dump(element_type);
     }
 
     xbt_assert(res->category.array_data.fixed_size == fixed_size,
@@ -529,17 +529,17 @@ gras_datadesc_array_fixed(const char *name,
 
     return res;
   }
-  res = gras_ddt_new(name);
+  res = xbt_ddt_new(name);
 
   xbt_assert(fixed_size >= 0, "'%s' is a array of negative fixed size",
               name);
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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_code = e_xbt_datadesc_type_cat_array;
 
   res->category.array_data.type = element_type;
   res->category.array_data.fixed_size = fixed_size;
@@ -549,23 +549,23 @@ gras_datadesc_array_fixed(const char *name,
 }
 
 /** \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
+xbt_datadesc_type_t xbt_datadesc_array_dyn(const char *name,
+                                             xbt_datadesc_type_t
                                              element_type,
-                                             gras_datadesc_type_cb_int_t
+                                             xbt_datadesc_type_cb_int_t
                                              dynamic_size)
 {
 
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
   int arch;
 
   XBT_IN("(%s)", name);
   xbt_assert(dynamic_size,
               "'%s' is a dynamic array without size discriminant", name);
 
-  res = gras_datadesc_by_name_or_null(name);
+  res = xbt_datadesc_by_name_or_null(name);
   if (res) {
-    xbt_assert(res->category_code == e_gras_datadesc_type_cat_array,
+    xbt_assert(res->category_code == e_xbt_datadesc_type_cat_array,
                 "Redefinition of type %s does not match", name);
     xbt_assert(res->category.array_data.type == element_type,
                 "Redefinition of type %s does not match", name);
@@ -578,15 +578,15 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char *name,
     return res;
   }
 
-  res = gras_ddt_new(name);
+  res = xbt_ddt_new(name);
 
-  for (arch = 0; arch < gras_arch_count; arch++) {
+  for (arch = 0; arch < xbt_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_code = e_xbt_datadesc_type_cat_array;
 
   res->category.array_data.type = element_type;
   res->category.array_data.fixed_size = -1;
@@ -595,7 +595,7 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char *name,
   return res;
 }
 
-/** \brief Declare a new type being an array which size can be found with \ref gras_cbps_i_pop
+/** \brief Declare a new type being an array which size can be found with \ref xbt_cbps_i_pop
  *
  * Most of the time, you want to include a reference in your structure which
  * is a pointer to a dynamic array whose size is fixed by another field of
@@ -609,7 +609,7 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char *name,
  * '[]*' appended to it.
  *
  * Then to use it, you just have to make sure that your structure pre-callback
- * does push the size of the array in the cbps (using #gras_cbps_i_push), and
+ * does push the size of the array in the cbps (using #xbt_cbps_i_push), and
  * you are set.
  *
  * But be remember that this is a stack. If you have two different pop_arr, you
@@ -617,35 +617,35 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char *name,
  * list when the first field gets transfered.
  *
  */
-gras_datadesc_type_t
-gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type)
+xbt_datadesc_type_t
+xbt_datadesc_ref_pop_arr(xbt_datadesc_type_t element_type)
 {
   int cpt = 0;
-  gras_datadesc_type_t res, ddt2;
+  xbt_datadesc_type_t res, ddt2;
   char *name = (char *) xbt_malloc(strlen(element_type->name) + 4);
 
   sprintf(name, "%s[]", element_type->name);
   /* Make sure we are not trying to redefine a ddt with the same name */
-  ddt2 = gras_datadesc_by_name_or_null(name);
+  ddt2 = xbt_datadesc_by_name_or_null(name);
 
   while (ddt2) {
     free(name);
     name = bprintf("%s[]_%d", element_type->name, cpt++);
-    ddt2 = gras_datadesc_by_name_or_null(name);
+    ddt2 = xbt_datadesc_by_name_or_null(name);
   }
 
-  res = gras_datadesc_array_dyn(name, element_type, gras_datadesc_cb_pop);
+  res = xbt_datadesc_array_dyn(name, element_type, xbt_datadesc_cb_pop);
 
   sprintf(name, "%s[]*", element_type->name);
   cpt = 0;
-  ddt2 = gras_datadesc_by_name_or_null(name);
+  ddt2 = xbt_datadesc_by_name_or_null(name);
   while (ddt2) {
     free(name);
     name = bprintf("%s[]*_%d", element_type->name, cpt++);
-    ddt2 = gras_datadesc_by_name_or_null(name);
+    ddt2 = xbt_datadesc_by_name_or_null(name);
   }
 
-  res = gras_datadesc_ref(name, res);
+  res = xbt_datadesc_ref(name, res);
 
   free(name);
 
@@ -658,16 +658,16 @@ gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type)
  *##
  */
 
-static void gras_datadesc_dynar_cb(gras_datadesc_type_t typedesc,
-                                   gras_cbps_t vars, void *data)
+static void xbt_datadesc_dynar_cb(xbt_datadesc_type_t typedesc,
+                                   xbt_cbps_t vars, void *data)
 {
-  gras_datadesc_type_t subtype;
+  xbt_datadesc_type_t subtype;
   xbt_dynar_t dynar = (xbt_dynar_t) data;
 
   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;
+  subtype = xbt_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;
@@ -689,60 +689,60 @@ static void gras_datadesc_dynar_cb(gras_datadesc_type_t typedesc,
  *  \param elm_t: the datadesc of the elements
  *  \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)
+xbt_datadesc_type_t
+xbt_datadesc_dynar(xbt_datadesc_type_t elm_t, void_f_pvoid_t free_func)
 {
 
   char *buffname;
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
 
   buffname = bprintf("s_xbt_dynar_of_%s", elm_t->name);
 
-  res = gras_datadesc_struct(buffname);
+  res = xbt_datadesc_struct(buffname);
 
-  gras_datadesc_struct_append(res, "size",
-                              gras_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(res, "size",
+                              xbt_datadesc_by_name("unsigned long int"));
 
-  gras_datadesc_struct_append(res, "used",
-                              gras_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(res, "used",
+                              xbt_datadesc_by_name("unsigned long int"));
 
-  gras_datadesc_struct_append(res, "elmsize",
-                              gras_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(res, "elmsize",
+                              xbt_datadesc_by_name("unsigned long int"));
 
-  gras_datadesc_struct_append(res, "data",
-                              gras_datadesc_ref_pop_arr(elm_t));
+  xbt_datadesc_struct_append(res, "data",
+                              xbt_datadesc_ref_pop_arr(elm_t));
 
-  gras_datadesc_struct_append(res, "free_f",
-                              gras_datadesc_by_name("function pointer"));
+  xbt_datadesc_struct_append(res, "free_f",
+                              xbt_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"));
+  xbt_datadesc_struct_append(res, "mutex",
+                              xbt_datadesc_by_name("data pointer"));
 
-  gras_datadesc_struct_close(res);
+  xbt_datadesc_struct_close(res);
 
-  gras_datadesc_cb_field_push(res, "used");
-  gras_datadesc_cb_recv(res, &gras_datadesc_dynar_cb);
+  xbt_datadesc_cb_field_push(res, "used");
+  xbt_datadesc_cb_recv(res, &xbt_datadesc_dynar_cb);
 
   /* build a ref to it */
   free(buffname);
   buffname = bprintf("xbt_dynar_of_%s", elm_t->name);
-  res = gras_datadesc_ref(buffname, res);
+  res = xbt_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)
+static void xbt_datadesc_matrix_cb(xbt_datadesc_type_t typedesc,
+                                    xbt_cbps_t vars, void *data)
 {
-  gras_datadesc_type_t subtype;
+  xbt_datadesc_type_t subtype;
   xbt_matrix_t matrix = (xbt_matrix_t) data;
 
   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;
+  subtype = xbt_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;
@@ -753,46 +753,46 @@ static void gras_datadesc_matrix_cb(gras_datadesc_type_t typedesc,
   matrix->elmsize = subtype->size[GRAS_THISARCH];
 }
 
-gras_datadesc_type_t
-gras_datadesc_matrix(gras_datadesc_type_t elm_t,
+xbt_datadesc_type_t
+xbt_datadesc_matrix(xbt_datadesc_type_t elm_t,
                      void_f_pvoid_t const free_f)
 {
   char *buffname;
-  gras_datadesc_type_t res;
+  xbt_datadesc_type_t res;
 
   buffname = bprintf("s_xbt_matrix_t(%s)", elm_t->name);
-  res = gras_datadesc_struct(buffname);
+  res = xbt_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"));
+  xbt_datadesc_struct_append(res, "lines",
+                              xbt_datadesc_by_name("unsigned int"));
+  xbt_datadesc_struct_append(res, "rows",
+                              xbt_datadesc_by_name("unsigned int"));
 
-  gras_datadesc_struct_append(res, "elmsize",
-                              gras_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(res, "elmsize",
+                              xbt_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);
+  xbt_datadesc_struct_append(res, "data",
+                              xbt_datadesc_ref_pop_arr(elm_t));
+  xbt_datadesc_struct_append(res, "free_f",
+                              xbt_datadesc_by_name("function pointer"));
+  xbt_datadesc_struct_close(res);
 
-  gras_datadesc_cb_field_push(res, "lines");
-  gras_datadesc_cb_field_push_multiplier(res, "rows");
+  xbt_datadesc_cb_field_push(res, "lines");
+  xbt_datadesc_cb_field_push_multiplier(res, "rows");
 
-  gras_datadesc_cb_recv(res, &gras_datadesc_matrix_cb);
+  xbt_datadesc_cb_recv(res, &xbt_datadesc_matrix_cb);
   memcpy(res->extra, &free_f, sizeof(free_f));
 
   /* build a ref to it */
   free(buffname);
   buffname = bprintf("xbt_matrix_t(%s)", elm_t->name);
-  res = gras_datadesc_ref(buffname, res);
+  res = xbt_datadesc_ref(buffname, res);
   free(buffname);
   return res;
 }
 
-gras_datadesc_type_t
-gras_datadesc_import_nws(const char *name,
+xbt_datadesc_type_t
+xbt_datadesc_import_nws(const char *name,
                          const DataDescriptor * desc,
                          unsigned long howmany)
 {
@@ -802,8 +802,8 @@ gras_datadesc_import_nws(const char *name,
 /**
  * (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)
+void xbt_datadesc_cb_send(xbt_datadesc_type_t type,
+                           xbt_datadesc_type_cb_void_t send)
 {
   type->send = send;
 }
@@ -811,28 +811,28 @@ void gras_datadesc_cb_send(gras_datadesc_type_t type,
 /**
  * (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)
+void xbt_datadesc_cb_recv(xbt_datadesc_type_t type,
+                           xbt_datadesc_type_cb_void_t recv)
 {
   type->recv = recv;
 }
 
 /*
- * gras_dd_find_field:
+ * xbt_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)
+static xbt_dd_cat_field_t
+xbt_dd_find_field(xbt_datadesc_type_t type, const char *field_name)
 {
   xbt_dynar_t field_array;
 
-  gras_dd_cat_field_t field = NULL;
+  xbt_dd_cat_field_t field = NULL;
   unsigned int field_num;
 
-  if (type->category_code == e_gras_datadesc_type_cat_union) {
+  if (type->category_code == e_xbt_datadesc_type_cat_union) {
     field_array = type->category.union_data.fields;
-  } else if (type->category_code == e_gras_datadesc_type_cat_struct) {
+  } else if (type->category_code == e_xbt_datadesc_type_cat_struct) {
     field_array = type->category.struct_data.fields;
   } else {
     XBT_ERROR("%s (%p) is not a struct nor an union. There is no field.",
@@ -853,12 +853,12 @@ gras_dd_find_field(gras_datadesc_type_t type, const char *field_name)
  * 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,
+void xbt_datadesc_cb_field_send(xbt_datadesc_type_t type,
                                  const char *field_name,
-                                 gras_datadesc_type_cb_void_t send)
+                                 xbt_datadesc_type_cb_void_t send)
 {
 
-  gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
+  xbt_dd_cat_field_t field = xbt_dd_find_field(type, field_name);
   field->send = send;
 }
 
@@ -866,25 +866,25 @@ void gras_datadesc_cb_field_send(gras_datadesc_type_t type,
 /**
  * The value, which must be an int, unsigned int, long int or unsigned long int
  * 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.
+ * \ref xbt_datadesc_ref_pop_arr or directly with \ref xbt_cbps_i_pop.
  */
-void gras_datadesc_cb_field_push(gras_datadesc_type_t type,
+void xbt_datadesc_cb_field_push(xbt_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;
+  xbt_dd_cat_field_t field = xbt_dd_find_field(type, field_name);
+  xbt_datadesc_type_t sub_type = field->type;
 
   XBT_DEBUG("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;
+    field->send = xbt_datadesc_cb_push_int;
   } else if (!strcmp("unsigned int", sub_type->name)) {
-    field->send = gras_datadesc_cb_push_uint;
+    field->send = xbt_datadesc_cb_push_uint;
   } else if (!strcmp("long int", sub_type->name)) {
-    field->send = gras_datadesc_cb_push_lint;
+    field->send = xbt_datadesc_cb_push_lint;
   } else if (!strcmp("unsigned long int", sub_type->name)) {
-    field->send = gras_datadesc_cb_push_ulint;
+    field->send = xbt_datadesc_cb_push_ulint;
   } else {
     XBT_ERROR
         ("Field %s is not an int, unsigned int, long int neither unsigned long int",
@@ -896,28 +896,28 @@ void gras_datadesc_cb_field_push(gras_datadesc_type_t type,
 /**
  * Any previously pushed value is poped and the field value is multiplied to
  * it. The result is then pushed back into the stack of sizes. It can then be
- * retrieved with \ref gras_datadesc_ref_pop_arr or directly with \ref
- * gras_cbps_i_pop.
+ * retrieved with \ref xbt_datadesc_ref_pop_arr or directly with \ref
+ * xbt_cbps_i_pop.
  *
  * 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,
+void xbt_datadesc_cb_field_push_multiplier(xbt_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;
+  xbt_dd_cat_field_t field = xbt_dd_find_field(type, field_name);
+  xbt_datadesc_type_t sub_type = field->type;
 
   XBT_DEBUG("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;
+    field->send = xbt_datadesc_cb_push_int_mult;
   } else if (!strcmp("unsigned int", sub_type->name)) {
-    field->send = gras_datadesc_cb_push_uint_mult;
+    field->send = xbt_datadesc_cb_push_uint_mult;
   } else if (!strcmp("long int", sub_type->name)) {
-    field->send = gras_datadesc_cb_push_lint_mult;
+    field->send = xbt_datadesc_cb_push_lint_mult;
   } else if (!strcmp("unsigned long int", sub_type->name)) {
-    field->send = gras_datadesc_cb_push_ulint_mult;
+    field->send = xbt_datadesc_cb_push_ulint_mult;
   } else {
     XBT_ERROR
         ("Field %s is not an int, unsigned int, long int neither unsigned long int",
@@ -930,35 +930,35 @@ void gras_datadesc_cb_field_push_multiplier(gras_datadesc_type_t type,
  * 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,
+void xbt_datadesc_cb_field_recv(xbt_datadesc_type_t type,
                                  const char *field_name,
-                                 gras_datadesc_type_cb_void_t recv)
+                                 xbt_datadesc_type_cb_void_t recv)
 {
 
-  gras_dd_cat_field_t field = gras_dd_find_field(type, field_name);
+  xbt_dd_cat_field_t field = xbt_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)
+void xbt_datadesc_free(xbt_datadesc_type_t * type)
 {
 
   XBT_DEBUG("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:
+  case e_xbt_datadesc_type_cat_scalar:
+  case e_xbt_datadesc_type_cat_ref:
+  case e_xbt_datadesc_type_cat_array:
     /* nothing to free in there */
     break;
 
-  case e_gras_datadesc_type_cat_struct:
+  case e_xbt_datadesc_type_cat_struct:
     xbt_dynar_free(&((*type)->category.struct_data.fields));
     break;
 
-  case e_gras_datadesc_type_cat_union:
+  case e_xbt_datadesc_type_cat_union:
     xbt_dynar_free(&((*type)->category.union_data.fields));
     break;
 
@@ -972,20 +972,20 @@ void gras_datadesc_free(gras_datadesc_type_t * type)
 }
 
 /**
- * gras_datadesc_type_cmp:
+ * xbt_datadesc_type_cmp:
  *
  * Compares two datadesc types with the same semantic than strcmp.
  *
  * This comparison does not take the set headers into account (name and ID),
  * 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 xbt_datadesc_type_cmp(const xbt_datadesc_type_t d1,
+                           const xbt_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;
+  xbt_dd_cat_field_t field1, field2;
+  xbt_datadesc_type_t field_desc_1, field_desc_2;
 
   if (d1 == d2)
     return 0;                   /* easy optimization */
@@ -1003,18 +1003,18 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
     return -1;
   }
 
-  for (cpt = 0; cpt < gras_arch_count; cpt++) {
+  for (cpt = 0; cpt < xbt_arch_count; cpt++) {
     if (d1->size[cpt] != d2->size[cpt]) {
       XBT_DEBUG("ddt_cmp: %s->size=%ld  !=  %s->size=%ld (on %s)",
              d1->name, d1->size[cpt], d2->name, d2->size[cpt],
-             gras_arches[cpt].name);
+             xbt_arches[cpt].name);
       return d1->size[cpt] > d2->size[cpt] ? 1 : -1;
     }
 
     if (d1->alignment[cpt] != d2->alignment[cpt]) {
       XBT_DEBUG("ddt_cmp: %s->alignment=%ld  !=  %s->alignment=%ld (on %s)",
              d1->name, d1->alignment[cpt], d2->name, d2->alignment[cpt],
-             gras_arches[cpt].name);
+             xbt_arches[cpt].name);
       return d1->alignment[cpt] > d2->alignment[cpt] ? 1 : -1;
     }
 
@@ -1022,15 +1022,15 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
       XBT_DEBUG
           ("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);
+           d2->aligned_size[cpt], xbt_arches[cpt].name);
       return d1->aligned_size[cpt] > d2->aligned_size[cpt] ? 1 : -1;
     }
   }
 
   if (d1->category_code != d2->category_code) {
     XBT_DEBUG("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]);
+           d1->name, xbt_datadesc_cat_names[d1->category_code],
+           d2->name, xbt_datadesc_cat_names[d2->category_code]);
     return d1->category_code > d2->category_code ? 1 : -1;
   }
 
@@ -1047,14 +1047,14 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
   }
 
   switch (d1->category_code) {
-  case e_gras_datadesc_type_cat_scalar:
+  case e_xbt_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:
+  case e_xbt_datadesc_type_cat_struct:
     if (xbt_dynar_length(d1->category.struct_data.fields) !=
         xbt_dynar_length(d2->category.struct_data.fields)) {
       XBT_DEBUG("ddt_cmp: %s (having %lu fields) !=  %s (having %lu fields)",
@@ -1068,10 +1068,10 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
 
       field2 =
           xbt_dynar_get_as(d2->category.struct_data.fields, cpt,
-                           gras_dd_cat_field_t);
+                           xbt_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);
+      ret = xbt_datadesc_type_cmp(field_desc_1, field_desc_2);
       if (ret) {
         XBT_DEBUG("%s->field[%d]=%s != %s->field[%d]=%s",
                d1->name, cpt, field1->name, d2->name, cpt, field2->name);
@@ -1081,7 +1081,7 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
     }
     break;
 
-  case e_gras_datadesc_type_cat_union:
+  case e_xbt_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 */
@@ -1095,10 +1095,10 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
 
       field2 =
           xbt_dynar_get_as(d2->category.union_data.fields, cpt,
-                           gras_dd_cat_field_t);
+                           xbt_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);
+      ret = xbt_datadesc_type_cmp(field_desc_1, field_desc_2);
       if (ret)
         return ret;
 
@@ -1106,7 +1106,7 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
     break;
 
 
-  case e_gras_datadesc_type_cat_ref:
+  case e_xbt_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 */
 
@@ -1115,7 +1115,7 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
           d2->category.ref_data.type ? 1 : -1;
     break;
 
-  case e_gras_datadesc_type_cat_array:
+  case e_xbt_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;
similarity index 73%
rename from src/gras/DataDesc/ddt_exchange.c
rename to src/xbt/datadesc/ddt_exchange.c
index 91da76f..12f601d 100644 (file)
@@ -7,52 +7,52 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/ex.h"
-#include "gras/DataDesc/datadesc_private.h"
-#include "gras/Transport/transport_interface.h" /* gras_trp_send/recv */
+#include "datadesc_private.h"
+#include "xbt/socket.h" /* xbt_trp_send/recv */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_exchange, gras_ddt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_exchange, xbt_ddt,
                                 "Sending data over the network");
-const char *gras_datadesc_cat_names[9] = {
+const char *xbt_datadesc_cat_names[9] = {
   "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_datadesc_type_t int_type = NULL;
+static xbt_datadesc_type_t pointer_type = NULL;
 
 static XBT_INLINE void
-gras_dd_send_int(gras_socket_t sock, int *i, int stable)
+xbt_dd_send_int(xbt_socket_t sock, int *i, int stable)
 {
 
   if (!int_type) {
-    int_type = gras_datadesc_by_name("int");
+    int_type = xbt_datadesc_by_name("int");
     xbt_assert(int_type);
   }
 
   XBT_DEBUG("send_int(%u)", *i);
-  gras_trp_send(sock, (char *) i, int_type->size[GRAS_THISARCH], stable);
+  xbt_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)
+xbt_dd_recv_int(xbt_socket_t sock, int r_arch, int *i)
 {
 
   if (!int_type) {
-    int_type = gras_datadesc_by_name("int");
+    int_type = xbt_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]);
+    xbt_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);
+      xbt_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]);
+    xbt_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);
+      xbt_dd_convert_elm(int_type, 1, r_arch, ptr, i);
     free(ptr);
   }
   XBT_DEBUG("recv_int(%u)", *i);
@@ -63,7 +63,7 @@ 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)
+static XBT_INLINE int xbt_dd_is_r_null(char **r_ptr, long int length)
 {
   int i;
 
@@ -76,7 +76,7 @@ static XBT_INLINE int gras_dd_is_r_null(char **r_ptr, long int length)
   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] */
+static XBT_INLINE void xbt_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;
@@ -89,7 +89,7 @@ static XBT_INLINE void gras_dd_alloc_ref(xbt_dict_t refs, long int size, char **
       ("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)) {
+  if (detect_cycle && r_ref && !xbt_dd_is_r_null(r_ref, r_len)) {
     void *ptr = xbt_malloc(sizeof(void *));
 
     memcpy(ptr, l_ref, sizeof(void *));
@@ -103,20 +103,20 @@ static XBT_INLINE void gras_dd_alloc_ref(xbt_dict_t refs, long int size, char **
 }
 
 static int
-gras_datadesc_memcpy_rec(gras_cbps_t state,
+xbt_datadesc_memcpy_rec(xbt_cbps_t state,
                          xbt_dict_t refs,
-                         gras_datadesc_type_t type,
+                         xbt_datadesc_type_t type,
                          char *src, char *dst, int subsize,
                          int detect_cycle)
 {
 
 
   unsigned int cpt;
-  gras_datadesc_type_t sub_type;        /* type on which we recurse */
+  xbt_datadesc_type_t sub_type;        /* type on which we recurse */
   int count = 0;
 
   XBT_VERB("Copy a %s (%s) from %p to %p (local sizeof=%ld)",
-        type->name, gras_datadesc_cat_names[type->category_code],
+        type->name, xbt_datadesc_cat_names[type->category_code],
         src, dst, type->size[GRAS_THISARCH]);
 
   if (type->send) {
@@ -124,20 +124,20 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
   }
 
   switch (type->category_code) {
-  case e_gras_datadesc_type_cat_scalar:
+  case e_xbt_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;
+  case e_xbt_datadesc_type_cat_struct:{
+      xbt_dd_cat_struct_t struct_data;
+      xbt_dd_cat_field_t field;
       char *field_src;
       char *field_dst;
 
       struct_data = type->category.struct_data;
       xbt_assert(struct_data.closed,
-                  "Please call gras_datadesc_declare_struct_close on %s before copying it",
+                  "Please call xbt_datadesc_declare_struct_close on %s before copying it",
                   type->name);
       XBT_VERB(">> Copy all fields of the structure %s", type->name);
       xbt_dynar_foreach(struct_data.fields, cpt, field) {
@@ -151,28 +151,28 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
 
         XBT_DEBUG("Copy field %s", field->name);
         count +=
-            gras_datadesc_memcpy_rec(state, refs, sub_type, field_src,
+            xbt_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")) {
+        if (XBT_LOG_ISENABLED(xbt_ddt_exchange, xbt_log_priority_verbose)) {
+          if (sub_type == xbt_datadesc_by_name("unsigned int")) {
             XBT_VERB("Copied value for field '%s': %d (type: unsigned int)",
                   field->name, *(unsigned int *) field_dst);
-          } else if (sub_type == gras_datadesc_by_name("int")) {
+          } else if (sub_type == xbt_datadesc_by_name("int")) {
             XBT_VERB("Copied value for field '%s': %d (type: int)",
                   field->name, *(int *) field_dst);
 
           } else if (sub_type ==
-                     gras_datadesc_by_name("unsigned long int")) {
+                     xbt_datadesc_by_name("unsigned long int")) {
             XBT_VERB
                 ("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")) {
+          } else if (sub_type == xbt_datadesc_by_name("long int")) {
             XBT_VERB("Copied value for field '%s': %ld (type: long int)",
                   field->name, *(long int *) field_dst);
 
-          } else if (sub_type == gras_datadesc_by_name("string")) {
+          } else if (sub_type == xbt_datadesc_by_name("string")) {
             XBT_VERB("Copied value for field '%s': '%s' (type: string)",
                   field->name, *(char **) field_dst);
           } else {
@@ -187,15 +187,15 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
       break;
     }
 
-  case e_gras_datadesc_type_cat_union:{
-      gras_dd_cat_union_t union_data;
-      gras_dd_cat_field_t field = NULL;
+  case e_xbt_datadesc_type_cat_union:{
+      xbt_dd_cat_union_t union_data;
+      xbt_dd_cat_field_t field = NULL;
       unsigned int field_num;
 
       union_data = type->category.union_data;
 
       xbt_assert(union_data.closed,
-                  "Please call gras_datadesc_declare_union_close on %s before copying it",
+                  "Please call xbt_datadesc_declare_union_close on %s before copying it",
                   type->name);
       /* retrieve the field number */
       field_num = union_data.selector(type, state, src);
@@ -212,20 +212,20 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
       /* Copy the content */
       field =
           xbt_dynar_get_as(union_data.fields, field_num,
-                           gras_dd_cat_field_t);
+                           xbt_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,
+      count += xbt_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;
+  case e_xbt_datadesc_type_cat_ref:{
+      xbt_dd_cat_ref_t ref_data;
       char **o_ref = NULL;
       char **n_ref = NULL;
       int reference_is_to_cpy;
@@ -263,14 +263,14 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
               (void *) *o_ref);
 
         if (!pointer_type) {
-          pointer_type = gras_datadesc_by_name("data pointer");
+          pointer_type = xbt_datadesc_by_name("data pointer");
           xbt_assert(pointer_type);
         }
 
-        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
+        if (sub_type->category_code == e_xbt_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;
+          xbt_dd_cat_array_t array_data = sub_type->category.array_data;
+          xbt_datadesc_type_t subsub_type;
 
           subsub_type = array_data.type;
           subsubcount = array_data.fixed_size;
@@ -279,18 +279,18 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
                 array_data.dynamic_size(subsub_type, state, *o_ref);
 
           if (subsubcount != 0)
-            gras_dd_alloc_ref(refs,
+            xbt_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],
+          xbt_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,
+        count += xbt_datadesc_memcpy_rec(state, refs, sub_type,
                                           *o_ref, (char *) l_referenced,
                                           subsubcount, detect_cycle
                                           || sub_type->cycle);
@@ -310,8 +310,8 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
       break;
     }
 
-  case e_gras_datadesc_type_cat_array:{
-      gras_dd_cat_array_t array_data;
+  case e_xbt_datadesc_type_cat_array:{
+      xbt_dd_cat_array_t array_data;
       unsigned long int array_count;
       char *src_ptr = src;
       char *dst_ptr = dst;
@@ -333,15 +333,15 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
       /* 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) {
+      if (sub_type->category_code == e_xbt_datadesc_type_cat_scalar) {
         XBT_VERB("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
+      } else if (sub_type->category_code == e_xbt_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) {
+                 e_xbt_datadesc_type_cat_scalar) {
 
         XBT_VERB("Array of %ld fixed array of scalars, copy it in one shot",
               array_count);
@@ -359,7 +359,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
         for (cpt = 0; cpt < array_count; cpt++) {
           XBT_VERB("Copy the %dth stuff out of %ld", cpt, array_count);
           count +=
-              gras_datadesc_memcpy_rec(state, refs, sub_type, src_ptr,
+              xbt_datadesc_memcpy_rec(state, refs, sub_type, src_ptr,
                                        dst_ptr, 0, detect_cycle
                                        || sub_type->cycle);
           src_ptr += elm_size;
@@ -377,35 +377,35 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
 }
 
 /**
- * gras_datadesc_memcpy:
+ * xbt_datadesc_memcpy:
  *
  * Copy the data pointed by src and described by type
  * 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)
+int xbt_datadesc_memcpy(xbt_datadesc_type_t type, void *src, void *dst)
 {
-  static gras_cbps_t state = NULL;
+  static xbt_cbps_t state = NULL;
   static xbt_dict_t refs = NULL;        /* all references already sent */
   int size = 0;
 
   xbt_assert(type, "called with NULL type descriptor");
 
-  XBT_DEBUG("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src,
+  XBT_DEBUG("Memcopy a %s from %p to %p", xbt_datadesc_get_name(type), src,
          dst);
   if (!state) {
-    state = gras_cbps_new();
+    state = xbt_cbps_new();
     refs = xbt_dict_new_homogeneous(xbt_free_f);
   }
 
   TRY {
     size =
-        gras_datadesc_memcpy_rec(state, refs, type, (char *) src,
+        xbt_datadesc_memcpy_rec(state, refs, type, (char *) src,
                                  (char *) dst, 0, type->cycle);
   }
   TRY_CLEANUP {
     xbt_dict_reset(refs);
-    gras_cbps_reset(state);
+    xbt_cbps_reset(state);
   }
   CATCH_ANONYMOUS {
     RETHROW;
@@ -418,18 +418,18 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst)
  ***/
 
 static void
-gras_datadesc_send_rec(gras_socket_t sock,
-                       gras_cbps_t state,
+xbt_datadesc_send_rec(xbt_socket_t sock,
+                       xbt_cbps_t state,
                        xbt_dict_t refs,
-                       gras_datadesc_type_t type,
+                       xbt_datadesc_type_t type,
                        char *data, int detect_cycle)
 {
 
   unsigned int cpt;
-  gras_datadesc_type_t sub_type;        /* type on which we recurse */
+  xbt_datadesc_type_t sub_type;        /* type on which we recurse */
 
   XBT_VERB("Send a %s (%s)",
-        type->name, gras_datadesc_cat_names[type->category_code]);
+        type->name, xbt_datadesc_cat_names[type->category_code]);
 
   if (!strcmp(type->name, "string"))
     XBT_VERB("value: '%s'", *(char **) data);
@@ -440,18 +440,18 @@ gras_datadesc_send_rec(gras_socket_t sock,
   }
 
   switch (type->category_code) {
-  case e_gras_datadesc_type_cat_scalar:
-    gras_trp_send(sock, data, type->size[GRAS_THISARCH], 1);
+  case e_xbt_datadesc_type_cat_scalar:
+    xbt_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;
+  case e_xbt_datadesc_type_cat_struct:{
+      xbt_dd_cat_struct_t struct_data;
+      xbt_dd_cat_field_t field;
       char *field_data;
 
       struct_data = type->category.struct_data;
       xbt_assert(struct_data.closed,
-                  "Please call gras_datadesc_declare_struct_close on %s before sending it",
+                  "Please call xbt_datadesc_declare_struct_close on %s before sending it",
                   type->name);
       XBT_VERB(">> Send all fields of the structure %s", type->name);
       xbt_dynar_foreach(struct_data.fields, cpt, field) {
@@ -466,7 +466,7 @@ gras_datadesc_send_rec(gras_socket_t sock,
         }
 
         XBT_VERB("Send field %s", field->name);
-        gras_datadesc_send_rec(sock, state, refs, sub_type, field_data,
+        xbt_datadesc_send_rec(sock, state, refs, sub_type, field_data,
                                detect_cycle || sub_type->cycle);
 
       }
@@ -475,15 +475,15 @@ gras_datadesc_send_rec(gras_socket_t sock,
       break;
     }
 
-  case e_gras_datadesc_type_cat_union:{
-      gras_dd_cat_union_t union_data;
-      gras_dd_cat_field_t field = NULL;
+  case e_xbt_datadesc_type_cat_union:{
+      xbt_dd_cat_union_t union_data;
+      xbt_dd_cat_field_t field = NULL;
       int field_num;
 
       union_data = type->category.union_data;
 
       xbt_assert(union_data.closed,
-                  "Please call gras_datadesc_declare_union_close on %s before sending it",
+                  "Please call xbt_datadesc_declare_union_close on %s before sending it",
                   type->name);
       /* retrieve the field number */
       field_num = union_data.selector(type, state, data);
@@ -498,25 +498,25 @@ gras_datadesc_send_rec(gras_socket_t sock,
                   xbt_dynar_length(union_data.fields));
 
       /* Send the field number */
-      gras_dd_send_int(sock, &field_num, 0 /* not stable */ );
+      xbt_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);
+                           xbt_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,
+      xbt_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;
+  case e_xbt_datadesc_type_cat_ref:{
+      xbt_dd_cat_ref_t ref_data;
       void **ref = (void **) data;
       int reference_is_to_send;
 
@@ -526,16 +526,16 @@ gras_datadesc_send_rec(gras_socket_t sock,
       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 */ );
+        xbt_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");
+        pointer_type = xbt_datadesc_by_name("data pointer");
         xbt_assert(pointer_type);
       }
 
-      gras_trp_send(sock, (char *) data,
+      xbt_trp_send(sock, (char *) data,
                     pointer_type->size[GRAS_THISARCH], 1 /*stable */ );
 
       /* Send the pointed data only if not already sent */
@@ -557,7 +557,7 @@ gras_datadesc_send_rec(gras_socket_t sock,
         XBT_VERB("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,
+        xbt_datadesc_send_rec(sock, state, refs, sub_type, *ref,
                                detect_cycle || sub_type->cycle);
 
       } else {
@@ -568,8 +568,8 @@ gras_datadesc_send_rec(gras_socket_t sock,
       break;
     }
 
-  case e_gras_datadesc_type_cat_array:{
-      gras_dd_cat_array_t array_data;
+  case e_xbt_datadesc_type_cat_array:{
+      xbt_dd_cat_array_t array_data;
       int count;
       char *ptr = data;
       long int elm_size;
@@ -583,25 +583,25 @@ gras_datadesc_send_rec(gras_socket_t sock,
         xbt_assert(count >= 0,
                     "Invalid (negative) array size for type %s",
                     type->name);
-        gras_dd_send_int(sock, &count, 0 /*non-stable */ );
+        xbt_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) {
+      if (sub_type->category_code == e_xbt_datadesc_type_cat_scalar) {
         XBT_VERB("Array of %d scalars, send it in one shot", count);
-        gras_trp_send(sock, data,
+        xbt_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
+      } else if (sub_type->category_code == e_xbt_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) {
+                 e_xbt_datadesc_type_cat_scalar) {
 
         XBT_VERB("Array of %d fixed array of scalars, send it in one shot",
               count);
-        gras_trp_send(sock, data,
+        xbt_trp_send(sock, data,
                       sub_type->category.array_data.
                       type->aligned_size[GRAS_THISARCH]
                       * count * sub_type->category.array_data.fixed_size,
@@ -609,7 +609,7 @@ gras_datadesc_send_rec(gras_socket_t sock,
 
       } else {
         for (cpt = 0; cpt < count; cpt++) {
-          gras_datadesc_send_rec(sock, state, refs, sub_type, ptr,
+          xbt_datadesc_send_rec(sock, state, refs, sub_type, ptr,
                                  detect_cycle || sub_type->cycle);
           ptr += elm_size;
         }
@@ -623,31 +623,31 @@ gras_datadesc_send_rec(gras_socket_t sock,
 }
 
 /**
- * gras_datadesc_send:
+ * xbt_datadesc_send:
  *
  * 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)
+void xbt_datadesc_send(xbt_socket_t sock,
+                        xbt_datadesc_type_t type, void *src)
 {
-  static gras_cbps_t state = NULL;
+  static xbt_cbps_t state = NULL;
   static xbt_dict_t refs = NULL;        /* all references already sent */
 
   xbt_assert(type, "called with NULL type descriptor");
 
   if (!state) {
-    state = gras_cbps_new();
+    state = xbt_cbps_new();
     refs = xbt_dict_new_homogeneous(NULL);
   }
 
   TRY {
-    gras_datadesc_send_rec(sock, state, refs, type, (char *) src,
+    xbt_datadesc_send_rec(sock, state, refs, type, (char *) src,
                            type->cycle);
   }
   TRY_CLEANUP {
     xbt_dict_reset(refs);
-    gras_cbps_reset(state);
+    xbt_cbps_reset(state);
   }
   CATCH_ANONYMOUS {
     RETHROW;
@@ -655,7 +655,7 @@ void gras_datadesc_send(gras_socket_t sock,
 }
 
 /**
- * gras_datadesc_recv_rec:
+ * xbt_datadesc_recv_rec:
  *
  * Do the data reception job recursively.
  *
@@ -667,10 +667,10 @@ 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_datadesc_recv_rec(xbt_socket_t sock,
+                       xbt_cbps_t state,
                        xbt_dict_t refs,
-                       gras_datadesc_type_t type,
+                       xbt_datadesc_type_t type,
                        int r_arch,
                        char **r_data,
                        long int r_lgr,
@@ -678,35 +678,35 @@ gras_datadesc_recv_rec(gras_socket_t sock,
 {
 
   unsigned int cpt;
-  gras_datadesc_type_t sub_type;
+  xbt_datadesc_type_t sub_type;
 
   XBT_VERB("Recv a %s @%p", type->name, (void *) l_data);
   xbt_assert(l_data);
 
   switch (type->category_code) {
-  case e_gras_datadesc_type_cat_scalar:
+  case e_xbt_datadesc_type_cat_scalar:
     if (type->size[GRAS_THISARCH] == type->size[r_arch]) {
-      gras_trp_recv(sock, (char *) l_data, type->size[r_arch]);
+      xbt_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);
+        xbt_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]);
+      xbt_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);
+        xbt_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;
+  case e_xbt_datadesc_type_cat_struct:{
+      xbt_dd_cat_struct_t struct_data;
+      xbt_dd_cat_field_t field;
 
       struct_data = type->category.struct_data;
 
       xbt_assert(struct_data.closed,
-                  "Please call gras_datadesc_declare_struct_close on %s before receiving it",
+                  "Please call xbt_datadesc_declare_struct_close on %s before receiving it",
                   type->name);
       XBT_VERB(">> Receive all fields of the structure %s", type->name);
       xbt_dynar_foreach(struct_data.fields, cpt, field) {
@@ -714,7 +714,7 @@ gras_datadesc_recv_rec(gras_socket_t sock,
 
         sub_type = field->type;
 
-        gras_datadesc_recv_rec(sock, state, refs, sub_type,
+        xbt_datadesc_recv_rec(sock, state, refs, sub_type,
                                r_arch, NULL, 0,
                                field_data, -1,
                                detect_cycle || sub_type->cycle);
@@ -730,18 +730,18 @@ gras_datadesc_recv_rec(gras_socket_t sock,
       break;
     }
 
-  case e_gras_datadesc_type_cat_union:{
-      gras_dd_cat_union_t union_data;
-      gras_dd_cat_field_t field = NULL;
+  case e_xbt_datadesc_type_cat_union:{
+      xbt_dd_cat_union_t union_data;
+      xbt_dd_cat_field_t field = NULL;
       int field_num;
 
       union_data = type->category.union_data;
 
       xbt_assert(union_data.closed,
-                  "Please call gras_datadesc_declare_union_close on %s before receiving it",
+                  "Please call xbt_datadesc_declare_union_close on %s before receiving it",
                   type->name);
       /* retrieve the field number */
-      gras_dd_recv_int(sock, r_arch, &field_num);
+      xbt_dd_recv_int(sock, r_arch, &field_num);
       if (field_num < 0)
         THROWF(mismatch_error, 0,
                "Received union field for %s is negative", type->name);
@@ -753,10 +753,10 @@ gras_datadesc_recv_rec(gras_socket_t sock,
       /* Recv the content */
       field =
           xbt_dynar_get_as(union_data.fields, field_num,
-                           gras_dd_cat_field_t);
+                           xbt_dd_cat_field_t);
       sub_type = field->type;
 
-      gras_datadesc_recv_rec(sock, state, refs, sub_type,
+      xbt_datadesc_recv_rec(sock, state, refs, sub_type,
                              r_arch, NULL, 0,
                              l_data, -1, detect_cycle || sub_type->cycle);
       if (field->recv)
@@ -765,10 +765,10 @@ gras_datadesc_recv_rec(gras_socket_t sock,
       break;
     }
 
-  case e_gras_datadesc_type_cat_ref:{
+  case e_xbt_datadesc_type_cat_ref:{
       char **r_ref = NULL;
       char **l_ref = NULL;
-      gras_dd_cat_ref_t ref_data;
+      xbt_dd_cat_ref_t ref_data;
       int reference_is_to_recv = 0;
 
       ref_data = type->category.ref_data;
@@ -777,22 +777,22 @@ gras_datadesc_recv_rec(gras_socket_t sock,
       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);
+        xbt_dd_recv_int(sock, r_arch, &ref_code);
+        sub_type = xbt_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");
+        pointer_type = xbt_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]);
+      xbt_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])) {
+      if (xbt_dd_is_r_null(r_ref, pointer_type->size[r_arch])) {
         XBT_VERB("Not receiving data remotely referenced @%p since it's NULL",
               *(void **) r_ref);
         *(void **) l_data = NULL;
@@ -815,19 +815,19 @@ gras_datadesc_recv_rec(gras_socket_t sock,
 
         XBT_VERB("Receiving a ref to '%s', remotely @%p",
               sub_type->name, *(void **) r_ref);
-        if (sub_type->category_code == e_gras_datadesc_type_cat_array) {
+        if (sub_type->category_code == e_xbt_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;
+          xbt_dd_cat_array_t array_data = sub_type->category.array_data;
+          xbt_datadesc_type_t subsub_type;
 
           subsubcount = array_data.fixed_size;
           if (subsubcount == -1)
-            gras_dd_recv_int(sock, r_arch, &subsubcount);
+            xbt_dd_recv_int(sock, r_arch, &subsubcount);
 
           subsub_type = array_data.type;
 
           if (subsubcount != 0)
-            gras_dd_alloc_ref(refs,
+            xbt_dd_alloc_ref(refs,
                               subsub_type->size[GRAS_THISARCH] *
                               subsubcount, r_ref,
                               pointer_type->size[r_arch],
@@ -835,13 +835,13 @@ gras_datadesc_recv_rec(gras_socket_t sock,
           else
             l_referenced = NULL;
         } else {
-          gras_dd_alloc_ref(refs, sub_type->size[GRAS_THISARCH],
+          xbt_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,
+          xbt_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);
@@ -862,8 +862,8 @@ gras_datadesc_recv_rec(gras_socket_t sock,
       break;
     }
 
-  case e_gras_datadesc_type_cat_array:{
-      gras_dd_cat_array_t array_data;
+  case e_xbt_datadesc_type_cat_array:{
+      xbt_dd_cat_array_t array_data;
       int count;
       char *ptr;
       long int elm_size;
@@ -874,35 +874,35 @@ gras_datadesc_recv_rec(gras_socket_t sock,
       if (count == -1)
         count = subsize;
       if (count == -1)
-        gras_dd_recv_int(sock, r_arch, &count);
+        xbt_dd_recv_int(sock, r_arch, &count);
       if (count == -1)
         THROWF(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) {
+      if (sub_type->category_code == e_xbt_datadesc_type_cat_scalar) {
         XBT_VERB("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,
+          xbt_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);
+            xbt_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,
+          xbt_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);
+            xbt_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
+      } else if (sub_type->category_code == e_xbt_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;
+                 e_xbt_datadesc_type_cat_scalar) {
+        xbt_datadesc_type_t subsub_type;
         array_data = sub_type->category.array_data;
         subsub_type = array_data.type;
 
@@ -910,22 +910,22 @@ gras_datadesc_recv_rec(gras_socket_t sock,
               count);
         if (subsub_type->aligned_size[GRAS_THISARCH] >=
             subsub_type->aligned_size[r_arch]) {
-          gras_trp_recv(sock, (char *) l_data,
+          xbt_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,
+            xbt_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,
+          xbt_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,
+            xbt_dd_convert_elm(subsub_type, count * array_data.fixed_size,
                                 r_arch, ptr, l_data);
           free(ptr);
         }
@@ -938,7 +938,7 @@ gras_datadesc_recv_rec(gras_socket_t sock,
 
         ptr = l_data;
         for (cpt = 0; cpt < count; cpt++) {
-          gras_datadesc_recv_rec(sock, state, refs, sub_type,
+          xbt_datadesc_recv_rec(sock, state, refs, sub_type,
                                  r_arch, NULL, 0, ptr, -1,
                                  detect_cycle || sub_type->cycle);
 
@@ -961,32 +961,32 @@ gras_datadesc_recv_rec(gras_socket_t sock,
 }
 
 /**
- * gras_datadesc_recv:
+ * xbt_datadesc_recv:
  *
  * Get an instance of the datatype described by @type from the @socket,
  * and store a pointer to it in @dst
  *
  */
 void
-gras_datadesc_recv(gras_socket_t sock,
-                   gras_datadesc_type_t type, int r_arch, void *dst)
+xbt_datadesc_recv(xbt_socket_t sock,
+                   xbt_datadesc_type_t type, int r_arch, void *dst)
 {
-  static gras_cbps_t state = NULL;      /* callback persistent state */
+  static xbt_cbps_t state = NULL;      /* callback persistent state */
   static xbt_dict_t refs = NULL;        /* all references already sent */
 
   if (!state) {
-    state = gras_cbps_new();
+    state = xbt_cbps_new();
     refs = xbt_dict_new_homogeneous(xbt_free_f);
   }
 
   xbt_assert(type, "called with NULL type descriptor");
   TRY {
-    gras_datadesc_recv_rec(sock, state, refs, type,
+    xbt_datadesc_recv_rec(sock, state, refs, type,
                            r_arch, NULL, 0, (char *) dst, -1, type->cycle);
   }
   TRY_CLEANUP {
     xbt_dict_reset(refs);
-    gras_cbps_reset(state);
+    xbt_cbps_reset(state);
   }
   CATCH_ANONYMOUS {
     RETHROW;
similarity index 64%
rename from src/gras/DataDesc/ddt_parse.c
rename to src/xbt/datadesc/ddt_parse.c
index 77f5d66..498f56e 100644 (file)
@@ -9,11 +9,11 @@
 #include <ctype.h>              /* isdigit */
 
 #include "xbt/ex.h"
-#include "gras/DataDesc/datadesc_private.h"
-#include "gras/DataDesc/ddt_parse.yy.h"
+#include "datadesc_private.h"
+#include "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(xbt_ddt_parse, xbt_ddt,
+                                "Parsing C data structures to build XBT data description");
 
 typedef struct s_type_modifier {
   short is_long;
@@ -31,61 +31,61 @@ typedef struct s_type_modifier {
 } s_type_modifier_t, *type_modifier_t;
 
 typedef struct s_field {
-  gras_datadesc_type_t type;
+  xbt_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 *xbt_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) {
+    if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_STAR) {
       /* This only used when parsing 'short *' since this function returns when int, float, double,... is encountered */
       XBT_DEBUG("This is a reference");
       type_modifier->is_ref++;
 
-    } else if (!strcmp(gras_ddt_parse_text, "unsigned")) {
+    } else if (!strcmp(xbt_ddt_parse_text, "unsigned")) {
       XBT_DEBUG("This is an unsigned");
       type_modifier->is_unsigned = 1;
 
-    } else if (!strcmp(gras_ddt_parse_text, "short")) {
+    } else if (!strcmp(xbt_ddt_parse_text, "short")) {
       XBT_DEBUG("This is short");
       type_modifier->is_short = 1;
 
-    } else if (!strcmp(gras_ddt_parse_text, "long")) {
+    } else if (!strcmp(xbt_ddt_parse_text, "long")) {
       XBT_DEBUG("This is long");
       type_modifier->is_long++; /* handle "long long" */
 
-    } else if (!strcmp(gras_ddt_parse_text, "struct")) {
+    } else if (!strcmp(xbt_ddt_parse_text, "struct")) {
       XBT_DEBUG("This is a struct");
       type_modifier->is_struct = 1;
 
-    } else if (!strcmp(gras_ddt_parse_text, "union")) {
+    } else if (!strcmp(xbt_ddt_parse_text, "union")) {
       XBT_DEBUG("This is an union");
       type_modifier->is_union = 1;
 
-    } else if (!strcmp(gras_ddt_parse_text, "enum")) {
+    } else if (!strcmp(xbt_ddt_parse_text, "enum")) {
       XBT_DEBUG("This is an enum");
       type_modifier->is_enum = 1;
 
-    } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_EMPTY) {
+    } else if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_EMPTY) {
       XBT_DEBUG("Pass space");
 
     } else {
-      XBT_DEBUG("Done with modifiers (got %s)", gras_ddt_parse_text);
+      XBT_DEBUG("Done with modifiers (got %s)", xbt_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)) {
-      XBT_DEBUG("Done with modifiers (got %s,%d)", gras_ddt_parse_text,
-             gras_ddt_parse_tok_num);
+    xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
+    if ((xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_WORD) &&
+        (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_STAR)) {
+      XBT_DEBUG("Done with modifiers (got %s,%d)", xbt_ddt_parse_text,
+             xbt_ddt_parse_tok_num);
       break;
     }
   } while (1);
@@ -132,7 +132,7 @@ static void change_to_fixed_array(xbt_dynar_t dynar, long int size)
           (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.type = xbt_datadesc_array_fixed(array.type_name, former.type, size);   /* redeclaration are ignored */
   array.name = former.name;
 
   xbt_dynar_push(dynar, &array);
@@ -152,7 +152,7 @@ static void change_to_ref(xbt_dynar_t dynar)
   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.type = xbt_datadesc_ref(ref.type_name, former.type);     /* redeclaration are ignored */
   ref.name = former.name;
 
   xbt_dynar_push(dynar, &ref);
@@ -166,7 +166,7 @@ static void change_to_ref_pop_array(xbt_dynar_t dynar)
 
   XBT_IN("");
   xbt_dynar_pop(dynar, &former);
-  ref.type = gras_datadesc_ref_pop_arr(former.type);    /* redeclaration are ignored */
+  ref.type = xbt_datadesc_ref_pop_arr(former.type);    /* redeclaration are ignored */
   ref.type_name = (char *) strdup(ref.type->name);
   ref.name = former.name;
 
@@ -177,14 +177,14 @@ static void change_to_ref_pop_array(xbt_dynar_t dynar)
 }
 
 static void change_to_dynar_of(xbt_dynar_t dynar,
-                               gras_datadesc_type_t subtype)
+                               xbt_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 = xbt_datadesc_dynar(subtype, NULL);        /* redeclaration are ignored */
   ref.type_name = (char *) strdup(ref.type->name);
   ref.name = former.name;
 
@@ -195,14 +195,14 @@ static void change_to_dynar_of(xbt_dynar_t dynar,
 }
 
 static void change_to_matrix_of(xbt_dynar_t dynar,
-                                gras_datadesc_type_t subtype)
+                                xbt_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 = xbt_datadesc_matrix(subtype, NULL);       /* redeclaration are ignored */
   ref.type_name = (char *) strdup(ref.type->name);
   ref.name = former.name;
 
@@ -237,27 +237,27 @@ static void parse_statement(char *definition,
   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_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
+  if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_RA) {
     XBT_OUT();
     THROWF(mismatch_error, 0, "End of the englobing structure or union");
   }
 
-  if (XBT_LOG_ISENABLED(gras_ddt_parse, xbt_log_priority_debug)) {
+  if (XBT_LOG_ISENABLED(xbt_ddt_parse, xbt_log_priority_debug)) {
     int colon_pos;
-    for (colon_pos = gras_ddt_parse_col_pos;
+    for (colon_pos = xbt_ddt_parse_col_pos;
          definition[colon_pos] != ';'; colon_pos++);
     definition[colon_pos] = '\0';
     XBT_DEBUG("Parse the statement \"%s%s;\" (col_pos=%d)",
-           gras_ddt_parse_text,
-           definition + gras_ddt_parse_col_pos, gras_ddt_parse_col_pos);
+           xbt_ddt_parse_text,
+           definition + xbt_ddt_parse_col_pos, xbt_ddt_parse_col_pos);
     definition[colon_pos] = ';';
   }
 
-  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+  if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_WORD)
     PARSE_ERROR
         ("Unparsable symbol: found a typeless statement (got '%s' instead)",
-         gras_ddt_parse_text);
+         xbt_ddt_parse_text);
 
         /**** get the type modifier of this statement ****/
   parse_type_modifier(&identifier.tm);
@@ -266,54 +266,54 @@ static void parse_statement(char *definition,
   if (identifier.tm.is_union || identifier.tm.is_enum
       || identifier.tm.is_struct)
     PARSE_ERROR
-        ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle recursive type definition yet");
+        ("Unimplemented feature: XBT_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")) {
+       || identifier.tm.is_unsigned) && strcmp(xbt_ddt_parse_text, "char")
+      && strcmp(xbt_ddt_parse_text, "float")
+      && strcmp(xbt_ddt_parse_text, "double")
+      && strcmp(xbt_ddt_parse_text, "int")) {
 
     /* bastard user, they omited "int" ! */
     identifier.type_name = (char *) strdup("int");
     XBT_DEBUG("the base type is 'int', which were omited (you vicious user)");
   } else {
-    identifier.type_name = (char *) strdup(gras_ddt_parse_text);
+    identifier.type_name = (char *) strdup(xbt_ddt_parse_text);
     XBT_DEBUG("the base type is '%s'", identifier.type_name);
-    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+    xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
   }
 
         /**** build the base type for latter use ****/
   if (identifier.tm.is_union) {
     PARSE_ERROR
-        ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle union yet (get callback from annotation?)");
+        ("Unimplemented feature: XBT_DEFINE_TYPE cannot handle union yet (get callback from annotation?)");
 
   } else if (identifier.tm.is_enum) {
     PARSE_ERROR
-        ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle enum yet");
+        ("Unimplemented feature: XBT_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 */
+    identifier.type = xbt_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");
+        identifier.type = xbt_datadesc_by_name("unsigned long long int");
       } else if (identifier.tm.is_long) {
-        identifier.type = gras_datadesc_by_name("unsigned long int");
+        identifier.type = xbt_datadesc_by_name("unsigned long int");
       } else if (identifier.tm.is_short) {
-        identifier.type = gras_datadesc_by_name("unsigned short int");
+        identifier.type = xbt_datadesc_by_name("unsigned short int");
       } else {
-        identifier.type = gras_datadesc_by_name("unsigned int");
+        identifier.type = xbt_datadesc_by_name("unsigned int");
       }
 
     } else if (!strcmp(identifier.type_name, "char")) {
-      identifier.type = gras_datadesc_by_name("unsigned char");
+      identifier.type = xbt_datadesc_by_name("unsigned char");
 
     } else {                    /* impossible, gcc parses this shit before us */
       THROW_IMPOSSIBLE;
@@ -321,28 +321,28 @@ static void parse_statement(char *definition,
 
   } else if (!strcmp(identifier.type_name, "float")) {
     /* no modificator allowed by gcc */
-    identifier.type = gras_datadesc_by_name("float");
+    identifier.type = xbt_datadesc_by_name("float");
 
   } else if (!strcmp(identifier.type_name, "double")) {
     if (identifier.tm.is_long)
       PARSE_ERROR("long double not portable and thus not handled");
 
-    identifier.type = gras_datadesc_by_name("double");
+    identifier.type = xbt_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");
+        identifier.type = xbt_datadesc_by_name("signed long long int");
       } else if (identifier.tm.is_long) {
-        identifier.type = gras_datadesc_by_name("signed long int");
+        identifier.type = xbt_datadesc_by_name("signed long int");
       } else if (identifier.tm.is_short) {
-        identifier.type = gras_datadesc_by_name("signed short int");
+        identifier.type = xbt_datadesc_by_name("signed short int");
       } else {
-        identifier.type = gras_datadesc_by_name("int");
+        identifier.type = xbt_datadesc_by_name("int");
       }
 
     } else if (!strcmp(identifier.type_name, "char")) {
-      identifier.type = gras_datadesc_by_name("char");
+      identifier.type = xbt_datadesc_by_name("char");
 
     } else {
       XBT_DEBUG("Base type is a constructed one (%s)", identifier.type_name);
@@ -351,7 +351,7 @@ static void parse_statement(char *definition,
       } else if (!strcmp(identifier.type_name, "xbt_dynar_t")) {
         identifier.tm.is_dynar = 1;
       } else {
-        identifier.type = gras_datadesc_by_name(identifier.type_name);
+        identifier.type = xbt_datadesc_by_name(identifier.type_name);
         if (!identifier.type)
           PARSE_ERROR("Unknown base type '%s'", identifier.type_name);
       }
@@ -365,37 +365,37 @@ static void parse_statement(char *definition,
    */
 
         /**** 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()) {
+  for (expect_id_separator = 0; (       /*(xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_EMPTY) && FIXME */
+                                  (xbt_ddt_parse_tok_num !=
+                                   XBT_DDT_PARSE_TOKEN_SEMI_COLON));
+       xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump()) {
 
     if (expect_id_separator) {
-      if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
+      if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_COLON) {
         expect_id_separator = 0;
         continue;
 
-      } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_LB) {
+      } else if (xbt_ddt_parse_tok_num == XBT_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) {
+        xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
+        if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_RB) {
           PARSE_ERROR
-              ("Unimplemented feature: GRAS_DEFINE_TYPE cannot deal with [] constructs (yet)");
+              ("Unimplemented feature: XBT_DEFINE_TYPE cannot deal with [] constructs (yet)");
 
-        } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
+        } else if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_WORD) {
           char *end;
-          long int size = strtol(gras_ddt_parse_text, &end, 10);
+          long int size = strtol(xbt_ddt_parse_text, &end, 10);
 
-          if (end == gras_ddt_parse_text || *end != '\0') {
+          if (end == xbt_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);
+            int *storage = xbt_dict_get_or_null(xbt_dd_constants,
+                                                xbt_ddt_parse_text);
             if (storage) {
               size = *storage;
             } else {
               PARSE_ERROR
-                  ("Unparsable size of array. Found '%s', expected number or known constant. Need to use gras_datadesc_set_const(), huh?",
-                   gras_ddt_parse_text);
+                  ("Unparsable size of array. Found '%s', expected number or known constant. Need to use xbt_datadesc_set_const(), huh?",
+                   xbt_ddt_parse_text);
             }
           }
 
@@ -403,8 +403,8 @@ static void parse_statement(char *definition,
           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)
+          xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
+          if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_RB)
             PARSE_ERROR("Unparsable size of array");
           XBT_DEBUG("Fixed size array, size=%ld", size);
           continue;
@@ -413,57 +413,57 @@ static void parse_statement(char *definition,
         }
         /* End of fixed size arrays handling */
 
-      } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
+      } else if (xbt_ddt_parse_tok_num == XBT_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"))
+        if (strcmp(xbt_ddt_parse_text, "XBT_ANNOTE"))
           PARSE_ERROR
-              ("Unparsable symbol: Expected 'GRAS_ANNOTE', got '%s'",
-               gras_ddt_parse_text);
+              ("Unparsable symbol: Expected 'XBT_ANNOTE', got '%s'",
+               xbt_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)
+        xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
+        if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_LP)
           PARSE_ERROR
               ("Unparsable annotation: Expected parenthesis, got '%s'",
-               gras_ddt_parse_text);
+               xbt_ddt_parse_text);
 
-        while ((gras_ddt_parse_tok_num =
-                gras_ddt_parse_lex_n_dump()) ==
-               GRAS_DDT_PARSE_TOKEN_EMPTY);
+        while ((xbt_ddt_parse_tok_num =
+                xbt_ddt_parse_lex_n_dump()) ==
+               XBT_DDT_PARSE_TOKEN_EMPTY);
 
-        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+        if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_WORD)
           PARSE_ERROR
               ("Unparsable annotation: Expected key name, got '%s'",
-               gras_ddt_parse_text);
-        keyname = (char *) strdup(gras_ddt_parse_text);
+               xbt_ddt_parse_text);
+        keyname = (char *) strdup(xbt_ddt_parse_text);
 
-        while ((gras_ddt_parse_tok_num =
-                gras_ddt_parse_lex_n_dump()) ==
-               GRAS_DDT_PARSE_TOKEN_EMPTY);
+        while ((xbt_ddt_parse_tok_num =
+                xbt_ddt_parse_lex_n_dump()) ==
+               XBT_DDT_PARSE_TOKEN_EMPTY);
 
-        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_COLON)
+        if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_COLON)
           PARSE_ERROR
               ("Unparsable annotation: expected ',' after the key name, got '%s'",
-               gras_ddt_parse_text);
+               xbt_ddt_parse_text);
 
-        while ((gras_ddt_parse_tok_num =
-                gras_ddt_parse_lex_n_dump()) ==
-               GRAS_DDT_PARSE_TOKEN_EMPTY);
+        while ((xbt_ddt_parse_tok_num =
+                xbt_ddt_parse_lex_n_dump()) ==
+               XBT_DDT_PARSE_TOKEN_EMPTY);
 
         /* get the value */
 
-        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+        if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_WORD)
           PARSE_ERROR
               ("Unparsable annotation: Expected key value, got '%s'",
-               gras_ddt_parse_text);
-        keyval = (char *) strdup(gras_ddt_parse_text);
+               xbt_ddt_parse_text);
+        keyval = (char *) strdup(xbt_ddt_parse_text);
 
-        while ((gras_ddt_parse_tok_num =
-                gras_ddt_parse_lex_n_dump()) ==
-               GRAS_DDT_PARSE_TOKEN_EMPTY);
+        while ((xbt_ddt_parse_tok_num =
+                xbt_ddt_parse_lex_n_dump()) ==
+               XBT_DDT_PARSE_TOKEN_EMPTY);
 
         /* Done with parsing the annotation. Now deal with it by replacing previously pushed type with the right one */
 
@@ -494,7 +494,7 @@ static void parse_statement(char *definition,
             }
           }
         } else if (!strcmp(keyname, "subtype")) {
-          gras_datadesc_type_t subtype = gras_datadesc_by_name(keyval);
+          xbt_datadesc_type_t subtype = xbt_datadesc_by_name(keyval);
           if (identifier.tm.is_matrix) {
             change_to_matrix_of(identifiers, subtype);
             identifier.tm.is_matrix = -1;
@@ -508,7 +508,7 @@ static void parse_statement(char *definition,
           }
           free(keyval);
         } else if (!strcmp(keyname, "free_f")) {
-          int *storage = xbt_dict_get_or_null(gras_dd_constants, keyval);
+          int *storage = xbt_dict_get_or_null(xbt_dd_constants, keyval);
           if (!storage)
             PARSE_ERROR
                 ("value for free_f annotation of field %s is not a known constant",
@@ -532,30 +532,30 @@ static void parse_statement(char *definition,
         free(keyname);
 
         /* Get all the multipliers */
-        while (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
+        while (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_STAR) {
 
-          gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+          xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
 
-          if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+          if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_WORD)
             PARSE_ERROR
                 ("Unparsable annotation: Expected field name after '*', got '%s'",
-                 gras_ddt_parse_text);
+                 xbt_ddt_parse_text);
 
-          keyval = xbt_malloc(strlen(gras_ddt_parse_text) + 2);
-          sprintf(keyval, "*%s", gras_ddt_parse_text);
+          keyval = xbt_malloc(strlen(xbt_ddt_parse_text) + 2);
+          sprintf(keyval, "*%s", xbt_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);
+          while ((xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump())
+                 == XBT_DDT_PARSE_TOKEN_EMPTY);
         }
 
-        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RP)
+        if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_RP)
           PARSE_ERROR
               ("Unparsable annotation: Expected parenthesis, got '%s'",
-               gras_ddt_parse_text);
+               xbt_ddt_parse_text);
 
         continue;
 
@@ -563,21 +563,21 @@ static void parse_statement(char *definition,
       } else {
         PARSE_ERROR
             ("Unparsable symbol: Got '%s' instead of expected comma (',')",
-             gras_ddt_parse_text);
+             xbt_ddt_parse_text);
       }
-    } else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
+    } else if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_COLON) {
       PARSE_ERROR("Unparsable symbol: Unexpected comma (',')");
     }
 
-    if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
+    if (xbt_ddt_parse_tok_num == XBT_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) {
+    if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_WORD) {
 
-      identifier.name = (char *) strdup(gras_ddt_parse_text);
+      identifier.name = (char *) strdup(xbt_ddt_parse_text);
       XBT_DEBUG("Found the identifier \"%s\"", identifier.name);
 
       xbt_dynar_push(identifiers, &identifier);
@@ -598,7 +598,7 @@ static void parse_statement(char *definition,
   XBT_OUT();
 }
 
-static gras_datadesc_type_t parse_struct(char *definition)
+static xbt_datadesc_type_t parse_struct(char *definition)
 {
 
   xbt_ex_t e;
@@ -614,27 +614,27 @@ static gras_datadesc_type_t parse_struct(char *definition)
   xbt_dynar_t fields_to_push;
   char *name;
 
-  volatile gras_datadesc_type_t struct_type;
+  volatile xbt_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);
-    XBT_VERB("Parse the struct '%s'", gras_ddt_parse_text);
-    gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+  if (xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_WORD) {
+    struct_type = xbt_datadesc_struct(xbt_ddt_parse_text);
+    XBT_VERB("Parse the struct '%s'", xbt_ddt_parse_text);
+    xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
   } else {
     sprintf(buffname, "anonymous struct %d", anonymous_struct++);
     XBT_VERB("Parse the anonymous struct nb %d", anonymous_struct);
-    struct_type = gras_datadesc_struct(buffname);
+    struct_type = xbt_datadesc_struct(buffname);
   }
 
-  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LA)
+  if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_LA)
     PARSE_ERROR
         ("Unparasable symbol: Expecting struct definition, but got %s instead of '{'",
-         gras_ddt_parse_text);
+         xbt_ddt_parse_text);
 
   /* Parse the identifiers */
   done = 0;
@@ -655,11 +655,11 @@ static gras_datadesc_type_t parse_struct(char *definition)
     xbt_dynar_foreach(identifiers, iter, field) {
       if (field.tm.is_ref)
         PARSE_ERROR
-            ("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
+            ("Not enough XBT_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
              field.name, field.tm.is_ref);
 
       XBT_VERB("Append field '%s' to %p", field.name, (void *) struct_type);
-      gras_datadesc_struct_append(struct_type, field.name, field.type);
+      xbt_datadesc_struct_append(struct_type, field.name, field.type);
       free(field.name);
       free(field.type_name);
 
@@ -673,25 +673,25 @@ static gras_datadesc_type_t parse_struct(char *definition)
       if (name[0] == '*') {
         XBT_VERB("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);
+        xbt_datadesc_cb_field_push_multiplier(struct_type, name + 1);
       } else {
         XBT_VERB("Push field '%s' into size stack of %p",
               name, (void *) struct_type);
-        gras_datadesc_cb_field_push(struct_type, name);
+        xbt_datadesc_cb_field_push(struct_type, name);
       }
       free(name);
     }
     xbt_dynar_reset(fields_to_push);
   } while (!done);
-  gras_datadesc_struct_close(struct_type);
+  xbt_datadesc_struct_close(struct_type);
 
   /* terminates */
-  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RA)
+  if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_RA)
     PARSE_ERROR
         ("Unparasable symbol: Expected '}' at the end of struct definition, got '%s'",
-         gras_ddt_parse_text);
+         xbt_ddt_parse_text);
 
-  gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
+  xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
 
   xbt_dynar_free(&identifiers);
   xbt_dynar_free(&fields_to_push);
@@ -699,12 +699,12 @@ static gras_datadesc_type_t parse_struct(char *definition)
   return struct_type;
 }
 
-static gras_datadesc_type_t parse_typedef(char *definition)
+static xbt_datadesc_type_t parse_typedef(char *definition)
 {
 
   s_type_modifier_t tm;
 
-  gras_datadesc_type_t typedef_desc = NULL;
+  xbt_datadesc_type_t typedef_desc = NULL;
 
   XBT_IN("");
   memset(&tm, 0, sizeof(tm));
@@ -720,17 +720,17 @@ static gras_datadesc_type_t parse_typedef(char *definition)
 
   if (tm.is_ref)
     PARSE_ERROR
-        ("GRAS_DEFINE_TYPE cannot handle reference without annotation");
+        ("XBT_DEFINE_TYPE cannot handle reference without annotation");
 
   /* get the aliasing name */
-  if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
+  if (xbt_ddt_parse_tok_num != XBT_DDT_PARSE_TOKEN_WORD)
     PARSE_ERROR
         ("Unparsable typedef: Expected the alias name, and got '%s'",
-         gras_ddt_parse_text);
+         xbt_ddt_parse_text);
 
   /* (FIXME: should) build the alias */
   PARSE_ERROR
-      ("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle typedef yet");
+      ("Unimplemented feature: XBT_DEFINE_TYPE cannot handle typedef yet");
 
   XBT_OUT();
   return typedef_desc;
@@ -738,15 +738,15 @@ static gras_datadesc_type_t parse_typedef(char *definition)
 
 
 /**
- * gras_datadesc_parse:
+ * xbt_datadesc_parse:
  *
  * 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)
+xbt_datadesc_type_t
+xbt_datadesc_parse(const char *name, const char *C_statement)
 {
 
-  gras_datadesc_type_t res = NULL;
+  xbt_datadesc_type_t res = NULL;
   char *definition;
   int semicolon_count = 0;
   int def_count, C_count;
@@ -766,20 +766,20 @@ gras_datadesc_parse(const char *name, const char *C_statement)
   definition[def_count] = '\0';
 
   /* init */
-  XBT_VERB("_gras_ddt_type_parse(%s) -> %d chars", definition, def_count);
-  gras_ddt_parse_pointer_string_init(definition);
+  XBT_VERB("_xbt_ddt_type_parse(%s) -> %d chars", definition, def_count);
+  xbt_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();
+  xbt_ddt_parse_tok_num = xbt_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();
+  if ((xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_WORD)
+      && (!strcmp(xbt_ddt_parse_text, "struct"))) {
+    xbt_ddt_parse_tok_num = xbt_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();
+  } else if ((xbt_ddt_parse_tok_num == XBT_DDT_PARSE_TOKEN_WORD)
+             && (!strcmp(xbt_ddt_parse_text, "typedef"))) {
+    xbt_ddt_parse_tok_num = xbt_ddt_parse_lex_n_dump();
     res = parse_typedef(definition);
 
   } else {
@@ -789,27 +789,27 @@ gras_datadesc_parse(const char *name, const char *C_statement)
     xbt_abort();
   }
 
-  gras_ddt_parse_pointer_string_close();
-  XBT_VERB("end of _gras_ddt_type_parse()");
+  xbt_ddt_parse_pointer_string_close();
+  XBT_VERB("end of _xbt_ddt_type_parse()");
   free(definition);
   /* register it under the name provided as symbol */
   if (strcmp(res->name, name)) {
     XBT_ERROR
-        ("In GRAS_DEFINE_TYPE, the provided symbol (here %s) must be the C type name (here %s)",
+        ("In XBT_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_ddt_parse_lex_destroy();
   XBT_OUT();
   return res;
 }
 
-xbt_dict_t gras_dd_constants;
+xbt_dict_t xbt_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)
+void xbt_datadesc_set_const(const char *name, int value)
 {
   int *stored = xbt_new(int, 1);
   *stored = value;
 
-  xbt_dict_set(gras_dd_constants, name, stored, NULL);
+  xbt_dict_set(xbt_dd_constants, name, stored, NULL);
 }
similarity index 73%
rename from src/gras/DataDesc/ddt_parse.yy.c
rename to src/xbt/datadesc/ddt_parse.yy.c
index acb8213..a3a4c66 100644 (file)
@@ -1,28 +1,28 @@
 
-#line 3 "src/gras/DataDesc/ddt_parse.yy.c"
+#line 3 "src/xbt/datadesc/ddt_parse.yy.c"
 
 #define  YY_INT_ALIGNED short int
 
 /* A lexical scanner generated by flex */
 
-#define yy_create_buffer gras_ddt_parse__create_buffer
-#define yy_delete_buffer gras_ddt_parse__delete_buffer
-#define yy_flex_debug gras_ddt_parse__flex_debug
-#define yy_init_buffer gras_ddt_parse__init_buffer
-#define yy_flush_buffer gras_ddt_parse__flush_buffer
-#define yy_load_buffer_state gras_ddt_parse__load_buffer_state
-#define yy_switch_to_buffer gras_ddt_parse__switch_to_buffer
-#define yyin gras_ddt_parse_in
-#define yyleng gras_ddt_parse_leng
-#define yylex gras_ddt_parse_lex
-#define yylineno gras_ddt_parse_lineno
-#define yyout gras_ddt_parse_out
-#define yyrestart gras_ddt_parse_restart
-#define yytext gras_ddt_parse_text
-#define yywrap gras_ddt_parse_wrap
-#define yyalloc gras_ddt_parse_alloc
-#define yyrealloc gras_ddt_parse_realloc
-#define yyfree gras_ddt_parse_free
+#define yy_create_buffer xbt_ddt_parse__create_buffer
+#define yy_delete_buffer xbt_ddt_parse__delete_buffer
+#define yy_flex_debug xbt_ddt_parse__flex_debug
+#define yy_init_buffer xbt_ddt_parse__init_buffer
+#define yy_flush_buffer xbt_ddt_parse__flush_buffer
+#define yy_load_buffer_state xbt_ddt_parse__load_buffer_state
+#define yy_switch_to_buffer xbt_ddt_parse__switch_to_buffer
+#define yyin xbt_ddt_parse_in
+#define yyleng xbt_ddt_parse_leng
+#define yylex xbt_ddt_parse_lex
+#define yylineno xbt_ddt_parse_lineno
+#define yyout xbt_ddt_parse_out
+#define yyrestart xbt_ddt_parse_restart
+#define yytext xbt_ddt_parse_text
+#define yywrap xbt_ddt_parse_wrap
+#define yyalloc xbt_ddt_parse_alloc
+#define yyrealloc xbt_ddt_parse_realloc
+#define yyfree xbt_ddt_parse_free
 
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
@@ -154,7 +154,7 @@ typedef unsigned int flex_uint32_t;
 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
 /* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE gras_ddt_parse_restart(gras_ddt_parse_in  )
+#define YY_NEW_FILE xbt_ddt_parse_restart(xbt_ddt_parse_in  )
 
 #define YY_END_OF_BUFFER_CHAR 0
 
@@ -180,9 +180,9 @@ typedef unsigned int flex_uint32_t;
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
-extern int gras_ddt_parse_leng;
+extern int xbt_ddt_parse_leng;
 
-extern FILE *gras_ddt_parse_in, *gras_ddt_parse_out;
+extern FILE *xbt_ddt_parse_in, *xbt_ddt_parse_out;
 
 #define EOB_ACT_CONTINUE_SCAN 0
 #define EOB_ACT_END_OF_FILE 1
@@ -194,13 +194,13 @@ extern FILE *gras_ddt_parse_in, *gras_ddt_parse_out;
 #define yyless(n) \
        do \
                { \
-               /* Undo effects of setting up gras_ddt_parse_text. */ \
+               /* Undo effects of setting up xbt_ddt_parse_text. */ \
         int yyless_macro_arg = (n); \
         YY_LESS_LINENO(yyless_macro_arg);\
                *yy_cp = (yy_hold_char); \
                YY_RESTORE_YY_MORE_OFFSET \
                (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
-               YY_DO_BEFORE_ACTION; /* set up gras_ddt_parse_text again */ \
+               YY_DO_BEFORE_ACTION; /* set up xbt_ddt_parse_text again */ \
                } \
        while ( 0 )
 
@@ -268,8 +268,8 @@ struct yy_buffer_state
         * 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.
+        * (via xbt_ddt_parse_restart()), so that the user can continue scanning by
+        * just pointing xbt_ddt_parse_in at a new input file.
         */
 #define YY_BUFFER_EOF_PENDING 2
 
@@ -296,51 +296,51 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
  */
 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
 
-/* yy_hold_char holds the character lost when gras_ddt_parse_text is formed. */
+/* yy_hold_char holds the character lost when xbt_ddt_parse_text is formed. */
 static char yy_hold_char;
 static int yy_n_chars;         /* number of characters read into yy_ch_buf */
-int gras_ddt_parse_leng;
+int xbt_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 */
 
-/* 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 ...
+/* Flag which is used to allow xbt_ddt_parse_wrap()'s to do buffer switches
+ * instead of setting up a fresh xbt_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 xbt_ddt_parse_restart (FILE *input_file  );
+void xbt_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
+YY_BUFFER_STATE xbt_ddt_parse__create_buffer (FILE *file,int size  );
+void xbt_ddt_parse__delete_buffer (YY_BUFFER_STATE b  );
+void xbt_ddt_parse__flush_buffer (YY_BUFFER_STATE b  );
+void xbt_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer  );
+void xbt_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 xbt_ddt_parse_ensure_buffer_stack (void );
+static void xbt_ddt_parse__load_buffer_state (void );
+static void xbt_ddt_parse__init_buffer (YY_BUFFER_STATE b,FILE *file  );
 
-#define YY_FLUSH_BUFFER gras_ddt_parse__flush_buffer(YY_CURRENT_BUFFER )
+#define YY_FLUSH_BUFFER xbt_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 xbt_ddt_parse__scan_buffer (char *base,yy_size_t size  );
+YY_BUFFER_STATE xbt_ddt_parse__scan_string (yyconst char *yy_str  );
+YY_BUFFER_STATE xbt_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 *xbt_ddt_parse_alloc (yy_size_t  );
+void *xbt_ddt_parse_realloc (void *,yy_size_t  );
+void xbt_ddt_parse_free (void *  );
 
-#define yy_new_buffer gras_ddt_parse__create_buffer
+#define yy_new_buffer xbt_ddt_parse__create_buffer
 
 #define yy_set_interactive(is_interactive) \
        { \
        if ( ! YY_CURRENT_BUFFER ){ \
-        gras_ddt_parse_ensure_buffer_stack (); \
+        xbt_ddt_parse_ensure_buffer_stack (); \
                YY_CURRENT_BUFFER_LVALUE =    \
-            gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE ); \
+            xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE ); \
        } \
        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
        }
@@ -348,9 +348,9 @@ void gras_ddt_parse_free (void *  );
 #define yy_set_bol(at_bol) \
        { \
        if ( ! YY_CURRENT_BUFFER ){\
-        gras_ddt_parse_ensure_buffer_stack (); \
+        xbt_ddt_parse_ensure_buffer_stack (); \
                YY_CURRENT_BUFFER_LVALUE =    \
-            gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE ); \
+            xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE ); \
        } \
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
        }
@@ -359,21 +359,21 @@ void gras_ddt_parse_free (void *  );
 
 /* Begin user sect3 */
 
-#define gras_ddt_parse_wrap(n) 1
+#define xbt_ddt_parse_wrap(n) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
 
-FILE *gras_ddt_parse_in = (FILE *) 0, *gras_ddt_parse_out = (FILE *) 0;
+FILE *xbt_ddt_parse_in = (FILE *) 0, *xbt_ddt_parse_out = (FILE *) 0;
 
 typedef int yy_state_type;
 
-extern int gras_ddt_parse_lineno;
+extern int xbt_ddt_parse_lineno;
 
-int gras_ddt_parse_lineno = 1;
+int xbt_ddt_parse_lineno = 1;
 
-extern char *gras_ddt_parse_text;
-#define yytext_ptr gras_ddt_parse_text
+extern char *xbt_ddt_parse_text;
+#define yytext_ptr xbt_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  );
@@ -381,11 +381,11 @@ 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.
+ * corresponding action - sets up xbt_ddt_parse_text.
  */
 #define YY_DO_BEFORE_ACTION \
        (yytext_ptr) = yy_bp; \
-       gras_ddt_parse_leng = (size_t) (yy_cp - yy_bp); \
+       xbt_ddt_parse_leng = (size_t) (yy_cp - yy_bp); \
        (yy_hold_char) = *yy_cp; \
        *yy_cp = '\0'; \
        (yy_c_buf_p) = yy_cp;
@@ -504,8 +504,8 @@ static yyconst flex_int16_t yy_chk[106] =
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
 
-extern int gras_ddt_parse__flex_debug;
-int gras_ddt_parse__flex_debug = 0;
+extern int xbt_ddt_parse__flex_debug;
+int xbt_ddt_parse__flex_debug = 0;
 
 /* The intent behind this definition is that it'll catch
  * any uses of REJECT which flex missed.
@@ -514,24 +514,24 @@ int gras_ddt_parse__flex_debug = 0;
 #define yymore() yymore_used_but_not_detected
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
-char *gras_ddt_parse_text;
-/* DataDesc/ddt_parse -- automatic parsing of data structures */
+char *xbt_ddt_parse_text;
+/* datadesc/ddt_parse -- automatic parsing of data structures */
 /* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. 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. */
-#include "gras/DataDesc/datadesc_private.h"
-#include "gras/DataDesc/ddt_parse.yy.h"
+#include "xbt/datadesc/datadesc_private.h"
+#include "xbt/datadesc/ddt_parse.yy.h"
 #include <string.h>
-  YY_BUFFER_STATE gras_ddt_input_buffer;
-  FILE *gras_ddt_file_to_parse;
+  YY_BUFFER_STATE xbt_ddt_input_buffer;
+  FILE *xbt_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;
+  int xbt_ddt_parse_line_pos = 1;
+  int xbt_ddt_parse_col_pos = 0;
+  int xbt_ddt_parse_char_pos = 0;
+  int xbt_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 XBT_DEBUG("%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)
+  XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_lexer,xbt_ddt_parse,"The crude internals of the lexer used for type parsing");
+#define SHOW_WHERE XBT_DEBUG("%d:%d (char #%d): seen '%s'", xbt_ddt_parse_line_pos,xbt_ddt_parse_col_pos,xbt_ddt_parse_char_pos,xbt_ddt_parse_text)
 
 #define INITIAL 0
 #define annotate 1
@@ -555,31 +555,31 @@ 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 xbt_ddt_parse_lex_destroy (void );
 
-int gras_ddt_parse_get_debug (void );
+int xbt_ddt_parse_get_debug (void );
 
-void gras_ddt_parse_set_debug (int debug_flag  );
+void xbt_ddt_parse_set_debug (int debug_flag  );
 
-YY_EXTRA_TYPE gras_ddt_parse_get_extra (void );
+YY_EXTRA_TYPE xbt_ddt_parse_get_extra (void );
 
-void gras_ddt_parse_set_extra (YY_EXTRA_TYPE user_defined  );
+void xbt_ddt_parse_set_extra (YY_EXTRA_TYPE user_defined  );
 
-FILE *gras_ddt_parse_get_in (void );
+FILE *xbt_ddt_parse_get_in (void );
 
-void gras_ddt_parse_set_in  (FILE * in_str  );
+void xbt_ddt_parse_set_in  (FILE * in_str  );
 
-FILE *gras_ddt_parse_get_out (void );
+FILE *xbt_ddt_parse_get_out (void );
 
-void gras_ddt_parse_set_out  (FILE * out_str  );
+void xbt_ddt_parse_set_out  (FILE * out_str  );
 
-int gras_ddt_parse_get_leng (void );
+int xbt_ddt_parse_get_leng (void );
 
-char *gras_ddt_parse_get_text (void );
+char *xbt_ddt_parse_get_text (void );
 
-int gras_ddt_parse_get_lineno (void );
+int xbt_ddt_parse_get_lineno (void );
 
-void gras_ddt_parse_set_lineno (int line_number  );
+void xbt_ddt_parse_set_lineno (int line_number  );
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -587,9 +587,9 @@ 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 xbt_ddt_parse_wrap (void );
 #else
-extern int gras_ddt_parse_wrap (void );
+extern int xbt_ddt_parse_wrap (void );
 #endif
 #endif
 
@@ -628,7 +628,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO do { if (fwrite( gras_ddt_parse_text, gras_ddt_parse_leng, 1, gras_ddt_parse_out )) {} } while (0)
+#define ECHO do { if (fwrite( xbt_ddt_parse_text, xbt_ddt_parse_leng, 1, xbt_ddt_parse_out )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -641,18 +641,18 @@ static int input (void );
                int c = '*'; \
                size_t n; \
                for ( n = 0; n < max_size && \
-                            (c = getc( gras_ddt_parse_in )) != EOF && c != '\n'; ++n ) \
+                            (c = getc( xbt_ddt_parse_in )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
                if ( c == '\n' ) \
                        buf[n++] = (char) c; \
-               if ( c == EOF && ferror( gras_ddt_parse_in ) ) \
+               if ( c == EOF && ferror( xbt_ddt_parse_in ) ) \
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
                result = n; \
                } \
        else \
                { \
                errno=0; \
-               while ( (result = fread(buf, 1, max_size, gras_ddt_parse_in))==0 && ferror(gras_ddt_parse_in)) \
+               while ( (result = fread(buf, 1, max_size, xbt_ddt_parse_in))==0 && ferror(xbt_ddt_parse_in)) \
                        { \
                        if( errno != EINTR) \
                                { \
@@ -660,7 +660,7 @@ static int input (void );
                                break; \
                                } \
                        errno=0; \
-                       clearerr(gras_ddt_parse_in); \
+                       clearerr(xbt_ddt_parse_in); \
                        } \
                }\
 \
@@ -693,12 +693,12 @@ static int input (void );
 #ifndef YY_DECL
 #define YY_DECL_IS_OURS 1
 
-extern int gras_ddt_parse_lex (void);
+extern int xbt_ddt_parse_lex (void);
 
-#define YY_DECL int gras_ddt_parse_lex (void)
+#define YY_DECL int xbt_ddt_parse_lex (void)
 #endif /* !YY_DECL */
 
-/* Code executed at the beginning of each rule, after gras_ddt_parse_text and gras_ddt_parse_leng
+/* Code executed at the beginning of each rule, after xbt_ddt_parse_text and xbt_ddt_parse_leng
  * have been set up.
  */
 #ifndef YY_USER_ACTION
@@ -735,26 +735,26 @@ YY_DECL
                if ( ! (yy_start) )
                        (yy_start) = 1; /* first start state */
 
-               if ( ! gras_ddt_parse_in )
-                       gras_ddt_parse_in = stdin;
+               if ( ! xbt_ddt_parse_in )
+                       xbt_ddt_parse_in = stdin;
 
-               if ( ! gras_ddt_parse_out )
-                       gras_ddt_parse_out = stdout;
+               if ( ! xbt_ddt_parse_out )
+                       xbt_ddt_parse_out = stdout;
 
                if ( ! YY_CURRENT_BUFFER ) {
-                       gras_ddt_parse_ensure_buffer_stack ();
+                       xbt_ddt_parse_ensure_buffer_stack ();
                        YY_CURRENT_BUFFER_LVALUE =
-                               gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
+                               xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE );
                }
 
-               gras_ddt_parse__load_buffer_state( );
+               xbt_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. */
+               /* Support of xbt_ddt_parse_text. */
                *yy_cp = (yy_hold_char);
 
                /* yy_bp points to the position in yy_ch_buf of the start of
@@ -814,8 +814,8 @@ YY_RULE_SETUP
 { /****************** ANNOTATION ************************/
   XBT_DEBUG("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);
+  xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
+  xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
   BEGIN(annotate);
 }
        YY_BREAK
@@ -824,8 +824,8 @@ YY_RULE_SETUP
 { /* trim annotation */
   XBT_DEBUG("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);
+  xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
+  xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
   BEGIN(annotate);
 }
        YY_BREAK
@@ -833,8 +833,8 @@ case 4:
 YY_RULE_SETUP
 {
   XBT_DEBUG("End annotation");
-  gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
-  gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
+  xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
+  xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
   BEGIN(annotate_caller);
 }
        YY_BREAK
@@ -854,9 +854,9 @@ YY_RULE_SETUP
 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;
+  xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
+  xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
+  return XBT_DDT_PARSE_TOKEN_ANNOTATE;
 }
        YY_BREAK
 case 8:
@@ -890,124 +890,124 @@ 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++;
+  ++xbt_ddt_parse_line_pos;
+  xbt_ddt_parse_col_pos=0;
+  xbt_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);
+  xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
+  xbt_ddt_parse_col_pos+= strlen(xbt_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);
+  xbt_ddt_parse_char_pos += strlen(xbt_ddt_parse_text);
+  xbt_ddt_parse_col_pos += strlen(xbt_ddt_parse_text);
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_WORD);
+  return(XBT_DDT_PARSE_TOKEN_WORD);
 }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
 { 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
+  xbt_ddt_parse_char_pos++; 
+  xbt_ddt_parse_col_pos++; 
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LA);
+  return(XBT_DDT_PARSE_TOKEN_LA);
 }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
 {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RA);
+  return(XBT_DDT_PARSE_TOKEN_RA);
 }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
 { 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
+  xbt_ddt_parse_char_pos++; 
+  xbt_ddt_parse_col_pos++; 
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LB);
+  return(XBT_DDT_PARSE_TOKEN_LB);
 }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
 {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RB);
+  return(XBT_DDT_PARSE_TOKEN_RB);
 }
        YY_BREAK
 case 19:
 YY_RULE_SETUP
 { 
-  gras_ddt_parse_char_pos++; 
-  gras_ddt_parse_col_pos++; 
+  xbt_ddt_parse_char_pos++; 
+  xbt_ddt_parse_col_pos++; 
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_LP);
+  return(XBT_DDT_PARSE_TOKEN_LP);
 }
        YY_BREAK
 case 20:
 YY_RULE_SETUP
 {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_RP);
+  return(XBT_DDT_PARSE_TOKEN_RP);
 }
        YY_BREAK
 case 21:
 YY_RULE_SETUP
 {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_STAR);
+  return(XBT_DDT_PARSE_TOKEN_STAR);
 }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
 {
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
+  return(XBT_DDT_PARSE_TOKEN_SEMI_COLON);
 }
        YY_BREAK
 case 23:
 YY_RULE_SETUP
 { 
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
-  return(GRAS_DDT_PARSE_TOKEN_COLON);
+  return(XBT_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;
xbt_ddt_parse_line_pos++; 
xbt_ddt_parse_char_pos++;
xbt_ddt_parse_col_pos=0;
   SHOW_WHERE;
 }
        YY_BREAK
 case 25:
 YY_RULE_SETUP
 { 
-  gras_ddt_parse_char_pos++;
-  gras_ddt_parse_col_pos++;
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
   SHOW_WHERE;
 }
        YY_BREAK
@@ -1034,15 +1034,15 @@ case YY_STATE_EOF(foo):
                        {
                        /* 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
+                        * just pointed xbt_ddt_parse_in at a new source and called
+                        * xbt_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_input_file = xbt_ddt_parse_in;
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
                        }
 
@@ -1095,11 +1095,11 @@ case YY_STATE_EOF(foo):
                                {
                                (yy_did_buffer_switch_on_eof) = 0;
 
-                               if ( gras_ddt_parse_wrap( ) )
+                               if ( xbt_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
+                                        * xbt_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
@@ -1148,7 +1148,7 @@ case YY_STATE_EOF(foo):
                        "fatal flex scanner internal error--no action found" );
        } /* end of action switch */
                } /* end of scanning one token */
-} /* end of gras_ddt_parse_lex */
+} /* end of xbt_ddt_parse_lex */
 
 /* yy_get_next_buffer - try to read in a new buffer
  *
@@ -1226,7 +1226,7 @@ static int yy_get_next_buffer (void)
 
                                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  );
+                                       xbt_ddt_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
                                }
                        else
                                /* Can't grow it, we don't own it. */
@@ -1258,7 +1258,7 @@ static int yy_get_next_buffer (void)
                if ( number_to_move == YY_MORE_ADJ )
                        {
                        ret_val = EOB_ACT_END_OF_FILE;
-                       gras_ddt_parse_restart(gras_ddt_parse_in  );
+                       xbt_ddt_parse_restart(xbt_ddt_parse_in  );
                        }
 
                else
@@ -1275,7 +1275,7 @@ static int yy_get_next_buffer (void)
        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  );
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xbt_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()" );
        }
@@ -1352,7 +1352,7 @@ static int yy_get_next_buffer (void)
     
     yy_cp = (yy_c_buf_p);
 
-       /* undo effects of setting up gras_ddt_parse_text */
+       /* undo effects of setting up xbt_ddt_parse_text */
        *yy_cp = (yy_hold_char);
 
        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
@@ -1424,13 +1424,13 @@ static int yy_get_next_buffer (void)
                                         */
 
                                        /* Reset buffer status. */
-                                       gras_ddt_parse_restart(gras_ddt_parse_in );
+                                       xbt_ddt_parse_restart(xbt_ddt_parse_in );
 
                                        /*FALLTHROUGH*/
 
                                case EOB_ACT_END_OF_FILE:
                                        {
-                                       if ( gras_ddt_parse_wrap( ) )
+                                       if ( xbt_ddt_parse_wrap( ) )
                                                return EOF;
 
                                        if ( ! (yy_did_buffer_switch_on_eof) )
@@ -1450,7 +1450,7 @@ static int yy_get_next_buffer (void)
                }
 
        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve gras_ddt_parse_text */
+       *(yy_c_buf_p) = '\0';   /* preserve xbt_ddt_parse_text */
        (yy_hold_char) = *++(yy_c_buf_p);
 
        return c;
@@ -1462,32 +1462,32 @@ static int yy_get_next_buffer (void)
  * 
  * @note This function does not reset the start condition to @c INITIAL .
  */
-    void gras_ddt_parse_restart  (FILE * input_file )
+    void xbt_ddt_parse_restart  (FILE * input_file )
 {
     
        if ( ! YY_CURRENT_BUFFER ){
-        gras_ddt_parse_ensure_buffer_stack ();
+        xbt_ddt_parse_ensure_buffer_stack ();
                YY_CURRENT_BUFFER_LVALUE =
-            gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
+            xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE );
        }
 
-       gras_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
-       gras_ddt_parse__load_buffer_state( );
+       xbt_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
+       xbt_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 xbt_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);
+        *              xbt_ddt_parse_pop_buffer_state();
+        *              xbt_ddt_parse_push_buffer_state(new_buffer);
      */
-       gras_ddt_parse_ensure_buffer_stack ();
+       xbt_ddt_parse_ensure_buffer_stack ();
        if ( YY_CURRENT_BUFFER == new_buffer )
                return;
 
@@ -1500,21 +1500,21 @@ static int yy_get_next_buffer (void)
                }
 
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       gras_ddt_parse__load_buffer_state( );
+       xbt_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
+        * EOF (xbt_ddt_parse_wrap()) processing, but the only time this flag
+        * is looked at is after xbt_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 xbt_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;
+       xbt_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
        (yy_hold_char) = *(yy_c_buf_p);
 }
 
@@ -1524,35 +1524,35 @@ 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 xbt_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 )  );
+       b = (YY_BUFFER_STATE) xbt_ddt_parse_alloc(sizeof( struct yy_buffer_state )  );
        if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
+               YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse__create_buffer()" );
 
        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  );
+       b->yy_ch_buf = (char *) xbt_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_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse__create_buffer()" );
 
        b->yy_is_our_buffer = 1;
 
-       gras_ddt_parse__init_buffer(b,file );
+       xbt_ddt_parse__init_buffer(b,file );
 
        return b;
 }
 
 /** Destroy the buffer.
- * @param b a buffer created with gras_ddt_parse__create_buffer()
+ * @param b a buffer created with xbt_ddt_parse__create_buffer()
  * 
  */
-    void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE  b )
+    void xbt_ddt_parse__delete_buffer (YY_BUFFER_STATE  b )
 {
     
        if ( ! b )
@@ -1562,9 +1562,9 @@ static void gras_ddt_parse__load_buffer_state  (void)
                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
        if ( b->yy_is_our_buffer )
-               gras_ddt_parse_free((void *) b->yy_ch_buf  );
+               xbt_ddt_parse_free((void *) b->yy_ch_buf  );
 
-       gras_ddt_parse_free((void *) b  );
+       xbt_ddt_parse_free((void *) b  );
 }
 
 #ifndef __cplusplus
@@ -1573,20 +1573,20 @@ extern int isatty (int );
     
 /* 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.
+ * such as during a xbt_ddt_parse_restart() or at EOF.
  */
-    static void gras_ddt_parse__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
+    static void xbt_ddt_parse__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
 {
        int oerrno = errno;
     
-       gras_ddt_parse__flush_buffer(b );
+       xbt_ddt_parse__flush_buffer(b );
 
        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.
+    /* If b is the current buffer, then xbt_ddt_parse__init_buffer was _probably_
+     * called from xbt_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){
@@ -1603,7 +1603,7 @@ extern int isatty (int );
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  * 
  */
-    void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE  b )
+    void xbt_ddt_parse__flush_buffer (YY_BUFFER_STATE  b )
 {
        if ( ! b )
                return;
@@ -1623,7 +1623,7 @@ extern int isatty (int );
        b->yy_buffer_status = YY_BUFFER_NEW;
 
        if ( b == YY_CURRENT_BUFFER )
-               gras_ddt_parse__load_buffer_state( );
+               xbt_ddt_parse__load_buffer_state( );
 }
 
 /** Pushes the new state onto the stack. The new state becomes
@@ -1632,14 +1632,14 @@ extern int isatty (int );
  *  @param new_buffer The new state.
  *  
  */
-void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
+void xbt_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
 {
        if (new_buffer == NULL)
                return;
 
-       gras_ddt_parse_ensure_buffer_stack();
+       xbt_ddt_parse_ensure_buffer_stack();
 
-       /* This block is copied from gras_ddt_parse__switch_to_buffer. */
+       /* This block is copied from xbt_ddt_parse__switch_to_buffer. */
        if ( YY_CURRENT_BUFFER )
                {
                /* Flush out information for old buffer. */
@@ -1653,8 +1653,8 @@ void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_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( );
+       /* copied from xbt_ddt_parse__switch_to_buffer. */
+       xbt_ddt_parse__load_buffer_state( );
        (yy_did_buffer_switch_on_eof) = 1;
 }
 
@@ -1662,18 +1662,18 @@ void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
  *  The next element becomes the new top.
  *  
  */
-void gras_ddt_parse_pop_buffer_state (void)
+void xbt_ddt_parse_pop_buffer_state (void)
 {
        if (!YY_CURRENT_BUFFER)
                return;
 
-       gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
+       xbt_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( );
+               xbt_ddt_parse__load_buffer_state( );
                (yy_did_buffer_switch_on_eof) = 1;
        }
 }
@@ -1681,7 +1681,7 @@ void gras_ddt_parse_pop_buffer_state (void)
 /* 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 xbt_ddt_parse_ensure_buffer_stack (void)
 {
        int num_to_alloc;
     
@@ -1692,11 +1692,11 @@ static void gras_ddt_parse_ensure_buffer_stack (void)
                 * immediate realloc on the next call.
          */
                num_to_alloc = 1;
-               (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_alloc
+               (yy_buffer_stack) = (struct yy_buffer_state**)xbt_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()" );
+                       YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse_ensure_buffer_stack()" );
                                                                  
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                                
@@ -1711,12 +1711,12 @@ static void gras_ddt_parse_ensure_buffer_stack (void)
                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) = (struct yy_buffer_state**)xbt_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()" );
+                       YY_FATAL_ERROR( "out of dynamic memory in xbt_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*));
@@ -1730,7 +1730,7 @@ 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 xbt_ddt_parse__scan_buffer  (char * base, yy_size_t  size )
 {
        YY_BUFFER_STATE b;
     
@@ -1740,9 +1740,9 @@ YY_BUFFER_STATE gras_ddt_parse__scan_buffer  (char * base, yy_size_t  size )
                /* They forgot to leave room for the EOB's. */
                return 0;
 
-       b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state )  );
+       b = (YY_BUFFER_STATE) xbt_ddt_parse_alloc(sizeof( struct yy_buffer_state )  );
        if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_buffer()" );
+               YY_FATAL_ERROR( "out of dynamic memory in xbt_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;
@@ -1754,33 +1754,33 @@ YY_BUFFER_STATE gras_ddt_parse__scan_buffer  (char * base, yy_size_t  size )
        b->yy_fill_buffer = 0;
        b->yy_buffer_status = YY_BUFFER_NEW;
 
-       gras_ddt_parse__switch_to_buffer(b  );
+       xbt_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
+/** Setup the input buffer state to scan a string. The next call to xbt_ddt_parse_lex() will
  * scan from a @e copy of @a str.
  * @param yystr a NUL-terminated string to scan
  * 
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
- *       gras_ddt_parse__scan_bytes() instead.
+ *       xbt_ddt_parse__scan_bytes() instead.
  */
-YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yystr )
+YY_BUFFER_STATE xbt_ddt_parse__scan_string (yyconst char * yystr )
 {
     
-       return gras_ddt_parse__scan_bytes(yystr,strlen(yystr) );
+       return xbt_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
+/** Setup the input buffer state to scan the given bytes. The next call to xbt_ddt_parse_lex() will
  * scan from a @e copy of @a bytes.
  * @param yybytes the byte buffer to scan
  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE gras_ddt_parse__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE xbt_ddt_parse__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
 {
        YY_BUFFER_STATE b;
        char *buf;
@@ -1789,18 +1789,18 @@ YY_BUFFER_STATE gras_ddt_parse__scan_bytes  (yyconst char * yybytes, int  _yybyt
     
        /* Get memory for full buffer, including space for trailing EOB's. */
        n = _yybytes_len + 2;
-       buf = (char *) gras_ddt_parse_alloc(n  );
+       buf = (char *) xbt_ddt_parse_alloc(n  );
        if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_bytes()" );
+               YY_FATAL_ERROR( "out of dynamic memory in xbt_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 );
+       b = xbt_ddt_parse__scan_buffer(buf,n );
        if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in gras_ddt_parse__scan_bytes()" );
+               YY_FATAL_ERROR( "bad buffer in xbt_ddt_parse__scan_bytes()" );
 
        /* It's okay to grow etc. this buffer, and we should throw it
         * away when we're done.
@@ -1826,14 +1826,14 @@ static void yy_fatal_error (yyconst char* msg )
 #define yyless(n) \
        do \
                { \
-               /* Undo effects of setting up gras_ddt_parse_text. */ \
+               /* Undo effects of setting up xbt_ddt_parse_text. */ \
         int yyless_macro_arg = (n); \
         YY_LESS_LINENO(yyless_macro_arg);\
-               gras_ddt_parse_text[gras_ddt_parse_leng] = (yy_hold_char); \
-               (yy_c_buf_p) = gras_ddt_parse_text + yyless_macro_arg; \
+               xbt_ddt_parse_text[xbt_ddt_parse_leng] = (yy_hold_char); \
+               (yy_c_buf_p) = xbt_ddt_parse_text + yyless_macro_arg; \
                (yy_hold_char) = *(yy_c_buf_p); \
                *(yy_c_buf_p) = '\0'; \
-               gras_ddt_parse_leng = yyless_macro_arg; \
+               xbt_ddt_parse_leng = yyless_macro_arg; \
                } \
        while ( 0 )
 
@@ -1842,85 +1842,85 @@ static void yy_fatal_error (yyconst char* msg )
 /** Get the current line number.
  * 
  */
-int gras_ddt_parse_get_lineno  (void)
+int xbt_ddt_parse_get_lineno  (void)
 {
         
-    return gras_ddt_parse_lineno;
+    return xbt_ddt_parse_lineno;
 }
 
 /** Get the input stream.
  * 
  */
-FILE *gras_ddt_parse_get_in  (void)
+FILE *xbt_ddt_parse_get_in  (void)
 {
-        return gras_ddt_parse_in;
+        return xbt_ddt_parse_in;
 }
 
 /** Get the output stream.
  * 
  */
-FILE *gras_ddt_parse_get_out  (void)
+FILE *xbt_ddt_parse_get_out  (void)
 {
-        return gras_ddt_parse_out;
+        return xbt_ddt_parse_out;
 }
 
 /** Get the length of the current token.
  * 
  */
-int gras_ddt_parse_get_leng  (void)
+int xbt_ddt_parse_get_leng  (void)
 {
-        return gras_ddt_parse_leng;
+        return xbt_ddt_parse_leng;
 }
 
 /** Get the current token.
  * 
  */
 
-char *gras_ddt_parse_get_text  (void)
+char *xbt_ddt_parse_get_text  (void)
 {
-        return gras_ddt_parse_text;
+        return xbt_ddt_parse_text;
 }
 
 /** Set the current line number.
  * @param line_number
  * 
  */
-void gras_ddt_parse_set_lineno (int  line_number )
+void xbt_ddt_parse_set_lineno (int  line_number )
 {
     
-    gras_ddt_parse_lineno = line_number;
+    xbt_ddt_parse_lineno = line_number;
 }
 
 /** Set the input stream. This does not discard the current
  * input buffer.
  * @param in_str A readable stream.
  * 
- * @see gras_ddt_parse__switch_to_buffer
+ * @see xbt_ddt_parse__switch_to_buffer
  */
-void gras_ddt_parse_set_in (FILE *  in_str )
+void xbt_ddt_parse_set_in (FILE *  in_str )
 {
-        gras_ddt_parse_in = in_str ;
+        xbt_ddt_parse_in = in_str ;
 }
 
-void gras_ddt_parse_set_out (FILE *  out_str )
+void xbt_ddt_parse_set_out (FILE *  out_str )
 {
-        gras_ddt_parse_out = out_str ;
+        xbt_ddt_parse_out = out_str ;
 }
 
-int gras_ddt_parse_get_debug  (void)
+int xbt_ddt_parse_get_debug  (void)
 {
-        return gras_ddt_parse__flex_debug;
+        return xbt_ddt_parse__flex_debug;
 }
 
-void gras_ddt_parse_set_debug (int  bdebug )
+void xbt_ddt_parse_set_debug (int  bdebug )
 {
-        gras_ddt_parse__flex_debug = bdebug ;
+        xbt_ddt_parse__flex_debug = bdebug ;
 }
 
 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.
+     * This function is called from xbt_ddt_parse_lex_destroy(), so don't allocate here.
      */
 
     (yy_buffer_stack) = 0;
@@ -1932,36 +1932,36 @@ static int yy_init_globals (void)
 
 /* Defined in main.c */
 #ifdef YY_STDINIT
-    gras_ddt_parse_in = stdin;
-    gras_ddt_parse_out = stdout;
+    xbt_ddt_parse_in = stdin;
+    xbt_ddt_parse_out = stdout;
 #else
-    gras_ddt_parse_in = (FILE *) 0;
-    gras_ddt_parse_out = (FILE *) 0;
+    xbt_ddt_parse_in = (FILE *) 0;
+    xbt_ddt_parse_out = (FILE *) 0;
 #endif
 
     /* For future reference: Set errno on error, since we are called by
-     * gras_ddt_parse_lex_init()
+     * xbt_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)
+/* xbt_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
+int xbt_ddt_parse_lex_destroy  (void)
 {
     
     /* Pop the buffer stack, destroying each element. */
        while(YY_CURRENT_BUFFER){
-               gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER  );
+               xbt_ddt_parse__delete_buffer(YY_CURRENT_BUFFER  );
                YY_CURRENT_BUFFER_LVALUE = NULL;
-               gras_ddt_parse_pop_buffer_state();
+               xbt_ddt_parse_pop_buffer_state();
        }
 
        /* Destroy the stack itself. */
-       gras_ddt_parse_free((yy_buffer_stack) );
+       xbt_ddt_parse_free((yy_buffer_stack) );
        (yy_buffer_stack) = NULL;
 
     /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * gras_ddt_parse_lex() is called, initialization will occur. */
+     * xbt_ddt_parse_lex() is called, initialization will occur. */
     yy_init_globals( );
 
     return 0;
@@ -1991,12 +1991,12 @@ static int yy_flex_strlen (yyconst char * s )
 }
 #endif
 
-void *gras_ddt_parse_alloc (yy_size_t  size )
+void *xbt_ddt_parse_alloc (yy_size_t  size )
 {
        return (void *) malloc( size );
 }
 
-void *gras_ddt_parse_realloc  (void * ptr, yy_size_t  size )
+void *xbt_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
@@ -2008,72 +2008,72 @@ void *gras_ddt_parse_realloc  (void * ptr, yy_size_t  size )
        return (void *) realloc( (char *) ptr, size );
 }
 
-void gras_ddt_parse_free (void * ptr )
+void xbt_ddt_parse_free (void * ptr )
 {
-       free( (char *) ptr );   /* see gras_ddt_parse_realloc() for (char *) cast */
+       free( (char *) ptr );   /* see xbt_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 xbt_ddt_parse_dump(void) {
+  switch(xbt_ddt_parse_tok_num) {
+  case XBT_DDT_PARSE_TOKEN_LA      : {printf("TOKEN_LA ");break;}
+  case XBT_DDT_PARSE_TOKEN_RA      : {printf("TOKEN_RA ");break;}
+  case XBT_DDT_PARSE_TOKEN_WORD    : {printf("TOKEN_WORD ");break;}
+    /*  case XBT_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}*/
+    /*  case XBT_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
+  case XBT_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
+  case XBT_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
+  default             : {printf("Unknown token %d\n", xbt_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",xbt_ddt_parse_text,xbt_ddt_parse_line_pos,xbt_ddt_parse_char_pos);
   return;
 }
 
-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);
+int xbt_ddt_parse_lex_n_dump(void) {
+  xbt_ddt_parse_tok_num = xbt_ddt_parse_lex();
+  /*  xbt_ddt_parse_char_pos += strlen(xbt_ddt_parse_text);*/
+  return(xbt_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 );
-  gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer);
+void  xbt_ddt_parse_pointer_init(const char *file) {
+  xbt_ddt_file_to_parse = fopen(file,"r");
+  xbt_ddt_input_buffer = xbt_ddt_parse__create_buffer(xbt_ddt_file_to_parse,10 );
+  xbt_ddt_parse__switch_to_buffer(xbt_ddt_input_buffer);
 
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_col_pos = 0;
-  gras_ddt_parse_tok_num = 0;
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_col_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
 }
 
-void  gras_ddt_parse_pointer_close(void) {
-  gras_ddt_parse__delete_buffer(gras_ddt_input_buffer);
-  fclose(gras_ddt_file_to_parse);
+void  xbt_ddt_parse_pointer_close(void) {
+  xbt_ddt_parse__delete_buffer(xbt_ddt_input_buffer);
+  fclose(xbt_ddt_file_to_parse);
 
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_tok_num = 0;
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_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  xbt_ddt_parse_pointer_string_init(const char *string_to_parse) {
+  xbt_ddt_input_buffer = xbt_ddt_parse__scan_string (string_to_parse);
   definition = string_to_parse;
-  gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer);
+  xbt_ddt_parse__switch_to_buffer(xbt_ddt_input_buffer);
 
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_tok_num = 0;
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
 }
 
-void  gras_ddt_parse_pointer_string_close(void) {
-  gras_ddt_parse__delete_buffer(gras_ddt_input_buffer);
+void  xbt_ddt_parse_pointer_string_close(void) {
+  xbt_ddt_parse__delete_buffer(xbt_ddt_input_buffer);
 
-  gras_ddt_parse_line_pos = 1;
-  gras_ddt_parse_char_pos = 0;
-  gras_ddt_parse_tok_num = 0;
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
 
   if (0)
     yyunput('\0',NULL); /* fake a use of this function to calm gcc down */
diff --git a/src/xbt/datadesc/ddt_parse.yy.h b/src/xbt/datadesc/ddt_parse.yy.h
new file mode 100644 (file)
index 0000000..ff15725
--- /dev/null
@@ -0,0 +1,64 @@
+/* ddt_parse.h -- automatic parsing of data structures                      */
+
+/* Copyright (c) 2004, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+typedef enum {
+  XBT_DDT_PARSE_TOKEN_EMPTY = 0,
+  XBT_DDT_PARSE_TOKEN_LA = 512,        /* { 'A' for the french "accolade" since there is a name conflict in english (braket/brace) */
+  XBT_DDT_PARSE_TOKEN_RA,      /* } */
+  XBT_DDT_PARSE_TOKEN_LB,      /* [ */
+  XBT_DDT_PARSE_TOKEN_RB,      /* ] */
+  XBT_DDT_PARSE_TOKEN_LP,      /* ( */
+  XBT_DDT_PARSE_TOKEN_RP,      /* ) */
+  XBT_DDT_PARSE_TOKEN_WORD,
+  XBT_DDT_PARSE_TOKEN_SPACE,
+  XBT_DDT_PARSE_TOKEN_COMMENT,
+  XBT_DDT_PARSE_TOKEN_ANNOTATE,
+  XBT_DDT_PARSE_TOKEN_NEWLINE,
+  XBT_DDT_PARSE_TOKEN_STAR,
+  XBT_DDT_PARSE_TOKEN_SEMI_COLON,
+  XBT_DDT_PARSE_TOKEN_COLON,   /* impossible since the macro think that it's a arg separator. 
+                                   But handle anyway for the *vicious* calling xbt_ddt_parse manually */
+  XBT_DDT_PARSE_TOKEN_ERROR
+} xbt_ddt_parse_token_t;
+
+#define XBT_DDT_PARSE_MAX_STR_CONST 4048
+
+extern int xbt_ddt_parse_line_pos;
+extern int xbt_ddt_parse_col_pos;
+extern int xbt_ddt_parse_char_pos;
+extern int xbt_ddt_parse_tok_num;
+
+void xbt_ddt_parse_dump(void);
+int xbt_ddt_parse_lex_n_dump(void);
+void xbt_ddt_parse_pointer_init(const char *file);
+void xbt_ddt_parse_pointer_close(void);
+void xbt_ddt_parse_pointer_string_init(const char *string_to_parse);
+void xbt_ddt_parse_pointer_string_close(void);
+
+/* prototypes of the functions offered by flex */
+int xbt_ddt_parse_lex(void);
+int xbt_ddt_parse_get_lineno(void);
+FILE *xbt_ddt_parse_get_in(void);
+FILE *xbt_ddt_parse_get_out(void);
+int xbt_ddt_parse_get_leng(void);
+char *xbt_ddt_parse_get_text(void);
+void xbt_ddt_parse_set_lineno(int line_number);
+void xbt_ddt_parse_set_in(FILE * in_str);
+void xbt_ddt_parse_set_out(FILE * out_str);
+int xbt_ddt_parse_get_debug(void);
+void xbt_ddt_parse_set_debug(int bdebug);
+int xbt_ddt_parse_lex_destroy(void);
+
+#define PARSE_ERROR(...)                                                \
+  PARSE_ERROR_(__VA_ARGS__,                                             \
+               xbt_ddt_parse_line_pos, xbt_ddt_parse_col_pos, definition)
+#define PARSE_ERROR_(fmt, ...)                           \
+  do {                                                   \
+    XBT_ERROR(fmt " at %d:%d of :\n%s", __VA_ARGS__);   \
+    xbt_abort();                                         \
+  } while (0)
diff --git a/src/xbt/datadesc/ddt_parse.yy.l b/src/xbt/datadesc/ddt_parse.yy.l
new file mode 100644 (file)
index 0000000..bc56045
--- /dev/null
@@ -0,0 +1,238 @@
+/* DataDesc/ddt_parse -- automatic parsing of data structures */
+
+/* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. 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. */
+
+%option noyywrap
+%{
+#include "xbt/DataDesc/datadesc_private.h"
+#include "xbt/DataDesc/ddt_parse.yy.h"
+#include <string.h>
+  YY_BUFFER_STATE xbt_ddt_input_buffer;
+  FILE *xbt_ddt_file_to_parse;
+
+  int xbt_ddt_parse_line_pos = 1;
+  int xbt_ddt_parse_col_pos = 0;
+  int xbt_ddt_parse_char_pos = 0;
+  int xbt_ddt_parse_tok_num = 0;
+  const char *definition;
+  XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_lexer,xbt_ddt_parse,"The crude internals of the lexer used for type parsing");
+#define SHOW_WHERE XBT_DEBUG("%d:%d (char #%d): seen '%s'", xbt_ddt_parse_line_pos,xbt_ddt_parse_col_pos,xbt_ddt_parse_char_pos,yytext)
+%}
+
+%x annotate comment foo
+space           [ \t]
+letter          [A-Za-z._-]
+digit           [0-9]
+
+%%
+   int comment_caller=0;
+   int annotate_caller=0;
+
+"//"[^\n]*
+
+"/*g"{space}* { /****************** ANNOTATION ************************/
+  XBT_DEBUG("Begin annotation");
+  annotate_caller = INITIAL;
+  xbt_ddt_parse_char_pos+= strlen(yytext);
+  xbt_ddt_parse_col_pos+= strlen(yytext);
+  BEGIN(annotate);
+}
+<foo>"/*g"{space}* { /* trim annotation */
+  XBT_DEBUG("Begin annotation");
+  annotate_caller = foo;
+  xbt_ddt_parse_char_pos+= strlen(yytext);
+  xbt_ddt_parse_col_pos+= strlen(yytext);
+  BEGIN(annotate);
+}
+
+<annotate>{space}*"g*/" {
+  XBT_DEBUG("End annotation");
+  xbt_ddt_parse_char_pos+= strlen(yytext);
+  xbt_ddt_parse_col_pos+= strlen(yytext);
+  BEGIN(annotate_caller);
+}
+
+<annotate>"*/" {
+  PARSE_ERROR("``/*g'' construct closed by a regular ``*/''");
+}
+<annotate>\n  {
+  PARSE_ERROR("Type annotation cannot spread over several lines");
+}
+
+<annotate>.* { /* eat the rest */
+  xbt_ddt_parse_char_pos+= strlen(yytext);
+  xbt_ddt_parse_col_pos+= strlen(yytext);
+  return XBT_DDT_PARSE_TOKEN_ANNOTATE;
+}
+
+"/*[^g]"   { /****************** COMMENTS ************************/
+  /* constructs like : */
+    /*g [string] g*/ 
+  /* are not comments but size annotations */
+  comment_caller = INITIAL;
+  BEGIN(comment);
+}
+
+<foo>"/*[^g]"    {
+  comment_caller = foo;
+  BEGIN(comment);
+}
+
+<comment>[^*\n]*      { /* eat anything that's not a '*' */
+}
+<comment>"*"+[^*/\n]* { /* eat up '*'s not followed by '/'s */
+}
+<comment>\n             {
+  ++xbt_ddt_parse_line_pos;
+  xbt_ddt_parse_col_pos=0;
+  xbt_ddt_parse_char_pos++;
+}
+<comment>"*"+"/" {
+  xbt_ddt_parse_char_pos+= strlen(yytext);
+  xbt_ddt_parse_col_pos+= strlen(yytext);
+  BEGIN(comment_caller);
+}
+
+({letter}|{digit})* {  /****************** STATEMENTS ************************/
+  xbt_ddt_parse_char_pos += strlen(yytext);
+  xbt_ddt_parse_col_pos += strlen(yytext);
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_WORD);
+}
+"{"  { 
+  xbt_ddt_parse_char_pos++; 
+  xbt_ddt_parse_col_pos++; 
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_LA);
+}
+"}" {
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_RA);
+}
+"["  { 
+  xbt_ddt_parse_char_pos++; 
+  xbt_ddt_parse_col_pos++; 
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_LB);
+}
+"]" {
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_RB);
+}
+"("  { 
+  xbt_ddt_parse_char_pos++; 
+  xbt_ddt_parse_col_pos++; 
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_LP);
+}
+")" {
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_RP);
+}
+"*" {
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_STAR);
+}
+";" {
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_SEMI_COLON);
+}
+"," { 
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+  return(XBT_DDT_PARSE_TOKEN_COLON);
+}
+"\n" {
+ xbt_ddt_parse_line_pos++; 
+ xbt_ddt_parse_char_pos++;
+ xbt_ddt_parse_col_pos=0;
+  SHOW_WHERE;
+}
+. { 
+  xbt_ddt_parse_char_pos++;
+  xbt_ddt_parse_col_pos++;
+  SHOW_WHERE;
+}
+%%
+/* {space}+                { return(TOKEN_SPACE);} */
+
+void xbt_ddt_parse_dump(void) {
+  switch(xbt_ddt_parse_tok_num) {
+  case XBT_DDT_PARSE_TOKEN_LA      : {printf("TOKEN_LA ");break;}
+  case XBT_DDT_PARSE_TOKEN_RA      : {printf("TOKEN_RA ");break;}
+  case XBT_DDT_PARSE_TOKEN_WORD    : {printf("TOKEN_WORD ");break;}
+    /*  case XBT_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}*/
+    /*  case XBT_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
+  case XBT_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
+  case XBT_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
+  default             : {printf("Unknown token %d\n", xbt_ddt_parse_tok_num);return;}
+  }
+  printf("-->%s<-- [line %d, pos %d]\n",yytext,xbt_ddt_parse_line_pos,xbt_ddt_parse_char_pos);
+  return;
+}
+
+int xbt_ddt_parse_lex_n_dump(void) {
+  xbt_ddt_parse_tok_num = xbt_ddt_parse_lex();
+  /*  xbt_ddt_parse_char_pos += strlen(yytext);*/
+  return(xbt_ddt_parse_tok_num);
+}
+
+void  xbt_ddt_parse_pointer_init(const char *file) {
+  xbt_ddt_file_to_parse = fopen(file,"r");
+  xbt_ddt_input_buffer = yy_create_buffer( xbt_ddt_file_to_parse, 10 );
+  yy_switch_to_buffer(xbt_ddt_input_buffer);
+
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_col_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
+}
+
+void  xbt_ddt_parse_pointer_close(void) {
+  yy_delete_buffer(xbt_ddt_input_buffer);
+  fclose(xbt_ddt_file_to_parse);
+
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
+}
+
+
+void  xbt_ddt_parse_pointer_string_init(const char *string_to_parse) {
+  xbt_ddt_input_buffer = yy_scan_string (string_to_parse);
+  definition = string_to_parse;
+  yy_switch_to_buffer(xbt_ddt_input_buffer);
+
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
+}
+
+void  xbt_ddt_parse_pointer_string_close(void) {
+  yy_delete_buffer(xbt_ddt_input_buffer);
+
+  xbt_ddt_parse_line_pos = 1;
+  xbt_ddt_parse_char_pos = 0;
+  xbt_ddt_parse_tok_num = 0;
+
+  if (0)
+    yyunput('\0',NULL); /* fake a use of this function to calm gcc down */
+}
+
+/* Local variables:*/
+/* mode: c */
+/* End: */
index db5e33e..d1b1d16 100644 (file)
@@ -44,6 +44,15 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_set);
 XBT_LOG_EXTERNAL_CATEGORY(xbt_sync_os);
 XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap);
 XBT_LOG_EXTERNAL_CATEGORY(xbt_parmap_unit);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_cbps);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_convert);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_create);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_exchange);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_lexer);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_ddt_parse);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_trp);
+XBT_LOG_EXTERNAL_CATEGORY(xbt_trp_meas);
 
 int _surf_do_model_check = 0;   /* this variable is used accros the libraries, and must be declared in XBT so that it's also defined in GRAS (not only in libsimgrid) */
 
@@ -114,16 +123,29 @@ static void xbt_preinit(void)
   XBT_LOG_CONNECT(xbt_sync_os, xbt);
   XBT_LOG_CONNECT(xbt_parmap,xbt);
   XBT_LOG_CONNECT(xbt_parmap_unit,xbt_parmap);
-
+  XBT_LOG_CONNECT(xbt_ddt, xbt);
+  XBT_LOG_CONNECT(xbt_ddt_cbps, xbt_ddt);
+  XBT_LOG_CONNECT(xbt_ddt_convert, xbt_ddt);
+  XBT_LOG_CONNECT(xbt_ddt_create, xbt_ddt);
+  XBT_LOG_CONNECT(xbt_ddt_exchange, xbt_ddt);
+  XBT_LOG_CONNECT(xbt_ddt_lexer, xbt_ddt_parse);
+  XBT_LOG_CONNECT(xbt_ddt_parse, xbt_ddt);
+  XBT_LOG_CONNECT(xbt_trp, xbt);
+  XBT_LOG_CONNECT(xbt_trp_meas, xbt_trp);
 
   xbt_backtrace_preinit();
   xbt_os_thread_mod_preinit();
   xbt_fifo_preinit();
   xbt_dict_preinit();
+  xbt_datadesc_preinit();
+  xbt_trp_preinit();
 }
 
 static void xbt_postexit(void)
 {
+  xbt_trp_postexit();
+  xbt_datadesc_postexit();
+
   xbt_backtrace_postexit();
 
   xbt_fifo_postexit();
diff --git a/src/xbt/xbt_socket.c b/src/xbt/xbt_socket.c
new file mode 100644 (file)
index 0000000..7587c14
--- /dev/null
@@ -0,0 +1,394 @@
+/* transport - low level communication                                      */
+
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+#include "xbt/ex.h"
+#include "xbt/peer.h"
+#include "xbt/dict.h"
+#include "xbt/socket.h"
+#include "xbt_modinter.h"
+#include "portable.h"
+#include "xbt_socket_private.h"
+#include "gras/Msg/msg_interface.h" /* FIXME */
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_trp, xbt,
+                                "Conveying bytes over the network");
+XBT_LOG_NEW_SUBCATEGORY(xbt_trp_meas, xbt_trp,
+                        "Conveying bytes over the network without formating for perf measurements");
+
+static short int xbt_trp_started = 0;
+static xbt_dict_t xbt_trp_plugins;          /* all registered plugins */
+static void xbt_trp_plugin_free(void *p);   /* free one of the plugins */
+
+void xbt_trp_plugin_new(const char *name, xbt_trp_setup_t setup)
+{
+  xbt_trp_plugin_t plug = xbt_new0(s_xbt_trp_plugin_t, 1);
+
+  XBT_DEBUG("Create plugin %s", name);
+
+  plug->name = xbt_strdup(name);
+  setup(plug);
+  xbt_dict_set(xbt_trp_plugins, name, plug, NULL);
+}
+
+void xbt_trp_preinit(void)
+{
+  if (!xbt_trp_started) {
+    /* make room for all plugins */
+    xbt_trp_plugins = xbt_dict_new_homogeneous(xbt_trp_plugin_free);
+
+#ifdef HAVE_WINSOCK2_H
+    /* initialize the windows mechanism */
+    {
+      WORD wVersionRequested;
+      WSADATA wsaData;
+
+      wVersionRequested = MAKEWORD(2, 0);
+      int res;
+      res = WSAStartup(wVersionRequested, &wsaData);
+      xbt_assert(res == 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_assert(LOBYTE(wsaData.wVersion) == 2 &&
+                  HIBYTE(wsaData.wVersion) == 0,
+                  "Cannot find a usable WinSock DLL");
+      XBT_INFO("Found and initialized winsock2");
+    }                           /* The WinSock DLL is acceptable. Proceed. */
+#elif HAVE_WINSOCK_H
+    {
+      WSADATA wsaData;
+      int res;
+      res = WSAStartup(0x0101, &wsaData);
+      xbt_assert(res == 0, "Cannot find a usable WinSock DLL");
+      XBT_INFO("Found and initialized winsock");
+    }
+#endif
+
+    /* create the TCP transport plugin */
+    xbt_trp_plugin_new("tcp", xbt_trp_tcp_setup);
+  }
+
+  xbt_trp_started++;
+}
+
+void xbt_trp_postexit(void)
+{
+  XBT_DEBUG("xbt_trp value %d", xbt_trp_started);
+  if (xbt_trp_started == 0) {
+    return;
+  }
+
+  if (--xbt_trp_started == 0) {
+#ifdef HAVE_WINSOCK_H
+    if (WSACleanup() == SOCKET_ERROR) {
+      if (WSAGetLastError() == WSAEINPROGRESS) {
+        WSACancelBlockingCall();
+        WSACleanup();
+      }
+    }
+#endif
+
+    /* Delete the plugins */
+    xbt_dict_free(&xbt_trp_plugins);
+  }
+}
+
+void xbt_trp_plugin_free(void *p)
+{
+  xbt_trp_plugin_t plug = p;
+
+  if (plug) {
+    if (plug->exit) {
+      plug->exit(plug);
+    } else if (plug->data) {
+      XBT_DEBUG("Plugin %s lacks exit(). Free data anyway.", plug->name);
+      free(plug->data);
+    }
+
+    free(plug->name);
+    free(plug);
+  }
+}
+
+
+/**
+ * xbt_trp_socket:
+ *
+ * Malloc a new socket with the TCP transport plugin and default parameters.
+ */
+void xbt_socket_new(int incoming, xbt_socket_t* dst)
+{
+  xbt_socket_new_ext(incoming, dst, xbt_trp_plugin_get_by_name("tcp"), 0, 0);
+}
+
+/**
+ * xbt_trp_socket_new:
+ *
+ * Malloc a new socket.
+ */
+void xbt_socket_new_ext(int incoming,
+                        xbt_socket_t * dst,
+                        xbt_trp_plugin_t plugin,
+                        unsigned long int buf_size,
+                        int measurement)
+{
+  xbt_socket_t sock = xbt_new0(s_xbt_socket_t, 1);
+
+  XBT_VERB("Create a new socket (%p)", (void *) sock);
+
+  sock->plugin = plugin;
+
+  sock->incoming = incoming ? 1 : 0;
+  sock->outgoing = incoming ? 0 : 1;
+  sock->accepting = incoming ? 1 : 0;
+  sock->meas = measurement;
+  sock->recvd = 0;
+  sock->valid = 1;
+  sock->moredata = 0;
+
+  sock->refcount = 1;
+  sock->buf_size = buf_size;
+  sock->sd = -1;
+
+  sock->data = NULL;
+  sock->bufdata = NULL;
+
+  *dst = sock;
+
+  XBT_OUT();
+}
+
+XBT_INLINE void* xbt_socket_get_data(xbt_socket_t sock) {
+  return sock->data;
+}
+
+XBT_INLINE void xbt_socket_set_data(xbt_socket_t sock, void* data) {
+  sock->data = data;
+}
+
+/**
+ * xbt_trp_send:
+ *
+ * Send a bunch of bytes from on socket
+ * (stable if we know the storage will keep as is until the next trp_flush)
+ */
+void xbt_trp_send(xbt_socket_t sd, char *data, long int size, int stable)
+{
+  xbt_assert(sd->outgoing, "Socket not suited for data send");
+  sd->plugin->send(sd, data, size, stable);
+}
+
+/**
+ * xbt_trp_recv:
+ *
+ * Receive a bunch of bytes from a socket
+ */
+void xbt_trp_recv(xbt_socket_t sd, char *data, long int size)
+{
+  xbt_assert(sd->incoming, "Socket not suited for data receive");
+  (sd->plugin->recv) (sd, data, size);
+}
+
+/**
+ * gras_trp_flush:
+ *
+ * Make sure all pending communications are done
+ */
+void xbt_trp_flush(xbt_socket_t sd)
+{
+  if (sd->plugin->flush)
+    (sd->plugin->flush) (sd);
+}
+
+xbt_trp_plugin_t xbt_trp_plugin_get_by_name(const char *name)
+{
+  return xbt_dict_get(xbt_trp_plugins, name);
+}
+
+int xbt_socket_my_port(xbt_socket_t sock)
+{
+  if (!sock->plugin->my_port)
+    THROWF(unknown_error, 0, "Function my_port unimplemented in plugin %s",sock->plugin->name);
+  return sock->plugin->my_port(sock);
+}
+
+int xbt_socket_peer_port(xbt_socket_t sock)
+{
+  if (!sock->plugin->peer_port)
+    THROWF(unknown_error, 0, "Function peer_port unimplemented in plugin %s",sock->plugin->name);
+  return sock->plugin->peer_port(sock);
+}
+
+const char *xbt_socket_peer_name(xbt_socket_t sock)
+{
+  xbt_assert(sock->plugin);
+  return sock->plugin->peer_name(sock);
+}
+
+const char *xbt_socket_peer_proc(xbt_socket_t sock)
+{
+  return sock->plugin->peer_proc(sock);
+}
+
+void xbt_socket_peer_proc_set(xbt_socket_t sock, char *peer_proc)
+{
+  return sock->plugin->peer_proc_set(sock,peer_proc);
+}
+
+/** \brief Check if the provided socket is a measurement one (or a regular one) */
+int xbt_socket_is_meas(xbt_socket_t sock)
+{
+  return sock->meas;
+}
+
+/** \brief Send a chunk of (random) data over a measurement socket
+ *
+ * @param peer measurement socket to use for the experiment
+ * @param timeout timeout (in seconds)
+ * @param msg_size size of each chunk sent over the socket (in bytes).
+ * @param msg_amount how many of these packets you want to send.
+ *
+ * Calls to xbt_socket_meas_send() and xbt_socket_meas_recv() on
+ * each side of the socket should be paired.
+ *
+ * The exchanged data is zeroed to make sure it's initialized, but
+ * there is no way to control what is sent (ie, you cannot use these
+ * functions to exchange data out of band).
+ *
+ * @warning: in SimGrid version 3.1 and previous, the numerical arguments
+ *           were the total amount of data to send and the msg_size. This
+ *           was changed for the fool wanting to send more than MAXINT
+ *           bytes in a fat pipe.
+ */
+void xbt_socket_meas_send(xbt_socket_t peer,
+                          unsigned int timeout,
+                          unsigned long int msg_size,
+                          unsigned long int msg_amount)
+{
+  char *chunk = NULL;
+  unsigned long int sent_sofar;
+
+  XBT_IN("");
+  THROWF(unknown_error, 0, "measurement sockets were broken in this release of SimGrid and should be ported back in the future."
+      "If you depend on it, sorry, you have to use an older version, or wait for the future version using it...");
+
+  if (peer->plugin == xbt_trp_plugin_get_by_name("tcp")) {
+    chunk = xbt_malloc0(msg_size);
+  }
+
+  xbt_assert(peer->meas,
+              "Asked to send measurement data on a regular socket");
+  xbt_assert(peer->outgoing,
+              "Socket not suited for data send (this is a server socket)");
+
+  for (sent_sofar = 0; sent_sofar < msg_amount; sent_sofar++) {
+    XBT_CDEBUG(xbt_trp_meas,
+            "Sent %lu msgs of %lu (size of each: %ld) to %s:%d",
+            sent_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer),
+            xbt_socket_peer_port(peer));
+    peer->plugin->raw_send(peer, chunk, msg_size);
+  }
+  XBT_CDEBUG(xbt_trp_meas,
+          "Sent %lu msgs of %lu (size of each: %ld) to %s:%d", sent_sofar,
+          msg_amount, msg_size, xbt_socket_peer_name(peer),
+          xbt_socket_peer_port(peer));
+
+  if (peer->plugin == xbt_trp_plugin_get_by_name("tcp")) {
+    free(chunk);
+  }
+
+  XBT_OUT();
+}
+
+/** \brief Receive a chunk of data over a measurement socket
+ *
+ * Calls to xbt_socket_meas_send() and xbt_socket_meas_recv() on
+ * each side of the socket should be paired.
+ *
+ * @warning: in SimGrid version 3.1 and previous, the numerical arguments
+ *           were the total amount of data to send and the msg_size. This
+ *           was changed for the fool wanting to send more than MAXINT
+ *           bytes in a fat pipe.
+ */
+void xbt_socket_meas_recv(xbt_socket_t peer,
+                           unsigned int timeout,
+                           unsigned long int msg_size,
+                           unsigned long int msg_amount)
+{
+
+  char *chunk = NULL;
+  unsigned long int got_sofar;
+
+  XBT_IN("");
+  THROWF(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future."
+      "If you depend on it, sorry, you have to use an older version, or wait for the future version using it...");
+
+  if (peer->plugin == xbt_trp_plugin_get_by_name("tcp")) {
+    chunk = xbt_malloc(msg_size);
+  }
+
+  xbt_assert(peer->meas,
+              "Asked to receive measurement data on a regular socket");
+  xbt_assert(peer->incoming, "Socket not suited for data receive");
+
+  for (got_sofar = 0; got_sofar < msg_amount; got_sofar++) {
+    XBT_CDEBUG(xbt_trp_meas,
+            "Recvd %ld msgs of %lu (size of each: %ld) from %s:%d",
+            got_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer),
+            xbt_socket_peer_port(peer));
+    (peer->plugin->raw_recv) (peer, chunk, msg_size);
+  }
+  XBT_CDEBUG(xbt_trp_meas,
+          "Recvd %ld msgs of %lu (size of each: %ld) from %s:%d",
+          got_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer),
+          xbt_socket_peer_port(peer));
+
+  if (peer->plugin == xbt_trp_plugin_get_by_name("tcp")) {
+    free(chunk);
+  }
+
+  XBT_OUT();
+}
+
+/**
+ * \brief Something similar to the good old accept system call.
+ *
+ * Make sure that there is someone speaking to the provided server socket.
+ * In RL, it does an accept(2) and return the result as last argument.
+ * In SG, as accepts are useless, it returns the provided argument as result.
+ * You should thus test whether (peer != accepted) before closing both of them.
+ *
+ * You should only call this on measurement sockets. It is automatically
+ * done for regular sockets, but you usually want more control about
+ * what's going on with measurement sockets.
+ */
+xbt_socket_t xbt_socket_meas_accept(xbt_socket_t peer)
+{
+  xbt_socket_t res;
+  THROWF(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future."
+      "If you depend on it, sorry, you have to use an older version, or wait for the future version using it...");
+
+  xbt_assert(peer->meas,
+              "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 */
+    return peer;
+  }
+
+  res = (peer->plugin->socket_accept) (peer);
+  res->meas = peer->meas;
+  XBT_CDEBUG(xbt_trp_meas, "meas_accepted onto %d", res->sd);
+
+  return res;
+}
diff --git a/src/xbt/xbt_socket_private.h b/src/xbt/xbt_socket_private.h
new file mode 100644 (file)
index 0000000..bf74ce8
--- /dev/null
@@ -0,0 +1,61 @@
+/* transport - low level communication (send/receive bunches of bytes)      */
+
+/* module's private interface masked even to other parts of XBT.           */
+
+/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * 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. */
+
+#ifndef XBT_SOCKET_PRIVATE_H
+#define XBT_SOCKET_PRIVATE_H
+
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
+#include "xbt/socket.h"
+
+/**
+ * s_xbt_trp_bufdata:
+ * 
+ * Description of a socket.
+ */
+typedef struct s_xbt_trp_bufdata xbt_trp_bufdata_t;
+
+typedef struct s_xbt_socket {
+
+  xbt_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 has left, 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 */
+
+  int refcount;                 /* refcounting on shared sockets */
+
+  unsigned long int buf_size;   /* what to say to the OS. 
+                                   Field here to remember it when accepting */
+
+  int sd;
+
+  void *data;                   /* userdata */
+  xbt_trp_bufdata_t *bufdata;   /* buffer userdata */
+} s_xbt_socket_t;
+
+void xbt_trp_tcp_setup(xbt_trp_plugin_t plug);
+
+#endif                          /* XBT_SOCKET_PRIVATE_H */
similarity index 72%
rename from src/gras/Transport/transport_plugin_tcp.c
rename to src/xbt/xbt_trp_plugin_tcp.c
index b74bf90..000016d 100644 (file)
@@ -1,4 +1,4 @@
-/* buf trp (transport) - buffered transport using the TCP one               */
+/* buffered transport using the TCP plugin or a custom one                  */
 
 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
  * All rights reserved.                                                     */
 #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 "xbt/xbt_socket_private.h"
+
+#include "gras/Transport/transport_interface.h" /* FIXME */
+#include "gras/Virtu/virtu_interface.h" /* FIXME */
+#include "gras/Msg/msg_interface.h" /* FIXME */
+extern int gras_trp_libdata_id; /* FIXME */
 
 /* FIXME maybe READV is sometime a good thing? */
 #undef HAVE_READV
 #include <sys/uio.h>
 #endif
 
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_trp_tcp, gras_trp,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_trp_tcp, xbt_trp,
                                 "TCP buffered transport");
 
 /***
@@ -39,7 +39,7 @@ typedef struct {
   int peer_port;                /* port on the other side */
   char *peer_name;              /* hostname of the other side */
   char *peer_proc;              /* process on the other side */
-} s_gras_trp_tcp_sock_data_t, *gras_trp_tcp_sock_data_t;
+} s_xbt_trp_tcp_sock_data_t, *xbt_trp_tcp_sock_data_t;
 
 typedef enum { buffering_buf, buffering_iov } buffering_kind;
 
@@ -47,13 +47,12 @@ typedef struct {
   int size;
   char *data;
   int pos;                      /* for receive; not exchanged over the net */
-} gras_trp_buf_t;
+} xbt_trp_buf_t;
 
-
-struct gras_trp_bufdata_ {
+struct s_xbt_trp_bufdata {
   int buffsize;
-  gras_trp_buf_t in_buf;
-  gras_trp_buf_t out_buf;
+  xbt_trp_buf_t in_buf;
+  xbt_trp_buf_t out_buf;
 
 #ifdef HAVE_READV
   xbt_dynar_t in_buf_v;
@@ -64,32 +63,32 @@ struct gras_trp_bufdata_ {
   buffering_kind out;
 };
 
-
 /*****************************/
 /****[ SOCKET MANAGEMENT ]****/
 /*****************************/
+
 /* 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);
-static int gras_trp_tcp_recv(gras_socket_t sock, char *data,
-                             unsigned long int size);
+static XBT_INLINE void xbt_trp_tcp_send(xbt_socket_t sock,
+                                        const char *data,
+                                        unsigned long int size);
+static int xbt_trp_tcp_recv(xbt_socket_t sock, char *data,
+                            unsigned long int size);
 
-
-static int _gras_tcp_proto_number(void);
+static int xbt_trp_tcp_proto_number(void);
+static void xbt_trp_sock_socket_close(xbt_socket_t sock);
 
 static XBT_INLINE
-void gras_trp_sock_socket_client(gras_trp_plugin_t ignored,
-                                 const char *host,
-                                 int port,
-                                 /*OUT*/gras_socket_t sock)
+void xbt_trp_sock_socket_client(xbt_trp_plugin_t ignored,
+                                const char *host,
+                                int port,
+                                /* OUT */ xbt_socket_t sock)
 {
-  gras_trp_tcp_sock_data_t sockdata = xbt_new(s_gras_trp_tcp_sock_data_t,1);
+  xbt_trp_tcp_sock_data_t sockdata = xbt_new(s_xbt_trp_tcp_sock_data_t,1);
   sockdata->port = port;
   sockdata->peer_proc = NULL;
   sockdata->peer_port = port;
-  sockdata->peer_name = (char *) strdup(host ? host : "localhost");
+  sockdata->peer_name = (char *) xbt_strdup(host ? host : "localhost");
   sock->data = sockdata;
 
   struct sockaddr_in addr;
@@ -137,7 +136,7 @@ void gras_trp_sock_socket_client(gras_trp_plugin_t ignored,
            sockdata->peer_name, sockdata->peer_port, sock_errstr(sock_errno));
   }
 
-  gras_trp_tcp_send(sock, (char *) &myport, sizeof(uint32_t));
+  xbt_trp_tcp_send(sock, (char *) &myport, sizeof(uint32_t));
   XBT_DEBUG("peerport sent to %d", sockdata->peer_port);
 
   XBT_VERB("Connect to %s:%d (sd=%d, port %d here)",
@@ -150,20 +149,20 @@ 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,
-                                 int port,
-                                 gras_socket_t sock)
+void xbt_trp_sock_socket_server(xbt_trp_plugin_t ignored,
+                                int port,
+                                xbt_socket_t sock)
 {
   int size = sock->buf_size;
   int on = 1;
   struct sockaddr_in server;
 
-  gras_trp_tcp_sock_data_t sockdata = xbt_new(s_gras_trp_tcp_sock_data_t,1);
+  xbt_trp_tcp_sock_data_t sockdata = xbt_new(s_xbt_trp_tcp_sock_data_t,1);
   sockdata->port = port;
   sockdata->peer_port = -1;
   sockdata->peer_name = NULL;
   sockdata->peer_proc = NULL;
-  sock->data=sockdata;
+  sock->data = sockdata;
 
   sock->outgoing = 1;           /* TCP => duplex mode */
 
@@ -207,9 +206,9 @@ void gras_trp_sock_socket_server(gras_trp_plugin_t ignored,
         sock->sd);
 }
 
-static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock)
+static xbt_socket_t xbt_trp_sock_socket_accept(xbt_socket_t sock)
 {
-  gras_socket_t res;
+  xbt_socket_t res;
 
   struct sockaddr_in peer_in;
   socklen_t peer_in_len = sizeof(peer_in);
@@ -223,34 +222,33 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock)
 
   uint32_t hisport;
 
-  int failed=0;
+  int failed = 0;
 
   XBT_IN("");
-  gras_trp_socket_new(1, &res);
+  xbt_socket_new_ext(1, &res, sock->plugin, sock->buf_size, 0);
 
   sd = accept(sock->sd, (struct sockaddr *) &peer_in, &peer_in_len);
   tmp_errno = sock_errno;
 
   if (sd == -1) {
-    gras_socket_close(sock);
+    xbt_trp_sock_socket_close(sock);
     THROWF(system_error, 0,
            "Accept failed (%s). Droping server socket.",
            sock_errstr(tmp_errno));
   }
 
-  if (_gras_tcp_proto_number()!=-1)
-    if (setsockopt(sd, _gras_tcp_proto_number(), TCP_NODELAY, (char *) &i,s))
-      failed=1;
+  if (xbt_trp_tcp_proto_number() != -1)
+    if (setsockopt(sd, xbt_trp_tcp_proto_number(), TCP_NODELAY, (char *) &i,s))
+      failed = 1;
 
   if (setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &i, s))
-    failed=1;
+    failed = 1;
 
   if (failed)
     THROWF(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,
@@ -263,12 +261,11 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock)
   res->outgoing = sock->outgoing;
   res->accepting = 0;
   res->sd = sd;
-  gras_trp_tcp_sock_data_t sockdata = xbt_new(s_gras_trp_tcp_sock_data_t,1);
+  xbt_trp_tcp_sock_data_t sockdata = xbt_new(s_xbt_trp_tcp_sock_data_t, 1);
   sockdata->port = -1;
-  res->data=sockdata;
-
+  res->data = sockdata;
 
-  gras_trp_tcp_recv(res, (char *) &hisport, sizeof(hisport));
+  xbt_trp_tcp_recv(res, (char *) &hisport, sizeof(hisport));
   sockdata->peer_port = ntohl(hisport);
   XBT_DEBUG("peerport %d received", sockdata->peer_port);
 
@@ -292,24 +289,23 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock)
   XBT_VERB("Accepted from %s:%d (sd=%d)", sockdata->peer_name, sockdata->peer_port, sd);
   xbt_dynar_push(((gras_trp_procdata_t)
                   gras_libdata_by_id(gras_trp_libdata_id))->sockets, &res);
+  /* FIXME we depend on GRAS here */
 
   XBT_OUT();
   return res;
 }
 
-static void gras_trp_sock_socket_close(gras_socket_t sock)
+static void xbt_trp_sock_socket_close(xbt_socket_t sock)
 {
-
   if (!sock)
     return;                     /* close only once */
 
-  free(((gras_trp_tcp_sock_data_t)sock->data)->peer_name);
+  free(((xbt_trp_tcp_sock_data_t)sock->data)->peer_name);
   free(sock->data);
 
   XBT_VERB("close tcp connection %d", sock->sd);
 
-  /* ask the listener to close the socket */
-  gras_msg_listener_close_socket(sock->sd);
+  gras_msg_listener_close_socket(sock->sd); /* FIXME */
 }
 
 /************************************/
@@ -322,11 +318,10 @@ 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)
+static XBT_INLINE void xbt_trp_tcp_send(xbt_socket_t sock,
+                                        const char *data,
+                                        unsigned long int size)
 {
-
   while (size) {
     int status = 0;
 
@@ -356,12 +351,11 @@ static XBT_INLINE void gras_trp_tcp_send(gras_socket_t sock,
 }
 
 static XBT_INLINE int
-gras_trp_tcp_recv_withbuffer(gras_socket_t sock,
-                             char *data,
-                             unsigned long int size,
-                             unsigned long int bufsize)
+xbt_trp_tcp_recv_withbuffer(xbt_socket_t sock,
+                            char *data,
+                            unsigned long int size,
+                            unsigned long int bufsize)
 {
-
   int got = 0;
 
   if (sock->recvd) {
@@ -382,8 +376,8 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock,
     if (status < 0) {
       THROWF(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);
+             sock->sd, data + got, (int) size, xbt_socket_peer_name(sock),
+             xbt_socket_peer_port(sock), sock_errstr(sock_errno), got);
     }
     XBT_DEBUG("Got %d more bytes (%s)", status,
            hexa_str((unsigned char *) data + got, status, 0));
@@ -401,10 +395,11 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock,
   return got;
 }
 
-static int gras_trp_tcp_recv(gras_socket_t sock,
-                             char *data, unsigned long int size)
+static int xbt_trp_tcp_recv(xbt_socket_t sock,
+                            char *data,
+                            unsigned long int size)
 {
-  return gras_trp_tcp_recv_withbuffer(sock, data, size, size);
+  return xbt_trp_tcp_recv_withbuffer(sock, data, size, size);
 
 }
 
@@ -417,24 +412,24 @@ 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 xbt_trp_bufiov_flush(xbt_socket_t sock)
 {
 #ifdef HAVE_READV
   xbt_dynar_t vect;
   int size;
 #endif
-  gras_trp_bufdata_t *data = sock->bufdata;
+  xbt_trp_bufdata_t *data = sock->bufdata;
   XBT_IN("");
 
   XBT_DEBUG("Flush");
   if (data->out == buffering_buf) {
-    if (XBT_LOG_ISENABLED(gras_trp_tcp, xbt_log_priority_debug))
+    if (XBT_LOG_ISENABLED(xbt_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) {
       XBT_DEBUG("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);
+             xbt_socket_peer_name(sock), xbt_socket_peer_port(sock));
+      xbt_trp_tcp_send(sock, data->out_buf.data, data->out_buf.size);
       XBT_VERB("Chunk sent (size=%d)", data->out_buf.size);
       data->out_buf.size = 0;
     }
@@ -464,12 +459,13 @@ static void gras_trp_bufiov_flush(gras_socket_t sock)
 }
 
 static void
-gras_trp_buf_send(gras_socket_t sock,
-                  const char *chunk,
-                  unsigned long int size, int stable_ignored)
+xbt_trp_buf_send(xbt_socket_t sock,
+                 const char *chunk,
+                 unsigned long int size,
+                 int stable_ignored)
 {
 
-  gras_trp_bufdata_t *data = (gras_trp_bufdata_t *) sock->bufdata;
+  xbt_trp_bufdata_t *data = (xbt_trp_bufdata_t *) sock->bufdata;
   int chunk_pos = 0;
 
   XBT_IN("");
@@ -493,17 +489,17 @@ gras_trp_buf_send(gras_socket_t sock,
            hexa_str((unsigned char *) chunk, chunk_pos, 0));
 
     if (data->out_buf.size == data->buffsize)   /* out of space. Flush it */
-      gras_trp_bufiov_flush(sock);
+      xbt_trp_bufiov_flush(sock);
   }
 
   XBT_OUT();
 }
 
 static int
-gras_trp_buf_recv(gras_socket_t sock, char *chunk, unsigned long int size)
+xbt_trp_buf_recv(xbt_socket_t sock, char *chunk, unsigned long int size)
 {
 
-  gras_trp_bufdata_t *data = sock->bufdata;
+  xbt_trp_bufdata_t *data = sock->bufdata;
   long int chunk_pos = 0;
 
   XBT_IN("");
@@ -518,12 +514,10 @@ gras_trp_buf_recv(gras_socket_t sock, char *chunk, unsigned long int size)
              (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);
+          xbt_trp_tcp_recv_withbuffer(sock, data->in_buf.data,
+                                      MIN(size - chunk_pos, data->buffsize),
+                                      data->buffsize);
 
       data->in_buf.pos = 0;
     }
@@ -555,15 +549,15 @@ gras_trp_buf_recv(gras_socket_t sock, char *chunk, unsigned long int size)
 /********************************/
 #ifdef HAVE_READV
 static void
-gras_trp_iov_send(gras_socket_t sock,
-                  const char *chunk, unsigned long int size, int stable)
+xbt_trp_iov_send(xbt_socket_t sock,
+                 const char *chunk, unsigned long int size, int stable)
 {
   struct iovec elm;
-  gras_trp_bufdata_t *data = (gras_trp_bufdata_t *) sock->bufdata;
+  xbt_trp_bufdata_t *data = (xbt_trp_bufdata_t *) sock->bufdata;
 
 
   XBT_DEBUG("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;
 
@@ -576,7 +570,7 @@ gras_trp_iov_send(gras_socket_t sock,
       elm.iov_base = (void *) chunk;
       xbt_dynar_push(data->out_buf_v, &elm);
 
-      gras_trp_bufiov_flush(sock);
+      xbt_trp_bufiov_flush(sock);
       return;
     } else {
       /* buffer big enough: 
@@ -597,7 +591,7 @@ gras_trp_iov_send(gras_socket_t sock,
 }
 
 static int
-gras_trp_iov_recv(gras_socket_t sock, char *chunk, unsigned long int size)
+xbt_trp_iov_recv(gras_socket_t sock, char *chunk, unsigned long int size)
 {
   struct iovec elm;
 
@@ -618,22 +612,22 @@ gras_trp_iov_recv(gras_socket_t sock, char *chunk, unsigned long int size)
 /***
  *** Prototypes of BUFFERED
  ***/
-
-void gras_trp_buf_socket_client(gras_trp_plugin_t self,
-    const char *host,
-    int port,
-                                gras_socket_t sock);
-void gras_trp_buf_socket_server(gras_trp_plugin_t self,
+static xbt_socket_t xbt_trp_buf_init_sock(xbt_socket_t sock);
+static void xbt_trp_buf_socket_client(xbt_trp_plugin_t self,
+                               const char *host,
+                               int port,
+                               xbt_socket_t sock);
+static void xbt_trp_buf_socket_server(xbt_trp_plugin_t self,
                                 int port,
-                                gras_socket_t sock);
-gras_socket_t gras_trp_buf_socket_accept(gras_socket_t sock);
+                                xbt_socket_t sock);
+static xbt_socket_t xbt_trp_buf_socket_accept(xbt_socket_t sock);
 
-void gras_trp_buf_socket_close(gras_socket_t sd);
+static void xbt_trp_buf_socket_close(xbt_socket_t sd);
 
 
-gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock)
+static xbt_socket_t xbt_trp_buf_init_sock(xbt_socket_t sock)
 {
-  gras_trp_bufdata_t *data = xbt_new(gras_trp_bufdata_t, 1);
+  xbt_trp_bufdata_t *data = xbt_new(xbt_trp_bufdata_t, 1);
 
   data->buffsize = 100 * 1024;  /* 100k */
 
@@ -663,105 +657,106 @@ gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock)
 /***
  *** Info about who's speaking
  ***/
-static int gras_trp_tcp_my_port(gras_socket_t s) {
-  gras_trp_tcp_sock_data_t sockdata = s->data;
+static int xbt_trp_tcp_my_port(xbt_socket_t s) {
+  xbt_trp_tcp_sock_data_t sockdata = s->data;
   return sockdata->port;
 }
-static int gras_trp_tcp_peer_port(gras_socket_t s) {
-  gras_trp_tcp_sock_data_t sockdata = s->data;
+
+static int xbt_trp_tcp_peer_port(xbt_socket_t s) {
+  xbt_trp_tcp_sock_data_t sockdata = s->data;
   return sockdata->peer_port;
 }
-static const char* gras_trp_tcp_peer_name(gras_socket_t s) {
-  gras_trp_tcp_sock_data_t sockdata = s->data;
+
+static const char* xbt_trp_tcp_peer_name(xbt_socket_t s) {
+  xbt_trp_tcp_sock_data_t sockdata = s->data;
   return sockdata->peer_name;
 }
-static const char* gras_trp_tcp_peer_proc(gras_socket_t s) {
-  gras_trp_tcp_sock_data_t sockdata = s->data;
+
+static const char* xbt_trp_tcp_peer_proc(xbt_socket_t s) {
+  xbt_trp_tcp_sock_data_t sockdata = s->data;
   return sockdata->peer_proc;
 }
-static void gras_trp_tcp_peer_proc_set(gras_socket_t s,char *name) {
-  gras_trp_tcp_sock_data_t sockdata = s->data;
+
+static void xbt_trp_tcp_peer_proc_set(xbt_socket_t s,char *name) {
+  xbt_trp_tcp_sock_data_t sockdata = s->data;
   sockdata->peer_proc = xbt_strdup(name);
 }
 
 /***
  *** Code
  ***/
-void gras_trp_tcp_setup(gras_trp_plugin_t plug)
+void xbt_trp_tcp_setup(xbt_trp_plugin_t plug)
 {
-
-  plug->my_port = gras_trp_tcp_my_port;
-  plug->peer_port = gras_trp_tcp_peer_port;
-  plug->peer_name = gras_trp_tcp_peer_name;
-  plug->peer_proc = gras_trp_tcp_peer_proc;
-  plug->peer_proc_set = gras_trp_tcp_peer_proc_set;
+  plug->my_port = xbt_trp_tcp_my_port;
+  plug->peer_port = xbt_trp_tcp_peer_port;
+  plug->peer_name = xbt_trp_tcp_peer_name;
+  plug->peer_proc = xbt_trp_tcp_peer_proc;
+  plug->peer_proc_set = xbt_trp_tcp_peer_proc_set;
 
 
-  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_client = xbt_trp_buf_socket_client;
+  plug->socket_server = xbt_trp_buf_socket_server;
+  plug->socket_accept = xbt_trp_buf_socket_accept;
+  plug->socket_close = xbt_trp_buf_socket_close;
 
 #ifdef HAVE_READV
-  plug->send = gras_trp_iov_send;
+  plug->send = xbt_trp_iov_send;
 #else
-  plug->send = gras_trp_buf_send;
+  plug->send = xbt_trp_buf_send;
 #endif
-  plug->recv = gras_trp_buf_recv;
+  plug->recv = xbt_trp_buf_recv;
 
-  plug->raw_send = gras_trp_tcp_send;
-  plug->raw_recv = gras_trp_tcp_recv;
+  plug->raw_send = xbt_trp_tcp_send;
+  plug->raw_recv = xbt_trp_tcp_recv;
 
-  plug->flush = gras_trp_bufiov_flush;
+  plug->flush = xbt_trp_bufiov_flush;
 
   plug->data = NULL;
   plug->exit = NULL;
 }
 
-void gras_trp_buf_socket_client(gras_trp_plugin_t self,
-    const char *host,
-    int port,
-                                /* OUT */ gras_socket_t sock)
+static void xbt_trp_buf_socket_client(xbt_trp_plugin_t self,
+                               const char *host,
+                               int port,
+                               /* OUT */ xbt_socket_t sock)
 {
-
-  gras_trp_sock_socket_client(NULL, host,port,sock);
-  gras_trp_buf_init_sock(sock);
+  xbt_trp_sock_socket_client(NULL, host, port, sock);
+  xbt_trp_buf_init_sock(sock);
 }
 
 /**
- * gras_trp_buf_socket_server:
+ * xbt_trp_buf_socket_server:
  *
  * Open a socket used to receive messages.
  */
-void gras_trp_buf_socket_server(gras_trp_plugin_t self,
-      int port,
-                                /* OUT */ gras_socket_t sock)
+static void xbt_trp_buf_socket_server(xbt_trp_plugin_t self,
+                               int port,
+                               /* OUT */ xbt_socket_t sock)
 {
-
-  gras_trp_sock_socket_server(NULL, port, sock);
-  gras_trp_buf_init_sock(sock);
+  xbt_trp_sock_socket_server(NULL, port, sock);
+  xbt_trp_buf_init_sock(sock);
 }
 
-gras_socket_t gras_trp_buf_socket_accept(gras_socket_t sock)
+static xbt_socket_t xbt_trp_buf_socket_accept(xbt_socket_t sock)
 {
-  return gras_trp_buf_init_sock(gras_trp_sock_socket_accept(sock));
+  return xbt_trp_buf_init_sock(xbt_trp_sock_socket_accept(sock));
 }
 
-void gras_trp_buf_socket_close(gras_socket_t sock)
+static void xbt_trp_buf_socket_close(xbt_socket_t sock)
 {
-  gras_trp_bufdata_t *data = sock->bufdata;
+  xbt_trp_bufdata_t *data = sock->bufdata;
 
   if (data->in_buf.size != data->in_buf.pos) {
     XBT_WARN("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);
+        data->in_buf.size - data->in_buf.pos,
+        data->in_buf.size, data->in_buf.pos);
   }
   free(data->in_buf.data);
 
   if (data->out_buf.size != data->out_buf.pos) {
     XBT_DEBUG("Flush the socket before closing (in=%d,out=%d)",
            data->in_buf.size, data->out_buf.size);
-    gras_trp_bufiov_flush(sock);
+    xbt_trp_bufiov_flush(sock);
   }
   free(data->out_buf.data);
 
@@ -774,14 +769,14 @@ void gras_trp_buf_socket_close(gras_socket_t sock)
   if (data->out_buf_v) {
     if (!xbt_dynar_is_empty(data->out_buf_v)) {
       XBT_DEBUG("Flush the socket before closing");
-      gras_trp_bufiov_flush(sock);
+      xbt_trp_bufiov_flush(sock);
     }
     xbt_dynar_free(&data->out_buf_v);
   }
 #endif
 
   free(data);
-  gras_trp_sock_socket_close(sock);
+  xbt_trp_sock_socket_close(sock);
 }
 
 /****************************/
@@ -793,7 +788,7 @@ 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 xbt_trp_tcp_proto_number(void)
 {
   struct protoent *fetchedEntry;
   static int returnValue = 0;
@@ -814,7 +809,7 @@ static int _gras_tcp_proto_number(void)
 #ifdef HAVE_WINSOCK_H
 #define RETSTR( x ) case x: return #x
 
-const char *gras_wsa_err2string(int err)
+const char *xbt_wsa_err2string(int err)
 {
   switch (err) {
     RETSTR(WSAEINTR);
index 491c1db..2e2d829 100644 (file)
@@ -26,6 +26,11 @@ void xbt_dict_postexit(void);
 void xbt_os_thread_mod_preinit(void);
 void xbt_os_thread_mod_postexit(void);
 
+void xbt_trp_preinit(void);
+void xbt_trp_postexit(void);
+void xbt_datadesc_preinit(void);
+void xbt_datadesc_postexit(void);
+
 void mmalloc_preinit(void);
 void mmalloc_postexit(void);
 
index df4bd1e..eca7355 100644 (file)
@@ -3,14 +3,9 @@ difference with the examples/gras directory is that what's in here
 tests some corner case that nobody would try in the first place. Here
 is a list of the directory content:
 
-datadesc/ Tests the marshalling facilities, trying to read messages
-         comming from all the known architectures. This is done by
-         storing these messages in files and loading them as if they
-         were comming from a socket.
-                 
 empty_main/ Once upon a time, GRAS was broken when processes did
            nothing. This test is here to ensure that this never
            happen again.
            
 msg_handle/ Ensures the wanted semantic for gras_msg_handle(i) when
-            i<0, i==0 and i>0.
\ No newline at end of file
+            i<0, i==0 and i>0.
index 57fb7e1..c9bb728 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);
+void write_read(const char *type,void *src, void *dst, xbt_socket_t *sock, int direction);
+
+XBT_DEFINE_TYPE(cccc,struct cccc { char a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(ccsc,struct ccsc { char a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(ccic,struct ccic { char a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(cclc,struct cclc { char a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(ccLc,struct ccLc { char a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(ccfc,struct ccfc { char a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(ccdc,struct ccdc { char a; char b; double c;char d;};)
+XBT_DEFINE_TYPE(sccc,struct sccc { short int a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(scsc,struct scsc { short int a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(scic,struct scic { short int a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(sclc,struct sclc { short int a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(scLc,struct scLc { short int a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(scfc,struct scfc { short int a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(scdc,struct scdc { short int a; char b; double c;char d;};)
+XBT_DEFINE_TYPE(iccc,struct iccc { int a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(icsc,struct icsc { int a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(icic,struct icic { int a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(iclc,struct iclc { int a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(icLc,struct icLc { int a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(icfc,struct icfc { int a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(icdc,struct icdc { int a; char b; double c;char d;};)
+XBT_DEFINE_TYPE(lccc,struct lccc { long int a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(lcsc,struct lcsc { long int a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(lcic,struct lcic { long int a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(lclc,struct lclc { long int a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(lcLc,struct lcLc { long int a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(lcfc,struct lcfc { long int a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(lcdc,struct lcdc { long int a; char b; double c;char d;};)
+XBT_DEFINE_TYPE(Lccc,struct Lccc { long long int a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(Lcsc,struct Lcsc { long long int a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(Lcic,struct Lcic { long long int a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(Lclc,struct Lclc { long long int a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(LcLc,struct LcLc { long long int a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(Lcfc,struct Lcfc { long long int a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(Lcdc,struct Lcdc { long long int a; char b; double c;char d;};)
+XBT_DEFINE_TYPE(fccc,struct fccc { float a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(fcsc,struct fcsc { float a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(fcic,struct fcic { float a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(fclc,struct fclc { float a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(fcLc,struct fcLc { float a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(fcfc,struct fcfc { float a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(fcdc,struct fcdc { float a; char b; double c;char d;};)
+XBT_DEFINE_TYPE(dccc,struct dccc { double a; char b; char c;char d;};)
+XBT_DEFINE_TYPE(dcsc,struct dcsc { double a; char b; short int c;char d;};)
+XBT_DEFINE_TYPE(dcic,struct dcic { double a; char b; int c;char d;};)
+XBT_DEFINE_TYPE(dclc,struct dclc { double a; char b; long int c;char d;};)
+XBT_DEFINE_TYPE(dcLc,struct dcLc { double a; char b; long long int c;char d;};)
+XBT_DEFINE_TYPE(dcfc,struct dcfc { double a; char b; float c;char d;};)
+XBT_DEFINE_TYPE(dcdc,struct dcdc { double a; char b; double c;char d;};)
 
-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)
-{
-  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));
-  gras_msgtype_declare("cclc", gras_datadesc_by_symbol(cclc));
-  gras_msgtype_declare("ccLc", gras_datadesc_by_symbol(ccLc));
-  gras_msgtype_declare("ccfc", gras_datadesc_by_symbol(ccfc));
-  gras_msgtype_declare("ccdc", gras_datadesc_by_symbol(ccdc));
-  gras_msgtype_declare("sccc", gras_datadesc_by_symbol(sccc));
-  gras_msgtype_declare("scsc", gras_datadesc_by_symbol(scsc));
-  gras_msgtype_declare("scic", gras_datadesc_by_symbol(scic));
-  gras_msgtype_declare("sclc", gras_datadesc_by_symbol(sclc));
-  gras_msgtype_declare("scLc", gras_datadesc_by_symbol(scLc));
-  gras_msgtype_declare("scfc", gras_datadesc_by_symbol(scfc));
-  gras_msgtype_declare("scdc", gras_datadesc_by_symbol(scdc));
-  gras_msgtype_declare("iccc", gras_datadesc_by_symbol(iccc));
-  gras_msgtype_declare("icsc", gras_datadesc_by_symbol(icsc));
-  gras_msgtype_declare("icic", gras_datadesc_by_symbol(icic));
-  gras_msgtype_declare("iclc", gras_datadesc_by_symbol(iclc));
-  gras_msgtype_declare("icLc", gras_datadesc_by_symbol(icLc));
-  gras_msgtype_declare("icfc", gras_datadesc_by_symbol(icfc));
-  gras_msgtype_declare("icdc", gras_datadesc_by_symbol(icdc));
-  gras_msgtype_declare("lccc", gras_datadesc_by_symbol(lccc));
-  gras_msgtype_declare("lcsc", gras_datadesc_by_symbol(lcsc));
-  gras_msgtype_declare("lcic", gras_datadesc_by_symbol(lcic));
-  gras_msgtype_declare("lclc", gras_datadesc_by_symbol(lclc));
-  gras_msgtype_declare("lcLc", gras_datadesc_by_symbol(lcLc));
-  gras_msgtype_declare("lcfc", gras_datadesc_by_symbol(lcfc));
-  gras_msgtype_declare("lcdc", gras_datadesc_by_symbol(lcdc));
-  gras_msgtype_declare("Lccc", gras_datadesc_by_symbol(Lccc));
-  gras_msgtype_declare("Lcsc", gras_datadesc_by_symbol(Lcsc));
-  gras_msgtype_declare("Lcic", gras_datadesc_by_symbol(Lcic));
-  gras_msgtype_declare("Lclc", gras_datadesc_by_symbol(Lclc));
-  gras_msgtype_declare("LcLc", gras_datadesc_by_symbol(LcLc));
-  gras_msgtype_declare("Lcfc", gras_datadesc_by_symbol(Lcfc));
-  gras_msgtype_declare("Lcdc", gras_datadesc_by_symbol(Lcdc));
-  gras_msgtype_declare("fccc", gras_datadesc_by_symbol(fccc));
-  gras_msgtype_declare("fcsc", gras_datadesc_by_symbol(fcsc));
-  gras_msgtype_declare("fcic", gras_datadesc_by_symbol(fcic));
-  gras_msgtype_declare("fclc", gras_datadesc_by_symbol(fclc));
-  gras_msgtype_declare("fcLc", gras_datadesc_by_symbol(fcLc));
-  gras_msgtype_declare("fcfc", gras_datadesc_by_symbol(fcfc));
-  gras_msgtype_declare("fcdc", gras_datadesc_by_symbol(fcdc));
-  gras_msgtype_declare("dccc", gras_datadesc_by_symbol(dccc));
-  gras_msgtype_declare("dcsc", gras_datadesc_by_symbol(dcsc));
-  gras_msgtype_declare("dcic", gras_datadesc_by_symbol(dcic));
-  gras_msgtype_declare("dclc", gras_datadesc_by_symbol(dclc));
-  gras_msgtype_declare("dcLc", gras_datadesc_by_symbol(dcLc));
-  gras_msgtype_declare("dcfc", gras_datadesc_by_symbol(dcfc));
-  gras_msgtype_declare("dcdc", gras_datadesc_by_symbol(dcdc));
+void register_structures(void) {
+  gras_msgtype_declare("cccc", xbt_datadesc_by_symbol(cccc));
+  gras_msgtype_declare("ccsc", xbt_datadesc_by_symbol(ccsc));
+  gras_msgtype_declare("ccic", xbt_datadesc_by_symbol(ccic));
+  gras_msgtype_declare("cclc", xbt_datadesc_by_symbol(cclc));
+  gras_msgtype_declare("ccLc", xbt_datadesc_by_symbol(ccLc));
+  gras_msgtype_declare("ccfc", xbt_datadesc_by_symbol(ccfc));
+  gras_msgtype_declare("ccdc", xbt_datadesc_by_symbol(ccdc));
+  gras_msgtype_declare("sccc", xbt_datadesc_by_symbol(sccc));
+  gras_msgtype_declare("scsc", xbt_datadesc_by_symbol(scsc));
+  gras_msgtype_declare("scic", xbt_datadesc_by_symbol(scic));
+  gras_msgtype_declare("sclc", xbt_datadesc_by_symbol(sclc));
+  gras_msgtype_declare("scLc", xbt_datadesc_by_symbol(scLc));
+  gras_msgtype_declare("scfc", xbt_datadesc_by_symbol(scfc));
+  gras_msgtype_declare("scdc", xbt_datadesc_by_symbol(scdc));
+  gras_msgtype_declare("iccc", xbt_datadesc_by_symbol(iccc));
+  gras_msgtype_declare("icsc", xbt_datadesc_by_symbol(icsc));
+  gras_msgtype_declare("icic", xbt_datadesc_by_symbol(icic));
+  gras_msgtype_declare("iclc", xbt_datadesc_by_symbol(iclc));
+  gras_msgtype_declare("icLc", xbt_datadesc_by_symbol(icLc));
+  gras_msgtype_declare("icfc", xbt_datadesc_by_symbol(icfc));
+  gras_msgtype_declare("icdc", xbt_datadesc_by_symbol(icdc));
+  gras_msgtype_declare("lccc", xbt_datadesc_by_symbol(lccc));
+  gras_msgtype_declare("lcsc", xbt_datadesc_by_symbol(lcsc));
+  gras_msgtype_declare("lcic", xbt_datadesc_by_symbol(lcic));
+  gras_msgtype_declare("lclc", xbt_datadesc_by_symbol(lclc));
+  gras_msgtype_declare("lcLc", xbt_datadesc_by_symbol(lcLc));
+  gras_msgtype_declare("lcfc", xbt_datadesc_by_symbol(lcfc));
+  gras_msgtype_declare("lcdc", xbt_datadesc_by_symbol(lcdc));
+  gras_msgtype_declare("Lccc", xbt_datadesc_by_symbol(Lccc));
+  gras_msgtype_declare("Lcsc", xbt_datadesc_by_symbol(Lcsc));
+  gras_msgtype_declare("Lcic", xbt_datadesc_by_symbol(Lcic));
+  gras_msgtype_declare("Lclc", xbt_datadesc_by_symbol(Lclc));
+  gras_msgtype_declare("LcLc", xbt_datadesc_by_symbol(LcLc));
+  gras_msgtype_declare("Lcfc", xbt_datadesc_by_symbol(Lcfc));
+  gras_msgtype_declare("Lcdc", xbt_datadesc_by_symbol(Lcdc));
+  gras_msgtype_declare("fccc", xbt_datadesc_by_symbol(fccc));
+  gras_msgtype_declare("fcsc", xbt_datadesc_by_symbol(fcsc));
+  gras_msgtype_declare("fcic", xbt_datadesc_by_symbol(fcic));
+  gras_msgtype_declare("fclc", xbt_datadesc_by_symbol(fclc));
+  gras_msgtype_declare("fcLc", xbt_datadesc_by_symbol(fcLc));
+  gras_msgtype_declare("fcfc", xbt_datadesc_by_symbol(fcfc));
+  gras_msgtype_declare("fcdc", xbt_datadesc_by_symbol(fcdc));
+  gras_msgtype_declare("dccc", xbt_datadesc_by_symbol(dccc));
+  gras_msgtype_declare("dcsc", xbt_datadesc_by_symbol(dcsc));
+  gras_msgtype_declare("dcic", xbt_datadesc_by_symbol(dcic));
+  gras_msgtype_declare("dclc", xbt_datadesc_by_symbol(dclc));
+  gras_msgtype_declare("dcLc", xbt_datadesc_by_symbol(dcLc));
+  gras_msgtype_declare("dcfc", xbt_datadesc_by_symbol(dcfc));
+  gras_msgtype_declare("dcdc", xbt_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;
-  XBT_INFO
-      ("---- Test on all possible struct having 4 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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("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)
-      XBT_VERB("Passed dcdc");
+void test_structures(xbt_socket_t *sock, int direction);
+void test_structures(xbt_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;
+  XBT_INFO("---- Test on all possible struct having 4 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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("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) XBT_VERB("Passed dcdc");
   }
 }
index 9327d3c..88d41fe 100644 (file)
@@ -11,9 +11,9 @@
 #endif
 
 #include <stdio.h>
+#include "xbt/datadesc.h"
+#include "xbt/datadesc/datadesc_interface.h"
 #include "gras.h"
-
-#include "gras/DataDesc/datadesc_interface.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this test");
 
 #define READ  0
@@ -24,11 +24,11 @@ const char *filename = "datadesc_usage.out";
 
 void
 write_read(const char *msgtype, void *src, void *dst,
-           gras_socket_t sock, int direction);
+           xbt_socket_t sock, int direction);
 
 void
 write_read(const char *msgtype, void *src, void *dst,
-           gras_socket_t sock, int direction)
+           xbt_socket_t sock, int direction)
 {
 
   switch (direction) {
@@ -41,7 +41,7 @@ write_read(const char *msgtype, void *src, void *dst,
     break;
 
   case COPY:
-    gras_datadesc_memcpy(gras_datadesc_by_name(msgtype), src, dst);
+    xbt_datadesc_memcpy(xbt_datadesc_by_name(msgtype), src, dst);
     break;
   }
 }
@@ -49,13 +49,13 @@ write_read(const char *msgtype, void *src, void *dst,
 
 /* defined in datadesc_structures.c, which in perl generated */
 void register_structures(void);
-void test_structures(gras_socket_t sock, int direction);
+void test_structures(xbt_socket_t sock, int direction);
 
 /************************
  * Each and every tests *
  ************************/
 
-static void test_int(gras_socket_t sock, int direction)
+static void test_int(xbt_socket_t sock, int direction)
 {
   int i = 5, j;
 
@@ -65,7 +65,7 @@ static void test_int(gras_socket_t sock, int direction)
     xbt_assert(i == j);
 }
 
-static void test_float(gras_socket_t sock, int direction)
+static void test_float(xbt_socket_t sock, int direction)
 {
   float i = 5.0, j;
 
@@ -75,7 +75,7 @@ static void test_float(gras_socket_t sock, int direction)
     xbt_assert(i == j, "%f != %f", i, j);
 }
 
-static void test_double(gras_socket_t sock, int direction)
+static void test_double(xbt_socket_t sock, int direction)
 {
   double i = -3252355.1234, j;
 
@@ -87,7 +87,7 @@ static void test_double(gras_socket_t sock, int direction)
 
 #define FIXED_ARRAY_SIZE 5
 typedef int array[FIXED_ARRAY_SIZE];
-static void test_array(gras_socket_t sock, int direction)
+static void test_array(xbt_socket_t sock, int direction)
 {
   array i = { 35212, -6226, 74337, 11414, 7733 };
   array j;
@@ -107,7 +107,7 @@ static void test_array(gras_socket_t sock, int direction)
 
 /*** Dynar of scalar ***/
 
-static void test_dynar_scal(gras_socket_t sock, int direction)
+static void test_dynar_scal(xbt_socket_t sock, int direction)
 {
   xbt_dynar_t i, j;
   int cpt;
@@ -138,7 +138,7 @@ static void test_dynar_scal(gras_socket_t sock, int direction)
 
 /*** Empty dynar ***/
 
-static void test_dynar_empty(gras_socket_t sock, int direction)
+static void test_dynar_empty(xbt_socket_t sock, int direction)
 {
   xbt_dynar_t i, j;
 
@@ -153,7 +153,7 @@ static void test_dynar_empty(gras_socket_t sock, int direction)
   xbt_dynar_free(&i);
 }
 
-static void test_intref(gras_socket_t sock, int direction)
+static void test_intref(xbt_socket_t sock, int direction)
 {
   int *i, *j;
 
@@ -173,7 +173,7 @@ static void test_intref(gras_socket_t sock, int direction)
 /***
  *** string (dynamic array)
  ***/
-static void test_string(gras_socket_t sock, int direction)
+static void test_string(xbt_socket_t sock, int direction)
 {
   char *i = xbt_strdup("Some data"), *j = NULL;
   int cpt;
@@ -197,7 +197,7 @@ static void test_string(gras_socket_t sock, int direction)
 typedef struct {
   int a, b, c, d;
 } homostruct;
-static void test_homostruct(gras_socket_t sock, int direction)
+static void test_homostruct(xbt_socket_t sock, int direction)
 {
   homostruct *i, *j;
 
@@ -229,7 +229,7 @@ typedef struct {
   unsigned char c2;
   unsigned long int l2;
 } hetestruct;
-static void test_hetestruct(gras_socket_t sock, int direction)
+static void test_hetestruct(xbt_socket_t sock, int direction)
 {
   hetestruct *i, *j;
 
@@ -253,7 +253,7 @@ static void test_hetestruct(gras_socket_t sock, int direction)
   free(i);
 }
 
-static void test_hetestruct_array(gras_socket_t sock, int direction)
+static void test_hetestruct_array(xbt_socket_t sock, int direction)
 {
   hetestruct *i, *j, *p, *q;
   int cpt;
@@ -290,7 +290,7 @@ typedef struct {
   hetestruct hete;
   homostruct homo;
 } nestedstruct;
-static void test_nestedstruct(gras_socket_t sock, int direction)
+static void test_nestedstruct(xbt_socket_t sock, int direction)
 {
   nestedstruct *i, *j;
 
@@ -360,7 +360,7 @@ int list_eq(chained_list_t * i, chained_list_t * j)
   return list_eq(i->l, j->l);
 }
 
-static void test_chain_list(gras_socket_t sock, int direction)
+static void test_chain_list(xbt_socket_t sock, int direction)
 {
   chained_list_t *i, *j;
 
@@ -382,7 +382,7 @@ static void test_chain_list(gras_socket_t sock, int direction)
 /***
  *** graph
  ***/
-static void test_graph(gras_socket_t sock, int direction)
+static void test_graph(xbt_socket_t sock, int direction)
 {
   chained_list_t *i, *j;
 
@@ -423,7 +423,7 @@ static void free_string(void *d)
   free(*(void **) d);
 }
 
-static void test_dynar_ref(gras_socket_t sock, int direction)
+static void test_dynar_ref(xbt_socket_t sock, int direction)
 {
   xbt_dynar_t i, j;
   char buf[1024];
@@ -456,22 +456,22 @@ static void test_dynar_ref(gras_socket_t sock, int direction)
 
 
 /**** 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];
-                 };
+XBT_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)
+static void test_pbio(xbt_socket_t sock, int direction)
 {
   int cpt;
   int cpt2;
@@ -479,7 +479,7 @@ static void test_pbio(gras_socket_t sock, int direction)
 
   XBT_INFO
       ("---- Test on the PBIO IEEE struct (also tests GRAS DEFINE TYPE) ----");
-  gras_datadesc_by_symbol(s_pbio); 
+  xbt_datadesc_by_symbol(s_pbio);
 
   /* Fill in that damn struct */
   i.Cnstatv = 325115;
@@ -543,14 +543,14 @@ static void test_pbio(gras_socket_t sock, int direction)
   }
 }
 
-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 */
-                 };)
+XBT_DEFINE_TYPE(s_clause, struct s_clause {
+                int num_lits;
+                int *literals XBT_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)
+static void test_clause(xbt_socket_t sock, int direction)
 {
   Clause *i, *j;
   int cpt;
@@ -581,7 +581,7 @@ static void test_clause(gras_socket_t sock, int direction)
   free(i);
 }
 
-static void test_clause_empty(gras_socket_t sock, int direction)
+static void test_clause_empty(xbt_socket_t sock, int direction)
 {
   Clause *i, *j;
 
@@ -609,88 +609,88 @@ static void test_clause_empty(gras_socket_t sock, int direction)
 
 static void register_types(void)
 {
-  gras_datadesc_type_t my_type, ref_my_type;
+  xbt_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"));
+  gras_msgtype_declare("char", xbt_datadesc_by_name("char"));
+  gras_msgtype_declare("int", xbt_datadesc_by_name("int"));
+  gras_msgtype_declare("float", xbt_datadesc_by_name("float"));
+  gras_msgtype_declare("double", xbt_datadesc_by_name("double"));
 
-  my_type = gras_datadesc_array_fixed("fixed int array",
-                                      gras_datadesc_by_name("int"),
+  my_type = xbt_datadesc_array_fixed("fixed int array",
+                                      xbt_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);
+  my_type = xbt_datadesc_dynar(xbt_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"));
+  my_type = xbt_datadesc_ref("int*", xbt_datadesc_by_name("int"));
   gras_msgtype_declare("int*", my_type);
 
-  gras_msgtype_declare("string", gras_datadesc_by_name("string"));
+  gras_msgtype_declare("string", xbt_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 = xbt_datadesc_struct("homostruct");
+  xbt_datadesc_struct_append(my_type, "a",
+                              xbt_datadesc_by_name("signed int"));
+  xbt_datadesc_struct_append(my_type, "b", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_append(my_type, "c", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_append(my_type, "d", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_close(my_type);
   my_type =
-      gras_datadesc_ref("homostruct*",
-                        gras_datadesc_by_name("homostruct"));
+      xbt_datadesc_ref("homostruct*",
+                        xbt_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 = xbt_datadesc_struct("hetestruct");
+  xbt_datadesc_struct_append(my_type, "c1",
+                              xbt_datadesc_by_name("unsigned char"));
+  xbt_datadesc_struct_append(my_type, "l1",
+                              xbt_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_append(my_type, "c2",
+                              xbt_datadesc_by_name("unsigned char"));
+  xbt_datadesc_struct_append(my_type, "l2",
+                              xbt_datadesc_by_name("unsigned long int"));
+  xbt_datadesc_struct_close(my_type);
   my_type =
-      gras_datadesc_ref("hetestruct*",
-                        gras_datadesc_by_name("hetestruct"));
+      xbt_datadesc_ref("hetestruct*",
+                        xbt_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);
+      xbt_datadesc_array_fixed("hetestruct[10]",
+                                xbt_datadesc_by_name("hetestruct"), 10);
+  my_type = xbt_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 = xbt_datadesc_struct("nestedstruct");
+  xbt_datadesc_struct_append(my_type, "hete",
+                              xbt_datadesc_by_name("hetestruct"));
+  xbt_datadesc_struct_append(my_type, "homo",
+                              xbt_datadesc_by_name("homostruct"));
+  xbt_datadesc_struct_close(my_type);
   my_type =
-      gras_datadesc_ref("nestedstruct*",
-                        gras_datadesc_by_name("nestedstruct"));
+      xbt_datadesc_ref("nestedstruct*",
+                        xbt_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*"));
+  my_type = xbt_datadesc_struct("chained_list_t");
+  ref_my_type = xbt_datadesc_ref("chained_list_t*", my_type);
+  xbt_datadesc_struct_append(my_type, "v", xbt_datadesc_by_name("int"));
+  xbt_datadesc_struct_append(my_type, "l", ref_my_type);
+  xbt_datadesc_struct_close(my_type);
+  xbt_datadesc_cycle_set(xbt_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);
+      xbt_datadesc_dynar(xbt_datadesc_by_name("string"), &free_string);
   gras_msgtype_declare("xbt_dynar_of_string", my_type);
 
-  my_type = gras_datadesc_by_symbol(s_pbio);
+  my_type = xbt_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);
+  my_type = xbt_datadesc_by_symbol(s_clause);
+  my_type = xbt_datadesc_ref("Clause*", my_type);
   gras_msgtype_declare("Clause*", my_type);
 
 }
@@ -701,7 +701,7 @@ static void register_types(void)
 
 int main(int argc, char *argv[])
 {
-  gras_socket_t sock = NULL;
+  xbt_socket_t sock = NULL;
   int direction = WRITE;
   int cpt;
   char local_arch, remote_arch;
@@ -713,8 +713,8 @@ int main(int argc, char *argv[])
   for (cpt = 1; cpt < argc; cpt++) {
     if (!strcmp(argv[cpt], "--arch")) {
       XBT_INFO("We are on %s (#%d)",
-            gras_datadesc_arch_name(gras_arch_selfid()),
-            (int) gras_arch_selfid());
+            xbt_datadesc_arch_name(xbt_arch_selfid()),
+            (int) xbt_arch_selfid());
       exit(0);
     } else if (!strcmp(argv[cpt], "--help")) {
       printf("Usage: datadesc_usage [option] [filename]\n");
@@ -730,7 +730,7 @@ int main(int argc, char *argv[])
       direction = WRITE;
       filename =
           bprintf("datadesc.%s",
-                  gras_datadesc_arch_name(gras_arch_selfid()));
+                  xbt_datadesc_arch_name(xbt_arch_selfid()));
     } else if (!strcmp(argv[cpt], "--read")) {
       direction = READ;
     } else if (!strcmp(argv[cpt], "--write")) {
@@ -756,11 +756,11 @@ int main(int argc, char *argv[])
     XBT_INFO("Memory copy");
   }
 
-  local_arch = gras_arch_selfid();
+  local_arch = xbt_arch_selfid();
   write_read("char", &local_arch, &remote_arch, sock, direction);
   if (direction == READ)
     XBT_VERB("This file was generated on %s (%d)",
-          gras_datadesc_arch_name(remote_arch), (int) remote_arch);
+          xbt_datadesc_arch_name(remote_arch), (int) remote_arch);
 
 
   test_int(sock, direction);
index a8c22b1..cc16f5a 100755 (executable)
@@ -25,7 +25,7 @@ print "XBT_LOG_NEW_DEFAULT_SUBCATEGORY(structs,test,\"Logs about the gigantic st
 
 print "#define READ  0\n#define WRITE 1\n#define RW    2\n\n";
   
-print "void write_read(const char *type,void *src, void *dst, gras_socket_t *sock, int direction);\n\n";
+print "void write_read(const char *type,void *src, void *dst, xbt_socket_t *sock, int direction);\n\n";
 
 my ($i,$j,$k,$l);
 my $max=scalar @types;
@@ -36,7 +36,7 @@ my $max_j=0;
 my $max_k=$max-1;
 my $max_l=0;     
 for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) {
-    print "GRAS_DEFINE_TYPE(".$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l].",".
+    print "XBT_DEFINE_TYPE(".$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l].",".
       "struct ".$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l]." { ".
         $types[$i]." a; ".
         $types[$j]." b; ".
@@ -52,12 +52,12 @@ print "void register_structures(void);\n";
 print "void register_structures(void) {\n";
 for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) {
     my $struct=$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l];
-    print "  gras_msgtype_declare(\"$struct\", gras_datadesc_by_symbol($struct));\n";
+    print "  gras_msgtype_declare(\"$struct\", xbt_datadesc_by_symbol($struct));\n";
 }}}}
 print "}\n";
 
-print "void test_structures(gras_socket_t *sock, int direction);\n";
-print "void test_structures(gras_socket_t *sock, int direction) {\n";
+print "void test_structures(xbt_socket_t *sock, int direction);\n";
+print "void test_structures(xbt_socket_t *sock, int direction) {\n";
 for $i (0..$max_i) { for $j (0..$max_j) { for $k (0..$max_k) { for $l (0..$max_l) {
     my $struct=$abrev[$i].$abrev[$j].$abrev[$k].$abrev[$l];
     print "  struct $struct my_$struct = {".$val[$i]."+(".$types[$i].")1,"
index 6943fdb..675cb00 100644 (file)
@@ -23,7 +23,7 @@ static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx,
 
 int server(int argc, char *argv[])
 {
-  volatile gras_socket_t me = NULL, pal = NULL;
+  volatile xbt_socket_t me = NULL, pal = NULL;
   int myport;
   char *palstr;
 
@@ -114,7 +114,7 @@ int server(int argc, char *argv[])
 
 int client(int argc, char *argv[])
 {
-  volatile gras_socket_t me = NULL, pal = NULL;
+  volatile xbt_socket_t me = NULL, pal = NULL;
   int myport;
   char *palstr;