changeset 6276:d26c558691cd

[project @ 2007-02-07 09:01:24 by jwe]
author jwe
date Wed, 07 Feb 2007 09:01:24 +0000
parents 6e5835ef21f8
children bdfb345dab8d
files ChangeLog aclocal.m4 configure.in src/ChangeLog src/defaults.cc src/ls-hdf5.cc src/ov-bool-mat.cc src/ov-bool-sparse.cc src/ov-cell.cc src/toplev.cc
diffstat 10 files changed, 67 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 07 07:29:47 2007 +0000
+++ b/ChangeLog	Wed Feb 07 09:01:24 2007 +0000
@@ -1,3 +1,8 @@
+2007-02-07  Michael Goffioul  <michael.goffioul@swing.be>
+
+	* aclocal.m4 (OCTAVE_HDF5_DLL): New macro.
+	* configure.in: Use it.
+
 2007-02-05  John W. Eaton  <jwe@octave.org>
 
 	* configure.in: Check for realpath function.
--- a/aclocal.m4	Wed Feb 07 07:29:47 2007 +0000
+++ b/aclocal.m4	Wed Feb 07 09:01:24 2007 +0000
@@ -987,3 +987,21 @@
   AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define if the UMFPACK Complex solver allow matrix and RHS to be split independently])
 fi
 ])
+dnl
+dnl Check whether using HDF5 DLL under Windows. This is done by
+dnl testing for a data symbol in the HDF5 library, which would
+dnl requires the definition of _HDF5USEDL_ under MSVC compiler.
+dnl
+AC_DEFUN([OCTAVE_HDF5_DLL], [
+  AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],octave_cv_hdf5_dll, [
+    AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE;],
+      octave_cv_hdf5_dll=no, [
+      CFLAGS_old=$CFLAGS
+      CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_"
+      AC_TRY_LINK([#include <hdf5.h>], [hid_t x = H5T_NATIVE_DOUBLE;],
+        octave_cv_hdf5_dll=yes,
+	octave_cv_hdf5_dll=no)
+      CFLAGS=$CFLAGS_old])])
+  if test "$octave_cv_hdf5_dll" = yes; then
+    AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)])
+  fi])
--- a/configure.in	Wed Feb 07 07:29:47 2007 +0000
+++ b/configure.in	Wed Feb 07 09:01:24 2007 +0000
@@ -29,7 +29,7 @@
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
 AC_INIT
-AC_REVISION($Revision: 1.552 $)
+AC_REVISION($Revision: 1.553 $)
 AC_PREREQ(2.57)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -527,6 +527,11 @@
   fi
 
   if $WITH_HDF5; then
+    case "$canonical_host_type" in
+      *-*-msdosmsvc)
+        OCTAVE_HDF5_DLL
+        ;;
+    esac
     true
   else
     warn_hdf5="HDF5 library not found.  Octave will not be able to save or load HDF5 data files."
@@ -1913,6 +1918,7 @@
 
 #if defined (_MSC_VER)
 #define __WIN32__
+#define WIN32
 /* missing parameters in macros */
 #pragma warning (disable: 4003)
 /* missing implementations in template instantiation */
--- a/src/ChangeLog	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/ChangeLog	Wed Feb 07 09:01:24 2007 +0000
@@ -1,3 +1,19 @@
+2007-02-07  John W. Eaton  <jwe@octave.org>
+
+	* defaults.cc (subst_octave_home):
+	Only substitute at beginning of string.
+
+	* ls-hdf5.cc (save_hdf5_empty): Use OCTAVE_LOCAL_BUFFER.
+	* ov-bool-mat.cc (octave_bool_matrix::save_hdf5,
+	octave_bool_matrix::load_hdf5): Likewise.
+	* ov-bool-sparse.cc (octave_sparse_bool_matrix::save_hdf5,
+	octave_sparse_bool_matrix::load_hdf5): Likewise.
+
+2007-02-07  Michael Goffioul  <michael.goffioul@swing.be>
+
+	* ov-cell.cc (octave_cell::save_hdf5): Correct test for H5Dwrite
+	return value.
+
 2007-02-07  John W. Eaton  <jwe@octave.org>
 
 	* zfstream.cc (gzfilebuf::open_mode): Always append "b" to c_mode.
--- a/src/defaults.cc	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/defaults.cc	Wed Feb 07 09:01:24 2007 +0000
@@ -108,12 +108,9 @@
   if (Voctave_home != prefix)
     {
       octave_idx_type len = prefix.length ();
-      size_t start = 0;
-      while ((start = retval.find (prefix, start)) != NPOS)
-	{
-	  retval.replace (start, len, Voctave_home);
-	  start += len;
-	}
+
+      if (s.substr (0, len) == prefix)
+	retval.replace (0, len, Voctave_home);
     }
 
   if (file_ops::dir_sep_char != '/')
--- a/src/ls-hdf5.cc	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/ls-hdf5.cc	Wed Feb 07 09:01:24 2007 +0000
@@ -624,7 +624,7 @@
 save_hdf5_empty (hid_t loc_id, const char *name, const dim_vector d)
 {
   hsize_t sz = d.length ();
-  octave_idx_type dims[sz];
+  OCTAVE_LOCAL_BUFFER (octave_idx_type, dims, sz);
   bool empty = false;
   hid_t space_hid = -1, data_hid = -1;
   int retval;
--- a/src/ov-bool-mat.cc	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/ov-bool-mat.cc	Wed Feb 07 09:01:24 2007 +0000
@@ -391,7 +391,7 @@
 
   octave_idx_type nel = m.nelem ();
   bool *mtmp = m.fortran_vec ();
-  hbool_t htmp[nel];
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
   
   for (octave_idx_type i = 0; i < nel; i++)
     htmp[i] = mtmp[i];
@@ -449,9 +449,9 @@
     }
 
   octave_idx_type nel = dv.numel ();
-  hbool_t htmp[nel];
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel);
   if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, 
-	       H5P_DEFAULT, htmp) >= 0) 
+	       H5P_DEFAULT, &htmp[0]) >= 0) 
     {
       retval = true;
 
--- a/src/ov-bool-sparse.cc	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/ov-bool-sparse.cc	Wed Feb 07 09:01:24 2007 +0000
@@ -479,13 +479,13 @@
       H5Gclose (group_hid);
       return false;
     }
-  
-  hbool_t htmp[m.nzmax ()];
+
+  OCTAVE_LOCAL_BUFFER (hbool_t, htmp, m.nzmax ());  
   for (int i = 0; i < m.nzmax (); i++)
     htmp[i] = m.xdata(i);
 
   retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL,
-		     H5P_DEFAULT, htmp) >= 0;
+		     H5P_DEFAULT, &htmp[0]) >= 0;
   H5Dclose (data_hid);
   H5Sclose (space_hid);
   H5Gclose (group_hid);
@@ -671,9 +671,13 @@
       return false;
     }
 
+#ifndef _MSC_VER
   hbool_t htmp[nz];
+#else
+  std::vector<hbool_t> htmp (nz);
+#endif
   bool retval = false;
-  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, htmp) >= 0) 
+  if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, &htmp[0]) >= 0) 
     {
       retval = true;
 
--- a/src/ov-cell.cc	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/ov-cell.cc	Wed Feb 07 09:01:24 2007 +0000
@@ -775,8 +775,8 @@
       return false;
     }
 
-  if (! H5Dwrite (size_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
-		  H5P_DEFAULT, hdims) < 0)
+  if (H5Dwrite (size_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL,
+		H5P_DEFAULT, hdims) < 0)
     {
       H5Dclose (size_hid);
       H5Sclose (space_hid);
@@ -796,7 +796,7 @@
   for (octave_idx_type i = 0; i < nel; i++)
     {
       std::ostringstream buf;
-      int digits = static_cast<int> (floor (log10 (nel) + 1.0));
+      int digits = static_cast<int> (floor (log10 (static_cast<double> (nel)) + 1.0));
       buf << "_" << std::setw (digits) << std::setfill ('0') << i;
       std::string s = buf.str ();
 
--- a/src/toplev.cc	Wed Feb 07 07:29:47 2007 +0000
+++ b/src/toplev.cc	Wed Feb 07 09:01:24 2007 +0000
@@ -814,12 +814,12 @@
       { false, "config_opts", OCTAVE_CONF_config_opts },
       { true, "datadir", OCTAVE_DATADIR },
       { true, "datarootdir", OCTAVE_DATAROOTDIR },
-      { false, "exec_prefix", OCTAVE_EXEC_PREFIX },
+      { true, "exec_prefix", OCTAVE_EXEC_PREFIX },
       { true, "fcnfiledir", OCTAVE_FCNFILEDIR },
       { true, "imagedir", OCTAVE_IMAGEDIR },
       { true, "includedir", OCTAVE_INCLUDEDIR },
       { true, "infodir", OCTAVE_INFODIR },
-      { false, "infofile", OCTAVE_INFOFILE },
+      { true, "infofile", OCTAVE_INFOFILE },
       { true, "libdir", OCTAVE_LIBDIR },
       { true, "libexecdir", OCTAVE_LIBEXECDIR },
       { true, "localapifcnfiledir", OCTAVE_LOCALAPIFCNFILEDIR },
@@ -838,7 +838,7 @@
       { true, "octfiledir", OCTAVE_OCTFILEDIR },
       { true, "octincludedir", OCTAVE_OCTINCLUDEDIR },
       { true, "octlibdir", OCTAVE_OCTLIBDIR },
-      { false, "prefix", OCTAVE_PREFIX },
+      { true, "prefix", OCTAVE_PREFIX },
       { true, "startupfiledir", OCTAVE_STARTUPFILEDIR },
       { false, "version", OCTAVE_VERSION },
       { false, 0, 0 }