Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Renamed any gras stuff that was in xbt and should therefore be called
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 3 Nov 2004 02:54:13 +0000 (02:54 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 3 Nov 2004 02:54:13 +0000 (02:54 +0000)
xbt_something. Martin, please go in */xbt and do a grep -i gras *.[ch]

Mostly loging has still traces of GRAS.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@478 48e7efb5-ca39-0410-a469-dd3cf9ba447f

86 files changed:
examples/alnem/alnem.c
examples/bandwidth/bandwidth.c
examples/ping/ping.c
examples/saturate/saturate.c
include/amok/bandwidth.h
include/amok/base.h
include/gras/core.h
include/gras/datadesc.h
include/gras/messages.h
include/gras/modules/bandwidth.h
include/gras/modules/base.h
include/gras/process.h
include/gras/transport.h
include/xbt.h
include/xbt/config.h
include/xbt/dict.h
include/xbt/dynar.h
include/xbt/error.h
include/xbt/log.h
include/xbt/misc.h
include/xbt/module.h
include/xbt/set.h
include/xbt/sysdep.h
src/amok/Bandwidth/bandwidth.c
src/amok/Bandwidth/bandwidth_private.h
src/amok/Bandwidth/saturate.c
src/amok/bandwidth.c
src/amok/base.c
src/gras/DataDesc/cbps.c
src/gras/DataDesc/datadesc.c
src/gras/DataDesc/datadesc_interface.h
src/gras/DataDesc/datadesc_private.h
src/gras/DataDesc/ddt_convert.c
src/gras/DataDesc/ddt_create.c
src/gras/DataDesc/ddt_exchange.c
src/gras/DataDesc/ddt_parse.c
src/gras/DataDesc/ddt_parse.yy.c
src/gras/DataDesc/ddt_parse.yy.h
src/gras/Msg/msg.c
src/gras/Msg/msg_interface.h
src/gras/Msg/msg_private.h
src/gras/RL/gras_rl.c
src/gras/RL/gras_rl.h
src/gras/SG/gras_sg.c
src/gras/Transport/rl_transport.c
src/gras/Transport/sg_transport.c
src/gras/Transport/transport.c
src/gras/Transport/transport_interface.h
src/gras/Transport/transport_plugin_buf.c
src/gras/Transport/transport_plugin_file.c
src/gras/Transport/transport_plugin_sg.c
src/gras/Transport/transport_plugin_tcp.c
src/gras/Transport/transport_private.h
src/gras/Virtu/process.c
src/gras/Virtu/rl_process.c
src/gras/Virtu/sg_process.c
src/gras/Virtu/virtu_interface.h
src/gras/Virtu/virtu_sg.h
src/xbt/config.c
src/xbt/dict.c
src/xbt/dict_cursor.c
src/xbt/dict_elm.c
src/xbt/dict_private.h
src/xbt/dynar.c
src/xbt/error.c
src/xbt/log.c
src/xbt/log_default_appender.c
src/xbt/module.c
src/xbt/set.c
src/xbt/sysdep.c
src/xbt_modinter.h
testsuite/gras/datadesc_usage.c
testsuite/gras/gras_dummy.c
testsuite/gras/trp_file_client.c
testsuite/gras/trp_file_server.c
testsuite/gras/trp_tcp_client.c
testsuite/gras/trp_tcp_server.c
testsuite/xbt/config_usage.c
testsuite/xbt/dict_crash.c
testsuite/xbt/dict_usage.c
testsuite/xbt/dynar_double.c
testsuite/xbt/dynar_int.c
testsuite/xbt/dynar_string.c
testsuite/xbt/log_usage.c
testsuite/xbt/multidict_crash.c
testsuite/xbt/set_usage.c

index 9d4d95f..23d75e8 100644 (file)
@@ -30,11 +30,11 @@ typedef struct {
 int sensor (int argc,char *argv[]);
 
 int sensor (int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   sensor_data_t *g=gras_userdata_new(sensor_data_t);  
 
   if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { 
-    fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",gras_error_name(errcode));
+    fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",xbt_error_name(errcode));
     return 1;
   }
 
@@ -46,7 +46,7 @@ int sensor (int argc,char *argv[]) {
   while (1) {
     if ((errcode=gras_msg_handle(3600.0)) && errcode != timeout_error) {
       fprintf(stderr,"Sensor: Error '%s' while handling message\n",
-             gras_error_name(errcode));
+             xbt_error_name(errcode));
     }
   }
 
@@ -80,7 +80,7 @@ int maestro(int argc,char *argv[]) {
   int msgSize=expSize;
   int satSize=msgSize * 100;
   double dummy,beginSim;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   maestro_data_t *g=gras_userdata_new(maestro_data_t);
 
   double bw[MAXHOSTS][MAXHOSTS];
@@ -100,7 +100,7 @@ int maestro(int argc,char *argv[]) {
   }
 
   if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { 
-    fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode));
+    fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",xbt_error_name(errcode));
     return 1;
   }
 
@@ -134,7 +134,7 @@ int maestro(int argc,char *argv[]) {
         }
       }
       if (errcode) {
-       fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode));
+       fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode));
        return 1;
       }
       fprintf(stderr,"%f Mb/s in %f sec\n",bw[a][b],dummy);
@@ -158,7 +158,7 @@ int maestro(int argc,char *argv[]) {
        
       if ((errcode=grasbw_saturate_start(argv[a],4000,argv[b],4000,satSize,360000000))) {
        fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n",
-               gras_error_name(errcode));
+               xbt_error_name(errcode));
        return -1;
       }
       gras_sleep(1,0);
@@ -173,7 +173,7 @@ int maestro(int argc,char *argv[]) {
          
          if ((errcode=grasbw_request(argv[c],4000,argv[d],4000,bufSize,expSize,msgSize,
                                      &dummy,&(bw_sat[c][d])))) {
-           fprintf(stderr,"MAESTRO: Error %s encountered in test\n",gras_error_name(errcode));
+           fprintf(stderr,"MAESTRO: Error %s encountered in test\n",xbt_error_name(errcode));
            return 1;
          }
          fprintf(stderr, "MAESTRO[%.2f sec]: SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s\n",
@@ -189,7 +189,7 @@ int maestro(int argc,char *argv[]) {
 
       if ((errcode=grasbw_saturate_stop(argv[a],4000,argv[b],4000))) {
        fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n",
-               gras_error_name(errcode));
+               xbt_error_name(errcode));
        return -1;
       }
       fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n",
index e075854..ecb3b18 100644 (file)
@@ -11,7 +11,7 @@
 #include "gras.h"
 #include "amok/bandwidth.h"
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(Bandwidth,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Bandwidth,"Messages specific to this example");
 
 /* **********************************************************************
  * Sensor code
@@ -26,22 +26,22 @@ typedef struct {
 int sensor (int argc,char *argv[]);
 
 int sensor (int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   sensor_data_t g;
 
-  gras_init(&argc,argv);
+  xbt_init(&argc,argv);
   g=gras_userdata_new(s_sensor_data_t);  
 
   amok_bw_init();
    
   if ((errcode=gras_socket_server(atoi(argv[1]),&(g->sock)))) { 
-    ERROR1("Sensor: Error %s encountered while opening the server socket",gras_error_name(errcode));
+    ERROR1("Sensor: Error %s encountered while opening the server socket",xbt_error_name(errcode));
     return 1;
   }
 
   errcode=gras_msg_handle(60.0);
   if (errcode != no_error) {
-     ERROR1("Sensor: Error '%s' while handling message",gras_error_name(errcode));
+     ERROR1("Sensor: Error '%s' while handling message",xbt_error_name(errcode));
      gras_socket_close(g->sock);
      return errcode;
   }
@@ -63,7 +63,7 @@ typedef struct {
 int maestro (int argc,char *argv[]);
 
 int maestro(int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   maestro_data_t g;
   double sec, bw;
   int buf_size=32;
@@ -71,13 +71,13 @@ int maestro(int argc,char *argv[]) {
   int msg_size=64;
   gras_socket_t peer;
 
-  gras_init(&argc,argv);
+  xbt_init(&argc,argv);
   g=gras_userdata_new(s_maestro_data_t);
   amok_bw_init();
   gras_os_sleep(1,0);
    
   if ((errcode=gras_socket_server(6000,&(g->sock)))) { 
-    ERROR1("Maestro: Error %s encountered while opening the server socket",gras_error_name(errcode));
+    ERROR1("Maestro: Error %s encountered while opening the server socket",xbt_error_name(errcode));
     return 1;
   }
       
@@ -89,7 +89,7 @@ int maestro(int argc,char *argv[]) {
 
   if ((errcode=gras_socket_client(argv[1],atoi(argv[2]),&peer))) {
      ERROR3("Client: Unable to connect to my peer on %s:%s. Got %s",
-           argv[1],argv[2],gras_error_name(errcode));
+           argv[1],argv[2],xbt_error_name(errcode));
      return 1;
   }
 
@@ -97,7 +97,7 @@ int maestro(int argc,char *argv[]) {
                               buf_size,exp_size,msg_size,&sec,&bw))) {*/
   
   if ((errcode=amok_bw_test(peer,buf_size,exp_size,msg_size,&sec,&bw))) {
-    ERROR1("maestro: Error %s encountered while doing the test",gras_error_name(errcode));
+    ERROR1("maestro: Error %s encountered while doing the test",xbt_error_name(errcode));
     return 1;
   }
    
index 074835e..b58078d 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "gras.h"
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(Ping,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(Ping,"Messages specific to this example");
 
 /* **********************************************************************
  * Comon code
@@ -53,7 +53,7 @@ int server (int argc,char *argv[]);
 int server_cb_ping_handler(gras_socket_t  expeditor,
                           void          *payload_data) {
                             
-  gras_error_t errcode;
+  xbt_error_t errcode;
   int msg=*(int*)payload_data;
   gras_msgtype_t *pong_t=NULL;
 
@@ -69,7 +69,7 @@ int server_cb_ping_handler(gras_socket_t  expeditor,
   errcode = gras_msg_send(expeditor, gras_msgtype_by_name("pong"), &msg);
 
   if (errcode != no_error) {
-    ERROR1("SERVER: Unable answer with PONG: %s\n", gras_error_name(errcode));
+    ERROR1("SERVER: Unable answer with PONG: %s\n", xbt_error_name(errcode));
     gras_socket_close(g->sock);
     return 1;
   }
@@ -81,13 +81,13 @@ int server_cb_ping_handler(gras_socket_t  expeditor,
 }
 
 int server (int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   server_data_t *g;
   gras_msgtype_t *ping_msg=NULL;
 
   int port = 4000;
   
-  gras_init(&argc,argv);
+  xbt_init(&argc,argv);
   g=gras_userdata_new(server_data_t);
    
   if (argc == 2) {
@@ -98,7 +98,7 @@ int server (int argc,char *argv[]) {
 
   if ((errcode=gras_socket_server(port,&(g->sock)))) { 
     CRITICAL1("Error %s encountered while opening the server socket",
-             gras_error_name(errcode));
+             xbt_error_name(errcode));
     return 1;
   }
 
@@ -119,7 +119,7 @@ int server (int argc,char *argv[]) {
     gras_os_sleep(1,0);
   gras_socket_close(g->sock);
   free(g);
-  gras_exit();
+  xbt_exit();
   INFO0("SERVER: Done.");
   return no_error;
 }
@@ -137,7 +137,7 @@ typedef struct {
 int client (int argc,char *argv[]);
 
 int client(int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   client_data_t *g;
 
   gras_socket_t from;
@@ -146,7 +146,7 @@ int client(int argc,char *argv[]) {
   const char *host = "127.0.0.1";
         int   port = 4000;
 
-  gras_init(&argc, argv);
+  xbt_init(&argc, argv);
   g=gras_userdata_new(client_data_t);
    
   if (argc == 3) {
@@ -158,7 +158,7 @@ int client(int argc,char *argv[]) {
   gras_os_sleep(1,0); /* Wait for the server startup */
   if ((errcode=gras_socket_client(host,port,&(g->sock)))) {
     ERROR1("Client: Unable to connect to the server. Got %s",
-          gras_error_name(errcode));
+          xbt_error_name(errcode));
     return 1;
   }
   INFO2("Client: Connected to %s:%d.",host,port);    
@@ -173,7 +173,7 @@ int client(int argc,char *argv[]) {
   errcode = gras_msg_send(g->sock, gras_msgtype_by_name("ping"), &ping);
   if (errcode != no_error) {
     fprintf(stderr, "Client: Unable send PING to server (%s)\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_socket_close(g->sock);
     return 1;
   }
@@ -184,7 +184,7 @@ int client(int argc,char *argv[]) {
   if ((errcode=gras_msg_wait(6000,gras_msgtype_by_name("pong"),
                             &from,&pong))) {
     ERROR1("Client: Why can't I get my PONG message like everyone else (%s)?",
-          gras_error_name(errcode));
+          xbt_error_name(errcode));
     gras_socket_close(g->sock);
     return 1;
   }
@@ -195,7 +195,7 @@ int client(int argc,char *argv[]) {
 
   gras_socket_close(g->sock);
   free(g);
-  gras_exit();
+  xbt_exit();
   INFO0("Client: Done.");
   return 0;
 }
index 3fe04b9..082adf4 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <gras.h>
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(saturate,"Messages specific to this example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(saturate,"Messages specific to this example");
 
 /* **********************************************************************
  * Sensor code
@@ -30,11 +30,11 @@ typedef struct {
 int sensor (int argc,char *argv[]);
 
 int sensor (int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   sensor_data_t *g=gras_userdata_new(sensor_data_t);  
 
   if ((errcode=gras_socket_server(4000,&(g->sock)))) {
-    CRITICAL1("Sensor: Error %s encountered while opening the server socket",gras_error_name(errcode));
+    CRITICAL1("Sensor: Error %s encountered while opening the server socket",xbt_error_name(errcode));
     return 1;
   }
 
@@ -46,7 +46,7 @@ int sensor (int argc,char *argv[]) {
   while (1) {
     if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { 
        CRITICAL1("Sensor: Error '%s' while handling message",
-             gras_error_name(errcode));
+             xbt_error_name(errcode));
     }
   }
 
@@ -70,7 +70,7 @@ int maestro (int argc,char *argv[]);
 double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2);
 
 double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   int bufSize=32 * 1024;
   int expSize=64 * 1024;
   int msgSize=64 * 1024;
@@ -78,7 +78,7 @@ double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2)
   double sec, bw, sec_sat,bw_sat;
 
   if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec,&bw))) {
-    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode));
+    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode));
     return -1;
   }
    
@@ -86,12 +86,12 @@ double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2)
 
   if ((errcode=grasbw_saturate_start(sat1,4000,sat2,4000,satSize,60))) {
     fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return -1;
   }
   gras_os_sleep(1,0);
   if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec_sat,&bw_sat))) {
-    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode));
+    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode));
     return -1;
   }
    
@@ -100,7 +100,7 @@ double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2)
 
   if ((errcode=grasbw_saturate_stop(sat1,4000,sat2,4000))) {
     fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return -1;
   }
 
@@ -123,7 +123,7 @@ int maestro(int argc,char *argv[]) {
   int msgSize=expSize;
   int satSize=msgSize * 100;
   double dummy,beginSim;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   maestro_data_t *g=gras_userdata_new(maestro_data_t);
   //  const char *hosts[MAXHOSTS] = { "61", "62", "63", "69", "70", "77", "81", "83", "85", "87", "88", "95", "98", "107", "109", "111", "112", "121", "124", "125", "131", "145", "150", "156", "157", "162", "165", "168", "169", "170", "175", "177", "178" };
   const char *hosts[MAXHOSTS] = { "A", "B", "C", "D" };
@@ -134,7 +134,7 @@ int maestro(int argc,char *argv[]) {
   int a,b,c,d,begin;
 
   if ((errcode=gras_socket_server(4000,&(g->sock)))) { 
-    fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode));
+    fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",xbt_error_name(errcode));
     return 1;
   }
 
@@ -151,7 +151,7 @@ int maestro(int argc,char *argv[]) {
       fprintf(stderr,"BW XP(%s %s)=",hosts[a],hosts[b]); 
       if ((errcode=grasbw_request(hosts[a],4000,hosts[b],4000,bufSize,expSize,msgSize,
                                  &dummy,&(bw[a][b])))) {
-       fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode));
+       fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode));
        return 1;
       }
       fprintf(stderr,"%f Mb/s in %f sec\n",bw[a][b],dummy);
@@ -166,7 +166,7 @@ int maestro(int argc,char *argv[]) {
        
       if ((errcode=grasbw_saturate_start(hosts[a],4000,hosts[b],4000,satSize,360000000))) {
        fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n",
-               gras_error_name(errcode));
+               xbt_error_name(errcode));
        return -1;
       }
       gras_os_sleep(1,0);
@@ -184,7 +184,7 @@ int maestro(int argc,char *argv[]) {
          
          if ((errcode=grasbw_request(hosts[c],4000,hosts[d],4000,bufSize,expSize,msgSize,
                                      &dummy,&(bw_sat[c][d])))) {
-           fprintf(stderr,"MAESTRO: Error %s encountered in test\n",gras_error_name(errcode));
+           fprintf(stderr,"MAESTRO: Error %s encountered in test\n",xbt_error_name(errcode));
            return 1;
          }
          fprintf(stderr, "MAESTRO[%.2f sec]: SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s\n",
@@ -200,7 +200,7 @@ int maestro(int argc,char *argv[]) {
 
       if ((errcode=grasbw_saturate_stop(hosts[a],4000,hosts[b],4000))) {
        fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n",
-               gras_error_name(errcode));
+               xbt_error_name(errcode));
        return -1;
       }
       fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n",
@@ -216,7 +216,7 @@ int maestro(int argc,char *argv[]) {
   fprintf(stderr,"MAESTRO: Start saturation with size %d\n",msgSize);
   if ((errcode=grasbw_saturate_start(argv[5],atoi(argv[6]),argv[7],atoi(argv[8]),msgSize*10,60))) {
     fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
   fprintf(stderr,"MAESTRO: Saturation started\n");
@@ -225,7 +225,7 @@ int maestro(int argc,char *argv[]) {
   /* test with saturation */
   if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]),
                              bufSize,expSize,msgSize,&sec,&bw))) {
-    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode));
+    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode));
     return 1;
   }
    
@@ -236,14 +236,14 @@ int maestro(int argc,char *argv[]) {
   /* stop saturation */
   if ((errcode=grasbw_saturate_stop(argv[5],atoi(argv[6]),argv[7],atoi(argv[8])))) {
     fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
 
   /* test without saturation */
   if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]),
                              bufSize,expSize,msgSize,&sec,&bw))) {
-    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode));
+    fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",xbt_error_name(errcode));
     return 1;
   }
    
index 884fb19..f089506 100644 (file)
@@ -35,7 +35,7 @@ void amok_bw_exit(void);
  * Conduct a bandwidth test from the local process to the given peer.
  * This call is blocking until the end of the experiment.
  */
-gras_error_t amok_bw_test(gras_socket_t peer,
+xbt_error_t amok_bw_test(gras_socket_t peer,
                          unsigned int buf_size,unsigned int exp_size,unsigned int msg_size,
                          /*OUT*/ double *sec, double *bw);
 
@@ -57,7 +57,7 @@ gras_error_t amok_bw_test(gras_socket_t peer,
  * Conduct a bandwidth test from the process from_host:from_port to to_host:to_port.
  * This call is blocking until the end of the experiment.
  */
-gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_request(const char* from_name,unsigned int from_port,
                           const char* to_name,unsigned int to_port,
                           unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
                           /*OUT*/ double *sec, double*bw);
@@ -81,7 +81,7 @@ gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
  * Ask the process 'from_name:from_port' to start to saturate the link between itself
  * and to_name:to_name.
  */
-gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                                  const char* to_name,unsigned int to_port,
                                  unsigned int msgSize, unsigned int timeout);
 
@@ -97,7 +97,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
  * Ask the process 'from_name:from_port' to stop saturating the link between itself
  * and to_name:to_name.
  */
-gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
                                 const char* to_name,unsigned int to_port);
 
 
index e91010a..7d1fd32 100644 (file)
@@ -28,9 +28,9 @@ typedef struct {
   unsigned int code;
 } s_amok_remoterr_t,*amok_remoterr_t;
 
-amok_remoterr_t amok_remoterr_new(gras_error_t errcode, 
+amok_remoterr_t amok_remoterr_new(xbt_error_t errcode, 
                                  const char* format, ...);
-amok_remoterr_t amok_remoterr_new_va(gras_error_t param_errcode, 
+amok_remoterr_t amok_remoterr_new_va(xbt_error_t param_errcode, 
                                     const char* format,va_list ap);
 void amok_remoterr_free(amok_remoterr_t *err);
 
@@ -62,7 +62,7 @@ typedef struct {
  */
 void
 amok_repport_error (gras_socket_t sock, gras_msgtype_t msgtype,
-                   gras_error_t errcode, const char* format,...);
+                   xbt_error_t errcode, const char* format,...);
 
 
 void amok_base_init(void);
index 1903616..4e79a50 100644 (file)
@@ -40,7 +40,7 @@ BEGIN_DECL
 /* **************************************************************************
  * Garbage collection support
  * **************************************************************************/
-typedef enum { free_after_use, free_never } e_gras_free_directive_t;
+typedef enum { free_after_use, free_never } e_xbt_free_directive_t;
 
 
 /* **************************************************************************
index eb5491d..1285057 100644 (file)
@@ -120,12 +120,12 @@ void gras_datadesc_cb_push_ulint(gras_cbps_t vars, void *data);
 
 
 /* complex one: complete variable environment support */
-gras_error_t
+xbt_error_t
   gras_cbps_v_pop (gras_cbps_t            ps, 
                   const char            *name,
         /* OUT */ gras_datadesc_type_t  *ddt,
         /* OUT */ void                 **res);
-gras_error_t
+xbt_error_t
 gras_cbps_v_push(gras_cbps_t            ps,
                 const char            *name,
                 void                  *data,
@@ -215,7 +215,7 @@ typedef struct DataDescriptorStruct {
   sizeof(structType) - offsetof(structType, lastMember) - \
   sizeof(memberType) * repetitions
 
-gras_error_t
+xbt_error_t
 gras_datadesc_import_nws(const char           *name,
                         const DataDescriptor *desc,
                         unsigned long         howmany,
index 032bbc2..88ae103 100644 (file)
@@ -51,14 +51,14 @@ void gras_cb_register  (gras_msgtype_t msgtype,
 void gras_cb_unregister(gras_msgtype_t msgtype,
                        gras_cb_t      cb);
 
-gras_error_t gras_msg_send(gras_socket_t   sock,
+xbt_error_t gras_msg_send(gras_socket_t   sock,
                           gras_msgtype_t  msgtype,
                           void           *payload);
-gras_error_t gras_msg_wait(double          timeout,    
+xbt_error_t gras_msg_wait(double          timeout,    
                           gras_msgtype_t  msgt_want,
                           gras_socket_t  *expeditor,
                           void           *payload);
-gras_error_t gras_msg_handle(double timeOut);
+xbt_error_t gras_msg_handle(double timeOut);
 
 
 END_DECL
index 179e89a..13e4b63 100644 (file)
@@ -46,7 +46,7 @@
  * Register all messages and callbacks needed for the current process to be ready
  * to do BW tests
  */
-gras_error_t grasbw_register_messages(void);
+xbt_error_t grasbw_register_messages(void);
 
 /* ***************************************************************************
  * Bandwidth tests
@@ -66,7 +66,7 @@ gras_error_t grasbw_register_messages(void);
  * Conduct a bandwidth test from the local process to the given peer.
  * This call is blocking until the end of the experiment.
  */
-gras_error_t grasbw_test(const char*to_name,unsigned int to_port,
+xbt_error_t grasbw_test(const char*to_name,unsigned int to_port,
                        unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
                        /*OUT*/ double *sec, double*bw);
 
@@ -87,7 +87,7 @@ gras_error_t grasbw_test(const char*to_name,unsigned int to_port,
  * Conduct a bandwidth test from the process from_host:from_port to to_host:to_port.
  * This call is blocking until the end of the experiment.
  */
-gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_request(const char* from_name,unsigned int from_port,
                           const char* to_name,unsigned int to_port,
                           unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
                           /*OUT*/ double *sec, double*bw);
@@ -111,7 +111,7 @@ gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
  * Ask the process 'from_name:from_port' to start to saturate the link between itself
  * and to_name:to_name.
  */
-gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                                  const char* to_name,unsigned int to_port,
                                  unsigned int msgSize, unsigned int timeout);
 
@@ -127,7 +127,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
  * Ask the process 'from_name:from_port' to stop saturating the link between itself
  * and to_name:to_name.
  */
-gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
                                 const char* to_name,unsigned int to_port);
 
 
index 0f300f5..482e537 100644 (file)
@@ -85,6 +85,6 @@ static const DataDescriptor msgResultDesc[] =
 void
 grasRepportError (gras_socket_t *sock, int id, int SeqCount,
                  const char *severeError,
-                 gras_error_t errcode, const char* format,...);
+                 xbt_error_t errcode, const char* format,...);
 
 #endif /* GRAS_ADDONS_H */
index 761647f..ded4ad7 100644 (file)
@@ -23,14 +23,14 @@ BEGIN_DECL
  * 
  * Perform the various intialisations needed by gras. Each process must run it
  */
-gras_error_t gras_process_init(void);
+xbt_error_t gras_process_init(void);
 
 /**
  * gras_process_exit:
  * 
  * Frees the memory allocated by gras. Processes should run it
  */
-gras_error_t gras_process_exit(void);
+xbt_error_t gras_process_exit(void);
 
 /****************************************************************************/
 /* Manipulating User Data                                                   */
index ca99c83..f87833e 100644 (file)
 
 typedef struct s_gras_socket *gras_socket_t;
 
-gras_error_t gras_socket_client(const char *host,
+xbt_error_t gras_socket_client(const char *host,
                                unsigned short port,
                                /* OUT */ gras_socket_t *dst);
-gras_error_t gras_socket_server(unsigned short port,
+xbt_error_t gras_socket_server(unsigned short port,
                                /* OUT */ gras_socket_t *dst);
 void         gras_socket_close(gras_socket_t sd);
 
@@ -30,30 +30,30 @@ int   gras_socket_peer_port(gras_socket_t sock);
 char *gras_socket_peer_name(gras_socket_t sock);
 
 /* extended interface to get all details */
-gras_error_t gras_socket_client_ext(const char *host,
+xbt_error_t gras_socket_client_ext(const char *host,
                                    unsigned short port,
                                    unsigned long int bufSize,
                                    int raw, 
                                    /* OUT */ gras_socket_t *dst);
-gras_error_t gras_socket_server_ext(unsigned short port,
+xbt_error_t gras_socket_server_ext(unsigned short port,
                                    unsigned long int bufSize,
                                    int raw,
                                    /* OUT */ gras_socket_t *dst);
 
 /* using raw sockets */
-gras_error_t gras_socket_raw_send(gras_socket_t peer, 
+xbt_error_t gras_socket_raw_send(gras_socket_t peer, 
                                  unsigned int timeout,
                                  unsigned long int expSize, 
                                  unsigned long int msgSize);
-gras_error_t gras_socket_raw_recv(gras_socket_t peer, 
+xbt_error_t gras_socket_raw_recv(gras_socket_t peer, 
                                  unsigned int timeout,
                                  unsigned long int expSize, 
                                  unsigned long int msgSize);
 
 /* debuging functions */
-gras_error_t gras_socket_client_from_file(const char*path,
+xbt_error_t gras_socket_client_from_file(const char*path,
                                          /* OUT */ gras_socket_t *dst);
-gras_error_t gras_socket_server_from_file(const char*path,
+xbt_error_t gras_socket_server_from_file(const char*path,
                                          /* OUT */ gras_socket_t *dst);
                                          
    
index 083286d..57243f4 100644 (file)
@@ -17,7 +17,7 @@
 #define TRUE  1
 #define FALSE 0
 
-#define GRAS_MAX_CHANNEL 10 /* FIXME: killme */
+#define XBT_MAX_CHANNEL 10 /* FIXME: killme */
 
 #include <xbt/sysdep.h>
 
index f12386e..a4311ac 100644 (file)
@@ -10,8 +10,8 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef _GRAS_CONFIG_H_
-#define _GRAS_CONFIG_H_
+#ifndef _XBT_CONFIG_H_
+#define _XBT_CONFIG_H_
 
 #include "xbt/dynar.h"
 
@@ -19,43 +19,43 @@ BEGIN_DECL
   
 /* For now, a config is only a special dynar. But don't rely on it, */
 /* it may change in the future. */
-typedef gras_dynar_t gras_cfg_t;
+typedef xbt_dynar_t xbt_cfg_t;
 
 /* type of a typed hash cell */
 typedef enum {
-  gras_cfgelm_int=0, gras_cfgelm_double, gras_cfgelm_string, gras_cfgelm_host,
-  gras_cfgelm_type_count
-} e_gras_cfgelm_type_t;
+  xbt_cfgelm_int=0, xbt_cfgelm_double, xbt_cfgelm_string, xbt_cfgelm_host,
+  xbt_cfgelm_type_count
+} e_xbt_cfgelm_type_t;
 
 /*----[ Memory management ]-----------------------------------------------*/
-gras_cfg_t gras_cfg_new (void);
-void gras_cfg_cpy(gras_cfg_t tocopy,
-        /* OUT */ gras_cfg_t *whereto);
-void gras_cfg_free(gras_cfg_t *cfg);
-void gras_cfg_dump(const char *name,const char*indent,gras_cfg_t cfg);
+xbt_cfg_t xbt_cfg_new (void);
+void xbt_cfg_cpy(xbt_cfg_t tocopy,
+        /* OUT */ xbt_cfg_t *whereto);
+void xbt_cfg_free(xbt_cfg_t *cfg);
+void xbt_cfg_dump(const char *name,const char*indent,xbt_cfg_t cfg);
 
 /*----[ Registering stuff ]-----------------------------------------------*/
 /* Register a possible cell */
-void gras_cfg_register(gras_cfg_t cfg,
-                      const char *name, e_gras_cfgelm_type_t type,
+void xbt_cfg_register(xbt_cfg_t cfg,
+                      const char *name, e_xbt_cfgelm_type_t type,
                       int min, int max);
 /* Unregister a possible cell */
-gras_error_t gras_cfg_unregister(gras_cfg_t cfg, const char *name);
+xbt_error_t xbt_cfg_unregister(xbt_cfg_t cfg, const char *name);
 
 /* Parse the configuration descriptor and register it */
 /* Should be of the form "<name>:<min nb>_to_<max nb>_<type>", */
 /*  with type being one of 'string','int', 'host' or 'double'  */
-gras_error_t gras_cfg_register_str(gras_cfg_t cfg, const char *entry);
+xbt_error_t xbt_cfg_register_str(xbt_cfg_t cfg, const char *entry);
 
 /* Check that each cell have the right amount of elements */
-gras_error_t gras_cfg_check(gras_cfg_t cfg);
+xbt_error_t xbt_cfg_check(xbt_cfg_t cfg);
 
 /* Get the type of this option in that repository */
-gras_error_t gras_cfg_get_type(gras_cfg_t cfg, const char *name, 
-                              /* OUT */ e_gras_cfgelm_type_t *type);
+xbt_error_t xbt_cfg_get_type(xbt_cfg_t cfg, const char *name, 
+                              /* OUT */ e_xbt_cfgelm_type_t *type);
 
 /*----[ Setting ]---------------------------------------------------------
- * gras_cfg_set_* functions.
+ * xbt_cfg_set_* functions.
  *
  * If the registered maximum is equal to 1, those functions remplace the 
  * current value with the provided one. If max>1, the provided value is 
@@ -63,62 +63,62 @@ gras_error_t gras_cfg_get_type(gras_cfg_t cfg, const char *name,
  *
  * string values are strdup'ed before use, so you have to free your copy  */
 
-gras_error_t gras_cfg_set_vargs(gras_cfg_t cfg, va_list pa);
-gras_error_t gras_cfg_set(gras_cfg_t cfg, ...);
+xbt_error_t xbt_cfg_set_vargs(xbt_cfg_t cfg, va_list pa);
+xbt_error_t xbt_cfg_set(xbt_cfg_t cfg, ...);
 
 /*
   Add the cells described in a string to a typed hash.
  */
-gras_error_t gras_cfg_set_parse(gras_cfg_t cfg, const char *options);
+xbt_error_t xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options);
 
 
 /*
   Set the value of the cell @name in @cfg with the provided value.
  */
-gras_error_t gras_cfg_set_int   (gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_set_int   (xbt_cfg_t cfg, const char *name, 
                                 int val);
-gras_error_t gras_cfg_set_double(gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, 
                                 double val);
-gras_error_t gras_cfg_set_string(gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, 
                                 const char *val);
-gras_error_t gras_cfg_set_host  (gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_set_host  (xbt_cfg_t cfg, const char *name, 
                                 const char *host,int port);
 
 /*
  Remove the provided value from the cell @name in @cfg.
  */
-gras_error_t gras_cfg_rm_int   (gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_rm_int   (xbt_cfg_t cfg, const char *name, 
                                int val);
-gras_error_t gras_cfg_rm_double(gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, 
                                double val);
-gras_error_t gras_cfg_rm_string(gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, 
                                const char *val);
-gras_error_t gras_cfg_rm_host  (gras_cfg_t cfg, const char *name, 
+xbt_error_t xbt_cfg_rm_host  (xbt_cfg_t cfg, const char *name, 
                                const char *host,int port);
 
 /* rm every values */
-gras_error_t gras_cfg_empty(gras_cfg_t cfg, const char *name); 
+xbt_error_t xbt_cfg_empty(xbt_cfg_t cfg, const char *name);    
 
 /*----[ Getting ]---------------------------------------------------------*/
 /* Returns a pointer to the values actually stored in the cache. Do not   */
 /* modify them unless you really know what you're doing.                  */
-gras_error_t gras_cfg_get_int   (gras_cfg_t  cfg,
+xbt_error_t xbt_cfg_get_int   (xbt_cfg_t  cfg,
                                 const char *name,
                                 int        *val);
-gras_error_t gras_cfg_get_double(gras_cfg_t  cfg,
+xbt_error_t xbt_cfg_get_double(xbt_cfg_t  cfg,
                                 const char *name,
                                 double     *val);
-gras_error_t gras_cfg_get_string(gras_cfg_t  cfg,
+xbt_error_t xbt_cfg_get_string(xbt_cfg_t  cfg,
                                 const char *name, 
                                 char      **val);
-gras_error_t gras_cfg_get_host  (gras_cfg_t  cfg, 
+xbt_error_t xbt_cfg_get_host  (xbt_cfg_t  cfg, 
                                 const char *name, 
                                 char      **host,
                                 int        *port);
-gras_error_t gras_cfg_get_dynar (gras_cfg_t    cfg,
+xbt_error_t xbt_cfg_get_dynar (xbt_cfg_t    cfg,
                                 const char   *name,
-                      /* OUT */ gras_dynar_t *dynar);
+                      /* OUT */ xbt_dynar_t *dynar);
 
 END_DECL
   
-#endif /* _GRAS_CONFIG_H_ */
+#endif /* _XBT_CONFIG_H_ */
index cb020d4..8b866bb 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-/* gras/dict.h -- api to a generic dictionary                               */
+/* xbt/dict.h -- api to a generic dictionary                               */
 
 /* Authors: Martin Quinson                                                  */
 /* Copyright (C) 2003 the OURAGAN project.                                  */
@@ -9,62 +9,62 @@
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 
-#ifndef _GRAS_DICT_H
-#define _GRAS_DICT_H
+#ifndef _XBT_DICT_H
+#define _XBT_DICT_H
 
 #ifdef  __cplusplus
 extern "C" 
 #endif
 
 /*####[ Type definition ]####################################################*/
-typedef struct gras_dict_ *gras_dict_t;
+typedef struct xbt_dict_ *xbt_dict_t;
 
 /*####[ Simple dict  functions ]#############################################*/
 
-gras_dict_t gras_dict_new(void);
-void gras_dict_free(gras_dict_t *dict);
+xbt_dict_t xbt_dict_new(void);
+void xbt_dict_free(xbt_dict_t *dict);
 
 
-void gras_dict_set    (gras_dict_t     head,
+void xbt_dict_set    (xbt_dict_t     head,
                       const char     *key,
                       void           *data,
                       void_f_pvoid_t *free_ctn);
-void gras_dict_set_ext(gras_dict_t     head,
+void xbt_dict_set_ext(xbt_dict_t     head,
                       const char     *key,
                       int             key_len,
                       void           *data,
                       void_f_pvoid_t *free_ctn);
 
-/*----[ gras_dict_get ]------------------------------------------------------*/
+/*----[ xbt_dict_get ]------------------------------------------------------*/
 /* Search the given #key#. data=NULL when not found.                         */
 /* Returns true if anything went ok, and false on internal error.            */
 /*---------------------------------------------------------------------------*/
-gras_error_t gras_dict_get(gras_dict_t head,const char *key,
+xbt_error_t xbt_dict_get(xbt_dict_t head,const char *key,
                           /* OUT */void **data);
-gras_error_t gras_dict_get_ext(gras_dict_t head,const char *key,
+xbt_error_t xbt_dict_get_ext(xbt_dict_t head,const char *key,
                               int key_len,
                               /* OUT */void **data);
-/*----[ gras_dict_remove ]---------------------------------------------------*/
+/*----[ xbt_dict_remove ]---------------------------------------------------*/
 /* Remove the entry associated with the given #key#.                         */
 /* Returns if ok. Removing a non-existant key is ok.                         */
 /*---------------------------------------------------------------------------*/
-gras_error_t gras_dict_remove(gras_dict_t head,const char *key);
+xbt_error_t xbt_dict_remove(xbt_dict_t head,const char *key);
 
-gras_error_t gras_dict_remove_ext(gras_dict_t head,
+xbt_error_t xbt_dict_remove_ext(xbt_dict_t head,
                                  const char *key, int key_len);
 
-/*----[ gras_dict_dump ]-----------------------------------------------------*/
+/*----[ xbt_dict_dump ]-----------------------------------------------------*/
 /* Outputs the content of the structure. (for debuging purpose)              */
 /* #output# is a function to output the data.If NULL, data won't be displayed*/
 /*---------------------------------------------------------------------------*/
-void gras_dict_dump(gras_dict_t head,
+void xbt_dict_dump(xbt_dict_t head,
                    void (*output)(void*));
-/*----[ gras_dict_print ]----------------------------------------------------*/
+/*----[ xbt_dict_print ]----------------------------------------------------*/
 /* To dump multicache, this function dump a cache                            */
 /*---------------------------------------------------------------------------*/
-void gras_dict_print(void *data);
+void xbt_dict_print(void *data);
 /* To dump multicache, this one dumps a string                               */
-void gras_dict_prints(void *data);
+void xbt_dict_prints(void *data);
 
 
 /*####[ Multi cache functions ]##############################################*/
@@ -72,77 +72,77 @@ void gras_dict_prints(void *data);
 /*  than their simple cache counterpart.                                     */
 /*###############################"###########################################*/
 
-/*----[ gras_multidict_free ]------------------------------------------------*/
-/* This function does not exist. Use gras_dict_free instead.                 */
+/*----[ xbt_multidict_free ]------------------------------------------------*/
+/* This function does not exist. Use xbt_dict_free instead.                 */
 /*---------------------------------------------------------------------------*/
 
-/*----[ gras_multidict_set ]-------------------------------------------------*/
+/*----[ xbt_multidict_set ]-------------------------------------------------*/
 /* Insert the data in the structure under the #keycount# #key#s.             */
 /* The key are destroyed in the process. Think to strdup it before.          */
 /* Returns if it was ok or not                                               */
 /*---------------------------------------------------------------------------*/
-gras_error_t gras_multidict_set(gras_dict_t *head,
+xbt_error_t xbt_multidict_set(xbt_dict_t *head,
                                int keycount,char **key,
                                void *data,void (*free_ctn)(void*));
 
-gras_error_t gras_multidict_set_ext(gras_dict_t *head,
+xbt_error_t xbt_multidict_set_ext(xbt_dict_t *head,
                                    int keycount,char **key,int *key_len,
                                    void *data,void_f_pvoid_t *free_ctn);
 
-/*----[ gras_multidict_get ]-------------------------------------------------*/
+/*----[ xbt_multidict_get ]-------------------------------------------------*/
 /* Search the given #key#. data=NULL when not found.                         */
 /* Returns true if anything went ok, and false on internal error.            */
 /*---------------------------------------------------------------------------*/
-gras_error_t gras_multidict_get(gras_dict_t head,
+xbt_error_t xbt_multidict_get(xbt_dict_t head,
                                int keycount,const char **key,
                                /* OUT */void **data);
 
-gras_error_t gras_multidict_get_ext(gras_dict_t head,
+xbt_error_t xbt_multidict_get_ext(xbt_dict_t head,
                                    int keycount,const char **key,int *key_len,
                                    /* OUT */void **data);
 
-/*----[ gras_multidict_remove ]----------------------------------------------*/
+/*----[ xbt_multidict_remove ]----------------------------------------------*/
 /* Remove the entry associated with the given #key#.                         */
 /* Returns if ok. Removing a non-existant key is ok.                         */
 /*---------------------------------------------------------------------------*/
-gras_error_t gras_multidict_remove(gras_dict_t head,
+xbt_error_t xbt_multidict_remove(xbt_dict_t head,
                                   int keycount,const char **key);
 
-gras_error_t gras_multidict_remove_ext(gras_dict_t head,
+xbt_error_t xbt_multidict_remove_ext(xbt_dict_t head,
                                        int keycount,const char **key,int *key_len);
 
 /*####[ Cache cursor functions ]#############################################*/
 /* To traverse (simple) caches                                               */
 /* Don't add or remove entries to the cache while traversing !!!             */
 /*###########################################################################*/
-typedef struct gras_dict_cursor_ *gras_dict_cursor_t;
+typedef struct xbt_dict_cursor_ *xbt_dict_cursor_t;
 /* creator/destructor */
-gras_dict_cursor_t gras_dict_cursor_new(const gras_dict_t head);
-void               gras_dict_cursor_free(gras_dict_cursor_t *cursor);
+xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t head);
+void               xbt_dict_cursor_free(xbt_dict_cursor_t *cursor);
 
 /* back to first element 
    it is not enough to reinit the cache after an add/remove in cache*/
-void gras_dict_cursor_rewind(gras_dict_cursor_t cursor);
+void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
 
 
-gras_error_t gras_dict_cursor_get_key     (gras_dict_cursor_t cursor,
+xbt_error_t xbt_dict_cursor_get_key     (xbt_dict_cursor_t cursor,
                                           /*OUT*/char **key);
-gras_error_t gras_dict_cursor_get_data    (gras_dict_cursor_t cursor,
+xbt_error_t xbt_dict_cursor_get_data    (xbt_dict_cursor_t cursor,
                                           /*OUT*/void **data);
 
-void gras_dict_cursor_first (const gras_dict_t   dict,
-                            gras_dict_cursor_t *cursor);
-void         gras_dict_cursor_step        (gras_dict_cursor_t  cursor);
-int          gras_dict_cursor_get_or_free (gras_dict_cursor_t *cursor,
+void xbt_dict_cursor_first (const xbt_dict_t   dict,
+                            xbt_dict_cursor_t *cursor);
+void         xbt_dict_cursor_step        (xbt_dict_cursor_t  cursor);
+int          xbt_dict_cursor_get_or_free (xbt_dict_cursor_t *cursor,
                                           char              **key,
                                           void              **data);
-#define gras_dict_foreach(dict,cursor,key,data)                       \
-  for (cursor=NULL, gras_dict_cursor_first((dict),&(cursor)) ;        \
-       gras_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));\
-       gras_dict_cursor_step(cursor) )
+#define xbt_dict_foreach(dict,cursor,key,data)                       \
+  for (cursor=NULL, xbt_dict_cursor_first((dict),&(cursor)) ;        \
+       xbt_dict_cursor_get_or_free(&(cursor),&(key),(void**)(&data));\
+       xbt_dict_cursor_step(cursor) )
 
 #ifdef  __cplusplus
 }
 #endif
 
-#endif /* _GRAS_DICT_H */
+#endif /* _XBT_DICT_H */
index 801180a..c95e619 100644 (file)
@@ -8,69 +8,69 @@
 /* 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_DYNAR_H
-#define _GRAS_DYNAR_H
+#ifndef _XBT_DYNAR_H
+#define _XBT_DYNAR_H
 
 #include "xbt/misc.h" /* BEGIN_DECL */
 
 BEGIN_DECL
 
-typedef struct gras_dynar_s *gras_dynar_t;
+typedef struct xbt_dynar_s *xbt_dynar_t;
 
 /* pointer to a function freeing something */
 typedef   void (void_f_ppvoid_t)(void**);
 typedef   void (void_f_pvoid_t) (void*);
 
-gras_dynar_t  gras_dynar_new(unsigned long elm_size, 
+xbt_dynar_t  xbt_dynar_new(unsigned long elm_size, 
                             void_f_pvoid_t *free_func);
-void          gras_dynar_free(gras_dynar_t *dynar);
-void          gras_dynar_free_container(gras_dynar_t *dynar);
+void          xbt_dynar_free(xbt_dynar_t *dynar);
+void          xbt_dynar_free_container(xbt_dynar_t *dynar);
 
-unsigned long gras_dynar_length(const gras_dynar_t dynar);
-void          gras_dynar_reset(gras_dynar_t dynar);
+unsigned long xbt_dynar_length(const xbt_dynar_t dynar);
+void          xbt_dynar_reset(xbt_dynar_t dynar);
 
 
 /* regular array functions */
-void gras_dynar_get_cpy(const gras_dynar_t dynar, int idx, void *const dst);
-void *gras_dynar_get_ptr(const gras_dynar_t dynar,
+void xbt_dynar_get_cpy(const xbt_dynar_t dynar, int idx, void *const dst);
+void *xbt_dynar_get_ptr(const xbt_dynar_t dynar,
                         const int          idx);
 
-#define gras_dynar_get_as(dynar,idx,type) *(type*)gras_dynar_get_ptr(dynar,idx)
+#define xbt_dynar_get_as(dynar,idx,type) *(type*)xbt_dynar_get_ptr(dynar,idx)
   
-void gras_dynar_set(gras_dynar_t dynar, int  idx, const void *src);
-void gras_dynar_replace(gras_dynar_t dynar,
+void xbt_dynar_set(xbt_dynar_t dynar, int  idx, const void *src);
+void xbt_dynar_replace(xbt_dynar_t dynar,
                        int idx, const void *object);
 
 /* perl array function */
 
-void gras_dynar_insert_at(gras_dynar_t dynar,
+void xbt_dynar_insert_at(xbt_dynar_t dynar,
                          int  idx, const void *src);
-void gras_dynar_remove_at(gras_dynar_t dynar,
+void xbt_dynar_remove_at(xbt_dynar_t dynar,
                          int  idx, void *object);
-void gras_dynar_push     (gras_dynar_t dynar, const void *src);
-void gras_dynar_pop      (gras_dynar_t dynar, void *const dst);
-void gras_dynar_unshift  (gras_dynar_t dynar, const void *src);
-void gras_dynar_shift    (gras_dynar_t dynar, void *const dst);
-void gras_dynar_map      (const gras_dynar_t dynar, void_f_pvoid_t *operator);
+void xbt_dynar_push     (xbt_dynar_t dynar, const void *src);
+void xbt_dynar_pop      (xbt_dynar_t dynar, void *const dst);
+void xbt_dynar_unshift  (xbt_dynar_t dynar, const void *src);
+void xbt_dynar_shift    (xbt_dynar_t dynar, void *const dst);
+void xbt_dynar_map      (const xbt_dynar_t dynar, void_f_pvoid_t *operator);
 
 /* speed-optimized versions */
-void *gras_dynar_insert_at_ptr(gras_dynar_t const dynar,
+void *xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
                               const int          idx);
-void *gras_dynar_push_ptr(gras_dynar_t dynar);
-void *gras_dynar_pop_ptr(gras_dynar_t dynar);
+void *xbt_dynar_push_ptr(xbt_dynar_t dynar);
+void *xbt_dynar_pop_ptr(xbt_dynar_t dynar);
 
-#define gras_dynar_insert_at_as(dynar,idx,type,value) *(type*)gras_dynar_insert_at_ptr(dynar,idx)=value
-#define gras_dynar_push_as(dynar,type,value) *(type*)gras_dynar_push_ptr(dynar)=value
-#define gras_dynar_pop_as(dynar,type) *(type*)gras_dynar_pop_ptr(dynar)
+#define xbt_dynar_insert_at_as(dynar,idx,type,value) *(type*)xbt_dynar_insert_at_ptr(dynar,idx)=value
+#define xbt_dynar_push_as(dynar,type,value) *(type*)xbt_dynar_push_ptr(dynar)=value
+#define xbt_dynar_pop_as(dynar,type) *(type*)xbt_dynar_pop_ptr(dynar)
 
 
 /* cursor functions */
-void gras_dynar_cursor_first (const gras_dynar_t dynar, int *cursor);
-void gras_dynar_cursor_step  (const gras_dynar_t dynar, int *cursor);
-int  gras_dynar_cursor_get   (const gras_dynar_t dynar, int *cursor, void *whereto);
+void xbt_dynar_cursor_first (const xbt_dynar_t dynar, int *cursor);
+void xbt_dynar_cursor_step  (const xbt_dynar_t dynar, int *cursor);
+int  xbt_dynar_cursor_get   (const xbt_dynar_t dynar, int *cursor, void *whereto);
 
 /**
- * gras_dynar_foreach:
+ * xbt_dynar_foreach:
  * @_dynar: what to iterate over
  * @_cursor: an integer used as cursor
  * @_data:
@@ -78,25 +78,25 @@ int  gras_dynar_cursor_get   (const gras_dynar_t dynar, int *cursor, void *where
  * Iterates over the whole dynar. Example:
  *
  * <programlisting>
- * gras_dynar_t *dyn;
+ * xbt_dynar_t *dyn;
  * int cpt;
  * string *str;
- * gras_dynar_foreach (dyn,cpt,str) {
+ * xbt_dynar_foreach (dyn,cpt,str) {
  *   printf("Seen %s\n",str);
  * }</programlisting>
  */
-#define gras_dynar_foreach(_dynar,_cursor,_data) \
-       for (gras_dynar_cursor_first(_dynar,&(_cursor))      ; \
-           gras_dynar_cursor_get(_dynar,&(_cursor),&_data) ; \
-            gras_dynar_cursor_step(_dynar,&(_cursor))         )
+#define xbt_dynar_foreach(_dynar,_cursor,_data) \
+       for (xbt_dynar_cursor_first(_dynar,&(_cursor))      ; \
+           xbt_dynar_cursor_get(_dynar,&(_cursor),&_data) ; \
+            xbt_dynar_cursor_step(_dynar,&(_cursor))         )
 /*
-       for (gras_dynar_length(_dynar) && (_gras_dynar_cursor_first(_dynar,&_cursor),      \
+       for (xbt_dynar_length(_dynar) && (_xbt_dynar_cursor_first(_dynar,&_cursor),      \
                                          1);     \
-           gras_dynar_length(_dynar) && gras_dynar_cursor_get(_dynar,&_cursor,&_data); \
-            gras_dynar_cursor_step(_dynar,&_cursor))
+           xbt_dynar_length(_dynar) && xbt_dynar_cursor_get(_dynar,&_cursor,&_data); \
+            xbt_dynar_cursor_step(_dynar,&_cursor))
 */
-void gras_dynar_cursor_rm(gras_dynar_t dynar,
+void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
                          int          *const cursor);
 
 END_DECL
-#endif /* _GRAS_DYNAR_H */
+#endif /* _XBT_DYNAR_H */
index 4dabcc8..c88d536 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-/* gras/error.h - Error tracking support                                    */
+/* xbt/error.h - Error tracking support                                     */
 
 /* Authors: Martin Quinson                                                  */
 /* Copyright (C) 2003,2004 da GRAS posse.                                   */
@@ -9,8 +9,8 @@
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 
-#ifndef GRAS_ERROR_H
-#define GRAS_ERROR_H
+#ifndef XBT_ERROR_H
+#define XBT_ERROR_H
 
 #include <stdio.h> /* FIXME: Get rid of it */
 
@@ -40,15 +40,15 @@ typedef enum {
   remote_timeout_error,
   remote_thread_error,
   remote_unknown_error
-} gras_error_t;
+} xbt_error_t;
 
-/*@observer@*/ const char *gras_error_name(gras_error_t errcode);
+/*@observer@*/ const char *xbt_error_name(xbt_error_t errcode);
 
 #define TRY(a) do {                                     \
   if ((errcode=a) != no_error) {                        \
      fprintf (stderr, "%s:%d: '%s' error raising...\n", \
             __FILE__,__LINE__,                         \
-             gras_error_name(errcode));                 \
+             xbt_error_name(errcode));                 \
      return errcode;                                    \
   } } while (0)
    
@@ -57,18 +57,18 @@ typedef enum {
   if ((errcode=a) != no_error) {                               \
      fprintf(stderr,"%s:%d: Got '%s' error !\n",               \
             __FILE__,__LINE__,                                \
-             gras_error_name(errcode));                        \
+             xbt_error_name(errcode));                        \
      fflush(stdout);                                           \
-     gras_abort();                                             \
+     xbt_abort();                                             \
   } } while(0)
 
 #define TRYEXPECT(action,expected_error)  do {                 \
   errcode=action;                                              \
   if (errcode != expected_error) {                             \
     fprintf(stderr,"Got error %s (instead of %s expected)\n",  \
-           gras_error_name(errcode),                          \
-           gras_error_name(expected_error));                  \
-    gras_abort();                                              \
+           xbt_error_name(errcode),                          \
+           xbt_error_name(expected_error));                  \
+    xbt_abort();                                              \
   }                                                            \
 } while(0)
 
@@ -81,13 +81,13 @@ typedef enum {
 } while(0)
 
 #if 0 /* FIXME: We don't use backtrace. Drop it? */
-#define _GRAS_ERR_PRE do {                                     \
+#define _XBT_ERR_PRE do {                                     \
  void *_gs_array[30];                                          \
   size_t _gs_size= backtrace (_gs_array, 30);                  \
   char **_gs_strings= backtrace_symbols (_gs_array, _gs_size); \
   size_t _gs_i;
 
-#define _GRAS_ERR_POST(code)                                   \
+#define _XBT_ERR_POST(code)                                   \
   fprintf(stderr,"Backtrace follows\n");                       \
   for (_gs_i = 0; _gs_i < _gs_size; _gs_i++)                   \
      fprintf (stderr,"   %s\n", _gs_strings[_gs_i]);           \
@@ -95,71 +95,71 @@ typedef enum {
 } while (0)
 
 #else /* if 0 */
-#define _GRAS_ERR_PRE do {
-#define _GRAS_ERR_POST(code)                                   \
+#define _XBT_ERR_PRE do {
+#define _XBT_ERR_POST(code)                                   \
   return code;                                                 \
 } while (0)
 #endif
 
-#define RAISE0(code,fmt) _GRAS_ERR_PRE     \
+#define RAISE0(code,fmt) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",    \
           __FILE__,__LINE__,__FUNCTION__); \
-  _GRAS_ERR_POST(code)
-#define RAISE1(code,fmt,a1) _GRAS_ERR_PRE     \
+  _XBT_ERR_POST(code)
+#define RAISE1(code,fmt,a1) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",       \
           __FILE__,__LINE__,__FUNCTION__,a1); \
-  _GRAS_ERR_POST(code)
-#define RAISE2(code,fmt,a1,a2) _GRAS_ERR_PRE     \
+  _XBT_ERR_POST(code)
+#define RAISE2(code,fmt,a1,a2) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",          \
           __FILE__,__LINE__,__FUNCTION__,a1,a2); \
-  _GRAS_ERR_POST(code)
-#define RAISE3(code,fmt,a1,a2,a3) _GRAS_ERR_PRE     \
+  _XBT_ERR_POST(code)
+#define RAISE3(code,fmt,a1,a2,a3) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",             \
           __FILE__,__LINE__,__FUNCTION__,a1,a2,a3); \
-  _GRAS_ERR_POST(code)
-#define RAISE4(code,fmt,a1,a2,a3,a4) _GRAS_ERR_PRE     \
+  _XBT_ERR_POST(code)
+#define RAISE4(code,fmt,a1,a2,a3,a4) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",                \
           __FILE__,__LINE__,__FUNCTION__,a1,a2,a3,a4); \
-  _GRAS_ERR_POST(code)
-#define RAISE5(code,fmt,a1,a2,a3,a4,a5) _GRAS_ERR_PRE     \
+  _XBT_ERR_POST(code)
+#define RAISE5(code,fmt,a1,a2,a3,a4,a5) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",                   \
           __FILE__,__LINE__,__FUNCTION__,a1,a2,a3,a4,a5); \
-  _GRAS_ERR_POST(code)
-#define RAISE6(code,fmt,a1,a2,a3,a4,a5,a6) _GRAS_ERR_PRE     \
+  _XBT_ERR_POST(code)
+#define RAISE6(code,fmt,a1,a2,a3,a4,a5,a6) _XBT_ERR_PRE     \
   fprintf(stderr,"%s:%d:%s: " fmt "\n",                      \
           __FILE__,__LINE__,__FUNCTION__,a1,a2,a3,a4,a5,a6); \
-  _GRAS_ERR_POST(code)
+  _XBT_ERR_POST(code)
 
 //#define RAISE_MALLOC     RAISE0(malloc_error,"Malloc error")
 #define RAISE_IMPOSSIBLE RAISE0(unknown_error,"The Impossible did happen")
 #define RAISE_UNIMPLEMENTED RAISE1(unknown_error,"Function %s unimplemented",__FUNCTION__)
 
 #ifdef NDEBUG
-#define gras_assert(cond)
-#define gras_assert0(cond,msg)
-#define gras_assert1(cond,msg,a)
-#define gras_assert2(cond,msg,a,b)
-#define gras_assert3(cond,msg,a,b,c)
-#define gras_assert4(cond,msg,a,b,c,d)
-#define gras_assert5(cond,msg,a,b,c,d,e)
-#define gras_assert6(cond,msg,a,b,c,d,e,f)
+#define xbt_assert(cond)
+#define xbt_assert0(cond,msg)
+#define xbt_assert1(cond,msg,a)
+#define xbt_assert2(cond,msg,a,b)
+#define xbt_assert3(cond,msg,a,b,c)
+#define xbt_assert4(cond,msg,a,b,c,d)
+#define xbt_assert5(cond,msg,a,b,c,d,e)
+#define xbt_assert6(cond,msg,a,b,c,d,e,f)
 #else
-#define gras_assert(cond)                  if (!(cond)) { CRITICAL1("Assertion %s failed", #cond); gras_abort(); }
-#define gras_assert0(cond,msg)             if (!(cond)) { CRITICAL0(msg); gras_abort(); }
-#define gras_assert1(cond,msg,a)           if (!(cond)) { CRITICAL1(msg,a); gras_abort(); }
-#define gras_assert2(cond,msg,a,b)         if (!(cond)) { CRITICAL2(msg,a,b); gras_abort(); }
-#define gras_assert3(cond,msg,a,b,c)       if (!(cond)) { CRITICAL3(msg,a,b,c); gras_abort(); }
-#define gras_assert4(cond,msg,a,b,c,d)     if (!(cond)) { CRITICAL4(msg,a,b,c,d); gras_abort(); }
-#define gras_assert5(cond,msg,a,b,c,d,e)   if (!(cond)) { CRITICAL5(msg,a,b,c,d,e); gras_abort(); }
-#define gras_assert6(cond,msg,a,b,c,d,e,f) if (!(cond)) { CRITICAL6(msg,a,b,c,d,e,f); gras_abort(); }
+#define xbt_assert(cond)                  if (!(cond)) { CRITICAL1("Assertion %s failed", #cond); xbt_abort(); }
+#define xbt_assert0(cond,msg)             if (!(cond)) { CRITICAL0(msg); xbt_abort(); }
+#define xbt_assert1(cond,msg,a)           if (!(cond)) { CRITICAL1(msg,a); xbt_abort(); }
+#define xbt_assert2(cond,msg,a,b)         if (!(cond)) { CRITICAL2(msg,a,b); xbt_abort(); }
+#define xbt_assert3(cond,msg,a,b,c)       if (!(cond)) { CRITICAL3(msg,a,b,c); xbt_abort(); }
+#define xbt_assert4(cond,msg,a,b,c,d)     if (!(cond)) { CRITICAL4(msg,a,b,c,d); xbt_abort(); }
+#define xbt_assert5(cond,msg,a,b,c,d,e)   if (!(cond)) { CRITICAL5(msg,a,b,c,d,e); xbt_abort(); }
+#define xbt_assert6(cond,msg,a,b,c,d,e,f) if (!(cond)) { CRITICAL6(msg,a,b,c,d,e,f); xbt_abort(); }
 #endif
 
-void gras_die(const char *msg);
+void xbt_die(const char *msg);
 
-#define DIE_IMPOSSIBLE gras_assert0(0,"The Impossible did happen (yet again)")
-#define gras_assert_error(a) gras_assert1(errcode == (a), "Error %s unexpected",gras_error_name(errcode))
+#define DIE_IMPOSSIBLE xbt_assert0(0,"The Impossible did happen (yet again)")
+#define xbt_assert_error(a) xbt_assert1(errcode == (a), "Error %s unexpected",xbt_error_name(errcode))
 
 END_DECL
 
-#endif /* GRAS_ERROR_H */
+#endif /* XBT_ERROR_H */
 
index b2e83b5..c565a13 100644 (file)
@@ -8,46 +8,46 @@
 /* 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. */
 
-/* GRAS_LOG_MAYDAY: define this to replace the logging facilities with basic
+/* XBT_LOG_MAYDAY: define this to replace the logging facilities with basic
    printf function. Useful to debug the logging facilities themselves */
-#undef GRAS_LOG_MAYDAY
-/*#define GRAS_LOG_MAYDAY*/
+#undef XBT_LOG_MAYDAY
+/*#define XBT_LOG_MAYDAY*/
 
-#ifndef _GRAS_LOG_H_
-#define _GRAS_LOG_H_
+#ifndef _XBT_LOG_H_
+#define _XBT_LOG_H_
 
 #include <stdarg.h>
 
 #include "xbt/sysdep.h"
 
 /**
- * e_gras_log_priority_t:
- * @gras_log_priority_none:          used internally (don't poke with)
- * @gras_log_priority_debug:         crufty output 
- * @gras_log_priority_verbose:       verbose output for the user wanting more
- * @gras_log_priority_info:          output about the regular functionning 
- * @gras_log_priority_warning:       minor issue encountered 
- * @gras_log_priority_error:         issue encountered 
- * @gras_log_priority_critical:      major issue encountered 
- * @gras_log_priority_infinite:      value for GRAS_LOG_STATIC_THRESHOLD to not log
- * @gras_log_priority_uninitialized: used internally (don't poke with)
+ * e_xbt_log_priority_t:
+ * @xbt_log_priority_none:          used internally (don't poke with)
+ * @xbt_log_priority_debug:         crufty output 
+ * @xbt_log_priority_verbose:       verbose output for the user wanting more
+ * @xbt_log_priority_info:          output about the regular functionning 
+ * @xbt_log_priority_warning:       minor issue encountered 
+ * @xbt_log_priority_error:         issue encountered 
+ * @xbt_log_priority_critical:      major issue encountered 
+ * @xbt_log_priority_infinite:      value for XBT_LOG_STATIC_THRESHOLD to not log
+ * @xbt_log_priority_uninitialized: used internally (don't poke with)
  *
  * The different existing priorities.
  */
 typedef enum {
-  gras_log_priority_none          = 0, 
-  gras_log_priority_trace         = 1, 
-  gras_log_priority_debug         = 2, 
-  gras_log_priority_verbose       = 3, 
-  gras_log_priority_info          = 4, 
-  gras_log_priority_warning       = 5, 
-  gras_log_priority_error         = 6, 
-  gras_log_priority_critical      = 7, 
-
-  gras_log_priority_infinite      = 8, 
-
-  gras_log_priority_uninitialized = -1 
-} e_gras_log_priority_t;
+  xbt_log_priority_none          = 0, 
+  xbt_log_priority_trace         = 1, 
+  xbt_log_priority_debug         = 2, 
+  xbt_log_priority_verbose       = 3, 
+  xbt_log_priority_info          = 4, 
+  xbt_log_priority_warning       = 5, 
+  xbt_log_priority_error         = 6, 
+  xbt_log_priority_critical      = 7, 
+
+  xbt_log_priority_infinite      = 8, 
+
+  xbt_log_priority_uninitialized = -1 
+} e_xbt_log_priority_t;
              
 
 /**
@@ -58,85 +58,85 @@ typedef enum {
 
 
 /**
- * GRAS_LOG_STATIC_THRESHOLD:
+ * XBT_LOG_STATIC_THRESHOLD:
  *
- * All logging with priority < GRAS_LOG_STATIC_THRESHOLD is disabled at
+ * All logging with priority < XBT_LOG_STATIC_THRESHOLD is disabled at
  * compile time, i.e., compiled out.
  */
 #ifdef NLOG
-#  define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_infinite
+#  define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_infinite
 #else
 
 #  ifdef NDEBUG
-#    define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_verbose
+#    define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_verbose
 #  else /* !NLOG && !NDEBUG */
 
-#    ifndef GRAS_LOG_STATIC_THRESHOLD
-#      define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_none
-#    endif /* !GRAS_LOG_STATIC_THRESHOLD */
+#    ifndef XBT_LOG_STATIC_THRESHOLD
+#      define XBT_LOG_STATIC_THRESHOLD xbt_log_priority_none
+#    endif /* !XBT_LOG_STATIC_THRESHOLD */
 #  endif /* NDEBUG */
 #endif /* !defined(NLOG) */
 
 /* Transforms a category name to a global variable name. */
-#define _GRAS_LOGV(cat)   _GRAS_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat)
-#define _GRAS_LOG_CONCAT(x,y) x ## y
+#define _XBT_LOGV(cat)   _XBT_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat)
+#define _XBT_LOG_CONCAT(x,y) x ## y
 
 /* The root of the category hierarchy. */
-#define GRAS_LOG_ROOT_CAT   root
+#define XBT_LOG_ROOT_CAT   root
 
 /**
- * GRAS_LOG_NEW_SUBCATEGORY:
+ * XBT_LOG_NEW_SUBCATEGORY:
  * @catName: name of new category
  * @parent: father of the new category in the tree
  * @desc: string describing the purpose of this category
  *
  * Defines a new subcategory of the parent. 
  */
-#define GRAS_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
-    extern s_gras_log_category_t _GRAS_LOGV(parent);    \
-    s_gras_log_category_t _GRAS_LOGV(catName) = {       \
-        &_GRAS_LOGV(parent), 0, 0,                    \
-        #catName, gras_log_priority_uninitialized, 1, \
+#define XBT_LOG_NEW_SUBCATEGORY(catName, parent, desc) \
+    extern s_xbt_log_category_t _XBT_LOGV(parent);    \
+    s_xbt_log_category_t _XBT_LOGV(catName) = {       \
+        &_XBT_LOGV(parent), 0, 0,                    \
+        #catName, xbt_log_priority_uninitialized, 1, \
         0, 1                                          \
     }
 
 /**
- * GRAS_LOG_NEW_CATEGORY:
+ * XBT_LOG_NEW_CATEGORY:
  * @catName: name of new category
  * @desc: string describing the purpose of this category
  *
  * Creates a new subcategory of the root category.
  */
-#define GRAS_LOG_NEW_CATEGORY(catName,desc)  GRAS_LOG_NEW_SUBCATEGORY(catName, GRAS_LOG_ROOT_CAT, desc)
+#define XBT_LOG_NEW_CATEGORY(catName,desc)  XBT_LOG_NEW_SUBCATEGORY(catName, XBT_LOG_ROOT_CAT, desc)
 
 /**
- * GRAS_LOG_DEFAULT_CATEGORY:
+ * XBT_LOG_DEFAULT_CATEGORY:
  * @cname: name of the cat
  *
  * Indicates which category is the default one.
  */
 
-#if defined(GRAS_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
-# define GRAS_LOG_DEFAULT_CATEGORY(cname)
+#if defined(XBT_LOG_MAYDAY) /*|| defined (NLOG) * turning logging off */
+# define XBT_LOG_DEFAULT_CATEGORY(cname)
 #else
-# define GRAS_LOG_DEFAULT_CATEGORY(cname) \
-        static gras_log_category_t _GRAS_LOGV(default) = &_GRAS_LOGV(cname)
+# define XBT_LOG_DEFAULT_CATEGORY(cname) \
+        static xbt_log_category_t _XBT_LOGV(default) = &_XBT_LOGV(cname)
 #endif
 
 /**
- * GRAS_LOG_NEW_DEFAULT_CATEGORY:
+ * XBT_LOG_NEW_DEFAULT_CATEGORY:
  * @cname: name of the cat
  * @desc: string describing the purpose of this category
  *
  * Creates a new subcategory of the root category and makes it the default
  * (used by macros that don't explicitly specify a category).
  */
-#define GRAS_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
-    GRAS_LOG_NEW_CATEGORY(cname,desc);                   \
-    GRAS_LOG_DEFAULT_CATEGORY(cname)
+#define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
+    XBT_LOG_NEW_CATEGORY(cname,desc);                   \
+    XBT_LOG_DEFAULT_CATEGORY(cname)
 
 /**
- * GRAS_LOG_NEW_DEFAULT_SUBCATEGORY:
+ * XBT_LOG_NEW_DEFAULT_SUBCATEGORY:
  * @cname: name of the cat
  * @parent: name of the parent
  * @desc: string describing the purpose of this category
@@ -144,54 +144,54 @@ typedef enum {
  * Creates a new subcategory of the parent category and makes it the default
  * (used by macros that don't explicitly specify a category).
  */
-#define GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
-    GRAS_LOG_NEW_SUBCATEGORY(cname, parent, desc);            \
-    GRAS_LOG_DEFAULT_CATEGORY(cname)
+#define XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
+    XBT_LOG_NEW_SUBCATEGORY(cname, parent, desc);            \
+    XBT_LOG_DEFAULT_CATEGORY(cname)
 
 /**
- * GRAS_LOG_EXTERNAL_CATEGORY:
+ * XBT_LOG_EXTERNAL_CATEGORY:
  * @cname: name of the cat
  *
  * Indicates that a category you'll use in this file (to get subcategories of it, 
  * for example) really lives in another file.
  */
 
-#define GRAS_LOG_EXTERNAL_CATEGORY(cname) \
-   extern s_gras_log_category_t _GRAS_LOGV(cname)
+#define XBT_LOG_EXTERNAL_CATEGORY(cname) \
+   extern s_xbt_log_category_t _XBT_LOGV(cname)
 
 /* Functions you may call */
 
-extern void gras_log_control_set(const char* cs);
+extern void xbt_log_control_set(const char* cs);
 
 /* Forward declarations */
-typedef struct gras_log_appender_s s_gras_log_appender_t,*gras_log_appender_t;
-typedef struct gras_log_event_s    s_gras_log_event_t,   *gras_log_event_t;
-typedef struct gras_log_category_s s_gras_log_category_t,*gras_log_category_t;
+typedef struct xbt_log_appender_s s_xbt_log_appender_t,*xbt_log_appender_t;
+typedef struct xbt_log_event_s    s_xbt_log_event_t,   *xbt_log_event_t;
+typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
 
 /**
  * Do NOT access any members of this structure directly. FIXME: move to private?
  */
-struct gras_log_category_s {
-            gras_log_category_t parent;
-/*@null@*/  gras_log_category_t firstChild; 
-/*@null@*/  gras_log_category_t nextSibling;
+struct xbt_log_category_s {
+            xbt_log_category_t parent;
+/*@null@*/  xbt_log_category_t firstChild; 
+/*@null@*/  xbt_log_category_t nextSibling;
             const char *name;
             int threshold;
             int isThreshInherited;
-/*@null@*/  gras_log_appender_t appender;
+/*@null@*/  xbt_log_appender_t appender;
             int willLogToParent;
   /* TODO: Formats? */
 };
 
-struct gras_log_appender_s {
-  void (*do_append) (gras_log_appender_t thisLogAppender,
-                   gras_log_event_t event, const char *fmt);
+struct xbt_log_appender_s {
+  void (*do_append) (xbt_log_appender_t thisLogAppender,
+                   xbt_log_event_t event, const char *fmt);
   void *appender_data;
 };
 
-struct gras_log_event_s {
-  gras_log_category_t cat;
-  e_gras_log_priority_t priority;
+struct xbt_log_event_s {
+  xbt_log_category_t cat;
+  e_xbt_log_priority_t priority;
   const char* fileName;
   const char* functionName;
   int lineNum;
@@ -199,50 +199,50 @@ struct gras_log_event_s {
 };
 
 /**
- * gras_log_threshold_set:
+ * xbt_log_threshold_set:
  * @cat: the category (not only its name, but the variable)
  * @thresholdPriority: the priority
  *
  * Programatically alters a category's threshold priority (don't use).
  */
-extern void gras_log_threshold_set(gras_log_category_t cat,
-                                  e_gras_log_priority_t thresholdPriority);
+extern void xbt_log_threshold_set(xbt_log_category_t cat,
+                                  e_xbt_log_priority_t thresholdPriority);
 
 /**
- * gras_log_parent_set:
+ * xbt_log_parent_set:
  * @cat: the category (not only its name, but the variable)
  * @parent: the parent cat
  *
  * Programatically alter a category's parent (don't use).
  */
-extern void gras_log_parent_set(gras_log_category_t cat,
-                               gras_log_category_t parent);
+extern void xbt_log_parent_set(xbt_log_category_t cat,
+                               xbt_log_category_t parent);
 
 /**
- * gras_log_appender_set:
+ * xbt_log_appender_set:
  * @cat: the category (not only its name, but the variable)
  * @app: the appender
  *
  * Programatically sets the category's appender (don't use).
  */
-extern void gras_log_appender_set(gras_log_category_t cat,
-                                 gras_log_appender_t app);
+extern void xbt_log_appender_set(xbt_log_category_t cat,
+                                 xbt_log_appender_t app);
 
 /* Functions that you shouldn't call. */
-extern void _gras_log_event_log(gras_log_event_t ev,
+extern void _xbt_log_event_log(xbt_log_event_t ev,
                                const char *fmt,
-                               ...) _GRAS_GNUC_PRINTF(2,3);
+                               ...) _XBT_GNUC_PRINTF(2,3);
 
-extern int _gras_log_cat_init(e_gras_log_priority_t priority, 
-                             gras_log_category_t   category);
+extern int _xbt_log_cat_init(e_xbt_log_priority_t priority, 
+                             xbt_log_category_t   category);
 
 
-extern s_gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT);
-GRAS_LOG_EXTERNAL_CATEGORY(GRAS);
-extern gras_log_appender_t gras_log_default_appender;
+extern s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT);
+XBT_LOG_EXTERNAL_CATEGORY(GRAS);
+extern xbt_log_appender_t xbt_log_default_appender;
 
 /**
- * GRAS_LOG_ISENABLED:
+ * XBT_LOG_ISENABLED:
  * @catName: name of the category
  * @priority: minimal priority to be enabled to return true
  *
@@ -251,21 +251,21 @@ extern gras_log_appender_t gras_log_default_appender;
  * command and used only within it, you should make its evaluation conditional
  * using this macro.
  */
-#define GRAS_LOG_ISENABLED(catName, priority) \
-            _GRAS_LOG_ISENABLEDV(_GRAS_LOGV(catName), priority)
+#define XBT_LOG_ISENABLED(catName, priority) \
+            _XBT_LOG_ISENABLEDV(_XBT_LOGV(catName), priority)
 
 /*
- * Helper function that implements GRAS_LOG_ISENABLED.
+ * Helper function that implements XBT_LOG_ISENABLED.
  *
  * NOTES
  * First part is a compile-time constant.
  * Call to _log_initCat only happens once.
  */
-#define _GRAS_LOG_ISENABLEDV(catv, priority)                  \
-       (priority >= GRAS_LOG_STATIC_THRESHOLD                 \
+#define _XBT_LOG_ISENABLEDV(catv, priority)                  \
+       (priority >= XBT_LOG_STATIC_THRESHOLD                 \
         && priority >= catv.threshold                         \
-        && (catv.threshold != gras_log_priority_uninitialized \
-            || _gras_log_cat_init(priority, &catv)) )
+        && (catv.threshold != xbt_log_priority_uninitialized \
+            || _xbt_log_cat_init(priority, &catv)) )
 
 /*
  * Internal Macros
@@ -280,20 +280,20 @@ extern gras_log_appender_t gras_log_default_appender;
  * Setting the LogEvent's valist member is done inside _log_logEvent.
  */
 
-#define _GRAS_LOG_PRE(catv, priority) do {                              \
-     if (_GRAS_LOG_ISENABLEDV(catv, priority)) {                        \
-         s_gras_log_event_t _log_ev =                                   \
-             {&(catv),priority,__FILE__,_GRAS_GNUC_FUNCTION,__LINE__};         \
-         _gras_log_event_log(&_log_ev
+#define _XBT_LOG_PRE(catv, priority) do {                              \
+     if (_XBT_LOG_ISENABLEDV(catv, priority)) {                        \
+         s_xbt_log_event_t _log_ev =                                   \
+             {&(catv),priority,__FILE__,_XBT_GNUC_FUNCTION,__LINE__};         \
+         _xbt_log_event_log(&_log_ev
 
-#define _GRAS_LOG_POST                          \
+#define _XBT_LOG_POST                          \
                         );                      \
      } } while(0)
 
 
 /* Logging Macros */
 
-#ifdef GRAS_LOG_MAYDAY
+#ifdef XBT_LOG_MAYDAY
 # define CLOG0(c, p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
 # define CLOG1(c, p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
 # define CLOG2(c, p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
@@ -304,58 +304,58 @@ extern gras_log_appender_t gras_log_default_appender;
 # define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
 # define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
 #else
-# define CLOG0(c, p, f)                   _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f _GRAS_LOG_POST                
-# define CLOG1(c, p, f,a1)                _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1 _GRAS_LOG_POST             
-# define CLOG2(c, p, f,a1,a2)             _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2 _GRAS_LOG_POST
-# define CLOG3(c, p, f,a1,a2,a3)          _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2,a3 _GRAS_LOG_POST
-# define CLOG4(c, p, f,a1,a2,a3,a4)       _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2,a3,a4 _GRAS_LOG_POST
-# define CLOG5(c, p, f,a1,a2,a3,a4,a5)    _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2,a3,a4,a5 _GRAS_LOG_POST
-# define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6 _GRAS_LOG_POST
-# define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7 _GRAS_LOG_POST
-# define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) _GRAS_LOG_PRE(_GRAS_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _GRAS_LOG_POST
+# define CLOG0(c, p, f)                   _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f _XBT_LOG_POST                   
+# define CLOG1(c, p, f,a1)                _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1 _XBT_LOG_POST                
+# define CLOG2(c, p, f,a1,a2)             _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2 _XBT_LOG_POST
+# define CLOG3(c, p, f,a1,a2,a3)          _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3 _XBT_LOG_POST
+# define CLOG4(c, p, f,a1,a2,a3,a4)       _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
+# define CLOG5(c, p, f,a1,a2,a3,a4,a5)    _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST
+# define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST
+# define CLOG7(c, p, f,a1,a2,a3,a4,a5,a6,a7) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7 _XBT_LOG_POST
+# define CLOG8(c, p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE(_XBT_LOGV(c),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
 #endif
 
-#define CDEBUG0(c, f)                   CLOG0(c, gras_log_priority_debug, f)
-#define CDEBUG1(c, f,a1)                CLOG1(c, gras_log_priority_debug, f,a1)
-#define CDEBUG2(c, f,a1,a2)             CLOG2(c, gras_log_priority_debug, f,a1,a2)
-#define CDEBUG3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_debug, f,a1,a2,a3)
-#define CDEBUG4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_debug, f,a1,a2,a3,a4)
-#define CDEBUG5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5)
-#define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
-#define CDEBUG7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
-#define CDEBUG8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
-
-#define CVERB0(c, f)                   CLOG0(c, gras_log_priority_verbose, f)
-#define CVERB1(c, f,a1)                CLOG1(c, gras_log_priority_verbose, f,a1)
-#define CVERB2(c, f,a1,a2)             CLOG2(c, gras_log_priority_verbose, f,a1,a2)
-#define CVERB3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_verbose, f,a1,a2,a3)
-#define CVERB4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_verbose, f,a1,a2,a3,a4)
-#define CVERB5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5)
-#define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
-
-#define CINFO0(c, f)                   CLOG0(c, gras_log_priority_info, f)
-#define CINFO1(c, f,a1)                CLOG1(c, gras_log_priority_info, f,a1)
-#define CINFO2(c, f,a1,a2)             CLOG2(c, gras_log_priority_info, f,a1,a2)
-#define CINFO3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_info, f,a1,a2,a3)
-#define CINFO4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_info, f,a1,a2,a3,a4)
-#define CINFO5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_info, f,a1,a2,a3,a4,a5)
-#define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_info, f,a1,a2,a3,a4,a5,a6)
-
-#define CWARN0(c, f)                   CLOG0(c, gras_log_priority_warning, f)
-#define CWARN1(c, f,a1)                CLOG1(c, gras_log_priority_warning, f,a1)
-#define CWARN2(c, f,a1,a2)             CLOG2(c, gras_log_priority_warning, f,a1,a2)
-#define CWARN3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_warning, f,a1,a2,a3)
-#define CWARN4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_warning, f,a1,a2,a3,a4)
-#define CWARN5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5)
-#define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
-
-#define CERROR0(c, f)                   CLOG0(c, gras_log_priority_error, f)
-#define CERROR1(c, f,a1)                CLOG1(c, gras_log_priority_error, f,a1)
-#define CERROR2(c, f,a1,a2)             CLOG2(c, gras_log_priority_error, f,a1,a2)
-#define CERROR3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_error, f,a1,a2,a3)
-#define CERROR4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_error, f,a1,a2,a3,a4)
-#define CERROR5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_error, f,a1,a2,a3,a4,a5)
-#define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_error, f,a1,a2,a3,a4,a5,a6)
+#define CDEBUG0(c, f)                   CLOG0(c, xbt_log_priority_debug, f)
+#define CDEBUG1(c, f,a1)                CLOG1(c, xbt_log_priority_debug, f,a1)
+#define CDEBUG2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_debug, f,a1,a2)
+#define CDEBUG3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_debug, f,a1,a2,a3)
+#define CDEBUG4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_debug, f,a1,a2,a3,a4)
+#define CDEBUG5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
+#define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
+#define CDEBUG7(c, f,a1,a2,a3,a4,a5,a6,a7) CLOG7(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
+#define CDEBUG8(c, f,a1,a2,a3,a4,a5,a6,a7,a8) CLOG8(c, xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
+
+#define CVERB0(c, f)                   CLOG0(c, xbt_log_priority_verbose, f)
+#define CVERB1(c, f,a1)                CLOG1(c, xbt_log_priority_verbose, f,a1)
+#define CVERB2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_verbose, f,a1,a2)
+#define CVERB3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_verbose, f,a1,a2,a3)
+#define CVERB4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_verbose, f,a1,a2,a3,a4)
+#define CVERB5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
+#define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
+
+#define CINFO0(c, f)                   CLOG0(c, xbt_log_priority_info, f)
+#define CINFO1(c, f,a1)                CLOG1(c, xbt_log_priority_info, f,a1)
+#define CINFO2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_info, f,a1,a2)
+#define CINFO3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_info, f,a1,a2,a3)
+#define CINFO4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_info, f,a1,a2,a3,a4)
+#define CINFO5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5)
+#define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
+
+#define CWARN0(c, f)                   CLOG0(c, xbt_log_priority_warning, f)
+#define CWARN1(c, f,a1)                CLOG1(c, xbt_log_priority_warning, f,a1)
+#define CWARN2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_warning, f,a1,a2)
+#define CWARN3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_warning, f,a1,a2,a3)
+#define CWARN4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_warning, f,a1,a2,a3,a4)
+#define CWARN5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
+#define CWARN6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
+
+#define CERROR0(c, f)                   CLOG0(c, xbt_log_priority_error, f)
+#define CERROR1(c, f,a1)                CLOG1(c, xbt_log_priority_error, f,a1)
+#define CERROR2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_error, f,a1,a2)
+#define CERROR3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_error, f,a1,a2,a3)
+#define CERROR4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_error, f,a1,a2,a3,a4)
+#define CERROR5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5)
+#define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
 
 /**
  * CCRITICAL6:
@@ -375,15 +375,15 @@ extern gras_log_appender_t gras_log_default_appender;
  * along with the format string.
  */
 
-#define CCRITICAL0(c, f)                   CLOG0(c, gras_log_priority_critical, f)
-#define CCRITICAL1(c, f,a1)                CLOG1(c, gras_log_priority_critical, f,a1)
-#define CCRITICAL2(c, f,a1,a2)             CLOG2(c, gras_log_priority_critical, f,a1,a2)
-#define CCRITICAL3(c, f,a1,a2,a3)          CLOG3(c, gras_log_priority_critical, f,a1,a2,a3)
-#define CCRITICAL4(c, f,a1,a2,a3,a4)       CLOG4(c, gras_log_priority_critical, f,a1,a2,a3,a4)
-#define CCRITICAL5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5)
-#define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
+#define CCRITICAL0(c, f)                   CLOG0(c, xbt_log_priority_critical, f)
+#define CCRITICAL1(c, f,a1)                CLOG1(c, xbt_log_priority_critical, f,a1)
+#define CCRITICAL2(c, f,a1,a2)             CLOG2(c, xbt_log_priority_critical, f,a1,a2)
+#define CCRITICAL3(c, f,a1,a2,a3)          CLOG3(c, xbt_log_priority_critical, f,a1,a2,a3)
+#define CCRITICAL4(c, f,a1,a2,a3,a4)       CLOG4(c, xbt_log_priority_critical, f,a1,a2,a3,a4)
+#define CCRITICAL5(c, f,a1,a2,a3,a4,a5)    CLOG5(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
+#define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
 
-#ifdef GRAS_LOG_MAYDAY
+#ifdef XBT_LOG_MAYDAY
 # define LOG0(p, f)                   fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__)
 # define LOG1(p, f,a1)                fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1)               
 # define LOG2(p, f,a1,a2)             fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2)            
@@ -394,15 +394,15 @@ extern gras_log_appender_t gras_log_default_appender;
 # define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7)
 # define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6,a7,a8)
 #else
-# define LOG0(p, f)                   _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f _GRAS_LOG_POST
-# define LOG1(p, f,a1)                _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1 _GRAS_LOG_POST
-# define LOG2(p, f,a1,a2)             _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2 _GRAS_LOG_POST
-# define LOG3(p, f,a1,a2,a3)          _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2,a3 _GRAS_LOG_POST
-# define LOG4(p, f,a1,a2,a3,a4)       _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2,a3,a4 _GRAS_LOG_POST
-# define LOG5(p, f,a1,a2,a3,a4,a5)    _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2,a3,a4,a5 _GRAS_LOG_POST
-# define LOG6(p, f,a1,a2,a3,a4,a5,a6) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6 _GRAS_LOG_POST
-# define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7 _GRAS_LOG_POST
-# define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _GRAS_LOG_POST
+# define LOG0(p, f)                   _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f _XBT_LOG_POST
+# define LOG1(p, f,a1)                _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1 _XBT_LOG_POST
+# define LOG2(p, f,a1,a2)             _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2 _XBT_LOG_POST
+# define LOG3(p, f,a1,a2,a3)          _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3 _XBT_LOG_POST
+# define LOG4(p, f,a1,a2,a3,a4)       _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4 _XBT_LOG_POST
+# define LOG5(p, f,a1,a2,a3,a4,a5)    _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5 _XBT_LOG_POST
+# define LOG6(p, f,a1,a2,a3,a4,a5,a6) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6 _XBT_LOG_POST
+# define LOG7(p, f,a1,a2,a3,a4,a5,a6,a7) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7 _XBT_LOG_POST
+# define LOG8(p, f,a1,a2,a3,a4,a5,a6,a7,a8) _XBT_LOG_PRE((*_XBT_LOGV(default)),p) ,f,a1,a2,a3,a4,a5,a6,a7,a8 _XBT_LOG_POST
 #endif
 
 /**
@@ -422,15 +422,15 @@ extern gras_log_appender_t gras_log_default_appender;
  * along with the format string.
  */
 
-#define DEBUG0(f)                   LOG0(gras_log_priority_debug, f)
-#define DEBUG1(f,a1)                LOG1(gras_log_priority_debug, f,a1)
-#define DEBUG2(f,a1,a2)             LOG2(gras_log_priority_debug, f,a1,a2)
-#define DEBUG3(f,a1,a2,a3)          LOG3(gras_log_priority_debug, f,a1,a2,a3)
-#define DEBUG4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_debug, f,a1,a2,a3,a4)
-#define DEBUG5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_debug, f,a1,a2,a3,a4,a5)
-#define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
-#define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
-#define DEBUG8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
+#define DEBUG0(f)                   LOG0(xbt_log_priority_debug, f)
+#define DEBUG1(f,a1)                LOG1(xbt_log_priority_debug, f,a1)
+#define DEBUG2(f,a1,a2)             LOG2(xbt_log_priority_debug, f,a1,a2)
+#define DEBUG3(f,a1,a2,a3)          LOG3(xbt_log_priority_debug, f,a1,a2,a3)
+#define DEBUG4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_debug, f,a1,a2,a3,a4)
+#define DEBUG5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_debug, f,a1,a2,a3,a4,a5)
+#define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6)
+#define DEBUG7(f,a1,a2,a3,a4,a5,a6,a7) LOG7(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7)
+#define DEBUG8(f,a1,a2,a3,a4,a5,a6,a7,a8) LOG8(xbt_log_priority_debug, f,a1,a2,a3,a4,a5,a6,a7,a8)
 
 /**
  * VERB6:
@@ -449,13 +449,13 @@ extern gras_log_appender_t gras_log_default_appender;
  * along with the format string.
  */
 
-#define VERB0(f)                   LOG0(gras_log_priority_verbose, f)
-#define VERB1(f,a1)                LOG1(gras_log_priority_verbose, f,a1)
-#define VERB2(f,a1,a2)             LOG2(gras_log_priority_verbose, f,a1,a2)
-#define VERB3(f,a1,a2,a3)          LOG3(gras_log_priority_verbose, f,a1,a2,a3)
-#define VERB4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_verbose, f,a1,a2,a3,a4)
-#define VERB5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_verbose, f,a1,a2,a3,a4,a5)
-#define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
+#define VERB0(f)                   LOG0(xbt_log_priority_verbose, f)
+#define VERB1(f,a1)                LOG1(xbt_log_priority_verbose, f,a1)
+#define VERB2(f,a1,a2)             LOG2(xbt_log_priority_verbose, f,a1,a2)
+#define VERB3(f,a1,a2,a3)          LOG3(xbt_log_priority_verbose, f,a1,a2,a3)
+#define VERB4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_verbose, f,a1,a2,a3,a4)
+#define VERB5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5)
+#define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_verbose, f,a1,a2,a3,a4,a5,a6)
 
 /**
  * INFO6:
@@ -474,13 +474,13 @@ extern gras_log_appender_t gras_log_default_appender;
  * along with the format string.
  */
 
-#define INFO0(f)                   LOG0(gras_log_priority_info, f)
-#define INFO1(f,a1)                LOG1(gras_log_priority_info, f,a1)
-#define INFO2(f,a1,a2)             LOG2(gras_log_priority_info, f,a1,a2)
-#define INFO3(f,a1,a2,a3)          LOG3(gras_log_priority_info, f,a1,a2,a3)
-#define INFO4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_info, f,a1,a2,a3,a4)
-#define INFO5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_info, f,a1,a2,a3,a4,a5)
-#define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_info, f,a1,a2,a3,a4,a5,a6)
+#define INFO0(f)                   LOG0(xbt_log_priority_info, f)
+#define INFO1(f,a1)                LOG1(xbt_log_priority_info, f,a1)
+#define INFO2(f,a1,a2)             LOG2(xbt_log_priority_info, f,a1,a2)
+#define INFO3(f,a1,a2,a3)          LOG3(xbt_log_priority_info, f,a1,a2,a3)
+#define INFO4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_info, f,a1,a2,a3,a4)
+#define INFO5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_info, f,a1,a2,a3,a4,a5)
+#define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_info, f,a1,a2,a3,a4,a5,a6)
 
 /**
  * WARN6:
@@ -499,13 +499,13 @@ extern gras_log_appender_t gras_log_default_appender;
  * along with the format string.
  */
 
-#define WARN0(f)                   LOG0(gras_log_priority_warning, f)
-#define WARN1(f,a1)                LOG1(gras_log_priority_warning, f,a1)
-#define WARN2(f,a1,a2)             LOG2(gras_log_priority_warning, f,a1,a2)
-#define WARN3(f,a1,a2,a3)          LOG3(gras_log_priority_warning, f,a1,a2,a3)
-#define WARN4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_warning, f,a1,a2,a3,a4)
-#define WARN5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_warning, f,a1,a2,a3,a4,a5)
-#define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
+#define WARN0(f)                   LOG0(xbt_log_priority_warning, f)
+#define WARN1(f,a1)                LOG1(xbt_log_priority_warning, f,a1)
+#define WARN2(f,a1,a2)             LOG2(xbt_log_priority_warning, f,a1,a2)
+#define WARN3(f,a1,a2,a3)          LOG3(xbt_log_priority_warning, f,a1,a2,a3)
+#define WARN4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_warning, f,a1,a2,a3,a4)
+#define WARN5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_warning, f,a1,a2,a3,a4,a5)
+#define WARN6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_warning, f,a1,a2,a3,a4,a5,a6)
 
 /**
  * ERROR6:
@@ -524,13 +524,13 @@ extern gras_log_appender_t gras_log_default_appender;
  * along with the format string.
  */
 
-#define ERROR0(f)                   LOG0(gras_log_priority_error, f)
-#define ERROR1(f,a1)                LOG1(gras_log_priority_error, f,a1)
-#define ERROR2(f,a1,a2)             LOG2(gras_log_priority_error, f,a1,a2)
-#define ERROR3(f,a1,a2,a3)          LOG3(gras_log_priority_error, f,a1,a2,a3)
-#define ERROR4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_error, f,a1,a2,a3,a4)
-#define ERROR5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_error, f,a1,a2,a3,a4,a5)
-#define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_error, f,a1,a2,a3,a4,a5,a6)
+#define ERROR0(f)                   LOG0(xbt_log_priority_error, f)
+#define ERROR1(f,a1)                LOG1(xbt_log_priority_error, f,a1)
+#define ERROR2(f,a1,a2)             LOG2(xbt_log_priority_error, f,a1,a2)
+#define ERROR3(f,a1,a2,a3)          LOG3(xbt_log_priority_error, f,a1,a2,a3)
+#define ERROR4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_error, f,a1,a2,a3,a4)
+#define ERROR5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_error, f,a1,a2,a3,a4,a5)
+#define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_error, f,a1,a2,a3,a4,a5,a6)
 
 /**
  * CRITICAL6:
@@ -548,19 +548,19 @@ extern gras_log_appender_t gras_log_default_appender;
  * for sake of clarity. They just differ in the number of arguments passed
  * along with the format string.
  */
-#define CRITICAL0(f)                   LOG0(gras_log_priority_critical, f)
-#define CRITICAL1(f,a1)                LOG1(gras_log_priority_critical, f,a1)
-#define CRITICAL2(f,a1,a2)             LOG2(gras_log_priority_critical, f,a1,a2)
-#define CRITICAL3(f,a1,a2,a3)          LOG3(gras_log_priority_critical, f,a1,a2,a3)
-#define CRITICAL4(f,a1,a2,a3,a4)       LOG4(gras_log_priority_critical, f,a1,a2,a3,a4)
-#define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5)
-#define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
-
-#define GRAS_IN               LOG1(gras_log_priority_trace, ">> begin of %s",     _GRAS_GNUC_FUNCTION)
-#define GRAS_IN1(fmt,a)       LOG2(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a)
-#define GRAS_IN2(fmt,a,b)     LOG3(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b)
-#define GRAS_IN3(fmt,a,b,c)   LOG4(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b,c)
-#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b,c,d)
-#define GRAS_OUT              LOG1(gras_log_priority_trace, "<< end of %s",       _GRAS_GNUC_FUNCTION)
-
-#endif /* ! _GRAS_LOG_H_ */
+#define CRITICAL0(f)                   LOG0(xbt_log_priority_critical, f)
+#define CRITICAL1(f,a1)                LOG1(xbt_log_priority_critical, f,a1)
+#define CRITICAL2(f,a1,a2)             LOG2(xbt_log_priority_critical, f,a1,a2)
+#define CRITICAL3(f,a1,a2,a3)          LOG3(xbt_log_priority_critical, f,a1,a2,a3)
+#define CRITICAL4(f,a1,a2,a3,a4)       LOG4(xbt_log_priority_critical, f,a1,a2,a3,a4)
+#define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(xbt_log_priority_critical, f,a1,a2,a3,a4,a5)
+#define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(xbt_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
+
+#define XBT_IN               LOG1(xbt_log_priority_trace, ">> begin of %s",     _XBT_GNUC_FUNCTION)
+#define XBT_IN1(fmt,a)       LOG2(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a)
+#define XBT_IN2(fmt,a,b)     LOG3(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b)
+#define XBT_IN3(fmt,a,b,c)   LOG4(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b,c)
+#define XBT_IN4(fmt,a,b,c,d) LOG5(xbt_log_priority_trace, ">> begin of %s" fmt, _XBT_GNUC_FUNCTION, a,b,c,d)
+#define XBT_OUT              LOG1(xbt_log_priority_trace, "<< end of %s",       _XBT_GNUC_FUNCTION)
+
+#endif /* ! _XBT_LOG_H_ */
index 7cb25f5..be295b5 100644 (file)
@@ -17,7 +17,7 @@
 #define TRUE  1
 #define FALSE 0
 
-#define GRAS_MAX_CHANNEL 10 /* FIXME: killme */
+#define XBT_MAX_CHANNEL 10 /* FIXME: killme */
 /*! C++ users need love */
 #ifndef BEGIN_DECL
 # ifdef __cplusplus
@@ -42,7 +42,7 @@ BEGIN_DECL
 typedef struct {  
    char *name;
    int port;
-} gras_host_t;
+} xbt_host_t;
 
 END_DECL
 
index 0dfb6fa..d2ce7aa 100644 (file)
@@ -8,15 +8,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. */
 
-#ifndef _GRAS_MODULE_H
-#define _GRAS_MODULE_H
+#ifndef _XBT_MODULE_H
+#define _XBT_MODULE_H
 
-typedef struct gras_module_ gras_module_t;
+typedef struct xbt_module_ xbt_module_t;
 
-typedef gras_module_t (*gras_module_new_fct_t)(int argc, char **argv);
-typedef int (*gras_module_finalize_fct_t)(void);
+typedef xbt_module_t (*xbt_module_new_fct_t)(int argc, char **argv);
+typedef int (*xbt_module_finalize_fct_t)(void);
 
-void gras_init(int *argc,char **argv);
-void gras_init_defaultlog(int *argc,char **argv, const char *defaultlog);
-void gras_exit(void);
-#endif /* _GRAS_MODULE_H */
+void xbt_init(int *argc,char **argv);
+void xbt_init_defaultlog(int *argc,char **argv, const char *defaultlog);
+void xbt_exit(void);
+#endif /* _XBT_MODULE_H */
index dc4a66a..b3a6dd7 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-/* gras/set.h -- api to a generic dictionary                                */
+/* xbt/set.h -- api to a generic dictionary                                 */
 
 /* Authors: Martin Quinson                                                  */
 /* Copyright (C) 2004 the OURAGAN project.                                  */
@@ -9,62 +9,62 @@
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 
-#ifndef _GRAS_SET_H
-#define _GRAS_SET_H
+#ifndef _XBT_SET_H
+#define _XBT_SET_H
 
 #include "xbt/misc.h" /* BEGIN_DECL */
 
 BEGIN_DECL
 
 /*####[ Type definition ]####################################################*/
-typedef struct gras_set_ *gras_set_t;
-typedef struct gras_set_elm_ {
+typedef struct xbt_set_ *xbt_set_t;
+typedef struct xbt_set_elm_ {
   unsigned int ID;
   char        *name;
   unsigned int name_len;
-} s_gras_set_elm_t,*gras_set_elm_t;
+} s_xbt_set_elm_t,*xbt_set_elm_t;
 
 /*####[ Functions ]##########################################################*/
 
-gras_set_t gras_set_new (void);
-void gras_set_free(gras_set_t *set);
+xbt_set_t xbt_set_new (void);
+void xbt_set_free(xbt_set_t *set);
 
 
-void gras_set_add (gras_set_t      set,
-                  gras_set_elm_t  elm,
+void xbt_set_add (xbt_set_t      set,
+                  xbt_set_elm_t  elm,
                   void_f_pvoid_t *free_func);
 
-/*----[ gras_set_retrieve ]-------------------------------------------------*/
+/*----[ xbt_set_retrieve ]-------------------------------------------------*/
 /* Search the given #key#. data=NULL when not found.                         */
 /*---------------------------------------------------------------------------*/
-gras_error_t gras_set_get_by_name    (gras_set_t      set,
+xbt_error_t xbt_set_get_by_name    (xbt_set_t      set,
                                      const char     *key,
-                                     /* OUT */gras_set_elm_t *dst);
-gras_error_t gras_set_get_by_name_ext(gras_set_t      set,
+                                     /* OUT */xbt_set_elm_t *dst);
+xbt_error_t xbt_set_get_by_name_ext(xbt_set_t      set,
                                      const char     *name,
                                      int             name_len,
-                                     /* OUT */gras_set_elm_t *dst);
-gras_error_t gras_set_get_by_id      (gras_set_t      set,
+                                     /* OUT */xbt_set_elm_t *dst);
+xbt_error_t xbt_set_get_by_id      (xbt_set_t      set,
                                      int             id,
-                                     /* OUT */gras_set_elm_t *dst);
+                                     /* OUT */xbt_set_elm_t *dst);
                                      
 /*####[ Cache cursor functions ]#############################################*/
 /* To traverse (simple) caches                                               */
 /* Don't add or remove entries to the cache while traversing !!!             */
 /*###########################################################################*/
-typedef struct gras_set_cursor_ *gras_set_cursor_t;
+typedef struct xbt_set_cursor_ *xbt_set_cursor_t;
 
-void         gras_set_cursor_first       (gras_set_t         set,
-                                         gras_set_cursor_t *cursor);
-void         gras_set_cursor_step        (gras_set_cursor_t  cursor);
-int          gras_set_cursor_get_or_free (gras_set_cursor_t *cursor,
-                                         gras_set_elm_t    *elm);
+void         xbt_set_cursor_first       (xbt_set_t         set,
+                                         xbt_set_cursor_t *cursor);
+void         xbt_set_cursor_step        (xbt_set_cursor_t  cursor);
+int          xbt_set_cursor_get_or_free (xbt_set_cursor_t *cursor,
+                                         xbt_set_elm_t    *elm);
 
-#define gras_set_foreach(set,cursor,elm)                       \
-  for ((cursor) = NULL, gras_set_cursor_first((set),&(cursor)) ;   \
-       gras_set_cursor_get_or_free(&(cursor),(gras_set_elm_t*)&(elm));          \
-       gras_set_cursor_step(cursor) )
+#define xbt_set_foreach(set,cursor,elm)                       \
+  for ((cursor) = NULL, xbt_set_cursor_first((set),&(cursor)) ;   \
+       xbt_set_cursor_get_or_free(&(cursor),(xbt_set_elm_t*)&(elm));          \
+       xbt_set_cursor_step(cursor) )
 
 END_DECL
 
-#endif /* _GRAS_SET_H */
+#endif /* _XBT_SET_H */
index 59df441..f98dbd3 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-/* gras/sysdep.h -- all system dependency                                   */
+/*  xbt/sysdep.h -- all system dependency                                   */
 /*  no system header should be loaded out of this file so that we have only */
 /*  one file to check when porting to another OS                            */
 
@@ -11,8 +11,8 @@
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 
-#ifndef _GRAS_SYSDEP_H
-#define _GRAS_SYSDEP_H
+#ifndef _XBT_SYSDEP_H
+#define _XBT_SYSDEP_H
 
 #include <string.h> /* Included directly for speed */
 
@@ -30,36 +30,36 @@ BEGIN_DECL
   #define REALLOC(p, s) (__REALLOC_OP ((p), (s)))
 #endif
   
-#define gras_strdup(s)  ((s)?(strdup(s)?:(gras_die("memory allocation error"),NULL))\
+#define xbt_strdup(s)  ((s)?(strdup(s)?:(xbt_die("memory allocation error"),NULL))\
                            :(NULL))
-#define gras_malloc(n)   (malloc(n) ?: (gras_die("memory allocation error"),NULL))
-#define gras_malloc0(n)  (calloc( (n),1 ) ?: (gras_die("memory allocation error"),NULL))
-#define gras_realloc(p,s) (s? (p? (realloc(p,s)?:gras_die("memory allocation error"),NULL) \
-                               : gras_malloc(s)) \
+#define xbt_malloc(n)   (malloc(n) ?: (xbt_die("memory allocation error"),NULL))
+#define xbt_malloc0(n)  (calloc( (n),1 ) ?: (xbt_die("memory allocation error"),NULL))
+#define xbt_realloc(p,s) (s? (p? (realloc(p,s)?:xbt_die("memory allocation error"),NULL) \
+                               : xbt_malloc(s)) \
                            : (p? (free(p),NULL) \
                                : NULL))
-#define gras_free free /*nothing specific to do here. A poor valgrind replacement?*/
-#define gras_free_fct free /* replacement with the guareenty of being a function */
+#define xbt_free free /*nothing specific to do here. A poor valgrind replacement?*/
+#define xbt_free_fct free /* replacement with the guareenty of being a function */
    
-#define gras_new(type, count)  ((type*)gras_malloc (sizeof (type) * (count)))
-#define gras_new0(type, count) ((type*)gras_malloc0 (sizeof (type) * (count)))
+#define xbt_new(type, count)  ((type*)xbt_malloc (sizeof (type) * (count)))
+#define xbt_new0(type, count) ((type*)xbt_malloc0 (sizeof (type) * (count)))
 
 /* Attributes are only in recent versions of GCC */
 
 #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-# define _GRAS_GNUC_PRINTF( format_idx, arg_idx )    \
+# define _XBT_GNUC_PRINTF( format_idx, arg_idx )    \
           __attribute__((__format__ (__printf__, format_idx, arg_idx)))
-# define _GRAS_GNUC_SCANF( format_idx, arg_idx )     \
+# define _XBT_GNUC_SCANF( format_idx, arg_idx )     \
               __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
-# define _GRAS_GNUC_FORMAT( arg_idx )                \
+# define _XBT_GNUC_FORMAT( arg_idx )                \
                   __attribute__((__format_arg__ (arg_idx)))
-# define _GRAS_GNUC_NORETURN __attribute__((__noreturn__))
+# define _XBT_GNUC_NORETURN __attribute__((__noreturn__))
 
 #else   /* !__GNUC__ */
-# define _GRAS_GNUC_PRINTF( format_idx, arg_idx )
-# define _GRAS_GNUC_SCANF( format_idx, arg_idx )
-# define _GRAS_GNUC_FORMAT( arg_idx )
-# define _GRAS_GNUC_NORETURN
+# define _XBT_GNUC_PRINTF( format_idx, arg_idx )
+# define _XBT_GNUC_SCANF( format_idx, arg_idx )
+# define _XBT_GNUC_FORMAT( arg_idx )
+# define _XBT_GNUC_NORETURN
 
 #endif  /* !__GNUC__ */
 
@@ -67,15 +67,15 @@ BEGIN_DECL
 
 #if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
 
-# define _GRAS_GNUC_FUNCTION __FUNCTION__
-# define _GRAS_INLINE inline
+# define _XBT_GNUC_FUNCTION __FUNCTION__
+# define _XBT_INLINE inline
 #else
-# define _GRAS_GNUC_FUNCTION "function"
-# define _GRAS_INLINE 
+# define _XBT_GNUC_FUNCTION "function"
+# define _XBT_INLINE 
 #endif
 
 
-void gras_abort(void) _GRAS_GNUC_NORETURN;
+void xbt_abort(void) _XBT_GNUC_NORETURN;
 
 /* FIXME: This is a very good candidate to rewrite (along with a proper string stuff) 
    but I'm too lazy right now, so copy the definition */
@@ -85,4 +85,4 @@ int atoi(const char *nptr);
 
 END_DECL   
 
-#endif /* _GRAS_SYSDEP_H */
+#endif /* _XBT_SYSDEP_H */
index ab3202d..9415022 100644 (file)
 #include "amok/Bandwidth/bandwidth_private.h"
 #include "gras/messages.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(bw,amok,"Bandwidth testing");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(bw,amok,"Bandwidth testing");
 
 static short _amok_bw_initialized = 0;
 
 /**** code ****/
 void amok_bw_init(void) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t bw_request_desc, bw_res_desc, sat_request_desc;
 
   if (_amok_bw_initialized)
@@ -27,7 +27,7 @@ void amok_bw_init(void) {
    
   /* Build the datatype descriptions */ 
   bw_request_desc = gras_datadesc_struct("s_bw_request_t");
-  gras_datadesc_struct_append(bw_request_desc,"host",gras_datadesc_by_name("gras_host_t"));
+  gras_datadesc_struct_append(bw_request_desc,"host",gras_datadesc_by_name("xbt_host_t"));
   gras_datadesc_struct_append(bw_request_desc,"buf_size",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_append(bw_request_desc,"exp_size",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_append(bw_request_desc,"msg_size",gras_datadesc_by_name("unsigned int"));
@@ -43,7 +43,7 @@ void amok_bw_init(void) {
   bw_res_desc = gras_datadesc_ref("bw_res_t",bw_res_desc);
 
   sat_request_desc = gras_datadesc_struct("s_sat_request_desc_t");
-  gras_datadesc_struct_append(sat_request_desc,"host",gras_datadesc_by_name("gras_host_t"));
+  gras_datadesc_struct_append(sat_request_desc,"host",gras_datadesc_by_name("xbt_host_t"));
   gras_datadesc_struct_append(sat_request_desc,"msg_size",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_append(sat_request_desc,"timeout",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_close(sat_request_desc);
@@ -108,13 +108,13 @@ void amok_bw_exit(void) {
  * Conduct a test between the local host and @peer, and 
  * report the result in last args
  */
-gras_error_t amok_bw_test(gras_socket_t peer,
+xbt_error_t amok_bw_test(gras_socket_t peer,
                          unsigned int buf_size,unsigned int exp_size,unsigned int msg_size,
                          /*OUT*/ double *sec, double *bw) {
   gras_socket_t rawIn,rawOut; /* raw sockets for the experiments */
   gras_socket_t sock_dummy; /* ignored arg to msg_wait */
   int port;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   bw_request_t request,request_ack;
   
   for (port = 5000, errcode = system_error;
@@ -122,11 +122,11 @@ gras_error_t amok_bw_test(gras_socket_t peer,
        errcode = gras_socket_server_ext(++port,buf_size,1,&rawIn));
   if (errcode != no_error) {
     ERROR1("Error %s encountered while opening a raw socket",
-          gras_error_name(errcode));
+          xbt_error_name(errcode));
     return errcode;
   }
        
-  request=gras_new0(s_bw_request_t,1);
+  request=xbt_new0(s_bw_request_t,1);
   request->buf_size=buf_size;
   request->exp_size=exp_size;
   request->msg_size=msg_size;
@@ -135,12 +135,12 @@ gras_error_t amok_bw_test(gras_socket_t peer,
   INFO1("Send an handshake to get the dude connect to port %d on me", request->host.port);
 
   if ((errcode=gras_msg_send(peer,gras_msgtype_by_name("BW handshake"),&request))) {
-    ERROR1("Error %s encountered while sending the BW request.", gras_error_name(errcode));
+    ERROR1("Error %s encountered while sending the BW request.", xbt_error_name(errcode));
     return errcode;
   }
   if ((errcode=gras_msg_wait(60,gras_msgtype_by_name("BW handshake ACK"),&sock_dummy,&request_ack))) {
     ERROR1("Error %s encountered while waiting for the answer to BW request.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return errcode;
   }
    
@@ -148,17 +148,17 @@ gras_error_t amok_bw_test(gras_socket_t peer,
    
   if((errcode=gras_socket_client_ext(gras_socket_peer_name(peer),request_ack->host.port, buf_size,1,&rawOut))) {
     ERROR3("Error %s encountered while opening the raw socket to %s:%d for BW test\n",
-           gras_error_name(errcode),gras_socket_peer_name(peer),request_ack->host.port);
+           xbt_error_name(errcode),gras_socket_peer_name(peer),request_ack->host.port);
     return errcode;
   }
-  gras_free(request_ack);
+  xbt_free(request_ack);
   INFO0("Got ACK");
 
   *sec=gras_os_time();
   if ((errcode=gras_socket_raw_send(rawOut,120,exp_size,msg_size)) ||
       (errcode=gras_socket_raw_recv(rawIn,120,1,1))) {
     ERROR1("Error %s encountered while sending the BW experiment.",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_socket_close(rawOut);
     gras_socket_close(rawIn);
     return errcode;
@@ -184,19 +184,19 @@ int amok_bw_cb_bw_handshake(gras_socket_t  expeditor,
   gras_socket_t rawIn,rawOut;
   bw_request_t request=*(bw_request_t*)payload;
   bw_request_t answer;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   int port;
   
   INFO2("Got an handshake to connect to %s:%d",
        request->host.name,request->host.port);
      
-  answer = gras_new0(s_bw_request_t,1);
+  answer = xbt_new0(s_bw_request_t,1);
   
   for (port = 5000, errcode = system_error;
        errcode == system_error;
        errcode = gras_socket_server_ext(++port,request->buf_size,1,&rawIn));
   if (errcode != no_error) {
-    ERROR1("Error %s encountered while opening a raw socket", gras_error_name(errcode));
+    ERROR1("Error %s encountered while opening a raw socket", xbt_error_name(errcode));
     /* FIXME: tell error to remote */
     return 1;
   }
@@ -204,7 +204,7 @@ int amok_bw_cb_bw_handshake(gras_socket_t  expeditor,
   if ((errcode=gras_socket_client_ext(gras_socket_peer_name(expeditor),request->host.port,
                                      request->buf_size,1,&rawOut))) { 
     ERROR3("Error '%s' encountered while opening a raw socket to %s:%d", 
-          gras_error_name(errcode),gras_socket_peer_name(expeditor),request->host.port);
+          xbt_error_name(errcode),gras_socket_peer_name(expeditor),request->host.port);
     /* FIXME: tell error to remote */
     return 1;
   }
@@ -216,7 +216,7 @@ int amok_bw_cb_bw_handshake(gras_socket_t  expeditor,
 
   if ((errcode=gras_msg_send(expeditor,gras_msgtype_by_name("BW handshake ACK"),&answer))) {
     ERROR1("Error %s encountered while sending the answer.",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_socket_close(rawIn);
     gras_socket_close(rawOut);
     /* FIXME: tell error to remote */
@@ -228,7 +228,7 @@ int amok_bw_cb_bw_handshake(gras_socket_t  expeditor,
   if ((errcode=gras_socket_raw_recv(rawIn, 120,request->exp_size,request->msg_size)) ||
       (errcode=gras_socket_raw_send(rawOut,120,1,1))) {
     ERROR1("Error %s encountered while receiving the experiment.",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_socket_close(rawIn);
     gras_socket_close(rawOut);
     /* FIXME: tell error to remote ? */
@@ -249,21 +249,21 @@ int amok_bw_cb_sat_begin(gras_socket_t     expeditor,
 
 #if 0
 /* function to request a BW test between two external hosts */
-gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_request(const char* from_name,unsigned int from_port,
                           const char* to_name,unsigned int to_port,
                           unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
                           /*OUT*/ double *sec, double*bw) {
   
   gras_sock_t *sock;
   gras_msg_t *answer;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   /* The request */
   BwExp_t *request;
   msgHost_t *target;
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"grasbw_request(): Error %s encountered while contacting the actuator\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return errcode;
   }
   if (!(request=(BwExp_t *)malloc(sizeof(BwExp_t))) ||
@@ -283,20 +283,20 @@ gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
                              target,1,
                              request,1))) {
     fprintf(stderr,"grasbw_request(): Error %s encountered while sending the request.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if ((errcode=gras_msg_wait(240,GRASMSG_BW_RESULT,&answer))) {
     fprintf(stderr,"grasbw_request(): Error %s encountered while waiting for the answer.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"grasbw_request(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
@@ -333,7 +333,7 @@ int grasbw_cbBWRequest(gras_msg_t *msg) {
                                  &(res[0].value),&(res[1].value) ))) {
     fprintf(stderr,
            "%s:%d:grasbw_cbRequest: Error %s encountered while doing the test\n",
-           __FILE__,__LINE__,gras_error_name(error->errcode));
+           __FILE__,__LINE__,xbt_error_name(error->errcode));
     strncpy(error->errmsg,"Error within grasbw_test",ERRMSG_LEN);
     gras_msg_new_and_send(msg->sock,GRASMSG_BW_RESULT,2,
                   error,1,
@@ -353,11 +353,11 @@ int grasbw_cbBWRequest(gras_msg_t *msg) {
  * Link saturation
  * ***************************************************************************/
 
-gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                                  const char* to_name,unsigned int to_port,
                                  unsigned int msgSize, unsigned int timeout) {
   gras_sock_t *sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   /* The request */
   SatExp_t *request;
   msgHost_t *target;
@@ -366,7 +366,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while contacting peer\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     return errcode;
   }
   if (!(request=(SatExp_t *)malloc(sizeof(SatExp_t))) ||
@@ -386,20 +386,20 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                              target,1,
                              request,1))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while sending the request.\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STARTED,&answer))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while waiting for the ACK.\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"%s:%d:saturate_start(): Peer reported error %s (%s).\n",
-           __FILE__,__LINE__,gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           __FILE__,__LINE__,xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
@@ -413,7 +413,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
 int grasbw_cbSatStart(gras_msg_t *msg) {
   gras_rawsock_t *raw;
   gras_sock_t *sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start; /* time to timeout */
 
   /* specification of the test to run */
@@ -439,7 +439,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   /* Negociate the saturation with the peer */
   if((errcode=gras_sock_client_open(to_name,to_port,&sock))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot contact peer.\n");
@@ -460,7 +460,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_BEGIN, 1, 
                              request,1))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while sending the request.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot send request.\n");
@@ -470,7 +470,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_BEGUN,&answer))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while waiting for the ACK.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
@@ -482,7 +482,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"cbSatStart(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
@@ -497,7 +497,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if ((errcode=gras_rawsock_client_open(to_name,raw_port,msgSize,&raw))) {
     fprintf(stderr,"cbSatStart(): Error %s while opening raw socket to %s:%d.\n",
-           gras_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port);
+           xbt_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
@@ -508,7 +508,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   /* send a train of data before repporting that XP is started */
   if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) {
-    fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode));
+    fprintf(stderr,"cbSatStart: Failure %s during raw send\n",xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot raw send.\n");
@@ -528,7 +528,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   while (gras_msg_wait(0,GRASMSG_SAT_STOP,&msg)==timeout_error && 
         gras_time()-start < timeout) {
     if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) {
-      fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode));
+      fprintf(stderr,"cbSatStart: Failure %s during raw send\n",xbt_error_name(errcode));
       /* our error message do not interess anyone. SAT_STOP will do nothing. */
       gras_sock_close(sock);
       gras_rawsock_close(raw);
@@ -579,7 +579,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
 int grasbw_cbSatBegin(gras_msg_t *msg) {
   gras_rawsock_t *raw;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start; /* timer */
   /* request */
   unsigned int msgSize=gras_msg_ctn(msg,0,0,SatExp_t).msgSize;
@@ -599,7 +599,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
 
   if ((errcode=gras_rawsock_server_open(6666,8000,msgSize,&raw))) { 
     fprintf(stderr,"cbSatBegin(): Error %s encountered while opening a raw socket\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_BEGUN,2,
                     "cbSatBegin: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot open raw socket");
@@ -613,7 +613,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
                              error,1,
                              request,1))) {
     fprintf(stderr,"cbSatBegin(): Error %s encountered while send ACK to peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
   gras_msg_free(msg);
@@ -623,7 +623,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
         gras_time() - start < timeout) {
     errcode=gras_rawsock_recv(raw,msgSize,msgSize,1);
     if (errcode != timeout_error && errcode != no_error) {
-      fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",gras_error_name(errcode));
+      fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",xbt_error_name(errcode));
       /* our error message do not interess anyone. SAT_END will do nothing. */
       /* (if timeout'ed, it may be because the sender stopped emission. so survive it) */
       return 1;
@@ -643,35 +643,35 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
   return 1;
 }
 
-gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
                                 const char* to_name,unsigned int to_port) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_sock_t *sock;
   gras_msg_t *answer;
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return errcode;
   }
 
   if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_STOP,0))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while sending request\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STOPPED,&answer))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while receiving ACK\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"saturate_stop(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
index 79dbf6e..c05cf0a 100644 (file)
@@ -24,7 +24,7 @@
  * If not, it should be between between the receiver and @host (3-tiers).
  */
 typedef struct {
-  gras_host_t host; /* host+raw socket to use */
+  xbt_host_t host; /* host+raw socket to use */
   unsigned int buf_size;
   unsigned int exp_size;
   unsigned int msg_size;
@@ -51,7 +51,7 @@ typedef struct {
  * Description of a saturation experiment (payload asking some host to collaborate for that)
  */
 typedef struct {
-  gras_host_t host; /* host+raw socket to use */
+  xbt_host_t host; /* host+raw socket to use */
   unsigned int msg_size;
   unsigned int timeout;
 } s_sat_request_t,*sat_request_t;
index f58c8c9..40b7894 100644 (file)
 
 #include "amok/Bandwidth/bandwidth_private.h"
 
-GRAS_LOG_EXTERNAL_CATEGORY(bw);
-GRAS_LOG_DEFAULT_CATEGORY(bw);
+XBT_LOG_EXTERNAL_CATEGORY(bw);
+XBT_LOG_DEFAULT_CATEGORY(bw);
 
 #if 0
 /* ***************************************************************************
  * Link saturation
  * ***************************************************************************/
 
-gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                                   const char* to_name,unsigned int to_port,
                                   unsigned int msgSize, unsigned int timeout) {
   gras_sock_t *sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   /* The request */
   SatExp_t *request;
   msgHost_t *target;
@@ -31,7 +31,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while contacting peer\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     return errcode;
   }
   if (!(request=(SatExp_t *)malloc(sizeof(SatExp_t))) ||
@@ -51,20 +51,20 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                              target,1,
                              request,1))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while sending the request.\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STARTED,&answer))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while waiting for the ACK.\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"%s:%d:saturate_start(): Peer reported error %s (%s).\n",
-           __FILE__,__LINE__,gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           __FILE__,__LINE__,xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
@@ -78,7 +78,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
 int grasbw_cbSatStart(gras_msg_t *msg) {
   gras_rawsock_t *raw;
   gras_sock_t *sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start; /* time to timeout */
 
   /* specification of the test to run */
@@ -104,7 +104,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   /* Negociate the saturation with the peer */
   if((errcode=gras_sock_client_open(to_name,to_port,&sock))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot contact peer.\n");
@@ -125,7 +125,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_BEGIN, 1, 
                              request,1))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while sending the request.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot send request.\n");
@@ -135,7 +135,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_BEGUN,&answer))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while waiting for the ACK.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
@@ -147,7 +147,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"cbSatStart(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
@@ -162,7 +162,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if ((errcode=gras_rawsock_client_open(to_name,raw_port,msgSize,&raw))) {
     fprintf(stderr,"cbSatStart(): Error %s while opening raw socket to %s:%d.\n",
-           gras_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port);
+           xbt_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
@@ -173,7 +173,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   /* send a train of data before repporting that XP is started */
   if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) {
-    fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode));
+    fprintf(stderr,"cbSatStart: Failure %s during raw send\n",xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot raw send.\n");
@@ -193,7 +193,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   while (gras_msg_wait(0,GRASMSG_SAT_STOP,&msg)==timeout_error && 
         gras_time()-start < timeout) {
     if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) {
-      fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode));
+      fprintf(stderr,"cbSatStart: Failure %s during raw send\n",xbt_error_name(errcode));
       /* our error message do not interess anyone. SAT_STOP will do nothing. */
       gras_sock_close(sock);
       gras_rawsock_close(raw);
@@ -244,7 +244,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
 int grasbw_cbSatBegin(gras_msg_t *msg) {
   gras_rawsock_t *raw;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start; /* timer */
   /* request */
   unsigned int msgSize=gras_msg_ctn(msg,0,0,SatExp_t).msgSize;
@@ -264,7 +264,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
 
   if ((errcode=gras_rawsock_server_open(6666,8000,msgSize,&raw))) { 
     fprintf(stderr,"cbSatBegin(): Error %s encountered while opening a raw socket\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_BEGUN,2,
                     "cbSatBegin: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot open raw socket");
@@ -278,7 +278,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
                              error,1,
                              request,1))) {
     fprintf(stderr,"cbSatBegin(): Error %s encountered while send ACK to peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
   gras_msg_free(msg);
@@ -288,7 +288,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
         gras_time() - start < timeout) {
     errcode=gras_rawsock_recv(raw,msgSize,msgSize,1);
     if (errcode != timeout_error && errcode != no_error) {
-      fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",gras_error_name(errcode));
+      fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",xbt_error_name(errcode));
       /* our error message do not interess anyone. SAT_END will do nothing. */
       /* (if timeout'ed, it may be because the sender stopped emission. so survive it) */
       return 1;
@@ -308,35 +308,35 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
   return 1;
 }
 
-gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
                                 const char* to_name,unsigned int to_port) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_sock_t *sock;
   gras_msg_t *answer;
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return errcode;
   }
 
   if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_STOP,0))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while sending request\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STOPPED,&answer))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while receiving ACK\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"saturate_stop(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
index 41db909..a46bb35 100644 (file)
@@ -23,7 +23,7 @@
  * If not, it should be between between the receiver and @host (3-tiers).
  */
 typedef struct {
-  gras_host_t host; /* host+raw socket to use */
+  xbt_host_t host; /* host+raw socket to use */
   unsigned int buf_size;
   unsigned int exp_size;
   unsigned int msg_size;
@@ -50,7 +50,7 @@ typedef struct {
  * Description of a saturation experiment (payload asking some host to collaborate for that)
  */
 typedef struct {
-  gras_host_t host; /* host+raw socket to use */
+  xbt_host_t host; /* host+raw socket to use */
   unsigned int msg_size;
   unsigned int timeout;
 } sat_request_t;
@@ -68,14 +68,14 @@ int amok_bw_cb_sat_begin(gras_socket_t    *expeditor,
 
 /**** code ****/
 void amok_bw_init(void) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t *bw_request_desc, *bw_res_desc, *sat_request_desc;
 
   amok_base_init();
    
   /* Build the datatype descriptions */ 
   bw_request_desc = gras_datadesc_struct("bw_request_t");
-  gras_datadesc_struct_append(bw_request_desc,"host",gras_datadesc_by_name("gras_host_t*"));
+  gras_datadesc_struct_append(bw_request_desc,"host",gras_datadesc_by_name("xbt_host_t*"));
   gras_datadesc_struct_append(bw_request_desc,"buf_size",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_append(bw_request_desc,"exp_size",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_append(bw_request_desc,"msg_size",gras_datadesc_by_name("unsigned int"));
@@ -91,7 +91,7 @@ void amok_bw_init(void) {
   bw_res_desc = gras_datadesc_ref("bw_res_t*",bw_res_desc);
 
   sat_request_desc = gras_datadesc_struct("sat_request_desc");
-  gras_datadesc_struct_append(sat_request_desc,"host",gras_datadesc_by_name("gras_host_t"));
+  gras_datadesc_struct_append(sat_request_desc,"host",gras_datadesc_by_name("xbt_host_t"));
   gras_datadesc_struct_append(sat_request_desc,"msg_size",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_append(sat_request_desc,"timeout",gras_datadesc_by_name("unsigned int"));
   gras_datadesc_struct_close(sat_request_desc);
@@ -135,12 +135,12 @@ void amok_bw_init(void) {
  * Conduct a test between the local host and @peer, and 
  * report the result in last args
  */
-gras_error_t amok_bw_test(gras_socket_t *peer,
+xbt_error_t amok_bw_test(gras_socket_t *peer,
                          unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
                          /*OUT*/ double *sec, double *bw) {
   gras_socket_t *rawIn,*rawOut;
   int port;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   bw_request_t *request;
   gras_msg_t *answer;
   
@@ -149,11 +149,11 @@ gras_error_t amok_bw_test(gras_socket_t *peer,
        errcode = gras_socket_server_ext(++port,bufSize,1,&rawIn));
   if (errcode != no_error) {
     ERROR1("Error %s encountered while opening a raw socket\n",
-          gras_error_name(errcode));
+          xbt_error_name(errcode));
     return errcode;
   }
 
-  request=gras_new(bw_request_t);
+  request=xbt_new(bw_request_t);
   request->bufSize=bufSize;
   request->expSize=expSize;
   request->msgSize=msgSize;
@@ -161,20 +161,20 @@ gras_error_t amok_bw_test(gras_socket_t *peer,
   request->host.port = gras_socket_peer_port(rawIn);
 
   if ((errcode=gras_send(peer,gras_msgtype_by_name("BW handshake"),request))) {
-    ERROR1("Error %s encountered while sending the request.", gras_error_name(errcode));
+    ERROR1("Error %s encountered while sending the request.", xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if ((errcode=gras_msg_wait(60,GRASMSG_BW_HANDSHAKED,&answer))) {
     fprintf(stderr,"grasbw_test(): Error %s encountered while waiting for the answer.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if((errcode=gras_rawsock_client_open(to_name,gras_msg_ctn(answer,0,0,BwExp_t).port,
                                    bufSize,&rawOut))) {
     fprintf(stderr,"grasbw_test(): Error %s encountered while opening the raw socket to %s:%d\n",
-           gras_error_name(errcode),to_name,gras_msg_ctn(answer,0,0,BwExp_t).port);
+           xbt_error_name(errcode),to_name,gras_msg_ctn(answer,0,0,BwExp_t).port);
     return errcode;
   }
 
@@ -182,7 +182,7 @@ gras_error_t amok_bw_test(gras_socket_t *peer,
   if ((errcode=gras_rawsock_send(rawOut,expSize,msgSize)) ||
       (errcode=gras_rawsock_recv(rawIn,1,1,120))) {
     fprintf(stderr,"grasbw_test(): Error %s encountered while sending the experiment.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_rawsock_close(rawOut);
     gras_rawsock_close(rawIn);
     return errcode;
@@ -209,17 +209,17 @@ gras_error_t amok_bw_test(gras_socket_t *peer,
 int grasbw_cbBWHandshake(gras_msg_t *msg) {
   gras_rawsock_t *rawIn,*rawOut;
   BwExp_t *ans;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   
   if ((errcode=gras_rawsock_server_open(6666,8000,gras_msg_ctn(msg,0,0,BwExp_t).bufSize,&rawIn))) { 
     fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while opening a raw socket\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
   if ((errcode=gras_rawsock_client_open(gras_sock_get_peer_name(msg->sock),gras_msg_ctn(msg,0,0,BwExp_t).port,
                                     gras_msg_ctn(msg,0,0,BwExp_t).bufSize,&rawOut))) { 
     fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while opening a raw socket\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
   if (!(ans=(BwExp_t *)malloc(sizeof(BwExp_t)))) {
@@ -238,7 +238,7 @@ int grasbw_cbBWHandshake(gras_msg_t *msg) {
   if ((errcode=gras_msg_new_and_send(msg->sock,GRASMSG_BW_HANDSHAKED, 1,
                              ans, 1))) {
     fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while sending the answer.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_rawsock_close(rawIn);
     gras_rawsock_close(rawOut);
     return 1;
@@ -250,7 +250,7 @@ int grasbw_cbBWHandshake(gras_msg_t *msg) {
                               120)) ||
       (errcode=gras_rawsock_send(rawOut,1,1))) {
     fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while receiving the experiment.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_rawsock_close(rawIn);
     gras_rawsock_close(rawOut);
     return 1;
@@ -262,21 +262,21 @@ int grasbw_cbBWHandshake(gras_msg_t *msg) {
 }
 
 /* function to request a BW test between to external hosts */
-gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_request(const char* from_name,unsigned int from_port,
                           const char* to_name,unsigned int to_port,
                           unsigned int bufSize,unsigned int expSize,unsigned int msgSize,
                           /*OUT*/ double *sec, double*bw) {
   
   gras_sock_t *sock;
   gras_msg_t *answer;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   /* The request */
   BwExp_t *request;
   msgHost_t *target;
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"grasbw_request(): Error %s encountered while contacting the actuator\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return errcode;
   }
   if (!(request=(BwExp_t *)malloc(sizeof(BwExp_t))) ||
@@ -296,20 +296,20 @@ gras_error_t grasbw_request(const char* from_name,unsigned int from_port,
                              target,1,
                              request,1))) {
     fprintf(stderr,"grasbw_request(): Error %s encountered while sending the request.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if ((errcode=gras_msg_wait(240,GRASMSG_BW_RESULT,&answer))) {
     fprintf(stderr,"grasbw_request(): Error %s encountered while waiting for the answer.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"grasbw_request(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
@@ -346,7 +346,7 @@ int grasbw_cbBWRequest(gras_msg_t *msg) {
                                  &(res[0].value),&(res[1].value) ))) {
     fprintf(stderr,
            "%s:%d:grasbw_cbRequest: Error %s encountered while doing the test\n",
-           __FILE__,__LINE__,gras_error_name(error->errcode));
+           __FILE__,__LINE__,xbt_error_name(error->errcode));
     strncpy(error->errmsg,"Error within grasbw_test",ERRMSG_LEN);
     gras_msg_new_and_send(msg->sock,GRASMSG_BW_RESULT,2,
                   error,1,
@@ -366,11 +366,11 @@ int grasbw_cbBWRequest(gras_msg_t *msg) {
  * Link saturation
  * ***************************************************************************/
 
-gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                                  const char* to_name,unsigned int to_port,
                                  unsigned int msgSize, unsigned int timeout) {
   gras_sock_t *sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   /* The request */
   SatExp_t *request;
   msgHost_t *target;
@@ -379,7 +379,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while contacting peer\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     return errcode;
   }
   if (!(request=(SatExp_t *)malloc(sizeof(SatExp_t))) ||
@@ -399,20 +399,20 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
                              target,1,
                              request,1))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while sending the request.\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STARTED,&answer))) {
     fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while waiting for the ACK.\n",
-           __FILE__,__LINE__,gras_error_name(errcode));
+           __FILE__,__LINE__,xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"%s:%d:saturate_start(): Peer reported error %s (%s).\n",
-           __FILE__,__LINE__,gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           __FILE__,__LINE__,xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
@@ -426,7 +426,7 @@ gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port,
 int grasbw_cbSatStart(gras_msg_t *msg) {
   gras_rawsock_t *raw;
   gras_sock_t *sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start; /* time to timeout */
 
   /* specification of the test to run */
@@ -452,7 +452,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   /* Negociate the saturation with the peer */
   if((errcode=gras_sock_client_open(to_name,to_port,&sock))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot contact peer.\n");
@@ -473,7 +473,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_BEGIN, 1, 
                              request,1))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while sending the request.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot send request.\n");
@@ -483,7 +483,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_BEGUN,&answer))) {
     fprintf(stderr,"cbSatStart(): Error %s encountered while waiting for the ACK.\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
@@ -495,7 +495,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"cbSatStart(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
@@ -510,7 +510,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   if ((errcode=gras_rawsock_client_open(to_name,raw_port,msgSize,&raw))) {
     fprintf(stderr,"cbSatStart(): Error %s while opening raw socket to %s:%d.\n",
-           gras_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port);
+           xbt_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port);
 
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
@@ -521,7 +521,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
   /* send a train of data before repporting that XP is started */
   if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) {
-    fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode));
+    fprintf(stderr,"cbSatStart: Failure %s during raw send\n",xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1,
                     "cbSatStart: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot raw send.\n");
@@ -541,7 +541,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
   while (gras_msg_wait(0,GRASMSG_SAT_STOP,&msg)==timeout_error && 
         gras_time()-start < timeout) {
     if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) {
-      fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode));
+      fprintf(stderr,"cbSatStart: Failure %s during raw send\n",xbt_error_name(errcode));
       /* our error message do not interess anyone. SAT_STOP will do nothing. */
       gras_sock_close(sock);
       gras_rawsock_close(raw);
@@ -592,7 +592,7 @@ int grasbw_cbSatStart(gras_msg_t *msg) {
 
 int grasbw_cbSatBegin(gras_msg_t *msg) {
   gras_rawsock_t *raw;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start; /* timer */
   /* request */
   unsigned int msgSize=gras_msg_ctn(msg,0,0,SatExp_t).msgSize;
@@ -612,7 +612,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
 
   if ((errcode=gras_rawsock_server_open(6666,8000,msgSize,&raw))) { 
     fprintf(stderr,"cbSatBegin(): Error %s encountered while opening a raw socket\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     grasRepportError(msg->sock,GRASMSG_SAT_BEGUN,2,
                     "cbSatBegin: Severe error: Cannot send error status to requester!!\n",
                     errcode,"Cannot open raw socket");
@@ -626,7 +626,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
                              error,1,
                              request,1))) {
     fprintf(stderr,"cbSatBegin(): Error %s encountered while send ACK to peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return 1;
   }
   gras_msg_free(msg);
@@ -636,7 +636,7 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
         gras_time() - start < timeout) {
     errcode=gras_rawsock_recv(raw,msgSize,msgSize,1);
     if (errcode != timeout_error && errcode != no_error) {
-      fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",gras_error_name(errcode));
+      fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",xbt_error_name(errcode));
       /* our error message do not interess anyone. SAT_END will do nothing. */
       /* (if timeout'ed, it may be because the sender stopped emission. so survive it) */
       return 1;
@@ -656,35 +656,35 @@ int grasbw_cbSatBegin(gras_msg_t *msg) {
   return 1;
 }
 
-gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
+xbt_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
                                 const char* to_name,unsigned int to_port) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_sock_t *sock;
   gras_msg_t *answer;
 
   if((errcode=gras_sock_client_open(from_name,from_port,&sock))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     return errcode;
   }
 
   if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_STOP,0))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while sending request\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STOPPED,&answer))) {
     fprintf(stderr,"saturate_stop(): Error %s encountered while receiving ACK\n",
-           gras_error_name(errcode));
+           xbt_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
 
   if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) {
     fprintf(stderr,"saturate_stop(): Peer reported error %s (%s).\n",
-           gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
+           xbt_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg);
     gras_msg_free(answer);
     gras_sock_close(sock);
     return errcode;
index 494cd09..2474e95 100644 (file)
@@ -12,9 +12,9 @@
 #include "gras/datadesc.h"
 #include "amok/base.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(amok,GRAS_LOG_ROOT_CAT,"All AMOK categories");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(amok,XBT_LOG_ROOT_CAT,"All AMOK categories");
 
-amok_remoterr_t amok_remoterr_new(gras_error_t param_errcode, 
+amok_remoterr_t amok_remoterr_new(xbt_error_t param_errcode, 
                                  const char* format,...) {
    
   amok_remoterr_t res;
@@ -26,12 +26,12 @@ amok_remoterr_t amok_remoterr_new(gras_error_t param_errcode,
   return res;
 }
 
-amok_remoterr_t amok_remoterr_new_va(gras_error_t param_errcode, 
+amok_remoterr_t amok_remoterr_new_va(xbt_error_t param_errcode, 
                                     const char* format,va_list ap) {
-  amok_remoterr_t res=gras_new(s_amok_remoterr_t,1);
+  amok_remoterr_t res=xbt_new(s_amok_remoterr_t,1);
   res->code=param_errcode;
   if (format) {
-     res->msg=(char*)gras_malloc(1024);
+     res->msg=(char*)xbt_malloc(1024);
      vsnprintf(res->msg,1024,format,ap);
   } else {
      res->msg = NULL;
@@ -42,8 +42,8 @@ amok_remoterr_t amok_remoterr_new_va(gras_error_t param_errcode,
 
 void amok_remoterr_free(amok_remoterr_t *err) {
    if (err && *err) {
-      if ((*err)->msg) gras_free((*err)->msg);
-      gras_free(*err);
+      if ((*err)->msg) xbt_free((*err)->msg);
+      xbt_free(*err);
       err=NULL;
    }
 }
@@ -51,14 +51,14 @@ void amok_remoterr_free(amok_remoterr_t *err) {
 
 void
 amok_repport_error (gras_socket_t sock, gras_msgtype_t msgtype,
-                   gras_error_t param_errcode, const char* format,...) {
+                   xbt_error_t param_errcode, const char* format,...) {
   amok_remoterr_t error;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   va_list ap;
 
-  error=gras_new(s_amok_remoterr_t,1);
+  error=xbt_new(s_amok_remoterr_t,1);
   error->code=param_errcode;
-  error->msg=(char*)gras_malloc(1024); /* FIXME */
+  error->msg=(char*)xbt_malloc(1024); /* FIXME */
   va_start(ap,format);
   vsnprintf(error->msg,1024,format,ap);
   va_end(ap);
@@ -66,7 +66,7 @@ amok_repport_error (gras_socket_t sock, gras_msgtype_t msgtype,
   errcode = gras_msg_send(sock,msgtype,error);
   if (errcode != no_error) {
      CRITICAL4("Error '%s' while reporting error '%s' to %s:%d",
-              gras_error_name(errcode),error->msg,
+              xbt_error_name(errcode),error->msg,
               gras_socket_peer_name(sock),gras_socket_peer_port(sock) );
   }
 }
@@ -75,11 +75,11 @@ void amok_base_init(void) {
   gras_datadesc_type_t host_desc, remoterr_desc;
      
   /* Build the datatype descriptions */
-  host_desc = gras_datadesc_struct("gras_host_t");
+  host_desc = gras_datadesc_struct("xbt_host_t");
   gras_datadesc_struct_append(host_desc,"name",gras_datadesc_by_name("string"));
   gras_datadesc_struct_append(host_desc,"exp_size",gras_datadesc_by_name("int"));
   gras_datadesc_struct_close(host_desc);
-  host_desc = gras_datadesc_ref("gras_host_t*",host_desc);
+  host_desc = gras_datadesc_ref("xbt_host_t*",host_desc);
    
   remoterr_desc = gras_datadesc_struct("s_amok_remoterr_t");
   gras_datadesc_struct_append(remoterr_desc,"msg",gras_datadesc_by_name("string"));
index f63f19b..e37d6fe 100644 (file)
@@ -9,7 +9,7 @@
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "gras/DataDesc/datadesc_private.h"
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_cbps,datadesc,"callback persistant state");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_cbps,datadesc,"callback persistant state");
 
 typedef struct {
   gras_datadesc_type_t  type;
@@ -17,31 +17,31 @@ typedef struct {
 } s_gras_cbps_elm_t, *gras_cbps_elm_t;
 
 typedef struct s_gras_cbps {
-  gras_dynar_t lints; /* simple stack of long integers (easy interface) */
+  xbt_dynar_t lints; /* simple stack of long integers (easy interface) */
 
-  gras_dict_t  space; /* varname x dynar of gras_cbps_elm_t */
-  gras_dynar_t frames; /* of dynar of names defined within this frame
+  xbt_dict_t  space; /* varname x dynar of gras_cbps_elm_t */
+  xbt_dynar_t frames; /* of dynar of names defined within this frame
                           (and to pop when we leave it) */
-  gras_dynar_t globals;
+  xbt_dynar_t globals;
 } s_gras_cbps_t;
 
 static void free_string(void *d);
 
 static void free_string(void *d){
-  gras_free(*(void**)d);
+  xbt_free(*(void**)d);
 }
 
 gras_cbps_t gras_cbps_new(void) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_cbps_t  res;
 
-  res=gras_new(s_gras_cbps_t,1);
+  res=xbt_new(s_gras_cbps_t,1);
 
-  res->lints = gras_dynar_new(sizeof(int), NULL);
-  res->space = gras_dict_new();
+  res->lints = xbt_dynar_new(sizeof(int), NULL);
+  res->space = xbt_dict_new();
   /* no leak, the content is freed manually on block_end */
-  res->frames = gras_dynar_new(sizeof(gras_dynar_t), NULL);
-  res->globals = gras_dynar_new(sizeof(char*), NULL);
+  res->frames = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
+  res->globals = xbt_dynar_new(sizeof(char*), NULL);
 
   gras_cbps_block_begin(res);
 
@@ -50,14 +50,14 @@ gras_cbps_t gras_cbps_new(void) {
 
 void gras_cbps_free(gras_cbps_t *state) {
 
-  gras_dynar_free( &( (*state)->lints   ) );
+  xbt_dynar_free( &( (*state)->lints   ) );
 
   gras_cbps_block_end(*state);
-  gras_dict_free ( &( (*state)->space   ) );
-  gras_dynar_free( &( (*state)->frames  ) );
-  gras_dynar_free( &( (*state)->globals ) );
+  xbt_dict_free ( &( (*state)->space   ) );
+  xbt_dynar_free( &( (*state)->frames  ) );
+  xbt_dynar_free( &( (*state)->globals ) );
 
-  gras_free(*state);
+  xbt_free(*state);
   *state = NULL;
 }
 
@@ -68,39 +68,39 @@ void gras_cbps_free(gras_cbps_t *state) {
  * name already exists, it is masked by the one given here, and will be 
  * seeable again only after a pop to remove the value this push adds.
  */
-gras_error_t
+xbt_error_t
 gras_cbps_v_push(gras_cbps_t          ps,
                 const char          *name,
                 void                *data,
                 gras_datadesc_type_t ddt) {
 
-  gras_dynar_t          varstack,frame;
+  xbt_dynar_t          varstack,frame;
   gras_cbps_elm_t       var;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char *varname = (char*)strdup(name);
 
   DEBUG2("push(%s,%p)",name,(void*)data);
-  errcode = gras_dict_get(ps->space, name, (void **)&varstack);
+  errcode = xbt_dict_get(ps->space, name, (void **)&varstack);
  
   if (errcode == mismatch_error) {
     DEBUG1("Create a new variable stack for '%s' into the space",name);
-    varstack = gras_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
-    gras_dict_set(ps->space, varname, (void **)varstack, NULL);
+    varstack = xbt_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
+    xbt_dict_set(ps->space, varname, (void **)varstack, NULL);
     /* leaking, you think? only if you do not close all the openned blocks ;)*/
   } else if (errcode != no_error) {
     return errcode;
   }
  
-  var       = gras_new0(s_gras_cbps_elm_t,1);
+  var       = xbt_new0(s_gras_cbps_elm_t,1);
   var->type = ddt;
   var->data = data;
   
-  gras_dynar_push(varstack, &var);
+  xbt_dynar_push(varstack, &var);
   
-  gras_dynar_pop(ps->frames, &frame);
+  xbt_dynar_pop(ps->frames, &frame);
   DEBUG4("Push %s (%p @%p) into frame %p",varname,(void*)varname,(void*)&varname,(void*)frame);
-  gras_dynar_push(frame, &varname);
-  gras_dynar_push(ps->frames, &frame); 
+  xbt_dynar_push(frame, &varname);
+  xbt_dynar_push(ps->frames, &frame); 
   return no_error;
 }
 
@@ -111,53 +111,53 @@ gras_cbps_v_push(gras_cbps_t          ps,
  * present in the current block, it will fail (with abort) and not search
  * in upper blocks since this denotes a programmation error.
  */
-gras_error_t
+xbt_error_t
 gras_cbps_v_pop (gras_cbps_t            ps, 
                 const char            *name,
                 gras_datadesc_type_t  *ddt,
                 void                 **res) {
-  gras_dynar_t          varstack,frame;
+  xbt_dynar_t          varstack,frame;
   gras_cbps_elm_t       var            = NULL;
   void                 *data           = NULL;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   DEBUG1("pop(%s)",name);
   /* FIXME: Error handling */
-  errcode = gras_dict_get(ps->space, name, (void **)&varstack);
+  errcode = xbt_dict_get(ps->space, name, (void **)&varstack);
   if (errcode == mismatch_error) {
     RAISE1(mismatch_error,"Asked to pop the non-existant %s",
           name);
   }
-  gras_dynar_pop(varstack, &var);
+  xbt_dynar_pop(varstack, &var);
   
-  if (!gras_dynar_length(varstack)) {
+  if (!xbt_dynar_length(varstack)) {
     DEBUG1("Last incarnation of %s poped. Kill it",name);
-    gras_dict_remove(ps->space, name);
-    gras_dynar_free(&varstack);
+    xbt_dict_remove(ps->space, name);
+    xbt_dynar_free(&varstack);
   }
   
   if (ddt)
     *ddt = var->type;  
   data    = var->data;
   
-  gras_free(var);
+  xbt_free(var);
   
-  gras_dynar_pop(ps->frames, &frame);
+  xbt_dynar_pop(ps->frames, &frame);
   {
-    int l = gras_dynar_length(frame);
+    int l = xbt_dynar_length(frame);
     
     while (l--) {
       char *_name = NULL;
                                                                                 
-      _name = gras_dynar_get_as(frame, l, char*);
+      _name = xbt_dynar_get_as(frame, l, char*);
       if (!strcmp(name, _name)) {
-       gras_dynar_remove_at(frame, l, &_name);
-       gras_free(_name);
+       xbt_dynar_remove_at(frame, l, &_name);
+       xbt_free(_name);
        break;
       }
     }
   }
-  gras_dynar_push(ps->frames, &frame);
+  xbt_dynar_push(ps->frames, &frame);
   
   *res = data;
   return no_error;
@@ -180,27 +180,27 @@ gras_cbps_v_set (gras_cbps_t          ps,
                 void                *data,
                 gras_datadesc_type_t ddt) {
 
-  gras_dynar_t    dynar        = NULL;
+  xbt_dynar_t    dynar        = NULL;
   gras_cbps_elm_t elm          = NULL;
-  gras_error_t    errcode;
+  xbt_error_t    errcode;
   
   DEBUG1("set(%s)",name);
-  errcode = gras_dict_get(ps->space, name, (void **)&dynar);
+  errcode = xbt_dict_get(ps->space, name, (void **)&dynar);
   
   if (errcode == mismatch_error) {
-    dynar = gras_dynar_new(sizeof (gras_cbps_elm_t), NULL);
-    gras_dict_set(ps->space, name, (void **)dynar, NULL);
+    dynar = xbt_dynar_new(sizeof (gras_cbps_elm_t), NULL);
+    xbt_dict_set(ps->space, name, (void **)dynar, NULL);
     
-    elm   = gras_new0(s_gras_cbps_elm_t,1);
-    gras_dynar_push(ps->globals, &name);
+    elm   = xbt_new0(s_gras_cbps_elm_t,1);
+    xbt_dynar_push(ps->globals, &name);
   } else {
-    gras_dynar_pop(dynar, &elm);
+    xbt_dynar_pop(dynar, &elm);
   }
   
   elm->type   = ddt;
   elm->data   = data;
  
-  gras_dynar_push(dynar, &elm);
+  xbt_dynar_push(dynar, &elm);
 
 }
 
@@ -218,14 +218,14 @@ gras_cbps_v_get (gras_cbps_t           ps,
                 const char           *name,
                 /* OUT */gras_datadesc_type_t *ddt) {
   
-  gras_dynar_t    dynar = NULL;
+  xbt_dynar_t    dynar = NULL;
   gras_cbps_elm_t elm   = NULL;
   
   DEBUG1("get(%s)",name);
   /* FIXME: Error handling */
-  gras_dict_get(ps->space, name, (void **)&dynar);
-  gras_dynar_pop(dynar, &elm);
-  gras_dynar_push(dynar, &elm);
+  xbt_dict_get(ps->space, name, (void **)&dynar);
+  xbt_dynar_pop(dynar, &elm);
+  xbt_dynar_push(dynar, &elm);
   
   if (ddt) {
     *ddt = elm->type;
@@ -252,11 +252,11 @@ gras_cbps_v_get (gras_cbps_t           ps,
 void
 gras_cbps_block_begin(gras_cbps_t ps) {
 
-  gras_dynar_t dynar = NULL;
+  xbt_dynar_t dynar = NULL;
 
   DEBUG0(">>> Block begin");
-  dynar = gras_dynar_new(sizeof (char *), NULL);
-  gras_dynar_push(ps->frames, &dynar);
+  dynar = xbt_dynar_new(sizeof (char *), NULL);
+  xbt_dynar_push(ps->frames, &dynar);
 }
 
 /**
@@ -267,33 +267,33 @@ gras_cbps_block_begin(gras_cbps_t ps) {
 void
 gras_cbps_block_end(gras_cbps_t ps) {
 
-  gras_dynar_t  frame        = NULL;
+  xbt_dynar_t  frame        = NULL;
   int           cursor       =    0;
   char         *name         = NULL;
 
-  gras_assert0(gras_dynar_length(ps->frames),
+  xbt_assert0(xbt_dynar_length(ps->frames),
               "More block_end than block_begin");
-  gras_dynar_pop(ps->frames, &frame);
+  xbt_dynar_pop(ps->frames, &frame);
   
-  gras_dynar_foreach(frame, cursor, name) {
+  xbt_dynar_foreach(frame, cursor, name) {
 
-    gras_dynar_t    varstack    = NULL;
+    xbt_dynar_t    varstack    = NULL;
     gras_cbps_elm_t var         = NULL;
  
     DEBUG2("Get ride of %s (%p)",name,(void*)name);
-    gras_dict_get(ps->space, name, (void **)&varstack);
-    gras_dynar_pop(varstack, &var);
+    xbt_dict_get(ps->space, name, (void **)&varstack);
+    xbt_dynar_pop(varstack, &var);
  
-    if (!gras_dynar_length(varstack)) {
-      gras_dict_remove(ps->space, name);
-      gras_dynar_free_container(&varstack); /*already empty, save a test ;) */
+    if (!xbt_dynar_length(varstack)) {
+      xbt_dict_remove(ps->space, name);
+      xbt_dynar_free_container(&varstack); /*already empty, save a test ;) */
     }
     
-    if (var->data) gras_free(var->data);
-    gras_free(var);
-    gras_free(name);
+    if (var->data) xbt_free(var->data);
+    xbt_free(var);
+    xbt_free(name);
   }
-  gras_dynar_free_container(&frame);/* we just emptied it */
+  xbt_dynar_free_container(&frame);/* we just emptied it */
   DEBUG0("<<< Block end");
 }
 
@@ -306,9 +306,9 @@ gras_cbps_block_end(gras_cbps_t ps) {
 void
 gras_cbps_i_push(gras_cbps_t ps,
                 int val) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   DEBUG1("push %d as a size",val);
-  gras_dynar_push_as(ps->lints,int,val);
+  xbt_dynar_push_as(ps->lints,int,val);
 }
 /**
  * gras_cbps_i_pop:
@@ -319,9 +319,9 @@ int
 gras_cbps_i_pop(gras_cbps_t ps) {
   int ret;
 
-  gras_assert0(gras_dynar_length(ps->lints) > 0,
+  xbt_assert0(xbt_dynar_length(ps->lints) > 0,
               "gras_cbps_i_pop: no value to pop");
-  ret = gras_dynar_pop_as(ps->lints,int);
+  ret = xbt_dynar_pop_as(ps->lints,int);
   DEBUG1("pop %d as a size",ret);
   return ret;
 }
index 5b2ee37..e7e7ce1 100644 (file)
@@ -10,9 +10,9 @@
 
 #include "gras/DataDesc/datadesc_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(datadesc,gras,"Data description");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(datadesc,gras,"Data description");
 /* FIXME: make this host-dependent using a trick such as UserData*/
-gras_set_t gras_datadesc_set_local=NULL;
+xbt_set_t gras_datadesc_set_local=NULL;
 
 
 /* callback for array size when sending strings */
@@ -32,7 +32,7 @@ _strlen_cb(gras_cbps_t vars, void *data) {
  **/
 void
 gras_datadesc_init(void) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t ddt; /* What to add */
 
   /* only initialize once */
@@ -41,7 +41,7 @@ gras_datadesc_init(void) {
   
   VERB0("Initializing DataDesc");
   
-  gras_datadesc_set_local = gras_set_new();
+  gras_datadesc_set_local = xbt_set_new();
   
   ddt = gras_datadesc_scalar("signed char", 
                             gras_ddt_scalar_char, 
@@ -122,7 +122,7 @@ gras_datadesc_init(void) {
 void
 gras_datadesc_exit(void) {
   VERB0("Exiting DataDesc");
-  gras_set_free(&gras_datadesc_set_local);
+  xbt_set_free(&gras_datadesc_set_local);
   DEBUG0("Exited DataDesc");
 }
 
@@ -205,7 +205,7 @@ void gras_datadesc_type_dump(const gras_datadesc_type_t ddt){
     gras_dd_cat_field_t  field;
 
     struct_data = ddt->category.struct_data;
-    gras_dynar_foreach(struct_data.fields, cpt, field) {
+    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);
index b0b71df..9ab2517 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef GRAS_DATADESC_INTERFACE_H
 #define GRAS_DATADESC_INTERFACE_H
 
-gras_error_t gras_datadesc_by_id  (long int code,
+xbt_error_t gras_datadesc_by_id  (long int code,
                                   gras_datadesc_type_t *type);
 
 /* to debug */
@@ -28,9 +28,9 @@ gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
 /* Access function */
 int  gras_datadesc_size(gras_datadesc_type_t type);
 /* Described data exchanges */
-gras_error_t gras_datadesc_cpy(gras_datadesc_type_t type, void *src, void **dst);
-gras_error_t gras_datadesc_send(gras_socket_t sock, gras_datadesc_type_t type, void *src);
-gras_error_t gras_datadesc_recv(gras_socket_t sock, gras_datadesc_type_t type,
+xbt_error_t gras_datadesc_cpy(gras_datadesc_type_t type, void *src, void **dst);
+xbt_error_t gras_datadesc_send(gras_socket_t sock, gras_datadesc_type_t type, void *src);
+xbt_error_t gras_datadesc_recv(gras_socket_t sock, gras_datadesc_type_t type,
                                int r_arch, void *dst);
 
    
index cdb0935..2435c23 100644 (file)
@@ -36,7 +36,7 @@
  */
 #define aligned(v, a) (((v) + (a - 1)) & ~(a - 1))
 
-extern gras_set_t gras_datadesc_set_local;
+extern xbt_set_t gras_datadesc_set_local;
 void gras_ddt_freev(void *ddt);
 /*******************************************
  * Descriptions of all known architectures *
@@ -142,7 +142,7 @@ typedef struct s_gras_dd_cat_scalar {
  * Specific fields of a struct
  */
 typedef struct s_gras_dd_cat_struct {
-  gras_dynar_t fields; /* elm type = gras_dd_cat_field_t */
+  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;
 
@@ -153,7 +153,7 @@ typedef struct s_gras_dd_cat_struct {
  */
 typedef struct s_gras_dd_cat_union {
   gras_datadesc_type_cb_int_t selector;
-  gras_dynar_t fields; /* elm type = gras_dd_cat_field_t */
+  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;
 
@@ -261,7 +261,7 @@ void gras_cbps_free(gras_cbps_t *state);
 /***************
  * Convertions *
  ***************/
-gras_error_t
+xbt_error_t
 gras_dd_convert_elm(gras_datadesc_type_t type, int count,
                    int r_arch, 
                    void *src, void *dst);
index 949c691..b6b4b9f 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "gras/DataDesc/datadesc_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_convert,datadesc,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_convert,datadesc,
                                 "Inter-architecture convertions");
 
 /***
@@ -68,7 +68,7 @@ gras_dd_reverse_bytes(void *to,
  * 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.
  */
-gras_error_t
+xbt_error_t
 gras_dd_convert_elm(gras_datadesc_type_t type, int count,
                    int r_arch, 
                    void *src, void *dst) {
@@ -84,8 +84,8 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
   } tester;
   */
 
-  gras_assert(type->category_code == e_gras_datadesc_type_cat_scalar);
-  gras_assert(r_arch != GRAS_THISARCH);
+  xbt_assert(type->category_code == e_gras_datadesc_type_cat_scalar);
+  xbt_assert(r_arch != GRAS_THISARCH);
   
   r_size = type->size[r_arch];
   l_size = type->size[GRAS_THISARCH];
@@ -122,7 +122,7 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count,
 
       DEBUG5("Resize integer %d from %lu @%p to %lu @%p",
             cpt, r_size,r_data, l_size,l_data);
-      gras_assert0(r_data != l_data, "Impossible to resize in place");
+      xbt_assert0(r_data != l_data, "Impossible to resize in place");
 
       if(sizeChange < 0) {
        DEBUG3("Truncate %d bytes (%s,%s)", -sizeChange,
index 1d49562..5b77b43 100644 (file)
@@ -11,7 +11,7 @@
 #include "xbt/misc.h" /* min()/max() */
 #include "gras/DataDesc/datadesc_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_create,datadesc,"Creating new datadescriptions");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_create,datadesc,"Creating new datadescriptions");
 
 /**
  * gras_ddt_freev:
@@ -27,19 +27,19 @@ void gras_ddt_freev(void *ddt) {
 }
 
 static gras_datadesc_type_t gras_ddt_new(const char *name) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t res;
 
-  GRAS_IN1("(%s)",name);
-  res=gras_new0(s_gras_datadesc_type_t,1);
+  XBT_IN1("(%s)",name);
+  res=xbt_new0(s_gras_datadesc_type_t,1);
 
   res->name = (char*)strdup(name);
   res->name_len = strlen(name);
   res->cycle = 0;
       
-  gras_set_add(gras_datadesc_set_local,
-              (gras_set_elm_t)res,&gras_ddt_freev);
-  GRAS_OUT;
+  xbt_set_add(gras_datadesc_set_local,
+              (xbt_set_elm_t)res,&gras_ddt_freev);
+  XBT_OUT;
   return res;
 }
 
@@ -52,13 +52,13 @@ gras_datadesc_type_t gras_datadesc_by_name(const char *name) {
 
   gras_datadesc_type_t type;
 
-  GRAS_IN1("(%s)",name);
-  if (gras_set_get_by_name(gras_datadesc_set_local,
-                          name,(gras_set_elm_t*)&type) == no_error) {
-    GRAS_OUT;
+  XBT_IN1("(%s)",name);
+  if (xbt_set_get_by_name(gras_datadesc_set_local,
+                          name,(xbt_set_elm_t*)&type) == no_error) {
+    XBT_OUT;
     return type;
   } else { 
-    GRAS_OUT;
+    XBT_OUT;
     return NULL;
   }
 }
@@ -68,11 +68,11 @@ gras_datadesc_type_t gras_datadesc_by_name(const char *name) {
  *
  * Retrieve a type from its code
  */
-gras_error_t gras_datadesc_by_id(long int              code,
+xbt_error_t gras_datadesc_by_id(long int              code,
                                 gras_datadesc_type_t *type) {
-  GRAS_IN;
-  return gras_set_get_by_id(gras_datadesc_set_local,
-                           code,(gras_set_elm_t*)type);
+  XBT_IN;
+  return xbt_set_get_by_id(gras_datadesc_set_local,
+                           code,(xbt_set_elm_t*)type);
 }
 
 /**
@@ -88,14 +88,14 @@ gras_datadesc_type_t
   gras_datadesc_type_t res;
   long int arch;
 
-  GRAS_IN;
+  XBT_IN;
   res = gras_datadesc_by_name(name);
   if (res) {
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_scalar,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_scalar,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.scalar_data.encoding == encoding,
+    xbt_assert1(res->category.scalar_data.encoding == encoding,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.scalar_data.type == type,
+    xbt_assert1(res->category.scalar_data.type == type,
                 "Redefinition of type %s does not match", name);
     VERB1("Discarding redefinition of %s",name);
     return res;
@@ -126,11 +126,11 @@ gras_datadesc_type_t
       /* size is not a power of 2 */
       /* alignment= next power of 2 after size */
       res->alignment[arch] = (res->size[arch] & ~(mask >> 1)) << 1;
-      gras_assert0(res->alignment[arch] != 0,
+      xbt_assert0(res->alignment[arch] != 0,
                   "scalar type too large");
       
       res->aligned_size[arch] = aligned(res->size[arch], res->alignment[arch]);
-      gras_assert0 (res->aligned_size[arch] >= 0,
+      xbt_assert0 (res->aligned_size[arch] >= 0,
                    "scalar type too large");
       
     } else {
@@ -144,7 +144,7 @@ gras_datadesc_type_t
   res->category_code                 = e_gras_datadesc_type_cat_scalar;
   res->category.scalar_data.encoding = encoding;
   res->category.scalar_data.type     = type;
-  GRAS_OUT;
+  XBT_OUT;
   
   return res;
 }
@@ -157,13 +157,13 @@ gras_datadesc_type_t
  */
 void gras_dd_cat_field_free(void *f) {
   gras_dd_cat_field_t field = *(gras_dd_cat_field_t *)f;
-  GRAS_IN;
+  XBT_IN;
   if (field) {
     if (field->name) 
-      gras_free(field->name);
-    gras_free(field);
+      xbt_free(field->name);
+    xbt_free(field);
   }
-  GRAS_OUT;
+  XBT_OUT;
 }
 
 /**
@@ -174,15 +174,15 @@ void gras_dd_cat_field_free(void *f) {
 gras_datadesc_type_t 
   gras_datadesc_struct(const char            *name) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t res;
   long int arch;
   
-  GRAS_IN1("(%s)",name);
+  XBT_IN1("(%s)",name);
   res = gras_datadesc_by_name(name);
   if (res) {
     /* FIXME: Check that field redefinition matches */
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_struct,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_struct,
                 "Redefinition of type %s does not match", name);
     VERB1("Discarding redefinition of %s",name);
     return res;
@@ -196,10 +196,10 @@ gras_datadesc_type_t
   }
   res->category_code = e_gras_datadesc_type_cat_struct;
   res->category.struct_data.fields = 
-       gras_dynar_new(sizeof(gras_dd_cat_field_t),
+       xbt_dynar_new(sizeof(gras_dd_cat_field_t),
                      &gras_dd_cat_field_free);
 
-  GRAS_OUT;
+  XBT_OUT;
   return res;
 }
 
@@ -213,25 +213,25 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
                            const char          *name,
                            gras_datadesc_type_t field_type) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_dd_cat_field_t field;
   int arch;
 
-  gras_assert2(field_type,
+  xbt_assert2(field_type,
               "Cannot add the field '%s' into struct '%s': its type is NULL. Typo in get_by_name?",
               name,struct_type->name);
-  GRAS_IN3("(%s %s.%s;)",field_type->name,struct_type->name,name);
+  XBT_IN3("(%s %s.%s;)",field_type->name,struct_type->name,name);
   if (struct_type->category.struct_data.closed) {
     VERB1("Ignoring request to add field to struct %s (closed. Redefinition?)",
          struct_type->name);
     return;
   }
 
-  gras_assert1(field_type->size != 0,
+  xbt_assert1(field_type->size != 0,
               "Cannot add a dynamically sized field in structure %s",
               struct_type->name);
     
-  field=gras_new(s_gras_dd_cat_field_t,1);
+  field=xbt_new(s_gras_dd_cat_field_t,1);
   field->name   = (char*)strdup(name);
 
   DEBUG0("----------------");
@@ -255,7 +255,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
   field->pre    = NULL;
   field->post   = NULL;
   
-  gras_dynar_push(struct_type->category.struct_data.fields, &field);
+  xbt_dynar_push(struct_type->category.struct_data.fields, &field);
 
   DEBUG3("Push a %s into %s at offset %ld.",
         field_type->name, struct_type->name,field->offset[GRAS_THISARCH]);
@@ -267,12 +267,12 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type,
         struct_type->size[GRAS_THISARCH], 
         struct_type->alignment[GRAS_THISARCH], 
         struct_type->aligned_size[GRAS_THISARCH]);
-  GRAS_OUT;
+  XBT_OUT;
 }
 
 void
 gras_datadesc_struct_close(gras_datadesc_type_t struct_type) {
-  GRAS_IN;
+  XBT_IN;
   struct_type->category.struct_data.closed = 1;
 }
 
@@ -310,20 +310,20 @@ gras_datadesc_type_t
 gras_datadesc_union(const char                   *name,
                    gras_datadesc_type_cb_int_t   selector) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t res;
   int arch;
 
-  GRAS_IN1("(%s)",name);
-  gras_assert0(selector,
+  XBT_IN1("(%s)",name);
+  xbt_assert0(selector,
               "Attempt to creat an union without field_count function");
 
   res = gras_datadesc_by_name(name);
   if (res) {
     /* FIXME: Check that field redefinition matches */
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_union,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_union,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.union_data.selector == selector,
+    xbt_assert1(res->category.union_data.selector == selector,
                 "Redefinition of type %s does not match", name);
     VERB1("Discarding redefinition of %s",name);
     return res;
@@ -339,7 +339,7 @@ gras_datadesc_union(const char                   *name,
 
   res->category_code           = e_gras_datadesc_type_cat_union;
   res->category.union_data.fields =
-     gras_dynar_new(sizeof(gras_dd_cat_field_t*),
+     xbt_dynar_new(sizeof(gras_dd_cat_field_t*),
                    &gras_dd_cat_field_free);
   res->category.union_data.selector = selector;
 
@@ -359,8 +359,8 @@ gras_datadesc_union_append(gras_datadesc_type_t  union_type,
   gras_dd_cat_field_t field;
   int arch;
 
-  GRAS_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
-  gras_assert1(field_type->size != 0,
+  XBT_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
+  xbt_assert1(field_type->size != 0,
               "Cannot add a dynamically sized field in union %s",
               union_type->name);
 
@@ -370,13 +370,13 @@ gras_datadesc_union_append(gras_datadesc_type_t  union_type,
     return;
   }
     
-  field=gras_new0(s_gras_dd_cat_field_t,1);
+  field=xbt_new0(s_gras_dd_cat_field_t,1);
 
   field->name   = (char*)strdup(name);
   field->type   = field_type;
   /* All offset are left to 0 in an union */
   
-  gras_dynar_push(union_type->category.union_data.fields, &field);
+  xbt_dynar_push(union_type->category.union_data.fields, &field);
 
   for (arch=0; arch<gras_arch_count; arch ++) {
     union_type->size[arch] = max(union_type->size[arch],
@@ -401,19 +401,19 @@ gras_datadesc_type_t
   gras_datadesc_ref(const char           *name,
                    gras_datadesc_type_t  referenced_type) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_datadesc_type_t res;
   gras_datadesc_type_t pointer_type = gras_datadesc_by_name("data pointer");
   int arch;
 
-  GRAS_IN1("(%s)",name);
+  XBT_IN1("(%s)",name);
   res = gras_datadesc_by_name(name);
   if (res) {
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
                 "Redefinition of %s does not match",name);
-    gras_assert1(res->category.ref_data.type == referenced_type,
+    xbt_assert1(res->category.ref_data.type == referenced_type,
                 "Redefinition of %s does not match",name);
-    gras_assert1(res->category.ref_data.selector == NULL,
+    xbt_assert1(res->category.ref_data.selector == NULL,
                 "Redefinition of %s does not match",name);
     VERB1("Discarding redefinition of %s",name);
     return res;
@@ -421,7 +421,7 @@ gras_datadesc_type_t
 
   res = gras_ddt_new(name);
 
-  gras_assert0(pointer_type, "Cannot get the description of data pointer");
+  xbt_assert0(pointer_type, "Cannot get the description of data pointer");
       
   for (arch=0; arch<gras_arch_count; arch ++){
     res->size[arch] = pointer_type->size[arch];
@@ -448,21 +448,21 @@ gras_datadesc_type_t
   gras_datadesc_type_t pointer_type = gras_datadesc_by_name("data pointer");
   int arch;
 
-  GRAS_IN1("(%s)",name);
+  XBT_IN1("(%s)",name);
   res = gras_datadesc_by_name(name);
   if (res) {
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.ref_data.type == NULL,
+    xbt_assert1(res->category.ref_data.type == NULL,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.ref_data.selector == selector,
+    xbt_assert1(res->category.ref_data.selector == selector,
                 "Redefinition of type %s does not match", name);
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
   res = gras_ddt_new(name);
 
-  gras_assert0(pointer_type, "Cannot get the description of data pointer");
+  xbt_assert0(pointer_type, "Cannot get the description of data pointer");
       
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = pointer_type->size[arch];
@@ -491,16 +491,16 @@ gras_datadesc_type_t
   gras_datadesc_type_t res;
   int arch;
 
-  GRAS_IN1("(%s)",name);
+  XBT_IN1("(%s)",name);
   res = gras_datadesc_by_name(name);
   if (res) {
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_array,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.type == element_type,
+    xbt_assert1(res->category.array_data.type == element_type,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.fixed_size == fixed_size,
+    xbt_assert1(res->category.array_data.fixed_size == fixed_size,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.dynamic_size == NULL,
+    xbt_assert1(res->category.array_data.dynamic_size == NULL,
                 "Redefinition of type %s does not match", name);
     VERB1("Discarding redefinition of %s",name);
 
@@ -508,7 +508,7 @@ gras_datadesc_type_t
   }
   res = gras_ddt_new(name);
 
-  gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
+  xbt_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = fixed_size * element_type->aligned_size[arch];
     res->alignment[arch] = element_type->alignment[arch];
@@ -536,20 +536,20 @@ gras_datadesc_type_t
   gras_datadesc_type_t res;
   int arch;
 
-  GRAS_IN1("(%s)",name);
-  gras_assert1(dynamic_size,
+  XBT_IN1("(%s)",name);
+  xbt_assert1(dynamic_size,
               "'%s' is a dynamic array without size discriminant",
               name);
 
   res = gras_datadesc_by_name(name);
   if (res) {
-    gras_assert1(res->category_code == e_gras_datadesc_type_cat_array,
+    xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.type == element_type,
+    xbt_assert1(res->category.array_data.type == element_type,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.fixed_size == 0,
+    xbt_assert1(res->category.array_data.fixed_size == 0,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.dynamic_size == dynamic_size,
+    xbt_assert1(res->category.array_data.dynamic_size == dynamic_size,
                 "Redefinition of type %s does not match", name);
     VERB1("Discarding redefinition of %s",name);
 
@@ -600,7 +600,7 @@ gras_datadesc_type_t
   gras_datadesc_ref_pop_arr(gras_datadesc_type_t element_type) {
 
   gras_datadesc_type_t res;
-  char *name=(char*)gras_malloc(strlen(element_type->name) + 4);
+  char *name=(char*)xbt_malloc(strlen(element_type->name) + 4);
 
   sprintf(name,"%s[]",element_type->name);
 
@@ -610,11 +610,11 @@ gras_datadesc_type_t
   sprintf(name,"%s[]*",element_type->name);
   res = gras_datadesc_ref(name,res);
 
-  gras_free(name);
+  xbt_free(name);
 
   return res;
 }
-gras_error_t
+xbt_error_t
 gras_datadesc_import_nws(const char           *name,
                         const DataDescriptor *desc,
                         unsigned long         howmany,
@@ -651,7 +651,7 @@ static gras_datadesc_type_t
   gras_dd_find_field(gras_datadesc_type_t  type,
                     const char           *field_name) {
    gras_datadesc_type_t sub_type=NULL;
-   gras_dynar_t         field_array;
+   xbt_dynar_t         field_array;
    
    gras_dd_cat_field_t  field=NULL;
    int                  field_num;
@@ -662,15 +662,15 @@ static gras_datadesc_type_t
       field_array = type->category.struct_data.fields;
    } else {
       ERROR2("%s (%p) is not a struct nor an union. There is no field.", type->name,(void*)type);
-      gras_abort();
+      xbt_abort();
    }
-   gras_dynar_foreach(field_array,field_num,field) {
+   xbt_dynar_foreach(field_array,field_num,field) {
       if (!strcmp(field_name,field->name)) {
         return field->type;
       }
    }
    ERROR2("No field nammed %s in %s",field_name,type->name);
-   gras_abort();
+   xbt_abort();
 
 }
                                  
@@ -709,7 +709,7 @@ void gras_datadesc_cb_field_push (gras_datadesc_type_t  type,
    } else {
       ERROR1("Field %s is not an int, unsigned int, long int neither unsigned long int",
             sub_type->name);
-      gras_abort();
+      xbt_abort();
    }
 }
 /**
@@ -729,7 +729,7 @@ void gras_datadesc_cb_field_recv(gras_datadesc_type_t          type,
 /**
  * gras_datadesc_free:
  *
- * Free a datadesc. Should only be called at gras_exit. 
+ * Free a datadesc. Should only be called at xbt_exit. 
  */
 void gras_datadesc_free(gras_datadesc_type_t *type) {
 
@@ -750,18 +750,18 @@ void gras_datadesc_free(gras_datadesc_type_t *type) {
     break;
     
   case e_gras_datadesc_type_cat_struct:
-    gras_dynar_free(&( (*type)->category.struct_data.fields ));
+    xbt_dynar_free(&( (*type)->category.struct_data.fields ));
     break;
     
   case e_gras_datadesc_type_cat_union:
-    gras_dynar_free(&( (*type)->category.union_data.fields ));
+    xbt_dynar_free(&( (*type)->category.union_data.fields ));
     break;
     
   default:
     /* datadesc was invalid. Killing it is like euthanasy, I guess */
     break;
   }
-  gras_free((*type)->name);
-  gras_free(*type);
+  xbt_free((*type)->name);
+  xbt_free(*type);
   type=NULL;
 }
index ffa1013..abd7272 100644 (file)
@@ -11,7 +11,7 @@
 #include "gras/DataDesc/datadesc_private.h"
 #include "gras/Transport/transport_interface.h" /* gras_trp_chunk_send/recv */
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_exchange,datadesc,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_exchange,datadesc,
                                 "Sending data over the network");
 const char *gras_datadesc_cat_names[9] = { 
   "undefined", 
@@ -20,28 +20,28 @@ const char *gras_datadesc_cat_names[9] = {
 
 static gras_datadesc_type_t int_type = NULL;
 static gras_datadesc_type_t pointer_type = NULL;    
-static _GRAS_INLINE gras_error_t gras_dd_send_int(gras_socket_t sock,             int  i);
-static _GRAS_INLINE gras_error_t gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i);
+static _XBT_INLINE xbt_error_t gras_dd_send_int(gras_socket_t sock,             int  i);
+static _XBT_INLINE xbt_error_t gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i);
 
-static _GRAS_INLINE gras_error_t
-gras_dd_alloc_ref(gras_dict_t  refs,  long int     size,
+static _XBT_INLINE xbt_error_t
+gras_dd_alloc_ref(xbt_dict_t  refs,  long int     size,
                  char       **r_ref, long int     r_len,
                  char       **l_ref, int detect_cycle);
 
-static _GRAS_INLINE int
+static _XBT_INLINE int
 gras_dd_is_r_null(char **r_ptr, long int length);
 
-static gras_error_t 
+static xbt_error_t 
 gras_datadesc_send_rec(gras_socket_t         sock,
                       gras_cbps_t           state,
-                      gras_dict_t           refs,
+                      xbt_dict_t           refs,
                       gras_datadesc_type_t  type, 
                       char                 *data, 
                       int                   detect_cycle);
-static gras_error_t
+static xbt_error_t
 gras_datadesc_recv_rec(gras_socket_t         sock, 
                       gras_cbps_t           state,
-                      gras_dict_t           refs,
+                      xbt_dict_t           refs,
                       gras_datadesc_type_t  type,
                       int                   r_arch,
                       char                **r_data,
@@ -51,25 +51,25 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                       int                   detect_cycle);
 
 
-static _GRAS_INLINE gras_error_t
+static _XBT_INLINE xbt_error_t
 gras_dd_send_int(gras_socket_t sock,int i) {
 
   if (!int_type) {
     int_type = gras_datadesc_by_name("int");
-     gras_assert(int_type);  
+     xbt_assert(int_type);  
   }
    
   DEBUG1("send_int(%d)",i);
   return gras_trp_chunk_send(sock, (char*)&i, int_type->size[GRAS_THISARCH]);
 }
 
-static _GRAS_INLINE gras_error_t
+static _XBT_INLINE xbt_error_t
 gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   if (!int_type) {
      int_type = gras_datadesc_by_name("int");
-     gras_assert(int_type);
+     xbt_assert(int_type);
   }
 
   if (int_type->size[GRAS_THISARCH] >= int_type->size[r_arch]) {
@@ -77,12 +77,12 @@ gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
     if (r_arch != GRAS_THISARCH)
       TRY(gras_dd_convert_elm(int_type,1,r_arch, i,i));
   } else {
-    void *ptr = gras_malloc(int_type->size[r_arch]);
+    void *ptr = xbt_malloc(int_type->size[r_arch]);
 
     TRY(gras_trp_chunk_recv(sock, (char*)ptr, int_type->size[r_arch]));
     if (r_arch != GRAS_THISARCH)
       TRY(gras_dd_convert_elm(int_type,1,r_arch, ptr,i));
-    gras_free(ptr);
+    xbt_free(ptr);
   }
   DEBUG1("recv_int(%d)",*i);
 
@@ -94,7 +94,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 _GRAS_INLINE int 
+static _XBT_INLINE int 
 gras_dd_is_r_null(char **r_ptr, long int length) {
   int i;
 
@@ -107,8 +107,8 @@ gras_dd_is_r_null(char **r_ptr, long int length) {
   return 1;
 }
 
-static _GRAS_INLINE gras_error_t
-gras_dd_alloc_ref(gras_dict_t  refs,
+static _XBT_INLINE xbt_error_t
+gras_dd_alloc_ref(xbt_dict_t  refs,
                  long int     size,
                  char       **r_ref,
                  long int     r_len, /* pointer_type->size[r_arch] */
@@ -116,8 +116,8 @@ gras_dd_alloc_ref(gras_dict_t  refs,
                  int          detect_cycle) {
   char *l_data = NULL;
 
-  gras_assert1(size>0,"Cannot allocate %ld bytes!", size);
-  l_data = gras_malloc((size_t)size);
+  xbt_assert1(size>0,"Cannot allocate %ld bytes!", size);
+  l_data = xbt_malloc((size_t)size);
 
   *l_ref = l_data;
   DEBUG2("l_data=%p, &l_data=%p",(void*)l_data,(void*)&l_data);
@@ -125,8 +125,8 @@ gras_dd_alloc_ref(gras_dict_t  refs,
   DEBUG3("alloc_ref: r_ref=%p; *r_ref=%p, r_len=%ld",
         (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)) {
-    gras_error_t errcode;
-    void *ptr = gras_malloc(sizeof(void *));
+    xbt_error_t errcode;
+    void *ptr = xbt_malloc(sizeof(void *));
 
     CRITICAL0("detect_cycle");
     memcpy(ptr,l_ref, sizeof(void *));
@@ -134,7 +134,7 @@ gras_dd_alloc_ref(gras_dict_t  refs,
     DEBUG2("Insert %p under %p",*(void**)ptr, *(void**)r_ref);
 
     if (detect_cycle)
-       gras_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, gras_free_fct);
+       xbt_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, xbt_free_fct);
   }
   return no_error;
 }
@@ -217,19 +217,19 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
     break;
     
   case e_gras_datadesc_type_cat_struct:    
-    if (gras_dynar_length(d1->category.struct_data.fields) != 
-       gras_dynar_length(d2->category.struct_data.fields)) {
+    if (xbt_dynar_length(d1->category.struct_data.fields) != 
+       xbt_dynar_length(d2->category.struct_data.fields)) {
       DEBUG4("ddt_cmp: %s (having %lu fields) !=  %s (having %lu fields)",
-            d1->name, gras_dynar_length(d1->category.struct_data.fields),
-            d2->name, gras_dynar_length(d2->category.struct_data.fields));
+            d1->name, xbt_dynar_length(d1->category.struct_data.fields),
+            d2->name, xbt_dynar_length(d2->category.struct_data.fields));
       
-      return gras_dynar_length(d1->category.struct_data.fields) >
-       gras_dynar_length(d2->category.struct_data.fields) ?
+      return xbt_dynar_length(d1->category.struct_data.fields) >
+       xbt_dynar_length(d2->category.struct_data.fields) ?
        1 : -1;
     }
-    gras_dynar_foreach(d1->category.struct_data.fields, cpt, field1) {
+    xbt_dynar_foreach(d1->category.struct_data.fields, cpt, field1) {
       
-      field2 = gras_dynar_get_as(d2->category.struct_data.fields, cpt, gras_dd_cat_field_t);
+      field2 = xbt_dynar_get_as(d2->category.struct_data.fields, cpt, gras_dd_cat_field_t);
       field_desc_1 = field1->type;
       field_desc_2 = field2->type;
       ret = gras_datadesc_type_cmp(field_desc_1,field_desc_2);
@@ -247,15 +247,15 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
     if (d1->category.union_data.selector != d2->category.union_data.selector) 
       return 1;  /* ISO C forbids ordered comparisons of pointers to functions */
     
-    if (gras_dynar_length(d1->category.union_data.fields) != 
-       gras_dynar_length(d2->category.union_data.fields))
-      return gras_dynar_length(d1->category.union_data.fields) >
-            gras_dynar_length(d2->category.union_data.fields) ?
+    if (xbt_dynar_length(d1->category.union_data.fields) != 
+       xbt_dynar_length(d2->category.union_data.fields))
+      return xbt_dynar_length(d1->category.union_data.fields) >
+            xbt_dynar_length(d2->category.union_data.fields) ?
        1 : -1;
     
-    gras_dynar_foreach(d1->category.union_data.fields, cpt, field1) {
+    xbt_dynar_foreach(d1->category.union_data.fields, cpt, field1) {
       
-      field2 = gras_dynar_get_as(d2->category.union_data.fields, cpt, gras_dd_cat_field_t);
+      field2 = xbt_dynar_get_as(d2->category.union_data.fields, cpt, gras_dd_cat_field_t);
       field_desc_1 = field1->type;
       field_desc_2 = field2->type;
       ret = gras_datadesc_type_cmp(field_desc_1,field_desc_2);
@@ -303,21 +303,21 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t d1,
  * to a new location, and store a pointer to it in dst.
  *
  */
-gras_error_t gras_datadesc_cpy(gras_datadesc_type_t type, 
+xbt_error_t gras_datadesc_cpy(gras_datadesc_type_t type, 
                               void *src, 
                               void **dst) {
   RAISE_UNIMPLEMENTED;
 }
 
-static gras_error_t 
+static xbt_error_t 
 gras_datadesc_send_rec(gras_socket_t         sock,
                       gras_cbps_t           state,
-                      gras_dict_t           refs,
+                      xbt_dict_t           refs,
                       gras_datadesc_type_t  type, 
                       char                 *data,
                       int                   detect_cycle) {
 
-  gras_error_t         errcode;
+  xbt_error_t         errcode;
   int                  cpt;
   gras_datadesc_type_t sub_type; /* type on which we recurse */
   
@@ -339,11 +339,11 @@ gras_datadesc_send_rec(gras_socket_t         sock,
     char                *field_data;
     
     struct_data = type->category.struct_data;
-    gras_assert1(struct_data.closed,
+    xbt_assert1(struct_data.closed,
       "Please call gras_datadesc_declare_struct_close on %s before sending it",
                type->name);
     VERB1(">> Send all fields of the structure %s",type->name);
-    gras_dynar_foreach(struct_data.fields, cpt, field) {
+    xbt_dynar_foreach(struct_data.fields, cpt, field) {
       field_data = data;
       field_data += field->offset[GRAS_THISARCH];
       
@@ -370,25 +370,25 @@ gras_datadesc_send_rec(gras_socket_t         sock,
     
     union_data = type->category.union_data;
     
-    gras_assert1(union_data.closed,
+    xbt_assert1(union_data.closed,
                "Please call gras_datadesc_declare_union_close on %s before sending it",
                type->name);
     /* retrieve the field number */
     field_num = union_data.selector(state, data);
     
-    gras_assert1(field_num > 0,
+    xbt_assert1(field_num > 0,
                 "union field selector of %s gave a negative value", 
                 type->name);
     
-    gras_assert3(field_num < gras_dynar_length(union_data.fields),
+    xbt_assert3(field_num < xbt_dynar_length(union_data.fields),
         "union field selector of %s returned %d but there is only %lu fields",
-                type->name, field_num, gras_dynar_length(union_data.fields));
+                type->name, field_num, xbt_dynar_length(union_data.fields));
 
     /* Send the field number */
     TRY(gras_dd_send_int(sock, field_num));
     
     /* Send the content */
-    field = gras_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
+    field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
     sub_type = field->type;
     
     if (field->pre)
@@ -420,7 +420,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
     /* Send the actual value of the pointer for cycle handling */
     if (!pointer_type) {
       pointer_type = gras_datadesc_by_name("data pointer");
-      gras_assert(pointer_type);
+      xbt_assert(pointer_type);
     }
      
     TRY(gras_trp_chunk_send(sock, (char*)data,
@@ -432,12 +432,12 @@ gras_datadesc_send_rec(gras_socket_t         sock,
       break;
     }
     errcode = detect_cycle 
-            ? gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy)
+            ? xbt_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy)
             : mismatch_error;
     if (errcode == mismatch_error) {
        VERB1("Sending data referenced at %p", (void*)*ref);
        if (detect_cycle)
-        gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL);
+        xbt_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL);
        TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref, detect_cycle || sub_type->cycle));
          
     } else if (errcode == no_error) {
@@ -461,7 +461,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
     count = array_data.fixed_size;
     if (count == 0) {
       count = array_data.dynamic_size(state,data);
-      gras_assert1(count >=0,
+      xbt_assert1(count >=0,
                   "Invalid (negative) array size for type %s",type->name);
       TRY(gras_dd_send_int(sock, count));
     }
@@ -492,7 +492,7 @@ gras_datadesc_send_rec(gras_socket_t         sock,
   }
 
   default:
-    gras_assert0(0, "Invalid type");
+    xbt_assert0(0, "Invalid type");
   }
 
   return no_error;
@@ -504,20 +504,20 @@ gras_datadesc_send_rec(gras_socket_t         sock,
  * Copy the data pointed by src and described by type to the socket
  *
  */
-gras_error_t gras_datadesc_send(gras_socket_t        sock, 
+xbt_error_t gras_datadesc_send(gras_socket_t        sock, 
                                gras_datadesc_type_t type, 
                                void *src) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_cbps_t  state;
-  gras_dict_t  refs; /* all references already sent */
+  xbt_dict_t  refs; /* all references already sent */
  
-  refs = gras_dict_new();
+  refs = xbt_dict_new();
   state = gras_cbps_new();
    
   errcode = gras_datadesc_send_rec(sock,state,refs,type,(char*)src, type->cycle);
 
-  gras_dict_free(&refs);
+  xbt_dict_free(&refs);
   gras_cbps_free(&state);
 
   return errcode;
@@ -535,10 +535,10 @@ gras_error_t gras_datadesc_send(gras_socket_t        sock,
  * Having this size passed as an argument of the recursive function is a crude
  * hack, but I was told that working code is sometimes better than neat one ;)
  */
-gras_error_t
+xbt_error_t
 gras_datadesc_recv_rec(gras_socket_t         sock, 
                       gras_cbps_t           state,
-                      gras_dict_t           refs,
+                      xbt_dict_t           refs,
                       gras_datadesc_type_t  type,
                       int                   r_arch,
                       char                **r_data,
@@ -547,12 +547,12 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                       int                   subsize,
                       int                   detect_cycle) {
 
-  gras_error_t         errcode;
+  xbt_error_t         errcode;
   int                  cpt;
   gras_datadesc_type_t sub_type;
 
   VERB2("Recv a %s @%p", type->name, (void*)l_data);
-  gras_assert(l_data);
+  xbt_assert(l_data);
 
   switch (type->category_code) {
   case e_gras_datadesc_type_cat_scalar:
@@ -561,12 +561,12 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
       if (r_arch != GRAS_THISARCH)
        TRY(gras_dd_convert_elm(type,1,r_arch, l_data,l_data));
     } else {
-      void *ptr = gras_malloc(type->size[r_arch]);
+      void *ptr = xbt_malloc(type->size[r_arch]);
 
       TRY(gras_trp_chunk_recv(sock, (char*)ptr, type->size[r_arch]));
       if (r_arch != GRAS_THISARCH)
        TRY(gras_dd_convert_elm(type,1,r_arch, ptr,l_data));
-      gras_free(ptr);
+      xbt_free(ptr);
     }
     break;
 
@@ -576,11 +576,11 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
 
     struct_data = type->category.struct_data;
 
-    gras_assert1(struct_data.closed,
+    xbt_assert1(struct_data.closed,
                "Please call gras_datadesc_declare_struct_close on %s before receiving it",
                type->name);
     VERB1(">> Receive all fields of the structure %s",type->name);
-    gras_dynar_foreach(struct_data.fields, cpt, field) {
+    xbt_dynar_foreach(struct_data.fields, cpt, field) {
       char                 *field_data = l_data + field->offset[GRAS_THISARCH];
 
       sub_type = field->type;
@@ -602,7 +602,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
 
     union_data = type->category.union_data;
 
-    gras_assert1(union_data.closed,
+    xbt_assert1(union_data.closed,
                "Please call gras_datadesc_declare_union_close on %s before receiving it",
                type->name);
     /* retrieve the field number */
@@ -610,13 +610,13 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
     if (field_num < 0)
       RAISE1(mismatch_error,
             "Received union field for %s is negative", type->name);
-    if (field_num < gras_dynar_length(union_data.fields)) 
+    if (field_num < xbt_dynar_length(union_data.fields)) 
       RAISE3(mismatch_error,
             "Received union field for %s is %d but there is only %lu fields",
-            type->name, field_num, gras_dynar_length(union_data.fields));
+            type->name, field_num, xbt_dynar_length(union_data.fields));
     
     /* Recv the content */
-    field = gras_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
+    field = xbt_dynar_get_as(union_data.fields, field_num, gras_dd_cat_field_t);
     sub_type = field->type;
     
     TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
@@ -644,10 +644,10 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
     /* Get the actual value of the pointer for cycle handling */
     if (!pointer_type) {
       pointer_type = gras_datadesc_by_name("data pointer");
-      gras_assert(pointer_type);
+      xbt_assert(pointer_type);
     }
 
-    r_ref = gras_malloc(pointer_type->size[r_arch]);
+    r_ref = xbt_malloc(pointer_type->size[r_arch]);
 
     TRY(gras_trp_chunk_recv(sock, (char*)r_ref,
                            pointer_type->size[r_arch]));
@@ -657,12 +657,12 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
       VERB1("Not receiving data remotely referenced @%p since it's NULL",
            *(void **)r_ref);
       *(void**)l_data = NULL;
-      gras_free(r_ref);
+      xbt_free(r_ref);
       break;
     }
          
     errcode = detect_cycle
-            ? gras_dict_get_ext(refs,
+            ? xbt_dict_get_ext(refs,
                                (char*)r_ref, pointer_type->size[r_arch],
                                (void**)&l_ref)
             : mismatch_error;
@@ -715,7 +715,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
     } else {
       return errcode;
     }
-    gras_free(r_ref);
+    xbt_free(r_ref);
     break;
   }
 
@@ -747,13 +747,13 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
        if (r_arch != GRAS_THISARCH)
          TRY(gras_dd_convert_elm(sub_type,count,r_arch, l_data,l_data));
       } else {
-       ptr = gras_malloc(sub_type->aligned_size[r_arch] * count);
+       ptr = xbt_malloc(sub_type->aligned_size[r_arch] * count);
 
        TRY(gras_trp_chunk_recv(sock, (char*)ptr, 
                                sub_type->size[r_arch] * count));
        if (r_arch != GRAS_THISARCH)
          TRY(gras_dd_convert_elm(sub_type,count,r_arch, ptr,l_data));
-       gras_free(ptr);
+       xbt_free(ptr);
       }
     } else if (sub_type->category_code == e_gras_datadesc_type_cat_array &&
               sub_type->category.array_data.fixed_size > 0 &&
@@ -770,13 +770,13 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
        if (r_arch != GRAS_THISARCH)
          TRY(gras_dd_convert_elm(subsub_type,count*array_data.fixed_size,r_arch, l_data,l_data));
       } else {
-       ptr = gras_malloc(subsub_type->aligned_size[r_arch] * count*array_data.fixed_size);
+       ptr = xbt_malloc(subsub_type->aligned_size[r_arch] * count*array_data.fixed_size);
 
        TRY(gras_trp_chunk_recv(sock, (char*)ptr, 
                                subsub_type->size[r_arch] * count*array_data.fixed_size));
        if (r_arch != GRAS_THISARCH)
          TRY(gras_dd_convert_elm(subsub_type,count*array_data.fixed_size,r_arch, ptr,l_data));
-       gras_free(ptr);
+       xbt_free(ptr);
       }
       
        
@@ -797,7 +797,7 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
   }
         
   default:
-    gras_assert0(0, "Invalid type");
+    xbt_assert0(0, "Invalid type");
   }
   
   if (type->recv)
@@ -813,17 +813,17 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
  * and store a pointer to it in @dst
  *
  */
-gras_error_t
+xbt_error_t
 gras_datadesc_recv(gras_socket_t         sock, 
                   gras_datadesc_type_t  type,
                   int                   r_arch,
                   void                 *dst) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_cbps_t  state; /* callback persistent state */
-  gras_dict_t  refs;  /* all references already sent */
+  xbt_dict_t  refs;  /* all references already sent */
 
-  refs = gras_dict_new();
+  refs = xbt_dict_new();
   state = gras_cbps_new();
 
   errcode = gras_datadesc_recv_rec(sock, state, refs, type, 
@@ -831,7 +831,7 @@ gras_datadesc_recv(gras_socket_t         sock,
                                   (char *) dst,-1, 
                                   type->cycle);
 
-  gras_dict_free(&refs);
+  xbt_dict_free(&refs);
   gras_cbps_free(&state);
 
   return errcode;
index f41d6fd..e4a8bf9 100644 (file)
@@ -13,7 +13,7 @@
 #include "gras/DataDesc/datadesc_private.h"
 #include "gras/DataDesc/ddt_parse.yy.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_parse,datadesc,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_parse,datadesc,
   "Parsing C data structures to build GRAS data description");
 
 typedef struct s_type_modifier{
@@ -39,7 +39,7 @@ extern char *gras_ddt_parse_text; /* text being considered in the parser */
 
 /* local functions */
 static void parse_type_modifier(type_modifier_t type_modifier)  {
-  GRAS_IN;
+  XBT_IN;
   do {
     if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
       /* This only used when parsing 'short *' since this function returns when int, float, double,... is encountered */
@@ -85,13 +85,13 @@ static void parse_type_modifier(type_modifier_t type_modifier)  {
       break;
     }
   } while(1);
-  GRAS_OUT;
+  XBT_OUT;
 }
 
 static void print_type_modifier(s_type_modifier_t tm) {
   int i;
 
-  GRAS_IN;
+  XBT_IN;
   if (tm.is_unsigned)             printf("(unsigned) ");
   if (tm.is_short)                printf("(short) ");
   for (i=0 ; i<tm.is_long ; i++)  printf("(long) ");
@@ -101,81 +101,81 @@ static void print_type_modifier(s_type_modifier_t tm) {
   if(tm.is_union)                 printf("(union) ");
 
   for (i=0 ; i<tm.is_ref ; i++)   printf("(ref) ");
-  GRAS_OUT;
+  XBT_OUT;
 }
 
-static void change_to_fixed_array(gras_dynar_t dynar, long int size) {
+static void change_to_fixed_array(xbt_dynar_t dynar, long int size) {
   s_identifier_t former,array;
   memset(&array,0,sizeof(array));
 
-  GRAS_IN;
-  gras_dynar_pop(dynar,&former);
-  array.type_name=(char*)gras_malloc(strlen(former.type->name)+20);
+  XBT_IN;
+  xbt_dynar_pop(dynar,&former);
+  array.type_name=(char*)xbt_malloc(strlen(former.type->name)+20);
   DEBUG2("Array specification (size=%ld, elm='%s'), change pushed type",
         size,former.type_name);
   sprintf(array.type_name,"%s[%ld]",former.type_name,size);
-  gras_free(former.type_name);
+  xbt_free(former.type_name);
 
   array.type = gras_datadesc_array_fixed(array.type_name, former.type, size); /* redeclaration are ignored */
   array.name = former.name;
 
-  gras_dynar_push(dynar,&array);
-  GRAS_OUT;
+  xbt_dynar_push(dynar,&array);
+  XBT_OUT;
 }
-static void change_to_ref(gras_dynar_t dynar) {
+static void change_to_ref(xbt_dynar_t dynar) {
   s_identifier_t former,ref;
   memset(&ref,0,sizeof(ref));
 
-  GRAS_IN;
-  gras_dynar_pop(dynar,&former);
-  ref.type_name=(char*)gras_malloc(strlen(former.type->name)+2);
+  XBT_IN;
+  xbt_dynar_pop(dynar,&former);
+  ref.type_name=(char*)xbt_malloc(strlen(former.type->name)+2);
   DEBUG1("Ref specification (elm='%s'), change pushed type", former.type_name);
   sprintf(ref.type_name,"%s*",former.type_name);
-  gras_free(former.type_name);
+  xbt_free(former.type_name);
 
   ref.type = gras_datadesc_ref(ref.type_name, former.type); /* redeclaration are ignored */
   ref.name = former.name;
 
-  gras_dynar_push(dynar,&ref);
-  GRAS_OUT;
+  xbt_dynar_push(dynar,&ref);
+  XBT_OUT;
 }
 
-static void change_to_ref_pop_array(gras_dynar_t dynar) {
+static void change_to_ref_pop_array(xbt_dynar_t dynar) {
   s_identifier_t former,ref;
   memset(&ref,0,sizeof(ref));
 
-  GRAS_IN;
-  gras_dynar_pop(dynar,&former);
+  XBT_IN;
+  xbt_dynar_pop(dynar,&former);
   ref.type = gras_datadesc_ref_pop_arr(former.type); /* redeclaration are ignored */
   ref.type_name = (char*)strdup(ref.type->name);
   ref.name = former.name;
 
-  gras_free(former.type_name);
+  xbt_free(former.type_name);
 
-  gras_dynar_push(dynar,&ref);
-  GRAS_OUT;
+  xbt_dynar_push(dynar,&ref);
+  XBT_OUT;
 }
 
-static gras_error_t parse_statement(char        *definition,
-                                   gras_dynar_t  identifiers,
-                                   gras_dynar_t  fields_to_push) {
-  gras_error_t errcode;
+static xbt_error_t parse_statement(char         *definition,
+                                   xbt_dynar_t  identifiers,
+                                   xbt_dynar_t  fields_to_push) {
+  xbt_error_t errcode;
   char buffname[512];
 
   s_identifier_t identifier;
 
   int expect_id_separator = 0;
 
-  GRAS_IN;
+  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) {
-    GRAS_OUT;
+    XBT_OUT;
     return mismatch_error; /* end of the englobing structure or union */
   }
   
-  if (GRAS_LOG_ISENABLED(ddt_parse,gras_log_priority_debug)) {
+  if (XBT_LOG_ISENABLED(ddt_parse,xbt_log_priority_debug)) {
     int colon_pos;
     for (colon_pos = gras_ddt_parse_col_pos;
         definition[colon_pos] != ';';
@@ -365,14 +365,14 @@ static gras_error_t parse_statement(char   *definition,
 
        DEBUG2("Anotation: %s=%s",keyname,keyval);
        if (!strcmp(keyname,"size")) {
-         gras_free(keyname);
+         xbt_free(keyname);
          if (!identifier.tm.is_ref)
            PARSE_ERROR0("Size annotation for a field not being a reference");
          identifier.tm.is_ref--;
 
          if (!strcmp(keyval,"1")) {
            change_to_ref(identifiers);
-           gras_free(keyval);
+           xbt_free(keyval);
            continue;
          } else {
            char *p;
@@ -383,12 +383,12 @@ static gras_error_t parse_statement(char   *definition,
            if (fixed) {
              change_to_fixed_array(identifiers,atoi(keyval));
              change_to_ref(identifiers);
-             gras_free(keyval);
+             xbt_free(keyval);
              continue;
 
            } else {
              change_to_ref_pop_array(identifiers);
-             gras_dynar_push(fields_to_push,&keyval);
+             xbt_dynar_push(fields_to_push,&keyval);
              continue;
            }
          }
@@ -418,8 +418,8 @@ static gras_error_t parse_statement(char     *definition,
       identifier.name=(char*)strdup(gras_ddt_parse_text);
       DEBUG1("Found the identifier \"%s\"",identifier.name);
       
-      gras_dynar_push(identifiers, &identifier);
-      DEBUG1("Dynar_len=%lu",gras_dynar_length(identifiers));
+      xbt_dynar_push(identifiers, &identifier);
+      DEBUG1("Dynar_len=%lu",xbt_dynar_length(identifiers));
       expect_id_separator = 1;
       continue;
     }
@@ -427,28 +427,28 @@ static gras_error_t parse_statement(char   *definition,
     PARSE_ERROR0("Unparasable symbol (maybe a def struct in a def struct or a parser bug ;)");
   }
 
-  GRAS_OUT;
+  XBT_OUT;
   return no_error;
 }
 
 static gras_datadesc_type_t parse_struct(char *definition) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char buffname[32];
   static int anonymous_struct=0;
 
-  gras_dynar_t identifiers;
+  xbt_dynar_t identifiers;
   s_identifier_t field;
   int i;
 
-  gras_dynar_t fields_to_push;
+  xbt_dynar_t fields_to_push;
   char *name;
 
   gras_datadesc_type_t struct_type;
 
-  GRAS_IN;
-  identifiers = gras_dynar_new(sizeof(s_identifier_t),NULL);
-  fields_to_push = gras_dynar_new(sizeof(char*),NULL);
+  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) {
@@ -470,34 +470,34 @@ static gras_datadesc_type_t parse_struct(char *definition) {
        errcode == no_error                            ;
        errcode=parse_statement(definition,identifiers,fields_to_push)) {
     
-    DEBUG1("This statement contained %lu identifiers",gras_dynar_length(identifiers));
+    DEBUG1("This statement contained %lu identifiers",xbt_dynar_length(identifiers));
     /* append the identifiers we've found */
-    gras_dynar_foreach(identifiers,i, field) {
+    xbt_dynar_foreach(identifiers,i, field) {
       if (field.tm.is_ref)
        PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
                     field.name,field.tm.is_ref);
 
       VERB2("Append field '%s' to %p",field.name, (void*)struct_type);      
       gras_datadesc_struct_append(struct_type, field.name, field.type);
-      gras_free(field.name);
-      gras_free(field.type_name);
+      xbt_free(field.name);
+      xbt_free(field.type_name);
 
     }
-    gras_dynar_reset(identifiers);
+    xbt_dynar_reset(identifiers);
     DEBUG1("struct_type=%p",(void*)struct_type);
     
     /* Make sure that all fields declaring a size push it into the cbps */
-    gras_dynar_foreach(fields_to_push,i, name) {
+    xbt_dynar_foreach(fields_to_push,i, name) {
       DEBUG1("struct_type=%p",(void*)struct_type);
       VERB2("Push field '%s' into size stack of %p", name, (void*)struct_type);
       gras_datadesc_cb_field_push(struct_type, name);
-      gras_free(name);
+      xbt_free(name);
     }
-    gras_dynar_reset(fields_to_push);
+    xbt_dynar_reset(fields_to_push);
   }
   gras_datadesc_struct_close(struct_type);
   if (errcode != mismatch_error) {
-    GRAS_OUT;
+    XBT_OUT;
     return NULL; /* FIXME: LEAK! */
   }
 
@@ -508,9 +508,9 @@ static gras_datadesc_type_t parse_struct(char *definition) {
 
   gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
 
-  gras_dynar_free(&identifiers);
-  gras_dynar_free(&fields_to_push);
-  GRAS_OUT;
+  xbt_dynar_free(&identifiers);
+  xbt_dynar_free(&fields_to_push);
+  XBT_OUT;
   return struct_type;
 }
 
@@ -521,7 +521,7 @@ static gras_datadesc_type_t parse_typedef(char *definition) {
   gras_datadesc_type_t struct_desc=NULL;
   gras_datadesc_type_t typedef_desc=NULL;
 
-  GRAS_IN;
+  XBT_IN;
   memset(&tm,0,sizeof(tm));
 
   /* get the aliased type */
@@ -544,7 +544,7 @@ static gras_datadesc_type_t parse_typedef(char *definition) {
   /* (FIXME: should) build the alias */
   PARSE_ERROR0("Cannot handle typedef yet");
 
-  GRAS_OUT;
+  XBT_OUT;
   return typedef_desc;
 }
 
@@ -563,12 +563,12 @@ gras_datadesc_parse(const char            *name,
   int semicolon_count=0;
   int def_count,C_count;
 
-  GRAS_IN;
+  XBT_IN;
   /* reput the \n in place for debug */
   for (C_count=0; C_statement[C_count] != '\0'; C_count++)
     if (C_statement[C_count] == ';' || C_statement[C_count] == '{')
       semicolon_count++;
-  definition = (char*)gras_malloc(C_count + semicolon_count + 1);
+  definition = (char*)xbt_malloc(C_count + semicolon_count + 1);
   for (C_count=0,def_count=0; C_statement[C_count] != '\0'; C_count++) {
     definition[def_count++] = C_statement[C_count];
     if (C_statement[C_count] == ';' || C_statement[C_count] == '{') {
@@ -594,19 +594,19 @@ gras_datadesc_parse(const char            *name,
 
   } else {
     ERROR1("Failed to parse the following symbol (not a struct neither a typedef) :\n%s",definition);    
-    gras_abort();
+    xbt_abort();
   }
 
   gras_ddt_parse_pointer_string_close();
   VERB0("end of _gras_ddt_type_parse()");
-  gras_free(definition);
+  xbt_free(definition);
   /* register it under the name provided as symbol */
   if (strcmp(res->name,name)) {
     ERROR2("In GRAS_DEFINE_TYPE, the provided symbol (here %s) must be the C type name (here %s)",
           name,res->name);
-    gras_abort();
+    xbt_abort();
   }    
-  GRAS_OUT;
+  XBT_OUT;
   return res;
 }
 
index 88b38a4..f184f04 100644 (file)
@@ -441,7 +441,7 @@ char *yytext;
   int gras_ddt_parse_char_pos = 0;
   int gras_ddt_parse_tok_num = 0;
   const char *definition;
-  GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
+  XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
 #define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
 #define annotate 1
 #define comment 2
index 922ef58..79bf2fe 100644 (file)
@@ -53,7 +53,7 @@ void gras_ddt_parse_set_debug (int  bdebug );
 int gras_ddt_parse_lex_destroy  (void);
 
 #define PARSE_ERROR_PRE do {
-#define PARSE_ERROR_POST gras_abort();} while (0)
+#define PARSE_ERROR_POST xbt_abort();} while (0)
 
 #define PARSE_ERROR0(fmt)     PARSE_ERROR_PRE \
                               ERROR3(fmt " at %d:%d of :\n%s", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
index c976c97..c7a5097 100644 (file)
@@ -13,9 +13,9 @@
 #include "gras/Transport/transport_interface.h" /* gras_trp_chunk_send/recv */
 #include "gras/Virtu/virtu_interface.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(msg,gras,"High level messaging");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg,gras,"High level messaging");
 
-gras_set_t _gras_msgtype_set = NULL;
+xbt_set_t _gras_msgtype_set = NULL;
 static char GRAS_header[6];
 static char *make_namev(const char *name, short int ver);
 
@@ -25,7 +25,7 @@ static char *make_namev(const char *name, short int ver);
  * Initialize this submodule.
  */
 void gras_msg_init(void) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   
   /* only initialize once */
   if (_gras_msgtype_set != NULL)
@@ -33,7 +33,7 @@ void gras_msg_init(void) {
 
   VERB0("Initializing Msg");
   
-  _gras_msgtype_set = gras_set_new();
+  _gras_msgtype_set = xbt_set_new();
 
   memcpy(GRAS_header,"GRAS", 4);
   GRAS_header[4]=GRAS_PROTOCOL_VERSION;
@@ -48,7 +48,7 @@ void gras_msg_init(void) {
 void
 gras_msg_exit(void) {
   VERB0("Exiting Msg");
-  gras_set_free(&_gras_msgtype_set);
+  xbt_set_free(&_gras_msgtype_set);
 }
 
 /**
@@ -59,8 +59,8 @@ gras_msg_exit(void) {
 void gras_msgtype_free(void *t) {
   gras_msgtype_t msgtype=(gras_msgtype_t)t;
   if (msgtype) {
-    gras_free(msgtype->name);
-    gras_free(msgtype);
+    xbt_free(msgtype->name);
+    xbt_free(msgtype);
   }
 }
 
@@ -76,7 +76,7 @@ static char *make_namev(const char *name, short int ver) {
   if (!ver)
     return (char *)name;
 
-  namev = (char*)gras_malloc(strlen(name)+2+3+1);
+  namev = (char*)xbt_malloc(strlen(name)+2+3+1);
 
   if (namev)
       sprintf(namev,"%s_v%d",name,ver);
@@ -113,17 +113,17 @@ gras_msgtype_declare_v(const char           *name,
                       short int             version,
                       gras_datadesc_type_t  payload) {
  
-  gras_error_t   errcode;
+  xbt_error_t   errcode;
   gras_msgtype_t msgtype;
   char *namev=make_namev(name,version);
   
-  errcode = gras_set_get_by_name(_gras_msgtype_set,
-                                namev,(gras_set_elm_t*)&msgtype);
+  errcode = xbt_set_get_by_name(_gras_msgtype_set,
+                                namev,(xbt_set_elm_t*)&msgtype);
 
   if (errcode == no_error) {
     VERB2("Re-register version %d of message '%s' (same payload, ignored).",
          version, name);
-    gras_assert3(!gras_datadesc_type_cmp(msgtype->ctn_type, payload),
+    xbt_assert3(!gras_datadesc_type_cmp(msgtype->ctn_type, payload),
                 "Message %s re-registred with another payload (%s was %s)",
                 namev,gras_datadesc_get_name(payload),
                 gras_datadesc_get_name(msgtype->ctn_type));
@@ -131,17 +131,17 @@ gras_msgtype_declare_v(const char           *name,
     return ; /* do really ignore it */
 
   }
-  gras_assert_error(mismatch_error); /* expect this error */
+  xbt_assert_error(mismatch_error); /* expect this error */
   VERB3("Register version %d of message '%s' (payload: %s).", 
        version, name, gras_datadesc_get_name(payload));    
 
-  msgtype = gras_new(s_gras_msgtype_t,1);
+  msgtype = xbt_new(s_gras_msgtype_t,1);
   msgtype->name = (namev == name ? strdup(name) : namev);
   msgtype->name_len = strlen(namev);
   msgtype->version = version;
   msgtype->ctn_type = payload;
 
-  gras_set_add(_gras_msgtype_set, (gras_set_elm_t)msgtype,
+  xbt_set_add(_gras_msgtype_set, (xbt_set_elm_t)msgtype,
               &gras_msgtype_free);
 }
 
@@ -162,17 +162,17 @@ gras_msgtype_t gras_msgtype_by_namev(const char      *name,
                                     short int        version) {
   gras_msgtype_t res;
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char *namev = make_namev(name,version); 
 
-  errcode = gras_set_get_by_name(_gras_msgtype_set, namev,
-                                (gras_set_elm_t*)&res);
+  errcode = xbt_set_get_by_name(_gras_msgtype_set, namev,
+                                (xbt_set_elm_t*)&res);
   if (errcode != no_error)
     res = NULL;
   if (!res) 
      WARN1("msgtype_by_name(%s) returns NULL",namev);
   if (name != namev) 
-    gras_free(namev);
+    xbt_free(namev);
   
   return res;
 }
@@ -182,12 +182,12 @@ gras_msgtype_t gras_msgtype_by_namev(const char      *name,
  *
  * Send the given message on the given socket 
  */
-gras_error_t
+xbt_error_t
 gras_msg_send(gras_socket_t   sock,
              gras_msgtype_t  msgtype,
              void           *payload) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   static gras_datadesc_type_t string_type=NULL;
 
   if (!msgtype)
@@ -196,7 +196,7 @@ gras_msg_send(gras_socket_t   sock,
 
   if (!string_type) {
     string_type = gras_datadesc_by_name("string");
-    gras_assert(string_type);
+    xbt_assert(string_type);
   }
 
   DEBUG3("send '%s' to %s:%d", msgtype->name, 
@@ -214,13 +214,13 @@ gras_msg_send(gras_socket_t   sock,
  *
  * receive the next message on the given socket.  
  */
-gras_error_t
+xbt_error_t
 gras_msg_recv(gras_socket_t    sock,
              gras_msgtype_t  *msgtype,
              void           **payload,
              int             *payload_size) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   static gras_datadesc_type_t string_type=NULL;
   char header[6];
   int cpt;
@@ -229,7 +229,7 @@ gras_msg_recv(gras_socket_t    sock,
 
   if (!string_type) {
     string_type=gras_datadesc_by_name("string");
-    gras_assert(string_type);
+    xbt_assert(string_type);
   }
   
   TRY(gras_trp_chunk_recv(sock, header, 6));
@@ -244,21 +244,21 @@ gras_msg_recv(gras_socket_t    sock,
         (int)header[4],gras_datadesc_arch_name(r_arch));
 
   TRY(gras_datadesc_recv(sock, string_type, r_arch, &msg_name));
-  errcode = gras_set_get_by_name(_gras_msgtype_set,
-                                msg_name,(gras_set_elm_t*)msgtype);
+  errcode = xbt_set_get_by_name(_gras_msgtype_set,
+                                msg_name,(xbt_set_elm_t*)msgtype);
   if (errcode != no_error)
     RAISE2(errcode,
           "Got error %s while retrieving the type associated to messages '%s'",
-          gras_error_name(errcode),msg_name);
+          xbt_error_name(errcode),msg_name);
   /* FIXME: Survive unknown messages */
-  gras_free(msg_name);
+  xbt_free(msg_name);
 
   *payload_size=gras_datadesc_size((*msgtype)->ctn_type);
-  gras_assert2(*payload_size > 0,
+  xbt_assert2(*payload_size > 0,
               "%s %s",
               "Dynamic array as payload is forbided for now (FIXME?).",
               "Reference to dynamic array is allowed.");
-  *payload = gras_malloc(*payload_size);
+  *payload = xbt_malloc(*payload_size);
   TRY(gras_datadesc_recv(sock, (*msgtype)->ctn_type, r_arch, *payload));
 
   return no_error;
@@ -275,7 +275,7 @@ gras_msg_recv(gras_socket_t    sock,
  * Every message of another type received before the one waited will be queued
  * and used by subsequent call to this function or MsgHandle().
  */
-gras_error_t
+xbt_error_t
 gras_msg_wait(double           timeout,    
              gras_msgtype_t   msgt_want,
              gras_socket_t   *expeditor,
@@ -284,7 +284,7 @@ gras_msg_wait(double           timeout,
   gras_msgtype_t msgt_got;
   void *payload_got;
   int payload_size_got;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double start, now;
   gras_procdata_t *pd=gras_procdata_get();
   int cpt;
@@ -301,12 +301,12 @@ gras_msg_wait(double           timeout,
 
   start = now = gras_os_time();
 
-  gras_dynar_foreach(pd->msg_queue,cpt,msg){
+  xbt_dynar_foreach(pd->msg_queue,cpt,msg){
     if (msg.type->code == msgt_want->code) {
       *expeditor = msg.expeditor;
       memcpy(payload, msg.payload, msg.payload_size);
-      gras_free(msg.payload);
-      gras_dynar_cursor_rm(pd->msg_queue, &cpt);
+      xbt_free(msg.payload);
+      xbt_dynar_cursor_rm(pd->msg_queue, &cpt);
       VERB0("The waited message was queued");
       return no_error;
     }
@@ -317,7 +317,7 @@ gras_msg_wait(double           timeout,
     TRY(gras_msg_recv(*expeditor, &msgt_got, &payload_got, &payload_size_got));
     if (msgt_got->code == msgt_want->code) {
       memcpy(payload, payload_got, payload_size_got);
-      gras_free(payload_got);
+      xbt_free(payload_got);
       VERB0("Got waited message");
       return no_error;
     }
@@ -327,7 +327,7 @@ gras_msg_wait(double           timeout,
     msg.type      =  msgt_got;
     msg.payload   =  payload;
     msg.payload_size = payload_size_got;
-    gras_dynar_push(pd->msg_queue,&msg);
+    xbt_dynar_push(pd->msg_queue,&msg);
     
     now=gras_os_time();
     if (now - start + 0.001 < timeout) {
@@ -346,10 +346,10 @@ gras_msg_wait(double           timeout,
  * Waits up to #timeOut# seconds to see if a message comes in; if so, calls the
  * registered listener for that message (see RegisterCallback()).
  */
-gras_error_t 
+xbt_error_t 
 gras_msg_handle(double timeOut) {
   
-  gras_error_t    errcode;
+  xbt_error_t    errcode;
   int             cpt;
 
   gras_msg_t      msg;
@@ -367,8 +367,8 @@ gras_msg_handle(double timeOut) {
   VERB1("Handling message within the next %.2fs",timeOut);
   
   /* get a message (from the queue or from the net) */
-  if (gras_dynar_length(pd->msg_queue)) {
-    gras_dynar_shift(pd->msg_queue,&msg);
+  if (xbt_dynar_length(pd->msg_queue)) {
+    xbt_dynar_shift(pd->msg_queue,&msg);
     expeditor = msg.expeditor;
     msgtype   = msg.type;
     payload   = msg.payload;
@@ -379,7 +379,7 @@ gras_msg_handle(double timeOut) {
   }
       
   /* handle it */
-  gras_dynar_foreach(pd->cbl_list,cpt,list) {
+  xbt_dynar_foreach(pd->cbl_list,cpt,list) {
     if (list->id == msgtype->code) {
       break;
     } else {
@@ -393,12 +393,12 @@ gras_msg_handle(double timeOut) {
     return no_error;
   }
   
-  gras_dynar_foreach(list->cbs,cpt,cb) { 
+  xbt_dynar_foreach(list->cbs,cpt,cb) { 
     INFO3("Use the callback #%d (@%p) for incomming msg %s",
          cpt+1,cb,msgtype->name);
     if ((*cb)(expeditor,payload)) {
       /* cb handled the message */
-      gras_free(payload);
+      xbt_free(payload);
       return no_error;
     }
   }
@@ -412,8 +412,8 @@ void
 gras_cbl_free(void *data){
   gras_cblist_t *list=*(void**)data;
   if (list) {
-    gras_dynar_free(&( list->cbs ));
-    gras_free(list);
+    xbt_dynar_free(&( list->cbs ));
+    xbt_free(list);
   }
 }
 
@@ -427,7 +427,7 @@ gras_cb_register(gras_msgtype_t msgtype,
   DEBUG2("Register %p as callback to %s",cb,msgtype->name);
 
   /* search the list of cb for this message on this host (creating if NULL) */
-  gras_dynar_foreach(pd->cbl_list,cpt,list) {
+  xbt_dynar_foreach(pd->cbl_list,cpt,list) {
     if (list->id == msgtype->code) {
       break;
     } else {
@@ -436,14 +436,14 @@ gras_cb_register(gras_msgtype_t msgtype,
   }
   if (!list) {
     /* First cb? Create room */
-    list = gras_new(gras_cblist_t,1);
+    list = xbt_new(gras_cblist_t,1);
     list->id = msgtype->code;
-    list->cbs = gras_dynar_new(sizeof(gras_cb_t), NULL);
-    gras_dynar_push(pd->cbl_list,&list);
+    list->cbs = xbt_dynar_new(sizeof(gras_cb_t), NULL);
+    xbt_dynar_push(pd->cbl_list,&list);
   }
 
   /* Insert the new one into the set */
-  gras_dynar_insert_at(list->cbs,0,&cb);
+  xbt_dynar_insert_at(list->cbs,0,&cb);
 }
 
 void
@@ -457,7 +457,7 @@ gras_cb_unregister(gras_msgtype_t msgtype,
   int found = 0;
 
   /* search the list of cb for this message on this host */
-  gras_dynar_foreach(pd->cbl_list,cpt,list) {
+  xbt_dynar_foreach(pd->cbl_list,cpt,list) {
     if (list->id == msgtype->code) {
       break;
     } else {
@@ -467,9 +467,9 @@ gras_cb_unregister(gras_msgtype_t msgtype,
 
   /* Remove it from the set */
   if (list) {
-    gras_dynar_foreach(list->cbs,cpt,cb_cpt) {
+    xbt_dynar_foreach(list->cbs,cpt,cb_cpt) {
       if (cb == cb_cpt) {
-       gras_dynar_cursor_rm(list->cbs, &cpt);
+       xbt_dynar_cursor_rm(list->cbs, &cpt);
        found = 1;
       }
     }
index fd10834..d7f016f 100644 (file)
@@ -21,7 +21,7 @@ typedef struct {
   int             payload_size;
 } gras_msg_t;
 
-gras_error_t gras_msg_send_namev(gras_socket_t  sock, 
+xbt_error_t gras_msg_send_namev(gras_socket_t  sock, 
                                 const char    *namev, 
                                 void          *payload);
 
index 2cc7607..4d4b5a6 100644 (file)
@@ -45,11 +45,11 @@ typedef struct s_gras_msgtype {
   gras_datadesc_type_t ctn_type;
 } s_gras_msgtype_t;
 
-extern gras_set_t _gras_msgtype_set; /* of gras_msgtype_t */
+extern xbt_set_t _gras_msgtype_set; /* of gras_msgtype_t */
 void gras_msgtype_free(void *msgtype);
 
 
-gras_error_t gras_msg_recv(gras_socket_t    sock,
+xbt_error_t gras_msg_recv(gras_socket_t    sock,
                           gras_msgtype_t  *msgtype,
                           void           **payload,
                           int             *payload_size);
@@ -61,7 +61,7 @@ gras_error_t gras_msg_recv(gras_socket_t    sock,
  */
 struct s_gras_cblist {
   long int id;
-  gras_dynar_t cbs; /* of gras_msg_cb_t */
+  xbt_dynar_t cbs; /* of gras_msg_cb_t */
 };
 
 void gras_cblist_free(void *cbl);
index 9f7575e..f3d998d 100644 (file)
 #include "timeouts.h"
 #include "protocol.h"
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(rl,"Real Life");
+XBT_LOG_NEW_DEFAULT_CATEGORY(rl,"Real Life");
                              
 /* globals */
 static grasProcessData_t *_grasProcessData;
 
 /* Prototypes of internal functions */
 static int grasConversionRequired(const DataDescriptor *description, size_t howMany);
-static gras_error_t
+static xbt_error_t
 _gras_rawsock_exchange(gras_rawsock_t *sd, int sender, unsigned int timeout,
                       unsigned int expSize, unsigned int msgSize);
 
 
-gras_error_t gras_process_init() {
+xbt_error_t gras_process_init() {
   if (!(_grasProcessData=(grasProcessData_t *)malloc(sizeof(grasProcessData_t)))) {
     fprintf(stderr,"gras_process_init: cannot malloc %d bytes\n",sizeof(grasProcessData_t));
     return malloc_error;
@@ -52,7 +52,7 @@ gras_error_t gras_process_init() {
   _grasProcessData->userdata = NULL;
   return no_error;
 }
-gras_error_t gras_process_finalize() {
+xbt_error_t gras_process_finalize() {
   fprintf(stderr,"FIXME: %s not implemented (=> leaking on exit :)\n",__FUNCTION__);
   return no_error;
 }
@@ -60,7 +60,7 @@ gras_error_t gras_process_finalize() {
 /* **************************************************************************
  * Openning/Maintaining/Closing connexions
  * **************************************************************************/
-gras_error_t
+xbt_error_t
 gras_sock_client_open(const char *host, short port, 
                      /* OUT */ gras_sock_t **sock) {
 
@@ -94,7 +94,7 @@ gras_sock_client_open(const char *host, short port,
 }
 
 
-gras_error_t
+xbt_error_t
 gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
                      /* OUT */ gras_sock_t **sock) {
 
@@ -115,7 +115,7 @@ gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
   return no_error;
 }
 
-gras_error_t gras_sock_close(gras_sock_t *sock) {
+xbt_error_t gras_sock_close(gras_sock_t *sock) {
   if (sock) {
     DROP_SOCKET(&(sock->sock));
     if (sock->peer_addr) free(sock->peer_addr);
@@ -275,7 +275,7 @@ int grasDataRecv( gras_sock_t *sd,
   return recvResult;
 }
 
-gras_error_t grasDataSend(gras_sock_t *sd,
+xbt_error_t grasDataSend(gras_sock_t *sd,
                         const void *data,
                         const DataDescriptor *description,
                         size_t description_length,
@@ -331,7 +331,7 @@ gras_error_t grasDataSend(gras_sock_t *sd,
   return no_error;
 }
 
-gras_error_t
+xbt_error_t
 grasMsgRecv(gras_msg_t **msg,
            double timeOut) {
   int dummyldap;
@@ -464,17 +464,17 @@ grasMsgRecv(gras_msg_t **msg,
  * Send a message to the network
  */
 
-gras_error_t
+xbt_error_t
 gras_msg_send(gras_sock_t *sd,
            gras_msg_t *msg,
-           e_gras_free_directive_t freeDirective) {
+           e_xbt_free_directive_t freeDirective) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   int i;
 
   /* arg validity checks */
-  gras_assert0(msg,"Trying to send NULL message");
-  gras_assert0(sd, "Trying to send over a NULL socket");
+  xbt_assert0(msg,"Trying to send NULL message");
+  xbt_assert0(sd, "Trying to send over a NULL socket");
 
 
   fprintf(stderr,"Header to send=ver:'%s' msg:%d size:%d seqCount:%d\n",
@@ -486,7 +486,7 @@ gras_msg_send(gras_sock_t *sd,
                            msg->header,
                            headerDescriptor,headerDescriptorCount,1))) {
     fprintf(stderr,"gras_msg_send: Error '%s' while sending header of message %s to %s:%d\n",
-           gras_error_name(errcode),msg->entry->name,gras_sock_get_peer_name(sd),gras_sock_get_peer_port(sd));
+           xbt_error_name(errcode),msg->entry->name,gras_sock_get_peer_name(sd),gras_sock_get_peer_port(sd));
     return errcode;
   }
 
@@ -494,7 +494,7 @@ gras_msg_send(gras_sock_t *sd,
                            msg->dataCount,countDescriptor,countDescriptorCount,
                            msg->entry->seqCount))) {
     fprintf(stderr,"gras_msg_send: Error '%s' while sending sequence counts of message %s to %s\n",
-           gras_error_name(errcode),msg->entry->name,gras_sock_get_peer_name(sd));
+           xbt_error_name(errcode),msg->entry->name,gras_sock_get_peer_name(sd));
     return errcode;
   }
 
@@ -504,7 +504,7 @@ gras_msg_send(gras_sock_t *sd,
                              (const DataDescriptor*)msg->entry->dd[i],msg->entry->ddCount[i],
                              msg->dataCount[i]))) {
       fprintf(stderr,"gras_msg_send: Error '%s' while sending sequence %d of message %s to %s\n",
-             gras_error_name(errcode),i,msg->entry->name,gras_sock_get_peer_name(sd));
+             xbt_error_name(errcode),i,msg->entry->name,gras_sock_get_peer_name(sd));
       return errcode;
     }
   }  
@@ -524,7 +524,7 @@ void grasSockFree(gras_sock_t *s) {
 /* **************************************************************************
  * Creating/Using raw sockets
  * **************************************************************************/
-gras_error_t gras_rawsock_server_open(unsigned short startingPort, 
+xbt_error_t gras_rawsock_server_open(unsigned short startingPort, 
                                  unsigned short endingPort,
                                  unsigned int bufSize, gras_rawsock_t **sock) {
   struct sockaddr_in sockaddr;
@@ -576,7 +576,7 @@ void Dummy(int sig) {
   return;
 }
 
-gras_error_t gras_rawsock_client_open(const char *host, short port, 
+xbt_error_t gras_rawsock_client_open(const char *host, short port, 
                                  unsigned int bufSize, gras_rawsock_t **sock) {
   int i,addrCount;
   IPAddress addresses[10];
@@ -638,7 +638,7 @@ gras_error_t gras_rawsock_client_open(const char *host, short port,
   return no_error;
 }
 
-gras_error_t gras_rawsock_close(gras_rawsock_t *sd) {
+xbt_error_t gras_rawsock_close(gras_rawsock_t *sd) {
   if (sd) {
     CloseSocket(&(sd->sock), 0);
     free(sd);
@@ -652,7 +652,7 @@ unsigned short gras_rawsock_get_peer_port(gras_rawsock_t *sd) {
 }
 
 /* FIXME: RL ignores the provided timeout and compute an appropriate one */
-static gras_error_t
+static xbt_error_t
 _gras_rawsock_exchange(gras_rawsock_t *sd, int sender, unsigned int timeout,
                     unsigned int expSize, unsigned int msgSize){
   char *expData;
@@ -719,12 +719,12 @@ _gras_rawsock_exchange(gras_rawsock_t *sd, int sender, unsigned int timeout,
   return no_error;
 }
 
-gras_error_t
+xbt_error_t
 gras_rawsock_recv(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize, 
                unsigned int timeout) {
   return _gras_rawsock_exchange(sd,0,timeout,expSize,msgSize);
 }
-gras_error_t
+xbt_error_t
 gras_rawsock_send(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize){
   return _gras_rawsock_exchange(sd,1,0,expSize,msgSize);
 }
index 34d27af..39ed6d7 100644 (file)
@@ -113,7 +113,7 @@ grasDataRecv( gras_sock_t *sd,
  *
  * Send a sequence of data across the network
  */
-gras_error_t
+xbt_error_t
 grasDataSend(gras_sock_t *sd,
             const void *data,
             const DataDescriptor *description,
index cd24c8a..b8d220f 100644 (file)
 
 #include "gras_sg.h"
 
-GRAS_LOG_DEFAULT_CATEGORY(GRAS);
+XBT_LOG_DEFAULT_CATEGORY(GRAS);
 
 /* **************************************************************************
  * Openning/Maintaining/Closing connexions (private functions for both raw
  * and regular sockets)
  * **************************************************************************/
-gras_error_t
+xbt_error_t
 _gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
                      int raw, unsigned int bufSize, /* OUT */ gras_sock_t **sock) {
 
@@ -28,8 +28,8 @@ _gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
   int port,i;
   const char *host=MSG_host_get_name(MSG_host_self());
 
-  gras_assert0(hd,"HostData=NULL !! Please run grasInit on each process\n");
-  gras_assert0(pd,"ProcessData=NULL !! Please run grasInit on each process\n");
+  xbt_assert0(hd,"HostData=NULL !! Please run grasInit on each process\n");
+  xbt_assert0(pd,"ProcessData=NULL !! Please run grasInit on each process\n");
 
   for (port=startingPort ; port <= endingPort ; port++) {
     for (i=0; i<hd->portLen && hd->port[i] != port; i++);
@@ -88,7 +88,7 @@ _gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
   return mismatch_error;
 }
 
-gras_error_t
+xbt_error_t
 _gras_sock_client_open(const char *host, short port, int raw, unsigned int bufSize,
                     /* OUT */ gras_sock_t **sock) {
   m_host_t peer;
@@ -142,11 +142,11 @@ _gras_sock_client_open(const char *host, short port, int raw, unsigned int bufSi
   return no_error;
 }
 
-gras_error_t _gras_sock_close(int raw, gras_sock_t *sd) {
+xbt_error_t _gras_sock_close(int raw, gras_sock_t *sd) {
   gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
   int i;
 
-  gras_assert0(hd,"HostData=NULL !! Please run grasInit on each process\n");
+  xbt_assert0(hd,"HostData=NULL !! Please run grasInit on each process\n");
 
   if (!sd) return no_error;
   if (raw && !sd->raw_sock) {
@@ -177,19 +177,19 @@ gras_error_t _gras_sock_close(int raw, gras_sock_t *sd) {
 /* **************************************************************************
  * Creating/Using regular sockets
  * **************************************************************************/
-gras_error_t
+xbt_error_t
 gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
                     /* OUT */ gras_sock_t **sock) {
   return _gras_sock_server_open(startingPort,endingPort,0,0,sock);
 }
 
-gras_error_t
+xbt_error_t
 gras_sock_client_open(const char *host, short port,
                     /* OUT */ gras_sock_t **sock) {
   return _gras_sock_client_open(host,port,0,0,sock);
 }
 
-gras_error_t gras_sock_close(gras_sock_t *sd) {
+xbt_error_t gras_sock_close(gras_sock_t *sd) {
   return _gras_sock_close(0,sd);
 }
 
@@ -220,17 +220,17 @@ gras_sock_get_peer_name(gras_sock_t *sd) {
 /* **************************************************************************
  * Creating/Using raw sockets
  * **************************************************************************/
-gras_error_t gras_rawsock_server_open(unsigned short startingPort, unsigned short endingPort,
+xbt_error_t gras_rawsock_server_open(unsigned short startingPort, unsigned short endingPort,
                                  unsigned int bufSize, gras_rawsock_t **sock) {
   return _gras_sock_server_open(startingPort,endingPort,1,bufSize,(gras_sock_t**)sock);
 }
 
-gras_error_t gras_rawsock_client_open(const char *host, short port, 
+xbt_error_t gras_rawsock_client_open(const char *host, short port, 
                                  unsigned int bufSize, gras_rawsock_t **sock) {
   return _gras_sock_client_open(host,port,1,bufSize,(gras_sock_t**)sock);
 }
 
-gras_error_t gras_rawsock_close(gras_rawsock_t *sd) {
+xbt_error_t gras_rawsock_close(gras_rawsock_t *sd) {
   return _gras_sock_close(1,(gras_sock_t*)sd);
 }
 
@@ -240,14 +240,14 @@ gras_rawsock_get_peer_port(gras_rawsock_t *sd) {
   return sd->to_port;
 }
 
-gras_error_t
+xbt_error_t
 gras_rawsock_send(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSize) {
   unsigned int bytesTotal;
   static unsigned int count=0;
   m_task_t task=NULL;
   char name[256];
 
-  gras_assert0(sock->raw_sock,"Asked to send raw data on a regular socket\n");
+  xbt_assert0(sock->raw_sock,"Asked to send raw data on a regular socket\n");
 
   for(bytesTotal = 0;
       bytesTotal < expSize;
@@ -277,7 +277,7 @@ gras_rawsock_send(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSi
   return no_error;
 }
 
-gras_error_t
+xbt_error_t
 gras_rawsock_recv(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSize,
                unsigned int timeout) {
   grasProcessData_t *pd=(grasProcessData_t *)MSG_process_get_data(MSG_process_self());
@@ -285,7 +285,7 @@ gras_rawsock_recv(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSi
   m_task_t task=NULL;
   double startTime;
 
-  gras_assert0(sock->raw_sock,"Asked to receive raw data on a regular socket\n");
+  xbt_assert0(sock->raw_sock,"Asked to receive raw data on a regular socket\n");
 
   startTime=gras_time();
   for(bytesTotal = 0;
@@ -330,7 +330,7 @@ gras_rawsock_recv(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSi
  * Actually exchanging messages
  * **************************************************************************/
 
-gras_error_t
+xbt_error_t
 grasMsgRecv(gras_msg_t **msg,
            double timeOut) {
 
@@ -378,10 +378,10 @@ grasMsgRecv(gras_msg_t **msg,
   return timeout_error;
 }
 
-gras_error_t
+xbt_error_t
 gras_msg_send(gras_sock_t *sd,
            gras_msg_t *_msg,
-           e_gras_free_directive_t freeDirective) {
+           e_xbt_free_directive_t freeDirective) {
   
   grasProcessData_t *pd=grasProcessDataGet();
   m_task_t task;
@@ -391,8 +391,8 @@ gras_msg_send(gras_sock_t *sd,
   gras_sock_t *answer;
 
   /* arg validity checks */
-  gras_assert0(msg,"Trying to send NULL message");
-  gras_assert0(sd ,"Trying to send over a NULL socket");
+  xbt_assert0(msg,"Trying to send NULL message");
+  xbt_assert0(sd ,"Trying to send over a NULL socket");
   
   if (!(answer=(gras_sock_t*)malloc(sizeof(gras_sock_t)))) {
     RAISE_MALLOC;
index 04970c4..bd697f1 100644 (file)
@@ -14,8 +14,8 @@
 #include <sys/socket.h>
 
 #include "gras/Transport/transport_private.h"
-GRAS_LOG_EXTERNAL_CATEGORY(transport);
-GRAS_LOG_DEFAULT_CATEGORY(transport);
+XBT_LOG_EXTERNAL_CATEGORY(transport);
+XBT_LOG_DEFAULT_CATEGORY(transport);
 
 
 
@@ -30,12 +30,12 @@ GRAS_LOG_DEFAULT_CATEGORY(transport);
  *
  * if timeout>0 and no message there, wait at most that amount of time before giving up.
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_select(double timeout,
                gras_socket_t *dst) {
 
-  gras_error_t errcode;
-  gras_dynar_t sockets= gras_socketset_get();
+  xbt_error_t errcode;
+  xbt_dynar_t sockets= gras_socketset_get();
   int done = -1;
   double wakeup = gras_os_time() + 1000000*timeout;
   double now = 0;
@@ -62,7 +62,7 @@ gras_trp_select(double timeout,
 
     /* construct the set of socket to ear from */
     FD_ZERO(&FDS);
-    gras_dynar_foreach(sockets,cursor,sock_iter) {
+    xbt_dynar_foreach(sockets,cursor,sock_iter) {
       if (sock_iter->incoming) {
        if (max_fds < sock_iter->sd)
          max_fds = sock_iter->sd;
@@ -107,7 +107,7 @@ gras_trp_select(double timeout,
        RAISE3(system_error,"invalid select: nb fds: %d, timeout: %d.%d",
               max_fds, (int)tout.tv_sec,(int) tout.tv_usec);
       case ENOMEM: 
-       gras_assert0(0,"Malloc error during the select");
+       xbt_assert0(0,"Malloc error during the select");
       default:
        RAISE2(system_error,"Error during select: %s (%d)",
               strerror(errno),errno);
@@ -117,7 +117,7 @@ gras_trp_select(double timeout,
       continue;         /* this was a timeout */
     }
 
-    gras_dynar_foreach(sockets,cursor,sock_iter) { 
+    xbt_dynar_foreach(sockets,cursor,sock_iter) { 
        if(!FD_ISSET(sock_iter->sd, &FDS)) { /* this socket is not ready */
        continue;
        }
@@ -171,6 +171,6 @@ gras_trp_select(double timeout,
   return timeout_error;
 }
 
-gras_error_t gras_trp_sg_setup(gras_trp_plugin_t *plug) {
+xbt_error_t gras_trp_sg_setup(gras_trp_plugin_t *plug) {
   return mismatch_error;
 }
index 39adee9..75d2d4e 100644 (file)
@@ -12,8 +12,8 @@
 #include <msg.h>
 #include "gras/Virtu/virtu_sg.h"
 
-GRAS_LOG_EXTERNAL_CATEGORY(transport);
-GRAS_LOG_DEFAULT_CATEGORY(transport);
+XBT_LOG_EXTERNAL_CATEGORY(transport);
+XBT_LOG_DEFAULT_CATEGORY(transport);
 
 /**
  * gras_trp_select:
@@ -26,11 +26,11 @@ GRAS_LOG_DEFAULT_CATEGORY(transport);
  *
  * if timeout>0 and no message there, wait at most that amount of time before giving up.
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_select(double timeout, 
                gras_socket_t *dst) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   double startTime=gras_os_time();
   gras_procdata_t *pd=gras_procdata_get();
   gras_trp_sg_sock_data_t *sockdata;
@@ -52,7 +52,7 @@ gras_trp_select(double timeout,
     r_pid = MSG_task_probe_from((m_channel_t) pd->chan);
     if (r_pid >= 0) {
       /* Try to reuse an already openned socket to that expeditor */
-      gras_dynar_foreach(pd->sockets,cursor,sock_iter) {
+      xbt_dynar_foreach(pd->sockets,cursor,sock_iter) {
        DEBUG1("Consider %p as outgoing socket to expeditor",sock_iter);
        sockdata = sock_iter->data;
 
@@ -80,7 +80,7 @@ gras_trp_select(double timeout,
 
       (*dst)->port      = -1;
 
-      sockdata = gras_new(gras_trp_sg_sock_data_t,1);
+      sockdata = xbt_new(gras_trp_sg_sock_data_t,1);
       sockdata->from_PID = MSG_process_self_PID();
       sockdata->to_PID   = r_pid;
       sockdata->to_host  = MSG_process_get_host(MSG_process_from_PID(r_pid));
@@ -90,17 +90,17 @@ gras_trp_select(double timeout,
       (*dst)->peer_name = strdup(MSG_host_get_name(sockdata->to_host));
 
       remote_hd=(gras_hostdata_t *)MSG_host_get_data(sockdata->to_host);
-      gras_assert0(remote_hd,"Run gras_process_init!!");
+      xbt_assert0(remote_hd,"Run gras_process_init!!");
 
       sockdata->to_chan = -1;
       (*dst)->peer_port = -10;
-      for (cursor=0; cursor<GRAS_MAX_CHANNEL; cursor++) {
+      for (cursor=0; cursor<XBT_MAX_CHANNEL; cursor++) {
        if (remote_hd->proc[cursor] == r_pid) {
          sockdata->to_chan = cursor;
          DEBUG2("Chan %d on %s is for my pal",
                 cursor,(*dst)->peer_name);
 
-         gras_dynar_foreach(remote_hd->ports, cpt, pr) {
+         xbt_dynar_foreach(remote_hd->ports, cpt, pr) {
            if (sockdata->to_chan == pr.tochan) {
              if (pr.raw) {
                DEBUG0("Damn, it's raw");
@@ -124,7 +124,7 @@ gras_trp_select(double timeout,
          }
        }
       }
-      gras_assert0(sockdata->to_chan != -1,
+      xbt_assert0(sockdata->to_chan != -1,
                   "Got a message from a process without channel");
 
       return no_error;
@@ -147,10 +147,10 @@ gras_trp_select(double timeout,
   
 /* dummy implementations of the functions used in RL mode */
 
-gras_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug) {
+xbt_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug) {
   return mismatch_error;
 }
-gras_error_t gras_trp_file_setup(gras_trp_plugin_t *plug) {
+xbt_error_t gras_trp_file_setup(gras_trp_plugin_t *plug) {
   return mismatch_error;
 }
 
index 415218a..3c89e80 100644 (file)
 
 #include "gras/Transport/transport_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(transport,gras,"Conveying bytes over the network");
-GRAS_LOG_NEW_SUBCATEGORY(raw_trp,transport,"Conveying bytes over the network without formating");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(transport,gras,"Conveying bytes over the network");
+XBT_LOG_NEW_SUBCATEGORY(raw_trp,transport,"Conveying bytes over the network without formating");
 
-static gras_dict_t _gras_trp_plugins;      /* All registered plugins */
+static xbt_dict_t _gras_trp_plugins;      /* All registered plugins */
 static void gras_trp_plugin_free(void *p); /* free one of the plugins */
 
 static void gras_trp_socket_free(void *s); /* free one socket */
 
 static void
 gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
-  gras_trp_plugin_t *plug = gras_new0(gras_trp_plugin_t, 1);
+  gras_trp_plugin_t *plug = xbt_new0(gras_trp_plugin_t, 1);
   
   DEBUG1("Create plugin %s",name);
 
-  plug->name=gras_strdup(name);
+  plug->name=xbt_strdup(name);
 
   errcode = setup(plug);
   switch (errcode) {
   case mismatch_error:
     /* SG plugin return mismatch when in RL mode (and vice versa) */
-    gras_free(plug->name);
-    gras_free(plug);
+    xbt_free(plug->name);
+    xbt_free(plug);
     break;
 
   case no_error:
-    gras_dict_set(_gras_trp_plugins,
+    xbt_dict_set(_gras_trp_plugins,
                  name, plug, gras_trp_plugin_free);
     break;
 
@@ -49,7 +49,7 @@ gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
 
 void gras_trp_init(void){
   /* make room for all plugins */
-  _gras_trp_plugins=gras_dict_new();
+  _gras_trp_plugins=xbt_dict_new();
 
   /* Add them */
   gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
@@ -63,7 +63,7 @@ void gras_trp_init(void){
 
 void
 gras_trp_exit(void){
-  gras_dict_free(&_gras_trp_plugins);
+  xbt_dict_free(&_gras_trp_plugins);
 }
 
 
@@ -75,11 +75,11 @@ void gras_trp_plugin_free(void *p) {
       plug->exit(plug);
     } else if (plug->data) {
       DEBUG1("Plugin %s lacks exit(). Free data anyway.",plug->name);
-      gras_free(plug->data);
+      xbt_free(plug->data);
     }
 
-    gras_free(plug->name);
-    gras_free(plug);
+    xbt_free(plug->name);
+    xbt_free(plug);
   }
 }
 
@@ -92,7 +92,7 @@ void gras_trp_plugin_free(void *p) {
 void gras_trp_socket_new(int incoming,
                         gras_socket_t *dst) {
 
-  gras_socket_t sock=gras_new0(s_gras_socket_t,1);
+  gras_socket_t sock=xbt_new0(s_gras_socket_t,1);
 
   DEBUG1("Create a new socket (%p)", (void*)sock);
 
@@ -111,7 +111,7 @@ void gras_trp_socket_new(int incoming,
 
   *dst = sock;
 
-  gras_dynar_push(gras_socketset_get(),dst);
+  xbt_dynar_push(gras_socketset_get(),dst);
 }
 
 
@@ -121,7 +121,7 @@ void gras_trp_socket_new(int incoming,
  * Opens a server socket and make it ready to be listened to.
  * In real life, you'll get a TCP socket.
  */
-gras_error_t
+xbt_error_t
 gras_socket_server_ext(unsigned short port,
                       
                       unsigned long int bufSize,
@@ -129,7 +129,7 @@ gras_socket_server_ext(unsigned short port,
                       
                       /* OUT */ gras_socket_t *dst) {
  
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *trp;
   gras_socket_t sock;
 
@@ -155,7 +155,7 @@ gras_socket_server_ext(unsigned short port,
         sock->accepting?'y':'n');
 
   if (errcode != no_error) {
-    gras_free(sock);
+    xbt_free(sock);
     return errcode;
   }
 
@@ -170,7 +170,7 @@ gras_socket_server_ext(unsigned short port,
  * Opens a client socket to a remote host.
  * In real life, you'll get a TCP socket.
  */
-gras_error_t
+xbt_error_t
 gras_socket_client_ext(const char *host,
                       unsigned short port,
                       
@@ -179,7 +179,7 @@ gras_socket_client_ext(const char *host,
                       
                       /* OUT */ gras_socket_t *dst) {
  
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *trp;
   gras_socket_t sock;
 
@@ -204,7 +204,7 @@ gras_socket_client_ext(const char *host,
         sock->accepting?'y':'n');
 
   if (errcode != no_error) {
-    gras_free(sock);
+    xbt_free(sock);
     return errcode;
   }
 
@@ -219,7 +219,7 @@ gras_socket_client_ext(const char *host,
  * Opens a server socket and make it ready to be listened to.
  * In real life, you'll get a TCP socket.
  */
-gras_error_t
+xbt_error_t
 gras_socket_server(unsigned short port,
                   /* OUT */ gras_socket_t *dst) {
    return gras_socket_server_ext(port,32,0,dst);
@@ -231,7 +231,7 @@ gras_socket_server(unsigned short port,
  * Opens a client socket to a remote host.
  * In real life, you'll get a TCP socket.
  */
-gras_error_t
+xbt_error_t
 gras_socket_client(const char *host,
                   unsigned short port,
                   /* OUT */ gras_socket_t *dst) {
@@ -240,22 +240,22 @@ gras_socket_client(const char *host,
 
 
 void gras_socket_close(gras_socket_t sock) {
-  gras_dynar_t sockets = gras_socketset_get();
+  xbt_dynar_t sockets = gras_socketset_get();
   gras_socket_t sock_iter;
   int cursor;
 
   /* FIXME: Issue an event when the socket is closed */
   if (sock) {
-    gras_dynar_foreach(sockets,cursor,sock_iter) {
+    xbt_dynar_foreach(sockets,cursor,sock_iter) {
       if (sock == sock_iter) {
-       gras_dynar_cursor_rm(sockets,&cursor);
+       xbt_dynar_cursor_rm(sockets,&cursor);
        if ( sock->plugin->socket_close) 
          (* sock->plugin->socket_close)(sock);
 
        /* free the memory */
        if (sock->peer_name)
-         gras_free(sock->peer_name);
-       gras_free(sock);
+         xbt_free(sock->peer_name);
+       xbt_free(sock);
        return;
       }
     }
@@ -268,14 +268,14 @@ void gras_socket_close(gras_socket_t sock) {
  *
  * Send a bunch of bytes from on socket
  */
-gras_error_t
+xbt_error_t
 gras_trp_chunk_send(gras_socket_t sd,
                    char *data,
                    long int size) {
-  gras_assert1(sd->outgoing,
+  xbt_assert1(sd->outgoing,
               "Socket not suited for data send (outgoing=%c)",
               sd->outgoing?'y':'n');
-  gras_assert1(sd->plugin->chunk_send,
+  xbt_assert1(sd->plugin->chunk_send,
               "No function chunk_send on transport plugin %s",
               sd->plugin->name);
   return (*sd->plugin->chunk_send)(sd,data,size);
@@ -285,13 +285,13 @@ gras_trp_chunk_send(gras_socket_t sd,
  *
  * Receive a bunch of bytes from a socket
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_chunk_recv(gras_socket_t sd,
                    char *data,
                    long int size) {
-  gras_assert0(sd->incoming,
+  xbt_assert0(sd->incoming,
               "Socket not suited for data receive");
-  gras_assert1(sd->plugin->chunk_recv,
+  xbt_assert1(sd->plugin->chunk_recv,
               "No function chunk_recv on transport plugin %s",
               sd->plugin->name);
   return (sd->plugin->chunk_recv)(sd,data,size);
@@ -302,16 +302,16 @@ gras_trp_chunk_recv(gras_socket_t sd,
  *
  * Make sure all pending communications are done
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_flush(gras_socket_t sd) {
   return (sd->plugin->flush)(sd);
 }
 
-gras_error_t
+xbt_error_t
 gras_trp_plugin_get_by_name(const char *name,
                            gras_trp_plugin_t **dst){
 
-  return gras_dict_get(_gras_trp_plugins,name,(void**)dst);
+  return xbt_dict_get(_gras_trp_plugins,name,(void**)dst);
 }
 
 int   gras_socket_my_port  (gras_socket_t sock) {
@@ -324,15 +324,15 @@ char *gras_socket_peer_name(gras_socket_t sock) {
   return sock->peer_name;
 }
 
-gras_error_t gras_socket_raw_send(gras_socket_t peer, 
+xbt_error_t gras_socket_raw_send(gras_socket_t peer, 
                                  unsigned int timeout,
                                  unsigned long int exp_size, 
                                  unsigned long int msg_size) {
-  gras_error_t errcode;
-  char *chunk = gras_malloc(msg_size);
+  xbt_error_t errcode;
+  char *chunk = xbt_malloc(msg_size);
   int exp_sofar;
    
-  gras_assert0(peer->raw,"Asked to send raw data on a regular socket");
+  xbt_assert0(peer->raw,"Asked to send raw data on a regular socket");
   for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) {
      CDEBUG5(raw_trp,"Sent %d of %lu (msg_size=%ld) to %s:%d",
             exp_sofar,exp_size,msg_size,
@@ -343,20 +343,20 @@ gras_error_t gras_socket_raw_send(gras_socket_t peer,
          exp_sofar,exp_size,msg_size,
          gras_socket_peer_name(peer), gras_socket_peer_port(peer));
             
-  gras_free(chunk);
+  xbt_free(chunk);
   return no_error;//gras_socket_raw_exchange(peer,1,timeout,expSize,msgSize);   
 }
 
-gras_error_t gras_socket_raw_recv(gras_socket_t peer, 
+xbt_error_t gras_socket_raw_recv(gras_socket_t peer, 
                                  unsigned int timeout,
                                  unsigned long int exp_size, 
                                  unsigned long int msg_size){
   
-  gras_error_t errcode;
-  char *chunk = gras_malloc(msg_size);
+  xbt_error_t errcode;
+  char *chunk = xbt_malloc(msg_size);
   int exp_sofar;
 
-  gras_assert0(peer->raw,"Asked to recveive raw data on a regular socket\n");
+  xbt_assert0(peer->raw,"Asked to recveive raw data on a regular socket\n");
   for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) {
      CDEBUG5(raw_trp,"Recvd %d of %lu (msg_size=%ld) from %s:%d",
             exp_sofar,exp_size,msg_size,
@@ -367,6 +367,6 @@ gras_error_t gras_socket_raw_recv(gras_socket_t peer,
          exp_sofar,exp_size,msg_size,
          gras_socket_peer_name(peer), gras_socket_peer_port(peer));
 
-  gras_free(chunk);
+  xbt_free(chunk);
   return no_error;//gras_socket_raw_exchange(peer,0,timeout,expSize,msgSize);   
 }
index d2dade3..5cc5aab 100644 (file)
 /***
  *** Main user functions
  ***/
-gras_error_t gras_trp_chunk_send(gras_socket_t sd,
+xbt_error_t gras_trp_chunk_send(gras_socket_t sd,
                                 char *data,
                                 long int size);
-gras_error_t gras_trp_chunk_recv(gras_socket_t sd,
+xbt_error_t gras_trp_chunk_recv(gras_socket_t sd,
                                 char *data,
                                 long int size);
-gras_error_t gras_trp_flush(gras_socket_t sd);
+xbt_error_t gras_trp_flush(gras_socket_t sd);
 
 /* Find which socket needs to be read next */
-gras_error_t 
+xbt_error_t 
 gras_trp_select(double timeout,
                gras_socket_t *dst);
 
@@ -44,12 +44,12 @@ struct gras_trp_plugin_ {
   /* dst pointers are created and initialized with default values
      before call to socket_client/server. 
      Retrive the info you need from there. */
-  gras_error_t (*socket_client)(gras_trp_plugin_t *self,
+  xbt_error_t (*socket_client)(gras_trp_plugin_t *self,
                                gras_socket_t      dst);
-  gras_error_t (*socket_server)(gras_trp_plugin_t *self,
+  xbt_error_t (*socket_server)(gras_trp_plugin_t *self,
                                gras_socket_t      dst);
    
-  gras_error_t (*socket_accept)(gras_socket_t  sock,
+  xbt_error_t (*socket_accept)(gras_socket_t  sock,
                                gras_socket_t *dst);
    
    
@@ -57,15 +57,15 @@ struct gras_trp_plugin_ {
     but should not free the socket itself (beside the specific part) */
   void         (*socket_close)(gras_socket_t sd);
     
-  gras_error_t (*chunk_send)(gras_socket_t sd,
+  xbt_error_t (*chunk_send)(gras_socket_t sd,
                             const char *data,
                             long int size);
-  gras_error_t (*chunk_recv)(gras_socket_t sd,
+  xbt_error_t (*chunk_recv)(gras_socket_t sd,
                             char *data,
                             long int size);
 
   /* flush has to make sure that the pending communications are achieved */
-  gras_error_t (*flush)(gras_socket_t sd);
+  xbt_error_t (*flush)(gras_socket_t sd);
 
   void          *data; /* plugin-specific data */
  
@@ -74,7 +74,7 @@ struct gras_trp_plugin_ {
   void         (*exit)(gras_trp_plugin_t *);
 };
 
-gras_error_t
+xbt_error_t
 gras_trp_plugin_get_by_name(const char *name,
                            gras_trp_plugin_t **dst);
 
index ea7f095..e19f2ea 100644 (file)
 #include "xbt/misc.h"
 #include "transport_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_buf,transport,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(trp_buf,transport,
       "Generic buffered transport (works on top of TCP or SG)");
 
 /***
  *** Prototypes 
  ***/
-gras_error_t gras_trp_buf_socket_client(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_buf_socket_client(gras_trp_plugin_t *self,
                                        gras_socket_t sock);
-gras_error_t gras_trp_buf_socket_server(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_buf_socket_server(gras_trp_plugin_t *self,
                                        gras_socket_t sock);
-gras_error_t gras_trp_buf_socket_accept(gras_socket_t sock,
+xbt_error_t gras_trp_buf_socket_accept(gras_socket_t sock,
                                        gras_socket_t *dst);
 
 void         gras_trp_buf_socket_close(gras_socket_t sd);
   
-gras_error_t gras_trp_buf_chunk_send(gras_socket_t sd,
+xbt_error_t gras_trp_buf_chunk_send(gras_socket_t sd,
                                     const char *data,
                                     long int size);
 
-gras_error_t gras_trp_buf_chunk_recv(gras_socket_t sd,
+xbt_error_t gras_trp_buf_chunk_recv(gras_socket_t sd,
                                     char *data,
                                     long int size);
-gras_error_t gras_trp_buf_flush(gras_socket_t sock);
+xbt_error_t gras_trp_buf_flush(gras_socket_t sock);
 
 
 /***
@@ -65,17 +65,17 @@ struct gras_trp_bufdata_{
 };
 
 void gras_trp_buf_init_sock(gras_socket_t sock) {
-  gras_trp_bufdata_t *data=gras_new(gras_trp_bufdata_t,1);
+  gras_trp_bufdata_t *data=xbt_new(gras_trp_bufdata_t,1);
   
-  GRAS_IN;
+  XBT_IN;
   data->buffsize = 100 * 1024 ; /* 100k */ 
 
   data->in.size  = 0;
-  data->in.data  = gras_malloc(data->buffsize);
+  data->in.data  = xbt_malloc(data->buffsize);
   data->in.pos   = 0; /* useless, indeed, since size==pos */
    
   data->out.size = 0;
-  data->out.data = gras_malloc(data->buffsize);
+  data->out.data = xbt_malloc(data->buffsize);
   data->out.pos  = 0;
    
   sock->bufdata = data;
@@ -85,12 +85,12 @@ void gras_trp_buf_init_sock(gras_socket_t sock) {
 /***
  *** Code
  ***/
-gras_error_t
+xbt_error_t
 gras_trp_buf_setup(gras_trp_plugin_t *plug) {
-  gras_error_t errcode;
-  gras_trp_buf_plug_data_t *data =gras_new(gras_trp_buf_plug_data_t,1);
+  xbt_error_t errcode;
+  gras_trp_buf_plug_data_t *data =xbt_new(gras_trp_buf_plug_data_t,1);
 
-  GRAS_IN;
+  XBT_IN;
   TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "tcp" : "sg",
                                  &(data->super)));
   DEBUG1("Derivate a buffer plugin from %s",gras_if_RL() ? "tcp" : "sg");
@@ -111,12 +111,12 @@ gras_trp_buf_setup(gras_trp_plugin_t *plug) {
   return no_error;
 }
 
-gras_error_t gras_trp_buf_socket_client(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_buf_socket_client(gras_trp_plugin_t *self,
                                        /* OUT */ gras_socket_t sock){
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *super=((gras_trp_buf_plug_data_t*)self->data)->super;
 
-  GRAS_IN;
+  XBT_IN;
   TRY(super->socket_client(super,sock));
   sock->plugin = self;
   gras_trp_buf_init_sock(sock);
@@ -129,25 +129,25 @@ gras_error_t gras_trp_buf_socket_client(gras_trp_plugin_t *self,
  *
  * Open a socket used to receive messages.
  */
-gras_error_t gras_trp_buf_socket_server(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_buf_socket_server(gras_trp_plugin_t *self,
                                        /* OUT */ gras_socket_t sock){
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *super=((gras_trp_buf_plug_data_t*)self->data)->super;
 
-  GRAS_IN;
+  XBT_IN;
   TRY(super->socket_server(super,sock));
   sock->plugin = self;
   gras_trp_buf_init_sock(sock);
   return no_error;
 }
 
-gras_error_t
+xbt_error_t
 gras_trp_buf_socket_accept(gras_socket_t  sock,
                           gras_socket_t *dst) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *super=((gras_trp_buf_plug_data_t*)sock->plugin->data)->super;
       
-  GRAS_IN;
+  XBT_IN;
   TRY(super->socket_accept(sock,dst));
   (*dst)->plugin = sock->plugin;
   gras_trp_buf_init_sock(*dst);
@@ -158,14 +158,14 @@ void gras_trp_buf_socket_close(gras_socket_t sock){
   gras_trp_plugin_t *super=((gras_trp_buf_plug_data_t*)sock->plugin->data)->super;
   gras_trp_bufdata_t *data=sock->bufdata;
 
-  GRAS_IN;
+  XBT_IN;
   if (data->in.size || data->out.size)
     gras_trp_buf_flush(sock);
   if (data->in.data)
-    gras_free(data->in.data);
+    xbt_free(data->in.data);
   if (data->out.data)
-    gras_free(data->out.data);
-  gras_free(data);
+    xbt_free(data->out.data);
+  xbt_free(data);
 
   super->socket_close(sock);
 }
@@ -175,18 +175,18 @@ void gras_trp_buf_socket_close(gras_socket_t sock){
  *
  * Send data on a TCP socket
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_buf_chunk_send(gras_socket_t sock,
                        const char *chunk,
                        long int size) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_bufdata_t *data=(gras_trp_bufdata_t*)sock->bufdata;
   int chunk_pos=0;
 
-  GRAS_IN;
+  XBT_IN;
   /* Let underneath plugin check for direction, we work even in duplex */
-  gras_assert0(size >= 0, "Cannot send a negative amount of data");
+  xbt_assert0(size >= 0, "Cannot send a negative amount of data");
 
   while (chunk_pos < size) {
     /* size of the chunck to receive in that shot */
@@ -207,7 +207,7 @@ gras_trp_buf_chunk_send(gras_socket_t sock,
       TRY(gras_trp_buf_flush(sock));
   }
 
-  GRAS_OUT;
+  XBT_OUT;
   return no_error;
 }
 
@@ -216,21 +216,21 @@ gras_trp_buf_chunk_send(gras_socket_t sock,
  *
  * Receive data on a TCP socket.
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_buf_chunk_recv(gras_socket_t sock,
                        char *chunk,
                        long int size) {
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *super=((gras_trp_buf_plug_data_t*)sock->plugin->data)->super;
   gras_trp_bufdata_t *data=sock->bufdata;
   long int chunck_pos = 0;
 
   /* Let underneath plugin check for direction, we work even in duplex */
-  gras_assert0(sock, "Cannot recv on an NULL socket");
-  gras_assert0(size >= 0, "Cannot receive a negative amount of data");
+  xbt_assert0(sock, "Cannot recv on an NULL socket");
+  xbt_assert0(size >= 0, "Cannot receive a negative amount of data");
   
-  GRAS_IN;
+  XBT_IN;
 
   while (chunck_pos < size) {
     /* size of the chunck to receive in that shot */
@@ -259,7 +259,7 @@ gras_trp_buf_chunk_recv(gras_socket_t sock,
           data->in.pos,size - chunck_pos,size,(int)chunck_pos,chunk);
   }
 
-  GRAS_OUT;
+  XBT_OUT;
   return no_error;
 }
 
@@ -268,14 +268,14 @@ gras_trp_buf_chunk_recv(gras_socket_t sock,
  *
  * Make sure the data is sent
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_buf_flush(gras_socket_t sock) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   uint32_t size;
   gras_trp_plugin_t *super=((gras_trp_buf_