Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2004-04-09 Martin Quinson <martin.quinson@tuxfamily.org>
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Apr 2004 00:17:02 +0000 (00:17 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Apr 2004 00:17:02 +0000 (00:17 +0000)
 [Transport plugins]
   - factorize more code between RL and SG in socket creation
   - Complete the implementation and tests of:
     o TCP
     o file (only in RL, and mainly for debugging)

     I lost 3 days to design a portable address resolver, and then decided
       that the prototype mainly have to run on my box.
     Addressing portability too early may be like optimizing too early :-/
 [Tests]
   - use gras_init in the Tests instead of the crappy parse_log_opt
     (the latter function is removed)
 [Conditional execution]
   - New functions: gras_if_RL/gras_if_SG (basic support for this)
 [Code reorganisation]
  - Get rid of libgrasutils.a since it makes more trouble than it solves.
    Build examples against the RL library, since there is no way to disable
    its creation for now.

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

45 files changed:
configure
configure.ac
cruft/doc/tmpl/comm_datadesc.sgml
cruft/doc/tmpl/comm_socks.sgml
cruft/doc/tmpl/gras-unused.sgml
cruft/doc/tmpl/gras_private.sgml
include/cond.h [new file with mode: 0644]
include/core.h
include/gras.h
include/module.h
include/transport.h
include/virtu.h [new file with mode: 0644]
install-sh
src/gras/.cvsignore
src/gras/Makefile.am
src/gras/Transport/rl_transport.c
src/gras/Transport/transport.c
src/gras/Transport/transport_interface.h
src/gras/Transport/transport_plugin_file.c [new file with mode: 0644]
src/gras/Transport/transport_plugin_sg.c
src/gras/Transport/transport_plugin_tcp.c
src/gras/Transport/transport_private.h
src/gras/Virtu/rl_conditional.c [new file with mode: 0644]
src/gras/Virtu/sg_conditional.c [new file with mode: 0644]
src/gras/gras_private.h
src/xbt/core_interface.h [new file with mode: 0644]
src/xbt/log.c
src/xbt/module.c
testsuite/.cvsignore
testsuite/Makefile.am
testsuite/gras/test_utils.c [deleted file]
testsuite/gras/trp_file_client.c [new file with mode: 0644]
testsuite/gras/trp_file_server.c [new file with mode: 0644]
testsuite/gras/trp_file_usage.in [new file with mode: 0644]
testsuite/gras/trp_tcp_client.c [new file with mode: 0644]
testsuite/gras/trp_tcp_server.c [new file with mode: 0644]
testsuite/gras/trp_tcp_usage.in [new file with mode: 0644]
testsuite/xbt/config_usage.c
testsuite/xbt/dict_crash.c
testsuite/xbt/dict_usage.c
testsuite/xbt/dynar_double.c
testsuite/xbt/dynar_int.c
testsuite/xbt/dynar_string.c
testsuite/xbt/log_usage.c
testsuite/xbt/set_usage.c

index 589babd..bfd4563 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
 #! /bin/sh
-# From configure.ac Revision: 1.4 .
+# From configure.ac Revision: 1.5 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for GRAS 0.0.040304.
 #
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.59 for GRAS 0.0.040304.
 #
@@ -466,7 +466,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS HTML_DIR PKG_CONFIG ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE ACI_CACHE_PROG aci_module_desc_XML aci_pkg_config_XML HAVE_XML CFLAGS_XML LIBS_XML aci_module_desc_SimGrid aci_pkg_prefix_SimGrid aci_pkg_inc_SimGrid aci_pkg_lib_SimGrid aci_pkg_extra_SimGrid HAVE_SimGrid CFLAGS_SimGrid LIBS_SimGrid MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT cflags_set BASH WARNING LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS HTML_DIR PKG_CONFIG ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE ACI_CACHE_PROG aci_module_desc_XML aci_pkg_config_XML HAVE_XML CFLAGS_XML LIBS_XML aci_module_desc_SimGrid aci_pkg_prefix_SimGrid aci_pkg_inc_SimGrid aci_pkg_lib_SimGrid aci_pkg_extra_SimGrid HAVE_SimGrid CFLAGS_SimGrid LIBS_SimGrid MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT cflags_set BASH WARNING LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1035,12 +1035,12 @@ Optional Features:
                           build static libraries [default=yes]
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
                           build static libraries [default=yes]
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
-  --disable-dependency-tracking Speeds up one-time builds
-  --enable-dependency-tracking  Do not reject slow dependency extractors
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
   --disable-libtool-lock  avoid locking (might break parallel builds)
   --enable-gtk-doc        use gtk-doc to build documentation default=no
   --disable-libtool-lock  avoid locking (might break parallel builds)
   --enable-gtk-doc        use gtk-doc to build documentation default=no
-  --enable-maintainer-mode enable make rules and dependencies not useful
-                          (and sometimes confusing) to the casual installer
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+                         (and sometimes confusing) to the casual installer
   --enable-compile-warnings=no/minimum/yes       Turn on compiler warnings.
   --enable-iso-c          Try to warn if code is not ISO C
 
   --enable-compile-warnings=no/minimum/yes       Turn on compiler warnings.
   --enable-iso-c          Try to warn if code is not ISO C
 
@@ -1645,7 +1645,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
           ac_config_headers="$ac_config_headers src/gras_config.h"
 
 
           ac_config_headers="$ac_config_headers src/gras_config.h"
 
-am__api_version="1.7"
+am__api_version="1.8"
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
@@ -1783,7 +1783,6 @@ _ACEOF
 program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
 rm conftest.sed
 
 program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
 rm conftest.sed
 
-
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
 
@@ -1797,6 +1796,31 @@ else
 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # Keeping the `.' argument allows $(mkdir_p) to be used without
+  # argument.  Indeed, we sometimes output rules like
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.
+  # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
+  # expensive solution, as it forces Make to start a sub-shell.)
+  mkdir_p='mkdir -p -- .'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -1875,7 +1899,7 @@ else
 fi
 rmdir .tst 2>/dev/null
 
 fi
 rmdir .tst 2>/dev/null
 
- # test to see if srcdir already configured
+# test to see if srcdir already configured
 if test "`cd $srcdir && pwd`" != "`pwd`" &&
    test -f $srcdir/config.status; then
   { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
 if test "`cd $srcdir && pwd`" != "`pwd`" &&
    test -f $srcdir/config.status; then
   { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
@@ -3124,7 +3148,9 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
@@ -3658,7 +3684,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 3661 "configure"' > conftest.$ac_ext
+  echo '#line 3687 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -4831,7 +4857,9 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
@@ -5215,7 +5243,7 @@ fi
 
 
 # Provide some information about the compiler.
 
 
 # Provide some information about the compiler.
-echo "$as_me:5218:" \
+echo "$as_me:5246:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6247,11 +6275,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6250: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6278: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6254: \$? = $ac_status" >&5
+   echo "$as_me:6282: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -6480,11 +6508,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6483: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6511: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6487: \$? = $ac_status" >&5
+   echo "$as_me:6515: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -6540,11 +6568,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6543: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6571: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:6547: \$? = $ac_status" >&5
+   echo "$as_me:6575: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8715,7 +8743,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8718 "configure"
+#line 8746 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8813,7 +8841,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8816 "configure"
+#line 8844 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10990,11 +11018,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10993: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11021: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10997: \$? = $ac_status" >&5
+   echo "$as_me:11025: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -11050,11 +11078,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11053: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11081: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11057: \$? = $ac_status" >&5
+   echo "$as_me:11085: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12404,7 +12432,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12407 "configure"
+#line 12435 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12502,7 +12530,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12505 "configure"
+#line 12533 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13329,11 +13357,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13332: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13360: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13336: \$? = $ac_status" >&5
+   echo "$as_me:13364: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -13389,11 +13417,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13392: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13420: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13396: \$? = $ac_status" >&5
+   echo "$as_me:13424: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15421,11 +15449,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15424: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15452: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15428: \$? = $ac_status" >&5
+   echo "$as_me:15456: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -15654,11 +15682,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15657: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15685: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15661: \$? = $ac_status" >&5
+   echo "$as_me:15689: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -15714,11 +15742,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15717: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15745: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15721: \$? = $ac_status" >&5
+   echo "$as_me:15749: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17889,7 +17917,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17892 "configure"
+#line 17920 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17987,7 +18015,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17990 "configure"
+#line 18018 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19772,7 +19800,9 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      : > sub/conftst$i.h
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
@@ -23301,7 +23331,7 @@ fi
 WARNING="This file is generated, do not edit"
 
 
 WARNING="This file is generated, do not edit"
 
 
-                                                                                                                                                      ac_config_files="$ac_config_files Makefile src/Makefile src/include/Makefile src/include/modules/Makefile src/base/Makefile src/base/Tests/Makefile src/base/Tests/gs_example src/base/Tests/run_tests src/modules/Makefile src/examples/Makefile src/examples/ping/Makefile src/examples/bandwidth/Makefile src/examples/saturate/Makefile src/examples/alnem/Makefile doc/Makefile"
+                                                                                                                                                                          ac_config_files="$ac_config_files Makefile src/Makefile src/include/Makefile src/include/modules/Makefile src/base/Makefile src/base/Tests/Makefile src/base/Tests/run_tests src/base/Tests/gs_example src/base/Tests/trp_tcp_usage src/base/Tests/trp_file_usage src/modules/Makefile src/examples/Makefile src/examples/ping/Makefile src/examples/bandwidth/Makefile src/examples/saturate/Makefile src/examples/alnem/Makefile doc/Makefile"
 
 
 cat >confcache <<\_ACEOF
 
 
 cat >confcache <<\_ACEOF
   "src/include/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/modules/Makefile" ;;
   "src/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Makefile" ;;
   "src/base/Tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/Makefile" ;;
   "src/include/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/include/modules/Makefile" ;;
   "src/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Makefile" ;;
   "src/base/Tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/Makefile" ;;
-  "src/base/Tests/gs_example" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/gs_example" ;;
   "src/base/Tests/run_tests" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/run_tests" ;;
   "src/base/Tests/run_tests" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/run_tests" ;;
+  "src/base/Tests/gs_example" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/gs_example" ;;
+  "src/base/Tests/trp_tcp_usage" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/trp_tcp_usage" ;;
+  "src/base/Tests/trp_file_usage" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/trp_file_usage" ;;
   "src/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
   "src/examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;;
   "src/examples/ping/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/ping/Makefile" ;;
   "src/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
   "src/examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;;
   "src/examples/ping/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/ping/Makefile" ;;
@@ -24018,6 +24050,7 @@ s,@install_sh@,$install_sh,;t t
 s,@STRIP@,$STRIP,;t t
 s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
 s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
 s,@STRIP@,$STRIP,;t t
 s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
 s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
 s,@AWK@,$AWK,;t t
 s,@SET_MAKE@,$SET_MAKE,;t t
 s,@am__leading_dot@,$am__leading_dot,;t t
 s,@AWK@,$AWK,;t t
 s,@SET_MAKE@,$SET_MAKE,;t t
 s,@am__leading_dot@,$am__leading_dot,;t t
@@ -24324,50 +24357,90 @@ s,@INSTALL@,$ac_INSTALL,;t t
   # Run the commands associated with the file.
   case $ac_file in
     Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
   # Run the commands associated with the file.
   case $ac_file in
     Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/include/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/include/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/include/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/include/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/base/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/base/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/base/Tests/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/base/Tests/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
-    src/base/Tests/gs_example ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/base/Tests/run_tests ) ( cd src/include ; test -e gras || ln -s . gras )
     src/base/Tests/run_tests ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
+    src/base/Tests/gs_example ) ( cd src/include ; test -e gras || ln -s . gras )
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
+    src/base/Tests/trp_tcp_usage ) ( cd src/include ; test -e gras || ln -s . gras )
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
+    src/base/Tests/trp_file_usage ) ( cd src/include ; test -e gras || ln -s . gras )
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/examples/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/examples/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/examples/ping/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/examples/ping/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/examples/bandwidth/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/examples/bandwidth/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/examples/saturate/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/examples/saturate/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     src/examples/alnem/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     src/examples/alnem/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
     doc/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
     doc/Makefile ) ( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests ;;
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests ;;
   esac
 done
 _ACEOF
   esac
 done
 _ACEOF
@@ -24758,14 +24831,14 @@ echo X"$mf" |
   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
   # Extract the definition of DEP_FILES from the Makefile without
   # running `make'.
-  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
   test -z "$DEPDIR" && continue
   # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n -e '/^U = / s///p' < "$mf"`
+  U=`sed -n 's/^U = //p' < "$mf"`
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
   # We invoke sed twice because it is the simplest approach to
   # changing $(DEPDIR) to its actual value in the expansion.
-  for file in `sed -n -e '
+  for file in `sed -n '
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
       :loop
     /^DEP_FILES = .*\\\\$/ {
       s/^DEP_FILES = //
       :loop
index c25b215..81d79db 100644 (file)
@@ -79,8 +79,10 @@ AC_CONFIG_FILES([
       src/include/modules/Makefile
     src/base/Makefile
       src/base/Tests/Makefile
       src/include/modules/Makefile
     src/base/Makefile
       src/base/Tests/Makefile
-      src/base/Tests/gs_example
       src/base/Tests/run_tests
       src/base/Tests/run_tests
+        src/base/Tests/gs_example
+        src/base/Tests/trp_tcp_usage
+        src/base/Tests/trp_file_usage
     src/modules/Makefile
     src/examples/Makefile 
       src/examples/ping/Makefile 
     src/modules/Makefile
     src/examples/Makefile 
       src/examples/ping/Makefile 
@@ -88,8 +90,10 @@ AC_CONFIG_FILES([
       src/examples/alnem/Makefile 
   doc/Makefile
 ],[( cd src/include ; test -e gras || ln -s . gras )
       src/examples/alnem/Makefile 
   doc/Makefile
 ],[( cd src/include ; test -e gras || ln -s . gras )
-     test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example;
-     test -e src/base/Tests/run_tests && chmod +x src/base/Tests/run_tests])
+     test -e src/base/Tests/trp_tcp_usage && chmod +x src/base/Tests/trp_tcp_usage;
+     test -e src/base/Tests/trp_file_usage && chmod +x src/base/Tests/trp_file_usage;
+     test -e src/base/Tests/gs_example    && chmod +x src/base/Tests/gs_example;
+     test -e src/base/Tests/run_tests     && chmod +x src/base/Tests/run_tests])
 
 AC_OUTPUT
 
 
 AC_OUTPUT
 
index cf9fb92..cbfbfc9 100644 (file)
@@ -19,13 +19,13 @@ Simple ways to describe data to exchange
 
 </para>
 
 
 </para>
 
+@name: 
 @desc: 
 @howmany: 
 @desc: 
 @howmany: 
-@dst
+@code
 @Returns: 
 <!-- # Unused Parameters # -->
 @Returns: 
 <!-- # Unused Parameters # -->
-@name: 
-@code: 
+@dst: 
 
 
 <!-- ##### FUNCTION gras_datadesc_parse ##### -->
 
 
 <!-- ##### FUNCTION gras_datadesc_parse ##### -->
@@ -33,13 +33,13 @@ Simple ways to describe data to exchange
 
 </para>
 
 
 </para>
 
-@def: 
-@dst: 
-@Returns: 
-<!-- # Unused Parameters # -->
 @name: 
 @Cdefinition: 
 @code: 
 @name: 
 @Cdefinition: 
 @code: 
+@Returns: 
+<!-- # Unused Parameters # -->
+@def: 
+@dst: 
 
 
 <!-- ##### MACRO gras_datadesc_declare_array ##### -->
 
 
 <!-- ##### MACRO gras_datadesc_declare_array ##### -->
index 091054c..e918bf5 100644 (file)
@@ -21,8 +21,11 @@ Open/close sockets, and get info on peer.
 
 @host: 
 @Param2: 
 
 @host: 
 @Param2: 
-@sock: 
+@bufSize: 
+@dst: 
 @Returns: 
 @Returns: 
+<!-- # Unused Parameters # -->
+@sock: 
 
 
 <!-- ##### FUNCTION gras_socket_server ##### -->
 
 
 <!-- ##### FUNCTION gras_socket_server ##### -->
@@ -41,16 +44,9 @@ Open/close sockets, and get info on peer.
 
 </para>
 
 
 </para>
 
-@sock: 
-@Returns: 
-
-
-<!-- ##### FUNCTION gras_socket_peer_name ##### -->
-<para>
-
-</para>
-
 @sd: 
 @sd: 
+<!-- # Unused Parameters # -->
+@sock: 
 @Returns: 
 
 
 @Returns: 
 
 
index 0fa4acb..4bd27dc 100644 (file)
@@ -1563,6 +1563,19 @@ Sockets
 
 @ud: 
 
 
 @ud: 
 
+<!-- ##### FUNCTION gras_datadesc_cmp ##### -->
+<para>
+
+</para>
+
+@d1: 
+@d2: 
+@Returns: 
+@dd1: 
+@c1: 
+@dd2: 
+@c2: 
+
 <!-- ##### FUNCTION gras_datadesc_copy_data ##### -->
 <para>
 
 <!-- ##### FUNCTION gras_datadesc_copy_data ##### -->
 <para>
 
@@ -1666,6 +1679,14 @@ Sockets
 @sock: 
 @Returns: 
 
 @sock: 
 @Returns: 
 
+<!-- ##### FUNCTION gras_socket_peer_name ##### -->
+<para>
+
+</para>
+
+@sd: 
+@Returns: 
+
 <!-- ##### FUNCTION gras_unlock ##### -->
 <para>
 
 <!-- ##### FUNCTION gras_unlock ##### -->
 <para>
 
index 170da11..0fe64db 100644 (file)
@@ -23,21 +23,6 @@ gras_private
 @size: 
 
 
 @size: 
 
 
-<!-- ##### FUNCTION gras_datadesc_cmp ##### -->
-<para>
-
-</para>
-
-@d1: 
-@d2: 
-@Returns: 
-<!-- # Unused Parameters # -->
-@dd1: 
-@c1: 
-@dd2: 
-@c2: 
-
-
 <!-- ##### MACRO SIMPLE_TYPE_COUNT ##### -->
 <para>
 
 <!-- ##### MACRO SIMPLE_TYPE_COUNT ##### -->
 <para>
 
diff --git a/include/cond.h b/include/cond.h
new file mode 100644 (file)
index 0000000..b39485a
--- /dev/null
@@ -0,0 +1,58 @@
+/* $Id$                     */
+
+/* gras/cond.h - public interface to conditional execution                  */
+/*                (specific parts for SG or RL)                             */
+/* Authors: Martin Quinson                                                  */
+/* Copyright (C) 2003,2004 da GRAS posse.                                   */
+
+/* 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_COND_H
+#define GRAS_COND_H
+
+#include <stddef.h>    /* offsetof() */
+#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++ */
+
+BEGIN_DECL
+
+/**
+ * gras_if_RL:
+ * 
+ * Returns true only if the program runs on real life
+ */
+int gras_if_RL(void);
+
+/**
+ * gras_if_SG:
+ * 
+ * Returns true only if the program runs within the simulator
+ */
+int gras_if_SG(void);
+
+END_DECL
+
+#endif /* GRAS_COND_H */
+
index acabba1..1903616 100644 (file)
@@ -57,22 +57,6 @@ typedef enum { free_after_use, free_never } e_gras_free_directive_t;
 const char *
 gras_get_my_fqdn(void);
 
 const char *
 gras_get_my_fqdn(void);
 
-/**
- * gras_time:
- * 
- * Get the time in number of second since the Epoch.
- * (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG)
- */
-double gras_time(void);
-
-/**
- * gras_sleep:
- * @sec: number of seconds to sleep
- * @usec: number of microseconds to sleep
- * 
- * sleeps for the given amount of seconds plus the given amount of microseconds.
- */
-void gras_sleep(unsigned long sec, unsigned long usec);
 
 END_DECL
 
 
 END_DECL
 
index 6cc6123..1b0d843 100644 (file)
 
 #include <gras/config.h>
 
 
 #include <gras/config.h>
 
-#include <gras/core.h>
+#include <gras/core.h> /* FIXME: killme */
 #include <gras/process.h>
 #include <gras/process.h>
+#include <gras/virtu.h>
+#include <gras/cond.h>
 
 
 #include <gras/transport.h>
 
 
 #include <gras/transport.h>
index b9a3ee4..d97da11 100644 (file)
@@ -17,5 +17,6 @@ typedef gras_module_t (*gras_module_new_fct_t)(int argc, char **argv);
 typedef int (*gras_module_finalize_fct_t)(void);
 
 void gras_init(int argc,char **argv);
 typedef int (*gras_module_finalize_fct_t)(void);
 
 void gras_init(int argc,char **argv);
-void gras_finalize(void);
+void gras_init_defaultlog(int argc,char **argv, const char *defaultlog);
+void gras_exit(void);
 #endif /* _GRAS_MODULE_H */
 #endif /* _GRAS_MODULE_H */
index 123b9f6..ad0a1bd 100644 (file)
@@ -17,12 +17,17 @@ typedef struct s_gras_socket gras_socket_t;
 
 gras_error_t gras_socket_client(const char *host,
                                unsigned short port,
 
 gras_error_t gras_socket_client(const char *host,
                                unsigned short port,
-                               unsigned int bufSize,
                                /* OUT */ gras_socket_t **dst);
 gras_error_t gras_socket_server(unsigned short port,
                                /* OUT */ gras_socket_t **dst);
 gras_error_t gras_socket_server(unsigned short port,
-                               unsigned int bufSize,
                                /* OUT */ gras_socket_t **dst);
                                /* OUT */ gras_socket_t **dst);
-void         gras_socket_close(gras_socket_t *sd);
+void         gras_socket_close(gras_socket_t **sd);
+
+
+/* debuging functions */
+gras_error_t gras_socket_client_from_file(const char*path,
+                                         /* OUT */ gras_socket_t **dst);
+gras_error_t gras_socket_server_from_file(const char*path,
+                                         /* OUT */ gras_socket_t **dst);
+                                         
    
 #endif /* GRAS_TRANSPORT_H */
    
 #endif /* GRAS_TRANSPORT_H */
diff --git a/include/virtu.h b/include/virtu.h
new file mode 100644 (file)
index 0000000..2466a33
--- /dev/null
@@ -0,0 +1,60 @@
+/* $Id$                     */
+
+/* gras/virtu.h - public interface to virtualization (cross-OS portability) */
+
+/* Authors: Martin Quinson                                                  */
+/* Copyright (C) 2003,2004 da GRAS posse.                                   */
+
+/* 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_VIRTU_H
+#define GRAS_VIRTU_H
+
+#include <stddef.h>    /* offsetof() */
+#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++ */
+
+BEGIN_DECL
+
+/**
+ * gras_time:
+ * 
+ * Get the time in number of second since the Epoch.
+ * (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG)
+ */
+double gras_time(void);
+
+/**
+ * gras_sleep:
+ * @sec: number of seconds to sleep
+ * @usec: number of microseconds to sleep
+ * 
+ * sleeps for the given amount of seconds plus the given amount of microseconds.
+ */
+void gras_sleep(unsigned long sec, unsigned long usec);
+
+END_DECL
+
+#endif /* GRAS_VIRTU_H */
+
index 0ec27bc..77bc381 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh
 #!/bin/sh
-#
 # install - install a program, script, or datafile
 # install - install a program, script, or datafile
-#
+
+scriptversion=2004-02-15.20
+
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
 # following copyright and license.
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
 # following copyright and license.
 # from scratch.  It can only install one file at a time, a restriction
 # shared with many OS's install programs.
 
 # from scratch.  It can only install one file at a time, a restriction
 # shared with many OS's install programs.
 
-
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
 
-
 # put in absolute paths if you don't have them in your path; or use env. vars.
 
 mvprog="${MVPROG-mv}"
 # put in absolute paths if you don't have them in your path; or use env. vars.
 
 mvprog="${MVPROG-mv}"
@@ -59,236 +58,259 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-transformbasename=""
-transform_arg=""
+transformbasename=
+transform_arg=
 instcmd="$mvprog"
 chmodcmd="$chmodprog 0755"
 instcmd="$mvprog"
 chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+chowncmd=
+chgrpcmd=
+stripcmd=
 rmcmd="$rmprog -f"
 mvcmd="$mvprog"
 rmcmd="$rmprog -f"
 mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-       -c) instcmd=$cpprog
-           shift
-           continue;;
-
-       -d) dir_arg=true
-           shift
-           continue;;
-
-       -m) chmodcmd="$chmodprog $2"
-           shift
-           shift
-           continue;;
-
-       -o) chowncmd="$chownprog $2"
-           shift
-           shift
-           continue;;
-
-       -g) chgrpcmd="$chgrpprog $2"
-           shift
-           shift
-           continue;;
-
-       -s) stripcmd=$stripprog
-           shift
-           continue;;
-
-       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
-           shift
-           continue;;
-
-       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-           shift
-           continue;;
-
-       *)  if [ x"$src" = x ]
-           then
-               src=$1
-           else
-               # this colon is to work around a 386BSD /bin/sh bug
-               :
-               dst=$1
-           fi
-           shift
-           continue;;
-    esac
+src=
+dst=
+dir_arg=
+
+usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 -d DIRECTORIES...
+
+In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
+In the second, create the directory path DIR.
+
+Options:
+-b=TRANSFORMBASENAME
+-c         copy source (using $cpprog) instead of moving (using $mvprog).
+-d         create directories instead of installing files.
+-g GROUP   $chgrp installed files to GROUP.
+-m MODE    $chmod installed files to MODE.
+-o USER    $chown installed files to USER.
+-s         strip installed files (using $stripprog).
+-t=TRANSFORM
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+        shift
+        continue;;
+
+    -c) instcmd=$cpprog
+        shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit 0;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+        shift
+        continue;;
+
+    --version) echo "$0 $scriptversion"; exit 0;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       test -n "$dir_arg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
 done
 
 done
 
-if [ x"$src" = x ]
-then
-       echo "$0: no input file specified" >&2
-       exit 1
-else
-       :
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
 fi
 
 fi
 
-if [ x"$dir_arg" != x ]; then
-       dst=$src
-       src=""
-
-       if [ -d "$dst" ]; then
-               instcmd=:
-               chmodcmd=""
-       else
-               instcmd=$mkdirprog
-       fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
-       if [ -f "$src" ] || [ -d "$src" ]
-       then
-               :
-       else
-               echo "$0: $src does not exist" >&2
-               exit 1
-       fi
-
-       if [ x"$dst" = x ]
-       then
-               echo "$0: no destination specified" >&2
-               exit 1
-       else
-               :
-       fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-       if [ -d "$dst" ]
-       then
-               dst=$dst/`basename "$src"`
-       else
-               :
-       fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-       '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-       pathcomp=$pathcomp$1
-       shift
-
-       if [ ! -d "$pathcomp" ] ;
-        then
-               $mkdirprog "$pathcomp"
-       else
-               :
-       fi
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      instcmd=:
+      chmodcmd=
+    else
+      instcmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
 
 
-       pathcomp=$pathcomp/
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp" || lasterr=$?
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $instcmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    # If we're going to rename the final executable, determine the name now.
+    if test -z "$transformarg"; then
+      dstfile=`basename "$dst"`
+    else
+      dstfile=`basename "$dst" $transformbasename \
+               | sed $transformarg`$transformbasename
+    fi
+
+    # don't allow the sed command to completely eliminate the filename.
+    test -z "$dstfile" && dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Move or copy the file name to the temp name
+    $doit $instcmd "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $instcmd $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now remove or move aside any old file at destination location.  We
+    # try this two ways since rm can't unlink itself on some systems and
+    # the destination file might be busy for other reasons.  In this case,
+    # the final cleanup might fail but the new file should still install
+    # successfully.
+    {
+      if test -f "$dstdir/$dstfile"; then
+        $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+        || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+        || {
+         echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+         (exit 1); exit
+        }
+      else
+        :
+      fi
+    } &&
+
+    # Now rename the file to the real destination.
+    $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+  fi || { (exit 1); exit; }
 done
 done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-       $doit $instcmd "$dst" &&
-
-       if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
-       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
-       if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
-       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-       if [ x"$transformarg" = x ]
-       then
-               dstfile=`basename "$dst"`
-       else
-               dstfile=`basename "$dst" $transformbasename |
-                       sed $transformarg`$transformbasename
-       fi
-
-# don't allow the sed command to completely eliminate the filename
-
-       if [ x"$dstfile" = x ]
-       then
-               dstfile=`basename "$dst"`
-       else
-               :
-       fi
-
-# Make a couple of temp file names in the proper directory.
-
-       dsttmp=$dstdir/#inst.$$#
-       rmtmp=$dstdir/#rm.$$#
-
-# Trap to clean up temp files at exit.
-
-       trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
-       trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
-       $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-       if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
-       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
-       if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
-       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location.  We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons.  In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
-       if [ -f "$dstdir/$dstfile" ]
-       then
-               $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
-               $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
-               {
-                 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-                 (exit 1); exit
-               }
-       else
-               :
-       fi
-} &&
-
-# Now rename the file to the real destination.
-
-       $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-
-fi &&
 
 # The final little trick to "correctly" pass the exit status to the exit trap.
 
 # The final little trick to "correctly" pass the exit status to the exit trap.
-
 {
 {
-       (exit 0); exit
+  (exit 0); exit
 }
 }
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
index 155be66..2045a0c 100644 (file)
@@ -1 +1,2 @@
-.deps .libs Makefile Makefile.in dict_usage dict_crash dynar_int dynar_double dynar_string
+.deps .libs Makefile Makefile.in
+cscope.files cscope.out
index 56f2a70..27ed9ed 100644 (file)
@@ -10,8 +10,6 @@ EXTRA_DIST=                 \
 
 lib_LIBRARIES= libgrasrl.a libgrassg.a
 
 
 lib_LIBRARIES= libgrasrl.a libgrassg.a
 
-noinst_LIBRARIES=libgrasutils.a
-
 #                     Core/dict_multi.c
 #  Common/gras.c      Common/gras_datadesc.c        Common/gras_msg.c            
 #   Messaging/messaging.c                       
 #                     Core/dict_multi.c
 #  Common/gras.c      Common/gras_datadesc.c        Common/gras_msg.c            
 #   Messaging/messaging.c                       
@@ -20,7 +18,7 @@ noinst_LIBRARIES=libgrasutils.a
 
 COMMON_S=\
   \
 
 COMMON_S=\
   \
-  Core/module.c                                                                 \
+  Core/module.c      Core/core_interface.h                                      \
   Core/log.c         Core/log_default_appender.c   Core/error.c                 \
   Core/dynar.c                                                                  \
   Core/dict.c        Core/dict_elm.c               Core/dict_cursor.c           \
   Core/log.c         Core/log_default_appender.c   Core/error.c                 \
   Core/dynar.c                                                                  \
   Core/dict.c        Core/dict_elm.c               Core/dict_cursor.c           \
@@ -29,15 +27,15 @@ COMMON_S=\
   Core/config.c                               \
   \
   Transport/transport.c    Transport/transport_private.h      \
   Core/config.c                               \
   \
   Transport/transport.c    Transport/transport_private.h      \
-  Transport/transport_plugin_tcp.c          \
-  Transport/transport_plugin_sg.c          \
-  \
+  Transport/transport_plugin_file.c            \
+  Transport/transport_plugin_tcp.c            \
+  Transport/transport_plugin_sg.c             \
   \
   DataDesc/ddt_create.c          DataDesc/ddt_declare.c \
   DataDesc/ddt_remote.c          DataDesc/ddt_use.c     \
   DataDesc/cbps.c                DataDesc/datadesc.c    \
   DataDesc/datadesc_interface.h  DataDesc/datadesc_private.h
   \
   DataDesc/ddt_create.c          DataDesc/ddt_declare.c \
   DataDesc/ddt_remote.c          DataDesc/ddt_use.c     \
   DataDesc/cbps.c                DataDesc/datadesc.c    \
   DataDesc/datadesc_interface.h  DataDesc/datadesc_private.h
-  
+
 #  DataDesc/datadesc.c                               \
 #  DataDesc/tools.c                                  \
 #  DataDesc/categories.h                             \
 #  DataDesc/datadesc.c                               \
 #  DataDesc/tools.c                                  \
 #  DataDesc/categories.h                             \
@@ -55,23 +53,12 @@ COMMON_S=\
 DataDesc/parse.yy.c: DataDesc/parse.yy.l
        flex -o$@ -Pgras_ddt_ $^
 
 DataDesc/parse.yy.c: DataDesc/parse.yy.l
        flex -o$@ -Pgras_ddt_ $^
 
-libgrasutils_a_SOURCES = $(COMMON_S) 
-#Tests/gras_dummy.c
-
 libgrasrl_a_SOURCES= $(COMMON_S) \
   Transport/rl_transport.c       \
 libgrasrl_a_SOURCES= $(COMMON_S) \
   Transport/rl_transport.c       \
-  Virtu/rl_process.c       Virtu/rl_time.c
+  Virtu/rl_process.c       Virtu/rl_time.c     Virtu/rl_conditional.c
 
 libgrassg_a_SOURCES= $(COMMON_S) \
   Transport/sg_transport.c       \
 
 libgrassg_a_SOURCES= $(COMMON_S) \
   Transport/sg_transport.c       \
-  Virtu/sg_process.c Virtu/sg_time.c
+  Virtu/sg_process.c       Virtu/sg_time.c     Virtu/sg_conditional.c
 
 # RL/gras_rl.c RL/gras_rl.h FIXME
 
 # RL/gras_rl.c RL/gras_rl.h FIXME
-
-# $(foreach file,\
-#  exp_smooth forc median mse_forc protocol \
-#  dnsutil fbuff forecast_api last_value run_mean timeouts, \
-#  $(top_srcdir)/src/nws_portability/build-@host@/obj/$(file).o) 
-
-
-       
index fe19f91..5069c42 100644 (file)
@@ -17,43 +17,6 @@ GRAS_LOG_EXTERNAL_CATEGORY(transport);
 GRAS_LOG_DEFAULT_CATEGORY(transport);
 
 
 GRAS_LOG_DEFAULT_CATEGORY(transport);
 
 
-gras_error_t
-gras_socket_server(unsigned short port,
-                  unsigned int bufSize, 
-                  /* OUT */ gras_socket_t **dst) {
-  gras_error_t errcode;
-  gras_trp_plugin_t *tcp;
-
-  TRY(gras_trp_plugin_get_by_name("TCP",&tcp));
-  TRY( tcp->socket_server(tcp, port, bufSize, dst));
-
-  (*dst)->incoming  = 1;
-  (*dst)->accepting = 1;
-
-  TRY(gras_dynar_push(_gras_trp_sockets,dst));
-
-  return no_error;
-}
-
-gras_error_t
-gras_socket_client(const char *host,
-                  unsigned short port,
-                  unsigned int bufSize, 
-                  /* OUT */ gras_socket_t **dst) {
-  gras_error_t errcode;
-  gras_trp_plugin_t *tcp;
-
-  TRY(gras_trp_plugin_get_by_name("TCP",&tcp));
-  TRY( (*tcp->socket_client)(tcp, host, port, bufSize, dst));
-
-  (*dst)->incoming  = 0;
-  (*dst)->accepting = 0;
-
-  return no_error;
-}
-
 
 /**
  * gras_trp_select:
 
 /**
  * gras_trp_select:
@@ -98,9 +61,13 @@ gras_trp_select(double timeout,
     /* construct the set of socket to ear from */
     FD_ZERO(&FDS);
     gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
     /* construct the set of socket to ear from */
     FD_ZERO(&FDS);
     gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
-      if (max_fds < sock_iter->sd)
-       max_fds = sock_iter->sd;
-      FD_SET(sock_iter->sd, &FDS);
+      if (sock_iter->incoming) {
+       if (max_fds < sock_iter->sd)
+         max_fds = sock_iter->sd;
+       FD_SET(sock_iter->sd, &FDS);
+      } else {
+       DEBUG1("Not considering socket %d for select",sock_iter->sd);
+      }
     }
 
     /* we cannot have more than FD_SETSIZE sockets */
     }
 
     /* we cannot have more than FD_SETSIZE sockets */
@@ -127,6 +94,7 @@ gras_trp_select(double timeout,
       p_tout = NULL;
     }
 
       p_tout = NULL;
     }
 
+    DEBUG1("Selecting over %d socket(s)", max_fds-1);
     ready = select(max_fds, &FDS, NULL, NULL, p_tout);
     if (ready == -1) {
       switch (errno) {
     ready = select(max_fds, &FDS, NULL, NULL, p_tout);
     if (ready == -1) {
       switch (errno) {
@@ -163,6 +131,8 @@ gras_trp_select(double timeout,
         TRY(sock_iter->plugin->socket_accept(sock_iter,&accepted));
         TRY(gras_dynar_push(_gras_trp_sockets,&accepted));
        } else {
         TRY(sock_iter->plugin->socket_accept(sock_iter,&accepted));
         TRY(gras_dynar_push(_gras_trp_sockets,&accepted));
        } else {
+#if 0 
+       FIXME: this fails of files. quite logical
         /* Make sure the socket is still alive by reading the first byte */
         char lookahead;
         int recvd;
         /* Make sure the socket is still alive by reading the first byte */
         char lookahead;
         int recvd;
@@ -171,18 +141,21 @@ gras_trp_select(double timeout,
         if (recvd < 0) {
           WARNING2("socket %d failed: %s", sock_iter->sd, strerror(errno));
           /* done with this socket */
         if (recvd < 0) {
           WARNING2("socket %d failed: %s", sock_iter->sd, strerror(errno));
           /* done with this socket */
-          gras_socket_close(sock_iter);
+          gras_socket_close(&sock_iter);
           cursor--;
         } else if (recvd == 0) {
           /* Connection reset (=closed) by peer. */
           DEBUG1("Connection %d reset by peer", sock_iter->sd);
           cursor--;
         } else if (recvd == 0) {
           /* Connection reset (=closed) by peer. */
           DEBUG1("Connection %d reset by peer", sock_iter->sd);
-          gras_socket_close(sock_iter); 
+          gras_socket_close(&sock_iter); 
           cursor--; 
         } else { 
           cursor--; 
         } else { 
+#endif
           /* Got a suited socket ! */
           *dst = sock_iter;
           return no_error;
           /* Got a suited socket ! */
           *dst = sock_iter;
           return no_error;
+#if 0
         }
         }
+#endif
        }
 
        
        }
 
        
index 15874f4..4b5d45a 100644 (file)
@@ -41,7 +41,13 @@ gras_trp_init(void){
 
   /* TCP */
   TRY(gras_trp_tcp_init(&plug));
 
   /* TCP */
   TRY(gras_trp_tcp_init(&plug));
-  TRY(gras_dict_insert(_gras_trp_plugins,plug->name, plug, gras_trp_plugin_free));
+  TRY(gras_dict_insert(_gras_trp_plugins, 
+                      plug->name, plug, gras_trp_plugin_free));
+
+  /* FILE */
+  TRY(gras_trp_file_init(&plug));
+  TRY(gras_dict_insert(_gras_trp_plugins, 
+                      plug->name, plug, gras_trp_plugin_free));
 
   return no_error;
 }
 
   return no_error;
 }
@@ -65,20 +71,145 @@ void gras_trp_plugin_free(void *p) {
   }
 }
 
   }
 }
 
-void gras_socket_close(gras_socket_t *sock) {
+
+/**
+ * gras_trp_socket_new:
+ *
+ * Malloc a new socket, and initialize it with defaults
+ */
+gras_error_t gras_trp_socket_new(int incoming,
+                                gras_socket_t **dst) {
+
+  gras_socket_t *sock;
+
+  if (! (sock=malloc(sizeof(gras_socket_t))) )
+    RAISE_MALLOC;
+
+  sock->plugin = NULL;
+  sock->sd     = -1;
+
+  sock->incoming  = incoming? 1:0;
+  sock->outgoing  = incoming? 0:1;
+  sock->accepting = incoming? 1:0;
+  DEBUG3("in=%c out=%c accept=%c",
+        sock->incoming?'y':'n', 
+        sock->outgoing?'y':'n',
+        sock->accepting?'y':'n');
+
+  sock->port      = -1;
+  sock->peer_port = -1;
+  sock->peer_name = NULL;
+
+  *dst = sock;
+  return no_error;
+}
+
+
+/**
+ * gras_socket_server:
+ *
+ * Opens a server socket and make it ready to be listened to.
+ * In real life, you'll get a TCP socket.
+ */
+gras_error_t
+gras_socket_server(unsigned short port,
+                  /* OUT */ gras_socket_t **dst) {
+  gras_error_t errcode;
+  gras_trp_plugin_t *trp;
+  gras_socket_t *sock;
+
+  *dst = NULL;
+
+  TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "TCP" : "SG",
+                                 &trp));
+
+  /* defaults settings */
+  TRY(gras_trp_socket_new(1,&sock));
+  sock->plugin= trp;
+  sock->port=port;
+
+  /* Call plugin socket creation function */
+  errcode = trp->socket_server(trp, port, sock);
+  if (errcode != no_error) {
+    free(sock);
+    return errcode;
+  }
+
+  *dst = sock;
+  /* Register this socket */
+  errcode = gras_dynar_push(_gras_trp_sockets,dst);
+  if (errcode != no_error) {
+    free(sock);
+    *dst = NULL;
+    return errcode;
+  }
+
+  return no_error;
+}
+
+/**
+ * gras_socket_client:
+ *
+ * Opens a client socket to a remote host.
+ * In real life, you'll get a TCP socket.
+ */
+gras_error_t
+gras_socket_client(const char *host,
+                  unsigned short port,
+                  /* OUT */ gras_socket_t **dst) {
+  gras_error_t errcode;
+  gras_trp_plugin_t *trp;
+  gras_socket_t *sock;
+
+  *dst = NULL;
+
+  TRY(gras_trp_plugin_get_by_name(gras_if_RL() ? "TCP" : "SG",
+                                 &trp));
+
+  /* defaults settings */
+  TRY(gras_trp_socket_new(0,&sock));
+  sock->plugin= trp;
+  sock->peer_port = port;
+  sock->peer_name = strdup(host?host:"localhost");
+
+  /* plugin-specific */
+  errcode= (* trp->socket_client)(trp, 
+                                 host ? host : "localhost", port,
+                                 sock);
+  if (errcode != no_error) {
+    free(sock);
+    return errcode;
+  }
+
+  /* register socket */
+  *dst = sock;
+  errcode = gras_dynar_push(_gras_trp_sockets,dst);
+  if (errcode != no_error) {
+    free(sock);
+    *dst = NULL;
+    return errcode;
+  }
+
+  return no_error;
+}
+
+void gras_socket_close(gras_socket_t **sock) {
   gras_socket_t *sock_iter;
   int cursor;
 
   /* FIXME: Issue an event when the socket is closed */
   gras_socket_t *sock_iter;
   int cursor;
 
   /* FIXME: Issue an event when the socket is closed */
-  if (sock) {
+  if (sock && *sock) {
     gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
     gras_dynar_foreach(_gras_trp_sockets,cursor,sock_iter) {
-      if (sock == sock_iter) {
+      if (*sock == sock_iter) {
        gras_dynar_cursor_rm(_gras_trp_sockets,&cursor);
        gras_dynar_cursor_rm(_gras_trp_sockets,&cursor);
-       if (sock->plugin->socket_close) 
-         (*sock->plugin->socket_close)(sock);
+       if ( (*sock)->plugin->socket_close) 
+         (* (*sock)->plugin->socket_close)(*sock);
 
        /* free the memory */
 
        /* free the memory */
-       free(sock);
+       free(*sock);
+       *sock=NULL;
        return;
       }
     }
        return;
       }
     }
@@ -95,6 +226,12 @@ gras_error_t
 gras_trp_chunk_send(gras_socket_t *sd,
                    char *data,
                    size_t size) {
 gras_trp_chunk_send(gras_socket_t *sd,
                    char *data,
                    size_t size) {
+  gras_assert1(sd->outgoing,
+              "Socket not suited for data send (outgoing=%c)",
+              sd->outgoing?'y':'n');
+  gras_assert1(sd->plugin->chunk_send,
+              "No function chunk_send on transport plugin %s",
+              sd->plugin->name);
   return (*sd->plugin->chunk_send)(sd,data,size);
 }
 /**
   return (*sd->plugin->chunk_send)(sd,data,size);
 }
 /**
@@ -102,10 +239,16 @@ gras_trp_chunk_send(gras_socket_t *sd,
  *
  * Receive a bunch of bytes from a socket
  */
  *
  * Receive a bunch of bytes from a socket
  */
-gras_error_t gras_trp_chunk_recv(gras_socket_t *sd,
-                                char *data,
-                                size_t size) {
-  return (*sd->plugin->chunk_recv)(sd,data,size);
+gras_error_t 
+gras_trp_chunk_recv(gras_socket_t *sd,
+                   char *data,
+                   size_t size) {
+  gras_assert0(sd->incoming,
+              "Socket not suited for data receive");
+  gras_assert1(sd->plugin->chunk_recv,
+              "No function chunk_recv on transport plugin %s",
+              sd->plugin->name);
+  return (sd->plugin->chunk_recv)(sd,data,size);
 }
 
 
 }
 
 
index 44f8dc3..d24e43a 100644 (file)
@@ -13,8 +13,6 @@
 #ifndef GRAS_TRP_INTERFACE_H
 #define GRAS_TRP_INTERFACE_H
 
 #ifndef GRAS_TRP_INTERFACE_H
 #define GRAS_TRP_INTERFACE_H
 
-#include "gras_private.h"
-
 /***
  *** Main user functions
  ***/
 /***
  *** Main user functions
  ***/
@@ -60,15 +58,16 @@ typedef enum e_gras_trp_plugin {
 struct gras_trp_plugin_ {
   char          *name;
  
 struct gras_trp_plugin_ {
   char          *name;
  
+  /* dst pointers are created and initialized with default values 
+     before call to socket_client/server*/
   gras_error_t (*socket_client)(gras_trp_plugin_t *self,
                                const char *host,
                                unsigned short port,
   gras_error_t (*socket_client)(gras_trp_plugin_t *self,
                                const char *host,
                                unsigned short port,
-                               unsigned int bufSize,
-                               /* OUT */ gras_socket_t **dst);
+                               /* OUT */ gras_socket_t *dst);
   gras_error_t (*socket_server)(gras_trp_plugin_t *self,
                                unsigned short port,
   gras_error_t (*socket_server)(gras_trp_plugin_t *self,
                                unsigned short port,
-                               unsigned int bufSize,
-                               /* OUT */ gras_socket_t **dst);
+                               /* OUT */ gras_socket_t *dst);
+   
   gras_error_t (*socket_accept)(gras_socket_t  *sock,
                                /* OUT */gras_socket_t **dst);
    
   gras_error_t (*socket_accept)(gras_socket_t  *sock,
                                /* OUT */gras_socket_t **dst);
    
diff --git a/src/gras/Transport/transport_plugin_file.c b/src/gras/Transport/transport_plugin_file.c
new file mode 100644 (file)
index 0000000..74774ae
--- /dev/null
@@ -0,0 +1,286 @@
+/* $Id$ */
+
+/* File transport - send/receive a bunch of bytes from a file               */
+
+/* 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. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "gras_private.h"
+#include "transport_private.h"
+
+GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(trp_file,transport);
+
+typedef struct {
+  int buffsize;
+} gras_trp_tcp_sock_specific_t;
+
+/***
+ *** Prototypes 
+ ***/
+void         gras_trp_file_close(gras_socket_t *sd);
+  
+gras_error_t gras_trp_file_chunk_send(gras_socket_t *sd,
+                                     char *data,
+                                     size_t size);
+
+gras_error_t gras_trp_file_chunk_recv(gras_socket_t *sd,
+                                     char *data,
+                                     size_t size);
+
+void         gras_trp_file_free_specific(void *s);
+
+/***
+ *** Specific plugin part
+ ***/
+
+typedef struct {
+  fd_set incoming_socks;
+} gras_trp_file_specific_t;
+
+/***
+ *** Specific socket part
+ ***/
+
+
+/***
+ *** Code
+ ***/
+gras_error_t
+gras_trp_file_init(gras_trp_plugin_t **dst) {
+
+  gras_trp_plugin_t *res=malloc(sizeof(gras_trp_plugin_t));
+  gras_trp_file_specific_t *specif = malloc(sizeof(gras_trp_file_specific_t));
+  if (!res || !specif)
+    RAISE_MALLOC;
+
+  FD_ZERO(&(specif->incoming_socks));
+
+  res->name = strdup("file");
+  res->socket_client = NULL;
+  res->socket_server = NULL;
+  res->socket_accept = NULL;
+  res->socket_close  = gras_trp_file_close;
+
+  res->chunk_send    = gras_trp_file_chunk_send;
+  res->chunk_recv    = gras_trp_file_chunk_recv;
+
+  res->specific      = (void*)specif;
+  res->free_specific = gras_trp_file_free_specific;
+
+  *dst = res;
+  return no_error;
+}
+
+void gras_trp_file_free_specific(void *s) {
+  gras_trp_file_specific_t *specific = s;
+  free(specific);
+}
+
+/**
+ * gras_socket_client_from_file:
+ *
+ * Create a client socket from a file path.
+ *
+ * This only possible in RL, and is mainly for debugging.
+ */
+gras_error_t
+gras_socket_client_from_file(const char*path,
+                            /* OUT */ gras_socket_t **dst) {
+  gras_error_t errcode;
+  gras_trp_plugin_t *trp;
+
+  gras_assert0(gras_if_RL(),
+              "Cannot use file as socket in the simulator");
+
+  TRY(gras_trp_socket_new(0,dst));
+
+  TRY(gras_trp_plugin_get_by_name("file",&trp));
+  (*dst)->plugin=trp;
+
+  DEBUG3("in=%c out=%c accept=%c",
+       (*dst)->incoming?'y':'n', 
+       (*dst)->outgoing?'y':'n',
+       (*dst)->accepting?'y':'n');
+
+  if (strcmp("-", path)) {
+    (*dst)->sd = open(path, O_RDONLY );
+    
+    if ( (*dst)->sd < 0) {
+      RAISE2(system_error,
+            "Cannot create a client socket from file %s: %s",
+            path, strerror(errno));
+    }
+  } else {
+    (*dst)->sd = 1; /* stdout */
+  }
+
+  DEBUG4("sd=%d in=%c out=%c accept=%c",
+       (*dst)->sd,
+       (*dst)->incoming?'y':'n', 
+       (*dst)->outgoing?'y':'n',
+       (*dst)->accepting?'y':'n');
+  /* register socket */
+  errcode = gras_dynar_push(_gras_trp_sockets,dst);
+  if (errcode != no_error) {
+    free(*dst);
+    *dst = NULL;
+    return errcode;
+  }
+
+  return no_error;
+}
+
+/**
+ * gras_socket_server_from_file:
+ *
+ * Create a server socket from a file path.
+ *
+ * This only possible in RL, and is mainly for debugging.
+ */
+gras_error_t
+gras_socket_server_from_file(const char*path,
+                            /* OUT */ gras_socket_t **dst) {
+  gras_error_t errcode;
+  gras_trp_plugin_t *trp;
+
+  gras_assert0(gras_if_RL(),
+              "Cannot use file as socket in the simulator");
+
+  TRY(gras_trp_socket_new(1,dst));
+
+  TRY(gras_trp_plugin_get_by_name("file",&trp));
+  (*dst)->plugin=trp;
+
+
+  if (strcmp("-", path)) {
+    (*dst)->sd = open(path, O_WRONLY );
+
+    if ( (*dst)->sd < 0) {
+      RAISE2(system_error,
+            "Cannot create a server socket from file %s: %s",
+            path, strerror(errno));
+    }
+  } else {
+    (*dst)->sd = 0; /* stdin */
+  }
+
+  DEBUG4("sd=%d in=%c out=%c accept=%c",
+        (*dst)->sd,
+        (*dst)->incoming?'y':'n', 
+        (*dst)->outgoing?'y':'n',
+        (*dst)->accepting?'y':'n');
+
+  /* register socket */
+  errcode = gras_dynar_push(_gras_trp_sockets,dst);
+  if (errcode != no_error) {
+    free(*dst);
+    *dst = NULL;
+    return errcode;
+  }
+
+  return no_error;
+}
+
+void gras_trp_file_close(gras_socket_t *sock){
+  gras_trp_file_specific_t *specific;
+  
+  if (!sock) return; /* close only once */
+  specific=sock->plugin->specific;
+
+  if (sock->sd == 0) {
+    DEBUG0("Do not close stdin");
+  } else if (sock->sd == 1) {
+    DEBUG0("Do not close stdout");
+  } else {
+    DEBUG1("close file connection %d\n", sock->sd);
+
+    /* forget about the socket */
+    FD_CLR(sock->sd, &(specific->incoming_socks));
+
+    /* close the socket */
+    if(close(sock->sd) < 0) {
+      WARNING2("error while closing file %d: %s\n", 
+              sock->sd, strerror(errno));
+    }
+  }
+}
+
+/**
+ * gras_trp_file_chunk_send:
+ *
+ * Send data on a file pseudo-socket
+ */
+gras_error_t 
+gras_trp_file_chunk_send(gras_socket_t *sock,
+                        char *data,
+                        size_t size) {
+  
+  gras_assert0(size >= 0, "Cannot send a negative amount of data");
+
+  while (size) {
+    int status = 0;
+    
+    status = write(sock->sd, data, (size_t)size);
+    DEBUG3("write(%d, %p, %ld);\n", sock->sd, data, size);
+    
+    if (status == -1) {
+      RAISE4(system_error,"write(%d,%p,%d) failed: %s",
+            sock->sd, data, (int)size,
+            strerror(errno));
+    }
+    
+    if (status) {
+      size  -= status;
+      data  += status;
+    } else {
+      RAISE0(system_error,"file descriptor closed");
+    }
+  }
+
+  return no_error;
+}
+/**
+ * gras_trp_file_chunk_recv:
+ *
+ * Receive data on a file pseudo-socket.
+ */
+gras_error_t 
+gras_trp_file_chunk_recv(gras_socket_t *sock,
+                       char *data,
+                       size_t size) {
+
+  /* TCP sockets are in duplex mode, don't check direction */
+  gras_assert0(sock, "Cannot recv on an NULL socket");
+  gras_assert0(size >= 0, "Cannot receive a negative amount of data");
+  
+  while (size) {
+    int status = 0;
+    
+    status = read(sock->sd, data, (size_t)size);
+    DEBUG3("read(%d, %p, %ld);\n", sock->sd, data, size);
+    
+    if (status == -1) {
+      RAISE4(system_error,"read(%d,%p,%d) failed: %s",
+            sock->sd, data, (int)size,
+            strerror(errno));
+    }
+    
+    if (status) {
+      size  -= status;
+      data  += status;
+    } else {
+      RAISE0(system_error,"file descriptor closed");
+    }
+  }
+  
+  return no_error;
+}
+
index 2779058..822812e 100644 (file)
@@ -26,11 +26,9 @@ void         gras_trp_sg_exit(gras_trp_plugin_t *plugin);
 gras_error_t gras_trp_sg_socket_client(const char *host,
                                       unsigned short port,
                                       int raw, 
 gras_error_t gras_trp_sg_socket_client(const char *host,
                                       unsigned short port,
                                       int raw, 
-                                      unsigned int bufSize, 
                                       /* OUT */ gras_socket_t **dst);
 gras_error_t gras_trp_sg_socket_server(unsigned short port,
                                       int raw, 
                                       /* OUT */ gras_socket_t **dst);
 gras_error_t gras_trp_sg_socket_server(unsigned short port,
                                       int raw, 
-                                      unsigned int bufSize, 
                                       /* OUT */ gras_socket_t **dst);
 void         gras_trp_sg_socket_close(gras_socket_t **sd);
 gras_error_t gras_trp_sg_select(double timeOut,
                                       /* OUT */ gras_socket_t **dst);
 void         gras_trp_sg_socket_close(gras_socket_t **sd);
 gras_error_t gras_trp_sg_select(double timeOut,
@@ -81,14 +79,12 @@ gras_trp_sg_exit(gras_trp_plugin_t *plugin) {
 gras_error_t gras_trp_sg_socket_client(const char *host,
                                       unsigned short port,
                                       int raw, 
 gras_error_t gras_trp_sg_socket_client(const char *host,
                                       unsigned short port,
                                       int raw, 
-                                      unsigned int bufSize, 
                                       /* OUT */ gras_socket_t **dst){
   RAISE_UNIMPLEMENTED;
 }
 
 gras_error_t gras_trp_sg_socket_server(unsigned short port,
                                       int raw, 
                                       /* OUT */ gras_socket_t **dst){
   RAISE_UNIMPLEMENTED;
 }
 
 gras_error_t gras_trp_sg_socket_server(unsigned short port,
                                       int raw, 
-                                      unsigned int bufSize, 
                                       /* OUT */ gras_socket_t **dst){
   RAISE_UNIMPLEMENTED;
 }
                                       /* OUT */ gras_socket_t **dst){
   RAISE_UNIMPLEMENTED;
 }
index 490ceeb..3d0cd16 100644 (file)
@@ -19,7 +19,7 @@
 #include <sys/wait.h>     /* waitpid() */
 #include <sys/socket.h>   /* getpeername() socket() */
 #include <stdlib.h>
 #include <sys/wait.h>     /* waitpid() */
 #include <sys/socket.h>   /* getpeername() socket() */
 #include <stdlib.h>
-
+#include <string.h>       /* memset */
 
 #include "gras_private.h"
 #include "transport_private.h"
 
 #include "gras_private.h"
 #include "transport_private.h"
@@ -36,24 +36,22 @@ typedef struct {
 gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
                                        const char *host,
                                        unsigned short port,
 gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
                                        const char *host,
                                        unsigned short port,
-                                       unsigned int bufSize, 
-                                       /* OUT */ gras_socket_t **dst);
+                                       /* OUT */ gras_socket_t *sock);
 gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
                                        unsigned short port,
 gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
                                        unsigned short port,
-                                       unsigned int bufSize, 
-                                       /* OUT */ gras_socket_t **dst);
+                                       /* OUT */ gras_socket_t *sock);
 gras_error_t gras_trp_tcp_socket_accept(gras_socket_t  *sock,
                                        gras_socket_t **dst);
 
 void         gras_trp_tcp_socket_close(gras_socket_t *sd);
   
 gras_error_t gras_trp_tcp_socket_accept(gras_socket_t  *sock,
                                        gras_socket_t **dst);
 
 void         gras_trp_tcp_socket_close(gras_socket_t *sd);
   
-gras_error_t gras_trp_tcp_bloc_send(gras_socket_t *sd,
-                                   char *data,
-                                   size_t size);
+gras_error_t gras_trp_tcp_chunk_send(gras_socket_t *sd,
+                                    char *data,
+                                    size_t size);
 
 
-gras_error_t gras_trp_tcp_bloc_recv(gras_socket_t *sd,
-                                   char *data,
-                                   size_t size);
+gras_error_t gras_trp_tcp_chunk_recv(gras_socket_t *sd,
+                                    char *data,
+                                    size_t size);
 
 void         gras_trp_tcp_free_specific(void *s);
 
 
 void         gras_trp_tcp_free_specific(void *s);
 
@@ -85,11 +83,15 @@ gras_trp_tcp_init(gras_trp_plugin_t **dst) {
 
   FD_ZERO(&(tcp->incoming_socks));
 
 
   FD_ZERO(&(tcp->incoming_socks));
 
+  res->name = strdup("TCP");
   res->socket_client = gras_trp_tcp_socket_client;
   res->socket_server = gras_trp_tcp_socket_server;
   res->socket_accept = gras_trp_tcp_socket_accept;
   res->socket_close  = gras_trp_tcp_socket_close;
 
   res->socket_client = gras_trp_tcp_socket_client;
   res->socket_server = gras_trp_tcp_socket_server;
   res->socket_accept = gras_trp_tcp_socket_accept;
   res->socket_close  = gras_trp_tcp_socket_close;
 
+  res->chunk_send    = gras_trp_tcp_chunk_send;
+  res->chunk_recv    = gras_trp_tcp_chunk_recv;
+
   res->specific      = (void*)tcp;
   res->free_specific = gras_trp_tcp_free_specific;
 
   res->specific      = (void*)tcp;
   res->free_specific = gras_trp_tcp_free_specific;
 
@@ -105,92 +107,88 @@ void gras_trp_tcp_free_specific(void *s) {
 gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
                                        const char *host,
                                        unsigned short port,
 gras_error_t gras_trp_tcp_socket_client(gras_trp_plugin_t *self,
                                        const char *host,
                                        unsigned short port,
-                                       unsigned int bufSize, 
-                                       /* OUT */ gras_socket_t **dst){
-  
-  int addrCount;
-  IPAddress addresses[10];
-  int i;
-  int sd;
+                                       /* OUT */ gras_socket_t *sock){
   
   
-  if (!(*sock=malloc(sizeof(gras_socket_t))))
-    RAISE_MALLOC;
+  struct sockaddr_in addr;
+  struct hostent *he;
+  struct in_addr *haddr;
+
+  sock->incoming = 1; /* TCP sockets are duplex'ed */
+
+  sock->sd = socket (AF_INET, SOCK_STREAM, 0);
   
   
-  (*sock)->peer_addr=NULL;
+  if (sock->sd < 0) {
+    RAISE1(system_error,
+          "Failed to create socket: %s",
+          strerror (errno));
+  }
   
   
-  if (!(addrCount = IPAddressValues(host, addresses, 10))) {
+  he = gethostbyname (host);
+  if (he == NULL) {
     RAISE2(system_error,
     RAISE2(system_error,
-         "tcp address retrieval of '%s' failed: %s",
-          host,strerror(errno));
+          "Failed to lookup hostname %s: %s",
+          host, strerror (errno));
   }
   
   }
   
-  for(i = 0; i < addrCount && i<10 ; i++) {
-    if(CallAddr(addresses[i], port, &sd, -1)) {
-      (*sock)->sock = sd;
-      (*sock)->port = port;
-      return no_error;
-    }
+  haddr = ((struct in_addr *) (he->h_addr_list)[0]);
+  
+  memset(&addr, 0, sizeof(struct sockaddr_in));
+  memcpy (&addr.sin_addr, haddr, sizeof(struct in_addr));
+  addr.sin_family = AF_INET;
+  addr.sin_port = htons (port);
+
+  if (connect (sock->sd, (struct sockaddr*) &addr, sizeof (addr)) < 0) {
+    close(sock->sd);
+    RAISE3(system_error,
+          "Failed to connect socket to %s:%d (%s)",
+          host, port, strerror (errno));
   }
   }
-  free(*sock);
-  RAISE2(system_error,"Something wicked happenned while connecting to %s:%d",
-          host,port);
+  
+  return no_error;
 }
 
 /**
  * gras_trp_tcp_socket_server:
  *
 }
 
 /**
  * gras_trp_tcp_socket_server:
  *
- * Open a socket used to receive messages. bufSize is in ko.
+ * Open a socket used to receive messages.
  */
 gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
                                        unsigned short port,
  */
 gras_error_t gras_trp_tcp_socket_server(gras_trp_plugin_t *self,
                                        unsigned short port,
-                                       unsigned int bufSize, 
-                                       /* OUT */ gras_socket_t **dst){
-  int size = bufSize * 1024;
+                                       /* OUT */ gras_socket_t *sock){
+//  int size = bufSize * 1024;
   int on = 1;
   int on = 1;
-  int sd = -1;
   struct sockaddr_in server;
 
   struct sockaddr_in server;
 
-  gras_socket_t *res;
   gras_trp_tcp_specific_t *data=(gras_trp_tcp_specific_t*)self -> specific;
  
   gras_trp_tcp_specific_t *data=(gras_trp_tcp_specific_t*)self -> specific;
  
-  res=malloc(sizeof(gras_socket_t));
-  if (!res)
-    RAISE_MALLOC;
+  sock->outgoing  = 1; /* TCP => duplex mode */
 
   server.sin_port = htons((u_short)port);
   server.sin_addr.s_addr = INADDR_ANY;
   server.sin_family = AF_INET;
 
   server.sin_port = htons((u_short)port);
   server.sin_addr.s_addr = INADDR_ANY;
   server.sin_family = AF_INET;
-  if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-    free(res);
+  if((sock->sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
     RAISE1(system_error,"socket allocation failed: %s", strerror(errno));
   }
 
     RAISE1(system_error,"socket allocation failed: %s", strerror(errno));
   }
 
-  (void)setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
+  (void)setsockopt(sock->sd, SOL_SOCKET, SO_REUSEADDR, 
+                  (char *)&on, sizeof(on));
+   /*
   (void)setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size));
   (void)setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size));
   (void)setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&size, sizeof(size));
   (void)setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&size, sizeof(size));
-  if (bind(sd, (struct sockaddr *)&server, sizeof(server)) == -1) {
-    free(res);
-    close(sd);
+    */
+  if (bind(sock->sd, (struct sockaddr *)&server, sizeof(server)) == -1) {
+    close(sock->sd);
     RAISE2(system_error,"Cannot bind to port %d: %s",port, strerror(errno));
   }
 
     RAISE2(system_error,"Cannot bind to port %d: %s",port, strerror(errno));
   }
 
-  if (listen(sd, 5) != -1) {
-    free(res);
-    close(sd);
+  if (listen(sock->sd, 5) < 0) {
+    close(sock->sd);
     RAISE2(system_error,"Cannot listen to port %d: %s",port,strerror(errno));
   }
 
     RAISE2(system_error,"Cannot listen to port %d: %s",port,strerror(errno));
   }
 
-  FD_SET(sd, &(data->incoming_socks));
+  FD_SET(sock->sd, &(data->incoming_socks));
 
 
-  *dst=res;
-  res->plugin = self;
-  res->incoming = 1;
-  res->sd = sd;
-  res->port=port;
-  res->peer_port=-1;
-  res->peer_name=NULL;
-
-  DEBUG2("Openned a server socket on port %d (sock %d)",port,sd);
+  DEBUG2("Openned a server socket on port %d (sock %d)",port,sock->sd);
   
   return no_error;
 }
   
   return no_error;
 }
@@ -214,7 +212,7 @@ gras_trp_tcp_socket_accept(gras_socket_t  *sock,
   tmp_errno = errno;
 
   if(sd == -1) {
   tmp_errno = errno;
 
   if(sd == -1) {
-    gras_socket_close(sock);
+    gras_socket_close(&sock);
     RAISE1(system_error,
           "Accept failed (%s). Droping server socket.", strerror(tmp_errno));
   } else {
     RAISE1(system_error,
           "Accept failed (%s). Droping server socket.", strerror(tmp_errno));
   } else {
@@ -226,18 +224,23 @@ gras_trp_tcp_socket_accept(gras_socket_t  *sock,
       WARNING0("setsockopt failed, cannot condition the accepted socket");
     }
  
       WARNING0("setsockopt failed, cannot condition the accepted socket");
     }
  
+     /* FIXME: bufSize removed until we can have optionsets 
     i = ((gras_trp_tcp_sock_specific_t*)sock->specific)->buffsize;
     if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&i, s)
        || setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&i, s)) {
       WARNING0("setsockopt failed, cannot set buffsize");      
     }
     i = ((gras_trp_tcp_sock_specific_t*)sock->specific)->buffsize;
     if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&i, s)
        || setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&i, s)) {
       WARNING0("setsockopt failed, cannot set buffsize");      
     }
-    res->plugin = sock->plugin;
-    res->incoming = 1;
-    res->sd = sd;
-    res->port= -1;
-    res->peer_port= peer_in.sin_port;
-
+      */
+     
+    res->plugin    = sock->plugin;
+    res->incoming  = sock->incoming;
+    res->outgoing  = sock->outgoing;
+    res->accepting = 0;
+    res->sd        = sd;
+    res->port      = -1;
+    res->peer_port = peer_in.sin_port;
+
+    /* FIXME: Lock to protect inet_ntoa */
     if (((struct sockaddr *)&peer_in)->sa_family != AF_INET) {
       res->peer_name = strdup("unknown");
     } else {
     if (((struct sockaddr *)&peer_in)->sa_family != AF_INET) {
       res->peer_name = strdup("unknown");
     } else {
@@ -248,7 +251,7 @@ gras_trp_tcp_socket_accept(gras_socket_t  *sock,
       
       tmp = inet_ntoa(addrAsInAddr);
       if (tmp != NULL) {
       
       tmp = inet_ntoa(addrAsInAddr);
       if (tmp != NULL) {
-       res->peer_name = strdup(inet_ntoa(addrAsInAddr));
+       res->peer_name = strdup(tmp);
       } else {
        res->peer_name = strdup("unknown");
       }
       } else {
        res->peer_name = strdup("unknown");
       }
@@ -284,14 +287,14 @@ void gras_trp_tcp_socket_close(gras_socket_t *sock){
     }
   } */
 
     }
   } */
 
+  /* forget about the socket */
+  FD_CLR(sock->sd, &(tcp->incoming_socks));
+
   /* close the socket */
   if(close(sock->sd) < 0) {
   /* close the socket */
   if(close(sock->sd) < 0) {
-    WARNING3("error while closing tcp socket %d: %d (%s)\n", sock->sd, errno, strerror(errno));
+    WARNING3("error while closing tcp socket %d: %d (%s)\n", 
+            sock->sd, errno, strerror(errno));
   }
   }
-
-  /* forget about it */
-  FD_CLR(sock->sd, &(tcp->incoming_socks));
-
 }
 
 /**
 }
 
 /**
@@ -304,8 +307,7 @@ gras_trp_tcp_chunk_send(gras_socket_t *sock,
                    char *data,
                    size_t size) {
   
                    char *data,
                    size_t size) {
   
-  /*  gras_assert0(sock && !sock->incoming,
-      "Asked to send stuff on an incomming socket");*/
+  /* TCP sockets are in duplex mode, don't check direction */
   gras_assert0(size >= 0, "Cannot send a negative amount of data");
 
   while (size) {
   gras_assert0(size >= 0, "Cannot send a negative amount of data");
 
   while (size) {
@@ -339,8 +341,9 @@ gras_error_t
 gras_trp_tcp_chunk_recv(gras_socket_t *sock,
                        char *data,
                        size_t size) {
 gras_trp_tcp_chunk_recv(gras_socket_t *sock,
                        char *data,
                        size_t size) {
-  gras_assert0(sock && !sock->incoming,
-              "Ascked to receive stuff on an outcomming socket");
+
+  /* TCP sockets are in duplex mode, don't check direction */
+  gras_assert0(sock, "Cannot recv on an NULL socket");
   gras_assert0(size >= 0, "Cannot receive a negative amount of data");
   
   while (size) {
   gras_assert0(size >= 0, "Cannot receive a negative amount of data");
   
   while (size) {
index f94b58b..543f6be 100644 (file)
@@ -27,11 +27,12 @@ extern gras_dynar_t *_gras_trp_sockets; /* all existing sockets */
 
 struct s_gras_socket  {
   gras_trp_plugin_t *plugin;
 
 struct s_gras_socket  {
   gras_trp_plugin_t *plugin;
+    
+  int incoming :1; /* true if we can read from this sock */
+  int outgoing :1; /* true if we can write on this sock */
+  int accepting :1; /* true if master incoming sock in tcp */
    
    
-  int incoming; /* true if incoming (server) sock, false if client sock */
-  int accepting; /* true if master incoming sock in tcp */
-   
-  int  sd;
+  int  sd; 
   int  port; /* port on this side */
   int  peer_port; /* port on the other side */
   char *peer_name; /* hostname of the other side */
   int  port; /* port on this side */
   int  peer_port; /* port on the other side */
   char *peer_name; /* hostname of the other side */
@@ -39,11 +40,12 @@ struct s_gras_socket  {
   void *specific; /* plugin specific data */
 };
        
   void *specific; /* plugin specific data */
 };
        
+gras_error_t gras_trp_socket_new(int incomming,
+                                gras_socket_t **dst);
 
 
-/* TCP driver */
+/* The drivers */
 gras_error_t gras_trp_tcp_init(gras_trp_plugin_t **dst);
 gras_error_t gras_trp_tcp_init(gras_trp_plugin_t **dst);
-
-/* SG driver */
+gras_error_t gras_trp_file_init(gras_trp_plugin_t **dst);
 gras_error_t gras_trp_sg_init (gras_trp_plugin_t **dst);
 
 
 gras_error_t gras_trp_sg_init (gras_trp_plugin_t **dst);
 
 
diff --git a/src/gras/Virtu/rl_conditional.c b/src/gras/Virtu/rl_conditional.c
new file mode 100644 (file)
index 0000000..c364faf
--- /dev/null
@@ -0,0 +1,19 @@
+/* $Id$ */
+
+/* rl_conditional - conditional execution (real life)                       */
+
+/* Authors: Martin Quinson                                                  */
+/* Copyright (C) 2003,2004 da GRAS posse.                                   */
+
+/* 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 "Virtu/virtu_rl.h"
+
+int gras_if_RL(void) {
+   return 1;
+}
+
+int gras_if_SG(void) {
+   return 0;
+}
diff --git a/src/gras/Virtu/sg_conditional.c b/src/gras/Virtu/sg_conditional.c
new file mode 100644 (file)
index 0000000..7ae9d76
--- /dev/null
@@ -0,0 +1,19 @@
+/* $Id$ */
+
+/* rl_conditional - conditional execution (simulation)                      */
+
+/* Authors: Martin Quinson                                                  */
+/* Copyright (C) 2003,2004 da GRAS posse.                                   */
+
+/* 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 "Virtu/virtu_rl.h"
+
+int gras_if_RL(void) {
+   return 0;
+}
+
+int gras_if_SG(void) {
+   return 1;
+}
index d4031e2..23b88e1 100644 (file)
@@ -34,6 +34,8 @@
 
 #include "gras/core.h"
 #include "gras/process.h"
 
 #include "gras/core.h"
 #include "gras/process.h"
+#include "gras/virtu.h"
+#include "gras/cond.h"
 
 #include "gras/transport.h"
 #include "Transport/transport_interface.h"
 
 #include "gras/transport.h"
 #include "Transport/transport_interface.h"
diff --git a/src/xbt/core_interface.h b/src/xbt/core_interface.h
new file mode 100644 (file)
index 0000000..4fedcd2
--- /dev/null
@@ -0,0 +1,19 @@
+/* $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 GRAS_CORE_INTERFACE_H
+#define GRAS_CORE_INTERFACE_H
+
+/* Modules definitions */
+void gras_log_exit(void);
+
+#endif /* GRAS_CORE_INTERFACE_H */
index a9c834a..cb07747 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 "Core/core_interface.h"
 #include "gras_private.h"
 #include <stdarg.h>
 #include <assert.h>
 #include "gras_private.h"
 #include <stdarg.h>
 #include <assert.h>
@@ -366,7 +367,6 @@ void gras_log_appender_set(gras_log_category_t* cat, gras_log_appender_t* app) {
   cat->appender = app;
 }
 
   cat->appender = app;
 }
 
-void gras_log_finalize(void);
-void gras_log_finalize(void) {
+void gras_log_exit(void) {
   gras_dynar_free(gras_log_settings);
 }
   gras_dynar_free(gras_log_settings);
 }
index f21cd23..65638c8 100644 (file)
@@ -12,7 +12,7 @@
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,GRAS);
 
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,GRAS);
 
-extern void gras_log_finalize(void);
+extern void gras_log_exit(void);
 
 struct gras_module_ {
   gras_dynar_t *deps;
 
 struct gras_module_ {
   gras_dynar_t *deps;
@@ -22,38 +22,53 @@ struct gras_module_ {
   gras_module_finalize_fct_t finalize;
 };
 
   gras_module_finalize_fct_t finalize;
 };
 
+void 
+gras_init(int argc, char **argv) {
+   gras_init_defaultlog(argc, argv, NULL);
+}
 
 /**
 
 /**
- * gras_init:
+ * gras_init_defaultlog:
  * @argc:
  * @argv:
  *
  * Initialize the gras mecanisms.
  */
 void
  * @argc:
  * @argv:
  *
  * Initialize the gras mecanisms.
  */
 void
-gras_init(int argc,char **argv) {
+gras_init_defaultlog(int argc,char **argv, const char *defaultlog) {
   int i;
   char *opt;
   gras_error_t errcode;
   int i;
   char *opt;
   gras_error_t errcode;
+  int found=0;
 
   INFO0("Initialize GRAS");
 
   INFO0("Initialize GRAS");
+  
+  /** Set logs and init log submodule */
   for (i=1; i<argc; i++) {
     if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
   for (i=1; i<argc; i++) {
     if (!strncmp(argv[i],"--gras-log=",strlen("--gras-log="))) {
+      found = 1;
       opt=strchr(argv[i],'=');
       opt++;
       TRYFAIL(gras_log_control_set(opt));
     }
   }
       opt=strchr(argv[i],'=');
       opt++;
       TRYFAIL(gras_log_control_set(opt));
     }
   }
+  if (!found && defaultlog) {
+     TRYFAIL(gras_log_control_set(defaultlog));
+  }
+   
+  /** init other submodules */
+  gras_trp_init();
 }
 
 /**
 }
 
 /**
- * gras_finalize:
+ * gras_exit:
  * @argc:
  * @argv:
  *
  * Finalize the gras mecanisms.
  */
 void 
  * @argc:
  * @argv:
  *
  * Finalize the gras mecanisms.
  */
 void 
-gras_finalize(){
-  gras_log_finalize();
+gras_exit(){
+  gras_trp_exit();
+  gras_log_exit();
 }
 }
index 4941ba9..bc30753 100644 (file)
@@ -5,3 +5,5 @@ log_usage
 config_usage
 set_usage
 gs_example gs_example_receive gs_example_send
 config_usage
 set_usage
 gs_example gs_example_receive gs_example_send
+trp_file_client trp_file_server trp_file_usage
+trp_tcp_client trp_tcp_server trp_tcp_usage
index 8c7533e..606e2a9 100644 (file)
@@ -1,6 +1,5 @@
 INCLUDES = -I$(top_srcdir)/src/include
 AM_CFLAGS=-g -Wno-unused-function 
 INCLUDES = -I$(top_srcdir)/src/include
 AM_CFLAGS=-g -Wno-unused-function 
-AM_LDFLAGS=-g
 
 CLEANFILES = *~ test a.out *.o
 DISTCLEANFILES=Makefile.in *~
 
 CLEANFILES = *~ test a.out *.o
 DISTCLEANFILES=Makefile.in *~
@@ -8,39 +7,52 @@ EXTRA_DIST=test_utils.c run_tests.in
 
 # Test stuff
 
 
 # Test stuff
 
-noinst_PROGRAMS =                             \
+core_tests =                                  \
        dynar_int dynar_double dynar_string   \
        dict_usage dict_crash                 \
        set_usage                             \
        log_usage                             \
        dynar_int dynar_double dynar_string   \
        dict_usage dict_crash                 \
        set_usage                             \
        log_usage                             \
-       config_usage                          
-       
-#      gs_example_send gs_example_receive
-       
+       config_usage
 # multidict_crash 
 
 # multidict_crash 
 
+RL_tests =                                    \
+       trp_tcp_client   trp_tcp_server       \
+       trp_file_client  trp_file_server
+#      gs_example_send gs_example_receive
 
 
-noinst_SCRIPTS = run_tests gs_example
+SG_tests =
 
 
-log_usage_LDADD=          $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+noinst_PROGRAMS = $(core_tests) $(RL_tests) $(SG_tests)
+noinst_SCRIPTS = run_tests gs_example trp_tcp_usage
+TESTS=run_tests
 
 
-dynar_int_LDADD=          $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-dynar_double_LDADD=       $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-dynar_string_LDADD=       $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+test: $(noinst_PROGRAMS) $(noinst_SCRIPTS)
+       ./run_tests
 
 
-dict_usage_LDADD=         $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-dict_crash_LDADD=         $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-#multidict_crash_LDADD=    $(top_srcdir)/src/base/libgrasutils.a test_utils.o
 
 
-set_usage_LDADD=          $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+# LDADD_UTILS is still a separate var to distinguish core tester from RL tester
+LDADD_UTILS=$(top_srcdir)/src/base/libgrasrl.a 
+LDADD_RL=   $(top_srcdir)/src/base/libgrasrl.a   
 
 
-config_usage_LDADD=       $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+log_usage_LDADD=          $(LDADD_UTILS)
 
 
+dynar_int_LDADD=          $(LDADD_UTILS)
+dynar_double_LDADD=       $(LDADD_UTILS)
+dynar_string_LDADD=       $(LDADD_UTILS)
 
 
-#gs_example_send_LDADD=    $(top_srcdir)/src/base/libgrasutils.a test_utils.o
-#gs_example_receive_LDADD= $(top_srcdir)/src/base/libgrasutils.a test_utils.o
+dict_usage_LDADD=         $(LDADD_UTILS)
+dict_crash_LDADD=         $(LDADD_UTILS)
+#multidict_crash_LDADD=    $(LDADD_UTILS)
 
 
-TESTS=run_tests
+set_usage_LDADD=          $(LDADD_UTILS)
+
+config_usage_LDADD=       $(LDADD_UTILS)
+
+trp_tcp_client_LDADD=     $(LDADD_RL)
+trp_tcp_server_LDADD=     $(LDADD_RL)
+trp_file_client_LDADD=    $(LDADD_RL)
+trp_file_server_LDADD=    $(LDADD_RL)
+
+#gs_example_send_LDADD=    $(LDADD_UTILS)
+#gs_example_receive_LDADD= $(LDADD_UTILS)
 
 
-test: $(noinst_PROGRAMS)
-       ./run_tests
diff --git a/testsuite/gras/test_utils.c b/testsuite/gras/test_utils.c
deleted file mode 100644 (file)
index b55b576..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include <gras.h>
-
-void parse_log_opt(int argc, char **argv,const char *deft);
-
-void parse_log_opt(int argc, char **argv,const char *deft) {
-   char *opt;
-   gras_error_t errcode;
-   
-   if (argc > 1 && !strncmp(argv[1],"--gras-log=",strlen("--gras-log="))) {
-    opt=strchr(argv[1],'=');
-    opt++;
-    TRYFAIL(gras_log_control_set(opt));
-  } else {
-    TRYFAIL(gras_log_control_set(deft));
-  }
-}
-
diff --git a/testsuite/gras/trp_file_client.c b/testsuite/gras/trp_file_client.c
new file mode 100644 (file)
index 0000000..2504954
--- /dev/null
@@ -0,0 +1,34 @@
+/* $Id$ */
+
+/* trp_tcp_client: Client of a test case for the tcp transport.             */
+
+/* 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. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+  gras_socket_t * sock;
+  gras_error_t errcode;
+  char data_send[256];
+
+  gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+  fprintf(stderr,"===[CLIENT]=== Contact the server\n");
+  TRYFAIL(gras_socket_client_from_file("-",&sock));
+
+  sprintf(data_send,"Hello, I am a little test data to send.");
+  fprintf(stderr,"===[CLIENT]=== Send data\n");
+  TRYFAIL(gras_trp_chunk_send(sock,data_send, sizeof(data_send)));
+  
+  fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
+  gras_socket_close(&sock);
+  return 0;
+}
diff --git a/testsuite/gras/trp_file_server.c b/testsuite/gras/trp_file_server.c
new file mode 100644 (file)
index 0000000..e1bfb99
--- /dev/null
@@ -0,0 +1,38 @@
+/* $Id$ */
+
+/* trp_tcp_server: Server of a test case for the tcp transport.             */
+
+/* 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. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+  gras_socket_t *sock, *conn;
+  gras_error_t errcode;
+  char data_recv[256];
+
+  gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+  fprintf(stderr,"===[SERVER]=== Create the socket\n");
+  TRYFAIL(gras_socket_server_from_file("-",&sock));
+
+  fprintf(stderr,"===[SERVER]=== Waiting for incomming connexions\n");
+  TRYFAIL(gras_trp_select(60,&conn));
+
+  fprintf(stderr,"===[SERVER]=== Contacted ! Waiting for the data\n");
+  TRYFAIL(gras_trp_chunk_recv(conn,data_recv, sizeof(data_recv)));
+  fprintf(stderr,"===[SERVER]=== Got '%s'.\n", data_recv);
+
+  fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
+  gras_socket_close(&sock);
+
+  return 0;
+}
diff --git a/testsuite/gras/trp_file_usage.in b/testsuite/gras/trp_file_usage.in
new file mode 100644 (file)
index 0000000..4d17f50
--- /dev/null
@@ -0,0 +1,4 @@
+#! @BASH@ -e
+
+./trp_file_client $@ | ./trp_file_server $@ 
+
diff --git a/testsuite/gras/trp_tcp_client.c b/testsuite/gras/trp_tcp_client.c
new file mode 100644 (file)
index 0000000..671e283
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id$ */
+
+/* trp_tcp_client: Client of a test case for the tcp transport.             */
+
+/* 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. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+  gras_socket_t * sock;
+  gras_error_t errcode;
+  char data_send[256];
+  char data_recv[256];
+
+  gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+  fprintf(stderr,"===[CLIENT]=== Contact the server\n");
+  TRYFAIL(gras_socket_client(NULL,55555,&sock));
+
+  sprintf(data_send,"Hello, I am a little test data to send.");
+  fprintf(stderr,"===[CLIENT]=== Send data\n");
+  TRYFAIL(gras_trp_chunk_send(sock,data_send, sizeof(data_send)));
+  fprintf(stderr,"===[CLIENT]=== Waiting for the ACK\n");
+  TRYFAIL(gras_trp_chunk_recv(sock,data_recv, sizeof(data_recv)));
+  
+  if (strcmp(data_send, data_recv)) {
+    fprintf(stderr, "===[CLIENT]=== String sent != string received\n");
+    exit(1);
+  } 
+  fprintf(stderr,"===[CLIENT]=== Got a valid ACK\n");
+  
+  fprintf(stderr,"===[CLIENT]=== Exiting successfully\n");
+  gras_socket_close(&sock);
+  return 0;
+}
diff --git a/testsuite/gras/trp_tcp_server.c b/testsuite/gras/trp_tcp_server.c
new file mode 100644 (file)
index 0000000..7c33b47
--- /dev/null
@@ -0,0 +1,40 @@
+/* $Id$ */
+
+/* trp_tcp_server: Server of a test case for the tcp transport.             */
+
+/* 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. */
+
+#include <stdio.h>
+#include <gras.h>
+#include "../Transport/transport_interface.h"
+
+//GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
+
+int main(int argc,char *argv[]) {
+  gras_socket_t *sock, *conn;
+  gras_error_t errcode;
+  char data_recv[256];
+
+  gras_init_defaultlog(argc,argv,"trp.thresh=debug");
+
+  fprintf(stderr,"===[SERVER]=== Create the socket\n");
+  TRYFAIL(gras_socket_server(55555,&sock));
+
+  fprintf(stderr,"===[SERVER]=== Waiting for incomming connexions\n");
+  TRYFAIL(gras_trp_select(60,&conn));
+
+  fprintf(stderr,"===[SERVER]=== Contacted ! Waiting for the data\n");
+  TRYFAIL(gras_trp_chunk_recv(conn,data_recv, sizeof(data_recv)));
+  fprintf(stderr,"===[SERVER]=== Got '%s'. Send it back.\n", data_recv);
+  TRYFAIL(gras_trp_chunk_send(conn,data_recv, sizeof(data_recv)));
+  gras_socket_close(&conn);
+
+  fprintf(stderr,"===[SERVER]=== Exiting successfully\n");
+  gras_socket_close(&sock);
+
+  return 0;
+}
diff --git a/testsuite/gras/trp_tcp_usage.in b/testsuite/gras/trp_tcp_usage.in
new file mode 100644 (file)
index 0000000..af417ae
--- /dev/null
@@ -0,0 +1,6 @@
+#! @BASH@ -e
+
+./trp_tcp_server $@ &
+sleep 1
+./trp_tcp_client $@ 
+
index e47e2a1..ab6f278 100644 (file)
@@ -48,14 +48,12 @@ int test5()
   return 1;
 }
  
   return 1;
 }
  
-void parse_log_opt(int argc, char **argv,const char *deft);
-
 int main(int argc, char **argv) {
   gras_error_t errcode;
   gras_cfg_t *set;
   int ival;
   
 int main(int argc, char **argv) {
   gras_error_t errcode;
   gras_cfg_t *set;
   int ival;
   
-  parse_log_opt(argc,argv,"config.thresh=debug root.thresh=info");
+  gras_init_defaultlog(argc,argv,"config.thresh=debug root.thresh=info");
 
   fprintf(stderr,"==== Alloc and free a config set.\n");
   set=make_set();
 
   fprintf(stderr,"==== Alloc and free a config set.\n");
   set=make_set();
index cf7c23b..0139085 100644 (file)
@@ -48,8 +48,6 @@ static gras_error_t countelems(gras_dict_t *head,int*count) {
   return no_error;
 }
 
   return no_error;
 }
 
-void parse_log_opt(int argc, char **argv, const char *deft);
-
 int main(int argc,char **argv) {
   gras_error_t errcode;
   gras_dict_t *head=NULL;
 int main(int argc,char **argv) {
   gras_error_t errcode;
   gras_dict_t *head=NULL;
@@ -57,7 +55,7 @@ int main(int argc,char **argv) {
   char *key;
   void *data;
 
   char *key;
   void *data;
 
-  parse_log_opt(argc,argv,"dict.thresh=verbose");
+  gras_init_defaultlog(argc,argv,"dict.thresh=verbose");
   srand((unsigned int)time(NULL));
 
   printf("Dictionnary: CRASH test:\n");
   srand((unsigned int)time(NULL));
 
   printf("Dictionnary: CRASH test:\n");
index ef3755f..72542d6 100644 (file)
@@ -96,14 +96,12 @@ static gras_error_t traverse(gras_dict_t *head) {
   return no_error;
 }
 
   return no_error;
 }
 
-void parse_log_opt(int argc, char **argv,const char *deft);
-
 int main(int argc,char **argv) {
   gras_error_t errcode;
   gras_dict_t *head=NULL;
   char *data;
 
 int main(int argc,char **argv) {
   gras_error_t errcode;
   gras_dict_t *head=NULL;
   char *data;
 
-  parse_log_opt(argc,argv,"dict.thresh=verbose");
+  gras_init_defaultlog(argc,argv,"dict.thresh=verbose");
    
   printf("\nGeneric dictionnary: USAGE test:\n");
 
    
   printf("\nGeneric dictionnary: USAGE test:\n");
 
@@ -167,8 +165,6 @@ int main(int argc,char **argv) {
   TRYFAIL(traverse(head));
 
   gras_dict_free(&head);
   TRYFAIL(traverse(head));
 
   gras_dict_free(&head);
-  gras_finalize();
-  return 0;
 
   TRYCATCH(debuged_remove(head,"12345"),mismatch_error);
   TRYFAIL(traverse(head));
 
   TRYCATCH(debuged_remove(head,"12345"),mismatch_error);
   TRYFAIL(traverse(head));
@@ -186,5 +182,6 @@ int main(int argc,char **argv) {
   printf(" - Free the dictionnary twice\n");
   gras_dict_free(&head);
   gras_dict_free(&head);
   printf(" - Free the dictionnary twice\n");
   gras_dict_free(&head);
   gras_dict_free(&head);
+  gras_exit();
   return 0;
 }
   return 0;
 }
index d85025e..1acaeb0 100644 (file)
 #include <stdio.h>
 #include <gras.h>
 
 #include <stdio.h>
 #include <gras.h>
 
-void parse_log_opt(int argc, char **argv,const char *deft);
-
 int main(int argc,char *argv[]) {
    gras_dynar_t *d;
    gras_error_t errcode;
    int cpt,cursor;
    double d1,d2;
    
 int main(int argc,char *argv[]) {
    gras_dynar_t *d;
    gras_error_t errcode;
    int cpt,cursor;
    double d1,d2;
    
-   parse_log_opt(argc,argv,"dynar.thresh=debug");
+   gras_init_defaultlog(argc,argv,"dynar.thresh=debug");
 
    fprintf(stderr,"==== Traverse the empty dynar\n");
    TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
 
    fprintf(stderr,"==== Traverse the empty dynar\n");
    TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
@@ -141,6 +139,6 @@ int main(int argc,char *argv[]) {
    }
    gras_dynar_free(d);
 
    }
    gras_dynar_free(d);
 
-   gras_finalize();
+   gras_exit();
    return 0;
 }
    return 0;
 }
index 0dc8641..70d3529 100644 (file)
 #define NB_ELEM 5000
 GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
 
 #define NB_ELEM 5000
 GRAS_LOG_NEW_DEFAULT_CATEGORY(test);
 
-void parse_log_opt(int argc, char **argv, const char *def);
-
 int main(int argc,char *argv[]) {
    gras_dynar_t *d;
    gras_error_t errcode;
    int i,cpt,cursor;
    
 int main(int argc,char *argv[]) {
    gras_dynar_t *d;
    gras_error_t errcode;
    int i,cpt,cursor;
    
-   parse_log_opt(argc,argv,"dynar.thresh=debug");
+   gras_init_defaultlog(argc,argv,"dynar.thresh=debug");
 
    fprintf(stderr,"==== Traverse the empty dynar\n");
    TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
 
    fprintf(stderr,"==== Traverse the empty dynar\n");
    TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
index 7c8bc40..7c755d9 100644 (file)
@@ -20,8 +20,6 @@ void free_string(void *d){
   free(*(void**)d);
 }
 
   free(*(void**)d);
 }
 
-void parse_log_opt(int argc, char **argv,const char *deft);
-
 int main(int argc,char *argv[]) {
    gras_dynar_t *d;
    gras_error_t errcode;
 int main(int argc,char *argv[]) {
    gras_dynar_t *d;
    gras_error_t errcode;
@@ -29,7 +27,7 @@ int main(int argc,char *argv[]) {
    char buf[1024];
    char *s1,*s2;
    
    char buf[1024];
    char *s1,*s2;
    
-   parse_log_opt(argc,argv,"dynar.thresh=debug");
+   gras_init_defaultlog(argc,argv,"dynar.thresh=debug");
    
    fprintf(stderr,"==== Traverse the empty dynar\n");
    TRYFAIL(gras_dynar_new(&d,sizeof(char *),&free_string));
    
    fprintf(stderr,"==== Traverse the empty dynar\n");
    TRYFAIL(gras_dynar_new(&d,sizeof(char *),&free_string));
index c86c44b..e2a277a 100644 (file)
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(Test, Top);
 GRAS_LOG_NEW_CATEGORY(Top);
 
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(Test, Top);
 GRAS_LOG_NEW_CATEGORY(Top);
 
-void parse_log_opt(int argc, char **argv,const char *deft);
-
 int main(int argc, char **argv) {
 int main(int argc, char **argv) {
-  parse_log_opt(argc,argv,"root.thresh=debug log.thresh=debug");
+  gras_init_defaultlog(argc,argv,"root.thresh=debug log.thresh=debug");
 
   DEBUG1("val=%d", 1);
   WARNING1("val=%d", 2);
   CDEBUG2(Top, "val=%d%s", 3, "!");
   CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!");
   
 
   DEBUG1("val=%d", 1);
   WARNING1("val=%d", 2);
   CDEBUG2(Top, "val=%d%s", 3, "!");
   CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!");
   
-  gras_finalize();
+  gras_exit();
   return 0;
 }
   return 0;
 }
index 6db7d21..e9eecdd 100644 (file)
@@ -161,14 +161,12 @@ static gras_error_t traverse(gras_set_t *set) {
   return no_error;
 }
 
   return no_error;
 }
 
-void parse_log_opt(int argc, char **argv,const char *deft);
-
 int main(int argc,char **argv) {
   gras_error_t errcode;
   gras_set_t *set=NULL;
   my_elem_t *elm;
 
 int main(int argc,char **argv) {
   gras_error_t errcode;
   gras_set_t *set=NULL;
   my_elem_t *elm;
 
-  parse_log_opt(argc,argv,"set.thresh=verbose");
+  gras_init_defaultlog(argc,argv,"set.thresh=verbose");
    
   printf("\nData set: USAGE test:\n");
 
    
   printf("\nData set: USAGE test:\n");