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_plug_data_t*)sock->plugin->data)->super;
   gras_trp_bufdata_t *data=sock->bufdata;
 
-  GRAS_IN;
+  XBT_IN;
   size = htonl(data->out.size);
   DEBUG1("Send the size (=%d)",data->out.size);
   TRY(super->chunk_send(sock,(char*) &size, 4));
index 36cb896..391d60d 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "transport_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport,
        "Pseudo-transport to write to/read from a file");
 
 /***
@@ -25,11 +25,11 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport,
  ***/
 void         gras_trp_file_close(gras_socket_t sd);
   
-gras_error_t gras_trp_file_chunk_send(gras_socket_t sd,
+xbt_error_t gras_trp_file_chunk_send(gras_socket_t sd,
                                      const char *data,
                                      long int size);
 
-gras_error_t gras_trp_file_chunk_recv(gras_socket_t sd,
+xbt_error_t gras_trp_file_chunk_recv(gras_socket_t sd,
                                      char *data,
                                      long int size);
 
@@ -51,10 +51,10 @@ typedef struct {
 /***
  *** Code
  ***/
-gras_error_t
+xbt_error_t
 gras_trp_file_setup(gras_trp_plugin_t *plug) {
 
-  gras_trp_file_plug_data_t *file = gras_new(gras_trp_file_plug_data_t,1);
+  gras_trp_file_plug_data_t *file = xbt_new(gras_trp_file_plug_data_t,1);
 
   FD_ZERO(&(file->incoming_socks));
 
@@ -73,13 +73,13 @@ gras_trp_file_setup(gras_trp_plugin_t *plug) {
  *
  * This only possible in RL, and is mainly for debugging.
  */
-gras_error_t
+xbt_error_t
 gras_socket_client_from_file(const char*path,
                             /* OUT */ gras_socket_t *dst) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *trp;
 
-  gras_assert0(gras_if_RL(),
+  xbt_assert0(gras_if_RL(),
               "Cannot use file as socket in the simulator");
 
   gras_trp_socket_new(0,dst);
@@ -116,13 +116,13 @@ gras_socket_client_from_file(const char*path,
  *
  * This only possible in RL, and is mainly for debugging.
  */
-gras_error_t
+xbt_error_t
 gras_socket_server_from_file(const char*path,
                             /* OUT */ gras_socket_t *dst) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_trp_plugin_t *trp;
 
-  gras_assert0(gras_if_RL(),
+  xbt_assert0(gras_if_RL(),
               "Cannot use file as socket in the simulator");
 
   gras_trp_socket_new(1,dst);
@@ -181,13 +181,13 @@ void gras_trp_file_close(gras_socket_t sock){
  *
  * Send data on a file pseudo-socket
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_file_chunk_send(gras_socket_t sock,
                         const char *data,
                         long int size) {
   
-  gras_assert0(sock->outgoing, "Cannot write on client file socket");
-  gras_assert0(size >= 0, "Cannot send a negative amount of data");
+  xbt_assert0(sock->outgoing, "Cannot write on client file socket");
+  xbt_assert0(size >= 0, "Cannot send a negative amount of data");
 
   while (size) {
     int status = 0;
@@ -216,14 +216,14 @@ gras_trp_file_chunk_send(gras_socket_t sock,
  *
  * Receive data on a file pseudo-socket.
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_file_chunk_recv(gras_socket_t sock,
                        char *data,
                        long int size) {
 
-  gras_assert0(sock, "Cannot recv on an NULL socket");
-  gras_assert0(sock->incoming, "Cannot recv on client file socket");
-  gras_assert0(size >= 0, "Cannot receive a negative amount of data");
+  xbt_assert0(sock, "Cannot recv on an NULL socket");
+  xbt_assert0(sock->incoming, "Cannot recv on client file socket");
+  xbt_assert0(size >= 0, "Cannot receive a negative amount of data");
   
   while (size) {
     int status = 0;
index 3ed5e64..70dd247 100644 (file)
 #include "transport_private.h"
 #include "gras/Virtu/virtu_sg.h"
 
-GRAS_LOG_EXTERNAL_CATEGORY(transport);
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_sg,transport,"SimGrid pseudo-transport");
+XBT_LOG_EXTERNAL_CATEGORY(transport);
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(trp_sg,transport,"SimGrid pseudo-transport");
 
 /***
  *** Prototypes 
  ***/
 /* retrieve the port record associated to a numerical port on an host */
-static gras_error_t find_port(gras_hostdata_t *hd, int port,
+static xbt_error_t find_port(gras_hostdata_t *hd, int port,
                              gras_sg_portrec_t *hpd);
 
 
-gras_error_t gras_trp_sg_socket_client(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_sg_socket_client(gras_trp_plugin_t *self,
                                       /* OUT */ gras_socket_t sock);
-gras_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
                                       /* OUT */ gras_socket_t sock);
 void         gras_trp_sg_socket_close(gras_socket_t sd);
 
-gras_error_t gras_trp_sg_chunk_send(gras_socket_t sd,
+xbt_error_t gras_trp_sg_chunk_send(gras_socket_t sd,
                                    const char *data,
                                    long int size);
 
-gras_error_t gras_trp_sg_chunk_recv(gras_socket_t sd,
+xbt_error_t gras_trp_sg_chunk_recv(gras_socket_t sd,
                                    char *data,
                                    long int size);
 
@@ -53,14 +53,14 @@ typedef struct {
 /***
  *** Code
  ***/
-static gras_error_t find_port(gras_hostdata_t *hd, int port,
+static xbt_error_t find_port(gras_hostdata_t *hd, int port,
                              gras_sg_portrec_t *hpd) {
   int cpt;
   gras_sg_portrec_t pr;
 
-  gras_assert0(hd,"Please run gras_process_init on each process");
+  xbt_assert0(hd,"Please run gras_process_init on each process");
   
-  gras_dynar_foreach(hd->ports, cpt, pr) {
+  xbt_dynar_foreach(hd->ports, cpt, pr) {
     if (pr.port == port) {
       memcpy(hpd,&pr,sizeof(gras_sg_portrec_t));
       return no_error;
@@ -70,10 +70,10 @@ static gras_error_t find_port(gras_hostdata_t *hd, int port,
 }
 
 
-gras_error_t
+xbt_error_t
 gras_trp_sg_setup(gras_trp_plugin_t *plug) {
 
-  gras_trp_sg_plug_data_t *data=gras_new(gras_trp_sg_plug_data_t,1);
+  gras_trp_sg_plug_data_t *data=xbt_new(gras_trp_sg_plug_data_t,1);
 
   plug->data      = data; 
 
@@ -89,10 +89,10 @@ gras_trp_sg_setup(gras_trp_plugin_t *plug) {
   return no_error;
 }
 
-gras_error_t gras_trp_sg_socket_client(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_sg_socket_client(gras_trp_plugin_t *self,
                                       /* OUT */ gras_socket_t sock){
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   m_host_t peer;
   gras_hostdata_t *hd;
@@ -131,7 +131,7 @@ gras_error_t gras_trp_sg_socket_client(gras_trp_plugin_t *self,
   }
 
   /* create the socket */
-  data = gras_new(gras_trp_sg_sock_data_t,1);
+  data = xbt_new(gras_trp_sg_sock_data_t,1);
   data->from_PID     = MSG_process_self_PID();
   data->to_PID       = hd->proc[ pr.tochan ];
   data->to_host      = peer;
@@ -148,10 +148,10 @@ gras_error_t gras_trp_sg_socket_client(gras_trp_plugin_t *self,
   return no_error;
 }
 
-gras_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
                                       gras_socket_t sock){
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
   gras_procdata_t *pd=gras_procdata_get();
@@ -160,7 +160,7 @@ gras_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
   
   const char *host=MSG_host_get_name(MSG_host_self());
 
-  gras_assert0(hd,"Please run gras_process_init on each process");
+  xbt_assert0(hd,"Please run gras_process_init on each process");
 
   sock->accepting = 0; /* no such nuisance in SG */
 
@@ -176,7 +176,7 @@ gras_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
     pr.tochan = sock->raw ? pd->rawChan : pd->chan;
     pr.port   = sock->port;
     pr.raw    = sock->raw;
-    gras_dynar_push(hd->ports,&pr);
+    xbt_dynar_push(hd->ports,&pr);
     break;
     
   default:
@@ -184,7 +184,7 @@ gras_error_t gras_trp_sg_socket_server(gras_trp_plugin_t *self,
   }
   
   /* Create the socket */
-  data = gras_new(gras_trp_sg_sock_data_t,1);
+  data = xbt_new(gras_trp_sg_sock_data_t,1);
   data->from_PID     = -1;
   data->to_PID       = MSG_process_self_PID();
   data->to_host      = MSG_host_self();
@@ -206,17 +206,17 @@ void gras_trp_sg_socket_close(gras_socket_t sock){
   gras_sg_portrec_t pr;
 
   if (!sock) return;
-  gras_assert0(hd,"Please run gras_process_init on each process");
+  xbt_assert0(hd,"Please run gras_process_init on each process");
 
   if (sock->data)
-    gras_free(sock->data);
+    xbt_free(sock->data);
 
   if (sock->incoming) {
     /* server mode socket. Un register it from 'OS' tables */
-    gras_dynar_foreach(hd->ports, cpt, pr) {
-      DEBUG2("Check pr %d of %lu", cpt, gras_dynar_length(hd->ports));
+    xbt_dynar_foreach(hd->ports, cpt, pr) {
+      DEBUG2("Check pr %d of %lu", cpt, xbt_dynar_length(hd->ports));
       if (pr.port == sock->port) {
-       gras_dynar_cursor_rm(hd->ports, &cpt);
+       xbt_dynar_cursor_rm(hd->ports, &cpt);
        return;
       }
     }
@@ -229,7 +229,7 @@ typedef struct {
   void *data;
 } sg_task_data_t;
 
-gras_error_t gras_trp_sg_chunk_send(gras_socket_t sock,
+xbt_error_t gras_trp_sg_chunk_send(gras_socket_t sock,
                                    const char *data,
                                    long int size) {
   m_task_t task=NULL;
@@ -240,8 +240,8 @@ gras_error_t gras_trp_sg_chunk_send(gras_socket_t sock,
   
   sprintf(name,"Chunk[%d]",count++);
 
-  task_data=gras_new(sg_task_data_t,1);
-  task_data->data=(void*)gras_malloc(size);
+  task_data=xbt_new(sg_task_data_t,1);
+  task_data->data=(void*)xbt_malloc(size);
   task_data->size = size;
   memcpy(task_data->data,data,size);
 
@@ -257,7 +257,7 @@ gras_error_t gras_trp_sg_chunk_send(gras_socket_t sock,
   return no_error;
 }
 
-gras_error_t gras_trp_sg_chunk_recv(gras_socket_t sock,
+xbt_error_t gras_trp_sg_chunk_recv(gras_socket_t sock,
                                    char *data,
                                    long int size){
   gras_procdata_t *pd=gras_procdata_get();
@@ -266,7 +266,7 @@ gras_error_t gras_trp_sg_chunk_recv(gras_socket_t sock,
   sg_task_data_t *task_data;
   gras_trp_sg_sock_data_t *sock_data = sock->data;
 
-  GRAS_IN;
+  XBT_IN;
   DEBUG4("recv chunk on %s ->  %s:%d (size=%ld)",
         MSG_host_get_name(sock_data->to_host),
         MSG_host_get_name(MSG_host_self()), sock_data->to_chan, size);
@@ -281,18 +281,18 @@ gras_error_t gras_trp_sg_chunk_recv(gras_socket_t sock,
           MSG_host_get_name(sock_data->to_host),
           MSG_host_get_name(MSG_host_self()), sock_data->to_chan);
   memcpy(data,task_data->data,size);
-  gras_free(task_data->data);
-  gras_free(task_data);
+  xbt_free(task_data->data);
+  xbt_free(task_data);
 
   if (MSG_task_destroy(task) != MSG_OK)
     RAISE0(unknown_error,"Error in MSG_task_destroy()");
 
-  GRAS_OUT;
+  XBT_OUT;
   return no_error;
 }
 
 /* Data exchange over raw sockets */
-gras_error_t gras_socket_raw_exchange(gras_socket_t peer,
+xbt_error_t gras_socket_raw_exchange(gras_socket_t peer,
                                      int sender,
                                      unsigned int timeout,
                                      unsigned long int expSize,
index d502ce1..c5cb397 100644 (file)
 
 #include "transport_private.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_tcp,transport,"TCP transport");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(trp_tcp,transport,"TCP transport");
 
 /***
  *** Prototypes 
  ***/
-gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
                                        gras_socket_t sock);
-gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
                                        gras_socket_t sock);
-gras_error_t gras_trp_tcp_socket_accept(gras_socket_t  sock,
+xbt_error_t gras_trp_tcp_socket_accept(gras_socket_t  sock,
                                        gras_socket_t *dst);
 
 void         gras_trp_tcp_socket_close(gras_socket_t sd);
   
-gras_error_t gras_trp_tcp_chunk_send(gras_socket_t sd,
+xbt_error_t gras_trp_tcp_chunk_send(gras_socket_t sd,
                                     const char *data,
                                     long int size);
 
-gras_error_t gras_trp_tcp_chunk_recv(gras_socket_t sd,
+xbt_error_t gras_trp_tcp_chunk_recv(gras_socket_t sd,
                                     char *data,
                                     long int size);
 
@@ -70,9 +70,9 @@ typedef struct {
 /***
  *** Code
  ***/
-gras_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug) {
+xbt_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug) {
 
-  gras_trp_tcp_plug_data_t *data = gras_new(gras_trp_tcp_plug_data_t,1);
+  gras_trp_tcp_plug_data_t *data = xbt_new(gras_trp_tcp_plug_data_t,1);
 
   FD_ZERO(&(data->msg_socks));
   FD_ZERO(&(data->raw_socks));
@@ -95,10 +95,10 @@ gras_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug) {
 
 void gras_trp_tcp_exit(gras_trp_plugin_t *plug) {
   DEBUG1("Exit plugin TCP (free %p)", plug->data);
-  gras_free(plug->data);
+  xbt_free(plug->data);
 }
 
-gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
                                        gras_socket_t sock){
   
   struct sockaddr_in addr;
@@ -151,7 +151,7 @@ gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
  *
  * Open a socket used to receive messages.
  */
-gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
+xbt_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
                                        /* OUT */ gras_socket_t sock){
   int size = sock->bufSize * 1024; 
   int on = 1;
@@ -199,11 +199,11 @@ gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
   return no_error;
 }
 
-gras_error_t
+xbt_error_t
 gras_trp_tcp_socket_accept(gras_socket_t  sock,
                           gras_socket_t *dst) {
   gras_socket_t res;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   
   struct sockaddr_in peer_in;
   socklen_t peer_in_len = sizeof(peer_in);
@@ -312,13 +312,13 @@ void gras_trp_tcp_socket_close(gras_socket_t sock){
  *
  * Send data on a TCP socket
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_tcp_chunk_send(gras_socket_t sock,
                        const char *data,
                        long int size) {
   
   /* TCP sockets are in duplex mode, don't check direction */
-  gras_assert0(size >= 0, "Cannot send a negative amount of data");
+  xbt_assert0(size >= 0, "Cannot send a negative amount of data");
 
   while (size) {
     int status = 0;
@@ -347,14 +347,14 @@ gras_trp_tcp_chunk_send(gras_socket_t sock,
  *
  * Receive data on a TCP socket.
  */
-gras_error_t 
+xbt_error_t 
 gras_trp_tcp_chunk_recv(gras_socket_t sock,
                        char *data,
                        long int size) {
 
   /* TCP sockets are in duplex mode, don't check direction */
-  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");
   
   while (size) {
     int status = 0;
@@ -391,7 +391,7 @@ static int TcpProtoNumber(void) {
   
   if(returnValue == 0) {
     fetchedEntry = getprotobyname("tcp");
-    gras_assert0(fetchedEntry, "getprotobyname(tcp) gave NULL");
+    xbt_assert0(fetchedEntry, "getprotobyname(tcp) gave NULL");
     returnValue = fetchedEntry->p_proto;
   }
   
@@ -403,7 +403,7 @@ static int TcpProtoNumber(void) {
    But I fail to find a good internal organization for now. We may want to split 
    raw and regular sockets more efficiently.
 */
-gras_error_t gras_socket_raw_exchange(gras_socket_t peer,
+xbt_error_t gras_socket_raw_exchange(gras_socket_t peer,
                                      int sender,
                                      unsigned int timeout,
                                      unsigned long int exp_size,
@@ -416,7 +416,7 @@ gras_error_t gras_socket_raw_exchange(gras_socket_t peer,
    
    struct timeval timeOut;
    
-   chunk = gras_malloc(msg_size);
+   chunk = xbt_malloc(msg_size);
 
    for   (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) {
       for(msg_sofar=0; msg_sofar < msg_size; msg_sofar += res_last) {
@@ -436,12 +436,12 @@ gras_error_t gras_socket_raw_exchange(gras_socket_t peer,
         }
         if (res_last == 0) {
           /* No progress done, bail out */
-          gras_free(chunk);
+          xbt_free(chunk);
           RAISE0(unknown_error,"Not exchanged a single byte, bailing out");
         }
       }
    }
    
-   gras_free(chunk);
+   xbt_free(chunk);
    return no_error;
 }
index 621e8ec..ba53530 100644 (file)
@@ -59,12 +59,12 @@ void gras_trp_socket_new(int incomming,
                         gras_socket_t *dst);
 
 /* The drivers */
-typedef gras_error_t (*gras_trp_setup_t)(gras_trp_plugin_t *dst);
+typedef xbt_error_t (*gras_trp_setup_t)(gras_trp_plugin_t *dst);
 
-gras_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug);
-gras_error_t gras_trp_file_setup(gras_trp_plugin_t *plug);
-gras_error_t gras_trp_sg_setup(gras_trp_plugin_t *plug);
-gras_error_t gras_trp_buf_setup(gras_trp_plugin_t *plug);
+xbt_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug);
+xbt_error_t gras_trp_file_setup(gras_trp_plugin_t *plug);
+xbt_error_t gras_trp_sg_setup(gras_trp_plugin_t *plug);
+xbt_error_t gras_trp_buf_setup(gras_trp_plugin_t *plug);
 
 /*
 
@@ -88,7 +88,7 @@ void gras_trp_buf_init_sock(gras_socket_t sock);
 
 
 /* Data exchange over raw sockets */
-gras_error_t gras_socket_raw_exchange(gras_socket_t peer,
+xbt_error_t gras_socket_raw_exchange(gras_socket_t peer,
                                      int sender,
                                      unsigned int timeout,
                                      unsigned long int expSize,
index 838aaa4..ffb7f1f 100644 (file)
@@ -18,7 +18,7 @@
 #include "gras/Virtu/virtu_interface.h"
 #include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(process,gras,"Process manipulation code");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(process,gras,"Process manipulation code");
 
 /* **************************************************************************
  * Process data
@@ -38,21 +38,21 @@ void
 gras_procdata_init() {
   gras_procdata_t *pd=gras_procdata_get();
   pd->userdata  = NULL;
-  pd->msg_queue = gras_dynar_new(sizeof(gras_msg_t),     NULL);
-  pd->cbl_list  = gras_dynar_new(sizeof(gras_cblist_t *),gras_cbl_free);
-  pd->sockets   = gras_dynar_new(sizeof(gras_socket_t*), NULL);
+  pd->msg_queue = xbt_dynar_new(sizeof(gras_msg_t),     NULL);
+  pd->cbl_list  = xbt_dynar_new(sizeof(gras_cblist_t *),gras_cbl_free);
+  pd->sockets   = xbt_dynar_new(sizeof(gras_socket_t*), NULL);
 }
 
 void
 gras_procdata_exit() {
   gras_procdata_t *pd=gras_procdata_get();
 
-  gras_dynar_free(&( pd->msg_queue ));
-  gras_dynar_free(&( pd->cbl_list ));
-  gras_dynar_free(&( pd->sockets ));
+  xbt_dynar_free(&( pd->msg_queue ));
+  xbt_dynar_free(&( pd->cbl_list ));
+  xbt_dynar_free(&( pd->sockets ));
 }
 
-gras_dynar_t 
+xbt_dynar_t 
 gras_socketset_get(void) {
    return gras_procdata_get()->sockets;
 }
index 3297932..e7343c1 100644 (file)
 
 #include "gras/Virtu/virtu_rl.h"
 
-GRAS_LOG_EXTERNAL_CATEGORY(process);
-GRAS_LOG_DEFAULT_CATEGORY(process);
+XBT_LOG_EXTERNAL_CATEGORY(process);
+XBT_LOG_DEFAULT_CATEGORY(process);
 
 /* globals */
 static gras_procdata_t *_gras_procdata = NULL;
 
-gras_error_t gras_process_init() {
-  _gras_procdata=gras_new(gras_procdata_t,1);
+xbt_error_t gras_process_init() {
+  _gras_procdata=xbt_new(gras_procdata_t,1);
   gras_procdata_init();
   return no_error;
 }
-gras_error_t gras_process_exit() {
+xbt_error_t gras_process_exit() {
   gras_procdata_exit();
   return no_error;
 }
@@ -31,7 +31,7 @@ gras_error_t gras_process_exit() {
  * **************************************************************************/
 
 gras_procdata_t *gras_procdata_get(void) {
-  gras_assert0(_gras_procdata,"Run gras_process_init!");
+  xbt_assert0(_gras_procdata,"Run gras_process_init!");
 
   return _gras_procdata;
 }
index 32066c8..cb89350 100644 (file)
 
 #include "gras/Virtu/virtu_sg.h"
 
-GRAS_LOG_EXTERNAL_CATEGORY(process);
-GRAS_LOG_DEFAULT_CATEGORY(process);
+XBT_LOG_EXTERNAL_CATEGORY(process);
+XBT_LOG_DEFAULT_CATEGORY(process);
 
-gras_error_t
+xbt_error_t
 gras_process_init() {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
   gras_procdata_t *pd;
   gras_sg_portrec_t prraw,pr;
   int i;
   
-  pd=gras_new(gras_procdata_t,1);
+  pd=xbt_new(gras_procdata_t,1);
 
   if (MSG_process_set_data(MSG_process_self(),(void*)pd) != MSG_OK)
     return unknown_error;
   gras_procdata_init();
 
   if (!hd) {
-    hd=gras_new(gras_hostdata_t,1);
-    hd->ports = gras_dynar_new(sizeof(gras_sg_portrec_t),NULL);
+    hd=xbt_new(gras_hostdata_t,1);
+    hd->ports = xbt_dynar_new(sizeof(gras_sg_portrec_t),NULL);
 
-    memset(hd->proc, 0, sizeof(hd->proc[0]) * GRAS_MAX_CHANNEL); 
+    memset(hd->proc, 0, sizeof(hd->proc[0]) * XBT_MAX_CHANNEL); 
 
     if (MSG_host_set_data(MSG_host_self(),(void*)hd) != MSG_OK)
       return unknown_error;
   }
   
   /* take a free channel for this process */
-  for (i=0; i<GRAS_MAX_CHANNEL && hd->proc[i]; i++);
-  if (i == GRAS_MAX_CHANNEL) 
+  for (i=0; i<XBT_MAX_CHANNEL && hd->proc[i]; i++);
+  if (i == XBT_MAX_CHANNEL) 
     RAISE2(system_error,
           "GRAS: Can't add a new process on %s, because all channel are already in use. Please increase MAX CHANNEL (which is %d for now) and recompile GRAS\n.",
-           MSG_host_get_name(MSG_host_self()),GRAS_MAX_CHANNEL);
+           MSG_host_get_name(MSG_host_self()),XBT_MAX_CHANNEL);
 
   pd->chan = i;
   hd->proc[ i ] = MSG_process_self_PID();
@@ -51,14 +51,14 @@ gras_process_init() {
   pr.port = -1;
   pr.tochan = i;
   pr.raw = 0;
-  gras_dynar_push(hd->ports,&pr);
+  xbt_dynar_push(hd->ports,&pr);
 
   /* take a free RAW channel for this process */
-  for (i=0; i<GRAS_MAX_CHANNEL && hd->proc[i]; i++);
-  if (i == GRAS_MAX_CHANNEL) {
+  for (i=0; i<XBT_MAX_CHANNEL && hd->proc[i]; i++);
+  if (i == XBT_MAX_CHANNEL) {
     RAISE2(system_error,
           "GRAS: Can't add a new process on %s, because all channel are already in use. Please increase MAX CHANNEL (which is %d for now) and recompile GRAS\n.",
-           MSG_host_get_name(MSG_host_self()),GRAS_MAX_CHANNEL);
+           MSG_host_get_name(MSG_host_self()),XBT_MAX_CHANNEL);
   }
   pd->rawChan = i;
 
@@ -68,7 +68,7 @@ gras_process_init() {
   prraw.port = -1;
   prraw.tochan = i;
   prraw.raw = 1;
-  gras_dynar_push(hd->ports,&prraw);
+  xbt_dynar_push(hd->ports,&prraw);
 
   VERB2("Creating process '%s' (%d)",
           MSG_process_get_name(MSG_process_self()),
@@ -76,7 +76,7 @@ gras_process_init() {
   return no_error;
 }
 
-gras_error_t
+xbt_error_t
 gras_process_exit() {
   gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
   gras_procdata_t *pd=gras_procdata_get();
@@ -84,22 +84,22 @@ gras_process_exit() {
   int cpt;
   gras_sg_portrec_t pr;
 
-  gras_assert0(hd && pd,"Run gras_process_init!!");
+  xbt_assert0(hd && pd,"Run gras_process_init!!");
 
   INFO2("GRAS: Finalizing process '%s' (%d)",
        MSG_process_get_name(MSG_process_self()),MSG_process_self_PID());
 
-  if (gras_dynar_length(pd->msg_queue))
+  if (xbt_dynar_length(pd->msg_queue))
     WARN1("process %d terminated, but some messages are still queued",
          MSG_process_self_PID());
 
-  for (cpt=0; cpt< GRAS_MAX_CHANNEL; cpt++)
+  for (cpt=0; cpt< XBT_MAX_CHANNEL; cpt++)
     if (myPID == hd->proc[cpt])
       hd->proc[cpt] = 0;
 
-  gras_dynar_foreach(hd->ports, cpt, pr) {
+  xbt_dynar_foreach(hd->ports, cpt, pr) {
     if (pr.port == pd->chan || pr.port == pd->rawChan) {
-      gras_dynar_cursor_rm(hd->ports, &cpt);
+      xbt_dynar_cursor_rm(hd->ports, &cpt);
     }
   }
 
@@ -114,7 +114,7 @@ gras_procdata_t *gras_procdata_get(void) {
   gras_procdata_t *pd=
     (gras_procdata_t *)MSG_process_get_data(MSG_process_self());
 
-  gras_assert0(pd,"Run gras_process_init!");
+  xbt_assert0(pd,"Run gras_process_init!");
 
   return pd;
 }
index 46bab61..c0a2c1e 100644 (file)
  */
 typedef struct {
   /*queue of msgs storing the ones got while msg_wait'ing for something else */
-  gras_dynar_t msg_queue; /* elm type: gras_msg_t */
+  xbt_dynar_t msg_queue; /* elm type: gras_msg_t */
 
   /* registered callbacks for each message */
-  gras_dynar_t cbl_list; /* elm type: gras_cblist_t */
+  xbt_dynar_t cbl_list; /* elm type: gras_cblist_t */
    
   /* SG only elements. In RL, they are part of the OS ;) */
   int chan;    /* Formated messages channel */
   int rawChan; /* Unformated echange channel */
-  gras_dynar_t sockets; /* all sockets known to this process */
+  xbt_dynar_t sockets; /* all sockets known to this process */
 
   /* globals of the process */
   void *userdata;               
 } gras_procdata_t;
 
 /* Access */
-gras_dynar_t gras_socketset_get(void);
+xbt_dynar_t gras_socketset_get(void);
 
 /* FIXME: mv to _private? */
 gras_procdata_t *gras_procdata_get(void);
index 2090257..91711e8 100644 (file)
@@ -14,7 +14,7 @@
 #include "gras/Virtu/virtu_interface.h"
 #include <msg.h> /* SimGrid header */
 
-#define GRAS_MAX_CHANNEL 10
+#define XBT_MAX_CHANNEL 10
 
 typedef struct {
   int port;  /* list of ports used by a server socket */
@@ -24,10 +24,10 @@ typedef struct {
 
 /* Data for each host */
 typedef struct {
-  int proc[GRAS_MAX_CHANNEL]; /* PID of who's connected to each channel */
+  int proc[XBT_MAX_CHANNEL]; /* PID of who's connected to each channel */
                               /* If =0, then free */
 
-  gras_dynar_t ports;
+  xbt_dynar_t ports;
 
 } gras_hostdata_t;
 
index 713e18c..3f8b43d 100644 (file)
 
 #include "xbt/config.h" /* prototypes of this module */
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(config,xbt,"configuration support");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(config,xbt,"configuration support");
 
-/* gras_cfgelm_t: the typedef corresponding to a config cell. 
+/* xbt_cfgelm_t: the typedef corresponding to a config cell. 
 
    Both data and DTD are mixed, but fixing it now would prevent me to ever
    defend my thesis. */
 
 typedef struct {
   /* Allowed type of the cell */
-  e_gras_cfgelm_type_t type;
+  e_xbt_cfgelm_type_t type;
   int min,max;
 
   /* actual content 
      (cannot be an union because type host uses both str and i) */
-  gras_dynar_t content;
-} s_gras_cfgelm_t,*gras_cfgelm_t;
+  xbt_dynar_t content;
+} s_xbt_cfgelm_t,*xbt_cfgelm_t;
 
-static const char *gras_cfgelm_type_name[gras_cfgelm_type_count]=
+static const char *xbt_cfgelm_type_name[xbt_cfgelm_type_count]=
   {"int","double","string","host"};
 
 /* Internal stuff used in cache to free a cell */
-static void gras_cfgelm_free(void *data);
+static void xbt_cfgelm_free(void *data);
 
 /* Retrieve the cell we'll modify */
-static gras_error_t gras_cfgelm_get(gras_cfg_t cfg, const char *name,
-                                   e_gras_cfgelm_type_t type,
-                                   /* OUT */ gras_cfgelm_t *whereto);
+static xbt_error_t xbt_cfgelm_get(xbt_cfg_t cfg, const char *name,
+                                   e_xbt_cfgelm_type_t type,
+                                   /* OUT */ xbt_cfgelm_t *whereto);
 
-void gras_cfg_str_free(void *d);
-void gras_cfg_host_free(void *d);
+void xbt_cfg_str_free(void *d);
+void xbt_cfg_host_free(void *d);
 
-void gras_cfg_str_free(void *d){
-  gras_free(*(void**)d);
+void xbt_cfg_str_free(void *d){
+  xbt_free(*(void**)d);
 }
-void gras_cfg_host_free(void *d){
-  gras_host_t *h=(gras_host_t*) *(void**)d; 
+void xbt_cfg_host_free(void *d){
+  xbt_host_t *h=(xbt_host_t*) *(void**)d; 
   if (h) {
-    if (h->name) gras_free(h->name);
-    gras_free(h);
+    if (h->name) xbt_free(h->name);
+    xbt_free(h);
   }
 }
 
 /*----[ Memory management ]-----------------------------------------------*/
 
 /**
- * gras_cfg_new:
+ * xbt_cfg_new:
  *
  * @whereto: 
  *
@@ -72,12 +72,12 @@ void gras_cfg_host_free(void *d){
  */
 
 
-gras_cfg_t gras_cfg_new(void) {
-  return (gras_cfg_t)gras_dict_new();
+xbt_cfg_t xbt_cfg_new(void) {
+  return (xbt_cfg_t)xbt_dict_new();
 }
 
 /**
- * gras_cfg_cpy:
+ * xbt_cfg_cpy:
  *
  * @whereto: the config set to be created
  * @tocopy: the source data
@@ -85,25 +85,25 @@ gras_cfg_t gras_cfg_new(void) {
  */
 
 void
-gras_cfg_cpy(gras_cfg_t tocopy,gras_cfg_t *whereto) {
-  gras_dict_cursor_t cursor=NULL; 
-  gras_cfgelm_t cell=NULL;
+xbt_cfg_cpy(xbt_cfg_t tocopy,xbt_cfg_t *whereto) {
+  xbt_dict_cursor_t cursor=NULL; 
+  xbt_cfgelm_t cell=NULL;
   char *name=NULL;
   
   *whereto=NULL;
-  gras_assert0(tocopy,"cannot copy NULL config");
+  xbt_assert0(tocopy,"cannot copy NULL config");
 
-  gras_dict_foreach((gras_dict_t)tocopy,cursor,name,cell) {
-    gras_cfg_register(*whereto, name, cell->type, cell->min, cell->max);
+  xbt_dict_foreach((xbt_dict_t)tocopy,cursor,name,cell) {
+    xbt_cfg_register(*whereto, name, cell->type, cell->min, cell->max);
   }
 }
 
-void gras_cfg_free(gras_cfg_t *cfg) {
-  gras_dict_free((gras_dict_t*)cfg);
+void xbt_cfg_free(xbt_cfg_t *cfg) {
+  xbt_dict_free((xbt_dict_t*)cfg);
 }
 
 /**
- * gras_cfg_dump:
+ * xbt_cfg_dump:
  * @name: The name to give to this config set
  * @indent: what to write at the begining of each line (right number of spaces)
  * @cfg: the config set
@@ -111,56 +111,56 @@ void gras_cfg_free(gras_cfg_t *cfg) {
  * Dumps a config set for debuging purpose
  */
 void
-gras_cfg_dump(const char *name,const char *indent,gras_cfg_t cfg) {
-  gras_dict_t dict = (gras_dict_t) cfg;
-  gras_dict_cursor_t cursor=NULL; 
-  gras_cfgelm_t cell=NULL;
+xbt_cfg_dump(const char *name,const char *indent,xbt_cfg_t cfg) {
+  xbt_dict_t dict = (xbt_dict_t) cfg;
+  xbt_dict_cursor_t cursor=NULL; 
+  xbt_cfgelm_t cell=NULL;
   char *key=NULL;
   int i; 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   int size;
   int ival;
   char *sval;
   double dval;
-  gras_host_t *hval;
+  xbt_host_t *hval;
 
   if (name)
     printf("%s>> Dumping of the config set '%s':\n",indent,name);
-  gras_dict_foreach(dict,cursor,key,cell) {
+  xbt_dict_foreach(dict,cursor,key,cell) {
 
     printf("%s  %s:",indent,key);
 
-    size = gras_dynar_length(cell->content);
+    size = xbt_dynar_length(cell->content);
     printf("%d_to_%d_%s. Actual size=%d. List of values:\n",
-          cell->min,cell->max,gras_cfgelm_type_name[cell->type],
+          cell->min,cell->max,xbt_cfgelm_type_name[cell->type],
           size);
 
     switch (cell->type) {
        
-    case gras_cfgelm_int:
+    case xbt_cfgelm_int:
       for (i=0; i<size; i++) {
-       ival = gras_dynar_get_as(cell->content,i,int);
+       ival = xbt_dynar_get_as(cell->content,i,int);
        printf ("%s    %d\n",indent,ival);
       }
       break;
 
-    case gras_cfgelm_double:
+    case xbt_cfgelm_double:
       for (i=0; i<size; i++) {
-       dval = gras_dynar_get_as(cell->content,i,double);
+       dval = xbt_dynar_get_as(cell->content,i,double);
        printf ("%s    %f\n",indent,dval);
       }
       break;
 
-    case gras_cfgelm_string:
+    case xbt_cfgelm_string:
       for (i=0; i<size; i++) {
-       sval = gras_dynar_get_as(cell->content,i,char*);
+       sval = xbt_dynar_get_as(cell->content,i,char*);
        printf ("%s    %s\n",indent,sval);
       }
       break;
 
-    case gras_cfgelm_host:
+    case xbt_cfgelm_host:
       for (i=0; i<size; i++) {
-       hval = gras_dynar_get_as(cell->content,i,gras_host_t*);
+       hval = xbt_dynar_get_as(cell->content,i,xbt_host_t*);
        printf ("%s    %s:%d\n",indent,hval->name,hval->port);
       }
       break;
@@ -174,30 +174,30 @@ gras_cfg_dump(const char *name,const char *indent,gras_cfg_t cfg) {
   if (name) printf("%s<< End of the config set '%s'\n",indent,name);
   fflush(stdout);
 
-  gras_dict_cursor_free(&cursor);
+  xbt_dict_cursor_free(&cursor);
   return;
 }
 
 /**
- * gras_cfgelm_free:
+ * xbt_cfgelm_free:
  *
  * @data: the data to be freed (typed as void* to be usable as free funct in dict)
  *
  * free an config element
  */
 
-void gras_cfgelm_free(void *data) {
-  gras_cfgelm_t c=(gras_cfgelm_t)data;
+void xbt_cfgelm_free(void *data) {
+  xbt_cfgelm_t c=(xbt_cfgelm_t)data;
 
   if (!c) return;
-  gras_dynar_free(&(c->content));
-  gras_free(c);
+  xbt_dynar_free(&(c->content));
+  xbt_free(c);
 }
 
 /*----[ Registering stuff ]-----------------------------------------------*/
 
 /**
- * gras_cfg_register:
+ * xbt_cfg_register:
  * @cfg: the config set
  * @type: the type of the config element
  * @min: the minimum
@@ -207,53 +207,53 @@ void gras_cfgelm_free(void *data) {
  */
 
 void
-gras_cfg_register(gras_cfg_t cfg,
-                 const char *name, e_gras_cfgelm_type_t type,
+xbt_cfg_register(xbt_cfg_t cfg,
+                 const char *name, e_xbt_cfgelm_type_t type,
                  int min, int max){
-  gras_cfgelm_t res;
-  gras_error_t errcode;
+  xbt_cfgelm_t res;
+  xbt_error_t errcode;
 
-  DEBUG4("Register cfg elm %s (%d to %d %s)",name,min,max,gras_cfgelm_type_name[type]);
-  errcode = gras_dict_get((gras_dict_t)cfg,name,(void**)&res);
+  DEBUG4("Register cfg elm %s (%d to %d %s)",name,min,max,xbt_cfgelm_type_name[type]);
+  errcode = xbt_dict_get((xbt_dict_t)cfg,name,(void**)&res);
 
   if (errcode == no_error) {
     WARN1("Config elem %s registered twice.",name);
     /* Will be removed by the insertion of the new one */
   } 
-  gras_assert_error(mismatch_error);
+  xbt_assert_error(mismatch_error);
 
-  res=gras_new(s_gras_cfgelm_t,1);
+  res=xbt_new(s_xbt_cfgelm_t,1);
 
   res->type=type;
   res->min=min;
   res->max=max;
 
   switch (type) {
-  case gras_cfgelm_int:
-    res->content = gras_dynar_new(sizeof(int), NULL);
+  case xbt_cfgelm_int:
+    res->content = xbt_dynar_new(sizeof(int), NULL);
     break;
 
-  case gras_cfgelm_double:
-    res->content = gras_dynar_new(sizeof(double), NULL);
+  case xbt_cfgelm_double:
+    res->content = xbt_dynar_new(sizeof(double), NULL);
     break;
 
-  case gras_cfgelm_string:
-   res->content = gras_dynar_new(sizeof(char*),&gras_cfg_str_free);
+  case xbt_cfgelm_string:
+   res->content = xbt_dynar_new(sizeof(char*),&xbt_cfg_str_free);
    break;
 
-  case gras_cfgelm_host:
-   res->content = gras_dynar_new(sizeof(gras_host_t*),&gras_cfg_host_free);
+  case xbt_cfgelm_host:
+   res->content = xbt_dynar_new(sizeof(xbt_host_t*),&xbt_cfg_host_free);
    break;
 
   default:
     ERROR1("%d is an invalide type code",type);
   }
     
-  gras_dict_set((gras_dict_t)cfg,name,res,&gras_cfgelm_free);
+  xbt_dict_set((xbt_dict_t)cfg,name,res,&xbt_cfgelm_free);
 }
 
 /**
- * gras_cfg_unregister:
+ * xbt_cfg_unregister:
  * 
  * @cfg: the config set
  * @name: the name of the elem to be freed
@@ -262,13 +262,13 @@ gras_cfg_register(gras_cfg_t cfg,
  * Note that it removes both the DTD and the actual content.
  */
 
-gras_error_t
-gras_cfg_unregister(gras_cfg_t cfg,const char *name) {
-  return gras_dict_remove((gras_dict_t)cfg,name);
+xbt_error_t
+xbt_cfg_unregister(xbt_cfg_t cfg,const char *name) {
+  return xbt_dict_remove((xbt_dict_t)cfg,name);
 }
 
 /**
- * gras_cfg_register_str:
+ * xbt_cfg_register_str:
  *
  * @cfg: the config set
  * @entry: a string describing the element to register
@@ -276,98 +276,98 @@ gras_cfg_unregister(gras_cfg_t cfg,const char *name) {
  * Parse a string and register the stuff described.
  */
 
-gras_error_t
-gras_cfg_register_str(gras_cfg_t cfg,const char *entry) {
-  char *entrycpy=gras_strdup(entry);
+xbt_error_t
+xbt_cfg_register_str(xbt_cfg_t cfg,const char *entry) {
+  char *entrycpy=xbt_strdup(entry);
   char *tok;
 
   int min,max;
-  e_gras_cfgelm_type_t type;
+  e_xbt_cfgelm_type_t type;
 
   tok=strchr(entrycpy, ':');
   if (!tok) {
     ERROR3("%s%s%s",
          "Invalid config element descriptor: ",entry,
          "; Should be <name>:<min nb>_to_<max nb>_<type>");
-    gras_free(entrycpy);
-    gras_abort();
+    xbt_free(entrycpy);
+    xbt_abort();
   }
   *(tok++)='\0';
 
   min=strtol(tok, &tok, 10);
   if (!tok) {
     ERROR1("Invalid minimum in config element descriptor %s",entry);
-    gras_free(entrycpy);
-    gras_abort();
+    xbt_free(entrycpy);
+    xbt_abort();
   }
 
   if (!strcmp(tok,"_to_")){
     ERROR3("%s%s%s",
          "Invalid config element descriptor: ",entry,
          "; Should be <name>:<min nb>_to_<max nb>_<type>");
-    gras_free(entrycpy);
-    gras_abort();
+    xbt_free(entrycpy);
+    xbt_abort();
   }
   tok += strlen("_to_");
 
   max=strtol(tok, &tok, 10);
   if (!tok) {
     ERROR1("Invalid maximum in config element descriptor %s",entry);
-    gras_free(entrycpy);
-    gras_abort();
+    xbt_free(entrycpy);
+    xbt_abort();
   }
 
   if (*(tok++)!='_') {
     ERROR3("%s%s%s",
          "Invalid config element descriptor: ",entry,
          "; Should be <name>:<min nb>_to_<max nb>_<type>");
-    gras_free(entrycpy);
-    gras_abort();
+    xbt_free(entrycpy);
+    xbt_abort();
   }
 
   for (type=0; 
-       type<gras_cfgelm_type_count && strcmp(tok,gras_cfgelm_type_name[type]); 
+       type<xbt_cfgelm_type_count && strcmp(tok,xbt_cfgelm_type_name[type]); 
        type++);
-  if (type == gras_cfgelm_type_count) {
+  if (type == xbt_cfgelm_type_count) {
     ERROR3("%s%s%s",
          "Invalid type in config element descriptor: ",entry,
          "; Should be one of 'string', 'int', 'host' or 'double'.");
-    gras_free(entrycpy);
-    gras_abort();
+    xbt_free(entrycpy);
+    xbt_abort();
   }
 
-  gras_cfg_register(cfg,entrycpy,type,min,max);
+  xbt_cfg_register(cfg,entrycpy,type,min,max);
 
-  gras_free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */
+  xbt_free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */
   return no_error;
 }
 
 /**
- * gras_cfg_check:
+ * xbt_cfg_check:
  *
  * @cfg: the config set
  * 
  * Check the config set
  */
 
-gras_error_t
-gras_cfg_check(gras_cfg_t cfg) {
-  gras_dict_cursor_t cursor; 
-  gras_cfgelm_t cell;
+xbt_error_t
+xbt_cfg_check(xbt_cfg_t cfg) {
+  xbt_dict_cursor_t cursor; 
+  xbt_cfgelm_t cell;
   char *name;
   int size;
 
-  gras_assert0(cfg,"NULL config set.");
+  xbt_assert0(cfg,"NULL config set.");
 
-  gras_dict_foreach((gras_dict_t)cfg,cursor,name,cell) {
-    size = gras_dynar_length(cell->content);
+  xbt_dict_foreach((xbt_dict_t)cfg,cursor,name,cell) {
+    size = xbt_dynar_length(cell->content);
     if (cell->min > size) { 
       ERROR4("Config elem %s needs at least %d %s, but there is only %d values.",
             name,
             cell->min,
-            gras_cfgelm_type_name[cell->type],
+            xbt_cfgelm_type_name[cell->type],
             size); 
-      gras_dict_cursor_free(&cursor);
+      xbt_dict_cursor_free(&cursor);
       return mismatch_error;
     }
 
@@ -375,24 +375,24 @@ gras_cfg_check(gras_cfg_t cfg) {
       ERROR4("Config elem %s accepts at most %d %s, but there is %d values.",
             name,
             cell->max,
-            gras_cfgelm_type_name[cell->type],
+            xbt_cfgelm_type_name[cell->type],
             size);
-      gras_dict_cursor_free(&cursor);
+      xbt_dict_cursor_free(&cursor);
       return mismatch_error;
     }
 
   }
 
-  gras_dict_cursor_free(&cursor);
+  xbt_dict_cursor_free(&cursor);
   return no_error;
 }
 
-static gras_error_t gras_cfgelm_get(gras_cfg_t  cfg,
+static xbt_error_t xbt_cfgelm_get(xbt_cfg_t  cfg,
                                    const char *name,
-                                   e_gras_cfgelm_type_t type,
-                                   /* OUT */ gras_cfgelm_t *whereto){
+                                   e_xbt_cfgelm_type_t type,
+                                   /* OUT */ xbt_cfgelm_t *whereto){
    
-  gras_error_t errcode = gras_dict_get((gras_dict_t)cfg,name,
+  xbt_error_t errcode = xbt_dict_get((xbt_dict_t)cfg,name,
                                       (void**)whereto);
 
   if (errcode == mismatch_error) {
@@ -403,17 +403,17 @@ static gras_error_t gras_cfgelm_get(gras_cfg_t  cfg,
   if (errcode != no_error)
      return errcode;
 
-  gras_assert3((*whereto)->type == type,
+  xbt_assert3((*whereto)->type == type,
               "You tried to access to the config element %s as an %s, but its type is %s.",
               name,
-              gras_cfgelm_type_name[type],
-              gras_cfgelm_type_name[(*whereto)->type]);
+              xbt_cfgelm_type_name[type],
+              xbt_cfgelm_type_name[(*whereto)->type]);
 
   return no_error;
 }
 
 /**
- * gras_cfg_get_type:
+ * xbt_cfg_get_type:
  *
  * @cfg: the config set
  * @name: the name of the element 
@@ -422,14 +422,14 @@ static gras_error_t gras_cfgelm_get(gras_cfg_t  cfg,
  * Give the type of the config element
  */
 
-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) {
 
-  gras_cfgelm_t cell;
-  gras_error_t errcode;
+  xbt_cfgelm_t cell;
+  xbt_error_t errcode;
 
-  TRYCATCH(mismatch_error,gras_dict_get((gras_dict_t)cfg,name,(void**)&cell));
+  TRYCATCH(mismatch_error,xbt_dict_get((xbt_dict_t)cfg,name,(void**)&cell));
 
   if (errcode == mismatch_error) {
     ERROR1("Can't get the type of '%s' since this cell does not exist",
@@ -444,49 +444,49 @@ gras_cfg_get_type(gras_cfg_t cfg, const char *name,
 
 /*----[ Setting ]---------------------------------------------------------*/
 /** 
- * gras_cfg_set_vargs(): 
+ * xbt_cfg_set_vargs(): 
  * @cfg: config set to fill
  * @varargs: NULL-terminated list of pairs {(const char*)key, value}
  *
  * Add some values to the config set.
  * @warning: if the list isn't NULL terminated, it will segfault. 
  */
-gras_error_t
-gras_cfg_set_vargs(gras_cfg_t cfg, va_list pa) {
+xbt_error_t
+xbt_cfg_set_vargs(xbt_cfg_t cfg, va_list pa) {
   char *str,*name;
   int i;
   double d;
-  e_gras_cfgelm_type_t type;
+  e_xbt_cfgelm_type_t type;
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
   
   while ((name=va_arg(pa,char *))) {
 
-    if (!gras_cfg_get_type(cfg,name,&type)) {
+    if (!xbt_cfg_get_type(cfg,name,&type)) {
       ERROR1("Can't set the property '%s' since it's not registered",name);
       return mismatch_error;
     }
 
     switch (type) {
-    case gras_cfgelm_host:
+    case xbt_cfgelm_host:
       str = va_arg(pa, char *);
       i=va_arg(pa,int);
-      TRY(gras_cfg_set_host(cfg,name,str,i));
+      TRY(xbt_cfg_set_host(cfg,name,str,i));
       break;
       
-    case gras_cfgelm_string:
+    case xbt_cfgelm_string:
       str=va_arg(pa, char *);
-      TRY(gras_cfg_set_string(cfg, name, str));
+      TRY(xbt_cfg_set_string(cfg, name, str));
       break;
 
-    case gras_cfgelm_int:
+    case xbt_cfgelm_int:
       i=va_arg(pa,int);
-      TRY(gras_cfg_set_int(cfg,name,i));
+      TRY(xbt_cfg_set_int(cfg,name,i));
       break;
 
-    case gras_cfgelm_double:
+    case xbt_cfgelm_double:
       d=va_arg(pa,double);
-      TRY(gras_cfg_set_double(cfg,name,d));
+      TRY(xbt_cfg_set_double(cfg,name,d));
       break;
 
     default: 
@@ -497,25 +497,25 @@ gras_cfg_set_vargs(gras_cfg_t cfg, va_list pa) {
 }
 
 /** 
- * gras_cfg_set():
+ * xbt_cfg_set():
  * @cfg: config set to fill
  * @varargs: NULL-terminated list of pairs {(const char*)key, value}
  *
  * Add some values to the config set.
  * @warning: if the list isn't NULL terminated, it will segfault. 
  */
-gras_error_t gras_cfg_set(gras_cfg_t cfg, ...) {
+xbt_error_t xbt_cfg_set(xbt_cfg_t cfg, ...) {
   va_list pa;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   va_start(pa,cfg);
-  errcode=gras_cfg_set_vargs(cfg,pa);
+  errcode=xbt_cfg_set_vargs(cfg,pa);
   va_end(pa);
   return errcode;
 }
 
 /**
- * gras_cfg_set_parse():
+ * xbt_cfg_set_parse():
  * @cfg: config set to fill
  * @options: a string containing the content to add to the config set. This
  * is a '\t',' ' or '\n' separated list of cells. Each individual cell is
@@ -526,24 +526,24 @@ gras_error_t gras_cfg_set(gras_cfg_t cfg, ...) {
  * Add the cells described in a string to a config set.
  */
 
-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) {
   int i;
   double d;
   char *str;
 
-  gras_cfgelm_t cell;
+  xbt_cfgelm_t cell;
   char *optionlist_cpy;
   char *option,  *name,*val;
 
   int len;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
-  GRAS_IN;
+  XBT_IN;
   if (!options || !strlen(options)) { /* nothing to do */
     return no_error;
   }
-  optionlist_cpy=gras_strdup(options);
+  optionlist_cpy=xbt_strdup(options);
 
   DEBUG1("List to parse and set:'%s'",options);
   option=optionlist_cpy;
@@ -586,8 +586,8 @@ gras_cfg_set_parse(gras_cfg_t cfg, const char *options) {
     
     val=strchr(name,':');
     if (!val) {
-      gras_free(optionlist_cpy);
-      gras_assert1(FALSE,
+      xbt_free(optionlist_cpy);
+      xbt_assert1(FALSE,
                   "Malformated option: '%s'; Should be of the form 'name:value'",
                   name);
     }
@@ -595,58 +595,58 @@ gras_cfg_set_parse(gras_cfg_t cfg, const char *options) {
 
     DEBUG2("name='%s';val='%s'",name,val);
 
-    errcode=gras_dict_get((gras_dict_t)cfg,name,(void**)&cell);
+    errcode=xbt_dict_get((xbt_dict_t)cfg,name,(void**)&cell);
     switch (errcode) {
     case no_error:
       break;
     case mismatch_error:
       ERROR1("No registrated cell corresponding to '%s'.",name);
-      gras_free(optionlist_cpy);
+      xbt_free(optionlist_cpy);
       return mismatch_error;
       break;
     default:
-      gras_free(optionlist_cpy);
+      xbt_free(optionlist_cpy);
       return errcode;
     }
 
     switch (cell->type) {
-    case gras_cfgelm_string:
-      TRYCLEAN(gras_cfg_set_string(cfg, name, val),
-              gras_free(optionlist_cpy));
+    case xbt_cfgelm_string:
+      TRYCLEAN(xbt_cfg_set_string(cfg, name, val),
+              xbt_free(optionlist_cpy));
       break;
 
-    case gras_cfgelm_int:
+    case xbt_cfgelm_int:
       i=strtol(val, &val, 0);
       if (val==NULL) {
-       gras_free(optionlist_cpy);      
-       gras_assert1(FALSE,
+       xbt_free(optionlist_cpy);       
+       xbt_assert1(FALSE,
                     "Value of option %s not valid. Should be an integer",
                     name);
       }
 
-      TRYCLEAN(gras_cfg_set_int(cfg,name,i),
-              gras_free(optionlist_cpy));
+      TRYCLEAN(xbt_cfg_set_int(cfg,name,i),
+              xbt_free(optionlist_cpy));
       break;
 
-    case gras_cfgelm_double:
+    case xbt_cfgelm_double:
       d=strtod(val, &val);
       if (val==NULL) {
-       gras_free(optionlist_cpy);      
-       gras_assert1(FALSE,
+       xbt_free(optionlist_cpy);       
+       xbt_assert1(FALSE,
               "Value of option %s not valid. Should be a double",
               name);
       }
 
-      TRYCLEAN(gras_cfg_set_double(cfg,name,d),
-              gras_free(optionlist_cpy));
+      TRYCLEAN(xbt_cfg_set_double(cfg,name,d),
+              xbt_free(optionlist_cpy));
       break;
 
-    case gras_cfgelm_host:
+    case xbt_cfgelm_host:
       str=val;
       val=strchr(val,':');
       if (!val) {
-       gras_free(optionlist_cpy);      
-       gras_assert1(FALSE,
+       xbt_free(optionlist_cpy);       
+       xbt_assert1(FALSE,
               "Value of option %s not valid. Should be an host (machine:port)",
               name);
       }
@@ -654,28 +654,28 @@ gras_cfg_set_parse(gras_cfg_t cfg, const char *options) {
       *(val++)='\0';
       i=strtol(val, &val, 0);
       if (val==NULL) {
-       gras_free(optionlist_cpy);      
-       gras_assert1(FALSE,
+       xbt_free(optionlist_cpy);       
+       xbt_assert1(FALSE,
               "Value of option %s not valid. Should be an host (machine:port)",
               name);
       }
 
-      TRYCLEAN(gras_cfg_set_host(cfg,name,str,i),
-              gras_free(optionlist_cpy));
+      TRYCLEAN(xbt_cfg_set_host(cfg,name,str,i),
+              xbt_free(optionlist_cpy));
       break;      
 
     default: 
-      gras_free(optionlist_cpy);
+      xbt_free(optionlist_cpy);
       RAISE1(unknown_error,"Type of config element %s is not valid.",name);
     }
     
   }
-  gras_free(optionlist_cpy);
+  xbt_free(optionlist_cpy);
   return no_error;
 }
 
 /**
- * gras_cfg_set_int:
+ * xbt_cfg_set_int:
  *
  * @cfg: the config set
  * @name: the name of the cell
@@ -683,24 +683,24 @@ gras_cfg_set_parse(gras_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, int val) {
-  gras_cfgelm_t cell;
-  gras_error_t errcode;
+xbt_error_t
+xbt_cfg_set_int(xbt_cfg_t cfg,const char*name, int val) {
+  xbt_cfgelm_t cell;
+  xbt_error_t errcode;
 
   VERB2("Configuration setting: %s=%d",name,val);
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_int,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_int,&cell));
 
   if (cell->max > 1) {
-    gras_dynar_push(cell->content,&val);
+    xbt_dynar_push(cell->content,&val);
   } else {
-    gras_dynar_set(cell->content,0,&val);
+    xbt_dynar_set(cell->content,0,&val);
   }
   return no_error;
 }
 
 /**
- * gras_cfg_set_double:
+ * xbt_cfg_set_double:
  * @cfg: the config set
  * @name: the name of the cell
  * @val: the doule to set
@@ -708,24 +708,24 @@ gras_cfg_set_int(gras_cfg_t cfg,const char*name, int val) {
  * Set the value of the cell @name in @cfg with the provided value.
  */ 
 
-gras_error_t
-gras_cfg_set_double(gras_cfg_t cfg,const char*name, double val) {
-  gras_cfgelm_t cell;
-  gras_error_t errcode;
+xbt_error_t
+xbt_cfg_set_double(xbt_cfg_t cfg,const char*name, double val) {
+  xbt_cfgelm_t cell;
+  xbt_error_t errcode;
 
   VERB2("Configuration setting: %s=%f",name,val);
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_double,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_double,&cell));
 
   if (cell->max > 1) {
-    gras_dynar_push(cell->content,&val);
+    xbt_dynar_push(cell->content,&val);
   } else {
-    gras_dynar_set(cell->content,0,&val);
+    xbt_dynar_set(cell->content,0,&val);
   }
   return no_error;
 }
 
 /**
- * gras_cfg_set_string:
+ * xbt_cfg_set_string:
  * 
  * @cfg: the config set
  * @name: the name of the cell
@@ -734,25 +734,25 @@ gras_cfg_set_double(gras_cfg_t cfg,const char*name, double val) {
  * Set the value of the cell @name in @cfg with the provided value.
  */ 
 
-gras_error_t
-gras_cfg_set_string(gras_cfg_t cfg,const char*name, const char*val) { 
-  gras_cfgelm_t cell;
-  gras_error_t errcode;
-  char *newval = gras_strdup(val);
+xbt_error_t
+xbt_cfg_set_string(xbt_cfg_t cfg,const char*name, const char*val) { 
+  xbt_cfgelm_t cell;
+  xbt_error_t errcode;
+  char *newval = xbt_strdup(val);
 
   VERB2("Configuration setting: %s=%s",name,val);
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_string,&cell));
 
   if (cell->max > 1) {
-    gras_dynar_push(cell->content,&newval);
+    xbt_dynar_push(cell->content,&newval);
   } else {
-    gras_dynar_set(cell->content,0,&newval);
+    xbt_dynar_set(cell->content,0,&newval);
   }
   return no_error;
 }
 
 /**
- * gras_cfg_set_host:
+ * xbt_cfg_set_host:
  * 
  * @cfg: the config set
  * @name: the name of the cell
@@ -763,24 +763,24 @@ gras_cfg_set_string(gras_cfg_t cfg,const char*name, const char*val) {
  * on the given @host to the given @port
  */ 
 
-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) {
-  gras_cfgelm_t cell;
-  gras_error_t errcode;
-  gras_host_t *val=gras_new(gras_host_t,1);
+  xbt_cfgelm_t cell;
+  xbt_error_t errcode;
+  xbt_host_t *val=xbt_new(xbt_host_t,1);
 
   VERB3("Configuration setting: %s=%s:%d",name,host,port);
 
-  val->name = gras_strdup(name);
+  val->name = xbt_strdup(name);
   val->port = port;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_host,&cell));
 
   if (cell->max > 1) {
-    gras_dynar_push(cell->content,&val);
+    xbt_dynar_push(cell->content,&val);
   } else {
-    gras_dynar_set(cell->content,0,&val);
+    xbt_dynar_set(cell->content,0,&val);
   }
   return no_error;
 }
@@ -788,7 +788,7 @@ gras_cfg_set_host(gras_cfg_t cfg,const char*name,
 /* ---- [ Removing ] ---- */
 
 /**
- * gras_cfg_rm_int:
+ * xbt_cfg_rm_int:
  *
  * @cfg: the config set
  * @name: the name of the cell
@@ -796,17 +796,17 @@ gras_cfg_set_host(gras_cfg_t cfg,const char*name,
  *
  * Remove the provided @val from the cell @name in @cfg.
  */
-gras_error_t gras_cfg_rm_int(gras_cfg_t cfg,const char*name, int val) {
+xbt_error_t xbt_cfg_rm_int(xbt_cfg_t cfg,const char*name, int val) {
 
-  gras_cfgelm_t cell;
+  xbt_cfgelm_t cell;
   int cpt,seen;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_int,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_int,&cell));
   
-  gras_dynar_foreach(cell->content,cpt,seen) {
+  xbt_dynar_foreach(cell->content,cpt,seen) {
     if (seen == val) {
-      gras_dynar_cursor_rm(cell->content,&cpt);
+      xbt_dynar_cursor_rm(cell->content,&cpt);
       return no_error;
     }
   }
@@ -817,7 +817,7 @@ gras_error_t gras_cfg_rm_int(gras_cfg_t cfg,const char*name, int val) {
 }
 
 /**
- * gras_cfg_rm_double:
+ * xbt_cfg_rm_double:
  *
  * @cfg: the config set
  * @name: the name of the cell
@@ -826,17 +826,17 @@ gras_error_t gras_cfg_rm_int(gras_cfg_t cfg,const char*name, int val) {
  * Remove the provided @val from the cell @name in @cfg.
  */
 
-gras_error_t gras_cfg_rm_double(gras_cfg_t cfg,const char*name, double val) {
-  gras_cfgelm_t cell;
+xbt_error_t xbt_cfg_rm_double(xbt_cfg_t cfg,const char*name, double val) {
+  xbt_cfgelm_t cell;
   int cpt;
   double seen;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_double,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_double,&cell));
   
-  gras_dynar_foreach(cell->content,cpt,seen) {
+  xbt_dynar_foreach(cell->content,cpt,seen) {
     if (seen == val) {
-      gras_dynar_cursor_rm(cell->content,&cpt);
+      xbt_dynar_cursor_rm(cell->content,&cpt);
       return no_error;
     }
   }
@@ -847,7 +847,7 @@ gras_error_t gras_cfg_rm_double(gras_cfg_t cfg,const char*name, double val) {
 }
 
 /**
- * gras_cfg_rm_string:
+ * xbt_cfg_rm_string:
  *
  * @cfg: the config set
  * @name: the name of the cell
@@ -855,18 +855,18 @@ gras_error_t gras_cfg_rm_double(gras_cfg_t cfg,const char*name, double val) {
  *
  * Remove the provided @val from the cell @name in @cfg.
  */
-gras_error_t
-gras_cfg_rm_string(gras_cfg_t cfg,const char*name, const char *val) {
-  gras_cfgelm_t cell;
+xbt_error_t
+xbt_cfg_rm_string(xbt_cfg_t cfg,const char*name, const char *val) {
+  xbt_cfgelm_t cell;
   int cpt;
   char *seen;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_string,&cell));
   
-  gras_dynar_foreach(cell->content,cpt,seen) {
+  xbt_dynar_foreach(cell->content,cpt,seen) {
     if (!strcpy(seen,val)) {
-      gras_dynar_cursor_rm(cell->content,&cpt);
+      xbt_dynar_cursor_rm(cell->content,&cpt);
       return no_error;
     }
   }
@@ -877,7 +877,7 @@ gras_cfg_rm_string(gras_cfg_t cfg,const char*name, const char *val) {
 }
 
 /**
- * gras_cfg_rm_host:
+ * xbt_cfg_rm_host:
  * 
  * @cfg: the config set
  * @name: the name of the cell
@@ -887,18 +887,18 @@ gras_cfg_rm_string(gras_cfg_t cfg,const char*name, const char *val) {
  * Remove the provided @host:@port from the cell @name in @cfg.
  */
 
-gras_error_t
-gras_cfg_rm_host(gras_cfg_t cfg,const char*name, const char *host,int port) {
-  gras_cfgelm_t cell;
+xbt_error_t
+xbt_cfg_rm_host(xbt_cfg_t cfg,const char*name, const char *host,int port) {
+  xbt_cfgelm_t cell;
   int cpt;
-  gras_host_t *seen;
-  gras_error_t errcode;
+  xbt_host_t *seen;
+  xbt_error_t errcode;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_host,&cell));
   
-  gras_dynar_foreach(cell->content,cpt,seen) {
+  xbt_dynar_foreach(cell->content,cpt,seen) {
     if (!strcpy(seen->name,host) && seen->port == port) {
-      gras_dynar_cursor_rm(cell->content,&cpt);
+      xbt_dynar_cursor_rm(cell->content,&cpt);
       return no_error;
     }
   }
@@ -911,7 +911,7 @@ gras_cfg_rm_host(gras_cfg_t cfg,const char*name, const char *host,int port) {
 /* rm everything */
 
 /**
- * gras_cfg_empty:
+ * xbt_cfg_empty:
  * 
  * @cfg: the config set
  * @name: the name of the cell
@@ -919,14 +919,14 @@ gras_cfg_rm_host(gras_cfg_t cfg,const char*name, const char *host,int port) {
  * rm evenything
  */
 
-gras_error_t 
-gras_cfg_empty(gras_cfg_t cfg,const char*name) {
-  gras_cfgelm_t cell;
+xbt_error_t 
+xbt_cfg_empty(xbt_cfg_t cfg,const char*name) {
+  xbt_cfgelm_t cell;
 
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   TRYCATCH(mismatch_error,
-          gras_dict_get((gras_dict_t)cfg,name,(void**)&cell));
+          xbt_dict_get((xbt_dict_t)cfg,name,(void**)&cell));
   if (errcode == mismatch_error) {
     ERROR1("Can't empty  '%s' since this config element does not exist",
           name);
@@ -934,7 +934,7 @@ gras_cfg_empty(gras_cfg_t cfg,const char*name) {
   }
 
   if (cell) {
-    gras_dynar_reset(cell->content);
+    xbt_dynar_reset(cell->content);
   }
   return no_error;
 }
@@ -942,101 +942,101 @@ gras_cfg_empty(gras_cfg_t cfg,const char*name) {
 /*----[ Getting ]---------------------------------------------------------*/
 
 /**
- * gras_cfg_get_int:
+ * xbt_cfg_get_int:
  * @cfg: the config set
  * @name: the name of the cell
  * @val: the wanted value
  *
  * Returns the first value from the config set under the given name.
- * If there is more than one value, it will issue a warning. Consider using gras_cfg_get_dynar() 
+ * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() 
  * instead.
  *
  * @warning the returned value is the actual content of the config set
  */
-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_cfgelm_t cell;
-  gras_error_t errcode;
+  xbt_cfgelm_t cell;
+  xbt_error_t errcode;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_int,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_int,&cell));
 
-  if (gras_dynar_length(cell->content) > 1) {
+  if (xbt_dynar_length(cell->content) > 1) {
     WARN2("You asked for the first value of the config element '%s', but there is %lu values",
-            name, gras_dynar_length(cell->content));
+            name, xbt_dynar_length(cell->content));
   }
 
-  *val = gras_dynar_get_as(cell->content, 0, int);
+  *val = xbt_dynar_get_as(cell->content, 0, int);
   return no_error;
 }
 
 /**
- * gras_cfg_get_double:
+ * xbt_cfg_get_double:
  * @cfg: the config set
  * @name: the name of the cell
  * @val: the wanted value
  *
  * Returns the first value from the config set under the given name.
- * If there is more than one value, it will issue a warning. Consider using gras_cfg_get_dynar() 
+ * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() 
  * instead.
  *
  * @warning the returned value is the actual content of the config set
  */
 
-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_cfgelm_t cell;
-  gras_error_t  errcode;
+  xbt_cfgelm_t cell;
+  xbt_error_t  errcode;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_double,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_double,&cell));
 
-  if (gras_dynar_length(cell->content) > 1) {
+  if (xbt_dynar_length(cell->content) > 1) {
     WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
-            name, gras_dynar_length(cell->content));
+            name, xbt_dynar_length(cell->content));
   }
 
-  *val = gras_dynar_get_as(cell->content, 0, double);
+  *val = xbt_dynar_get_as(cell->content, 0, double);
   return no_error;
 }
 
 /**
- * gras_cfg_get_string:
+ * xbt_cfg_get_string:
  *
  * @th: the config set
  * @name: the name of the cell
  * @val: the wanted value
  *
  * Returns the first value from the config set under the given name.
- * If there is more than one value, it will issue a warning. Consider using gras_cfg_get_dynar() 
+ * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() 
  * instead.
  *
  * @warning the returned value is the actual content of the config set
  */
 
-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_cfgelm_t  cell;
-  gras_error_t errcode;
+  xbt_cfgelm_t  cell;
+  xbt_error_t errcode;
 
   *val=NULL;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_string,&cell));
 
-  if (gras_dynar_length(cell->content) > 1) {
+  if (xbt_dynar_length(cell->content) > 1) {
     WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
-            name, gras_dynar_length(cell->content));
+            name, xbt_dynar_length(cell->content));
   }
 
-  *val = gras_dynar_get_as(cell->content, 0, char *);
+  *val = xbt_dynar_get_as(cell->content, 0, char *);
   return no_error;
 }
 
 /**
- * gras_cfg_get_host:
+ * xbt_cfg_get_host:
  *
  * @cfg: the config set
  * @name: the name of the cell
@@ -1044,28 +1044,28 @@ gras_error_t gras_cfg_get_string(gras_cfg_t  cfg,
  * @port: the port number
  *
  * Returns the first value from the config set under the given name.
- * If there is more than one value, it will issue a warning. Consider using gras_cfg_get_dynar() 
+ * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() 
  * instead.
  *
  * @warning the returned value is the actual content of the config set
  */
 
-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_cfgelm_t cell;
-  gras_error_t  errcode;
-  gras_host_t  *val;
+  xbt_cfgelm_t cell;
+  xbt_error_t  errcode;
+  xbt_host_t  *val;
 
-  TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
+  TRY (xbt_cfgelm_get(cfg,name,xbt_cfgelm_host,&cell));
 
-  if (gras_dynar_length(cell->content) > 1) {
+  if (xbt_dynar_length(cell->content) > 1) {
     WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
-            name, gras_dynar_length(cell->content));
+            name, xbt_dynar_length(cell->content));
   }
 
-  val = gras_dynar_get_as(cell->content, 0, gras_host_t*);
+  val = xbt_dynar_get_as(cell->content, 0, xbt_host_t*);
   *host=val->name;
   *port=val->port;
   
@@ -1073,7 +1073,7 @@ gras_error_t gras_cfg_get_host  (gras_cfg_t  cfg,
 }
 
 /**
- * gras_cfg_get_dynar:
+ * xbt_cfg_get_dynar:
  * @cfg: where to search in
  * @name: what to search for
  * @dynar: result
@@ -1082,11 +1082,11 @@ gras_error_t gras_cfg_get_host  (gras_cfg_t  cfg,
  *
  * @warning the returned value is the actual content of the config set
  */
-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,
-                                gras_dynar_t *dynar) {
-  gras_cfgelm_t cell;
-  gras_error_t  errcode = gras_dict_get((gras_dict_t)cfg,name,
+                                xbt_dynar_t *dynar) {
+  xbt_cfgelm_t cell;
+  xbt_error_t  errcode = xbt_dict_get((xbt_dict_t)cfg,name,
                                        (void**)&cell);
 
   if (errcode == mismatch_error) {
index 2a79ff1..c622e78 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <stdio.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt,
    "Dictionaries provide the same functionnalities than hash tables");
 
 /*####[ Private prototypes ]#################################################*/
@@ -24,38 +24,38 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt,
 /*####[ Code ]###############################################################*/
 
 /**
- * gras_dict_new:
+ * xbt_dict_new:
  *
  * @whereto: pointer to the destination
  *
  * Creates and initialize a new dictionnary
  */
-gras_dict_t 
-gras_dict_new(void) {
-  gras_dict_t res= gras_new(s_gras_dict_t,1);
+xbt_dict_t 
+xbt_dict_new(void) {
+  xbt_dict_t res= xbt_new(s_xbt_dict_t,1);
   res->head=NULL;
   return res;
 }
 /**
- * gras_dict_free:
+ * xbt_dict_free:
  * @dict: the dictionnary to be freed
  *
  * Frees a cache structure with all its childs.
  */
 void
-gras_dict_free(gras_dict_t *dict)  {
+xbt_dict_free(xbt_dict_t *dict)  {
   if (dict && *dict) {
     if ((*dict)->head) {
-      gras_dictelm_free( &( (*dict)->head ) );
+      xbt_dictelm_free( &( (*dict)->head ) );
       (*dict)->head = NULL;
     }
-    gras_free(*dict);
+    xbt_free(*dict);
     *dict=NULL;
   }
 }
 
 /**
- * gras_dict_set_ext:
+ * xbt_dict_set_ext:
  *
  * @p_dict: the container
  * @key: the key to set the new data
@@ -66,20 +66,20 @@ gras_dict_free(gras_dict_t *dict)  {
  * of data, as long as its length is provided in @key_len.
  */
 void
-gras_dict_set_ext(gras_dict_t      dict,
+xbt_dict_set_ext(xbt_dict_t      dict,
                  const char      *key,
                  int              key_len,
                  void            *data,
                  void_f_pvoid_t  *free_ctn) {
 
-  gras_assert(dict);
+  xbt_assert(dict);
 
-  gras_dictelm_set_ext(&(dict->head),
+  xbt_dictelm_set_ext(&(dict->head),
                       key, key_len, data, free_ctn);
 }
 
 /**
- * gras_dict_set:
+ * xbt_dict_set:
  *
  * @head: the head of the dict
  * @key: the key to set the new data
@@ -90,18 +90,18 @@ gras_dict_set_ext(gras_dict_t      dict,
  * null terminated string.
  */
 void
-gras_dict_set(gras_dict_t     dict,
+xbt_dict_set(xbt_dict_t     dict,
              const char     *key,
              void           *data,
              void_f_pvoid_t *free_ctn) {
 
-  gras_assert(dict);
+  xbt_assert(dict);
   
-  gras_dictelm_set(&(dict->head), key, data, free_ctn);
+  xbt_dictelm_set(&(dict->head), key, data, free_ctn);
 }
 
 /**
- * gras_dict_get_ext:
+ * xbt_dict_get_ext:
  *
  * @dict: the dealer of data
  * @key: the key to find data
@@ -110,19 +110,19 @@ gras_dict_set(gras_dict_t     dict,
  *
  * Search the given @key. mismatch_error when not found.
  */
-gras_error_t
-gras_dict_get_ext(gras_dict_t     dict,
+xbt_error_t
+xbt_dict_get_ext(xbt_dict_t     dict,
                  const char     *key,
                  int             key_len,
                  /* OUT */void **data) {
 
-  gras_assert(dict);
+  xbt_assert(dict);
 
-  return gras_dictelm_get_ext(dict->head, key, key_len, data);
+  return xbt_dictelm_get_ext(dict->head, key, key_len, data);
 }
 
 /**
- * gras_dict_get:
+ * xbt_dict_get:
  *
  * @dict: the dealer of data
  * @key: the key to find data
@@ -131,69 +131,69 @@ gras_dict_get_ext(gras_dict_t     dict,
  *
  * Search the given @key. mismatch_error when not found.
  */
-gras_error_t
-gras_dict_get(gras_dict_t     dict,
+xbt_error_t
+xbt_dict_get(xbt_dict_t     dict,
              const char     *key,
              /* OUT */void **data) {
-  gras_assert(dict);
+  xbt_assert(dict);
 
-  return gras_dictelm_get(dict->head, key, data);
+  return xbt_dictelm_get(dict->head, key, data);
 }
 
 
 /**
- * gras_dict_remove_ext:
+ * xbt_dict_remove_ext:
  *
  * @dict: the trash can
  * @key: the key of the data to be removed
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Remove the entry associated with the given @key
  */
-gras_error_t
-gras_dict_remove_ext(gras_dict_t  dict,
+xbt_error_t
+xbt_dict_remove_ext(xbt_dict_t  dict,
                      const char  *key,
                      int          key_len) {
-  gras_assert(dict);
+  xbt_assert(dict);
   
-  return gras_dictelm_remove_ext(dict->head, key, key_len);
+  return xbt_dictelm_remove_ext(dict->head, key, key_len);
 }
 
 /**
- * gras_dict_remove:
+ * xbt_dict_remove:
  *
  * @head: the head of the dict
  * @key: the key of the data to be removed
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Remove the entry associated with the given @key
  */
-gras_error_t
-gras_dict_remove(gras_dict_t  dict,
+xbt_error_t
+xbt_dict_remove(xbt_dict_t  dict,
                 const char  *key) {
   if (!dict) 
      RAISE1(mismatch_error,"Asked to remove key %s from NULL dict",key);
 
-  return gras_dictelm_remove(dict->head, key);
+  return xbt_dictelm_remove(dict->head, key);
 }
 
 
 /**
- * gras_dict_dump:
+ * xbt_dict_dump:
  *
  * @dict: the exibitionist
  * @output: a function to dump each data in the tree
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Ouputs the content of the structure. (for debuging purpose). @ouput is a
  * function to output the data. If NULL, data won't be displayed.
  */
 
 void
-gras_dict_dump(gras_dict_t     dict,
+xbt_dict_dump(xbt_dict_t     dict,
                void_f_pvoid_t *output) {
 
   printf("Dict %p:\n", (void*)dict);
-  gras_dictelm_dump(dict ? dict->head: NULL, output);
+  xbt_dictelm_dump(dict ? dict->head: NULL, output);
 }
 
index 3b600aa..48eab46 100644 (file)
 
 #include <string.h> /* strlen() */
 
-GRAS_LOG_EXTERNAL_CATEGORY(dict);
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict_cursor,dict,"To traverse dictionaries");
+XBT_LOG_EXTERNAL_CATEGORY(dict);
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dict_cursor,dict,"To traverse dictionaries");
 
 
 /*####[ Dict cursor functions ]#############################################*/
 /* To traverse (simple) dicts                                               */
 /* Don't add or remove entries to the dict while traversing !!!             */
 /*###########################################################################*/
-struct gras_dict_cursor_ {
+struct xbt_dict_cursor_ {
   /* we store all level encountered until here, to backtrack on next() */
-  gras_dynar_t   keys;
-  gras_dynar_t   key_lens;
+  xbt_dynar_t   keys;
+  xbt_dynar_t   key_lens;
   int            pos;
   int            pos_len;
-  gras_dictelm_t head;
+  xbt_dictelm_t head;
 };
 
-static _GRAS_INLINE void
-_cursor_push_keys(gras_dict_cursor_t p_cursor,
-                  gras_dictelm_t     p_elm);
+static _XBT_INLINE void
+_cursor_push_keys(xbt_dict_cursor_t p_cursor,
+                  xbt_dictelm_t     p_elm);
 
-#undef gras_dict_CURSOR_DEBUG
-/*#define gras_dict_CURSOR_DEBUG 1*/
+#undef xbt_dict_CURSOR_DEBUG
+/*#define xbt_dict_CURSOR_DEBUG 1*/
 
 /**
- * gras_dict_cursor_new:
+ * xbt_dict_cursor_new:
  *
  * @head: the head of the dict
  * @cursor: the curent position in the dict
  *
  * Structure creator
  */
-gras_dict_cursor_t 
-gras_dict_cursor_new(const gras_dict_t head) {
-  gras_error_t        errcode  = no_error;
-  gras_dict_cursor_t res = NULL;
-
-  res = gras_new(s_gras_dict_cursor_t,1);
-  res->keys     = gras_dynar_new(sizeof(char **), NULL);
-  res->key_lens = gras_dynar_new(sizeof(int  *),  NULL);
+xbt_dict_cursor_t 
+xbt_dict_cursor_new(const xbt_dict_t head) {
+  xbt_error_t        errcode  = no_error;
+  xbt_dict_cursor_t res = NULL;
+
+  res = xbt_new(s_xbt_dict_cursor_t,1);
+  res->keys     = xbt_dynar_new(sizeof(char **), NULL);
+  res->key_lens = xbt_dynar_new(sizeof(int  *),  NULL);
   res->pos      = 0;
   res->pos_len  = 0;
   res->head     = head ? head->head : NULL;
 
-  gras_dict_cursor_rewind(res);
+  xbt_dict_cursor_rewind(res);
 
   return res;
 }
 
 /**
- * gras_dict_cursor_free:
+ * xbt_dict_cursor_free:
  *
  * @cursor: poor victim
  *
  * Structure destructor
  */
 void
-gras_dict_cursor_free(gras_dict_cursor_t *cursor) {
+xbt_dict_cursor_free(xbt_dict_cursor_t *cursor) {
   if (*cursor) {
-    gras_dynar_free(&((*cursor)->keys));
-    gras_dynar_free(&((*cursor)->key_lens));
-    gras_free(*cursor);
+    xbt_dynar_free(&((*cursor)->keys));
+    xbt_dynar_free(&((*cursor)->key_lens));
+    xbt_free(*cursor);
     *cursor = NULL;
   }
 }
@@ -84,11 +84,11 @@ gras_dict_cursor_free(gras_dict_cursor_t *cursor) {
  *
  * Sanity check to see if the head contains something
  */
-static _GRAS_INLINE
-gras_error_t
-__cursor_not_null(gras_dict_cursor_t cursor) {
+static _XBT_INLINE
+xbt_error_t
+__cursor_not_null(xbt_dict_cursor_t cursor) {
 
-  gras_assert0(cursor, "Null cursor");
+  xbt_assert0(cursor, "Null cursor");
 
   if (!cursor->head) {
     return mismatch_error;
@@ -98,24 +98,24 @@ __cursor_not_null(gras_dict_cursor_t cursor) {
 }
 
 
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_cursor_push_keys(gras_dict_cursor_t cursor,
-                  gras_dictelm_t     elm) {
-  gras_error_t         errcode = no_error;
-  gras_dictelm_t       child = NULL;
+_cursor_push_keys(xbt_dict_cursor_t cursor,
+                  xbt_dictelm_t     elm) {
+  xbt_error_t         errcode = no_error;
+  xbt_dictelm_t       child = NULL;
   int                  i       = 0;
   static volatile int  count   = 0; /* ??? */
 
   CDEBUG1(dict_cursor, "Push childs of %p in the cursor", (void*)elm);
 
   if (elm->content) {
-    gras_dynar_push(cursor->keys,     &elm->key    );
-    gras_dynar_push(cursor->key_lens, &elm->key_len);
+    xbt_dynar_push(cursor->keys,     &elm->key    );
+    xbt_dynar_push(cursor->key_lens, &elm->key_len);
     count++;
   }
 
-  gras_dynar_foreach(elm->sub, i, child) {
+  xbt_dynar_foreach(elm->sub, i, child) {
     if (child)
       _cursor_push_keys(cursor, child);
   }
@@ -124,142 +124,142 @@ _cursor_push_keys(gras_dict_cursor_t cursor,
 }
 
 /**
- * gras_dict_cursor_rewind:
+ * xbt_dict_cursor_rewind:
  * @cursor: the cursor
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * back to the first element
  */
 void
-gras_dict_cursor_rewind(gras_dict_cursor_t cursor) {
-  gras_error_t errcode = no_error;
+xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) {
+  xbt_error_t errcode = no_error;
 
-  CDEBUG0(dict_cursor, "gras_dict_cursor_rewind");
-  gras_assert(cursor);
+  CDEBUG0(dict_cursor, "xbt_dict_cursor_rewind");
+  xbt_assert(cursor);
 
-  gras_dynar_reset(cursor->keys);
-  gras_dynar_reset(cursor->key_lens);
+  xbt_dynar_reset(cursor->keys);
+  xbt_dynar_reset(cursor->key_lens);
 
   if (!cursor->head)
     return ;
 
   _cursor_push_keys(cursor, cursor->head);
 
-  gras_dynar_cursor_first(cursor->keys,     &cursor->pos    );
-  gras_dynar_cursor_first(cursor->key_lens, &cursor->pos_len);
+  xbt_dynar_cursor_first(cursor->keys,     &cursor->pos    );
+  xbt_dynar_cursor_first(cursor->key_lens, &cursor->pos_len);
 
 }
 
 /**
- * gras_dict_cursor_first:
+ * xbt_dict_cursor_first:
  * @dict: on what to let the cursor iterate
  * @cursor: dest address
  *
  * Create the cursor if it does not exists. Rewind it in any case.
  */
-void gras_dict_cursor_first (const gras_dict_t   dict,
-                            gras_dict_cursor_t *cursor){
+void xbt_dict_cursor_first (const xbt_dict_t   dict,
+                            xbt_dict_cursor_t *cursor){
 
   if (!*cursor) {
     DEBUG0("Create the cursor on first use");
-    *cursor=gras_dict_cursor_new(dict);
+    *cursor=xbt_dict_cursor_new(dict);
   }
 
-  gras_dict_cursor_rewind(*cursor);
+  xbt_dict_cursor_rewind(*cursor);
 }
 
 
 /**
- * gras_dict_cursor_step:
+ * xbt_dict_cursor_step:
  * @cursor: the cursor
  *
  * Move to the next element. 
  */
 void
-gras_dict_cursor_step(gras_dict_cursor_t cursor) {
-  gras_assert(cursor);
+xbt_dict_cursor_step(xbt_dict_cursor_t cursor) {
+  xbt_assert(cursor);
 
-  gras_dynar_cursor_step(cursor->keys,     &cursor->pos);
-  gras_dynar_cursor_step(cursor->key_lens, &cursor->pos_len);
+  xbt_dynar_cursor_step(cursor->keys,     &cursor->pos);
+  xbt_dynar_cursor_step(cursor->key_lens, &cursor->pos_len);
 }
 
 /**
- * gras_dict_cursor_get_or_free:
+ * xbt_dict_cursor_get_or_free:
  * @cursor: the cursor
  * @Returns: true if it's ok, false if there is no more data
  *
  * Get current data
  */
 int
-gras_dict_cursor_get_or_free(gras_dict_cursor_t  *cursor,
+xbt_dict_cursor_get_or_free(xbt_dict_cursor_t  *cursor,
                             char               **key,
                             void               **data) {
-  gras_error_t  errcode = no_error;
+  xbt_error_t  errcode = no_error;
   int           key_len = 0;
   
   if (!cursor || !(*cursor))
     return FALSE;
 
-  if (gras_dynar_length((*cursor)->keys) <= (*cursor)->pos) {
-    gras_dict_cursor_free(cursor);
+  if (xbt_dynar_length((*cursor)->keys) <= (*cursor)->pos) {
+    xbt_dict_cursor_free(cursor);
     return FALSE;
   }
     
-  *key    = gras_dynar_get_as((*cursor)->keys,     (*cursor)->pos,     char*);
-  key_len = gras_dynar_get_as((*cursor)->key_lens, (*cursor)->pos_len, int);
+  *key    = xbt_dynar_get_as((*cursor)->keys,     (*cursor)->pos,     char*);
+  key_len = xbt_dynar_get_as((*cursor)->key_lens, (*cursor)->pos_len, int);
 
-  errcode = gras_dictelm_get_ext((*cursor)->head, *key, key_len, data);
+  errcode = xbt_dictelm_get_ext((*cursor)->head, *key, key_len, data);
   if (errcode == mismatch_error) {
-    gras_dict_cursor_free(cursor);
+    xbt_dict_cursor_free(cursor);
     return FALSE;
   }
 
-  gras_assert1(errcode == no_error,
+  xbt_assert1(errcode == no_error,
               "Unexpected problem while retrieving the content of cursor. Got %s",
-              gras_error_name(errcode));
+              xbt_error_name(errcode));
 
   return TRUE;
 }
 
 /**
- * gras_dict_cursor_get_key:
+ * xbt_dict_cursor_get_key:
  * @cursor: the cursor
  * @key: the current element
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Get current key
  */
-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 errcode = no_error;
+  xbt_error_t errcode = no_error;
 
   TRY(__cursor_not_null(cursor));
 
-  *key = gras_dynar_get_as(cursor->keys, cursor->pos - 1, char*);
+  *key = xbt_dynar_get_as(cursor->keys, cursor->pos - 1, char*);
 
   return errcode;
 }
 
 /**
- * gras_dict_cursor_get_data:
+ * xbt_dict_cursor_get_data:
  * @cursor: the cursor
  *
  * Get current data
  */
-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) {
-  gras_error_t  errcode = no_error;
+  xbt_error_t  errcode = no_error;
   char         *key     = NULL;
   int           key_len = 0;
 
   TRY(__cursor_not_null(cursor));
 
-  key     = gras_dynar_get_as(cursor->keys,     cursor->pos-1,  char *);
-  key_len = gras_dynar_get_as(cursor->key_lens, cursor->pos_len-1, int);
+  key     = xbt_dynar_get_as(cursor->keys,     cursor->pos-1,  char *);
+  key_len = xbt_dynar_get_as(cursor->key_lens, cursor->pos_len-1, int);
 
-  TRY(gras_dictelm_get_ext(cursor->head, key, key_len, data));
+  TRY(xbt_dictelm_get_ext(cursor->head, key, key_len, data));
 
   return errcode;
 }
index a2dd562..20458b4 100644 (file)
 
 #include "dict_private.h"  /* prototypes of this module */
 
-GRAS_LOG_EXTERNAL_CATEGORY(dict);
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict_elm,dict,"Dictionaries internals");
+XBT_LOG_EXTERNAL_CATEGORY(dict);
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dict_elm,dict,"Dictionaries internals");
 
-GRAS_LOG_NEW_SUBCATEGORY(dict_add,dict,"Dictionaries internals: elements addition");
-GRAS_LOG_NEW_SUBCATEGORY(dict_search,dict,"Dictionaries internals: searching");
-GRAS_LOG_NEW_SUBCATEGORY(dict_remove,dict,"Dictionaries internals: elements removal");
-GRAS_LOG_NEW_SUBCATEGORY(dict_collapse,dict,"Dictionaries internals: post-removal cleanup");
-GRAS_LOG_NEW_SUBCATEGORY(dict_multi,dict,"Dictionaries internals: dictionaries of dictionaries");
+XBT_LOG_NEW_SUBCATEGORY(dict_add,dict,"Dictionaries internals: elements addition");
+XBT_LOG_NEW_SUBCATEGORY(dict_search,dict,"Dictionaries internals: searching");
+XBT_LOG_NEW_SUBCATEGORY(dict_remove,dict,"Dictionaries internals: elements removal");
+XBT_LOG_NEW_SUBCATEGORY(dict_collapse,dict,"Dictionaries internals: post-removal cleanup");
+XBT_LOG_NEW_SUBCATEGORY(dict_multi,dict,"Dictionaries internals: dictionaries of dictionaries");
 
 /*####[ Private prototypes ]#################################################*/
 
-static _GRAS_INLINE void _gras_dictelm_alloc(char                *key,
+static _XBT_INLINE void _xbt_dictelm_alloc(char                *key,
                                             int                  offset,
                                             int                  key_len,
                                             void                *data,
                                             void_f_pvoid_t      *free_f,
-                                            /*OUT*/s_gras_dictelm_t **where);
+                                            /*OUT*/s_xbt_dictelm_t **where);
 static void         _dictelm_wrapper_free(void*);
 
-static _GRAS_INLINE void  _str_prefix_lgr(const char *key1,
+static _XBT_INLINE void  _str_prefix_lgr(const char *key1,
                                          int         key_len1,
                                          const char *key2,
                                          int         key_len2,
@@ -37,78 +37,78 @@ static _GRAS_INLINE void  _str_prefix_lgr(const char *key1,
                                          int        *match);
 
 
-static void _gras_dictelm_dump_rec(s_gras_dictelm_t *head,
+static void _xbt_dictelm_dump_rec(s_xbt_dictelm_t *head,
                                   int             offset,
                                   void_f_pvoid_t *output);
 
 
 
-static void _gras_dictelm_set_rec(s_gras_dictelm_t *head,
+static void _xbt_dictelm_set_rec(s_xbt_dictelm_t *head,
                                  char           *key,
                                  int             key_len,
                                  int             offset,
                                  void           *data,
                                  void_f_pvoid_t *free_f);
-static gras_error_t _gras_dictelm_get_rec(s_gras_dictelm_t *head,
+static xbt_error_t _xbt_dictelm_get_rec(s_xbt_dictelm_t *head,
                                               const char     *key,
                                               int             key_len,
                                               int             offset,
                                               /* OUT */void **data);
-static gras_error_t _gras_dictelm_remove_rec(s_gras_dictelm_t *head,
+static xbt_error_t _xbt_dictelm_remove_rec(s_xbt_dictelm_t *head,
                                             const char     *key,
                                             int             key_len,
                                             int             offset);
 
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_collapse_if_need(s_gras_dictelm_t *p_head,
+_collapse_if_need(s_xbt_dictelm_t *p_head,
                  int             pos,
                  int             offset);
 
 /* ---- */
 
-static _GRAS_INLINE
+static _XBT_INLINE
 void *
-gras_memdup(const void * const ptr,
+xbt_memdup(const void * const ptr,
            const size_t       length) {
   void * new_ptr = NULL;
 
-  new_ptr = gras_malloc(length);
+  new_ptr = xbt_malloc(length);
   memcpy(new_ptr, ptr, length);
    
   return new_ptr;
 }
 
 /*
- * _gras_nibble_to_char:
+ * _xbt_nibble_to_char:
  *
  * Change any byte to a printable char
  */
 
-static _GRAS_INLINE
+static _XBT_INLINE
 char
-_gras_nibble_to_char(unsigned char c) {
+_xbt_nibble_to_char(unsigned char c) {
   c &= 0x0f;
   return c>9 ? c-10+'a' : c + '0';
 }
 
 /*
- * _gras_bytes_to_string:
+ * _xbt_bytes_to_string:
  *
  * Change any byte array to a printable string
  * The length of string_container should at least be data_len*2+1 
  */
-static _GRAS_INLINE
+static _XBT_INLINE
 char *
-_gras_bytes_to_string(char * const ptr,
+_xbt_bytes_to_string(char * const ptr,
                       int          data_len,
                       char * const string_container) {
   unsigned char *src = (unsigned char *)ptr;
            char *dst = string_container;
 
   while (data_len--) {
-    *dst++ = _gras_nibble_to_char(*src   & 0x0f     );
-    *dst++ = _gras_nibble_to_char(*src++ & 0xf0 >> 4);
+    *dst++ = _xbt_nibble_to_char(*src   & 0x0f     );
+    *dst++ = _xbt_nibble_to_char(*src++ & 0xf0 >> 4);
   }
 
   *dst = 0;
@@ -119,57 +119,57 @@ _gras_bytes_to_string(char * const ptr,
 /* ---- */
 
 /*
- * _gras_dictelm_alloc:
+ * _xbt_dictelm_alloc:
  *
  * Alloc a dict element with no child.
  */
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_gras_dictelm_alloc(char                *key,
+_xbt_dictelm_alloc(char                *key,
                    int                  key_len,
                    int                  offset,
                    void                *data,
                    void_f_pvoid_t      *free_f,
-                 /*OUT*/s_gras_dictelm_t **pp_elm) {
-  gras_error_t   errcode = no_error;
-  s_gras_dictelm_t *p_elm  = NULL;
+                 /*OUT*/s_xbt_dictelm_t **pp_elm) {
+  xbt_error_t   errcode = no_error;
+  s_xbt_dictelm_t *p_elm  = NULL;
 
-  p_elm = gras_new(s_gras_dictelm_t,1);
+  p_elm = xbt_new(s_xbt_dictelm_t,1);
 
   p_elm->key      = key;
   p_elm->key_len  = key_len;
   p_elm->offset   = offset;
   p_elm->content  = data;
   p_elm->free_f = free_f;
-  p_elm->sub      = gras_dynar_new(sizeof(s_gras_dictelm_t*), _dictelm_wrapper_free);
+  p_elm->sub      = xbt_dynar_new(sizeof(s_xbt_dictelm_t*), _dictelm_wrapper_free);
 
   *pp_elm = p_elm;
 
 }
 
 /**
- * gras_dictelm_free:
+ * xbt_dictelm_free:
  *
  * @pp_elm: the dict elem to be freed
  *
  * Frees a dictionnary element with all its childs.
  */
 void
-gras_dictelm_free(s_gras_dictelm_t **pp_elm)  {
+xbt_dictelm_free(s_xbt_dictelm_t **pp_elm)  {
   if (*pp_elm) {
-    s_gras_dictelm_t *p_elm = *pp_elm;
+    s_xbt_dictelm_t *p_elm = *pp_elm;
 
-    gras_dynar_free(&(p_elm->sub));
+    xbt_dynar_free(&(p_elm->sub));
 
     if (p_elm->key) {
-      gras_free(p_elm->key);
+      xbt_free(p_elm->key);
     }
 
     if (p_elm->free_f && p_elm->content) {
       p_elm->free_f(p_elm->content);
     }
 
-    gras_free(p_elm);
+    xbt_free(p_elm);
     *pp_elm = NULL;
   }
 }
@@ -183,9 +183,9 @@ static
 void
 _dictelm_wrapper_free(void *pp_elm) {
   DEBUG3("Free dictelm '%.*s' %p", 
-        (*(s_gras_dictelm_t**)pp_elm)->key_len, (*(s_gras_dictelm_t**)pp_elm)->key,
+        (*(s_xbt_dictelm_t**)pp_elm)->key_len, (*(s_xbt_dictelm_t**)pp_elm)->key,
         *(void**)pp_elm);
-  gras_dictelm_free((s_gras_dictelm_t**)pp_elm);
+  xbt_dictelm_free((s_xbt_dictelm_t**)pp_elm);
 }
 
 /*####[ utility functions ]##################################################*/
@@ -196,7 +196,7 @@ _dictelm_wrapper_free(void *pp_elm) {
  * Returns the length of the common prefix of @str1 and @str2.
  * Do make sure the strings are not null
  */
-static _GRAS_INLINE
+static _XBT_INLINE
 void
 _str_prefix_lgr(const char *key1,
                int         key_len1,
@@ -252,23 +252,23 @@ _str_prefix_lgr(const char *key1,
  * _dictelm_child_cmp:
  *
  * Compares two dictelm keys and return their matching (using the same 
- * convention than @_gras_dict_child_search() )
+ * convention than @_xbt_dict_child_search() )
  */
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_dict_child_cmp(s_gras_dictelm_t *p_dict,
+_dict_child_cmp(s_xbt_dictelm_t *p_dict,
                 int          pos,
                 const char  *key,
                 const int    key_len,
                 int         *p_offset,
                 int         *p_match,
                 int         *p_cmp) {
-  s_gras_dictelm_t  *p_child = NULL;
+  s_xbt_dictelm_t  *p_child = NULL;
   int           cmp     = 0;
   int           o       = *p_offset;
   int           m       = *p_match;
 
-  p_child = gras_dynar_get_as(p_dict->sub, pos, s_gras_dictelm_t*);
+  p_child = xbt_dynar_get_as(p_dict->sub, pos, s_xbt_dictelm_t*);
 
   /* Compute the length of the prefix
      and if the searched key is before or after cur */
@@ -298,7 +298,7 @@ _dict_child_cmp(s_gras_dictelm_t *p_dict,
 }
 
 /**
- * _gras_dict_child_search:
+ * _xbt_dict_child_search:
  *
  * Search where would be inserted @key between the childs of @p_elm.
  * 
@@ -319,9 +319,9 @@ _dict_child_cmp(s_gras_dictelm_t *p_dict,
  *  handled by previous levels of recursion. In output, that the one counting
  *  also this level.                                                         
  */
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_gras_dictelm_child_search(s_gras_dictelm_t *p_elm,
+_xbt_dictelm_child_search(s_xbt_dictelm_t *p_elm,
                           const char  *key,
                           int          key_len,
                           int         *p_pos,
@@ -337,10 +337,10 @@ _gras_dictelm_child_search(s_gras_dictelm_t *p_elm,
   CDEBUG5(dict_search, "search child [%.*s] under [%.*s] (len=%lu)",
          key_len, key,
           p_elm?p_elm->key_len:6, p_elm?p_elm->key:"(head)",
-         (p_elm&&p_elm->sub)?gras_dynar_length(p_elm->sub):0);
+         (p_elm&&p_elm->sub)?xbt_dynar_length(p_elm->sub):0);
   
 
-  len = gras_dynar_length(p_elm->sub);
+  len = xbt_dynar_length(p_elm->sub);
 
   for (p = 0; p < len; p++) {
     int          cmp     = 0;
@@ -370,13 +370,13 @@ _gras_dictelm_child_search(s_gras_dictelm_t *p_elm,
 }
 
 /**
- * _gras_dictelm_change_value:
+ * _xbt_dictelm_change_value:
  *
  * Change the value of the dictelm, making sure to free the old one, if any.
  */
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_gras_dictelm_change_value(s_gras_dictelm_t    *p_elm,
+_xbt_dictelm_change_value(s_xbt_dictelm_t    *p_elm,
                           void           *data,
                           void_f_pvoid_t *free_f) {
 
@@ -389,7 +389,7 @@ _gras_dictelm_change_value(s_gras_dictelm_t    *p_elm,
 }
 
 /**
- * _gras_dictelm_set_rec:
+ * _xbt_dictelm_set_rec:
  *
  * @head: the head of the dict
  * @key: the key to set the new data
@@ -400,11 +400,11 @@ _gras_dictelm_change_value(s_gras_dictelm_t    *p_elm,
  * set the @data in the structure under the @key. The @key is destroyed
  * in the process. Think to strdup it before.
  *
- * This is a helper function to gras_dict_set which locks the struct and
+ * This is a helper function to xbt_dict_set which locks the struct and
  * strdup the key before action. 
  */
 void
-_gras_dictelm_set_rec(s_gras_dictelm_t     *p_head,
+_xbt_dictelm_set_rec(s_xbt_dictelm_t     *p_head,
                         char            *key,
                         int              key_len,
                         int              offset,
@@ -427,14 +427,14 @@ _gras_dictelm_set_rec(s_gras_dictelm_t     *p_head,
 
     CDEBUG0(dict_add, "--> Change the value of head");
 
-    _gras_dictelm_change_value(p_head, data, free_f);
-    gras_free(key); /* Keep the key used in the tree */
+    _xbt_dictelm_change_value(p_head, data, free_f);
+    xbt_free(key); /* Keep the key used in the tree */
 
     return;
   }
 
   /*** Search where to add this child, and how ***/
-  _gras_dictelm_child_search(p_head, key, key_len, &pos, &offset, &match);
+  _xbt_dictelm_child_search(p_head, key, key_len, &pos, &offset, &match);
 
   CDEBUG3(dict_add, "child_search => pos=%d, offset=%d, match=%d",
          pos, offset, match);
@@ -443,87 +443,87 @@ _gras_dictelm_set_rec(s_gras_dictelm_t     *p_head,
 
   case 0: /* no child have a common prefix */
     {
-      s_gras_dictelm_t *p_child = NULL;
+      s_xbt_dictelm_t *p_child = NULL;
 
-      _gras_dictelm_alloc(key, key_len, offset, data, free_f, &p_child);
+      _xbt_dictelm_alloc(key, key_len, offset, data, free_f, &p_child);
       CDEBUG1(dict_add, "-> Add a child %p", (void*)p_child);
-      gras_dynar_insert_at(p_head->sub, pos, &p_child);
+      xbt_dynar_insert_at(p_head->sub, pos, &p_child);
 
       return;
     }
 
   case 1: /* A child have exactly this key => change its value*/
     {
-      s_gras_dictelm_t *p_child = NULL;
+      s_xbt_dictelm_t *p_child = NULL;
 
-      p_child = gras_dynar_get_as(p_head->sub, pos, s_gras_dictelm_t*);
+      p_child = xbt_dynar_get_as(p_head->sub, pos, s_xbt_dictelm_t*);
       CDEBUG1(dict_add, "-> Change the value of the child %p", (void*)p_child);
-      _gras_dictelm_change_value(p_child, data, free_f);
+      _xbt_dictelm_change_value(p_child, data, free_f);
 
-      gras_free(key);
+      xbt_free(key);
 
       return;
     }
 
   case 2: /* A child constitutes a prefix of the key => recurse */
     {
-      s_gras_dictelm_t *p_child = NULL;
+      s_xbt_dictelm_t *p_child = NULL;
 
-      p_child=gras_dynar_get_as(p_head->sub, pos, s_gras_dictelm_t*);
+      p_child=xbt_dynar_get_as(p_head->sub, pos, s_xbt_dictelm_t*);
       CDEBUG2(dict_add,"-> Recurse on %p (offset=%d)", (void*)p_child, offset);
 
-      _gras_dictelm_set_rec(p_child, key, key_len, 
+      _xbt_dictelm_set_rec(p_child, key, key_len, 
                            offset, data, free_f);
       return;
     }
 
   case 3: /* The key is a prefix of the child => child becomes child of p_new */
     {
-      s_gras_dictelm_t *p_new   = NULL;
-      s_gras_dictelm_t *p_child = NULL;
+      s_xbt_dictelm_t *p_new   = NULL;
+      s_xbt_dictelm_t *p_child = NULL;
 
-      p_child=gras_dynar_get_as(p_head->sub, pos, s_gras_dictelm_t*);
-      _gras_dictelm_alloc(key, key_len, old_offset, data, free_f, &p_new);
+      p_child=xbt_dynar_get_as(p_head->sub, pos, s_xbt_dictelm_t*);
+      _xbt_dictelm_alloc(key, key_len, old_offset, data, free_f, &p_new);
 
       CDEBUG2(dict_add, "-> The child %p become child of new dict (%p)",
               (void*)p_child, (void*)p_new);
 
-      gras_dynar_push(p_new->sub, &p_child);
+      xbt_dynar_push(p_new->sub, &p_child);
       p_child->offset = offset;
-      gras_dynar_set(p_head->sub, pos, &p_new);
+      xbt_dynar_set(p_head->sub, pos, &p_new);
 
       return;
     }
 
   case 4: /* A child share a common prefix with this key => Common ancestor */
     {
-      s_gras_dictelm_t *p_new       = NULL;
-      s_gras_dictelm_t *p_child     = NULL;
-      s_gras_dictelm_t *p_anc       = NULL;
+      s_xbt_dictelm_t *p_new       = NULL;
+      s_xbt_dictelm_t *p_child     = NULL;
+      s_xbt_dictelm_t *p_anc       = NULL;
       char        *anc_key     = NULL;
       int          anc_key_len = offset;
 
-      _gras_dictelm_alloc(key, key_len, offset, data, free_f, &p_new);
-      p_child=gras_dynar_get_as(p_head->sub, pos, s_gras_dictelm_t*);
+      _xbt_dictelm_alloc(key, key_len, offset, data, free_f, &p_new);
+      p_child=xbt_dynar_get_as(p_head->sub, pos, s_xbt_dictelm_t*);
 
-      anc_key = gras_memdup(key, anc_key_len);
+      anc_key = xbt_memdup(key, anc_key_len);
 
-      _gras_dictelm_alloc(anc_key, anc_key_len, old_offset, NULL, NULL, &p_anc);
+      _xbt_dictelm_alloc(anc_key, anc_key_len, old_offset, NULL, NULL, &p_anc);
 
       CDEBUG3(dict_add, "-> Make a common ancestor %p (%.*s)",
              (void*)p_anc, anc_key_len, anc_key);
 
       if (key[offset] < p_child->key[offset]) {
-        gras_dynar_push(p_anc->sub, &p_new);
-        gras_dynar_push(p_anc->sub, &p_child);
+        xbt_dynar_push(p_anc->sub, &p_new);
+        xbt_dynar_push(p_anc->sub, &p_child);
       } else {
-        gras_dynar_push(p_anc->sub, &p_child);
-        gras_dynar_push(p_anc->sub, &p_new);
+        xbt_dynar_push(p_anc->sub, &p_child);
+        xbt_dynar_push(p_anc->sub, &p_new);
       }
 
       p_child->offset = offset;
 
-      gras_dynar_set(p_head->sub, pos, &p_anc);
+      xbt_dynar_set(p_head->sub, pos, &p_anc);
 
       return;
     }
@@ -534,7 +534,7 @@ _gras_dictelm_set_rec(s_gras_dictelm_t     *p_head,
 }
 
 /**
- * gras_dictelm_set_ext:
+ * xbt_dictelm_set_ext:
  *
  * @head: the head of the dict
  * @key: the key to set the new data
@@ -545,38 +545,38 @@ _gras_dictelm_set_rec(s_gras_dictelm_t     *p_head,
  * of data, as long as its length is provided in @key_len.
  */
 void
-gras_dictelm_set_ext(s_gras_dictelm_t **pp_head,
+xbt_dictelm_set_ext(s_xbt_dictelm_t **pp_head,
                        const char      *_key,
                        int              key_len,
                        void            *data,
                        void_f_pvoid_t  *free_f) {
-  s_gras_dictelm_t  *p_head  = *pp_head;
+  s_xbt_dictelm_t  *p_head  = *pp_head;
   char         *key     =  NULL;
 
-  key = gras_memdup(_key, key_len);
+  key = xbt_memdup(_key, key_len);
 
   /* there is no head, create it */
   if (!p_head) {
-    s_gras_dictelm_t *p_child = NULL;
+    s_xbt_dictelm_t *p_child = NULL;
 
     CDEBUG0(dict_add, "Create an head");
 
     /* The head is priviledged by being the only one with a NULL key */
-    _gras_dictelm_alloc(NULL, 0, 0, NULL, NULL, &p_head);
+    _xbt_dictelm_alloc(NULL, 0, 0, NULL, NULL, &p_head);
 
-    _gras_dictelm_alloc(key, key_len, 0, data, free_f, &p_child);
-    gras_dynar_insert_at(p_head->sub, 0, &p_child);
+    _xbt_dictelm_alloc(key, key_len, 0, data, free_f, &p_child);
+    xbt_dynar_insert_at(p_head->sub, 0, &p_child);
 
     *pp_head = p_head;
 
     return;
   }
 
-  _gras_dictelm_set_rec(p_head, key, key_len, 0, data, free_f);
+  _xbt_dictelm_set_rec(p_head, key, key_len, 0, data, free_f);
 }
 
 /**
- * gras_dictelm_set:
+ * xbt_dictelm_set:
  *
  * @head: the head of the dict
  * @key: the key to set the new data
@@ -587,16 +587,16 @@ gras_dictelm_set_ext(s_gras_dictelm_t **pp_head,
  * null terminated string.
  */
 void
-gras_dictelm_set(s_gras_dictelm_t **pp_head,
+xbt_dictelm_set(s_xbt_dictelm_t **pp_head,
                    const char      *_key,
                    void            *data,
                    void_f_pvoid_t  *free_f) {
 
-  gras_dictelm_set_ext(pp_head, _key, 1+strlen(_key), data, free_f);
+  xbt_dictelm_set_ext(pp_head, _key, 1+strlen(_key), data, free_f);
 }
 
 /**
- * _gras_dict_get_rec:
+ * _xbt_dict_get_rec:
  *
  * @head: the head of the dict
  * @key: the key to find data
@@ -607,8 +607,8 @@ gras_dictelm_set(s_gras_dictelm_t **pp_head,
  * Search the given @key. mismatch_error when not found.
  */
 static 
-gras_error_t
-_gras_dictelm_get_rec(s_gras_dictelm_t *p_head,
+xbt_error_t
+_xbt_dictelm_get_rec(s_xbt_dictelm_t *p_head,
                      const char     *key,
                      int             key_len,
                      int             offset,
@@ -633,7 +633,7 @@ _gras_dictelm_get_rec(s_gras_dictelm_t *p_head,
     *data = NULL; /* Make it ready to answer 'not found' in one operation */
 
     /*** Search where is the good child, and how good it is ***/
-    _gras_dictelm_child_search(p_head, key, key_len, &pos, &offset, &match);
+    _xbt_dictelm_child_search(p_head, key, key_len, &pos, &offset, &match);
 
     switch (match) {
 
@@ -642,9 +642,9 @@ _gras_dictelm_get_rec(s_gras_dictelm_t *p_head,
 
     case 1: /* A child have exactly this key => Got it */
       {
-        s_gras_dictelm_t *p_child = NULL;
+        s_xbt_dictelm_t *p_child = NULL;
 
-        p_child = gras_dynar_get_as(p_head->sub, pos, s_gras_dictelm_t*);
+        p_child = xbt_dynar_get_as(p_head->sub, pos, s_xbt_dictelm_t*);
         *data = p_child->content;
 
         return no_error;
@@ -652,11 +652,11 @@ _gras_dictelm_get_rec(s_gras_dictelm_t *p_head,
 
     case 2: /* A child constitutes a prefix of the key => recurse */
       {
-        s_gras_dictelm_t *p_child = NULL;
+        s_xbt_dictelm_t *p_child = NULL;
 
-        p_child = gras_dynar_get_as(p_head->sub, pos, s_gras_dictelm_t*);
+        p_child = xbt_dynar_get_as(p_head->sub, pos, s_xbt_dictelm_t*);
 
-        return _gras_dictelm_get_rec(p_child, key, key_len, offset, data);
+        return _xbt_dictelm_get_rec(p_child, key, key_len, offset, data);
       }
 
     case 3: /* The key is a prefix of the child => not found */
@@ -672,7 +672,7 @@ _gras_dictelm_get_rec(s_gras_dictelm_t *p_head,
 }
 
 /**
- * gras_dictelm_get_ext:
+ * xbt_dictelm_get_ext:
  *
  * @head: the head of the dict
  * @key: the key to find data
@@ -681,8 +681,8 @@ _gras_dictelm_get_rec(s_gras_dictelm_t *p_head,
  *
  * Search the given @key. mismatch_error when not found.
  */
-gras_error_t
-gras_dictelm_get_ext(s_gras_dictelm_t *p_head,
+xbt_error_t
+xbt_dictelm_get_ext(s_xbt_dictelm_t *p_head,
                          const char     *key,
                          int             key_len,
                          /* OUT */void **data) {
@@ -691,11 +691,11 @@ gras_dictelm_get_ext(s_gras_dictelm_t *p_head,
     return mismatch_error;
   }
 
-  return _gras_dictelm_get_rec(p_head, key, key_len, 0, data);
+  return _xbt_dictelm_get_rec(p_head, key, key_len, 0, data);
 }
 
 /**
- * gras_dictelm_get:
+ * xbt_dictelm_get:
  *
  * @head: the head of the dict
  * @key: the key to find data
@@ -704,36 +704,36 @@ gras_dictelm_get_ext(s_gras_dictelm_t *p_head,
  *
  * Search the given @key. mismatch_error when not found.
  */
-gras_error_t
-gras_dictelm_get(s_gras_dictelm_t    *p_head,
+xbt_error_t
+xbt_dictelm_get(s_xbt_dictelm_t    *p_head,
                    const char     *key,
                    /* OUT */void **data) {
 
-  return gras_dictelm_get_ext(p_head, key, 1+strlen(key), data);
+  return xbt_dictelm_get_ext(p_head, key, 1+strlen(key), data);
 }
 
-/*----[ _gras_dict_collapse ]------------------------------------------------*/
-static _GRAS_INLINE
+/*----[ _xbt_dict_collapse ]------------------------------------------------*/
+static _XBT_INLINE
 void
-_collapse_if_need(gras_dictelm_t head,
+_collapse_if_need(xbt_dictelm_t head,
                  int            pos,
                  int            offset) {
-  gras_dictelm_t child = NULL;
+  xbt_dictelm_t child = NULL;
 
   CDEBUG2(dict_collapse, "Collapse %d of %p... ", pos, (void*)head);
 
   if (pos >= 0) {
     /* Remove the child if |it's key| == 0 (meaning it's dead) */
-    child = gras_dynar_get_as(head->sub, pos, gras_dictelm_t);
+    child = xbt_dynar_get_as(head->sub, pos, xbt_dictelm_t);
 
     if (offset >= child->key_len) {
 
-      gras_assert0(gras_dynar_length(child->sub) == 0,
+      xbt_assert0(xbt_dynar_length(child->sub) == 0,
                   "Found a dead child with grand childs. Internal error");
 
       CDEBUG1(dict_collapse, "Remove dead child %p.... ", (void*)child);
-      gras_dynar_remove_at(head->sub, pos, &child);
-      gras_dictelm_free(&child);
+      xbt_dynar_remove_at(head->sub, pos, &child);
+      xbt_dictelm_free(&child);
     }
   }
 
@@ -743,12 +743,12 @@ _collapse_if_need(gras_dictelm_t head,
   }
 
   if (head->content || head->free_f ||
-      gras_dynar_length(head->sub) != 1) {
+      xbt_dynar_length(head->sub) != 1) {
     CDEBUG0(dict_collapse, "Cannot collapse");
     return; /* cannot collapse */
   }
 
-  child = gras_dynar_get_as(head->sub, 0, gras_dictelm_t);
+  child = xbt_dynar_get_as(head->sub, 0, xbt_dictelm_t);
 
   /* Get the child's key as new key */
   CDEBUG2(dict_collapse,
@@ -756,32 +756,32 @@ _collapse_if_need(gras_dictelm_t head,
 
   head->content  = child->content;
   head->free_f = child->free_f;
-  gras_free(head->key);
+  xbt_free(head->key);
   head->key      = child->key;
   head->key_len  = child->key_len;
 
-  gras_dynar_free_container(&(head->sub)) ;
+  xbt_dynar_free_container(&(head->sub)) ;
 
   head->sub = child->sub;
-  gras_free(child);
+  xbt_free(child);
 }
 
 /**
- * _gras_dict_remove_rec:
+ * _xbt_dict_remove_rec:
  *
  * @head: the head of the dict
  * @key: the key of the data to be removed
  * @offset: offset on the key
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Remove the entry associated with the given @key
  */
-gras_error_t
-_gras_dictelm_remove_rec(gras_dictelm_t head,
+xbt_error_t
+_xbt_dictelm_remove_rec(xbt_dictelm_t head,
                         const char  *key,
                         int          key_len,
                         int          offset) {
-  gras_error_t errcode = no_error;
+  xbt_error_t errcode = no_error;
 
   /* there is no key to search, we did enough recursion => kill current */
   if (offset >= key_len) {
@@ -791,7 +791,7 @@ _gras_dictelm_remove_rec(gras_dictelm_t head,
       head->free_f(head->content);
     }
 
-    killme = !gras_dynar_length(head->sub);
+    killme = !xbt_dynar_length(head->sub);
     head->content  = NULL;
     head->free_f = NULL;
     _collapse_if_need(head, -1, offset);
@@ -809,7 +809,7 @@ _gras_dictelm_remove_rec(gras_dictelm_t head,
     int old_offset = offset;
 
     /*** Search where is the good child, and how good it is ***/
-    _gras_dictelm_child_search(head, key, key_len, &pos, &offset, &match);
+    _xbt_dictelm_child_search(head, key, key_len, &pos, &offset, &match);
 
     switch (match) {
 
@@ -817,12 +817,12 @@ _gras_dictelm_remove_rec(gras_dictelm_t head,
     case 2: /* A child constitutes a prefix of the key => recurse */
 
       {
-        s_gras_dictelm_t *p_child = NULL;
+        s_xbt_dictelm_t *p_child = NULL;
 
-        p_child = gras_dynar_get_as(head->sub, pos, s_gras_dictelm_t*);
+        p_child = xbt_dynar_get_as(head->sub, pos, s_xbt_dictelm_t*);
         /*DEBUG5("Recurse on child %d of %p to remove %.*s (prefix=%d)",
           pos, (void*)p_child, key+offset, key_len-offset,offset);*/
-        TRY(_gras_dictelm_remove_rec(p_child, key, key_len, offset));
+        TRY(_xbt_dictelm_remove_rec(p_child, key, key_len, offset));
 
         _collapse_if_need(head, pos, old_offset);
        return no_error;
@@ -844,16 +844,16 @@ _gras_dictelm_remove_rec(gras_dictelm_t head,
 }
 
 /**
- * gras_dictelm_remove_ext:
+ * xbt_dictelm_remove_ext:
  *
  * @head: the head of the dict
  * @key: the key of the data to be removed
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Remove the entry associated with the given @key
  */
-gras_error_t
-gras_dictelm_remove_ext(gras_dictelm_t head,
+xbt_error_t
+xbt_dictelm_remove_ext(xbt_dictelm_t head,
                        const char  *key,
                        int          key_len) {
   /* there is no head, go to hell */
@@ -861,33 +861,33 @@ gras_dictelm_remove_ext(gras_dictelm_t head,
     RAISE0(mismatch_error, "there is no head, go to hell");
   }
   
-  return _gras_dictelm_remove_rec(head, key, key_len, 0);
+  return _xbt_dictelm_remove_rec(head, key, key_len, 0);
 }
 
 /**
- * gras_dictelm_remove:
+ * xbt_dictelm_remove:
  *
  * @head: the head of the dict
  * @key: the key of the data to be removed
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Remove the entry associated with the given @key
  */
-gras_error_t
-gras_dictelm_remove(gras_dictelm_t head,
+xbt_error_t
+xbt_dictelm_remove(xbt_dictelm_t head,
                    const char     *key) {
-  return _gras_dictelm_remove_rec(head, key, 1+strlen(key),0);
+  return _xbt_dictelm_remove_rec(head, key, 1+strlen(key),0);
 }
 
-/*----[ _gras_dict_dump_rec ]------------------------------------------------*/
-/* private function to do the job of gras_dict_dump recursively              */
+/*----[ _xbt_dict_dump_rec ]------------------------------------------------*/
+/* private function to do the job of xbt_dict_dump recursively              */
 /*---------------------------------------------------------------------------*/
 static
 void
-_gras_dictelm_dump_rec(gras_dictelm_t  head,
+_xbt_dictelm_dump_rec(xbt_dictelm_t  head,
                       int             offset,
                       void_f_pvoid_t *output) {
-  gras_dictelm_t child   =     NULL;
+  xbt_dictelm_t child   =     NULL;
   char          *key     =     NULL;
   int            key_len =        0;
   int            i       =        0;
@@ -915,12 +915,12 @@ _gras_dictelm_dump_rec(gras_dictelm_t  head,
     } else {
       char *key_string = NULL;
 
-      key_string = gras_malloc(key_len*2+1);
-      _gras_bytes_to_string(key, key_len, key_string);
+      key_string = xbt_malloc(key_len*2+1);
+      _xbt_bytes_to_string(key, key_len, key_string);
 
       printf("%.*s|(%d)", key_len-offset, key_string + offset, offset);
 
-      gras_free(key_string);
+      xbt_free(key_string);
     }
 
   }
@@ -939,32 +939,32 @@ _gras_dictelm_dump_rec(gras_dictelm_t  head,
     printf("(null)");
   }
 
-  printf("    \t\t\t[ %lu child(s) ]\n", gras_dynar_length(head->sub));
+  printf("    \t\t\t[ %lu child(s) ]\n", xbt_dynar_length(head->sub));
 
-  gras_dynar_foreach(head->sub, i, child) 
-    _gras_dictelm_dump_rec(child, child->offset, output);
+  xbt_dynar_foreach(head->sub, i, child) 
+    _xbt_dictelm_dump_rec(child, child->offset, output);
 
 }
 
 /**
- * gras_dictelm_dump:
+ * xbt_dictelm_dump:
  *
  * @head: the head of the dict
  * @output: a function to dump each data in the tree
- * @Returns: gras_error_t
+ * @Returns: xbt_error_t
  *
  * Ouputs the content of the structure. (for debuging purpose). @ouput is a
  * function to output the data. If NULL, data won't be displayed.
  */
 
 void
-gras_dictelm_dump(gras_dictelm_t  head,
+xbt_dictelm_dump(xbt_dictelm_t  head,
                  void_f_pvoid_t *output) {
-  _gras_dictelm_dump_rec(head, 0, output);
+  _xbt_dictelm_dump_rec(head, 0, output);
 }
 
 /**
- * gras_dictelm_print_fct:
+ * xbt_dictelm_print_fct:
  *
  * @data:
  *
@@ -972,7 +972,7 @@ gras_dictelm_dump(gras_dictelm_t  head,
  */
 
 void
-gras_dictelm_print_fct(void *data) {
+xbt_dictelm_print_fct(void *data) {
   printf("tree %p", (void*)data);
 }
 
index 04484bc..67e5a5c 100644 (file)
@@ -9,8 +9,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_DICT_ELM_T_
-#define _GRAS_DICT_ELM_T_
+#ifndef _XBT_DICT_ELM_T_
+#define _XBT_DICT_ELM_T_
 
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dict.h"
 
 /*####[ Type definition ]####################################################*/
-typedef struct gras_dictelm_ {
+typedef struct xbt_dictelm_ {
   char           *key;
   int             key_len;
   int             offset; /* offset on the key */
   void           *content;
   void_f_pvoid_t *free_f; /*pointer to the function to call to free this ctn*/
 
-  gras_dynar_t    sub; /* sub */
-} s_gras_dictelm_t, *gras_dictelm_t;
+  xbt_dynar_t    sub; /* sub */
+} s_xbt_dictelm_t, *xbt_dictelm_t;
 
-typedef struct gras_dict_ {
-  s_gras_dictelm_t *head;
-} s_gras_dict_t;
+typedef struct xbt_dict_ {
+  s_xbt_dictelm_t *head;
+} s_xbt_dict_t;
 
-typedef struct gras_dict_cursor_ s_gras_dict_cursor_t;
+typedef struct xbt_dict_cursor_ s_xbt_dict_cursor_t;
 
 /*####[ Function prototypes ]################################################*/
-void gras_dictelm_free      (s_gras_dictelm_t **pp_elm);
+void xbt_dictelm_free      (s_xbt_dictelm_t **pp_elm);
 
-void gras_dictelm_set       (s_gras_dictelm_t **pp_head,
+void xbt_dictelm_set       (s_xbt_dictelm_t **pp_head,
                             const char      *_key,
                             void            *data,
                             void_f_pvoid_t  *free_ctn);
-void gras_dictelm_set_ext   (s_gras_dictelm_t **pp_head,
+void xbt_dictelm_set_ext   (s_xbt_dictelm_t **pp_head,
                             const char      *_key,
                             int              key_len,
                             void            *data,
                             void_f_pvoid_t  *free_ctn);
 
-gras_error_t gras_dictelm_get       (s_gras_dictelm_t *p_head,
+xbt_error_t xbt_dictelm_get       (s_xbt_dictelm_t *p_head,
                                     const char     *key,
                                     /* OUT */void **data);
-gras_error_t gras_dictelm_get_ext   (s_gras_dictelm_t *p_head,
+xbt_error_t xbt_dictelm_get_ext   (s_xbt_dictelm_t *p_head,
                                     const char     *key,
                                     int             key_len,
                                     /* OUT */void **data);
 
-gras_error_t gras_dictelm_remove    (s_gras_dictelm_t *p_head,
+xbt_error_t xbt_dictelm_remove    (s_xbt_dictelm_t *p_head,
                                     const char  *key);
-gras_error_t gras_dictelm_remove_ext(s_gras_dictelm_t *p_head,
+xbt_error_t xbt_dictelm_remove_ext(s_xbt_dictelm_t *p_head,
                                       const char  *key,
                                       int          key_len);
 
-void         gras_dictelm_dump      (s_gras_dictelm_t *p_head,
+void         xbt_dictelm_dump      (s_xbt_dictelm_t *p_head,
                                     void_f_pvoid_t *output);
 
-void         gras_dictelm_print_fct (void *data);
+void         xbt_dictelm_print_fct (void *data);
 
-#endif  /* _GRAS_DICT_ELM_T_ */
+#endif  /* _XBT_DICT_ELM_T_ */
 
index 28f0436..4fa3110 100644 (file)
 #include "xbt/dynar.h"
 #include <sys/types.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,xbt,"Dynamic arrays");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,xbt,"Dynamic arrays");
 
-typedef struct gras_dynar_s {
+typedef struct xbt_dynar_s {
   unsigned long          size;
   unsigned long          used;
   unsigned long          elmsize;
   void           *data;
   void_f_pvoid_t *free_f;
-} s_gras_dynar_t;
+} s_xbt_dynar_t;
 
 #define __sanity_check_dynar(dynar)       \
-           gras_assert0(dynar,           \
+           xbt_assert0(dynar,           \
                        "dynar is NULL")
 #define __sanity_check_idx(idx)                \
-           gras_assert1(idx >= 0,             \
+           xbt_assert1(idx >= 0,             \
                        "dynar idx(=%d) < 0", \
                        (int) (idx))
 #define __check_inbound_idx(dynar, idx)                                                \
-           gras_assert2(idx < dynar->used,                                             \
+           xbt_assert2(idx < dynar->used,                                             \
                        "dynar is not that long. You asked %d, but it's only %lu long", \
                        (int) (idx), (unsigned long) dynar->used)
 #define __check_sloppy_inbound_idx(dynar, idx)                                         \
-           gras_assert2(idx <= dynar->used,                                            \
+           xbt_assert2(idx <= dynar->used,                                            \
                        "dynar is not that long. You asked %d, but it's only %lu long", \
                        (int) (idx), (unsigned long) dynar->used)
 #define __check_populated_dynar(dynar)            \
-           gras_assert1(dynar->used,              \
+           xbt_assert1(dynar->used,              \
                        "dynar %p contains nothing",(void*)dynar)
 
-static _GRAS_INLINE 
-void _gras_clear_mem(void * const ptr,
+static _XBT_INLINE 
+void _xbt_clear_mem(void * const ptr,
                     const unsigned long length) {
   memset(ptr, 0, length);
 }
 
-static _GRAS_INLINE
-gras_error_t
-_gras_dynar_expand(gras_dynar_t const dynar,
+static _XBT_INLINE
+xbt_error_t
+_xbt_dynar_expand(xbt_dynar_t const dynar,
                    const int          nb) {
-  gras_error_t errcode     = no_error;
+  xbt_error_t errcode     = no_error;
   const unsigned long old_size    = dynar->size;
 
   if (nb > old_size) {
@@ -68,17 +68,17 @@ _gras_dynar_expand(gras_dynar_t const dynar,
 
     const unsigned long new_size    = nb > (2*(old_size+1)) ? nb : (2*(old_size+1));
     const unsigned long new_length  = new_size*elmsize;
-    char * const new_data    = gras_malloc0(elmsize*new_size);
+    char * const new_data    = xbt_malloc0(elmsize*new_size);
 
     DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb);
 
     if (old_data) {
       memcpy(new_data, old_data, used_length);
-      _gras_clear_mem(old_data, old_length);
-      gras_free(old_data);
+      _xbt_clear_mem(old_data, old_length);
+      xbt_free(old_data);
     }
 
-    _gras_clear_mem(new_data + used_length, new_length - used_length);
+    _xbt_clear_mem(new_data + used_length, new_length - used_length);
 
     dynar->size = new_size;
     dynar->data = new_data;
@@ -87,9 +87,9 @@ _gras_dynar_expand(gras_dynar_t const dynar,
   return errcode;
 }
 
-static _GRAS_INLINE
+static _XBT_INLINE
 void *
-_gras_dynar_elm(const gras_dynar_t  dynar,
+_xbt_dynar_elm(const xbt_dynar_t  dynar,
                const unsigned long idx) {
   char * const data    = dynar->data;
   const unsigned long elmsize = dynar->elmsize;
@@ -97,30 +97,30 @@ _gras_dynar_elm(const gras_dynar_t  dynar,
   return data + idx*elmsize;
 }
 
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_gras_dynar_get_elm(void  * const       dst,
-                    const gras_dynar_t  dynar,
+_xbt_dynar_get_elm(void  * const       dst,
+                    const xbt_dynar_t  dynar,
                     const unsigned long idx) {
-  void * const elm     = _gras_dynar_elm(dynar, idx);
+  void * const elm     = _xbt_dynar_elm(dynar, idx);
   const unsigned long elmsize = dynar->elmsize;
 
   memcpy(dst, elm, elmsize);
 }
 
-static _GRAS_INLINE
+static _XBT_INLINE
 void
-_gras_dynar_put_elm(const gras_dynar_t  dynar,
+_xbt_dynar_put_elm(const xbt_dynar_t  dynar,
                     const unsigned long idx,
                     const void * const  src) {
-  void * const elm     = _gras_dynar_elm(dynar, idx);
+  void * const elm     = _xbt_dynar_elm(dynar, idx);
   const unsigned long elmsize = dynar->elmsize;
 
   memcpy(elm, src, elmsize);
 }
 
 /**
- * gras_dynar_new:
+ * xbt_dynar_new:
  * @elm_size: size of each element in the dynar
  * @free_func: function to call each time we want to get rid of an element (or NULL if nothing to do).
  *
@@ -128,11 +128,11 @@ _gras_dynar_put_elm(const gras_dynar_t  dynar,
  * pointer of pointer. That is to say that dynars can contain either base
  * types (int, char, double, etc) or pointer of pointers (struct **).
  */
-gras_dynar_t 
-gras_dynar_new(const unsigned long           elmsize,
+xbt_dynar_t 
+xbt_dynar_new(const unsigned long           elmsize,
                void_f_pvoid_t * const free_f) {
    
-  gras_dynar_t dynar = gras_new0(s_gras_dynar_t,1);
+  xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t,1);
 
   dynar->size    = 0;
   dynar->used    = 0;
@@ -144,46 +144,46 @@ gras_dynar_new(const unsigned long           elmsize,
 }
 
 /**
- * gras_dynar_free_container:
+ * xbt_dynar_free_container:
  * @dynar: poor victim
  *
  * kilkil a dynar BUT NOT its content. Ie, the array is freed, but not what
  * its contain points to.
  */
 void
-gras_dynar_free_container(gras_dynar_t *dynar) {
+xbt_dynar_free_container(xbt_dynar_t *dynar) {
   if (dynar && *dynar) {
 
     if ((*dynar)->data) {
-      _gras_clear_mem((*dynar)->data, (*dynar)->size);
-      gras_free((*dynar)->data);
+      _xbt_clear_mem((*dynar)->data, (*dynar)->size);
+      xbt_free((*dynar)->data);
     }
 
-    _gras_clear_mem(*dynar, sizeof(s_gras_dynar_t));
+    _xbt_clear_mem(*dynar, sizeof(s_xbt_dynar_t));
 
-    gras_free(*dynar);
+    xbt_free(*dynar);
     *dynar=NULL;
   }
 }
 
 /**
- * gras_dynar_reset:
+ * xbt_dynar_reset:
  * @dynar: who to squeeze
  *
  * Frees the content and set the size to 0
  */
 void
-gras_dynar_reset(gras_dynar_t const dynar) {
+xbt_dynar_reset(xbt_dynar_t const dynar) {
 
   __sanity_check_dynar(dynar);
 
   DEBUG1("Reset the dynar %p",(void*)dynar);
   if (dynar->free_f) {
-    gras_dynar_map(dynar, dynar->free_f);
+    xbt_dynar_map(dynar, dynar->free_f);
   }
 
   if (dynar->data)
-    gras_free(dynar->data);
+    xbt_free(dynar->data);
 
   dynar->size = 0;
   dynar->used = 0;
@@ -191,33 +191,33 @@ gras_dynar_reset(gras_dynar_t const dynar) {
 }
 
 /**
- * gras_dynar_free:
+ * xbt_dynar_free:
  * @dynar: poor victim
  *
  * kilkil a dynar and its content
  */
 
 void
-gras_dynar_free(gras_dynar_t * dynar) {
+xbt_dynar_free(xbt_dynar_t * dynar) {
   if (dynar && *dynar) {
-    gras_dynar_reset(*dynar);
-    gras_dynar_free_container(dynar);
+    xbt_dynar_reset(*dynar);
+    xbt_dynar_free_container(dynar);
   }
 }
 
 /**
- * gras_dynar_length:
+ * xbt_dynar_length:
  * @dynar: the dynar we want to mesure
  *
  * Returns the count of elements in a dynar
  */
 unsigned long
-gras_dynar_length(const gras_dynar_t dynar) {
+xbt_dynar_length(const xbt_dynar_t dynar) {
   return (dynar ? (unsigned long) dynar->used : (unsigned long)0);
 }
 
 /**
- * gras_dynar_get_cpy:
+ * xbt_dynar_get_cpy:
  * @dynar: information dealer
  * @idx: index of the slot we want to retrive
  * @dst: where to pu the result to.
@@ -225,7 +225,7 @@ gras_dynar_length(const gras_dynar_t dynar) {
  * Retrieve a copy of the Nth element of a dynar.
  */
 void
-gras_dynar_get_cpy(const gras_dynar_t dynar,
+xbt_dynar_get_cpy(const xbt_dynar_t dynar,
                   const int          idx,
                   void       * const dst) {
 
@@ -233,11 +233,11 @@ gras_dynar_get_cpy(const gras_dynar_t dynar,
   __sanity_check_idx(idx);
   __check_inbound_idx(dynar, idx);
 
-  _gras_dynar_get_elm(dst, dynar, idx);
+  _xbt_dynar_get_elm(dst, dynar, idx);
 }
 
 /**
- * gras_dynar_get:
+ * xbt_dynar_get_ptr:
  * @dynar: information dealer
  * @idx: index of the slot we want to retrive
  * @dst: where to pu the result to.
@@ -246,55 +246,55 @@ gras_dynar_get_cpy(const gras_dynar_t dynar,
  * the dynar. Make a copy before fooling with it.
  */
 void*
-gras_dynar_get_ptr(const gras_dynar_t dynar,
+xbt_dynar_get_ptr(const xbt_dynar_t dynar,
                   const int          idx) {
 
   __sanity_check_dynar(dynar);
   __sanity_check_idx(idx);
   __check_inbound_idx(dynar, idx);
 
-  return _gras_dynar_elm(dynar, idx);
+  return _xbt_dynar_elm(dynar, idx);
 }
 
 /**
- * gras_dynar_set:
+ * xbt_dynar_set:
  * @dynar:
  * @idx:
  * @src: What will be feeded to the dynar
  *
  * Set the Nth element of a dynar, expanding the dynar if needed, BUT NOT freeing
  * the previous value at this position. If you want to free the previous content,
- * use gras_dynar_replace().
+ * use xbt_dynar_replace().
  */
 void
-gras_dynar_set(gras_dynar_t         dynar,
+xbt_dynar_set(xbt_dynar_t         dynar,
                const int            idx,
                const void   * const src) {
 
   __sanity_check_dynar(dynar);
   __sanity_check_idx(idx);
 
-  _gras_dynar_expand(dynar, idx+1);
+  _xbt_dynar_expand(dynar, idx+1);
 
   if (idx >= dynar->used) {
     dynar->used = idx+1;
   }
 
-  _gras_dynar_put_elm(dynar, idx, src);
+  _xbt_dynar_put_elm(dynar, idx, src);
 }
 
 /**
- * gras_dynar_replace:
+ * xbt_dynar_replace:
  * @dynar:
  * @idx:
  * @object:
  *
  * Set the Nth element of a dynar, expanding the dynar if needed, AND DO
  * free the previous value at this position. If you don't want to free the
- * previous content, use gras_dynar_set().
+ * previous content, use xbt_dynar_set().
  */
 void
-gras_dynar_replace(gras_dynar_t         dynar,
+xbt_dynar_replace(xbt_dynar_t         dynar,
                   const int            idx,
                   const void   * const object) {
 
@@ -302,23 +302,23 @@ gras_dynar_replace(gras_dynar_t         dynar,
   __sanity_check_idx(idx);
 
   if (idx < dynar->used && dynar->free_f) {
-    void * const old_object = _gras_dynar_elm(dynar, idx);
+    void * const old_object = _xbt_dynar_elm(dynar, idx);
 
     dynar->free_f(old_object);
   }
 
-  gras_dynar_set(dynar, idx, object);
+  xbt_dynar_set(dynar, idx, object);
 }
 
 /**
- * gras_dynar_insert_at_ptr:
+ * xbt_dynar_insert_at_ptr:
  * 
  * Make room for a new element in the dynar, and return a pointer to
  * its position. You can then use regular affectation to set its value
  * instead of relying on the slow memcpy
  */
 void *
-gras_dynar_insert_at_ptr(gras_dynar_t const dynar,
+xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
                         const int            idx) {
    
   __sanity_check_dynar(dynar);
@@ -329,24 +329,24 @@ gras_dynar_insert_at_ptr(gras_dynar_t const dynar,
     const unsigned long old_used = dynar->used;
     const unsigned long new_used = old_used + 1;
 
-    _gras_dynar_expand(dynar, new_used);
+    _xbt_dynar_expand(dynar, new_used);
 
     {
       const unsigned long nb_shift =  old_used - idx;
 
       if (nb_shift)
-        memmove(_gras_dynar_elm(dynar, idx+1), 
-                _gras_dynar_elm(dynar, idx), 
+        memmove(_xbt_dynar_elm(dynar, idx+1), 
+                _xbt_dynar_elm(dynar, idx), 
                 nb_shift * dynar->elmsize);
     }
 
     dynar->used = new_used;
-    return _gras_dynar_elm(dynar,idx);
+    return _xbt_dynar_elm(dynar,idx);
   }
 }
 
 /**
- * gras_dynar_insert_at:
+ * xbt_dynar_insert_at:
  * @dynar:
  * @idx:
  * @src: What will be feeded to the dynar
@@ -356,18 +356,18 @@ gras_dynar_insert_at_ptr(gras_dynar_t const dynar,
  * position right in the dynar.
  */
 void
-gras_dynar_insert_at(gras_dynar_t  const dynar,
+xbt_dynar_insert_at(xbt_dynar_t  const dynar,
                      const int            idx,
                      const void   * const src) {
 
-  /* checks done in gras_dynar_insert_at_ptr */
-  memcpy(gras_dynar_insert_at_ptr(dynar,idx),
+  /* checks done in xbt_dynar_insert_at_ptr */
+  memcpy(xbt_dynar_insert_at_ptr(dynar,idx),
         src,
         dynar->elmsize);
 }
 
 /**
- * gras_dynar_remove_at:
+ * xbt_dynar_remove_at:
  * @dynar: 
  * @idx:
  * @object:
@@ -376,7 +376,7 @@ gras_dynar_insert_at(gras_dynar_t  const dynar,
  * all subsequent values to one position left in the dynar.
  */
 void
-gras_dynar_remove_at(gras_dynar_t  const dynar,
+xbt_dynar_remove_at(xbt_dynar_t  const dynar,
                      const int            idx,
                      void         * const object) {
 
@@ -385,7 +385,7 @@ gras_dynar_remove_at(gras_dynar_t  const dynar,
   __check_inbound_idx(dynar, idx);
 
   if (object)
-    _gras_dynar_get_elm(object, dynar, idx);
+    _xbt_dynar_get_elm(object, dynar, idx);
 
   {
     const unsigned long old_used = dynar->used;
@@ -396,8 +396,8 @@ gras_dynar_remove_at(gras_dynar_t  const dynar,
 
     const unsigned long offset   =  nb_shift*elmsize;
 
-    void * const elm_src  = _gras_dynar_elm(dynar, idx+1);
-    void * const elm_dst  = _gras_dynar_elm(dynar, idx);
+    void * const elm_src  = _xbt_dynar_elm(dynar, idx+1);
+    void * const elm_dst  = _xbt_dynar_elm(dynar, idx);
 
     memmove(elm_dst, elm_src, offset);
 
@@ -406,95 +406,95 @@ gras_dynar_remove_at(gras_dynar_t  const dynar,
 }
 
 /**
- * gras_dynar_push_ptr:
+ * xbt_dynar_push_ptr:
  * 
  * Make room at the end of the dynar for a new element, and return a pointer to it
  */
 void *
-gras_dynar_push_ptr(gras_dynar_t  const dynar) {
-  return gras_dynar_insert_at_ptr(dynar, dynar->used);    
+xbt_dynar_push_ptr(xbt_dynar_t  const dynar) {
+  return xbt_dynar_insert_at_ptr(dynar, dynar->used);    
 }
 
 /**
- * gras_dynar_push:
+ * xbt_dynar_push:
  * @dynar:
  * @src:
  *
  * Add an element at the end of the dynar
  */
 void
-gras_dynar_push(gras_dynar_t  const dynar,
+xbt_dynar_push(xbt_dynar_t  const dynar,
                 const void   * const src) {
   /* sanity checks done by insert_at */
-  gras_dynar_insert_at(dynar, dynar->used, src); 
+  xbt_dynar_insert_at(dynar, dynar->used, src); 
 }
 
 /**
- * gras_dynar_pop_ptr:
+ * xbt_dynar_pop_ptr:
  * @dynar:
  * @dst:
  *
  * Make the last element of the dynar as unused and return a pointer to it.
  */
 void *
-gras_dynar_pop_ptr(gras_dynar_t  const dynar) {
+xbt_dynar_pop_ptr(xbt_dynar_t  const dynar) {
 
   __check_populated_dynar(dynar);
   DEBUG1("Pop %p",(void*)dynar);
   dynar->used--;
-  return _gras_dynar_elm(dynar,dynar->used);
+  return _xbt_dynar_elm(dynar,dynar->used);
 }
 
 /**
- * gras_dynar_pop:
+ * xbt_dynar_pop:
  * @dynar:
  * @dst:
  *
  * Get and remove the last element of the dynar
  */
 void
-gras_dynar_pop(gras_dynar_t  const dynar,
+xbt_dynar_pop(xbt_dynar_t  const dynar,
                void         * const dst) {
 
   /* sanity checks done by remove_at */
   DEBUG1("Pop %p",(void*)dynar);
-  gras_dynar_remove_at(dynar, dynar->used-1, dst);
+  xbt_dynar_remove_at(dynar, dynar->used-1, dst);
 }
 
 /**
- * gras_dynar_unshift:
+ * xbt_dynar_unshift:
  * @dynar:
  * @src:
  *
  * Add an element at the begining of the dynar (rather long, Use
- * gras_dynar_push() when possible)
+ * xbt_dynar_push() when possible)
  */
 void
-gras_dynar_unshift(gras_dynar_t  const dynar,
+xbt_dynar_unshift(xbt_dynar_t  const dynar,
                    const void   * const src) {
   
   /* sanity checks done by insert_at */
-  gras_dynar_insert_at(dynar, 0, src);
+  xbt_dynar_insert_at(dynar, 0, src);
 }
 
 /**
- * gras_dynar_shift:
+ * xbt_dynar_shift:
  * @dynar:
  * @dst:
  *
  * Get and remove the first element of the dynar (rather long, Use
- * gras_dynar_pop() when possible)
+ * xbt_dynar_pop() when possible)
  */
 void
-gras_dynar_shift(gras_dynar_t  const dynar,
+xbt_dynar_shift(xbt_dynar_t  const dynar,
                  void         * const dst) {
 
   /* sanity checks done by remove_at */
-  gras_dynar_remove_at(dynar, 0, dst);
+  xbt_dynar_remove_at(dynar, 0, dst);
 }
 
 /**
- * gras_dynar_map:
+ * xbt_dynar_map:
  * @dynar:
  * @operator:
  *
@@ -502,7 +502,7 @@ gras_dynar_shift(gras_dynar_t  const dynar,
  * value of the element itself, but should not mess with the dynar).
  */
 void
-gras_dynar_map(const gras_dynar_t  dynar,
+xbt_dynar_map(const xbt_dynar_t  dynar,
                void_f_pvoid_t     * const operator) {
 
   __sanity_check_dynar(dynar);
@@ -513,14 +513,14 @@ gras_dynar_map(const gras_dynar_t  dynar,
     unsigned long       i    = 0;
 
     for (i = 0; i < used; i++) {
-      _gras_dynar_get_elm(elm, dynar, i);
+      _xbt_dynar_get_elm(elm, dynar, i);
       operator(elm);
     }
   }
 }
 
 /**
- * gras_dynar_first:
+ * xbt_dynar_cursor_first:
  *
  * Put the cursor at the begining of the dynar. (actually, one step before
  * the begining, so that you can iterate over the dynar with a for loop).
@@ -531,7 +531,7 @@ gras_dynar_map(const gras_dynar_t  dynar,
  *
  */
 void
-gras_dynar_cursor_first(const gras_dynar_t dynar,
+xbt_dynar_cursor_first(const xbt_dynar_t dynar,
                        int        * const cursor) {
 
   DEBUG1("Set cursor on %p to the first position",(void*)dynar);
@@ -539,24 +539,24 @@ gras_dynar_cursor_first(const gras_dynar_t dynar,
 }
 
 /**
- * gras_dynar_cursor_step:
+ * xbt_dynar_cursor_step:
  *
  * Move the cursor to the next value (and return true), or return false.
  */
 void
-gras_dynar_cursor_step(const gras_dynar_t dynar,
+xbt_dynar_cursor_step(const xbt_dynar_t dynar,
                       int        * const cursor) {
   
   (*cursor)++;
 }
 
 /**
- * gras_dynar_cursor_get:
+ * xbt_dynar_cursor_get:
  *
  * Get the current value of the cursor
  */
 int
-gras_dynar_cursor_get(const gras_dynar_t dynar,
+xbt_dynar_cursor_get(const xbt_dynar_t dynar,
                      int                * const cursor,
                      void               * const dst) {
 
@@ -571,37 +571,37 @@ gras_dynar_cursor_get(const gras_dynar_t dynar,
     }
     DEBUG2("Cash out cursor on %p at %d",(void*)dynar,idx);
 
-    _gras_dynar_get_elm(dst, dynar, idx);
+    _xbt_dynar_get_elm(dst, dynar, idx);
   }
   return TRUE;
 
 }
 
 /**
- * gras_dynar_cursor_rm:
+ * xbt_dynar_cursor_rm:
  * @dynar:
  * @cursor:
  *
  * Remove (free) the entry pointed by the cursor, for use in the middle of a foreach
  */
-void gras_dynar_cursor_rm(gras_dynar_t dynar,
+void xbt_dynar_cursor_rm(xbt_dynar_t dynar,
                          int          * const cursor) {
   void *dst;
 
   if (dynar->elmsize > sizeof(void*)) {
     DEBUG0("Elements too big to fit into a pointer");
     if (dynar->free_f) {
-      dst=gras_malloc(dynar->elmsize);
-      gras_dynar_remove_at(dynar,(*cursor)--,dst);
+      dst=xbt_malloc(dynar->elmsize);
+      xbt_dynar_remove_at(dynar,(*cursor)--,dst);
       (dynar->free_f)(dst);
-      gras_free(dst);
+      xbt_free(dst);
     } else {
       DEBUG0("Ok, we dont care about the element without free function");
-      gras_dynar_remove_at(dynar,(*cursor)--,NULL);
+      xbt_dynar_remove_at(dynar,(*cursor)--,NULL);
     }
       
   } else {
-    gras_dynar_remove_at(dynar,(*cursor)--,&dst);
+    xbt_dynar_remove_at(dynar,(*cursor)--,&dst);
     if (dynar->free_f)
       (dynar->free_f)(dst);
   }
index 9cf52d5..d39050c 100644 (file)
 #include "xbt/error.h"
 
 /**
- * gras_error_name:
+ * xbt_error_name:
  * @errcode: 
  * @Returns: the printable name of an error code
  *
  * usefull to do nice error repporting messages
  */
 
-const char *gras_error_name(gras_error_t errcode)  {
+const char *xbt_error_name(xbt_error_t errcode)  {
 
    switch (errcode) {
       
@@ -34,11 +34,11 @@ const char *gras_error_name(gras_error_t errcode)  {
    }
 }
 
-GRAS_LOG_EXTERNAL_CATEGORY(gras);
-GRAS_LOG_DEFAULT_CATEGORY(gras);
+XBT_LOG_EXTERNAL_CATEGORY(gras);
+XBT_LOG_DEFAULT_CATEGORY(gras);
   
-void gras_die (const char *msg) {
+void xbt_die (const char *msg) {
    CRITICAL1("%s",msg);
-   gras_abort();
+   xbt_abort();
 }
 
index 3cfad1e..595576a 100644 (file)
 
 typedef struct {
   char *catname;
-  e_gras_log_priority_t thresh;
-} s_gras_log_setting_t,*gras_log_setting_t;
+  e_xbt_log_priority_t thresh;
+} s_xbt_log_setting_t,*xbt_log_setting_t;
 
-static gras_dynar_t gras_log_settings=NULL;
+static xbt_dynar_t xbt_log_settings=NULL;
 static void _free_setting(void *s) {
-  gras_log_setting_t set=(gras_log_setting_t)s;
+  xbt_log_setting_t set=(xbt_log_setting_t)s;
   if (set) {
-    gras_free(set->catname);
-/*    gras_free(set); FIXME: uncommenting this leads to segfault when more than one chunk is passed as gras-log */
+    xbt_free(set->catname);
+/*    xbt_free(set); FIXME: uncommenting this leads to segfault when more than one chunk is passed as gras-log */
   }
 }
 
-const char *gras_log_priority_names[8] = {
+const char *xbt_log_priority_names[8] = {
   "NONE",
   "TRACE",
   "DEBUG",
@@ -44,64 +44,64 @@ const char *gras_log_priority_names[8] = {
   "CRITICAL"
 };
 
-s_gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT) = {
+s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT) = {
   0, 0, 0,
-  "root", gras_log_priority_uninitialized, 0,
+  "root", xbt_log_priority_uninitialized, 0,
   NULL, 0
 };
 
-GRAS_LOG_NEW_SUBCATEGORY(gras,GRAS_LOG_ROOT_CAT,"All GRAS categories");
-GRAS_LOG_NEW_SUBCATEGORY(xbt,GRAS_LOG_ROOT_CAT,"All XBT categories (gras toolbox)");
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log,xbt,"Loggings from the logging mecanism itself");
+XBT_LOG_NEW_SUBCATEGORY(gras,XBT_LOG_ROOT_CAT,"All GRAS categories");
+XBT_LOG_NEW_SUBCATEGORY(xbt,XBT_LOG_ROOT_CAT,"All XBT categories (gras toolbox)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log,xbt,"Loggings from the logging mecanism itself");
 
 
-static void _apply_control(gras_log_category_t cat) {
+static void _apply_control(xbt_log_category_t cat) {
   int cursor;
-  gras_log_setting_t setting=NULL;
+  xbt_log_setting_t setting=NULL;
   int found = 0;
 
-  if (!gras_log_settings)
+  if (!xbt_log_settings)
     return;
 
-  gras_assert0(cat,"NULL category");
-  gras_assert(cat->name);
+  xbt_assert0(cat,"NULL category");
+  xbt_assert(cat->name);
 
-  gras_dynar_foreach(gras_log_settings,cursor,setting) {
-    gras_assert0(setting,"Damnit, NULL cat in the list");
-    gras_assert1(setting->catname,"NULL setting(=%p)->catname",(void*)setting);
+  xbt_dynar_foreach(xbt_log_settings,cursor,setting) {
+    xbt_assert0(setting,"Damnit, NULL cat in the list");
+    xbt_assert1(setting->catname,"NULL setting(=%p)->catname",(void*)setting);
 
     if (!strcmp(setting->catname,cat->name)) {
       found = 1;
 
-      gras_log_threshold_set(cat, setting->thresh);
-      gras_dynar_cursor_rm(gras_log_settings,&cursor);
+      xbt_log_threshold_set(cat, setting->thresh);
+      xbt_dynar_cursor_rm(xbt_log_settings,&cursor);
 
-      if (cat->threshold <= gras_log_priority_verbose) {
-       s_gras_log_event_t _log_ev = 
-         {cat,gras_log_priority_verbose,__FILE__,_GRAS_GNUC_FUNCTION,__LINE__};
-       _gras_log_event_log(&_log_ev,
+      if (cat->threshold <= xbt_log_priority_verbose) {
+       s_xbt_log_event_t _log_ev = 
+         {cat,xbt_log_priority_verbose,__FILE__,_XBT_GNUC_FUNCTION,__LINE__};
+       _xbt_log_event_log(&_log_ev,
                 "Apply settings for category '%s': set threshold to %s (=%d)",
                 cat->name, 
-                gras_log_priority_names[cat->threshold], cat->threshold);
+                xbt_log_priority_names[cat->threshold], cat->threshold);
       }
     }
   }
-  if (!found && cat->threshold <= gras_log_priority_verbose) {
-    s_gras_log_event_t _log_ev = 
-      {cat,gras_log_priority_verbose,__FILE__,_GRAS_GNUC_FUNCTION,__LINE__};
-    _gras_log_event_log(&_log_ev,
+  if (!found && cat->threshold <= xbt_log_priority_verbose) {
+    s_xbt_log_event_t _log_ev = 
+      {cat,xbt_log_priority_verbose,__FILE__,_XBT_GNUC_FUNCTION,__LINE__};
+    _xbt_log_event_log(&_log_ev,
                        "Category '%s': inherited threshold = %s (=%d)",
                        cat->name,
-                       gras_log_priority_names[cat->threshold], cat->threshold);
+                       xbt_log_priority_names[cat->threshold], cat->threshold);
   }
 
 }
 
-void _gras_log_event_log( gras_log_event_t ev, const char *fmt, ...) {
-  gras_log_category_t cat = ev->cat;
+void _xbt_log_event_log( xbt_log_event_t ev, const char *fmt, ...) {
+  xbt_log_category_t cat = ev->cat;
   va_start(ev->ap, fmt);
   while(1) {
-    gras_log_appender_t appender = cat->appender;
+    xbt_log_appender_t appender = cat->appender;
     if (appender != NULL) {
       appender->do_append(appender, ev, fmt);
     }
@@ -113,12 +113,12 @@ void _gras_log_event_log( gras_log_event_t ev, const char *fmt, ...) {
   va_end(ev->ap);
 }
 
-static void _cat_init(gras_log_category_t category) {
-  if (category == &_GRAS_LOGV(GRAS_LOG_ROOT_CAT)) {
-    category->threshold = gras_log_priority_info;
-    category->appender = gras_log_default_appender;
+static void _cat_init(xbt_log_category_t category) {
+  if (category == &_XBT_LOGV(XBT_LOG_ROOT_CAT)) {
+    category->threshold = xbt_log_priority_info;
+    category->appender = xbt_log_default_appender;
   } else {
-    gras_log_parent_set(category, category->parent);
+    xbt_log_parent_set(category, category->parent);
   }
   _apply_control(category);
 }
@@ -128,27 +128,27 @@ static void _cat_init(gras_log_category_t category) {
  * initialization. 
  * Also resets threshold to inherited!
  */
-int _gras_log_cat_init(e_gras_log_priority_t priority,
-                      gras_log_category_t   category) {
+int _xbt_log_cat_init(e_xbt_log_priority_t priority,
+                      xbt_log_category_t   category) {
     
   _cat_init(category);
         
   return priority >= category->threshold;
 }
 
-void gras_log_parent_set(gras_log_category_t cat,
-                        gras_log_category_t parent) {
+void xbt_log_parent_set(xbt_log_category_t cat,
+                        xbt_log_category_t parent) {
 
-  gras_assert0(cat,"NULL category to be given a parent");
-  gras_assert1(parent,"The parent category of %s is NULL",cat->name);
+  xbt_assert0(cat,"NULL category to be given a parent");
+  xbt_assert1(parent,"The parent category of %s is NULL",cat->name);
 
   /* unlink from current parent */
-  if (cat->threshold != gras_log_priority_uninitialized) {
-    gras_log_category_t* cpp = &parent->firstChild;
+  if (cat->threshold != xbt_log_priority_uninitialized) {
+    xbt_log_category_t* cpp = &parent->firstChild;
     while(*cpp != cat && *cpp != NULL) {
       cpp = &(*cpp)->nextSibling;
     }
-    gras_assert(*cpp == cat);
+    xbt_assert(*cpp == cat);
     *cpp = cat->nextSibling;
   }
 
@@ -158,7 +158,7 @@ void gras_log_parent_set(gras_log_category_t cat,
   parent->firstChild = cat;
 
   /* Make sure parent is initialized */
-  if (parent->threshold == gras_log_priority_uninitialized) {
+  if (parent->threshold == xbt_log_priority_uninitialized) {
     _cat_init(parent);
   }
     
@@ -167,28 +167,28 @@ void gras_log_parent_set(gras_log_category_t cat,
   cat->isThreshInherited = 1;
 } /* log_setParent */
 
-static void _set_inherited_thresholds(gras_log_category_t cat) {
-  gras_log_category_t child = cat->firstChild;
+static void _set_inherited_thresholds(xbt_log_category_t cat) {
+  xbt_log_category_t child = cat->firstChild;
   for( ; child != NULL; child = child->nextSibling) {
     if (child->isThreshInherited) {
-      if (cat != &_GRAS_LOGV(log))
+      if (cat != &_XBT_LOGV(log))
        VERB3("Set category threshold of %s to %s (=%d)",
-             child->name,gras_log_priority_names[cat->threshold],cat->threshold);
+             child->name,xbt_log_priority_names[cat->threshold],cat->threshold);
       child->threshold = cat->threshold;
       _set_inherited_thresholds(child);
     }
   }
 }
 
-void gras_log_threshold_set(gras_log_category_t   cat,
-                           e_gras_log_priority_t threshold) {
+void xbt_log_threshold_set(xbt_log_category_t   cat,
+                           e_xbt_log_priority_t threshold) {
   cat->threshold = threshold;
   cat->isThreshInherited = 0;
   _set_inherited_thresholds(cat);
 }
 
-static void _gras_log_parse_setting(const char*        control_string,
-                                   gras_log_setting_t set) {
+static void _xbt_log_parse_setting(const char*        control_string,
+                                   xbt_log_setting_t set) {
   const char *name, *dot, *eq;
   
   set->catname=NULL;
@@ -204,12 +204,12 @@ static void _gras_log_parse_setting(const char*        control_string,
   eq = control_string;
   control_string += strcspn(control_string, " ");
 
-  gras_assert1(*dot == '.' && *eq == '=',
+  xbt_assert1(*dot == '.' && *eq == '=',
               "Invalid control string '%s'",control_string);
 
   if (!strncmp(dot + 1, "thresh", min(eq - dot - 1,strlen("thresh")))) {
     int i;
-    char *neweq=gras_strdup(eq+1);
+    char *neweq=xbt_strdup(eq+1);
     char *p=neweq-1;
     
     while (*(++p) != '\0') {
@@ -219,41 +219,41 @@ static void _gras_log_parse_setting(const char*        control_string,
     }
     
     DEBUG1("New priority name = %s",neweq);
-    for (i=0; i<gras_log_priority_infinite-1; i++) {
-      if (!strncmp(gras_log_priority_names[i],neweq,p-eq)) {
+    for (i=0; i<xbt_log_priority_infinite-1; i++) {
+      if (!strncmp(xbt_log_priority_names[i],neweq,p-eq)) {
        DEBUG1("This is priority %d",i);
        break;
       }
     }
-    if (i<gras_log_priority_infinite-1) {
+    if (i<xbt_log_priority_infinite-1) {
       set->thresh=i;
     } else {
-      gras_assert1(FALSE,"Unknown priority name: %s",eq+1);
+      xbt_assert1(FALSE,"Unknown priority name: %s",eq+1);
     }
-    gras_free(neweq);
+    xbt_free(neweq);
   } else {
     char buff[512];
     snprintf(buff,min(512,eq - dot - 1),"%s",dot+1);
-    gras_assert1(FALSE,"Unknown setting of the log category: %s",buff);
+    xbt_assert1(FALSE,"Unknown setting of the log category: %s",buff);
   }
-  set->catname=(char*)gras_malloc(dot - name+1);
+  set->catname=(char*)xbt_malloc(dot - name+1);
     
   strncpy(set->catname,name,dot-name);
   set->catname[dot-name]='\0'; /* Just in case */
   DEBUG1("This is for cat '%s'", set->catname);
 }
 
-static gras_error_t _gras_log_cat_searchsub(gras_log_category_t cat,char *name,
-                                           /*OUT*/gras_log_category_t*whereto) {
-  gras_error_t errcode;
-  gras_log_category_t child;
+static xbt_error_t _xbt_log_cat_searchsub(xbt_log_category_t cat,char *name,
+                                           /*OUT*/xbt_log_category_t*whereto) {
+  xbt_error_t errcode;
+  xbt_log_category_t child;
   
   if (!strcmp(cat->name,name)) {
     *whereto=cat;
     return no_error;
   }
   for(child=cat->firstChild ; child != NULL; child = child->nextSibling) {
-    errcode=_gras_log_cat_searchsub(child,name,whereto);
+    errcode=_xbt_log_cat_searchsub(child,name,whereto);
     if (errcode==no_error)
       return no_error;
   }
@@ -293,7 +293,7 @@ static void _cleanup_double_spaces(char *s) {
 }
 
 /**
- * gras_log_control_set:
+ * xbt_log_control_set:
  * @cs: What to parse
  *
  * Typically passed a command-line argument. The string has the syntax:
@@ -310,9 +310,9 @@ static void _cleanup_double_spaces(char *s) {
  * This routine may only be called once and that must be before any other
  * logging command! Typically, this is done from main().
  */
-void gras_log_control_set(const char* control_string) {
-  gras_error_t errcode;
-  gras_log_setting_t set;
+void xbt_log_control_set(const char* control_string) {
+  xbt_error_t errcode;
+  xbt_log_setting_t set;
   char *cs;
   char *p;
   int done = 0;
@@ -320,17 +320,17 @@ void gras_log_control_set(const char* control_string) {
   DEBUG1("Parse log settings '%s'",control_string);
   if (control_string == NULL)
     return;
-  if (gras_log_settings == NULL)
-    gras_log_settings = gras_dynar_new(sizeof(gras_log_setting_t),
+  if (xbt_log_settings == NULL)
+    xbt_log_settings = xbt_dynar_new(sizeof(xbt_log_setting_t),
                                       _free_setting);
 
-  set = gras_new(s_gras_log_setting_t,1);
-  cs=gras_strdup(control_string);
+  set = xbt_new(s_xbt_log_setting_t,1);
+  cs=xbt_strdup(control_string);
 
   _cleanup_double_spaces(cs);
 
   while (!done) {
-    gras_log_category_t cat;
+    xbt_log_category_t cat;
     
     p=strrchr(cs,' ');
     if (p) {
@@ -340,31 +340,31 @@ void gras_log_control_set(const char* control_string) {
       p=cs;
       done = 1;
     }
-    _gras_log_parse_setting(p,set);
+    _xbt_log_parse_setting(p,set);
     
-    errcode = _gras_log_cat_searchsub(&_GRAS_LOGV(root),set->catname,&cat);
+    errcode = _xbt_log_cat_searchsub(&_XBT_LOGV(root),set->catname,&cat);
     if (errcode == mismatch_error) {
       DEBUG0("Store for further application");
       DEBUG1("push %p to the settings",(void*)set);
-      gras_dynar_push(gras_log_settings,&set);
+      xbt_dynar_push(xbt_log_settings,&set);
       /* malloc in advance the next slot */
-      set = gras_new(s_gras_log_setting_t,1);
+      set = xbt_new(s_xbt_log_setting_t,1);
     } else {
       DEBUG0("Apply directly");
-      gras_free(set->catname);
-      gras_log_threshold_set(cat,set->thresh);
+      xbt_free(set->catname);
+      xbt_log_threshold_set(cat,set->thresh);
     }
   }
-  gras_free(set);
-  gras_free(cs);
+  xbt_free(set);
+  xbt_free(cs);
 } 
 
-void gras_log_appender_set(gras_log_category_t cat, gras_log_appender_t app) {
+void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app) {
   cat->appender = app;
 }
 
-void gras_log_exit(void) {
+void xbt_log_exit(void) {
   VERB0("Exiting log");
-  gras_dynar_free(&gras_log_settings);
+  xbt_dynar_free(&xbt_log_settings);
   VERB0("Exited log");
 }
index c96adb6..28c5f36 100644 (file)
 #include "xbt/error.h"
 #include <stdio.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler");
 
 /**
  * The root category's default logging function.
  */
 
-extern const char *gras_log_priority_names[7];
+extern const char *xbt_log_priority_names[7];
 
-static void append_file(gras_log_appender_t this, gras_log_event_t ev,
+static void append_file(xbt_log_appender_t this, xbt_log_event_t ev,
                        const char *fmt);
 
 /*
-struct gras_log_appender_file_s {
-  gras_log_appender_t* appender;
+struct xbt_log_appender_file_s {
+  xbt_log_appender_t* appender;
   FILE *file;
 };
 */
 
-static s_gras_log_appender_t gras_log_appender_file = { append_file, NULL } ;
+static s_xbt_log_appender_t xbt_log_appender_file = { append_file, NULL } ;
 /* appender_data=FILE* */
 
-gras_log_appender_t gras_log_default_appender  = &gras_log_appender_file;
+xbt_log_appender_t xbt_log_default_appender  = &xbt_log_appender_file;
 
-static void append_file(gras_log_appender_t this,
-                       gras_log_event_t ev, 
+static void append_file(xbt_log_appender_t this,
+                       xbt_log_event_t ev, 
                        const char *fmt) {
 
   /* TODO: define a format field in struct for timestamp, etc.
@@ -46,15 +46,15 @@ static void append_file(gras_log_appender_t this,
     if ((FILE*)(this->appender_data) == NULL)
       this->appender_data = (void*)stderr;
     
-    gras_assert0(ev->priority>=0,
+    xbt_assert0(ev->priority>=0,
                 "Negative logging priority naturally forbidden");
-    gras_assert1(ev->priority<sizeof(gras_log_priority_names),
+    xbt_assert1(ev->priority<sizeof(xbt_log_priority_names),
                 "Priority %d is greater than the biggest allowed value",
                 ev->priority);
 
     fprintf(stderr, "%s:%d: ", ev->fileName, ev->lineNum);
     fprintf(stderr, "[%s/%s] ", 
-           ev->cat->name, gras_log_priority_names[ev->priority]);
+           ev->cat->name, xbt_log_priority_names[ev->priority]);
     vfprintf(stderr, fmt, ev->ap);
     fprintf(stderr, "\n");
 }
index d2a7188..44e6e87 100644 (file)
 #include "xbt_modinter.h"  /* prototype of other module's init/exit in XBT */
 #include "gras_modinter.h" /* same in GRAS */
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
 
-static int gras_running_process = 0;
+static int xbt_running_process = 0;
 
-struct gras_module_ {
-  gras_dynar_t *deps;
-  gras_cfg_t *cfg;
+struct xbt_module_ {
+  xbt_dynar_t *deps;
+  xbt_cfg_t *cfg;
   int ref;
-  gras_module_new_fct_t new;
-  gras_module_finalize_fct_t finalize;
+  xbt_module_new_fct_t new;
+  xbt_module_finalize_fct_t finalize;
 };
 
 void 
-gras_init(int *argc, char **argv) {
-   gras_init_defaultlog(argc, argv, NULL);
+xbt_init(int *argc, char **argv) {
+   xbt_init_defaultlog(argc, argv, NULL);
 }
 
 /**
- * gras_init_defaultlog:
+ * xbt_init_defaultlog:
  * @argc:
  * @argv:
  *
  * Initialize the gras mecanisms.
  */
 void
-gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
+xbt_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
   int i,j;
   char *opt;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   int found=0;
 
   INFO0("Initialize GRAS");
@@ -60,7 +60,7 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
       found = 1;
       opt=strchr(argv[i],'=');
       opt++;
-      gras_log_control_set(opt);
+      xbt_log_control_set(opt);
       DEBUG1("Did apply '%s' as log setting",opt);
       /*remove this from argv*/
       for (j=i+1; j<*argc; j++) {
@@ -72,12 +72,12 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
     }
   }
   if (!found && defaultlog) {
-     gras_log_control_set(defaultlog);
+     xbt_log_control_set(defaultlog);
   }
    
   gras_process_init(); /* calls procdata_init, which calls dynar_new */
   /** init other submodules */
-  if (gras_running_process++ == 0) {
+  if (xbt_running_process++ == 0) {
     gras_msg_init();
     gras_trp_init();
     gras_datadesc_init();
@@ -85,19 +85,19 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
 }
 
 /**
- * gras_exit:
+ * xbt_exit:
  *
  * Finalize the gras mecanisms.
  */
 void 
-gras_exit(){
+xbt_exit(){
   INFO0("Exiting GRAS");
   gras_process_exit();
-  if (--gras_running_process == 0) {
+  if (--xbt_running_process == 0) {
     gras_msg_exit();
     gras_trp_exit();
     gras_datadesc_exit();
   }
-  gras_log_exit();
+  xbt_log_exit();
   DEBUG0("Exited GRAS");
 }
index fe86a97..2d912e5 100644 (file)
 
 #include "xbt/set.h"
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt,"data container consisting in dict+dynar");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt,"data container consisting in dict+dynar");
 
 /*####[ Type definition ]####################################################*/
-typedef struct gras_set_ {
-  gras_dict_t  dict;  /* data stored by name */
-  gras_dynar_t dynar; /* data stored by ID   */
-} s_gras_set_t;
+typedef struct xbt_set_ {
+  xbt_dict_t  dict;  /* data stored by name */
+  xbt_dynar_t dynar; /* data stored by ID   */
+} s_xbt_set_t;
 
 /*####[ Memory  ]############################################################*/
 /**
- * gras_set_new:
+ * xbt_set_new:
  * @dst: where to
  *
  * Creates a new set.
  */
-gras_set_t gras_set_new (void) {
-  gras_set_t res=gras_new(s_gras_set_t,1);
-  gras_error_t errcode;
+xbt_set_t xbt_set_new (void) {
+  xbt_set_t res=xbt_new(s_xbt_set_t,1);
+  xbt_error_t errcode;
 
-  res->dict=gras_dict_new ();
-  res->dynar=gras_dynar_new(sizeof(void*),NULL);
+  res->dict=xbt_dict_new ();
+  res->dynar=xbt_dynar_new(sizeof(void*),NULL);
 
   return res;
 }
 
 /**
- * gras_set_free:
+ * xbt_set_free:
  * @set:
  *
  * Frees a set.
  */
-void  gras_set_free(gras_set_t *set) {
+void  xbt_set_free(xbt_set_t *set) {
   if (*set) {
-    gras_dict_free ( &( (*set)->dict  ) );
-    gras_dynar_free( &( (*set)->dynar ) );
-    gras_free(*set);
+    xbt_dict_free ( &( (*set)->dict  ) );
+    xbt_dynar_free( &( (*set)->dynar ) );
+    xbt_free(*set);
     *set = NULL;
   }
 }
 
 /**
- * gras_set_add:
+ * xbt_set_add:
  * @set: set to populate
  * @elm: element to add. 
  * @free_ctn: How to add the data 
@@ -69,18 +69,18 @@ void  gras_set_free(gras_set_t *set) {
  * elm->name_len is used as is unless it's <= 0 (in which case it's recomputed);
  * elm->ID is attributed automatically.
  */
-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_error_t   errcode;
-  gras_set_elm_t found_in_dict;
+  xbt_error_t   errcode;
+  xbt_set_elm_t found_in_dict;
 
   if (elm->name_len <= 0) {
     elm->name_len = strlen(elm->name);
   }
 
-  errcode = gras_dict_get_ext (set->dict, 
+  errcode = xbt_dict_get_ext (set->dict, 
                                    elm->name, elm->name_len,
                                    (void**)&found_in_dict);
   if (errcode == no_error) {
@@ -91,39 +91,39 @@ void gras_set_add    (gras_set_t      set,
     } else {
       elm->ID=found_in_dict->ID;
       DEBUG2("Reinsertion of key %s (id %d)", elm->name, elm->ID);
-      gras_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
-      gras_dynar_set(set->dynar, elm->ID, &elm);
+      xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
+      xbt_dynar_set(set->dynar, elm->ID, &elm);
       return;
     }
   } else {
-    gras_assert_error(mismatch_error);
+    xbt_assert_error(mismatch_error);
   }
 
-  elm->ID = gras_dynar_length( set->dynar );
-  gras_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
-  gras_dynar_set(set->dynar, elm->ID, &elm);
+  elm->ID = xbt_dynar_length( set->dynar );
+  xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func);
+  xbt_dynar_set(set->dynar, elm->ID, &elm);
   DEBUG2("Insertion of key '%s' (id %d)", elm->name, elm->ID);
 
 }
 
 /**
- * gras_set_get_by_name:
+ * xbt_set_get_by_name:
  * @set:
  * @name: Name of the searched cell
  * @dst: where to put the found data into
  *
  * get a data stored in the cell by providing its name.
  */
-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     *name,
-                                     /* OUT */gras_set_elm_t *dst) {
-  gras_error_t errcode;
-  errcode = gras_dict_get_ext(set->dict, name, strlen(name), (void**) dst);
-  DEBUG2("Lookup key %s: %s",name,gras_error_name(errcode));
+                                     /* OUT */xbt_set_elm_t *dst) {
+  xbt_error_t errcode;
+  errcode = xbt_dict_get_ext(set->dict, name, strlen(name), (void**) dst);
+  DEBUG2("Lookup key %s: %s",name,xbt_error_name(errcode));
   return errcode;
 }
 /**
- * gras_set_get_by_name_ext:
+ * xbt_set_get_by_name_ext:
  * @set:
  * @name: Name of the searched cell
  * @name_len: length of the name, when strlen cannot be trusted
@@ -133,16 +133,16 @@ gras_error_t gras_set_get_by_name    (gras_set_t     set,
  * of the name, when strlen cannot be trusted because you don't use a char*
  * as name, you weird guy).
  */
-gras_error_t gras_set_get_by_name_ext(gras_set_t      set,
+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) {
+                                     /* OUT */xbt_set_elm_t *dst) {
 
-  return gras_dict_get_ext (set->dict, name, name_len, (void**)dst);
+  return xbt_dict_get_ext (set->dict, name, name_len, (void**)dst);
 }
 
 /**
- * gras_set_get_by_code:
+ * xbt_set_get_by_code:
  * @set:
  * @id: what you're looking for
  * @dst: where to put the found data into
@@ -150,15 +150,15 @@ gras_error_t gras_set_get_by_name_ext(gras_set_t      set,
  * get a data stored in the cell by providing its id. 
  * @warning, if the ID does not exists, you're getting into trouble
  */
-gras_error_t gras_set_get_by_id      (gras_set_t      set,
+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) {
 
   /* Don't bother checking the bounds, the dynar does so */
 
-  *dst = gras_dynar_get_as(set->dynar,id,gras_set_elm_t);
+  *dst = xbt_dynar_get_as(set->dynar,id,xbt_set_elm_t);
   DEBUG3("Lookup type of id %d (of %lu): %s", 
-        id, gras_dynar_length(set->dynar), (*dst)->name);
+        id, xbt_dynar_length(set->dynar), (*dst)->name);
   
   return no_error;
 }
@@ -166,63 +166,63 @@ gras_error_t gras_set_get_by_id      (gras_set_t      set,
 /***
  *** Cursors
  ***/
-typedef struct gras_set_cursor_ {
-  gras_set_t set;
+typedef struct xbt_set_cursor_ {
+  xbt_set_t set;
   int val;
-} s_gras_set_cursor_t;
+} s_xbt_set_cursor_t;
 
 /**
- * gras_set_cursor_first:
+ * xbt_set_cursor_first:
  * @set: on what to let the cursor iterate
  * @cursor: dest address
  *
  * Create the cursor if it does not exists. Rewind it in any case.
  */
-void         gras_set_cursor_first       (gras_set_t         set,
-                                         gras_set_cursor_t *cursor) {
+void         xbt_set_cursor_first       (xbt_set_t         set,
+                                         xbt_set_cursor_t *cursor) {
 
   if (set != NULL) {
     if (!*cursor) {
       DEBUG0("Create the cursor on first use");
-      *cursor = gras_new(s_gras_set_cursor_t,1);
-      gras_assert0(*cursor,
+      *cursor = xbt_new(s_xbt_set_cursor_t,1);
+      xbt_assert0(*cursor,
                   "Malloc error during the creation of the cursor");
     }
     (*cursor)->set = set;
-    gras_dynar_cursor_first(set->dynar, &( (*cursor)->val) );
+    xbt_dynar_cursor_first(set->dynar, &( (*cursor)->val) );
   } else {
     *cursor = NULL;
   }
 }
 
 /**
- * gras_set_cursor_step:
+ * xbt_set_cursor_step:
  * @cursor: the cursor
  *
  * Move to the next element. 
  */
-void         gras_set_cursor_step        (gras_set_cursor_t cursor) {
-  gras_dynar_cursor_step(cursor->set->dynar, &( cursor->val ) );
+void         xbt_set_cursor_step        (xbt_set_cursor_t cursor) {
+  xbt_dynar_cursor_step(cursor->set->dynar, &( cursor->val ) );
 }
 
 /**
- * gras_set_cursor_get_or_free:
+ * xbt_set_cursor_get_or_free:
  * @cursor: the cursor
  * @Returns: true if it's ok, false if there is no more data
  *
  * Get current data
  */
-int          gras_set_cursor_get_or_free (gras_set_cursor_t *curs,
-                                         gras_set_elm_t    *elm) {
-  gras_set_cursor_t cursor;
+int          xbt_set_cursor_get_or_free (xbt_set_cursor_t *curs,
+                                         xbt_set_elm_t    *elm) {
+  xbt_set_cursor_t cursor;
 
   if (!curs || !(*curs))
     return FALSE;
 
   cursor=*curs;
 
-  if (! gras_dynar_cursor_get( cursor->set->dynar,&(cursor->val),elm) ) {
-    gras_free(cursor);
+  if (! xbt_dynar_cursor_get( cursor->set->dynar,&(cursor->val),elm) ) {
+    xbt_free(cursor);
     *curs=NULL;
     return FALSE;    
   } 
index 0734456..1858dce 100644 (file)
 
 #include <stdlib.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency");
 
 /****
  **** Misc
  ****/
 
-void gras_abort(void) {
+void xbt_abort(void) {
    abort();
 }
index 3207123..f2b13fe 100644 (file)
@@ -13,6 +13,6 @@
 
 /* Modules definitions */
 void gras_log_init(void);
-void gras_log_exit(void);
+void xbt_log_exit(void);
 
 #endif /* XBT_MODINTER_H */
index b6ee2ad..f715163 100644 (file)
@@ -12,7 +12,7 @@
 #include <gras.h>
 
 #include "gras/DataDesc/datadesc_interface.h"
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 
 #define READ  0
 #define WRITE 1
@@ -21,14 +21,14 @@ GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 int r_arch;
 const char *filename = "datadesc_usage.out";  
 
-gras_error_t
+xbt_error_t
 write_read(gras_datadesc_type_t type,void *src, void *dst, 
           gras_socket_t sock, int direction);
 
-gras_error_t
+xbt_error_t
 write_read(gras_datadesc_type_t type,void *src, void *dst, 
           gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
    
   /* write */
   if (direction == RW) 
@@ -51,65 +51,65 @@ write_read(gras_datadesc_type_t type,void *src, void *dst,
   return no_error;
 }
 
-gras_error_t test_int(gras_socket_t sock, int direction);
-gras_error_t test_float(gras_socket_t sock, int direction);
-gras_error_t test_double(gras_socket_t sock, int direction);
-gras_error_t test_array(gras_socket_t sock, int direction);
-gras_error_t test_intref(gras_socket_t sock, int direction);
-gras_error_t test_string(gras_socket_t sock, int direction);
+xbt_error_t test_int(gras_socket_t sock, int direction);
+xbt_error_t test_float(gras_socket_t sock, int direction);
+xbt_error_t test_double(gras_socket_t sock, int direction);
+xbt_error_t test_array(gras_socket_t sock, int direction);
+xbt_error_t test_intref(gras_socket_t sock, int direction);
+xbt_error_t test_string(gras_socket_t sock, int direction);
 
-gras_error_t test_homostruct(gras_socket_t sock, int direction);
-gras_error_t test_hetestruct(gras_socket_t sock, int direction);
-gras_error_t test_nestedstruct(gras_socket_t sock, int direction);
-gras_error_t test_chain_list(gras_socket_t sock, int direction);
-gras_error_t test_graph(gras_socket_t sock, int direction);
+xbt_error_t test_homostruct(gras_socket_t sock, int direction);
+xbt_error_t test_hetestruct(gras_socket_t sock, int direction);
+xbt_error_t test_nestedstruct(gras_socket_t sock, int direction);
+xbt_error_t test_chain_list(gras_socket_t sock, int direction);
+xbt_error_t test_graph(gras_socket_t sock, int direction);
 
-gras_error_t test_pbio(gras_socket_t sock, int direction);
-gras_error_t test_clause(gras_socket_t sock, int direction);
+xbt_error_t test_pbio(gras_socket_t sock, int direction);
+xbt_error_t test_clause(gras_socket_t sock, int direction);
 
 /* defined in datadesc_structures.c, which in perl generated */
-gras_error_t test_structures(gras_socket_t sock, int direction); 
+xbt_error_t test_structures(gras_socket_t sock, int direction); 
 
 
 
-gras_error_t test_int(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_int(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   int i=5,j;
   
   INFO0("---- Test on integer ----");
   TRY(write_read(gras_datadesc_by_name("int"), &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert(i == j);
+    xbt_assert(i == j);
   }
   return no_error;
 }
-gras_error_t test_float(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_float(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   float i=5.0,j;
   
   INFO0("---- Test on float ----");
   TRY(write_read(gras_datadesc_by_name("float"), &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert2(i == j,"%f != %f",i,j);
+    xbt_assert2(i == j,"%f != %f",i,j);
   }
   return no_error;
 }
-gras_error_t test_double(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_double(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   double i=-3252355.1234,j;
   
   INFO0("---- Test on double ----");
   TRY(write_read(gras_datadesc_by_name("double"), &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert2(i == j,"%f != %f",i,j);
+    xbt_assert2(i == j,"%f != %f",i,j);
   }
   return no_error;
 }
 
 #define SIZE 5
 typedef int array[SIZE];
-gras_error_t test_array(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_array(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   gras_datadesc_type_t my_type;
   
   array i = { 35212,-6226,74337,11414,7733};
@@ -126,18 +126,18 @@ gras_error_t test_array(gras_socket_t sock, int direction) {
   if (direction == READ || direction == RW) {
     for (cpt=0; cpt<SIZE; cpt++) {
       DEBUG1("Test spot %d",cpt);
-      gras_assert4(i[cpt] == j[cpt],"i[%d]=%d  !=  j[%d]=%d",
+      xbt_assert4(i[cpt] == j[cpt],"i[%d]=%d  !=  j[%d]=%d",
                   cpt,i[cpt],cpt,j[cpt]);
     }
   }
   return no_error;
 }
-gras_error_t test_intref(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_intref(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   gras_datadesc_type_t my_type;
   int *i,*j;
   
-  i=gras_new(int,1);
+  i=xbt_new(int,1);
   *i=12345;
 
   INFO1("---- Test on a reference to an integer (%p) ----",i);
@@ -146,7 +146,7 @@ gras_error_t test_intref(gras_socket_t sock, int direction) {
 
   TRY(write_read(my_type, &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert(*i == *j);
+    xbt_assert(*i == *j);
     free(j);
   }
   free(i);
@@ -156,9 +156,9 @@ gras_error_t test_intref(gras_socket_t sock, int direction) {
 /***
  *** string (dynamic array)
  ***/ 
-gras_error_t test_string(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
-  char *i=gras_strdup("Some data"), *j=NULL;
+xbt_error_t test_string(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
+  char *i=xbt_strdup("Some data"), *j=NULL;
   int cpt;
   
   INFO0("---- Test on string (ref to dynamic array) ----");
@@ -166,7 +166,7 @@ gras_error_t test_string(gras_socket_t sock, int direction) {
                 sock,direction));
   if (direction == READ || direction == RW) {
     for (cpt=0; cpt<strlen(i); cpt++) {
-      gras_assert4(i[cpt] == j[cpt],"i[%d]=%c  !=  j[%d]=%c",
+      xbt_assert4(i[cpt] == j[cpt],"i[%d]=%c  !=  j[%d]=%c",
                   cpt,i[cpt],cpt,j[cpt]);
     } 
     free(j);
@@ -182,8 +182,8 @@ gras_error_t test_string(gras_socket_t sock, int direction) {
 typedef struct {
   int a,b,c,d;
 } homostruct;
-gras_error_t test_homostruct(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_homostruct(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   gras_datadesc_type_t my_type;
   homostruct *i, *j; 
 
@@ -203,16 +203,16 @@ gras_error_t test_homostruct(gras_socket_t sock, int direction) {
                            gras_datadesc_by_name("homostruct"));
 
   /* init a value, exchange it and check its validity*/
-  i=gras_new(homostruct,1);
+  i=xbt_new(homostruct,1);
   i->a = 2235;    i->b = 433425;
   i->c = -23423;  i->d = -235235;
 
   TRY(write_read(my_type, &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert2(i->a == j->a,"i->a=%d != j->a=%d",i->a,j->a);
-    gras_assert(i->b == j->b);
-    gras_assert(i->c == j->c);
-    gras_assert(i->d == j->d);
+    xbt_assert2(i->a == j->a,"i->a=%d != j->a=%d",i->a,j->a);
+    xbt_assert(i->b == j->b);
+    xbt_assert(i->c == j->c);
+    xbt_assert(i->d == j->d);
     free(j);
   }
   free(i);
@@ -228,8 +228,8 @@ typedef struct {
   unsigned char c2;
   unsigned long int l2;
 } hetestruct;
-gras_error_t test_hetestruct(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_hetestruct(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   gras_datadesc_type_t my_type;
   hetestruct *i, *j; 
 
@@ -249,16 +249,16 @@ gras_error_t test_hetestruct(gras_socket_t sock, int direction) {
 
 
   /* init a value, exchange it and check its validity*/
-  i=gras_new(hetestruct,1);
+  i=xbt_new(hetestruct,1);
   i->c1 = 's'; i->l1 = 123455;
   i->c2 = 'e'; i->l2 = 774531;
 
   TRY(write_read(my_type, &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert(i->c1 == j->c1);
-    gras_assert(i->c2 == j->c2);
-    gras_assert2(i->l1 == j->l1,"i->l1(=%ld)  !=  j->l1(=%ld)",i->l1,j->l1);
-    gras_assert(i->l2 == j->l2);
+    xbt_assert(i->c1 == j->c1);
+    xbt_assert(i->c2 == j->c2);
+    xbt_assert2(i->l1 == j->l1,"i->l1(=%ld)  !=  j->l1(=%ld)",i->l1,j->l1);
+    xbt_assert(i->l2 == j->l2);
     free(j);
   }
   free(i);
@@ -272,8 +272,8 @@ typedef struct {
   hetestruct hete;
   homostruct homo;
 } nestedstruct;
-gras_error_t test_nestedstruct(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_nestedstruct(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   gras_datadesc_type_t my_type;
   nestedstruct *i, *j; 
 
@@ -289,7 +289,7 @@ gras_error_t test_nestedstruct(gras_socket_t sock, int direction) {
   my_type=gras_datadesc_ref("nestedstruct*", gras_datadesc_by_name("nestedstruct"));
 
   /* init a value, exchange it and check its validity*/
-  i=gras_new(nestedstruct,1);
+  i=xbt_new(nestedstruct,1);
   i->homo.a = 235231;  i->homo.b = -124151;
   i->homo.c = 211551;  i->homo.d = -664222;
   i->hete.c1 = 's'; i->hete.l1 = 123455;
@@ -297,14 +297,14 @@ gras_error_t test_nestedstruct(gras_socket_t sock, int direction) {
 
   TRY(write_read(my_type, &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert(i->homo.a == j->homo.a);
-    gras_assert(i->homo.b == j->homo.b);
-    gras_assert(i->homo.c == j->homo.c);
-    gras_assert(i->homo.d == j->homo.d);
-    gras_assert(i->hete.c1 == j->hete.c1);
-    gras_assert(i->hete.c2 == j->hete.c2);
-    gras_assert(i->hete.l1 == j->hete.l1);
-    gras_assert(i->hete.l2 == j->hete.l2);
+    xbt_assert(i->homo.a == j->homo.a);
+    xbt_assert(i->homo.b == j->homo.b);
+    xbt_assert(i->homo.c == j->homo.c);
+    xbt_assert(i->homo.d == j->homo.d);
+    xbt_assert(i->hete.c1 == j->hete.c1);
+    xbt_assert(i->hete.c2 == j->hete.c2);
+    xbt_assert(i->hete.l1 == j->hete.l1);
+    xbt_assert(i->hete.l2 == j->hete.l2);
     free(j);
   }
   free(i);
@@ -319,13 +319,13 @@ struct s_chained_list {
   int          v;
   chained_list_t *l;
 };
-gras_error_t declare_chained_list_type(void);
+xbt_error_t declare_chained_list_type(void);
 chained_list_t *cons(int v, chained_list_t *l);
 void list_free(chained_list_t *l);
 int list_eq(chained_list_t*i,chained_list_t*j);
 
-gras_error_t declare_chained_list_type(void) {
-  gras_error_t errcode;
+xbt_error_t declare_chained_list_type(void) {
+  xbt_error_t errcode;
   gras_datadesc_type_t my_type,ref_my_type;
 
   my_type=gras_datadesc_struct("chained_list_t");
@@ -339,7 +339,7 @@ gras_error_t declare_chained_list_type(void) {
 }
 
 chained_list_t * cons(int v, chained_list_t *l) {
-  chained_list_t *nl = gras_new(chained_list_t,1);
+  chained_list_t *nl = xbt_new(chained_list_t,1);
   
   nl->v = v;
   nl->l = l;
@@ -358,8 +358,8 @@ int list_eq(chained_list_t*i,chained_list_t*j) {
     return 0;
   return list_eq(i->l, j->l); 
 }
-gras_error_t test_chain_list(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_chain_list(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   chained_list_t *i, *j; 
 
   INFO0("---- Test on chained list ----");
@@ -372,7 +372,7 @@ gras_error_t test_chain_list(gras_socket_t sock, int direction) {
                 &i,&j,
                 sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert(list_eq(i,j));    
+    xbt_assert(list_eq(i,j));    
     list_free(j);
   }
 
@@ -382,8 +382,8 @@ gras_error_t test_chain_list(gras_socket_t sock, int direction) {
 /***
  *** graph
  ***/
-gras_error_t test_graph(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_graph(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   chained_list_t *i, *j; 
 
   INFO0("---- Test on graph (cyclique chained list) ----");
@@ -405,14 +405,14 @@ gras_error_t test_graph(gras_socket_t sock, int direction) {
     DEBUG1("j->l=%p"      ,j->l);
     DEBUG1("j->l->l=%p"   ,j->l->l);
     DEBUG1("j->l->l->l=%p",j->l->l->l);
-    gras_assert4(j->l->l->l == j,
+    xbt_assert4(j->l->l->l == j,
                 "Received list is not cyclic. j=%p != j->l->l->l=%p\n"
                 "j=%p; &j=%p",
                 j,j->l->l->l, 
                 j ,&j);
     j->l->l->l = NULL;
     i->l->l->l = NULL;
-    gras_assert(list_eq(i,j));
+    xbt_assert(list_eq(i,j));
 
     list_free(j);
   }
@@ -442,8 +442,8 @@ struct s_pbio{ /* structure presented in the IEEE article */
                 )
 typedef struct s_pbio pbio_t;
 
-gras_error_t test_pbio(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_pbio(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   pbio_t i,j;
   int cpt;
   int cpt2;
@@ -483,30 +483,30 @@ gras_error_t test_pbio(gras_socket_t sock, int direction) {
                 &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
     /* Check that the data match */
-    gras_assert(i.Cnstatv == j.Cnstatv);
+    xbt_assert(i.Cnstatv == j.Cnstatv);
     for (cpt=0; cpt<12; cpt++)
-      gras_assert(i.Cstatev[cpt] == j.Cstatev[cpt]);
-    gras_assert(i.Cnprops == j.Cnprops);
+      xbt_assert(i.Cstatev[cpt] == j.Cstatev[cpt]);
+    xbt_assert(i.Cnprops == j.Cnprops);
     for (cpt=0; cpt<110; cpt++)
-      gras_assert(i.Cprops[cpt] == j.Cprops[cpt]);
+      xbt_assert(i.Cprops[cpt] == j.Cprops[cpt]);
     for (cpt=0; cpt<4; cpt++) 
-      gras_assert(i.Cndi[cpt] == j.Cndi[cpt]);
-    gras_assert(i.Cnshr == j.Cnshr);
-    gras_assert(i.Cnpt == j.Cnpt);
-    gras_assert(i.Cdtime == j.Cdtime);
-    gras_assert(i.Ctime[0] == j.Ctime[0]);
-    gras_assert(i.Ctime[1] == j.Ctime[1]);
-    gras_assert(i.Cntens == j.Cntens);
+      xbt_assert(i.Cndi[cpt] == j.Cndi[cpt]);
+    xbt_assert(i.Cnshr == j.Cnshr);
+    xbt_assert(i.Cnpt == j.Cnpt);
+    xbt_assert(i.Cdtime == j.Cdtime);
+    xbt_assert(i.Ctime[0] == j.Ctime[0]);
+    xbt_assert(i.Ctime[1] == j.Ctime[1]);
+    xbt_assert(i.Cntens == j.Cntens);
     for (cpt=0; cpt<3; cpt++) {
       for (cpt2=0; cpt2<373; cpt2++)
-       gras_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
+       xbt_assert(i.Cdfgrd0[cpt2][cpt] == j.Cdfgrd0[cpt2][cpt]);
       for (cpt2=0; cpt2<3; cpt2++)
-       gras_assert(i.Cdfgrd1[cpt][cpt2] == j.Cdfgrd1[cpt][cpt2]);
+       xbt_assert(i.Cdfgrd1[cpt][cpt2] == j.Cdfgrd1[cpt][cpt2]);
     }
     for (cpt=0; cpt<106; cpt++) {
-      gras_assert(i.Cstress[cpt] == j.Cstress[cpt]);
+      xbt_assert(i.Cstress[cpt] == j.Cstress[cpt]);
       for (cpt2=0; cpt2<106; cpt2++) 
-       gras_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
+       xbt_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2],
                     "%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f",
                     i.Cddsdde[cpt][cpt2],cpt,cpt2,j.Cddsdde[cpt][cpt2]);
     }
@@ -522,8 +522,8 @@ struct s_clause {
 };)
 typedef struct s_clause Clause;
 
-gras_error_t test_clause(gras_socket_t sock, int direction) {
-  gras_error_t errcode;
+xbt_error_t test_clause(gras_socket_t sock, int direction) {
+  xbt_error_t errcode;
   gras_datadesc_type_t ddt,array_t;
   Clause *i,*j;
   int cpt;
@@ -531,10 +531,10 @@ gras_error_t test_clause(gras_socket_t sock, int direction) {
   INFO0("---- Test on struct containing dynamic array and its size (cbps test) ----");
 
   /* create and fill the struct */
-  i=gras_new(Clause,1);
+  i=xbt_new(Clause,1);
 
   i->num_lits = 5432;
-  i->literals = gras_new(int, i->num_lits);
+  i->literals = xbt_new(int, i->num_lits);
   for (cpt=0; cpt<i->num_lits; cpt++)
     i->literals[cpt] = cpt * cpt - ((cpt * cpt) / 2);
   DEBUG3("created data=%p (within %p @%p)",&(i->num_lits),i,&i);
@@ -548,9 +548,9 @@ gras_error_t test_clause(gras_socket_t sock, int direction) {
 
   TRY(write_read(ddt, &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
-    gras_assert(i->num_lits == j->num_lits);
+    xbt_assert(i->num_lits == j->num_lits);
     for (cpt=0; cpt<i->num_lits; cpt++)
-      gras_assert(i->literals[cpt] == j->literals[cpt]);
+      xbt_assert(i->literals[cpt] == j->literals[cpt]);
     
     free(j->literals);
     free(j);
@@ -561,13 +561,13 @@ gras_error_t test_clause(gras_socket_t sock, int direction) {
 }
 
 int main(int argc,char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
   gras_socket_t sock;
   int direction = RW;
   int cpt;
   char r_arch_char = gras_arch_selfid();
 
-  gras_init_defaultlog(&argc,argv,NULL);
+  xbt_init_defaultlog(&argc,argv,NULL);
 
   for (cpt=1; cpt<argc; cpt++) {
     if (!strcmp(argv[cpt], "--read")) {
@@ -618,7 +618,7 @@ int main(int argc,char *argv[]) {
 
   if (direction != RW) 
     gras_socket_close(sock);
-  gras_exit();
+  xbt_exit();
   return 0;
 }
 
index e7a7823..a7c5bd1 100644 (file)
 
 #include "gras_private.h"
 
-gras_error_t gras_process_init() {
+xbt_error_t gras_process_init() {
   return unknown_error;
 }
 
-gras_error_t gras_process_exit() {
+xbt_error_t gras_process_exit() {
   return unknown_error;
 }
 
-gras_error_t gras_sock_client_open(const char *host, short port, 
+xbt_error_t gras_sock_client_open(const char *host, short port, 
                                   /* OUT */ gras_sock_t **sock) {
   return unknown_error;
 }
 
 
-gras_error_t gras_sock_server_open(unsigned short startingPort, 
+xbt_error_t gras_sock_server_open(unsigned short startingPort, 
                                   unsigned short endingPort,
                                   /* OUT */ gras_sock_t **sock) {
 
   return unknown_error;
 }
 
-gras_error_t gras_sock_close(gras_sock_t *sock) {
+xbt_error_t gras_sock_close(gras_sock_t *sock) {
   return unknown_error;
 }
 
@@ -49,36 +49,36 @@ char * gras_sock_get_peer_name(gras_sock_t *sd) {
   return NULL;
 }
 
-gras_error_t grasMsgRecv(gras_msg_t **msg,
+xbt_error_t grasMsgRecv(gras_msg_t **msg,
                         double timeOut) {
   return unknown_error;
 }
-gras_error_t gras_msg_send(gras_sock_t *sd,
+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) {
   return unknown_error;
 }
-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) {
   return unknown_error;
 }
-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 unknown_error;
 }
-gras_error_t gras_rawsock_close(gras_rawsock_t *sd) {
+xbt_error_t gras_rawsock_close(gras_rawsock_t *sd) {
   return unknown_error;
 }
 unsigned short gras_rawsock_get_peer_port(gras_rawsock_t *sd) {
   return -1;
 }
-gras_error_t
+xbt_error_t
 gras_rawsock_recv(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize, 
                  unsigned int timeout) {
   return unknown_error;
 }
-gras_error_t
+xbt_error_t
 gras_rawsock_send(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize){
   return unknown_error;
 }
index 21680c3..013c566 100644 (file)
 #include <gras.h>
 #include "gras/Transport/transport_interface.h"
 
-/* GRAS_LOG_NEW_DEFAULT_CATEGORY(test); */
+/* XBT_LOG_NEW_DEFAULT_CATEGORY(test); */
 
 int main(int argc,char *argv[]) {
   gras_socket_t sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char data_send[256];
 
   memset(data_send,0,sizeof(data_send));
-  gras_init_defaultlog(&argc,argv,"trp.thresh=debug");
+  xbt_init_defaultlog(&argc,argv,"trp.thresh=debug");
 
   fprintf(stderr,"===[CLIENT]=== Contact the server\n");
   TRYFAIL(gras_socket_client_from_file("-",&sock));
@@ -32,6 +32,6 @@ int main(int argc,char *argv[]) {
   fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
   gras_socket_close(sock);
    
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index 8aac726..6bd4304 100644 (file)
 #include <gras.h>
 #include "gras/Transport/transport_interface.h"
 
-/*GRAS_LOG_NEW_DEFAULT_CATEGORY(test);*/
+/*XBT_LOG_NEW_DEFAULT_CATEGORY(test);*/
 
 int main(int argc,char *argv[]) {
   gras_socket_t sock, conn;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char data_recv[256];
 
-  gras_init_defaultlog(&argc,argv,"trp.thresh=debug");
+  xbt_init_defaultlog(&argc,argv,"trp.thresh=debug");
 
   fprintf(stderr,"===[SERVER]=== Create the socket\n");
   TRYFAIL(gras_socket_server_from_file("-",&sock));
@@ -34,6 +34,6 @@ int main(int argc,char *argv[]) {
   fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
   gras_socket_close(sock);
 
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index d24a208..bba877a 100644 (file)
 #include <gras.h>
 #include "gras/Transport/transport_interface.h"
 
-/*GRAS_LOG_NEW_DEFAULT_CATEGORY(test);*/
+/*XBT_LOG_NEW_DEFAULT_CATEGORY(test);*/
 
 int main(int argc,char *argv[]) {
   gras_socket_t sock;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char data_send[256];
   char data_recv[256];
 
   memset(data_send, 0, sizeof(data_send));
   memset(data_recv, 0, sizeof(data_recv));
 
-  gras_init_defaultlog(&argc,argv,"trp.thresh=debug");
+  xbt_init_defaultlog(&argc,argv,"trp.thresh=debug");
 
   fprintf(stderr,"===[CLIENT]=== Contact the server\n");
   TRYFAIL(gras_socket_client(NULL,55555,&sock));
@@ -37,13 +37,13 @@ int main(int argc,char *argv[]) {
   
   if (strcmp(data_send, data_recv)) {
     fprintf(stderr, "===[CLIENT]=== String sent != string received\n");
-    gras_abort();
+    xbt_abort();
   } 
   fprintf(stderr,"===[CLIENT]=== Got a valid ACK\n");
   
   fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
   gras_socket_close(sock);
    
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index 192cc3a..075d9eb 100644 (file)
 #include <gras.h>
 #include "gras/Transport/transport_interface.h"
 
-/*GRAS_LOG_NEW_DEFAULT_CATEGORY(test);*/
+/*XBT_LOG_NEW_DEFAULT_CATEGORY(test);*/
 
 int main(int argc,char *argv[]) {
   gras_socket_t sock, conn;
-  gras_error_t errcode;
+  xbt_error_t errcode;
   char data_recv[256];
 
-  gras_init_defaultlog(&argc,argv,"trp.thresh=debug");
+  xbt_init_defaultlog(&argc,argv,"trp.thresh=debug");
 
   fprintf(stderr,"===[SERVER]=== Create the socket\n");
   TRYFAIL(gras_socket_server(55555,&sock));
@@ -37,6 +37,6 @@ int main(int argc,char *argv[]) {
   fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
   gras_socket_close(sock);
 
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index b85638c..946fe0b 100644 (file)
@@ -6,84 +6,84 @@
 #include <gras.h>
 
 /*====[ Prototypes ]=========================================================*/
-gras_cfg_t make_set(void); /* build a minimal set */
+xbt_cfg_t make_set(void); /* build a minimal set */
 
 /*====[ Code ]===============================================================*/
-gras_cfg_t make_set(){
-  gras_cfg_t set=NULL; 
-  gras_error_t errcode;
+xbt_cfg_t make_set(){
+  xbt_cfg_t set=NULL; 
+  xbt_error_t errcode;
 
-  set = gras_cfg_new();
-  TRYFAIL(gras_cfg_register_str(set,"speed:1_to_2_int"));
-  TRYFAIL(gras_cfg_register_str(set,"hostname:1_to_1_string"));
-  TRYFAIL(gras_cfg_register_str(set,"user:1_to_10_string"));
+  set = xbt_cfg_new();
+  TRYFAIL(xbt_cfg_register_str(set,"speed:1_to_2_int"));
+  TRYFAIL(xbt_cfg_register_str(set,"hostname:1_to_1_string"));
+  TRYFAIL(xbt_cfg_register_str(set,"user:1_to_10_string"));
 
-  TRYFAIL(gras_cfg_set_parse(set, "hostname:veloce "
+  TRYFAIL(xbt_cfg_set_parse(set, "hostname:veloce "
                             "user:mquinson\nuser:oaumage\tuser:alegrand"));
   return set;
 }
  
 int main(int argc, char **argv) {
-  gras_error_t errcode;
-  gras_cfg_t set;
+  xbt_error_t errcode;
+  xbt_cfg_t set;
 
-  gras_dynar_t dyn;
+  xbt_dynar_t dyn;
   char *str;
   int ival;
   
-  gras_init_defaultlog(&argc,argv,"config.thresh=debug root.thresh=info");
+  xbt_init_defaultlog(&argc,argv,"config.thresh=debug root.thresh=info");
 
   fprintf(stderr,"==== Alloc and free a config set.\n");
   set=make_set();
-  gras_cfg_dump("test set","",set);
-  gras_cfg_free(&set);
-  gras_cfg_free(&set);
+  xbt_cfg_dump("test set","",set);
+  xbt_cfg_free(&set);
+  xbt_cfg_free(&set);
 
 
   fprintf(stderr,"==== Try to use an unregistered option. (ERROR EXPECTED: 'color' not registered)\n");
   set=make_set();
-  TRYEXPECT(mismatch_error,gras_cfg_set_parse(set,"color:blue"));
-  gras_cfg_free(&set);
-  gras_cfg_free(&set);
+  TRYEXPECT(mismatch_error,xbt_cfg_set_parse(set,"color:blue"));
+  xbt_cfg_free(&set);
+  xbt_cfg_free(&set);
 
 
   fprintf(stderr,
          "==== Validation test. (ERROR EXPECTED: not enough values of 'speed')\n");
   set=make_set();
-  gras_cfg_check(set);
-  gras_cfg_free(&set);
-  gras_cfg_free(&set);
+  xbt_cfg_check(set);
+  xbt_cfg_free(&set);
+  xbt_cfg_free(&set);
 
   fprintf(stderr,"==== Validation test (ERROR EXPECTED: too many elements)\n");
   set=make_set();
-  gras_cfg_set_parse(set,"hostname:toto:42");
-  gras_cfg_set_parse(set,"speed:42 speed:24 speed:34");
-  gras_cfg_check(set);
-  gras_cfg_free(&set);
-  gras_cfg_free(&set);
+  xbt_cfg_set_parse(set,"hostname:toto:42");
+  xbt_cfg_set_parse(set,"speed:42 speed:24 speed:34");
+  xbt_cfg_check(set);
+  xbt_cfg_free(&set);
+  xbt_cfg_free(&set);
 
   fprintf(stderr,"==== Get single value (Expected: 'speed value: 42')\n");
   set=make_set();
-  gras_cfg_set_parse(set,"hostname:toto:42 speed:42");
-  gras_cfg_get_int(set,"speed",&ival);
+  xbt_cfg_set_parse(set,"hostname:toto:42 speed:42");
+  xbt_cfg_get_int(set,"speed",&ival);
   fprintf(stderr,"speed value: %d\n",ival); 
-  gras_cfg_free(&set);
-  gras_cfg_free(&set);
+  xbt_cfg_free(&set);
+  xbt_cfg_free(&set);
 
   fprintf(stderr,"==== Get multiple values (Expected: 'Count: 3; Options: mquinson;ecaron;alegrand;')\n");
   set=make_set();
-  gras_cfg_set_parse(set,"speed:42");
-  gras_cfg_check(set);
-  gras_cfg_get_dynar(set,"user",&dyn);
-  fprintf(stderr,"Count: %lu; Options: ",gras_dynar_length(dyn));
-  gras_dynar_foreach(dyn,ival,str) {
+  xbt_cfg_set_parse(set,"speed:42");
+  xbt_cfg_check(set);
+  xbt_cfg_get_dynar(set,"user",&dyn);
+  fprintf(stderr,"Count: %lu; Options: ",xbt_dynar_length(dyn));
+  xbt_dynar_foreach(dyn,ival,str) {
     fprintf(stderr,"%s;",str);
   }
   fprintf(stderr,"\n");
-  gras_cfg_free(&set);
-  gras_cfg_free(&set);
+  xbt_cfg_free(&set);
+  xbt_cfg_free(&set);
 
-  gras_exit();
+  xbt_exit();
   return 0;
 }
 
index 0a3c623..219b930 100644 (file)
@@ -21,41 +21,41 @@ static void print_str(void *str) {
   printf("%s",(char*)str);
 }
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 
-static gras_error_t traverse(gras_dict_t head) {
-  gras_dict_cursor_t cursor=NULL;
+static xbt_error_t traverse(xbt_dict_t head) {
+  xbt_dict_cursor_t cursor=NULL;
   char *key;
   char *data;
 
-  gras_dict_foreach(head,cursor,key,data) {
+  xbt_dict_foreach(head,cursor,key,data) {
     /*    printf("   Seen:  %s=%s\n",key,data); */
-    gras_assert2 (!strcmp(key,data),
+    xbt_assert2 (!strcmp(key,data),
       "Key(%s) != value(%s). Abording\n",key,data);
   }
   return no_error;
 }
 
-static gras_error_t countelems(gras_dict_t head,int*count) {
-  gras_dict_cursor_t cursor;
+static xbt_error_t countelems(xbt_dict_t head,int*count) {
+  xbt_dict_cursor_t cursor;
   char *key;
   void *data;
   *count=0;
 
-  gras_dict_foreach(head,cursor,key,data) {
+  xbt_dict_foreach(head,cursor,key,data) {
     (*count)++;
   }
   return no_error;
 }
 
 int main(int argc,char **argv) {
-  gras_error_t errcode;
-  gras_dict_t head=NULL;
+  xbt_error_t errcode;
+  xbt_dict_t head=NULL;
   int i,j,k, nb;
   char *key;
   void *data;
 
-  gras_init_defaultlog(&argc,argv,"dict.thresh=verbose");
+  xbt_init_defaultlog(&argc,argv,"dict.thresh=verbose");
   srand((unsigned int)time(NULL));
 
   printf("Dictionnary: CRASH test:\n");
@@ -64,7 +64,7 @@ int main(int argc,char **argv) {
   printf(" (a point is a test)\n");
 
   for (i=0;i<20;i++) {
-    head=gras_dict_new();
+    head=xbt_dict_new();
     if (i%10) printf("."); else printf("%d",i/10); fflush(stdout);
     nb=0;
     for (j=0;j<1000;j++) {
@@ -77,22 +77,22 @@ int main(int argc,char **argv) {
        key[k]=rand() % ('z' - 'a') + 'a';
       key[k]='\0';
       /*      printf("[%d %s]\n",j,key); */
-      gras_dict_set(head,key,key,&free);
+      xbt_dict_set(head,key,key,&free);
     }
     nb=0;
-    /*    gras_dict_dump(head,(void (*)(void*))&printf); */
+    /*    xbt_dict_dump(head,(void (*)(void*))&printf); */
     TRYFAIL(countelems(head,&nb));
     if (nb != 1000) {
        printf ("\nI found %d elements, and not 1000\n",nb);
        abort();
     }    
     TRYFAIL(traverse(head));
-    gras_dict_free(&head);
-    gras_dict_free(&head);
+    xbt_dict_free(&head);
+    xbt_dict_free(&head);
   }
 
 
-  head=gras_dict_new();
+  head=xbt_dict_new();
   printf("\n Fill 20 000 elements, with keys being the number of element\n");
   printf("  (a point is 1 000 elements)\n");
   for (j=0;j<NB_ELM;j++) {
@@ -106,7 +106,7 @@ int main(int argc,char **argv) {
     }
     
     sprintf(key,"%d",j);
-    gras_dict_set(head,key,key,&free);
+    xbt_dict_set(head,key,key,&free);
   }
 
   printf("\n Count the elements (retrieving the key and data for each): \n");
@@ -123,7 +123,7 @@ int main(int argc,char **argv) {
     for (j=0;j<NB_ELM;j++) {
       
       sprintf(key,"%d",j);
-      TRYFAIL(gras_dict_get(head,key,&data));
+      TRYFAIL(xbt_dict_get(head,key,&data));
       if (strcmp(key,(char*)data)) {
        printf("key=%s != data=%s\n",key,(char*)data);
        abort();
@@ -141,16 +141,16 @@ int main(int argc,char **argv) {
     if (!(j%10000)) printf("."); fflush(stdout);
     
     sprintf(key,"%d",j);
-    TRYFAIL(gras_dict_remove(head,key));
+    TRYFAIL(xbt_dict_remove(head,key));
   }
   printf("\n");
   free(key);
 
   
   printf("\n Free the structure (twice)\n");
-  gras_dict_free(&head);
-  gras_dict_free(&head);
+  xbt_dict_free(&head);
+  xbt_dict_free(&head);
   
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index 18d3450..1ca353b 100644 (file)
 
 #include <gras.h>
 
-GRAS_LOG_EXTERNAL_CATEGORY(dict);
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_EXTERNAL_CATEGORY(dict);
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 
-static void fill(gras_dict_t *head);
-static void debuged_add(gras_dict_t head,const char*key);
-static gras_error_t search(gras_dict_t head,const char*key);
-static gras_error_t debuged_remove(gras_dict_t head,const char*key);
-static gras_error_t traverse(gras_dict_t head);
+static void fill(xbt_dict_t *head);
+static void debuged_add(xbt_dict_t head,const char*key);
+static xbt_error_t search(xbt_dict_t head,const char*key);
+static xbt_error_t debuged_remove(xbt_dict_t head,const char*key);
+static xbt_error_t traverse(xbt_dict_t head);
 
 static void print_str(void *str);
 static void print_str(void *str) {
   printf("%s",(char*)str);
 }
 
-static void fill(gras_dict_t *head) {
+static void fill(xbt_dict_t *head) {
   printf("\n Fill in the dictionnary\n");
 
-  *head = gras_dict_new();
+  *head = xbt_dict_new();
   debuged_add(*head,"12");
   debuged_add(*head,"12a");
   debuged_add(*head,"12b");
@@ -43,60 +43,60 @@ static void fill(gras_dict_t *head) {
 
 }
 
-static void debuged_add(gras_dict_t head,const char*key)
+static void debuged_add(xbt_dict_t head,const char*key)
 {
-  char *data=gras_strdup(key);
+  char *data=xbt_strdup(key);
 
   printf("   - Add %s\n",key);
-  gras_dict_set(head,key,data,&free);
-  if (GRAS_LOG_ISENABLED(dict,gras_log_priority_debug)) {
-    gras_dict_dump(head,(void (*)(void*))&printf);
+  xbt_dict_set(head,key,data,&free);
+  if (XBT_LOG_ISENABLED(dict,xbt_log_priority_debug)) {
+    xbt_dict_dump(head,(void (*)(void*))&printf);
     fflush(stdout);
   }
 }
 
-static gras_error_t search(gras_dict_t head,const char*key) {
+static xbt_error_t search(xbt_dict_t head,const char*key) {
   void *data;
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   
-  errcode=gras_dict_get(head,key,&data);
+  errcode=xbt_dict_get(head,key,&data);
   printf("   - Search %s. Found %s\n",key,data?(char*)data:"(null)");fflush(stdout);
   if (strcmp((char*)data,key)) 
     return mismatch_error;
   return errcode;
 }
 
-static gras_error_t debuged_remove(gras_dict_t head,const char*key)
+static xbt_error_t debuged_remove(xbt_dict_t head,const char*key)
 {
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
   printf("   Remove '%s'\n",key);fflush(stdout);
-  errcode=gras_dict_remove(head,key);
-  /*  gras_dict_dump(head,(void (*)(void*))&printf); */
+  errcode=xbt_dict_remove(head,key);
+  /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
   return errcode;
 }
 
 
-static gras_error_t traverse(gras_dict_t head) {
-  gras_dict_cursor_t cursor=NULL;
+static xbt_error_t traverse(xbt_dict_t head) {
+  xbt_dict_cursor_t cursor=NULL;
   char *key;
   char *data;
 
-  gras_dict_foreach(head,cursor,key,data) {
+  xbt_dict_foreach(head,cursor,key,data) {
     printf("   - Seen:  %s->%s\n",key,data);
-    gras_assert2(!strcmp(key,data),
+    xbt_assert2(!strcmp(key,data),
                 "Key(%s) != value(%s). Abording\n",key,data);
   }
   return no_error;
 }
 
 int main(int argc,char **argv) {
-  gras_error_t errcode;
-  gras_dict_t head=NULL;
+  xbt_error_t errcode;
+  xbt_dict_t head=NULL;
   char *data;
 
-  gras_init_defaultlog(&argc,argv,"dict.thresh=verbose");
+  xbt_init_defaultlog(&argc,argv,"dict.thresh=verbose");
    
   printf("\nGeneric dictionnary: USAGE test:\n");
 
@@ -105,33 +105,33 @@ int main(int argc,char **argv) {
 
   fill(&head);
   printf(" Free the dictionnary (twice)\n");
-  gras_dict_free(&head);
-  gras_dict_free(&head);
+  xbt_dict_free(&head);
+  xbt_dict_free(&head);
   
   fill(&head);
 
   printf(" - Change some values\n");
   printf("   - Change 123 to 'Changed 123'\n");
-  gras_dict_set(head,"123",strdup("Changed 123"),&free);
+  xbt_dict_set(head,"123",strdup("Changed 123"),&free);
   printf("   - Change 123 back to '123'\n");
-  gras_dict_set(head,"123",strdup("123"),&free);
+  xbt_dict_set(head,"123",strdup("123"),&free);
   printf("   - Change 12a to 'Dummy 12a'\n");
-  gras_dict_set(head,"12a",strdup("Dummy 12a"),&free);
+  xbt_dict_set(head,"12a",strdup("Dummy 12a"),&free);
   printf("   - Change 12a to '12a'\n");
-  gras_dict_set(head,"12a",strdup("12a"),&free);
+  xbt_dict_set(head,"12a",strdup("12a"),&free);
 
-  /*  gras_dict_dump(head,(void (*)(void*))&printf); */
+  /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
   printf(" - Traverse the resulting dictionnary\n");
   TRYFAIL(traverse(head));
 
   printf(" - Retrive values\n");
-  TRYFAIL(gras_dict_get(head,"123",(void**)&data));
+  TRYFAIL(xbt_dict_get(head,"123",(void**)&data));
   assert(data);
   TRYFAIL(strcmp("123",data));
 
-  TRYEXPECT(gras_dict_get(head,"Can't be found",(void**)&data),mismatch_error);
-  TRYEXPECT(gras_dict_get(head,"123 Can't be found",(void**)&data),mismatch_error);
-  TRYEXPECT(gras_dict_get(head,"12345678 NOT",(void**)&data),mismatch_error);
+  TRYEXPECT(xbt_dict_get(head,"Can't be found",(void**)&data),mismatch_error);
+  TRYEXPECT(xbt_dict_get(head,"123 Can't be found",(void**)&data),mismatch_error);
+  TRYEXPECT(xbt_dict_get(head,"12345678 NOT",(void**)&data),mismatch_error);
 
   TRYFAIL(search(head,"12a"));
   TRYFAIL(search(head,"12b"));
@@ -143,11 +143,11 @@ int main(int argc,char **argv) {
   printf(" - Traverse the resulting dictionnary\n");
   TRYFAIL(traverse(head));
 
-  /*  gras_dict_dump(head,(void (*)(void*))&printf); */
+  /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
 
   printf(" Free the dictionnary twice\n");
-  gras_dict_free(&head);
-  gras_dict_free(&head);
+  xbt_dict_free(&head);
+  xbt_dict_free(&head);
 
   printf(" - Traverse the resulting dictionnary\n");
   TRYFAIL(traverse(head));
@@ -158,7 +158,7 @@ int main(int argc,char **argv) {
   TRYEXPECT(debuged_remove(head,"Does not exist"),mismatch_error);
   TRYFAIL(traverse(head));
 
-  gras_dict_free(&head);
+  xbt_dict_free(&head);
 
   printf(" - Remove data from the NULL dict (error message expected)\n");
   TRYCATCH(debuged_remove(head,"12345"),mismatch_error);
@@ -176,8 +176,8 @@ int main(int argc,char **argv) {
   TRYEXPECT(debuged_remove(head,"12346"),mismatch_error);  TRYFAIL(traverse(head));
   
   printf(" - Free the dictionnary twice\n");
-  gras_dict_free(&head);
-  gras_dict_free(&head);
-  gras_exit();
+  xbt_dict_free(&head);
+  xbt_dict_free(&head);
+  xbt_exit();
   return 0;
 }
index b09e788..97ce5b0 100644 (file)
 #include <stdio.h>
 #include <gras.h>
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 
 int main(int argc,char *argv[]) {
-   gras_dynar_t d;
-   gras_error_t errcode;
+   xbt_dynar_t d;
+   xbt_error_t errcode;
    int cpt,cursor;
    double d1,d2;
    
-   gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
+   xbt_init_defaultlog(&argc,argv,"dynar.thresh=debug");
 
    INFO0("==== Traverse the empty dynar");
-   d=gras_dynar_new(sizeof(int),NULL);
-   gras_dynar_foreach(d,cursor,cpt){
-     gras_assert0(FALSE,
+   d=xbt_dynar_new(sizeof(int),NULL);
+   xbt_dynar_foreach(d,cursor,cpt){
+     xbt_assert0(FALSE,
             "Damnit, there is something in the empty dynar");
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
    INFO0("==== Push/shift 5000 doubles");
-   d=gras_dynar_new(sizeof(double),NULL);
+   d=xbt_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_push(d,&d1);
+     xbt_dynar_push(d,&d1);
    }
-   gras_dynar_foreach(d,cursor,d2){
+   xbt_dynar_foreach(d,cursor,d2){
      d1=(double)cursor;
-     gras_assert2(d1 == d2,
+     xbt_assert2(d1 == d2,
            "The retrieved value is not the same than the injected one (%f!=%f)",
                  d1,d2);
    }
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_shift(d,&d2);
-     gras_assert2(d1 == d2,
+     xbt_dynar_shift(d,&d2);
+     xbt_assert2(d1 == d2,
            "The retrieved value is not the same than the injected one (%f!=%f)",
                  d1,d2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
    INFO0("==== Unshift/pop 5000 doubles");
-   d=gras_dynar_new(sizeof(double),NULL);
+   d=xbt_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_unshift(d,&d1);
+     xbt_dynar_unshift(d,&d1);
    }
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_pop(d,&d2);
-     gras_assert2 (d1 == d2,
+     xbt_dynar_pop(d,&d2);
+     xbt_assert2 (d1 == d2,
            "The retrieved value is not the same than the injected one (%f!=%f)",
                   d1,d2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
 
    INFO0("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
-   d=gras_dynar_new(sizeof(double),NULL);
+   d=xbt_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_push(d,&d1);
+     xbt_dynar_push(d,&d1);
    }
    for (cpt=0; cpt< 1000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_insert_at(d,2500,&d1);
+     xbt_dynar_insert_at(d,2500,&d1);
    }
 
    for (cpt=0; cpt< 2500; cpt++) {
      d1=(double)cpt;
-     gras_dynar_shift(d,&d2);
-     gras_assert2(d1 == d2,
+     xbt_dynar_shift(d,&d2);
+     xbt_assert2(d1 == d2,
            "The retrieved value is not the same than the injected one at the begining (%f!=%f)",
                  d1,d2);
-     DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
+     DEBUG2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
    }
    for (cpt=999; cpt>=0; cpt--) {
      d1=(double)cpt;
-     gras_dynar_shift(d,&d2);
-     gras_assert2 (d1 == d2,
+     xbt_dynar_shift(d,&d2);
+     xbt_assert2 (d1 == d2,
            "The retrieved value is not the same than the injected one in the middle (%f!=%f)",
                   d1,d2);
    }
    for (cpt=2500; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_shift(d,&d2);
-     gras_assert2 (d1 == d2,
+     xbt_dynar_shift(d,&d2);
+     xbt_assert2 (d1 == d2,
            "The retrieved value is not the same than the injected one at the end (%f!=%f)",
                   d1,d2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
    INFO0("==== Push 5000 double, remove 2000-4000. free the rest");
-   d=gras_dynar_new(sizeof(double),NULL);
+   d=xbt_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_push(d,&d1);
+     xbt_dynar_push(d,&d1);
    }
    for (cpt=2000; cpt< 4000; cpt++) {
      d1=(double)cpt;
-     gras_dynar_remove_at(d,2000,&d2);
-     gras_assert2 (d1 == d2,
+     xbt_dynar_remove_at(d,2000,&d2);
+     xbt_assert2 (d1 == d2,
            "Remove a bad value. Got %f, expected %f",
               d2,d1);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
-   gras_exit();
+   xbt_exit();
    return 0;
 }
index 68f0d48..a3df42b 100644 (file)
 #include <gras.h>
 
 #define NB_ELEM 5000
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 
 int main(int argc,char *argv[]) {
-   gras_dynar_t d;
-   gras_error_t errcode;
+   xbt_dynar_t d;
+   xbt_error_t errcode;
    int i,cpt,cursor;
    int *iptr;
    
-   gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
+   xbt_init_defaultlog(&argc,argv,"dynar.thresh=debug");
 
    INFO0("==== Traverse the empty dynar");
-   d=gras_dynar_new(sizeof(int),NULL);
-   gras_dynar_foreach(d,cursor,i){
-     gras_assert0(0,"Damnit, there is something in the empty dynar");
+   d=xbt_dynar_new(sizeof(int),NULL);
+   xbt_dynar_foreach(d,cursor,i){
+     xbt_assert0(0,"Damnit, there is something in the empty dynar");
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
    INFO1("==== Push %d int, set them again 3 times, traverse them, shift them",
        NB_ELEM);
-   d=gras_dynar_new(sizeof(int),NULL);
+   d=xbt_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
-     gras_dynar_push_as(d,int,cpt);
-     DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
+     xbt_dynar_push_as(d,int,cpt);
+     DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
    }
    for (cursor=0; cursor< NB_ELEM; cursor++) {
-     iptr=gras_dynar_get_ptr(d,cursor);
-     gras_assert2(cursor == *iptr,
+     iptr=xbt_dynar_get_ptr(d,cursor);
+     xbt_assert2(cursor == *iptr,
                  "The retrieved value is not the same than the injected one (%d!=%d)",
                  cursor,cpt);
    }
-   gras_dynar_foreach(d,cursor,cpt){
-     gras_assert2(cursor == cpt,
+   xbt_dynar_foreach(d,cursor,cpt){
+     xbt_assert2(cursor == cpt,
                  "The retrieved value is not the same than the injected one (%d!=%d)",
                  cursor,cpt);
    }
    for (cpt=0; cpt< NB_ELEM; cpt++)
-     *(int*)gras_dynar_get_ptr(d,cpt) = cpt;
+     *(int*)xbt_dynar_get_ptr(d,cpt) = cpt;
 
    for (cpt=0; cpt< NB_ELEM; cpt++) 
-     *(int*)gras_dynar_get_ptr(d,cpt) = cpt;
-/*     gras_dynar_set(d,cpt,&cpt);*/
+     *(int*)xbt_dynar_get_ptr(d,cpt) = cpt;
+/*     xbt_dynar_set(d,cpt,&cpt);*/
    
    for (cpt=0; cpt< NB_ELEM; cpt++) 
-     *(int*)gras_dynar_get_ptr(d,cpt) = cpt;
+     *(int*)xbt_dynar_get_ptr(d,cpt) = cpt;
    
    cpt=0;
-   gras_dynar_foreach(d,cursor,i){
-     gras_assert2(i == cpt,
+   xbt_dynar_foreach(d,cursor,i){
+     xbt_assert2(i == cpt,
          "The retrieved value is not the same than the injected one (%d!=%d)",
                  i,cpt);
      cpt++;
    }
-   gras_assert2(cpt == NB_ELEM,
+   xbt_assert2(cpt == NB_ELEM,
                "Cannot retrieve my %d values. Last got one is %d",
                NB_ELEM, cpt);
 
    for (cpt=0; cpt< NB_ELEM; cpt++) {
-     gras_dynar_shift(d,&i);
-     gras_assert2(i == cpt,
+     xbt_dynar_shift(d,&i);
+     xbt_assert2(i == cpt,
            "The retrieved value is not the same than the injected one (%d!=%d)",
               i,cpt);
-     DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
+     DEBUG2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
    
    INFO1("==== Unshift/pop %d int",NB_ELEM);
-   d=gras_dynar_new(sizeof(int),NULL);
+   d=xbt_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
-     gras_dynar_unshift(d,&cpt);
-     DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
+     xbt_dynar_unshift(d,&cpt);
+     DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
    }
    for (cpt=0; cpt< NB_ELEM; cpt++) {
-     i=gras_dynar_pop_as(d,int);
-     gras_assert2(i == cpt,
+     i=xbt_dynar_pop_as(d,int);
+     xbt_assert2(i == cpt,
            "The retrieved value is not the same than the injected one (%d!=%d)",
                 i,cpt);
-     DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
+     DEBUG2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
    
    INFO1("==== Push %d int, insert 1000 int in the middle, shift everything",NB_ELEM);
-   d=gras_dynar_new(sizeof(int),NULL);
+   d=xbt_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
-     gras_dynar_push_as(d,int,cpt);
-     DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
+     xbt_dynar_push_as(d,int,cpt);
+     DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
    }
    for (cpt=0; cpt< 1000; cpt++) {
-     gras_dynar_insert_at_as(d,2500,int,cpt);
-     DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
+     xbt_dynar_insert_at_as(d,2500,int,cpt);
+     DEBUG2("Push %d, length=%lu",cpt, xbt_dynar_length(d));
    }
 
    for (cpt=0; cpt< 2500; cpt++) {
-     gras_dynar_shift(d,&i);
-     gras_assert2(i == cpt,
+     xbt_dynar_shift(d,&i);
+     xbt_assert2(i == cpt,
            "The retrieved value is not the same than the injected one at the begining (%d!=%d)",
               i,cpt);
-     DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
+     DEBUG2("Pop %d, length=%lu",cpt, xbt_dynar_length(d));
    }
    for (cpt=999; cpt>=0; cpt--) {
-     gras_dynar_shift(d,&i);
-     gras_assert2(i == cpt,
+     xbt_dynar_shift(d,&i);
+     xbt_assert2(i == cpt,
            "The retrieved value is not the same than the injected one in the middle (%d!=%d)",
               i,cpt);
    }
    for (cpt=2500; cpt< NB_ELEM; cpt++) {
-     gras_dynar_shift(d,&i);
-      gras_assert2(i == cpt,
+     xbt_dynar_shift(d,&i);
+      xbt_assert2(i == cpt,
            "The retrieved value is not the same than the injected one at the end (%d!=%d)",
               i,cpt);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
    INFO1("==== Push %d int, remove 2000-4000. free the rest",NB_ELEM);
-   d=gras_dynar_new(sizeof(int),NULL);
+   d=xbt_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) 
-     gras_dynar_push_as(d,int,cpt);
+     xbt_dynar_push_as(d,int,cpt);
    
    for (cpt=2000; cpt< 4000; cpt++) {
-     gras_dynar_remove_at(d,2000,&i);
-     gras_assert2(i == cpt,
+     xbt_dynar_remove_at(d,2000,&i);
+     xbt_assert2(i == cpt,
                  "Remove a bad value. Got %d, expected %d",
                  i,cpt);
-     DEBUG2("remove %d, length=%lu",cpt, gras_dynar_length(d));
+     DEBUG2("remove %d, length=%lu",cpt, xbt_dynar_length(d));
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
-   gras_exit();
+   xbt_exit();
    return 0;
 }
index 90abe20..f1d976f 100644 (file)
@@ -13,7 +13,7 @@
 
 /* NB_ELEM HAS to be a multiple of 5 */
 #define NB_ELEM 5000
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
 
 void free_string(void *d);
 
@@ -22,141 +22,141 @@ void free_string(void *d){
 }
 
 int main(int argc,char *argv[]) {
-   gras_dynar_t d;
-   gras_error_t errcode;
+   xbt_dynar_t d;
+   xbt_error_t errcode;
    int cpt;
    char buf[1024];
    char *s1,*s2;
    
-   gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
+   xbt_init_defaultlog(&argc,argv,"dynar.thresh=debug");
    
    INFO0("==== Traverse the empty dynar");
-   d=gras_dynar_new(sizeof(char *),&free_string);
-   gras_dynar_foreach(d,cpt,s1){
-     gras_assert0(FALSE,
+   d=xbt_dynar_new(sizeof(char *),&free_string);
+   xbt_dynar_foreach(d,cpt,s1){
+     xbt_assert0(FALSE,
                  "Damnit, there is something in the empty dynar");
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
    INFO1("==== Push %d strings, set them again 3 times, shift them",NB_ELEM);
-   d=gras_dynar_new(sizeof(char*),&free_string);
+   d=xbt_dynar_new(sizeof(char*),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_push(d,&s1);
+     xbt_dynar_push(d,&s1);
    }
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_replace(d,cpt,&s1);
+     xbt_dynar_replace(d,cpt,&s1);
    }
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_replace(d,cpt,&s1);
+     xbt_dynar_replace(d,cpt,&s1);
    }
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_replace(d,cpt,&s1);
+     xbt_dynar_replace(d,cpt,&s1);
    }
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
-     gras_dynar_shift(d,&s2);
-     gras_assert2 (!strcmp(buf,s2),
+     xbt_dynar_shift(d,&s2);
+     xbt_assert2 (!strcmp(buf,s2),
            "The retrieved value is not the same than the injected one (%s!=%s)",
                   buf,s2);
      free(s2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
    INFO1("==== Unshift, traverse and pop %d strings",NB_ELEM);
-   d=gras_dynar_new(sizeof(char**),&free_string);
+   d=xbt_dynar_new(sizeof(char**),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_unshift(d,&s1);
+     xbt_dynar_unshift(d,&s1);
    }
-   gras_dynar_foreach(d,cpt,s1) {
+   xbt_dynar_foreach(d,cpt,s1) {
      sprintf(buf,"%d",NB_ELEM - cpt -1);
-     gras_assert2 (!strcmp(buf,s1),
+     xbt_assert2 (!strcmp(buf,s1),
            "The retrieved value is not the same than the injected one (%s!=%s)",
               buf,s1);
    }
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
-     gras_dynar_pop(d,&s2);
-     gras_assert2 (!strcmp(buf,s2),
+     xbt_dynar_pop(d,&s2);
+     xbt_assert2 (!strcmp(buf,s2),
            "The retrieved value is not the same than the injected one (%s!=%s)",
               buf,s2);
      free(s2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
    INFO2("==== Push %d strings, insert %d strings in the middle, shift everything",NB_ELEM,NB_ELEM/5);
-   d=gras_dynar_new(sizeof(char*),&free_string);
+   d=xbt_dynar_new(sizeof(char*),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_push(d,&s1);
+     xbt_dynar_push(d,&s1);
    }
    for (cpt=0; cpt< NB_ELEM/5; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_insert_at(d,NB_ELEM/2,&s1);
+     xbt_dynar_insert_at(d,NB_ELEM/2,&s1);
    }
 
    for (cpt=0; cpt< NB_ELEM/2; cpt++) {
      sprintf(buf,"%d",cpt);
-     gras_dynar_shift(d,&s2);
-     gras_assert2(!strcmp(buf,s2),
+     xbt_dynar_shift(d,&s2);
+     xbt_assert2(!strcmp(buf,s2),
            "The retrieved value is not the same than the injected one at the begining (%s!=%s)",
               buf,s2);
       free(s2);
    }
    for (cpt=(NB_ELEM/5)-1; cpt>=0; cpt--) {
      sprintf(buf,"%d",cpt);
-     gras_dynar_shift(d,&s2);
-     gras_assert2 (!strcmp(buf,s2),
+     xbt_dynar_shift(d,&s2);
+     xbt_assert2 (!strcmp(buf,s2),
            "The retrieved value is not the same than the injected one in the middle (%s!=%s)",
               buf,s2);
      free(s2);
    }
    for (cpt=NB_ELEM/2; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
-     gras_dynar_shift(d,&s2);
-     gras_assert2 (!strcmp(buf,s2),
+     xbt_dynar_shift(d,&s2);
+     xbt_assert2 (!strcmp(buf,s2),
            "The retrieved value is not the same than the injected one at the end (%s!=%s)",
               buf,s2);
      free(s2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
 
    INFO3("==== Push %d strings, remove %d-%d. free the rest",NB_ELEM,2*(NB_ELEM/5),4*(NB_ELEM/5));
-   d=gras_dynar_new(sizeof(char*),&free_string);
+   d=xbt_dynar_new(sizeof(char*),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
-     gras_dynar_push(d,&s1);
+     xbt_dynar_push(d,&s1);
    }
    for (cpt=2*(NB_ELEM/5); cpt< 4*(NB_ELEM/5); cpt++) {
      sprintf(buf,"%d",cpt);
-     gras_dynar_remove_at(d,2*(NB_ELEM/5),&s2);
-     gras_assert2(!strcmp(buf,s2),
+     xbt_dynar_remove_at(d,2*(NB_ELEM/5),&s2);
+     xbt_assert2(!strcmp(buf,s2),
                  "Remove a bad value. Got %s, expected %s",
                  s2,buf);
       free(s2);
    }
-   gras_dynar_free(&d);
-   gras_dynar_free(&d);
+   xbt_dynar_free(&d);
+   xbt_dynar_free(&d);
 
-   gras_exit();
+   xbt_exit();
    return 0;
 }
index e92a485..d8192e0 100644 (file)
 #include <gras.h>
 #include <stdio.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(test, top,"Logging specific to this test");
-GRAS_LOG_NEW_CATEGORY(top,"Useless test channel");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(test, top,"Logging specific to this test");
+XBT_LOG_NEW_CATEGORY(top,"Useless test channel");
 
 int main(int argc, char **argv) {
-  gras_init_defaultlog(&argc,argv,"root.thresh=debug log.thresh=debug");
+  xbt_init_defaultlog(&argc,argv,"root.thresh=debug log.thresh=debug");
 
   DEBUG1("val=%d", 1);
   WARN1("val=%d", 2);
   CDEBUG2(top, "val=%d%s", 3, "!");
   CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!");
   
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index c1bcac8..2e8a92d 100644 (file)
 #define NB_TEST 20
 int verbose=0;
 
-static gras_error_t test1();
+static xbt_error_t test1();
 
-static gras_error_t test1() {
-  gras_error_t errcode;
-  gras_dict_t *head=NULL;
+static xbt_error_t test1() {
+  xbt_error_t errcode;
+  xbt_dict_t *head=NULL;
   int i,j,k,l;
   char **key = NULL;
   char **val = NULL;
@@ -54,10 +54,10 @@ static gras_error_t test1() {
        key[l]=val[l];/*  NOWADAYS, no need to strdup the key. */
       }
       if (verbose) printf("in multitree %p.\n",head);
-      TRYFAIL(gras_multidict_set(&head,MULTICACHE_DEPTH,key,
+      TRYFAIL(xbt_multidict_set(&head,MULTICACHE_DEPTH,key,
                                 strdup(val[0]),&free));
 
-      TRYFAIL(gras_multidict_get(head,
+      TRYFAIL(xbt_multidict_get(head,
                                 MULTICACHE_DEPTH,(const char **)val,
                                 &data));
       if (!data || strcmp((char*)data,val[0])) {
@@ -66,8 +66,8 @@ static gras_error_t test1() {
        abort();
       }
     }
-    gras_dict_dump(head,&gras_dict_print);
-    gras_dict_free(&head);
+    xbt_dict_dump(head,&xbt_dict_print);
+    xbt_dict_free(&head);
 
     for (l=0 ; l<MULTICACHE_DEPTH ; l++)
       if (val[l]) free(val[l]);
@@ -81,11 +81,11 @@ static gras_error_t test1() {
 }
 
 int main(int argc, char *argv[]) {
-  gras_error_t errcode;
+  xbt_error_t errcode;
 
-  gras_init(argc,argv,"root.thresh=debug"));
+  xbt_init(argc,argv,"root.thresh=debug"));
   TRYFAIL(test1());
    
-  gras_exit();
+  xbt_exit();
   return 0;
 }
index 8f0d20e..e31de7b 100644 (file)
@@ -13,8 +13,8 @@
 
 #include <gras.h>
 
-GRAS_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
-GRAS_LOG_EXTERNAL_CATEGORY(set);
+XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
+XBT_LOG_EXTERNAL_CATEGORY(set);
 
 typedef struct  {
   /* headers */
@@ -26,16 +26,16 @@ typedef struct  {
   char         *data;
 } s_my_elem_t,*my_elem_t;
 
-static void fill(gras_set_t *set);
-static void debuged_add(gras_set_t set,const char*key);
-static void debuged_add_with_data(gras_set_t  set,
+static void fill(xbt_set_t *set);
+static void debuged_add(xbt_set_t set,const char*key);
+static void debuged_add_with_data(xbt_set_t  set,
                                  const char *name,
                                  const char *data);
-static gras_error_t search_name(gras_set_t set,const char*key);
-static gras_error_t search_id(gras_set_t head,
+static xbt_error_t search_name(xbt_set_t set,const char*key);
+static xbt_error_t search_id(xbt_set_t head,
                              int id,
                              const char*expected_key);
-static gras_error_t traverse(gras_set_t set);
+static xbt_error_t traverse(xbt_set_t set);
 
 static void my_elem_free(void *e) {
   my_elem_t elm=(my_elem_t)e;
@@ -47,36 +47,36 @@ static void my_elem_free(void *e) {
   }
 }
 
-static void debuged_add_with_data(gras_set_t  set,
+static void debuged_add_with_data(xbt_set_t  set,
                                  const char *name,
                                  const char *data) {
 
   my_elem_t    elm;
 
-  elm = gras_new(s_my_elem_t,1);
-  elm->name=gras_strdup(name);
+  elm = xbt_new(s_my_elem_t,1);
+  elm->name=xbt_strdup(name);
   elm->name_len=0;
 
-  elm->data=gras_strdup(data);
+  elm->data=xbt_strdup(data);
 
   printf("   - Add %s ",name);
   if (strcmp(name,data)) {
     printf("(->%s)",data);
   }
   printf("\n");
-  gras_set_add(set, (gras_set_elm_t)elm,
+  xbt_set_add(set, (xbt_set_elm_t)elm,
               &my_elem_free);
 }
 
-static void debuged_add(gras_set_t  set,
+static void debuged_add(xbt_set_t  set,
                        const char *name) {
   debuged_add_with_data(set, name, name);
 }
 
-static void fill(gras_set_t *set) {
+static void fill(xbt_set_t *set) {
   printf("\n Fill in the data set\n");
 
-  *set=gras_set_new();
+  *set=xbt_set_new();
   debuged_add(*set,"12");
   debuged_add(*set,"12a");
   debuged_add(*set,"12b");
@@ -88,11 +88,11 @@ static void fill(gras_set_t *set) {
   debuged_add(*set,"123457");
 }
 
-static gras_error_t search_name(gras_set_t head,const char*key) {
-  gras_error_t    errcode;
+static xbt_error_t search_name(xbt_set_t head,const char*key) {
+  xbt_error_t    errcode;
   my_elem_t       elm;
   
-  errcode=gras_set_get_by_name(head,key,(gras_set_elm_t*)&elm);
+  errcode=xbt_set_get_by_name(head,key,(xbt_set_elm_t*)&elm);
   printf("   - Search by name %s. Found %s (under ID %d)\n",
         key, 
         elm? elm->data:"(null)",
@@ -111,11 +111,11 @@ static gras_error_t search_name(gras_set_t head,const char*key) {
   return errcode;
 }
 
-static gras_error_t search_id(gras_set_t head,int id,const char*key) {
-  gras_error_t errcode;
+static xbt_error_t search_id(xbt_set_t head,int id,const char*key) {
+  xbt_error_t errcode;
   my_elem_t    elm;
   
-  errcode=gras_set_get_by_id(head,id,(gras_set_elm_t*)&elm);
+  errcode=xbt_set_get_by_id(head,id,(xbt_set_elm_t*)&elm);
   printf("   - Search by id %d. Found %s (data %s)\n",
         id, 
         elm? elm->name:"(null)",
@@ -140,14 +140,14 @@ static gras_error_t search_id(gras_set_t head,int id,const char*key) {
 }
 
 
-static gras_error_t traverse(gras_set_t set) {
-  gras_set_cursor_t cursor=NULL;
+static xbt_error_t traverse(xbt_set_t set) {
+  xbt_set_cursor_t cursor=NULL;
   my_elem_t         elm=NULL;
 
-  gras_set_foreach(set,cursor,elm) {
-    gras_assert0(elm,"Dude ! Got a null elm during traversal!");
+  xbt_set_foreach(set,cursor,elm) {
+    xbt_assert0(elm,"Dude ! Got a null elm during traversal!");
     printf("   - Id(%d):  %s->%s\n",elm->ID,elm->name,elm->data);
-    gras_assert2(!strcmp(elm->name,elm->data),
+    xbt_assert2(!strcmp(elm->name,elm->data),
                 "Key(%s) != value(%s). Abording",
                 elm->name,elm->data);
   }
@@ -155,11 +155,11 @@ static gras_error_t traverse(gras_set_t set) {
 }
 
 int main(int argc,char **argv) {
-  gras_error_t errcode;
-  gras_set_t set=NULL;
+  xbt_error_t errcode;
+  xbt_set_t set=NULL;
   my_elem_t  elm;
 
-  gras_init_defaultlog(&argc,argv,"set.thresh=verbose");
+  xbt_init_defaultlog(&argc,argv,"set.thresh=verbose");
    
   printf("\nData set: USAGE test:\n");
 
@@ -168,9 +168,9 @@ int main(int argc,char **argv) {
 
   fill(&set);
   printf(" Free the data set\n");
-  gras_set_free(&set);
+  xbt_set_free(&set);
   printf(" Free the data set again\n");
-  gras_set_free(&set);
+  xbt_set_free(&set);
   
   fill(&set);
 
@@ -184,20 +184,20 @@ int main(int argc,char **argv) {
   printf("   - Change 12a to '12a'\n");
   debuged_add_with_data(set,"12a","12a");
 
-  /*  gras_dict_dump(head,(void (*)(void*))&printf); */
+  /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
   printf(" - Traverse the resulting data set\n");
   TRYFAIL(traverse(set));
 
   printf(" - Retrive values\n");
-  gras_set_get_by_name(set,"123",(gras_set_elm_t*)&elm);
+  xbt_set_get_by_name(set,"123",(xbt_set_elm_t*)&elm);
   assert(elm);
   TRYFAIL(strcmp("123",elm->data));
 
-  TRYEXPECT(gras_set_get_by_name(set,"Can't be found",(gras_set_elm_t*)&elm),
+  TRYEXPECT(xbt_set_get_by_name(set,"Can't be found",(xbt_set_elm_t*)&elm),
            mismatch_error);
-  TRYEXPECT(gras_set_get_by_name(set,"123 Can't be found",(gras_set_elm_t*)&elm),
+  TRYEXPECT(xbt_set_get_by_name(set,"123 Can't be found",(xbt_set_elm_t*)&elm),
            mismatch_error);
-  TRYEXPECT(gras_set_get_by_name(set,"12345678 NOT",(gras_set_elm_t*)&elm),
+  TRYEXPECT(xbt_set_get_by_name(set,"12345678 NOT",(xbt_set_elm_t*)&elm),
            mismatch_error);
 
   TRYFAIL(search_name(set,"12"));
@@ -219,15 +219,15 @@ int main(int argc,char **argv) {
   printf(" - Traverse the resulting data set\n");
   TRYFAIL(traverse(set));
 
-  /*  gras_dict_dump(head,(void (*)(void*))&printf); */
+  /*  xbt_dict_dump(head,(void (*)(void*))&printf); */
 
   printf(" Free the data set (twice)\n");
-  gras_set_free(&set);
-  gras_set_free(&set);
+  xbt_set_free(&set);
+  xbt_set_free(&set);
 
   printf(" - Traverse the resulting data set\n");
   TRYFAIL(traverse(set));
 
-  gras_exit();
+  xbt_exit();
   return 0;
 }