[gdl] Update to current cvs

Orion Poplawski orion at fedoraproject.org
Tue Jul 17 02:17:18 UTC 2012


commit 742d2204c4acb6b6ec949bb8b83b58df8fe60897
Author: Orion Poplawski <orion at cora.nwra.com>
Date:   Mon Jul 16 20:16:55 2012 -0600

    Update to current cvs

 gdl-0.9.2-cvs.patch | 6725 ++++++++++++++++++++++++++++++++++++++++++++++-----
 gdl.spec            |    5 +-
 2 files changed, 6177 insertions(+), 553 deletions(-)
---
diff --git a/gdl-0.9.2-cvs.patch b/gdl-0.9.2-cvs.patch
index 92ff646..16b6119 100644
--- a/gdl-0.9.2-cvs.patch
+++ b/gdl-0.9.2-cvs.patch
@@ -1,6 +1,6 @@
 diff -ruN --exclude CVS gdl-0.9.2/CMakeLists.txt gdl/CMakeLists.txt
 --- gdl-0.9.2/CMakeLists.txt	2011-11-06 15:39:45.000000000 -0700
-+++ gdl/CMakeLists.txt	2012-02-21 09:54:30.323132942 -0700
++++ gdl/CMakeLists.txt	2012-02-19 04:21:43.000000000 -0700
 @@ -8,13 +8,13 @@
  #
  
@@ -251,7 +251,7 @@ diff -ruN --exclude CVS gdl-0.9.2/CMakeLists.txt gdl/CMakeLists.txt
  
 diff -ruN --exclude CVS gdl-0.9.2/CMakeModules/FindNumpy.cmake gdl/CMakeModules/FindNumpy.cmake
 --- gdl-0.9.2/CMakeModules/FindNumpy.cmake	2011-08-19 04:18:51.000000000 -0600
-+++ gdl/CMakeModules/FindNumpy.cmake	2012-02-21 09:54:32.261062619 -0700
++++ gdl/CMakeModules/FindNumpy.cmake	2012-01-02 14:28:12.000000000 -0700
 @@ -19,7 +19,7 @@
    set (PYTHON_NUMPY_FIND_QUIETLY TRUE)
  endif (PYTHON_NUMPY_INCLUDE_DIR)
@@ -282,7 +282,7 @@ diff -ruN --exclude CVS gdl-0.9.2/CMakeModules/FindNumpy.cmake gdl/CMakeModules/
  if (PYTHON_NUMPY_FOUND)
 diff -ruN --exclude CVS gdl-0.9.2/config.h.cmake gdl/config.h.cmake
 --- gdl-0.9.2/config.h.cmake	2010-09-02 13:43:21.000000000 -0600
-+++ gdl/config.h.cmake	2012-02-21 09:54:31.747081269 -0700
++++ gdl/config.h.cmake	2011-12-31 02:08:24.000000000 -0700
 @@ -64,5 +64,6 @@
  #cmakedefine USE_NETCDF 1
  #cmakedefine USE_PYTHON 1
@@ -1406,7 +1406,7 @@ diff -ruN --exclude CVS gdl-0.9.2/config.log gdl/config.log
 -configure: exit 255
 diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
 --- gdl-0.9.2/configure	2011-11-08 17:27:35.000000000 -0700
-+++ gdl/configure	2012-02-21 09:54:31.892076009 -0700
++++ gdl/configure	2012-06-28 03:54:53.000000000 -0600
 @@ -1,6 +1,6 @@
  #! /bin/sh
  # Guess values for system-dependent variables and create Makefiles.
@@ -1426,7 +1426,23 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  PACKAGE_BUGREPORT=''
  PACKAGE_URL=''
  
-@@ -1339,7 +1339,7 @@
+@@ -628,6 +628,7 @@
+ PYTHON_VERSION
+ PYTHON
+ nc_config
++GraphicsMagickConfig
+ XMKMF
+ MagickConfig
+ wxConfig
+@@ -770,6 +771,7 @@
+ with_wxWidgets
+ with_Magick
+ with_x
++with_GraphicsMagick
+ with_netcdf
+ with_hdf
+ with_hdf5
+@@ -1339,7 +1341,7 @@
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat <<_ACEOF
@@ -1435,7 +1451,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  
  Usage: $0 [OPTION]... [VAR=VALUE]...
  
-@@ -1413,7 +1413,7 @@
+@@ -1413,7 +1415,7 @@
  
  if test -n "$ac_init_help"; then
    case $ac_init_help in
@@ -1444,7 +1460,15 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
     esac
    cat <<\_ACEOF
  
-@@ -1541,7 +1541,7 @@
+@@ -1449,6 +1451,7 @@
+   --with-wxWidgets=DIR    use wxWidgets (with optional path DIR)
+   --with-Magick=DIR       use ImageMagick package (with optional path DIR)
+   --with-x                use the X Window System
++  --with-GraphicsMagick=DIR  use GraphicsMagick package (with optional path DIR)
+   --with-netcdf=DIR       use netCDF package (with optional path DIR)
+   --with-hdf=DIR          use HDF package (with optional path DIR)
+   --with-hdf5=DIR         use HDF5 package (with optional path DIR)
+@@ -1541,7 +1544,7 @@
  test -n "$ac_init_help" && exit $ac_status
  if $ac_init_version; then
    cat <<\_ACEOF
@@ -1453,7 +1477,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  generated by GNU Autoconf 2.68
  
  Copyright (C) 2010 Free Software Foundation, Inc.
-@@ -2125,7 +2125,7 @@
+@@ -2125,7 +2128,7 @@
  This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.
  
@@ -1462,7 +1486,15 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  generated by GNU Autoconf 2.68.  Invocation command line was
  
    $ $0 $@
-@@ -2971,7 +2971,7 @@
+@@ -2483,6 +2486,7 @@
+ if test "x$with_udunits"     = "x"; then with_udunits=no;      fi
+ if test "x$with_grib"        = "x"; then with_grib=no;         fi
+ if test "x$with_Magick"      = "x"; then with_Magick=yes;      fi
++if test "x$with_GraphicsMagick" = "x"; then with_GraphicsMagick=no;      fi
+ if test "x$with_netcdf"      = "x"; then with_netcdf=yes;      fi
+ if test "x$with_hdf"         = "x"; then with_hdf=yes;         fi
+ if test "x$with_hdf5"        = "x"; then with_hdf5=yes;        fi
+@@ -2971,7 +2975,7 @@
  
  # Define the identity of the package.
   PACKAGE='gdl'
@@ -1471,7 +1503,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  
  
  cat >>confdefs.h <<_ACEOF
-@@ -3509,13 +3509,13 @@
+@@ -3509,13 +3513,13 @@
    CXXFLAGS=$ac_save_CXXFLAGS
  elif test $ac_cv_prog_cxx_g = yes; then
    if test "$GXX" = yes; then
@@ -1487,7 +1519,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
    else
      CXXFLAGS=
    fi
-@@ -4404,13 +4404,13 @@
+@@ -4404,13 +4408,13 @@
    CFLAGS=$ac_save_CFLAGS
  elif test $ac_cv_prog_cc_g = yes; then
    if test "$GCC" = yes; then
@@ -1503,7 +1535,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
    else
      CFLAGS=
    fi
-@@ -15588,6 +15588,7 @@
+@@ -15588,6 +15592,7 @@
  	echo "       Check the README or use configure --help for other libraries needed"
          echo ""
          echo "       (suitable Debian/Ubuntu package: libreadline5-dev)"
@@ -1511,7 +1543,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  	exit -1
  
  fi
-@@ -15717,6 +15718,7 @@
+@@ -15717,6 +15722,7 @@
   	echo "       Use --with-zlibdir=DIR to specify the zlib directory tree"
          echo ""
          echo "       (suitable Debian/Ubuntu package: zlib1g-dev)"
@@ -1519,7 +1551,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
   	exit -1
  
  fi
-@@ -15843,6 +15845,7 @@
+@@ -15843,6 +15849,7 @@
  	echo "Error! Gnu Scientific Library (1.7 or higher) is mandatory"
          echo ""
          echo "       (suitable Debian/Ubuntu package: libgsl0-dev)"
@@ -1527,7 +1559,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
          exit -1
  
  fi
-@@ -15986,6 +15989,7 @@
+@@ -15986,6 +15993,7 @@
  	echo "       Use --with-plplot=DIR to specify the plplot directory tree"
          echo ""
          echo "       (suitable Debian/Ubuntu packages: libplplot-dev, plplot9-driver-xwin)"
@@ -1535,7 +1567,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  	exit -1
  
  fi
-@@ -16149,6 +16153,7 @@
+@@ -16149,6 +16157,7 @@
      echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
      echo ""
      echo "       (suitable Debian/Ubuntu package: libwxgtk2.8-dev)"
@@ -1543,7 +1575,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
    else
      LIBS="$LIBS `wx-config --libs`"
-@@ -16279,6 +16284,7 @@
+@@ -16279,6 +16288,7 @@
        Use --with-Magick=no  to not use it
  
        (suitable Debian/Ubuntu package: libmagick++-dev)
@@ -1551,15 +1583,425 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      " "$LINENO" 5
    else
      LIBS="$LIBS `$MagickConfig --libs`"
-@@ -16575,6 +16581,7 @@
+@@ -16574,7 +16584,416 @@
+         echo "       Check the README or use configure --help for other libraries needed"
          echo "       (--with-xxxdir = mandatory, --with-xxx = optional (--with-xxx=no to disable))"
          echo ""
-         echo "       (suitable Debian/Ubuntu package: libmagick-dev)"
+-        echo "       (suitable Debian/Ubuntu package: libmagick-dev)"
++        echo "       (suitable Debian/Ubuntu package: libmagick++-dev)"
 +        echo "       (suitable Fedora package: ImageMagick-c++-devel)"
++        exit -1
++
++fi
++
++
++
++fi
++
++fi
++
++
++# Check whether --with-GraphicsMagick was given.
++if test "${with_GraphicsMagick+set}" = set; then :
++  withval=$with_GraphicsMagick; with_GraphicsMagick="$withval"
++fi
++
++
++if test "x$with_GraphicsMagick" != "xno"; then
++  if test "x$with_GraphicsMagick" = "xyes"; then
++    # Extract the first word of "GraphicsMagick++-config", so it can be a program name with args.
++set dummy GraphicsMagick++-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_path_GraphicsMagickConfig+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  case $GraphicsMagickConfig in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_GraphicsMagickConfig="$GraphicsMagickConfig" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_GraphicsMagickConfig="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  test -z "$ac_cv_path_GraphicsMagickConfig" && ac_cv_path_GraphicsMagickConfig="no"
++  ;;
++esac
++fi
++GraphicsMagickConfig=$ac_cv_path_GraphicsMagickConfig
++if test -n "$GraphicsMagickConfig"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GraphicsMagickConfig" >&5
++$as_echo "$GraphicsMagickConfig" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++  else
++    # Extract the first word of "GraphicsMagick++-config", so it can be a program name with args.
++set dummy GraphicsMagick++-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_path_GraphicsMagickConfig+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  case $GraphicsMagickConfig in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_GraphicsMagickConfig="$GraphicsMagickConfig" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in "$with_GraphicsMagick/bin"
++do
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
++    ac_cv_path_GraphicsMagickConfig="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  test -z "$ac_cv_path_GraphicsMagickConfig" && ac_cv_path_GraphicsMagickConfig="no"
++  ;;
++esac
++fi
++GraphicsMagickConfig=$ac_cv_path_GraphicsMagickConfig
++if test -n "$GraphicsMagickConfig"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GraphicsMagickConfig" >&5
++$as_echo "$GraphicsMagickConfig" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++  fi
++
++  if test "x$GraphicsMagickConfig" = "xno"; then
++    as_fn_error $? "GraphicsMagick is required but was not found (GraphicsMagick++-config program not found)
++      Use --with-GraphicsMagick=DIR to specify the GraphicsMagick directory tree
++      Use --with-GraphicsMagick=no  to not use it
++
++      (suitable Debian/Ubuntu package: libmagick++-dev)
++      (suitable Fedora package: GraphicsMagick-c++-devel)
++    " "$LINENO" 5
++  else
++    LIBS="$LIBS `$GraphicsMagickConfig --libs`"
++    INCLUDES="$INCLUDES `$GraphicsMagickConfig --cppflags`"
++    LDFLAGS="$LDFLAGS `$GraphicsMagickConfig --ldflags`"
++  fi
++
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GetMagickVersion in -lGraphicsMagick++" >&5
++$as_echo_n "checking for GetMagickVersion in -lGraphicsMagick++... " >&6; }
++if ${ac_cv_lib_GraphicsMagickpp_GetMagickVersion+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lGraphicsMagick++  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char GetMagickVersion ();
++int
++main ()
++{
++return GetMagickVersion ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++  ac_cv_lib_GraphicsMagickpp_GetMagickVersion=yes
++else
++  ac_cv_lib_GraphicsMagickpp_GetMagickVersion=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GraphicsMagickpp_GetMagickVersion" >&5
++$as_echo "$ac_cv_lib_GraphicsMagickpp_GetMagickVersion" >&6; }
++if test "x$ac_cv_lib_GraphicsMagickpp_GetMagickVersion" = xyes; then :
++
++$as_echo "#define USE_MAGICK 1" >>confdefs.h
++
++else
++
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking if adding X library path helps" >&5
++$as_echo_n "checking if adding X library path helps... " >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ?" >&5
++$as_echo "?" >&6; }
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
++$as_echo_n "checking for X... " >&6; }
++
++
++# Check whether --with-x was given.
++if test "${with_x+set}" = set; then :
++  withval=$with_x;
++fi
++
++# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
++if test "x$with_x" = xno; then
++  # The user explicitly disabled X.
++  have_x=disabled
++else
++  case $x_includes,$x_libraries in #(
++    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
++    *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  # One or both of the vars are not set, and there is no cached value.
++ac_x_includes=no ac_x_libraries=no
++rm -f -r conftest.dir
++if mkdir conftest.dir; then
++  cd conftest.dir
++  cat >Imakefile <<'_ACEOF'
++incroot:
++	@echo incroot='${INCROOT}'
++usrlibdir:
++	@echo usrlibdir='${USRLIBDIR}'
++libdir:
++	@echo libdir='${LIBDIR}'
++_ACEOF
++  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
++    # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
++    for ac_var in incroot usrlibdir libdir; do
++      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
++    done
++    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
++    for ac_extension in a so sl dylib la dll; do
++      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
++	 test -f "$ac_im_libdir/libX11.$ac_extension"; then
++	ac_im_usrlibdir=$ac_im_libdir; break
++      fi
++    done
++    # Screen out bogus values from the imake configuration.  They are
++    # bogus both because they are the default anyway, and because
++    # using them would break gcc on systems where it needs fixed includes.
++    case $ac_im_incroot in
++	/usr/include) ac_x_includes= ;;
++	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
++    esac
++    case $ac_im_usrlibdir in
++	/usr/lib | /usr/lib64 | /lib | /lib64) ;;
++	*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
++    esac
++  fi
++  cd ..
++  rm -f -r conftest.dir
++fi
++
++# Standard set of common directories for X headers.
++# Check X11 before X11Rn because it is often a symlink to the current release.
++ac_x_header_dirs='
++/usr/X11/include
++/usr/X11R7/include
++/usr/X11R6/include
++/usr/X11R5/include
++/usr/X11R4/include
++
++/usr/include/X11
++/usr/include/X11R7
++/usr/include/X11R6
++/usr/include/X11R5
++/usr/include/X11R4
++
++/usr/local/X11/include
++/usr/local/X11R7/include
++/usr/local/X11R6/include
++/usr/local/X11R5/include
++/usr/local/X11R4/include
++
++/usr/local/include/X11
++/usr/local/include/X11R7
++/usr/local/include/X11R6
++/usr/local/include/X11R5
++/usr/local/include/X11R4
++
++/usr/X386/include
++/usr/x386/include
++/usr/XFree86/include/X11
++
++/usr/include
++/usr/local/include
++/usr/unsupported/include
++/usr/athena/include
++/usr/local/x11r5/include
++/usr/lpp/Xamples/include
++
++/usr/openwin/include
++/usr/openwin/share/include'
++
++if test "$ac_x_includes" = no; then
++  # Guess where to find include files, by looking for Xlib.h.
++  # First, try using that file with no special directory specified.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <X11/Xlib.h>
++_ACEOF
++if ac_fn_cxx_try_cpp "$LINENO"; then :
++  # We can compile using X headers with no special include directory.
++ac_x_includes=
++else
++  for ac_dir in $ac_x_header_dirs; do
++  if test -r "$ac_dir/X11/Xlib.h"; then
++    ac_x_includes=$ac_dir
++    break
++  fi
++done
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
++fi # $ac_x_includes = no
++
++if test "$ac_x_libraries" = no; then
++  # Check for the libraries.
++  # See if we find them without any special options.
++  # Don't add to $LIBS permanently.
++  ac_save_LIBS=$LIBS
++  LIBS="-lX11 $LIBS"
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <X11/Xlib.h>
++int
++main ()
++{
++XrmInitialize ()
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++  LIBS=$ac_save_LIBS
++# We can link X programs with no special library path.
++ac_x_libraries=
++else
++  LIBS=$ac_save_LIBS
++for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
++do
++  # Don't even attempt the hair of trying to link an X program!
++  for ac_extension in a so sl dylib la dll; do
++    if test -r "$ac_dir/libX11.$ac_extension"; then
++      ac_x_libraries=$ac_dir
++      break 2
++    fi
++  done
++done
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++fi # $ac_x_libraries = no
++
++case $ac_x_includes,$ac_x_libraries in #(
++  no,* | *,no | *\'*)
++    # Didn't find X, or a directory has "'" in its name.
++    ac_cv_have_x="have_x=no";; #(
++  *)
++    # Record where we found X for the cache.
++    ac_cv_have_x="have_x=yes\
++	ac_x_includes='$ac_x_includes'\
++	ac_x_libraries='$ac_x_libraries'"
++esac
++fi
++;; #(
++    *) have_x=yes;;
++  esac
++  eval "$ac_cv_have_x"
++fi # $with_x != no
++
++if test "$have_x" != yes; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
++$as_echo "$have_x" >&6; }
++  no_x=yes
++else
++  # If each of the values was on the command line, it overrides each guess.
++  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
++  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
++  # Update the cache value to reflect the command line values.
++  ac_cv_have_x="have_x=yes\
++	ac_x_includes='$x_includes'\
++	ac_x_libraries='$x_libraries'"
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
++$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
++fi
++
++      LDFLAGS="$LDFLAGS -L$x_libraries"
++      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GetMagickReleaseDate in -lGraphicsMagick++" >&5
++$as_echo_n "checking for GetMagickReleaseDate in -lGraphicsMagick++... " >&6; }
++if ${ac_cv_lib_GraphicsMagickpp_GetMagickReleaseDate+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lGraphicsMagick++  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char GetMagickReleaseDate ();
++int
++main ()
++{
++return GetMagickReleaseDate ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++  ac_cv_lib_GraphicsMagickpp_GetMagickReleaseDate=yes
++else
++  ac_cv_lib_GraphicsMagickpp_GetMagickReleaseDate=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GraphicsMagickpp_GetMagickReleaseDate" >&5
++$as_echo "$ac_cv_lib_GraphicsMagickpp_GetMagickReleaseDate" >&6; }
++if test "x$ac_cv_lib_GraphicsMagickpp_GetMagickReleaseDate" = xyes; then :
++  $as_echo "#define USE_MAGICK 1" >>confdefs.h
++
++else
++
++        echo ""
++        echo "Error! GraphicsMagick version 1.3 or later is required but was not found"
++        echo "       Use --with-GraphicsMagick=DIR to specify the GraphicsMagick directory tree"
++        echo "       Use --with-GraphicsMagick=no  to not use it"
++        echo "       Check the README or use configure --help for other libraries needed"
++        echo "       (--with-xxxdir = mandatory, --with-xxx = optional (--with-xxx=no to disable))"
++        echo ""
++        echo "       (suitable Debian/Ubuntu package: libgraphicsmagick++-dev)"
++        echo "       (suitable Fedora package: graphicsMagick-c++-devel)"
          exit -1
  
  fi
-@@ -16746,6 +16753,7 @@
+@@ -16746,6 +17165,7 @@
      echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
      echo ""
      echo "       (suitable Debian/Ubuntu package: libnetcdf-dev)"
@@ -1567,7 +2009,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
  
  fi
-@@ -17168,6 +17176,7 @@
+@@ -17168,6 +17588,7 @@
      echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
      echo ""
      echo "       (suitable Debian/Ubuntu package: libhdf5-serial-dev)"
@@ -1575,7 +2017,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
  
  fi
-@@ -17331,6 +17340,7 @@
+@@ -17331,6 +17752,7 @@
      echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
      echo ""
      echo "       (suitable Debian/Ubuntu package: libfftw3-dev)"
@@ -1583,7 +2025,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
  
  fi
-@@ -17893,6 +17903,7 @@
+@@ -17893,6 +18315,7 @@
      echo "       Use --with-python=no  to not use it"
      echo ""
      echo "       (suitable Debian/Ubuntu package: python$PYTHON_VERSION-dev)"
@@ -1591,7 +2033,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
  
  fi
-@@ -18009,6 +18020,7 @@
+@@ -18009,6 +18432,7 @@
      echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
      echo ""
      echo "       (suitable Debian/Ubuntu package: libudunits2-dev)"
@@ -1599,7 +2041,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
  
  fi
-@@ -18240,6 +18252,7 @@
+@@ -18240,6 +18664,7 @@
              echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
              echo ""
              echo "       (suitable Debian/Ubuntu package: libgrib-api-dev)"
@@ -1607,7 +2049,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
              exit -1
  
  fi
-@@ -18571,6 +18584,7 @@
+@@ -18571,6 +18996,7 @@
      echo "       (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
      echo ""
      echo "       (suitable Debian/Ubuntu package: pslib-dev)"
@@ -1615,7 +2057,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
      exit -1
  
  fi
-@@ -19275,7 +19289,7 @@
+@@ -19275,7 +19701,7 @@
  # report actual input values of CONFIG_FILES etc. instead of their
  # values after options handling.
  ac_log="
@@ -1624,7 +2066,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  generated by GNU Autoconf 2.68.  Invocation command line was
  
    CONFIG_FILES    = $CONFIG_FILES
-@@ -19341,7 +19355,7 @@
+@@ -19341,7 +19767,7 @@
  cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
  ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
  ac_cs_version="\\
@@ -1633,6 +2075,29 @@ diff -ruN --exclude CVS gdl-0.9.2/configure gdl/configure
  configured by $0, generated by GNU Autoconf 2.68,
    with options \\"\$ac_cs_config\\"
  
+@@ -21404,6 +21830,8 @@
+     then echo 'no'; else echo yes; fi`
+   Magick:              `if test no = $with_Magick;
+     then echo 'no'; else echo yes; fi`
++  GraphicsMagick:      `if test no = $with_GraphicsMagick;
++    then echo 'no'; else echo yes; fi`
+   NetCDF:              `if test no = $with_netcdf;
+     then echo 'no'; else echo yes; fi`
+   HDF4:                `if test no = $with_hdf;
+@@ -21442,4 +21870,13 @@
+   use 'make' to build and 'make install' to install GDL
+   (optional 'make check' tests the build - experimental)
+ "
++echo "
++*********************** WARNING ******************************
++We plan to drop support for Autotools-based configuration
++(i.e. the configure script) and switch to CMake. If possible,
++please try to compile GDL with CMake (e.g. by typing \"cmake .\"
++instead of \"./configure\") and please do report any problems.
++Consult INSTALL.CMake for help on passing options to CMake.
++**************************************************************
++"
+ 
 diff -ruN --exclude CVS gdl-0.9.2/configure~ gdl/configure~
 --- gdl-0.9.2/configure~	2011-11-08 17:26:43.000000000 -0700
 +++ gdl/configure~	1969-12-31 17:00:00.000000000 -0700
@@ -23084,7 +23549,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure~ gdl/configure~
 -
 diff -ruN --exclude CVS gdl-0.9.2/configure.in gdl/configure.in
 --- gdl-0.9.2/configure.in	2011-11-08 16:44:26.000000000 -0700
-+++ gdl/configure.in	2012-05-10 15:10:01.151623514 -0600
++++ gdl/configure.in	2012-05-10 03:21:15.000000000 -0600
 @@ -1,4 +1,4 @@
 -AC_INIT(gdl, 0.9.2)
 +AC_INIT(gdl, 0.9.2 CVS)
@@ -23290,7 +23755,7 @@ diff -ruN --exclude CVS gdl-0.9.2/configure.in gdl/configure.in
  dnl == EOF =================================================
 diff -ruN --exclude CVS gdl-0.9.2/doc/gdl.1 gdl/doc/gdl.1
 --- gdl-0.9.2/doc/gdl.1	2011-10-12 17:44:01.000000000 -0600
-+++ gdl/doc/gdl.1	2012-02-21 09:54:32.287061675 -0700
++++ gdl/doc/gdl.1	2012-01-02 14:22:15.000000000 -0700
 @@ -1,4 +1,4 @@
 -.TH GDL 1 "2011-10-01" "The GDL Team"
 +.TH GDL 1 "2011-12-27" "The GDL Team"
@@ -23315,9 +23780,20 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/gdl.1 gdl/doc/gdl.1
  Influences behaviour of PYTHON procedure and PYTHON() function (available if GDL is compiled with support 
  for calling Python code)
  .TP
+diff -ruN --exclude CVS gdl-0.9.2/doc/Makefile.in gdl/doc/Makefile.in
+--- gdl-0.9.2/doc/Makefile.in	2011-11-01 17:46:37.000000000 -0600
++++ gdl/doc/Makefile.in	2012-06-28 03:54:54.000000000 -0600
+@@ -104,6 +104,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/chapters/credits.tex gdl/doc/udg/chapters/credits.tex
 --- gdl-0.9.2/doc/udg/chapters/credits.tex	2011-08-24 06:20:40.000000000 -0600
-+++ gdl/doc/udg/chapters/credits.tex	2012-02-21 09:54:32.364058881 -0700
++++ gdl/doc/udg/chapters/credits.tex	2012-01-03 03:09:18.000000000 -0700
 @@ -2,13 +2,15 @@
  
  GDL have been developed by a team of volunteers led by {\bf Marc~Schellens} --
@@ -23337,7 +23813,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/chapters/credits.tex gdl/doc/udg/chapt
  Greg~Huey, % UNIT kw for SPAWN
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/diag/broken-references gdl/doc/udg/diag/broken-references
 --- gdl-0.9.2/doc/udg/diag/broken-references	2011-08-24 06:20:40.000000000 -0600
-+++ gdl/doc/udg/diag/broken-references	2012-02-21 09:54:32.409057247 -0700
++++ gdl/doc/udg/diag/broken-references	2012-01-03 03:09:19.000000000 -0700
 @@ -27,7 +27,9 @@
  LIB.READS.FUN
  LIB.IDL-VALIDANEM.FUN
@@ -23620,7 +24096,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/arguments-abbr/arguments-abbr
 +help, strpos('kayak', 'a', 2, /reverse_search, /reverse_offset)
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/call_external_0/call_external_0.pro gdl/doc/udg/examples/call_external_0/call_external_0.pro
 --- gdl-0.9.2/doc/udg/examples/call_external_0/call_external_0.pro	2011-04-27 02:42:50.000000000 -0600
-+++ gdl/doc/udg/examples/call_external_0/call_external_0.pro	2012-02-21 09:54:32.533052749 -0700
++++ gdl/doc/udg/examples/call_external_0/call_external_0.pro	2012-01-03 03:09:23.000000000 -0700
 @@ -9,7 +9,7 @@
  $ make
  $ echo
@@ -23632,14 +24108,14 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/call_external_0/call_external
    call_external(img, 'c_nextafter', 1d308, 2d308, /d_value)
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/file_lines_0/file_lines_0.out.txt gdl/doc/udg/examples/file_lines_0/file_lines_0.out.txt
 --- gdl-0.9.2/doc/udg/examples/file_lines_0/file_lines_0.out.txt	2011-07-03 16:44:28.000000000 -0600
-+++ gdl/doc/udg/examples/file_lines_0/file_lines_0.out.txt	2012-02-21 09:54:32.572051333 -0700
++++ gdl/doc/udg/examples/file_lines_0/file_lines_0.out.txt	2012-01-03 03:09:23.000000000 -0700
 @@ -1,2 +1,2 @@
  % Compiled module: FILE_LINES.
 -        5290
 +        6335
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt gdl/doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt
 --- gdl-0.9.2/doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt	2011-04-09 15:19:14.000000000 -0600
-+++ gdl/doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt	2012-02-21 09:54:32.574051260 -0700
++++ gdl/doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt	2012-01-03 03:09:23.000000000 -0700
 @@ -1 +1 @@
 -<Expression>    STRING    = '1.8.6'
 +<Expression>    STRING    = '1.8.8'
@@ -23678,7 +24154,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/mathfunc_2/mathfunc_2.pro gdl
 +help, round(1d10), round(1d10, /l64)
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/obj_class_1/obj_class_1.out.txt gdl/doc/udg/examples/obj_class_1/obj_class_1.out.txt
 --- gdl-0.9.2/doc/udg/examples/obj_class_1/obj_class_1.out.txt	2011-04-09 15:19:14.000000000 -0600
-+++ gdl/doc/udg/examples/obj_class_1/obj_class_1.out.txt	2012-02-21 09:54:32.611049918 -0700
++++ gdl/doc/udg/examples/obj_class_1/obj_class_1.out.txt	2012-01-03 03:09:24.000000000 -0700
 @@ -1,3 +1,3 @@
 -CLASSES         STRING    = Array[23]
 -!PLT !GNUDATALANGUAGE !AXIS !VERSION !MOUSE !ERROR_STATE !VALUES !MAP !CPU !WARN IDL_SIZE FSTAT64 FSTAT FILE_INFO IDL_MEMORY IDL_MEMORY64 MACHAR 
@@ -23688,7 +24164,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/examples/obj_class_1/obj_class_1.out.t
 +IDL_MEMORY64 MACHAR DMACHAR WIDGET_BUTTON WIDGET_DROPLIST WIDGET_TEXT WIDGET_VERSION !DEVICE
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/gdl.tex gdl/doc/udg/gdl.tex
 --- gdl-0.9.2/doc/udg/gdl.tex	2011-08-24 06:20:39.000000000 -0600
-+++ gdl/doc/udg/gdl.tex	2012-02-21 09:54:32.333060003 -0700
++++ gdl/doc/udg/gdl.tex	2012-01-03 03:09:17.000000000 -0700
 @@ -112,7 +112,7 @@
    \Large a free/libre/open-source implementation of IDL/PV-WAVE\textsuperscript{*}\nnfoottext{
      \textsuperscript{*}
@@ -23700,7 +24176,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/gdl.tex gdl/doc/udg/gdl.tex
  \author{
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/makeall gdl/doc/udg/makeall
 --- gdl-0.9.2/doc/udg/makeall	2011-09-19 06:06:11.000000000 -0600
-+++ gdl/doc/udg/makeall	2012-02-21 09:54:32.345059569 -0700
++++ gdl/doc/udg/makeall	2012-01-03 03:09:17.000000000 -0700
 @@ -19,7 +19,7 @@
  echo -n "--- Generating routinelist.tmp file (may take a while) ... "
  newest=`ls -1 -t ../../src/pro/*.pro ../../src/gdl ./gdl.pro ./routinelist.pro | head -1`
@@ -23750,7 +24226,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/README.txt gdl/doc/udg/README.txt
 +Please report any broken link(s)
 diff -ruN --exclude CVS gdl-0.9.2/doc/udg/routines/appleman.pro.tex gdl/doc/udg/routines/appleman.pro.tex
 --- gdl-0.9.2/doc/udg/routines/appleman.pro.tex	2011-02-27 15:32:34.000000000 -0700
-+++ gdl/doc/udg/routines/appleman.pro.tex	2012-02-21 09:54:32.931038320 -0700
++++ gdl/doc/udg/routines/appleman.pro.tex	2012-01-03 03:09:24.000000000 -0700
 @@ -1 +1,12 @@
 -Mandelbrot set\index{Mandelbrot set}
 +Computes and optionally renders the Mandelbrot set\index{Mandelbrot set}.
@@ -23767,7 +24243,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/udg/routines/appleman.pro.tex gdl/doc/udg/
 +\gdlcodeexample{appleman_0}{}{}
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/contribute.html gdl/doc/www/contribute.html
 --- gdl-0.9.2/doc/www/contribute.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/contribute.html	2011-08-18 10:54:41.488160491 -0600
++++ gdl/doc/www/contribute.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -23780,7 +24256,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/contribute.html gdl/doc/www/contribute
 +</html>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/credits.html gdl/doc/www/credits.html
 --- gdl-0.9.2/doc/www/credits.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/credits.html	2011-08-18 10:54:41.500160072 -0600
++++ gdl/doc/www/credits.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -23950,7 +24426,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/documentation.php gdl/doc/www/document
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/download.html gdl/doc/www/download.html
 --- gdl-0.9.2/doc/www/download.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/download.html	2011-08-18 10:54:41.514159583 -0600
++++ gdl/doc/www/download.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -24084,7 +24560,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/faq.php gdl/doc/www/faq.php
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/feedback.html gdl/doc/www/feedback.html
 --- gdl-0.9.2/doc/www/feedback.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/feedback.html	2011-08-18 10:54:41.523159269 -0600
++++ gdl/doc/www/feedback.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -24160,7 +24636,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/_footer.inc.php gdl/doc/www/_footer.in
 +</html>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/_header.inc.php gdl/doc/www/_header.inc.php
 --- gdl-0.9.2/doc/www/_header.inc.php	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/_header.inc.php	2012-02-21 09:54:33.056033769 -0700
++++ gdl/doc/www/_header.inc.php	2011-12-27 10:28:24.000000000 -0700
 @@ -0,0 +1,68 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +
@@ -24232,7 +24708,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/_header.inc.php gdl/doc/www/_header.in
 +			<a name="TemplateInfo"></a>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/home.html gdl/doc/www/home.html
 --- gdl-0.9.2/doc/www/home.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/home.html	2011-08-18 10:54:41.532158954 -0600
++++ gdl/doc/www/home.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -24247,7 +24723,7 @@ Binary files gdl-0.9.2/doc/www/images/bg.jpg and gdl/doc/www/images/bg.jpg diffe
 Binary files gdl-0.9.2/doc/www/images/bullet.gif and gdl/doc/www/images/bullet.gif differ
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/images/Colourise.css gdl/doc/www/images/Colourise.css
 --- gdl-0.9.2/doc/www/images/Colourise.css	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/images/Colourise.css	2012-02-21 09:54:33.211028145 -0700
++++ gdl/doc/www/images/Colourise.css	2011-12-27 10:28:25.000000000 -0700
 @@ -0,0 +1,526 @@
 +/* ----------------------------------------------
 +	Template Name : Colourise
@@ -24779,7 +25255,7 @@ Binary files gdl-0.9.2/doc/www/images/footer-top.jpg and gdl/doc/www/images/foot
 Binary files gdl-0.9.2/doc/www/images/header-search.jpg and gdl/doc/www/images/header-search.jpg differ
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/index.html gdl/doc/www/index.html
 --- gdl-0.9.2/doc/www/index.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/index.html	2011-08-18 10:54:41.533158920 -0600
++++ gdl/doc/www/index.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html>
@@ -24887,7 +25363,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/index.php gdl/doc/www/index.php
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/menu.html gdl/doc/www/menu.html
 --- gdl-0.9.2/doc/www/menu.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/menu.html	2011-08-18 10:54:41.543158570 -0600
++++ gdl/doc/www/menu.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -24900,7 +25376,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/menu.html gdl/doc/www/menu.html
 +</html>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/_news.inc.php gdl/doc/www/_news.inc.php
 --- gdl-0.9.2/doc/www/_news.inc.php	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/_news.inc.php	2012-05-10 15:10:03.581535806 -0600
++++ gdl/doc/www/_news.inc.php	2012-05-08 03:48:44.000000000 -0600
 @@ -0,0 +1,37 @@
 +<h2>GDL 0.9.2 released</h2>
 +<p>
@@ -24941,7 +25417,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/_news.inc.php gdl/doc/www/_news.inc.ph
 +</p>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/require.html gdl/doc/www/require.html
 --- gdl-0.9.2/doc/www/require.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/require.html	2011-08-18 10:54:41.560157976 -0600
++++ gdl/doc/www/require.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -24954,7 +25430,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/require.html gdl/doc/www/require.html
 +</html>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/requirements.php gdl/doc/www/requirements.php
 --- gdl-0.9.2/doc/www/requirements.php	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/requirements.php	2011-09-20 09:46:45.499501554 -0600
++++ gdl/doc/www/requirements.php	2011-09-19 06:06:11.000000000 -0600
 @@ -0,0 +1,86 @@
 +<?php require('_header.inc.php'); ?>
 +			
@@ -25044,7 +25520,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/requirements.php gdl/doc/www/requireme
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/resources.html gdl/doc/www/resources.html
 --- gdl-0.9.2/doc/www/resources.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/resources.html	2011-08-18 10:54:41.571157592 -0600
++++ gdl/doc/www/resources.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -25057,7 +25533,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/resources.html gdl/doc/www/resources.h
 +</html>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/resources.php gdl/doc/www/resources.php
 --- gdl-0.9.2/doc/www/resources.php	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/resources.php	2012-05-10 15:10:03.665532774 -0600
++++ gdl/doc/www/resources.php	2012-04-30 02:20:38.000000000 -0600
 @@ -0,0 +1,117 @@
 +<?php require('_header.inc.php'); ?>
 +
@@ -25178,7 +25654,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/resources.php gdl/doc/www/resources.ph
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/screenshot.html gdl/doc/www/screenshot.html
 --- gdl-0.9.2/doc/www/screenshot.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/screenshot.html	2011-08-18 10:54:41.579157313 -0600
++++ gdl/doc/www/screenshot.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -25354,7 +25830,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/screenshots.php gdl/doc/www/screenshot
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/support.html gdl/doc/www/support.html
 --- gdl-0.9.2/doc/www/support.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/support.html	2011-08-18 10:54:41.600156580 -0600
++++ gdl/doc/www/support.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -25430,7 +25906,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/support.php gdl/doc/www/support.php
 +<?php require('_footer.inc.php'); ?>
 diff -ruN --exclude CVS gdl-0.9.2/doc/www/tdl.html gdl/doc/www/tdl.html
 --- gdl-0.9.2/doc/www/tdl.html	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/doc/www/tdl.html	2011-08-18 10:54:41.608156300 -0600
++++ gdl/doc/www/tdl.html	2011-07-08 07:06:48.000000000 -0600
 @@ -0,0 +1,9 @@
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
@@ -25443,7 +25919,7 @@ diff -ruN --exclude CVS gdl-0.9.2/doc/www/tdl.html gdl/doc/www/tdl.html
 +</html>
 diff -ruN --exclude CVS gdl-0.9.2/INSTALL gdl/INSTALL
 --- gdl-0.9.2/INSTALL	2011-11-08 17:15:09.000000000 -0700
-+++ gdl/INSTALL	2012-05-10 15:10:01.087625823 -0600
++++ gdl/INSTALL	2012-04-13 15:50:27.000000000 -0600
 @@ -126,7 +126,7 @@
  initial values for variables by setting them in the environment.  Using
  a Bourne-compatible shell, you can do that on the command line like
@@ -25470,10 +25946,21 @@ diff -ruN --exclude CVS gdl-0.9.2/INSTALL gdl/INSTALL
 +> rm libtool aclocal.m4
 +> autoreconf -vfi
 +> make
+diff -ruN --exclude CVS gdl-0.9.2/Makefile.in gdl/Makefile.in
+--- gdl-0.9.2/Makefile.in	2011-11-01 17:46:36.000000000 -0600
++++ gdl/Makefile.in	2012-06-28 03:54:53.000000000 -0600
+@@ -163,6 +163,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
 diff -ruN --exclude CVS gdl-0.9.2/NEWS gdl/NEWS
 --- gdl-0.9.2/NEWS	2011-11-08 16:27:32.000000000 -0700
-+++ gdl/NEWS	2012-05-15 12:11:34.840694290 -0600
-@@ -535,5 +535,20 @@
++++ gdl/NEWS	2012-07-13 16:39:45.000000000 -0600
+@@ -535,5 +535,24 @@
             - memory leak fix (bug introduced in the previous version)
             - various testsuite & docs updates (incl. docs and examples for CALL_EXTERNAL)
  	   - fix in WordExp() when filename argument contain whitespaces (useful in various cases, including 
@@ -25490,14 +25977,29 @@ diff -ruN --exclude CVS gdl-0.9.2/NEWS gdl/NEWS
 +	   - Initial import of CONGRID and BILINEAR
 +	   - Initial import of TV for PS output
 +	   - fix in RANDOMN/RANDOMU (Binomial OK, conflicting keywords detected ...)
-+           - Initial import for QROMB() and QSIMP() (based on QROMB) and QROMO() [not finished]
++           - Initial import for QROMB(), QSIMP() (based on QROMB) and QROMO()
 +           - Initial import for TRISOL()
 +	   - fix in ERASE for background color (preparing Coyote lib. support)
 +	   - Initial import of STANDARDIZE and HIST_EQUAL
 +	   - improvment in MAGICK related codes, especially MAGICK_PING (pb with ImageMagick (IM) in Ubuntu 12.04; GraphicsMagick can also be used instead of IM)
++	   - FZ_ROOTS: initial import (same way than IMSL_ZEROPOLY using gsl_poly_complex_solve(), only real coefs. for input poly)
++	   - FX_ROOT: initial import. in c++
++           - keyword DIM in MOMENT(), MEAN(), STDDEV(), VARIANCE(), SKEWNESS(), KURTOSIS() (requested DIM and other improvments)
++           - keyword SIGN in FINITE
+diff -ruN --exclude CVS gdl-0.9.2/src/antlr/Makefile.in gdl/src/antlr/Makefile.in
+--- gdl-0.9.2/src/antlr/Makefile.in	2011-11-01 17:46:37.000000000 -0600
++++ gdl/src/antlr/Makefile.in	2012-06-28 03:54:54.000000000 -0600
+@@ -209,6 +209,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
 diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.cpp gdl/src/arrayindex.cpp
 --- gdl-0.9.2/src/arrayindex.cpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/arrayindex.cpp	2012-02-21 09:54:34.469982462 -0700
++++ gdl/src/arrayindex.cpp	2012-01-23 15:33:27.000000000 -0700
 @@ -67,13 +67,13 @@
    
    if( s < 0)
@@ -25604,7 +26106,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.cpp gdl/src/arrayindex.cpp
  }
 diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
 --- gdl-0.9.2/src/arrayindex.hpp	2011-11-06 20:10:46.000000000 -0700
-+++ gdl/src/arrayindex.hpp	2012-02-21 09:54:34.493981591 -0700
++++ gdl/src/arrayindex.hpp	2012-07-14 08:05:47.000000000 -0600
 @@ -241,6 +241,7 @@
    void Init() 
    {
@@ -25627,7 +26129,15 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
        // int ret = ix_->Scalar2RangeT(s);
        // from GDL 0.9 on negative indices are fine
        // 	if( ret == -1) // index < 0
-@@ -547,7 +549,7 @@
+@@ -523,6 +525,7 @@
+     //SizeT nElem = ix_->N_Elements();
+     //    ix = new SizeT[ nElem]; // allocate array
+ 
++  //DEBUG if( ix != NULL)    
+     assert( ix == NULL);
+ 
+     //     ix = new AllIxMultiT( nElem);
+@@ -547,7 +550,7 @@
  
        if( s < 0)
  	throw GDLException(NULL,"Subscript out of range [-i].",true,false);
@@ -25636,7 +26146,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
  	throw GDLException(NULL,"Subscript out of range [i].",true,false);
        return 1;
      }
-@@ -674,7 +676,7 @@
+@@ -674,7 +677,7 @@
  	  s = sInit;
  	if( s < 0)
  	  throw GDLException(NULL,"Subscript out of range [-i].",true,false);
@@ -25645,7 +26155,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
  	  throw GDLException(NULL,"Subscript out of range [i].",true,false);
  	return 1;
        }
-@@ -824,7 +826,7 @@
+@@ -824,7 +827,7 @@
  
    SizeT NIter( SizeT varDim)
    {
@@ -25654,7 +26164,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
        throw GDLException(NULL,"Subscript out of range [s:*].",true,false);
      if( sInit < 0)
      {
-@@ -1023,7 +1025,7 @@
+@@ -1023,7 +1026,7 @@
        throw 
  	GDLException(NULL,"Subscript range values of the form low:high "
  		"must be < size, with low <= high",true,false);
@@ -25663,7 +26173,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
  		throw GDLException(NULL,"Subscript out of range [s:e].",true,false);
      return (e - s + 1);
    }
-@@ -1191,7 +1193,7 @@
+@@ -1191,7 +1194,7 @@
      else
        s= sInit;
  
@@ -25672,7 +26182,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
        throw GDLException(NULL,"Subscript out of range [s:*:stride].",true,false);
      return (varDim - s + stride - 1)/stride;
    }
-@@ -1402,7 +1404,7 @@
+@@ -1402,7 +1405,7 @@
  			GDLException(NULL,"Subscript range values of the form low:high "
  				"must be < size, with low <= high",true,false);
      
@@ -25683,7 +26193,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindex.hpp gdl/src/arrayindex.hpp
        }
 diff -ruN --exclude CVS gdl-0.9.2/src/arrayindexlistnoassoct.hpp gdl/src/arrayindexlistnoassoct.hpp
 --- gdl-0.9.2/src/arrayindexlistnoassoct.hpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/arrayindexlistnoassoct.hpp	2012-02-19 22:06:07.000000000 -0700
++++ gdl/src/arrayindexlistnoassoct.hpp	2012-07-10 11:47:17.000000000 -0600
 @@ -121,15 +121,8 @@
  //   bool ToAssocIndex( SizeT& lastIx)
    bool ToAssocIndex( SizeT& lastIx)
@@ -25712,7 +26222,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindexlistnoassoct.hpp gdl/src/arrayin
      assert( allIx == NULL);
  //     if( allIx != NULL)
  // 		return allIx;
-@@ -683,9 +679,9 @@
+@@ -683,10 +679,10 @@
  	if( sInit < 0)
  	  s = sInit + var->Size();
  	if( s < 0)
@@ -25720,10 +26230,12 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindexlistnoassoct.hpp gdl/src/arrayin
 +	  throw GDLException(NULL,"Scalar subscript out of range [<].4",true,false);
  	if( s >= var->Size())
 -	  throw GDLException(NULL,"Scalar subscript out of range [>].2",true,false);
+-	var->AssignAtIx( s, right);
 +	  throw GDLException(NULL,"Scalar subscript out of range [>].4",true,false);
- 	var->AssignAtIx( s, right);
++	var->AssignAtIx( s, right); // must use COPY_BYTE_AS_INT
  	return;
        }
+     
 @@ -713,11 +709,11 @@
  	if( sInit < 0)
  	  s = sInit + var->Size();
@@ -26410,7 +26922,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindexlistnoassoct.hpp gdl/src/arrayin
  		return;
 diff -ruN --exclude CVS gdl-0.9.2/src/arrayindexlistt.hpp gdl/src/arrayindexlistt.hpp
 --- gdl-0.9.2/src/arrayindexlistt.hpp	2011-11-06 20:10:46.000000000 -0700
-+++ gdl/src/arrayindexlistt.hpp	2012-02-21 09:54:34.714973569 -0700
++++ gdl/src/arrayindexlistt.hpp	2012-02-19 22:06:07.000000000 -0700
 @@ -43,10 +43,18 @@
  
    virtual ArrayIndexListT* Clone() { assert( 0); return NULL;}
@@ -26473,7 +26985,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/arrayindexlistt.hpp gdl/src/arrayindexlist
  // 		return allIx;
 diff -ruN --exclude CVS gdl-0.9.2/src/basegdl.cpp gdl/src/basegdl.cpp
 --- gdl-0.9.2/src/basegdl.cpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/basegdl.cpp	2012-02-21 09:54:34.726973137 -0700
++++ gdl/src/basegdl.cpp	2011-12-08 00:03:09.000000000 -0700
 @@ -72,11 +72,11 @@
    throw GDLException("BaseGDL::Equal(SizeT,SizeT) called.");
  }
@@ -26508,7 +27020,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basegdl.cpp gdl/src/basegdl.cpp
  }
 diff -ruN --exclude CVS gdl-0.9.2/src/basegdl.hpp gdl/src/basegdl.hpp
 --- gdl-0.9.2/src/basegdl.hpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/basegdl.hpp	2012-02-21 09:54:34.771971504 -0700
++++ gdl/src/basegdl.hpp	2011-12-08 00:03:09.000000000 -0700
 @@ -416,8 +416,8 @@
    virtual bool Greater(SizeT i1, SizeT i2) const; // comp 2 elements
    virtual bool Equal(SizeT i1, SizeT i2) const; // comp 2 elements
@@ -26534,35 +27046,36 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basegdl.hpp gdl/src/basegdl.hpp
    // used in r_expr
 diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
 --- gdl-0.9.2/src/basic_fun.cpp	2011-11-06 16:43:21.000000000 -0700
-+++ gdl/src/basic_fun.cpp	2012-05-10 15:10:04.482503284 -0600
-@@ -828,18 +828,16 @@
++++ gdl/src/basic_fun.cpp	2012-06-28 03:54:54.000000000 -0600
+@@ -828,18 +828,23 @@
        }
   */ }
  
-+  // never called 
-+  // done directly in FCALL_LIB_N_ELEMENTSNode::Eval();
-+  // needed for LibInit() for correct parametrization
++  // only called from CALL_FUNCTION 
++  // otherwise done directly in FCALL_LIB_N_ELEMENTSNode::Eval();
++  // (but must be defined anyway for LibInit() for correct parametrization)
 +  // N_ELEMENTS is special because on error it just returns 0L
 +  // (the error is just caught and dropped)
    BaseGDL* n_elements( EnvT* e)
    {
--    SizeT nParam=e->NParam(1);
--
+     SizeT nParam=e->NParam(1);
+ 
 -//     if( nParam != 1)
 -//       e->Throw( "Incorrect number of arguments.");
 -
--    BaseGDL* p0=e->GetPar( 0);
--
--    if( p0 == NULL) return new DLongGDL( 0);
--    
+     BaseGDL* p0=e->GetPar( 0);
+ 
+     if( p0 == NULL) return new DLongGDL( 0);
++    return new DLongGDL( p0->N_Elements()); 
+     
 -    return new DLongGDL( p0->N_Elements());
-+    assert( 0);
-+    e->Throw("Internal error: lib::n_elements called.");
-+    return NULL; // get rid of compiler warning
++//     assert( 0);
++//     e->Throw("Internal error: lib::n_elements called.");
++//     return NULL; // get rid of compiler warning
    }
  
    template< typename ComplexGDL, typename Complex, typename Float>
-@@ -1204,11 +1202,17 @@
+@@ -1204,11 +1209,17 @@
        {
          // SA: calling STRING() with correct parameters
          static int stringIx = LibFunIx("STRING");
@@ -26582,7 +27095,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
          return static_cast<DLibFun*>(newEnv->GetPro())->Fun()(newEnv);
        }
        e->Throw( "Improper TYPE value.");
-@@ -1218,8 +1222,6 @@
+@@ -1218,8 +1229,6 @@
  
    BaseGDL* call_function( EnvT* e)
    {
@@ -26591,7 +27104,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
      int nParam=e->NParam();
      if( nParam == 0)
       e->Throw( "No function specified.");
-@@ -1234,14 +1236,17 @@
+@@ -1234,14 +1243,31 @@
      int funIx=LibFunIx( callF);
      if( funIx != -1)
        {
@@ -26601,18 +27114,32 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  	// make the call
 -	EnvT* newEnv = static_cast<EnvT*>(e->Interpreter()->CallStack().back());
 +// 	EnvT* newEnv = static_cast<EnvT*>(e->Interpreter()->CallStack().back());
++
++	// handle direct call functions 
++	if( libFunList[ funIx]->DirectCall())
++	{
++	  BaseGDL* directCallParameter = e->GetParDefined(1);
++	  BaseGDL* res = 
++	  static_cast<DLibFunDirect*>(libFunList[ funIx])->FunDirect()(directCallParameter, true /*isReference*/);
++	  return res;
++	}
++	else
++	{
 +	EnvT* newEnv = e->NewEnv( libFunList[ funIx], 1);
 +	auto_ptr<EnvT> guard( newEnv);
  	return static_cast<DLibFun*>(newEnv->GetPro())->Fun()(newEnv);
++	}
        }
      else
        {
-+    StackGuard<EnvStackT> guard( e->Interpreter()->CallStack());
++	// no direct call here
++	
++	StackGuard<EnvStackT> guard( e->Interpreter()->CallStack());
 +
  	funIx = GDLInterpreter::GetFunIx( callF);
  	
  	e->PushNewEnvUD( funList[ funIx], 1);
-@@ -1274,8 +1279,8 @@
+@@ -1274,8 +1300,8 @@
  
      if( method == NULL)
        e->Throw( "Method not found: "+callP);
@@ -26623,7 +27150,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
      
      // make the call
      return e->Interpreter()->call_fun( method->GetTree());
-@@ -1290,13 +1295,13 @@
+@@ -1290,13 +1316,13 @@
      bool quietCompile = false;
      if( nParam == 2)
        {
@@ -26644,7 +27171,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
        }
  
      if (e->GetParDefined(0)->Rank() != 0)
-@@ -1308,8 +1313,10 @@
+@@ -1308,8 +1334,10 @@
      // remove current environment (own one)
      assert( dynamic_cast<EnvUDT*>(e->Caller()) != NULL);
      EnvUDT* caller = static_cast<EnvUDT*>(e->Caller());
@@ -26657,7 +27184,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  
      istringstream istr(line+"\n");
  
-@@ -1583,15 +1590,19 @@
+@@ -1583,15 +1611,19 @@
      return res;
    }
  
@@ -26684,7 +27211,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
      ULong nEl1 = e1->N_Elements();
  
      Data_<SpDByte>* res = new Data_<SpDByte>( e1->Dim(), BaseGDL::NOZERO);
-@@ -1876,53 +1887,139 @@
+@@ -1876,53 +1908,139 @@
      return res;
    }
  
@@ -26789,18 +27316,6 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
 +
 +	if( res == p0S)
 +	{
-+TRACEOMP( __FILE__, __LINE__)
-+#pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10)))
-+{
-+#pragma omp for
-+    for( SizeT i=0; i<nEl; ++i)
-+      {
-+		StrUpCaseInplace((*p0S)[ i]);
-+      }
-+}
-+	}
-+	else
-+	{
  TRACEOMP( __FILE__, __LINE__)
  #pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10)))
  {
@@ -26808,10 +27323,22 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
      for( SizeT i=0; i<nEl; ++i)
        {
 -	(*res)[ i] = StrUpCase((*p0S)[ i]);
-+		(*res)[ i] = StrUpCase((*p0S)[ i]);
++		StrUpCaseInplace((*p0S)[ i]);
        }
  }
 +	}
++	else
++	{
++TRACEOMP( __FILE__, __LINE__)
++#pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10)))
++{
++#pragma omp for
++    for( SizeT i=0; i<nEl; ++i)
++      {
++		(*res)[ i] = StrUpCase((*p0S)[ i]);
++      }
++}
++	}
      return res;
    }
  
@@ -26838,7 +27365,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  
      DLongGDL* res = new DLongGDL( p0S->Dim(), BaseGDL::NOZERO);
  
-@@ -1932,7 +2029,7 @@
+@@ -1932,7 +2050,7 @@
  // #pragma omp for
      for( SizeT i=0; i<nEl; ++i)
        {
@@ -26847,7 +27374,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
        }
  }
      return res;
-@@ -3382,7 +3479,7 @@
+@@ -3382,7 +3500,7 @@
  	for( SizeT i=0; i<rank; ++i) perm[i] = (*p1L)[ i];
  	delete p1L;
  
@@ -26856,7 +27383,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  	for( SizeT i=0; i<rank; ++i) 
  	  {
  	    DUInt j;
-@@ -4363,6 +4460,7 @@
+@@ -4363,6 +4481,7 @@
  		DLong s1;
  		e->AssureLongScalarPar( 1, s1);
  
@@ -26864,7 +27391,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  		return p0->CShift( s1);
        }
      
-@@ -4373,7 +4471,12 @@
+@@ -4373,7 +4492,12 @@
      for( SizeT i=0; i< nShift; i++)
        e->AssureLongScalarPar( i+1, sIx[ i]);
  
@@ -26878,7 +27405,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
    }
  
    BaseGDL* arg_present( EnvT* e)
-@@ -5367,7 +5470,12 @@
+@@ -5367,7 +5491,12 @@
  
    BaseGDL* get_kbrd( EnvT* e)
    {
@@ -26892,7 +27419,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  
      bool doWait = true;
      if( nParam > 0)
-@@ -5381,39 +5489,51 @@
+@@ -5381,39 +5510,51 @@
  	  }
        }
  
@@ -26975,7 +27502,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.cpp gdl/src/basic_fun.cpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.hpp gdl/src/basic_fun.hpp
 --- gdl-0.9.2/src/basic_fun.hpp	2009-09-10 07:07:44.000000000 -0600
-+++ gdl/src/basic_fun.hpp	2012-02-21 09:54:34.876967693 -0700
++++ gdl/src/basic_fun.hpp	2011-11-24 04:31:27.000000000 -0700
 @@ -83,14 +83,14 @@
  
    BaseGDL* gdl_logical_and( EnvT* e);
@@ -26997,7 +27524,20 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun.hpp gdl/src/basic_fun.hpp
    BaseGDL* strtrim( EnvT* e);
 diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun_jmg.cpp gdl/src/basic_fun_jmg.cpp
 --- gdl-0.9.2/src/basic_fun_jmg.cpp	2011-10-11 01:37:36.000000000 -0600
-+++ gdl/src/basic_fun_jmg.cpp	2012-02-21 09:54:34.892967113 -0700
++++ gdl/src/basic_fun_jmg.cpp	2012-06-28 03:54:54.000000000 -0600
+@@ -120,10 +120,10 @@
+       }
+ 
+ 
+-      DLongGDL *dims_res = new DLongGDL(dimension(8), BaseGDL::ZERO);      
++      DLongGDL *dims_res = new DLongGDL(dimension(MAXRANK), BaseGDL::ZERO);      
+ 
+       // Initialize dimension values to 0
+-      for( SizeT i=Rank; i<8; ++i) (*dims_res)[ i] = 0;
++      for( SizeT i=Rank; i<MAXRANK; ++i) (*dims_res)[ i] = 0;
+       for( SizeT i=0; i<Rank; ++i) {
+ 	(*dims_res)[ i] = p0->Dim(i);
+       }
 @@ -642,7 +642,9 @@
      SizeT nParam=e->NParam();
  
@@ -27037,7 +27577,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_fun_jmg.cpp gdl/src/basic_fun_jmg.cp
  	      if (p == NULL) {
 diff -ruN --exclude CVS gdl-0.9.2/src/basic_pro.cpp gdl/src/basic_pro.cpp
 --- gdl-0.9.2/src/basic_pro.cpp	2011-11-06 20:07:18.000000000 -0700
-+++ gdl/src/basic_pro.cpp	2012-02-21 09:54:35.030962106 -0700
++++ gdl/src/basic_pro.cpp	2011-12-03 06:10:46.000000000 -0700
 @@ -817,8 +817,6 @@
    
    void call_procedure( EnvT* e)
@@ -27070,7 +27610,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/basic_pro.cpp gdl/src/basic_pro.cpp
  	e->PushNewEnvUD( proList[ proIx], 1);
 diff -ruN --exclude CVS gdl-0.9.2/src/CMakeLists.txt gdl/src/CMakeLists.txt
 --- gdl-0.9.2/src/CMakeLists.txt	2011-11-06 20:07:18.000000000 -0700
-+++ gdl/src/CMakeLists.txt	2012-02-21 09:54:33.425020381 -0700
++++ gdl/src/CMakeLists.txt	2012-06-28 03:54:54.000000000 -0600
 @@ -130,6 +130,8 @@
  gshhs.hpp
  gsl_fun.cpp
@@ -27080,9 +27620,37 @@ diff -ruN --exclude CVS gdl-0.9.2/src/CMakeLists.txt gdl/src/CMakeLists.txt
  gzstream.hpp
  hdf5_fun.cpp
  hdf5_fun.hpp
+@@ -181,7 +183,6 @@
+ objects.hpp
+ ofmt.cpp
+ ofmt.hpp
+-plot3d_nr.cpp
+ plotting_axis.cpp
+ plotting_contour.cpp
+ plotting_convert_coord.cpp
 diff -ruN --exclude CVS gdl-0.9.2/src/convert2.cpp gdl/src/convert2.cpp
 --- gdl-0.9.2/src/convert2.cpp	2011-10-17 04:01:43.000000000 -0600
-+++ gdl/src/convert2.cpp	2012-02-21 09:54:35.048961453 -0700
++++ gdl/src/convert2.cpp	2012-07-10 11:47:17.000000000 -0600
+@@ -234,13 +234,13 @@
+ 	if( mode == BaseGDL::COPY_BYTE_AS_INT)
+ 	  {
+ 	    Data_<SpDString>* dest=new Data_<SpDString>( dim, BaseGDL::NOZERO);
+-TRACEOMP( __FILE__, __LINE__)
+-#pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl))
+-{
+-#pragma omp for
++// TRACEOMP( __FILE__, __LINE__)
++// #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl))
++// {
++// #pragma omp for
+ 	    for( SizeT i=0; i < nEl; ++i)
+-	      (*dest)[i]=i2s((*this)[i],4);
+-}
++	      (*dest)[i]=i2s(static_cast<int>((*this)[i]),4);
++// }
+ 	    if( (mode & BaseGDL::CONVERT) != 0) delete this;
+ 	    return dest;
+ 	  }
 @@ -2257,12 +2257,13 @@
  	}
  #endif
@@ -27103,7 +27671,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/convert2.cpp gdl/src/convert2.cpp
        }
 diff -ruN --exclude CVS gdl-0.9.2/src/datatypes.cpp gdl/src/datatypes.cpp
 --- gdl-0.9.2/src/datatypes.cpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/datatypes.cpp	2012-02-21 09:54:35.118958912 -0700
++++ gdl/src/datatypes.cpp	2012-07-10 11:47:17.000000000 -0600
 @@ -55,6 +55,9 @@
  // this (ugly) including of other sourcefiles has to be done, because
  // on Mac OS X a template instantiation request (see bottom of file)
@@ -27173,15 +27741,17 @@ diff -ruN --exclude CVS gdl-0.9.2/src/datatypes.cpp gdl/src/datatypes.cpp
    return n;
  }
  
+-template<class Sp>
+-void Data_<Sp>::LogThis()              
+-{ 
+-  assert( 0);
 +// this is actually not a "log" of "this",
 +// but the behaviour is fine with the usage in the library function
 +// the real LogThis is done in the specializations for floating and 
 +// complex types
- template<class Sp>
--void Data_<Sp>::LogThis()              
++template<class Sp>
 +BaseGDL* Data_<Sp>::LogThis()              
- { 
--  assert( 0);
++{ 
 +  DFloatGDL* res = static_cast<DFloatGDL*>
 +    (this->Convert2( FLOAT, BaseGDL::COPY));
 +  res->LogThis(); // calls correct LogThis for float
@@ -27571,9 +28141,29 @@ diff -ruN --exclude CVS gdl-0.9.2/src/datatypes.cpp gdl/src/datatypes.cpp
  template<>
  Data_<SpDObj>& Data_<SpDObj>::operator=(const BaseGDL& r)
  {
+@@ -2572,7 +2662,8 @@
+   
+ 	if( srcIn->Type() != this->Type())
+     {
+-      Data_* rConv = static_cast<Data_*>(srcIn->Convert2( this->Type(), BaseGDL::COPY));
++      Data_* rConv = static_cast<Data_*>(srcIn->Convert2( this->Type(), BaseGDL::COPY_BYTE_AS_INT));
++//      Data_* rConv = static_cast<Data_*>(srcIn->Convert2( this->Type(), BaseGDL::COPY));
+       auto_ptr<Data_> conv_guard( rConv);
+       (*this)[ix] = (*rConv)[0];
+     }
+@@ -2583,7 +2674,8 @@
+ 	} // ixR >= 0
+   if( srcIn->Type() != this->Type())
+     {
+-      Data_* rConv = static_cast<Data_*>(srcIn->Convert2( this->Type(), BaseGDL::COPY));
++      Data_* rConv = static_cast<Data_*>(srcIn->Convert2( this->Type(), BaseGDL::COPY_BYTE_AS_INT));
++//       Data_* rConv = static_cast<Data_*>(srcIn->Convert2( this->Type(), BaseGDL::COPY));
+       auto_ptr<Data_> conv_guard( rConv);
+       (*this)[ixR] = (*rConv)[0];
+     }
 diff -ruN --exclude CVS gdl-0.9.2/src/datatypes.hpp gdl/src/datatypes.hpp
 --- gdl-0.9.2/src/datatypes.hpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/datatypes.hpp	2012-02-21 09:54:35.160957387 -0700
++++ gdl/src/datatypes.hpp	2011-12-08 00:03:09.000000000 -0700
 @@ -113,8 +113,8 @@
    bool Greater(SizeT i1, SizeT i2) const; // comp 2 elements
    bool Equal(SizeT i1, SizeT i2) const; // comp 2 elements
@@ -27608,7 +28198,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/datatypes.hpp gdl/src/datatypes.hpp
    BaseGDL* UMinus(); // UMinus for SpDString returns float
 diff -ruN --exclude CVS gdl-0.9.2/src/deviceps.hpp gdl/src/deviceps.hpp
 --- gdl-0.9.2/src/deviceps.hpp	2011-10-31 03:08:38.000000000 -0600
-+++ gdl/src/deviceps.hpp	2012-02-21 09:54:35.186956446 -0700
++++ gdl/src/deviceps.hpp	2012-01-03 03:31:38.000000000 -0700
 @@ -19,6 +19,7 @@
  #  define DEVICEPS_HPP_
  
@@ -27753,7 +28343,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/deviceps.hpp gdl/src/deviceps.hpp
  #endif
 diff -ruN --exclude CVS gdl-0.9.2/src/devicex.hpp gdl/src/devicex.hpp
 --- gdl-0.9.2/src/devicex.hpp	2011-11-06 15:28:57.000000000 -0700
-+++ gdl/src/devicex.hpp	2012-05-10 15:10:04.731494297 -0600
++++ gdl/src/devicex.hpp	2012-03-16 19:50:04.000000000 -0600
 @@ -201,8 +201,8 @@
  	}
  
@@ -28061,7 +28651,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/devicex.hpp gdl/src/devicex.hpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/devicez.hpp gdl/src/devicez.hpp
 --- gdl-0.9.2/src/devicez.hpp	2011-08-22 14:41:46.000000000 -0600
-+++ gdl/src/devicez.hpp	2012-02-21 09:54:35.255953942 -0700
++++ gdl/src/devicez.hpp	2011-12-28 16:14:09.000000000 -0700
 @@ -277,7 +277,7 @@
      //    Graphics* actDevice = Graphics::GetDevice();
      SizeT nParam=e->NParam( 1); 
@@ -28073,7 +28663,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/devicez.hpp gdl/src/devicez.hpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/dinterpreter.cpp gdl/src/dinterpreter.cpp
 --- gdl-0.9.2/src/dinterpreter.cpp	2011-09-20 05:33:52.000000000 -0600
-+++ gdl/src/dinterpreter.cpp	2012-02-21 09:54:35.310951945 -0700
++++ gdl/src/dinterpreter.cpp	2012-07-11 09:59:42.000000000 -0600
 @@ -949,7 +949,7 @@
      {
  	  env->ResizeForLoops( nForLoopsIn);
@@ -28083,9 +28673,28 @@ diff -ruN --exclude CVS gdl-0.9.2/src/dinterpreter.cpp gdl/src/dinterpreter.cpp
        return CC_OK;
      }
    catch( ANTLRException& e)
+@@ -1089,14 +1089,16 @@
+ // inner loop (called via Control-C, STOP, error)
+ RetCode DInterpreter::InnerInterpreterLoop(SizeT lineOffset)
+ {
+-
+-  bool runCmd = false;
++  ProgNodeP retTreeSave = _retTree;
+   for (;;) {
+     feclearexcept(FE_ALL_EXCEPT);
+ 
+ //     try
+ //       {
+ 	DInterpreter::CommandCode ret=ExecuteLine(NULL, lineOffset);
++
++	_retTree = retTreeSave; // on return, _retTree should be kept
++
+ 	if( ret == CC_RETURN) return RC_RETURN;
+ 	if( ret == CC_CONTINUE) return RC_OK; 
+ 	if( ret == CC_STEP) return RC_OK;
 diff -ruN --exclude CVS gdl-0.9.2/src/dpro.cpp gdl/src/dpro.cpp
 --- gdl-0.9.2/src/dpro.cpp	2010-12-03 13:12:41.000000000 -0700
-+++ gdl/src/dpro.cpp	2012-02-21 09:54:35.399948717 -0700
++++ gdl/src/dpro.cpp	2011-11-17 19:50:19.000000000 -0700
 @@ -44,11 +44,12 @@
  // DLib ******************************************************
  DLib::DLib( const string& n, const string& o, const int nPar_, 
@@ -28177,7 +28786,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/dpro.cpp gdl/src/dpro.cpp
  // DSubUD ****************************************************
 diff -ruN --exclude CVS gdl-0.9.2/src/dpro.hpp gdl/src/dpro.hpp
 --- gdl-0.9.2/src/dpro.hpp	2010-05-04 11:32:32.000000000 -0600
-+++ gdl/src/dpro.hpp	2012-02-21 09:54:35.439947265 -0700
++++ gdl/src/dpro.hpp	2011-11-17 19:50:19.000000000 -0700
 @@ -117,6 +117,7 @@
    IDList              key;    // keyword names (IDList: typedefs.hpp)
                                // (KEYWORD_NAME=keyword_value)
@@ -28299,7 +28908,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/dpro.hpp gdl/src/dpro.hpp
  // User Defined
 diff -ruN --exclude CVS gdl-0.9.2/src/dstructgdl.cpp gdl/src/dstructgdl.cpp
 --- gdl-0.9.2/src/dstructgdl.cpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/dstructgdl.cpp	2012-02-21 09:54:35.467946249 -0700
++++ gdl/src/dstructgdl.cpp	2011-12-08 00:03:09.000000000 -0700
 @@ -202,9 +202,10 @@
  }
  
@@ -28328,7 +28937,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/dstructgdl.cpp gdl/src/dstructgdl.cpp
    SizeT nEl = N_Elements();
 diff -ruN --exclude CVS gdl-0.9.2/src/dstructgdl.hpp gdl/src/dstructgdl.hpp
 --- gdl-0.9.2/src/dstructgdl.hpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/dstructgdl.hpp	2012-02-21 09:54:35.497945160 -0700
++++ gdl/src/dstructgdl.hpp	2011-12-08 00:03:09.000000000 -0700
 @@ -217,8 +217,8 @@
     DStructGDL* SetBuffer( const void* b);
    void SetBufferSize( SizeT s);
@@ -28351,8 +28960,19 @@ diff -ruN --exclude CVS gdl-0.9.2/src/dstructgdl.hpp gdl/src/dstructgdl.hpp
    
 diff -ruN --exclude CVS gdl-0.9.2/src/envt.cpp gdl/src/envt.cpp
 --- gdl-0.9.2/src/envt.cpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/envt.cpp	2012-02-21 09:54:35.521944289 -0700
-@@ -916,14 +916,19 @@
++++ gdl/src/envt.cpp	2012-07-16 07:21:15.000000000 -0600
+@@ -907,23 +907,28 @@
+ }
+ 
+ // called after parameter definition
+-void EnvBaseT::Extra()
++void EnvBaseT::ResolveExtra()
+ {
+-  if( extra != NULL) extra->Resolve();
++  if( extra != NULL) extra->ResolveExtra( NULL);
+ }
+ 
+ EnvBaseT* EnvBaseT::Caller()
  {
    EnvStackT& callStack=interpreter->CallStack();
  
@@ -28378,7 +28998,22 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.cpp gdl/src/envt.cpp
  }
  
  // used by obj_new (basic_fun.cpp)
-@@ -971,7 +976,7 @@
+@@ -960,18 +965,20 @@
+       newEnv->SetNextPar( &GetPar( p)); // pass as global
+     }
+ 
+-  interpreter->CallStack().push_back( newEnv); 
++  // interpreter->CallStack().push_back( newEnv); // problem with call_function if done here s. b.
+ 
+   // _REF_EXTRA is set to the keyword string array
+   newEnv->extra = new ExtraT( newEnv);
+   newEnv->extra->Set( &env[0]);
+-  newEnv->extra->Resolve();
++  newEnv->extra->ResolveExtra( this); // s. a. problem caused here due to a call to EnvBaseT::Caller() in Resolve()
++
++  interpreter->CallStack().push_back( newEnv); 
+ }
+ // used by obj_new (basic_fun.cpp)
  // and obj_destroy (basic_pro.cpp)
  // and call_function (basic_fun.cpp)
  // and call_procedure (basic_pro.cpp)
@@ -28387,7 +29022,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.cpp gdl/src/envt.cpp
  {
    EnvT* newEnv= new EnvT( this, newPro, newObj);
  
-@@ -982,12 +987,14 @@
+@@ -982,12 +989,14 @@
        newEnv->SetNextPar( &GetPar( p)); // pass as global
      }
  
@@ -28397,13 +29032,14 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.cpp gdl/src/envt.cpp
    // _REF_EXTRA is set to the keyword string array
    newEnv->extra = new ExtraT( newEnv);
    newEnv->extra->Set( &env[0]);
-   newEnv->extra->Resolve();
+-  newEnv->extra->Resolve();
++  newEnv->extra->ResolveExtra( this);
 +
 +  return newEnv;
  }
  
  void EnvT::AssureGlobalPar( SizeT pIx)
-@@ -1354,6 +1361,11 @@
+@@ -1354,6 +1363,11 @@
      }
    return env[ ix];
  }
@@ -28417,8 +29053,25 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.cpp gdl/src/envt.cpp
  {
 diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
 --- gdl-0.9.2/src/envt.hpp	2011-11-05 10:56:43.000000000 -0600
-+++ gdl/src/envt.hpp	2012-02-21 09:54:35.547943346 -0700
-@@ -478,7 +478,7 @@
++++ gdl/src/envt.hpp	2012-07-16 07:21:15.000000000 -0600
+@@ -112,6 +112,7 @@
+ 
+   // for CLEANUP calls due to reference counting
+   void PushNewEmptyEnvUD(  DSub* newPro, BaseGDL** newObj = NULL);
++  void PushNewEmptyEnvUDWithExtra(  DSub* newPro, BaseGDL** newObj = NULL);
+   
+   void AddEnv( DPtrListT& ptrAccessible, DPtrListT& objAccessible);
+   void AddToDestroy( DPtrListT& ptrAccessible, DPtrListT& objAccessible);
+@@ -179,7 +180,7 @@
+   void RemoveLoc( BaseGDL* p) { env.RemoveLoc( p);}
+ 
+   // called after parameter definition
+-  void Extra();
++  void ResolveExtra();
+   friend class ExtraT;
+ 
+   // used by compiler and from EnvT (for variable number of paramters)
+@@ -478,7 +479,7 @@
    void ObjCleanup( DObj actID);
  
    // used by obj_new (basic_fun.cpp)
@@ -28427,7 +29080,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
    void PushNewEnvUD(  DSub* newPro, SizeT skipP, BaseGDL** newObj=NULL);
    // for exclusive use by lib::on_error
    void OnError();
-@@ -523,6 +523,10 @@
+@@ -523,6 +524,10 @@
  
    // returns the ix'th parameter (NULL if not defined)
    BaseGDL*& GetPar(SizeT i);
@@ -28438,7 +29091,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
  
    // get i'th parameter
    // throws if not defined (ie. never returns NULL)
-@@ -572,9 +576,11 @@
+@@ -572,9 +577,11 @@
    T* GetParAs( SizeT pIx)
    {
      BaseGDL* p = GetParDefined( pIx);
@@ -28453,7 +29106,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
      Guard( res);
      return res;
    }
-@@ -585,9 +591,11 @@
+@@ -585,9 +592,11 @@
      BaseGDL* p = GetKW( ix);
      if( p == NULL)
        Throw( "Keyword is undefined: "+GetString( ix));
@@ -28468,7 +29121,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
      Guard( res);
      return res;
    }
-@@ -598,9 +606,11 @@
+@@ -598,9 +607,11 @@
    {
      BaseGDL* p = GetPar( pIx);
      if( p == NULL) return NULL;
@@ -28483,7 +29136,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
      Guard( res);
      return res;
    }
-@@ -610,9 +620,11 @@
+@@ -610,9 +621,11 @@
    {
      BaseGDL* p = GetKW( ix);
      if( p == NULL) return NULL;
@@ -28498,7 +29151,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
      Guard( res);
      return res;
    }
-@@ -771,7 +783,8 @@
+@@ -771,7 +784,8 @@
  };
  
  
@@ -28510,8 +29163,27 @@ diff -ruN --exclude CVS gdl-0.9.2/src/envt.hpp gdl/src/envt.hpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/extrat.cpp gdl/src/extrat.cpp
 --- gdl-0.9.2/src/extrat.cpp	2009-11-08 16:36:07.000000000 -0700
-+++ gdl/src/extrat.cpp	2012-05-10 15:10:04.815491266 -0600
-@@ -50,27 +50,35 @@
++++ gdl/src/extrat.cpp	2012-07-16 07:21:15.000000000 -0600
+@@ -23,7 +23,7 @@
+ 
+ using namespace std;
+ 
+-void ExtraT::Resolve()
++void ExtraT::ResolveExtra(EnvBaseT* callerIn)
+ {
+   // if the subroutine has _REF_EXTRA, explicit keywords override
+   // if the subroutine has _EXTRA, _EXTRA keywords override
+@@ -36,6 +36,9 @@
+ 
+   DSub::ExtraType extraType= pro->Extra();
+ 
++//   EnvBaseT* callerDebug=thisEnv->Caller();
++//   DSub::ExtraType extraTypeDebug= callerDebug->pro->Extra();
++
+   DStructGDL* extraStruct= dynamic_cast<DStructGDL*>(thisExtra);
+   if( extraStruct != NULL) // _EXTRA
+     {
+@@ -50,34 +53,46 @@
  	  IDList::iterator f=find_if(pro->key.begin(),
  				     pro->key.end(),
  				     String_abbref_eq( tName));
@@ -28549,8 +29221,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/extrat.cpp gdl/src/extrat.cpp
 +          listName.push_back(tName);
 +          listEnv.push_back(extraStruct->Get(t)); // always local
 +        }
-+        else if (strict)
-+        { // pro has no (_REF)_EXTRA) and _STRICT_EXTRA -> error
++        else if (strict || callerIn == NULL) // always strict if callerIn is set
++        { // pro has no (_REF)_EXTRA and _STRICT_EXTRA -> error
 +          // ... unless keyword is a warnkey!
 +          // search warn keyword
 +          IDList::iterator wf=find_if(pro->warnKey.begin(),
@@ -28568,9 +29240,45 @@ diff -ruN --exclude CVS gdl-0.9.2/src/extrat.cpp gdl/src/extrat.cpp
      }
    else // _REF_EXTRA
      {
+       DStringGDL* extraString= dynamic_cast<DStringGDL*>(thisExtra);
+       if( extraString != NULL)
+ 	{
+-	  EnvBaseT* caller=thisEnv->Caller();
++	  EnvBaseT* caller;
++	  if( callerIn == NULL)
++	    caller = thisEnv->Caller();
++	  else
++	    caller = callerIn;
+ 
+ 	  // STRING only works, if the *caller* has _REF_EXTRA
+ 	  if( caller->pro->Extra() == DSub::REFEXTRA)
+diff -ruN --exclude CVS gdl-0.9.2/src/extrat.hpp gdl/src/extrat.hpp
+--- gdl-0.9.2/src/extrat.hpp	2005-09-24 09:18:18.000000000 -0600
++++ gdl/src/extrat.hpp	2012-07-16 07:21:15.000000000 -0600
+@@ -114,7 +114,7 @@
+   // 2. if pro has (_REF)_EXTRA:
+   // combine additional keywords and the (remaining) _EXTRA data to pro's 
+   // (_REF)_EXTRA value
+-  void Resolve();
++  void ResolveExtra(EnvBaseT* caller);
+ };
+ 
+ #endif
+diff -ruN --exclude CVS gdl-0.9.2/src/fftw.cpp gdl/src/fftw.cpp
+--- gdl-0.9.2/src/fftw.cpp	2011-09-29 12:54:30.000000000 -0600
++++ gdl/src/fftw.cpp	2012-06-28 03:54:54.000000000 -0600
+@@ -42,7 +42,7 @@
+   T* fftw_template(BaseGDL* p0,
+ 		   SizeT nEl, SizeT dbl, SizeT overwrite, double direct)
+   {
+-    int dim[8];
++    int dim[MAXRANK];
+ 
+     T* res;
+ 
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.g gdl/src/gdlc.g
 --- gdl-0.9.2/src/gdlc.g	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/gdlc.g	2012-02-21 09:54:35.573942402 -0700
++++ gdl/src/gdlc.g	2011-11-15 16:19:00.000000000 -0700
 @@ -105,7 +105,8 @@
      FOREACH_INDEX_LOOP;
  	FCALL;
@@ -28583,7 +29291,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.g gdl/src/gdlc.g
  	KEYDECL;
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.i.g gdl/src/gdlc.i.g
 --- gdl-0.9.2/src/gdlc.i.g	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/gdlc.i.g	2012-02-21 09:54:35.597941532 -0700
++++ gdl/src/gdlc.i.g	2012-07-16 07:24:41.000000000 -0600
 @@ -749,7 +749,8 @@
      }
  
@@ -28594,7 +29302,15 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.i.g gdl/src/gdlc.i.g
      
      std::string GetClearActualLine()
      {
-@@ -3353,11 +3354,13 @@
+@@ -1913,6 +1914,7 @@
+                 aD->Root(structR); 
+             }
+ 	}
++    return;
+ //	_retTree = _t;
+ }
+     : #(ARRAYEXPR rP=l_indexable_expr aL=arrayindex_list)   
+@@ -3353,11 +3355,13 @@
  // the environment is not on the callstack
  parameter_def [EnvBaseT* actEnv] 
  {
@@ -28609,7 +29325,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.i.g gdl/src/gdlc.i.g
  
      try{
  
-@@ -3412,6 +3415,7 @@
+@@ -3389,7 +3393,7 @@
+                         while(_retTree != NULL) 
+                             static_cast<ParameterNode*>(_retTree)->Parameter( actEnv);
+                     }    
+-                actEnv->Extra(); // expand _EXTRA        
++                actEnv->ResolveExtra(); // expand _EXTRA        
+             }
+     } 
+     catch( GDLException& e)
+@@ -3412,6 +3416,7 @@
              )
          )
  	;
@@ -28617,7 +29342,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.i.g gdl/src/gdlc.i.g
  // the environment is not on the callstack
  // for library subroutines, their number of parameters is already checked in the compiler
  parameter_def_nocheck [EnvBaseT* actEnv] 
-@@ -3420,7 +3424,8 @@
+@@ -3420,7 +3425,8 @@
  
      EnvBaseT* callerEnv = callStack.back();
      EnvBaseT* oldNewEnv = callerEnv->GetNewEnv();
@@ -28627,9 +29352,18 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.i.g gdl/src/gdlc.i.g
  
      try{
  
+@@ -3433,7 +3439,7 @@
+                 while(_retTree != NULL) 
+                      static_cast<ParameterNode*>(_retTree)->Parameter( actEnv);
+ 
+-                actEnv->Extra(); // expand _EXTRA        
++                actEnv->ResolveExtra(); // expand _EXTRA        
+             }
+     } 
+     catch( GDLException& e)
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.tree.g gdl/src/gdlc.tree.g
 --- gdl-0.9.2/src/gdlc.tree.g	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/gdlc.tree.g	2012-02-21 09:54:35.634940190 -0700
++++ gdl/src/gdlc.tree.g	2011-11-15 16:19:00.000000000 -0700
 @@ -95,6 +95,7 @@
              lT == FCALL_LIB ||
  //            lT == FCALL_LIB_N_ELEMENTS ||
@@ -28697,7 +29431,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlc.tree.g gdl/src/gdlc.tree.g
                          //                    #id->SetFunIx(i);
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlgstream.hpp gdl/src/gdlgstream.hpp
 --- gdl-0.9.2/src/gdlgstream.hpp	2011-08-09 09:30:00.000000000 -0600
-+++ gdl/src/gdlgstream.hpp	2012-02-21 09:54:35.651939572 -0700
++++ gdl/src/gdlgstream.hpp	2012-01-02 14:20:38.000000000 -0700
 @@ -36,26 +36,19 @@
  {
    void init(); // prevent plstream::init from being called directly
@@ -28805,43 +29539,18 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlgstream.hpp gdl/src/gdlgstream.hpp
    }
  
    static void SetErrorHandlers();
-diff -ruN --exclude CVS gdl-0.9.2/src/gdlgstream.hpp.rej gdl/src/gdlgstream.hpp.rej
---- gdl-0.9.2/src/gdlgstream.hpp.rej	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/src/gdlgstream.hpp.rej	2011-08-22 08:48:35.878147873 -0600
-@@ -0,0 +1,29 @@
-+--- src/gdlgstream.hpp.includes	2010-06-11 09:09:51.000000000 -0600
-++++ src/gdlgstream.hpp	2011-08-18 13:10:41.285235153 -0600
-+@@ -50,7 +50,7 @@
-+   {
-+ //   std::cerr << "GDLGStream()" << std::endl;
-+     if (!checkPlplotDriver(driver))
-+-      ThrowGDLException(string("PLplot installation lacks the requested driver: ") + driver);
-++      ThrowGDLException(std::string("PLplot installation lacks the requested driver: ") + driver);
-+   }
-+ 
-+   virtual ~GDLGStream()
-+@@ -103,7 +103,7 @@
-+ 
-+ //     devNames = new std::vector<std::string>( numdevs_plus_one - 1);
-+     for( int i = 0; i < numdevs_plus_one - 1; ++i)
-+-		devNames.push_back(string(devnames[ i]));
-++		devNames.push_back(std::string(devnames[ i]));
-+     
-+     free(devnames);
-+ }
-+@@ -111,7 +111,7 @@
-+ // for debug
-+ std::vector<std::string> devnamesDbg = devNames;
-+ 
-+-return std::find( devNames.begin(), devNames.end(), string( driver)) != devNames.end();
-++return std::find( devNames.begin(), devNames.end(), std::string( driver)) != devNames.end();
-+ 
-+ //     checking if a given driver is in the list
-+ //     bool supported = false;
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.cpp gdl/src/GDLInterpreter.cpp
 --- gdl-0.9.2/src/GDLInterpreter.cpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLInterpreter.cpp	2012-02-21 09:54:33.814006265 -0700
-@@ -3843,11 +3843,13 @@
++++ gdl/src/GDLInterpreter.cpp	2012-07-16 07:21:15.000000000 -0600
+@@ -2277,6 +2277,7 @@
+ 	aD->Root(structR); 
+ 	}
+ 		}
++	return;
+ 	//	_retTree = _t;
+ 	
+ 	
+@@ -3843,11 +3844,13 @@
  ) {
  	ProgNodeP parameter_def_AST_in = (_t == ProgNodeP(ASTNULL)) ? ProgNodeP(antlr::nullAST) : _t;
  	
@@ -28856,7 +29565,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.cpp gdl/src/GDLInterpreter.
  	
  	try{
  	
-@@ -5081,7 +5083,8 @@
+@@ -3879,7 +3882,7 @@
+ 	while(_retTree != NULL) 
+ 	static_cast<ParameterNode*>(_retTree)->Parameter( actEnv);
+ 	}    
+-	actEnv->Extra(); // expand _EXTRA        
++	actEnv->ResolveExtra(); // expand _EXTRA        
+ 	}
+ 	} 
+ 	catch( GDLException& e)
+@@ -5081,7 +5084,8 @@
  	
  	EnvBaseT* callerEnv = callStack.back();
  	EnvBaseT* oldNewEnv = callerEnv->GetNewEnv();
@@ -28866,7 +29584,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.cpp gdl/src/GDLInterpreter.
  	
  	try{
  	
-@@ -5305,6 +5308,8 @@
+@@ -5094,7 +5098,7 @@
+ 	while(_retTree != NULL) 
+ 	static_cast<ParameterNode*>(_retTree)->Parameter( actEnv);
+ 	
+-	actEnv->Extra(); // expand _EXTRA        
++	actEnv->ResolveExtra(); // expand _EXTRA        
+ 	}
+ 	} 
+ 	catch( GDLException& e)
+@@ -5305,6 +5309,8 @@
  	"FOREACH_INDEX_LOOP",
  	"FCALL",
  	"FCALL_LIB",
@@ -28875,7 +29602,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.cpp gdl/src/GDLInterpreter.
  	"FCALL_LIB_RETNEW",
  	"IF_ELSE",
  	"KEYDECL",
-@@ -5500,14 +5505,14 @@
+@@ -5500,14 +5506,14 @@
  	0
  };
  
@@ -28894,7 +29621,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.cpp gdl/src/GDLInterpreter.
  // NSTRUC NSTRUC_REF POSTDEC POSTINC STRUC SYSVAR VAR VARPTR DEC INC DOT 
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.hpp gdl/src/GDLInterpreter.hpp
 --- gdl-0.9.2/src/GDLInterpreter.hpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLInterpreter.hpp	2012-02-21 09:54:33.871004197 -0700
++++ gdl/src/GDLInterpreter.hpp	2011-12-03 07:28:36.000000000 -0700
 @@ -696,7 +696,8 @@
      }
  
@@ -28920,7 +29647,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreter.hpp gdl/src/GDLInterpreter.
  	
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreterTokenTypes.hpp gdl/src/GDLInterpreterTokenTypes.hpp
 --- gdl-0.9.2/src/GDLInterpreterTokenTypes.hpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLInterpreterTokenTypes.hpp	2012-02-21 09:54:33.877003979 -0700
++++ gdl/src/GDLInterpreterTokenTypes.hpp	2011-11-15 16:19:00.000000000 -0700
 @@ -48,198 +48,200 @@
  		FOREACH_INDEX_LOOP = 37,
  		FCALL = 38,
@@ -29316,7 +30043,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreterTokenTypes.hpp gdl/src/GDLIn
  #ifdef __cplusplus
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreterTokenTypes.txt gdl/src/GDLInterpreterTokenTypes.txt
 --- gdl-0.9.2/src/GDLInterpreterTokenTypes.txt	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLInterpreterTokenTypes.txt	2012-02-21 09:54:33.933001946 -0700
++++ gdl/src/GDLInterpreterTokenTypes.txt	2011-11-15 16:19:00.000000000 -0700
 @@ -36,195 +36,197 @@
  FOREACH_INDEX_LOOP=37
  FCALL=38
@@ -29709,7 +30436,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLInterpreterTokenTypes.txt gdl/src/GDLIn
 +MAX_TOKEN_NUMBER=233
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLLexer.cpp gdl/src/GDLLexer.cpp
 --- gdl-0.9.2/src/GDLLexer.cpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLLexer.cpp	2012-02-21 09:54:33.954001185 -0700
++++ gdl/src/GDLLexer.cpp	2011-11-15 16:19:00.000000000 -0700
 @@ -36,47 +36,47 @@
  
  void GDLLexer::initLiterals()
@@ -29825,7 +30552,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLLexer.cpp gdl/src/GDLLexer.cpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLParser.cpp gdl/src/GDLParser.cpp
 --- gdl-0.9.2/src/GDLParser.cpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLParser.cpp	2012-02-21 09:54:34.040998028 -0700
++++ gdl/src/GDLParser.cpp	2011-11-15 16:19:00.000000000 -0700
 @@ -9302,7 +9302,7 @@
  
  void GDLParser::initializeASTFactory( antlr::ASTFactory& factory )
@@ -30030,7 +30757,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLParser.cpp gdl/src/GDLParser.cpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLParser.hpp gdl/src/GDLParser.hpp
 --- gdl-0.9.2/src/GDLParser.hpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLParser.hpp	2012-02-21 09:54:34.064997158 -0700
++++ gdl/src/GDLParser.hpp	2011-11-15 16:19:00.000000000 -0700
 @@ -214,10 +214,10 @@
  private:
  	static const char* tokenNames[];
@@ -30046,7 +30773,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLParser.hpp gdl/src/GDLParser.hpp
  	
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlpsstream.hpp gdl/src/gdlpsstream.hpp
 --- gdl-0.9.2/src/gdlpsstream.hpp	2011-09-19 06:06:11.000000000 -0600
-+++ gdl/src/gdlpsstream.hpp	2012-02-21 09:54:35.679938557 -0700
++++ gdl/src/gdlpsstream.hpp	2011-12-28 06:25:24.000000000 -0700
 @@ -28,7 +28,7 @@
    bool encapsulated;
  public:
@@ -30058,7 +30785,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlpsstream.hpp gdl/src/gdlpsstream.hpp
    }
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLTokenTypes.hpp gdl/src/GDLTokenTypes.hpp
 --- gdl-0.9.2/src/GDLTokenTypes.hpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLTokenTypes.hpp	2012-02-21 09:54:34.106995634 -0700
++++ gdl/src/GDLTokenTypes.hpp	2011-11-15 16:19:00.000000000 -0700
 @@ -48,198 +48,200 @@
  		FOREACH_INDEX_LOOP = 37,
  		FCALL = 38,
@@ -30454,7 +31181,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLTokenTypes.hpp gdl/src/GDLTokenTypes.hp
  #ifdef __cplusplus
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLTokenTypes.txt gdl/src/GDLTokenTypes.txt
 --- gdl-0.9.2/src/GDLTokenTypes.txt	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLTokenTypes.txt	2012-02-21 09:54:34.163993565 -0700
++++ gdl/src/GDLTokenTypes.txt	2011-11-15 16:19:00.000000000 -0700
 @@ -36,195 +36,197 @@
  FOREACH_INDEX_LOOP=37
  FCALL=38
@@ -30847,7 +31574,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLTokenTypes.txt gdl/src/GDLTokenTypes.tx
 +MAX_TOKEN_NUMBER=233
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParser.cpp gdl/src/GDLTreeParser.cpp
 --- gdl-0.9.2/src/GDLTreeParser.cpp	2011-11-07 16:38:20.000000000 -0700
-+++ gdl/src/GDLTreeParser.cpp	2012-02-21 09:54:34.203992113 -0700
++++ gdl/src/GDLTreeParser.cpp	2011-11-15 16:19:00.000000000 -0700
 @@ -3010,8 +3010,11 @@
  		nParam = para_AST->GetNParam();
  		
@@ -30939,7 +31666,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParser.cpp gdl/src/GDLTreeParser.cp
  // STRUC SYSVAR UMINUS VAR "and" "eq" "ge" "gt" "le" "lt" "mod" "ne" "not" 
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParser.hpp gdl/src/GDLTreeParser.hpp
 --- gdl-0.9.2/src/GDLTreeParser.hpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/GDLTreeParser.hpp	2012-02-21 09:54:34.240990771 -0700
++++ gdl/src/GDLTreeParser.hpp	2011-11-15 16:19:00.000000000 -0700
 @@ -42,6 +42,7 @@
              lT == FCALL_LIB ||
  //            lT == FCALL_LIB_N_ELEMENTS ||
@@ -30963,7 +31690,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParser.hpp gdl/src/GDLTreeParser.hp
  	
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParserTokenTypes.hpp gdl/src/GDLTreeParserTokenTypes.hpp
 --- gdl-0.9.2/src/GDLTreeParserTokenTypes.hpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/GDLTreeParserTokenTypes.hpp	2012-02-21 09:54:34.257990155 -0700
++++ gdl/src/GDLTreeParserTokenTypes.hpp	2011-11-15 16:19:00.000000000 -0700
 @@ -48,198 +48,200 @@
  		FOREACH_INDEX_LOOP = 37,
  		FCALL = 38,
@@ -31359,7 +32086,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParserTokenTypes.hpp gdl/src/GDLTre
  #ifdef __cplusplus
 diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParserTokenTypes.txt gdl/src/GDLTreeParserTokenTypes.txt
 --- gdl-0.9.2/src/GDLTreeParserTokenTypes.txt	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/GDLTreeParserTokenTypes.txt	2012-02-21 09:54:34.296988739 -0700
++++ gdl/src/GDLTreeParserTokenTypes.txt	2011-11-15 16:19:00.000000000 -0700
 @@ -36,195 +36,197 @@
  FOREACH_INDEX_LOOP=37
  FCALL=38
@@ -31752,7 +32479,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/GDLTreeParserTokenTypes.txt gdl/src/GDLTre
 +MAX_TOKEN_NUMBER=233
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlwidget.cpp gdl/src/gdlwidget.cpp
 --- gdl-0.9.2/src/gdlwidget.cpp	2010-11-15 16:06:48.000000000 -0700
-+++ gdl/src/gdlwidget.cpp	2012-02-21 09:54:35.686938302 -0700
++++ gdl/src/gdlwidget.cpp	2012-07-02 03:09:10.000000000 -0600
+@@ -626,7 +626,7 @@
+     wxString *choices = new wxString[n];
+     for( SizeT i=0; i<n; ++i) choices[i] = wxString((*val)[i].c_str(), wxConvUTF8);
+ 
+-    combo = new wxComboBox( panel, widgetID, wxString( choices[0].c_str(), wxConvUTF8),
++    combo = new wxComboBox( panel, widgetID, wxString( (const wchar_t*) choices[0].c_str(), wxConvUTF8),
+ 			    wxDefaultPosition, wxDefaultSize,
+ 			    n, choices, style);
+ 
 @@ -769,15 +769,18 @@
  
      int proIx = ProIx( eventHandler); 
@@ -31762,15 +32498,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlwidget.cpp gdl/src/gdlwidget.cpp
 -    std::auto_ptr< EnvBaseT> e_guard( e);
 -    StackSizeGuard<EnvStackT> guard( GDLInterpreter::CallStack());
 -    GDLInterpreter::CallStack().push_back( e);
+-
+-    EnvBaseT* caller;
+-    caller = e->Caller();
+-    e->Interpreter()->CallStack().pop_back();
 +//     EnvUDT* e;
 +//     e = new EnvUDT( NULL, sub);
 +//     std::auto_ptr< EnvUDT> e_guard( e);
 +//     StackSizeGuard<EnvStackT> guard( GDLInterpreter::CallStack());
 +//     GDLInterpreter::CallStack().push_back( e);
- 
--    EnvBaseT* caller;
--    caller = e->Caller();
--    e->Interpreter()->CallStack().pop_back();
++
 +	// TODO: MS: if the only purpose of e is to get the caller:
 +	// EnvBaseT* caller = GDLInterpreter::CallStack().back(); is sufficient
 +// ms: commented out to comply with new stack handling
@@ -31782,7 +32519,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gdlwidget.cpp gdl/src/gdlwidget.cpp
      id = (*static_cast<DLongGDL*>
 diff -ruN --exclude CVS gdl-0.9.2/src/gdlxstream.cpp gdl/src/gdlxstream.cpp
 --- gdl-0.9.2/src/gdlxstream.cpp	2010-06-11 09:09:51.000000000 -0600
-+++ gdl/src/gdlxstream.cpp	2012-02-21 09:54:35.705937613 -0700
++++ gdl/src/gdlxstream.cpp	2012-01-26 16:21:14.000000000 -0700
 @@ -171,12 +171,13 @@
    r1 = (PLINT) rb;
    g1 = (PLINT) gb;
@@ -32361,7 +33098,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/getas.cpp gdl/src/getas.cpp
 \ No newline at end of file
 diff -ruN --exclude CVS gdl-0.9.2/src/graphics.cpp gdl/src/graphics.cpp
 --- gdl-0.9.2/src/graphics.cpp	2010-06-11 09:09:51.000000000 -0600
-+++ gdl/src/graphics.cpp	2012-02-21 09:54:35.731936666 -0700
++++ gdl/src/graphics.cpp	2011-12-28 16:14:09.000000000 -0700
 @@ -232,6 +232,5 @@
  
  void Graphics::LoadCT( UInt iCT)
@@ -32371,7 +33108,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/graphics.cpp gdl/src/graphics.cpp
  }
 diff -ruN --exclude CVS gdl-0.9.2/src/gshhs.cpp gdl/src/gshhs.cpp
 --- gdl-0.9.2/src/gshhs.cpp	2011-07-08 06:39:43.000000000 -0600
-+++ gdl/src/gshhs.cpp	2012-02-21 09:54:35.751935943 -0700
++++ gdl/src/gshhs.cpp	2011-11-16 11:08:50.000000000 -0700
 @@ -301,7 +301,7 @@
    void map_continents(EnvT* e)
    {
@@ -32383,7 +33120,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gshhs.cpp gdl/src/gshhs.cpp
  } // namespace
 diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 --- gdl-0.9.2/src/gsl_fun.cpp	2011-10-20 02:08:53.000000000 -0600
-+++ gdl/src/gsl_fun.cpp	2012-05-10 15:10:05.105480799 -0600
++++ gdl/src/gsl_fun.cpp	2012-07-14 12:56:37.000000000 -0600
+@@ -4,7 +4,7 @@
+     begin                : Jan 20 2004
+     copyright            : (C) 2004 by Joel Gales
+     email                : jomoga at users.sourceforge.net
+- ***************************************************************************/
++***************************************************************************/
+ 
+ /***************************************************************************
+  *                                                                         *
 @@ -26,6 +26,9 @@
  #include "gsl_fun.hpp"
  #include "dinterpreter.hpp"
@@ -32404,7 +33150,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
  // constant
  #include <gsl/gsl_const_mksa.h>
  #include <gsl/gsl_const_num.h>
-@@ -75,6 +81,10 @@
+@@ -75,6 +81,15 @@
  // spher_harm
  #include <gsl/gsl_sf_legendre.h>
  
@@ -32412,10 +33158,352 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +#include <gsl/gsl_errno.h>
 +#include "interp_multid.h"
 +
++//fx_root
++#include <stdio.h>
++#include <iostream>
++#include <complex>
++
  #define LOG10E 0.434294
  
  namespace lib {
-@@ -877,29 +887,52 @@
+@@ -93,8 +108,8 @@
+     double det;
+     long singular=0;
+ 
+-//     if( nParam == 0)
+-//       e->Throw( "Incorrect number of arguments.");
++    //     if( nParam == 0)
++    //       e->Throw( "Incorrect number of arguments.");
+ 
+     BaseGDL* p0 = e->GetParDefined( 0);
+ 
+@@ -111,8 +126,8 @@
+     }
+ 
+     // status 
+-	// check here, if not done, res would be pending in case of SetPar() throws
+-	// SetPar() only throws in AssureGlobalPar()
++    // check here, if not done, res would be pending in case of SetPar() throws
++    // SetPar() only throws in AssureGlobalPar()
+     if (nParam == 2) e->AssureGlobalPar( 1);
+ 
+     // only one element matrix
+@@ -129,7 +144,7 @@
+ 	  singular=1;
+ 	  (*res)[0]= DComplexDbl(0., 0.);
+ 	} else {
+-	(*res)[0]= DComplexDbl(a/deno, -b/deno);
++	  (*res)[0]= DComplexDbl(a/deno, -b/deno);
+ 	}
+ 	if (nParam == 2) e->SetPar(1,new DLongGDL( singular)); 
+ 	return res;
+@@ -172,7 +187,7 @@
+       } else {
+ 	(*res)[0]= 1.0 / ((*res)[0]);
+       }
+-	if (nParam == 2) e->SetPar(1,new DLongGDL( singular)); 
++      if (nParam == 2) e->SetPar(1,new DLongGDL( singular)); 
+       return res;
+     }
+     
+@@ -299,9 +314,9 @@
+ 	DByteGDL* p0B = static_cast<DByteGDL*>( p0);
+ 
+ 	//	if (p0->Type() == STRING) {
+-	  DFloatGDL* p0SS = static_cast<DFloatGDL*>
+-	    (p0->Convert2( FLOAT, BaseGDL::COPY));
+-	  //}
++	DFloatGDL* p0SS = static_cast<DFloatGDL*>
++	  (p0->Convert2( FLOAT, BaseGDL::COPY));
++	//}
+ 
+ 	DFloatGDL* res = new DFloatGDL( p0->Dim(), BaseGDL::NOZERO);
+ 
+@@ -369,7 +384,7 @@
+ 
+   template< typename T>
+   int cp2data_template( BaseGDL* p0, T* data, SizeT nEl, 
+-			 SizeT offset, SizeT stride_in, SizeT stride_out)
++			SizeT offset, SizeT stride_in, SizeT stride_out)
+   {
+     switch ( p0->Type()) {
+     case DOUBLE: 
+@@ -537,74 +552,145 @@
+     }
+   }
+ 
+-
+   template < typename T>
+   T* fft_template(BaseGDL* p0,
+ 		  SizeT nEl, SizeT dbl, SizeT overwrite, 
+ 		  double direct, DLong dimension)
+   {
+     SizeT offset;
+-    SizeT stride;
+-
++    SizeT stride=1;
++    
+     T* res;
+-
++    T* tabtemp=new T(p0->Dim());
++    
+     if (overwrite == 0)
+-      if (dimension == 0)
++      {
+ 	res = new T( p0->Dim(), BaseGDL::ZERO);
+-      else
+-	res = new T( p0->Dim(dimension-1), BaseGDL::ZERO);
++      } 
+     else
+       res = (T*) p0;
++    
++    DComplexGDL* tabfft = new DComplexGDL(p0->Dim()) ;
++    DComplexGDL* p0C = static_cast<DComplexGDL*>
++      (p0->Convert2( COMPLEX, BaseGDL::COPY));
++            
++    int dec=0;
++    int temp=0;
++    int flag=0;
++    int l=0;
++        
++    int tab[tabfft->Rank()];
++    for (int y=0;y<tabfft->Rank();y++)
++      tab[y]=0;
++    
++    // Debut demontage tab
+ 
+-
+-    if( p0->Rank() == 1 || dimension > 0) {
+-	offset=0;
+-	stride=1;
+-
+-	fft_1d( p0, &(*res)[0], nEl, offset, stride, 
+-		direct, dbl, dimension);
+-
+-    } else if ( p0->Rank() == 2) {
+-      stride=p0->Dim(0);
+-      for( SizeT i=0; i<p0->Dim(0); ++i) {
+-	fft_1d( p0, &(*res)[0], p0->Dim(1), i, stride, 
+-		direct, dbl, dimension);
+-      }
+-      for( SizeT i=0; i<p0->Dim(1); ++i) {
+-	fft_1d( res, &(*res)[0], 
+-		p0->Dim(0), i*p0->Dim(0), 1, 
+-		direct, dbl, dimension);
+-      }
+-    } else if( p0->Rank() >= 3) {
+-      unsigned char *used = new unsigned char [nEl];
+-
+-      stride = nEl;
+-      for( SizeT i=p0->Rank(); i<nEl; ++i) used[i] = 0;
+-
+-      for (SizeT k=p0->Rank(); k>0; --k) {
+-	for( SizeT i=0; i<nEl; ++i) used[i] = 0;
+-	stride /= p0->Dim(k-1);
+-
+-	SizeT cnt=1;
+-	offset = 0;
+-	while(cnt <= nEl/p0->Dim(k-1)) {
+-	  if (used[offset] != 1) {
+-	    cnt++;
+-	    for( SizeT i=0; i<p0->Dim(k-1); ++i) 
+-	      used[offset+i*stride] = 1;
+-	    if (k == p0->Rank())
+-	      fft_1d( p0, &(*res)[0], p0->Dim(k-1), offset, stride, 
+-		      direct, dbl, dimension);
+-	    else
+-	      fft_1d( res, &(*res)[0], p0->Dim(k-1), offset, stride, 
+-		      direct, dbl, dimension);
++    l=0;
++    for(int j=0;j<nEl/tabfft->Dim(dimension);j++)
++      {
++	dec=0;		  
++	flag=0;
++	for(int n=0;n<tabfft->Rank();n++)
++	  {
++	    if(tab[n]!=tabfft->Dim(n)-1 && flag==0 && n!=dimension && l!=0)
++	      {
++		tab[n]++;
++		//cout << "tab[" << n << "] = " << tab[n] << endl;
++		flag=1;
++	      }
++	    else if(tab[n]==tabfft->Dim(n)-1 && flag==0 && n!=dimension && l!=0)
++	      tab[n]=0;
++	    
++	    temp=1;
++	    if(n!=0)
++	      {
++		for(int m=n-1;m>=0;m--)
++		  {
++		    temp=temp*tabfft->Dim(m);
++		  }
++	      }
++	    //cout << "temp = " << temp << endl;
++	    dec=dec+tab[n]*temp;
++	    //cout << "dec = " << dec << endl;
++	  }
++	
++	temp=1;
++	for(int y=dimension-1;y>=0;y--)
++	  {
++	    temp=temp*tabfft->Dim(y);
++	  }
++	for(int i=0; i<tabfft->Dim(dimension);i++)
++	  {
++	    (*tabfft)[l]=(*p0C)[dec+i*temp];
++	    //cout << l << "=" << dec+i*temp << endl;
++	    l++;
+ 	  }
+-	  offset++;
+-	}
+       }
+-      delete used;
+-    }
++    
++    // Fin demontage tab - Debut res
+ 
++    temp=1;
++    for(int y=0;y<tabfft->Rank();y++)
++      {
++	if(y!=dimension)
++	  temp=temp*tabfft->Dim(y);
++      }
++    
++    for(int i=0;i<temp;i++)
++      {
++	
++	offset=i*tabfft->Dim(dimension);
++	fft_1d(tabfft, &(*tabtemp)[0], tabfft->Dim(dimension), offset, stride, 
++	       direct, dbl,1);
++      }
++    
++    // Fin res - Debut remontage
++    
++    for (int y=0;y<tabfft->Rank();y++)
++      tab[y]=0;
++    
++    l=0;
++    for(int j=0;j<nEl/tabfft->Dim(dimension);j++)
++      {
++	dec=0;		  
++	flag=0;
++	for(int n=0;n<tabfft->Rank();n++)
++	  {
++	    if(tab[n]!=tabfft->Dim(n)-1 && flag==0 && n!=dimension && l!=0)
++	      {
++		tab[n]++;
++		//cout << "tab[" << n << "] = " << tab[n] << endl;
++		flag=1;
++	      }
++	    else if(tab[n]==tabfft->Dim(n)-1 && flag==0 && n!=dimension && l!=0)
++	      tab[n]=0;
++	    
++	    temp=1;
++	    if(n!=0)
++	      {
++		for(int m=n-1;m>=0;m--)
++		  {
++		    temp=temp*tabfft->Dim(m);
++		  }
++	      }
++	    //cout << "temp = " << temp << endl;
++	    dec=dec+tab[n]*temp;
++	    //cout << "dec = " << dec << endl;
++	  }
++	
++	temp=1;
++	for(int y=dimension-1;y>=0;y--)
++	  {
++	    temp=temp*tabfft->Dim(y);
++	  }
++	for(int i=0; i<tabfft->Dim(dimension);i++)
++	  {
++	    (*res)[dec+i*temp]=(*tabtemp)[l];
++	    //cout << l << "=" << dec+i*temp << endl;
++	    l++;
++	  }
++      }
++        
+     return res;
+   }
+ 
+@@ -615,11 +701,11 @@
+       Program Flow
+       ------------
+       fft_fun
+-         fft_template
+-	    fft_1d
+-	       (real/complex)_fft_transform_template
+-	          cp2data_template (real only)
+-		     cp2data_2_template (real only)
++      fft_template
++      fft_1d
++      (real/complex)_fft_transform_template
++      cp2data_template (real only)
++      cp2data_2_template (real only)
+     */
+ 
+     SizeT nParam=e->NParam();
+@@ -632,7 +718,7 @@
+ 
+     if( nParam == 0)
+       e->Throw( 
+-			  "Incorrect number of arguments.");
++	       "Incorrect number of arguments.");
+ 
+ 
+     //BaseGDL* p0 = e->GetNumericArrayParDefined( 0); 
+@@ -641,15 +727,15 @@
+     SizeT nEl = p0->N_Elements();
+     if( nEl == 0)
+       e->Throw( 
+-			  "Variable is undefined: "+e->GetParString(0));
++	       "Variable is undefined: "+e->GetParString(0));
+   
+ 
+     if( nParam == 2) {
+       BaseGDL* p1 = e->GetPar( 1);
+       if (p1->N_Elements() > 1)
+ 	e->Throw( 
+-			    "Expression must be a scalar or 1 element array: "
+-			    +e->GetParString(1));
++		 "Expression must be a scalar or 1 element array: "
++		 +e->GetParString(1));
+ 
+ 
+ 
+@@ -665,12 +751,10 @@
+ 
+     // Check for dimension keyword
+     DLong dimension=0;
+-    if(e->KeywordSet(3)) {
++    if(e->KeywordSet(3)) 
+       e->AssureLongScalarKW( 3, dimension);
+-      for( SizeT i=0; i<p0->Rank(); ++i)
+-	if (i != (dimension-1)) nEl /= p0->Dim(i);
+-      overwrite = 0;  // Disable overwrite
+-    }
++    dimension--;
++     
+ 
+     if( p0->Type() == COMPLEXDBL || p0->Type() == DOUBLE || dbl) {
+ 
+@@ -682,7 +766,7 @@
+       return fft_template< DComplexDblGDL> (p0, nEl, dbl, overwrite,
+ 					    direct, dimension);
+ 
+-    }
++    }  
+     else if( p0->Type() == COMPLEX) {
+ 
+ 	//cout << "if 2" << endl;
+@@ -871,35 +955,57 @@
+       }
+   }
+ 
+-
+   template< typename T1, typename T2>
+   int random_template( EnvT* e, T1* res, gsl_rng *r, 
  		       dimension dim, 
  		       DDoubleGDL* binomialKey, DDoubleGDL* poissonKey)
    {
@@ -32477,7 +33565,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
  	if (mu < 100000) {
  	  for( SizeT i=0; i<nEl; ++i) (*res)[ i] =
  					(T2) gsl_ran_poisson (r, mu);
-@@ -910,19 +943,20 @@
+@@ -910,19 +1016,20 @@
  	  for( SizeT i=0; i<nEl; ++i) (*res)[ i] += mu;
  	}
        }
@@ -32506,7 +33594,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
    }
  
  
-@@ -1001,6 +1035,16 @@
+@@ -1001,6 +1108,16 @@
  
      DSub* pro=dynamic_cast<DSub*>(e->GetPro());
      DDoubleGDL* binomialKey = e->IfDefGetKWAs<DDoubleGDL>( 4);
@@ -32523,7 +33611,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
      DDoubleGDL* poissonKey = e->IfDefGetKWAs<DDoubleGDL>( 5);
  
      if( e->KeywordSet(0)) { // DOUBLE
-@@ -1014,7 +1058,7 @@
+@@ -1014,7 +1131,7 @@
        return res;
      } else {
        DFloatGDL* res = new DFloatGDL(dim, BaseGDL::NOZERO);
@@ -32532,7 +33620,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
        random_template< DFloatGDL, float>( e, res, r, dim, 
  					  binomialKey, poissonKey);
  
-@@ -1081,7 +1125,7 @@
+@@ -1081,7 +1198,7 @@
        e->Throw( "Complex expression not allowed in this context: "
  		+e->GetParString(0));
      
@@ -32541,7 +33629,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
      DDouble bsize = 1.0;
      if( binsizeKW != NULL)
        {
-@@ -1090,14 +1134,14 @@
+@@ -1090,14 +1207,14 @@
  	  e->Throw( "Illegal BINSIZE.");
        }
  
@@ -32560,7 +33648,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
  	if( nbins < 0)
  	  e->Throw( "Illegal NBINS (<0).");
  	if( nbins == 0) // NBINS=0 is ignored
-@@ -1117,13 +1161,32 @@
+@@ -1117,13 +1234,32 @@
  
      // get min max
      // use MinMax here when NAN will be supported
@@ -32596,11 +33684,11 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    }
 +
 +    int debug=0;
-+    cout << "min/max : " << minVal << " " << maxVal << endl;
++    if (debug) cout << "min/max : " << minVal << " " << maxVal << endl;
  
      // min
      if (minKW == NULL) 
-@@ -1134,7 +1197,7 @@
+@@ -1134,7 +1270,7 @@
  	  a = minVal;
        } 
      else 
@@ -32609,7 +33697,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
      // max
      if (maxKW == NULL) 
        {
-@@ -1154,7 +1217,7 @@
+@@ -1154,7 +1290,7 @@
        } 
      else
        {
@@ -32618,7 +33706,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
  
  	// MAX && !BINSIZE && NBINS -> determine BINSIZE
  	if( binsizeKW == NULL && nbinsKW != NULL)
-@@ -1174,7 +1237,7 @@
+@@ -1174,7 +1310,7 @@
        nbins = static_cast< DLong>( floor( (b - a) / bsize) + 1);
  
      // INPUT keyword
@@ -32627,7 +33715,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
      DLongGDL* input = e->IfDefGetKWAs<DLongGDL>( inputIx);
      if (input != NULL)
        if (input->N_Elements() < nbins)
-@@ -1196,7 +1259,7 @@
+@@ -1196,7 +1332,7 @@
      gsl_histogram_set_ranges_uniform( hh, a, b);
  
      // Set maxVal from keyword if present
@@ -32636,7 +33724,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
  
      // Generate histogram
      for( SizeT i=0; i<nEl; ++i) {
-@@ -1218,18 +1281,18 @@
+@@ -1218,18 +1354,18 @@
      // SA: using aOri/bOri instead of gsl_histogram_min(hh) (as in calculation of LOCATIONS) 
      //     otherwise, when converting e.g. to INT the conversion might give bad results
      // OMAX
@@ -32660,7 +33748,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
  
        if (input != NULL)
  	e->Throw("Conflicting keywords.");
-@@ -1299,12 +1362,12 @@
+@@ -1299,12 +1435,12 @@
  	(*revindKW)[i] = k + nbins + 1;
        }
  
@@ -32676,7 +33764,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
        delete (*locationsKW);
  
        dimension dim( nbins);
-@@ -1377,516 +1440,483 @@
+@@ -1377,516 +1513,483 @@
  
      return(res);
    }
@@ -32719,12 +33807,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +      dims[resRank++] = x->Dim(i); if (resRank>MAXRANK) e->Throw("Rank of resulting array is currently limited to 8.");
      }
 -  }
-+    chunksize=nx;
- 
-+    dimension dim((DLong *)dims, resRank);
-+    DDoubleGDL *res;
-+    res = new DDoubleGDL(dim, BaseGDL::NOZERO);
- 
+-
+-
 -  void twoD_lin_interpolate(SizeT ninterp,
 -			    double *xa, bool grid, 
 -			    SizeT nx, SizeT ny, SizeT nxa, SizeT nya,
@@ -32732,30 +33816,25 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -  {
 -    gsl_interp_accel *acc = gsl_interp_accel_alloc ();
 -    gsl_interp *interp;
--
++    chunksize=nx;
+ 
 -    // Allocate and initialize interpolation arrays
 -    interp = gsl_interp_alloc (gsl_interp_linear, nxa);
 -    //    gsl_interp_init (interp, xa, &(*p0D)[0], nxa);
--
++    dimension dim((DLong *)dims, resRank);
++    DDoubleGDL *res;
++    res = new DDoubleGDL(dim, BaseGDL::NOZERO);
+ 
 -    // Allocate "work" arrays
 -    SizeT ny2 = (ny == 1) * 2 + (ny > 1) * ny;
 -    double **work = new double*[ny2];
 -    for( SizeT k=0; k<ny2; ++k) work[k] = new double[nx];
--
--    double **ya = new double*[nya];
--    for( SizeT k=0; k<nya; ++k) ya[k] = new double[nxa];
--
--    for( SizeT i=0; i<ninterp; ++i) {
 +    // Determine number of interpolations for remaining dimensions
 +    SizeT ninterp = 1;
 +    for (SizeT i = 0; i < rankLeft; ++i) ninterp *= array->Dim(i);
  
--      // Get input y-axis values
--      for( SizeT k=0; k<nya; ++k) {
--	for( SizeT j=0; j<nxa; ++j) {
--	  ya[k][j] = p0[i+(ninterp*j)+(ninterp*nxa)*k];
--	  //  cout << k << "  " << j << "  " << ya[k][j] << endl;
--	}
+-    double **ya = new double*[nya];
+-    for( SizeT k=0; k<nya; ++k) ya[k] = new double[nxa];
 +    //need to PAD the intermediate work array to satisfy the IDL requirement that
 +    //INTERPOLATE considers location points with values between zero and n,
 +    //where n is the number of values in the input array, to be valid.
@@ -32763,11 +33842,18 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    SizeT nxa = array->Dim(rankLeft)+1;
 +    double *xa = new double[nxa];
 +    for (SizeT i = 0; i < nxa; ++i) xa[i] = (double)i;
-+
+ 
+-    for( SizeT i=0; i<ninterp; ++i) {
 +    // Setup interpolation arrays
 +    gsl_interp_accel *accx = gsl_interp_accel_alloc();
 +    gdl_interp1d* interpolant = gdl_interp1d_alloc(interp_type, nxa);
-+
+ 
+-      // Get input y-axis values
+-      for( SizeT k=0; k<nya; ++k) {
+-	for( SizeT j=0; j<nxa; ++j) {
+-	  ya[k][j] = p0[i+(ninterp*j)+(ninterp*nxa)*k];
+-	  //  cout << k << "  " << j << "  " << ya[k][j] << endl;
+-	}
 +    // output locations tables:
 +    double *xval = new double[chunksize];
 +    for (SizeT count = 0; count < chunksize; ++count)
@@ -32831,34 +33917,34 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -
 -      } // row (k) loop
 -    } // interp loop 
-+    gsl_interp_accel_free(accx);
-+    gdl_interp1d_free(interpolant);
-+    return res;
-+ }
- 
+-
 -    // Free dynamic arrays
 -    for( SizeT k=0; k<ny2; ++k) 
 -      delete [] work[k];
 -    delete [] work;
++    gsl_interp_accel_free(accx);
++    gdl_interp1d_free(interpolant);
++    return res;
++ }
  
 -    for( SizeT k=0; k<nya; ++k) 
 -      delete [] ya[k];
 -    delete [] ya;
-+DDoubleGDL* interpolate_2dim(EnvT* e, const gdl_interp2d_type* interp_type, DDoubleGDL* array, DDoubleGDL* x, DDoubleGDL* y, bool grid, bool use_missing, DDouble missing, DDouble gamma)
-+{
  
 -    gsl_interp_accel_free (acc);
 -    gsl_interp_free (interp);
 -  }
++DDoubleGDL* interpolate_2dim(EnvT* e, const gdl_interp2d_type* interp_type, DDoubleGDL* array, DDoubleGDL* x, DDoubleGDL* y, bool grid, bool use_missing, DDouble missing, DDouble gamma)
++{
+ 
 +    SizeT nx = x->N_Elements();
 +    SizeT ny = y->N_Elements();
  
-+    if (nx == 1 && ny == 1)  grid = false;
- 
 -  BaseGDL* interpolate_fun( EnvT* e)
 -  {
 -    SizeT nParam=e->NParam();
--
++    if (nx == 1 && ny == 1)  grid = false;
+ 
 -    if( nParam < 2)
 -      e->Throw("Incorrect number of arguments.");
 +    // Determine number and value of input points along x-axis and y-axis
@@ -33000,11 +34086,11 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    // Determine number of interpolations for remaining dimensions
      SizeT ninterp = 1;
 -    for( SizeT i=0; i<p0->Rank()-(nParam-1); ++i) ninterp *= p0->Dim(i);
-+    for (SizeT i = 0; i < rankLeft; ++i) ninterp *= array->Dim(i);
- 
+-
 -    // 1D Interpolation
 -    if( nParam == 2) {
--
++    for (SizeT i = 0; i < rankLeft; ++i) ninterp *= array->Dim(i);
+ 
 -      // Setup interpolation arrays
 -      gsl_interp_accel *acc = gsl_interp_accel_alloc ();
 -      gsl_interp *interp;
@@ -33183,15 +34269,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -      SizeT nxa = p0->Dim(p0->Rank()-nParam+1);
 -      double *xa = new double[nxa];
 -      for( SizeT i=0; i<nxa; ++i) xa[i] = (double) i;
-+      {
-+        for (SizeT i = 0; i < x->Rank(); ++i)
-+        {
-+          if (x->Dim(i) != y->Dim(i) || x->Dim(i) != z->Dim(i))
-+            e->Throw("Coordinate arrays must have same shape if Grid not set.");
-+        }
-+      }
-+    }
- 
+-
 -      // Determine number and value of input points along y-axis
 -      SizeT nya = p0->Dim(p0->Rank()-1);
 -      
@@ -33201,6 +34279,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -			   &(*p0D)[0], &(*p1D)[0], &(*p2D)[0], &(*res)[0], use_missing, missing);
 -      
 -      delete [] xa;
++      {
++        for (SizeT i = 0; i < x->Rank(); ++i)
++        {
++          if (x->Dim(i) != y->Dim(i) || x->Dim(i) != z->Dim(i))
++            e->Throw("Coordinate arrays must have same shape if Grid not set.");
++        }
++      }
++    }
+ 
+-    } // if( nParam == 3)
 +    //initialize output array with correct dimensions
 +    DLong dims[MAXRANK] = {0, 0, 0, 0, 0, 0, 0, 0};
 +    SizeT resRank;
@@ -33227,11 +34315,12 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    DDoubleGDL *res;
 +    res = new DDoubleGDL(dim, BaseGDL::NOZERO);
  
--    } // if( nParam == 3)
 +    // Determine number of interpolations for remaining dimensions
 +    SizeT ninterp = 1;
 +    for (SizeT i = 0; i < rankLeft; ++i) ninterp *= array->Dim(i);
  
+-    // 3D Interpolation
+-    if( nParam == 4) {
 +    SizeT nxa = array->Dim(rankLeft);
 +    double *xa = new double[nxa];
 +    for (SizeT i = 0; i < nxa; ++i) xa[i] = (double)i;
@@ -33284,8 +34373,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    //construct 3d intermediate array, subset of array with stride ninterp
 +    double *temp = new double[nxa*nya*nza];
  
--    // 3D Interpolation
--    if( nParam == 4) {
+-      if( cubic)
+-	e->Throw("Bicubic interpolation not supported.");
 +    // Interpolate iteratively ninterp times:
 +    // this outer loop could be multihreaded easily
 +    for (SizeT iterate = 0; iterate < ninterp; ++iterate)
@@ -33301,15 +34390,6 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +      }
 +    }
  
--      if( cubic)
--	e->Throw("Bicubic interpolation not supported.");
-+    gsl_interp_accel_free(accx);
-+    gsl_interp_accel_free(accy);
-+    gsl_interp_accel_free(accz);
-+    gdl_interp3d_free(interpolant);
-+    return res;
-+ }
- 
 -      if ( p1->Type() == DOUBLE) 
 -	p1D = static_cast<DDoubleGDL*> ( p1);
 -      else
@@ -33318,6 +34398,12 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -	  (p1->Convert2( DOUBLE, BaseGDL::COPY));
 -	guard1.reset( p1D);
 -	}	
++    gsl_interp_accel_free(accx);
++    gsl_interp_accel_free(accy);
++    gsl_interp_accel_free(accz);
++    gdl_interp3d_free(interpolant);
++    return res;
++ }
  
 -      if ( p2->Type() == DOUBLE) 
 -	p2D = static_cast<DDoubleGDL*> ( p2);
@@ -33327,7 +34413,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -	  (p2->Convert2( DOUBLE, BaseGDL::COPY));
 -	guard2.reset( p2D);
 -	}	
--
+ 
 -      if ( p3->Type() == DOUBLE) 
 -	p3D = static_cast<DDoubleGDL*> ( p3);
 -      else
@@ -33377,7 +34463,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    p0D = static_cast<DDoubleGDL*>(p0->Convert2(DOUBLE, BaseGDL::COPY));
 +    guard0.reset(p0D);
 +  }
- 
++
 +  BaseGDL* p1 = e->GetParDefined(1);
 +  if (p1->Type() == DOUBLE) p1D = static_cast<DDoubleGDL*>(p1);
 +  else
@@ -33385,6 +34471,28 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    p1D = static_cast<DDoubleGDL*>(p1->Convert2(DOUBLE, BaseGDL::COPY));
 +    guard1.reset(p1D);
 +  }
++
++  BaseGDL* p2 = NULL;
++  if (nParam >= 3) {
++    p2 = e->GetParDefined(2);
++    if (p2->Type() == DOUBLE) p2D = static_cast<DDoubleGDL*>(p2);
++    else
++    {
++      p2D = static_cast<DDoubleGDL*>(p2->Convert2(DOUBLE, BaseGDL::COPY));
++      guard2.reset(p2D);
++    }
++  }
+ 
++  BaseGDL* p3 = NULL;
++  if (nParam >= 4) {
++    p3 = e->GetParDefined(3);
++    if (p3->Type() == DOUBLE) p3D = static_cast<DDoubleGDL*>(p3);
++    else
++    {
++      p3D = static_cast<DDoubleGDL*>(p3->Convert2(DOUBLE, BaseGDL::COPY));
++      guard3.reset(p3D);
++    }
++  }
  
 -      // Compute nx,ny (number of interpolated points along each dimension
 -      SizeT nx = 1;
@@ -33434,15 +34542,23 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -	      work_za[k] = work_xy[k*nx*ny + j*nx + i];
 -	    interpolate_linear(acc, interp_z, za, nz, work_za, 
 -			       &(*p3D)[0], work_z, use_missing, missing);
-+  BaseGDL* p2 = NULL;
-+  if (nParam >= 3) {
-+    p2 = e->GetParDefined(2);
-+    if (p2->Type() == DOUBLE) p2D = static_cast<DDoubleGDL*>(p2);
-+    else
-+    {
-+      p2D = static_cast<DDoubleGDL*>(p2->Convert2(DOUBLE, BaseGDL::COPY));
-+      guard2.reset(p2D);
-+    }
++  // Determine dimensions of output
++  DDoubleGDL* res;
++  // 1D Interpolation
++  if (nParam == 2) {
++ //   res=interpolate_1dim(e,p0D,p1D,cubic,use_missing,missing);
++    if (nnbor)   res=interpolate_1dim(e,gdl_interp1d_nearest,p0D,p1D,use_missing,missing,0.0);
++    else if (cubic)   res=interpolate_1dim(e,gdl_interp1d_cubic,p0D,p1D,use_missing,missing,gamma);
++    else         res=interpolate_1dim(e,gdl_interp1d_linear,p0D,p1D,use_missing,missing,0.0);
++  }
++ 
++  if (nParam == 3) {
++    if (nnbor)        res=interpolate_2dim(e,gdl_interp2d_binearest,p0D,p1D,p2D,grid,use_missing,missing,0.0);
++    else if (cubic)   res=interpolate_2dim(e,gdl_interp2d_bicubic,p0D,p1D,p2D,grid,use_missing,missing,gamma);
++    else              res=interpolate_2dim(e,gdl_interp2d_bilinear,p0D,p1D,p2D,grid,use_missing,missing,0.0);
++  }
++  if (nParam == 4) {
++    res=interpolate_3dim(e,gdl_interp3d_trilinear,p0D,p1D,p2D,p3D,grid,use_missing,missing);
 +  }
  
 -	    for( SizeT k=0; k<nz; ++k) (*res)[k*nx*ny + j*nx + i] = work_z[k];
@@ -33519,37 +34635,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 -      return res1;
 -    } else {
 -      return res;
-+  BaseGDL* p3 = NULL;
-+  if (nParam >= 4) {
-+    p3 = e->GetParDefined(3);
-+    if (p3->Type() == DOUBLE) p3D = static_cast<DDoubleGDL*>(p3);
-+    else
-+    {
-+      p3D = static_cast<DDoubleGDL*>(p3->Convert2(DOUBLE, BaseGDL::COPY));
-+      guard3.reset(p3D);
-     }
+-    }
 -    
-   }
- 
-+  // Determine dimensions of output
-+  DDoubleGDL* res;
-+  // 1D Interpolation
-+  if (nParam == 2) {
-+ //   res=interpolate_1dim(e,p0D,p1D,cubic,use_missing,missing);
-+    if (nnbor)   res=interpolate_1dim(e,gdl_interp1d_nearest,p0D,p1D,use_missing,missing,NULL);
-+    else if (cubic)   res=interpolate_1dim(e,gdl_interp1d_cubic,p0D,p1D,use_missing,missing,gamma);
-+    else         res=interpolate_1dim(e,gdl_interp1d_linear,p0D,p1D,use_missing,missing,NULL);
-+  }
-+ 
-+  if (nParam == 3) {
-+    if (nnbor)        res=interpolate_2dim(e,gdl_interp2d_binearest,p0D,p1D,p2D,grid,use_missing,missing,NULL);
-+    else if (cubic)   res=interpolate_2dim(e,gdl_interp2d_bicubic,p0D,p1D,p2D,grid,use_missing,missing,gamma);
-+    else              res=interpolate_2dim(e,gdl_interp2d_bilinear,p0D,p1D,p2D,grid,use_missing,missing,NULL);
-+  }
-+  if (nParam == 4) {
-+    res=interpolate_3dim(e,gdl_interp3d_trilinear,p0D,p1D,p2D,p3D,grid,use_missing,missing);
-+  }
-+
 +  if (p0->Type() == DOUBLE)
 +  {
 +    return res;
@@ -33613,14 +34700,14 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +  else
 +  {
 +    return res;
-+  }
-+
+   }
+ 
 +}
 +
  
    void la_trired_pro( EnvT* e)
    {
-@@ -2155,6 +2185,7 @@
+@@ -2155,6 +2258,7 @@
        }
    }
  
@@ -33628,7 +34715,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
    // gsl_multiroot_function-compatible function serving as a wrapper to the 
    // user-defined function passed (by name) as the second arg. to NEWTON or BROYDEN
    class n_b_param 
-@@ -2178,10 +2209,12 @@
+@@ -2178,10 +2282,12 @@
      // TODO: no guarding if res is an optimized constant
      // NO!!! the return value of call_fun() is always owned by the caller (constants are Dup()ed)
     auto_ptr<BaseGDL> res_guard(res);
@@ -33645,7 +34732,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
        return GSL_EBADFUNC;
      }
      DDoubleGDL* dres;
-@@ -2246,8 +2279,9 @@
+@@ -2246,8 +2352,9 @@
      SizeT nParam = e->NParam();
  
      // 1-st argument : initial guess vector
@@ -33657,7 +34744,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
      BaseGDL* par = p0->Convert2(DOUBLE, BaseGDL::COPY);
      auto_ptr<BaseGDL> par_guard(par);
  
-@@ -2349,6 +2383,244 @@
+@@ -2349,6 +2456,569 @@
      );
    }
  
@@ -33784,6 +34871,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +      }
 +  }
 +
++
 +  // AC: the library routine is registered in libinit_ac.cpp
 +  BaseGDL* qromo_fun(EnvT* e)
 +  {
@@ -33791,18 +34879,33 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +
 +    // sanity check (for number of parameters)
 +    SizeT nParam = e->NParam();
++    if(e->KeywordSet("MIDEXP"))
++      {
++	if (nParam < 2) e->Throw("Incorrect number of arguments.");
++	if (nParam > 2) e->Throw("Too many arguments.");
++      }
++    else
++      {
++	if (nParam < 3) e->Throw("Incorrect number of arguments.");
++      }
 +
 +    // 2-nd argument : initial bound
-+    BaseGDL* p1 = e->GetParDefined(1);
-+    BaseGDL* par1 = p1->Convert2(DOUBLE, BaseGDL::COPY);
++    BaseGDL* p1 = NULL;
++    BaseGDL* par1 = NULL;
++    p1 = e->GetParDefined(1);
++    par1 = p1->Convert2(DOUBLE, BaseGDL::COPY);
 +    auto_ptr<BaseGDL> par1_guard(par1);
 +
-+    //   if (!e->KeywordSet("MIDEXP")) {
-+    // 3-th argument : final bound
-+    BaseGDL* p2 = e->GetParDefined(2);
-+    BaseGDL* par2 = p2->Convert2(DOUBLE, BaseGDL::COPY);
-+    auto_ptr<BaseGDL> par2_guard(par2);
-+    
++    BaseGDL* p2 = NULL;
++    BaseGDL* par2 = NULL;
++    if (!e->KeywordSet("MIDEXP"))
++     {
++	// 3-th argument : final bound
++	p2 = e->GetParDefined(2);
++	par2 = p2->Convert2(DOUBLE, BaseGDL::COPY);
++	auto_ptr<BaseGDL> par2_guard(par2);
++     }
++
 +    // 1-st argument : name of user function defining the system
 +    DString fun;
 +    e->AssureScalarPar<DStringGDL>(0, fun);
@@ -33810,6 +34913,20 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    if (LibFunIx(fun) != -1)
 +      e->Throw("only user-defined functions allowed (library-routine name given)");
 +
++    gsl_error_handler_t* old_handler = gsl_set_error_handler(&n_b_gslerrhandler);
++    n_b_gslerrhandler(e->GetProName().c_str(), NULL, -1, -1);
++
++    // Check for impossible case
++    bool flag=0;
++    for(SizeT i=4;i<=8;i++) 
++      {
++	if(flag==1 && e->KeywordPresent(i))
++	  {
++	    e->Throw("Incorrect number of arguments.");
++	  }
++	else if (flag==0 && e->KeywordPresent(i)) flag=1;
++      }
++
 +    // GDL magick
 +    StackGuard<EnvStackT> guard(e->Interpreter()->CallStack());
 +    EnvUDT* newEnv = new EnvUDT(e, funList[GDLInterpreter::GetFunIx(fun)], NULL);
@@ -33831,87 +34948,393 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.cpp gdl/src/gsl_fun.cpp
 +    double first, last;
 +
 +    SizeT nEl1=par1->N_Elements();
-+    //SizeT nEl2=nEl1;
-+    //if (!e->KeywordSet("MIDEXP"))
-+    SizeT nEl2=par2->N_Elements();
++    SizeT nEl2=nEl1;
++    if (!e->KeywordSet("MIDEXP")) 
++      SizeT nEl2=par2->N_Elements();
 +    SizeT nEl=nEl1;
 +    DDoubleGDL* res;
-+
-+    if (nEl1 == 1 || nEl2 == 1) {
-+      if (nEl1 == 1) {
-+	nEl=nEl2;
-+	res=new DDoubleGDL(par2->Dim(), BaseGDL::NOZERO);
-+      }
-+      if (nEl2 == 1) {
-+	res=new DDoubleGDL(par1->Dim(), BaseGDL::NOZERO);
-+	nEl=nEl1;
-+      }
-+    } else {
-+      if (nEl1 <= nEl2) {
-+	res=new DDoubleGDL(par1->Dim(), BaseGDL::NOZERO);      
++    if (!e->KeywordSet("MIDEXP")) {
++      if (nEl1 == 1 || nEl2 == 1) {
++	if (nEl1 == 1) {
++	  nEl=nEl2;
++	  res=new DDoubleGDL(par2->Dim(), BaseGDL::NOZERO);
++	}
++	if (nEl2 == 1) {
++	  res=new DDoubleGDL(par1->Dim(), BaseGDL::NOZERO);
++	  nEl=nEl1;
++	}
 +      } else {
-+	res=new DDoubleGDL(par2->Dim(), BaseGDL::NOZERO);
-+	nEl=nEl2;
++	if (nEl1 <= nEl2) {
++	  res=new DDoubleGDL(par1->Dim(), BaseGDL::NOZERO);     
++	} else {
++	  res=new DDoubleGDL(par2->Dim(), BaseGDL::NOZERO);
++	  nEl=nEl2;
++	}
 +      }
-+    }  
++    }
++    else res=new DDoubleGDL(par1->Dim(), BaseGDL::NOZERO);
 +    
-+    gsl_integration_workspace *w = gsl_integration_workspace_alloc (1000);
++    // eps value:
++    double eps;
++    int pos;
++    if(!e->KeywordSet("MIDEXP"))
++	{
++	  if (e->KeywordSet("EPS"))
++	    {
++	      pos = e->KeywordIx("EPS");
++	      e->AssureDoubleScalarKWIfPresent(pos, eps);
++	      if(!isfinite(eps)) eps=1e-6;
++	   }
++	  else if (e->KeywordSet("DOUBLE") || p1->Type() == DOUBLE || p2->Type() == DOUBLE) eps = 1e-12;
++	  else eps = 1e-6;
++	}
++      else if  (e->KeywordSet("EPS"))
++	{
++	  pos = e->KeywordIx("EPS");
++	  e->AssureDoubleScalarKWIfPresent(pos, eps);
++	  if(!isfinite(eps)) eps=1e-6;
++	}
++      else if ((e->KeywordSet("DOUBLE") && e->KeywordSet("MIDEXP")) || p1->Type() == DOUBLE) eps = 1e-12;
++      else eps = 1e-6;
++
++    // Definition of JMAX
++    DLong wsize =static_cast<DLong>(pow(2.0, (20-1)));
++    if(e->KeywordSet("JMAX"))
++      {
++	pos = e->KeywordIx("JMAX");
++	e->AssureLongScalarKWIfPresent(pos, wsize);
++	wsize=static_cast<DLong>(pow(2.0, (wsize-1)));
++      }
++    gsl_integration_workspace *w = gsl_integration_workspace_alloc (wsize);
 +
 +    first=(*static_cast<DDoubleGDL*>(par1))[0];
 +    if (!e->KeywordSet("MIDEXP")) last =(*static_cast<DDoubleGDL*>(par2))[0];
 +    
 +    for( SizeT i=0; i<nEl; i++) {
 +      if (nEl1 > 1) {first=(*static_cast<DDoubleGDL*>(par1))[i];}
-+      if (nEl2 > 1) {last =(*static_cast<DDoubleGDL*>(par2))[i];}
-+
++      if ((!e->KeywordSet("MIDEXP")) && (nEl2 > 1)) {last =(*static_cast<DDoubleGDL*>(par2))[i];}
++      
 +      if (debug) cout << "Boundaries : "<< first << " " << last <<endl;
 +      
-+      // MIDEXP, MIDINF, MIDPNT, MIDSQL, MIDSQU
-+
 +      // intregation on open range [first,+inf[
 +      if (e->KeywordSet("MIDEXP"))
++	{	 
++	  gsl_integration_qagiu(&F, first, 0, eps, wsize, w, &result, &error);
++	} 
++      else if (e->KeywordSet("MIDINF") || e->KeywordSet("MIDPNT") || e->KeywordSet("MIDSQL") || e->KeywordSet("MIDSQU") || e->KeywordSet("JMAX") || e->KeywordSet("K"))
 +	{
-+	  gsl_integration_qagiu(&F, first, 0, 1e-7, 1000, w, &result, &error);
++	  gsl_integration_qag(&F, first, last, 0, eps, GSL_INTEG_GAUSS61, wsize, w, &result, &error);
 +	} 
-+      else
-+	{	
-+	  if (nEl2 > 1) {last =(*static_cast<DDoubleGDL*>(par2))[i];}	  
++       else
++	{		  
 +	  // intregation on open range ]first,last[
-+	  gsl_integration_qags(&F, first, last, 0, 1e-7, 1000, w, &result, &error);
++	  gsl_integration_qag (&F, first, last, 0, eps, GSL_INTEG_GAUSS61, wsize, w, &result, &error);
 +	}
-+
++   
 +      if (debug) cout << "Result : " << result << endl;
-+      
++     
 +      (*res)[i]=result;
 +    }
 +
 +    gsl_integration_workspace_free (w);
-+ 
-+    if (e->KeywordSet("DOUBLE") || p1->Type() == DOUBLE || p2->Type() == DOUBLE)
++
++    if (!e->KeywordSet("MIDEXP"))
 +      {
-+	return res;
++         if (e->KeywordSet("DOUBLE") || p1->Type() == DOUBLE || p2->Type() == DOUBLE) return res;
++	 else return res->Convert2(FLOAT, BaseGDL::CONVERT);
 +      }
-+    else
++    else if (e->KeywordSet("DOUBLE")  || p1->Type() == DOUBLE) return res;
++    else return res->Convert2(FLOAT, BaseGDL::CONVERT);
++  }
++
++
++//FZ_ROOT:compute polynomial roots
++
++  BaseGDL* fz_roots_fun(EnvT* e)
++  {
++
++    static int doubleIx = e->KeywordIx("DOUBLE");
++   
++    // Ascending coefficient array
++    BaseGDL* p0 = e->GetNumericArrayParDefined(0);
++    DDoubleGDL* coef = e->GetParAs<DDoubleGDL>(0);
++    
++    // GSL function
++    
++    if (ComplexType(p0->Type()))
 +      {
-+	return res->Convert2(FLOAT, BaseGDL::CONVERT);
++	e->Throw("Polynomials with complex coefficients not supported yet (FIXME!)");
++      }
++    
++    if (coef->N_Elements() < 2)
++      {
++	e->Throw("Degree of the polynomial must be strictly greather than zero");
++      }
++    
++    for (int i = 0; i <coef->N_Elements();i++)
++      {
++	if (!isfinite((*coef)[i])) e->Throw("Not a number and infinity are not supported");
++      }
++    
++    gsl_poly_complex_workspace* w = gsl_poly_complex_workspace_alloc (coef->N_Elements()); 
++    
++    SizeT resultSize = coef->N_Elements()-1;
++    vector<double> tmp(2 * resultSize);
++	
++    gsl_poly_complex_solve (&(*coef)[0],coef->N_Elements(),w, &(tmp[0]));
++    
++    gsl_poly_complex_workspace_free (w);
++    
++    int debug =0;
++    if (debug) {
++      for (int i = 0; i < resultSize; i++)
++      {
++	printf ("z%d = %+.18f %+.18f\n", i, tmp[2*i], tmp[2*i+1]);
++      }
++    }
++    DComplexDblGDL* result = new DComplexDblGDL(dimension(resultSize), BaseGDL::NOZERO);
++    for (SizeT i = 0; i < resultSize; ++i) 
++      {
++	(*result)[i] = complex<double>(tmp[2 * i], tmp[2 * i + 1]);
 +      }
++      
++    return result->Convert2(
++			    e->KeywordSet(doubleIx) || p0->Type() == DOUBLE
++			    ? COMPLEXDBL 
++			    : COMPLEX, 
++			    BaseGDL::CONVERT);
 +  }
 +
++//FX_ROOT
 +
++class fx_root_param
++{ 
++public: 
++EnvT* envt; 
++EnvUDT* nenvt;
++DComplexDblGDL* arg;  
++};
++
++complex<double> fx_root_function(complex<double> x,void* params)
++{
++  fx_root_param *p = static_cast<fx_root_param*>(params);
++  (*(p->arg))[0] = x;
++  BaseGDL* res;
++  res = p->envt->Interpreter()->call_fun(static_cast<DSubUD*>(p->nenvt->GetPro())->GetTree());
++  return (*static_cast<DComplexDblGDL*>(res))[0]; 
++}
++ 
++BaseGDL* fx_root_fun(EnvT* e)
++{       
++  //Sanity check
++  //SizeT nParam = e->NParam();
++  //cout << nParam << endl;
++  
++  //1-st argument: a 2-element real or complex initial guess array
++  BaseGDL* p0 = e->GetNumericArrayParDefined(0);
++  DComplexDblGDL* init = e->GetParAs<DComplexDblGDL>(0);
++  BaseGDL* par0 = p0->Convert2(COMPLEXDBL, BaseGDL::COPY);
++  auto_ptr<BaseGDL> par0_guard(par0);
 +
++  if (init->N_Elements() != 3)
++    {
++      e->Throw("Initial guess vector must be a 3-element vector");
++    }
++  
++  // 2-nd argument : function name 
++  DString fun;
++  e->AssureScalarPar<DStringGDL>(1, fun);
++  fun = StrUpCase(fun);
++  //cout<<fun<<endl;
++  if (LibFunIx(fun) != -1)
++    e->Throw("only user-defined functions allowed (library-routine name given)");
++  
++  // GDL magick
++  StackGuard<EnvStackT> guard(e->Interpreter()->CallStack());
++  EnvUDT* newEnv = new EnvUDT(e, funList[GDLInterpreter::GetFunIx(fun)], NULL);
++  newEnv->SetNextPar(&par0);
++  e->Interpreter()->CallStack().push_back(newEnv);
++  
++  // Function parameter initialization  
++  fx_root_param param;
++  param.envt = e;
++  param.nenvt = newEnv;
++  param.arg = static_cast<DComplexDblGDL*>(par0);
++  
++  //3-rd argument : number of iteration
++  DLong max_iter =100;
++  if (e->KeywordSet("ITMAX"))
++    { 
++      int pos = e->KeywordIx("ITMAX");
++      e->AssureLongScalarKWIfPresent(pos, max_iter);
++    }
++  
++  //4-th argument : stopping criterion
++  DLong stop = 0;
++  if (e->KeywordSet("STOP"))
++    {
++      int pos = e->KeywordIx("STOP");
++      e->AssureLongScalarKWIfPresent(pos, stop);
++    }
++  
++  if (stop != 0 || stop != 1 || isfinite(stop) == 0)
++    {
++      DLong stop = 0;
++    }
++  
++  //5-th argument : tolerance criterion
++  DDouble tol = 0.0001;
++  if (e->KeywordSet("TOL"))
++    {
++      int pos = e->KeywordIx("TOL");
++      e->AssureDoubleScalarKWIfPresent(pos, tol);
++    }
++  if (isfinite(tol) == 0)
++    {
++      DDouble tol = 0.0001;
++    }
++     
++  //Müller method
++  //Initialization and interpolation 
++  
++  complex<double> x0((*init)[0].real(),(*init)[0].imag());
++  complex<double> x1((*init)[1].real(),(*init)[1].imag());
++  complex<double> x2((*init)[2].real(),(*init)[2].imag());
++  
++  //Security tests
++  if ( (x0.real() == x1.real() && x0.imag() == x1.imag()) || (x0.real() == x2.real() && x0.imag() == x2.imag()) || (x1.real() == x2.real() && x1.imag() == x2.imag()) )
++    {
++      e->Throw("Initial parameters must be different");
++    }
++  
++  if ((isfinite(x0.real()) == 0 || isfinite(x0.imag()) == 0) || (isfinite(x1.real()) == 0 || isfinite(x1.imag()) == 0) || (isfinite(x2.real()) == 0 || isfinite(x2.imag()) == 0))
++    {
++      e->Throw("Not a number and Infinity are not supported");
++    }
++
++  complex<double> fx0 = fx_root_function(x0,&param);
++  complex<double> fx1 = fx_root_function(x1,&param);
++  complex<double> fx2 = fx_root_function(x2,&param);
++  complex<double> den = (x0-x2)*(x1-x2)*(x0-x1);
++  complex<double> a = ((x1-x2)*(fx0-fx2)-(x0-x2)*(fx1-fx2))/den;
++  complex<double> b = (pow(x0-x2,2)*(fx1-fx2)-pow(x1-x2,2)*(fx0-fx2))/den;
++  complex<double> c = fx2;
++  complex<double> op;
++  
++  int iter = 0;
++  double stopcri;
++  DComplexDblGDL* res;
++  res=new DComplexDblGDL(1, BaseGDL::NOZERO);
++
++  // before going further, we check whether the "x_i" are roots ?!
++
++  int done=0;
++  if (abs(fx0) < tol) {(*res)[0] = x0; done=1;}
++  if (abs(fx1) < tol) {(*res)[0] = x1; done=1;}
++  if (abs(fx2) < tol) {(*res)[0] = x2; done=1;}
++
++  if (done ==0) {
++    complex<double> tmpdisc;
++    complex<double> discm;
++    complex<double> discp;    
++    int debug=0;
++    
++    do
++      {
++	iter++;
++	
++	if (stop == 1) {
++	  stopcri =abs(fx_root_function(x2,&param));
++	} else {
++          stopcri = abs(x1-x2);
++	}
++	
++	tmpdisc=sqrt(pow(b,2)-4.*a*c);
++	
++	if (debug) {
++	  cout << "Iteration " << iter << endl;
++	  cout << "x0: " << setprecision(15) << x0 << endl;
++	  cout << "x1: " << setprecision(15) << x1 << endl;
++	  cout << "x2: " << setprecision(15) << x2 << endl;
++	  cout << "tmpdisc "<< tmpdisc << endl;
++	}
++
++	discm=b-tmpdisc;
++	discp=b+tmpdisc;
++	
++	if (abs(discm) < abs(discp)) {op = 2.*c/discp;} else {op = 2.*c/discm;}
++	
++	x0 = x1;
++	x1 = x2;
++	x2 = x2 - op;
++	fx0 = fx1;
++	fx1 = fx2;
++	fx2 = fx_root_function(x2,&param);
++	den = (x0-x2)*(x1-x2)*(x0-x1);
++	a = ((x1-x2)*(fx0-fx2)-(x0-x2)*(fx1-fx2))/den;
++	b = (pow(x0-x2,2)*(fx1-fx2)-pow(x1-x2,2)*(fx0-fx2))/den;
++	c = fx2;
++	(*res)[0] = x1;
++    }
++    while (stopcri >= tol &&
++	   (isfinite(x2.real()) == 1 &&
++	    isfinite(x2.imag()) == 1) &&
++	   iter < max_iter);
++  }
++    
++  if ((*res)[0].imag() == 0)
++    {
++      DDoubleGDL* resreal;
++      resreal = new DDoubleGDL(1, BaseGDL::NOZERO);
++      (*resreal)[0] = (*res)[0].real();
++      
++      if (e->KeywordSet("DOUBLE") || 
++	  p0->Type() == COMPLEXDBL ||
++	  p0->Type() == DOUBLE)
++	{
++	  return resreal->Convert2(DOUBLE, BaseGDL::CONVERT);
++	}
++      else
++	{
++	  return resreal->Convert2(FLOAT, BaseGDL::CONVERT);
++	}
++    }
++  
++  if (e->KeywordSet("DOUBLE") ||
++      p0->Type() == COMPLEXDBL)
++    {
++      return res->Convert2(COMPLEXDBL, BaseGDL::CONVERT);
++    }
++  else
++    {
++      return res->Convert2(COMPLEX, BaseGDL::CONVERT);
++    }
++}
++  
    /*
     * SA: TODO:
     * constants: Catalan
+@@ -2819,7 +3489,7 @@
+     for (SizeT i = 0; i < resultSize; ++i) 
+       (*result)[i] = complex<double>(tmp[2 * i], tmp[2 * i + 1]);
+     
+-    return result->Convert2(
++   return result->Convert2(
+       e->KeywordSet(doubleIx) || p0->Type() == DOUBLE
+         ? COMPLEXDBL 
+         : COMPLEX, 
 diff -ruN --exclude CVS gdl-0.9.2/src/gsl_fun.hpp gdl/src/gsl_fun.hpp
 --- gdl-0.9.2/src/gsl_fun.hpp	2010-05-31 04:59:30.000000000 -0600
-+++ gdl/src/gsl_fun.hpp	2012-02-21 09:54:35.829933113 -0700
-@@ -49,6 +49,10 @@
++++ gdl/src/gsl_fun.hpp	2012-06-27 04:13:57.000000000 -0600
+@@ -49,6 +49,12 @@
    void inplacemxradixfft(double a[], double b[], 
  			 int ntot, int n, int nspan, int isn);
  
 +  // the following by AC
 +  BaseGDL* qromb_fun(EnvT* e);
 +  BaseGDL* qromo_fun(EnvT* e);
++  BaseGDL* fz_roots_fun(EnvT* e);
++  BaseGDL* fx_root_fun(EnvT* e);
 +
    // the following by SA
    BaseGDL* newton_broyden(EnvT* e);
@@ -34335,7 +35758,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/gsl_matrix.hpp gdl/src/gsl_matrix.hpp
 +
 diff -ruN --exclude CVS gdl-0.9.2/src/initsysvar.cpp gdl/src/initsysvar.cpp
 --- gdl-0.9.2/src/initsysvar.cpp	2011-11-08 14:52:06.000000000 -0700
-+++ gdl/src/initsysvar.cpp	2012-02-21 09:54:35.890930899 -0700
++++ gdl/src/initsysvar.cpp	2011-11-22 15:29:19.000000000 -0700
 @@ -42,7 +42,7 @@
    UInt pathIx, promptIx, edit_inputIx, quietIx, 
      dIx, pIx, xIx, yIx, zIx, vIx, gdlIx, cIx, MouseIx,
@@ -34387,7 +35810,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/initsysvar.cpp gdl/src/initsysvar.cpp
  }
 diff -ruN --exclude CVS gdl-0.9.2/src/initsysvar.hpp gdl/src/initsysvar.hpp
 --- gdl-0.9.2/src/initsysvar.hpp	2011-09-19 06:06:11.000000000 -0600
-+++ gdl/src/initsysvar.hpp	2012-02-21 09:54:35.916929954 -0700
++++ gdl/src/initsysvar.hpp	2011-11-22 15:29:19.000000000 -0700
 @@ -82,7 +82,10 @@
    DLong JournalLUN();
    void JournalLUN( DLong jLUN);
@@ -35207,7 +36630,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/interp_multid.h gdl/src/interp_multid.h
 +#endif
 diff -ruN --exclude CVS gdl-0.9.2/src/libinit_ac.cpp gdl/src/libinit_ac.cpp
 --- gdl-0.9.2/src/libinit_ac.cpp	2010-09-21 16:48:41.000000000 -0600
-+++ gdl/src/libinit_ac.cpp	2012-02-21 09:54:35.959928395 -0700
++++ gdl/src/libinit_ac.cpp	2012-06-27 04:13:57.000000000 -0600
 @@ -23,6 +23,8 @@
  #endif
  
@@ -35226,7 +36649,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/libinit_ac.cpp gdl/src/libinit_ac.cpp
    const string beseliKey[]={"DOUBLE","ITER","HELP",KLISTEND};
    new DLibFun(lib::beseli_fun,string("BESELI"),2,beseliKey);
    const string beseljKey[]={"DOUBLE","ITER","HELP",KLISTEND};
-@@ -39,6 +43,27 @@
+@@ -39,6 +43,33 @@
    new DLibFun(lib::beselk_fun,string("BESELK"),2,beselkKey);
    const string beselyKey[]={"DOUBLE","ITER","HELP",KLISTEND};
    new DLibFun(lib::besely_fun,string("BESELY"),2,beselyKey);
@@ -35250,13 +36673,19 @@ diff -ruN --exclude CVS gdl-0.9.2/src/libinit_ac.cpp gdl/src/libinit_ac.cpp
 +  const string qromoKey[]={"DOUBLE","EPS","JMAX","K","MIDEXP",
 +			   "MIDINF","MIDPNT","MIDSQL","MIDSQU",KLISTEND};
 +  new DLibFun(lib::qromo_fun,string("QROMO"),3,qromoKey);
++  const string fz_rootsKey[]={"DOUBLE","EPS","NO_POLISH",KLISTEND};
++  new DLibFun(lib::fz_roots_fun,string("FZ_ROOTS"),3,fz_rootsKey);
++  const string fx_rootKey[]={"DOUBLE","ITMAX","STOP","TOL",KLISTEND};
++  new DLibFun(lib::fx_root_fun,string("FX_ROOT"),2,fx_rootKey);
++  
++
 +
  #endif
    
    const string spl1Key[]={"YP0","YPN_1","DOUBLE","HELP",KLISTEND};
 diff -ruN --exclude CVS gdl-0.9.2/src/libinit.cpp gdl/src/libinit.cpp
 --- gdl-0.9.2/src/libinit.cpp	2011-09-19 06:06:11.000000000 -0600
-+++ gdl/src/libinit.cpp	2012-05-10 15:10:05.158478886 -0600
++++ gdl/src/libinit.cpp	2012-05-25 04:47:14.000000000 -0600
 @@ -282,7 +282,7 @@
    new DLibFunRetNew(lib::cindgen,string("CINDGEN"),MAXRANK,NULL,NULL,true);
    new DLibFunRetNew(lib::dcindgen,string("DCINDGEN"),MAXRANK,NULL,NULL,true);
@@ -35266,6 +36695,15 @@ diff -ruN --exclude CVS gdl-0.9.2/src/libinit.cpp gdl/src/libinit.cpp
  
    new DLibFun(lib::execute,string("EXECUTE"),2);
  
+@@ -320,7 +320,7 @@
+   new DLibPro(lib::writeu,string("WRITEU"),-1,writeuKey);
+   new DLibPro(lib::readu,string("READU"),-1,writeuKey);
+ 
+-  const string resolve_routineWarnKey[]={"EITHER","IS_FUNCTION","NO_RECOMPILE",KLISTEND};
++  const string resolve_routineWarnKey[]={"EITHER","IS_FUNCTION","NO_RECOMPILE","COMPILE_FULL_FILE",KLISTEND};
+   const string resolve_routineKey[]={KLISTEND};
+   new DLibPro(lib::resolve_routine,string("RESOLVE_ROUTINE"),1,
+ 	      NULL, resolve_routineWarnKey);
 @@ -363,31 +363,33 @@
  
    new DLibFunRetNew(lib::gdl_logical_and,string("LOGICAL_AND"),2,NULL,NULL,true);
@@ -35468,7 +36906,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/libinit.cpp gdl/src/libinit.cpp
    new DLibFun(lib::laguerre,string("LAGUERRE"),3,laguerreKey);
 diff -ruN --exclude CVS gdl-0.9.2/src/libinit_jmg.cpp gdl/src/libinit_jmg.cpp
 --- gdl-0.9.2/src/libinit_jmg.cpp	2011-08-17 04:55:32.000000000 -0600
-+++ gdl/src/libinit_jmg.cpp	2012-05-10 15:10:05.162478741 -0600
++++ gdl/src/libinit_jmg.cpp	2012-06-20 09:36:55.000000000 -0600
 @@ -89,10 +89,10 @@
  
    const string histogramKey[]={"BINSIZE","INPUT","MAX","MIN","NBINS",
@@ -35491,6 +36929,15 @@ diff -ruN --exclude CVS gdl-0.9.2/src/libinit_jmg.cpp gdl/src/libinit_jmg.cpp
    new DLibPro(lib::map_continents, string("MAP_CONTINENTS"), 0, 
      map_continentsKey, map_continentsWarnKey);
  
+@@ -133,7 +133,7 @@
+   new DLibFun(lib::convert_coord,string("CONVERT_COORD"),3,convert_coordKey);
+ 
+ 
+-  const string finiteKey[]={"INFINITY","NAN",KLISTEND};
++  const string finiteKey[]={"INFINITY","NAN","SIGN",KLISTEND};
+   new DLibFun(lib::finite_fun,string("FINITE"),1,finiteKey);
+ 
+   const string radonKey[]={"BACKPROJECT","DOUBLE","DRHO","DX","DY",
 @@ -249,7 +249,7 @@
   
  #endif
@@ -35502,7 +36949,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/libinit_jmg.cpp gdl/src/libinit_jmg.cpp
    const string tvrdKey[]={"CHANNEL","ORDER","TRUE","WORDS",KLISTEND};
 diff -ruN --exclude CVS gdl-0.9.2/src/magick_cl.cpp gdl/src/magick_cl.cpp
 --- gdl-0.9.2/src/magick_cl.cpp	2011-10-31 06:00:24.000000000 -0600
-+++ gdl/src/magick_cl.cpp	2012-05-10 15:10:05.165478632 -0600
++++ gdl/src/magick_cl.cpp	2012-05-10 02:50:10.000000000 -0600
 @@ -168,7 +168,8 @@
        Image a;
        try 
@@ -35761,7 +37208,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/magick_cl.cpp gdl/src/magick_cl.cpp
      catch (Exception &error_ )
 diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.am gdl/src/Makefile.am
 --- gdl-0.9.2/src/Makefile.am	2011-11-06 20:07:18.000000000 -0700
-+++ gdl/src/Makefile.am	2012-02-21 09:54:34.322987795 -0700
++++ gdl/src/Makefile.am	2012-06-27 16:36:53.000000000 -0600
 @@ -24,7 +24,8 @@
  		gdlsvgstream.cpp gdlsvgstream.hpp gdlpython.cpp gdlpython.hpp \
  		GDLTokenTypes.hpp GDLTreeParser.cpp GDLTreeParser.hpp GDLTreeParserTokenTypes.hpp \
@@ -35772,10 +37219,19 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.am gdl/src/Makefile.am
  		gstream.hpp ifmt.cpp \
  		initct.cpp initsysvar.cpp initsysvar.hpp io.cpp io.hpp libinit_cl.cpp libinit.cpp \
  		libinit_jmg.cpp \
+@@ -43,7 +44,7 @@
+ 		convol_inc1.cpp convol_inc2.cpp sigfpehandler.cpp sigfpehandler.hpp devicez.hpp \
+ 		gdlzstream.cpp gdlzstream.hpp gdlwidget.hpp arrayindexlistt.hpp arrayindexlistnoassoct.hpp \
+ 		arrayindex.cpp \
+-		fftw.cpp fftw.hpp mpi.cpp mpi.hpp plot3d_nr.cpp grib.cpp grib.hpp \
++		fftw.cpp fftw.hpp mpi.cpp mpi.hpp grib.cpp grib.hpp \
+                 prognode.cpp prognode_lexpr.cpp prognodeexpr.cpp strassenmatrix.hpp datatypesref.cpp lapack.cpp \
+                 gshhs.cpp gshhs.hpp newprognode.cpp plotting_plot.cpp plotting_oplot.cpp \
+                 plotting_device.cpp plotting_cursor.cpp plotting_contour.cpp plotting_surface.cpp \
 diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
 --- gdl-0.9.2/src/Makefile.in	2011-11-06 20:07:18.000000000 -0700
-+++ gdl/src/Makefile.in	2012-02-21 09:54:34.388985400 -0700
-@@ -76,24 +76,24 @@
++++ gdl/src/Makefile.in	2012-06-28 03:54:54.000000000 -0600
+@@ -76,28 +76,28 @@
  	GDLTokenTypes.hpp GDLTreeParser.cpp GDLTreeParser.hpp \
  	GDLTreeParserTokenTypes.hpp gdlwinstream.cpp gdlwinstream.hpp \
  	gdlxstream.cpp gdlxstream.hpp getfmtast.cpp getfmtast.hpp \
@@ -35818,7 +37274,12 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  	sigfpehandler.cpp sigfpehandler.hpp devicez.hpp gdlzstream.cpp \
  	gdlzstream.hpp gdlwidget.hpp arrayindexlistt.hpp \
  	arrayindexlistnoassoct.hpp arrayindex.cpp fftw.cpp fftw.hpp \
-@@ -116,20 +116,20 @@
+-	mpi.cpp mpi.hpp plot3d_nr.cpp grib.cpp grib.hpp prognode.cpp \
++	mpi.cpp mpi.hpp grib.cpp grib.hpp prognode.cpp \
+ 	prognode_lexpr.cpp prognodeexpr.cpp strassenmatrix.hpp \
+ 	datatypesref.cpp lapack.cpp gshhs.cpp gshhs.hpp \
+ 	newprognode.cpp plotting_plot.cpp plotting_oplot.cpp \
+@@ -116,18 +116,18 @@
  	gdlgstream.lo GDLInterpreter.lo GDLLexer.lo GDLParser.lo \
  	gdlpsstream.lo gdlsvgstream.lo gdlpython.lo GDLTreeParser.lo \
  	gdlwinstream.lo gdlxstream.lo getfmtast.lo graphics.lo \
@@ -35834,8 +37295,6 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
 -	convol.lo convol_inc0.lo convol_inc1.lo convol_inc2.lo \
 -	sigfpehandler.lo gdlzstream.lo arrayindex.lo fftw.lo mpi.lo \
 -	plot3d_nr.lo grib.lo prognode.lo prognode_lexpr.lo \
--	prognodeexpr.lo datatypesref.lo lapack.lo gshhs.lo \
--	newprognode.lo plotting_plot.lo plotting_oplot.lo \
 +	gsl_fun.lo gsl_matrix.lo ifmt.lo initct.lo initsysvar.lo io.lo \
 +	libinit_cl.lo libinit.lo libinit_jmg.lo math_fun.lo \
 +	math_fun_jmg.lo math_utl.lo ncdf_att_cl.lo ncdf_cl.lo \
@@ -35847,13 +37306,11 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
 +	widget.lo basegdl.lo hdf5_fun.lo libinit_mes.lo file.lo \
 +	image.lo gdljournal.lo convol.lo convol_inc0.lo convol_inc1.lo \
 +	convol_inc2.lo sigfpehandler.lo gdlzstream.lo arrayindex.lo \
-+	fftw.lo mpi.lo plot3d_nr.lo grib.lo prognode.lo \
-+	prognode_lexpr.lo prognodeexpr.lo datatypesref.lo lapack.lo \
-+	gshhs.lo newprognode.lo plotting_plot.lo plotting_oplot.lo \
++	fftw.lo mpi.lo grib.lo prognode.lo prognode_lexpr.lo \
+ 	prognodeexpr.lo datatypesref.lo lapack.lo gshhs.lo \
+ 	newprognode.lo plotting_plot.lo plotting_oplot.lo \
  	plotting_device.lo plotting_cursor.lo plotting_contour.lo \
- 	plotting_surface.lo plotting_axis.lo plotting_plots.lo \
- 	plotting_xyouts.lo plotting_polyfill.lo plotting_windows.lo \
-@@ -171,24 +171,24 @@
+@@ -171,28 +171,28 @@
  	GDLTokenTypes.hpp GDLTreeParser.cpp GDLTreeParser.hpp \
  	GDLTreeParserTokenTypes.hpp gdlwinstream.cpp gdlwinstream.hpp \
  	gdlxstream.cpp gdlxstream.hpp getfmtast.cpp getfmtast.hpp \
@@ -35896,6 +37353,11 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  	sigfpehandler.cpp sigfpehandler.hpp devicez.hpp gdlzstream.cpp \
  	gdlzstream.hpp gdlwidget.hpp arrayindexlistt.hpp \
  	arrayindexlistnoassoct.hpp arrayindex.cpp fftw.cpp fftw.hpp \
+-	mpi.cpp mpi.hpp plot3d_nr.cpp grib.cpp grib.hpp prognode.cpp \
++	mpi.cpp mpi.hpp grib.cpp grib.hpp prognode.cpp \
+ 	prognode_lexpr.cpp prognodeexpr.cpp strassenmatrix.hpp \
+ 	datatypesref.cpp lapack.cpp gshhs.cpp gshhs.hpp \
+ 	newprognode.cpp plotting_plot.cpp plotting_oplot.cpp \
 @@ -222,7 +222,8 @@
  	gdl-gdlpython.$(OBJEXT) gdl-GDLTreeParser.$(OBJEXT) \
  	gdl-gdlwinstream.$(OBJEXT) gdl-gdlxstream.$(OBJEXT) \
@@ -35906,7 +37368,42 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  	gdl-initsysvar.$(OBJEXT) gdl-io.$(OBJEXT) \
  	gdl-libinit_cl.$(OBJEXT) gdl-libinit.$(OBJEXT) \
  	gdl-libinit_jmg.$(OBJEXT) gdl-math_fun.$(OBJEXT) \
-@@ -494,7 +495,8 @@
+@@ -246,16 +247,16 @@
+ 	gdl-convol_inc1.$(OBJEXT) gdl-convol_inc2.$(OBJEXT) \
+ 	gdl-sigfpehandler.$(OBJEXT) gdl-gdlzstream.$(OBJEXT) \
+ 	gdl-arrayindex.$(OBJEXT) gdl-fftw.$(OBJEXT) gdl-mpi.$(OBJEXT) \
+-	gdl-plot3d_nr.$(OBJEXT) gdl-grib.$(OBJEXT) \
+-	gdl-prognode.$(OBJEXT) gdl-prognode_lexpr.$(OBJEXT) \
+-	gdl-prognodeexpr.$(OBJEXT) gdl-datatypesref.$(OBJEXT) \
+-	gdl-lapack.$(OBJEXT) gdl-gshhs.$(OBJEXT) \
+-	gdl-newprognode.$(OBJEXT) gdl-plotting_plot.$(OBJEXT) \
+-	gdl-plotting_oplot.$(OBJEXT) gdl-plotting_device.$(OBJEXT) \
+-	gdl-plotting_cursor.$(OBJEXT) gdl-plotting_contour.$(OBJEXT) \
+-	gdl-plotting_surface.$(OBJEXT) gdl-plotting_axis.$(OBJEXT) \
+-	gdl-plotting_plots.$(OBJEXT) gdl-plotting_xyouts.$(OBJEXT) \
+-	gdl-plotting_polyfill.$(OBJEXT) gdl-plotting_windows.$(OBJEXT) \
++	gdl-grib.$(OBJEXT) gdl-prognode.$(OBJEXT) \
++	gdl-prognode_lexpr.$(OBJEXT) gdl-prognodeexpr.$(OBJEXT) \
++	gdl-datatypesref.$(OBJEXT) gdl-lapack.$(OBJEXT) \
++	gdl-gshhs.$(OBJEXT) gdl-newprognode.$(OBJEXT) \
++	gdl-plotting_plot.$(OBJEXT) gdl-plotting_oplot.$(OBJEXT) \
++	gdl-plotting_device.$(OBJEXT) gdl-plotting_cursor.$(OBJEXT) \
++	gdl-plotting_contour.$(OBJEXT) gdl-plotting_surface.$(OBJEXT) \
++	gdl-plotting_axis.$(OBJEXT) gdl-plotting_plots.$(OBJEXT) \
++	gdl-plotting_xyouts.$(OBJEXT) gdl-plotting_polyfill.$(OBJEXT) \
++	gdl-plotting_windows.$(OBJEXT) \
+ 	gdl-plotting_convert_coord.$(OBJEXT) \
+ 	gdl-plotting_map_proj.$(OBJEXT) gdl-plotting_misc.$(OBJEXT) \
+ 	gdl-plotting_erase.$(OBJEXT) gdl-semshm.$(OBJEXT)
+@@ -365,6 +366,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+@@ -494,7 +496,8 @@
  		gdlsvgstream.cpp gdlsvgstream.hpp gdlpython.cpp gdlpython.hpp \
  		GDLTokenTypes.hpp GDLTreeParser.cpp GDLTreeParser.hpp GDLTreeParserTokenTypes.hpp \
  		gdlwinstream.cpp gdlwinstream.hpp gdlxstream.cpp gdlxstream.hpp getfmtast.cpp \
@@ -35916,7 +37413,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  		gstream.hpp ifmt.cpp \
  		initct.cpp initsysvar.cpp initsysvar.hpp io.cpp io.hpp libinit_cl.cpp libinit.cpp \
  		libinit_jmg.cpp \
-@@ -736,6 +738,7 @@
+@@ -513,7 +516,7 @@
+ 		convol_inc1.cpp convol_inc2.cpp sigfpehandler.cpp sigfpehandler.hpp devicez.hpp \
+ 		gdlzstream.cpp gdlzstream.hpp gdlwidget.hpp arrayindexlistt.hpp arrayindexlistnoassoct.hpp \
+ 		arrayindex.cpp \
+-		fftw.cpp fftw.hpp mpi.cpp mpi.hpp plot3d_nr.cpp grib.cpp grib.hpp \
++		fftw.cpp fftw.hpp mpi.cpp mpi.hpp grib.cpp grib.hpp \
+                 prognode.cpp prognode_lexpr.cpp prognodeexpr.cpp strassenmatrix.hpp datatypesref.cpp lapack.cpp \
+                 gshhs.cpp gshhs.hpp newprognode.cpp plotting_plot.cpp plotting_oplot.cpp \
+                 plotting_device.cpp plotting_cursor.cpp plotting_contour.cpp plotting_surface.cpp \
+@@ -736,6 +739,7 @@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-grib.Po at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-gshhs.Po at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-gsl_fun.Po at am__quote@
@@ -35924,6 +37430,14 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-hdf5_fun.Po at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-hdf_fun.Po at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-hdf_pro.Po at am__quote@
+@@ -768,7 +772,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-newprognode.Po at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-objects.Po at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-ofmt.Po at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-plot3d_nr.Po at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-plotting.Po at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-plotting_axis.Po at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gdl-plotting_contour.Po at am__quote@
 @@ -814,6 +817,7 @@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/grib.Plo at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gshhs.Plo at am__quote@
@@ -35932,7 +37446,15 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf5_fun.Plo at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf_fun.Plo at am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf_pro.Plo at am__quote@
-@@ -1515,6 +1519,20 @@
+@@ -846,7 +850,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/newprognode.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/objects.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ofmt.Plo at am__quote@
+- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/plot3d_nr.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/plotting.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/plotting_axis.Plo at am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/plotting_contour.Plo at am__quote@
+@@ -1515,6 +1518,20 @@
  @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -c -o gdl-gsl_fun.obj `if test -f 'gsl_fun.cpp'; then $(CYGPATH_W) 'gsl_fun.cpp'; else $(CYGPATH_W) '$(srcdir)/gsl_fun.cpp'; fi`
  
@@ -35953,9 +37475,30 @@ diff -ruN --exclude CVS gdl-0.9.2/src/Makefile.in gdl/src/Makefile.in
  gdl-ifmt.o: ifmt.cpp
  @am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -MT gdl-ifmt.o -MD -MP -MF $(DEPDIR)/gdl-ifmt.Tpo -c -o gdl-ifmt.o `test -f 'ifmt.cpp' || echo '$(srcdir)/'`ifmt.cpp
  @am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/gdl-ifmt.Tpo $(DEPDIR)/gdl-ifmt.Po
+@@ -2229,20 +2246,6 @@
+ @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ @am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -c -o gdl-mpi.obj `if test -f 'mpi.cpp'; then $(CYGPATH_W) 'mpi.cpp'; else $(CYGPATH_W) '$(srcdir)/mpi.cpp'; fi`
+ 
+-gdl-plot3d_nr.o: plot3d_nr.cpp
+- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -MT gdl-plot3d_nr.o -MD -MP -MF $(DEPDIR)/gdl-plot3d_nr.Tpo -c -o gdl-plot3d_nr.o `test -f 'plot3d_nr.cpp' || echo '$(srcdir)/'`plot3d_nr.cpp
+- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/gdl-plot3d_nr.Tpo $(DEPDIR)/gdl-plot3d_nr.Po
+- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='plot3d_nr.cpp' object='gdl-plot3d_nr.o' libtool=no @AMDEPBACKSLASH@
+- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -c -o gdl-plot3d_nr.o `test -f 'plot3d_nr.cpp' || echo '$(srcdir)/'`plot3d_nr.cpp
+-
+-gdl-plot3d_nr.obj: plot3d_nr.cpp
+- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -MT gdl-plot3d_nr.obj -MD -MP -MF $(DEPDIR)/gdl-plot3d_nr.Tpo -c -o gdl-plot3d_nr.obj `if test -f 'plot3d_nr.cpp'; then $(CYGPATH_W) 'plot3d_nr.cpp'; else $(CYGPATH_W) '$(srcdir)/plot3d_nr.cpp'; fi`
+- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/gdl-plot3d_nr.Tpo $(DEPDIR)/gdl-plot3d_nr.Po
+- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='plot3d_nr.cpp' object='gdl-plot3d_nr.obj' libtool=no @AMDEPBACKSLASH@
+- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -c -o gdl-plot3d_nr.obj `if test -f 'plot3d_nr.cpp'; then $(CYGPATH_W) 'plot3d_nr.cpp'; else $(CYGPATH_W) '$(srcdir)/plot3d_nr.cpp'; fi`
+-
+ gdl-grib.o: grib.cpp
+ @am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gdl_CXXFLAGS) $(CXXFLAGS) -MT gdl-grib.o -MD -MP -MF $(DEPDIR)/gdl-grib.Tpo -c -o gdl-grib.o `test -f 'grib.cpp' || echo '$(srcdir)/'`grib.cpp
+ @am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/gdl-grib.Tpo $(DEPDIR)/gdl-grib.Po
 diff -ruN --exclude CVS gdl-0.9.2/src/math_fun.cpp gdl/src/math_fun.cpp
 --- gdl-0.9.2/src/math_fun.cpp	2011-09-29 12:54:30.000000000 -0600
-+++ gdl/src/math_fun.cpp	2012-02-21 09:54:36.094923497 -0700
++++ gdl/src/math_fun.cpp	2011-11-24 04:43:23.000000000 -0700
 @@ -223,16 +223,19 @@
      return res;
    }
@@ -36699,7 +38242,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun.cpp gdl/src/math_fun.cpp
  	  static_cast< DFloatGDL*>( p0->Convert2( FLOAT, BaseGDL::COPY));
 diff -ruN --exclude CVS gdl-0.9.2/src/math_fun.hpp gdl/src/math_fun.hpp
 --- gdl-0.9.2/src/math_fun.hpp	2010-06-08 06:08:18.000000000 -0600
-+++ gdl/src/math_fun.hpp	2012-02-21 09:54:36.138921901 -0700
++++ gdl/src/math_fun.hpp	2011-11-24 04:31:27.000000000 -0700
 @@ -25,32 +25,32 @@
  
    void svdc( EnvT* e);
@@ -36751,8 +38294,231 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun.hpp gdl/src/math_fun.hpp
    BaseGDL* gauss_pdf(EnvT* e);
 diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
 --- gdl-0.9.2/src/math_fun_jmg.cpp	2011-10-11 01:37:36.000000000 -0600
-+++ gdl/src/math_fun_jmg.cpp	2012-02-21 09:54:36.171920703 -0700
-@@ -967,19 +967,25 @@
++++ gdl/src/math_fun_jmg.cpp	2012-06-28 07:59:01.000000000 -0600
+@@ -220,6 +220,76 @@
+        do_it(static_cast<T*>(src), kwNaN, kwInfinity);
+    };
+ 
++   template< typename T, bool> struct finite_helper_sign
++   {
++     inline static BaseGDL* do_it(T* src, bool kwNaN, bool kwInfinity, DLong kwSign)
++     {
++
++// #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl))
++
++       DByteGDL* res = new DByteGDL( src->Dim(), BaseGDL::NOZERO); // ::ZERO is not working
++       SizeT nEl = src->N_Elements();
++
++       //       for ( SizeT i=0; i<nEl; ++i) (*res)[i]=0;
++
++       if (kwInfinity) {
++	 if (kwSign > 0) {
++// #pragma omp for
++	   for ( SizeT i=0; i<nEl; ++i) {
++	     if (isinf((*src)[ i]) && (signbit((*src)[ i]) == 0)) (*res)[i]=1; else (*res)[i]=0;
++	   }
++	 } else {
++// #pragma omp for
++	   for ( SizeT i=0; i<nEl; ++i) {
++	     if (isinf((*src)[ i]) && (signbit((*src)[ i]) != 0)) (*res)[i]=1; else (*res)[i]=0;
++	   }
++	 }
++	 return res;	 
++       }
++       if (kwNaN) {
++	 if (kwSign > 0) {
++// #pragma omp for
++	   for ( SizeT i=0; i<nEl; ++i) {
++	     if (isnan((*src)[ i]) && (signbit((*src)[ i]) == 0)) (*res)[i]=1; else (*res)[i]=0;
++	   }
++	 } else {
++// #pragma omp for
++	   for ( SizeT i=0; i<nEl; ++i) {
++	     if (isnan((*src)[ i]) && (signbit((*src)[ i]) != 0)) (*res)[i]=1; else (*res)[i]=0;
++	   }
++	 }
++	 return res;
++       }
++     }
++   };
++
++   // partial specialization for COMPLEX, DCOMPLEX
++   template< typename T> struct finite_helper_sign<T, true>
++   {
++     inline static BaseGDL* do_it(T* src, bool kwNaN, bool kwInfinity, DLong kwSign)
++     {
++       DByteGDL* res = new DByteGDL( src->Dim(), BaseGDL::NOZERO);
++       SizeT nEl = src->N_Elements();
++       
++       for ( SizeT i=0; i<nEl; ++i)
++	 {
++	   (*res)[i]=0;
++	   if      ((kwInfinity && isinf((*src)[ i].real()) || kwNaN && isnan((*src)[ i].real())) && signbit((*src)[ i].real())==0 && kwSign > 0) (*res)[i]=1;
++	   else if ((kwInfinity && isinf((*src)[ i].imag()) || kwNaN && isnan((*src)[ i].imag())) && signbit((*src)[ i].imag())==0 && kwSign > 0) (*res)[i]=1;
++	   else if ((kwInfinity && isinf((*src)[ i].real()) || kwNaN && isnan((*src)[ i].real())) && signbit((*src)[ i].real())==1 && kwSign < 0) (*res)[i]=1;
++	   else if ((kwInfinity && isinf((*src)[ i].imag()) || kwNaN && isnan((*src)[ i].imag())) && signbit((*src)[ i].imag())==1 && kwSign < 0) (*res)[i]=1;	 
++	 }
++       return res;
++     }
++   };
++
++   template< typename T, bool IS_COMPLEX>
++   inline BaseGDL* finite_template( BaseGDL* src, bool kwNaN, bool kwInfinity, DLong kwSign)
++   {
++     return finite_helper_sign<T, IS_COMPLEX>::
++       do_it(static_cast<T*>(src), kwNaN, kwInfinity, kwSign);
++   };
++
+    BaseGDL* finite_fun( EnvT* e)
+    {
+      e->NParam( 1);
+@@ -233,52 +303,107 @@
+      static int infinityIx = e->KeywordIx( "INFINITY");
+      bool kwInfinity = e->KeywordSet( infinityIx);
+ 
++     static int signIx = e->KeywordIx( "SIGN");
++     DLong kwSign = 0;
++     e->AssureLongScalarKWIfPresent( signIx, kwSign); 
++
+      if( kwNaN && kwInfinity)
+        e->Throw("Conflicting keywords.");
+-
+-     switch (p0->Type()) 
++     
++     if(kwSign==0 || (kwInfinity==0 && kwNaN==0))
+        {
+-       case FLOAT: 
+-	 {
+-	   return finite_template<DFloatGDL, false>(p0, kwNaN, kwInfinity);
+-	 }
+-       case DOUBLE:
+-	 {
+-	   return finite_template<DDoubleGDL, false>(p0, kwNaN, kwInfinity);
+-	 }
+-       case COMPLEX:
+-	 {
+-	   return finite_template<DComplexGDL, true>(p0, kwNaN, kwInfinity);
+-	 }
+-       case COMPLEXDBL:
+-	 {
+-	   return finite_template<DComplexDblGDL, true>(p0, kwNaN, kwInfinity);
+-	 }
+-       case STRING:
+-	 {
+-	   DFloatGDL* p0F = 
+-	     static_cast<DFloatGDL*>(p0->Convert2(FLOAT,BaseGDL::COPY));
+-	   guard.reset( p0F);
+-	   return finite_template<DFloatGDL, false>(p0F, kwNaN, kwInfinity);
+-	 }
+-       case STRUCT:
+-       case PTR:
+-       case OBJECT:
+-	 {
+-	   e->Throw( p0->TypeStr() + " not allowed in this context: " +
+-		     e->GetParString( 0));
+-	 }
+-       default: // integer types
+-	 {
+-	   if( kwNaN || kwInfinity)
+-	     return new DByteGDL( p0->Dim()); // zero
+-
++	 switch (p0->Type()) 
++	   {
++	   case FLOAT: 
++	     {
++	       return finite_template<DFloatGDL, false>(p0, kwNaN, kwInfinity);
++	     }
++	   case DOUBLE:
++	     {
++	       return finite_template<DDoubleGDL, false>(p0, kwNaN, kwInfinity);
++	     }
++	   case COMPLEX:
++	     {
++	       return finite_template<DComplexGDL, true>(p0, kwNaN, kwInfinity);
++	     }
++	   case COMPLEXDBL:
++	     {
++	       return finite_template<DComplexDblGDL, true>(p0, kwNaN, kwInfinity);
++	     }
++	   case STRING:
++	     {
++	       DFloatGDL* p0F = 
++		 static_cast<DFloatGDL*>(p0->Convert2(FLOAT,BaseGDL::COPY));
++	       guard.reset( p0F);
++	       return finite_template<DFloatGDL, false>(p0F, kwNaN, kwInfinity);
++	     }
++	   case STRUCT:
++	   case PTR:
++	   case OBJECT:
++	     {
++	       e->Throw( p0->TypeStr() + " not allowed in this context: " +
++			 e->GetParString( 0));
++	     }
++	   default: // integer types
++	     {
++	       if( kwNaN || kwInfinity)
++		 return new DByteGDL( p0->Dim()); // zero
++	       
+ 	   DByteGDL* res = new DByteGDL( p0->Dim(), BaseGDL::NOZERO); 
+ 	   SizeT nEl = p0->N_Elements();
+ 	   for (SizeT i=0; i<nEl; i++)
+ 	     (*res)[i] = 1;
+ 	   return res;
+-	 }
++	     }
++	   }
++       }
++     // Sign
++     else
++       {
++	 switch (p0->Type()) 
++	   {
++	   case FLOAT: 
++	     {
++	       return finite_template<DFloatGDL, false>(p0, kwNaN, kwInfinity, kwSign);
++	     }
++	   case DOUBLE:
++	     {
++	       return finite_template<DDoubleGDL, false>(p0, kwNaN, kwInfinity, kwSign);
++	     }
++	   case COMPLEX:
++	     {
++	       return finite_template<DComplexGDL, true>(p0, kwNaN, kwInfinity, kwSign);
++	     }
++	   case COMPLEXDBL:
++	     {
++	       return finite_template<DComplexDblGDL, true>(p0, kwNaN, kwInfinity, kwSign);
++	     }
++	   case STRING:
++	     {
++	       DFloatGDL* p0F = 
++		 static_cast<DFloatGDL*>(p0->Convert2(FLOAT,BaseGDL::COPY));
++	       guard.reset( p0F);
++	       return finite_template<DFloatGDL, false>(p0F, kwNaN, kwInfinity, kwSign);
++	     }
++	   case STRUCT:
++	   case PTR:
++	   case OBJECT:
++	     {
++	       e->Throw( p0->TypeStr() + " not allowed in this context: " +
++			 e->GetParString( 0));
++	     }
++	   default: // integer types
++	     {
++	       if( kwNaN || kwInfinity)
++		 return new DByteGDL( p0->Dim()); // zero
++	       
++	       DByteGDL* res = new DByteGDL( p0->Dim(), BaseGDL::NOZERO);
++	       SizeT nEl = p0->N_Elements();
++	       for (SizeT i=0; i<nEl; i++)
++	       (*res)[i] = 0;
++	       return res;
++	     }
++	   }
+        }
+    }
+ 
+@@ -967,19 +1092,25 @@
  
    template< typename T1, typename T2>
    BaseGDL* poly_2d_shift_template( BaseGDL* p0, DLong nCol, DLong nRow, 
@@ -36780,7 +38546,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
      char *p_in  = (char *) p0->DataAddr();
  
      SizeT sz = sizeof(T2);
-@@ -1095,39 +1101,39 @@
+@@ -1095,39 +1226,39 @@
  	  if (p0->Type() == BYTE) {
  	    return poly_2d_shift_template< DByteGDL, DByte>( p0, nCol, nRow,  
  							     (int) (*Q)[0], 
@@ -36829,7 +38595,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  	  }
  	}
        } else {
-@@ -1141,7 +1147,7 @@
+@@ -1141,7 +1272,7 @@
  	warped = image_warp(p0->Dim(1), p0->Dim(0), nRow, nCol, p0->Type(), 
  			    p0->DataAddr(), kernel_name,
  			    lineartrans, poly_v, poly_u,
@@ -36838,7 +38604,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
        }
      } else {
        // Polynomial
-@@ -1172,7 +1178,7 @@
+@@ -1172,7 +1303,7 @@
        warped = image_warp(p0->Dim(1), p0->Dim(0), nRow, nCol, p0->Type(), 
  			  p0->DataAddr(), kernel_name, 
  			  lineartrans, poly_v, poly_u, 
@@ -36847,7 +38613,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  
        if (poly_u->px != NULL) free(poly_u->px);
        if (poly_u->py != NULL) free(poly_u->py);
-@@ -1427,7 +1433,7 @@
+@@ -1427,7 +1558,7 @@
   */
  /*--------------------------------------------------------------------------*/
  
@@ -36856,7 +38622,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  		     SizeT  lx,		     
  		     SizeT  ly,		     
  		     SizeT  lx_out,		     
-@@ -1440,7 +1446,8 @@
+@@ -1440,7 +1571,8 @@
  		     poly2d		*	poly_v,
  		     DLong interp,
  		     DDouble cubic,
@@ -36866,7 +38632,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  {
      image_t    *	image_out ;
      int         	i, j, k ;
-@@ -1484,7 +1491,7 @@
+@@ -1484,7 +1616,7 @@
        }
      }
  
@@ -36875,7 +38641,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  
      /* Pre compute leaps for 16 closest neighbors positions */
  
-@@ -1531,7 +1538,10 @@
+@@ -1531,7 +1663,10 @@
  	      (px > (lx-1)) ||
  	      (py < 1) ||
  	      (py > (ly-1)))
@@ -36887,7 +38653,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  	  else {
  	    /* Now feed the positions for the closest 16 neighbors  */
  	    pos = px + py * lx ;
-@@ -1700,7 +1710,8 @@
+@@ -1700,7 +1835,8 @@
  /*--------------------------------------------------------------------------*/
  image_t * image_new(
  		int 	size_x, 
@@ -36897,7 +38663,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  {
      image_t    *	image_new ;
  
-@@ -1717,6 +1728,9 @@
+@@ -1717,6 +1853,9 @@
      image_new->lx = size_x ;
      image_new->ly = size_y ;
      image_new->data = (pixelvalue *) calloc(size_x * size_y, sizeof(pixelvalue));
@@ -36907,7 +38673,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
      return image_new ;
  }
  
-@@ -1921,7 +1935,8 @@
+@@ -1921,7 +2060,8 @@
      // Execute command string
      EnvBaseT* caller;
      caller = e->Caller();
@@ -36919,7 +38685,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.cpp gdl/src/math_fun_jmg.cpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.hpp gdl/src/math_fun_jmg.hpp
 --- gdl-0.9.2/src/math_fun_jmg.hpp	2010-06-11 09:09:51.000000000 -0600
-+++ gdl/src/math_fun_jmg.hpp	2012-02-21 09:54:36.187920123 -0700
++++ gdl/src/math_fun_jmg.hpp	2011-12-29 19:25:12.000000000 -0700
 @@ -68,9 +68,9 @@
    image_t * image_warp(SizeT, SizeT, SizeT, SizeT, DType, void*, 
  		       char *kernel_type,
@@ -36934,7 +38700,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/math_fun_jmg.hpp gdl/src/math_fun_jmg.hpp
  } // namespace
 diff -ruN --exclude CVS gdl-0.9.2/src/newprognode.cpp gdl/src/newprognode.cpp
 --- gdl-0.9.2/src/newprognode.cpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/newprognode.cpp	2012-02-21 09:54:36.210919288 -0700
++++ gdl/src/newprognode.cpp	2011-11-15 16:19:00.000000000 -0700
 @@ -103,13 +103,19 @@
    if( refNode == RefDNode(antlr::nullAST)) return NULL;
  
@@ -37183,7 +38949,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/newprognode.cpp gdl/src/newprognode.cpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/objects.cpp gdl/src/objects.cpp
 --- gdl-0.9.2/src/objects.cpp	2010-12-30 17:37:52.000000000 -0700
-+++ gdl/src/objects.cpp	2012-02-21 09:54:36.241918164 -0700
++++ gdl/src/objects.cpp	2011-11-18 11:42:17.000000000 -0700
 @@ -17,6 +17,7 @@
  
  #include "includefirst.hpp"
@@ -37200,9 +38966,1380 @@ diff -ruN --exclude CVS gdl-0.9.2/src/objects.cpp gdl/src/objects.cpp
  
  // instantiate own AST factory
  //_DNodeFactory DNodeFactory;
+diff -ruN --exclude CVS gdl-0.9.2/src/plot3d_nr.cpp gdl/src/plot3d_nr.cpp
+--- gdl-0.9.2/src/plot3d_nr.cpp	2010-11-17 00:24:55.000000000 -0700
++++ gdl/src/plot3d_nr.cpp	1969-12-31 17:00:00.000000000 -0700
+@@ -1,1367 +0,0 @@
+-/* $Id: plot3d_nr.cpp,v 1.7 2010/11/17 07:24:55 slayoo Exp $
+-
+-	3d plot routines.
+-
+-   Copyright (C) 2004  Alan W. Irwin
+-   Copyright (C) 2004  Joao Cardoso
+-   Copyright (C) 2004  Andrew Ross
+-
+-   This file is part of PLplot.
+-
+-   PLplot is free software; you can redistribute it and/or modify
+-   it under the terms of the GNU Library General Public License as published
+-   by the Free Software Foundation; either version 2 of the License, or
+-   (at your option) any later version.
+-
+-   PLplot is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-   GNU Library General Public License for more details.
+-
+-   You should have received a copy of the GNU Library General Public License
+-   along with PLplot; if not, write to the Free Software
+-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+-*/
+-
+-#include <plplot/plplotP.h>
+-
+-namespace lib {
+-
+-  /* Internal constants */
+-
+-#define  BINC      50		/* Block size for memory allocation */
+-
+-  static PLINT pl3mode = 0;	/* 0 3d solid; 1 mesh plot */
+-  static PLINT pl3upv = 1;	/* 1 update view; 0 no update */
+-  
+-  static PLINT zbflg = 0, zbcol, zbwidth;
+-  static PLFLT zbtck;
+-
+-  static PLINT *oldhiview = NULL;
+-  static PLINT *oldloview = NULL;
+-  static PLINT *newhiview = NULL;
+-  static PLINT *newloview = NULL;
+-  static PLINT *utmp = NULL;
+-  static PLINT *vtmp = NULL;
+-  static PLFLT *ctmp = NULL;
+-
+-  static PLINT mhi, xxhi, newhisize;
+-  static PLINT mlo, xxlo, newlosize;
+-
+-  /* Light source for shading */
+-  static PLFLT xlight, ylight, zlight;
+-  static PLINT falsecolor=0;
+-  static PLFLT fc_minz, fc_maxz;
+-
+-  /* Prototypes for static functions */
+-
+-  static void plgrid3	(PLFLT);
+-  static void plnxtv (PLINT *, PLINT *, PLFLT*, PLINT, PLINT);
+-  static void plside3	(PLFLT *, PLFLT *, PLFLT **, PLINT, PLINT, PLINT);
+-  static void plt3zz	(PLINT, PLINT, PLINT, PLINT,
+-			 PLINT, PLINT *, PLFLT *, PLFLT *, PLFLT **,
+-			 PLINT, PLINT, PLINT *, PLINT *, PLFLT*);
+-  static void plnxtvhi (PLINT *, PLINT *, PLFLT*, PLINT, PLINT);
+-  static void plnxtvlo (PLINT *, PLINT *, PLFLT*, PLINT, PLINT);
+-  static void plnxtvhi_draw(PLINT *u, PLINT *v, PLFLT* c, PLINT n);
+-
+-  static void savehipoint	(PLINT, PLINT);
+-  static void savelopoint	(PLINT, PLINT);
+-  static void swaphiview	(void);
+-  static void swaploview	(void);
+-  static void myexit	(char *);
+-  static void myabort	(char *);
+-  static void freework	(void);
+-  static int  plabv	(PLINT, PLINT, PLINT, PLINT, PLINT, PLINT);
+-  static void pl3cut	(PLINT, PLINT, PLINT, PLINT, PLINT,
+-			 PLINT, PLINT, PLINT, PLINT *, PLINT *);
+-  static void plP_draw3d(PLINT x, PLINT y, PLFLT *c, PLINT j, PLINT move);
+-
+-  static void plt3zz_nr (PLINT, PLINT, PLINT, PLINT,
+-			 PLINT, PLINT *, PLFLT *, PLFLT *, PLFLT **,
+-			 PLINT, PLINT, PLINT *, PLINT *, PLFLT*);
+-
+-  void mesh_nr(PLFLT *, PLFLT *, PLFLT **, PLINT, PLINT, PLINT);
+-
+-  void c_plot3dc_nr(PLFLT *, PLFLT *, PLFLT **,
+-		    PLINT, PLINT, PLINT,
+-		    PLFLT *, PLINT);
+-
+-  void c_plot3dcl_nr(PLFLT *, PLFLT *, PLFLT **,
+-		     PLINT, PLINT, PLINT, 
+-		     PLFLT *, PLINT,
+-		     PLINT, PLINT, PLINT *, PLINT *);
+-
+-/*--------------------------------------------------------------------------*\
+- * void plside3()
+- *
+- * This routine draws sides around the front of the 3d plot so that
+- * it does not appear to float.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plside3(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt)
+-{
+-    PLINT i;
+-    PLFLT cxx, cxy, cyx, cyy, cyz;
+-    PLFLT xmin, ymin, zmin, xmax, ymax, zmax, zscale;
+-    PLFLT tx, ty, ux, uy;
+-
+-    plP_gw3wc(&cxx, &cxy, &cyx, &cyy, &cyz);
+-    plP_gdom(&xmin, &xmax, &ymin, &ymax);
+-    plP_grange(&zscale, &zmin, &zmax);
+-
+-/* Get x, y coordinates of legs and plot */
+-
+-    if (cxx >= 0.0 && cxy <= 0.0) {
+-	if (opt != 1) {
+-	    for (i = 0; i < nx; i++) {
+-		tx = plP_w3wcx(x[i], y[0], zmin);
+-		ty = plP_w3wcy(x[i], y[0], zmin);
+-		ux = plP_w3wcx(x[i], y[0], z[i][0]);
+-		uy = plP_w3wcy(x[i], y[0], z[i][0]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-	if (opt != 2) {
+-	    for (i = 0; i < ny; i++) {
+-		tx = plP_w3wcx(x[0], y[i], zmin);
+-		ty = plP_w3wcy(x[0], y[i], zmin);
+-		ux = plP_w3wcx(x[0], y[i], z[0][i]);
+-		uy = plP_w3wcy(x[0], y[i], z[0][i]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-    }
+-    else if (cxx <= 0.0 && cxy <= 0.0) {
+-	if (opt != 1) {
+-	    for (i = 0; i < nx; i++) {
+-		tx = plP_w3wcx(x[i], y[ny - 1], zmin);
+-		ty = plP_w3wcy(x[i], y[ny - 1], zmin);
+-		ux = plP_w3wcx(x[i], y[ny - 1], z[i][ny - 1]);
+-		uy = plP_w3wcy(x[i], y[ny - 1], z[i][ny - 1]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-	if (opt != 2) {
+-	    for (i = 0; i < ny; i++) {
+-		tx = plP_w3wcx(x[0], y[i], zmin);
+-		ty = plP_w3wcy(x[0], y[i], zmin);
+-		ux = plP_w3wcx(x[0], y[i], z[0][i]);
+-		uy = plP_w3wcy(x[0], y[i], z[0][i]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-    }
+-    else if (cxx <= 0.0 && cxy >= 0.0) {
+-	if (opt != 1) {
+-	    for (i = 0; i < nx; i++) {
+-		tx = plP_w3wcx(x[i], y[ny - 1], zmin);
+-		ty = plP_w3wcy(x[i], y[ny - 1], zmin);
+-		ux = plP_w3wcx(x[i], y[ny - 1], z[i][ny - 1]);
+-		uy = plP_w3wcy(x[i], y[ny - 1], z[i][ny - 1]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-	if (opt != 2) {
+-	    for (i = 0; i < ny; i++) {
+-		tx = plP_w3wcx(x[nx - 1], y[i], zmin);
+-		ty = plP_w3wcy(x[nx - 1], y[i], zmin);
+-		ux = plP_w3wcx(x[nx - 1], y[i], z[nx - 1][i]);
+-		uy = plP_w3wcy(x[nx - 1], y[i], z[nx - 1][i]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-    }
+-    else if (cxx >= 0.0 && cxy >= 0.0) {
+-	if (opt != 1) {
+-	    for (i = 0; i < nx; i++) {
+-		tx = plP_w3wcx(x[i], y[0], zmin);
+-		ty = plP_w3wcy(x[i], y[0], zmin);
+-		ux = plP_w3wcx(x[i], y[0], z[i][0]);
+-		uy = plP_w3wcy(x[i], y[0], z[i][0]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-	if (opt != 2) {
+-	    for (i = 0; i < ny; i++) {
+-		tx = plP_w3wcx(x[nx - 1], y[i], zmin);
+-		ty = plP_w3wcy(x[nx - 1], y[i], zmin);
+-		ux = plP_w3wcx(x[nx - 1], y[i], z[nx - 1][i]);
+-		uy = plP_w3wcy(x[nx - 1], y[i], z[nx - 1][i]);
+-		pljoin(tx, ty, ux, uy);
+-	    }
+-	}
+-    }
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void plgrid3()
+- *
+- * This routine draws a grid around the back side of the 3d plot with
+- * hidden line removal.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plgrid3(PLFLT tick)
+-{
+-    PLFLT xmin, ymin, zmin, xmax, ymax, zmax, zscale;
+-    PLFLT cxx, cxy, cyx, cyy, cyz, zmin_in, zmax_in;
+-    PLINT u[3], v[3];
+-    PLINT nsub = 0;
+-    PLFLT tp;
+-
+-    plP_gw3wc(&cxx, &cxy, &cyx, &cyy, &cyz);
+-    plP_gdom(&xmin, &xmax, &ymin, &ymax);
+-    plP_grange(&zscale, &zmin_in, &zmax_in);
+-    zmin = (zmax_in > zmin_in) ? zmin_in: zmax_in;
+-    zmax = (zmax_in > zmin_in) ? zmax_in: zmin_in;
+-
+-#ifdef HAVE_OLDPLPLOT
+-    pldtik(zmin, zmax, &tick, &nsub);
+-#else
+-    pldtik(zmin, zmax, &tick, &nsub, FALSE);
+-#endif
+-    tp = tick * floor(zmin / tick) + tick;
+-    pl3upv = 0;
+-
+-    if (cxx >= 0.0 && cxy <= 0.0) {
+-	while (tp <= zmax) {
+-	    u[0] = plP_wcpcx(plP_w3wcx(xmin, ymax, tp));
+-	    v[0] = plP_wcpcy(plP_w3wcy(xmin, ymax, tp));
+-	    u[1] = plP_wcpcx(plP_w3wcx(xmax, ymax, tp));
+-	    v[1] = plP_wcpcy(plP_w3wcy(xmax, ymax, tp));
+-	    u[2] = plP_wcpcx(plP_w3wcx(xmax, ymin, tp));
+-	    v[2] = plP_wcpcy(plP_w3wcy(xmax, ymin, tp));
+-	    plnxtv(u, v, 0, 3, 0);
+-
+-	    tp += tick;
+-	}
+-	u[0] = plP_wcpcx(plP_w3wcx(xmax, ymax, zmin));
+-	v[0] = plP_wcpcy(plP_w3wcy(xmax, ymax, zmin));
+-	u[1] = plP_wcpcx(plP_w3wcx(xmax, ymax, zmax));
+-	v[1] = plP_wcpcy(plP_w3wcy(xmax, ymax, zmax));
+-	plnxtv(u, v, 0, 2, 0);
+-    }
+-    else if (cxx <= 0.0 && cxy <= 0.0) {
+-	while (tp <= zmax) {
+-	    u[0] = plP_wcpcx(plP_w3wcx(xmax, ymax, tp));
+-	    v[0] = plP_wcpcy(plP_w3wcy(xmax, ymax, tp));
+-	    u[1] = plP_wcpcx(plP_w3wcx(xmax, ymin, tp));
+-	    v[1] = plP_wcpcy(plP_w3wcy(xmax, ymin, tp));
+-	    u[2] = plP_wcpcx(plP_w3wcx(xmin, ymin, tp));
+-	    v[2] = plP_wcpcy(plP_w3wcy(xmin, ymin, tp));
+-	    plnxtv(u, v, 0,3, 0);
+-
+-	    tp += tick;
+-	}
+-	u[0] = plP_wcpcx(plP_w3wcx(xmax, ymin, zmin));
+-	v[0] = plP_wcpcy(plP_w3wcy(xmax, ymin, zmin));
+-	u[1] = plP_wcpcx(plP_w3wcx(xmax, ymin, zmax));
+-	v[1] = plP_wcpcy(plP_w3wcy(xmax, ymin, zmax));
+-	plnxtv(u, v, 0,2, 0);
+-    }
+-    else if (cxx <= 0.0 && cxy >= 0.0) {
+-	while (tp <= zmax) {
+-	    u[0] = plP_wcpcx(plP_w3wcx(xmax, ymin, tp));
+-	    v[0] = plP_wcpcy(plP_w3wcy(xmax, ymin, tp));
+-	    u[1] = plP_wcpcx(plP_w3wcx(xmin, ymin, tp));
+-	    v[1] = plP_wcpcy(plP_w3wcy(xmin, ymin, tp));
+-	    u[2] = plP_wcpcx(plP_w3wcx(xmin, ymax, tp));
+-	    v[2] = plP_wcpcy(plP_w3wcy(xmin, ymax, tp));
+-	    plnxtv(u, v, 0,3, 0);
+-
+-	    tp += tick;
+-	}
+-	u[0] = plP_wcpcx(plP_w3wcx(xmin, ymin, zmin));
+-	v[0] = plP_wcpcy(plP_w3wcy(xmin, ymin, zmin));
+-	u[1] = plP_wcpcx(plP_w3wcx(xmin, ymin, zmax));
+-	v[1] = plP_wcpcy(plP_w3wcy(xmin, ymin, zmax));
+-	plnxtv(u, v, 0,2, 0);
+-    }
+-    else if (cxx >= 0.0 && cxy >= 0.0) {
+-	while (tp <= zmax) {
+-	    u[0] = plP_wcpcx(plP_w3wcx(xmin, ymin, tp));
+-	    v[0] = plP_wcpcy(plP_w3wcy(xmin, ymin, tp));
+-	    u[1] = plP_wcpcx(plP_w3wcx(xmin, ymax, tp));
+-	    v[1] = plP_wcpcy(plP_w3wcy(xmin, ymax, tp));
+-	    u[2] = plP_wcpcx(plP_w3wcx(xmax, ymax, tp));
+-	    v[2] = plP_wcpcy(plP_w3wcy(xmax, ymax, tp));
+-	    plnxtv(u, v, 0,3, 0);
+-
+-	    tp += tick;
+-	}
+-	u[0] = plP_wcpcx(plP_w3wcx(xmin, ymax, zmin));
+-	v[0] = plP_wcpcy(plP_w3wcy(xmin, ymax, zmin));
+-	u[1] = plP_wcpcx(plP_w3wcx(xmin, ymax, zmax));
+-	v[1] = plP_wcpcy(plP_w3wcy(xmin, ymax, zmax));
+-	plnxtv(u, v, 0,2, 0);
+-    }
+-    pl3upv = 1;
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void plnxtv()
+- *
+- * Draw the next view of a 3-d plot. The physical coordinates of the
+- * points for the next view are placed in the n points of arrays u and
+- * v. The silhouette found so far is stored in the heap as a set of m peak
+- * points.
+- *
+- * These routines dynamically allocate memory for hidden line removal.
+- * Memory is allocated in blocks of 2*BINC*sizeof(PLINT) bytes.  Large
+- * values of BINC give better performance but also allocate more memory
+- * than is needed. If your 3D plots are very "spiky" or you are working
+- * with very large matrices then you will probably want to increase BINC.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plnxtv(PLINT *u, PLINT *v, PLFLT* c, PLINT n, PLINT init)
+-{
+-    plnxtvhi(u, v, c, n, init);
+-
+-    if (pl3mode)
+-	plnxtvlo(u, v, c, n, init);
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void plnxtvhi()
+- *
+- * Draw the top side of the 3-d plot.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plnxtvhi(PLINT *u, PLINT *v, PLFLT* c, PLINT n, PLINT init)
+-{
+-  /*
+-   * For the initial set of points, just display them and store them as the
+-   * peak points.
+-   */
+-  if (init == 1) {
+-    int i;
+-    oldhiview = (PLINT *) malloc((size_t) (2 * n * sizeof(PLINT)));
+-    if ( ! oldhiview)
+-      myexit((char*)"plnxtvhi: Out of memory.");
+-
+-    oldhiview[0] = u[0];
+-    oldhiview[1] = v[0];
+-    plP_draw3d(u[0], v[0], c, 0, 1);
+-    for (i = 1; i < n; i++) {
+-      oldhiview[2 * i] = u[i];
+-      oldhiview[2 * i + 1] = v[i];
+-      plP_draw3d(u[i], v[i], c, i, 0);
+-    }
+-    mhi = n;
+-    return;
+-  }
+-
+-  /*
+-   * Otherwise, we need to consider hidden-line removal problem. We scan
+-   * over the points in both the old (i.e. oldhiview[]) and new (i.e. u[]
+-   * and v[]) arrays in order of increasing x coordinate.  At each stage, we
+-   * find the line segment in the other array (if one exists) that straddles
+-   * the x coordinate of the point. We have to determine if the point lies
+-   * above or below the line segment, and to check if the below/above status
+-   * has changed since the last point.
+-   *
+-   * If pl3upv = 0 we do not update the view, this is useful for drawing
+-   * lines on the graph after we are done plotting points.  Hidden line
+-   * removal is still done, but the view is not updated.
+-   */
+-  xxhi = 0;
+-  if (pl3upv != 0) {
+-    newhisize = 2 * (mhi + BINC);
+-    if (newhiview != NULL) {
+-      newhiview =
+-	(PLINT *) realloc((void *) newhiview,
+-			  (size_t) (newhisize * sizeof(PLINT)));
+-    }
+-    else {
+-      newhiview =
+-	(PLINT *) malloc((size_t) (newhisize * sizeof(PLINT)));
+-    }
+-    if ( ! newhiview)
+-      myexit((char*)"plnxtvhi: Out of memory.");
+-  }
+-
+-  /* Do the draw or shading with hidden line removal */
+-
+-  plnxtvhi_draw(u, v, c, n);
+-
+-  /* Set oldhiview */
+-
+-  swaphiview();
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void plnxtvhi_draw()
+- *
+- * Draw the top side of the 3-d plot.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plnxtvhi_draw(PLINT *u, PLINT *v, PLFLT* c, PLINT n)
+-{
+-    PLINT i = 0, j = 0, first = 1;
+-    PLINT sx1 = 0, sx2 = 0, sy1 = 0, sy2 = 0;
+-    PLINT su1, su2, sv1, sv2;
+-    PLINT cx, cy, px, py;
+-    PLINT seg, ptold, lstold = 0, pthi, pnewhi = 0, newhi, change, ochange = 0;
+-
+-/*
+- * (oldhiview[2*i], oldhiview[2*i]) is the i'th point in the old array
+- * (u[j], v[j]) is the j'th point in the new array
+- */
+-
+-/*
+- * First attempt at 3d shading.  It works ok for simple plots, but
+- * will just not draw faces, or draw them overlapping for very
+- * jagged plots
+- */
+-
+-    while (i < mhi || j < n) {
+-
+-    /*
+-     * The coordinates of the point under consideration are (px,py).  The
+-     * line segment joins (sx1,sy1) to (sx2,sy2).  "ptold" is true if the
+-     * point lies in the old array. We set it by comparing the x coordinates
+-     * of the i'th old point and the j'th new point, being careful if we
+-     * have fallen past the edges. Having found the point, load up the point
+-     * and segment coordinates appropriately.
+-     */
+-
+-    ptold = (j >= n || (i < mhi && oldhiview[2 * i] < u[j]));
+-    if (ptold) {
+-      px = oldhiview[2 * i];
+-      py = oldhiview[2 * i + 1];
+-      seg = j > 0 && j < n;
+-      if (seg) {
+-	sx1 = u[j - 1];
+-	sy1 = v[j - 1];
+-	sx2 = u[j];
+-	sy2 = v[j];
+-      }
+-    } else {
+-      px = u[j];
+-      py = v[j];
+-      seg = i > 0 && i < mhi;
+-      if (seg) {
+-	sx1 = oldhiview[2 * (i - 1)];
+-	sy1 = oldhiview[2 * (i - 1) + 1];
+-	sx2 = oldhiview[2 * i];
+-	sy2 = oldhiview[2 * i + 1];
+-      }
+-    }
+-
+-    /*
+-     * Now determine if the point is higher than the segment, using the
+-     * logical function "above". We also need to know if it is the old view
+-     * or the new view that is higher. "newhi" is set true if the new view
+-     * is higher than the old.
+-     */
+-    if (seg)
+-      pthi = plabv(px, py, sx1, sy1, sx2, sy2);
+-    else
+-      pthi = 1;
+-
+-    newhi = (ptold && !pthi) || (!ptold && pthi);
+-    /*
+-     * The last point and this point lie on different sides of
+-     * the current silouette
+-     */
+-    change = (newhi && !pnewhi) || (!newhi && pnewhi);
+-
+-    /*
+-     * There is a new intersection point to put in the peak array if the
+-     * state of "newhi" changes.
+-     */
+-    if (first) {
+-      plP_draw3d(px, py, c, j, 1);
+-      first = 0;
+-      lstold = ptold;
+-      savehipoint(px, py);
+-      pthi = 0;
+-      ochange = 0;
+-    } else if (change) {
+-
+-      /*
+-       * Take care of special cases at end of arrays.  If pl3upv is 0 the
+-       * endpoints are not connected to the old view.
+-       */
+-      if (pl3upv == 0 && ((!ptold && j == 0) || (ptold && i == 0))) {
+-	plP_draw3d(px, py, c, j, 1);
+-	lstold = ptold;
+-	pthi = 0;
+-	ochange = 0;
+-      } else if (pl3upv == 0 &&
+-		 (( ! ptold && i >= mhi) || (ptold && j >= n))) {
+-	plP_draw3d(px, py, c, j, 1);
+-	lstold = ptold;
+-	pthi = 0;
+-	ochange = 0;
+-      } else {
+-
+-	/*
+-	 * If pl3upv is not 0 then we do want to connect the current line
+-	 * with the previous view at the endpoints.  Also find intersection
+-	 * point with old view.
+-	 */
+-	if (i == 0) {
+-	  sx1 = oldhiview[0];
+-	  sy1 = -1;
+-	  sx2 = oldhiview[0];
+-	  sy2 = oldhiview[1];
+-	} else if (i >= mhi) {
+-	  sx1 = oldhiview[2 * (mhi - 1)];
+-	  sy1 = oldhiview[2 * (mhi - 1) + 1];
+-	  sx2 = oldhiview[2 * (mhi - 1)];
+-	  sy2 = -1;
+-	} else {
+-	  sx1 = oldhiview[2 * (i - 1)];
+-	  sy1 = oldhiview[2 * (i - 1) + 1];
+-	  sx2 = oldhiview[2 * i];
+-	  sy2 = oldhiview[2 * i + 1];
+-	}
+-
+-	if (j == 0) {
+-	  su1 = u[0];
+-	  sv1 = -1;
+-	  su2 = u[0];
+-	  sv2 = v[0];
+-	} else if (j >= n) {
+-	  su1 = u[n - 1];
+-	  sv1 = v[n - 1];
+-	  su2 = u[n - 1];
+-	  sv2 = -1;
+-	} else {
+-	  su1 = u[j - 1];
+-	  sv1 = v[j - 1];
+-	  su2 = u[j];
+-	  sv2 = v[j];
+-	}
+-
+-	/* Determine the intersection */
+-
+-	pl3cut(sx1, sy1, sx2, sy2, su1, sv1, su2, sv2, &cx, &cy);
+-	if (cx == px && cy == py) {
+-	  if (lstold && !ochange)
+-	    plP_draw3d(px, py, c, j, 1);
+-	  else
+-	    plP_draw3d(px, py, c, j, 0);
+-
+-	  savehipoint(px, py);
+-	  lstold = 1;
+-	  pthi = 0;
+-	} else {
+-	  if (lstold && !ochange)
+-	    plP_draw3d(cx, cy, c, j, 1);
+-	  else
+-	    plP_draw3d(cx, cy, c, j, 0);
+-
+-	  lstold = 1;
+-	  savehipoint(cx, cy);
+-	}
+-	ochange = 1;
+-      }
+-    }
+-
+-    /* If point is high then draw plot to point and update view. */
+-
+-    if (pthi) {
+-      if (lstold && ptold)
+-	plP_draw3d(px, py, c, j, 1);
+-      else
+-	plP_draw3d(px, py, c, j, 0);
+-
+-      savehipoint(px, py);
+-      lstold = ptold;
+-      ochange = 0;
+-    }
+-    pnewhi = newhi;
+-
+-    if (ptold)
+-      i++;
+-    else
+-      j++;
+-  }
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void  plP_draw3d()
+- *
+- * Does a simple move or line draw.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plP_draw3d(PLINT x, PLINT y, PLFLT *c, PLINT j, PLINT move)
+-{
+-    if (move)
+-      plP_movphy(x, y);
+-    else {
+-      if (c != NULL)
+-	plcol1(c[j-1]);
+-      plP_draphy(x, y);
+-    }
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void plnxtvlo()
+- *
+- * Draw the bottom side of the 3-d plot.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plnxtvlo(PLINT *u, PLINT *v, PLFLT*c, PLINT n, PLINT init)
+-{
+-  PLINT i, j, first;
+-  PLINT sx1 = 0, sx2 = 0, sy1 = 0, sy2 = 0;
+-  PLINT su1, su2, sv1, sv2;
+-  PLINT cx, cy, px, py;
+-  PLINT seg, ptold, lstold = 0, ptlo, pnewlo, newlo, change, ochange = 0;
+-
+-  first = 1;
+-  pnewlo = 0;
+-
+-  /*
+-   * For the initial set of points, just display them and store them as the
+-   * peak points.
+-   */
+-  if (init == 1) {
+-
+-    oldloview = (PLINT *) malloc((size_t) (2 * n * sizeof(PLINT)));
+-    if ( ! oldloview)
+-      myexit((char*)"\nplnxtvlo: Out of memory.");
+-
+-    plP_draw3d(u[0], v[0], c, 0, 1);
+-    oldloview[0] = u[0];
+-    oldloview[1] = v[0];
+-    for (i = 1; i < n; i++) {
+-      plP_draw3d(u[i], v[i], c, i, 0);
+-      oldloview[2 * i] = u[i];
+-      oldloview[2 * i + 1] = v[i];
+-    }
+-    mlo = n;
+-    return;
+-  }
+-
+-  /*
+-   * Otherwise, we need to consider hidden-line removal problem. We scan
+-   * over the points in both the old (i.e. oldloview[]) and new (i.e. u[]
+-   * and v[]) arrays in order of increasing x coordinate.  At each stage, we
+-   * find the line segment in the other array (if one exists) that straddles
+-   * the x coordinate of the point. We have to determine if the point lies
+-   * above or below the line segment, and to check if the below/above status
+-   * has changed since the last point.
+-   *
+-   * If pl3upv = 0 we do not update the view, this is useful for drawing
+-   * lines on the graph after we are done plotting points.  Hidden line
+-   * removal is still done, but the view is not updated.
+-   */
+-  xxlo = 0;
+-  i = 0;
+-  j = 0;
+-  if (pl3upv != 0) {
+-    newlosize = 2 * (mlo + BINC);
+-    if (newloview != NULL) {
+-      newloview =
+-	(PLINT *) realloc((void *) newloview,
+-			  (size_t) (newlosize * sizeof(PLINT)));
+-    }
+-    else {
+-      newloview =
+-	(PLINT *) malloc((size_t) (newlosize * sizeof(PLINT)));
+-    }
+-    if ( ! newloview)
+-      myexit((char*)"plnxtvlo: Out of memory.");
+-  }
+-
+-  /*
+-   * (oldloview[2*i], oldloview[2*i]) is the i'th point in the old array
+-   * (u[j], v[j]) is the j'th point in the new array.
+-   */
+-  while (i < mlo || j < n) {
+-
+-    /*
+-     * The coordinates of the point under consideration are (px,py).  The
+-     * line segment joins (sx1,sy1) to (sx2,sy2).  "ptold" is true if the
+-     * point lies in the old array. We set it by comparing the x coordinates
+-     * of the i'th old point and the j'th new point, being careful if we
+-     * have fallen past the edges. Having found the point, load up the point
+-     * and segment coordinates appropriately.
+-     */
+-    ptold = (j >= n || (i < mlo && oldloview[2 * i] < u[j]));
+-    if (ptold) {
+-      px = oldloview[2 * i];
+-      py = oldloview[2 * i + 1];
+-      seg = j > 0 && j < n;
+-      if (seg) {
+-	sx1 = u[j - 1];
+-	sy1 = v[j - 1];
+-	sx2 = u[j];
+-	sy2 = v[j];
+-      }
+-    }
+-    else {
+-      px = u[j];
+-      py = v[j];
+-      seg = i > 0 && i < mlo;
+-      if (seg) {
+-	sx1 = oldloview[2 * (i - 1)];
+-	sy1 = oldloview[2 * (i - 1) + 1];
+-	sx2 = oldloview[2 * i];
+-	sy2 = oldloview[2 * i + 1];
+-      }
+-    }
+-
+-    /*
+-     * Now determine if the point is lower than the segment, using the
+-     * logical function "above". We also need to know if it is the old view
+-     * or the new view that is lower. "newlo" is set true if the new view is
+-     * lower than the old.
+-     */
+-    if (seg)
+-      ptlo = !plabv(px, py, sx1, sy1, sx2, sy2);
+-    else
+-      ptlo = 1;
+-
+-    newlo = (ptold && !ptlo) || (!ptold && ptlo);
+-    change = (newlo && !pnewlo) || (!newlo && pnewlo);
+-
+-    /*
+-     * There is a new intersection point to put in the peak array if the
+-     * state of "newlo" changes.
+-     */
+-    if (first) {
+-      plP_draw3d(px, py, c, j, 1);
+-      first = 0;
+-      lstold = ptold;
+-      savelopoint(px, py);
+-      ptlo = 0;
+-      ochange = 0;
+-    }
+-    else if (change) {
+-
+-      /*
+-       * Take care of special cases at end of arrays.  If pl3upv is 0 the
+-       * endpoints are not connected to the old view.
+-       */
+-      if (pl3upv == 0 && ((!ptold && j == 0) || (ptold && i == 0))) {
+-	plP_draw3d(px, py, c, j, 1);
+-	lstold = ptold;
+-	ptlo = 0;
+-	ochange = 0;
+-      }
+-      else if (pl3upv == 0 &&
+-	       (( ! ptold && i >= mlo) || (ptold && j >= n))) {
+-	plP_draw3d(px, py, c, j, 1);
+-	lstold = ptold;
+-	ptlo = 0;
+-	ochange = 0;
+-      }
+-
+-      /*
+-       * If pl3upv is not 0 then we do want to connect the current line
+-       * with the previous view at the endpoints.  Also find intersection
+-       * point with old view.
+-       */
+-      else {
+-	if (i == 0) {
+-	  sx1 = oldloview[0];
+-	  sy1 = 100000;
+-	  sx2 = oldloview[0];
+-	  sy2 = oldloview[1];
+-	}
+-	else if (i >= mlo) {
+-	  sx1 = oldloview[2 * (mlo - 1)];
+-	  sy1 = oldloview[2 * (mlo - 1) + 1];
+-	  sx2 = oldloview[2 * (mlo - 1)];
+-	  sy2 = 100000;
+-	}
+-	else {
+-	  sx1 = oldloview[2 * (i - 1)];
+-	  sy1 = oldloview[2 * (i - 1) + 1];
+-	  sx2 = oldloview[2 * i];
+-	  sy2 = oldloview[2 * i + 1];
+-	}
+-
+-	if (j == 0) {
+-	  su1 = u[0];
+-	  sv1 = 100000;
+-	  su2 = u[0];
+-	  sv2 = v[0];
+-	}
+-	else if (j >= n) {
+-	  su1 = u[n - 1];
+-	  sv1 = v[n - 1];
+-	  su2 = u[n];
+-	  sv2 = 100000;
+-	}
+-	else {
+-	  su1 = u[j - 1];
+-	  sv1 = v[j - 1];
+-	  su2 = u[j];
+-	  sv2 = v[j];
+-	}
+-
+-	/* Determine the intersection */
+-
+-	pl3cut(sx1, sy1, sx2, sy2, su1, sv1, su2, sv2, &cx, &cy);
+-	if (cx == px && cy == py) {
+-	  if (lstold && !ochange)
+-	    plP_draw3d(px, py, c, j, 1);
+-	  else
+-	    plP_draw3d(px, py, c, j, 0);
+-
+-	  savelopoint(px, py);
+-	  lstold = 1;
+-	  ptlo = 0;
+-	}
+-	else {
+-	  if (lstold && !ochange)
+-	    plP_draw3d(cx, cy, c, j, 1);
+-	  else
+-	    plP_draw3d(cx, cy, c, j, 0);
+-
+-	  lstold = 1;
+-	  savelopoint(cx, cy);
+-	}
+-	ochange = 1;
+-      }
+-    }
+-
+-    /* If point is low then draw plot to point and update view. */
+-
+-    if (ptlo) {
+-      if (lstold && ptold)
+-	plP_draw3d(px, py, c, j, 1);
+-      else
+-	plP_draw3d(px, py, c, j, 0);
+-
+-      savelopoint(px, py);
+-      lstold = ptold;
+-      ochange = 0;
+-    }
+-
+-    pnewlo = newlo;
+-
+-    if (ptold)
+-      i = i + 1;
+-    else
+-      j = j + 1;
+-  }
+-
+-  /* Set oldloview */
+-
+-  swaploview();
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * savehipoint
+- * savelopoint
+- *
+- * Add a point to the list of currently visible peaks/valleys, when
+- * drawing the top/bottom surface, respectively.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-savehipoint(PLINT px, PLINT py)
+-{
+-    if (pl3upv == 0)
+-	return;
+-
+-    if (xxhi >= newhisize) {	/* allocate additional space */
+-	newhisize += 2 * BINC;
+-	newhiview = (PLINT *) realloc((void *) newhiview,
+-				      (size_t) (newhisize * sizeof(PLINT)));
+-	if ( ! newhiview)
+-	    myexit((char*)"savehipoint: Out of memory.");
+-    }
+-
+-    newhiview[xxhi] = px;
+-    xxhi++;
+-    newhiview[xxhi] = py;
+-    xxhi++;
+-}
+-
+-static void
+-savelopoint(PLINT px, PLINT py)
+-{
+-    if (pl3upv == 0)
+-	return;
+-
+-    if (xxlo >= newlosize) {	/* allocate additional space */
+-	newlosize += 2 * BINC;
+-	newloview = (PLINT *) realloc((void *) newloview,
+-				      (size_t) (newlosize * sizeof(PLINT)));
+-	if ( ! newloview)
+-	    myexit((char*)"savelopoint: Out of memory.");
+-    }
+-
+-    newloview[xxlo] = px;
+-    xxlo++;
+-    newloview[xxlo] = py;
+-    xxlo++;
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * swaphiview
+- * swaploview
+- *
+- * Swaps the top/bottom views.  Need to do a real swap so that the
+- * memory cleanup routine really frees everything (and only once).
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-swaphiview(void)
+-{
+-    PLINT *tmp;
+-
+-    if (pl3upv != 0) {
+-	mhi = xxhi / 2;
+-	tmp = oldhiview;
+-	oldhiview = newhiview;
+-	newhiview = tmp;
+-    }
+-}
+-
+-static void
+-swaploview(void)
+-{
+-    PLINT *tmp;
+-
+-    if (pl3upv != 0) {
+-	mlo = xxlo / 2;
+-	tmp = oldloview;
+-	oldloview = newloview;
+-	newloview = tmp;
+-    }
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * freework
+- *
+- * Frees memory associated with work arrays
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-freework(void)
+-{
+-    free_mem(oldhiview);
+-    free_mem(oldloview);
+-    free_mem(newhiview);
+-    free_mem(newloview);
+-    free_mem(vtmp);
+-    free_mem(utmp);
+-    free_mem(ctmp);
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * myexit
+- *
+- * Calls plexit, cleaning up first.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-myexit(char *msg)
+-{
+-    freework();
+-    plexit(msg);
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * myabort
+- *
+- * Calls plabort, cleaning up first.
+- * Caller should return to the user program.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-myabort(char *msg)
+-{
+-    freework();
+-    plabort(msg);
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * int plabv()
+- *
+- * Determines if point (px,py) lies above the line joining (sx1,sy1) to
+- * (sx2,sy2). It only works correctly if sx1 <= px <= sx2.
+-\*--------------------------------------------------------------------------*/
+-
+-static int
+-plabv(PLINT px, PLINT py, PLINT sx1, PLINT sy1, PLINT sx2, PLINT sy2)
+-{
+-    int above;
+-
+-    if (py >= sy1 && py >= sy2)
+-	above = 1;
+-    else if (py < sy1 && py < sy2)
+-	above = 0;
+-    else if ((double) (sx2 - sx1) * (py - sy1) >=
+-	     (double) (px - sx1) * (sy2 - sy1))
+-	above = 1;
+-    else
+-	above = 0;
+-
+-    return above;
+-}
+-
+-/*--------------------------------------------------------------------------*\
+- * void pl3cut()
+- *
+- * Determines the point of intersection (cx,cy) between the line joining
+- * (sx1,sy1) to (sx2,sy2) and the line joining (su1,sv1) to (su2,sv2).
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-pl3cut(PLINT sx1, PLINT sy1, PLINT sx2, PLINT sy2,
+-       PLINT su1, PLINT sv1, PLINT su2, PLINT sv2, PLINT *cx, PLINT *cy)
+-{
+-    PLINT x21, y21, u21, v21, yv1, xu1, a, b;
+-    double fa, fb;
+-
+-    x21 = sx2 - sx1;
+-    y21 = sy2 - sy1;
+-    u21 = su2 - su1;
+-    v21 = sv2 - sv1;
+-    yv1 = sy1 - sv1;
+-    xu1 = sx1 - su1;
+-
+-    a = x21 * v21 - y21 * u21;
+-    fa = (double) a;
+-    if (a == 0) {
+-	if (sx2 < su2) {
+-	    *cx = sx2;
+-	    *cy = sy2;
+-	}
+-	else {
+-	    *cx = su2;
+-	    *cy = sv2;
+-	}
+-	return;
+-    }
+-    else {
+-	b = yv1 * u21 - xu1 * v21;
+-	fb = (double) b;
+-	*cx = (PLINT) (sx1 + (fb * x21) / fa + .5);
+-	*cy = (PLINT) (sy1 + (fb * y21) / fa + .5);
+-    }
+-}
+-
+-
+-void
+-mesh_nr(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt)
+-{
+-  c_plot3dc_nr(x, y, z, nx, ny, opt | MESH, NULL, 0);
+-}
+-
+-
+-/*--------------------------------------------------------------------------*\
+- * void plot3dc_nr(x, y, z, nx, ny, opt, clevel, nlevel)
+- *
+- * Plots a 3-d representation of the function z[x][y]. The x values
+- * are stored as x[0..nx-1], the y values as y[0..ny-1], and the z
+- * values are in the 2-d array z[][]. The integer "opt" specifies:
+- * see plot3dcl() below
+-\*--------------------------------------------------------------------------*/
+-
+-void
+-c_plot3dc_nr(PLFLT *x, PLFLT *y, PLFLT **z,
+-	     PLINT nx, PLINT ny, PLINT opt,
+-	     PLFLT *clevel, PLINT nlevel)
+-{
+-  c_plot3dcl_nr( x, y, z, nx, ny, opt, clevel, nlevel, 0, 0, NULL, NULL);
+-}
+-
+-
+-/*--------------------------------------------------------------------------*\
+- * void plot3dcl_nr(x, y, z, nx, ny, opt, clevel, nlevel,
+- *       ixstart, ixn, indexymin, indexymax)
+- *
+- * Plots a 3-d representation of the function z[x][y]. The x values
+- * are stored as x[0..nx-1], the y values as y[0..ny-1], and the z
+- * values are in the 2-d array z[][]. The integer "opt" specifies:
+- *
+- *  DRAW_LINEX :  Draw lines parallel to x-axis
+- *  DRAW_LINEY :  Draw lines parallel to y-axis
+- *  DRAW_LINEXY:  Draw lines parallel to both axes
+- *  MAG_COLOR:    Magnitude coloring of wire frame
+- *  BASE_CONT:    Draw contour at bottom xy plane
+- *  TOP_CONT:     Draw contour at top xy plane (not yet)
+- *  DRAW_SIDES:   Draw sides around the plot
+- *  MESH:       Draw the "under" side of the plot
+- *
+- * or any bitwise combination, e.g. "MAG_COLOR | DRAW_LINEX"
+- * indexymin and indexymax are arrays which specify the y index limits
+- * (following the convention that the upper range limit is one more than
+- * actual index limit) for an x index range of ixstart, ixn.
+-\*--------------------------------------------------------------------------*/
+-
+-void
+-c_plot3dcl_nr(PLFLT *x, PLFLT *y, PLFLT **z,
+-	      PLINT nx, PLINT ny, PLINT opt,
+-	      PLFLT *clevel, PLINT nlevel,
+-	      PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT *indexymax)
+-{
+-    PLFLT cxx, cxy, cyx, cyy, cyz;
+-    PLINT init, i, ix, iy, color, width;
+-    PLFLT xmin, xmax, ymin, ymax, zmin, zmax, zscale;
+-    PLINT clipped = 0, base_cont = 0, side = 0;
+-
+-    pl3mode = 0;
+-
+-    if (plsc->level < 3) {
+-	myabort((char*)"plot3dcl: Please set up window first");
+-	return;
+-    }
+-
+-    if (opt < 1) {
+-	myabort((char*)"plot3dcl: Bad option");
+-	return;
+-    }
+-
+-    if (nx <= 0 || ny <= 0) {
+-	myabort((char*)"plot3dcl: Bad array dimensions.");
+-	return;
+-    }
+-
+-    plP_gdom(&xmin, &xmax, &ymin, &ymax);
+-    plP_grange(&zscale, &zmin, &zmax);
+-    if(zmin > zmax) {
+-      PLFLT t = zmin;
+-      zmin = zmax;
+-      zmax = t;
+-    }
+-
+-    if (opt & MESH)
+-      pl3mode = 1;
+-
+-    if (opt & DRAW_SIDES)
+-      side = 1;
+-
+-    if ((opt & BASE_CONT) || (opt & TOP_CONT) || (opt && MAG_COLOR)) {
+-     /*
+-      * Don't use the data z value to scale the color, use the z axis
+-      * values set by plw3d()
+-      *
+-      * plMinMax2dGrid(z, nx, ny, &fc_maxz, &fc_minz);
+-      */
+-
+-     fc_minz = plsc->ranmi;
+-     fc_maxz = plsc->ranma;
+-
+-     if (fc_maxz == fc_minz) {
+-       plwarn("plot3dcl: Maximum and minimum Z values are equal! \"fixing\"...");
+-       fc_maxz = fc_minz + 1e-6;
+-     }
+-    }
+-
+-    if (opt & BASE_CONT) {     /* If enabled, draw the contour at the base.  */
+-      if (clevel != NULL && nlevel != 0) {
+-	base_cont = 1;
+-	/* even if MESH is not set, "set it",
+-	   as the base contour can only be done in this case */
+-	pl3mode = 1;
+-      }
+-    }
+-
+-    if (opt & MAG_COLOR) {     /* If enabled, use magnitude colored wireframe  */
+-      //      ctmp = (PLFLT *) malloc((size_t) (2 * MAX(nx, ny) * sizeof(PLFLT)));
+-    } else
+-      ctmp = NULL;
+-    
+-    /* next logic only knows opt = 1 | 2 | 3, make sure that it only gets that */
+-    opt &= DRAW_LINEXY;
+-
+-    /* Allocate work arrays */
+-
+-    utmp = (PLINT *) malloc((size_t) (2 * MAX(nx, ny) * sizeof(PLINT)));
+-    vtmp = (PLINT *) malloc((size_t) (2 * MAX(nx, ny) * sizeof(PLINT)));
+-
+-    if ( ! utmp || ! vtmp)
+-	myexit((char*)"plot3dcl: Out of memory.");
+-
+-    plP_gw3wc(&cxx, &cxy, &cyx, &cyy, &cyz);
+-    init = 1;
+-    /* Call 3d line plotter.  Each viewing quadrant
+-       (perpendicular to x-y plane) must be handled separately. */
+-
+-    if (cxx >= 0.0 && cxy <= 0.0) {
+-      if (opt == DRAW_LINEY)
+-	plt3zz_nr(1, ny, 1, -1, -opt, &init, x, y, z, nx, ny, utmp, vtmp,ctmp);
+-      else {
+-	    for (iy = 2; iy <= ny; iy++)
+-		plt3zz_nr(1, iy, 1, -1, -opt, &init, x, y, z, nx, ny, utmp, vtmp,ctmp);
+-	}
+-	if (opt == DRAW_LINEX)
+-	    plt3zz_nr(1, ny, 1, -1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (ix = 1; ix <= nx - 1; ix++)
+-		plt3zz_nr(ix, ny, 1, -1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-    }
+-
+-    else if (cxx <= 0.0 && cxy <= 0.0) {
+-        if (opt == DRAW_LINEX)
+-	    plt3zz_nr(nx, ny, -1, -1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (ix = 2; ix <= nx; ix++)
+-		plt3zz_nr(ix, ny, -1, -1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-	if (opt == DRAW_LINEY)
+-	    plt3zz_nr(nx, ny, -1, -1, -opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (iy = ny; iy >= 2; iy--)
+-	      plt3zz_nr(nx, iy, -1, -1, -opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-    }
+-
+-    else if (cxx <= 0.0 && cxy >= 0.0) {
+-	if (opt == DRAW_LINEY)
+-	    plt3zz_nr(nx, 1, -1, 1, -opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (iy = ny - 1; iy >= 1; iy--)
+-		plt3zz_nr(nx, iy, -1, 1, -opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-	if (opt == DRAW_LINEX)
+-	    plt3zz_nr(nx, 1, -1, 1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (ix = nx; ix >= 2; ix--)
+-		plt3zz_nr(ix, 1, -1, 1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-    }
+-
+-    else if (cxx >= 0.0 && cxy >= 0.0) {
+-	if (opt == DRAW_LINEX)
+-	    plt3zz_nr(1, 1, 1, 1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (ix = nx - 1; ix >= 1; ix--)
+-		plt3zz_nr(ix, 1, 1, 1, opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-	if (opt == DRAW_LINEY)
+-	    plt3zz_nr(1, 1, 1, 1, -opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	else {
+-	    for (iy = 1; iy <= ny - 1; iy++)
+-		plt3zz_nr(1, iy, 1, 1, -opt, &init, x, y, z, nx, ny, utmp, vtmp, ctmp);
+-	}
+-    }
+-
+-    /* Finish up by drawing sides, background grid (both are optional) */
+-
+-    if (side)
+-	plside3(x, y, z, nx, ny, opt);
+-
+-    if (zbflg) {
+-	color = plsc->icol0;
+-        width = plsc->width;
+-	plwid(zbwidth);
+-	plcol0(zbcol);
+-	plgrid3(zbtck);
+-	plwid(width);
+-	plcol0(color);
+-    }
+-
+-    freework();
+-}
+-
+-
+-/*--------------------------------------------------------------------------*\
+- * void plt3zz_nr()
+- *
+- * Draws the next zig-zag line for a 3-d plot.  The data is stored in array
+- * z[][] as a function of x[] and y[], and is plotted out starting at index
+- * (x0,y0).
+- *
+- * Depending on the state of "flag", the sequence of data points sent to
+- * plnxtv is altered so as to allow cross-hatch plotting, or plotting
+- * parallel to either the x-axis or the y-axis.
+-\*--------------------------------------------------------------------------*/
+-
+-static void
+-plt3zz_nr(PLINT x0, PLINT y0, PLINT dx, PLINT dy, PLINT flag, PLINT *init,
+-       PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny,
+-       PLINT *u, PLINT *v, PLFLT* c)
+-{
+-    PLINT n = 0;
+-    PLFLT x2d, y2d;
+-
+-    while (1 <= x0 && x0 <= nx && 1 <= y0 && y0 <= ny) {
+-
+-      if (ny == 1) {
+-	x2d = plP_w3wcx(x[x0 - 1], y[x0 - 1], z[x0 - 1][y0 - 1]);
+-	y2d = plP_w3wcy(x[x0 - 1], y[x0 - 1], z[x0 - 1][y0 - 1]);
+-      }
+-
+-      if (nx == 1) {
+-	x2d = plP_w3wcx(x[y0 - 1], y[y0 - 1], z[x0 - 1][y0 - 1]);
+-	y2d = plP_w3wcy(x[y0 - 1], y[y0 - 1], z[x0 - 1][y0 - 1]);
+-      }
+-
+-	u[n] = plP_wcpcx(x2d);
+-	v[n] = plP_wcpcy(y2d);
+-	if (c != NULL)
+-	  c[n] = (z[x0 - 1][y0 - 1] - fc_minz)/(fc_maxz-fc_minz);
+-
+-	switch (flag) {
+-	case -3:
+-	    y0 += dy;
+-	    flag = -flag;
+-	    break;
+-	case -2:
+-	    y0 += dy;
+-	    break;
+-	case -1:
+-	    y0 += dy;
+-	    flag = -flag;
+-	    break;
+-	case 1:
+-	    x0 += dx;
+-	    break;
+-	case 2:
+-	    x0 += dx;
+-	    flag = -flag;
+-	    break;
+-	case 3:
+-	    x0 += dx;
+-	    flag = -flag;
+-	    break;
+-	}
+-	n++;
+-    }
+-
+-    if (flag == 1 || flag == -2) {
+-	if (flag == 1) {
+-	    x0 -= dx;
+-	    y0 += dy;
+-	}
+-	else if (flag == -2) {
+-	    y0 -= dy;
+-	    x0 += dx;
+-	}
+-	if (1 <= x0 && x0 <= nx && 1 <= y0 && y0 <= ny) {
+-	  if (ny == 1) {
+-	    x2d = plP_w3wcx(x[x0 - 1], y[x0 - 1], z[x0 - 1][y0 - 1]);
+-	    y2d = plP_w3wcy(x[x0 - 1], y[x0 - 1], z[x0 - 1][y0 - 1]);
+-	  }
+-
+-	  if (nx == 1) {
+-	    x2d = plP_w3wcx(x[y0 - 1], y[y0 - 1], z[x0 - 1][y0 - 1]);
+-	    y2d = plP_w3wcy(x[y0 - 1], y[y0 - 1], z[x0 - 1][y0 - 1]);
+-	  }
+-
+-	    u[n] = plP_wcpcx(x2d);
+-	    v[n] = plP_wcpcy(y2d);
+-	    if (c != NULL)
+-	      c[n] = (z[x0 - 1][y0 - 1] - fc_minz)/(fc_maxz-fc_minz);
+-	    n++;
+-	}
+-    }
+-
+-/* All the setup is done.  Time to do the work. */
+-
+-    plnxtv(u, v, c, n, *init);
+-    *init = 0;
+-}
+-}
+-
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_axis.cpp gdl/src/plotting_axis.cpp
 --- gdl-0.9.2/src/plotting_axis.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_axis.cpp	2012-02-21 09:54:36.346914353 -0700
++++ gdl/src/plotting_axis.cpp	2012-01-26 17:02:50.000000000 -0700
 @@ -279,7 +279,7 @@
        if (e->KeywordSet("SAVE"))
        {
@@ -37223,7 +40360,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_axis.cpp gdl/src/plotting_axis.cp
          set_axis_type("Y",yLog);
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_contour.cpp gdl/src/plotting_contour.cpp
 --- gdl-0.9.2/src/plotting_contour.cpp	2011-09-19 06:06:11.000000000 -0600
-+++ gdl/src/plotting_contour.cpp	2012-02-21 09:54:36.376913265 -0700
++++ gdl/src/plotting_contour.cpp	2012-01-26 17:01:33.000000000 -0700
 @@ -849,15 +849,15 @@
  
      private: virtual void post_call(EnvT*, GDLGStream* actStream) // {{{
@@ -37245,7 +40382,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_contour.cpp gdl/src/plotting_cont
          set_axis_type("X",xLog);
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting.cpp gdl/src/plotting.cpp
 --- gdl-0.9.2/src/plotting.cpp	2011-09-19 06:06:11.000000000 -0600
-+++ gdl/src/plotting.cpp	2012-05-10 15:10:05.288474195 -0600
++++ gdl/src/plotting.cpp	2012-03-05 08:35:07.000000000 -0700
 @@ -1,1329 +1,1458 @@
 -/***************************************************************************
 -                       plotting.cpp  -  GDL routines for plotting
@@ -40036,7 +43173,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting.cpp gdl/src/plotting.cpp
 +} // namespace
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_cursor.cpp gdl/src/plotting_cursor.cpp
 --- gdl-0.9.2/src/plotting_cursor.cpp	2011-06-28 06:53:58.000000000 -0600
-+++ gdl/src/plotting_cursor.cpp	2012-02-21 09:54:36.392912684 -0700
++++ gdl/src/plotting_cursor.cpp	2012-01-26 17:01:33.000000000 -0700
 @@ -20,207 +20,233 @@
  #include "math_utl.hpp"
  #define PLK_Escape            0x1B
@@ -40453,7 +43590,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_cursor.cpp gdl/src/plotting_curso
  } // namespace
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_erase.cpp gdl/src/plotting_erase.cpp
 --- gdl-0.9.2/src/plotting_erase.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_erase.cpp	2012-05-10 15:10:05.346472099 -0600
++++ gdl/src/plotting_erase.cpp	2012-03-13 10:17:36.000000000 -0600
 @@ -38,19 +38,52 @@
  
      private: void call_plplot(EnvT* e, GDLGStream* actStream) // {{{
@@ -40520,7 +43657,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_erase.cpp gdl/src/plotting_erase.
      {
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting.hpp gdl/src/plotting.hpp
 --- gdl-0.9.2/src/plotting.hpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting.hpp	2012-05-10 15:10:05.305473578 -0600
++++ gdl/src/plotting.hpp	2012-03-05 08:35:07.000000000 -0700
 @@ -35,6 +35,7 @@
    void xyouts( EnvT* e);
    void axis( EnvT* e);
@@ -40581,7 +43718,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting.hpp gdl/src/plotting.hpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_misc.cpp gdl/src/plotting_misc.cpp
 --- gdl-0.9.2/src/plotting_misc.cpp	2011-06-28 06:53:58.000000000 -0600
-+++ gdl/src/plotting_misc.cpp	2012-02-21 09:54:36.408912104 -0700
++++ gdl/src/plotting_misc.cpp	2012-02-07 04:23:00.000000000 -0700
 @@ -200,6 +200,16 @@
  	      }
  	  }
@@ -40602,7 +43739,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_misc.cpp gdl/src/plotting_misc.cp
  } // namespace
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.cpp
 --- gdl-0.9.2/src/plotting_oplot.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_oplot.cpp	2012-05-10 15:10:05.358471665 -0600
++++ gdl/src/plotting_oplot.cpp	2012-06-20 09:26:32.000000000 -0600
 @@ -24,99 +24,151 @@
  
    class oplot_call : public plotting_routine_call 
@@ -40685,8 +43822,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
 +          xEl = size;
 +          yEl = size;
 +        }
-       }
--    DLong minEl = (xEl < yEl)? xEl : yEl;
++      }
 +      //check nsum validity
 +      nsum=max(1,nsum);
 +      nsum=min(nsum,(DLong)xEl);
@@ -40740,7 +43876,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
 +            (*yVal)[i] = y;
 +          }
 +        }
-+      }
+       }
+-    DLong minEl = (xEl < yEl)? xEl : yEl;
 +    }
  
 -    // !X, !Y (also used below)
@@ -40769,7 +43906,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
      get_axis_type("Y", yLog);
 -    
 -    //    int just = (e->KeywordSet("ISOTROPIC"))? 1 : 0;
- 
+-
 -    // start drawing
 -    gkw_background(e, actStream,false);
 -    gkw_color(e, actStream);
@@ -40778,7 +43915,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
 -    DFloat charsize;
 -    gkw_charsize(e,actStream, charsize, false);
 -
--
+ 
 -    if( (yStart == yEnd) || (xStart == xEnd))
 -      {
 -	if( yStart != 0.0 && yStart == yEnd)
@@ -40822,7 +43959,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
      e->AssureDoubleScalarKWIfPresent( "MIN_VALUE", minVal);
      e->AssureDoubleScalarKWIfPresent( "MAX_VALUE", maxVal);
  
-@@ -129,33 +181,25 @@
+@@ -129,33 +181,35 @@
  	static int clippingix = e->KeywordIx( "CLIP"); 
  	clippingD = e->IfDefGetKWAs<DDoubleGDL>( clippingix);
        }
@@ -40833,10 +43970,18 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
 -			    xLog, yLog,
 -			    xMarginL, xMarginR, yMarginB, yMarginT,
 -			    xStart, xEnd, minVal, maxVal);
--    if( !okVPWC) return;
++    DFloat xMarginL, xMarginR, yMarginB, yMarginT;
++    get_axis_margin("X",xMarginL, xMarginR); 	 
++    get_axis_margin("Y",yMarginB, yMarginT);
++    // viewport and world coordinates 	 
++    bool okVPWC = SetVP_WC( e, actStream, NULL, clippingD, 	 
++			    xLog, yLog, 	 
++			    xMarginL, xMarginR, yMarginB, yMarginT, 	 
++			    xStart, xEnd, minVal, maxVal); 	 
+     if( !okVPWC) return;
 -    // pen thickness for axis
-     actStream->wid( 0);
--
+-    actStream->wid( 0);
+ 
 -    // axis
 -    //    string xOpt = "bcnst";
 -    //string yOpt = "bcnstv";
@@ -40844,6 +43989,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
 -    //    if( xLog) xOpt += "l";
 -    //if( yLog) yOpt += "l";
 -    // pen thickness for plot
++    actStream->wid( 0);
 +    // start drawing. Graphic Keywords accepted:CLIP(NO), COLOR(YES), LINESTYLE(YES), NOCLIP(YES),
 +    //                                          PSYM(YES), SYMSIZE(YES), T3D(NO), ZVALUE(NO)
 +    gkw_background(e, actStream, false);
@@ -40869,7 +44015,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_oplot.cpp gdl/src/plotting_oplot.
      actStream->lsty(1);//reset linestyle
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_plot.cpp gdl/src/plotting_plot.cpp
 --- gdl-0.9.2/src/plotting_plot.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_plot.cpp	2012-05-10 15:10:05.371471197 -0600
++++ gdl/src/plotting_plot.cpp	2012-03-05 08:35:07.000000000 -0700
 @@ -1,306 +1,411 @@
 -/***************************************************************************
 -                       plotting_plot.cpp  -  GDL routines for plotting
@@ -41590,7 +44736,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_plot.cpp gdl/src/plotting_plot.cp
 +
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_plots.cpp gdl/src/plotting_plots.cpp
 --- gdl-0.9.2/src/plotting_plots.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_plots.cpp	2012-05-10 15:10:05.374471090 -0600
++++ gdl/src/plotting_plots.cpp	2012-03-05 08:35:07.000000000 -0700
 @@ -1,331 +1,286 @@
 -/***************************************************************************
 -                       plotting.cpp  -  GDL routines for plotting
@@ -42211,7 +45357,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_plots.cpp gdl/src/plotting_plots.
 +} // namespace
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_polyfill.cpp gdl/src/plotting_polyfill.cpp
 --- gdl-0.9.2/src/plotting_polyfill.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_polyfill.cpp	2012-02-21 09:54:36.522907967 -0700
++++ gdl/src/plotting_polyfill.cpp	2012-01-26 17:01:33.000000000 -0700
 @@ -134,14 +134,14 @@
      DDouble minVal = yStart, maxVal = yEnd;
  
@@ -42237,8 +45383,28 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_polyfill.cpp gdl/src/plotting_pol
      if ( xEnd - xStart == 0 || yEnd - yStart == 0 || isnan(xStart) || isnan(yStart) ) {
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_surface.cpp gdl/src/plotting_surface.cpp
 --- gdl-0.9.2/src/plotting_surface.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_surface.cpp	2012-02-21 09:54:36.564906443 -0700
-@@ -485,7 +485,7 @@
++++ gdl/src/plotting_surface.cpp	2012-06-28 02:10:45.000000000 -0600
+@@ -460,7 +460,8 @@
+ 	  xVec1[i] = (*xVal)[j*xEl+i];
+ 	  yVec1[i] = (*yVal)[j*xEl+i];
+ 	}
+-	lib::mesh_nr(xVec1, yVec1, z1, (long int) xEl, 1,1);
++	//lib::mesh_nr(xVec1, yVec1, z1, (long int) xEl, 1,1);
++        actStream->mesh(xVec1, yVec1, z1, (long int) xEl, 1,1); 
+       }
+       delete[] z1;
+       delete[] xVec1;
+@@ -477,7 +478,8 @@
+ 	  xVec2[i] = (*xVal)[i*xEl+j];
+ 	  yVec2[i] = (*yVal)[i*xEl+j];
+ 	}
+-	lib::mesh_nr(xVec2, yVec2, z2, 1, (long int) yEl, 2);
++	//lib::mesh_nr(xVec2, yVec2, z2, 1, (long int) yEl, 2);
++        actStream->mesh(xVec2, yVec2, z2, 1, (long int) yEl, 2); 
+       }
+       delete[] z2;
+       delete[] xVec2;
+@@ -485,7 +487,7 @@
      }
  
      // TODO: not sure if this is also valid for 3D?
@@ -42247,7 +45413,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_surface.cpp gdl/src/plotting_surf
  
      // title and sub title
      actStream->schr( 0.0, 1.25*actH/defH);
-@@ -504,9 +504,9 @@
+@@ -504,9 +506,9 @@
        actStream->lsty(1);//reset linestyle
  
        // set ![XY].CRANGE
@@ -42262,7 +45428,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_surface.cpp gdl/src/plotting_surf
        set_axis_type("X", xLog);
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_windows.cpp gdl/src/plotting_windows.cpp
 --- gdl-0.9.2/src/plotting_windows.cpp	2011-07-02 09:14:05.000000000 -0600
-+++ gdl/src/plotting_windows.cpp	2012-02-21 09:54:36.611904739 -0700
++++ gdl/src/plotting_windows.cpp	2012-02-02 18:05:27.000000000 -0700
 @@ -61,12 +61,9 @@
  	title = "GDL "+i2s( wIx);
        }
@@ -42294,7 +45460,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_windows.cpp gdl/src/plotting_wind
  		 "(BadValue (integer parameter out of range for "
 diff -ruN --exclude CVS gdl-0.9.2/src/plotting_xyouts.cpp gdl/src/plotting_xyouts.cpp
 --- gdl-0.9.2/src/plotting_xyouts.cpp	2011-07-08 06:37:54.000000000 -0600
-+++ gdl/src/plotting_xyouts.cpp	2012-02-21 09:54:36.651903286 -0700
++++ gdl/src/plotting_xyouts.cpp	2012-01-26 17:01:33.000000000 -0700
 @@ -75,7 +75,7 @@
      
      DDouble xStart, xEnd, yStart, yEnd;
@@ -42391,7 +45557,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/plotting_xyouts.cpp gdl/src/plotting_xyout
      handle_pmulti_position(e, actStream);
 diff -ruN --exclude CVS gdl-0.9.2/src/print.cpp gdl/src/print.cpp
 --- gdl-0.9.2/src/print.cpp	2011-05-11 10:11:09.000000000 -0600
-+++ gdl/src/print.cpp	2012-02-21 09:54:36.681902198 -0700
++++ gdl/src/print.cpp	2011-12-03 07:28:36.000000000 -0700
 @@ -200,8 +200,8 @@
  
      // GDL magick (based on the Python interface code)
@@ -42426,7 +45592,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/print.cpp gdl/src/print.cpp
      // looping over the parameters
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/appleman.pro gdl/src/pro/appleman.pro
 --- gdl-0.9.2/src/pro/appleman.pro	2010-01-20 04:41:56.000000000 -0700
-+++ gdl/src/pro/appleman.pro	2012-02-21 09:54:37.192883656 -0700
++++ gdl/src/pro/appleman.pro	2012-01-02 14:20:38.000000000 -0700
 @@ -1,50 +1,37 @@
 -;$Id: appleman.pro,v 1.3 2010/01/20 11:41:56 slayoo Exp $
 -pro AppleMan,xRange,yRange,RESULT=res
@@ -42641,7 +45807,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/bilinear.pro gdl/src/pro/bilinear.pro
 +end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/congrid.pro gdl/src/pro/congrid.pro
 --- gdl-0.9.2/src/pro/congrid.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/src/pro/congrid.pro	2012-05-10 15:10:05.866453331 -0600
++++ gdl/src/pro/congrid.pro	2012-04-13 06:19:50.000000000 -0600
 @@ -0,0 +1,142 @@
 +; part of GNU Data Language - GDL 
 +;-------------------------------------------------------------
@@ -42889,9 +46055,97 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/diag_matrix.pro gdl/src/pro/diag_matri
 +return, resu
 +;
 +end
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/dicom/Makefile.in gdl/src/pro/dicom/Makefile.in
+--- gdl-0.9.2/src/pro/dicom/Makefile.in	2011-11-01 17:46:37.000000000 -0600
++++ gdl/src/pro/dicom/Makefile.in	2012-06-28 03:54:55.000000000 -0600
+@@ -103,6 +103,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/file_lines.pro gdl/src/pro/file_lines.pro
+--- gdl-0.9.2/src/pro/file_lines.pro	2010-01-14 16:03:57.000000000 -0700
++++ gdl/src/pro/file_lines.pro	2012-07-04 10:10:29.000000000 -0600
+@@ -20,7 +20,9 @@
+ ;
+ ; COMMON BLOCKS: none
+ ;
+-; SIDE EFFECTS:  none
++; SIDE EFFECTS:  as is on July 2012, we still have problems related to
++;                WordExp() in "str.cpp", when a file is prefixed or
++;                suffixed by white space, FILE_TEST() returns "1" wrongly.
+ ;
+ ; RESTRICTIONS:  only for Unix (Unix, Linux and Mac OS X) systems
+ ;
+@@ -33,17 +35,22 @@
+ ;   - 30/05/2008: Michael Mueller (U of Arizona) fixed inconsistent
+ ;     handling of files that don't end in newline
+ ;   - 14/01/2010: Lucio Baggio (LATMOS/CNRS) avoided shell interaction
++;   - 04/07/2012: Alain 
++;      * Correcting bug 3189065 : better message when no-existing file !
++;      * Correcting bug 3175753 : bad value when filename begin with number
++;      * managing input files list
+ ;
+ ;-
+ ; LICENCE:
+-; Copyright (C) 2006, Alain Coulais
++; Copyright (C) 2006, 2012 Alain Coulais
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+ ; (at your option) any later version.
+ ;-
+ ;
+-function FILE_LINES, filename, compress=compress, noexpand_path=noexpand_path
++function FILE_LINES, filenames, compress=compress, noexpand_path=noexpand_path, $
++                     verbose=verbose, test=test
+ ;
+ ON_ERROR, 2    ;Return to caller
+ if KEYWORD_SET(compress) then begin
+@@ -56,13 +63,30 @@
+     return, -1
+ endif
+ ;
+-commande=["wc", "-l",filename]
+-SPAWN, commande, resultat, /NOSHELL
+-nbp=(LONG(STRCOMPRESS(resultat,/remove_all)))(0)
+-commande=["tail","-c 1",filename]
+-SPAWN, commande, resultat, /NOSHELL
+-nbp += resultat NE ''
++nbp=LONARR(N_ELEMENTS(filenames))
+ ;
+-return, nbp
++for ii=0, N_ELEMENTS(filenames)-1 do begin
++    ;;
++    filename=filenames[ii]
++    if (FILE_TEST(filename) EQ 0) then begin
++        MESSAGE, 'Error opening file. File: '+filename
++    endif
++    ;;
++    commande=["wc", "-l",filename]
++    SPAWN, commande, resultat, /NOSHELL
++    nbp[ii]=(LONG((STRSPLIT(resultat,' ',/extract))[0]))
++    ;;nbp[ii]=(LONG(STRCOMPRESS(resultat,/remove_all)))(0)
++    ;;
++    ;; checking remaining missing bad endline
++    commande=["tail","-c 1",filename]
++    SPAWN, commande, resultat, /NOSHELL
++    nbp[ii] += resultat NE ''
++    ;;
++    if KEYWORD_SET(verbose) then print, filename, '  :  ', nbp[ii]
++endfor
++;
++if KEYWORD_SET(test) then STOP
++;
++if N_ELEMENTS(filenames) EQ 1 then return, nbp[0] else return, nbp
+ ;
+ end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/findex.pro gdl/src/pro/findex.pro
 --- gdl-0.9.2/src/pro/findex.pro	2011-08-15 03:05:16.000000000 -0600
-+++ gdl/src/pro/findex.pro	2012-05-10 15:10:05.937450769 -0600
++++ gdl/src/pro/findex.pro	2012-02-27 18:08:50.000000000 -0700
 @@ -1,97 +1,101 @@
 - ;+
 -   ; ROUTINE:  findex
@@ -43121,13 +46375,208 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/get_login_info.pro gdl/src/pro/get_log
 +;
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/hist_equal.pro gdl/src/pro/hist_equal.pro
 --- gdl-0.9.2/src/pro/hist_equal.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/src/pro/hist_equal.pro	2012-05-14 06:38:52.000000000 -0600
-@@ -0,0 +1,2 @@
-+AC 14 May 2012
-+will arrived soon
++++ gdl/src/pro/hist_equal.pro	2012-05-25 04:47:16.000000000 -0600
+@@ -0,0 +1,197 @@
++;+
++;
++; NAME:
++;     HIST_EQUAL
++;
++; PURPOSE:
++;       Scales an input image by equalising its histogram. By setting
++;       a percent it can an also scale an image via a linear contrast.
++;
++; CATEGORY: Image processing.
++;
++; CALLING SEQUENCE: 
++;        Result = HIST_EQUAL(image, BinSIZE=value,
++;          Fcn=column_vector, Histogram_Only=value, Maxv=value,
++;          Minv=value, Omax=variable, Omin=variable, Percent=value,
++;          Top=value)
++;
++; KEYWORD PARAMETERS:
++;
++;       BINSIZE: The SIZE of the bin in which to construct the
++;        histogram. Defaulted to 1 for an image of type BYTE. The
++;        default for other data types is (maxv-minv)/5000double.
++;
++;       FCN: The cumulative probability distribution function. (Not
++;         currently implemented).
++;
++;       HISTOGRAM_ONLY: Returns the cumulative histogram of type Long.
++;
++;       MAXV: The maximum value of the original image to
++;        consider. Defaulted to 255 if image is of type BYTE,
++;        otherwise the image is searched for the maximum value.
++;
++;       MINV: The minimum value of the original image to
++;        consider. Default is 0 if image is of type BYTE, otherwise
++;        the image is searched for the minimum value.
++;
++;       PERCENT: If set to a value between 0 and 100, the histogram of
++;        the image will be linearly stretched between the upper and
++;        lower values found by the specified percent of the cumulative
++;        histogram.
++;
++;       TOP: The maximum value of the scaled result. Defaulted to 255.
++;
++; OUTPUTS: An image that is has been modified by its histogram. If the
++;       Histogram_Only keyword has been set, then the cumulative
++;       histogram (of type Long) will be output.
++;
++;
++; OPTIONAL OUTPUTS:
++;
++;   OMAX: Will contain the maximum value used for constructing the histogram.
++;   OMIN: Will contain the minimum value used for constructing the histogram.
++;
++; COMMON BLOCKS:
++;
++; SIDE EFFECTS:
++;
++; RESTRICTIONS:
++;
++;     The FCN keyword is currently not implemented.
++;
++; PROCEDURE:
++;     Sources:
++;     http://www.cacs.louisiana.edu/~cice/cacs508/fa11/lecture%2005%200908.pdf
++;     http://www.cis.rit.edu/class/simg782/lectures/lecture_05/lec782_05_05.pdf
++;
++; EXAMPLE:
++;       http://idlastro.gsfc.nasa.gov/idl_html_help/HIST_EQUAL.html
++;       image = dist(100)
++;       tv, image
++;       scl_img = hist_equal(image, minv=10, maxv=200, top=220)
++;       tv, scl_img
++;  
++;       window, 1, xSIZE=900, ySIZE=550
++;       !p.multi=[0,2,1]
++;       plot, histogram(image), title='Histogram'
++;       oplot, histogram(scl_img), color=255
++;       plot, total(histogram(image), /cumulative), title='Cumulative Histogram'
++;       oplot, total(histogram(scl_img), /cumulative), color=255
++;       xyouts, 0.2324805, 0.0200364, 'White = Original', /normal, charSIZE=2
++;       xyouts, 0.5795328, 0.0200364, 'Red = Equalised', /normal, charSIZE=2
++;
++; MODIFICATION HISTORY:
++;   01-May-2012 Written by:     Josh Sixsmith
++;   07-May-2012 Fixed percent keyword argument
++;   22-May-2012 Alain Coulais: Details (/help,/test), initial import in GDL
++;   25-May-2012 Alain: typo in LINEAR_PERCENT :( , formatting
++;
++;-
++; LICENCE:
++; Copyright (C) 2010, Josh Sixsmith
++; This program is free software; you can redistribute it and/or modify  
++; it under the terms of the GNU General Public License as published by  
++; the Free Software Foundation; either version 3 of the License, or     
++; (at your option) any later version.                                   
++;
++;-
++;
++pro LINEAR_PERCENT, cumuhist, percent, min, binSIZE, maxDN, minDN
++;
++n = cumuhist[N_ELEMENTS(cumuhist)-1]
++low = (percent/100.) 
++high = (1 - (percent/100.)) 
++;
++x1 = VALUE_LOCATE(cumuhist, n * low)
++if x1 eq -1 then x1 = 0
++while cumuhist[x1] eq cumuhist[x1 + 1] do begin
++    x1 = x1 + 1
++endwhile
++;
++close1 = abs(low - cumuhist[x1]/n)
++close2 = abs(low - cumuhist[x1 + 1]/n)
++x1 = (close1 le close2) ? x1 : x1 + 1
++minDN = x1 * binSIZE + min
++;
++x2 = VALUE_LOCATE(cumuhist, n * high)
++while cumuhist[x2] eq cumuhist[x2 - 1] do begin
++    x2 = x2 - 1
++endwhile
++;
++close1 = ABS(high - cumuhist[x2]/n)
++close2 = ABS(high - cumuhist[x2 + 1]/n)
++x2 = (close1 le close2) ? x2 : x2 + 1
++maxDN = x2 * binSIZE + min
++;
++end
++;
++; ------------------------------------
++;
++function HIST_EQUAL, img, binSIZE=bs, fcn=fcn, Histogram_Only=ho, $
++                     maxv=maxv, minv=minv, omax=omax_, omin=omin_, $
++                     percent=percent, Top=top_, $
++                     help=help, test=test
++;
++ON_ERROR, 2
++;
++if KEYWORD_SET(help) then begin
++    print, 'function HIST_EQUAL, img, binSIZE=bs, fcn=fcn, Histogram_Only=ho, $'
++    print, '                     maxv=maxv, minv=minv, omax=omax_, omin=omin_, $'
++    print, '                     percent=percent, Top=top_, $'
++    print, '                     help=help, test=test'
++    return, -1
++endif
++;
++txt='Cumulative Probability Distribution Function not currently supported'
++if KEYWORD_SET(fcn) then MESSAGE, txt
++;
++;    if (percent le 0) or (percent ge 100) then MESSAGE, 'Percent must be between 0 and 100'
++;
++if N_ELEMENTS(maxv) eq 0 then maxv = max(img, min=min_)
++if N_ELEMENTS(minv) eq 0 then minv = min_
++;
++if N_ELEMENTS(top_) eq 1 then top = top_[0] else top = 255
++;
++type = SIZE(img, /type)
++;
++if N_ELEMENTS(bs) eq 0 then begin
++    if type eq 1 then begin
++        bs = 1
++    endif else begin
++        ;; Calculate as double. Precision needed for very small values. 
++        bs = (maxv - minv)/5000d 
++    endelse
++endif
++;
++hist = HISTOGRAM(img, binSIZE=bs, omax=omax_, omin=omin_, max=maxv, min=minv)
++;; Zeroing the first element of the histogram
++hist[0] = 0
++;
++cumu = TOTAL(hist, /cumulative, /double)
++if KEYWORD_SET(ho) then return, long(cumu)
++;
++if N_ELEMENTS(percent) gt 0 then begin
++    if (percent le 0) or (percent ge 100) then MESSAGE, 'Percent must be between 0 and 100'
++    LINEAR_PERCENT, cumu, percent, minv, bs, maxDN, minDN
++    scl = BYTSCL(img, max=maxDN, min=minDN, top=top)
++    ;;
++    if KEYWORD_SET(test) then STOP
++    return, scl
++endif
++;
++bytsc = BYTSCL(cumu, top=top)
++;
++if SIZE(img, /type) eq 1 then begin
++    ;; Check for minv. Clip to zero if non zero
++    scl = (minv eq 0) ? bytsc[img] : bytsc[(img > minv) - minv]
++endif else begin
++    ;; Scale by the binSIZE to in order to get the bin position
++    ;; Check for minv. Clip to zero if non zero
++    scl = (minv eq 0) ? bytsc[img/bs] : bytsc[((img > minv) - minv)/bs]    
++endelse
++;
++if KEYWORD_SET(test) then STOP
++;
++return, scl
++;
++end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/identity.pro gdl/src/pro/identity.pro
 --- gdl-0.9.2/src/pro/identity.pro	2011-02-27 12:05:38.000000000 -0700
-+++ gdl/src/pro/identity.pro	2012-02-21 09:54:37.241881878 -0700
++++ gdl/src/pro/identity.pro	2011-12-29 19:02:47.000000000 -0700
 @@ -1,24 +1,18 @@
 -;$Id: identity.pro,v 1.2 2011/02/27 19:05:38 slayoo Exp $
 -
@@ -43363,7 +46812,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/image_statistics.pro gdl/src/pro/image
 +end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/interpol.pro gdl/src/pro/interpol.pro
 --- gdl-0.9.2/src/pro/interpol.pro	2011-08-15 03:05:16.000000000 -0600
-+++ gdl/src/pro/interpol.pro	2012-05-10 15:10:06.022447700 -0600
++++ gdl/src/pro/interpol.pro	2012-03-05 07:50:55.000000000 -0700
 @@ -1,55 +1,115 @@
 +;
 +; under GNU GPL v2 or later
@@ -43530,6 +46979,90 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/interpol.pro gdl/src/pro/interpol.pro
 +return, result
 +;
  end
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/kurtosis.pro gdl/src/pro/kurtosis.pro
+--- gdl-0.9.2/src/pro/kurtosis.pro	2005-07-25 01:33:25.000000000 -0600
++++ gdl/src/pro/kurtosis.pro	2012-07-13 16:28:02.000000000 -0600
+@@ -1,27 +1,25 @@
+-;$Id: kurtosis.pro,v 1.2 2005/07/25 07:33:25 m_schellens Exp $
+-function kurtosis, x, double=double, NaN=NaN
+-
+-;+
++;$Id: kurtosis.pro,v 1.3 2012/07/13 22:28:02 alaingdl Exp $
+ ;
++function KURTOSIS, x, double=double, NaN=NaN, dimension=dimension
+ ;
++;+
+ ;
+-; NAME: 
+-;       kurtosis
++; NAME: KURTOSIS
+ ;
+ ; PURPOSE: 
+ ;     Calculates the kurtosis of the input data
+ ;       
+-;
+ ; CATEGORY:
+ ;     Mathematics: Statistics
+ ;
+ ; CALLING SEQUENCE:
+ ;     Result=kurtosis(x)
+ ;
+-;
+ ; KEYWORD PARAMETERS: 
+ ;     DOUBLE : Keyword for double precision calculation
+ ;     NAN    : Flag to treat IEEE Special Floating-Point values as missing data
++;     DIMENSION : if absent or equal to zero, compute the variance over the
++;                 whole data. otherwise, compute along the related dimension.
+ ;
+ ; OUTPUTS:
+ ;    Result is the mean of input data
+@@ -32,32 +30,35 @@
+ ;    struct, ptr, object)
+ ;
+ ; PROCEDURE:
+-;     kurtosis = 1/N sum((x-mean(x))^4/sqrt(variance(x))) - 3,
++;     kurtosis = 1/N sum((x-MEAN(x))^4/SQRT(VARIANCE(x))) - 3,
+ ;     Uses the MOMENT function
+ ;
+ ; EXAMPLE:
+-;     a=findgen(100)
+-;     result=kurtosis(a)
++;     a=FINDGEN(100)
++;     result=KURTOSIS(a)
+ ;     print, result
+ ;     -1.23606
+ ;
+ ; MODIFICATION HISTORY:
+ ;   20-Mar-2004 : Written by Christopher Lee
+ ;   18-Jul-2005 : PC, moment.pro update
++;   13-Jul-2012 : Alain Coulais : adding DIMENSION keyword, using MOMENT()
+ ;
+ ; LICENCE:
+-; Copyright (C) 2004, Christopher Lee
++; Copyright (C) 2004, Christopher Lee, 2005 P. Chanial, 2012 Alain Coulais
++;
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+ ; (at your option) any later version.                                   
+ ;
+-;
+ ;-
+-
+- on_error, 2
+- 
+- m = moment(x, double=double, NaN=NaN)
+- return, m[3]
+-
++;
++ON_ERROR, 2
++;
++tmp=MOMENT(x, kurtosis=kurtosis, double=double, NaN=NaN, $
++           dimension=dimension, maxmoment=4)
++;
++return, kurtosis
++;
+ end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/la_invert.pro gdl/src/pro/la_invert.pro
 --- gdl-0.9.2/src/pro/la_invert.pro	1969-12-31 17:00:00.000000000 -0700
 +++ gdl/src/pro/la_invert.pro	2012-01-23 17:13:54.000000000 -0700
@@ -43547,7 +47080,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/la_invert.pro gdl/src/pro/la_invert.pr
 +
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/loadct.pro gdl/src/pro/loadct.pro
 --- gdl-0.9.2/src/pro/loadct.pro	2011-03-31 20:21:49.000000000 -0600
-+++ gdl/src/pro/loadct.pro	2012-05-10 15:10:06.037447159 -0600
++++ gdl/src/pro/loadct.pro	2012-03-14 19:07:08.000000000 -0600
 @@ -93,10 +93,18 @@
  TVLCT,r,g,b,/GET
  
@@ -43589,7 +47122,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/ludc.pro gdl/src/pro/ludc.pro
 -end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.am gdl/src/pro/Makefile.am
 --- gdl-0.9.2/src/pro/Makefile.am	2011-08-09 08:07:01.000000000 -0600
-+++ gdl/src/pro/Makefile.am	2012-05-15 12:11:38.725550294 -0600
++++ gdl/src/pro/Makefile.am	2012-05-14 06:37:08.000000000 -0600
 @@ -3,9 +3,12 @@
  prolib_DATA = \
    appleman.pro \
@@ -43659,8 +47192,16 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.am gdl/src/pro/Makefile.am
    write_png.pro \
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.in gdl/src/pro/Makefile.in
 --- gdl-0.9.2/src/pro/Makefile.in	2011-11-01 17:46:37.000000000 -0600
-+++ gdl/src/pro/Makefile.in	2012-05-15 12:11:38.741549700 -0600
-@@ -266,9 +266,12 @@
++++ gdl/src/pro/Makefile.in	2012-06-28 03:54:55.000000000 -0600
+@@ -158,6 +158,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+@@ -266,9 +267,12 @@
  prolib_DATA = \
    appleman.pro \
    array_indices.pro \
@@ -43673,7 +47214,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.in gdl/src/pro/Makefile.in
    dialog_message.pro \
    dialog_pickfile.pro \
    dist.pro \
-@@ -284,20 +287,23 @@
+@@ -284,20 +288,23 @@
    filepath.pro \
    findex.pro \
    findfile.pro \
@@ -43698,7 +47239,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.in gdl/src/pro/Makefile.in
    map_clip_set.pro \
    matrix_multiply.pro \
    mean.pro \
-@@ -327,6 +333,8 @@
+@@ -327,6 +334,8 @@
    read_binary.pro \
    read_bmp.pro \
    read_dicom.pro \
@@ -43707,7 +47248,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.in gdl/src/pro/Makefile.in
    read_jpeg.pro \
    read_pict.pro \
    read_png.pro \
-@@ -343,8 +351,10 @@
+@@ -343,8 +352,10 @@
    smooth.pro \
    spl_init_old.pro \
    spl_interp_old.pro \
@@ -43718,7 +47259,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.in gdl/src/pro/Makefile.in
    strsplit.pro \
    swap_endian.pro \
    swap_endian_inplace.pro \
-@@ -356,6 +366,8 @@
+@@ -356,6 +367,8 @@
    value_locate.pro \
    variance.pro \
    write_bmp.pro \
@@ -43727,9 +47268,287 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/Makefile.in gdl/src/pro/Makefile.in
    write_jpeg.pro \
    write_pict.pro \
    write_png.pro \
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/mean.pro gdl/src/pro/mean.pro
+--- gdl-0.9.2/src/pro/mean.pro	2005-07-25 01:33:25.000000000 -0600
++++ gdl/src/pro/mean.pro	2012-07-13 16:28:02.000000000 -0600
+@@ -1,32 +1,29 @@
+-;$Id: mean.pro,v 1.2 2005/07/25 07:33:25 m_schellens Exp $
+-function mean, x, double=double, nan=nan
+-
+-;+
++;$Id: mean.pro,v 1.3 2012/07/13 22:28:02 alaingdl Exp $
+ ;
++function MEAN, x, double=double, NaN=NaN, dimension=dimension
+ ;
++;+
+ ;
+-; NAME: 
+-;       mean
++; NAME: MEAN
+ ;
+ ; PURPOSE: 
+ ;     Calculates the mean of the input data
+ ;       
+-;
+ ; CATEGORY:
+ ;     Mathematics: Statistics
+ ;
+ ; CALLING SEQUENCE:
+ ;     Result=mean(x)
+ ;
+-;
+ ; KEYWORD PARAMETERS: 
+ ;     DOUBLE : Keyword for double precision calculation
+ ;     NAN    : Flag to treat IEEE Special Floating-Point values as missing data
++;     DIMENSION : if absent or equal to zero, compute the variance over the
++;                 whole data. otherwise, compute along the related dimension.
+ ;
+ ; OUTPUTS:
+ ;    Result is the mean of input data
+ ;
+-;
+ ; RESTRICTIONS:
+ ;    The input x needs to be an array of numbers (i.e not strings,
+ ;    struct, ptr, object)
+@@ -35,36 +32,42 @@
+ ;     mean = 1/N sum(x)
+ ;
+ ; EXAMPLE:
+-;     a=findgen(100)
+-;     result=mean(a)
++;     a=FINDGEN(100)
++;     result=MEAN(a)
+ ;     print, result
+ ;     49.5000
+ ;
+ ; MODIFICATION HISTORY:
+ ;   20-Mar-2004 : Written by Christopher Lee
+ ;   18-Jul-2005 : Rewritten by Pierre Chanial
++;   13-Jul-2012 : Alain Coulais : adding DIMENSION keyword, using MOMENT()
+ ;
+ ; LICENCE:
+-; Copyright (C) 2004, Christopher Lee
+-;               2005, Pierre Chanial
++; Copyright (C) 2004, Christopher Lee, 2005 P. Chanial, 2012 Alain Coulais
++;
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+ ; (at your option) any later version.                                   
+ ;
+-;
+ ;-
+-
+- on_error, 2
+- 
+- ; we don't call moment.pro, since it requires 2 or more elements
+- if keyword_set(NaN) then begin
+-    n = total(finite(x), double=double)
+- endif else begin
+-    n = n_elements(x)
+- endelse
+- 
+- mean = total(x, double=double, NaN=NaN)/n
+- return, mean
+-
++;
++ON_ERROR, 2
++;
++; old version by PC, without Dimension
++; ; we don't call moment.pro, since it requires 2 or more elements
++; if keyword_set(NaN) then begin
++;    n = total(finite(x), double=double)
++; endif else begin
++;    n = n_elements(x)
++; endelse
++; 
++; mean = total(x, double=double, NaN=NaN)/n
++; return, mean
++;
++tmp=MOMENT(x, mean=mean, double=double, NaN=NaN, $
++           dimension=dimension, maxmoment=2)
++;
++return, mean
++;
+ end
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/moment.pro gdl/src/pro/moment.pro
+--- gdl-0.9.2/src/pro/moment.pro	2010-10-13 16:55:48.000000000 -0600
++++ gdl/src/pro/moment.pro	2012-07-14 12:53:49.000000000 -0600
+@@ -1,24 +1,20 @@
+ function MOMENT, x, mdev=mdev, sdev=sdev, $
+                  double=double, NaN=NaN, $
+-                 maxmoment=maxmoment
++                 maxmoment=maxmoment, dimension=dimension, $
++                 kurtosis=kurtosis, mean=mean, $
++                 skewness=skewness, variance=variance
+ ;+
+ ;
+-;
+-;
+-; NAME: 
+-;       MOMENT
++; NAME: MOMENT
+ ;
+ ; PURPOSE: 
+ ;     Calculates the following from the input data; mean, variance,
+ ;     skewness, kurtosis, mean absolute deviation, standard deviation
+ ;       
+-;
+ ; CATEGORY:
+ ;     Mathematics: Statistics
+ ;
+-; CALLING SEQUENCE:
+-;     Result=moment(x)
+-;
++; CALLING SEQUENCE: Result=MOMENT(x)
+ ;
+ ; KEYWORD PARAMETERS: 
+ ;     DOUBLE    : Keyword for double precision calculation
+@@ -28,6 +24,10 @@
+ ;                 2 - calculate mean, variance, mean absolute deviation and standard dev.
+ ;                 3 - calculate all but kurtosis
+ ;                 4 or 0 (keyword not present) - calculate all moments
++;     DIMENSION : if absent or equal to zero, compute the values
++;                 (moment, stddev, variance, skewness and kurtosis)
++;                 over the whole data. otherwise, compute along the related
++;                 dimension.
+ ;
+ ; OUTPUTS:
+ ;    Result is a 4 element array, with
+@@ -36,7 +36,7 @@
+ ; OPTIONAL OUTPUTS:
+ ;     MDEV   : Named variable which will contain the mean absolute deviation
+ ;     SDEV   : Named variable which will contain the standard deviation
+-;
++;     KURTOSIS, MEAN, SKEWNESS, VARIANCE: as named !
+ ;
+ ; RESTRICTIONS:
+ ;    The input x needs to be an array of numbers (i.e not strings,
+@@ -58,8 +58,8 @@
+ ;     standard deviation = sqrt(variance)
+ ;
+ ; EXAMPLE:
+-;     a=findgen(100)
+-;     result=moment(a)
++;     a=FINDGEN(100)
++;     result=MOMENT(a)
+ ;     print, result
+ ;     49.5000    841.667     0.0000   1.73395
+ ;
+@@ -71,57 +71,88 @@
+ ;   18-Jul-2005 : Rewritten by Pierre Chanial
+ ;   10-Aug-2009 : MAXMOMENT keyword added by Sylwester Arabas
+ ;   14-Oct-2010 : Correcting Bug in Kurtosis (by Alain C.)
+-;
++;   16-Jun-2012 : Dimension Keyword (by Mathieu Pinter)
++;   14-Jul-2012 : check ASAP whether Dimension value is OK ... (by Alain C.)
+ ;
+ ; LICENCE:
+ ; Copyright (C) 2004, Christopher Lee
+ ;               2005, Pierre Chanial
+ ;               2009, Sylwester Arabas
+ ;               2010, Alain Coulais
++;               2012, Mathieu Pinter and Alain Coulais
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+ ; (at your option) any later version.                                   
+ ;
+-;
+ ;-
+-
+-on_error, 2
++ON_ERROR, 2
+ ;
+ if (N_ELEMENTS(x) LE 1) then begin
+    MESSAGE, 'Input Array must contain 2 OR more elements.'
+ endif
+ ;
+ ; we don't reuse code in mean.pro, because we need variable n.
+-if KEYWORD_SET(NaN) then begin
+-   n = TOTAL(FINITE(x), double=double)
++;
++if KEYWORD_SET(dimension) then begin
++   ;; we check asap whether "dimension" in the good range
++   if ((dimension GT SIZE(x, /N_DIMENSION)) || (dimension LT 0)) then begin
++      MESSAGE, "Illegal keyword value for DIMENSION."
++   endif
++   dim = SIZE(x, /DIMENSION)
++   if KEYWORD_SET(NaN) then begin 
++      n = TOTAL(FINITE(x), dimension)
++   endif else begin
++      n = dim(dimension-1)
++   endelse
+ endif else begin
+-   n = N_ELEMENTS(x)
++   dimension = 0
++   if KEYWORD_SET(NaN) THEN BEGIN
++      n = TOTAL(FINITE(x), DOUBLE=double)
++   endif ELSE BEGIN
++      n = N_ELEMENTS(x)
++   endelse
+ endelse
+ ;
+ ; if input is : print, MOMENT([1,!values.f_nan],/na)
+ ;
+-if (n LE 1) then begin
++if (TOTAL(n) LE 1) THEN BEGIN
+    MESSAGE, 'Input Array must contain 2 OR more elements.'
+ endif
+ ; 
+-; get the mean value in the required type (FLOAT or DOUBLE)
+-; subsequent operations will rely on GDL automatic type conversion
++if ~KEYWORD_SET(maxmoment) THEN maxmoment = 4
+ ;
+-mean = TOTAL(x, double=double, NaN=NaN)/n
+-x0   = x-mean
+-;
+-if ~KEYWORD_SET(maxmoment) then maxmoment = 4
++if dimension EQ 0 THEN BEGIN
++   ;;
++   ;; get the mean value in the required type (FLOAT or DOUBLE)
++   ;; subsequent operations will rely on GDL automatic type conversion
++   mean = TOTAL(x, DOUBLE=double, NaN=NaN)/n
++   x0   = x-mean
++   ;;
++   variance = maxmoment GE 2 ? TOTAL(x0^2, NaN=NaN)/(n-1)        : !VALUES.F_NAN
++   sdev     = maxmoment GE 2 ? SQRT(variance)                    : !VALUES.F_NAN 
++   skewness = maxmoment GE 3 ? TOTAL(x0^3, NaN=NaN)/sdev^3/n     : !VALUES.F_NAN
++   kurtosis = maxmoment GE 4 ? (TOTAL(x0^4, NaN=NaN)/sdev^4)/n-3 : !VALUES.F_NAN
++   result = [mean, variance, skewness, kurtosis]
++endif ELSE BEGIN
++   mean = TOTAL(x, dimension, DOUBLE=double, NaN=NaN)/n
++   dim2 = dim
++   dim2(dimension-1) = 1
++   if KEYWORD_SET(double) then nan1 = DBLARR(SIZE(mean, /DIMENSION)) 
++   if ~KEYWORD_SET(double) then nan1= FLTARR(SIZE(mean, /DIMENSION))
++   nan1(*) = !VALUES.F_NAN
++   x0 = (x-REBIN(REFORM(mean, dim2), dim))
++   variance = maxmoment GE 2 ? TOTAL((x0)^2, dimension, NaN=NaN)/(n-1)        : nan1
++   sdev     = maxmoment GE 2 ? SQRT(variance)                                 : nan1
++   skewness = maxmoment GE 3 ? TOTAL((x0)^3, dimension, NaN=NaN)/(n*sdev^3)   : nan1
++   kurtosis = maxmoment GE 4 ? TOTAL((x0)^4, dimension, NaN=NaN)/(n*sdev^4)-3 : nan1
++   result = [[[mean]], [[variance]], [[skewness]], [[kurtosis]]]
++endelse
+ ;
+-variance = maxmoment ge 2 ? TOTAL(x0^2, NaN=NaN)/(n-1)        : !VALUES.F_NAN
+-sdev     = maxmoment ge 2 ? SQRT(variance)                    : !VALUES.F_NAN 
+-skewness = maxmoment ge 3 ? TOTAL(x0^3, NaN=NaN)/sdev^3/n     : !VALUES.F_NAN
+-kurtosis = maxmoment ge 4 ? (TOTAL(x0^4, NaN=NaN)/sdev^4)/n-3 : !VALUES.F_NAN
+-
+-if ARG_PRESENT(mdev) then begin
+-   mdev = maxmoment ge 2 ? TOTAL(abs(x0), NaN=NaN)/n          : !VALUES.F_NAN
++if ARG_PRESENT(mdev) THEN BEGIN
++   mdev = maxmoment GE 2 ? TOTAL(ABS(x0), dimension, NaN=NaN)/n : !VALUES.F_NAN
+ endif
+ ;
+-return, [mean, variance, skewness, kurtosis]
++return, result
+ ; 
+ end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_ascii.pro gdl/src/pro/read_ascii.pro
 --- gdl-0.9.2/src/pro/read_ascii.pro	2009-10-18 16:03:55.000000000 -0600
-+++ gdl/src/pro/read_ascii.pro	2012-02-21 09:54:37.341878249 -0700
++++ gdl/src/pro/read_ascii.pro	2011-11-15 17:51:17.000000000 -0700
 @@ -1,5 +1,4 @@
  ;+
 -;
@@ -44619,7 +48438,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_image.pro gdl/src/pro/read_image.
 +end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_jpeg.pro gdl/src/pro/read_jpeg.pro
 --- gdl-0.9.2/src/pro/read_jpeg.pro	2011-08-18 11:39:08.000000000 -0600
-+++ gdl/src/pro/read_jpeg.pro	2012-02-21 09:54:37.392876397 -0700
++++ gdl/src/pro/read_jpeg.pro	2012-02-07 16:23:25.000000000 -0700
 @@ -1,9 +1,9 @@
 -;$Id: read_jpeg.pro,v 1.6 2011/08/18 17:39:08 alaingdl Exp $
 +;$Id: read_jpeg.pro,v 1.13 2012/02/07 23:23:25 alaingdl Exp $
@@ -44767,22 +48586,62 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_jpeg.pro gdl/src/pro/read_jpeg.pr
  ;endelse
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_png.pro gdl/src/pro/read_png.pro
 --- gdl-0.9.2/src/pro/read_png.pro	2011-08-18 11:26:43.000000000 -0600
-+++ gdl/src/pro/read_png.pro	2012-02-21 09:54:37.416875527 -0700
-@@ -1,9 +1,11 @@
++++ gdl/src/pro/read_png.pro	2012-05-25 15:27:39.000000000 -0600
+@@ -1,34 +1,15 @@
 -;$Id: read_png.pro,v 1.3 2011/08/18 17:26:43 alaingdl Exp $
-+;$Id: read_png.pro,v 1.8 2012/02/15 15:09:52 alaingdl Exp $
+-;
+-pro READ_PNG, filename, image, red, green, blue, $
+-              order=order, verbose=verbose, transparent=transparent, $
+-              help=help, test=test
+-;
+-image=READ_PNG(filename, red, green, blue, $
+-              order=order, verbose=verbose, transparent=transparent, $
+-              help=help, test=test)
+-;
+-end
+-;
+-; ---------------------------------
+-;
+-function READ_PNG, filename, red, green, blue, $
+-                   order=order, verbose=verbose, transparent=transparent, $
+-                   help=help, test=test
+-;
+-ON_ERROR, 2
+ ;+
  ;
- pro READ_PNG, filename, image, red, green, blue, $
-               order=order, verbose=verbose, transparent=transparent, $
-               help=help, test=test
+ ; NAME: READ_PNG
  ;
-+ON_ERROR, 2
-+;
- image=READ_PNG(filename, red, green, blue, $
-               order=order, verbose=verbose, transparent=transparent, $
-               help=help, test=test)
-@@ -56,19 +58,28 @@
+-;
+-; PURPOSE: Reads a PNG file into memory
++; PURPOSE: Reads a PNG file into memory (Function OR Procedure)
+ ;
+ ; CATEGORY: Images (IO)
+ ;
++; CALLING SEQUENCE: 2 ways: Pro or Func
+ ;
+-; CALLING SEQUENCE: image=READ_PNG(filename,r,g,b)
+-;
++;   Function:  image=READ_PNG(filename,r,g,b)
++;   Procedure: READ_PNG, filename, image, r,g,b
+ ;
+ ; KEYWORD PARAMETERS: 
+ ;        ORDER: flip the image in the vertical 
+@@ -38,8 +19,6 @@
+ ; OUTPUTS: For true color images, data is a three dimensional array
+ ; with interleaving set by TRUE keyword
  ;
+-;
+-;
+ ; OPTIONAL OUTPUTS: For pseudocolor only
+ ;        red  : the Red colormap vector (for PseudoColor images)
+ ;        green: the Green colormap vector (for PseudoColor images)
+@@ -52,32 +31,40 @@
+ ;         Use ImageMagick to read the data as requested
+ ;
+ ; EXAMPLE:
+-;         
+-;
++;         See "test_read_standard_images.pro" in testsuite/
  ;
  ; MODIFICATION HISTORY:
 -; 	Written by: Christopher Lee 2004-05-23
@@ -44801,6 +48660,9 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_png.pro gdl/src/pro/read_png.pro
 +;  2012-Feb-07, Alain Coulais : new test cases in testsuite:
 +;   test_read_standard_images.pro : 2 JPEG and 4 PNG (2 with transparency)
 +;   The transpose for 2D image is no more need.
++;
++;  2012-May-25, Alain Coulais : fake INTERNAL_READ_PNG to have both
++;   pro/func working transparently without pre-compilation
  ;
  ;-
  ; LICENCE:
@@ -44814,8 +48676,21 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_png.pro gdl/src/pro/read_png.pro
 -;
  ;-
  ;
- if KEYWORD_SET(help) then begin
-@@ -86,9 +97,23 @@
+-if KEYWORD_SET(help) then begin
+-    print, 'function READ_PNG, filename, red, green, blue, $'
+-    print, '                   order=order, verbose=verbose, transparent=transparent, $'
+-    print, '                   help=help, test=test'
+-    return, -1
+-endif
+-;
++function INTERNAL_READ_PNG, filename, red, green, blue, $
++                            order=order, transparent=transparent, $
++                            test=test, verbose=verbose
++
+ ; Do we have access to ImageMagick functionnalities ??
+ ;
+ if (MAGICK_EXISTS() EQ 0) then begin
+@@ -86,9 +73,23 @@
  endif
  ;
  if (N_PARAMS() EQ 0) then MESSAGE, "Incorrect number of arguments."
@@ -44839,7 +48714,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_png.pro gdl/src/pro/read_png.pro
  ;
  mid=MAGICK_OPEN(filename)
  ;
-@@ -101,7 +126,9 @@
+@@ -101,7 +102,9 @@
      MAGICK_READCOLORMAPRGB, mid, red, green, blue
      colortable=[[red],[green],[blue]]
  endif else begin
@@ -44850,9 +48725,58 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_png.pro gdl/src/pro/read_png.pro
  endelse
  ;
  MAGICK_CLOSE, mid
+@@ -111,4 +114,47 @@
+ return, image
+ ;
+ end
+-
++;
++; ----------------------------- Procedure ------------------------
++;
++pro READ_PNG, filename, image, red, green, blue, $
++              order=order, transparent=transparent, $
++              help=help, test=test, verbose=verbose
++;
++ON_ERROR, 2
++;
++if KEYWORD_SET(help) then begin
++   print, 'pro READ_PNG, filename, red, green, blue, $'
++   print, '              order=order, transparent=transparent, $'
++   print, '              help=help, test=test, verbose=verbose'
++   return
++endif
++;
++image=INTERNAL_READ_PNG(filename, red, green, blue, $
++                        order=order, transparent=transparent, $
++                        test=test, verbose=verbose)
++;
++end
++;
++; ----------------------------- Function ------------------------
++;
++function READ_PNG, filename, red, green, blue, $
++                   order=order, transparent=transparent, $
++                   help=help, test=test, verbose=verbose
++;
++ON_ERROR, 2
++;
++if KEYWORD_SET(help) then begin
++   print, 'function READ_PNG, filename, red, green, blue, $'
++   print, '                   order=order, transparent=transparent, $'
++   print, '                   help=help, test=test, verbose=verbose'
++   return, -1
++endif
++;
++image=INTERNAL_READ_PNG(filename, red, green, blue, $
++                        order=order, transparent=transparent, $
++                        test=test, verbose=verbose)
++;
++return, image
++;
++end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_xwd.pro gdl/src/pro/read_xwd.pro
 --- gdl-0.9.2/src/pro/read_xwd.pro	2010-01-20 04:41:59.000000000 -0700
-+++ gdl/src/pro/read_xwd.pro	2012-02-21 09:54:37.464873785 -0700
++++ gdl/src/pro/read_xwd.pro	2011-11-15 17:51:17.000000000 -0700
 @@ -1,77 +1,82 @@
 -;$Id: read_xwd.pro,v 1.3 2010/01/20 11:41:59 slayoo Exp $
 -
@@ -44967,9 +48891,89 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/read_xwd.pro gdl/src/pro/read_xwd.pro
  end
  
  
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/skewness.pro gdl/src/pro/skewness.pro
+--- gdl-0.9.2/src/pro/skewness.pro	2005-07-25 01:33:25.000000000 -0600
++++ gdl/src/pro/skewness.pro	2012-07-13 16:28:02.000000000 -0600
+@@ -1,27 +1,24 @@
+-;$Id: skewness.pro,v 1.2 2005/07/25 07:33:25 m_schellens Exp $
+-function skewness, x, double=double, NaN=NaN
+-
+-;+
++;$Id: skewness.pro,v 1.3 2012/07/13 22:28:02 alaingdl Exp $
+ ;
++function skewness, x, double=double, NaN=NaN, dimension=dimension
+ ;
++;+
+ ;
+-; NAME: 
+-;       skewness
++; NAME: SKEWNESS
+ ;
+ ; PURPOSE: 
+ ;     Calculates the skewness of the input data
+ ;       
+-;
+ ; CATEGORY:
+ ;     Mathematics: Statistics
+ ;
+-; CALLING SEQUENCE:
+-;     Result=skewness(x)
+-;
++; CALLING SEQUENCE:  Result=SKEWNESS(x [, /nan][,/double][, dim=])
+ ;
+ ; KEYWORD PARAMETERS: 
+ ;     DOUBLE : Keyword for double precision calculation
+ ;     NAN    : Flag to treat IEEE Special Floating-Point values as missing data
++;     DIMENSION : if absent or equal to zero, compute the variance over the
++;                 whole data. otherwise, compute along the related dimension.
+ ;
+ ; OUTPUTS:
+ ;    Result is the mean of input data
+@@ -36,17 +33,19 @@
+ ;     Uses the MOMENT function
+ ;
+ ; EXAMPLE:
+-;     a=findgen(100)
+-;     result=mean(a)
++;     a=FINDGEN(100)
++;     result=SKEWNESS(a)
+ ;     print, result
+ ;     0.0000
+ ;
+ ; MODIFICATION HISTORY:
+ ;   20-Mar-2004 : Written by Christopher Lee
+ ;   18-Jul-2005 : PC, moment.pro update
++;   13-Jul-2012 : Alain Coulais : adding DIMENSION keyword, using MOMENT()
+ ;
+ ; LICENCE:
+-; Copyright (C) 2004,
++; Copyright (C) 2004, Christopher Lee, 2005 P. Chanial, 2012 Alain Coulais
++;
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+@@ -54,10 +53,12 @@
+ ;
+ ;
+ ;-
+-
+- on_error, 2
+- 
+- m = moment(x, double=double, NaN=NaN)
+- return, m[2]
+-
++;
++ON_ERROR, 2
++;
++tmp = MOMENT(x, skewness=skewness, double=double, NaN=NaN, $
++             dimension=dimension, maxmoment=3)
++;
++return, skewness
++;
+ end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/smooth.pro gdl/src/pro/smooth.pro
 --- gdl-0.9.2/src/pro/smooth.pro	2008-03-28 04:25:23.000000000 -0600
-+++ gdl/src/pro/smooth.pro	2012-05-10 15:10:06.208440987 -0600
++++ gdl/src/pro/smooth.pro	2012-05-08 03:48:44.000000000 -0600
 @@ -3,9 +3,19 @@
  ;
  ; PURPOSE:  The SMOOTH function returns a smoothed array of the input array.
@@ -45310,8 +49314,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/smooth.pro gdl/src/pro/smooth.pro
  if KEYWORD_SET(test) then STOP
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/standardize.pro gdl/src/pro/standardize.pro
 --- gdl-0.9.2/src/pro/standardize.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/src/pro/standardize.pro	2012-05-12 17:21:14.000000000 -0600
-@@ -0,0 +1,80 @@
++++ gdl/src/pro/standardize.pro	2012-05-16 08:38:39.000000000 -0600
+@@ -0,0 +1,82 @@
 +;+
 +;
 +; NAME: 
@@ -45351,6 +49355,8 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/standardize.pro gdl/src/pro/standardiz
 +; MODIFICATION HISTORY:
 +; 15-Apr-2012: Written by Josh Sixsmith
 +; 13-May-2012: Alain: Correcting a sigm pb; Preparing for putting in GDL CVS ...
++; 15-May-2012: Josh: Form now properly reflects (x - mu)/sigma. 
++;                    Corrects the sign error as noted by Alain.
 +;
 +; LICENCE:
 +; Copyright (C) 2012, Josh Sixsmith
@@ -45380,11 +49386,11 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/standardize.pro gdl/src/pro/standardiz
 +;                             
 +; Uses the form for population (x - mu)/sigma
 +; Unsure whether the form should be for a sample:
-+; (xbar - mu)/(sigma/sqrt(n))
++; (x - xbar)/(sigma/sqrt(n))
 +;
 +for i=0, dims[0]-1 do begin
 +   mom = MOMENT(array[i,*], sdev=stdv, Double = dbl)
-+   result[i,*] = -(mom[0] - array[i,*])/stdv
++   result[i,*] = (array[i,*] - mom[0])/stdv
 +endfor
 +;
 +if KEYWORD_SET(test) then STOP
@@ -45394,7 +49400,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/standardize.pro gdl/src/pro/standardiz
 +end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/STATUS gdl/src/pro/STATUS
 --- gdl-0.9.2/src/pro/STATUS	2010-02-20 13:46:27.000000000 -0700
-+++ gdl/src/pro/STATUS	2012-05-15 12:11:38.747549479 -0600
++++ gdl/src/pro/STATUS	2012-05-14 06:37:08.000000000 -0600
 @@ -124,7 +124,7 @@
  !h_eq_int.pro
  !hilbert.pro
@@ -45435,6 +49441,92 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/STATUS gdl/src/pro/STATUS
   write_nrif.pro
  =write_pict.pro
   write_ppm.pro
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/stddev.pro gdl/src/pro/stddev.pro
+--- gdl-0.9.2/src/pro/stddev.pro	2005-07-25 01:33:25.000000000 -0600
++++ gdl/src/pro/stddev.pro	2012-07-13 16:28:02.000000000 -0600
+@@ -1,33 +1,29 @@
+-;$Id: stddev.pro,v 1.2 2005/07/25 07:33:25 m_schellens Exp $
+-
+-function stddev, x, double=double, NaN=NaN
+-
+-;+
++;$Id: stddev.pro,v 1.3 2012/07/13 22:28:02 alaingdl Exp $
+ ;
++function STDDEV, x, double=double, NaN=NaN, dimension=dimension
+ ;
++;+
+ ;
+-; NAME: 
+-;       stddev
++; NAME: STDDEV
+ ;
+ ; PURPOSE: 
+ ;     Calculates the standard deviation of the input data
+ ;       
+-;
+ ; CATEGORY:
+ ;     Mathematics: Statistics
+ ;
+ ; CALLING SEQUENCE:
+-;     Result=stddev(x)
+-;
++;     Result=STDDEV(x)
+ ;
+ ; KEYWORD PARAMETERS: 
+ ;     DOUBLE : Keyword for double precision calculation
+ ;     NAN    : Flag to treat IEEE Special Floating-Point values as missing data
++;     DIMENSION : if absent or equal to zero, compute the variance over the
++;                 whole data. otherwise, compute along the related dimension.
+ ;
+ ; OUTPUTS:
+ ;    Result is the standard deviation of input data
+ ;
+-;
+ ; RESTRICTIONS:
+ ;    The input x needs to be an array of numbers (i.e not strings,
+ ;    struct, ptr, object)
+@@ -37,28 +33,31 @@
+ ;     Uses the MOMENT function
+ ;
+ ; EXAMPLE:
+-;     a=findgen(100)
+-;     result=stddev(a)
++;     a=FINDGEN(100)
++;     result=STDDEV(a)
+ ;     print, result
+ ;     29.0115
+ ;
+ ; MODIFICATION HISTORY:
+ ;   20-Mar-2004 : Written by Christopher Lee
+ ;   18-Jul-2005 : PC, moment.pro update
++;   13-Jul-2012 : Alain Coulais : adding DIMENSION keyword, using MOMENT()
+ ;
+ ; LICENCE:
+-; Copyright (C) 2004, Christopher Lee
++; Copyright (C) 2004, Christopher Lee, 2005 P. Chanial, 2012 Alain Coulais
++;
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+ ; (at your option) any later version.                                   
+ ;
+-;
+ ;-
+-
+- on_error, 2
+- 
+- junk = moment(x, sdev=sdev, double=double, NaN=NaN)
+- return, sdev
+-
++;
++ON_ERROR, 2
++;
++tmp=MOMENT(x, sdev=sdev, double=double, NaN=NaN, $
++           dimension=dimension, maxmoment=2)
++;
++return, sdev
++;
+ end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/strmatch.pro gdl/src/pro/strmatch.pro
 --- gdl-0.9.2/src/pro/strmatch.pro	1969-12-31 17:00:00.000000000 -0700
 +++ gdl/src/pro/strmatch.pro	2011-11-22 10:54:39.000000000 -0700
@@ -45493,6 +49585,279 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/strmatch.pro gdl/src/pro/strmatch.pro
 +  tmp = '^' + tmp + '$'
 +  return, stregex(mstr, tmp, /boolean, fold_case=fold_case)
 +end
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/strsplit.pro gdl/src/pro/strsplit.pro
+--- gdl-0.9.2/src/pro/strsplit.pro	2011-08-12 09:33:34.000000000 -0600
++++ gdl/src/pro/strsplit.pro	2012-07-11 07:45:51.000000000 -0600
+@@ -19,6 +19,7 @@
+ ;                 better managment of (missing/void) inputs
+ ;   11-Aug-2011 : Alain Coulais : solving conflits due to
+ ;                 /preserve_null and /regex; curing bugs in special cases
++;   11-Jul-2012 : When /extract, we must return STRARR even for 1-element
+ ;
+ ; LICENCE:
+ ; Copyright (C)
+@@ -139,7 +140,9 @@
+       resu=0
+       beg=0
+       ;;
+-      for ii=0, STRLEN(input2)-1 do resu=[resu, STRMULTIPOS(local_input1, STRMID(input2, ii, 1))]
++      for ii=0, STRLEN(input2)-1 do begin
++         resu=[resu, STRMULTIPOS(local_input1, STRMID(input2, ii, 1))]
++      endfor
+       ;;
+       resu=resu[WHERE(resu GE 0)]
+       tst=resu[WHERE(resu EQ 0)]
+@@ -162,13 +165,13 @@
+             endif else begin
+                sresu[0]=STRMID(local_input1, resu[0]+1, resu[1]-resu[0]-1)
+             endelse
+-
++            
+             for ii=1, N_ELEMENTS(resu)-2 do begin
+                ;;print, resu[ii]+1,resu[ii+1]-resu[ii]-1                    
+                sresu[ii]=STRMID(local_input1, resu[ii]+1,resu[ii+1]-resu[ii]-1)
+             endfor
+             sresu[N_ELEMENTS(resu)-1]=STRMID(local_input1, resu[N_ELEMENTS(resu)-1]+1)
+-                                ;stop
++            ;;stop
+             resu=sresu
+          endelse
+          ;;
+@@ -212,7 +215,17 @@
+ ;
+ if KEYWORD_SET(test) then STOP
+ ;
+-if (SIZE(resu,/type) NE 7) then resu=LONG(resu)
++if (SIZE(resu,/type) NE 7) then begin
++   resu=LONG(resu)
++endif else begin
++   ;; when we have a non null (not '') string singleton
++   ;; we must return an array
++   if (SIZE(resu,/n_dim) EQ 0) then begin
++      if (STRLEN(resu) GT 0) then resu=REFORM(resu,1)
++   endif
++endelse
++;
++if KEYWORD_SET(test) then STOP
+ ;
+ return, resu
+ ;
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/tvscl.pro gdl/src/pro/tvscl.pro
+--- gdl-0.9.2/src/pro/tvscl.pro	2010-04-14 09:10:22.000000000 -0600
++++ gdl/src/pro/tvscl.pro	2012-06-12 15:08:23.000000000 -0600
+@@ -2,52 +2,69 @@
+ ; NAME:
+ ;	TVSCL
+ ;
+-;
+ ; PURPOSE:
+ ;	Replicates the built-in TVSCL procedure in IDL for GDL
+ ;
+-;
+ ; CATEGORY:
+ ;	Graphics
+ ;
+-;
+ ; CALLING SEQUENCE:
+ ;	TVSCL, image, x,y
+ ;
+-;
+ ; INPUTS:
+ ;	image	The image to be displayed, may be any numeric type.
+ ;
+-;
+ ; OPTIONAL INPUTS:
+ ;	x, y	The position of the lower-left corner of the image.
+ ;
+-;
+ ; KEYWORD PARAMETERS:
+ ;	/nan	If set, then treat non-numbers (infinity & nan) as
+ ;		missing data.
+ ;
+ ;	Any keyword accepted by TV is also accepted by TVSCL.
+ ;
+-;
+ ; SIDE EFFECTS:
+ ;	An image is displayed on the current graphics device.
+ ;
+-; REESTRICTIONS:
+-;	Has to use a slightly cumbersome procedure as the nan key is
++; REESTRICTIONS: (obsolete mention)
++;       Has to use a slightly cumbersome procedure as the nan key is
+ ;	not yet implemented in MIN, MAX and BYTSCL.
++; REESTRICTIONS: (current version)
++;       When data contains NaN, we have no way to know what will
++;       happen in basic arithmetic ( a > 0 if a contains NaN may
++;       return 0. or NaN ...). Then we decide not to follow the rule
++;       and to manage NaN when /Nan not set ... Result becomes more
++;       predictable ...
+ ;
+ ; MODIFICATION HISTORY:
+ ;     Original: 14/03/2005; SJT
+-;     Modification: 14/04/2010; Alain Coulais: 
++;     Modifications:
++; 2010-04-14: Alain Coulais.
+ ;        -- better managment of inputs
+ ;        -- no use of "locs" if no /NaN !
+-;
++; 2012-06-12: Alain Coulais. When first field in array is NaN,
++; we don't known how the range will be compute --> we decide
++; not to follow this rule ...
++;
++; LICENCE:
++; Copyright (C) 2005, SJT; 2012, A. Coulais
++; This program is free software; you can redistribute it and/or modify  
++; it under the terms of the GNU General Public License as published by  
++; the Free Software Foundation; either version 2 of the License, or     
++; (at your option) any later version.                                   
++; 
+ ;-
+-pro TVSCL, image, x, y, nan = nan, _extra = _extra
++pro TVSCL, image, x, y, NaN=NaN, $
++           help=help, verbose=verbose, test=test, _extra = _extra
+ ;
+ ON_ERROR, 2                     ; Return to caller on error.
+ ;
++if KEYWORD_SET(help) then begin
++   print, 'pro TVSCL, image, x, y, NaN=NaN, $'
++   print, '           help=help, verbose=verbose, test=test, _extra = _extra'
++   return
++endif
++;
+ if N_PARAMS() EQ 0 then begin
+    MESSAGE, 'Incorrect number of arguments.'
+    return
+@@ -58,22 +75,33 @@
+ endif
+ ;
+ if KEYWORD_SET(nan) then begin
+-    locs = WHERE(FINITE(image), nf)
+-    if (nf EQ 0) then MESSAGE, "No finite values found in image"
+-    dmin = MIN(image[locs], max = dmax)
++   locs = WHERE(FINITE(image), nf)
++   if (nf EQ 0) then MESSAGE, "No finite values found in image"
++   dmin = MIN(image[locs], max = dmax)
+ endif else begin
++   ;; unpredictable result if image does contain NaN values (see MIN
++   ;; doc. or Minimum and Maximum Operators in IDL doc.)
++   ;;
++   ;; this case is not well managed in IDL too (no warning)
+    dmin = MIN(image, max = dmax)
++   if ~FINITE(dmin) OR ~FINITE(dmax) then begin
++      MESSAGE, /continue, 'Data range is wrong due to NaN/Inf, we used /NaN'
++      dmin = MIN(image, max = dmax, /nan)
++   endif
+ endelse
+-
+-if !d.table_size eq 0 then imax = !d.n_colors-1 $
+-else imax = !d.table_size-1
+-
++;
++if !d.table_size eq 0 then imax = !d.n_colors-1 else imax = !d.table_size-1
++;
++if KEYWORD_SET(verbose) then print, 'Range, imax :', dmin, dmax, imax
++;
+ img = BYTSCL(image, min = dmin, max = dmax, top = imax)
+ 
+ case N_PARAMS() of
+-    1: TV, img, _extra = _extra
+-    2: TV, img, x, _extra = _extra
+-    3: TV, img, x, y, _extra = _extra
++   1: TV, img, _extra = _extra
++   2: TV, img, x, _extra = _extra
++   3: TV, img, x, y, _extra = _extra
+ endcase
+-
++;
++if KEYWORD_SET(test) then STOP
++;
+ end
+diff -ruN --exclude CVS gdl-0.9.2/src/pro/variance.pro gdl/src/pro/variance.pro
+--- gdl-0.9.2/src/pro/variance.pro	2005-07-25 01:33:25.000000000 -0600
++++ gdl/src/pro/variance.pro	2012-07-13 16:28:02.000000000 -0600
+@@ -1,17 +1,13 @@
+-;$Id: variance.pro,v 1.2 2005/07/25 07:33:25 m_schellens Exp $
+-function variance, x, double=double, NaN=NaN
+-
+-
+-;+
++;$Id: variance.pro,v 1.3 2012/07/13 22:28:02 alaingdl Exp $
+ ;
++function VARIANCE, x, double=double, NaN=NaN, dimension=dimension
+ ;
++;+
+ ;
+-; NAME: 
+-;       variance
++; NAME: VARIANCE
+ ;
+ ; PURPOSE: 
+ ;     Calculates the variance of the input data
+-;       
+ ;
+ ; CATEGORY:
+ ;     Mathematics: Statistics
+@@ -19,15 +15,15 @@
+ ; CALLING SEQUENCE:
+ ;     Result=variance(x)
+ ;
+-;
+ ; KEYWORD PARAMETERS: 
+ ;     DOUBLE : Keyword for double precision calculation
+ ;     NAN    : Flag to treat IEEE Special Floating-Point values as missing data
++;     DIMENSION : if absent or equal to zero, compute the variance over the
++;                 whole data. otherwise, compute along the related dimension.
+ ;
+ ; OUTPUTS:
+ ;    Result is the variance of input data
+ ;
+-;
+ ; RESTRICTIONS:
+ ;    The input x needs to be an array of numbers (i.e not strings,
+ ;    struct, ptr, object)
+@@ -37,28 +33,31 @@
+ ;     Uses the MOMENT function
+ ;
+ ; EXAMPLE:
+-;     a=findgen(100)
+-;     result=variance(a)
++;     a=FINDGEN(100)
++;     result=VARIANCE(a)
+ ;     print, result
+ ;        841.667
+ ;
+ ; MODIFICATION HISTORY:
+ ;   20-Mar-2004 : Written by Christopher Lee
+-;   18-Jul-2005 : PC, moment.pro update 
++;   18-Jul-2005 : PC, moment.pro update
++;   13-Jul-2012 : Alain Coulais : adding DIMENSION keyword, using MOMENT()
+ ;
+ ; LICENCE:
+-; Copyright (C) 2004, Christopher Lee
++; Copyright (C) 2004, Christopher Lee, 2005 P. Chanial, 2012 Alain Coulais
++;
+ ; This program is free software; you can redistribute it and/or modify  
+ ; it under the terms of the GNU General Public License as published by  
+ ; the Free Software Foundation; either version 2 of the License, or     
+ ; (at your option) any later version.                                   
+ ;
+-;
+ ;-
+-
+- on_error, 2
+- 
+- m = moment(x, double=double, NaN=NaN)
+- return, m[1]
+-
++;
++ON_ERROR, 2
++;
++tmp = MOMENT(x, variance=variance, double=double, NaN=NaN, $
++             dimension=dimension, maxmoment=2)
++;
++return, variance
++;
+ end
 diff -ruN --exclude CVS gdl-0.9.2/src/pro/write_gif.pro gdl/src/pro/write_gif.pro
 --- gdl-0.9.2/src/pro/write_gif.pro	1969-12-31 17:00:00.000000000 -0700
 +++ gdl/src/pro/write_gif.pro	2011-11-30 06:33:09.000000000 -0700
@@ -45713,7 +50078,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/pro/write_image.pro gdl/src/pro/write_imag
 +end
 diff -ruN --exclude CVS gdl-0.9.2/src/prognode.cpp gdl/src/prognode.cpp
 --- gdl-0.9.2/src/prognode.cpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/prognode.cpp	2012-02-21 09:54:36.733900310 -0700
++++ gdl/src/prognode.cpp	2011-12-13 00:20:25.000000000 -0700
 @@ -552,7 +552,8 @@
  }
  
@@ -45911,7 +50276,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/prognode.cpp gdl/src/prognode.cpp
  RetCode      LABELNode::Run()
 diff -ruN --exclude CVS gdl-0.9.2/src/prognodeexpr.cpp gdl/src/prognodeexpr.cpp
 --- gdl-0.9.2/src/prognodeexpr.cpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/prognodeexpr.cpp	2012-02-21 09:54:36.794898097 -0700
++++ gdl/src/prognodeexpr.cpp	2011-12-05 03:48:26.000000000 -0700
 @@ -168,9 +168,11 @@
  //       throw GDLException( "Expressions of this type cannot be converted.");
  //     }
@@ -46673,7 +51038,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/prognodeexpr.cpp gdl/src/prognodeexpr.cpp
      // *** MUST always return a defined expression
 diff -ruN --exclude CVS gdl-0.9.2/src/prognodeexpr.hpp gdl/src/prognodeexpr.hpp
 --- gdl-0.9.2/src/prognodeexpr.hpp	2011-11-01 21:47:29.000000000 -0600
-+++ gdl/src/prognodeexpr.hpp	2012-02-21 09:54:36.810897518 -0700
++++ gdl/src/prognodeexpr.hpp	2011-11-15 16:19:00.000000000 -0700
 @@ -103,6 +103,24 @@
    BaseGDL* Eval();
  };
@@ -46747,7 +51112,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/prognodeexpr.hpp gdl/src/prognodeexpr.hpp
    MOD_OPNCNode( const RefDNode& refNode): BinaryExprNC( refNode){}
 diff -ruN --exclude CVS gdl-0.9.2/src/prognode.hpp gdl/src/prognode.hpp
 --- gdl-0.9.2/src/prognode.hpp	2011-11-07 16:38:21.000000000 -0700
-+++ gdl/src/prognode.hpp	2012-02-21 09:54:36.755899513 -0700
++++ gdl/src/prognode.hpp	2011-12-13 00:20:25.000000000 -0700
 @@ -387,13 +387,17 @@
  };
  class BREAKNode: public DefaultNode
@@ -46813,7 +51178,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/prognode.hpp gdl/src/prognode.hpp
  class REFVNNode: public ParameterNode
 diff -ruN --exclude CVS gdl-0.9.2/src/specializations.hpp gdl/src/specializations.hpp
 --- gdl-0.9.2/src/specializations.hpp	2011-10-19 08:45:19.000000000 -0600
-+++ gdl/src/specializations.hpp	2012-02-21 09:54:36.871895303 -0700
++++ gdl/src/specializations.hpp	2011-12-08 00:03:09.000000000 -0700
 @@ -673,6 +673,12 @@
  
  
@@ -46829,7 +51194,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/specializations.hpp gdl/src/specialization
  // topython.cpp
 diff -ruN --exclude CVS gdl-0.9.2/src/str.cpp gdl/src/str.cpp
 --- gdl-0.9.2/src/str.cpp	2011-11-08 15:15:51.000000000 -0700
-+++ gdl/src/str.cpp	2012-02-21 09:54:36.915893707 -0700
++++ gdl/src/str.cpp	2011-11-29 22:43:03.000000000 -0700
 @@ -179,6 +179,17 @@
      r[i]=toupper(sCStr[i]);
    return string(r);
@@ -46905,7 +51270,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/str.cpp gdl/src/str.cpp
       if( p.we_wordc > 0)
 diff -ruN --exclude CVS gdl-0.9.2/src/str.hpp gdl/src/str.hpp
 --- gdl-0.9.2/src/str.hpp	2008-12-09 12:05:36.000000000 -0700
-+++ gdl/src/str.hpp	2012-02-21 09:54:36.980891348 -0700
++++ gdl/src/str.hpp	2011-11-29 22:43:03.000000000 -0700
 @@ -75,7 +75,9 @@
  	     bool reverseOffset, bool reverseSearch);
  std::string StrMid(const std::string& s, long first, long len, bool reverse);
@@ -46918,7 +51283,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/str.hpp gdl/src/str.hpp
  
 diff -ruN --exclude CVS gdl-0.9.2/src/typedefs.hpp gdl/src/typedefs.hpp
 --- gdl-0.9.2/src/typedefs.hpp	2011-11-08 16:44:26.000000000 -0700
-+++ gdl/src/typedefs.hpp	2012-02-21 09:54:36.997890731 -0700
++++ gdl/src/typedefs.hpp	2012-01-02 14:20:38.000000000 -0700
 @@ -406,7 +406,7 @@
  
    T& operator[]( SizeT ix) throw()
@@ -46948,7 +51313,7 @@ diff -ruN --exclude CVS gdl-0.9.2/src/typedefs.hpp gdl/src/typedefs.hpp
  	assert( sz == right.size());
 diff -ruN --exclude CVS gdl-0.9.2/src/widget.cpp gdl/src/widget.cpp
 --- gdl-0.9.2/src/widget.cpp	2011-04-04 20:09:26.000000000 -0600
-+++ gdl/src/widget.cpp	2012-02-21 09:54:37.049888845 -0700
++++ gdl/src/widget.cpp	2012-02-19 21:10:38.000000000 -0700
 @@ -675,9 +675,10 @@
        // Call widget event handler routine
        if ( lasttop != top) {
@@ -47015,7 +51380,7 @@ diff -ruN --exclude CVS gdl-0.9.2/templates/h gdl/templates/h
 + ***************************************************************************/
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.am gdl/testsuite/Makefile.am
 --- gdl-0.9.2/testsuite/Makefile.am	2011-11-02 17:17:58.000000000 -0600
-+++ gdl/testsuite/Makefile.am	2012-05-15 12:11:38.981540806 -0600
++++ gdl/testsuite/Makefile.am	2012-06-27 17:07:02.000000000 -0600
 @@ -33,6 +33,7 @@
    test_bug_3147181.pro \
    test_bug_3147733.pro \
@@ -47024,13 +51389,14 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.am gdl/testsuite/Makefile.a
    test_bug_3152899.pro \
    test_bug_3189072.pro \
    test_bug_3199465.pro \
-@@ -46,9 +47,13 @@
+@@ -46,9 +47,14 @@
    test_bug_3300626.pro \
    test_bug_3313522.pro \
    test_bug_3376577.pro \
-+  test_bug_3441031.pro \
 +  test_bug_3453775.pro \
 +  test_bug_3488003.pro \
++  test_call_function.pro \
++  test_call_procedure.pro \
    test_ce.pro \
    test_clip.pro \
    test_common.pro \
@@ -47038,7 +51404,18 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.am gdl/testsuite/Makefile.a
    test_constants.pro \
    test_correlate.pro \
    test_deriv.pro \
-@@ -72,8 +77,10 @@
+@@ -64,16 +70,21 @@
+   test_file_dirname.pro \
+   test_file_search.pro \
+   test_file_which.pro \
++  test_finite.pro \
+   test_fix.pro \
+   test_fixprint.pro \
++  test_fx_root.pro \
++  test_fz_roots.pro \
+   test_gc.pro \
+   test_get_screen_size.pro \
+   test_grib.pro \
    test_hist_2d.pro \
    test_idl8.pro \
    test_idl_validname.pro \
@@ -47049,7 +51426,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.am gdl/testsuite/Makefile.a
    test_memory.pro \
    test_moment.pro \
    test_mpfit.pro \
-@@ -87,6 +94,9 @@
+@@ -87,6 +98,9 @@
    test_python_module_0.pro \
    test_python_module_1.pro \
    test_python_module_2.pro \
@@ -47059,7 +51436,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.am gdl/testsuite/Makefile.a
    test_readf.pro \
    test_rebin.pro \
    test_rk4.pro \
-@@ -95,13 +105,16 @@
+@@ -95,13 +109,16 @@
    test_spawn_unit.pro \
    test_spher_harm.pro \
    test_spl_init.pro \
@@ -47078,13 +51455,31 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.am gdl/testsuite/Makefile.a
    test_zeropoly.pro \
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.in gdl/testsuite/Makefile.in
 --- gdl-0.9.2/testsuite/Makefile.in	2011-11-02 17:17:58.000000000 -0600
-+++ gdl/testsuite/Makefile.in	2012-05-15 12:11:38.985540657 -0600
-@@ -265,9 +265,12 @@
++++ gdl/testsuite/Makefile.in	2012-06-28 03:54:55.000000000 -0600
+@@ -115,6 +115,7 @@
+ FGREP = @FGREP@
+ GDLDATADIR = @GDLDATADIR@
+ GREP = @GREP@
++GraphicsMagickConfig = @GraphicsMagickConfig@
+ HAVE_64BIT_OS = @HAVE_64BIT_OS@
+ INSTALL = @INSTALL@
+ INSTALL_DATA = @INSTALL_DATA@
+@@ -252,6 +253,7 @@
+   test_bug_3147181.pro \
+   test_bug_3147733.pro \
+   test_bug_3151760.pro \
++  test_bug_3152892.pro \
+   test_bug_3152899.pro \
+   test_bug_3189072.pro \
+   test_bug_3199465.pro \
+@@ -265,9 +267,14 @@
    test_bug_3300626.pro \
    test_bug_3313522.pro \
    test_bug_3376577.pro \
-+  test_bug_3441031.pro \
 +  test_bug_3453775.pro \
++  test_bug_3488003.pro \
++  test_call_function.pro \
++  test_call_procedure.pro \
    test_ce.pro \
    test_clip.pro \
    test_common.pro \
@@ -47092,7 +51487,18 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.in gdl/testsuite/Makefile.i
    test_constants.pro \
    test_correlate.pro \
    test_deriv.pro \
-@@ -291,8 +294,10 @@
+@@ -283,16 +290,21 @@
+   test_file_dirname.pro \
+   test_file_search.pro \
+   test_file_which.pro \
++  test_finite.pro \
+   test_fix.pro \
+   test_fixprint.pro \
++  test_fx_root.pro \
++  test_fz_roots.pro \
+   test_gc.pro \
+   test_get_screen_size.pro \
+   test_grib.pro \
    test_hist_2d.pro \
    test_idl8.pro \
    test_idl_validname.pro \
@@ -47103,7 +51509,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.in gdl/testsuite/Makefile.i
    test_memory.pro \
    test_moment.pro \
    test_mpfit.pro \
-@@ -306,6 +311,9 @@
+@@ -306,6 +318,9 @@
    test_python_module_0.pro \
    test_python_module_1.pro \
    test_python_module_2.pro \
@@ -47113,7 +51519,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/Makefile.in gdl/testsuite/Makefile.i
    test_readf.pro \
    test_rebin.pro \
    test_rk4.pro \
-@@ -314,13 +322,16 @@
+@@ -314,13 +329,16 @@
    test_spawn_unit.pro \
    test_spher_harm.pro \
    test_spl_init.pro \
@@ -47137,14 +51543,6 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_bug_3152892.pro gdl/testsuite/t
 +pro test_bug_3152892
 +  help, *(ptr_new([1,2,3.]))
 +end
-diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_bug_3441031.pro gdl/testsuite/test_bug_3441031.pro
---- gdl-0.9.2/testsuite/test_bug_3441031.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/testsuite/test_bug_3441031.pro	2012-02-21 07:21:34.000000000 -0700
-@@ -0,0 +1,4 @@
-+pro test_bug_3441031
-+  ; this caused a segfault
-+  res=EXECUTE("a = strjoin(strsplit((['a'])[1],'a'),'a')")
-+end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_bug_3453775.pro gdl/testsuite/test_bug_3453775.pro
 --- gdl-0.9.2/testsuite/test_bug_3453775.pro	1969-12-31 17:00:00.000000000 -0700
 +++ gdl/testsuite/test_bug_3453775.pro	2011-12-28 04:51:37.000000000 -0700
@@ -47166,9 +51564,200 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_bug_3488003.pro gdl/testsuite/t
 +  mask=[59,70,89,103,115,119,130,145,179,193]
 +  a.value1[mask]=1
 +end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_call_function.pro gdl/testsuite/test_call_function.pro
+--- gdl-0.9.2/testsuite/test_call_function.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_call_function.pro	2012-06-29 15:39:57.000000000 -0600
+@@ -0,0 +1,91 @@
++;
++; Alain C., 22 June 2012
++;
++; More systematic tests on EXECUTE, CALL_FUNCTION and CALL_PROCEDURE
++;
++; ----------------------------------------------
++; we add a keyword to test also keyword, because of bug report 3490415 
++;
++function FUNC_MY_FUNC, x, add_one=add_one
++;
++resultat=x+5
++if KEYWORD_SET(add_one) then resultat=resultat+1
++return, resultat
++;
++end
++;
++; --------------------
++;
++pro BASIC_CALL_FUNCTION, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro BASIC_CALL_FUNCTION, help=help, test=test, no_exit=no_exit, verbose=verbose'
++    return
++endif
++;
++nb_errors = 0
++tolerance=1e-5
++;
++; internal intrinsic function, single value
++expected=-1.
++result=CALL_FUNCTION('COS', !pi)
++;
++if (ABS(result-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++; internal intrinsic function, array
++;
++expected=REPLICATE(-1.,10)
++result=CALL_FUNCTION('COS', REPLICATE(!pi,10))
++;
++if (TOTAL(ABS(result-expected)) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++; external function, single element
++;
++expected=0.
++result=CALL_FUNCTION('FUNC_MY_FUNC', -5.)
++;
++if (ABS(result-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++; external function, single element, one keyword
++;
++expected=1.
++result=CALL_FUNCTION('FUNC_MY_FUNC', -5., /add_one)
++;
++if (ABS(result-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++; external function, value 2D array
++;
++expected=0.
++result=CALL_FUNCTION('FUNC_MY_FUNC', REPLICATE(-5,12,3))
++;
++if (TOTAL(ABS(result-expected)) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++;
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, STRING(nb_errors)+' Errors founded when testing CALL_FUNCTION', /continue
++endif else begin
++    MESSAGE, 'testing CALL_FUNCTION: No Errors founded', /continue
++endelse
++;
++if KEYWORD_SET(test) then STOP
++;
++if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++end
++;
++pro TEST_CALL_FUNCTION, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_CALL_FUNCTION, help=help, test=test, no_exit=no_exit, verbose=verbose'
++    return
++endif
++;
++BASIC_CALL_FUNCTION, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_call_procedure.pro gdl/testsuite/test_call_procedure.pro
+--- gdl-0.9.2/testsuite/test_call_procedure.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_call_procedure.pro	2012-06-29 15:39:57.000000000 -0600
+@@ -0,0 +1,92 @@
++;
++; Alain C., 22 June 2012
++;
++; More systematic tests on EXECUTE, CALL_FUNCTION and CALL_PROCEDURE
++;
++; ----------------------------------------------
++; we add a keyword to test also keyword, because of bug report 3490415 
++;
++pro PRO_MY_PRO, x, y, add_one=add_one
++;
++y=x+5
++;
++if KEYWORD_SET(add_one) then y=y+1.
++;
++end
++;
++; --------------------
++;
++pro BASIC_CALL_PROCEDURE, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro BASIC_CALL_PROCEDURE, help=help, test=test, no_exit=no_exit, verbose=verbose'
++    return
++endif
++;
++nb_errors = 0
++tolerance=1e-5
++;
++; internal intrinsic function, single value
++;
++txt1='XYZ is cool'
++txt2='GDL is cool'
++CALL_PROCEDURE, 'STRPUT', txt1, 'GDL', 0
++;
++if (STRCMP(txt1, txt2) NE 1)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, txt1, txt2
++;
++; internal intrinsic function, array
++;
++; no idea now, help welcome
++;
++; external function, single element
++;
++expected=17.
++CALL_PROCEDURE, 'PRO_MY_PRO', 12, result
++;
++if (ABS(result-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++; external function, single element, keyword
++;
++expected=17.+1.
++CALL_PROCEDURE, 'PRO_MY_PRO', 12, result, /add_one
++;
++if (ABS(result-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, result, expected
++;
++; external function, value 2D array
++;
++data_in=REPLICATE(-5,12,3)
++PRO_MY_PRO, data_in, data_out1
++CALL_PROCEDURE, 'PRO_MY_PRO', data_in, data_out2
++;
++if (TOTAL(ABS(data_out1-data_out2)) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, data_out1-data_out2
++;
++;
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, STRING(nb_errors)+' Errors founded when testing CALL_PROCEDURE', /continue
++endif else begin
++    MESSAGE, 'testing CALL_PROCEDURE: No Errors founded', /continue
++endelse
++;
++if KEYWORD_SET(test) then STOP
++;
++if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++end
++;
++; ----------------------------------------------------
++;
++pro TEST_CALL_PROCEDURE, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_CALL_PROCEDURE, help=help, test=test, no_exit=no_exit, verbose=verbose'
++    return
++endif
++;
++BASIC_CALL_PROCEDURE, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_congrid.pro gdl/testsuite/test_congrid.pro
 --- gdl-0.9.2/testsuite/test_congrid.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/testsuite/test_congrid.pro	2012-05-10 15:10:06.707422978 -0600
++++ gdl/testsuite/test_congrid.pro	2012-04-13 15:08:47.000000000 -0600
 @@ -0,0 +1,146 @@
 +;
 +; This basic test for CONGRID, using the Saturn.jpg image in the
@@ -47360,9 +51949,219 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_diag_matrix.pro gdl/testsuite/t
 +TEST_DIAG_MATRIX_INSERT
 +;
 +end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_dicom.pro gdl/testsuite/test_dicom.pro
+--- gdl-0.9.2/testsuite/test_dicom.pro	2010-12-28 11:19:26.000000000 -0700
++++ gdl/testsuite/test_dicom.pro	2012-07-05 13:22:22.000000000 -0600
+@@ -1,4 +1,26 @@
++;
+ ; just tests if gdlffdicom is in path
+-pro test_dicom
+-  a = gdlffdicom_date()
++;
++pro TEST_DICOM, version=version
++;
++; bug 3150207 (I was not able to reproduce it on July 2012)
++;
++if ~KEYWORD_SET(version) then begin
++    w=OBJ_NEW('gdlffdicom')
++    print, 'hello post OBJ_NEW'
++    help, w
++endif else begin
++    HELP, OBJ_NEW('gdlffdicom')
++endelse
++;
++; dates ...
++;
++dicom_dat = GDLFFDICOM_DATE()
++SPAWN, 'date +%Y%m%d', unix_date
++;
++if (unix_date[0] NE dicom_dat) then EXIT, status=1
++;
++MESSAGE, /continue, 'very basic tests OK on DICOM'
++MESSAGE, /continue, 'please contribute extending the test cases'
++;
+ end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_execute.pro gdl/testsuite/test_execute.pro
+--- gdl-0.9.2/testsuite/test_execute.pro	2010-08-27 08:25:17.000000000 -0600
++++ gdl/testsuite/test_execute.pro	2012-06-27 17:07:02.000000000 -0600
+@@ -1,9 +1,138 @@
++;
++; Alain C., 22 June 2012
++;
++; More systematic tests on EXECUTE, CALL_FUNCTION and CALL_PROCEDURE
++;
++pro PRO_MY_PRO, x, y
++;
++y=x+5
++;
++end
++;
++function FUNC_MY_FUNC, x
++;
++return, x+5
++;
++end
++;
++; ---------------------
++; old temporay bug
++;
++pro TEST_BUG_3441031
++;; this caused a segfault
++res=EXECUTE("a = STRJOIN(STRSPLIT((['a'])[1],'a'),'a')")
++;
++end
++;
++; another old temporay bug
++;
+ ; by Sylwester Arabas <slayoo at igf.fuw.edu.pl>
+-pro test_execute
+-
+-  if execute('print,execute([''''])') then begin
+-    message, 'EXECUTE should not accept array arguments', /conti
+-    exit, status=1
+-  endif
++pro OLD_TEST_EXECUTE
+ 
++if EXECUTE('print, EXECUTE([''''])') then begin
++   MESSAGE, 'EXECUTE should not accept array arguments', /conti
++   EXIT, status=1
++endif
++;
++end
++;
++; --------------------
++;
++pro BASIC_EXECUTE, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro BASIC_EXECUTE, help=help, test=test, no_exit=no_exit, verbose=verbose'
++    return
++endif
++;
++nb_errors = 0
++tolerance=1e-5
++;
++; internal intrinsic function, single value
++com='a=COS(!pi)'
++expected=-1.
++status=EXECUTE(com)
++;
++if (status NE 1) then nb_errors=nb_errors+1
++if (ABS(a-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, com, status, a, expected
++;
++; internal intrinsic function, array
++;
++com='a=COS(REPLICATE(!pi,10))'
++expected=REPLICATE(-1.,10)
++status=EXECUTE(com)
++;
++if (status NE 1) then nb_errors=nb_errors+1
++if (TOTAL(ABS(a-expected)) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, com, status, a, expected
++;
++; internal intrinsic procedure (better idea welcome !)
++;
++com='plot, SIN(!pi*findgen(100)/10.)'
++status=EXECUTE(com)
++;
++if (status NE 1) then nb_errors=nb_errors+1
++;
++; external function, single element
++;
++com='a=FUNC_MY_FUNC(12.)'
++expected=17.
++status=EXECUTE(com)
++;
++if (status NE 1) then nb_errors=nb_errors+1
++if (ABS(a-expected) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, com, status, a, expected
++;
++; external function, value 2D array
++;
++com='a=FUNC_MY_FUNC(REPLICATE(-5,12,3))'
++expected=REPLICATE(0.,12,3)
++status=EXECUTE(com)
++;
++if (status NE 1) then nb_errors=nb_errors+1
++if (TOTAL(ABS(a-expected)) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, com, status, a, expected
++;
++; external function, named' 2D array
++;
++input=REPLICATE(-5,12,3)
++com='a=FUNC_MY_FUNC(input)'
++expected=input+5.
++status=EXECUTE(com)
++;
++if (status NE 1) then nb_errors=nb_errors+1
++if (TOTAL(ABS(a-expected)) GT tolerance)  then nb_errors=nb_errors+1
++if KEYWORD_SET(verbose) then print, com, status, a, expected
++;
++;
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, STRING(nb_errors)+' Errors founded when testing EXECUTE', /continue
++endif else begin
++    MESSAGE, 'testing EXECUTE: No Errors founded', /continue
++endelse
++;
++if KEYWORD_SET(test) then STOP
++;
++if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++WDELETE
++;
++end
++;
++; ----------------------------------------------------
++;
++pro TEST_EXECUTE, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_EXECUTE, help=help, test=test, no_exit=no_exit, verbose=verbose'
++    return
++endif;
++;
++TEST_BUG_3441031
++OLD_TEST_EXECUTE
++;
++BASIC_EXECUTE, help=help, test=test, no_exit=no_exit, verbose=verbose
++;
+ end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_fft_dim.pro gdl/testsuite/test_fft_dim.pro
+--- gdl-0.9.2/testsuite/test_fft_dim.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_fft_dim.pro	2012-07-05 17:58:57.000000000 -0600
+@@ -0,0 +1,26 @@
++;
++; Alain C. and Mathieu P. under GNU GPL v2 or later
++;
++; Visual empiric preliminary test of FFT(dim=)
++; A shift line by in an array should have no consequence
++; on the FFT module ...
++;
++pro TEST_FFT_DIM
++
++; Create a cosine wave damped by an exponential.
++n = 256
++x = FINDGEN(n)
++y = COS(x*!PI/6)*EXP(-((x - n/2)/30)^2/2)
++; Construct a two-dimensional image of the wave.
++z = REBIN(y, n, n)
++z1=z
++for ii=0, n-1 do z1[*,ii]=shift(z1[*,ii],ii)
++
++window, xsi=3*n, ysize=n
++tvscl, z1,0
++tvscl, ABS(FFT(z1, dim=1)),1
++tvscl, ABS(FFT(z1, dim=2)),2
++
++; we can do the diff, no phase diff  ...
++
++end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_file_copy.pro gdl/testsuite/test_file_copy.pro
 --- gdl-0.9.2/testsuite/test_file_copy.pro	2010-06-29 02:47:39.000000000 -0600
-+++ gdl/testsuite/test_file_copy.pro	2012-02-21 09:54:37.701865187 -0700
++++ gdl/testsuite/test_file_copy.pro	2011-11-15 17:57:05.000000000 -0700
 @@ -4,18 +4,32 @@
  ; Lea Noreskal, June 2010
  ; under GNU GPL 2 or later
@@ -47655,7 +52454,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_file_copy.pro gdl/testsuite/tes
  if KEYWORD_SET(test) then STOP
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_file_delete.pro gdl/testsuite/test_file_delete.pro
 --- gdl-0.9.2/testsuite/test_file_delete.pro	2010-06-29 02:47:39.000000000 -0600
-+++ gdl/testsuite/test_file_delete.pro	2012-02-21 09:54:37.721864461 -0700
++++ gdl/testsuite/test_file_delete.pro	2011-11-15 17:57:05.000000000 -0700
 @@ -5,56 +5,61 @@
  ; initial version by AC, 28 Avril 2009
  ; very basic tests for FILE_DELETE
@@ -47736,6 +52535,394 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_file_delete.pro gdl/testsuite/t
  
  all_files_and_directories=[all_files_and_directories,tdir]
  
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_finite.pro gdl/testsuite/test_finite.pro
+--- gdl-0.9.2/testsuite/test_finite.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_finite.pro	2012-06-28 07:29:22.000000000 -0600
+@@ -0,0 +1,135 @@
++;
++; under GNU GPL v2 or later
++; Alain Coulais, 19-June-2012
++; Mathieu Pinter, 19-June-2012
++; 
++pro BASIC_FINITE, data=data, comp=comp, double=double, test=test
++;
++if ~ARG_PRESENT(data) then begin
++   data=[0., -0.0, 10, -10., !values.f_nan, -!values.f_nan]
++   data=[data, !values.f_infinity, -!values.f_infinity]
++endif
++;
++if KEYWORD_SET(double) then data=DOUBLE(data)
++if KEYWORD_SET(comp) then data=COMPLEX(0.,0.)+data
++;
++print, data
++print, FINITE(data)
++print, FINITE(data,/nan)
++print, FINITE(data,/inf)
++;
++print, FINITE(data,/nan, sign=-1)
++print, FINITE(data,/nan, sign=0)
++print, FINITE(data,/nan, sign=1)
++;
++print, FINITE(data,/inf, sign=-1)
++print, FINITE(data,/inf, sign=0)
++print, FINITE(data,/inf, sign=1)
++;
++if KEYWORD_SET(test) then STOP
++;
++end
++; -------------------------------------------------
++;
++pro TEST_FINITE, help=help, test=test, debug=debug, $
++                 no_exit=no_exit, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_FINITE, help=help, test=test, debug=debug, $'
++    print, '                 no_exit=no_exit, verbose=verbose'
++    return
++endif
++;
++nb_errors = 0
++tab=[[1.,!VALUES.F_INFINITY,1],$
++     [0,!VALUES.F_NAN,5],$
++     [-!VALUES.F_INFINITY,-!VALUES.F_NAN,100]]
++;
++a=FINITE(tab) 
++if a(1,0) NE 0 then nb_errors=nb_errors + 1
++;
++a=FINITE(tab, /INF) 
++if a(1,0) NE 1 then nb_errors=nb_errors + 1
++;
++a=FINITE(tab, /NAN) 
++if a(1,1) NE 1 then nb_errors=nb_errors + 1
++;
++a=FINITE(tab, /INF, SIGN=1) 
++if a(1,0) NE 1 then nb_errors=nb_errors + 1
++;
++a=FINITE(tab, /INF, SIGN=-1) 
++if a(0,2) NE 1 then nb_errors=nb_errors + 1
++;
++a=FINITE(tab, /NAN, SIGN=1) 
++if a(1,1) NE 1 then nb_errors=nb_errors + 1
++;
++a=FINITE(tab, /NAN, SIGN=-1) 
++if a(1,2) NE 1 then nb_errors=nb_errors + 1
++;
++if KEYWORD_SET(debug) then STOP
++;
++b=FLTARR(1000)
++b[10:19]=-!VALUES.F_NAN
++b[110:119]=!VALUES.F_NAN
++a=WHERE(FINITE(b, /NAN, SIGN=-1) EQ 1, count)
++if count NE 10 then nb_errors=nb_errors + 1
++;
++if count EQ 20 then begin
++    MESSAGE,/continue, "This platform does not distinguish between +Nan and -Nan"
++endif
++;
++a=WHERE(FINITE(b, /inf, SIGN=-1) EQ 1, count)
++if count NE 0 then nb_errors=nb_errors + 1
++; counting +Inf
++b[210:219]=!VALUES.F_infinity
++b[410:419]=-!VALUES.F_infinity
++a=WHERE(FINITE(b, /inf, SIGN=1) EQ 1, count)
++if count NE 10 then nb_errors=nb_errors + 1
++if count EQ 20 then begin
++    MESSAGE,/continue, "This platform does not distinguish between +Inf and -Inf"
++endif
++;
++; now we have +-Nan and +inf, do we still know how to count ?
++a=WHERE(FINITE(b, /NAN, SIGN=-1) EQ 1, count)
++if count NE 10 then nb_errors=nb_errors + 1
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, STRING(nb_errors)+' Errors founded when testing FINITE', /continue
++endif else begin
++    MESSAGE, 'testing FINITE: No Errors founded', /continue
++endelse
++;
++if KEYWORD_SET(test) then STOP
++;
++if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++end
++;
++;
++;
++pro TEST_FINITE_TIMETEST, nbp=nbp, test=test
++
++if ~ARG_PRESENT(nbp) then nbp=1e7
++
++a=randomu(seed, nbp)
++
++a(where(a GT 0.75))=!values.f_nan
++a(where(a LT 0.25))=-!values.f_nan
++
++print, 'finite only'
++t0=systime(1) & b=finite(a) & print, systime(1)-t0
++
++print, 'NaN only'
++t0=systime(1) & b=finite(a, /nan) & print, systime(1)-t0
++t0=systime(1) & b=finite(a, /nan, sign=1) & print, systime(1)-t0
++t0=systime(1) & b=finite(a, /nan, sign=-1) & print, systime(1)-t0
++
++print, 'Inf only'
++t0=systime(1) & b=finite(a, /inf) & print, systime(1)-t0
++t0=systime(1) & b=finite(a, /inf, sign=1) & print, systime(1)-t0
++t0=systime(1) & b=finite(a, /inf, sign=-1) & print, systime(1)-t0
++
++if KEYWORD_SET(test) then STOP
++
++
++end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_fx_root.pro gdl/testsuite/test_fx_root.pro
+--- gdl-0.9.2/testsuite/test_fx_root.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_fx_root.pro	2012-07-05 16:59:54.000000000 -0600
+@@ -0,0 +1,127 @@
++;
++; under GNU GPL v2 or later
++; Benjamin Laurent, 18-June-2012
++; long term contact : Alain Coulais
++;
++; 06-July-2012: we change Func1 to a better one !
++; 
++; -------------------------------------------------
++; usage: in GDL CLI:
++; GDL> test_fx_root
++;
++; -------------------------------------------------
++;
++; AC 06/07/2012 the example in IDL doc is stupid !
++function FUNC1_STUPID, X  
++  return, EXP(SIN(X)^2 + COS(X)^2 - 1) - 1.
++end
++; alternative example found in Matlab Tuto
++function FUNC1, X  
++  return, COS(x)-x
++end
++;
++; from GDL doc
++function FUNC2, X
++  return, X^2-5.
++end
++;
++; from http://objectmix.com/idl-pvwave/169016-better-root-finder.html
++; three roots, depending the range where we are computing
++function FUNC3, x
++return, x^3-8.0
++end
++;
++; -------------------------------------------------
++;
++pro TEST_FX_ROOT_ON_FUNC, init=init, function_name=function_name, $
++                          iter=iter, eps=eps, help=help, test=test
++  
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_FX_ROOT_ON_FUNC, init=init, function_name=function_name, $'
++    print, '                          iter=iter, eps=eps, help=help, test=test'
++    return
++endif
++;
++;Error tolerance
++if (N_ELEMENTS(eps) EQ 0) then eps=1e-4
++;
++if N_ELEMENTS(function_name) EQ 0 then function_name='FUNC1'
++;
++nb_errors=0
++;
++;return one root
++resuFX=FX_ROOT(init,function_name,ITMAX=iter,/DOUBLE,STOP=1,TOL=0.00001)
++resuNW=NEWTON(4.,function_name) 
++;;  
++print, 'FX_ROOT : ',  resuFX
++print, 'FX_NEWTON : ', resuNW
++;
++; comparing
++;
++if ABS(CALL_FUNCTION(function_name,resuFX)) GT eps then nb_errors=nb_errors+1
++;
++if ABS(resuFX-resuNW) GT eps then nb_errors=nb_errors+1
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, /continue, STRING(nb_errors)+' Errors founded'
++    if ~KEYWORD_SET(test) then EXIT, status=1
++endif else begin
++    MESSAGE, /continue, 'Function '+function_name+' : No Errors founded'
++endelse
++  
++if KEYWORD_SET(test) then STOP
++
++end
++;
++; depending the [x0,x1,x2] values, we can converge to different roots
++;
++pro WHERE_DO_WE_CONVERGE
++;
++tol=1.e-5
++expected_module=2.
++re_r1=-1
++;
++root1=FX_ROOT([-10,0,.5], 'FUNC3')
++root2=FX_ROOT([0,.5,3], 'FUNC3')    
++;
++errors=0
++; checking module values
++if ABS(ABS(root1)-expected_module) GT tol then begin
++   errors=errors+1
++   MESSAGE,/continue, 'root1 inaccurate'
++endif
++if ABS(ABS(root2)-expected_module) GT tol then begin
++   errors=errors+1
++   MESSAGE,/continue, 'root2 inaccurate'
++endif
++;
++; checking roots values
++if ABS(real_part(root1)-re_r1) GT tol then begin
++   errors=errors+1
++   MESSAGE,/continue, 'unexpected root1'
++endif
++if ABS(real_part(root2)-expected_module) GT tol then begin
++   errors=errors+1
++   MESSAGE,/continue, 'unexpected root2'
++endif
++;
++if errors EQ 0 then MESSAGE,/continue, 'convergence on expected roots well done'
++;
++end
++;
++pro TEST_FX_ROOT
++;
++;float precision for double DCOMPLEXARR
++C = COMPLEXARR(1,3)
++C[0] = complex(1,0)
++C[1] = complex(2,0)
++C[2] = complex(3,0)
++c=reform(c)
++;
++TEST_FX_ROOT_ON_FUNC, init=C, function_name='FUNC1', iter=100
++TEST_FX_ROOT_ON_FUNC, init=C, function_name='FUNC2', iter=100
++;
++; informational test
++WHERE_DO_WE_CONVERGE
++;
++end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_fz_roots.pro gdl/testsuite/test_fz_roots.pro
+--- gdl-0.9.2/testsuite/test_fz_roots.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_fz_roots.pro	2012-06-16 15:35:44.000000000 -0600
+@@ -0,0 +1,114 @@
++;
++; under GNU GPL v2 or later
++; Benjamin Laurent, 15-Juin-2012
++; 
++; -------------------------------------------------
++;
++; to be extended ...
++;
++; -------------------------------------------------
++;
++;usage:
++;GDL> test_fz_roots
++
++function poly, m, c , r , index, double;Return the maximum error between 'exact' roots and fz_roots 
++  resp=0
++  resn=0
++  epsref=1e-6
++  s=fz_roots(*c[m],/double)  
++  ;Sorting, index gives the relation
++  ;between 'exact' roots and fz_roots (cause to different orders...)
++  for j = 0,n_elements(*r[m])-1 do begin
++     for i = 0,n_elements(*r[m])-1 do begin
++        if ( abs(s[j]-(*r[m])[i]) lt epsref ) then begin
++           (*index[m])[j]=i
++        endif
++     endfor
++  endfor
++  
++  for j = 0,n_elements(*r[m])-1 do begin
++     resn=abs(s[j]-(*r[m])[(*index[m])[j]])
++     if (resn GT resp) then begin resp = resn
++     endif
++  endfor
++  return, resp
++end
++
++pro TEST_FZ_ROOTS_ON_POLY, numberpoly=numberpoly, eps=eps, help=help, test=test , c=c, r=r, index=index, double=double
++
++  if KEYWORD_SET(help) then begin
++     print, 'pro TEST_FZ_ROOTS_POLY, numberpoly=m, eps=eps, help=help, test=test, c=c, r=r, index=index, double=double'
++     return
++  endif
++
++;Error tolerance
++  if (N_ELEMENTS(eps) EQ 0) then begin eps=1e-6
++  endif
++  if (N_ELEMENTS(numberpoly) EQ 0) then begin m=0
++  endif
++  nb_errors=0
++
++  resuFZ=poly(numberpoly,c,r,index,double);maximum error
++
++  if resuFZ GT eps then begin nb_errors=nb_errors+1 ;comparing
++  endif
++
++  if (nb_errors GT 0) then begin
++     MESSAGE, /continue, STRING(nb_errors)+' Errors founded'
++     if ~KEYWORD_SET(test) then EXIT, status=1
++  endif else begin
++     MESSAGE, /continue, 'Polynomial '+string(format='(I1)',numberpoly)+' : No Errors founded'
++  endelse
++
++
++;
++  if KEYWORD_SET(test) then begin STOP
++  endif
++;
++end
++
++
++
++pro TEST_FZ_ROOTS
++
++n=5;number of polynomials
++c=ptrarr(n);polynomial coefficients
++r=ptrarr(n);polynomial roots
++
++c[0]=ptr_new([-1,0,0,0,0,1])
++r[0]=ptr_new(exp([0,2,4,6,8] * !PI * complex(0,1) / 5))
++
++c[1]=ptr_new([-1,0,0,0,0,1])
++r[1]=ptr_new(exp([0,2,4,6,8] * !PI * complex(0,1) / 5))
++
++; IDL-doc example (IMSL_ZEROPOLY)
++c[2] = ptr_new([-2, 4, -3, 1])
++r[2] = ptr_new([1, complex(1,-1), complex(1,1)])
++
++; IDL-doc examples (FZ_ROOTS)
++c[3] = ptr_new([-2, -9, -7, 6])
++r[3] = ptr_new([-.5, -1./3, 2.])
++
++c[4] = ptr_new([2, 0, 3, 0, 1])
++r[4] = ptr_new(complex(0,[-sqrt(2), sqrt(2), -1, 1]))
++
++;c[5]=ptr_new([1]);To check error handling of degree zero polynomial
++;c[6]=ptr_new([complex(0,1),0,0,1]);To check error handling of complex coefficients polynomial
++   
++index=ptrarr(5)
++index[0]=ptr_new([0,0,0,0,0])
++index[1]=ptr_new([0,0,0,0,0])
++index[2]=ptr_new([0,0,0])
++index[3]=ptr_new([0,0,0])
++index[4]=ptr_new([0,0,0,0])
++
++TEST_FZ_ROOTS_ON_POLY, numberpoly=0, c=c, r=r, index=index, double=double
++TEST_FZ_ROOTS_ON_POLY, numberpoly=1, c=c, r=r, index=index, double=double
++TEST_FZ_ROOTS_ON_POLY, numberpoly=2, c=c, r=r, index=index, double=double
++TEST_FZ_ROOTS_ON_POLY, numberpoly=3, c=c, r=r, index=index, double=double
++TEST_FZ_ROOTS_ON_POLY, numberpoly=4, c=c, r=r, index=index, double=double
++end
++
++
++
++
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_get_kbrd.pro gdl/testsuite/test_get_kbrd.pro
 --- gdl-0.9.2/testsuite/test_get_kbrd.pro	1969-12-31 17:00:00.000000000 -0700
 +++ gdl/testsuite/test_get_kbrd.pro	2011-12-29 19:11:38.000000000 -0700
@@ -47787,9 +52974,83 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_get_kbrd.pro gdl/testsuite/test
 +for ii=0, 5 do print, GET_KBRD(wait)
 +;
 +end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_hist_equal.pro gdl/testsuite/test_hist_equal.pro
+--- gdl-0.9.2/testsuite/test_hist_equal.pro	1969-12-31 17:00:00.000000000 -0700
++++ gdl/testsuite/test_hist_equal.pro	2012-05-22 09:33:00.000000000 -0600
+@@ -0,0 +1,70 @@
++;
++; Josh Sixsmith 16 May 2012, under GNU GPL v3 or later
++;
++; A simple statistical test for distribution shape
++;
++; After HIST_EQUAL we check that:
++; -- kurtosis of the image is roughly -1.2
++; -- skewness of the image is roughly 0
++; This should describe a Uniform distribution
++;
++pro TEST_HIST_EQUAL, samples=samples, test=test, verbose=verbose, help=help
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_HIST_EQUAL, samples=samples, test=test, $'
++    print, '                     verbose=verbose. help=help'
++    return
++endif
++;
++if N_ELEMENTS(samples) eq 0 then samples=100
++;
++; We will calculate an image from a random normal distribution.
++; This should (roughly) have a skewness of 0 and a kurtosis of 0.
++img = RANDOMN(sd, samples,samples)
++;
++; compute the histogram equalisation on the image
++scl = HIST_EQUAL(img)
++;
++; compute the moment of the raw image and the scaled image
++m_raw    = MOMENT(img)
++m_scl = MOMENT(scl)
++;
++; The more samples used in the image creation, the closer the
++; image is to being a normal distribution.
++; As such, some variation will be expected, so an error of 0.1
++; should suffice.
++err = 0.1
++total_pb = 0
++;
++if (ABS(m_scl[3] + 1.2) ge err) then begin
++    if KEYWORD_SET(verbose) then MESSAGE, 'pb with kurtosis ofimage', /continue
++    total_pb = total_pb + 1
++endif
++;
++if (ABS(m_scl[2]) ge err) then begin
++    if KEYWORD_SET(verbose) then MESSAGE, 'pb with skewness of image', /continue
++    total_pb = total_pb + 1
++endif
++;
++if KEYWORD_SET(verbose) then begin
++    print, 'Stats on Raw Image:'
++    print, 'Mean: ', m_raw[0] & print, 'Variance: ', m_raw[1]
++    print, 'Skewness: ', m_raw[2] & print, 'Kurtosis: ', m_raw[3]
++    print, 'Stats on Equalised Image:'
++    print, 'Mean: ', m_scl[0] & print, 'Variance: ', m_scl[1]
++    print, 'Skewness: ', m_scl[2] & print, 'Kurtosis: ', m_scl[3]
++endif
++;
++if KEYWORD_SET(test) then stop
++;
++if (total_pb gt 0) then begin
++    if KEYWORD_SET(no_exit) then begin
++        MESSAGE, 'Tests failed. Increase sample SIZE?', /continue
++    endif else begin
++        EXIT, status=1
++    endelse
++endif else begin
++    MESSAGE, 'Tests successful.', /continue
++endelse
++;
++end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_histo.pro gdl/testsuite/test_histo.pro
 --- gdl-0.9.2/testsuite/test_histo.pro	2009-10-30 10:56:27.000000000 -0600
-+++ gdl/testsuite/test_histo.pro	2012-02-21 09:54:37.792861884 -0700
++++ gdl/testsuite/test_histo.pro	2011-12-06 15:30:24.000000000 -0700
 @@ -1,9 +1,9 @@
  ;
 -; AC 01-jun-2007
@@ -47863,7 +53124,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_histo.pro gdl/testsuite/test_hi
 +
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_image_statistics.pro gdl/testsuite/test_image_statistics.pro
 --- gdl-0.9.2/testsuite/test_image_statistics.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/testsuite/test_image_statistics.pro	2012-05-10 15:10:06.762420995 -0600
++++ gdl/testsuite/test_image_statistics.pro	2012-03-05 17:21:54.000000000 -0700
 @@ -0,0 +1,96 @@
 +;
 +; Alain Coulais, 16-Nov-2011, from an idea by LLuvia
@@ -47963,7 +53224,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_image_statistics.pro gdl/testsu
 +end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_interpol.pro gdl/testsuite/test_interpol.pro
 --- gdl-0.9.2/testsuite/test_interpol.pro	2010-04-09 04:30:38.000000000 -0600
-+++ gdl/testsuite/test_interpol.pro	2012-05-10 15:10:06.791419943 -0600
++++ gdl/testsuite/test_interpol.pro	2012-03-05 07:50:56.000000000 -0700
 @@ -1,39 +1,126 @@
 +;
 +; testin INTERPOL on few basic cases ...
@@ -48253,9 +53514,210 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_ludc_lusol.pro gdl/testsuite/te
 +TEST_LUDC_GSL,/double
 +;
 +end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_moment.pro gdl/testsuite/test_moment.pro
+--- gdl-0.9.2/testsuite/test_moment.pro	2010-10-13 17:07:51.000000000 -0600
++++ gdl/testsuite/test_moment.pro	2012-07-14 13:01:41.000000000 -0600
+@@ -5,11 +5,126 @@
+ ;
+ ; ToDo: testing /NaN ?!
+ ;
++; Since 16 June 2012, we also have DIMENSION for MOMENT() (Mathieu Pinter)
++; Since 14 July 2012, we also have DIMENSION for related codes:
++;                     MEAN(), STDDEV(), VARIANCE(), SKEWNESS(), KURTOSIS()
++;
++; -------------------------------------------------------------
++;
+ function ERREUR, x1, x2
+ return, SQRT(TOTAL((x1-x2)^2))
+ end
+ ;
+-pro TEST_MOMENT, test=test
++; -------------------------------------------------------------
++;
++function CHECK_DIMENSION_CAPABILITY, verbose=verbose
++;
++; IDL before version 8 cannot manage DIMENSION keyword
++;
++; Since 16 June 2012, we also have DIMENSION for MOMENT()
++; Since 14 July 2012, we also have DIMENSION for related codes:
++;    MEAN(), STDDEV(), VARIANCE(), SKEWNESS(), KURTOSIS()
++;
++if KEYWORD_SET(verbose) then begin
++   txt1='dimension keyword is available in MOMENT() and related codes:'
++   txt2='MEAN(), STDDEV(), VARIANCE(), SKEWNESS(), KURTOSIS()'
++endif
++;
++DEFSYSV, '!gdl', exists=isGDL
++;
++check_dim=0
++;
++if (isGDL) then begin
++   check_dim=1
++   if KEYWORD_SET(verbose) then begin
++      MESSAGE,/cont, 'in GDL, '+txt1
++      MESSAGE,/cont, txt2
++   endif
++endif else begin
++   ;; when IDL, which major version ? we assume "." is the separator !
++   version=!version.release
++   if (FIX(STRMID(version,0, STRPOS(version,'.'))) GE 8) then check_dim=1
++   if KEYWORD_SET(verbose) then begin
++      if (check_dim EQ 0) then begin
++         MESSAGE,/cont, 'in IDL, before 8.0, dimension keyword not available !'
++      endif else begin
++         MESSAGE,/cont, 'in IDL, since 8.0, '+txt1
++         MESSAGE,/cont, txt2
++      endelse
++   endif
++endelse
++;
++return, check_dim
++;
++end
++;
++; -------------------------------------------------------------
++;
++pro CHECK_VISUAL_MOMENT, data, force_dim=force_dim, no_exit=no_exit, $
++                         help=help, test=test, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++   print, 'pro CHECK_VISUAL_MOMENT, data, force_dim=force_dim, no_exit=no_exit, $'
++   print, '                         help=help, test=test, verbose=verbose'
++   return
++endif
++;
++; do we have the dimension keyword capability ?
++;
++if ~KEYWORD_SET(force_dim) then begin
++   check_dim=CHECK_DIMENSION_CAPABILITY()
++endif else check_dim=1
++;
++if (check_dim EQ 0) then begin
++   MESSAGE, 'this test requires Dimension keyword capability'
++endif
++;
++if N_PARAMS() EQ 0 then data=DIST(115, 128)
++;
++nb_nan=N_ELEMENTS(data)/10
++pos=FIX(RANDOMU(seed,nb_nan)*N_ELEMENTS(data))
++data_NaN=data
++data_NaN[pos]=!values.f_nan
++;
++for ii=0,1 do begin
++   if ii EQ 0 then begin
++      tmp=data 
++      title='no NaN'
++   endif else begin
++      tmp=data_NaN
++      title='with 10% NaN'
++   endelse
++   WINDOW, ii, xsize=400, ysize=750, title=title
++   !p.multi=[0,2,4]
++   ;;
++   plot, MEAN(tmp, dim=1,/nan), title='MEAN, dim=1'
++   plot, MEAN(tmp, dim=2,/nan), title='MEAN, dim=1'
++   plot, STDDEV(tmp, dim=1,/nan), title='STDDEV, dim=1'
++   plot, STDDEV(tmp, dim=2,/nan), title='STDDEV, dim=2'
++   plot, SKEWNESS(tmp, dim=1,/nan), title='SKEWNESS, dim=1'
++   plot, SKEWNESS(tmp, dim=2,/nan), title='SKEWNESS, dim=2'
++   plot, KURTOSIS(tmp, dim=1,/nan), title='KURTOSIS, dim=1'
++   plot, KURTOSIS(tmp, dim=2,/nan), title='KURTOSIS, dim=2'
++endfor
++;
++!p.multi=0
++;
++end
++;
++pro TEST_NUMERICAL_MOMENT, force_dim=force_dim, no_exit=no_exit, $
++                           help=help, test=test, verbose=verbose
++;
++if KEYWORD_SET(help) then begin
++    print, 'pro TEST_NUMERICAL_MOMENT, force_dim=force_dim, no_exit=no_exit, $'
++    print, '                           help=help, test=test, verbose=verbose'
++    return
++endif
++;
++; do we have the dimension keyword capability ?
++;
++if ~KEYWORD_SET(force_dim) then begin
++   check_dim=CHECK_DIMENSION_CAPABILITY(/verbose)
++endif else check_dim=1
+ ;
+ nb_pb=0
+ ;
+@@ -27,13 +142,67 @@
+ e2=ERREUR(expected_resu2, resu2)
+ if (e2 GT 1e-5) then nb_pb=nb_pb+1
+ ;
+-if KEYWORD_SET(test) then STOP
++; -----
++;
++a=FINDGEN(3, 2, 3)^2
++expected_resu3=[[[60.0000, 73.0000, 88.0000], $
++                 [105.000, 124.000, 145.000]], $
++                [[5616.00, 7488.00, 9648.00], $
++                 [12096.0, 14832.0, 17856.0]], $
++                [[0.287409, 0.256015, 0.229751], $
++                 [0.207827, 0.189413, 0.173812]], $
++                [[-2.33333, -2.33333, -2.33333], $
++                 [-2.33333, -2.33333, -2.33333]]]
++if (check_dim) then begin
++    resu3=MOMENT(a, DIMENSION=3)
++    e3=ERREUR(expected_resu3, resu3)
++    if (e3 GT 1e-5) then nb_pb=nb_pb+1
++endif else MESSAGE, /continue, 'skipping /DIM test'
++;
++; -----
++;
++a=[1,4,5,!VALUES.F_NAN]
++expected_resu4=[3.33333, 4.33333, -0.28741, -2.33333]
++resu4=MOMENT(a, /NAN)
++e4=ERREUR(expected_resu4, resu4)
++if (e4 GT 1e-5) then nb_pb=nb_pb+1
++;
++; -----
++;
++a=[[1,4,5,!VALUES.F_NAN],[6,8,!VALUES.F_NAN, 9]]
++expected_resu5=[[3.33333,7.66667], $
++                [4.33333,2.33333],[-0.28741,-0.20783], $
++                [-2.33333,-2.33333]]
++if (check_dim) then begin
++    resu5=MOMENT(a, DIMENSION=1, /NAN)
++    e5=ERREUR(expected_resu5, resu5)
++    if (e5 GT 1e-5) then nb_pb=nb_pb+1
++endif else MESSAGE, /continue, 'skipping /DIM test'
++;
++; -----------------
+ ;
+ if (nb_pb EQ 0) then begin 
+    MESSAGE, 'No problem found in TEST_MOMENT', /continue
+ endif else begin
+    MESSAGE, STRING(nb_pb)+' problem(s) found in TEST_MOMENT', /continue
+-   EXIT, status=1
+ endelse
+ ;
++if KEYWORD_SET(test) then STOP
++;
++if (nb_pb GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++end
++;
++; ------------------------------------
++;
++pro TEST_MOMENT, force_dim=force_dim, $
++                 help=help, test=test, no_exit=no_exit, verbose=verbose
++;
++TEST_NUMERICAL_MOMENT, force_dim=force_dim, help=help, $
++                       test=test, no_exit=no_exit, verbose=verbose
++;
++CHECK_VISUAL_MOMENT, force_dim=force_dim, help=help, $
++                     test=test, no_exit=no_exit, verbose=verbose
++;
+ end
++
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_mpfit.pro gdl/testsuite/test_mpfit.pro
 --- gdl-0.9.2/testsuite/test_mpfit.pro	2010-10-26 16:30:15.000000000 -0600
-+++ gdl/testsuite/test_mpfit.pro	2012-02-21 09:54:37.871859017 -0700
++++ gdl/testsuite/test_mpfit.pro	2011-11-16 15:32:57.000000000 -0700
 @@ -6,6 +6,12 @@
  ; AC 26/10/2010: better managment of error when CMSV lib. or MPFIT
  ; lib. are not in the path ...
@@ -48292,7 +53754,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_mpfit.pro gdl/testsuite/test_mp
  RESTORE, datafile
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_plotting_ranges.pro gdl/testsuite/test_plotting_ranges.pro
 --- gdl-0.9.2/testsuite/test_plotting_ranges.pro	2011-07-03 06:52:03.000000000 -0600
-+++ gdl/testsuite/test_plotting_ranges.pro	2012-02-21 09:54:37.893858219 -0700
++++ gdl/testsuite/test_plotting_ranges.pro	2012-01-26 16:18:51.000000000 -0700
 @@ -15,12 +15,11 @@
  
    print, '2'
@@ -48312,7 +53774,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_plotting_ranges.pro gdl/testsui
  
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_poly2d.pro gdl/testsuite/test_poly2d.pro
 --- gdl-0.9.2/testsuite/test_poly2d.pro	2009-11-24 09:44:13.000000000 -0700
-+++ gdl/testsuite/test_poly2d.pro	2012-02-21 09:54:37.912857529 -0700
++++ gdl/testsuite/test_poly2d.pro	2012-01-23 09:51:41.000000000 -0700
 @@ -1,4 +1,14 @@
 -pro test_poly2d
 +;
@@ -48641,7 +54103,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_poly2d.pro gdl/testsuite/test_p
 +end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_postscript.pro gdl/testsuite/test_postscript.pro
 --- gdl-0.9.2/testsuite/test_postscript.pro	2011-08-30 02:37:21.000000000 -0600
-+++ gdl/testsuite/test_postscript.pro	2012-02-21 09:54:37.914857457 -0700
++++ gdl/testsuite/test_postscript.pro	2011-12-29 18:10:47.000000000 -0700
 @@ -3,7 +3,35 @@
  ;
  ; Alain Coulais 23/08/2011
@@ -48700,7 +54162,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_postscript.pro gdl/testsuite/te
 +
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_ps_decomposed.pro gdl/testsuite/test_ps_decomposed.pro
 --- gdl-0.9.2/testsuite/test_ps_decomposed.pro	2011-10-29 03:55:16.000000000 -0600
-+++ gdl/testsuite/test_ps_decomposed.pro	2012-02-21 09:54:37.933856768 -0700
++++ gdl/testsuite/test_ps_decomposed.pro	2011-12-29 18:10:47.000000000 -0700
 @@ -5,7 +5,7 @@
  ; this code was failing on a computer with "bad" locale (fr_FR.utf8)
  ;
@@ -48876,50 +54338,178 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_qromb.pro gdl/testsuite/test_qr
 +end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_qromo.pro gdl/testsuite/test_qromo.pro
 --- gdl-0.9.2/testsuite/test_qromo.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/testsuite/test_qromo.pro	2012-01-22 15:59:29.000000000 -0700
-@@ -0,0 +1,39 @@
++++ gdl/testsuite/test_qromo.pro	2012-06-19 04:17:43.000000000 -0600
+@@ -0,0 +1,167 @@
 +;
 +; under GNU GPL v2 or later
 +; Alain Coulais, 20-Jan-2012
++; Mathieu Pinter, 12-June-2012
 +; 
 +; -------------------------------------------------
 +;
-+; to be extend ...
++; We compare the output from QROMO with exact values on
++; well know integrales.
++; We also check that the dimensions of the outputs are OK
 +;
++; You can also provide a known function TOTO but also TOTO_INTEGRAL ...
 +; -------------------------------------------------
 +;
-+;
 +; http://www.mathcurve.com/courbes2d/agnesi/agnesi.shtml
 +function AGNESI_SQUARE, x
 +common agnesi_param, a
 +return, (a^3/(a^2+x^2))^2
 +end
 +;
-+pro TEST_QROMO_ON_AGNESI, value, param
++pro TEST_QROMO_ON_AGNESI, cumul=cumul, no_exit=no_exit, test=test, verbose=verbose
 +;
 +common agnesi_param, a
-+if N_ELEMENTS(param) EQ 0 then a=1. else a=param[0]
 +;
-+if N_ELEMENTS(param) EQ 0 then debut=2.0 else debut=value[0]
++a=1.
++debut=2.0
++fin=1.
++fin2=12.
 +;
-+; hum, not all is solved in QROMO :((
++expected1=0.031382
++expected2=0.6427
++expected3=0.14251
 +;
-+print, 'infinite integration:'
-+DEFSYSV, '!gdl', exists=isGDL
-+if ~isGDL then print, QROMO('AGNESI_SQUARE', debut, /MIDEXP)
-+if isGDL then print, QROMO('AGNESI_SQUARE', debut, 0., /MIDEXP)
++comp1=QROMO('AGNESI_SQUARE', debut, /MIDEXP)
++comp2=QROMO('AGNESI_SQUARE', 0, fin)
++comp3=QROMO('AGNESI_SQUARE', fin, fin2)
++;
++eps=1e-3
++;
++nb_errors=0
++if (ABS(expected1-comp1) GT eps) then nb_errors=nb_errors+1
++if (ABS(expected2-comp2) GT eps) then nb_errors=nb_errors+1
++if (ABS(expected3-comp3) GT eps) then nb_errors=nb_errors+1
++;
++if KEYWORD_SET(verbose) then begin
++    print, 'AGNESI_SQUARE espec/comp/err: ', expected1, comp1, expected1-comp1
++    print, 'AGNESI_SQUARE espec/comp/err: ', expected2, comp2, expected2-comp2
++    print, 'AGNESI_SQUARE espec/comp/err: ', expected3, comp3, expected3-comp3
++endif
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, /continue, STRING(nb_errors)+' Numerical Errors founded'
++endif else begin
++    MESSAGE, /continue, 'No Numerical Errors founded'
++endelse
++;
++if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++if ARG_PRESENT(cumul) then begin
++    if KEYWORD_SET(cumul) then cumul=cumul+nb_errors else cumul=nb_errors
++endif
++;
++if KEYWORD_set(test) then STOP
++;
++end
++;
++; -------------------------------
++;
++function EXPON, x
++return, exp(-x)
++end
++;
++function EXPON_INTEGRAL, x
++return, -exp(-x)
++end
++;
++function INV, x
++return, 1/(1+x^2)+exp(-x)
++end
++;
++function INV_INTEGRAL, x
++return, atan(x)-exp(-x)
++end
++;
++; -------------------------------
++;
++pro TEST_QROMO_DIM, function_name=function_name, cumul=cumul, $
++                    no_exit=no_exit, test=test, verbose=verbose
++;
++debut=1.0
++fin=2.0
++infini=1.0e30
++;
++if (N_ELEMENTS(eps) EQ 0) then eps=1e-6
++nb_errors=0
++;
++resuQR=QROMO(function_name, debut, fin, JMAX=7)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, fin, /MIDPNT)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, /MIDEXP)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', infini)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
 +;
-+print, 'finite integration:'
-+print, QROMO('AGNESI_SQUARE', debut, 4.)
++resuQR=QROMO(function_name, debut, fin, /DOUBLE)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, /MIDEXP, EPS=1e-13)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', infini)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, fin, /MIDINF)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, fin, /MIDSQL)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, fin, /MIDSQU)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++resuQR=QROMO(function_name, debut, fin, K=6)
++resuIN=CALL_FUNCTION(function_name+'_INTEGRAL', fin)-CALL_FUNCTION(function_name+'_INTEGRAL', debut)
++if TOTAL((resuQR-resuIN)^2) GT eps then nb_errors=nb_errors+1
++;
++if (nb_errors GT 0) then begin
++    MESSAGE, /continue, STRING(nb_errors)+' Errors founded'
++endif else begin
++    MESSAGE, /continue, 'function ' + function_name + ': No Errors founded'
++endelse
++;
++if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
++;
++if ARG_PRESENT(cumul) then begin
++    if KEYWORD_SET(cumeul) then cumul=cumul+nb_errors else cumul=nb_errors
++endif
++;
++if KEYWORD_SET(test) then STOP
 +;
 +end
 +;
++; ----------------------------------
++;
 +pro TEST_QROMO
-+TEST_QROMO_ON_AGNESI
++;
++cumul=0
++;
++TEST_QROMO_DIM, function_name='EXPON', cumul=cumul, /no_exit
++TEST_QROMO_DIM, function_name='INV', cumul=cumul, /no_exit
++;
++TEST_QROMO_ON_AGNESI, cumul=cumul, /no_exit
++;
++if (cumul GT 0) then begin
++    MESSAGE, /continue, STRING(cumul)+' Errors founded'
++    EXIT, status=1
++endif else begin
++    MESSAGE, /continue, 'No Errors founded'
++endelse
++;
 +end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_random.pro gdl/testsuite/test_random.pro
 --- gdl-0.9.2/testsuite/test_random.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/testsuite/test_random.pro	2012-05-10 15:10:06.905415829 -0600
++++ gdl/testsuite/test_random.pro	2012-04-13 15:10:27.000000000 -0600
 @@ -0,0 +1,68 @@
 +;
 +; Alain Coulais, 5 Janvier 2011, under GNU GPL v2 or later
@@ -48991,7 +54581,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_random.pro gdl/testsuite/test_r
 +
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test-read_ascii.pro gdl/testsuite/test-read_ascii.pro
 --- gdl-0.9.2/testsuite/test-read_ascii.pro	2011-06-07 10:45:42.000000000 -0600
-+++ gdl/testsuite/test-read_ascii.pro	2012-02-21 09:54:37.598868924 -0700
++++ gdl/testsuite/test-read_ascii.pro	2011-11-15 17:49:34.000000000 -0700
 @@ -1,14 +1,14 @@
  ;
  ; Script : test-read_ascii
@@ -49069,7 +54659,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test-read_ascii.pro gdl/testsuite/te
  end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_read_jpeg.pro gdl/testsuite/test_read_jpeg.pro
 --- gdl-0.9.2/testsuite/test_read_jpeg.pro	2010-04-14 09:07:58.000000000 -0600
-+++ gdl/testsuite/test_read_jpeg.pro	2012-02-21 09:54:37.966855569 -0700
++++ gdl/testsuite/test_read_jpeg.pro	2012-01-24 02:11:39.000000000 -0700
 @@ -6,8 +6,9 @@
  ; What is tested ?
  ; -- reading back a small (600x259) JPEG image
@@ -49110,7 +54700,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_read_jpeg.pro gdl/testsuite/tes
  end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_read_standard_images.pro gdl/testsuite/test_read_standard_images.pro
 --- gdl-0.9.2/testsuite/test_read_standard_images.pro	1969-12-31 17:00:00.000000000 -0700
-+++ gdl/testsuite/test_read_standard_images.pro	2012-05-10 15:10:06.917415396 -0600
++++ gdl/testsuite/test_read_standard_images.pro	2012-05-09 18:10:52.000000000 -0600
 @@ -0,0 +1,435 @@
 +;
 +; AC, 5-Feb-2012
@@ -49549,7 +55139,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_read_standard_images.pro gdl/te
 +end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_smooth.pro gdl/testsuite/test_smooth.pro
 --- gdl-0.9.2/testsuite/test_smooth.pro	2006-10-05 17:42:30.000000000 -0600
-+++ gdl/testsuite/test_smooth.pro	2012-05-10 15:10:06.921415253 -0600
++++ gdl/testsuite/test_smooth.pro	2012-05-08 03:48:44.000000000 -0600
 @@ -1,9 +1,112 @@
  ;
 -; ARSC 13/07/2006
@@ -49770,7 +55360,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_standardize.pro gdl/testsuite/t
 +
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_str_functions.pro gdl/testsuite/test_str_functions.pro
 --- gdl-0.9.2/testsuite/test_str_functions.pro	2010-04-16 08:41:32.000000000 -0600
-+++ gdl/testsuite/test_str_functions.pro	2012-02-21 09:54:38.001854301 -0700
++++ gdl/testsuite/test_str_functions.pro	2011-11-29 04:04:20.000000000 -0700
 @@ -3,6 +3,10 @@
  ;
  ; Few basic tests on functions working on Strings
@@ -49872,6 +55462,37 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_strmatch.pro gdl/testsuite/test
 +  err += ~array_equal(strmatch(['gdl', 'GDL'], 'gdl'), [1,0])
 +  if err ne 0 then exit, status=1
 +end
+diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_strsplit.pro gdl/testsuite/test_strsplit.pro
+--- gdl-0.9.2/testsuite/test_strsplit.pro	2011-08-19 06:38:14.000000000 -0600
++++ gdl/testsuite/test_strsplit.pro	2012-07-11 07:55:34.000000000 -0600
+@@ -244,6 +244,27 @@
+    nb_pbs=nb_pbs+1
+ endif
+ ;
++; we must return a STRARR except for ''
++;
++tab=STRSPLIT('eeee','e',/extract)
++if (SIZE(tab, /n_dim) NE 0) then begin
++   if KEYWORD_SET(verbose) then MESSAGE, 'bad size for void string', /continue
++   nb_pbs=nb_pbs+1
++endif
++tab=STRSPLIT('eeABCee','e',/extract)
++if (SIZE(tab, /n_dim) NE 1) then begin
++   if KEYWORD_SET(verbose) then MESSAGE, 'bad size for 1D STRARR', /continue
++   nb_pbs=nb_pbs+1
++endif
++if (tab NE 'ABC') then begin
++   if KEYWORD_SET(verbose) then MESSAGE, 'bad value in STRARR', /continue
++   nb_pbs=nb_pbs+1
++endif
++tab=STRSPLIT('eeABCeeABCee','e',/extract)
++if (SIZE(tab, /n_dim) NE 1) then begin
++   if KEYWORD_SET(verbose) then MESSAGE, 'bad size for 2 elements STRARR', /continue
++   nb_pbs=nb_pbs+1
++endif
+ ;
+ vide=''
+ if (EXECUTE('res=TEXTOIDL(vide)') EQ 0) then begin
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_trisol.pro gdl/testsuite/test_trisol.pro
 --- gdl-0.9.2/testsuite/test_trisol.pro	1969-12-31 17:00:00.000000000 -0700
 +++ gdl/testsuite/test_trisol.pro	2012-02-03 08:11:48.000000000 -0700
@@ -50052,7 +55673,7 @@ diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_usersym.pro gdl/testsuite/test_
 +end
 diff -ruN --exclude CVS gdl-0.9.2/testsuite/test_zip.pro gdl/testsuite/test_zip.pro
 --- gdl-0.9.2/testsuite/test_zip.pro	2010-06-29 03:20:57.000000000 -0600
-+++ gdl/testsuite/test_zip.pro	2012-05-15 12:11:39.267530203 -0600
++++ gdl/testsuite/test_zip.pro	2012-05-14 08:22:35.000000000 -0600
 @@ -3,124 +3,216 @@
  ;
  ; Maxime Lenoir, June 2010
diff --git a/gdl.spec b/gdl.spec
index 7e1c4f6..f63e18f 100644
--- a/gdl.spec
+++ b/gdl.spec
@@ -2,7 +2,7 @@
 
 Name:           gdl
 Version:        0.9.2
-Release:        6.cvs20120515%{?dist}
+Release:        7.cvs20120716%{?dist}
 Summary:        GNU Data Language
 
 Group:          Applications/Engineering
@@ -180,6 +180,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon Jul 16 2012 Orion Poplawski <orion at cora.nwra.com> - 0.9.2-7.cvs20120716
+- Update to current cvs
+
 * Tue May 15 2012 Orion Poplawski <orion at cora.nwra.com> - 0.9.2-6.cvs20120515
 - Update to current cvs
 - Add patch for testsuite make check to work in build directory


More information about the scm-commits mailing list