Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Current state. See changelog, sorry, I'm out of time
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 6 Oct 2004 14:03:54 +0000 (14:03 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 6 Oct 2004 14:03:54 +0000 (14:03 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@442 48e7efb5-ca39-0410-a469-dd3cf9ba447f

65 files changed:
ChangeLog
configure.ac
examples/Makefile.am
examples/ping/Makefile.am
examples/saturate/Makefile.am
examples/saturate/saturate.c
include/Makefile.am
include/gras.h
include/gras/datadesc.h
include/gras/messages.h
include/gras/transport.h
include/xbt/config.h
include/xbt/dict.h
include/xbt/dynar.h
include/xbt/error.h
include/xbt/log.h
include/xbt/set.h
src/Makefile.am
src/amok/Makefile.am
src/amok/bandwidth.c
src/amok/base.c
src/gras/DataDesc/cbps.c
src/gras/DataDesc/datadesc.c
src/gras/DataDesc/datadesc_private.h
src/gras/DataDesc/ddt_create.c
src/gras/DataDesc/ddt_exchange.c
src/gras/DataDesc/ddt_parse.c
src/gras/Msg/msg.c
src/gras/Msg/msg_private.h
src/gras/Transport/transport.c
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_conditional.c
src/gras/Virtu/rl_time.c
src/gras/Virtu/sg_conditional.c
src/gras/Virtu/sg_process.c
src/gras/Virtu/virtu_interface.h
src/gras/Virtu/virtu_rl.h
src/gras/Virtu/virtu_sg.h
src/gras_private.h [deleted file]
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/xbt_interface.h [deleted file]
testsuite/gras/datadesc_usage.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/set_usage.c

index 3a1cc88..6f255aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,16 +1,47 @@
+2004-11-04 Martin Quinson
+  - Allow to (en/dis)able the cycle detection at run time.
+  
+    Whether we should check for cycle or not is now a property of each
+    datatype. When you think there may be some cycle, use datadesc_cycle_set.
+    datadesc_cycle_unset allow to remove this property when previously set.
+    
+    Note that the cycle detection is off by default since it impacts the 
+    performance. Watch the data you feed GRAS with ;)
+    
+    This property is hereditary. Any element embeeded in a structure having it
+    set have it set for the time of this data exchange.
+    
+    You should set it both on sender and receiver side. If you don't set it on
+    sender side, it will enter an endless loop. If you forget on receiver
+    side, the cycles won't be recreated after communication.
+    
+  - Header reorganization.
+    Kill gras_private.h, each submodule must load the headers it needs.
+
+2004-10-04 Martin Quinson
+  - Interface revolution: do not try to survive to malloc failure.
+  
+    Now, gras_malloc and friends call gras_abort() on failure.
+    As a conclusion, malloc_error is not a valid error anymore, and all
+      functions for which it was the only gras_error_t return value are
+      changed. They now return void, or there result directly. 
+    This simplify the API a lot.
+
 2004-09-29 Martin Quinson
   - Re-enable raw sockets.
     Created by gras_socket_{client,server}_ext;
     Used with gras_raw_{send,recv}
 2004-09-29 Martin Quinson
   - Re-enable raw sockets.
     Created by gras_socket_{client,server}_ext;
     Used with gras_raw_{send,recv}
+    No select possible.
     
     
-    It should allow to kill the last bits of gras first version.
+    It should allow to kill the last bits of gras first version soon.
   
     This is not completely satisfactory yet (dupplicate code with
      chunk_{send,recv}; a bit out of the plugin mecanism), but it should
      work. 
 
   
     This is not completely satisfactory yet (dupplicate code with
      chunk_{send,recv}; a bit out of the plugin mecanism), but it should
      work. 
 
-  - Simplify transport plugin interface by not passing any argument to
-    _server and _client, but embeeding them in the socket struct directly. 
+  - Simplify transport plugin (internal) interface by not passing any
+    argument to _server and _client, but embeeding them in the socket
+    struct directly. 
 
 2004-09-28 Martin Quinson
   - Finish the port to AIX.
 
 2004-09-28 Martin Quinson
   - Finish the port to AIX.
@@ -28,7 +59,7 @@
 
 2004-09-07 Martin Quinson
   - Source code reorganization to allow Arnaud to surf all over there.
 
 2004-09-07 Martin Quinson
   - Source code reorganization to allow Arnaud to surf all over there.
-  - Allow to document the logging categories
+  - Allow to document the logging categories.
   - Remove all uppercase from logging categories and useless cleanup in names.
 
 2004-08-18 Martin Quinson
   - Remove all uppercase from logging categories and useless cleanup in names.
 
 2004-08-18 Martin Quinson
@@ -52,7 +83,7 @@
   Version 0.5 (protocol not changed; ABI changed)
   - Allow to off turn the cycle detection code in data exchange at
     compilation time. It should be at run time, but I'm short of time (and
   Version 0.5 (protocol not changed; ABI changed)
   - Allow to off turn the cycle detection code in data exchange at
     compilation time. It should be at run time, but I'm short of time (and
-    the config stuff is still broken). That way, we keep dict of of the
+    the config stuff is still broken). That way, we keep dict out of the
     critical path, which is good because the performance is poor:
      - search not dichotomial yet
      - dynar give no way to access their content and memcpy everytime
     critical path, which is good because the performance is poor:
      - search not dichotomial yet
      - dynar give no way to access their content and memcpy everytime
@@ -61,7 +92,7 @@
     of the critical path, which is good since they rely on dynar and
     dictionnaries. The only loose of that is that we cannot detect the
     redeclaration of a structure/union with another content (but I'm not sure 
     of the critical path, which is good since they rely on dynar and
     dictionnaries. The only loose of that is that we cannot detect the
     redeclaration of a structure/union with another content (but I'm not sure 
-    the code detected this error well before anyway). We still can detect
+    the code detected well this error before anyway). We still can detect
     the redefinition discrepancy for the other types.
   - Use a whole bunch of optimisation flags (plus -fno-strict-aliasing since
     it breaks the code because of type-punning used all over the place).
     the redefinition discrepancy for the other types.
   - Use a whole bunch of optimisation flags (plus -fno-strict-aliasing since
     it breaks the code because of type-punning used all over the place).
index 9552da7..88c7d2b 100644 (file)
@@ -97,8 +97,7 @@ AC_CONFIG_FILES([
   include/Makefile
   src/Makefile
   examples/Makefile 
   include/Makefile
   src/Makefile
   examples/Makefile 
-    examples/ping/Makefile 
-    examples/ping/test_sg
+    examples/ping/Makefile      examples/ping/test_sg
   doc/Makefile
   tools/compile-remote-worker
   testsuite/Makefile
   doc/Makefile
   tools/compile-remote-worker
   testsuite/Makefile
@@ -115,19 +114,13 @@ AC_CONFIG_FILES([
      chmod +x $srcdir/examples/ping/test_rl
 ])
 
      chmod +x $srcdir/examples/ping/test_rl
 ])
 
-#    src/gros/Makefile
-#    src/gras/Makefile
-
-#      testsuite/gras/Makefile
-#
-#        testsuite/gras/trp_tcp_usage
-#        testsuite/gras/trp_file_usage
+#    src/amok/Makefile
 
 
+#    examples/bandwidth/Makefile examples/bandwidth/test_sg
+#    examples/saturate/Makefile  examples/saturate/test_sg
+#    examples/alnem/Makefile     examples/alnem/test_sg
 
 
-#      src/examples/pastry/Makefile
-#    src/amok/Makefile
-#      src/examples/bandwidth/Makefile src/examples/saturate/Makefile
-#      src/examples/alnem/Makefile 
+#    examples/pastry/Makefile    examples/pastry/test_sg
 
 AC_OUTPUT
 
 
 AC_OUTPUT
 
index 6b5e04b..c092314 100644 (file)
@@ -1,3 +1,3 @@
-SUBDIRS=ping
+SUBDIRS=ping # saturate
 EXTRA_DIST=gras_stub_generator WAN_3.platform.txt WAN_3.platform_2.txt
 #bandwidth saturate alnem
 EXTRA_DIST=gras_stub_generator WAN_3.platform.txt WAN_3.platform_2.txt
 #bandwidth saturate alnem
index 7857539..01d8725 100644 (file)
@@ -28,7 +28,3 @@ MAINTAINERCLEANFILES = _ping_simulator.c _ping_client.c _ping_server.c
 _ping_client.c _ping_server.c _ping_simulator.c: ping_deployment.txt $(top_srcdir)/examples/gras_stub_generator
        $(top_srcdir)/examples/gras_stub_generator ping ping_deployment.txt >/dev/null
 
 _ping_client.c _ping_server.c _ping_simulator.c: ping_deployment.txt $(top_srcdir)/examples/gras_stub_generator
        $(top_srcdir)/examples/gras_stub_generator ping ping_deployment.txt >/dev/null
 
-
-# support vpath build
-#test_rl test_sg: 
-#      cp $(srcdir)/$@ . && chmod +x $@ 
index 958e813..7cad623 100644 (file)
@@ -1,23 +1,30 @@
-DISTCLEANFILES=Makefile.in
-INCLUDES= -I$(top_srcdir)/src/include
+INCLUDES= -I$(top_srcdir)/include
 AM_CFLAGS=-g
 
 AM_CFLAGS=-g
 
-check_PROGRAMS=saturate_simulator saturate_sensor saturate_maestro 
+TESTS=test_rl test_sg
+EXTRA_DIST=saturate_deployment.txt $(TESTS)
+
+if HAVE_SG
+ check_PROGRAMS=saturate_simulator saturate_sensor saturate_maestro
+
+ saturate_simulator_SOURCES=_saturate_simulator.c saturate.c
+ saturate_simulator_LDADD=     $(top_builddir)/src/libgrassg.la @LIBS_SimGrid@ # $(top_srcdir)/src/modules/libgrasmodules.la
+else
+ check_PROGRAMS=saturate_sensor saturate_maestro
+endif
 
 
-saturate_simulator_SOURCES=      _saturate_simulator.c saturate.c
 saturate_sensor_SOURCES=          _saturate_sensor.c saturate.c
 saturate_maestro_SOURCES=         _saturate_maestro.c saturate.c
 
 saturate_sensor_SOURCES=          _saturate_sensor.c saturate.c
 saturate_maestro_SOURCES=         _saturate_maestro.c saturate.c
 
-saturate_simulator_LDADD=        $(top_srcdir)/src/base/libgrassg.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ 
-saturate_sensor_LDADD=            $(top_srcdir)/src/base/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a
-saturate_maestro_LDADD=          $(top_srcdir)/src/base/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a
+saturate_sensor_LDADD=            $(top_srcdir)/src/libgrasrl.la # $(top_srcdir)/src/modules/libgrasmodules.a
+saturate_maestro_LDADD=          $(top_srcdir)/src/libgrasrl.la # $(top_srcdir)/src/modules/libgrasmodules.a
 
 # cleanup templates
 CLEANFILES= _saturate_simulator.c _saturate_sensor.c _saturate_maestro.c 
 
 # generate templates 
 _saturate_sensor.c _saturate_maestro.c _saturate_simulator.c: saturate_deployment.txt
 
 # cleanup templates
 CLEANFILES= _saturate_simulator.c _saturate_sensor.c _saturate_maestro.c 
 
 # generate templates 
 _saturate_sensor.c _saturate_maestro.c _saturate_simulator.c: saturate_deployment.txt
-       ../gras_stub_generator saturate saturate_deployment.txt >/dev/null
+       $(top_srcdir)/examples/gras_stub_generator saturate saturate_deployment.txt >/dev/null
 
 
 
 
 
 
index 52136fd..3fe04b9 100644 (file)
 
 #include <gras.h>
 
 
 #include <gras.h>
 
+GRAS_LOG_NEW_DEFAULT_CATEGORY(saturate,"Messages specific to this example");
+
 /* **********************************************************************
  * Sensor code
  * **********************************************************************/
 
 /* Global private data */
 typedef struct {
 /* **********************************************************************
  * Sensor code
  * **********************************************************************/
 
 /* Global private data */
 typedef struct {
-  gras_sock_t *sock;
+  gras_socket_t *sock;
 } sensor_data_t;
 
 /* Function prototypes */
 } sensor_data_t;
 
 /* Function prototypes */
@@ -31,25 +33,27 @@ int sensor (int argc,char *argv[]) {
   gras_error_t errcode;
   sensor_data_t *g=gras_userdata_new(sensor_data_t);  
 
   gras_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));
+  if ((errcode=gras_socket_server(4000,&(g->sock)))) {
+    CRITICAL1("Sensor: Error %s encountered while opening the server socket",gras_error_name(errcode));
     return 1;
   }
 
   if (grasbw_register_messages()) {
     return 1;
   }
 
   if (grasbw_register_messages()) {
-    gras_sock_close(g->sock);
+    gras_socket_close(g->sock);
     return 1;
   }
 
   while (1) {
     return 1;
   }
 
   while (1) {
-    if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) {
-      fprintf(stderr,"Sensor: Error '%s' while handling message\n",
+    if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { 
+       CRITICAL1("Sensor: Error '%s' while handling message",
              gras_error_name(errcode));
     }
   }
 
              gras_error_name(errcode));
     }
   }
 
-  gras_sleep(5,0);
-  return gras_sock_close(g->sock);
+  gras_os_sleep(5,0);
+  gras_socket_close(g->sock);
+   
+  return 0;
 }
 
 /* **********************************************************************
 }
 
 /* **********************************************************************
@@ -58,7 +62,7 @@ int sensor (int argc,char *argv[]) {
 
 /* Global private data */
 typedef struct {
 
 /* Global private data */
 typedef struct {
-  gras_sock_t *sock;
+  gras_socket_t *sock;
 } maestro_data_t;
 
 /* Function prototypes */
 } maestro_data_t;
 
 /* Function prototypes */
@@ -85,7 +89,7 @@ double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2)
            gras_error_name(errcode));
     return -1;
   }
            gras_error_name(errcode));
     return -1;
   }
-  gras_sleep(1,0);
+  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));
     return -1;
   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));
     return -1;
@@ -129,18 +133,18 @@ int maestro(int argc,char *argv[]) {
 
   int a,b,c,d,begin;
 
 
   int a,b,c,d,begin;
 
-  if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { 
+  if ((errcode=gras_socket_server(4000,&(g->sock)))) { 
     fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode));
     return 1;
   }
 
   if (grasbw_register_messages()) {
     fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode));
     return 1;
   }
 
   if (grasbw_register_messages()) {
-    gras_sock_close(g->sock);
+    gras_socket_close(g->sock);
     return 1;
   }
 
   begin=time(NULL);
     return 1;
   }
 
   begin=time(NULL);
-  beginSim=gras_time();
+  beginSim=gras_os_time();
   for (a=0; a<MAXHOSTS; a++) {
     for (b=0; b<MAXHOSTS; b++) {
       if (a==b) continue;
   for (a=0; a<MAXHOSTS; a++) {
     for (b=0; b<MAXHOSTS; b++) {
       if (a==b) continue;
@@ -154,7 +158,7 @@ int maestro(int argc,char *argv[]) {
     }
   }
   fprintf(stderr,"Did all BW tests in %ld sec (%.2f simulated sec)\n",
     }
   }
   fprintf(stderr,"Did all BW tests in %ld sec (%.2f simulated sec)\n",
-         time(NULL)-begin,gras_time()-beginSim);
+         time(NULL)-begin,gras_os_time()-beginSim);
       
   for (a=0; a<MAXHOSTS; a++) {
     for (b=0; b<MAXHOSTS; b++) {
       
   for (a=0; a<MAXHOSTS; a++) {
     for (b=0; b<MAXHOSTS; b++) {
@@ -165,10 +169,10 @@ int maestro(int argc,char *argv[]) {
                gras_error_name(errcode));
        return -1;
       }
                gras_error_name(errcode));
        return -1;
       }
-      gras_sleep(1,0);
+      gras_os_sleep(1,0);
 
       begin=time(NULL);
 
       begin=time(NULL);
-      beginSim=gras_time();
+      beginSim=gras_os_time();
       for (c=0 ;c<MAXHOSTS; c++) {
        if (a==c) continue;
        if (b==c) continue;
       for (c=0 ;c<MAXHOSTS; c++) {
        if (a==c) continue;
        if (b==c) continue;
@@ -184,7 +188,7 @@ int maestro(int argc,char *argv[]) {
            return 1;
          }
          fprintf(stderr, "MAESTRO[%.2f sec]: SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s\n",
            return 1;
          }
          fprintf(stderr, "MAESTRO[%.2f sec]: SATURATED BW XP(%s %s // %s %s) => %f (%f vs %f)%s\n",
-                 gras_time(),
+                 gras_os_time(),
                  hosts[c],hosts[d],hosts[a],hosts[b],
                  bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d],
 
                  hosts[c],hosts[d],hosts[a],hosts[b],
                  bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d],
 
@@ -200,11 +204,11 @@ int maestro(int argc,char *argv[]) {
        return -1;
       }
       fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n",
        return -1;
       }
       fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n",
-             time(NULL)-begin, gras_time()-beginSim);
+             time(NULL)-begin, gras_os_time()-beginSim);
     }
   }
 
     }
   }
 
-  gras_sleep(5,0);
+  gras_os_sleep(5,0);
   exit(0);
 #if 0
   return 0;
   exit(0);
 #if 0
   return 0;
@@ -216,7 +220,7 @@ int maestro(int argc,char *argv[]) {
     return 1;
   }
   fprintf(stderr,"MAESTRO: Saturation started\n");
     return 1;
   }
   fprintf(stderr,"MAESTRO: Saturation started\n");
-  gras_sleep(5,0);
+  gras_os_sleep(5,0);
 
   /* test with saturation */
   if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]),
 
   /* test with saturation */
   if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]),
@@ -247,7 +251,9 @@ int maestro(int argc,char *argv[]) {
          expSize/1024,msgSize/1024,
          sec,bw);
 
          expSize/1024,msgSize/1024,
          sec,bw);
 
-  gras_sleep(5,0);
+  gras_os_sleep(5,0);
 #endif
 #endif
-  return gras_sock_close(g->sock);
+  gras_socket_close(g->sock);
+   
+  return 0;
 }
 }
index b818108..30bddb4 100644 (file)
@@ -1,5 +1,6 @@
 include_HEADERS = gras.h xbt.h
 nobase_include_HEADERS = \
 include_HEADERS = gras.h xbt.h
 nobase_include_HEADERS = \
+       xbt/misc.h \
        xbt/sysdep.h \
        xbt/log.h xbt/error.h \
        xbt/module.h \
        xbt/sysdep.h \
        xbt/log.h xbt/error.h \
        xbt/module.h \
index 4420bce..4f479d4 100644 (file)
@@ -22,9 +22,4 @@
 #include <gras/datadesc.h>
 #include <gras/messages.h>
 
 #include <gras/datadesc.h>
 #include <gras/messages.h>
 
-/* FIXME: This is amok */
-
-#include <gras/modules/base.h>
-#include <gras/modules/bandwidth.h>
-
 #endif /* GRAS_H */
 #endif /* GRAS_H */
index 597686b..d3e5796 100644 (file)
 #include <sys/types.h>  /* size_t */
 #include <stdarg.h>
 
 #include <sys/types.h>  /* size_t */
 #include <stdarg.h>
 
-
-/*! C++ users need love */
-#ifndef BEGIN_DECL
-# ifdef __cplusplus
-#  define BEGIN_DECL extern "C" {
-# else
-#  define BEGIN_DECL 
-# endif
-#endif
-
-/*! C++ users need love */
-#ifndef END_DECL
-# ifdef __cplusplus
-#  define END_DECL }
-# else
-#  define END_DECL 
-# endif
-#endif
-/* End of cruft for C++ */
+#include "xbt/misc.h" /* BEGIN_DECL */
 
 BEGIN_DECL
 
 
 BEGIN_DECL
 
-
 /**
  * gras_datadesc_type_t:
  * 
 /**
  * gras_datadesc_type_t:
  * 
@@ -104,6 +85,9 @@ gras_datadesc_type_t *
  * Change stuff within datadescs *
  *********************************/
 
  * Change stuff within datadescs *
  *********************************/
 
+void gras_datadesc_cycle_set(gras_datadesc_type_t *type);
+void gras_datadesc_cycle_unset(gras_datadesc_type_t *type);
+
 void gras_datadesc_cb_send (gras_datadesc_type_t    *type,
                            gras_datadesc_type_cb_void_t  pre);
 void gras_datadesc_cb_recv(gras_datadesc_type_t    *type,
 void gras_datadesc_cb_send (gras_datadesc_type_t    *type,
                            gras_datadesc_type_cb_void_t  pre);
 void gras_datadesc_cb_recv(gras_datadesc_type_t    *type,
index b794e14..96e8152 100644 (file)
 #ifndef GRAS_MESSAGES_H
 #define GRAS_MESSAGES_H
 
 #ifndef GRAS_MESSAGES_H
 #define GRAS_MESSAGES_H
 
-/*! C++ users need love */
-#ifndef BEGIN_DECL
-# ifdef __cplusplus
-#  define BEGIN_DECL extern "C" {
-# else
-#  define BEGIN_DECL 
-# endif
-#endif
-
-/*! C++ users need love */
-#ifndef END_DECL
-# ifdef __cplusplus
-#  define END_DECL }
-# else
-#  define END_DECL 
-# endif
-#endif
-/* End of cruft for C++ */
+#include "xbt/misc.h"
+#include "gras/transport.h"
+#include "gras/datadesc.h"
 
 BEGIN_DECL
 
 
 BEGIN_DECL
 
index ae488b1..32a5cdb 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef GRAS_TRANSPORT_H
 #define GRAS_TRANSPORT_H
 
 #ifndef GRAS_TRANSPORT_H
 #define GRAS_TRANSPORT_H
 
+#include "xbt/error.h"
+
 typedef struct s_gras_socket gras_socket_t;
 
 gras_error_t gras_socket_client(const char *host,
 typedef struct s_gras_socket gras_socket_t;
 
 gras_error_t gras_socket_client(const char *host,
index db1fa61..a4ff04f 100644 (file)
 #ifndef _GRAS_CONFIG_H_
 #define _GRAS_CONFIG_H_
 
 #ifndef _GRAS_CONFIG_H_
 #define _GRAS_CONFIG_H_
 
-typedef struct {
-  char *name;
-  int port;
-} gras_host_t;
-
 /* 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;
 /* 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;
@@ -29,7 +24,7 @@ typedef enum {
 } gras_cfgelm_type_t;
 
 /*----[ Memory management ]-----------------------------------------------*/
 } gras_cfgelm_type_t;
 
 /*----[ Memory management ]-----------------------------------------------*/
-void gras_cfg_new (gras_cfg_t **whereto); /* (whereto == NULL) is ok */
+gras_cfg_t *gras_cfg_new (void);
 void gras_cfg_cpy(gras_cfg_t **whereto, gras_cfg_t *tocopy);
 void gras_cfg_free(gras_cfg_t **cfg);
 void gras_cfg_dump(const char *name,const char*indent,gras_cfg_t *cfg);
 void gras_cfg_cpy(gras_cfg_t **whereto, gras_cfg_t *tocopy);
 void gras_cfg_free(gras_cfg_t **cfg);
 void gras_cfg_dump(const char *name,const char*indent,gras_cfg_t *cfg);
index 3ec4711..a209155 100644 (file)
@@ -21,7 +21,7 @@ typedef struct gras_dict_ gras_dict_t;
 
 /*####[ Simple dict  functions ]#############################################*/
 
 
 /*####[ Simple dict  functions ]#############################################*/
 
-void gras_dict_new(gras_dict_t **dict);
+gras_dict_t *gras_dict_new(void);
 void gras_dict_free(gras_dict_t **dict);
 
 
 void gras_dict_free(gras_dict_t **dict);
 
 
@@ -117,9 +117,8 @@ gras_error_t gras_multidict_remove_ext(gras_dict_t *head,
 /*###########################################################################*/
 typedef struct gras_dict_cursor_ gras_dict_cursor_t;
 /* creator/destructor */
 /*###########################################################################*/
 typedef struct gras_dict_cursor_ gras_dict_cursor_t;
 /* creator/destructor */
-void gras_dict_cursor_new(const gras_dict_t *head,
-                         /*OUT*/gras_dict_cursor_t **cursor);
-void         gras_dict_cursor_free(gras_dict_cursor_t *cursor);
+gras_dict_cursor_t *gras_dict_cursor_new(const gras_dict_t *head);
+void                gras_dict_cursor_free(gras_dict_cursor_t *cursor);
 
 /* back to first element 
    it is not enough to reinit the cache after an add/remove in cache*/
 
 /* back to first element 
    it is not enough to reinit the cache after an add/remove in cache*/
@@ -131,9 +130,8 @@ gras_error_t gras_dict_cursor_get_key     (gras_dict_cursor_t *cursor,
 gras_error_t gras_dict_cursor_get_data    (gras_dict_cursor_t *cursor,
                                           /*OUT*/void **data);
 
 gras_error_t gras_dict_cursor_get_data    (gras_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_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,
                                           char               **key,
 void         gras_dict_cursor_step        (gras_dict_cursor_t  *cursor);
 int          gras_dict_cursor_get_or_free (gras_dict_cursor_t **cursor,
                                           char               **key,
index 0e120b3..9b71233 100644 (file)
@@ -17,9 +17,8 @@ typedef struct gras_dynar_s gras_dynar_t;
 typedef   void (void_f_ppvoid_t)(void**);
 typedef   void (void_f_pvoid_t) (void*);
 
 typedef   void (void_f_ppvoid_t)(void**);
 typedef   void (void_f_pvoid_t) (void*);
 
-void          gras_dynar_new(gras_dynar_t **whereto, 
-                           size_t elm_size, 
-                           void_f_pvoid_t *free_func);
+gras_dynar_t *gras_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          gras_dynar_free(gras_dynar_t *dynar);
 void          gras_dynar_free_container(gras_dynar_t *dynar);
 
@@ -28,30 +27,26 @@ void          gras_dynar_reset(gras_dynar_t *dynar);
 
 
 /* regular array functions */
 
 
 /* regular array functions */
-void gras_dynar_get(const gras_dynar_t *dynar,
-                   int idx, void *dst);
-void gras_dynar_set(gras_dynar_t *dynar,
-                   int  idx, const void *src);
+void gras_dynar_get(const gras_dynar_t *dynar, int idx, void *const dst);
+void gras_dynar_set(gras_dynar_t *dynar, int  idx, const void *src);
 void gras_dynar_remplace(gras_dynar_t *dynar,
 void gras_dynar_remplace(gras_dynar_t *dynar,
-                        int  idx, const void *object);
+                        int idx, const void *object);
 
 /* perl array function */
 void gras_dynar_insert_at(gras_dynar_t *dynar,
 
 /* perl array function */
 void gras_dynar_insert_at(gras_dynar_t *dynar,
-                         int  idx, const void *src);
+                          int  idx, const void *src);
 void gras_dynar_remove_at(gras_dynar_t *dynar,
 void gras_dynar_remove_at(gras_dynar_t *dynar,
-                         int  idx, void *object);
+                          int  idx, void *object);
 void gras_dynar_push     (gras_dynar_t *dynar, const void *src);
 void gras_dynar_push     (gras_dynar_t *dynar, const void *src);
-void gras_dynar_pop      (gras_dynar_t *dynar, void *dst);
+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_unshift  (gras_dynar_t *dynar, const void *src);
-void gras_dynar_shift    (gras_dynar_t *dynar, void *dst);
+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);
 
 /* cursor functions */
 void gras_dynar_cursor_first (const gras_dynar_t *dynar, int *cursor);
 void gras_dynar_map      (const gras_dynar_t *dynar, void_f_pvoid_t *operator);
 
 /* 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 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);
 
 /**
  * gras_dynar_foreach:
 
 /**
  * gras_dynar_foreach:
index 4c283f7..9aa54b2 100644 (file)
@@ -18,6 +18,8 @@
 
 #include <stdio.h> /* FIXME: Get rid of it */
 
 
 #include <stdio.h> /* FIXME: Get rid of it */
 
+#include "xbt/log.h"
+
 #ifdef HAVE_EXECINFO_H
 #include <execinfo.h>  /* to print the backtrace */
 #endif
 #ifdef HAVE_EXECINFO_H
 #include <execinfo.h>  /* to print the backtrace */
 #endif
index c36e084..d95838a 100644 (file)
 #undef GRAS_LOG_MAYDAY
 /*#define GRAS_LOG_MAYDAY*/
 
 #undef GRAS_LOG_MAYDAY
 /*#define GRAS_LOG_MAYDAY*/
 
-
 #ifndef _GRAS_LOG_H_
 #define _GRAS_LOG_H_
 
 #include <stdarg.h>
 
 #ifndef _GRAS_LOG_H_
 #define _GRAS_LOG_H_
 
 #include <stdarg.h>
 
+#include "xbt/sysdep.h"
+
 /**
  * gras_log_priority_t:
  * @gras_log_priority_none:          used internally (don't poke with)
 /**
  * gras_log_priority_t:
  * @gras_log_priority_none:          used internally (don't poke with)
index 8fb2e2c..5ab5d1c 100644 (file)
@@ -26,7 +26,7 @@ typedef struct gras_set_elm_ {
 
 /*####[ Functions ]##########################################################*/
 
 
 /*####[ Functions ]##########################################################*/
 
-void gras_set_new (gras_set_t **dst);
+gras_set_t *gras_set_new (void);
 void gras_set_free(gras_set_t **set);
 
 
 void gras_set_free(gras_set_t **set);
 
 
@@ -61,7 +61,7 @@ int          gras_set_cursor_get_or_free (gras_set_cursor_t **cursor,
                                          gras_set_elm_t    **elm);
 
 #define gras_set_foreach(set,cursor,elm)                       \
                                          gras_set_elm_t    **elm);
 
 #define gras_set_foreach(set,cursor,elm)                       \
-  for (cursor=NULL, gras_set_cursor_first((set),&(cursor)) ;   \
+  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) )
 
        gras_set_cursor_get_or_free(&(cursor),(gras_set_elm_t**)&(elm));          \
        gras_set_cursor_step(cursor) )
 
index b68f89d..1ad9ef1 100644 (file)
@@ -1,5 +1,4 @@
-SUBDIRS=.  
-# amok not ported to GRAS NG yet
+SUBDIRS= . # amok
 
 AM_CFLAGS= -g
 #AM_CFLAGS= -DNDEBUG 
 
 AM_CFLAGS= -g
 #AM_CFLAGS= -DNDEBUG 
@@ -17,7 +16,6 @@ MAINTAINERCLEANFILES=Makefile.in
 INCLUDES= -I$(top_srcdir)/include \
           @CFLAGS_SimGrid@
 EXTRA_DIST= \
 INCLUDES= -I$(top_srcdir)/include \
           @CFLAGS_SimGrid@
 EXTRA_DIST= \
-        gras_private.h\
         \
         xbt/dict_private.h \
         \
         \
         xbt/dict_private.h \
         \
@@ -27,6 +25,8 @@ EXTRA_DIST= \
        gras/Virtu/virtu_sg.h \
        gras/DataDesc/ddt_parse.yy.l gras/DataDesc/ddt_parse.yy.c
 
        gras/Virtu/virtu_sg.h \
        gras/DataDesc/ddt_parse.yy.l gras/DataDesc/ddt_parse.yy.c
 
+#        gras_private.h
+
 #LIBRARY_VERSION= 0:0:0
 #                 | | |
 #          +------+ | +---+
 #LIBRARY_VERSION= 0:0:0
 #                 | | |
 #          +------+ | +---+
@@ -74,7 +74,8 @@ endif
 
 COMMON_S=\
   \
 
 COMMON_S=\
   \
-  xbt/xbt_interface.h                                                         \
+  xbt_modinter.h    gras_modinter.h                                            \
+  \
   xbt/sysdep.c                                                                 \
   xbt/log.c         xbt/log_default_appender.c   xbt/error.c                 \
   xbt/dynar.c                                                                  \
   xbt/sysdep.c                                                                 \
   xbt/log.c         xbt/log_default_appender.c   xbt/error.c                 \
   xbt/dynar.c                                                                  \
index 94a82d5..5f8e10a 100644 (file)
@@ -1,9 +1,11 @@
 DISTCLEANFILES=Makefile.in
 DISTCLEANFILES=Makefile.in
-INCLUDES= -I$(top_srcdir)/src/include @CFLAGS_SimGrid@
+INCLUDES= -I$(top_srcdir)/src -I$(top_srcdir)/include @CFLAGS_SimGrid@
 
 
-lib_LIBRARIES= libgrasmodules.a
+lib_LTLIBRARIES= libamok.la
 
 
-libgrasmodules_a_SOURCES= \
+libamok_la_SOURCES= \
        base.c bandwidth.c
 
        base.c bandwidth.c
 
+VERSION_INFO= -release 20040722 -version-info 0:0:0
+
 
 
index 167559c..41db909 100644 (file)
@@ -1,9 +1,9 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts    */
+/* amok_bandwidth - Bandwidth tests facilities    */
 
 /* Authors: Martin Quinson                                                  */
 
 /* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2003 the OURAGAN project.                                  */
+/* Copyright (C) 2003, 2004 the OURAGAN project.                            */
 
 /* 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. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
-#include <gras.h>
+#include "gras/messages.h"
+#include "amok/bandwidth.h"
 
 /**
 
 /**
- * BwExp_t:
+ * bw_request_t:
  *
  *
- * Description of a BW experiment (payload when asking an host to do a BW experiment with us)
+ * Request for a BW experiment.
+ * If host==NULL, it should be between the sender and the receiver.
+ * If not, it should be between between the receiver and @host (3-tiers).
  */
 typedef struct {
  */
 typedef struct {
-  unsigned int bufSize;
-  unsigned int expSize;
-  unsigned int msgSize;
-  unsigned int port;    /* raw socket to use */
-} BwExp_t;
-
-static const DataDescriptor BwExp_Desc[] = 
- { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,bufSize)),
-   SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,expSize)),
-   SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,msgSize)),
-   SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,port))};
-#define BwExp_Len 4
+  gras_host_t host; /* host+raw socket to use */
+  unsigned int buf_size;
+  unsigned int exp_size;
+  unsigned int msg_size;
+} bw_request_t;
 
 /**
 
 /**
- * SatExp_t:
+ * bw_res_t:
  *
  *
- * Description of a BW experiment (payload when asking an host to do a BW experiment with us)
+ * Result of a BW experiment (payload when answering).
+ * if err.msg != NULL, it wasn't sucessful. Check err.msg and err.code to see why.
+ * else
  */
 typedef struct {
  */
 typedef struct {
-  unsigned int msgSize;
-  unsigned int timeout;
-  unsigned int port;    /* raw socket to use */
-} SatExp_t;
+  amok_remoterr_t err;
+  unsigned int timestamp;
+  double seconds;
+  double bw;
+} bw_res_t;
 
 
-static const DataDescriptor SatExp_Desc[] = 
- { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,msgSize)),
-   SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,timeout)),
-   SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,port))};
-#define SatExp_Len 3
 
 
+/**
+ * sat_request_t:
+ *
+ * Description of a saturation experiment (payload asking some host to collaborate for that)
+ */
+typedef struct {
+  gras_host_t host; /* host+raw socket to use */
+  unsigned int msg_size;
+  unsigned int timeout;
+} sat_request_t;
 
 /* Prototypes of local callbacks */
 
 /* Prototypes of local callbacks */
-int grasbw_cbBWHandshake(gras_msg_t *msg);
-int grasbw_cbBWRequest(gras_msg_t *msg);
+int amok_bw_cb_bw_handshake(gras_socket_t *expeditor,
+                           void          *payload);
+int amok_bw_cb_bw_request(gras_socket_t   *expeditor,
+                         void            *payload);
 
 
-int grasbw_cbSatStart(gras_msg_t *msg);
-int grasbw_cbSatBegin(gras_msg_t *msg);
+int amok_bw_cb_sat_start(gras_socket_t    *expeditor,
+                        void             *payload);
+int amok_bw_cb_sat_begin(gras_socket_t    *expeditor,
+                        void             *payload);
 
 /**** code ****/
 
 /**** code ****/
-gras_error_t grasbw_register_messages(void) {
+void amok_bw_init(void) {
   gras_error_t errcode;
   gras_error_t errcode;
-
-  
-  if ( /* Bandwidth */
-      (errcode=gras_msgtype_register(GRASMSG_BW_REQUEST,"BW request",2,
-                              msgHostDesc,msgHostLen,
-                              BwExp_Desc,BwExp_Len)) ||
-      (errcode=gras_msgtype_register(GRASMSG_BW_RESULT, "BW result",2,
-                              msgErrorDesc,msgErrorLen,
-                              msgResultDesc,msgResultLen /* first=seconds, second=bw */)) ||
-      
-      (errcode=gras_msgtype_register(GRASMSG_BW_HANDSHAKE, "BW handshake",1,
-                              BwExp_Desc,BwExp_Len))  || 
-      (errcode=gras_msgtype_register(GRASMSG_BW_HANDSHAKED, "BW handshake ACK",1,
-                              BwExp_Desc,BwExp_Len)) ||
-      
-      /* Saturation */
-      (errcode=gras_msgtype_register(GRASMSG_SAT_START,"SAT_START",2,
-                              msgHostDesc,msgHostLen,
-                              SatExp_Desc,SatExp_Len)) ||
-      (errcode=gras_msgtype_register(GRASMSG_SAT_STARTED, "SAT_STARTED",1,
-                              msgErrorDesc,msgErrorLen)) ||
-      
-      (errcode=gras_msgtype_register(GRASMSG_SAT_BEGIN,"SAT_BEGIN",1,
-                              SatExp_Desc,SatExp_Len)) ||
-      (errcode=gras_msgtype_register(GRASMSG_SAT_BEGUN, "SAT_BEGUN",2,
-                              msgErrorDesc,msgErrorLen,
-                              SatExp_Desc,SatExp_Len)) ||
-      
-      (errcode=gras_msgtype_register(GRASMSG_SAT_END,"SAT_END",0)) ||
-      (errcode=gras_msgtype_register(GRASMSG_SAT_ENDED, "SAT_ENDED",1,
-                              msgErrorDesc,msgErrorLen)) ||
-      
-      (errcode=gras_msgtype_register(GRASMSG_SAT_STOP,"SAT_STOP",0)) ||
-      (errcode=gras_msgtype_register(GRASMSG_SAT_STOPPED, "SAT_STOPPED",1,
-                              msgErrorDesc,msgErrorLen)) ) 
-    {
-
-      fprintf(stderr,"GRASBW: Unable register the messages (got error %s)\n",
-             gras_error_name(errcode));
-      return errcode;
-    }
-
-  if ((errcode=gras_cb_register(GRASMSG_BW_HANDSHAKE,-1,&grasbw_cbBWHandshake)) ||
-      (errcode=gras_cb_register(GRASMSG_BW_REQUEST,-1,&grasbw_cbBWRequest))  ||
-
-      (errcode=gras_cb_register(GRASMSG_SAT_START,-1,&grasbw_cbSatStart))  ||
-      (errcode=gras_cb_register(GRASMSG_SAT_BEGIN,-1,&grasbw_cbSatBegin)) ) {
-
-    fprintf(stderr,"GRASBW: Unable register the callbacks (got error %s)\n",
-           gras_error_name(errcode));
-    return errcode;
-  }
-
-  return no_error;
+  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,"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"));
+  gras_datadesc_struct_close(bw_request_desc);
+  bw_request_desc = gras_datadesc_ref("bw_request_t*",bw_request_desc);
+
+  bw_res_desc = gras_datadesc_struct("bw_res_t");
+  gras_datadesc_struct_append(bw_res_desc,"err",gras_datadesc_by_name("amok_remoterr_t"));
+  gras_datadesc_struct_append(bw_res_desc,"timestamp",gras_datadesc_by_name("unsigned int"));
+  gras_datadesc_struct_append(bw_res_desc,"seconds",gras_datadesc_by_name("double"));
+  gras_datadesc_struct_append(bw_res_desc,"bw",gras_datadesc_by_name("double"));
+  gras_datadesc_struct_close(bw_res_desc);
+  bw_res_desc = gras_datadesc_ref("bw_res_t*",bw_res_desc);
+
+  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,"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);
+  sat_request_desc = gras_datadesc_ref("sat_request_t*",sat_request_desc);
+   
+  /* Register the bandwidth messages */
+  gras_msgtype_declare("BW request",       bw_request_desc);
+  gras_msgtype_declare("BW result",        bw_res_desc);
+  gras_msgtype_declare("BW handshake",     bw_request_desc);
+  gras_msgtype_declare("BW handshake ACK", bw_request_desc);
+
+  /* Register the saturation messages */
+  gras_msgtype_declare("SAT start",   sat_request_desc);
+  gras_msgtype_declare("SAT started", gras_datadesc_by_name("amok_remoterr_t"));
+  gras_msgtype_declare("SAT begin",   sat_request_desc);
+  gras_msgtype_declare("SAT begun",   gras_datadesc_by_name("amok_remoterr_t"));
+  gras_msgtype_declare("SAT end",     NULL);
+  gras_msgtype_declare("SAT ended",   gras_datadesc_by_name("amok_remoterr_t"));
+  gras_msgtype_declare("SAT stop",    NULL);
+  gras_msgtype_declare("SAT stopped", gras_datadesc_by_name("amok_remoterr_t"));
+
+  /* Register the callbacks */
+  gras_cb_register(gras_msgtype_by_name("BW request"),
+                  &amok_bw_cb_bw_request);
+  gras_cb_register(gras_msgtype_by_name("BW handshake"),
+                  &amok_bw_cb_bw_handshake);
+
+  gras_cb_register(gras_msgtype_by_name("SAT start"),
+                  &amok_bw_cb_sat_start);
+  gras_cb_register(gras_msgtype_by_name("SAT begin"),
+                  &amok_bw_cb_sat_begin);
 }
 
 /* ***************************************************************************
  * Bandwidth tests
  * ***************************************************************************/
 /* Function to do a test from local to given host */
 }
 
 /* ***************************************************************************
  * Bandwidth tests
  * ***************************************************************************/
 /* Function to do a test from local to given host */
-gras_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) {
-  gras_rawsock_t *rawIn,*rawOut;
-  gras_sock_t *sock;
+/**
+ * amok_bw_test:
+ * 
+ * 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,
+                         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;
   gras_error_t errcode;
-  BwExp_t *request;
+  bw_request_t *request;
   gras_msg_t *answer;
   
   gras_msg_t *answer;
   
-  if((errcode=gras_sock_client_open(to_name,to_port,&sock))) {
-    fprintf(stderr,"grasbw_test(): Error %s encountered while contacting peer\n",
-           gras_error_name(errcode));
-    return errcode;
-  }
-  if ((errcode=gras_rawsock_server_open(6666,8000,bufSize,&rawIn))) { 
-    fprintf(stderr,"grasbw_test(): Error %s encountered while opening a raw socket\n",
-           gras_error_name(errcode));
+  for (port = 5000, errcode = system_error;
+       errcode == system_error;
+       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));
     return errcode;
   }
 
     return errcode;
   }
 
-  if (!(request=(BwExp_t *)malloc(sizeof(BwExp_t)))) {
-    fprintf(stderr,"grasbw_test(): Malloc error\n");
-    gras_sock_close(sock);
-    return malloc_error;    
-  }
+  request=gras_new(bw_request_t);
   request->bufSize=bufSize;
   request->expSize=expSize;
   request->msgSize=msgSize;
   request->bufSize=bufSize;
   request->expSize=expSize;
   request->msgSize=msgSize;
-  request->port=gras_rawsock_get_peer_port(rawIn);
+  request->host.name = NULL;
+  request->host.port = gras_socket_peer_port(rawIn);
 
 
-  if ((errcode=gras_msg_new_and_send(sock,GRASMSG_BW_HANDSHAKE, 1, 
-                             request,1))) {
-    fprintf(stderr,"grasbw_test(): Error %s encountered while sending the request.\n",
-           gras_error_name(errcode));
+  if ((errcode=gras_send(peer,gras_msgtype_by_name("BW handshake"),request))) {
+    ERROR1("Error %s encountered while sending the request.", gras_error_name(errcode));
     gras_sock_close(sock);
     return errcode;
   }
     gras_sock_close(sock);
     return errcode;
   }
@@ -190,6 +197,9 @@ gras_error_t grasbw_test(const char*to_name,unsigned int to_port,
   return no_error;
 }
 
   return no_error;
 }
 
+#if 0
+
+
 /* Callback to the GRASMSG_BW_HANDSHAKE message: 
    opens a server raw socket,
    indicate its port in an answer GRASMSG_BW_HANDSHAKED message,
 /* Callback to the GRASMSG_BW_HANDSHAKE message: 
    opens a server raw socket,
    indicate its port in an answer GRASMSG_BW_HANDSHAKED message,
@@ -685,3 +695,4 @@ gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port,
 
   return no_error;
 }
 
   return no_error;
 }
+#endif
index 8278bb6..7a62512 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$ */
 
 /* $Id$ */
 
-/* gras_addons - several addons to do specific stuff not in GRAS itself     */
+/* base - several addons to do specific stuff not in GRAS itself     */
 
 /* Authors: Martin Quinson                                                  */
 /* Copyright (C) 2003 the OURAGAN project.                                  */
 
 /* Authors: Martin Quinson                                                  */
 /* Copyright (C) 2003 the OURAGAN project.                                  */
 
 #include <stdlib.h>
 #include <stdio.h>
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <strings.h>
 
 
-#include <gras.h>
+#include "xbt/error.h"
+#include "gras/datadesc.h"
+#include "amok/base.h"
 
 
-void
-grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount,
-                 const char *severeError,
-                 gras_error_t errcode, const char* format,...) {
-  msgError_t *error;
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(amok,GRAS_LOG_ROOT_CAT,"All AMOK categories");
+
+amok_remoterr_t *amok_remoterr_new(gras_error_t param_errcode, 
+                                 const char* format,...) {
+   
+  amok_remoterr_t *res;
+   
   va_list ap;
   va_list ap;
+  va_start(ap,format);
+  res = amok_remoterr_new_va(param_errcode,format,ap);
+  va_end(ap);
+  return res;
+}
 
 
-  if (!(error=(msgError_t*)malloc(sizeof(msgError_t)))) {
-    fprintf(stderr,severeError);
-    return;
+amok_remoterr_t *amok_remoterr_new_va(gras_error_t param_errcode, 
+                                     const char* format,va_list ap) {
+  amok_remoterr_t *res=gras_new(amok_remoterr_t,1);
+  res->code=param_errcode;
+  if (format) {
+     res->msg=(char*)gras_malloc(1024);
+     vsnprintf(res->msg,1024,format,ap);
+  } else {
+     res->msg = NULL;
   }
   }
+   
+  return res;   
+}
+
+void amok_remoterr_free(amok_remoterr_t*err) {
+   if (err) {
+      if (err->msg) gras_free(err->msg);
+      gras_free(err);
+   }
+}
+
 
 
-  error->errcode=errcode;
+void
+amok_repport_error (gras_socket_t *sock, gras_msgtype_t *msgtype,
+                   gras_error_t param_errcode, const char* format,...) {
+  amok_remoterr_t *error;
+  gras_error_t errcode;
+  va_list ap;
+
+  error=gras_new(amok_remoterr_t,1);
+  error->code=param_errcode;
+  error->msg=(char*)gras_malloc(1024); /* FIXME */
   va_start(ap,format);
   va_start(ap,format);
-  vsprintf(error->errmsg,format,ap);
+  vsnprintf(error->msg,1024,format,ap);
   va_end(ap);
 
   va_end(ap);
 
-  /* FIXME: If message id have more than 17 sequences, the following won't work */
-  if (gras_msg_new_and_send(sock,id,SeqCount,   error,1,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,
-                    NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0)) {
-    fprintf(stderr,severeError);
+  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,
+              gras_socket_peer_name(sock),gras_socket_peer_port(sock) );
   }
 }
   }
 }
+
+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");
+  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);
+   
+  remoterr_desc = gras_datadesc_struct("amok_remoterr_t");
+  gras_datadesc_struct_append(remoterr_desc,"msg",gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(remoterr_desc,"code",gras_datadesc_by_name("unsigned int"));
+  gras_datadesc_struct_close(remoterr_desc);
+  remoterr_desc = gras_datadesc_ref("amok_remoterr_t*",remoterr_desc);
+}
+
+void amok_base_exit(void) {
+   /* No real module mecanism in GRAS so far, nothing to do. */
+}
+
index cfbb4af..066fef5 100644 (file)
@@ -37,11 +37,11 @@ gras_cbps_t * gras_cbps_new(void) {
 
   res=gras_new(gras_cbps_t,1);
 
 
   res=gras_new(gras_cbps_t,1);
 
-  gras_dynar_new(&(res->lints), sizeof(int), NULL);
-  gras_dict_new(&(res->space));
+  res->lints = gras_dynar_new(sizeof(int), NULL);
+  res->space = gras_dict_new();
   /* no leak, the content is freed manually on block_end */
   /* no leak, the content is freed manually on block_end */
-  gras_dynar_new(&(res->frames), sizeof(gras_dynar_t*), NULL);
-  gras_dynar_new(&(res->globals), sizeof(char*), NULL);
+  res->frames = gras_dynar_new(sizeof(gras_dynar_t*), NULL);
+  res->globals = gras_dynar_new(sizeof(char*), NULL);
 
   gras_cbps_block_begin(res);
 
 
   gras_cbps_block_begin(res);
 
@@ -84,7 +84,7 @@ gras_cbps_v_push(gras_cbps_t        *ps,
  
   if (errcode == mismatch_error) {
     DEBUG1("Create a new variable stack for '%s' into the space",name);
  
   if (errcode == mismatch_error) {
     DEBUG1("Create a new variable stack for '%s' into the space",name);
-    gras_dynar_new(&varstack, sizeof (gras_cbps_elm_t *), NULL);
+    varstack = gras_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
     gras_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) {
     gras_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) {
@@ -188,7 +188,7 @@ gras_cbps_v_set (gras_cbps_t        *ps,
   errcode = gras_dict_get(ps->space, name, (void **)&p_dynar);
   
   if (errcode == mismatch_error) {
   errcode = gras_dict_get(ps->space, name, (void **)&p_dynar);
   
   if (errcode == mismatch_error) {
-    gras_dynar_new(&p_dynar, sizeof (gras_cbps_elm_t *), NULL);
+    p_dynar = gras_dynar_new(sizeof (gras_cbps_elm_t *), NULL);
     gras_dict_set(ps->space, name, (void **)p_dynar, NULL);
     
     p_elm   = gras_new0(gras_cbps_elm_t,1);
     gras_dict_set(ps->space, name, (void **)p_dynar, NULL);
     
     p_elm   = gras_new0(gras_cbps_elm_t,1);
@@ -255,7 +255,7 @@ gras_cbps_block_begin(gras_cbps_t *ps) {
   gras_dynar_t            *p_dynar        = NULL;
 
   DEBUG0(">>> Block begin");
   gras_dynar_t            *p_dynar        = NULL;
 
   DEBUG0(">>> Block begin");
-  gras_dynar_new(&p_dynar, sizeof (char *), NULL);
+  p_dynar = gras_dynar_new(sizeof (char *), NULL);
   gras_dynar_push(ps->frames, &p_dynar);
 }
 
   gras_dynar_push(ps->frames, &p_dynar);
 }
 
index 729e301..1b0515b 100644 (file)
@@ -41,7 +41,7 @@ gras_datadesc_init(void) {
   
   VERB0("Initializing DataDesc");
   
   
   VERB0("Initializing DataDesc");
   
-  gras_set_new(&gras_datadesc_set_local);
+  gras_datadesc_set_local = gras_set_new();
   
   ddt = gras_datadesc_scalar("signed char", 
                             gras_ddt_scalar_char, 
   
   ddt = gras_datadesc_scalar("signed char", 
                             gras_ddt_scalar_char, 
index 2d21aad..6350d6b 100644 (file)
 #ifndef GRAS_DATADESC_PRIVATE_H
 #define GRAS_DATADESC_PRIVATE_H
 
 #ifndef GRAS_DATADESC_PRIVATE_H
 #define GRAS_DATADESC_PRIVATE_H
 
-#include "gras_private.h"
-#include "gras/DataDesc/datadesc_interface.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
+#include "xbt/set.h"
+
+#include "gras_config.h" /* GRAS_THISARCH */
+
+#include "gras/transport.h"  /* socket handling */
+
+#include "gras_modinter.h"   /* module init/exit */
+#include "gras/datadesc.h"   /* rest of module public interface */
+
+#include "gras/DataDesc/datadesc_interface.h" /* semi-public API */
 
 /**
  * aligned:
 
 /**
  * aligned:
@@ -225,6 +238,8 @@ struct s_gras_datadesc_type {
   
   gras_datadesc_type_cb_void_t         send;
   gras_datadesc_type_cb_void_t         recv;
   
   gras_datadesc_type_cb_void_t         send;
   gras_datadesc_type_cb_void_t         recv;
+   
+  int                                  cycle; /* true if the datatype may contain cycle */
 };
 
 /***************************
 };
 
 /***************************
index 757b6cf..d7e021d 100644 (file)
@@ -8,6 +8,7 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "xbt/misc.h" /* min()/max() */
 #include "gras/DataDesc/datadesc_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_create,datadesc,"Creating new datadescriptions");
 #include "gras/DataDesc/datadesc_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_create,datadesc,"Creating new datadescriptions");
@@ -25,9 +26,7 @@ void gras_ddt_freev(void *ddt) {
   }
 }
 
   }
 }
 
-static void
-gras_ddt_new(const char            *name,
-            gras_datadesc_type_t **dst) {
+static gras_datadesc_type_t *gras_ddt_new(const char *name) {
   gras_error_t errcode;
   gras_datadesc_type_t *res;
 
   gras_error_t errcode;
   gras_datadesc_type_t *res;
 
@@ -36,11 +35,12 @@ gras_ddt_new(const char            *name,
 
   res->name = (char*)strdup(name);
   res->name_len = strlen(name);
 
   res->name = (char*)strdup(name);
   res->name_len = strlen(name);
+  res->cycle = 0;
       
       
-  *dst=res;
   gras_set_add(gras_datadesc_set_local,
               (gras_set_elm_t*)res,&gras_ddt_freev);
   GRAS_OUT;
   gras_set_add(gras_datadesc_set_local,
               (gras_set_elm_t*)res,&gras_ddt_freev);
   GRAS_OUT;
+  return res;
 }
 
 /**
 }
 
 /**
@@ -100,7 +100,7 @@ gras_datadesc_type_t *
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   for (arch = 0; arch < gras_arch_count; arch ++) {
     long int sz;
 
   for (arch = 0; arch < gras_arch_count; arch ++) {
     long int sz;
@@ -187,7 +187,7 @@ gras_datadesc_type_t *
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = 0;
 
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = 0;
@@ -195,9 +195,9 @@ gras_datadesc_type_t *
     res->aligned_size[arch] = 0;
   }
   res->category_code = e_gras_datadesc_type_cat_struct;
     res->aligned_size[arch] = 0;
   }
   res->category_code = e_gras_datadesc_type_cat_struct;
-  gras_dynar_new(&(res->category.struct_data.fields),
-                sizeof(gras_dd_cat_field_t*),
-                &gras_dd_cat_field_free);
+  res->category.struct_data.fields = 
+       gras_dynar_new(sizeof(gras_dd_cat_field_t*),
+                     &gras_dd_cat_field_free);
 
   GRAS_OUT;
   return res;
 
   GRAS_OUT;
   return res;
@@ -273,6 +273,31 @@ gras_datadesc_struct_close(gras_datadesc_type_t  *struct_type) {
   struct_type->category.struct_data.closed = 1;
 }
 
   struct_type->category.struct_data.closed = 1;
 }
 
+/**
+ * gras_datadesc_cycle_set:
+ * 
+ * Tell GRAS that the pointers of the type described by @ddt may present
+ * some loop, and that the cycle detection mecanism is needed.
+ *
+ * Note that setting this option when not needed have a rather bad effect 
+ * on the performance (several times slower on big data).
+ */
+void
+gras_datadesc_cycle_set(gras_datadesc_type_t  *ddt) {
+  ddt->cycle = 1;
+}
+/**
+ * gras_datadesc_cycle_unset:
+ * 
+ * Tell GRAS that the pointers of the type described by @ddt do not present
+ * any loop and that cycle detection mecanism are not needed.
+ * (default)
+ */
+void
+gras_datadesc_cycle_unset(gras_datadesc_type_t *ddt) {
+  ddt->cycle = 0;
+}
+
 /**
  * gras_datadesc_union:
  *
 /**
  * gras_datadesc_union:
  *
@@ -301,7 +326,7 @@ gras_datadesc_union(const char                   *name,
     return res;
   }
 
     return res;
   }
 
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   for (arch=0; arch<gras_arch_count; arch ++) {
      res->size[arch] = 0;
 
   for (arch=0; arch<gras_arch_count; arch ++) {
      res->size[arch] = 0;
@@ -310,9 +335,9 @@ gras_datadesc_union(const char                   *name,
   }
 
   res->category_code           = e_gras_datadesc_type_cat_union;
   }
 
   res->category_code           = e_gras_datadesc_type_cat_union;
-  gras_dynar_new(&(res->category.union_data.fields),
-                sizeof(gras_dd_cat_field_t*),
-                &gras_dd_cat_field_free);
+  res->category.union_data.fields =
+     gras_dynar_new(sizeof(gras_dd_cat_field_t*),
+                   &gras_dd_cat_field_free);
   res->category.union_data.selector = selector;
 
   return res;
   res->category.union_data.selector = selector;
 
   return res;
@@ -391,7 +416,7 @@ gras_datadesc_type_t *
     return res;
   }
 
     return res;
   }
 
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   gras_assert0(pointer_type, "Cannot get the description of data pointer");
       
 
   gras_assert0(pointer_type, "Cannot get the description of data pointer");
       
@@ -432,7 +457,7 @@ gras_datadesc_type_t *
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
     VERB1("Discarding redefinition of %s",name);
     return res;
   }
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   gras_assert0(pointer_type, "Cannot get the description of data pointer");
       
 
   gras_assert0(pointer_type, "Cannot get the description of data pointer");
       
@@ -478,7 +503,7 @@ gras_datadesc_type_t *
 
     return res;
   }
 
     return res;
   }
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
   for (arch=0; arch<gras_arch_count; arch ++) {
 
   gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
   for (arch=0; arch<gras_arch_count; arch ++) {
@@ -528,7 +553,7 @@ gras_datadesc_type_t *
     return res;
   }
 
     return res;
   }
 
-  gras_ddt_new(name,&res);
+  res = gras_ddt_new(name);
 
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = 0; /* make sure it indicates "dynamic" */
 
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = 0; /* make sure it indicates "dynamic" */
index 05df6ce..4bd36ed 100644 (file)
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_exchange,datadesc,
                                 "Sending data over the network");
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_exchange,datadesc,
                                 "Sending data over the network");
-
-#undef DETECT_CYCLE
-/* CRUDE HACK to turn all cycle detection of */
-#ifndef DETECT_CYCLE
-#define gras_dict_get_ext(a,b,c,d) mismatch_error
-#define gras_dict_set_ext(a,b,c,d,e) no_error
-#endif
-
 const char *gras_datadesc_cat_names[9] = { 
   "undefined", 
   "scalar", "struct", "union", "ref", "array", "ignored",
 const char *gras_datadesc_cat_names[9] = { 
   "undefined", 
   "scalar", "struct", "union", "ref", "array", "ignored",
@@ -34,8 +26,9 @@ static _GRAS_INLINE gras_error_t gras_dd_recv_int(gras_socket_t *sock, int r_arc
 static _GRAS_INLINE gras_error_t
 gras_dd_alloc_ref(gras_dict_t *refs,  long int     size,
                  char       **r_ref, long int     r_len,
 static _GRAS_INLINE gras_error_t
 gras_dd_alloc_ref(gras_dict_t *refs,  long int     size,
                  char       **r_ref, long int     r_len,
-                 char       **l_ref);
-static _GRAS_INLINE int 
+                 char       **l_ref, int detect_cycle);
+
+static _GRAS_INLINE int
 gras_dd_is_r_null(char **r_ptr, long int length);
 
 static gras_error_t 
 gras_dd_is_r_null(char **r_ptr, long int length);
 
 static gras_error_t 
@@ -43,7 +36,8 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
                       gras_cbps_t       *state,
                       gras_dict_t          *refs,
                       gras_datadesc_type_t *type, 
                       gras_cbps_t       *state,
                       gras_dict_t          *refs,
                       gras_datadesc_type_t *type, 
-                      char                 *data);
+                      char                 *data, 
+                      int                   detect_cycle);
 static gras_error_t
 gras_datadesc_recv_rec(gras_socket_t        *sock, 
                       gras_cbps_t       *state,
 static gras_error_t
 gras_datadesc_recv_rec(gras_socket_t        *sock, 
                       gras_cbps_t       *state,
@@ -53,7 +47,8 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
                       char                **r_data,
                       long int              r_lgr,
                       char                 *dst,
                       char                **r_data,
                       long int              r_lgr,
                       char                 *dst,
-                      int                   subsize);
+                      int                   subsize, 
+                      int                   detect_cycle);
 
 
 static _GRAS_INLINE gras_error_t
 
 
 static _GRAS_INLINE gras_error_t
@@ -117,7 +112,8 @@ gras_dd_alloc_ref(gras_dict_t *refs,
                  long int     size,
                  char       **r_ref,
                  long int     r_len, /* pointer_type->size[r_arch] */
                  long int     size,
                  char       **r_ref,
                  long int     r_len, /* pointer_type->size[r_arch] */
-                 char       **l_ref) {
+                 char       **l_ref,
+                 int          detect_cycle) {
   char *l_data = NULL;
 
   gras_assert1(size>0,"Cannot allocate %ld bytes!", size);
   char *l_data = NULL;
 
   gras_assert1(size>0,"Cannot allocate %ld bytes!", size);
@@ -128,8 +124,7 @@ 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);
 
   DEBUG3("alloc_ref: r_ref=%p; *r_ref=%p, r_len=%ld",
         (void*)r_ref, (void*)(r_ref?*r_ref:NULL), r_len);
-#ifdef DETECT_CYCLE
-  if (r_ref && !gras_dd_is_r_null( r_ref, 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 *));
 
     gras_error_t errcode;
     void *ptr = gras_malloc(sizeof(void *));
 
@@ -137,9 +132,9 @@ gras_dd_alloc_ref(gras_dict_t *refs,
 
     DEBUG2("Insert %p under %p",*(void**)ptr, *(void**)r_ref);
 
 
     DEBUG2("Insert %p under %p",*(void**)ptr, *(void**)r_ref);
 
-    TRY(gras_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, gras_free));
+    if (detect_cycle)
+       gras_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, gras_free);
   }
   }
-#endif
   return no_error;
 }
 
   return no_error;
 }
 
@@ -318,7 +313,8 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
                       gras_cbps_t       *state,
                       gras_dict_t          *refs,
                       gras_datadesc_type_t *type, 
                       gras_cbps_t       *state,
                       gras_dict_t          *refs,
                       gras_datadesc_type_t *type, 
-                      char                 *data) {
+                      char                 *data,
+                      int                   detect_cycle) {
 
   gras_error_t          errcode;
   int                   cpt;
 
   gras_error_t          errcode;
   int                   cpt;
@@ -356,7 +352,7 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
        field->pre(state,field_data);
       
       VERB1("Send field %s",field->name);
        field->pre(state,field_data);
       
       VERB1("Send field %s",field->name);
-      TRY(gras_datadesc_send_rec(sock,state,refs,sub_type, field_data));
+      TRY(gras_datadesc_send_rec(sock,state,refs,sub_type, field_data, detect_cycle || sub_type->cycle));
       
       if (field->post)
        field->post(state,field_data);
       
       if (field->post)
        field->post(state,field_data);
@@ -397,7 +393,7 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
     if (field->pre)
       field->pre(state,data);
     
     if (field->pre)
       field->pre(state,data);
     
-    TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, data));
+    TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, data, detect_cycle || sub_type->cycle));
       
     if (field->post)
       field->post(state,data);
       
     if (field->post)
       field->post(state,data);
@@ -409,9 +405,7 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
     gras_dd_cat_ref_t      ref_data;
 
     void                 **ref=(void**)data;
     gras_dd_cat_ref_t      ref_data;
 
     void                 **ref=(void**)data;
-#ifdef DETECT_CYCLE
     void *dummy;
     void *dummy;
-#endif
     
     ref_data = type->category.ref_data;
     
     
     ref_data = type->category.ref_data;
     
@@ -436,16 +430,19 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
       VERB0("Not sending NULL referenced data");
       break;
     }
       VERB0("Not sending NULL referenced data");
       break;
     }
-    errcode = gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy);
+    errcode = detect_cycle 
+            ? gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy)
+            : mismatch_error;
     if (errcode == mismatch_error) {
     if (errcode == mismatch_error) {
-      VERB1("Sending data referenced at %p", (void*)*ref);
-      TRY(gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL));
-      TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref));
-      
+       VERB1("Sending data referenced at %p", (void*)*ref);
+       if (detect_cycle)
+        gras_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) {
     } else if (errcode == no_error) {
-      VERB1("Not sending data referenced at %p (already done)", (void*)*ref);
+       VERB1("Not sending data referenced at %p (already done)", (void*)*ref);
     } else {
     } else {
-      return errcode;
+       return errcode;
     }
     
     break;
     }
     
     break;
@@ -477,7 +474,7 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
                              sub_type->aligned_size[GRAS_THISARCH] * count));
     } else {
       for (cpt=0; cpt<count; cpt++) {
                              sub_type->aligned_size[GRAS_THISARCH] * count));
     } else {
       for (cpt=0; cpt<count; cpt++) {
-       TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, ptr));
+       TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, ptr, detect_cycle || sub_type->cycle));
        ptr += elm_size;
       }
     }
        ptr += elm_size;
       }
     }
@@ -505,10 +502,10 @@ gras_error_t gras_datadesc_send(gras_socket_t *sock,
   gras_cbps_t *state = NULL;
   gras_dict_t    *refs; /* all references already sent */
  
   gras_cbps_t *state = NULL;
   gras_dict_t    *refs; /* all references already sent */
  
-  gras_dict_new(&refs);
+  refs = gras_dict_new();
   state = gras_cbps_new();
 
   state = gras_cbps_new();
 
-  errcode = gras_datadesc_send_rec(sock,state,refs,type,(char*)src);
+  errcode = gras_datadesc_send_rec(sock,state,refs,type,(char*)src, type->cycle);
 
   gras_dict_free(&refs);
   gras_cbps_free(&state);
 
   gras_dict_free(&refs);
   gras_cbps_free(&state);
@@ -537,7 +534,8 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
                       char                **r_data,
                       long int              r_lgr,
                       char                 *l_data,
                       char                **r_data,
                       long int              r_lgr,
                       char                 *l_data,
-                      int                   subsize) {
+                      int                   subsize,
+                      int                   detect_cycle) {
 
   gras_error_t          errcode;
   int                   cpt;
 
   gras_error_t          errcode;
   int                   cpt;
@@ -579,7 +577,8 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
 
       TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
                                 r_arch,NULL,0,
 
       TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
                                 r_arch,NULL,0,
-                                field_data,-1));
+                                field_data,-1, 
+                                detect_cycle || sub_type->cycle));
     }
     VERB1("<< Received all fields of the structure %s", type->name);
     
     }
     VERB1("<< Received all fields of the structure %s", type->name);
     
@@ -612,7 +611,8 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
     
     TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
                               r_arch,NULL,0,
     
     TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
                               r_arch,NULL,0,
-                              l_data,-1));
+                              l_data,-1, 
+                              detect_cycle || sub_type->cycle));
     break;
   }
 
     break;
   }
 
@@ -650,10 +650,12 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
       gras_free(r_ref);
       break;
     }
       gras_free(r_ref);
       break;
     }
-    errcode = gras_dict_get_ext(refs,
+         
+    errcode = detect_cycle
+            ? gras_dict_get_ext(refs,
                                (char*)r_ref, pointer_type->size[r_arch],
                                (char*)r_ref, pointer_type->size[r_arch],
-                               (void**)&l_ref);
-
+                               (void**)&l_ref)
+            : mismatch_error;
 
     if (errcode == mismatch_error) {
       int subsubcount = 0;
 
     if (errcode == mismatch_error) {
       int subsubcount = 0;
@@ -677,16 +679,19 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
        TRY(gras_dd_alloc_ref(refs,
                              subsub_type->size[GRAS_THISARCH] * subsubcount, 
                              r_ref,pointer_type->size[r_arch], 
        TRY(gras_dd_alloc_ref(refs,
                              subsub_type->size[GRAS_THISARCH] * subsubcount, 
                              r_ref,pointer_type->size[r_arch], 
-                             (char**)&l_referenced));
+                             (char**)&l_referenced,
+                             detect_cycle));
       } else {
        TRY(gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH], 
                              r_ref,pointer_type->size[r_arch], 
       } else {
        TRY(gras_dd_alloc_ref(refs,sub_type->size[GRAS_THISARCH], 
                              r_ref,pointer_type->size[r_arch], 
-                             (char**)&l_referenced));
+                             (char**)&l_referenced,
+                             detect_cycle));
       }
 
       TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
                                 r_arch,r_ref,pointer_type->size[r_arch],
       }
 
       TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
                                 r_arch,r_ref,pointer_type->size[r_arch],
-                                (char*)l_referenced, subsubcount));
+                                (char*)l_referenced, subsubcount, 
+                                detect_cycle || sub_type->cycle));
       *(void**)l_data=l_referenced;
       VERB3("'%s' remotely referenced at %p locally at %p",
            sub_type->name, *(void**)r_ref, l_referenced);
       *(void**)l_data=l_referenced;
       VERB3("'%s' remotely referenced at %p locally at %p",
            sub_type->name, *(void**)r_ref, l_referenced);
@@ -748,7 +753,8 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
       ptr = l_data;
       for (cpt=0; cpt<count; cpt++) {
        TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
       ptr = l_data;
       for (cpt=0; cpt<count; cpt++) {
        TRY(gras_datadesc_recv_rec(sock,state,refs, sub_type,
-                                  r_arch, NULL, 0, ptr,-1));
+                                  r_arch, NULL, 0, ptr,-1,
+                                  detect_cycle || sub_type->cycle));
        ptr += elm_size;
       }
     }
        ptr += elm_size;
       }
     }
@@ -782,12 +788,13 @@ gras_datadesc_recv(gras_socket_t *sock,
   gras_cbps_t *state = NULL; /* callback persistent state */
   gras_dict_t    *refs;         /* all references already sent */
 
   gras_cbps_t *state = NULL; /* callback persistent state */
   gras_dict_t    *refs;         /* all references already sent */
 
-  gras_dict_new(&refs);
+  refs = gras_dict_new();
   state = gras_cbps_new();
 
   errcode = gras_datadesc_recv_rec(sock, state, refs, type, 
                                   r_arch, NULL, 0,
   state = gras_cbps_new();
 
   errcode = gras_datadesc_recv_rec(sock, state, refs, type, 
                                   r_arch, NULL, 0,
-                                  (char *) dst,-1);
+                                  (char *) dst,-1, 
+                                  type->cycle);
 
   gras_dict_free(&refs);
   gras_cbps_free(&state);
 
   gras_dict_free(&refs);
   gras_cbps_free(&state);
index 7599c9c..0885117 100644 (file)
@@ -447,8 +447,8 @@ static gras_datadesc_type_t *parse_struct(char *definition) {
   gras_datadesc_type_t *struct_type;
 
   GRAS_IN;
   gras_datadesc_type_t *struct_type;
 
   GRAS_IN;
-  gras_dynar_new(&identifiers,sizeof(identifier_t),NULL);
-  gras_dynar_new(&fields_to_push,sizeof(char*),NULL);
+  identifiers = gras_dynar_new(sizeof(identifier_t),NULL);
+  fields_to_push = gras_dynar_new(sizeof(char*),NULL);
 
   /* Create the struct descriptor */
   if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
 
   /* Create the struct descriptor */
   if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
index ce37d34..b787bfa 100644 (file)
@@ -33,7 +33,7 @@ void gras_msg_init(void) {
 
   VERB0("Initializing Msg");
   
 
   VERB0("Initializing Msg");
   
-  gras_set_new(&_gras_msgtype_set);
+  _gras_msgtype_set = gras_set_new();
 
   memcpy(GRAS_header,"GRAS", 4);
   GRAS_header[4]=GRAS_PROTOCOL_VERSION;
 
   memcpy(GRAS_header,"GRAS", 4);
   GRAS_header[4]=GRAS_PROTOCOL_VERSION;
@@ -437,7 +437,7 @@ gras_cb_register(gras_msgtype_t *msgtype,
     /* First cb? Create room */
     list = gras_new(gras_cblist_t,1);
     list->id = msgtype->code;
     /* First cb? Create room */
     list = gras_new(gras_cblist_t,1);
     list->id = msgtype->code;
-    gras_dynar_new(&(list->cbs), sizeof(gras_cb_t), NULL);
+    list->cbs = gras_dynar_new(sizeof(gras_cb_t), NULL);
     gras_dynar_push(pd->cbl_list,&list);
   }
 
     gras_dynar_push(pd->cbl_list,&list);
   }
 
index 6d71574..7e36382 100644 (file)
 #ifndef GRAS_MESSAGE_PRIVATE_H
 #define GRAS_MESSAGE_PRIVATE_H
 
 #ifndef GRAS_MESSAGE_PRIVATE_H
 #define GRAS_MESSAGE_PRIVATE_H
 
-#include "gras_private.h"
+#include "gras_config.h"
+
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/set.h"
+#include "gras/transport.h"
+#include "gras/datadesc.h"
+#include "gras/virtu.h"
+
+#include "gras/messages.h"
+#include "gras_modinter.h"
+
 #include "gras/Msg/msg_interface.h"
 
 /**
 #include "gras/Msg/msg_interface.h"
 
 /**
index f6014ee..afbfddd 100644 (file)
@@ -46,11 +46,9 @@ gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
 
 }
 
 
 }
 
-void
-gras_trp_init(void){
-  
+void gras_trp_init(void){
   /* make room for all plugins */
   /* make room for all plugins */
-  gras_dict_new(&_gras_trp_plugins);
+  _gras_trp_plugins=gras_dict_new();
 
   /* Add them */
   gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
 
   /* Add them */
   gras_trp_plugin_new("tcp", gras_trp_tcp_setup);
@@ -325,18 +323,35 @@ char *gras_socket_peer_name(gras_socket_t *sock) {
 
 gras_error_t gras_socket_raw_send(gras_socket_t *peer, 
                                  unsigned int timeout,
 
 gras_error_t gras_socket_raw_send(gras_socket_t *peer, 
                                  unsigned int timeout,
-                                 unsigned long int expSize, 
-                                 unsigned long int msgSize) {
-  
+                                 unsigned long int exp_size, 
+                                 unsigned long int msg_size) {
+  gras_error_t errcode;
+  char *chunk = gras_malloc(msg_size);
+  int exp_sofar;
+   
   gras_assert0(peer->raw,"Asked to send raw data on a regular socket\n");
   gras_assert0(peer->raw,"Asked to send raw data on a regular socket\n");
-  return gras_socket_raw_exchange(peer,1,timeout,expSize,msgSize);   
+  for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) {
+     TRY(gras_trp_chunk_send(peer,chunk,msg_size));
+  }
+            
+  gras_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, 
                                  unsigned int timeout,
 }
 
 gras_error_t gras_socket_raw_recv(gras_socket_t *peer, 
                                  unsigned int timeout,
-                                 unsigned long int expSize, 
-                                 unsigned long int msgSize){
+                                 unsigned long int exp_size, 
+                                 unsigned long int msg_size){
   
   
+  gras_error_t errcode;
+  char *chunk = gras_malloc(msg_size);
+  int exp_sofar;
+
   gras_assert0(peer->raw,"Asked to recveive raw data on a regular socket\n");
   gras_assert0(peer->raw,"Asked to recveive raw data on a regular socket\n");
-  return gras_socket_raw_exchange(peer,0,timeout,expSize,msgSize);   
+  for (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) {
+     TRY(gras_trp_chunk_send(peer,chunk,msg_size));
+  }
+
+  gras_free(chunk);
+  return no_error;//gras_socket_raw_exchange(peer,0,timeout,expSize,msgSize);   
 }
 }
index cc11972..26410d2 100644 (file)
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <string.h>       /* memset */
 
 #include <stdlib.h>
 #include <string.h>       /* memset */
 
-#include "gras_private.h"
+#include "xbt/misc.h"
 #include "transport_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_buf,transport,
 #include "transport_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_buf,transport,
index e542ff7..11f1a29 100644 (file)
@@ -15,7 +15,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 
 #include <fcntl.h>
 #include <unistd.h>
 
-#include "gras_private.h"
 #include "transport_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport,
 #include "transport_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport,
index 173f115..5e68583 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <msg.h>
 
 
 #include <msg.h>
 
-#include "gras_private.h"
 #include "transport_private.h"
 #include "gras/Virtu/virtu_sg.h"
 
 #include "transport_private.h"
 #include "gras/Virtu/virtu_sg.h"
 
index 25ee77f..56aa78e 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>       /* memset */
 
 #include <stdlib.h>
 #include <string.h>       /* memset */
 
-#include "gras_private.h"
 #include "transport_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_tcp,transport,"TCP transport");
 #include "transport_private.h"
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_tcp,transport,"TCP transport");
@@ -418,9 +417,9 @@ gras_error_t gras_socket_raw_exchange(gras_socket_t *peer,
    struct timeval timeOut;
    
    chunk = gras_malloc(msg_size);
    struct timeval timeOut;
    
    chunk = gras_malloc(msg_size);
-   
-   for   (exp_sofar=0; exp_sofar < exp_size; exp_size += msg_sofar) {
-      for(msg_sofar=0; msg_sofar < msg_size; msg_size += res_last) {
+
+   for   (exp_sofar=0; exp_sofar < exp_size; exp_sofar += msg_size) {
+      for(msg_sofar=0; msg_sofar < msg_size; msg_sofar += res_last) {
         
         if(sender) {
            res_last = send(peer->sd, chunk, msg_size - msg_sofar, 0);
         
         if(sender) {
            res_last = send(peer->sd, chunk, msg_size - msg_sofar, 0);
index f5f1c3d..1539170 100644 (file)
 #ifndef GRAS_TRP_PRIVATE_H
 #define GRAS_TRP_PRIVATE_H
 
 #ifndef GRAS_TRP_PRIVATE_H
 #define GRAS_TRP_PRIVATE_H
 
-#include "gras_private.h"
-#include "gras/Transport/transport_interface.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
+
+#include "gras/cond.h"       /* gras_if_RL() */
+
+#include "gras_modinter.h"   /* module init/exit */
+#include "gras/transport.h"  /* rest of module interface */
+
+#include "gras/Transport/transport_interface.h" /* semi-public API */
 #include "gras/Virtu/virtu_interface.h" /* socketset_get() */
 
 /**
 #include "gras/Virtu/virtu_interface.h" /* socketset_get() */
 
 /**
index 052d5c7..eea80f7 100644 (file)
@@ -8,7 +8,13 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "gras/transport.h"
+#include "gras/datadesc.h"
+#include "gras/messages.h"
+
 #include "gras/Virtu/virtu_interface.h"
 #include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */
 
 #include "gras/Virtu/virtu_interface.h"
 #include "gras/Msg/msg_interface.h" /* FIXME: Get rid of this cyclic */
 
@@ -31,10 +37,10 @@ void gras_userdata_set(void *ud) {
 void
 gras_procdata_init() {
   gras_procdata_t *pd=gras_procdata_get();
 void
 gras_procdata_init() {
   gras_procdata_t *pd=gras_procdata_get();
-  pd->userdata = NULL;
-  gras_dynar_new(&(pd->msg_queue), sizeof(gras_msg_t),     NULL);
-  gras_dynar_new(&(pd->cbl_list),  sizeof(gras_cblist_t *),gras_cbl_free);
-  gras_dynar_new(&(pd->sockets),   sizeof(gras_socket_t*), NULL);
+  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);
 }
 
 void
 }
 
 void
index c704f0f..513df2d 100644 (file)
@@ -8,6 +8,7 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "gras/cond.h"
 #include "gras/Virtu/virtu_rl.h"
 
 int gras_if_RL(void) {
 #include "gras/Virtu/virtu_rl.h"
 
 int gras_if_RL(void) {
index f9d8074..fcd0b1a 100644 (file)
@@ -8,7 +8,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. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/sysdep.h"
+#include "gras/virtu.h"
 #include <sys/time.h>   /* gettimeofday() */
 
 double gras_os_time() {
 #include <sys/time.h>   /* gettimeofday() */
 
 double gras_os_time() {
index 1c0737e..6d1ad93 100644 (file)
@@ -8,6 +8,7 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "gras/cond.h"
 #include "gras/Virtu/virtu_sg.h"
 
 int gras_if_RL(void) {
 #include "gras/Virtu/virtu_sg.h"
 
 int gras_if_RL(void) {
index ea7627c..32066c8 100644 (file)
@@ -29,7 +29,7 @@ gras_process_init() {
 
   if (!hd) {
     hd=gras_new(gras_hostdata_t,1);
 
   if (!hd) {
     hd=gras_new(gras_hostdata_t,1);
-    gras_dynar_new(&(hd->ports),sizeof(gras_sg_portrec_t),NULL);
+    hd->ports = gras_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]) * GRAS_MAX_CHANNEL); 
 
index 10c065d..935ddb4 100644 (file)
 #ifndef GRAS_VIRTU_INTERFACE_H
 #define GRAS_VIRTU_INTERFACE_H
 
 #ifndef GRAS_VIRTU_INTERFACE_H
 #define GRAS_VIRTU_INTERFACE_H
 
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "gras/virtu.h"
+#include "gras/process.h"
+
 /**
  * gras_process_data_t:
  *
 /**
  * gras_process_data_t:
  *
index 648e7c2..bcc59f9 100644 (file)
@@ -11,7 +11,6 @@
 #ifndef VIRTU_RL_H
 #define VIRTU_RL_H
 
 #ifndef VIRTU_RL_H
 #define VIRTU_RL_H
 
-#include "gras_private.h"
 #include "gras/Virtu/virtu_interface.h"
 
 #endif /* VIRTU_RL_H */
 #include "gras/Virtu/virtu_interface.h"
 
 #endif /* VIRTU_RL_H */
index 9d0a89c..e05ff6a 100644 (file)
@@ -11,7 +11,6 @@
 #ifndef VIRTU_SG_H
 #define VIRTU_SG_H
 
 #ifndef VIRTU_SG_H
 #define VIRTU_SG_H
 
-#include "gras_private.h"
 #include "gras/Virtu/virtu_interface.h"
 #include <msg.h> /* SimGrid header */
 
 #include "gras/Virtu/virtu_interface.h"
 #include <msg.h> /* SimGrid header */
 
diff --git a/src/gras_private.h b/src/gras_private.h
deleted file mode 100644 (file)
index 124c9df..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$ */
-
-/* gras_private.h - GRAS private definitions                                */
-
-/* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2003 the OURAGAN project.                                  */
-
-/* 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_PRIVATE_H
-#define GRAS_PRIVATE_H
-
-#define max(a, b) (((a) > (b))?(a):(b))
-#define min(a, b) (((a) < (b))?(a):(b))
-
-#define TRUE  1
-#define FALSE 0
-
-#define GRAS_MAX_CHANNEL 10 /* FIXME: killme */
-
-#include "gras_config.h"
-
-#include "xbt/sysdep.h"
-
-#include "xbt/error.h"
-#include "xbt/log.h"
-#include "xbt/module.h"
-#include "xbt/dynar.h"
-#include "xbt/dict.h"
-#include "xbt/set.h"
-#include "xbt/config.h"
-
-#include "gras/core.h"
-#include "gras/process.h"
-#include "gras/virtu.h"
-#include "gras/cond.h"
-
-#include "gras/transport.h"
-#include "gras/datadesc.h"
-#include "gras/messages.h"
-
-/* modules initialization functions */
-void gras_msg_init(void);
-void gras_msg_exit(void);
-void gras_trp_init(void);
-void gras_trp_exit(void);
-void gras_datadesc_init(void);
-void gras_datadesc_exit(void);
-
-#endif /* GRAS_PRIVATE_H */
index c76008d..640528e 100644 (file)
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h" /* prototypes of this module */
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
 
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(config,gros,"configuration support");
+#include "xbt/config.h" /* prototypes of this module */
+
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(config,xbt,"configuration support");
 
 /* gras_cfgelm_t: the typedef corresponding to a config cell. 
 
 
 /* gras_cfgelm_t: the typedef corresponding to a config cell. 
 
@@ -65,8 +72,8 @@ void gras_cfg_host_free(void *d){
  */
 
 
  */
 
 
-void gras_cfg_new(gras_cfg_t **whereto) {
-  gras_dict_new((gras_dict_t**)whereto);
+gras_cfg_t *gras_cfg_new(void) {
+  return (gras_cfg_t *)gras_dict_new();
 }
 
 /**
 }
 
 /**
@@ -223,19 +230,19 @@ gras_cfg_register(gras_cfg_t *cfg,
 
   switch (type) {
   case gras_cfgelm_int:
 
   switch (type) {
   case gras_cfgelm_int:
-    gras_dynar_new(&(res->content), sizeof(int), NULL);
+    res->content = gras_dynar_new(sizeof(int), NULL);
     break;
 
   case gras_cfgelm_double:
     break;
 
   case gras_cfgelm_double:
-    gras_dynar_new(&(res->content), sizeof(double), NULL);
+    res->content = gras_dynar_new(sizeof(double), NULL);
     break;
 
   case gras_cfgelm_string:
     break;
 
   case gras_cfgelm_string:
-   gras_dynar_new(&(res->content),sizeof(char*),&gras_cfg_str_free);
+   res->content = gras_dynar_new(sizeof(char*),&gras_cfg_str_free);
    break;
 
   case gras_cfgelm_host:
    break;
 
   case gras_cfgelm_host:
-   gras_dynar_new(&(res->content),sizeof(gras_host_t*),&gras_cfg_host_free);
+   res->content = gras_dynar_new(sizeof(gras_host_t*),&gras_cfg_host_free);
    break;
 
   default:
    break;
 
   default:
index 3bf65c2..101a08a 100644 (file)
@@ -8,8 +8,6 @@
 /* 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. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-
-#include "gras_private.h"
 #include "dict_private.h"
 
 #include <stdlib.h> /* malloc() */
 #include "dict_private.h"
 
 #include <stdlib.h> /* malloc() */
@@ -17,7 +15,7 @@
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,gros,
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt,
    "Dictionaries provide the same functionnalities than hash tables");
 
 /*####[ Private prototypes ]#################################################*/
    "Dictionaries provide the same functionnalities than hash tables");
 
 /*####[ Private prototypes ]#################################################*/
@@ -32,12 +30,11 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,gros,
  *
  * Creates and initialize a new dictionnary
  */
  *
  * Creates and initialize a new dictionnary
  */
-void
-gras_dict_new(gras_dict_t **whereto) {
-
-  (*whereto) = gras_new(gras_dict_t,1);
-  (*whereto)->head=NULL;
-
+gras_dict_t *
+gras_dict_new(void) {
+  gras_dict_t *res= gras_new(gras_dict_t,1);
+  res->head=NULL;
+  return res;
 }
 /**
  * gras_dict_free:
 }
 /**
  * gras_dict_free:
index ba78128..5e9269e 100644 (file)
@@ -8,7 +8,7 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/misc.h"
 #include "dict_private.h"
 
 #include <string.h> /* strlen() */
 #include "dict_private.h"
 
 #include <string.h> /* strlen() */
@@ -45,25 +45,21 @@ _cursor_push_keys(gras_dict_cursor_t *p_cursor,
  *
  * Structure creator
  */
  *
  * Structure creator
  */
-void
-gras_dict_cursor_new(const gras_dict_t          *p_head,
-                     /*OUT*/gras_dict_cursor_t **pp_cursor) {
+gras_dict_cursor_t *
+gras_dict_cursor_new(const gras_dict_t          *p_head) {
   gras_error_t        errcode  = no_error;
   gras_error_t        errcode  = no_error;
-  gras_dict_cursor_t *p_cursor = NULL;
-
-  p_cursor = gras_new(gras_dict_cursor_t,1);
-
-  gras_dynar_new(&p_cursor->keys,     sizeof(char **), NULL);
-  gras_dynar_new(&p_cursor->key_lens, sizeof(int  *),  NULL);
-
-  p_cursor->pos     = 0;
-  p_cursor->pos_len = 0;
-  p_cursor->head    = p_head ? p_head->head : NULL;
+  gras_dict_cursor_t *res = NULL;
 
 
-  gras_dict_cursor_rewind(p_cursor);
+  res = gras_new(gras_dict_cursor_t,1);
+  res->keys     = gras_dynar_new(sizeof(char **), NULL);
+  res->key_lens = gras_dynar_new(sizeof(int  *),  NULL);
+  res->pos      = 0;
+  res->pos_len  = 0;
+  res->head     = p_head ? p_head->head : NULL;
 
 
-  *pp_cursor = p_cursor;
+  gras_dict_cursor_rewind(res);
 
 
+  return res;
 }
 
 /**
 }
 
 /**
@@ -161,12 +157,12 @@ gras_dict_cursor_rewind(gras_dict_cursor_t *p_cursor) {
  *
  * Create the cursor if it does not exists. Rewind it in any case.
  */
  *
  * 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 gras_dict_cursor_first (const gras_dict_t   *dict,
+                            gras_dict_cursor_t **cursor){
 
   if (!*cursor) {
     DEBUG0("Create the cursor on first use");
 
   if (!*cursor) {
     DEBUG0("Create the cursor on first use");
-    gras_dict_cursor_new(dict,cursor);
+    *cursor=gras_dict_cursor_new(dict);
   }
 
   gras_dict_cursor_rewind(*cursor);
   }
 
   gras_dict_cursor_rewind(*cursor);
index 24f61bc..380a355 100644 (file)
@@ -8,8 +8,6 @@
 /* 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. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-
-#include "gras_private.h"
 #include "dict_private.h"  /* prototypes of this module */
 
 GRAS_LOG_EXTERNAL_CATEGORY(dict);
 #include "dict_private.h"  /* prototypes of this module */
 
 GRAS_LOG_EXTERNAL_CATEGORY(dict);
@@ -143,8 +141,7 @@ _gras_dictelm_alloc(char                *key,
   p_elm->offset   = offset;
   p_elm->content  = data;
   p_elm->free_ctn = free_ctn;
   p_elm->offset   = offset;
   p_elm->content  = data;
   p_elm->free_ctn = free_ctn;
-
-  gras_dynar_new(&(p_elm->sub), sizeof(gras_dictelm_t*), _dictelm_wrapper_free);
+  p_elm->sub      = gras_dynar_new(sizeof(gras_dictelm_t*), _dictelm_wrapper_free);
 
   *pp_elm = p_elm;
 
 
   *pp_elm = p_elm;
 
index 3b17689..b675d2b 100644 (file)
 #ifndef _GRAS_DICT_ELM_T_
 #define _GRAS_DICT_ELM_T_
 
 #ifndef _GRAS_DICT_ELM_T_
 #define _GRAS_DICT_ELM_T_
 
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
+
 /*####[ Type definition ]####################################################*/
 typedef struct gras_dictelm_ {
   char           *key;
 /*####[ Type definition ]####################################################*/
 typedef struct gras_dictelm_ {
   char           *key;
index a0954b7..ad9b0f3 100644 (file)
@@ -8,15 +8,19 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
 #include <sys/types.h>
 
 #include <sys/types.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,gros,"Dynamic arrays");
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,xbt,"Dynamic arrays");
 
 struct gras_dynar_s {
 
 struct gras_dynar_s {
-  size_t          size;
-  size_t          used;
-  size_t          elmsize;
+  unsigned long          size;
+  unsigned long          used;
+  unsigned long          elmsize;
   void           *data;
   void_f_pvoid_t *free;
 };
   void           *data;
   void_f_pvoid_t *free;
 };
@@ -42,7 +46,7 @@ struct gras_dynar_s {
 
 static _GRAS_INLINE 
 void _gras_clear_mem(void * const ptr,
 
 static _GRAS_INLINE 
 void _gras_clear_mem(void * const ptr,
-                    const size_t length) {
+                    const unsigned long length) {
   memset(ptr, 0, length);
 }
 
   memset(ptr, 0, length);
 }
 
@@ -51,19 +55,19 @@ gras_error_t
 _gras_dynar_expand(gras_dynar_t * const dynar,
                    const int            nb) {
   gras_error_t errcode     = no_error;
 _gras_dynar_expand(gras_dynar_t * const dynar,
                    const int            nb) {
   gras_error_t errcode     = no_error;
-  const size_t old_size    = dynar->size;
+  const unsigned long old_size    = dynar->size;
 
   if (nb > old_size) {
     char * const old_data    = dynar->data;
 
 
   if (nb > old_size) {
     char * const old_data    = dynar->data;
 
-    const size_t elmsize     = dynar->elmsize;
-    const size_t old_length  = old_size*elmsize;
+    const unsigned long elmsize     = dynar->elmsize;
+    const unsigned long old_length  = old_size*elmsize;
 
 
-    const size_t used        = dynar->used;
-    const size_t used_length = used*elmsize;
+    const unsigned long used        = dynar->used;
+    const unsigned long used_length = used*elmsize;
 
 
-    const size_t new_size    = nb > (2*(old_size+1)) ? nb : (2*(old_size+1));
-    const size_t new_length  = new_size*elmsize;
+    const unsigned long new_size    = nb > (2*(old_size+1)) ? nb : (2*(old_size+1));
+    const unsigned long new_length  = new_size*elmsize;
     char * const new_data    = gras_malloc0(elmsize*new_size);
 
     DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb);
     char * const new_data    = gras_malloc0(elmsize*new_size);
 
     DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb);
@@ -86,9 +90,9 @@ _gras_dynar_expand(gras_dynar_t * const dynar,
 static _GRAS_INLINE
 void *
 _gras_dynar_elm(const gras_dynar_t * const dynar,
 static _GRAS_INLINE
 void *
 _gras_dynar_elm(const gras_dynar_t * const dynar,
-                const size_t               idx) {
+                const unsigned long               idx) {
   char * const data    = dynar->data;
   char * const data    = dynar->data;
-  const size_t elmsize = dynar->elmsize;
+  const unsigned long elmsize = dynar->elmsize;
 
   return data + idx*elmsize;
 }
 
   return data + idx*elmsize;
 }
@@ -97,9 +101,9 @@ static _GRAS_INLINE
 void
 _gras_dynar_get_elm(void               * const dst,
                     const gras_dynar_t * const dynar,
 void
 _gras_dynar_get_elm(void               * const dst,
                     const gras_dynar_t * const dynar,
-                    const size_t               idx) {
+                    const unsigned long               idx) {
   void * const elm     = _gras_dynar_elm(dynar, idx);
   void * const elm     = _gras_dynar_elm(dynar, idx);
-  const size_t elmsize = dynar->elmsize;
+  const unsigned long elmsize = dynar->elmsize;
 
   memcpy(dst, elm, elmsize);
 }
 
   memcpy(dst, elm, elmsize);
 }
@@ -107,17 +111,16 @@ _gras_dynar_get_elm(void               * const dst,
 static _GRAS_INLINE
 void
 _gras_dynar_put_elm(const gras_dynar_t * const dynar,
 static _GRAS_INLINE
 void
 _gras_dynar_put_elm(const gras_dynar_t * const dynar,
-                    const size_t               idx,
+                    const unsigned long               idx,
                     const void         * const src) {
   void * const elm     = _gras_dynar_elm(dynar, idx);
                     const void         * const src) {
   void * const elm     = _gras_dynar_elm(dynar, idx);
-  const size_t elmsize = dynar->elmsize;
+  const unsigned long elmsize = dynar->elmsize;
 
   memcpy(elm, src, elmsize);
 }
 
 /**
  * gras_dynar_new:
 
   memcpy(elm, src, elmsize);
 }
 
 /**
  * gras_dynar_new:
- * @whereto: pointer to where the dynar should be created
  * @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).
  *
  * @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).
  *
@@ -125,10 +128,9 @@ _gras_dynar_put_elm(const gras_dynar_t * const dynar,
  * pointer of pointer. That is to say that dynars can contain either base
  * types (int, char, double, etc) or pointer of pointers (struct **).
  */
  * pointer of pointer. That is to say that dynars can contain either base
  * types (int, char, double, etc) or pointer of pointers (struct **).
  */
-void
-gras_dynar_new(gras_dynar_t   ** const p_dynar,
-               const size_t            elmsize,
-               void_f_pvoid_t  * const free_func) {
+gras_dynar_t *
+gras_dynar_new(const unsigned long           elmsize,
+               void_f_pvoid_t * const free_func) {
    
   gras_dynar_t *dynar = gras_new0(gras_dynar_t,1);
 
    
   gras_dynar_t *dynar = gras_new0(gras_dynar_t,1);
 
@@ -138,7 +140,7 @@ gras_dynar_new(gras_dynar_t   ** const p_dynar,
   dynar->data    = NULL;
   dynar->free    = free_func;
 
   dynar->data    = NULL;
   dynar->free    = free_func;
 
-  *p_dynar = dynar;
+  return dynar;
 }
 
 /**
 }
 
 /**
@@ -310,16 +312,16 @@ gras_dynar_insert_at(gras_dynar_t * const dynar,
   __check_sloppy_inbound_idx(dynar, idx);
 
   {
   __check_sloppy_inbound_idx(dynar, idx);
 
   {
-    const size_t old_used = dynar->used;
-    const size_t new_used = old_used + 1;
+    const unsigned long old_used = dynar->used;
+    const unsigned long new_used = old_used + 1;
 
     _gras_dynar_expand(dynar, new_used);
 
     {
 
     _gras_dynar_expand(dynar, new_used);
 
     {
-      const size_t nb_shift =  old_used - idx;
-      const size_t elmsize  =  dynar->elmsize;
+      const unsigned long nb_shift =  old_used - idx;
+      const unsigned long elmsize  =  dynar->elmsize;
 
 
-      const size_t offset   =  nb_shift*elmsize;
+      const unsigned long offset   =  nb_shift*elmsize;
 
       void * const elm_src  = _gras_dynar_elm(dynar, idx);
       void * const elm_dst  = _gras_dynar_elm(dynar, idx+1);
 
       void * const elm_src  = _gras_dynar_elm(dynar, idx);
       void * const elm_dst  = _gras_dynar_elm(dynar, idx+1);
@@ -354,13 +356,13 @@ gras_dynar_remove_at(gras_dynar_t * const dynar,
     _gras_dynar_get_elm(object, dynar, idx);
 
   {
     _gras_dynar_get_elm(object, dynar, idx);
 
   {
-    const size_t old_used = dynar->used;
-    const size_t new_used = old_used - 1;
+    const unsigned long old_used = dynar->used;
+    const unsigned long new_used = old_used - 1;
 
 
-    const size_t nb_shift =  old_used-1 - idx;
-    const size_t elmsize  =  dynar->elmsize;
+    const unsigned long nb_shift =  old_used-1 - idx;
+    const unsigned long elmsize  =  dynar->elmsize;
 
 
-    const size_t offset   =  nb_shift*elmsize;
+    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  = _gras_dynar_elm(dynar, idx+1);
     void * const elm_dst  = _gras_dynar_elm(dynar, idx);
@@ -449,8 +451,8 @@ gras_dynar_map(const gras_dynar_t * const dynar,
 
   {
     char         elm[64];
 
   {
     char         elm[64];
-    const size_t used = dynar->used;
-    size_t       i    = 0;
+    const unsigned long used = dynar->used;
+    unsigned long       i    = 0;
 
     for (i = 0; i < used; i++) {
       _gras_dynar_get_elm(elm, dynar, i);
 
     for (i = 0; i < used; i++) {
       _gras_dynar_get_elm(elm, dynar, i);
index af455a8..fa12a0a 100644 (file)
@@ -8,7 +8,7 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/error.h"
 
 /**
  * gras_error_name:
 
 /**
  * gras_error_name:
index eb15e53..364edb1 100644 (file)
@@ -8,13 +8,17 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-
-#include "xbt_interface.h"
-#include "gras_private.h"
 #include <stdarg.h>
 #include <stdarg.h>
-#include <assert.h>
 #include <ctype.h>
 
 #include <ctype.h>
 
+#include "xbt_modinter.h"
+
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+
 typedef struct {
   char *catname;
   gras_log_priority_t thresh;
 typedef struct {
   char *catname;
   gras_log_priority_t thresh;
@@ -47,8 +51,8 @@ gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT) = {
 };
 
 GRAS_LOG_NEW_SUBCATEGORY(gras,GRAS_LOG_ROOT_CAT,"All GRAS categories");
 };
 
 GRAS_LOG_NEW_SUBCATEGORY(gras,GRAS_LOG_ROOT_CAT,"All GRAS categories");
-GRAS_LOG_NEW_SUBCATEGORY(gros,GRAS_LOG_ROOT_CAT,"All GROS categories (gras toolbox)");
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log,gros,"Loggings from the logging mecanism itself");
+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");
 
 
 static void _apply_control(gras_log_category_t* cat) {
 
 
 static void _apply_control(gras_log_category_t* cat) {
@@ -144,7 +148,7 @@ void gras_log_parent_set(gras_log_category_t* cat,
     while(*cpp != cat && *cpp != NULL) {
       cpp = &(*cpp)->nextSibling;
     }
     while(*cpp != cat && *cpp != NULL) {
       cpp = &(*cpp)->nextSibling;
     }
-    assert(*cpp == cat);
+    gras_assert(*cpp == cat);
     *cpp = cat->nextSibling;
   }
 
     *cpp = cat->nextSibling;
   }
 
@@ -316,8 +320,8 @@ void gras_log_control_set(const char* control_string) {
   if (control_string == NULL)
     return;
   if (gras_log_settings == NULL)
   if (control_string == NULL)
     return;
   if (gras_log_settings == NULL)
-    gras_dynar_new(&gras_log_settings,sizeof(gras_log_setting_t*),
-                  _free_setting);
+    gras_log_settings = gras_dynar_new(sizeof(gras_log_setting_t*),
+                                      _free_setting);
 
   set = gras_new(gras_log_setting_t,1);
   cs=gras_strdup(control_string);
 
   set = gras_new(gras_log_setting_t,1);
   cs=gras_strdup(control_string);
index b4e3054..931e689 100644 (file)
@@ -8,7 +8,9 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
 #include <stdio.h>
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler");
 #include <stdio.h>
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log_app,log,"default logging handler");
index c2c9f85..d2a7188 100644 (file)
@@ -8,11 +8,21 @@
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/config.h"
 
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,gros, "module handling");
+#include "gras/process.h" /* FIXME: bad loop */
+
+#include "xbt/module.h" /* this module */
+
+#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");
 
 
-extern void gras_log_exit(void);
 static int gras_running_process = 0;
 
 struct gras_module_ {
 static int gras_running_process = 0;
 
 struct gras_module_ {
index 974837e..aa42896 100644 (file)
@@ -8,9 +8,16 @@
 /* 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. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
+#include "xbt/dynar.h"
+#include "xbt/dict.h"
 
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,gros,"data container consisting in dict+dynar");
+#include "xbt/set.h"
+
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt,"data container consisting in dict+dynar");
 
 /*####[ Type definition ]####################################################*/
 struct gras_set_ {
 
 /*####[ Type definition ]####################################################*/
 struct gras_set_ {
@@ -25,14 +32,14 @@ struct gras_set_ {
  *
  * Creates a new set.
  */
  *
  * Creates a new set.
  */
-void gras_set_new (gras_set_t **dst) {
+gras_set_t *gras_set_new (void) {
   gras_set_t *res=gras_new(gras_set_t,1);
   gras_error_t errcode;
 
   gras_set_t *res=gras_new(gras_set_t,1);
   gras_error_t errcode;
 
-  gras_dict_new (&(res->dict));
-  gras_dynar_new(&(res->dynar), sizeof(void*),NULL);
+  res->dict=gras_dict_new ();
+  res->dynar=gras_dynar_new(sizeof(void*),NULL);
 
 
-  *dst=res;
+  return res;
 }
 
 /**
 }
 
 /**
index 2575bf9..f740897 100644 (file)
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
    under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "gras_private.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+#include "xbt/error.h"
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
-GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, gros, "System dependency");
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(sysdep, xbt, "System dependency");
 
 /****
  **** Memory management
 
 /****
  **** Memory management
diff --git a/src/xbt/xbt_interface.h b/src/xbt/xbt_interface.h
deleted file mode 100644 (file)
index efa29e7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $Id$ */
-
-/* core - very basic functionnalities of GRAS (logs, data container, ...)   */
-
-/* module's public interface exported within GRAS, but not to end user.     */
-
-/* Authors: Martin Quinson                                                  */
-/* Copyright (C) 2004 Martin Quinson.                                       */
-
-/* This program is free software; you can redistribute it and/or modify it
-   under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef XBT_INTERFACE_H
-#define XBT_INTERFACE_H
-
-/* Modules definitions */
-void gras_log_exit(void);
-
-#endif /* XBT_INTERFACE_H */
index d22e377..458a3fa 100644 (file)
@@ -392,6 +392,7 @@ gras_error_t test_graph(gras_socket_t *sock, int direction) {
   i->l->l->l = i;
   j = NULL;
 
   i->l->l->l = i;
   j = NULL;
 
+  gras_datadesc_cycle_set(gras_datadesc_by_name("chained_list_t*"));
   TRY(write_read(gras_datadesc_by_name("chained_list_t*"),
                 &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
   TRY(write_read(gras_datadesc_by_name("chained_list_t*"),
                 &i,&j, sock,direction));
   if (direction == READ || direction == RW) {
@@ -609,7 +610,7 @@ int main(int argc,char *argv[]) {
 
   TRYFAIL(declare_chained_list_type());
   TRYFAIL(test_chain_list(sock,direction));
 
   TRYFAIL(declare_chained_list_type());
   TRYFAIL(test_chain_list(sock,direction));
-  /*  TRYFAIL(test_graph(sock,direction)); */
+  TRYFAIL(test_graph(sock,direction)); 
 
   TRYFAIL(test_pbio(sock,direction));
 
 
   TRYFAIL(test_pbio(sock,direction));
 
index f4ff054..f03b44a 100644 (file)
@@ -13,7 +13,7 @@ gras_cfg_t *make_set(){
   gras_cfg_t *set=NULL; 
   gras_error_t errcode;
 
   gras_cfg_t *set=NULL; 
   gras_error_t errcode;
 
-  gras_cfg_new(&set);
+  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"));
   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"));
index 124f3ee..d97aaf4 100644 (file)
@@ -64,7 +64,7 @@ int main(int argc,char **argv) {
   printf(" (a point is a test)\n");
 
   for (i=0;i<20;i++) {
   printf(" (a point is a test)\n");
 
   for (i=0;i<20;i++) {
-    gras_dict_new(&head);
+    head=gras_dict_new();
     if (i%10) printf("."); else printf("%d",i/10); fflush(stdout);
     nb=0;
     for (j=0;j<1000;j++) {
     if (i%10) printf("."); else printf("%d",i/10); fflush(stdout);
     nb=0;
     for (j=0;j<1000;j++) {
@@ -91,7 +91,7 @@ int main(int argc,char **argv) {
   }
 
 
   }
 
 
-  gras_dict_new(&head);
+  head=gras_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++) {
   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++) {
index 56b6907..fe53dda 100644 (file)
@@ -30,7 +30,7 @@ static void print_str(void *str) {
 static void fill(gras_dict_t **head) {
   printf("\n Fill in the dictionnary\n");
 
 static void fill(gras_dict_t **head) {
   printf("\n Fill in the dictionnary\n");
 
-  gras_dict_new(head);
+  *head = gras_dict_new();
   debuged_add(*head,"12");
   debuged_add(*head,"12a");
   debuged_add(*head,"12b");
   debuged_add(*head,"12");
   debuged_add(*head,"12a");
   debuged_add(*head,"12b");
index 92288a4..09c295d 100644 (file)
@@ -22,7 +22,7 @@ int main(int argc,char *argv[]) {
    gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
 
    INFO0("==== Traverse the empty dynar");
    gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
 
    INFO0("==== Traverse the empty dynar");
-   gras_dynar_new(&d,sizeof(int),NULL);
+   d=gras_dynar_new(sizeof(int),NULL);
    gras_dynar_foreach(d,cursor,cpt){
      gras_assert0(FALSE,
             "Damnit, there is something in the empty dynar");
    gras_dynar_foreach(d,cursor,cpt){
      gras_assert0(FALSE,
             "Damnit, there is something in the empty dynar");
@@ -30,7 +30,7 @@ int main(int argc,char *argv[]) {
    gras_dynar_free(d);
 
    INFO0("==== Push/shift 5000 doubles");
    gras_dynar_free(d);
 
    INFO0("==== Push/shift 5000 doubles");
-   gras_dynar_new(&d,sizeof(double),NULL);
+   d=gras_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_push(d,&d1);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_push(d,&d1);
@@ -52,7 +52,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO0("==== Unshift/pop 5000 doubles");
 
 
    INFO0("==== Unshift/pop 5000 doubles");
-   gras_dynar_new(&d,sizeof(double),NULL);
+   d=gras_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_unshift(d,&d1);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_unshift(d,&d1);
@@ -69,7 +69,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO0("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
 
 
    INFO0("==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything");
-   gras_dynar_new(&d,sizeof(double),NULL);
+   d=gras_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_push(d,&d1);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_push(d,&d1);
@@ -105,7 +105,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO0("==== Push 5000 double, remove 2000-4000. free the rest");
 
 
    INFO0("==== Push 5000 double, remove 2000-4000. free the rest");
-   gras_dynar_new(&d,sizeof(double),NULL);
+   d=gras_dynar_new(sizeof(double),NULL);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_push(d,&d1);
    for (cpt=0; cpt< 5000; cpt++) {
      d1=(double)cpt;
      gras_dynar_push(d,&d1);
index 90febee..c01aeac 100644 (file)
@@ -22,7 +22,7 @@ int main(int argc,char *argv[]) {
    gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
 
    INFO0("==== Traverse the empty dynar");
    gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
 
    INFO0("==== Traverse the empty dynar");
-   gras_dynar_new(&d,sizeof(int),NULL);
+   d=gras_dynar_new(sizeof(int),NULL);
    gras_dynar_foreach(d,cursor,i){
      gras_assert0(0,"Damnit, there is something in the empty dynar");
    }
    gras_dynar_foreach(d,cursor,i){
      gras_assert0(0,"Damnit, there is something in the empty dynar");
    }
@@ -30,7 +30,7 @@ int main(int argc,char *argv[]) {
 
    INFO1("==== Push %d int, set them again 3 times, traverse them, shift them",
        NB_ELEM);
 
    INFO1("==== Push %d int, set them again 3 times, traverse them, shift them",
        NB_ELEM);
-   gras_dynar_new(&d,sizeof(int),NULL);
+   d=gras_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      gras_dynar_push(d,&cpt);
      DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      gras_dynar_push(d,&cpt);
      DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
@@ -77,7 +77,7 @@ int main(int argc,char *argv[]) {
 
    
    INFO1("==== Unshift/pop %d int",NB_ELEM);
 
    
    INFO1("==== Unshift/pop %d int",NB_ELEM);
-   gras_dynar_new(&d,sizeof(int),NULL);
+   d=gras_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));
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      gras_dynar_unshift(d,&cpt);
      DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
@@ -94,7 +94,7 @@ int main(int argc,char *argv[]) {
 
    
    INFO1("==== Push %d int, insert 1000 int in the middle, shift everything",NB_ELEM);
 
    
    INFO1("==== Push %d int, insert 1000 int in the middle, shift everything",NB_ELEM);
-   gras_dynar_new(&d,sizeof(int),NULL);
+   d=gras_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      gras_dynar_push(d,&cpt);
      DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      gras_dynar_push(d,&cpt);
      DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
@@ -127,7 +127,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO1("==== Push %d int, remove 2000-4000. free the rest",NB_ELEM);
 
 
    INFO1("==== Push %d int, remove 2000-4000. free the rest",NB_ELEM);
-   gras_dynar_new(&d,sizeof(int),NULL);
+   d=gras_dynar_new(sizeof(int),NULL);
    for (cpt=0; cpt< NB_ELEM; cpt++) 
      gras_dynar_push(d,&cpt);
    
    for (cpt=0; cpt< NB_ELEM; cpt++) 
      gras_dynar_push(d,&cpt);
    
index 7730826..60e346a 100644 (file)
@@ -31,7 +31,7 @@ int main(int argc,char *argv[]) {
    gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
    
    INFO0("==== Traverse the empty dynar");
    gras_init_defaultlog(&argc,argv,"dynar.thresh=debug");
    
    INFO0("==== Traverse the empty dynar");
-   gras_dynar_new(&d,sizeof(char *),&free_string);
+   d=gras_dynar_new(sizeof(char *),&free_string);
    gras_dynar_foreach(d,cpt,s1){
      gras_assert0(FALSE,
                  "Damnit, there is something in the empty dynar");
    gras_dynar_foreach(d,cpt,s1){
      gras_assert0(FALSE,
                  "Damnit, there is something in the empty dynar");
@@ -39,7 +39,7 @@ int main(int argc,char *argv[]) {
    gras_dynar_free(d);
 
    INFO1("==== Push %d strings, set them again 3 times, shift them",NB_ELEM);
    gras_dynar_free(d);
 
    INFO1("==== Push %d strings, set them again 3 times, shift them",NB_ELEM);
-   gras_dynar_new(&d,sizeof(char*),&free_string);
+   d=gras_dynar_new(sizeof(char*),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
@@ -72,7 +72,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO1("==== Unshift, traverse and pop %d strings",NB_ELEM);
 
 
    INFO1("==== Unshift, traverse and pop %d strings",NB_ELEM);
-   gras_dynar_new(&d,sizeof(char**),&free_string);
+   d=gras_dynar_new(sizeof(char**),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
@@ -96,7 +96,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO2("==== Push %d strings, insert %d strings in the middle, shift everything",NB_ELEM,NB_ELEM/5);
 
 
    INFO2("==== Push %d strings, insert %d strings in the middle, shift everything",NB_ELEM,NB_ELEM/5);
-   gras_dynar_new(&d,sizeof(char*),&free_string);
+   d=gras_dynar_new(sizeof(char*),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
@@ -136,7 +136,7 @@ int main(int argc,char *argv[]) {
 
 
    INFO3("==== Push %d strings, remove %d-%d. free the rest",NB_ELEM,2*(NB_ELEM/5),4*(NB_ELEM/5));
 
 
    INFO3("==== Push %d strings, remove %d-%d. free the rest",NB_ELEM,2*(NB_ELEM/5),4*(NB_ELEM/5));
-   gras_dynar_new(&d,sizeof(char*),&free_string);
+   d=gras_dynar_new(sizeof(char*),&free_string);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
    for (cpt=0; cpt< NB_ELEM; cpt++) {
      sprintf(buf,"%d",cpt);
      s1=strdup(buf);
index 20fde06..a92362d 100644 (file)
@@ -76,7 +76,7 @@ static void debuged_add(gras_set_t *set,
 static void fill(gras_set_t **set) {
   printf("\n Fill in the data set\n");
 
 static void fill(gras_set_t **set) {
   printf("\n Fill in the data set\n");
 
-  gras_set_new(set);
+  *set=gras_set_new();
   debuged_add(*set,"12");
   debuged_add(*set,"12a");
   debuged_add(*set,"12b");
   debuged_add(*set,"12");
   debuged_add(*set,"12a");
   debuged_add(*set,"12b");