From b55b34f78a602964d0e4d106a7e8982c4c4273b1 Mon Sep 17 00:00:00 2001
From: Orion Poplawski
Date: Jun 03 2010 15:10:46 +0000
Subject: - Update to today's cvs
- Drop GLDLexer and python patches
- BR antlr-C++ on Fedora 14+
---
diff --git a/gdl-0.9rc4-GDLLexer.patch b/gdl-0.9rc4-GDLLexer.patch
deleted file mode 100644
index be0cb25..0000000
--- a/gdl-0.9rc4-GDLLexer.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- gdl-0.9rc4/src/widget.cpp.GDLLexer 2010-02-02 11:13:51.000000000 -0700
-+++ gdl-0.9rc4/src/widget.cpp 2010-02-04 08:41:11.835418064 -0700
-@@ -589,7 +589,7 @@
-
- RefDNode theAST;
-
-- GDLLexer lexer(istr, "");
-+ GDLLexer lexer(istr, "", GDLParser::NONE);
- GDLParser& parser = lexer.Parser();
- parser.interactive();
-
diff --git a/gdl-0.9rc4-cvs.patch b/gdl-0.9rc4-cvs.patch
new file mode 100644
index 0000000..c2af6d0
--- /dev/null
+++ b/gdl-0.9rc4-cvs.patch
@@ -0,0 +1,52158 @@
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/config.h.in cvs/gdl/config.h.in
+--- gdl-0.9rc4/config.h.in 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/config.h.in 2010-05-21 10:23:52.639905982 -0600
+@@ -12,6 +12,9 @@
+ /* Define to 1 if you have the header file. */
+ #undef HAVE_DLFCN_H
+
++/* Define to 1 if you have the header file. */
++#undef HAVE_GSHHS_H
++
+ /* Define to 1 if you have the header file. */
+ #undef HAVE_INTTYPES_H
+
+@@ -136,6 +139,9 @@
+ /* Define if you want to use GRIB */
+ #undef USE_GRIB
+
++/* Define if you want to use GSHHS */
++#undef USE_GSHHS
++
+ /* Define if you want to use HDF */
+ #undef USE_HDF
+
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/configure cvs/gdl/configure
+--- gdl-0.9rc4/configure 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/configure 2010-04-16 11:22:42.000000000 -0600
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.65 for gdl 0.9rc4.
++# Generated by GNU Autoconf 2.65 for gdl 0.9rc4 CVS.
+ #
+ #
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+@@ -698,8 +698,8 @@
+ # Identity of this package.
+ PACKAGE_NAME='gdl'
+ PACKAGE_TARNAME='gdl'
+-PACKAGE_VERSION='0.9rc4'
+-PACKAGE_STRING='gdl 0.9rc4'
++PACKAGE_VERSION='0.9rc4 CVS'
++PACKAGE_STRING='gdl 0.9rc4 CVS'
+ PACKAGE_BUGREPORT=''
+ PACKAGE_URL=''
+
+@@ -1455,7 +1455,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
+-\`configure' configures gdl 0.9rc4 to adapt to many kinds of systems.
++\`configure' configures gdl 0.9rc4 CVS to adapt to many kinds of systems.
+
+ Usage: $0 [OPTION]... [VAR=VALUE]...
+
+@@ -1529,7 +1529,7 @@
+
+ if test -n "$ac_init_help"; then
+ case $ac_init_help in
+- short | recursive ) echo "Configuration of gdl 0.9rc4:";;
++ short | recursive ) echo "Configuration of gdl 0.9rc4 CVS:";;
+ esac
+ cat <<\_ACEOF
+
+@@ -1653,7 +1653,7 @@
+ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+-gdl configure 0.9rc4
++gdl configure 0.9rc4 CVS
+ generated by GNU Autoconf 2.65
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+@@ -2237,7 +2237,7 @@
+ This file contains any messages produced by compilers while
+ running configure, to aid debugging if configure makes a mistake.
+
+-It was created by gdl $as_me 0.9rc4, which was
++It was created by gdl $as_me 0.9rc4 CVS, which was
+ generated by GNU Autoconf 2.65. Invocation command line was
+
+ $ $0 $@
+@@ -2597,7 +2597,7 @@
+ 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
+-if test "x$with_fftw" = "x"; then with_fftw=no; fi
++if test "x$with_fftw" = "x"; then with_fftw=auto; fi
+ if test "x$with_libproj4" = "x"; then with_libproj4=no; fi
+ if test "x$with_mpich" = "x"; then with_mpich=no; fi
+ if test "x$with_python" = "x"; then with_python=yes; fi
+@@ -3068,7 +3068,7 @@
+
+ # Define the identity of the package.
+ PACKAGE='gdl'
+- VERSION='0.9rc4'
++ VERSION='0.9rc4 CVS'
+
+
+ cat >>confdefs.h <<_ACEOF
+@@ -14579,6 +14579,66 @@
+ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
++$as_echo_n "checking for library containing dlopen... " >&6; }
++if test "${ac_cv_search_dlopen+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_func_search_save_LIBS=$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 dlopen ();
++int
++main ()
++{
++return dlopen ();
++ ;
++ return 0;
++}
++_ACEOF
++for ac_lib in '' dl; do
++ if test -z "$ac_lib"; then
++ ac_res="none required"
++ else
++ ac_res=-l$ac_lib
++ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
++ fi
++ if ac_fn_cxx_try_link "$LINENO"; then :
++ ac_cv_search_dlopen=$ac_res
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext
++ if test "${ac_cv_search_dlopen+set}" = set; then :
++ break
++fi
++done
++if test "${ac_cv_search_dlopen+set}" = set; then :
++
++else
++ ac_cv_search_dlopen=no
++fi
++rm conftest.$ac_ext
++LIBS=$ac_func_search_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
++$as_echo "$ac_cv_search_dlopen" >&6; }
++ac_res=$ac_cv_search_dlopen
++if test "$ac_res" != no; then :
++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
++
++fi
++
++if test x"$ac_cv_search_dlopen" = x-ldl; then
++LIBS="$LIBS -ldl"
++fi
++
+
+ # Check whether --enable-python_module was given.
+ if test "${enable_python_module+set}" = set; then :
+@@ -14962,6 +15022,7 @@
+ fi
+
+
++openmp_autodetected=no
+ if test "x$with_openmp" = "x"; then
+ for ac_header in "omp.h"
+ do :
+@@ -14974,11 +15035,10 @@
+ _ACEOF
+
+ with_openmp=yes
++ openmp_autodetected=yes
+ echo ""
+ echo "OpenMP enabled (omp.h file was found)."
+ echo "Try --with-openmp=no if your compiler does not support it (e.g. GCC < 4.2)"
+- echo "The warnings about unsigned iteration variable can be ignored."
+- echo "See the README for details."
+ echo ""
+
+ else
+@@ -15170,6 +15230,7 @@
+ LIBS="$LIBS -lplplotd -lplplotcxxd"
+ fi
+
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for plsexit in -lplplotcxxd" >&5
+ $as_echo_n "checking for plsexit in -lplplotcxxd... " >&6; }
+ if test "${ac_cv_lib_plplotcxxd_plsexit+set}" = set; then :
+@@ -15824,7 +15885,7 @@
+ echo " Use --with-Magick=DIR to specify the ImageMagick directory tree"
+ echo " Use --with-Magick=no to not use it"
+ echo " Check the README or use configure --help for other libraries needed"
+- echo " (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
++ echo " (--with-xxxdir = mandatory, --with-xxx = optional (--with-xxx=no to disable))"
+ exit -1
+
+ fi
+@@ -16422,6 +16483,99 @@
+ fi
+
+
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw_malloc in -lfftw3" >&5
++$as_echo_n "checking for fftw_malloc in -lfftw3... " >&6; }
++if test "${ac_cv_lib_fftw3_fftw_malloc+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_check_lib_save_LIBS=$LIBS
++LIBS="-lfftw3 $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 fftw_malloc ();
++int
++main ()
++{
++return fftw_malloc ();
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++ ac_cv_lib_fftw3_fftw_malloc=yes
++else
++ ac_cv_lib_fftw3_fftw_malloc=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_fftw3_fftw_malloc" >&5
++$as_echo "$ac_cv_lib_fftw3_fftw_malloc" >&6; }
++if test "x$ac_cv_lib_fftw3_fftw_malloc" = x""yes; then :
++
++
++else
++
++if test "x$with_fftw" = "xauto"; then with_fftw=no; fi
++
++fi
++
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftwf_malloc in -lfftw3f" >&5
++$as_echo_n "checking for fftwf_malloc in -lfftw3f... " >&6; }
++if test "${ac_cv_lib_fftw3f_fftwf_malloc+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ ac_check_lib_save_LIBS=$LIBS
++LIBS="-lfftw3f $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 fftwf_malloc ();
++int
++main ()
++{
++return fftwf_malloc ();
++ ;
++ return 0;
++}
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++ ac_cv_lib_fftw3f_fftwf_malloc=yes
++else
++ ac_cv_lib_fftw3f_fftwf_malloc=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_fftw3f_fftwf_malloc" >&5
++$as_echo "$ac_cv_lib_fftw3f_fftwf_malloc" >&6; }
++if test "x$ac_cv_lib_fftw3f_fftwf_malloc" = x""yes; then :
++
++if test "x$with_fftw" = "xauto"; then with_fftw=yes; fi
++
++else
++
++if test "x$with_fftw" = "xauto"; then with_fftw=no; fi
++
++fi
++
++
+
+ # Check whether --with-fftw was given.
+ if test "${with_fftw+set}" = set; then :
+@@ -17174,6 +17328,10 @@
+ LIBS="$LIBS -lsocket -lnsl"
+ ;;
+
++ *cygwin* )
++ LIBS="$LIBS -lrpc"
++ ;;
++
+ esac
+
+ case "${host}" in
+@@ -17794,7 +17952,7 @@
+ # report actual input values of CONFIG_FILES etc. instead of their
+ # values after options handling.
+ ac_log="
+-This file was extended by gdl $as_me 0.9rc4, which was
++This file was extended by gdl $as_me 0.9rc4 CVS, which was
+ generated by GNU Autoconf 2.65. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+@@ -17860,7 +18018,7 @@
+ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ ac_cs_version="\\
+-gdl config.status 0.9rc4
++gdl config.status 0.9rc4 CVS
+ configured by $0, generated by GNU Autoconf 2.65,
+ with options \\"\$ac_cs_config\\"
+
+@@ -19872,7 +20030,9 @@
+ Installation prefix: $prefix
+ C++ compiler: $CXX $CXXFLAGS
+ OpenMP support: `if test "x$with_openmp" = "xno";
+- then echo 'no'; else echo 'yes (use --with-openmp=no if your compiler does not support it)'; fi`
++ then echo 'no'; else echo 'yes'; fi`
++ Build type: `if test "x$PYTHON_MODULE" = "xyes";
++ then echo 'library (Python module)'; else echo 'standalone (other: Python module)'; fi`
+ ----- optional libraries (consult README/INSTALL): ---
+ wxWidgets: `if test no = $with_wxWidgets;
+ then echo 'no (needs explicit enabling)'; else echo yes; fi`
+@@ -19902,6 +20062,12 @@
+ - SAVE and RESTORE procedures require *.pro files from
+ the CMSVLIB package (see README for details)
+ ------------------------------------------------------
++`if test yes = $openmp_autodetected; then
++ echo '----- note on OpenMP support -------------------------'
++ echo ' OpenMP was autodetected, use --with-openmp=no if your'
++ echo ' compiler does not support it (e.g. GCC < 4.2)'
++ echo '------------------------------------------------------'; fi`
+ use 'make' to build and 'make install' to install GDL
++ (optional 'make check' tests the build - experimental)
+ "
+
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/configure.in cvs/gdl/configure.in
+--- gdl-0.9rc4/configure.in 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/configure.in 2010-04-22 09:50:39.000000000 -0600
+@@ -1,4 +1,4 @@
+-AC_INIT(gdl, 0.9rc4)
++AC_INIT(gdl, 0.9rc4 CVS)
+ AC_CONFIG_MACRO_DIR([m4])
+
+ dnl == Configuration (of the configure script) ============
+@@ -18,10 +18,11 @@
+ 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
+-if test "x$with_fftw" = "x"; then with_fftw=no; fi
++if test "x$with_fftw" = "x"; then with_fftw=auto; fi
+ if test "x$with_libproj4" = "x"; then with_libproj4=no; fi
+ if test "x$with_mpich" = "x"; then with_mpich=no; fi
+ if test "x$with_python" = "x"; then with_python=yes; fi
++if test "x$with_gshhs" = "x"; then with_gshhs=no; fi
+
+ dnl default DATADIR subdirectory
+ datasubdir="gnudatalanguage"
+@@ -52,6 +53,11 @@
+ AC_SUBST(HAVE_64BIT_OS)
+ AC_LANG_RESTORE
+
++AC_SEARCH_LIBS([dlopen], [dl])
++if test x"$ac_cv_search_dlopen" = x-ldl; then
++LIBS="$LIBS -ldl"
++fi
++
+ dnl == Python module (calling GDL from Python) =============
+ dnl ========================================================
+
+@@ -183,14 +189,14 @@
+ [with_openmp="$withval" ])
+
+ dnl default yes if omp.h found
++openmp_autodetected=no
+ if test "x$with_openmp" = "x"; then
+ AC_CHECK_HEADERS("omp.h", [
+ with_openmp=yes
++ openmp_autodetected=yes
+ echo ""
+ echo "OpenMP enabled (omp.h file was found)."
+ echo "Try --with-openmp=no if your compiler does not support it (e.g. GCC < 4.2)"
+- echo "The warnings about unsigned iteration variable can be ignored."
+- echo "See the README for details."
+ echo ""
+ ], [
+ with_openmp=no
+@@ -288,6 +294,8 @@
+ LIBS="$LIBS -lplplotd -lplplotcxxd"
+ fi
+
++dnl LIBS="$LIBS /usr/local/lib/libplplotd.a /usr/local/lib/libplplotcxxd.a"
++
+ AC_CHECK_LIB(plplotcxxd, plsexit, [AC_DEFINE([HAVE_LIBPLPLOTCXXD], [1], [plplot library])],
+ [
+ echo ""
+@@ -296,6 +304,20 @@
+ exit -1
+ ])
+
++if test "x$with_Magick" != "xno"; then
++ # https://sourceforge.net/tracker/index.php?func=detail&aid=2974380&group_id=97659&atid=618683
++ AC_CHECK_LIB(plplotd, plGetDrvDir, [
++ echo ""
++ echo "Warning! Dynamic drivers have to be disabled in plplot"
++ echo " to make plplot work with ImageMagic:"
++ echo " - use the -DENABLE_DYNDRIVERS=OFF cmake option when"
++ echo " compiling plplot to disable dynamic drivers in plplot, or"
++ echo " - use --with-Magick=no here to not use ImageMagick in GDL."
++ echo ""
++ ])
++fi
++
++
+ dnl == wxWidgets ===========================================
+ dnl ========================================================
+
+@@ -380,7 +402,7 @@
+ echo " Use --with-Magick=DIR to specify the ImageMagick directory tree"
+ echo " Use --with-Magick=no to not use it"
+ echo " Check the README or use configure --help for other libraries needed"
+- echo " (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
++ echo " (--with-xxxdir = mandatory, --with-xxx = optional (--with-xxx=no to disable))"
+ exit -1
+ ])
+ ]
+@@ -547,6 +569,18 @@
+ dnl == FFTW ================================================
+ dnl ========================================================
+
++AC_CHECK_LIB(fftw3, fftw_malloc, [
++dnl do nothing
++], [
++if test "x$with_fftw" = "xauto"; then with_fftw=no; fi
++])
++
++AC_CHECK_LIB(fftw3f, fftwf_malloc, [
++if test "x$with_fftw" = "xauto"; then with_fftw=yes; fi
++], [
++if test "x$with_fftw" = "xauto"; then with_fftw=no; fi
++])
++
+ AC_ARG_WITH(fftw,
+ [ --with-fftw[=DIR] use FFTW package (with optional path DIR) ],
+ [with_fftw="$withval" ])
+@@ -832,6 +866,32 @@
+
+ fi
+
++dnl == GSHHS ===============================================
++dnl ========================================================
++
++AC_ARG_WITH(gshhs,
++ [ --with-gshhs[=DIR] use GSHHS package (with optional path DIR) ],
++ [with_gshhs="$withval" ])
++
++if test "x$with_gshhs" != "xno"; then
++ if test "x$with_gshhs" != "xyes"; then
++ INCLUDES="$INCLUDES -I$with_gshhs/include"
++ fi
++
++ AC_CHECK_HEADERS(gshhs.h, [
++ AC_DEFINE([USE_GSHHS], [1], [Define if you want to use GSHHS])
++ ], [
++ echo ""
++ echo "Error! GSHHS is required but gshhs.h was not found"
++ echo " Use --with-gshhs=DIR to specify the GSHHS directory tree"
++ echo " Use --with-gshhs=no to not use it"
++ echo " Check the README or use configure --help for other libraries needed"
++ echo " (--with-xxxdir = obligatory, --with-xxx = optional (--with-xxx=no to disable))"
++ exit -1
++ ])
++
++fi
++
+ dnl == installation paths ==================================
+ dnl ========================================================
+
+@@ -884,6 +944,10 @@
+ LIBS="$LIBS -lsocket -lnsl"
+ ;;
+
++ *cygwin* )
++ LIBS="$LIBS -lrpc"
++ ;;
++
+ dnl *)
+ dnl AC_MSG_ERROR(unknown system type ${host}.)
+ dnl ;;
+@@ -1002,7 +1066,9 @@
+ Installation prefix: $prefix
+ C++ compiler: $CXX $CXXFLAGS
+ OpenMP support: `if test "x$with_openmp" = "xno";
+- then echo 'no'; else echo 'yes (use --with-openmp=no if your compiler does not support it)'; fi`
++ then echo 'no'; else echo 'yes'; fi`
++ Build type: `if test "x$PYTHON_MODULE" = "xyes";
++ then echo 'library (Python module)'; else echo 'standalone (other: Python module)'; fi`
+ ----- optional libraries (consult README/INSTALL): ---
+ wxWidgets: `if test no = $with_wxWidgets;
+ then echo 'no (needs explicit enabling)'; else echo yes; fi`
+@@ -1026,13 +1092,21 @@
+ then echo 'no (needs explicit enabling)'; else echo yes; fi`
+ GRIB: `if test no = $with_grib;
+ then echo 'no (needs explicit enabling)'; else echo yes; fi`
++ GSHHS: `if test no = $with_gshhs;
++ then echo 'no (see also MAP_INSTALL)'; else echo yes; fi`
+ ----- notes on auxiliary files: ----------------------
+ - consult MAP_INSTALL for details concerning auxiliary
+ files needed for mapping support
+ - SAVE and RESTORE procedures require *.pro files from
+ the CMSVLIB package (see README for details)
+ ------------------------------------------------------
++`if test yes = $openmp_autodetected; then
++ echo ' ----- note on OpenMP support -------------------------'
++ echo ' OpenMP was autodetected, use --with-openmp=no if your'
++ echo ' compiler does not support it (e.g. GCC < 4.2)'
++ echo ' ------------------------------------------------------'; fi`
+ use 'make' to build and 'make install' to install GDL
++ (optional 'make check' tests the build - experimental)
+ "
+
+ dnl == EOF =================================================
+Only in gdl-0.9rc4/doc: Makefile
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/doc/www/contribute.html cvs/gdl/doc/www/contribute.html
+--- gdl-0.9rc4/doc/www/contribute.html 1969-12-31 17:00:00.000000000 -0700
++++ cvs/gdl/doc/www/contribute.html 2010-01-20 15:20:40.000000000 -0700
+@@ -0,0 +1,30 @@
++
++GDL Contribute
++
++
++
++
++
++
Contributions to GDL
++
++
GDL is actively developed and has already a lot of functionality.
++But it is still in beta state as of November 2009.
++Even though it can already be used for many tasks, there are many
++things left to be done.
++Any contributions are very welcome. Currently contributions can be made in C/C++, GDL and python.
++See the files HACKING and PYHTON.txt in the GDL root directory.
++
++
Urgent things to do are:
++
++
Library functions and procedures
++
Porting GDL to other platforms
++
Implementing GUI library functions
++
Completing the graphical output system
++
Testing and test routines written in GDL
++
++
++
++Please send your contributions using the trackers.
++
++ Please do check the version number of the package you intend to use against
++ the current GDL source-code release.
++ GDL is still in beta stage of development and thus it is highly recommended to
++ use a resonably recent version.
++
++
++ Please note as well that several features of GDL depend on compile-time configuration,
++ and might not be available in pre-built or pre-configured packages.
++
Your comments are welcome! Let us know what you use GDL for. Or if you don't,
++why not. Which functionality are you missing/would appreciate most for
++comming versions.
++
++
Please send your bug reports, complaints, suggestions and comments using the
++trackers
++or
++forums.
++
++
A free IDL (Interactive Data Language) compatible incremental
++compiler (i. e. runs IDL programs).
++IDL is a registered trademark of ITT Visual Information Solutions.
++
++
++
++
Features
++
++
Full syntax compatibility with IDL 6.0 and later
++
++
ALL IDL language elements are supported, including:
++
++
++
objects, pointers, structs and arrays,
++
system, common block and assoc variables,
++
all operators and datatypes,
++
_EXTRA, _STRICT_EXTRA and _REF_EXTRA keywords...
++
++
++
The file input output system is fully implemented
++(Exception: For formatted I/O the C() sub-codes are not supported yet)
++
++
netCDF files are fully supported.
++
HDF files are partially supported.
++
Basic support for HDF5 files.
++
++
Overall more than 380 library routines are implemented.
++For a sorted list enter HELP,/LIB at the command prompt and look for
++library routines written in GDL in the src/pro subdirectory.
++
++
++Alain Coulais maintains a list
++of subroutines available in GDL.
++
++
++
++SAVE and RESTORE are supported through Craig Markwardt's CMSVLIB library.
++
++
++
++Graphical output is partially implemented. The PLOT, OPLOT, PLOTS,
++ XYOUTS, SURFACE, TVRD and TV commands
++(along with WINDOW, WDELETE, SET_PLOT, WSET, TVLCT) work
++(important keywords, some !P
++system variable tags and multi-plots are supported)
++for X windows, z-buffer and postscript output.
++
++
++
GDL has an interface to python (python routines can be called from GDL).
++
GDL can be build as a pyhton module (GDL subroutines can be called from python).
At least g++ 3.2 (or a similar C++ standard conforming
++compiler) is needed for compiling GDL.
++Note that due to problems with static casts g++ 3.3.1
++does not compile GDL, but 3.3.2 works fine again, so does 4.0 .
++GDL compiles under Mac OS X (10.2, 10.3 and 10.4) with g++ 3.3 (build 1671 -
++for build 1666 problems were reported) and with g++ 4.0.
++
++
++
The GNU readline
++library 4.3 or later is needed (GDL should compile
++without it, but it's very inconvenient to use that way, furthermore,
++proper event handling for graphic windows requires readline).
++OS X 10.4: Note that the the readline library which comes with OS X is
++not GNU readline. You need to install GNU readline and set the --with-readlinedir= DIR option to configure.
++
++
++
GDL uses the plplot
++ library version 5.3 or later for graphics.
++
For reading and writing images in several formats, GDL uses
++ImageMagick.
++It is required by default. If you don't want to use it, use
++'--with-Magick=no' as a command line option to 'configure'.
++
++
++
The HDF format is supported (version 4).
++If you want to use it, you need the
++HDF library.
++It is required by default. If you don't want to use it, use
++'--with-hdf=no' as a command line option to 'configure'.
++Note that HDF in turn needs other libraries. Check out the
++HDF homepage for
++more information.
++
++
++
Basic support for HDF5 is provided.
++If you want to use it, you need the
++HDF5 library.
++It is required by default. If you don't want to use it, use
++'--with-hdf5=no'. Note that HDF5 in turn needs other libraries. Check out the
++HDF homepage
++for more information.
++
++
++
++
The netCDF format is fully supported since version 0.8 . If you
++ want to use it, you need the
++netCDF library.
++It is required by default. If you don't want to use it, use
++'--with-netcdf=no' as a command line option to 'configure'.
++
++
++
GDL has an interface to python (GDL can be build and used as a python module as well).
++As so far there are only two example GDL extensions written in python its use optional for now but required by default.
++If you don't want to use it, use '--with-python=no'
++as a command line option to 'configure'.
++If you want to use it you need python 2.3 or later and the python package
++numarray 0.9 (or later).
++For nice graphical output the python package matplotlib 0.52 (or later)
++is used in one of the examples.
++The GDL configure script will determine the installed python version
++automatically. For this the python executable must be installed.
++The python version can be explictely set with
++--enable-pyhton_version=VERSION# (eg. --enable-pyhton_version=2.3).
++Note: For embedding python as done by GDL, the python dynamic
++library is needed which is not build by default. You need to run
++'configure' for python with the '--enable-shared' option. Please see
++the python README file for details.
++See the file PYTHON.txt in the GDL home directory for more details.
++
++
GDL was developed using ANTLR
++but unless you want to change the grammar (*.g files) you don't need
++ANTLR. All relevant ANTLR files are included in the package.
++
++
++
GDL is currently developed using KDevelop 3.3.6 under Fedora Core 7 GNU/Linux. The KDevelop project file is included in the tarball, so if you
++have KDevelop you should be able to use it with GDL seamlessly.
As GDL is almost 100% compatible to IDL (although not complete as many
++subroutines are waiting to be implemented), resources for IDL can also
++be utilized for GDL.
++
++
++Many IDL resources can be found on the page run by IDL guru
++David Fanning.
++
++
++Lots of routines written for IDL can be found with the
++IDL Libraries Browser many of them should also
++work with GDL.
++
++
++An IDL online tutorial is available at the Scientific Computing and
++Visualization website.
++
++
++For writing programs in GDL using Emacs the Emacs addon (mode)
++IDLWAVE, maintained
++by J.D. Smith is highly appreciated.
++
++
++
++
++
++ GDL used as a part of a web-interface for controlling 2D fluid flow simulation and
++ visualizing the output (reading netCDF files and outputting SVG plots).
++
++
++
++
++
++
++ GDL plotting data from a HDF file with MODIS satellite image.
++
++
++
++
++
++
++
++
++
++ GDL used for demonstrating Kalman filtering.
++
++
++
++
++
++ GDL-generated PostScript plot of a Fourier spectrum in a LaTeX-generated PDF file.
++
++
++
++
++
++
++
++
++
++ GDL plotting weather-forecast map from a GRIB file with NOAA GFS model output.
++
++
++
++
++
++
++ GDL plotting Daubechies wavelet to an SVG file under OpenSolaris.
++
++
++
++
++
++
++
++
++
++ GDL writing a surface plot to a PNG file under Cygwin on Windows (by Mateusz Turcza).
++
++
++
++
++
++
++ GDL rendering the Madelbrot set in an X window under coLinux on Windows (by Merrick Berg).
++
++
++
++
++
++ GDL used for analyzing LIDAR data (reading them from netCDF files, producing PostScript plots) on Linux, using the IDLWAVE mode for Emacs. (by Michał Piądłowski)
++
++
++
++
++
++
++
++
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot01.png and cvs/gdl/doc/www/screenshots/screenshot01.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot01_thumb.png and cvs/gdl/doc/www/screenshots/screenshot01_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot02.png and cvs/gdl/doc/www/screenshots/screenshot02.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot02_thumb.png and cvs/gdl/doc/www/screenshots/screenshot02_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot03.png and cvs/gdl/doc/www/screenshots/screenshot03.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot03_thumb.png and cvs/gdl/doc/www/screenshots/screenshot03_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot04.png and cvs/gdl/doc/www/screenshots/screenshot04.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot04_thumb.png and cvs/gdl/doc/www/screenshots/screenshot04_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot05.png and cvs/gdl/doc/www/screenshots/screenshot05.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot05_thumb.png and cvs/gdl/doc/www/screenshots/screenshot05_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot06.png and cvs/gdl/doc/www/screenshots/screenshot06.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot06_thumb.png and cvs/gdl/doc/www/screenshots/screenshot06_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot07.png and cvs/gdl/doc/www/screenshots/screenshot07.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot07_thumb.png and cvs/gdl/doc/www/screenshots/screenshot07_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot08.png and cvs/gdl/doc/www/screenshots/screenshot08.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot08_thumb.png and cvs/gdl/doc/www/screenshots/screenshot08_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot09.png and cvs/gdl/doc/www/screenshots/screenshot09.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot09_thumb.png and cvs/gdl/doc/www/screenshots/screenshot09_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot10.png and cvs/gdl/doc/www/screenshots/screenshot10.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot10_thumb.png and cvs/gdl/doc/www/screenshots/screenshot10_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot11.png and cvs/gdl/doc/www/screenshots/screenshot11.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot11_thumb.png and cvs/gdl/doc/www/screenshots/screenshot11_thumb.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot12.png and cvs/gdl/doc/www/screenshots/screenshot12.png differ
+Binary files gdl-0.9rc4/doc/www/screenshots/screenshot12_thumb.png and cvs/gdl/doc/www/screenshots/screenshot12_thumb.png differ
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/doc/www/support.html cvs/gdl/doc/www/support.html
+--- gdl-0.9rc4/doc/www/support.html 1969-12-31 17:00:00.000000000 -0700
++++ cvs/gdl/doc/www/support.html 2010-01-20 15:20:41.000000000 -0700
+@@ -0,0 +1,20 @@
++
++
++
++GDL Support
++
++
++
++
++
++
GDL Support
++
++
Please read the files in the GDL root directory carefully. Especially README and INSTALL.
++
++
++If you still have any questions you might use one of these trackers
++or
++forums.
++
++The good folks at freshmeat had
++a problem with the name GDL - GNU Data Language, but kindly agreed to
++list it as TDL - The Data Language. Therefore its listed there as TDL.
++
++
++
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/gdl.kdevelop cvs/gdl/gdl.kdevelop
+--- gdl-0.9rc4/gdl.kdevelop 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/gdl.kdevelop 2010-04-16 11:22:42.000000000 -0600
+@@ -32,13 +32,13 @@
+ false
+ executable
+ /
+-
++
+ true
+
+
+
+
+-
++
+ /home/marc/gdl/debug/src
+ true
+ false
+@@ -63,7 +63,7 @@
+
+
+
+- --with-readlinedir=yes --with-python=yes --with-hdf=yes --with-hdf5=no --with-plplotdir=/usr --with-python=yes --disable-python_module --with-netcdf=no --enable-oldplplot --with-openmp=yes --with-libproj4=no --with-wxWidgets=no --with-Magick=no
++ --with-readlinedir=yes --with-hdf=yes --with-hdf5=yes --with-plplotdir=/usr/local --with-python=yes --disable-python_module --with-netcdf=no --disable-oldplplot --with-openmp=no --with-libproj4=no --with-mpich=/usr/lib/mpich --with-wxWidgets=yes --with-Magick=yes
+ debug
+ kdevgccoptions
+ kdevgppoptions
+@@ -279,6 +279,7 @@
+
+
+
+-
++ /home/marc/gdl/tags
++
+
+
+Only in gdl-0.9rc4: gdl.kdevses
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/INSTALL cvs/gdl/INSTALL
+--- gdl-0.9rc4/INSTALL 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/INSTALL 2010-04-22 09:50:39.000000000 -0600
+@@ -4,15 +4,18 @@
+ (If you encounter any problems, please read on further, also have a
+ look at the REQUIREMENTS section in the README file.)
+
+-Unpack the tarball under any directory (tar xfvz gdl-0.9.tar.gz)
+-change to the new subdirectory gdl-0.9
+-type ./configure (use './configure --help' for a list of options)
+-type make (use 'make -j N' to run N parallel processes)
+-The executable (named 'gdl') should then be in the src subdirectory
+-(gdl-0.9/src/gdl).
++* unpack the tarball under any directory (tar xfvz gdl-0.9.tar.gz)
++* change to the new subdirectory gdl-0.9
++* type "./configure" (use './configure --help' for a list of options)
++* type "make" (use 'make -j N' to run N parallel processes)
++* optionally type "make check" to test the build
++* type "make install" to deploy GDL binary (gdl), libraries, manpage, etc
+
+ If you know IDL, you should feel very familiar with GDL.
+-Some GDL test files are in the gdl/pro subdirectory (test_*.pro)
++A list of command-line options is available both in the manpage and
++after typing "gdl --help".
++
++Some GDL test files are in the gdl/testsuite subdirectory (test_*.pro)
+
+ Note:
+ When compiling you might get some warnings:
+@@ -71,42 +74,31 @@
+ determine which python version is actually
+ used. With this option the version can be
+ expicitely set
+- (e.g. --enable-python_version=2.3).
++ (e.g. --enable-python_version=2.6).
++--with-ncursesdir=DIR to specify the ncurses (or curses) directory tree
++--with-readlinedir=DIR to specify the GNU readline directory tree
++--with-libzdir=DIR to specify the Zlib directory tree
++--with-openmp=no to disable the OpenMP support (e.g. for GCC <4.2)
++--with-gsldir=DIR to specify the GSL directory tree
+ --with-plplotdir=DIR to specify the plplot directory tree
+ --enable-oldplplot to specify that you have an older than 5.9.0 plplot lib.
+
+---with-ncursesdir=DIR to specify the ncurses directory tree
+---with-readlinedir=DIR to specify the readline directory tree
+---with-gsldir=DIR to specify the GSL directory tree
+---with-libzdir=DIR to specify the Zlib directory tree
++--with-Magick=DIR to specify the ImageMagick directory tree
++--with-Magick=no to not use ImageMagick
+
+ --with-netcdf=DIR to specify the netcdf directory tree
+ --with-netcdf=no to not use netcdf
+
+---with-hdf=DIR to specify the HDF4 directory tree
+---with-hdf=no to not use HDF4
+-
+---with-hdf5=DIR to specify the HDF5 directory tree
+---with-hdf5=no to not use HDF5
+-
+---with-python=DIR to specify the python directory tree
+---with-python=no to not use python
+-
+---with-Magick=DIR to specify the ImageMagick directory tree
+---with-Magick=no to not use ImageMagick
+-
+ --with-fftw=DIR to specify the FFTW directory tree
+---with-fftw=no to not use FFTW (this is the default)
+-
+---with-libproj4=DIR to specify the libproj4 directory tree
+---with-libproj4=no to not use libproj4 (this is the default)
++--with-fftw=no to not use FFTW
+
++... and so on for: wxWidgets, hdf, hdf5, fftw, libproj4, python, udunits,
++grib, GSHHS, and others - see README file for details (REQUIREMENTS section).
+
+ For example, if you have python installed in /usr/local, use
+
+ ./configure --with-python=/usr/local
+
+-
+ Basic Installation Instructions
+ ===============================
+
+Only in gdl-0.9rc4: m4
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/Makefile.cvs cvs/gdl/Makefile.cvs
+--- gdl-0.9rc4/Makefile.cvs 1969-12-31 17:00:00.000000000 -0700
++++ cvs/gdl/Makefile.cvs 2004-12-09 08:10:02.000000000 -0700
+@@ -0,0 +1,8 @@
++default: all
++
++all:
++ aclocal
++ autoheader
++ automake
++ autoconf
++
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/MAP_INSTALL cvs/gdl/MAP_INSTALL
+--- gdl-0.9rc4/MAP_INSTALL 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/MAP_INSTALL 2010-05-21 10:23:52.346969024 -0600
+@@ -1,12 +1,10 @@
++===========================================================================
+
+ To provide map projections support your first need to make sure the libproj4
+ library is installed. The source code for this can be found at:
+
+-http://members.verizon.net/~vze2hc4d/proj4/libproj4.3_20081120.tar.bz2
+-(or http://home.comcast.net/~gevenden56/)
+-
+-(Older version: http://members.verizon.net/~vze2hc4d/proj4/lbp4_050319S.tar.gz)
+-
++http://home.comcast.net/~gevenden56/proj/
++(http://home.comcast.net/~gevenden56/proj/libproj4.3_20081120.tar.bz2)
+
+ The "--with-libproj4=DIR" switch in configure can be used give the location
+ of this library.
+@@ -15,7 +13,6 @@
+ The following additional PRO files must be acquired and placed in the
+ appropriate directories:
+
+-map_continents.pro
+ map_grid.pro
+ map_horizon.pro
+ map_image.pro
+@@ -38,29 +35,33 @@
+
+ They can be placed in any directory within you GDL path.
+
++===========================================================================
++
++MAP_CONTINENTS is implemented in GDL using the GSHHS (Global
++Self-consistent, Hierarchical, High-resolution Shoreline Database)
++available under the GNU GPL. To provide support for MAP_CONTINENTS the
++database files and one header file (gshhs.h) need to be downloaded e.g. from:
++
++ftp://ftp.soest.hawaii.edu/pwessel/gshhs
++
++The header file for the 2.0 dataset is in the gshhs_1.12_src.zip file.
++The datafiles (*.b) are in the gshhs_2.0.tbz file.
++
++When compiling GDL, the --with-gshhs option must be given (not enabled
++by default), optionally with an argument pointing to the GSHHS installation
++prefix:
+
+-To provide support for MAP_CONTINENTS the database files must be
+-downloaded:
++--with-gshhs : searches gshhs.h in the default include path of the compiler
++--with-gshhs=/usr/local : searches for /usr/local/include/gshhs.h
+
+-blow.dat
+-blow.ndx
+-clow.dat
+-clow.ndx
+-plow.dat
+-plow.ndx
+-rlow.dat
+-rlow.ndx
+-
+-These files can be found at:
+-
+-http://comm.nsdl.org/viewcvs/viewcvs.cgi/ddtoolkitnfndry/ETA_Viewer/Development/resource/maps/low/
+-
+-These files should be placed in the "resource/maps/low" subdirectory
+-of the !DIR directory which can be found by starting GDL and printing
+-the !DIR system variable.
++GDL searches for the GSHHS datafiles (gshhs_f.b, gshhs_l.b, etc...) in the
++$GDLDATADIR/../gshhs/ directory (we need a better solution - FIXME!)
+
+-Note: Only low-resolution boundaries are currently supported.
++Reference:
++Wessel, P. and Smith, W.H.F., 1996. A global, self-consistent, hierarchical,
++ high-resolution shoreline database. J. Geophys. Res., 101(B4): 8741--8743.
+
++===========================================================================
+
+ The following projections are at least partially supported
+ (numbers defined in the map_sep.pro file itself):
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/NEWS cvs/gdl/NEWS
+--- gdl-0.9rc4/NEWS 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/NEWS 2010-06-03 09:06:33.827800868 -0600
+@@ -478,3 +478,22 @@
+ - making the initial "DECOMPOSED" setting of the X device dependtant on the colour
+ depth reported by the X-server
+
++0.9rc5:
++ - FOREACH statement, syntax: FOREACH loopVar OF array DO
++ - member function and procedure calls with '.' e. g.: object.aProcedure
++ - support of negative index ranges. -1 is the last element, -2 the one before
++ the last and so on. E.g.: array[-7:-5]
++ - new widget features incl. WIDGET_DROPLIST
++ - automatic garbage collection
++ - numerous bugfixes (incl. SAVE/RESTORE)
++ - new routines:
++ - HIST_2D
++ - MAP_CONTINENTS
++ - POLYFILL
++ - RESOLVE_ROUTINE
++ - SPHER_HARM
++ - new keywords/calling sequences handled:
++ - DEVICE, /INCHES, GET_SCREEN_SIZE
++ - PRODUCT, /PRESERVE_TYPE, /INTEGER
++ - REBIN: support for specifying new dimensions as an array
++ - TOTAL, /PRESERVE_TYPE
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/README cvs/gdl/README
+--- gdl-0.9rc4/README 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/README 2010-04-22 09:50:39.000000000 -0600
+@@ -37,7 +37,7 @@
+ DICOM files are supported via the GDLffDICOM object
+ (src/pro/dicom subdirectory).
+
+-Overall more than 300 library routines are implemented.
++Overall more than 380 library routines are implemented.
+ For a list enter HELP,/LIB at the command prompt and look for
+ library routines written in GDL in the src/pro subdirectory.
+
+@@ -77,8 +77,10 @@
+ HDF5 ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/current
+ FFTW http://www.fftw.org/download.html
+ python http://www.python.org
+-libproj4 http://members.verizon.net/~vze2hc4d/proj4/
++libproj4 (consult the MAP_INSTALL file)
+ UDUNITS-2 http://www.unidata.ucar.edu/software/udunits/
++GRIB API http://www.ecmwf.int/products/data/software/grib_api.html
++GSHHS (consult the MAP_INSTALL file)
+
+ Only with python:
+ numarray http://www.stsci.edu/resources/software_hardware/numarray
+@@ -119,6 +121,14 @@
+ If you have plplot older than 5.9.0 use the configure
+ option --enable-oldplplot
+ With this option, plplot down to 5.3 should work.
++A possible problem was reported:
++On opening more than one window, plplot causes a segmentation fault
++if GDL is compiled with ImageMagick. This happens if plplot uses
++dynamic drivers .
++The current solution is to disable dynamic drivers for plplot
++(-DENABLE_DYNDRIVERS=OFF option for cmake).
++Current ubuntu/debian distributions are using dynamic drivers, so plplot
++needs to be compiled from source there.
+
+ Furthermore you need the GNU Scientific Library.
+ (Minimal version is 1.7, which is now checked via "gsl.m4".
+@@ -231,6 +241,10 @@
+ library (http://www.unidata.ucar.edu/software/udunits/)
+ If you want to use it, use --with-udunits=DIR
+
++GDL supports the GRIB file format - see README_GRIB
++
++GDL uses GSHHS to implement MAP_CONTINENTS - see MAP_INSTALL
++
+ GDL 0.9 was developed using ANTLR 2.7.6,
+ but unless you want to change the grammar (*.g files) you don't need
+ ANTLR. All relevant ANTLR files are included in the package.
+@@ -258,7 +272,7 @@
+ ==============
+
+ GDL 0.9 is actively developed, but due to the vast amount of subroutines
+-to implement still in beta state as of November 2009.
++to implement still in beta state as of February 2010.
+ Even though it can already be used for several tasks, there are many
+ things to be done.
+ Bug reports, feedback in general and interested people who would
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/accessdesc.hpp cvs/gdl/src/accessdesc.hpp
+--- gdl-0.9rc4/src/accessdesc.hpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/accessdesc.hpp 2010-04-16 11:22:53.000000000 -0600
+@@ -337,9 +337,13 @@
+ BaseGDL* Resolve()
+ {
+ SetupDim();
+-
+- // no zeroing, here the new variable is created
+- BaseGDL* newData=top->New( dim, BaseGDL::NOZERO);
++
++ BaseGDL* newData;
++ // no zeroing, here the new variable is created TODO: zero only for PTR and OBJECT
++ if( top->Type() == PTR || top->Type() == OBJECT)
++ newData=top->New( dim);//, BaseGDL::NOZERO);
++ else
++ newData=top->New( dim, BaseGDL::NOZERO);
+
+ rOffset=0; // crucial line, only with rOffset == 0 var is set
+
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/antlr/LLkParser.cpp cvs/gdl/src/antlr/LLkParser.cpp
+--- gdl-0.9rc4/src/antlr/LLkParser.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/antlr/LLkParser.cpp 2010-04-16 11:22:54.000000000 -0600
+@@ -2,7 +2,7 @@
+ * Project led by Terence Parr at http://www.jGuru.com
+ * Software rights: http://www.antlr.org/license.html
+ *
+- * $Id: LLkParser.cpp,v 1.1.1.1 2004/12/09 15:10:20 m_schellens Exp $
++ * $Id: LLkParser.cpp,v 1.3 2010/04/07 14:59:09 m_schellens Exp $
+ */
+
+ #include "antlr/LLkParser.hpp"
+@@ -40,11 +40,13 @@
+
+ void LLkParser::trace(const char* ee, const char* rname)
+ {
++ if(inputState->guessing>0) return;
++
+ traceIndent();
+
+- cout << ee << rname << ((inputState->guessing>0)?"; [guessing]":"; ");
++ cout << ee << rname << ((inputState->guessing>0)?"; [guessing]":"; <<<");
+
+- for (int i = 1; i <= k; i++)
++ for (int i = 1; i <= k+3; i++)
+ {
+ if (i != 1) {
+ cout << ", ";
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/antlr/Makefile.am cvs/gdl/src/antlr/Makefile.am
+--- gdl-0.9rc4/src/antlr/Makefile.am 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/antlr/Makefile.am 2010-04-16 11:22:54.000000000 -0600
+@@ -3,14 +3,14 @@
+ antlr_sources = ANTLRException.hpp ANTLRUtil.cpp ANTLRUtil.hpp ASTArray.hpp ASTFactory.cpp ASTFactory.hpp AST.hpp ASTNULLType.cpp ASTNULLType.hpp ASTPair.hpp ASTRefCount.cpp ASTRefCount.hpp BaseAST.cpp BaseAST.hpp BitSet.cpp BitSet.hpp CharBuffer.cpp CharBuffer.hpp CharInputBuffer.hpp CharScanner.cpp CharScanner.hpp CharStreamException.hpp CharStreamIOException.hpp CircularQueue.hpp CommonAST.cpp CommonAST.hpp CommonASTWithHiddenTokens.cpp CommonASTWithHiddenTokens.hpp CommonHiddenStreamToken.cpp CommonHiddenStreamToken.hpp CommonToken.cpp CommonToken.hpp config.hpp InputBuffer.cpp InputBuffer.hpp IOException.hpp LexerSharedInputState.hpp LLkParser.cpp LLkParser.hpp Makefile.am Makefile.in MismatchedCharException.cpp MismatchedCharException.hpp MismatchedTokenException.cpp MismatchedTokenException.hpp NoViableAltException.cpp NoViableAltException.hpp NoViableAltForCharException.cpp NoViableAltForCharException.hpp Parser.cpp Parser.hpp ParserSharedInputState.hpp RecognitionException.cpp RecognitionException.hpp RefCount.hpp SemanticException.hpp String.cpp String.hpp TokenBuffer.cpp TokenBuffer.hpp Token.cpp Token.hpp TokenStreamBasicFilter.cpp TokenStreamBasicFilter.hpp TokenStreamException.hpp TokenStreamHiddenTokenFilter.cpp TokenStreamHiddenTokenFilter.hpp TokenStream.hpp TokenStreamIOException.hpp TokenStreamRecognitionException.hpp TokenStreamRetryException.hpp TokenStreamSelector.cpp TokenStreamSelector.hpp TreeParser.cpp TreeParser.hpp TreeParserSharedInputState.hpp
+
+ if !BUILDASLIBRARY
+-lib_LIBRARIES = libantlr.a
++noinst_LIBRARIES = libantlr.a
+ libantlr_a_SOURCES = $(antlr_sources)
+ # trigger basename generation
+ libantlr_a_CXXFLAGS = $(AM_CXXFLAGS)
+ endif
+
+-# if we build a shared library, antlr stuff has to build
+-# as shared library also
++# if we build a shared library, antlr stuff has to be build
++# as a shared library also
+ if BUILDASLIBRARY
+ noinst_LTLIBRARIES = libantlr.la
+ libantlr_la_SOURCES = $(antlr_sources)
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/antlr/Makefile.in cvs/gdl/src/antlr/Makefile.in
+--- gdl-0.9rc4/src/antlr/Makefile.in 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/antlr/Makefile.in 2010-04-16 11:22:54.000000000 -0600
+@@ -45,29 +45,7 @@
+ CONFIG_HEADER = $(top_builddir)/config.h
+ CONFIG_CLEAN_FILES =
+ CONFIG_CLEAN_VPATH_FILES =
+-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+-am__vpath_adj = case $$p in \
+- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+- *) f=$$p;; \
+- esac;
+-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+-am__install_max = 40
+-am__nobase_strip_setup = \
+- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+-am__nobase_strip = \
+- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+-am__nobase_list = $(am__nobase_strip_setup); \
+- for p in $$list; do echo "$$p $$p"; done | \
+- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+- if (++n[$$2] == $(am__install_max)) \
+- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+- END { for (dir in files) print dir, files[dir] }'
+-am__base_list = \
+- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+-am__installdirs = "$(DESTDIR)$(libdir)"
+-LIBRARIES = $(lib_LIBRARIES)
++LIBRARIES = $(noinst_LIBRARIES)
+ ARFLAGS = cru
+ libantlr_a_AR = $(AR) $(ARFLAGS)
+ libantlr_a_LIBADD =
+@@ -352,13 +330,13 @@
+ TokenStreamRetryException.hpp TokenStreamSelector.cpp \
+ TokenStreamSelector.hpp TreeParser.cpp TreeParser.hpp \
+ TreeParserSharedInputState.hpp
+-@BUILDASLIBRARY_FALSE@lib_LIBRARIES = libantlr.a
++@BUILDASLIBRARY_FALSE@noinst_LIBRARIES = libantlr.a
+ @BUILDASLIBRARY_FALSE@libantlr_a_SOURCES = $(antlr_sources)
+ # trigger basename generation
+ @BUILDASLIBRARY_FALSE@libantlr_a_CXXFLAGS = $(AM_CXXFLAGS)
+
+-# if we build a shared library, antlr stuff has to build
+-# as shared library also
++# if we build a shared library, antlr stuff has to be build
++# as a shared library also
+ @BUILDASLIBRARY_TRUE@noinst_LTLIBRARIES = libantlr.la
+ @BUILDASLIBRARY_TRUE@libantlr_la_SOURCES = $(antlr_sources)
+ all: all-am
+@@ -395,38 +373,9 @@
+ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ $(am__aclocal_m4_deps):
+-install-libLIBRARIES: $(lib_LIBRARIES)
+- @$(NORMAL_INSTALL)
+- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+- @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+- list2=; for p in $$list; do \
+- if test -f $$p; then \
+- list2="$$list2 $$p"; \
+- else :; fi; \
+- done; \
+- test -z "$$list2" || { \
+- echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
+- $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
+- @$(POST_INSTALL)
+- @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+- for p in $$list; do \
+- if test -f $$p; then \
+- $(am__strip_dir) \
+- echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
+- ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
+- else :; fi; \
+- done
+
+-uninstall-libLIBRARIES:
+- @$(NORMAL_UNINSTALL)
+- @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+- test -n "$$files" || exit 0; \
+- echo " ( cd '$(DESTDIR)$(libdir)' && rm -f "$$files" )"; \
+- cd "$(DESTDIR)$(libdir)" && rm -f $$files
+-
+-clean-libLIBRARIES:
+- -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
++clean-noinstLIBRARIES:
++ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+ libantlr.a: $(libantlr_a_OBJECTS) $(libantlr_a_DEPENDENCIES)
+ -rm -f libantlr.a
+ $(libantlr_a_AR) libantlr.a $(libantlr_a_OBJECTS) $(libantlr_a_LIBADD)
+@@ -995,9 +944,6 @@
+ check: check-am
+ all-am: Makefile $(LIBRARIES) $(LTLIBRARIES)
+ installdirs:
+- for dir in "$(DESTDIR)$(libdir)"; do \
+- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+- done
+ install: install-am
+ install-exec: install-exec-am
+ install-data: install-data-am
+@@ -1025,7 +971,7 @@
+ @echo "it deletes files that may require special tools to rebuild."
+ clean: clean-am
+
+-clean-am: clean-generic clean-libLIBRARIES clean-libtool \
++clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+ distclean: distclean-am
+@@ -1052,7 +998,7 @@
+
+ install-dvi-am:
+
+-install-exec-am: install-libLIBRARIES
++install-exec-am:
+
+ install-html: install-html-am
+
+@@ -1092,23 +1038,23 @@
+
+ ps-am:
+
+-uninstall-am: uninstall-libLIBRARIES
++uninstall-am:
+
+ .MAKE: install-am install-strip
+
+ .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+- clean-libLIBRARIES clean-libtool clean-noinstLTLIBRARIES ctags \
+- distclean distclean-compile distclean-generic \
++ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
++ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+- install-info-am install-libLIBRARIES install-man install-pdf \
+- install-pdf-am install-ps install-ps-am install-strip \
+- installcheck installcheck-am installdirs maintainer-clean \
++ install-info-am install-man install-pdf install-pdf-am \
++ install-ps install-ps-am install-strip installcheck \
++ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+- tags uninstall uninstall-am uninstall-libLIBRARIES
++ tags uninstall uninstall-am
+
+
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/antlr/Parser.cpp cvs/gdl/src/antlr/Parser.cpp
+--- gdl-0.9rc4/src/antlr/Parser.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/antlr/Parser.cpp 2010-04-16 11:22:54.000000000 -0600
+@@ -2,11 +2,12 @@
+ * Project led by Terence Parr at http://www.jGuru.com
+ * Software rights: http://www.antlr.org/license.html
+ *
+- * $Id: Parser.cpp,v 1.2 2008/11/16 13:51:49 m_schellens Exp $
++ * $Id: Parser.cpp,v 1.4 2010/04/07 14:59:09 m_schellens Exp $
+ */
+
+ // g++-4.3 needs this
+ #include
++#include
+
+ #include "antlr/Parser.hpp"
+
+@@ -187,13 +188,16 @@
+ void Parser::traceIndent()
+ {
+ for( int i = 0; i < traceDepth; i++ )
+- ANTLR_USE_NAMESPACE(std)cout << " ";
++ ANTLR_USE_NAMESPACE(std)cout << " ";
++ ANTLR_USE_NAMESPACE(std)cout << ANTLR_USE_NAMESPACE(std)setw(3) << traceDepth << " ";
+ }
+
+ void Parser::traceIn(const char* rname)
+ {
+ traceDepth++;
+
++if(inputState->guessing>0) return;
++
+ for( int i = 0; i < traceDepth; i++ )
+ ANTLR_USE_NAMESPACE(std)cout << " ";
+
+@@ -205,6 +209,7 @@
+
+ void Parser::traceOut(const char* rname)
+ {
++if(inputState->guessing<=0) {
+ for( int i = 0; i < traceDepth; i++ )
+ ANTLR_USE_NAMESPACE(std)cout << " ";
+
+@@ -212,7 +217,7 @@
+ << "; LA(1)==" << LT(1)->getText().c_str()
+ << ((inputState->guessing>0)?" [guessing]":"")
+ << ANTLR_USE_NAMESPACE(std)endl;
+-
++}
+ traceDepth--;
+ }
+
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/antlr/RefCount.hpp cvs/gdl/src/antlr/RefCount.hpp
+--- gdl-0.9rc4/src/antlr/RefCount.hpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/antlr/RefCount.hpp 2010-04-16 11:22:54.000000000 -0600
+@@ -4,7 +4,7 @@
+ * Project led by Terence Parr at http://www.jGuru.com
+ * Software rights: http://www.antlr.org/license.html
+ *
+- * $Id: RefCount.hpp,v 1.1.1.1 2004/12/09 15:10:20 m_schellens Exp $
++ * $Id: RefCount.hpp,v 1.2 2010/03/09 23:54:39 m_schellens Exp $
+ */
+
+ #include
+@@ -62,7 +62,7 @@
+ return ref ? ref->ptr : 0;
+ }
+
+- T* get() const
++ T* get() const
+ {
+ return ref ? ref->ptr : 0;
+ }
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/antlr/TreeParser.cpp cvs/gdl/src/antlr/TreeParser.cpp
+--- gdl-0.9rc4/src/antlr/TreeParser.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/antlr/TreeParser.cpp 2010-04-16 11:22:54.000000000 -0600
+@@ -2,11 +2,12 @@
+ * Project led by Terence Parr at http://www.jGuru.com
+ * Software rights: http://www.antlr.org/license.html
+ *
+- * $Id: TreeParser.cpp,v 1.2 2008/11/16 13:51:49 m_schellens Exp $
++ * $Id: TreeParser.cpp,v 1.3 2010/04/05 01:22:05 m_schellens Exp $
+ */
+
+ // g++-4.3 needs this
+ #include
++#include
+
+ #include "antlr/TreeParser.hpp"
+ #include "antlr/ASTNULLType.hpp"
+@@ -98,7 +99,8 @@
+ void TreeParser::traceIndent()
+ {
+ for( int i = 0; i < traceDepth; i++ )
+- ANTLR_USE_NAMESPACE(std)cout << " ";
++ ANTLR_USE_NAMESPACE(std)cout << " ";
++ ANTLR_USE_NAMESPACE(std)cout << ANTLR_USE_NAMESPACE(std)setw(3) << traceDepth << ": ";
+ }
+
+ void TreeParser::traceIn(const char* rname, RefAST t)
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/arrayindex.cpp cvs/gdl/src/arrayindex.cpp
+--- gdl-0.9rc4/src/arrayindex.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/arrayindex.cpp 2010-05-21 10:23:54.851967986 -0600
+@@ -197,13 +197,13 @@
+
+ if( ixList->size() == 1)
+ {
+- if( dynamic_cast< CArrayIndexScalar*>((*ixList)[0]))
++ if( CArrayIndexScalarID == (*ixList)[0]->Type())
+ return new ArrayIndexListOneConstScalarT( ixList);
+
+- if( dynamic_cast< ArrayIndexScalar*>((*ixList)[0]))
++ if( ArrayIndexScalarID == (*ixList)[0]->Type())
+ return new ArrayIndexListOneScalarT( ixList);
+
+- if( dynamic_cast< ArrayIndexScalarVP*>((*ixList)[0]))
++ if( ArrayIndexScalarVPID == (*ixList)[0]->Type())
+ return new ArrayIndexListOneScalarVPT( ixList);
+
+ return new ArrayIndexListOneT( ixList);
+@@ -212,9 +212,9 @@
+ SizeT nScalar = 0;
+ for( SizeT i=0; isize(); ++i)
+ {
+- if( dynamic_cast< ArrayIndexScalar*>((*ixList)[i]) ||
+- dynamic_cast< ArrayIndexScalarVP*>((*ixList)[i]) ||
+- dynamic_cast< CArrayIndexScalar*>((*ixList)[i])) ++nScalar;
++ if( ArrayIndexScalarID == (*ixList)[i]->Type() ||
++ ArrayIndexScalarVPID == (*ixList)[i]->Type() ||
++ CArrayIndexScalarID == (*ixList)[i]->Type() ) ++nScalar;
+ }
+ if( nScalar == ixList->size())
+ return new ArrayIndexListScalarT( ixList);
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/arrayindex.hpp cvs/gdl/src/arrayindex.hpp
+--- gdl-0.9rc4/src/arrayindex.hpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/arrayindex.hpp 2010-05-21 10:23:54.881967727 -0600
+@@ -27,9 +27,30 @@
+ //typedef std::valarray AllIxT; // now in typedefs.hpp
+ typedef std::vector IxExprListT;
+
++enum IndexType
++{
++ArrayIndexTID,
++ArrayIndexScalarID,
++ArrayIndexScalarVPID,
++CArrayIndexScalarID,
++ArrayIndexIndexedID,
++CArrayIndexIndexedID,
++ArrayIndexAllID,
++ArrayIndexORangeID,
++CArrayIndexORangeID,
++ArrayIndexRangeID,
++CArrayIndexRangeID,
++ArrayIndexORangeSID,
++CArrayIndexORangeSID,
++ArrayIndexRangeSID,
++CArrayIndexRangeSID
++};
++
+ class ArrayIndexT
+ {
+ public:
++ virtual IndexType Type() { return ArrayIndexTID;}
++
+ // this may be called from ArrayIndexListT::ToAssocIndex
+ virtual void Init() {}
+
+@@ -41,8 +62,8 @@
+ virtual void Clear() {}
+ virtual ~ArrayIndexT() {}
+
+- virtual SizeT GetIx0()=0;
+- virtual SizeT GetS() { return 0;}
++ virtual RangeT GetIx0()=0;
++ virtual RangeT GetS() { return 0;}
+ virtual SizeT GetStride() { return 0;}
+
+ virtual bool Scalar() { return false;}
+@@ -68,11 +89,13 @@
+ SizeT s;
+
+ public:
++ IndexType Type() { return ArrayIndexScalarID;}
++
+ SizeT GetVarIx() const { return varIx;}
+
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
++ RangeT GetS() { return s;}
+
+ bool Scalar() { return true;}
+ bool Scalar( SizeT& s_)
+@@ -81,7 +104,7 @@
+ return true;
+ }
+
+- SizeT GetIx0()
++ RangeT GetIx0()
+ {
+ return s;
+ }
+@@ -123,11 +146,13 @@
+ SizeT s;
+
+ public:
++ IndexType Type() { return ArrayIndexScalarVPID;}
++
+ DVar* GetVarPtr() const { return varPtr;}
+
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
++ RangeT GetS() { return s;}
+
+ bool Scalar() { return true;}
+ bool Scalar( SizeT& s_)
+@@ -144,7 +169,7 @@
+ void Clear()
+ {}
+
+- SizeT GetIx0()
++ RangeT GetIx0()
+ {
+ return s;
+ }
+@@ -180,6 +205,8 @@
+ SizeT s;
+
+ public:
++ IndexType Type() { return CArrayIndexScalarID;}
++
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+ bool Scalar() { return true;}
+@@ -189,12 +216,12 @@
+ return true;
+ }
+
+- SizeT GetIx0()
++ RangeT GetIx0()
+ {
+ return s;
+ }
+
+- SizeT GetS() { return s;}
++ RangeT GetS() { return s;}
+
+ ~CArrayIndexScalar()
+ {}
+@@ -238,6 +265,8 @@
+ }
+ };
+
++
++
+ // INDEXED or ONE [v] (must handle both)
+ class ArrayIndexIndexed: public ArrayIndexT
+ {
+@@ -254,9 +283,11 @@
+ ArrayIndexIndexed( const ArrayIndexT& r) {}
+
+ public:
++ IndexType Type() { return ArrayIndexIndexedID;}
++
+ SizeT NParam() { return 1;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
++ RangeT GetS() { return s;}
+
+ bool Scalar() { return (ix == NULL);}
+ bool Scalar( SizeT& s_)
+@@ -274,7 +305,7 @@
+
+ dimension GetDim() { return *ixDim;}
+
+- SizeT GetIx0()
++ RangeT GetIx0()
+ {
+ if( ix != NULL) return (*ix)[0]; // from array
+ return s;
+@@ -744,6 +775,8 @@
+
+ };
+
++
++
+ // constant version
+ class CArrayIndexIndexed: public ArrayIndexIndexed
+ {
+@@ -752,6 +785,8 @@
+ SizeT maxIx;
+
+ public:
++ IndexType Type() { return CArrayIndexIndexedID;}
++
+ ~CArrayIndexIndexed() { delete ixOri;}
+
+ CArrayIndexIndexed( BaseGDL* c, bool strictArrSubs_ = false):
+@@ -874,15 +909,22 @@
+ }
+ };
+
++
++
++
++
++
+ // [*]
+ class ArrayIndexAll: public ArrayIndexT
+ {
+ public:
++ IndexType Type() { return ArrayIndexAllID;}
++
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+ void Init() {};
+
+- SizeT GetIx0() { return 0;}
++ RangeT GetIx0() { return 0;}
+
+ ArrayIndexT* Dup() const
+ {
+@@ -905,17 +947,21 @@
+ }
+ };
+
++
++
+ // [s:*]
+ class ArrayIndexORange: public ArrayIndexT
+ {
+ protected:
+- SizeT s;
++ RangeT s;
+
+ public:
++ IndexType Type() { return ArrayIndexORangeID;}
++
+ SizeT NParam() { return 1;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
+- SizeT GetIx0() { return s;}
++ RangeT GetS() { return s;}
++ RangeT GetIx0() { return s;}
+
+ ArrayIndexT* Dup() const
+ {
+@@ -924,34 +970,47 @@
+ return d;
+ }
+
++ // s is always scalar here
+ void Init( BaseGDL* s_)
+ {
+- int retMsg=s_->Scalar2index(s);
++ int retMsg=s_->Scalar2RangeT(s);
+ if( retMsg == 0) // index empty or array
+ {
+ if( s_->N_Elements() == 0)
+ throw
+- GDLException(NULL,"Internal error: Scalar2index:"
++ GDLException(NULL,"Internal error: Scalar2RangeT:"
+ " 1st index empty",true,false);
+ else
+ throw
+ GDLException(NULL,"Expression must be a scalar"
+ " in this context.",true,false);
+ }
+- if( retMsg == -1) // index < 0
+- {
+- throw
+- GDLException(NULL,"Subscript range values of the"
+- " form low:high must be >= 0, < size, "
+- "with low <= high.",true,false);
+- }
++// not with Scalar2RangeT():
++// if( retMsg == -1) // index < 0
++// {
++// throw
++// GDLException(NULL,"Subscript range values of the"
++// " form low:high must be >= 0, < size, "
++// "with low <= high.",true,false);
++// }
+ }
+
+ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+ {
+ Init( ix[0]);
++
++ SizeT varSize = var->Size();
+
+- if( s >= var->Size())
++ if( s < 0)
++ {
++ RangeT i = s + varSize;
++ if( i < 0)
++ throw GDLException(NULL,"Subscript out of range [-s:*].",true,false);
++
++ return var->NewIxFrom( i);
++ }
++
++ if( s >= varSize)
+ throw GDLException(NULL,"Subscript out of range [s:*].",true,false);
+
+ return var->NewIxFrom( s);
+@@ -961,13 +1020,25 @@
+ {
+ if( s >= varDim)
+ throw GDLException(NULL,"Subscript out of range [s:*].",true,false);
++ if( s < 0)
++ {
++ RangeT i = s + varDim;
++ if( i < 0)
++ throw GDLException(NULL,"Subscript out of range [-s:*].",true,false);
++
++ return (varDim - i);
++ }
+ return (varDim - s);
+ }
+ };
+
++
++
+ class CArrayIndexORange: public ArrayIndexORange
+ {
+ public:
++ IndexType Type() { return CArrayIndexORangeID;}
++
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+ CArrayIndexORange( BaseGDL* c): ArrayIndexORange()
+@@ -986,36 +1057,74 @@
+
+ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+ {
+- if( s >= var->Size())
++ SizeT varSize = var->Size();
++
++ if( s < 0)
++ {
++ RangeT i = s + varSize;
++ if( i < 0)
++ throw GDLException(NULL,"Subscript out of range [-s:*].",true,false);
++
++ return var->NewIxFrom( i);
++ }
++
++ if( s >= varSize)
+ throw GDLException(NULL,"Subscript out of range [s:*].",true,false);
+
+ return var->NewIxFrom( s);
+ }
+ };
+
++
++
+ // [s:e]
+ class ArrayIndexRange: public ArrayIndexT
+ {
+ protected:
+- SizeT s,e;
++ RangeT s,e;
+
+ public:
++ IndexType Type() { return ArrayIndexRangeID;}
++
+ SizeT NParam() { return 2;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
+- SizeT GetIx0() { return s;}
++ RangeT GetS() { return s;}
++ RangeT GetIx0() { return s;}
+
+ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+ {
+ Init( ix[0], ix[1]);
+
+- if( e >= var->Size())
++ SizeT varSize = var->Size();
++
++ RangeT sl,el;
++ if( s < 0)
++ {
++ sl = s + varSize;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:e].",true,false);
++ }
++ else
++ sl = s;
++ if( e < 0)
++ {
++ el = e + varSize;
++ if( el < 0)
++ throw GDLException(NULL,"Subscript out of range [s:-E].",true,false);
++ }
++ else
++ el = e;
++
++ if( sl > el)
++ throw
++ GDLException(NULL,"Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
++ if( el >= var->Size())
+ throw GDLException(NULL,"Subscript out of range [s:e].",true,false);
+
+- return var->NewIxFrom( s, e);
++ return var->NewIxFrom( sl, el);
+ }
+
+-
+ ArrayIndexT* Dup() const
+ {
+ ArrayIndexRange* d = new ArrayIndexRange();
+@@ -1024,65 +1133,90 @@
+ return d;
+ }
+
+-
+ void Init( BaseGDL* s_, BaseGDL* e_)
+ {
+- int retMsg=s_->Scalar2index(s);
++// SizeT varSize = var->Size();
++
++ int retMsg=s_->Scalar2RangeT(s);
+ if( retMsg == 0) // index empty or array
+ {
+ if( s_->N_Elements() == 0)
+ throw
+- GDLException(NULL,"Internal error: Scalar2index: 1st index empty.",true,false);
++ GDLException(NULL,"Internal error: Scalar2RangeT: 1st index empty.",true,false);
+ else
+ throw
+ GDLException(NULL,"Expression must be a scalar in this context.",true,false);
+ }
+- if( retMsg == -1) // index < 0
+- {
+- throw
+- GDLException(NULL,"Subscript range values of the form low:high "
+- "must be >= 0, < size, with low <= high.",true,false);
+- }
+-
+- retMsg=e_->Scalar2index(e);
++// if( retMsg == -1) // index < 0
++// {
++// throw
++// GDLException(NULL,"Subscript range values of the form low:high "
++// "must be >= 0, < size, with low <= high.",true,false);
++// }
++
++ retMsg=e_->Scalar2RangeT(e);
+ if( retMsg == 0) // index empty or array
+ {
+ if( e_->N_Elements() == 0)
+ throw
+- GDLException(NULL,"Internal error: Scalar2index: 2nd index empty.",true,false);
++ GDLException(NULL,"Internal error: Scalar2RangeT: 2nd index empty.",true,false);
+ else
+ throw
+ GDLException(NULL,"Expression must be a scalar in this context.",true,false);
+ }
+- if( retMsg == -1) // index < 0
+- {
+- throw
+- GDLException(NULL,"Subscript range values of the form low:high "
+- "must be >= 0, < size, with low <= high.",true,false);
+- }
++// if( retMsg == -1) // index < 0
++// {
++// throw
++// GDLException(NULL,"Subscript range values of the form low:high "
++// "must be >= 0, < size, with low <= high.",true,false);
++// }
+
+- if( e < s)
++ if( e>=0 && s>=0 && e < s)
+ {
+ throw
+- GDLException(NULL," Subscript range values of the form low:high "
++ GDLException(NULL,"Subscript range values of the form low:high "
+ "must be >= 0, < size, with low <= high",true,false);
+ }
+ }
+
+-
+ // number of iterations
+ // also checks/adjusts range
+ SizeT NIter( SizeT varDim)
+ {
+- if( e >= varDim)
+- throw GDLException(NULL,"Subscript out of range [s:e].",true,false);
+- return (e - s + 1);
++ RangeT sl,el;
++ if( s < 0)
++ {
++ sl = s + varDim;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [S:e].",true,false);
++ }
++ else
++ sl = s;
++ if( e < 0)
++ {
++ el = e + varDim;
++ if( el < 0)
++ throw GDLException(NULL,"Subscript out of range [s:E].",true,false);
++ }
++ else
++ el = e;
++ if( sl > el)
++ throw
++ GDLException(NULL,"Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
++ if( el >= varDim)
++ throw GDLException(NULL,"Subscript out of range [s:e].",true,false);
++ return (el - sl + 1);
+ }
+ };
+
++
++
+ class CArrayIndexRange: public ArrayIndexRange
+ {
+ public:
++ IndexType Type() { return CArrayIndexRangeID;}
++
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+ CArrayIndexRange( BaseGDL* c1, BaseGDL* c2): ArrayIndexRange()
+@@ -1100,27 +1234,56 @@
+ return d;
+ }
+
+- BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+- {
+- if( e >= var->Size())
++ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
++ {
++ SizeT varSize = var->Size();
++
++ RangeT sl,el;
++ if( s < 0)
++ {
++ sl = s + varSize;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:e].",true,false);
++ }
++ else
++ sl = s;
++ if( e < 0)
++ {
++ el = e + varSize;
++ if( el < 0)
++ throw GDLException(NULL,"Subscript out of range [s:-E].",true,false);
++ }
++ else
++ el = e;
++
++ if( sl > el)
++ throw
++ GDLException(NULL,"Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
++ if( el >= var->Size())
+ throw GDLException(NULL,"Subscript out of range [s:e].",true,false);
+
+- return var->NewIxFrom( s, e);
+- }
++ return var->NewIxFrom( sl, el);
++ }
+ };
+
++
++
+ // [s:*:st]
+ class ArrayIndexORangeS: public ArrayIndexT
+ {
+ protected:
+- SizeT s,stride;
++ RangeT s;
++ SizeT stride;
+
+ public:
++ IndexType Type() { return ArrayIndexORangeSID;}
++
+ SizeT NParam() { return 2;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
++ RangeT GetS() { return s;}
+ SizeT GetStride() { return stride;}
+- SizeT GetIx0() { return s;}
++ RangeT GetIx0() { return s;}
+
+ ArrayIndexT* Dup() const
+ {
+@@ -1132,47 +1295,58 @@
+
+ void Init( BaseGDL* s_, BaseGDL* stride_)
+ {
+- int retMsg=s_->Scalar2index( s);
++ int retMsg=s_->Scalar2RangeT( s);
+ if( retMsg == 0) // index empty or array
+ {
+- if( s_->N_Elements() == 0)
+- throw
+- GDLException( "Internal error: Scalar2index:"
+- " 1st index empty",true,false);
+- else
+- throw
+- GDLException( "Expression must be a scalar"
+- " in this context.",true,false);
+- }
+- if( retMsg == -1) // index < 0
+- {
+- throw
+- GDLException( "Subscript range values of the"
+- " form low:high must be >= 0, < size, with low <= high.",true,false);
+- }
++ if( s_->N_Elements() == 0)
++ throw
++ GDLException( "Internal error: Scalar2RangeT:"
++ " 1st index empty",true,false);
++ else
++ throw
++ GDLException( "Expression must be a scalar"
++ " in this context.",true,false);
++ }
++// if( retMsg == -1) // index < 0
++// {
++// throw
++// GDLException( "Subscript range values of the"
++// " form low:high must be >= 0, < size, with low <= high.",true,false);
++// }
+ // stride
+ retMsg=stride_->Scalar2index( stride);
+ if( retMsg == 0) // index empty or array
+ {
+- if( stride_->N_Elements() == 0)
+- throw
+- GDLException( "Internal error: Scalar2index:"
+- " stride index empty",true,false);
+- else
+- throw
+- GDLException( "Expression must be a scalar"
+- " in this context.",true,false);
++ if( stride_->N_Elements() == 0)
++ throw
++ GDLException( "Internal error: Scalar2index:"
++ " stride index empty",true,false);
++ else
++ throw
++ GDLException( "Expression must be a scalar"
++ " in this context.",true,false);
+ }
+ if( retMsg == -1 || stride == 0) // stride <= 0
+ {
+- throw
+- GDLException( "Range subscript stride must be >= 1.",true,false);
++ throw
++ GDLException( "Range subscript stride must be >= 1.",true,false);
+ }
+ }
+
+ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+ {
+ Init( ix[0], ix[1]);
++
++ SizeT varSize = var->Size();
++
++ if( s < 0)
++ {
++ RangeT sl = s + varSize;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:*:stride].",true,false);
++
++ return var->NewIxFromStride( sl, stride);
++ }
+
+ if( s >= var->Size())
+ throw GDLException(NULL,"Subscript out of range [s:*:stride].",true,false);
+@@ -1184,6 +1358,14 @@
+ // also checks/adjusts range
+ SizeT NIter( SizeT varDim)
+ {
++ if( s < 0)
++ {
++ RangeT sl = s + varDim;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:*:stride].",true,false);
++ return (varDim - sl + stride - 1)/stride;
++ }
++
+ if( s >= varDim)
+ throw GDLException(NULL,"Subscript out of range [s:*:stride].",true,false);
+ return (varDim - s + stride - 1)/stride;
+@@ -1193,6 +1375,8 @@
+ class CArrayIndexORangeS: public ArrayIndexORangeS
+ {
+ public:
++ IndexType Type() { return CArrayIndexORangeSID;}
++
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+ CArrayIndexORangeS( BaseGDL* c1, BaseGDL* c2): ArrayIndexORangeS()
+@@ -1212,6 +1396,17 @@
+
+ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+ {
++ SizeT varSize = var->Size();
++
++ if( s < 0)
++ {
++ RangeT sl = s + varSize;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:*:stride].",true,false);
++
++ return var->NewIxFromStride( sl, stride);
++ }
++
+ if( s >= var->Size())
+ throw GDLException(NULL,"Subscript out of range [s:*:stride].",true,false);
+
+@@ -1223,14 +1418,17 @@
+ class ArrayIndexRangeS: public ArrayIndexT
+ {
+ protected:
+- SizeT s,e,stride;
++ RangeT s,e;
++ SizeT stride;
+
+ public:
++ IndexType Type() { return ArrayIndexRangeSID;}
++
+ SizeT NParam() { return 3;} // number of parameter to Init(...)
+
+- SizeT GetS() { return s;}
++ RangeT GetS() { return s;}
+ SizeT GetStride() { return stride;}
+- SizeT GetIx0() { return s;}
++ RangeT GetIx0() { return s;}
+
+ ArrayIndexT* Dup() const
+ {
+@@ -1243,45 +1441,45 @@
+
+ void Init( BaseGDL* s_, BaseGDL* e_, BaseGDL* stride_)
+ {
+- int retMsg=s_->Scalar2index(s);
++ int retMsg=s_->Scalar2RangeT(s);
+ if( retMsg == 0) // index empty or array
+ {
+ if( s_->N_Elements() == 0)
+ throw
+- GDLException( "Internal error: Scalar2index: 1st index empty.",true,false);
++ GDLException( "Internal error: Scalar2RangeT: 1st index empty.",true,false);
+ else
+ throw
+ GDLException( "Expression must be a scalar in this context.",true,false);
+ }
+- if( retMsg == -1) // index < 0
+- {
+- throw
+- GDLException( "Subscript range values of the form low:high "
+- "must be >= 0, < size, with low <= high.",true,false);
+- }
++// if( retMsg == -1) // index < 0
++// {
++// throw
++// GDLException( "Subscript range values of the form low:high "
++// "must be >= 0, < size, with low <= high.",true,false);
++// }
+
+- retMsg=e_->Scalar2index(e);
++ retMsg=e_->Scalar2RangeT(e);
+ if( retMsg == 0) // index empty or array
+ {
+ if( e_->N_Elements() == 0)
+ throw
+- GDLException( "Internal error: Scalar2index: 2nd index empty.",true,false);
++ GDLException( "Internal error: Scalar2RangeT: 2nd index empty.",true,false);
+ else
+ throw
+ GDLException( "Expression must be a scalar in this context.",true,false);
+ }
+- if( retMsg == -1) // index < 0
+- {
+- throw
+- GDLException( "Subscript range values of the form low:high "
+- "must be >= 0, < size, with low <= high.",true,false);
+- }
++// if( retMsg == -1) // index < 0
++// {
++// throw
++// GDLException( "Subscript range values of the form low:high "
++// "must be >= 0, < size, with low <= high.",true,false);
++// }
+
+- if( e < s)
++ if( e >= 0 && s >= 0 && e < s)
+ {
+- throw
+- GDLException( "Subscript range values of the form low:high "
+- "must be >= 0, < size, with low <= high",true,false);
++ throw
++ GDLException( "Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
+ }
+
+ // stride
+@@ -1308,29 +1506,79 @@
+ {
+ Init( ix[0], ix[1], ix[2]);
+
+- if( e >= var->Size())
++ SizeT varSize = var->Size();
++
++ RangeT sl,el;
++ if( s < 0)
++ {
++ sl = s + varSize;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:e:stride].",true,false);
++ }
++ else
++ sl = s;
++ if( e < 0)
++ {
++ el = e + varSize;
++ if( el < 0)
++ throw GDLException(NULL,"Subscript out of range [s:-E:stride].",true,false);
++ }
++ else
++ el = e;
++
++ if( sl > el)
++ throw
++ GDLException(NULL,"Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
++
++ if( el >= var->Size())
+ {
+ throw GDLException(NULL,"Subscript out of range [s:e:st].",true,false);
+ }
+
+- return var->NewIxFromStride( s, e, stride);
++ return var->NewIxFromStride( sl, el, stride);
+ }
+
+ // number of iterations
+ // also checks/adjusts range
+ SizeT NIter( SizeT varDim)
+ {
+- if( e >= varDim)
++ RangeT sl,el;
++ if( s < 0)
++ {
++ sl = s + varDim;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:e:stride].",true,false);
++ }
++ else
++ sl = s;
++ if( e < 0)
++ {
++ el = e + varDim;
++ if( el < 0)
++ throw GDLException(NULL,"Subscript out of range [s:-E:stride].",true,false);
++ }
++ else
++ el = e;
++
++ if( sl > el)
++ throw
++ GDLException(NULL,"Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
++
++ if( el >= varDim)
+ {
+- throw GDLException(NULL,"Subscript out of range [s:e:st].",true,false);
++ throw GDLException(NULL,"Subscript out of range [s:e:st].",true,false);
+ }
+- return (e - s + stride)/stride;
++ return (el - sl + stride)/stride;
+ }
+ };
+
+ class CArrayIndexRangeS: public ArrayIndexRangeS
+ {
+ public:
++ IndexType Type() { return CArrayIndexRangeSID;}
++
+ SizeT NParam() { return 0;} // number of parameter to Init(...)
+
+ CArrayIndexRangeS( BaseGDL* c1, BaseGDL* c2, BaseGDL* c3):
+@@ -1352,12 +1600,37 @@
+
+ BaseGDL* Index( BaseGDL* var, IxExprListT& ix)
+ {
+- if( e >= var->Size())
++ SizeT varSize = var->Size();
++
++ RangeT sl,el;
++ if( s < 0)
++ {
++ sl = s + varSize;
++ if( sl < 0)
++ throw GDLException(NULL,"Subscript out of range [-S:e:stride].",true,false);
++ }
++ else
++ sl = s;
++ if( e < 0)
++ {
++ el = e + varSize;
++ if( el < 0)
++ throw GDLException(NULL,"Subscript out of range [s:-E:stride].",true,false);
++ }
++ else
++ el = e;
++
++ if( sl > el)
++ throw
++ GDLException(NULL,"Subscript range values of the form low:high "
++ "must be < size, with low <= high",true,false);
++
++ if( el >= var->Size())
+ {
+- throw GDLException(NULL,"Subscript out of range [s:e:st].",true,false);
++ throw GDLException(NULL,"Subscript out of range [s:e:st].",true,false);
+ }
+
+- return var->NewIxFromStride( s, e, stride);
++ return var->NewIxFromStride( sl, el, stride);
+ }
+ };
+
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/arrayindexlistt.hpp cvs/gdl/src/arrayindexlistt.hpp
+--- gdl-0.9rc4/src/arrayindexlistt.hpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/arrayindexlistt.hpp 2010-05-21 10:23:54.885967465 -0600
+@@ -1014,11 +1014,11 @@
+ SizeT nScalar = 0;
+ for( SizeT i=0; (i+1)(ixList[i]) ||
+- dynamic_cast< CArrayIndexScalar*>(ixList[i])) nScalar++;
+- if( dynamic_cast< ArrayIndexIndexed*>(ixList[i]) ||
+- dynamic_cast< CArrayIndexIndexed*>(ixList[i])) nIndexed++;
++ // note: here we examine the actual type
++ if( ArrayIndexScalarID == ixList[i]->Type() ||
++ CArrayIndexScalarID == ixList[i]->Type() ) nScalar++;
++ if( ArrayIndexIndexedID == ixList[i]->Type() ||
++ CArrayIndexIndexedID == ixList[i]->Type()) nIndexed++;
+ }
+ if( nScalar == ixList.size()-1)
+ accessTypeAssocInit = ALLONE;
+@@ -1029,10 +1029,14 @@
+ else
+ accessTypeAssocInit = INDEXED_ONE;
+
+- if( dynamic_cast< ArrayIndexScalar*>(ixList[ixList.size()-1]) ||
++ if( ArrayIndexScalarID == ixList[ixList.size()-1]->Type() ||
++ CArrayIndexScalarID == ixList[ixList.size()-1]->Type()) nScalar++;
++ if( ArrayIndexIndexedID == ixList[ixList.size()-1]->Type() ||
++ CArrayIndexIndexedID == ixList[ixList.size()-1]->Type()) nIndexed++;
++/* if( dynamic_cast< ArrayIndexScalar*>(ixList[ixList.size()-1]) ||
+ dynamic_cast< CArrayIndexScalar*>(ixList[ixList.size()-1])) nScalar++;
+ if( dynamic_cast(ixList[ixList.size()-1]) ||
+- dynamic_cast(ixList[ixList.size()-1]) ) nIndexed++;
++ dynamic_cast(ixList[ixList.size()-1]) ) nIndexed++;*/
+
+ if( nScalar == ixList.size())
+ accessTypeInit = ALLONE;
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/assocdata.hpp cvs/gdl/src/assocdata.hpp
+--- gdl-0.9rc4/src/assocdata.hpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/assocdata.hpp 2010-05-21 10:23:54.895969758 -0600
+@@ -44,13 +44,13 @@
+ ~Assoc_() {}
+
+ // c-i
+- Assoc_( const Assoc_& cp): Parent_( cp),
++ Assoc_( const Assoc_& cp): Parent_(cp),
+ lun(cp.lun),
+ fileOffset( cp.fileOffset),
+ sliceSize( cp.sliceSize)
+ {}
+
+- Parent_* Dup() { return new Assoc_(*this);}
++ Parent_* Dup() { return new Assoc_(*this);}
+
+ void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList, SizeT offset);
+ void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList);
+@@ -170,11 +170,22 @@
+ throw GDLException("File expression not allowed in this context.");
+ }
+
++ bool EqualNoDelete( const BaseGDL*)
++ {
++ throw GDLException("File expression not allowed in this context.");
++ }
++
+ void ForCheck( BaseGDL**, BaseGDL** = NULL)
+ {
+ throw GDLException("File expression not allowed in this context.");
+ }
+
++ bool ForAddCondUp( BaseGDL* loopInfo)
++// bool ForAddCondUp( ForLoopInfoT& loopInfo)
++ {
++ throw GDLException("File expression not allowed in this context.");
++ }
++
+ bool ForCondUp( BaseGDL*)
+ {
+ throw GDLException("File expression not allowed in this context.");
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/basegdl.cpp cvs/gdl/src/basegdl.cpp
+--- gdl-0.9rc4/src/basegdl.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/basegdl.cpp 2010-05-21 10:23:54.899967552 -0600
+@@ -191,6 +191,10 @@
+ {
+ throw GDLException("Operation not defined for UNDEF 1.");
+ }
++int BaseGDL::Scalar2RangeT(RangeT& ret) const
++{
++ throw GDLException("Operation not defined for UNDEF 1a.");
++}
+
+ bool BaseGDL::BaseGDL::True()
+ {
+@@ -227,16 +231,21 @@
+ throw GDLException("Operation not defined for UNDEF 5.");
+ }
+
+-bool BaseGDL::Equal( BaseGDL*)
++bool BaseGDL::Equal( BaseGDL*) const
+ {
+ throw GDLException("Operation not defined for UNDEF 6.");
+ }
+
+-bool BaseGDL::ArrayEqual( BaseGDL*)
++bool BaseGDL::EqualNoDelete( const BaseGDL*) const
+ {
+ throw GDLException("Operation not defined for UNDEF 6a.");
+ }
+
++bool BaseGDL::ArrayEqual( BaseGDL*)
++{
++ throw GDLException("Operation not defined for UNDEF 6b.");
++}
++
+ // for statement compliance (int types , float types scalar only)
+ void BaseGDL::ForCheck( BaseGDL**, BaseGDL**)
+ {
+@@ -248,6 +257,12 @@
+ throw GDLException("Operation not defined for UNDEF 8.");
+ }
+
++bool BaseGDL::ForAddCondUp( BaseGDL* loopInfo)
++// bool BaseGDL::ForAddCondUp( ForLoopInfoT& loopInfo)
++{
++ throw GDLException("Operation not defined for UNDEF 8a.");
++}
++
+ bool BaseGDL::ForCondDown( BaseGDL*)
+ {
+ throw GDLException("Operation not defined for UNDEF 9.");
+@@ -414,7 +429,7 @@
+ throw GDLException("Operation not defined for UNDEF 171.");
+ }
+
+-BaseGDL* BaseGDL::MatrixOp( BaseGDL* r)
++BaseGDL* BaseGDL::MatrixOp( BaseGDL* r, bool rtranspose, bool transposeResult, bool strassen)
+ {
+ throw GDLException("Operation not defined for UNDEF 18.");
+ }
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/basegdl.hpp cvs/gdl/src/basegdl.hpp
+--- gdl-0.9rc4/src/basegdl.hpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/basegdl.hpp 2010-05-21 10:23:54.924905189 -0600
+@@ -157,8 +157,8 @@
+ true, //STRING,
+ true, //STRUCT,
+ true, //COMPLEXDBL,
+- false, //PTR,
+- false, //OBJECT,
++ true, //PTR, nonPOD due to reference counting
++ true, //OBJECT, nonPOD due to reference counting
+ false, //UINT,
+ false, //ULONG,
+ false, //LONG64,
+@@ -210,6 +210,8 @@
+ struct SpDULong;
+ template class Data_;
+
++struct ForLoopInfoT;
++
+ void breakpoint();
+
+ // --- SA: MemStats stuff
+@@ -364,7 +366,7 @@
+ return i;
+ }
+
+- virtual BaseGDL& operator=(const BaseGDL& right);
++ virtual BaseGDL& operator=(const BaseGDL& right);
+
+ // virtual functions
+ virtual bool IsAssoc() const;
+@@ -420,6 +422,7 @@
+ virtual BaseGDL* SetBuffer( const void* b);
+ virtual void SetBufferSize( SizeT s);
+ virtual int Scalar2index(SizeT& ret) const;
++ virtual int Scalar2RangeT(RangeT& ret) const;
+ virtual SizeT LoopIndex() const;
+ virtual bool True();
+ virtual bool False();
+@@ -428,12 +431,16 @@
+ virtual DLong* Where( bool comp, SizeT& count);
+ virtual BaseGDL* LogNeg();
+ virtual int Sgn(); // -1,0,1
+- virtual bool Equal( BaseGDL*);
++ virtual bool Equal( BaseGDL*) const;
++ virtual bool EqualNoDelete( const BaseGDL*) const;
+ virtual bool ArrayEqual( BaseGDL*);
+ // for statement compliance (int types , float types scalar only)
+ virtual void ForCheck( BaseGDL**, BaseGDL** = NULL);
+ virtual bool ForCondUp( BaseGDL*);
+ virtual bool ForCondDown( BaseGDL*);
++ virtual bool ForAddCondUp( BaseGDL* loopInfo);
++// virtual bool ForAddCondUp( ForLoopInfoT& loopInfo);
++// virtual bool ForAddCondDown( ForLoopInfoT& loopInfo);
+ // virtual bool ForCondUpDown( BaseGDL*);
+ virtual void ForAdd( BaseGDL* add=NULL);
+ virtual BaseGDL* CatArray( ExprListT& exprList,
+@@ -530,7 +537,7 @@
+ // virtual BaseGDL* ModInvNew( BaseGDL* r);
+ virtual BaseGDL* PowNew( BaseGDL* r);
+ // virtual BaseGDL* PowInvNew( BaseGDL* r);
+- virtual BaseGDL* MatrixOp( BaseGDL* r);
++ virtual BaseGDL* MatrixOp( BaseGDL* r, bool rtranspose = false, bool transposeResult =false, bool strassen = false);
+ virtual void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList, SizeT offset);
+ virtual void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList);
+ virtual void AssignAt( BaseGDL* srcIn);
+@@ -578,7 +585,29 @@
+ }
+ };
+
++
++
+ typedef ExprListT::iterator ExprListIterT;
+
++
++
++struct ForLoopInfoT
++{
++ BaseGDL* endLoopVar; // the source for foreach as well
++ BaseGDL* loopStepVar;
++ DLong foreachIx;
++
++ ForLoopInfoT()
++ : endLoopVar(NULL)
++ , loopStepVar(NULL)
++ , foreachIx(-1)
++ {}
++ ~ForLoopInfoT()
++ {
++ delete endLoopVar;
++ delete loopStepVar;
++ }
++};
++
+ #endif
+
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/basic_fun_cl.cpp cvs/gdl/src/basic_fun_cl.cpp
+--- gdl-0.9rc4/src/basic_fun_cl.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/basic_fun_cl.cpp 2010-05-21 10:23:55.098906081 -0600
+@@ -128,7 +128,7 @@
+ DIntGDL* v = static_cast(e->GetParDefined(0)->Convert2(INT,BaseGDL::COPY));
+ v_guard.reset( v); // e->Guard(v);
+
+- if (v->Equal(new DIntGDL(1)))
++ if ( (*v)[0] == 1) //->EqualNoDelete( static_cDIntGDL(1)))
+ ret_seconds=true;
+ } else if (nParam == 2) {
+ if (e->KeywordSet("JULIAN")) e->Throw("Conflicting keywords.");
+@@ -140,7 +140,7 @@
+ v_guard.reset( v1); // e->Guard(v1);
+ DDoubleGDL* v2 = static_cast(e->GetParDefined(1)->Convert2(DOUBLE,BaseGDL::COPY));
+
+- if(v1->Equal(new DIntGDL(0))) { //0, read the second argument as time_t;
++ if( (*v1)[0] == 0) { //v1->EqualNoDelete( DIntGDL(0))) { //0, read the second argument as time_t;
+ tval.tv_sec = static_cast((*v2)[0]);
+ tval.tv_usec = static_cast(((*v2)[0]-tval.tv_sec)*1e+6);
+ delete v2; // we delete v2 here as it is not guarded. Avoids a "new" in the following "else"
+diff -ru --unidirectional-new-file --exclude=CVS gdl-0.9rc4/src/basic_fun.cpp cvs/gdl/src/basic_fun.cpp
+--- gdl-0.9rc4/src/basic_fun.cpp 2010-02-02 11:13:51.000000000 -0700
++++ cvs/gdl/src/basic_fun.cpp 2010-04-22 09:50:40.000000000 -0600
+@@ -322,21 +322,26 @@
+
+ DPtrGDL* ret;
+
+- if( e->KeywordSet(0) || e->KeywordSet(1))
++// if( e->KeywordSet(0))
++// ret= new DPtrGDL(dim);//, BaseGDL::NOZERO);
++// else
++// if( e->KeywordSet(1))
++// ret= new DPtrGDL(dim, BaseGDL::NOZERO);
++// else
++// return new DPtrGDL(dim);
++ if( !e->KeywordSet(1))
++ return new DPtrGDL(dim);
++
+ ret= new DPtrGDL(dim, BaseGDL::NOZERO);
+- else
+- return new DPtrGDL(dim);
+
+- if( e->KeywordSet(1))
+- {
+ SizeT nEl=ret->N_Elements();
+ SizeT sIx=e->NewHeap(nEl);
+ #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl))
+ {
+ #pragma omp for
+- for( SizeT i=0; iKeywordSet(0)) return new DObjGDL(dim, BaseGDL::NOZERO);
++// reference counting if( e->KeywordSet(0)) return new DObjGDL(dim, BaseGDL::NOZERO);
+ return new DObjGDL(dim);
+ /* }
+ catch( GDLException& ex)
+@@ -492,7 +497,7 @@
+ auto_ptr pL_guard;
+ if( pL == NULL)
+ {
+- pL = static_cast(p->Convert2(LONG,BaseGDL::COPY));
++ pL = static_cast(p->Convert2(LONG,BaseGDL::COPY));
+ pL_guard.reset( pL);
+ // e->Guard( pL);
+ }
+@@ -1239,6 +1244,8 @@
+ return e->Interpreter()->call_fun( method->GetTree());
+ }
+
++
++
+ BaseGDL* execute( EnvT* e)
+ {
+ int nParam=e->NParam( 1);
+@@ -1259,7 +1266,8 @@
+ e->AssureScalarPar( 0, line);
+
+ // remove current environment (own one)
+- EnvBaseT* caller = e->Caller();
++ assert( dynamic_cast(e->Caller()) != NULL);
++ EnvUDT* caller = static_cast(e->Caller());
+ e->Interpreter()->CallStack().pop_back();
+ delete e;
+
+@@ -1312,30 +1320,42 @@
+
+ if( trAST == NULL) return new DIntGDL( 1);
+
++ int nForLoopsIn = caller->NForLoops();
+ try
+ {
+- ProgNodeP progAST = ProgNode::NewProgNode( trAST);
+- auto_ptr< ProgNode> progAST_guard( progAST);
++ ProgNodeP progAST = ProgNode::NewProgNode( trAST);
++ auto_ptr< ProgNode> progAST_guard( progAST);
+
+- GDLInterpreter::RetCode retCode =
+- caller->Interpreter()->execute( progAST);
++ int nForLoops = ProgNode::NumberForLoops( progAST, nForLoopsIn);
++ caller->ResizeForLoops( nForLoops);
+
+- if( retCode == GDLInterpreter::RC_OK)
+- return new DIntGDL( 1);
+- else
+- return new DIntGDL( 0);
++ progAST->setLine( e->GetLineNumber());
++
++ RetCode retCode = caller->Interpreter()->execute( progAST);
++
++ caller->ResizeForLoops( nForLoopsIn);
++
++ if( retCode == RC_OK)
++ return new DIntGDL( 1);
++ else
++ return new DIntGDL( 0);
+ }
+ catch( GDLException& ex)
+ {
+- if( !quietCompile) cerr << "EXECUTE: Unhandled GDL exception: " <<
+- ex.getMessage() << endl;
+- return new DIntGDL( 0);
++ caller->ResizeForLoops( nForLoopsIn);
++ // are we throwing to target environment?
++// if( ex.GetTargetEnv() == NULL)
++ if( !quietCompile) cerr << "EXECUTE: " <<
++ ex.getMessage() << endl;
++ return new DIntGDL( 0);
+ }
+ catch( ANTLRException ex)
+ {
+- if( !quietCompile) cerr << "EXECUTE: Interpreter exception: " <<
+- ex.getMessage() << endl;
+- return new DIntGDL( 0);
++ caller->ResizeForLoops( nForLoopsIn);
++
++ if( !quietCompile) cerr << "EXECUTE: Interpreter exception: " <<
++ ex.getMessage() << endl;
++ return new DIntGDL( 0);
+ }
+
+ return new DIntGDL( 0); // control flow cannot reach here - compiler shut up
+@@ -1751,7 +1771,7 @@
+ DLong scVal1;
+ bool sc1 = p1L->Scalar( scVal1);
+
+- long scVal2 = numeric_limits::max();
++ DLong scVal2 = numeric_limits::max();
+ bool sc2 = true;
+ if( p2L != NULL)
+ {
+@@ -1766,7 +1786,7 @@
+ stride = p1L->Dim( 0);
+ if( stride != p2L->Dim( 0))
+ e->Throw(
+- "Starting offset and Length arguments "
++ "Starting offset and length arguments "
+ "have incompatible first dimension.");
+ }
+ else
+@@ -1790,21 +1810,21 @@
+ SizeT nEl2 = (sc2)? 1 : p2L->N_Elements();
+
+ SizeT nSrcStr = p0S->N_Elements();
+-#pragma omp parallel if ((nSrcStr*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nSrcStr*10)))
++#pragma omp parallel if ((nSrcStr*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nSrcStr*10))) default( shared)
+ {
+ #pragma omp for
+ for( long i=0; iKeywordIx("INTEGER");
+ static int doubleIx = e->KeywordIx( "DOUBLE");
+ static int nanIx = e->KeywordIx( "NAN");
++ static int preserveIx = e->KeywordIx( "PRESERVE_TYPE");
+
+ bool cumulative = e->KeywordSet( cumIx);
+ bool intRes = e->KeywordSet( intIx);
+ bool doubleRes = e->KeywordSet( doubleIx);
+ bool nan = e->KeywordSet( nanIx);
++ bool preserve = e->KeywordSet( preserveIx);
+
+ DLong sumDim = 0;
+ if( nParam == 2)
+@@ -2160,6 +2182,24 @@
+ {
+ if( !cumulative)
+ {
++ if (preserve)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return total_template(static_cast(p0), false);
++ case INT: return total_template(static_cast(p0), false);
++ case UINT: return total_template(static_cast(p0), false);
++ case LONG: return total_template(static_cast(p0), false);
++ case ULONG: return total_template(static_cast(p0), false);
++ case LONG64: return total_template(static_cast(p0), false);
++ case ULONG64: return total_template(static_cast(p0), false);
++ case FLOAT: return total_template(static_cast(p0), nan);
++ case DOUBLE: return total_template(static_cast(p0), nan);
++ case COMPLEX: return total_template(static_cast(p0), nan);
++ case COMPLEXDBL: return total_template(static_cast(p0), nan);
++ default: assert(false);
++ }
++ }
+
+ // Integer parts by Erin Sheldon
+ // In IDL total(), the INTEGER keyword takes precedence
+@@ -2229,6 +2269,24 @@
+ }
+ else // cumulative
+ {
++ if (preserve)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return total_cu_template(static_cast(p0)->Dup(), false);
++ case INT: return total_cu_template(static_cast(p0)->Dup(), false);
++ case UINT: return total_cu_template(static_cast(p0)->Dup(), false);
++ case LONG: return total_cu_template(static_cast(p0)->Dup(), false);
++ case ULONG: return total_cu_template(static_cast(p0)->Dup(), false);
++ case LONG64: return total_cu_template(static_cast(p0)->Dup(), false);
++ case ULONG64: return total_cu_template(static_cast(p0)->Dup(), false);
++ case FLOAT: return total_cu_template(static_cast(p0)->Dup(), nan);
++ case DOUBLE: return total_cu_template(static_cast(p0)->Dup(), nan);
++ case COMPLEX: return total_cu_template(static_cast(p0)->Dup(), nan);
++ case COMPLEXDBL: return total_cu_template(static_cast(p0)->Dup(), nan);
++ default: assert(false);
++ }
++ }
+
+ // INTEGER keyword takes precedence
+ if( intRes )
+@@ -2302,6 +2360,24 @@
+
+ if( !cumulative)
+ {
++ if (preserve)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case INT: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case UINT: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case LONG: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case ULONG: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case LONG64: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case ULONG64: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false);
++ case FLOAT: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan);
++ case DOUBLE: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan);
++ case COMPLEX: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan);
++ case COMPLEXDBL: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan);
++ default: assert(false);
++ }
++ }
+
+ // INTEGER keyword takes precedence
+ if( intRes )
+@@ -2377,6 +2453,24 @@
+ }
+ else // cumulative
+ {
++ if (preserve)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case INT: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case UINT: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case LONG: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case ULONG: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case LONG64: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case ULONG64: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, false);
++ case FLOAT: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, nan);
++ case DOUBLE: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, nan);
++ case COMPLEX: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, nan);
++ case COMPLEXDBL: return total_over_dim_cu_template(static_cast(p0)->Dup(), sumDim-1, nan);
++ default: assert(false);
++ }
++ }
+
+ // INTEGER keyword takes precedence
+ if( intRes )
+@@ -2502,6 +2596,28 @@
+ }
+
+ template<>
++ BaseGDL* product_template( DComplexGDL* src, bool omitNaN)
++ {
++ DComplexGDL::Ty sum = 1;
++ SizeT nEl = src->N_Elements();
++ if( !omitNaN)
++ {
++ for ( SizeT i=0; i
+ BaseGDL* product_template( DComplexDblGDL* src, bool omitNaN)
+ {
+ DComplexDblGDL::Ty sum = 1;
+@@ -2606,138 +2722,324 @@
+ BaseGDL* product( EnvT* e)
+ {
+ SizeT nParam = e->NParam( 1);
+-
++
+ BaseGDL* p0 = e->GetParDefined( 0);
+-
++
+ SizeT nEl = p0->N_Elements();
+ if( nEl == 0)
+ e->Throw( "Variable is undefined: "+e->GetParString(0));
+-
++
+ if( p0->Type() == STRING)
+ e->Throw( "String expression not allowed "
+ "in this context: "+e->GetParString(0));
+
+ static int cumIx = e->KeywordIx( "CUMULATIVE");
+ static int nanIx = e->KeywordIx( "NAN");
+- bool cumulative = e->KeywordSet( cumIx);
+- bool nan = e->KeywordSet( nanIx);
+-
++ static int intIx = e->KeywordIx("INTEGER");
++ static int preIx = e->KeywordIx("PRESERVE_TYPE");
++ bool KwCumul = e->KeywordSet( cumIx);
++ bool KwNaN = e->KeywordSet( nanIx);
++ bool KwInt = e->KeywordSet( intIx);
++ bool KwPre = e->KeywordSet( preIx);
++ bool nanInt=false;
++
+ DLong sumDim = 0;
+ if( nParam == 2)
+ e->AssureLongScalarPar( 1, sumDim);
++
++ if( sumDim == 0) {
++ if( !KwCumul) {
++ if (KwPre)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return product_template(static_cast(p0), nanInt);
++ case INT: return product_template(static_cast(p0), nanInt);
++ case UINT: return product_template(static_cast(p0), nanInt);
++ case LONG: return product_template(static_cast(p0), nanInt);
++ case ULONG: return product_template(static_cast(p0), nanInt);
++ case LONG64: return product_template(static_cast(p0), nanInt);
++ case ULONG64: return product_template(static_cast(p0), nanInt);
++ case FLOAT: return product_template(static_cast(p0), KwNaN);
++ case DOUBLE: return product_template(static_cast(p0), KwNaN);
++ case COMPLEX: return product_template(static_cast(p0), KwNaN);
++ case COMPLEXDBL: return product_template(static_cast(p0), KwNaN);
++ default: assert(false);
++ }
++ }
+
+- if( sumDim == 0)
+- {
+- if( !cumulative)
+- {
+- if( p0->Type() == DOUBLE)
+- {
+- return product_template
+- ( static_cast(p0), nan);
+- }
+- if( p0->Type() == COMPLEXDBL)
+- {
+- return product_template
+- ( static_cast(p0), nan);
+- }
+- if( p0->Type() == COMPLEX)
+- {
+- DComplexDblGDL* p0D = static_cast
+- (p0->Convert2( COMPLEXDBL,BaseGDL::COPY));
+- auto_ptr p0D_guard( p0D);
+- //p0D_guard.reset( p0D);
+- return product_template( p0D, nan);
+- }
++ // Integer parts derivated from Total code by Erin Sheldon
++ // In IDL PRODUCT(), the INTEGER keyword takes precedence
++ if (KwInt) {
++ // We use LONG64 unless the input is ULONG64
++ if ((p0->Type() == LONG64) && (!KwNaN)) {
++ return product_template
++ ( static_cast(p0), nanInt );
++ }
++ if ((p0->Type() == ULONG64) && (!KwNaN)) {
++ return product_template
++ (static_cast(p0), nanInt );
++ }
+
+- DDoubleGDL* p0D = static_cast
+- (p0->Convert2( DOUBLE, BaseGDL::COPY));
+- auto_ptr p0D_guard( p0D);
+- // p0D_guard.reset( p0D);
+- return product_template( p0D, nan);
+- }
+- else // cumulative
+- {
+- // special case as DOUBLE type overrides /DOUBLE
+- if( p0->Type() == DOUBLE)
+- {
+- return product_cu_template< DDoubleGDL>
+- ( static_cast(p0)->Dup(), nan);
+- }
+- if( p0->Type() == COMPLEXDBL)
+- {
+- return product_cu_template< DComplexDblGDL>
+- ( static_cast(p0)->Dup(), nan);
+- }
+- if( p0->Type() == COMPLEX)
+- {
+- return product_cu_template< DComplexDblGDL>
+- ( static_cast(p0->Convert2( COMPLEXDBL,
+- BaseGDL::COPY)), nan);
++ // Convert to Long64
++ DLong64GDL* p0L64 = static_cast
++ (p0->Convert2( LONG64, BaseGDL::COPY));
++ auto_ptr guard( p0L64);
++ if (KwNaN) {
++ DFloatGDL* p0f = static_cast
++ (p0->Convert2( FLOAT, BaseGDL::COPY));
++ auto_ptr guard( p0f);
++ for( SizeT i=0; i
+- ( static_cast(p0->Convert2( DOUBLE,
+- BaseGDL::COPY)), nan);
++ }
++ return product_template( p0L64, nanInt);
++ } // integer results
++
++ if( p0->Type() == DOUBLE) {
++ return product_template
++ ( static_cast(p0), KwNaN);
++ }
++ if( p0->Type() == COMPLEXDBL) {
++ return product_template
++ ( static_cast(p0), KwNaN);
+ }
+- }
++ if( p0->Type() == COMPLEX) {
++ DComplexDblGDL* p0D = static_cast
++ (p0->Convert2( COMPLEXDBL,BaseGDL::COPY));
++ auto_ptr p0D_guard( p0D);
++ //p0D_guard.reset( p0D);
++ return product_template( p0D, KwNaN);
++ }
++
++ DDoubleGDL* p0D = static_cast
++ (p0->Convert2( DOUBLE, BaseGDL::COPY));
++ auto_ptr p0D_guard( p0D);
++ // p0D_guard.reset( p0D);
++ return product_template( p0D, KwNaN);
++ }
++ else
++ { // KwCumul
+
++ if (KwPre)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case INT: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case UINT: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case LONG: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case ULONG: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case LONG64: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case ULONG64: return product_cu_template(static_cast(p0)->Dup(), nanInt);
++ case FLOAT: return product_cu_template(static_cast(p0)->Dup(), KwNaN);
++ case DOUBLE: return product_cu_template(static_cast(p0)->Dup(), KwNaN);
++ case COMPLEX: return product_cu_template(static_cast(p0)->Dup(), KwNaN);
++ case COMPLEXDBL: return product_cu_template(static_cast(p0)->Dup(), KwNaN);
++ default: assert(false);
++ }
++ }
++
++ // Integer parts derivated from Total code by Erin Sheldon
++ // In IDL PRODUCT(), the INTEGER keyword takes precedence
++ if (KwInt) {
++ // We use LONG64 unless the input is ULONG64
++ if ((p0->Type() == LONG64) && (!KwNaN)) {
++ return product_cu_template
++ ( static_cast(p0)->Dup(), nanInt);
++ }
++ if ((p0->Type() == ULONG64) && (!KwNaN)) {
++ return product_cu_template
++ ( static_cast(p0)->Dup(), nanInt);
++ }
++ // Convert to Long64
++ DLong64GDL* p0L64 = static_cast
++ (p0->Convert2( LONG64, BaseGDL::COPY));
++ auto_ptr guard( p0L64);
++ if (KwNaN) {
++ DFloatGDL* p0f = static_cast
++ (p0->Convert2( FLOAT, BaseGDL::COPY));
++ auto_ptr guard( p0f);
++ for( SizeT i=0; i
++ ((p0L64)->Dup(), nanInt);
++ } // integer results
++
++ // special case as DOUBLE type overrides /DOUBLE
++ if (p0->Type() == DOUBLE) {
++ return product_cu_template< DDoubleGDL>
++ ( static_cast(p0)->Dup(), KwNaN);
++ }
++ if (p0->Type() == COMPLEXDBL) {
++ return product_cu_template< DComplexDblGDL>
++ ( static_cast(p0)->Dup(), KwNaN);
++ }
++ if (p0->Type() == COMPLEX) {
++ return product_cu_template< DComplexDblGDL>
++ ( static_cast
++ (p0->Convert2( COMPLEXDBL, BaseGDL::COPY)), KwNaN);
++ }
++ return product_cu_template< DDoubleGDL>
++ ( static_cast
++ (p0->Convert2( DOUBLE, BaseGDL::COPY)), KwNaN);
++ }
++ }
++
+ // product over sumDim
+ dimension srcDim = p0->Dim();
+ SizeT srcRank = srcDim.Rank();
+-
++
+ if( sumDim < 1 || sumDim > srcRank)
+ e->Throw( "Array must have "+i2s(sumDim)+
+ " dimensions: "+e->GetParString(0));
++
++ if (!KwCumul) {
+
+- if( !cumulative)
++ if (KwPre)
+ {
+- if( p0->Type() == DOUBLE)
+- {
+- return product_over_dim_template< DDoubleGDL>
+- ( static_cast(p0), srcDim, sumDim-1, nan);
+- }
+- if( p0->Type() == COMPLEXDBL)
+- {
+- return product_over_dim_template< DComplexDblGDL>
+- ( static_cast(p0), srcDim, sumDim-1, nan);
+- }
+- if( p0->Type() == COMPLEX)
+- {
+- DComplexDblGDL* p0D = static_cast
+- (p0->Convert2( COMPLEXDBL,BaseGDL::COPY));
+- auto_ptr p0D_guard( p0D);
+- // p0D_guard.reset( p0D);
+- return product_over_dim_template< DComplexDblGDL>
+- ( p0D, srcDim, sumDim-1, nan);
+- }
+-
+- DDoubleGDL* p0D = static_cast
+- (p0->Convert2( DOUBLE,BaseGDL::COPY));
+- auto_ptr p0D_guard( p0D);
+- //p0D_guard.reset( p0D);
+- return product_over_dim_template< DDoubleGDL>( p0D, srcDim, sumDim-1,nan);
++ switch (p0->Type())
++ {
++ case BYTE: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case INT: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case UINT: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case LONG: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case ULONG: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case LONG64: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case ULONG64: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt);
++ case FLOAT: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN);
++ case DOUBLE: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN);
++ case COMPLEX: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN);
++ case COMPLEXDBL: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN);
++ default: assert(false);
++ }
+ }
+- else // cumulative
+- {
+- if( p0->Type() == DOUBLE)
+- {
+- return product_over_dim_cu_template< DDoubleGDL>
+- ( static_cast(p0)->Dup(), sumDim-1, nan);
+- }
+- if( p0->Type() == COMPLEXDBL)
+- {
+- return product_over_dim_cu_template< DComplexDblGDL>
+- ( static_cast(p0)->Dup(), sumDim-1, nan);
+- }
+- if( p0->Type() == COMPLEX)
+- {
+- return product_over_dim_cu_template< DComplexDblGDL>
+- ( static_cast(p0->Convert2( COMPLEXDBL,
+- BaseGDL::COPY)), sumDim-1, nan);
++
++ // Integer parts derivated from Total code by Erin Sheldon
++ // In IDL PRODUCT(), the INTEGER keyword takes precedence
++ if (KwInt) {
++ // We use LONG64 unless the input is ULONG64
++ if ((p0->Type() == LONG64 ) && (!KwNaN)) {
++ return product_over_dim_template
++ ( static_cast(p0), srcDim, sumDim-1, nanInt);
++ }
++ if ((p0->Type() == ULONG64) && (!KwNaN)) {
++ return product_over_dim_template
++ ( static_cast(p0), srcDim, sumDim-1, nanInt);
++ }
++
++ // Conver to Long64
++ DLong64GDL* p0L64 = static_cast
++ (p0->Convert2( LONG64, BaseGDL::COPY));
++ auto_ptr guard( p0L64);
++ if (KwNaN) {
++ DFloatGDL* p0f = static_cast
++ (p0->Convert2( FLOAT, BaseGDL::COPY));
++ auto_ptr guard( p0f);
++ for( SizeT i=0; i
++ ( p0L64, srcDim, sumDim-1, nanInt);
++ } // integer results
++
++ if( p0->Type() == DOUBLE) {
++ return product_over_dim_template< DDoubleGDL>
++ ( static_cast(p0), srcDim, sumDim-1, KwNaN);
++ }
++ if( p0->Type() == COMPLEXDBL) {
++ return product_over_dim_template< DComplexDblGDL>
++ ( static_cast(p0), srcDim, sumDim-1, KwNaN);
++ }
++ if( p0->Type() == COMPLEX) {
++ DComplexDblGDL* p0D = static_cast
++ (p0->Convert2( COMPLEXDBL,BaseGDL::COPY));
++ auto_ptr p0D_guard( p0D);
++ // p0D_guard.reset( p0D);
++ return product_over_dim_template< DComplexDblGDL>
++ ( p0D, srcDim, sumDim-1, KwNaN);
++ }
++
++ DDoubleGDL* p0D = static_cast
++ (p0->Convert2( DOUBLE,BaseGDL::COPY));
++ auto_ptr p0D_guard( p0D);
++ //p0D_guard.reset( p0D);
++ return product_over_dim_template< DDoubleGDL>
++ ( p0D, srcDim, sumDim-1,KwNaN);
++ }
++ else
++ { // KwCumul
+
++ if (KwPre)
++ {
++ switch (p0->Type())
++ {
++ case BYTE: return product_over_dim_cu_template(static_cast