annotate libinterp/corefcn/ls-hdf5.cc @ 21200:fcac5dbbf9ed

maint: Indent #ifdef blocks in libinterp. * builtins.h, Cell.cc, __contourc__.cc, __dispatch__.cc, __dsearchn__.cc, __ichol__.cc, __ilu__.cc, __lin_interpn__.cc, __pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, cellfun.cc, colloc.cc, comment-list.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, defaults.cc, defaults.in.h, defun-dld.h, defun.cc, defun.h, det.cc, dirfns.cc, display.cc, dlmread.cc, dot.cc, dynamic-ld.cc, eig.cc, ellipj.cc, error.cc, errwarn.cc, event-queue.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, gammainc.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, gripes.cc, hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, jit-ir.cc, jit-typeinfo.cc, jit-util.cc, jit-util.h, kron.cc, load-path.cc, load-save.cc, lookup.cc, ls-ascii-helper.cc, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc, ls-oct-text.h, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, luinc.cc, mappers.cc, matrix_type.cc, max.cc, mex.h, mexproto.h, mgorth.cc, nproc.cc, oct-errno.in.cc, oct-fstrm.cc, oct-hdf5-types.cc, oct-hdf5.h, oct-hist.cc, oct-iostrm.cc, oct-lvalue.cc, oct-map.cc, oct-prcstrm.cc, oct-procbuf.cc, oct-stream.cc, oct-strstrm.cc, octave-link.cc, ordschur.cc, pager.cc, pinv.cc, pr-output.cc, procstream.cc, profiler.cc, psi.cc, pt-jit.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc, sysdep.h, time.cc, toplev.cc, tril.cc, tsearch.cc, txt-eng-ft.cc, txt-eng.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, xdiv.cc, xnorm.cc, xpow.cc, zfstream.cc, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __magick_read__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc, convhulln.cc, dmperm.cc, fftw.cc, oct-qhull.h, qr.cc, symbfact.cc, symrcm.cc, oct-conf.in.cc, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc, ov-base-scalar.cc, ov-base-sparse.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.cc, ov-cell.cc, ov-ch-mat.cc, ov-class.cc, ov-classdef.cc, ov-colon.cc, ov-complex.cc, ov-cs-list.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-fcn.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-lazy-idx.cc, ov-mex-fcn.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, ov-usr-fcn.cc, ov.cc, ovl.cc, octave.cc, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-double-conv.cc, op-fcdm-fcdm.cc, op-fcdm-fdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-float-conv.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-int-conv.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, pt-arg-list.cc, pt-array-list.cc, pt-assign.cc, pt-binop.cc, pt-bp.cc, pt-cbinop.cc, pt-cell.cc, pt-check.cc, pt-classdef.cc, pt-cmd.cc, pt-colon.cc, pt-colon.h, pt-const.cc, pt-decl.cc, pt-eval.cc, pt-except.cc, pt-exp.cc, pt-fcn-handle.cc, pt-funcall.cc, pt-id.cc, pt-idx.cc, pt-jump.cc, pt-loop.cc, pt-mat.cc, pt-misc.cc, pt-pr-code.cc, pt-select.cc, pt-stmt.cc, pt-unop.cc, pt.cc, token.cc, Array-jit.cc, Array-os.cc, Array-sym.cc, Array-tc.cc, version.cc: Indent #ifdef blocks in libinterp.
author Rik <rik@octave.org>
date Fri, 05 Feb 2016 16:29:08 -0800
parents e39e05d90788
children 2cf8bc5c7017
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1 /*
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 18678
diff changeset
3 Copyright (C) 1996-2015 John W. Eaton
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
4
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
6
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6276
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6276
diff changeset
10 option) any later version.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
11
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
15 for more details.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
16
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6276
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6276
diff changeset
19 <http://www.gnu.org/licenses/>.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
20
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
21 */
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
22
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
23 // Author: Steven G. Johnson <stevenj@alum.mit.edu>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
24
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
25 #ifdef HAVE_CONFIG_H
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21100
diff changeset
26 # include <config.h>
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
27 #endif
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
28
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
29 #if defined (HAVE_HDF5)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
30
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
31 #include <cfloat>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
32 #include <cstring>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
33 #include <cctype>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
34
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
35 #include <fstream>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
36 #include <iomanip>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
37 #include <iostream>
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
38 #include <string>
4726
14dc2267c343 [project @ 2004-01-23 20:04:35 by jwe]
jwe
parents: 4696
diff changeset
39 #include <vector>
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
40
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
41 #include "byte-swap.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
42 #include "data-conv.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
43 #include "file-ops.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
44 #include "glob-match.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
45 #include "lo-mappers.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
46 #include "mach-info.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
47 #include "oct-env.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
48 #include "oct-time.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
49 #include "quit.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
50 #include "str-vec.h"
8377
25bc2d31e1bf improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents: 7336
diff changeset
51 #include "oct-locbuf.h"
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
52
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
53 #include "Cell.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
54 #include "defun.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
55 #include "error.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21022
diff changeset
56 #include "errwarn.h"
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
57 #include "load-save.h"
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
58 #include "oct-hdf5.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20449
diff changeset
59 #include "ovl.h"
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
60 #include "oct-map.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
61 #include "ov-cell.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
62 #include "pager.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
63 #include "pt-exp.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
64 #include "sysdep.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
65 #include "unwind-prot.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
66 #include "utils.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
67 #include "variables.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
68 #include "version.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
69 #include "dMatrix.h"
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
70 #include "ov-lazy-idx.h"
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
71
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
72 #include "ls-utils.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
73 #include "ls-hdf5.h"
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
74
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
75 hdf5_fstreambase::hdf5_fstreambase (const char *name, int mode, int /* prot */)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
76 : file_id (-1), current_item (-1)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
77 {
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
78 if (mode & std::ios::in)
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
79 file_id = H5Fopen (name, H5F_ACC_RDONLY, octave_H5P_DEFAULT);
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
80 else if (mode & std::ios::out)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
81 {
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
82 if (mode & std::ios::app && H5Fis_hdf5 (name) > 0)
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
83 file_id = H5Fopen (name, H5F_ACC_RDWR, octave_H5P_DEFAULT);
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
84 else
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
85 file_id = H5Fcreate (name, H5F_ACC_TRUNC, octave_H5P_DEFAULT,
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
86 octave_H5P_DEFAULT);
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
87 }
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
88 if (file_id < 0)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
89 std::ios::setstate (std::ios::badbit);
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
90
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
91 current_item = 0;
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
92 }
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
93
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
94 void
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
95 hdf5_fstreambase::close (void)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
96 {
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
97 if (file_id >= 0)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
98 {
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
99 if (H5Fclose (file_id) < 0)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
100 std::ios::setstate (std::ios::badbit);
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
101 file_id = -1;
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
102 }
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
103 }
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
104
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
105 void
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
106 hdf5_fstreambase::open (const char *name, int mode, int)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
107 {
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
108 clear ();
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
109
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
110 if (mode & std::ios::in)
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
111 file_id = H5Fopen (name, H5F_ACC_RDONLY, octave_H5P_DEFAULT);
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
112 else if (mode & std::ios::out)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
113 {
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
114 if (mode & std::ios::app && H5Fis_hdf5 (name) > 0)
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
115 file_id = H5Fopen (name, H5F_ACC_RDWR, octave_H5P_DEFAULT);
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
116 else
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
117 file_id = H5Fcreate (name, H5F_ACC_TRUNC, octave_H5P_DEFAULT,
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
118 octave_H5P_DEFAULT);
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
119 }
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
120 if (file_id < 0)
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
121 std::ios::setstate (std::ios::badbit);
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
122
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
123 current_item = 0;
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
124 }
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
125
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
126 static std::string
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
127 make_valid_identifier (const std::string& nm)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
128 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
129 std::string retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
130
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
131 size_t nm_len = nm.length ();
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
132
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
133 if (nm_len > 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
134 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
135 if (! isalpha (nm[0]))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
136 retval += '_';
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
137
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
138 for (size_t i = 0; i < nm_len; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
139 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
140 char c = nm[i];
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
141 retval += (isalnum (c) || c == '_') ? c : '_';
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
142 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
143 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
144
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
145 return retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
146 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
147
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
148 // Define this to 1 if/when HDF5 supports automatic conversion between
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
149 // integer and floating-point binary data:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
150 #define HAVE_HDF5_INT2FLOAT_CONVERSIONS 0
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
151
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
152 // Given two compound types t1 and t2, determine whether they
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
153 // are compatible for reading/writing. This function only
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
154 // works for non-nested types composed of simple elements (ints, floats...),
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
155 // which is all we need it for
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
156
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
157 bool
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
158 hdf5_types_compatible (octave_hdf5_id t1, octave_hdf5_id t2)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
159 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
160 int n;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
161 if ((n = H5Tget_nmembers (t1)) != H5Tget_nmembers (t2))
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
162 return false;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
163
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
164 for (int i = 0; i < n; ++i)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
165 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
166 hid_t mt1 = H5Tget_member_type (t1, i);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
167 hid_t mt2 = H5Tget_member_type (t2, i);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
168
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
169 if (H5Tget_class (mt1) != H5Tget_class (mt2))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
170 return false;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
171
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
172 H5Tclose (mt2);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
173 H5Tclose (mt1);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
174 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
175
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
176 return true;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
177 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
178
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
179 // Return true if loc_id has the attribute named attr_name, and false
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
180 // otherwise.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
181
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
182 bool
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
183 hdf5_check_attr (octave_hdf5_id loc_id, const char *attr_name)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
184 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
185 bool retval = false;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
186
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
187 // we have to pull some shenanigans here to make sure
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
188 // HDF5 doesn't print out all sorts of error messages if we
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
189 // call H5Aopen for a non-existing attribute
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
190
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
191 H5E_auto_t err_func;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
192 void *err_func_data;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
193
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
194 // turn off error reporting temporarily, but save the error
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
195 // reporting function:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
196
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
197 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
198 H5Eget_auto (octave_H5E_DEFAULT, &err_func, &err_func_data);
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
199 H5Eset_auto (octave_H5E_DEFAULT, 0, 0);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
200 #else
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
201 H5Eget_auto (&err_func, &err_func_data);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
202 H5Eset_auto (0, 0);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
203 #endif
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
204
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
205 hid_t attr_id = H5Aopen_name (loc_id, attr_name);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
206
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
207 if (attr_id >= 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
208 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
209 // successful
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
210 retval = true;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
211 H5Aclose (attr_id);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
212 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
213
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
214 // restore error reporting:
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
215 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
216 H5Eset_auto (octave_H5E_DEFAULT, err_func, err_func_data);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
217 #else
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
218 H5Eset_auto (err_func, err_func_data);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
219 #endif
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
220 return retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
221 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
222
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
223 bool
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
224 hdf5_get_scalar_attr (octave_hdf5_id loc_id, octave_hdf5_id type_id,
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
225 const char *attr_name, void *buf)
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
226 {
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
227 bool retval = false;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
228
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
229 // we have to pull some shenanigans here to make sure
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
230 // HDF5 doesn't print out all sorts of error messages if we
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
231 // call H5Aopen for a non-existing attribute
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
232
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
233 H5E_auto_t err_func;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
234 void *err_func_data;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
235
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
236 // turn off error reporting temporarily, but save the error
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
237 // reporting function:
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
238
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
239 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
240 H5Eget_auto (octave_H5E_DEFAULT, &err_func, &err_func_data);
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
241 H5Eset_auto (octave_H5E_DEFAULT, 0, 0);
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
242 #else
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
243 H5Eget_auto (&err_func, &err_func_data);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
244 H5Eset_auto (0, 0);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
245 #endif
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
246
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
247 hid_t attr_id = H5Aopen_name (loc_id, attr_name);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
248
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
249 if (attr_id >= 0)
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
250 {
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
251 hid_t space_id = H5Aget_space (attr_id);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
252
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
253 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
254
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
255 if (rank == 0)
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
256 retval = H5Aread (attr_id, type_id, buf) >= 0;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
257 H5Aclose (attr_id);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
258 }
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
259
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
260 // restore error reporting:
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
261 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
262 H5Eset_auto (octave_H5E_DEFAULT, err_func, err_func_data);
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
263 #else
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
264 H5Eset_auto (err_func, err_func_data);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
265 #endif
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
266 return retval;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
267 }
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
268
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
269
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
270
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
271
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
272 // The following subroutines creates an HDF5 representations of the way
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
273 // we will store Octave complex types (pairs of floating-point numbers).
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
274 // NUM_TYPE is the HDF5 numeric type to use for storage (e.g.
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
275 // H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
276 // conversions are handled automatically by HDF5.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
277
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
278 octave_hdf5_id
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
279 hdf5_make_complex_type (octave_hdf5_id num_type)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
280 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
281 hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 2);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
282
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
283 H5Tinsert (type_id, "real", 0 * sizeof (double), num_type);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
284 H5Tinsert (type_id, "imag", 1 * sizeof (double), num_type);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
285
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
286 return type_id;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
287 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
288
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
289 // This function is designed to be passed to H5Giterate, which calls it
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
290 // on each data item in an HDF5 file. For the item whose name is NAME in
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
291 // the group GROUP_ID, this function sets dv->tc to an Octave representation
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
292 // of that item. (dv must be a pointer to hdf5_callback_data.) (It also
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
293 // sets the other fields of dv).
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
294 //
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
295 // It returns 1 on success (in which case H5Giterate stops and returns),
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
296 // -1 on error, and 0 to tell H5Giterate to continue on to the next item
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
297 // (e.g. if NAME was a data type we don't recognize).
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
298
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
299 octave_hdf5_err
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
300 hdf5_read_next_data (octave_hdf5_id group_id, const char *name, void *dv)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
301 {
19739
3fa35defe495 Adjust spacing of static_cast<> calls to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
302 hdf5_callback_data *d = static_cast<hdf5_callback_data *> (dv);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
303 hid_t type_id = -1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
304 hid_t type_class_id = -1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
305 hid_t data_id = -1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
306 hid_t subgroup_id = -1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
307 hid_t space_id = -1;;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
308
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
309 H5G_stat_t info;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
310 herr_t retval = 0;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
311 bool ident_valid = valid_identifier (name);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
312
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
313 std::string vname = name;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
314
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
315 // Allow identifiers as all digits so we can load lists saved by
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
316 // earlier versions of Octave.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
317
18678
6113e0c6920b maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents: 18676
diff changeset
318 if (! ident_valid)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
319 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
320 // fix the identifier, replacing invalid chars with underscores
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
321 vname = make_valid_identifier (vname);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
322
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
323 // check again (in case vname was null, empty, or some such thing):
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
324 ident_valid = valid_identifier (vname);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
325 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
326
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
327 H5Gget_objinfo (group_id, name, 1, &info);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
328
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
329 if (info.type == H5G_GROUP && ident_valid)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
330 {
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
331 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
332 subgroup_id = H5Gopen (group_id, name, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
333 #else
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
334 subgroup_id = H5Gopen (group_id, name);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
335 #endif
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
336
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
337 if (subgroup_id < 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
338 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
339 retval = subgroup_id;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
340 goto done;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
341 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
342
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
343 if (hdf5_check_attr (subgroup_id, "OCTAVE_NEW_FORMAT"))
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
344 {
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
345 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
346 data_id = H5Dopen (subgroup_id, "type", octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
347 #else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
348 data_id = H5Dopen (subgroup_id, "type");
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
349 #endif
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
350
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
351 if (data_id < 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
352 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
353 retval = data_id;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
354 goto done;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
355 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
356
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
357 type_id = H5Dget_type (data_id);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
358
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
359 type_class_id = H5Tget_class (type_id);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
360
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
361 if (type_class_id != H5T_STRING)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
362 goto done;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
363
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
364 space_id = H5Dget_space (data_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
365 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
366
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
367 if (rank != 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
368 goto done;
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
369
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
370 int slen = H5Tget_size (type_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
371 if (slen < 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
372 goto done;
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
373
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
374 OCTAVE_LOCAL_BUFFER (char, typ, slen);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
375
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
376 // create datatype for (null-terminated) string to read into:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
377 hid_t st_id = H5Tcopy (H5T_C_S1);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
378 H5Tset_size (st_id, slen);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
379
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
380 if (H5Dread (data_id, st_id, octave_H5S_ALL, octave_H5S_ALL, octave_H5P_DEFAULT,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
381 typ) < 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
382 goto done;
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
383
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
384 H5Tclose (st_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
385 H5Dclose (data_id);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
386
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
387 d->tc = octave_value_typeinfo::lookup_type (typ);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
388
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
389 retval = (d->tc.load_hdf5 (subgroup_id, "value") ? 1 : -1);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
390
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
391 // check for OCTAVE_GLOBAL attribute:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
392 d->global = hdf5_check_attr (subgroup_id, "OCTAVE_GLOBAL");
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
393
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
394 H5Gclose (subgroup_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
395 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
396 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
397 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
398 // an HDF5 group is treated as an octave structure by
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
399 // default (since that preserves name information), and an
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
400 // octave list otherwise.
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
401
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
402 if (hdf5_check_attr (subgroup_id, "OCTAVE_LIST"))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
403 d->tc = octave_value_typeinfo::lookup_type ("list");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
404 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
405 d->tc = octave_value_typeinfo::lookup_type ("struct");
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
406
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
407 // check for OCTAVE_GLOBAL attribute:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
408 d->global = hdf5_check_attr (subgroup_id, "OCTAVE_GLOBAL");
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
409
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
410 H5Gclose (subgroup_id);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
411
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
412 retval = (d->tc.load_hdf5 (group_id, name) ? 1 : -1);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
413 }
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
414
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
415 }
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
416 else if (info.type == H5G_DATASET && ident_valid)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
417 {
20449
df4165dfc676 maint: Fix misspelled word compatibility in code comments.
Rik <rik@octave.org>
parents: 20264
diff changeset
418 // For backwards compatibility.
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
419 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
420 data_id = H5Dopen (group_id, name, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
421 #else
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
422 data_id = H5Dopen (group_id, name);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
423 #endif
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
424
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
425 if (data_id < 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
426 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
427 retval = data_id;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
428 goto done;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
429 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
430
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
431 type_id = H5Dget_type (data_id);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
432
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
433 type_class_id = H5Tget_class (type_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
434
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
435 if (type_class_id == H5T_FLOAT)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
436 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
437 space_id = H5Dget_space (data_id);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
438
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
439 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
440
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
441 if (rank == 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
442 d->tc = octave_value_typeinfo::lookup_type ("scalar");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
443 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
444 d->tc = octave_value_typeinfo::lookup_type ("matrix");
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
445
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
446 H5Sclose (space_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
447 }
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
448 else if (type_class_id == H5T_INTEGER)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
449 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
450 // What integer type do we really have..
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
451 std::string int_typ;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
452 #ifdef HAVE_H5T_GET_NATIVE_TYPE
17861
870f3e12e163 maint: Use phrase "FIXME:" for problem areas in code.
Rik <rik@octave.org>
parents: 17787
diff changeset
453 // FIXME: test this code and activated with an autoconf
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
454 // test!! It is also incorrect for 64-bit indexing!!
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
455
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
456 switch (H5Tget_native_type (type_id, H5T_DIR_ASCEND))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
457 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
458 case H5T_NATIVE_CHAR:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
459 int_typ = "int8 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
460 break;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
461
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
462 case H5T_NATIVE_SHORT:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
463 int_typ = "int16 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
464 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
465
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
466 case H5T_NATIVE_INT:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
467 case H5T_NATIVE_LONG:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
468 int_typ = "int32 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
469 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
470
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
471 case H5T_NATIVE_LLONG:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
472 int_typ = "int64 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
473 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
474
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
475 case H5T_NATIVE_UCHAR:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
476 int_typ = "uint8 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
477 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
478
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
479 case H5T_NATIVE_USHORT:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
480 int_typ = "uint16 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
481 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
482
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
483 case H5T_NATIVE_UINT:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
484 case H5T_NATIVE_ULONG:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
485 int_typ = "uint32 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
486 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
487
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
488 case H5T_NATIVE_ULLONG:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
489 int_typ = "uint64 ";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
490 break;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
491 }
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
492 #else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
493 hid_t int_sign = H5Tget_sign (type_id);
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
494
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
495 if (int_sign == H5T_SGN_ERROR)
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
496 warning ("load: can't read '%s' (unknown datatype)", name);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
497 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
498 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
499 if (int_sign == H5T_SGN_NONE)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
500 int_typ.append ("u");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
501 int_typ.append ("int");
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
502
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
503 int slen = H5Tget_size (type_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
504 if (slen < 0)
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
505 warning ("load: can't read '%s' (unknown datatype)", name);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
506 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
507 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
508 switch (slen)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
509 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
510 case 1:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
511 int_typ.append ("8 ");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
512 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
513
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
514 case 2:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
515 int_typ.append ("16 ");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
516 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
517
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
518 case 4:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
519 int_typ.append ("32 ");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
520 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
521
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
522 case 8:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
523 int_typ.append ("64 ");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
524 break;
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
525
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
526 default:
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
527 warning ("load: can't read '%s' (unknown datatype)",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
528 name);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
529 int_typ = "";
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
530 break;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
531 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
532 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
533 }
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
534 #endif
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
535 if (int_typ == "")
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
536 warning ("load: can't read '%s' (unknown datatype)", name);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
537 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
538 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
539 // Matrix or scalar?
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
540 space_id = H5Dget_space (data_id);
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
541
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
542 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
543
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
544 if (rank == 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
545 int_typ.append ("scalar");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
546 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
547 int_typ.append ("matrix");
4948
7124436476cb [project @ 2004-08-31 17:57:21 by jwe]
jwe
parents: 4805
diff changeset
548
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
549 d->tc = octave_value_typeinfo::lookup_type (int_typ);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
550 H5Sclose (space_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
551 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
552 }
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
553 else if (type_class_id == H5T_STRING)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
554 d->tc = octave_value_typeinfo::lookup_type ("string");
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
555 else if (type_class_id == H5T_COMPOUND)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
556 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
557 hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
558
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
559 if (hdf5_types_compatible (type_id, complex_type))
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
560 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
561 // read complex matrix or scalar variable
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
562 space_id = H5Dget_space (data_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
563 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
564
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
565 if (rank == 0)
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
566 d->tc = octave_value_typeinfo::lookup_type ("complex scalar");
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
567 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
568 d->tc = octave_value_typeinfo::lookup_type ("complex matrix");
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
569
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
570 H5Sclose (space_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
571 }
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
572 else
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
573 // Assume that if its not complex its a range. If its not
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
574 // it'll be rejected later in the range code
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
575 d->tc = octave_value_typeinfo::lookup_type ("range");
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
576
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
577 H5Tclose (complex_type);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
578 }
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
579 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
580 {
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
581 warning ("load: can't read '%s' (unknown datatype)", name);
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
582 retval = 0; // unknown datatype; skip
18676
5bd1ca29c5f0 Clean up questionable code bits identified by clang sanitize.
Rik <rik@octave.org>
parents: 18100
diff changeset
583 return retval;
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
584 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
585
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
586 // check for OCTAVE_GLOBAL attribute:
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
587 d->global = hdf5_check_attr (data_id, "OCTAVE_GLOBAL");
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
588
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
589 H5Tclose (type_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
590 H5Dclose (data_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
591
9881
b3089dba88bf Remove HDF5 cruft for older versions of HDF5
Kacper Kowalik
parents: 8920
diff changeset
592 retval = (d->tc.load_hdf5 (group_id, name) ? 1 : -1);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
593 }
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
594
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20945
diff changeset
595 if (! ident_valid)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
596 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
597 // should we attempt to handle invalid identifiers by converting
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
598 // bad characters to '_', say?
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
599 warning ("load: skipping invalid identifier '%s' in hdf5 file",
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
600 name);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
601 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
602
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
603 done:
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
604 if (retval < 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
605 error ("load: error while reading hdf5 item %s", name);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
606
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
607 if (retval > 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
608 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
609 // get documentation string, if any:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
610 int comment_length = H5Gget_comment (group_id, name, 0, 0);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
611
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
612 if (comment_length > 1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
613 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
614 OCTAVE_LOCAL_BUFFER (char, tdoc, comment_length);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
615 H5Gget_comment (group_id, name, comment_length, tdoc);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
616 d->doc = tdoc;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
617 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
618 else if (vname != name)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
619 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
620 // the name was changed; store the original name
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
621 // as the documentation string:
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
622 d->doc = name;
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
623 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
624
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
625 // copy name (actually, vname):
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
626 d->name = vname;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
627 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
628
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
629 return retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
630 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
631
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
632 // Read the next Octave variable from the stream IS, which must really be
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
633 // an hdf5_ifstream. Return the variable value in tc, its doc string
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
634 // in doc, and whether it is global in global. The return value is
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
635 // the name of the variable, or NULL if none were found or there was
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
636 // and error.
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
637 std::string
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
638 read_hdf5_data (std::istream& is, const std::string& /* filename */,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
639 bool& global, octave_value& tc, std::string& doc,
17709
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
640 const string_vector& argv, int argv_idx, int argc)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
641 {
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
642 check_hdf5_types ();
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19739
diff changeset
643
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
644 std::string retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
645
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
646 doc.resize (0);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
647
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5351
diff changeset
648 hdf5_ifstream& hs = dynamic_cast<hdf5_ifstream&> (is);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
649 hdf5_callback_data d;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
650
4696
fcab389ad291 [project @ 2004-01-15 02:11:59 by jwe]
jwe
parents: 4687
diff changeset
651 herr_t H5Giterate_retval = -1;
fcab389ad291 [project @ 2004-01-15 02:11:59 by jwe]
jwe
parents: 4687
diff changeset
652
fcab389ad291 [project @ 2004-01-15 02:11:59 by jwe]
jwe
parents: 4687
diff changeset
653 hsize_t num_obj = 0;
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
654 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
655 hid_t group_id = H5Gopen (hs.file_id, "/", octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
656 #else
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
657 hid_t group_id = H5Gopen (hs.file_id, "/");
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
658 #endif
5060
34a904ac130d [project @ 2004-11-02 03:08:10 by jwe]
jwe
parents: 4948
diff changeset
659 H5Gget_num_objs (group_id, &num_obj);
34a904ac130d [project @ 2004-11-02 03:08:10 by jwe]
jwe
parents: 4948
diff changeset
660 H5Gclose (group_id);
17709
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
661
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
662 // For large datasets and out-of-core functionality,
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
663 // check if only parts of the data is requested
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
664 bool load_named_vars = argv_idx < argc;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
665 while (load_named_vars && hs.current_item < static_cast<int> (num_obj))
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
666 {
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
667 std::vector<char> var_name;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
668 bool found = false;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
669 size_t len = 0;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
670
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
671 len = H5Gget_objname_by_idx (hs.file_id, hs.current_item, 0, 0);
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
672 var_name.resize (len+1);
18678
6113e0c6920b maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents: 18676
diff changeset
673 H5Gget_objname_by_idx (hs.file_id, hs.current_item, &var_name[0], len+1);
17709
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
674
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
675 for (int i = argv_idx; i < argc; i++)
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
676 {
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
677 glob_match pattern (argv[i]);
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
678 if (pattern.match (std::string (&var_name[0])))
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
679 {
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
680 found = true;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
681 break;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
682 }
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
683 }
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
684
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
685 if (found)
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
686 break;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
687
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
688 hs.current_item++;
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
689 }
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
690
5415a9cd61d4 Implement faster partial loading of HDF5 files.
Rik <rik@octave.org>
parents: 16892
diff changeset
691
4696
fcab389ad291 [project @ 2004-01-15 02:11:59 by jwe]
jwe
parents: 4687
diff changeset
692 if (hs.current_item < static_cast<int> (num_obj))
fcab389ad291 [project @ 2004-01-15 02:11:59 by jwe]
jwe
parents: 4687
diff changeset
693 H5Giterate_retval = H5Giterate (hs.file_id, "/", &hs.current_item,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
694 hdf5_read_next_data, &d);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
695
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
696 if (H5Giterate_retval > 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
697 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
698 global = d.global;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
699 tc = d.tc;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
700 doc = d.doc;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
701 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
702 else
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
703 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
704 // an error occurred (H5Giterate_retval < 0) or there are no
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
705 // more datasets print an error message if retval < 0?
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
706 // hdf5_read_next_data already printed one, probably.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
707 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
708
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
709 if (! d.name.empty ())
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
710 retval = d.name;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
711
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
712 return retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
713 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
714
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
715 // Add an attribute named attr_name to loc_id (a simple scalar
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
716 // attribute with value 1). Return value is >= 0 on success.
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
717 octave_hdf5_err
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
718 hdf5_add_attr (octave_hdf5_id loc_id, const char *attr_name)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
719 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
720 herr_t retval = 0;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
721
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
722 hid_t as_id = H5Screate (H5S_SCALAR);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
723
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
724 if (as_id >= 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
725 {
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
726 #if HAVE_HDF5_18
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
727 hid_t a_id = H5Acreate (loc_id, attr_name, H5T_NATIVE_UCHAR,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
728 as_id, octave_H5P_DEFAULT, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
729 #else
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
730 hid_t a_id = H5Acreate (loc_id, attr_name,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
731 H5T_NATIVE_UCHAR, as_id, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
732 #endif
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
733 if (a_id >= 0)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
734 {
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
735 unsigned char attr_val = 1;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
736
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
737 retval = H5Awrite (a_id, H5T_NATIVE_UCHAR, &attr_val);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
738
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
739 H5Aclose (a_id);
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
740 }
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
741 else
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
742 retval = a_id;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
743
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
744 H5Sclose (as_id);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
745 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
746 else
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
747 retval = as_id;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
748
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
749 return retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
750 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
751
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
752 octave_hdf5_err
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
753 hdf5_add_scalar_attr (octave_hdf5_id loc_id, octave_hdf5_id type_id,
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
754 const char *attr_name, void *buf)
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
755 {
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
756 herr_t retval = 0;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
757
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
758 hid_t as_id = H5Screate (H5S_SCALAR);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
759
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
760 if (as_id >= 0)
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
761 {
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
762 #if HAVE_HDF5_18
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
763 hid_t a_id = H5Acreate (loc_id, attr_name, type_id,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
764 as_id, octave_H5P_DEFAULT, octave_H5P_DEFAULT);
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
765 #else
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
766 hid_t a_id = H5Acreate (loc_id, attr_name,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
767 type_id, as_id, octave_H5P_DEFAULT);
11176
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
768 #endif
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
769 if (a_id >= 0)
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
770 {
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
771 retval = H5Awrite (a_id, type_id, buf);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
772
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
773 H5Aclose (a_id);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
774 }
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
775 else
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
776 retval = a_id;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
777
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
778 H5Sclose (as_id);
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
779 }
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
780 else
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
781 retval = as_id;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
782
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
783 return retval;
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
784 }
2271261f088a Address precision issue in ranges saved to HDF5 files
David Bateman <dbateman@free.fr>
parents: 10325
diff changeset
785
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
786 // Save an empty matrix, if needed. Returns
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
787 // > 0 Saved empty matrix
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
788 // = 0 Not an empty matrix; did nothing
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
789 // < 0 Error condition
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
790 int
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
791 save_hdf5_empty (octave_hdf5_id loc_id, const char *name, const dim_vector d)
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
792 {
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
793 hsize_t sz = d.length ();
6276
d26c558691cd [project @ 2007-02-07 09:01:24 by jwe]
jwe
parents: 5775
diff changeset
794 OCTAVE_LOCAL_BUFFER (octave_idx_type, dims, sz);
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
795 bool empty = false;
18100
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17861
diff changeset
796 hid_t space_hid = -1;
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17861
diff changeset
797 hid_t data_hid = -1;
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
798 int retval;
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
799 for (hsize_t i = 0; i < sz; i++)
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
800 {
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
801 dims[i] = d(i);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
802 if (dims[i] < 1)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
803 empty = true;
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
804 }
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
805
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20945
diff changeset
806 if (! empty)
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
807 return 0;
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
808
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5351
diff changeset
809 space_hid = H5Screate_simple (1, &sz, 0);
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
810 if (space_hid < 0) return space_hid;
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
811 #if HAVE_HDF5_18
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
812 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
813 octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
814 #else
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
815 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
816 octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
817 #endif
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
818 if (data_hid < 0)
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
819 {
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
820 H5Sclose (space_hid);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
821 return data_hid;
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
822 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
823
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
824 retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, octave_H5S_ALL, octave_H5S_ALL,
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
825 octave_H5P_DEFAULT, dims) >= 0;
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
826
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
827 H5Dclose (data_hid);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
828 H5Sclose (space_hid);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
829
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
830 if (retval >= 0)
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
831 retval = hdf5_add_attr (loc_id, "OCTAVE_EMPTY_MATRIX");
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
832
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
833 return (retval == 0 ? 1 : retval);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
834 }
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
835
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
836 // Load an empty matrix, if needed. Returns
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
837 // > 0 loaded empty matrix, dimensions returned
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
838 // = 0 Not an empty matrix; did nothing
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
839 // < 0 Error condition
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
840 int
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
841 load_hdf5_empty (octave_hdf5_id loc_id, const char *name, dim_vector &d)
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
842 {
14861
f7afecdd87ef maint: Use Octave coding conventions for cuddling parentheses in src/ directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
843 if (! hdf5_check_attr (loc_id, "OCTAVE_EMPTY_MATRIX"))
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
844 return 0;
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
845
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
846 hsize_t hdims, maxdims;
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
847 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
848 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
849 #else
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
850 hid_t data_hid = H5Dopen (loc_id, name);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
851 #endif
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
852 hid_t space_id = H5Dget_space (data_hid);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
853 H5Sget_simple_extent_dims (space_id, &hdims, &maxdims);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
854 int retval;
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
855
5351
05adf9de7657 [project @ 2005-05-16 20:07:36 by dbateman]
dbateman
parents: 5307
diff changeset
856 OCTAVE_LOCAL_BUFFER (octave_idx_type, dims, hdims);
05adf9de7657 [project @ 2005-05-16 20:07:36 by dbateman]
dbateman
parents: 5307
diff changeset
857
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
858 retval = H5Dread (data_hid, H5T_NATIVE_IDX, octave_H5S_ALL, octave_H5S_ALL,
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
859 octave_H5P_DEFAULT, dims);
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
860 if (retval >= 0)
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
861 {
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
862 d.resize (hdims);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
863 for (hsize_t i = 0; i < hdims; i++)
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
864 d(i) = dims[i];
4805
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
865 }
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
866
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
867 H5Sclose (space_id);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
868 H5Dclose (data_hid);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
869
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
870 return (retval == 0 ? hdims : retval);
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
871 }
b0d6da24caeb [project @ 2004-03-02 03:43:15 by jwe]
jwe
parents: 4726
diff changeset
872
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
873 // save_type_to_hdf5 is not currently used, since hdf5 doesn't yet support
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
874 // automatic float<->integer conversions:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
875
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
876 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
877
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
878 // return the HDF5 type id corresponding to the Octave save_type
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
879
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
880 octave_hdf5_id
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
881 save_type_to_hdf5 (save_type st)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
882 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
883 switch (st)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
884 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
885 case LS_U_CHAR:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
886 return H5T_NATIVE_UCHAR;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
887
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
888 case LS_U_SHORT:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
889 return H5T_NATIVE_USHORT;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
890
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
891 case LS_U_INT:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
892 return H5T_NATIVE_UINT;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
893
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
894 case LS_CHAR:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
895 return H5T_NATIVE_CHAR;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
896
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
897 case LS_SHORT:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
898 return H5T_NATIVE_SHORT;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
899
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
900 case LS_INT:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
901 return H5T_NATIVE_INT;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
902
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
903 case LS_FLOAT:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
904 return H5T_NATIVE_FLOAT;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
905
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
906 case LS_DOUBLE:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
907 default:
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
908 return H5T_NATIVE_DOUBLE;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
909 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
910 }
20945
9d9270e2f98f eliminate comments after preprocessor conditionals
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
911 #endif
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
912
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
913 // Add the data from TC to the HDF5 location loc_id, which could
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
914 // be either a file or a group within a file. Return true if
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
915 // successful. This function calls itself recursively for lists
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
916 // (stored as HDF5 groups).
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
917
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
918 bool
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
919 add_hdf5_data (octave_hdf5_id loc_id, const octave_value& tc,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
920 const std::string& name, const std::string& doc,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
921 bool mark_as_global, bool save_as_floats)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
922 {
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
923 hsize_t dims[3];
18100
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17861
diff changeset
924 hid_t type_id, space_id, data_id, data_type_id;
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17861
diff changeset
925 type_id = space_id = data_id = data_type_id = -1;
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17861
diff changeset
926
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
927 bool retval = false;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
928 octave_value val = tc;
8401
712cfdc2e417 allow saving diagonal & permutation matrices to hdf5 as full
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
929 // FIXME: diagonal & permutation matrices currently don't know how to save
712cfdc2e417 allow saving diagonal & permutation matrices to hdf5 as full
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
930 // themselves, so we convert them first to normal matrices using A = A(:,:).
712cfdc2e417 allow saving diagonal & permutation matrices to hdf5 as full
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
931 // This is a temporary hack.
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
932 if (val.is_diag_matrix () || val.is_perm_matrix ()
10325
8b3cfc1288e2 implement lazy index conversions
Jaroslav Hajek <highegg@gmail.com>
parents: 10315
diff changeset
933 || val.type_id () == octave_lazy_index::static_type_id ())
8914
354179c24c79 fix hdf5 saving of diag & perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8676
diff changeset
934 val = val.full_value ();
8401
712cfdc2e417 allow saving diagonal & permutation matrices to hdf5 as full
Jaroslav Hajek <highegg@gmail.com>
parents: 8377
diff changeset
935
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
936 std::string t = val.type_name ();
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
937 #if HAVE_HDF5_18
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
938 data_id = H5Gcreate (loc_id, name.c_str (), octave_H5P_DEFAULT, octave_H5P_DEFAULT,
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
939 octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
940 #else
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
941 data_id = H5Gcreate (loc_id, name.c_str (), 0);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
942 #endif
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
943 if (data_id < 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
944 goto error_cleanup;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
945
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
946 // attach the type of the variable
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
947 type_id = H5Tcopy (H5T_C_S1); H5Tset_size (type_id, t.length () + 1);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
948 if (type_id < 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
949 goto error_cleanup;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
950
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
951 dims[0] = 0;
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5351
diff changeset
952 space_id = H5Screate_simple (0 , dims, 0);
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
953 if (space_id < 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
954 goto error_cleanup;
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
955 #if HAVE_HDF5_18
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
956 data_type_id = H5Dcreate (data_id, "type", type_id, space_id,
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
957 octave_H5P_DEFAULT, octave_H5P_DEFAULT, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
958 #else
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
959 data_type_id = H5Dcreate (data_id, "type", type_id, space_id, octave_H5P_DEFAULT);
9892
ac69e6f4b33d Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
Kacper Kowalik <xarthisius.kk@gmail.com>
parents: 9881
diff changeset
960 #endif
21022
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
961 if (data_type_id < 0 || H5Dwrite (data_type_id, type_id, octave_H5S_ALL, octave_H5S_ALL,
ebc439187d29 avoid old-style cast warnings from HDF5 macros used in C++ sources
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
962 octave_H5P_DEFAULT, t.c_str ()) < 0)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
963 goto error_cleanup;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
964
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
965 // Now call the real function to save the variable
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
966 retval = val.save_hdf5 (data_id, "value", save_as_floats);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
967
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
968 // attach doc string as comment:
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
969 if (retval && doc.length () > 0
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
970 && H5Gset_comment (loc_id, name.c_str (), doc.c_str ()) < 0)
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
971 retval = false;
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
972
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
973 // if it's global, add an attribute "OCTAVE_GLOBAL" with value 1
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
974 if (retval && mark_as_global)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
975 retval = hdf5_add_attr (data_id, "OCTAVE_GLOBAL") >= 0;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
976
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
977 // We are saving in the new variable format, so mark it
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
978 if (retval)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
979 retval = hdf5_add_attr (data_id, "OCTAVE_NEW_FORMAT") >= 0;
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
980
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
981 error_cleanup:
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
982
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
983 if (data_type_id >= 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
984 H5Dclose (data_type_id);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
985
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
986 if (type_id >= 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
987 H5Tclose (type_id);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
988
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
989 if (space_id >= 0)
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
990 H5Sclose (space_id);
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
991
4687
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
992 if (data_id >= 0)
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
993 H5Gclose (data_id);
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
994
e95c86d48732 [project @ 2004-01-06 21:53:34 by jwe]
jwe
parents: 4675
diff changeset
995 if (! retval)
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
996 error ("save: error while writing '%s' to hdf5 file", name.c_str ());
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
997
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
998 return retval;
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
999 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1000
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1001 // Write data from TC in HDF5 (binary) format to the stream OS,
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1002 // which must be an hdf5_ofstream, returning true on success.
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1003
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1004 bool
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1005 save_hdf5_data (std::ostream& os, const octave_value& tc,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
1006 const std::string& name, const std::string& doc,
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
1007 bool mark_as_global, bool save_as_floats)
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1008 {
20264
bfe66db8addb don't include hdf5.h or use HDF5 typedefs in public header files (bug #43180)
John W. Eaton <jwe@octave.org>
parents: 19863
diff changeset
1009 check_hdf5_types ();
19863
09ed6f7538dd avoid needing to include hdf5 in public header files (bug #44370, #43180)
John W. Eaton <jwe@octave.org> and Mike Miller <mtmiller@ieee.org>
parents: 19739
diff changeset
1010
5760
8d7162924bd3 [project @ 2006-04-14 04:01:37 by jwe]
jwe
parents: 5351
diff changeset
1011 hdf5_ofstream& hs = dynamic_cast<hdf5_ofstream&> (os);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1012
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1013 return add_hdf5_data (hs.file_id, tc, name, doc,
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
1014 mark_as_global, save_as_floats);
4634
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1015 }
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1016
79fe96966ca0 [project @ 2003-11-19 21:22:39 by jwe]
jwe
parents:
diff changeset
1017 #endif